Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp208194pxa; Fri, 21 Aug 2020 05:22:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxZn3MNpMCi8sOH5tYvIxSgOVzxptdW07W0H8y/Iwl1phOm/6U1Im7k9lKP7Fmsc5VbQVs X-Received: by 2002:a17:906:3f82:: with SMTP id b2mr2754679ejj.240.1598012558856; Fri, 21 Aug 2020 05:22:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598012558; cv=none; d=google.com; s=arc-20160816; b=B6EQb8kAhC0HD0A6M1As4v4Kob4qCgGwpIyG2KL8tNmvFb46lzaYXc4oeEWqsFEjKq 9zdLuAfv/q3HBXvLNRgBcYo8bjHwnzOaxPbZ51Q/wN180zdNzUA5a3Fvd6XnzkLnaTg6 nCUIgcQI6OVUkRoIWjZg6ma3JjIgGTfyZIUcerMwbuwbsqmOtEk4BOa/9VqNYvmTymxA fbuPBTiaqPjhwDtvp5xqIAWRPbGZkBqoKuwFKf4eK3zPTHQ9UwgC4+AzRNmNyTWcISz6 wWsFqAvxOFbbktmGsuXu0+/YufonTkaCpegVMh/5hh5FqA4zk6S1e5hJTwSkGQeLnRZi 2O9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=52w1cJUaQ9YanpUGNy0nDzv1xTgiDNv65mHDcwVGT/k=; b=sKc2vYXsat2++3NpobDGZ1xlZIE4un5o90awxDwMy6oPT5oIoz3RA/hPcQT4VnaV+Y DOn8YIMeLZhX8LaB8b+pWUpaj/Tz8W84aTWalyaGI8BdhZlF+wWCbj30Ij3C4rE6acKd 4RqaccxWHneH/opOgh+2MRNbeOpdpjB643G6/sw3KnbZUh7FIOkqdOg7T25e865qsjY7 imaOBxC+lIJvyPhhcru+rTy/LggbG5r2Mg8LEKPTyObB2aYCudKMpROfOHi4tw3NxYVL Ln+jgvC3SLUbBNByBM7WnHtgTYYojqXLkFmTMgxG/VEwuYT67fm1P1kgxa1aUOquEMW5 jEYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ma8DyBTi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u17si1029142ejt.560.2020.08.21.05.22.15; Fri, 21 Aug 2020 05:22:38 -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; dkim=pass header.i=@chromium.org header.s=google header.b=ma8DyBTi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728516AbgHUMVC (ORCPT + 99 others); Fri, 21 Aug 2020 08:21:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728344AbgHUMUH (ORCPT ); Fri, 21 Aug 2020 08:20:07 -0400 Received: from mail-vs1-xe41.google.com (mail-vs1-xe41.google.com [IPv6:2607:f8b0:4864:20::e41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36B76C061387 for ; Fri, 21 Aug 2020 05:20:06 -0700 (PDT) Received: by mail-vs1-xe41.google.com with SMTP id j188so718491vsd.2 for ; Fri, 21 Aug 2020 05:20:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=52w1cJUaQ9YanpUGNy0nDzv1xTgiDNv65mHDcwVGT/k=; b=ma8DyBTio5H7kC0GIQ2hYvDq/OC2i1mxC0vGTCsokkwIOce8mzt3dmwWQ2pc7uHqhw GQjt7ejyzZqestweM11fLlNXDcO8dJAf767AZFt9DXZcnqF9FCaUBsu+nP3DBFbWA/8H m9IprTGaVujoL/pcNzqE6hjgEPBKQmEx73Tck= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=52w1cJUaQ9YanpUGNy0nDzv1xTgiDNv65mHDcwVGT/k=; b=Y+yIgeuQLbqp44Xr2XJ3RFEdmZlbyTNno5ClbzfKZ4UvWh11aUxLGfX+cwJnfO4BRI HUpVIVM8DUjKfvXNfnHVEmdZPhOARE4gnIc+kVykwebbc7Dqej38WtiF2zESqoj6X1rx siEjCLf21A7wJ7svuaWBj9bzx7fAtshoA3N0heMnngmXLyZ0XiqDo7Gzs6PNoO3O0is6 q04o+7Rm/KHdSrRBxiwsu3MvXJlcxRsjCO/6+jBOTu3XEE3KUj/z4/StMknUpg+e9AAt 1yO4GOeetb4qWXtXHOLZg3heDPojpzbKgDRYjkuXBO59Su5HyR8nigKKLPwMbU8nYXjc Rhjg== X-Gm-Message-State: AOAM530cau2j/mAqP8dMgwWTM+4zJlLbEIK+/t1o8yjamy09ebC5VkPG PAmmrDIcGbzxmiNuWSJWIGOpV89Fgm+WXuw3LznTtQ== X-Received: by 2002:a05:6102:1ca:: with SMTP id s10mr1289867vsq.14.1598012403767; Fri, 21 Aug 2020 05:20:03 -0700 (PDT) MIME-Version: 1.0 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> <20200820230105.1f9651b7@oasis.local.home> In-Reply-To: <20200820230105.1f9651b7@oasis.local.home> From: Nicolas Boichat Date: Fri, 21 Aug 2020 20:19:52 +0800 Message-ID: Subject: Re: [PATCH v4 3/3] media: atomisp: Only use trace_printk if allowed To: Steven Rostedt Cc: 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 , Joe Perches Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 21, 2020 at 11:01 AM Steven Rostedt wrote: > > On Fri, 21 Aug 2020 10:39:02 +0800 > Nicolas Boichat wrote: > > > I'm not sure how that helps? I mean, the use case you have in mind is > > somebody reusing a distro/random config and not being able to use > > trace_printk, right? If that config has CONFIG_DISABLE_TRACE_PRINTK=y, > > then the developer will still need to flip that back. > > > > Note that the option I'm added has default=y (_allow_ trace_printk), > > so I don't think default y or default n really matters? > > Ideally, the production system doesn't have it set. It only sets it to > make sure that it's clean before sending out. But then it can add it > back before production. Yeah, it's pretty much cutting hairs between > the two. I don't like either one. > > Really, if you are worried about this, just add your patch to your > local tree. I'm not sure this is something that can be fixed upstream. > > Another idea is to add something like below, and build with: > > make CHECK_TRACE_PRINT=1 > > This way it is a build command line option that causes the build to > fail if trace_printk() is added. > > This way production systems can add this to make sure their kernels are > free of trace_printk() but it doesn't affect the config that is used. (for some reason I missed this reply in the thread ,-P) Thanks, that's quite a nice idea, I'll try it out (not sure if we still want that build_assert trick). We'd lose the automatic detection of issues through randconfig kernel test robot, but hopefully if enough distros enable it they'll start filing reports about issues. And maybe we can use that in combination with a checkpatch.pl check. (it turns out I'm having a hard time finding a good spot for this test in our Chrome OS build infra, so an upstream-friendly solution would be much better ,-P) > > -- Steve > > [ Not even compiled tested! ] > > diff --git a/Makefile b/Makefile > index 2057c92a6205..5714a738879d 100644 > --- a/Makefile > +++ b/Makefile > @@ -91,6 +91,13 @@ else > Q = @ > endif > > +ifeq ("$(origin CHECK_TRACE_PRINTK)", "command line") > + KBUILD_NO_TRACE_PRINTK = $(NO_TRACE_PRINTK) > +endif > +ifndef KBUILD_NO_TRACE_PRINTK > + KBUILD_NO_TRACE_PRINTK = 0 > +endif > + > # If the user is running make -s (silent mode), suppress echoing of > # commands > > @@ -839,6 +846,10 @@ KBUILD_AFLAGS += -gz=zlib > KBUILD_LDFLAGS += --compress-debug-sections=zlib > endif > > +ifeq ($(KBUILD_NO_TRACE_PRINTK),1) > +KBUILD_CFLAGS += -DNO_TRACE_PRINTK > +endif > + > KBUILD_CFLAGS += $(DEBUG_CFLAGS) > export DEBUG_CFLAGS > > diff --git a/include/linux/kernel.h b/include/linux/kernel.h > index 500def620d8f..bee432547d26 100644 > --- a/include/linux/kernel.h > +++ b/include/linux/kernel.h > @@ -680,11 +680,14 @@ extern void tracing_stop(void); > static inline __printf(1, 2) > void ____trace_printk_check_format(const char *fmt, ...) > { > +#ifdef NO_TRACE_PRINTK > + extern void __no_trace_printk_on_build(void); > + __no_trace_printk_on_build(); > +#endif > } > #define __trace_printk_check_format(fmt, args...) \ > do { \ > - if (0) \ > - ____trace_printk_check_format(fmt, ##args); \ > + ____trace_printk_check_format(fmt, ##args); \ > } while (0) > > /**