Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2470817rwd; Wed, 14 Jun 2023 03:23:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7YtvX+w+/HUfHOE62SbyKkcquxyp4xejOCTBxHkDjscU30accPMODWJq/SOWjqC0kROCJD X-Received: by 2002:a17:902:b585:b0:1af:de3d:bbe6 with SMTP id a5-20020a170902b58500b001afde3dbbe6mr11183790pls.2.1686738186825; Wed, 14 Jun 2023 03:23:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686738186; cv=none; d=google.com; s=arc-20160816; b=EjungKJM2Ac6FRrlGE7EHfxRS1/Y0KPGMB1pDY9Kl/2f6zQJbZaBfVmTVvLcW0YfM2 UTRaa2PPRFEyrUyvSmarGSt2WFZ0ZB72GURijsuFrIxpwxY5mGSdftceAz06UTcNYlVX a0KWnodrilzb8bWQOsDYyJgRPFU8WbdujpsyEdQ1s4pskk7jZlYefrHBilslvQR9S0HB mBcPL0adIcd7y+CJ6wYplFyksNkwo11b+M0I4Ox/T/7Ma/SokTfUZL4h9XYnk2C3UfEa rOpE/7ts8pj86O0SPeFH9/LwczoA0vWKXrt/ruvOJK5ehErgwf/S30LSXs8RfjO5f+c7 rTYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=xhymlCn2FnsI+gSfLzUYk6+fbFOnA90ec9D1z5DhDDs=; b=PqY0AHEGW2EH58dWAVDcKeCD+DcbxypE2j53Ps5PEtfum0Be4kerD60M0PZ+/ZIF7s R5zfr6t3488hKiNxqpP40Mob8cA3qC8Zi2wyV2olnkP8m9nyApoVDGEOAVR3JNKB0bNq cplKE2+IMIs+H1mwRkV9jlKR1uvZ2Iy/VxCcotVaLFCmyzYFvyAI8DVwQOgwXqc8oXXy cd8l8hGPGCY1SvIpTMQ17s+aL6sSugcwpZ382taGJBhl7zyvYDb+RdVR6Oi9LRGDly0s fMQkLz1T2q/3E8eI/QwVH9on9JPoMiPV6+/liShabjp83RMqZqrXqjBXvPd5oBPiA0nB OP3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m15-20020a170902db0f00b001b00ae4ad57si10836301plx.369.2023.06.14.03.22.54; Wed, 14 Jun 2023 03:23:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235580AbjFNJ5n convert rfc822-to-8bit (ORCPT + 99 others); Wed, 14 Jun 2023 05:57:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233697AbjFNJ5m (ORCPT ); Wed, 14 Jun 2023 05:57:42 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39A4DC2 for ; Wed, 14 Jun 2023 02:57:40 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-318-cYKJ_jYvN-aJa4XviMzn4A-1; Wed, 14 Jun 2023 10:57:37 +0100 X-MC-Unique: cYKJ_jYvN-aJa4XviMzn4A-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 14 Jun 2023 10:57:33 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Wed, 14 Jun 2023 10:57:33 +0100 From: David Laight To: 'Steven Rostedt' , LKML , Linux Trace Kernel CC: Masami Hiramatsu , Mark Rutland Subject: RE: [PATCH] tracing: Add a debug_trace_printk() function Thread-Topic: [PATCH] tracing: Add a debug_trace_printk() function Thread-Index: AQHZnYZXodJCXa8lT0+2rDQCqxMQQa+KDaeA Date: Wed, 14 Jun 2023 09:57:33 +0000 Message-ID: References: <20230612193337.0fb0d3ca@gandalf.local.home> In-Reply-To: <20230612193337.0fb0d3ca@gandalf.local.home> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Steven Rostedt > Sent: 13 June 2023 00:34 > > From: "Steven Rostedt (Google)" > > While doing some tracing and kernel debugging, I found that some of my > trace_printk()s were being lost in the noise of the other code that was > being traced. Having a way to write trace_printk() not in the top level > trace buffer would have been useful. > > There was also a time I needed to debug ftrace itself, where > trace_printk() did not hit the paths that were being debugged. But because > the trace that was being debugged, was going into the top level ring > buffer, it was causing issues for seeing what is to be traced. > > To solve both of the above, add a debug_trace_printk() that can be used > just like trace_printk() except that it goes into a "debug" instance > buffer instead. This can be used at boot up as well. ... > +#ifdef CONFIG_FTRACE_DEBUG_PRINT > + debug_trace = trace_array_get_by_name("debug"); > + if (WARN_ON(!debug_trace)) > + return; > + trace_array_init_printk(debug_trace); > +#endif I was wondering if that could be done whenever the "debug" trace_array is created? (perhaps only if trace_prink() has been used?) Since (AFAICT) it could be created at any time?? So you wouldn't really need an extra kernel knob? (Except to get the boot time trace diverted.) The trace could go to the global buffer if the debug one isn't created. OTOH I'm missing what trace_array_init_prink() does? It seems to just call alloc_percpu_trace_buffer() with no arguments. It looks like alloc_percpu_trace_buffer() is called if there are any trace_printk() formats in the main kernel. Hopefully they aren't just in modules?? David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)