Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp14959659rwb; Mon, 28 Nov 2022 06:40:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf4vrz3OQpylqUArVHLUoExK3vXy6A//ZoTyWk1P7PV2IllwdoP873eMqPckqPr0k3Sikjz9 X-Received: by 2002:a17:906:2998:b0:78d:3ff8:6ec8 with SMTP id x24-20020a170906299800b0078d3ff86ec8mr27851705eje.568.1669646443133; Mon, 28 Nov 2022 06:40:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669646443; cv=none; d=google.com; s=arc-20160816; b=lrQRkp1pPbl+3KLcsGQj5Ub4Z03kgJoAoEaqY6Vj/AM404tClZCEDV9rnM1alP4om/ VPDIOrMJ4U6h/AfYZKdfj1Y96m3oheXwOVr8AD+uxYkTCqWXP36ccKu68dNPkeQokUay OUmdPN/3bO/iCEHVvsCLMxK3R58j3tt+X7SrDrSRwk1hd5FE32l4qy0BiYMOtzZEdUut 8qOnQfcTwPe4iLxFa8v4NOypJKH8lqbAplsWvpvDxaqypAmJCnldX7Gma9fgQipVsNeA BATULQVKZD2Zmmd8MaG8Wk/vn9m9euYSn6BOnfKgpyqHz0dgO0Z/4QFx2OL+RGIEuB6n P6cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=9wTzr7P00ZqlaJ/8ucvmk0XYg82ZvQTOl/Mx499qBGM=; b=G7cZtf4dWPAK6yQWhC/7DqRKRj9Jo7cyfGLL1mMy4JwEkeYNqC4rsiBO22bPi6JPty TfnAqM7DPBEM0znB7iGl2iGUzxKtBGxCY9YfVe5xmTgbc9666NOggzHkgWgriIRhj6GN cWg6llymS78giwNCe344wWy6bd0+z3J32c/o9NnAnteaalr95b0p1Kvh1VDbIVnkc51A 2I70aQuSLb8Iad1OOZkK8K2HFyZ/TO0TPVNUohNiyQCrehUDQggTo7uX/MlbFYkGCvME tdqhchTkKeirHCf5c1czE0rEOZuuL8OhwP2aso0ZQgD9t7wEnTefYdycaQp+4cKtvuc0 1NmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=LUNK0Z6e; dkim=neutral (no key) header.i=@suse.de; 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=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s13-20020a50ab0d000000b004694d005e82si9014459edc.571.2022.11.28.06.40.19; Mon, 28 Nov 2022 06:40:43 -0800 (PST) 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; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=LUNK0Z6e; dkim=neutral (no key) header.i=@suse.de; 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=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232273AbiK1N4z (ORCPT + 84 others); Mon, 28 Nov 2022 08:56:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232244AbiK1N4s (ORCPT ); Mon, 28 Nov 2022 08:56:48 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9A6420350 for ; Mon, 28 Nov 2022 05:56:38 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B69C921B8F; Mon, 28 Nov 2022 13:56:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1669643796; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9wTzr7P00ZqlaJ/8ucvmk0XYg82ZvQTOl/Mx499qBGM=; b=LUNK0Z6ep1vGyfkcwo+1Y3oLpjricTjC/0xTb/sH3yGlN4PrC+0Bh09t26qGv3V3bt0iCB w6PSm/RzUL0sli8igZgrct8KBw+JJh37PdT8hFerkiPXis22efFdBmFDNfvRNvhIe98cL5 +Bew8R3179GEKwodAezpBi1fviw89Zs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1669643796; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9wTzr7P00ZqlaJ/8ucvmk0XYg82ZvQTOl/Mx499qBGM=; b=hsXZVBOPtJ7R6njq3fUVS6kbBOAaFiCnplH2Q8/jHUAMVmlY6itirYTqbtBxPuRBsPsg5w Uoe60mxVhtC8UWCQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 938801326E; Mon, 28 Nov 2022 13:56:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Ydw6IxS+hGOlFQAAMHmgww (envelope-from ); Mon, 28 Nov 2022 13:56:36 +0000 Date: Mon, 28 Nov 2022 14:56:36 +0100 Message-ID: <87ilizyygb.wl-tiwai@suse.de> From: Takashi Iwai To: John Keeping Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Takashi Iwai Subject: Re: [PATCH] ALSA: pcm: fix tracing reason in hw_ptr_error In-Reply-To: References: <20221125162327.297440-1-john@metanate.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham 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 On Mon, 28 Nov 2022 11:50:52 +0100, John Keeping wrote: > > On Sat, Nov 26, 2022 at 12:51:53PM +0900, Takashi Sakamoto wrote: > > Hi, > > > > On Fri, Nov 25, 2022 at 04:23:26PM +0000, John Keeping wrote: > > > Strings need to be specially marked in trace events to ensure the > > > content is captured, othewise the trace just shows the value of the > > > pointer. > > > > > > Signed-off-by: John Keeping > > > --- > > > sound/core/pcm_trace.h | 6 +++--- > > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > Thanks for the patch, while I have a slight concern about the intension > > of change. > > > > Let's see message in below commit to add 'trace_safe_str()' in > > 'kernel/trace/trace.c': > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9a6944fee68 > > > > "The proper way to handle displaying any string that is not guaranteed to be > > in the kernel core rodata section, is to copy it into the ring buffer via > > the __string(), __assign_str() and __get_str() helper macros." > > > > Additionally, the macros looks to be alias to __dynamic_array() or so. > > > > In our case, the pointer of 'why' argument should points to two > > hardcoded strings; "hw_ptr skipping" and "Unexpected hw_ptr". As long as > > I know, they are put into any of .rodata section. > > > > ``` > > $ objdump -s sound/core/snd-pcm.ko -j .rodata.str1.1 > > ``` > > 0830 74757265 20436861 6e6e656c 204d6170 ture Channel Map > > 0840 00585255 4e3a2025 730a0055 6e657870 .XRUN: %s..Unexp > > 0850 65637465 64206877 5f707472 0068775f ected hw_ptr.hw_ > > 0860 70747220 736b6970 70696e67 004c6f73 ptr skipping.Los > > 0870 7420696e 74657272 75707473 3f00756e t interrupts?.un > > ``` > > > > I think current implementation is enough safe. > > Thanks for this analysis - I hadn't looked into the history of this. > > It seems that trace-cmd's record/report functionality does not support > rodata strings in this way though. Without this patch, the trace log is > not very informative: > > $ trace-cmd record -e snd_pcm:hw_ptr_error > ^C > $ trace-cmd report > irq/49-ehci_hcd-111 [002] 65.785147: hw_ptr_error: pcmC1D0p/sub0: ERROR: c0b1b3c7 > > With this patch applied this becomes: > > irq/49-ehci_hcd-111 [002] 435.758754: hw_ptr_error: pcmC2D0p/sub0: ERROR: Lost interrupts? Fair enough, I applied now as is. Thanks! Takashi