Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4210969ybf; Tue, 3 Mar 2020 22:57:56 -0800 (PST) X-Google-Smtp-Source: ADFU+vs/IdXGO+cYdOfAUKz/IYILRnkOjvQ2SNqs+WDd/PkMNzzY5l3sMx3BNvsHS/DX7+swBPK/ X-Received: by 2002:a05:6808:4c2:: with SMTP id a2mr764554oie.118.1583305076711; Tue, 03 Mar 2020 22:57:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583305076; cv=none; d=google.com; s=arc-20160816; b=PvZNDmiwQEDP0X9ha9OotrVUQPvWkrr8Cy1p8htZ525WX6/QykJX87SBpHMz26/5QD OdGTqBNlaHwfm3uUclvrODuVbh/SqKPy8IJed3pzD8UvHLSFLbu4qsmMydAEmSoz9MFT gSjYioHrR2iN/1sCyy/ZEVR9TtmeY7vN3zHdiewlITewggsSLAdW1hAZsg5ERcDzW/uO 7ZSsLNrFoOprLXbnElu0UHS0Ms7zUoAyyNm8jx+PMYEl01OSMZt4rMxN934vKW9y7Kzz S7HuYMdq3pLaNqH30H6EHwTKCR1Ojon5E4wIF5em/0olkbJmZsWxBHdQnzCVy+SMBgnr tjaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=35jKOnziD1U3uOOHCc4j7HvW5xxkKRfLpA3V8RJ+hx4=; b=PvlSglythTJXsQNeMbPA83vOUgn4QSwVoYYXWqh0qYmgBIY1zwp2h6UtSPasm5v2uN kUs5zx11o6K9AOTJPAE5hr1Ie6JHJyXF/9vXgmUx5fKC/H6X62AbeSXSItrRRBGm1x1y 9LpdVfCnPPoh9dhk7Hhd4c+v/zTJ5/p1URwYl3HSXPgv4OUQ2tAvT5Jp42dJUHMoOHLo 758AQJ2HZJoSQrFjIucTLZDh2Nca6G9ZgQzZmLkOb6VBw7sUSIoPI51sHKgFotldOKEb iaWpHKNIWAmQ/vBQmIGQ83P8eCn7IDwjdDgL10WYrUdMty4ivlmgoZp2xrqEWp3vE8KK CKpQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d11si574253otf.135.2020.03.03.22.57.45; Tue, 03 Mar 2020 22:57:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728475AbgCDG5l (ORCPT + 99 others); Wed, 4 Mar 2020 01:57:41 -0500 Received: from mx2.suse.de ([195.135.220.15]:52102 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728273AbgCDG5l (ORCPT ); Wed, 4 Mar 2020 01:57:41 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 331A1B265; Wed, 4 Mar 2020 06:57:38 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id 5650CE037F; Wed, 4 Mar 2020 07:57:38 +0100 (CET) Date: Wed, 4 Mar 2020 07:57:38 +0100 From: Michal Kubecek To: David Miller Cc: kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] tun: fix ethtool_ops get_msglvl and set_msglvl handlers Message-ID: <20200304065738.GG4264@unicorn.suse.cz> References: <20200303082252.81F7FE1F46@unicorn.suse.cz> <20200303.145916.1506066510928020193.davem@davemloft.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200303.145916.1506066510928020193.davem@davemloft.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 03, 2020 at 02:59:16PM -0800, David Miller wrote: > From: Michal Kubecek > Date: Tue, 3 Mar 2020 09:22:52 +0100 (CET) > > > The get_msglvl and setmsglvl handlers only work as expected if TUN_DEBUG > > is defined (which required editing the source). Otherwise tun_get_msglvl() > > returns -EOPNOTSUPP but as this handler is not supposed to return error > > code, it is not recognized as one and passed to userspace as is, resulting > > in bogus output of ethtool command. The set_msglvl handler ignores its > > argument and does nothing if TUN_DEBUG is left undefined. > > > > The way to return EOPNOTSUPP to userspace for both requests is not to > > provide these ethtool_ops callbacks at all if TUN_DEBUG is left undefined. > > > > Signed-off-by: Michal Kubecek > > I agree with your analysis. > > But this TUN_DEBUG thing stands outside of what we let drivers do. Either > this tracing is not so useful and can be deleted, or the tracing should > be available unconditionally so that it can be turned on by the vast > majority of users who do not edit the source. > > I suspect making the TUN_DEBUG code unconditional is that way to go here. I started to think in this direction too and ended up with - DBG1() macro checks a variable which is never set; it's also used only in one place which doesn't seem to differ from others where tun_debug() is used - many tun_debug() calls can be dropped as they only inform about entering a function and sometimes show some if its arguments; we have ftrace and kprobes for that - the rest should be rewritten to netif_info() - the two tun_debug() in packet processing path could use netif_dbg() to avoid overhead when not turned on ...which is where I stopped and went with the quick fix instead. On the other hand, there is no rush, the issue seems to exist since before git. And unlike some other drivers doing strange things for debugging, tun is widely used so it deserves a cleanup. I'll send a patch (or patches) with proper cleanup for net-next. Michal