Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp942087lqb; Fri, 15 Mar 2024 10:27:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVmKmplX9lZC2oSgq8p7mwS5IWVy4C9OQS3Op6AGRtgKBoDoMZ+PDSc7eWl9Salzeb5sGVM/K6rpWEl5ivushMi55qX37SUNYgzg61L5Q== X-Google-Smtp-Source: AGHT+IED+hgEkFrCSeJt0lmWe2G6Sh+nLI54I5vEN1taorBp6f3C825gHZcfUzt3PsQ0tY4o511c X-Received: by 2002:a05:6a20:4f22:b0:1a1:66cf:c52c with SMTP id gi34-20020a056a204f2200b001a166cfc52cmr3942560pzb.12.1710523670276; Fri, 15 Mar 2024 10:27:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710523670; cv=pass; d=google.com; s=arc-20160816; b=01ucnwCSCLVWP4pfotyGpu5yTM9aJ47W7PYRYy/RNDixzqy6DJiBKkH3msBRdIhQ49 aOBlTRPN0AJgvGdTglCf5MmM+dpGa4Slo7pqDefUmfCPr7zLIwKI4DFqH5wJKNJGZ9AU VrADPqwuqvIppIpe4vL5uk0jWldwMAlbs0CQC9Ue1dqfBAqzea6km55QEoCJ/o0oHmb0 jHPuDPbCb58iloG/omtuFUYZPCri7YaphNh7eXJyCl3aELh/5wqRpYXgGkL5V0eV9zOC jdk2cGFd/q53g/I7y2LDJEOll2pKABiex6SAhbqlRc1UNOIxrA/KmpVhDzCugDSMtq7c Fn4Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=FUTTENQu98g8GGjS0Qig78YbHyssUyhpquLG9rMN+Ig=; fh=HVp5QDp8xfNYci1tVdgFGQS7CNSjgBwzcLNRsBDnku8=; b=X8VBdFlUslyUy6hmxTw7bRWIaZ9SLb3T7RJdXVGEHrG2upD5vZBNg4PF0GRAUQoM/i XG7O2rPsiSQBDWWs/D/igcMWDEE/p7mt3lA6h7ji7PIA66LNDc/CwWxxqng/YYqe9Xi4 FRgLFD7oGzWstlo0WWxt8ERYvDF+ekmF6NSUca3OR6SgqSOSTRYyYi+io4PvjDWEeFbC adFpHyY4KeW4jnsxf8/ubQGFREX3ae0GPvW7FG/cqNbjhq+Myfvoe6PUAqswB83XJTM8 V9yB5FVywP+hNsczKXHd6EdyUD77dmAlW0StZAjJx2Uek+DGWNgcGwVqjwXCq1alu5WC a2ow==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-104706-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104706-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id i12-20020a636d0c000000b005e46720db84si3064000pgc.117.2024.03.15.10.27.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 10:27:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-104706-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-104706-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104706-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E57EBB22110 for ; Fri, 15 Mar 2024 17:20:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 254154F5FA; Fri, 15 Mar 2024 17:19:35 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A094A4C637; Fri, 15 Mar 2024 17:19:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710523174; cv=none; b=iWI3qU+9/JZJUgaTiZVbPAaoicYHgi0Ktjh6JVrcG1mxCnw8m6hGnvporuFs1AXIthCSMwhsSNOUMlyEuaKgRYFW5ZhJEeOucTTFmpPBLmHIOFjJnhrec9+oE/P0FQONu5PtLZlRCUeJNGFFFtOhbr/J9bQXY3yQkKto6ib1v4M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710523174; c=relaxed/simple; bh=CRVeu9fBjqD2aRKqUgc0w7WBeeU30YVOG7/MSWK4HlU=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BQgVlTAfLSEbwdjj7p+qIVe1KpD25FThRPseuUU1VKRqLfeiUN4tc9XCKiNLLm7T/Be3DdkDmXawE1e9p/hLCTHFyYG2FK7mGbQDFvVKZVUy7C7ZuSq7sg1qNMUNuesWGMwbhQVMTh4XEaMucvPZ3MttU3bKTdeijo0teAMRiPU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93924C43390; Fri, 15 Mar 2024 17:19:33 +0000 (UTC) Date: Fri, 15 Mar 2024 13:21:46 -0400 From: Steven Rostedt To: Luca Ceresoli Cc: Masami Hiramatsu , Mathieu Desnoyers , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Liam Girdwood , Mark Brown , Thomas Petazzoni Subject: Re: TP_printk() bug with %c, and more? Message-ID: <20240315132146.29edf416@gandalf.local.home> In-Reply-To: <20240315174900.14418f22@booty> References: <20240315174900.14418f22@booty> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 15 Mar 2024 17:49:00 +0100 Luca Ceresoli wrote: > Hello Linux tracing maintainers, Hi Luca! > > I've come across an unexpected behaviour in the kernel tracing > infrastructure that looks like a bug, or maybe two. > > Cc-ing ASoC maintainers for as it appeared using ASoC traces, but it > does not look ASoC-specific. > > It all started when using this trace-cmd sequence on an ARM64 board > running a mainline 6.8.0-rc7 kernel: > > trace-cmd record -e snd_soc_dapm_path ./my-play > trace-cmd report > > While this produces perfectly valid traces for other asoc events, > the snd_soc_dapm_path produces: > > snd_soc_dapm_path: >c<* MIC1_EN <- (direct) <- > > instead of the expected: > > snd_soc_dapm_path: *MIC1 <- (direct) <- MIC1_EN > > The originating macro is: > > TP_printk("%c%s %s %s %s %s", > (int) __entry->path_node && > (int) __entry->path_connect ? '*' : ' ', > __get_str(wname), DAPM_ARROW(__entry->path_dir), > __get_str(pname), DAPM_ARROW(__entry->path_dir), > __get_str(pnname)) > > It appears as if the %c placeholder always produces the three ">c<" > characters, the '*' or ' ' char is printed as the first %s, all the > other strings are shifted right by one position and the last string is > never printed. > > On my x86_64 laptop running the default Ubuntu kernel (6.5) I'm able to > trace a few events having a '%c' in their TP_printk() macros and the > result is: > > intel_pipe_update_start: dev 0000:00:02.0, pipe >c<, frame=1, > scanline=107856, min=2208, max=2154 > What does /sys/kernel/tracing/trace show? If that's fine, then the bug is in libtraceevent and not the kernel. I'm testing it out now, and I see %c not being processed properly by libtraceevent. I'll take a deeper look. Thanks for the report. -- Steve > originating from: > > TP_printk("dev %s, pipe %c, frame=%u, scanline=%u, min=%u, max=%u", > > Here it looks like the %c produced ">c<" again, but apparently without > any shifting. > > Back on the ARM64 board I found a couple interesting clues. > > First, using the /tracing/ interface instead of trace-cmd, I'm > getting correctly formatted strings: > > trace-cmd: snd_soc_dapm_path: >c<* HPOUT_L -> (direct) -> > debugfs: snd_soc_dapm_path: *HPOUT_L <- (direct) <- HPOUT_POP_SOUND_L > > Notice the arrows pointing to the opposite direction though. The correct > arrow is the one in the debugfs run. > > Second, I tried a simple test: > > TP_printk("(%c,%c,%c,%c) [%s,%s,%s,%s]",