Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1724893pxa; Thu, 20 Aug 2020 20:02:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzx5y+uIFp5kh92+bMu3c4N2KvOMx72TLsmmwvPleK37OgU9MeZj+kujuFVM93Ajvq8m6m X-Received: by 2002:a17:906:c187:: with SMTP id g7mr979173ejz.108.1597978942279; Thu, 20 Aug 2020 20:02:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597978942; cv=none; d=google.com; s=arc-20160816; b=L/HNW5cfOEVGjKvuYE6/yT291luxAMSoG+rX1/tilMD4H6Wd98uay+s0jNnm9lQb5d 0MHqBa/zvJRzXjQrL98Hn0sDPN8IZsK2Zbf7j8JPcjxzFaQnJgLeqChdCBDwEiKxRzjZ 4UuMllJhJsx+dzTfZHuTZfz/IeZGALBdKZ8KWuWB9I7GnkZki9ObsHPSDFImuA+VWHR2 PRqa1KakFQWRVQeQEaUiDp6SC7NUWIQk4+qKXyCIbvjomFuBqQUgrYebQlcU4+mOSB6Z qqppSFAZU7oS1pDf0VbvM6KZOiCb5Ue1KRWpthfiXNuKfk+bEbonPNiwLYyu4M3GHPB3 NFBA== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=2VkwOx23MOxjOCWsKcQ7naPFtAuB7YX3Qyq8fXeDYLg=; b=gSYAKrwH59XAA9ztdezZu2iiyI2gPnGgV7L5jK8V3O7ZVooaF9C6V0nK7DJ1os2v8v ekWDQ1pT+PuZKADmtz+4Fnmc5Q2YOCqmG+/es19n2cpbrqXWA6GjjVDYTi3mWZA2wSH4 lgcBXrIDz0MRg+R4KYogKjp4FP+b2JLzscAXMgiKGihSx8KMj2AQdkIB6XFCdNIY/rgK igvGMx8HINxbq1KovZ9S6I7kcSFFBEN7rd6ydomP5D8MBHHqcKBIfHSXaQFUAmyMrqae J6TNSqP5RKW+OSofOQtoDn6qyPoJtkvBFwmDKFv7UE3kGqgkMh2bLPxL3dIlO/cAdR6F RX0w== 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 u23si347657edr.459.2020.08.20.20.01.58; Thu, 20 Aug 2020 20:02:22 -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 S1727063AbgHUDBJ (ORCPT + 99 others); Thu, 20 Aug 2020 23:01:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:34708 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725852AbgHUDBI (ORCPT ); Thu, 20 Aug 2020 23:01:08 -0400 Received: from oasis.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A1EF220732; Fri, 21 Aug 2020 03:01:06 +0000 (UTC) Date: Thu, 20 Aug 2020 23:01:05 -0400 From: Steven Rostedt To: Nicolas Boichat 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 Subject: Re: [PATCH v4 3/3] media: atomisp: Only use trace_printk if allowed Message-ID: <20200820230105.1f9651b7@oasis.local.home> 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> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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, 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. -- 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) /**