Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1039498ybt; Wed, 24 Jun 2020 18:15:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJys6XQP6XB6Ua9KPLpTC2GA4gFruACEvcityn2n9PScZTFKw4GUiyq4ztpMjdwgfCamvG1z X-Received: by 2002:a17:906:5590:: with SMTP id y16mr29011661ejp.228.1593047758292; Wed, 24 Jun 2020 18:15:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593047758; cv=none; d=google.com; s=arc-20160816; b=FflJr5qdVbXlkzyqZu9I07VyC67MCIES++eD0EhmJfoHRaXBN8zt+58x73TdnqeLD6 Fv8kHBNFRwMfpB4vhyk3vp8ICD3O0gfAVQYWz3nRssHtZDnOFwS6sf760RsNJxWrGsDL esd+eDjajTylzQpCsdBP1e+1Fo3/H7qEXdThpsqc7PRhI0VmnpxLpQ/lmqUVutVR7gmd /li/p+fwDYcUKCWETbyxeJQ1d+vRLvWU9x/8gtk0TH3PZ9sZv1z98YfM7U2vS4lTLStf WtwtPQz+xYpQJU9r3B4OCA6nWi1Ldn6IJ5qxAFmouY0jRzgz7WPUtgOOk9ToPNOjgCRR 1sMQ== 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=yd/PU2VuXCyC+PGBfj/tOPhw/fq362LdKGFogKdH6dQ=; b=x/LxN/sLzMUCNs+JmPRL5Zy0JzJfR2SEWUL4Oy68moaTzfa++zSiTRPdmcCR4QVevK Lyhd/ewFObK9QpH/RGCWl+F/aEDhKZz0HuWj/NeS6ANAZmvQ9k+jAvgVxdXfojbQEUWH Eg2WKqEkPH2GntgigP5/gdybJ/BcoTa0TqfhoZdWIOZc3mfnZQU/Z5xBRLSVvbwS0Uac jW4YleaZ8qpY/TbC0cXFXz+bB9dNWeA49fMhcwWRh4n1yuTALFBaeAa/RRtYxiPfS4Ee u7HsKQR7EoIBs30VIIMmfZs0/gfa/RrhVO5XQtPV2ieZ2pETEcuiELYmadM7PDFJTZ7N 7XXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jFpeUDDb; 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 p23si4187040ejz.151.2020.06.24.18.15.31; Wed, 24 Jun 2020 18:15:58 -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=jFpeUDDb; 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 S2388930AbgFYBNa (ORCPT + 99 others); Wed, 24 Jun 2020 21:13:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388789AbgFYBNa (ORCPT ); Wed, 24 Jun 2020 21:13:30 -0400 Received: from mail-vk1-xa43.google.com (mail-vk1-xa43.google.com [IPv6:2607:f8b0:4864:20::a43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAE35C061573 for ; Wed, 24 Jun 2020 18:13:29 -0700 (PDT) Received: by mail-vk1-xa43.google.com with SMTP id x126so1025206vkb.1 for ; Wed, 24 Jun 2020 18:13:29 -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=yd/PU2VuXCyC+PGBfj/tOPhw/fq362LdKGFogKdH6dQ=; b=jFpeUDDb3Q12nPIetx9tHwWUXCdCPqmYgqO3AocKZnBHoE2f6aY6srfCjwIS/PyOkI EIogltEO+iQ/5vcXFOysuZ0HXTs6lDIWHjk7r4tWk82usu7zIbk87aDe7skzef9GZLSu 1aliXE9GSq50dJecN6mhX9M9QpFyZhE0bvWPA= 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=yd/PU2VuXCyC+PGBfj/tOPhw/fq362LdKGFogKdH6dQ=; b=hFBjzWO0B6EhygteM1bNIkR+a50h0gnku6RxUm+40Q4nHw4++DzfAdnSyN+jX8AkTX bh7QI1HXE4n6vkIbBcLDex8bqQP2IrPnNItvTRT5/j8k4JicyDHfmmPoPElL3O6VY2mW Ktv9QlyH+Wgna19TMiYWTh9uBysowsf4r+MFoj4uL1WzIxxk/dwT7RYliR5i7C2Z1ieS /f79d30ATzXZ+rlzZ0EJ7wOoJbvHFpdDM4ae34bMqYAHGVTsIy3HlOpt+CRVM7EM3vhP ueBVjKx33dPfc0XZIins4Fp1vqJRr6UegZ2+33XtkNfsZLg+haMV9zNGaNTyJJtgGYgH +Bkw== X-Gm-Message-State: AOAM5337ygzyfLJzl1rCHRDXfGGcRyCBARULPrPRFRWklE7JrwQjZKAo jCc7rPnz/pFjFZayrVggHERIZOFk3qPgrCCwbN2hfQ== X-Received: by 2002:a1f:3d47:: with SMTP id k68mr13296326vka.68.1593047608816; Wed, 24 Jun 2020 18:13:28 -0700 (PDT) MIME-Version: 1.0 References: <20200624084524.259560-1-drinkcat@chromium.org> <20200624135722.GF6578@ziepe.ca> In-Reply-To: <20200624135722.GF6578@ziepe.ca> From: Nicolas Boichat Date: Thu, 25 Jun 2020 09:13:17 +0800 Message-ID: Subject: Re: [PATCH] kernel/trace: Add TRACING_ALLOW_PRINTK config option To: Jason Gunthorpe Cc: lkml , Steven Rostedt , Ingo Molnar , Andrew Morton , Kees Cook , Daniel Vetter , Peter Zijlstra , Vinod Koul , Andy Shevchenko , Alexey Dobriyan , Tiezhu Yang , Thomas Gleixner , "Guilherme G . Piccoli" , Will Deacon , Douglas Anderson , Guenter Roeck 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 Wed, Jun 24, 2020 at 9:57 PM Jason Gunthorpe wrote: > > On Wed, Jun 24, 2020 at 04:45:24PM +0800, Nicolas Boichat wrote: > > trace_printk is only meant as a debugging tool, and should never be > > compiled into production code without source code changes, as > > indicated by the warning that shows up on boot if any trace_printk > > is called: > > ** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE ** > > ** ** > > ** trace_printk() being used. Allocating extra memory. ** > > ** ** > > ** This means that this is a DEBUG kernel and it is ** > > ** unsafe for production use. ** > > > > If this option is set to n, the kernel will generate a build-time > > error if trace_printk is used. > > > > Signed-off-by: Nicolas Boichat > > include/linux/kernel.h | 17 ++++++++++++++++- > > kernel/trace/Kconfig | 9 +++++++++ > > 2 files changed, 25 insertions(+), 1 deletion(-) > > > > diff --git a/include/linux/kernel.h b/include/linux/kernel.h > > index 196607aaf653082..b6addc6ba669e85 100644 > > +++ b/include/linux/kernel.h > > @@ -721,10 +721,15 @@ do { \ > > #define trace_printk(fmt, ...) \ > > do { \ > > char _______STR[] = __stringify((__VA_ARGS__)); \ > > + \ > > + __static_assert( \ > > + IS_ENABLED(CONFIG_TRACING_ALLOW_PRINTK),\ > > + "trace_printk called, please enable CONFIG_TRACING_ALLOW_PRINTK."); \ > > + \ > > Why __static_assert not normal static_assert? Oh, I misread the macro code (and didn't read the comment above in include/linux/build_bug.h). static_assert would be just fine. > > Jason