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 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 31FD5C43217 for ; Mon, 28 Nov 2022 13:57:37 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 28D55169D; Mon, 28 Nov 2022 14:56:45 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 28D55169D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669643855; bh=3h/E77oVbD5mvN70sgSTcqGxqcrMca1Hc6ryD6CnJT0=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Rg7voAFCjxzdYDQggeFSgHA17qpKDAnbG7Hh+MYkIGTCbUre5mdbpD3zWRK60zchk Fq6pJe2bIEloB8JlxPBXG0Zn2Zyckr8l0lAu1HwhVEi0FVBOY+ZQHdupv/M6BLR7iH +jweVqBjb/9xzmbZ0qfZ/Ci19SySk/+dVD2zP8uM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D561DF801D8; Mon, 28 Nov 2022 14:56:44 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 522EFF801D8; Mon, 28 Nov 2022 14:56:43 +0100 (CET) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 555EDF8016E for ; Mon, 28 Nov 2022 14:56:36 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 555EDF8016E Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="LUNK0Z6e"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="hsXZVBOP" 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 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 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Takashi Iwai X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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