From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEC69C433DB for ; Tue, 12 Jan 2021 00:35:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A462622D5B for ; Tue, 12 Jan 2021 00:35:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405405AbhALAZ3 (ORCPT ); Mon, 11 Jan 2021 19:25:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403959AbhAKXQU (ORCPT ); Mon, 11 Jan 2021 18:16:20 -0500 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A66C4C061795 for ; Mon, 11 Jan 2021 15:15:39 -0800 (PST) Received: by mail-ed1-x532.google.com with SMTP id by27so28551edb.10 for ; Mon, 11 Jan 2021 15:15:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=uV41K99y9lBZhpgJUjD483NFbwIW66YVKPO41Hk6TII=; b=IzAUmxfNffqtAslmKn15Tpdsa22JQCCzh+ielVhygiYrtTkSG2lTj3Y9M5eY5plNSU d/SquHXndSSp24pS9xXUSVNIX5PDA5g8FHupdxCD8tHjBn2zEImGHP1QIlIOfRSC5GkE nXKqoZ+x418viPbcpVQ8VCXofOthPk+KMLp/qCciDGt7XaXjAzFw3Z75SFPYaVtzL65H aUIClDfHrqje4PPCF65mtUvQjPkhdMpIz6P46tfCBufvb44Cf0aldvULZ6DUImVSQqMG xLph4QxaLjf5zLanANA7YX3JE3WP718cyizVC6wyBRFZQlYcziY7gThR3xfqwlWhKIKq x8ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=uV41K99y9lBZhpgJUjD483NFbwIW66YVKPO41Hk6TII=; b=dafDcLxVVt2R87QDKH85laLM6IJZp+0Q3cUFfnRTpGmLlcz3qUiO+uiGHjp+1NlNHI zop1smmsAeusa+516uTNa4yzDPxeUxBmLB8cKASPgrPo2MCgybNhGFj5BSp2XWkVvEQ+ XMLsFJLqrjeRhUCfwvYeb0GBvuTv902OxWXKms2/Ph0fVClIHfPYzHFZ4ely88TuatXv YHp9md4NIcST5H4+EBEizYMIex5v/iKoq8w6nT99uONvHPsG5Qri+VtekYYDvXTyzNoC jjJfywAiIMy/UQpEGZkpQ8drCuX7qR2WJv3P1NPrSgq+wynwCT8MZqT6UGBunq/Iw4CW tXtg== X-Gm-Message-State: AOAM533ztv8bWrqJu3APJ9MubwJKhxbSj0m7jDq88cKyXAVqBCuisqST F1BGhG1wG+6kJK7LK8sril4= X-Google-Smtp-Source: ABdhPJxwlml8TmU7WwfRRLoE39yXPi9o7WU/GfKrp3rLdjGINHKc48EAQjkIj1g3hlrvAg+oaizejw== X-Received: by 2002:aa7:d485:: with SMTP id b5mr1155568edr.214.1610406938273; Mon, 11 Jan 2021 15:15:38 -0800 (PST) Received: from skbuf (5-12-227-87.residential.rdsnet.ro. [5.12.227.87]) by smtp.gmail.com with ESMTPSA id mb15sm438444ejb.9.2021.01.11.15.15.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jan 2021 15:15:37 -0800 (PST) Date: Tue, 12 Jan 2021 01:15:35 +0200 From: Vladimir Oltean To: Saeed Mahameed Cc: "David S . Miller" , Jakub Kicinski , netdev@vger.kernel.org, Andrew Lunn , Florian Fainelli , Cong Wang , Stephen Hemminger , Eric Dumazet , George McCollister , Oleksij Rempel , Jay Vosburgh , Veaceslav Falico , Andy Gospodarek , Arnd Bergmann , Taehee Yoo , Jiri Pirko , Florian Westphal , Nikolay Aleksandrov , Pravin B Shelar , Sridhar Samudrala Subject: Re: [PATCH v6 net-next 11/15] net: catch errors from dev_get_stats Message-ID: <20210111231535.lfkv7ggjzynbiicc@skbuf> References: <20210109172624.2028156-1-olteanv@gmail.com> <20210109172624.2028156-12-olteanv@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Mon, Jan 11, 2021 at 02:54:50PM -0800, Saeed Mahameed wrote: > On Sat, 2021-01-09 at 19:26 +0200, Vladimir Oltean wrote: > > From: Vladimir Oltean > > > > dev_get_stats can now return error codes. Convert all remaining call > > sites to look at that error code and stop processing. > > > > The effects of simulating a kernel error (returning -ENOMEM) upon > > existing programs or kernel interfaces: > > > > - ifconfig and "cat /proc/net/dev" print up until the interface that > > failed, and there they return: > > cat: read error: Cannot allocate memory > > > > - ifstat and "ip -s -s link show": > > RTNETLINK answers: Cannot allocate memory > > Dump terminated > > > > Some call sites are coming from a context that returns void (ethtool > > stats, workqueue context). So since we can't report to the upper > > layer, > > do the next best thing: print an error to the console. > > > > another concern, one buggy netdev driver in a system will cause > unnecessary global failures when reading stats via netlink/procfs for > all the netdev in a netns, when other drivers will be happy to report. > > can't we just show a message in that driver's stats line about the > occurred err ? and show the normal stats line of all others ? So you're worried that user space apps won't handle an error code when reading from a file, but you're not worried that they'll start scraping junk from procfs when we print this? cat /proc/net/dev Inter-| Receive | Transmit face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed lo: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 bond0: Cannot allocate memory sit0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0