From patchwork Thu Jun 1 21:31:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 102201 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp628000vqr; Thu, 1 Jun 2023 14:39:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7MssjKlUP6z61V3b2JuJClkvsSTOhOM9AEHnpzdq/jhZGWGfACaSgCRPkHRP5Lwk7DmAHh X-Received: by 2002:a17:902:860c:b0:1ac:8ad0:1707 with SMTP id f12-20020a170902860c00b001ac8ad01707mr708350plo.1.1685655552125; Thu, 01 Jun 2023 14:39:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685655552; cv=none; d=google.com; s=arc-20160816; b=w8g9fQKTSy3vaMCKmxiKgidoHmY+PYHIk1k3QME6jGmTtqqqDVp4ZtSrp7905mya9r 1Yu/4eGXGBaCVgEWKiVCfHxp9Xfrtxr4bEq1EeaoIvsj+ZsXkakazxdJGMzh+7e/F3Sa CVtG+7mklfi4hNRSar+1ADxwFjGGxz++RJxERoMJ+FHmqFB7KIjJsbRPdklY2dxmDXWq Uy0uzEp1XW9E+hNFzYjhGQOZNJ9Z2/UWAI4c4rpYLY2sh2VK2iUBcm/t7Pl0XI9li6oF gFEzuV85CkBaKwqcTQ/DVSfeLgdNagYeaAgWeJr//+zxQvFlZ5fmvgPaIaKoV3kb8Ros 6Fhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3FwIy9pdxSPLLDGVrHowuSMAgkehvs21QOIs4DuKC6A=; b=clq24pAhnctfZ8KHyx/3wy6SUTSC12vuFKtBJZWZSP+c/sAAecipmFZsem+iXcIf8Y dfkQ4++YfkcW7tdSDIwLeeKlK8AmF+tdO4WGWJ9R/oodTGy5/70GMz2HoNyTGVw3E/hW ymCC74U/m88hW6MVo7M8oh+i8O/2ZjWpdCfmOO2jtRGovd4JheUTocCpQtLaI6/PsyBt U3QUQcjvROapmcWwhw/1pFC8Skv3KxzNTbgPzbWMVLdnkvO7qNnS45Kn4yO/K5TIz/As B/aaHhnXJiqcX4gj/1wOFuAYAlbWt5kLhWJTBC3Q6yaq7oOtVMn8EOM0NqSffzHWFZSO ZTvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=MRdCoSuj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u14-20020a170903124e00b001a2a4eb10d6si3502485plh.58.2023.06.01.14.38.59; Thu, 01 Jun 2023 14:39:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=MRdCoSuj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232853AbjFAVhP (ORCPT + 99 others); Thu, 1 Jun 2023 17:37:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229618AbjFAVhL (ORCPT ); Thu, 1 Jun 2023 17:37:11 -0400 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5248C184 for ; Thu, 1 Jun 2023 14:37:10 -0700 (PDT) Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-651ffcc1d3dso610747b3a.3 for ; Thu, 01 Jun 2023 14:37:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1685655430; x=1688247430; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3FwIy9pdxSPLLDGVrHowuSMAgkehvs21QOIs4DuKC6A=; b=MRdCoSujmCnjjOacpNHectteICFpfTy0Q7HRW6iFcJoXa0fZhuuEBFYooU/G8NXg2X HfAG3gvX2a17Cc1yGXHsw3CBdxIMjz24Xa8DvLZVxCCds24Mumi4TVNGg8ZmNyV/Svls MmHnVj0glIpRBoHcvAP9y7A/SWAwUDBE3yhk0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685655430; x=1688247430; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3FwIy9pdxSPLLDGVrHowuSMAgkehvs21QOIs4DuKC6A=; b=cAZxwfcXAFllZAtAnINbZeBM6rvIcq8m+s+rrAgWZ+cAKdOhgeohUKyt4iXmliuLwu didABgGHCEMXSnV9lC3ykbcUdG15B7hFbqL83SzZPJ4jRbDlVL894JOeGQNGa8yaoNiF IJ24NzKU+Rzv4mr/A2G7pNLIEIVIA0oDQxKb41Oe5Ocph+d3dVWpUf/N6MTUieigQ44p /2zQauZc5SWJVvmPfaVB4dmbqgHvHnLXlnINWqE28ZwMZVXJLKb8JBgsG2tUlAf467qC uRFM9Ty1mIaldepxyGD91Y+Xu0N6xukC8nUBjGS5NVUL3wGS6sdTJSb2TVDmI1LWVcG/ 0vpg== X-Gm-Message-State: AC+VfDwgIpj1Fo+P8VbMvSuQNCgvm0cg6tGW2tEo5osxAzeBnktbjTBZ WjMNiuU6a0W33YWhBIn3zIE1qw== X-Received: by 2002:a05:6a20:2451:b0:106:c9b7:c92f with SMTP id t17-20020a056a20245100b00106c9b7c92fmr8938270pzc.49.1685655429931; Thu, 01 Jun 2023 14:37:09 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:11b8:2d2:7e02:6bff]) by smtp.gmail.com with ESMTPSA id g22-20020aa78756000000b0064d48d98260sm5319534pfo.156.2023.06.01.14.37.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 14:37:09 -0700 (PDT) From: Douglas Anderson To: Mark Rutland , Catalin Marinas , Will Deacon , Sumit Garg , Daniel Thompson , Marc Zyngier Cc: linux-perf-users@vger.kernel.org, ito-yuichi@fujitsu.com, Chen-Yu Tsai , Ard Biesheuvel , Stephen Boyd , Peter Zijlstra , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, kgdb-bugreport@lists.sourceforge.net, Masayoshi Mizuma , "Rafael J . Wysocki" , Lecopzer Chen , Douglas Anderson , Frederic Weisbecker , "Gautham R. Shenoy" , Ingo Molnar , linux-kernel@vger.kernel.org Subject: [PATCH v9 2/7] arm64: idle: Tag the arm64 idle functions as __cpuidle Date: Thu, 1 Jun 2023 14:31:46 -0700 Message-ID: <20230601143109.v9.2.I4baba13e220bdd24d11400c67f137c35f07f82c7@changeid> X-Mailer: git-send-email 2.41.0.rc2.161.g9c6817b8e7-goog In-Reply-To: <20230601213440.2488667-1-dianders@chromium.org> References: <20230601213440.2488667-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767537956396497283?= X-GMAIL-MSGID: =?utf-8?q?1767537956396497283?= As per the (somewhat recent) comment before the definition of `__cpuidle`, the tag is like `noinstr` but also marks a function so it can be identified by cpu_in_idle(). Let'a add this. After doing this then when we dump stack traces of all processors using nmi_cpu_backtrace() then instead of getting useless backtraces we get things like: NMI backtrace for cpu N skipped: idling at cpu_do_idle+0x94/0x98 NOTE: this patch won't make cpu_in_idle() work perfectly for arm64, but it doesn't hurt and does catch some cases. Specifically an example that wasn't caught in my testing looked like this: gic_cpu_sys_reg_init+0x1f8/0x314 gic_cpu_pm_notifier+0x40/0x78 raw_notifier_call_chain+0x5c/0x134 cpu_pm_notify+0x38/0x64 cpu_pm_exit+0x20/0x2c psci_enter_idle_state+0x48/0x70 cpuidle_enter_state+0xb8/0x260 cpuidle_enter+0x44/0x5c do_idle+0x188/0x30c Signed-off-by: Douglas Anderson Acked-by: Mark Rutland --- Changes in v9: - Added to commit message that this doesn't catch all cases. Changes in v8: - "Tag the arm64 idle functions as __cpuidle" new for v8 arch/arm64/kernel/idle.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/idle.c b/arch/arm64/kernel/idle.c index c1125753fe9b..05cfb347ec26 100644 --- a/arch/arm64/kernel/idle.c +++ b/arch/arm64/kernel/idle.c @@ -20,7 +20,7 @@ * ensure that interrupts are not masked at the PMR (because the core will * not wake up if we block the wake up signal in the interrupt controller). */ -void noinstr cpu_do_idle(void) +void __cpuidle cpu_do_idle(void) { struct arm_cpuidle_irq_context context; @@ -35,7 +35,7 @@ void noinstr cpu_do_idle(void) /* * This is our default idle handler. */ -void noinstr arch_cpu_idle(void) +void __cpuidle arch_cpu_idle(void) { /* * This should do all the clock switching and wait for interrupt