Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp959661lqs; Wed, 6 Mar 2024 01:53:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUqesPAP1SQPYMeW8cxhZpqt05jrBOEX6WJ8JOUB9cUKxgCOXqataPh5NBrcI0JtNK4CyNS2Yu0Z9BLQcOD3c8HZhiatz3tZhOBCFLzKg== X-Google-Smtp-Source: AGHT+IGS9qyDQkahNwNZpYXmm+ObMPVmNJpTtpqrZAaSOoN3Fa9vVeZZQLQMnC+yIQQyGatHmQys X-Received: by 2002:aca:1714:0:b0:3c1:adf2:3e15 with SMTP id j20-20020aca1714000000b003c1adf23e15mr4256866oii.23.1709718802989; Wed, 06 Mar 2024 01:53:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709718802; cv=pass; d=google.com; s=arc-20160816; b=gZxX8TgOrl70XaQQl7pgJ2W7SctSwVtqTVmcD3UtQYjvlVCeLSRSRLhyOSh0vq+ox5 IGyqQhwNB5QKGglI9sR6KxjMYinC4gPblmq2UPnXuxk/bWLa52hc8T3uYoIaDe3eWhlA iy4iktpPI18rFjn66sh6uzfi4dBKYg4mIaOxjLoL+dSiQqG5UGwsUOIbsCVADuc7/1Fl LjXbHRpJZI2Wf9tMR/FTtAhVP+tHbzQzTYc3jYMMA3yQuRwEX+zT/DVrMAzSuzk6HPbZ mF9rK+YpkqBhK7GRLtg+qfP7grpaMvTQoWElz1UU60c6Dy6L55/uDb9Io1PokEygibgN iXwA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=+C64T2jK/k8mcNRemqy1jld39vwq5/AiYYHCI9ylD3s=; fh=yyM3hUU18oWHLJuy0PToUI5om26DySuXX0yOciFrgkM=; b=kQVM8vdl+RBlTAeENPveGjv0hLM8fb3aXSVtneSg0XBFyx7Hj1MQdRnt7YPvFy6+Mw LXPrRgFE1UEcSrfOWMDq5u2oFnb3jHjxD9lWK35vd+o/WKzCwmytanKvB+k/s45ahjIh IJgB08UCAMmNLJhb+6r2HmAqhyCjJg6tEDeNPL65T1U9Cpu6LKgd96L/e8EOezwuQPKF /OnZpT75b5hYc/2nz4suW/HjYn/T5pTqnxbGFA3RwYg2V9kAeAe01FHoUebT8a90A1fw WxWNo1QQuyqo73SRsQ9LwuAA23X54B43ShRM2QBtfyNOjNkTQinN0Z8A3tsuXTH0BJzq Jxpg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Rv6s1wlB; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-93628-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93628-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d26-20020a631d1a000000b005dc883a6ba5si11397437pgd.500.2024.03.06.01.53.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 01:53:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-93628-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Rv6s1wlB; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-93628-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93628-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com 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 A496BB2A0EE for ; Wed, 6 Mar 2024 09:30:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EB3BF5EE89; Wed, 6 Mar 2024 09:30:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Rv6s1wlB" Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (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 65FC61BDEB; Wed, 6 Mar 2024 09:30:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709717418; cv=none; b=JoMxFNwtjokj+RjKr7TdD+A2bJTtwRnW4AgmukWIoKQIjTQ6pt2vGQG9ViStK2lmCE/l9Ie2s4t8LxjpoMlwJu1Me7DJa7VcUwtxYr1aHQAlbVjdEbv0SDPbH66gaRxCWWvXNvNdTCFMODJqGKMNUZHkotw2fC21CUeCTyEMuE0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709717418; c=relaxed/simple; bh=v/PTUsmXjwTYqBP3hqhN/SNIkFflE1GoSi/yKBKur+k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=J4RzUu5wqfk4vuSEDaXhlR65kCEyj4bwifkJ8edGR0TzuEkIX3HlTHVp2sdC6RKSsfQ/hL5o8m/zBsQh12/QQrY4FXhpV1h+uiMBnIqRW0SasRMikkEY51yUS3goCJ63HidXq4ycvUNDIYnS7CTgVk7+f6JUD9IrSIPyBVAKEHo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=Rv6s1wlB; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 680321C0005; Wed, 6 Mar 2024 09:30:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709717408; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+C64T2jK/k8mcNRemqy1jld39vwq5/AiYYHCI9ylD3s=; b=Rv6s1wlBUezNztKgZhMPyxdrgbHoOKa/qEf6WAf/6qxyeO+wRvEQ2ZnAc/rQM0U8Vw8Hd/ Wn1n6gdwL+S4whjAXpwY87GMZE7m21X7HlaeucitSsRnVHGm/dTn/guTiqENRZ5S2CwtXG gYu4kyv5oIn7Lu49ySPRgMTJT5HY/nokM7JpgIW2bUkJFp7oKA+utPVv49Wy/VrwiiZrjQ lJjBUwhK2iQshIRun2li+TAvvApewVNVdm3eqTKxPTN570MPqK9Hjhwe0nL5ryNvcejaae Wb+9vJqRoXIbA9pnCLZcgmlVItsjrXb8MC0nXOINkcGnAbyWle33bCwH/VvBMw== From: Luca Ceresoli Date: Wed, 06 Mar 2024 10:30:00 +0100 Subject: [PATCH 1/2] ASoC: trace: add component to set_bias_level trace events 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="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240306-improve-asoc-trace-events-v1-1-edb252bbeb10@bootlin.com> References: <20240306-improve-asoc-trace-events-v1-0-edb252bbeb10@bootlin.com> In-Reply-To: <20240306-improve-asoc-trace-events-v1-0-edb252bbeb10@bootlin.com> To: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: Thomas Petazzoni , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-sound@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.13.0 X-GND-Sasl: luca.ceresoli@bootlin.com The snd_soc_bias_level_start and snd_soc_bias_level_done trace events currently look like: aplay-229 [000] 1250.140778: snd_soc_bias_level_start: card=vscn-2046 val=1 aplay-229 [000] 1250.140784: snd_soc_bias_level_done: card=vscn-2046 val=1 aplay-229 [000] 1250.140786: snd_soc_bias_level_start: card=vscn-2046 val=2 aplay-229 [000] 1250.140788: snd_soc_bias_level_done: card=vscn-2046 val=2 kworker/u8:1-21 [000] 1250.140871: snd_soc_bias_level_start: card=vscn-2046 val=1 kworker/u8:0-11 [000] 1250.140951: snd_soc_bias_level_start: card=vscn-2046 val=1 kworker/u8:0-11 [000] 1250.140956: snd_soc_bias_level_done: card=vscn-2046 val=1 kworker/u8:0-11 [000] 1250.140959: snd_soc_bias_level_start: card=vscn-2046 val=2 kworker/u8:0-11 [000] 1250.140961: snd_soc_bias_level_done: card=vscn-2046 val=2 kworker/u8:1-21 [000] 1250.167219: snd_soc_bias_level_done: card=vscn-2046 val=1 kworker/u8:1-21 [000] 1250.167222: snd_soc_bias_level_start: card=vscn-2046 val=2 kworker/u8:1-21 [000] 1250.167232: snd_soc_bias_level_done: card=vscn-2046 val=2 kworker/u8:0-11 [000] 1250.167440: snd_soc_bias_level_start: card=vscn-2046 val=3 kworker/u8:0-11 [000] 1250.167444: snd_soc_bias_level_done: card=vscn-2046 val=3 kworker/u8:1-21 [000] 1250.167497: snd_soc_bias_level_start: card=vscn-2046 val=3 kworker/u8:1-21 [000] 1250.167506: snd_soc_bias_level_done: card=vscn-2046 val=3 There are clearly multiple calls, one per component, but they cannot be discriminated from each other. Change the ftrace events to also print the component name, to make it clear which part of the code is involved. This requires changing the passed value from a struct snd_soc_card, where the DAPM context is not kwown, to a struct snd_soc_dapm_context where it is obviously known but the a card pointer is also available. With this change, the resulting trace becomes: aplay-247 [000] 1436.357332: snd_soc_bias_level_start: card=vscn-2046 component=(none) val=1 aplay-247 [000] 1436.357338: snd_soc_bias_level_done: card=vscn-2046 component=(none) val=1 aplay-247 [000] 1436.357340: snd_soc_bias_level_start: card=vscn-2046 component=(none) val=2 aplay-247 [000] 1436.357343: snd_soc_bias_level_done: card=vscn-2046 component=(none) val=2 kworker/u8:4-215 [000] 1436.357437: snd_soc_bias_level_start: card=vscn-2046 component=ff560000.codec val=1 kworker/u8:5-231 [000] 1436.357518: snd_soc_bias_level_start: card=vscn-2046 component=ff320000.i2s val=1 kworker/u8:5-231 [000] 1436.357523: snd_soc_bias_level_done: card=vscn-2046 component=ff320000.i2s val=1 kworker/u8:5-231 [000] 1436.357526: snd_soc_bias_level_start: card=vscn-2046 component=ff320000.i2s val=2 kworker/u8:5-231 [000] 1436.357528: snd_soc_bias_level_done: card=vscn-2046 component=ff320000.i2s val=2 kworker/u8:4-215 [000] 1436.383217: snd_soc_bias_level_done: card=vscn-2046 component=ff560000.codec val=1 kworker/u8:4-215 [000] 1436.383221: snd_soc_bias_level_start: card=vscn-2046 component=ff560000.codec val=2 kworker/u8:4-215 [000] 1436.383231: snd_soc_bias_level_done: card=vscn-2046 component=ff560000.codec val=2 kworker/u8:5-231 [000] 1436.383468: snd_soc_bias_level_start: card=vscn-2046 component=ff320000.i2s val=3 kworker/u8:5-231 [000] 1436.383472: snd_soc_bias_level_done: card=vscn-2046 component=ff320000.i2s val=3 kworker/u8:4-215 [000] 1436.383503: snd_soc_bias_level_start: card=vscn-2046 component=ff560000.codec val=3 kworker/u8:4-215 [000] 1436.383513: snd_soc_bias_level_done: card=vscn-2046 component=ff560000.codec val=3 Signed-off-by: Luca Ceresoli --- include/trace/events/asoc.h | 29 ++++++++++++++++------------- sound/soc/soc-dapm.c | 4 ++-- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/include/trace/events/asoc.h b/include/trace/events/asoc.h index 4d8ef71090af..b7ac7f100bb4 100644 --- a/include/trace/events/asoc.h +++ b/include/trace/events/asoc.h @@ -17,38 +17,41 @@ struct snd_soc_card; struct snd_soc_dapm_widget; struct snd_soc_dapm_path; -DECLARE_EVENT_CLASS(snd_soc_card, +DECLARE_EVENT_CLASS(snd_soc_dapm, - TP_PROTO(struct snd_soc_card *card, int val), + TP_PROTO(struct snd_soc_dapm_context *dapm, int val), - TP_ARGS(card, val), + TP_ARGS(dapm, val), TP_STRUCT__entry( - __string( name, card->name ) - __field( int, val ) + __string( card_name, dapm->card->name) + __string( comp_name, dapm->component ? dapm->component->name : "(none)") + __field( int, val) ), TP_fast_assign( - __assign_str(name, card->name); + __assign_str(card_name, dapm->card->name); + __assign_str(comp_name, dapm->component ? dapm->component->name : "(none)"); __entry->val = val; ), - TP_printk("card=%s val=%d", __get_str(name), (int)__entry->val) + TP_printk("card=%s component=%s val=%d", + __get_str(card_name), __get_str(comp_name), (int)__entry->val) ); -DEFINE_EVENT(snd_soc_card, snd_soc_bias_level_start, +DEFINE_EVENT(snd_soc_dapm, snd_soc_bias_level_start, - TP_PROTO(struct snd_soc_card *card, int val), + TP_PROTO(struct snd_soc_dapm_context *dapm, int val), - TP_ARGS(card, val) + TP_ARGS(dapm, val) ); -DEFINE_EVENT(snd_soc_card, snd_soc_bias_level_done, +DEFINE_EVENT(snd_soc_dapm, snd_soc_bias_level_done, - TP_PROTO(struct snd_soc_card *card, int val), + TP_PROTO(struct snd_soc_dapm_context *dapm, int val), - TP_ARGS(card, val) + TP_ARGS(dapm, val) ); diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index bffeea80277f..7e8a2a5312f5 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -725,7 +725,7 @@ static int snd_soc_dapm_set_bias_level(struct snd_soc_dapm_context *dapm, struct snd_soc_card *card = dapm->card; int ret = 0; - trace_snd_soc_bias_level_start(card, level); + trace_snd_soc_bias_level_start(dapm, level); ret = snd_soc_card_set_bias_level(card, dapm, level); if (ret != 0) @@ -739,7 +739,7 @@ static int snd_soc_dapm_set_bias_level(struct snd_soc_dapm_context *dapm, ret = snd_soc_card_set_bias_level_post(card, dapm, level); out: - trace_snd_soc_bias_level_done(card, level); + trace_snd_soc_bias_level_done(dapm, level); return ret; } -- 2.34.1