Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1719659pxa; Thu, 20 Aug 2020 19:51:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzn6kjnb/3oIRgf3rtuSOUww57jcytBFLhExBVZtlt/5FB+hV9fL+YitDjiX6T2lHFC0kXZ X-Received: by 2002:a05:6402:212:: with SMTP id t18mr888300edv.124.1597978266235; Thu, 20 Aug 2020 19:51:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597978266; cv=none; d=google.com; s=arc-20160816; b=FzJrGkJzxlSPmfzf8DMhyASDcas609JfHm51OKZqRoFszA6TXpwsFthz6678zqDAbG ZNpo8ljWIiTZew4sCx2VH4BC7LCG0zK+oiuwt5veHNePVwhxM7HwZauoP+wyi7KzkAME toY8mvwHyOYFsgvc76ncdhNgueLh+0r5qLKSiSi/FLa8yA4G7qAtKlZR2ZRuK/TYA3Rs f4ZM9eU6i0h+2bCXm3nmsOc8jZbnft4NzcK0WyRyoLvmAD7lR9vt1QZcPebEIoq57wFl kAlIuBe6t/H2V+N7skW6WGAxIasyYSGXCOEpUe2stbqaveQzfTstY/c5QAgTrBOue77E 3sLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=YXvlTDCObGPUKVI9bZ73dVLJwujeJvHkJebrMbFQKho=; b=ny6osJS3ITBb+6qdg0vtQXiJSEiGSBhnBSJBldOpa7Ub9j9v8Qeb5YXM1vM8EcD3xK mKkGCHb0iyTqtFUWKoGq4AoLdrmJCylh9GbFmu3GAU1vFdn8FWSec8aGPHTx7VBlbkFn hbuFHNDxpEHb/YwVHBNVL1agXsRqwfz60rYF9YJkIx8Qbcn+CmbzD1uP+5N/cVE+pr60 5QgdLw3KxEiJ05XsK8bTDim8YC1iLMdumUfucJwHF3M1oGzCz2R4nQE4y1rE268Ac2kN I9SIvFW5KLHK5y5dDuNH+zuybtJIYd2V31yDfB2Nrtz1wazxuCLdvv/Yy67HYGv9hhvW 5Zew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l18si313345edq.425.2020.08.20.19.50.42; Thu, 20 Aug 2020 19:51:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727066AbgHUCuE (ORCPT + 99 others); Thu, 20 Aug 2020 22:50:04 -0400 Received: from smtprelay0015.hostedemail.com ([216.40.44.15]:41834 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725852AbgHUCuE (ORCPT ); Thu, 20 Aug 2020 22:50:04 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay06.hostedemail.com (Postfix) with ESMTP id 8DDB11801EA45; Fri, 21 Aug 2020 02:50:02 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,joe@perches.com,,RULES_HIT:41:355:379:599:800:960:967:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2393:2525:2553:2561:2564:2682:2685:2693:2828:2859:2895:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3355:3622:3865:3866:3867:3868:3870:3871:3872:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:5007:6117:6119:6248:6691:6742:7903:9025:10004:10400:10848:10967:11026:11232:11658:11914:12043:12296:12297:12438:12555:12740:12760:12895:13439:14181:14659:14721:21080:21324:21433:21451:21627:21972:21990:30006:30012:30054:30060:30070:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:1:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: tank92_391416627035 X-Filterd-Recvd-Size: 4489 Received: from XPS-9350.home (unknown [47.151.133.149]) (Authenticated sender: joe@perches.com) by omf11.hostedemail.com (Postfix) with ESMTPA; Fri, 21 Aug 2020 02:50:00 +0000 (UTC) Message-ID: Subject: Re: [PATCH v4 3/3] media: atomisp: Only use trace_printk if allowed From: Joe Perches To: Nicolas Boichat Cc: Steven Rostedt , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andy Shevchenko , Sakari Ailus , devel@driverdev.osuosl.org, lkml , Linux Media Mailing List , Peter Zijlstra , Thomas Gleixner , Josh Poimboeuf , Douglas Anderson , Guenter Roeck Date: Thu, 20 Aug 2020 19:49:59 -0700 In-Reply-To: References: <20200820170951.v4.1.Ia54fe801f246a0b0aee36fb1f3bfb0922a8842b0@changeid> <20200820170951.v4.3.I066d89f39023956c47fb0a42edf196b3950ffbf7@changeid> <20200820102347.15d2f610@oasis.local.home> <20200820203601.4f70bf98@oasis.local.home> <20200820215701.667f02b2@oasis.local.home> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.36.4-0ubuntu1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2020-08-21 at 10:42 +0800, Nicolas Boichat wrote: > On Fri, Aug 21, 2020 at 10:36 AM Joe Perches wrote: > > On Thu, 2020-08-20 at 21:57 -0400, Steven Rostedt wrote: > > > On Fri, 21 Aug 2020 09:39:19 +0800 > > > Nicolas Boichat wrote: > > [] > > > > Some other approaches/ideas: > > > > 1. Filter all lkml messages that contain trace_printk. Already found > > > > 1 instance, and I can easily reply to those with a semi-canned answer, > > > > if I remember to check that filter regularly (not sustainable in the > > > > long run...). > > > > > > Added Joe Perches to the thread. > > > > > > We can update checkpatch.pl to complain about a trace_printk() that it > > > finds in the added code. > > > > Why? > > > > I don't see much value in a trace_printk checkpatch warning. > > tracing is still dependent on CONFIG_TRACING otherwise > > trace_printk is an if (0) > > > > ELI5 please. > > This is my "new" canned answer to this: > > Please do not use trace_printk in production code [1,2], it is only > meant for debug use. Consider using trace events, or dev_dbg. > [1] https://elixir.bootlin.com/linux/v5.8/source/kernel/trace/trace.c#L3158 > [2] https://elixir.bootlin.com/linux/v5.8/source/include/linux/kernel.h#L766 > > I also had arguments in patch 2/3 notes: > > There's at least 3 reasons that I can come up with: > 1. trace_printk introduces some overhead. [some users, e.g. > Android/Chrome OS, want CONFIG_TRACING but _not_ that extra overhead] > 2. If the kernel keeps adding always-enabled trace_printk, it will be > much harder for developers to make use of trace_printk for debugging. > 3. People may assume that trace_printk is for debugging only, and may > accidentally output sensitive data (theoretical at this stage). Perhaps make trace_printk dependent on #define DEBUG? Something like: --- include/linux/kernel.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 500def620d8f..6ca8f958df73 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -717,6 +717,7 @@ do { \ * let gcc optimize the rest. */ +#ifdef DEBUG #define trace_printk(fmt, ...) \ do { \ char _______STR[] = __stringify((__VA_ARGS__)); \ @@ -725,6 +726,12 @@ do { \ else \ trace_puts(fmt); \ } while (0) +#else +#define trace_printk(fmt, ...) \ +do { \ + __trace_printk_check_format(fmt, ##args); \ +} while (0) +#endif #define do_trace_printk(fmt, args...) \ do { \