From nobody Sat Feb 7 21:24:39 2026 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E460A1E1A14 for ; Fri, 17 Jan 2025 04:01:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737086506; cv=none; b=b/vo4mYqqIh8LmO2nGgsRQgS/5994Qip2NrzYtiBISdtvBzyI+h0wOjeakr+wg4qin18rHTx9O2Ou3C/Azmkgsw4pK18Wd/fmSLzLCcnh7rUHHB9JXrTiS2bgWa4Mz/5AzpyGTaxpk/LCaNY44613DJWGR3KvtNpX0XuCsRTwJE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737086506; c=relaxed/simple; bh=oPexBCHXLUBrYCkSK7CxljpUzgYwKpWEPaYZxRbgJRo=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=NFqQ8SvSisSk1kNQZm89XQB4vg+cYdciw0U2gLsGHtb0r1to3dn/MmNz+cnsUNZoEGHDEafkgrBaq7tQDNovKaeeIZQ3Km7ot5XF3e9hcTAwLAp6I++lV4UwwHH2QroXPIKeo3twrZkFjRIpC/mmkk1hz2lNZVVVUQDZrwg7+mg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--keyz.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=UoKuGe2V; arc=none smtp.client-ip=209.85.214.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--keyz.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="UoKuGe2V" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-216430a88b0so34280155ad.0 for ; Thu, 16 Jan 2025 20:01:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1737086504; x=1737691304; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=CEiGuXqFpFvTFCSS6OS61iJ4F2JfCdl4C1VFaJs2q6g=; b=UoKuGe2Vt/j0fsq/mUajXBO0o2kgUDli7cvuBYR4+l/Tg9hSDCtJeYMZyd/8V3/efW rZc+326zUxoMPUyCQ4e+1DEhiu2Z5QhWUB5RAiGy+zc/3fMBDa0Rg9jUbimc0hahWdAs O+wDKC02IGhrU0BRvZTYCDdLDgfC7Ytw2iTXuLOS9K1bCZC8HtI4m7JAr3CXLJultjzU T/Mq//6LQue1Tgvmpy8FX+EbzHq94QLyIXHsR6Iv32v53EhyVAPB7Rg9LeGILtHltEjp 2TSKcmUxGKo8IrDCXVcCW/dBqGKsA/LA5O4gI0KmaMZgYIXZHHfWXpTUh6PXwEHqH/Di pLuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737086504; x=1737691304; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=CEiGuXqFpFvTFCSS6OS61iJ4F2JfCdl4C1VFaJs2q6g=; b=QgQzXpXa0n9gPok5ZuVLJFOgpxpSKqZ/LImKodTw5IHdQ9+PvSStKSrEcuiXR0eaPf bGAPEdUmF2wB46U8Gp17vGT0fOTjjL3lda2WmPN0reXEiRAnNrr6rHzXJgjpAEJ3B6Vj 9gah8D9Uuz0jKgpSQ4xhYfVxA14fnfkIbmY2BtIKhRkN6OLlpjlaD1P4beBFsSQIXHy+ c/Zl/7R5wQ2l3XmwwpB9T8T7iijRzck3Fr0TtGscMX8wmu0aQgSHVBvllJorXWOKC/9i N9QYWXgD3JW1aM5K74rDjzRG/7L5zlkfokgQb/CKWOy7/fEPQd28Sqi9B6PGbfRaZFOY LhnA== X-Forwarded-Encrypted: i=1; AJvYcCXHYd679uo8VhFBlU9IJRR1sl17nQO862Qoonr0yCfcLpNaTQAgU0RdJv+xFbf+vpBQUVR56Q0CdBYwJBM=@vger.kernel.org X-Gm-Message-State: AOJu0YwGSal7zb8yWSZN+ig7JS4TaHPQnI2IUEyx0xdrNT/ID5RUdwAR 2IUUR9y+DXr7/ra5+q1wuMZLzUp4WGZ5w/B3utBKsAYgxcMJB3cAL0PKvT+cDH1QomZhCQ== X-Google-Smtp-Source: AGHT+IGDb+9WYwTzYDxn0Re4JPH7eopPvdlHxZjnk8qGZpF8HIzrHPuv1NxuJhAfSQuice83Hn/+/EvB X-Received: from pgbds10.prod.google.com ([2002:a05:6a02:430a:b0:7fd:483d:9d10]) (user=keyz job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:9983:b0:1e2:2e4:6b2a with SMTP id adf61e73a8af0-1eb2145dc2emr1465893637.5.1737086504222; Thu, 16 Jan 2025 20:01:44 -0800 (PST) Date: Fri, 17 Jan 2025 12:01:32 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.48.0.rc2.279.g1de40edade-goog Message-ID: <20250117040132.3237808-1-keyz@google.com> Subject: [PATCH] cpuidle: psci: Add trace for PSCI domain idle From: Keita Morisaki To: rostedt@goodmis.org, mhiramat@kernel.org, mathieu.desnoyers@efficios.com, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, lpieralisi@kernel.org, sudeep.holla@arm.com, rafael@kernel.org, daniel.lezcano@linaro.org, linux-pm@vger.kernel.org Cc: aarontian@google.com, yimingtseng@google.com, Keita Morisaki Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The trace event cpu_idle provides insufficient information for debugging PSCI requests due to lacking access to determined PSCI domain idle states. The cpu_idle usually only shows -1, 0, or 1 regardless how many CPUidle states the power domain has. Add a new trace named psci_domain_idle with a determined idle state info before the state entry, and after the state exit. This new trace event will help developers debug CPUidle issues on ARM systems using PSCI by providing more detailed information about the requested idle states. Signed-off-by: Keita Morisaki --- drivers/cpuidle/cpuidle-psci.c | 3 +++ include/trace/events/power.h | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c index 2562dc001fc1..5888d4511787 100644 --- a/drivers/cpuidle/cpuidle-psci.c +++ b/drivers/cpuidle/cpuidle-psci.c @@ -25,6 +25,7 @@ #include =20 #include +#include =20 #include "cpuidle-psci.h" #include "dt_idle_states.h" @@ -74,7 +75,9 @@ static __cpuidle int __psci_enter_domain_idle_state(struc= t cpuidle_device *dev, if (!state) state =3D states[idx]; =20 + trace_psci_domain_idle(dev->cpu, state, true, s2idle); ret =3D psci_cpu_suspend_enter(state) ? -1 : idx; + trace_psci_domain_idle(dev->cpu, state, false, s2idle); =20 if (s2idle) dev_pm_genpd_resume(pd_dev); diff --git a/include/trace/events/power.h b/include/trace/events/power.h index d2349b6b531a..82ad8bb1c477 100644 --- a/include/trace/events/power.h +++ b/include/trace/events/power.h @@ -62,6 +62,31 @@ TRACE_EVENT(cpu_idle_miss, (unsigned long)__entry->state, (__entry->below)?"below":"above") ); =20 +TRACE_EVENT(psci_domain_idle, + + TP_PROTO(unsigned int cpu_id, unsigned int state, bool enter, bool s2idle= ), + + TP_ARGS(cpu_id, state, enter, s2idle), + + TP_STRUCT__entry( + __field(u32, cpu_id) + __field(u32, state) + __field(bool, enter) + __field(bool, s2idle) + ), + + TP_fast_assign( + __entry->cpu_id =3D cpu_id; + __entry->state =3D state; + __entry->enter =3D enter; + __entry->s2idle =3D s2idle; + ), + + TP_printk("cpu_id=3D%lu state=3D0x%lx type=3D%s, is_s2idle=3D%s", + (unsigned long)__entry->cpu_id, (unsigned long)__entry->state, + (__entry->enter)?"enter":"exit", (__entry->s2idle)?"yes":"no") +); + TRACE_EVENT(powernv_throttle, =20 TP_PROTO(int chip_id, const char *reason, int pmax), base-commit: 9bffa1ad25b8b3b95d8f463e5c24dabe3c87d54d --=20 2.48.0.rc2.279.g1de40edade-goog