From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44FC4C433DF for ; Fri, 21 Aug 2020 12:37:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 13ACF207DA for ; Fri, 21 Aug 2020 12:37:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="B+XDozwp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728284AbgHUMh3 (ORCPT ); Fri, 21 Aug 2020 08:37:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727104AbgHUMh2 (ORCPT ); Fri, 21 Aug 2020 08:37:28 -0400 Received: from mail-vs1-xe42.google.com (mail-vs1-xe42.google.com [IPv6:2607:f8b0:4864:20::e42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8546C061386 for ; Fri, 21 Aug 2020 05:37:27 -0700 (PDT) Received: by mail-vs1-xe42.google.com with SMTP id r7so733513vsq.5 for ; Fri, 21 Aug 2020 05:37:27 -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=HUgN6ieJhIl8uII5WpVu/u5z15uJplqpBcG4NHNK9Tk=; b=B+XDozwpX0mgDxmJ6B/TSWbBDUbxlXICDWzTZ0j1JZrwcVr7nlDnFEkAXLfjy9/mv8 htZLil76tPTHeIHrsH8uDlSs0MDekxxkQFL5tatwS+M8PXeS8Las4CgSNBfkRPfZZY5n Db2XXy4qs3y2Ha+4PSmAEzBhK26XXt/hZh7Hk= 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=HUgN6ieJhIl8uII5WpVu/u5z15uJplqpBcG4NHNK9Tk=; b=ZDRz70Qem2dsGJTomxl9drfqxtuLXU0NlLqRyQCkVj6m+9Im17o7AuItGpViIpfHOc L8E+qiCg7LEWY1auIt/3qBbpQlcNARCsdGj3GJi9tgM7NoKXI3Wfi+Wv/VXroqeFs6oF hF2C6YM7KoMz4GEyR6H82HgtzDoz1Ga8vq9OkTIm6SoKUpYl70wjUlFvIG3frGwmssDO 7OO4LSFNRiYGndrpJqbg4EHeFJKup4+hqSHS/f3CaSQ3k/x7R4VxAi2ToD+JzwS63+n6 cv4IQOUvTFIWKq59qzZFt/u2mqGzQaeSLnjxdrosN3k4zgWLI0l5KrCpxgKR6zUIWfUi aFbg== X-Gm-Message-State: AOAM530Zb08zwJ5tbk4TxTo5wp3rqQ0Pl3+qYtpNHnQmuh3fzjFv5+AE JIF9B5uGxa53IMlOXAJB4R1Zl2ZOgpQQqV7NgnJYlA== X-Google-Smtp-Source: ABdhPJygLjeX9qF2zIlcXZqIhRvgUeRfApyD41pRd420Ijd4idtK0rAzzpbRlTzYydU7YTYMB4F1QwLFqPlRNMYVFDE= X-Received: by 2002:a67:f787:: with SMTP id j7mr1403877vso.79.1598013446831; Fri, 21 Aug 2020 05:37:26 -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> <21fae92da07c4566ba4eed3b5e1bce2d@AcuMS.aculab.com> <898c56e4b7ef4c3da1d634fdef5a8898@AcuMS.aculab.com> <6c5249afad274ce49e643d9b05706e3a@AcuMS.aculab.com> In-Reply-To: <6c5249afad274ce49e643d9b05706e3a@AcuMS.aculab.com> From: Nicolas Boichat Date: Fri, 21 Aug 2020 20:37:15 +0800 Message-ID: Subject: Re: [PATCH v4 3/3] media: atomisp: Only use trace_printk if allowed To: David Laight 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 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 8:18 PM David Laight wrote: > > From: Nicolas Boichat > > Sent: 21 August 2020 13:07 > ... > > > You might also want a #define that can set temporarily > > > to enable traces in a specific file/module even though > > > CONFIG_TRACE=n. > > > > I don't understand how traces are supposed to work with CONFIG_TRACE=n? > > Probably because I meant something different :-) > > You want the kernel built so that there are no (expanded) > calls to trace_printf() but with support for modules that > contain them. > > Then I can load a module into a distro kernel that > contains trace_printf() calls for debug testing. Gotcha. I think it already works this way ,-) So if you have CONFIG_TRACE=y, but no trace_printk in your vmlinux/kernel, no memory is used, and no warning splat (https://elixir.bootlin.com/linux/v5.8/source/kernel/trace/trace.c#L3160) is displayed. But then when you load a module with trace_printk, the buffers are allocated and the warning splat is printed. The magic is here: https://elixir.bootlin.com/linux/v5.8/source/kernel/trace/trace_printk.c#L53 My option wouldn't really change that. I mean, if you have CONFIG_TRACING_ALLOW_PRINTK=n when you compile your module, it'd fail at build time, but if you set it to =y, your module could happily build and load (with the big warning splat), no matter how you built your kernel (I mean, you still need CONFIG_TRACE=y, but CONFIG_TRACING_ALLOW_PRINTK doesn't matter). > Which is why I was suggesting a config option that > only rand-config builds would ever set that would > cause the calls to generate compile-time errors. I think I already answered that one above. We'd want that config option enabled on Chrome OS and we're not a rand-config build (I mean, we're a very carefully selected random config ,-P). Thanks, > > David > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > Registration No: 1397386 (Wales) From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45B57C433DF for ; Fri, 21 Aug 2020 12:37:36 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0C70820724 for ; Fri, 21 Aug 2020 12:37:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="B+XDozwp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C70820724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=driverdev-devel-bounces@linuxdriverproject.org Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8E312203B5; Fri, 21 Aug 2020 12:37:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PM0QxJSeKBZ5; Fri, 21 Aug 2020 12:37:31 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 4DE3922270; Fri, 21 Aug 2020 12:37:31 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 9C42C1BF2BC for ; Fri, 21 Aug 2020 12:37:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 73C9222270 for ; Fri, 21 Aug 2020 12:37:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3rAh5YtXG6tA for ; Fri, 21 Aug 2020 12:37:28 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-vs1-f65.google.com (mail-vs1-f65.google.com [209.85.217.65]) by silver.osuosl.org (Postfix) with ESMTPS id 114F9203B5 for ; Fri, 21 Aug 2020 12:37:28 +0000 (UTC) Received: by mail-vs1-f65.google.com with SMTP id o184so740265vsc.0 for ; Fri, 21 Aug 2020 05:37:28 -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=HUgN6ieJhIl8uII5WpVu/u5z15uJplqpBcG4NHNK9Tk=; b=B+XDozwpX0mgDxmJ6B/TSWbBDUbxlXICDWzTZ0j1JZrwcVr7nlDnFEkAXLfjy9/mv8 htZLil76tPTHeIHrsH8uDlSs0MDekxxkQFL5tatwS+M8PXeS8Las4CgSNBfkRPfZZY5n Db2XXy4qs3y2Ha+4PSmAEzBhK26XXt/hZh7Hk= 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=HUgN6ieJhIl8uII5WpVu/u5z15uJplqpBcG4NHNK9Tk=; b=OQ1/iFneh+zUXrcBKwBBT8YNEguS+zVmx2kJy5PUAL99zTrHdATDgK4UJEZaWlGKLK Oni3Kp2AcHejAoJcPjktjRtgXo5O4QNQrw5VDg7MTUl8/U2uxu8MDMryjOja7m2q2Lax dVjoq8rZnfbQYNJk4nlb7myENOqhi+rt37ousnLH5NKAjBjmWULqK6OweL0BvRhqUmV2 MhZUU+FmJd5jUK5+nwqESlF0lTX1T5c3Ad+qFRupdRGLDFtiUbFO8KoCOlSPod2LDurA A7s1fYJd0cuY9PM19cSYsTxy2D3XOgTiBMbFC2OUG/6wbu23IBDvLzRem1RQ+8wjzsQp 376w== X-Gm-Message-State: AOAM533EGhOp93QBkEaPEXolazAKancR3jcB/8IA+SkqIkSak06oypkw ZbAjlsKMri4lLbpIRQ5jmVmDytpuFM2p4IfMg6xZ3xTrxZWrEw== X-Google-Smtp-Source: ABdhPJygLjeX9qF2zIlcXZqIhRvgUeRfApyD41pRd420Ijd4idtK0rAzzpbRlTzYydU7YTYMB4F1QwLFqPlRNMYVFDE= X-Received: by 2002:a67:f787:: with SMTP id j7mr1403877vso.79.1598013446831; Fri, 21 Aug 2020 05:37:26 -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> <21fae92da07c4566ba4eed3b5e1bce2d@AcuMS.aculab.com> <898c56e4b7ef4c3da1d634fdef5a8898@AcuMS.aculab.com> <6c5249afad274ce49e643d9b05706e3a@AcuMS.aculab.com> In-Reply-To: <6c5249afad274ce49e643d9b05706e3a@AcuMS.aculab.com> From: Nicolas Boichat Date: Fri, 21 Aug 2020 20:37:15 +0800 Message-ID: Subject: Re: [PATCH v4 3/3] media: atomisp: Only use trace_printk if allowed To: David Laight X-BeenThere: driverdev-devel@linuxdriverproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "devel@driverdev.osuosl.org" , Andy Shevchenko , Peter Zijlstra , Greg Kroah-Hartman , lkml , Steven Rostedt , Sakari Ailus , Josh Poimboeuf , Thomas Gleixner , Mauro Carvalho Chehab , Linux Media Mailing List Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" On Fri, Aug 21, 2020 at 8:18 PM David Laight wrote: > > From: Nicolas Boichat > > Sent: 21 August 2020 13:07 > ... > > > You might also want a #define that can set temporarily > > > to enable traces in a specific file/module even though > > > CONFIG_TRACE=n. > > > > I don't understand how traces are supposed to work with CONFIG_TRACE=n? > > Probably because I meant something different :-) > > You want the kernel built so that there are no (expanded) > calls to trace_printf() but with support for modules that > contain them. > > Then I can load a module into a distro kernel that > contains trace_printf() calls for debug testing. Gotcha. I think it already works this way ,-) So if you have CONFIG_TRACE=y, but no trace_printk in your vmlinux/kernel, no memory is used, and no warning splat (https://elixir.bootlin.com/linux/v5.8/source/kernel/trace/trace.c#L3160) is displayed. But then when you load a module with trace_printk, the buffers are allocated and the warning splat is printed. The magic is here: https://elixir.bootlin.com/linux/v5.8/source/kernel/trace/trace_printk.c#L53 My option wouldn't really change that. I mean, if you have CONFIG_TRACING_ALLOW_PRINTK=n when you compile your module, it'd fail at build time, but if you set it to =y, your module could happily build and load (with the big warning splat), no matter how you built your kernel (I mean, you still need CONFIG_TRACE=y, but CONFIG_TRACING_ALLOW_PRINTK doesn't matter). > Which is why I was suggesting a config option that > only rand-config builds would ever set that would > cause the calls to generate compile-time errors. I think I already answered that one above. We'd want that config option enabled on Chrome OS and we're not a rand-config build (I mean, we're a very carefully selected random config ,-P). Thanks, > > David > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > Registration No: 1397386 (Wales) _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel