From patchwork Fri Jan 17 04:01:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keita Morisaki X-Patchwork-Id: 13942809 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (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 E5F2A1F63DD for ; Fri, 17 Jan 2025 04:01:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737086506; cv=none; b=uVy51OiBX7x20LXgAgKPTUzOAQjO9KtmTxc/xQ0euKcf3s5kMGuTq6LW3v+R1yRuBVhEnNEM/smR9X9LyVlrb2iXPw19O93JWVoqCdrF8UR3sd9curi6WmJ71Iz3mNkBqx3KrE7yUNT6S8X8hmMlcLqH/g2UJcq1YHLHaJm9Gfs= 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.202 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-f202.google.com with SMTP id d9443c01a7336-2161d5b3eb5so29233345ad.3 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=wUGelSQOLNth1fWe81T/R/BBm2KK/EFGBBvgz6a7Q6ZBwnmCDOOLcK87PdddurqjbO c+YtjVu/zIOcynGk24hJ6RUcuxmJxNaPqVTdy5RY/flt3pkbccpadOmUWLf1bNGqYt3V ga0KU4WK3hftGBqjhrYixQomZbQgW9iUoMqYZ51ykxgt7u1QJ4hm/Qyg6eVfHIgiyyA7 OVWGz3w1+KIpw5V0FTxNmhYurWHYDSCWr7r/aQCQhIBNR3GukYBg2nzTMGBZZjh6JYhW TD1xuPlf+05f7UOzThmL+s0y9X4xRUxH7Yh/uZEcfp97CPXZeBwNrY++3Bf8Mej3U50n aPEw== X-Forwarded-Encrypted: i=1; AJvYcCVI6+ghpczPhDUlCVMxuQnq1S433LUDzyO5MtgFU73c4dpXgUSFL/WwSXvp3GFXJkbmgae5ZIQFDWn4vj1OOALuwP4=@vger.kernel.org X-Gm-Message-State: AOJu0YyZYIHK6S/feYfG4Ktkzn5RyEvVoNsruS/9ZEX/i+AjKo9JzvPb Af7Bqy9XeTLLVxpIytBB/jsRL6QjBPpfZGHsPfaZY7U8HHx2lCqECZOtkD2GDt0Xgx8lfA== 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-trace-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 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(+) base-commit: 9bffa1ad25b8b3b95d8f463e5c24dabe3c87d54d 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 #include +#include #include "cpuidle-psci.h" #include "dt_idle_states.h" @@ -74,7 +75,9 @@ static __cpuidle int __psci_enter_domain_idle_state(struct cpuidle_device *dev, if (!state) state = states[idx]; + trace_psci_domain_idle(dev->cpu, state, true, s2idle); ret = psci_cpu_suspend_enter(state) ? -1 : idx; + trace_psci_domain_idle(dev->cpu, state, false, s2idle); 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") ); +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 = cpu_id; + __entry->state = state; + __entry->enter = enter; + __entry->s2idle = s2idle; + ), + + TP_printk("cpu_id=%lu state=0x%lx type=%s, is_s2idle=%s", + (unsigned long)__entry->cpu_id, (unsigned long)__entry->state, + (__entry->enter)?"enter":"exit", (__entry->s2idle)?"yes":"no") +); + TRACE_EVENT(powernv_throttle, TP_PROTO(int chip_id, const char *reason, int pmax),