From patchwork Wed Aug 30 19:11:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13370704 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 32F9CC6FA8F for ; Wed, 30 Aug 2023 19:14:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EudAdkUIvK1uqtjpZdWvDaX4+hCrb9qKr3CB16EV+9w=; b=Xg5e80QxpVG9Fk JVaslRWC494c/3wVn/DyG57Gb9vfof+khnbJ+4pB6PnVfKee6oS5eMir7UcXxb5DV+eeN4ld7ceNm f6/y6qFt4kWseDgGTWxdIWVerpbdUZz9pK8db+MtYkDaAn/Jqqczsa5ftDsiJ+8xcN7TqOzTLEFZZ smF1aeaCY1BPQtV1JLHSImc/vyWDA0ASgB7JUBWX+17GE3RLGZlCra9Hv8mqDKpIOxs7yTHzueWTI DhKJAmQUA/SGpRThPUiduQgroCdJtv46EAzV3FZo1N5Ewae3OnsDjKL+dMvOedugjgm3ukCa+JWTM u7ubJErIQOFMWBr4EgVg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qbQdf-00E3Ew-17; Wed, 30 Aug 2023 19:14:03 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qbQdU-00E37u-15 for linux-arm-kernel@lists.infradead.org; Wed, 30 Aug 2023 19:13:55 +0000 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1bf1935f6c2so8947945ad.1 for ; Wed, 30 Aug 2023 12:13:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1693422821; x=1694027621; darn=lists.infradead.org; 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=ZcYgzJmdMLPe2IlWA1yPnnbUqn3VnbnF5Y/j/01p/cw=; b=Q+X3f0F6kKmo/ZWdeZY8BgvtNtN1LN5vsPsVexi+heCDpngxbzu/yrHNNrO8g9nC1G dDwK7ox1zogmy2D0bRJQ+GtSBslW/F/wl5IcJvwnsGkL+DXZVFmwTa1Y9XXwNV5E4YRc pF6+V1EGm9Zn3GCq5OHzexuRh0TXQ988v3It8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693422821; x=1694027621; 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=ZcYgzJmdMLPe2IlWA1yPnnbUqn3VnbnF5Y/j/01p/cw=; b=fIVooYQIwvBBXNu8IBzpE21XAwtl7cJDm2uTVbRMVpeD7qgxlBCfMfZaCmKKaP822G 3ZJgu/fqYXw8hk6UVD4DO2WZBj9Oj0hbkKCHCFZsjZ2/N84zkKqJOQYIykrlJn8KSx6Y V3PexsyGJkX+SJNd5S/vPOJqf0wDKUba4pIXt26ULKNrnse+Qy6LNhCOWhXtZRxQzRNe lCsUEZtz3T/PDOkyTyPPlk15XqvhiR3cT9zqsrLn4KEZLs3fjbIWoNR2tLJEy6hx98XL ofVQ4X97GRkUxCa7/97Rt/AtoWEi8fXqRcOgqaTzoaStd+vPR8HOHleA7GiObPFUPS2p QN5A== X-Gm-Message-State: AOJu0YyOqz4JUAsC40E4tBXkL8oYX4WVWFr+Hur+pwGV0u4Tp0wgm5/k QrHAe2r/JDse7Hx6EMtL7dlSzg== X-Google-Smtp-Source: AGHT+IG6twoQxbusQyqNYajt9MUxkEGt9m+q9o/FOJcMdRNJj/VNJrOH6rag6dueRkF1UgSa1G+MZQ== X-Received: by 2002:a17:903:2448:b0:1bc:7312:78e2 with SMTP id l8-20020a170903244800b001bc731278e2mr835918pls.5.1693422820749; Wed, 30 Aug 2023 12:13:40 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:e315:dec6:467c:83c5]) by smtp.gmail.com with ESMTPSA id c15-20020a170902d48f00b001bbdf32f011sm11338928plg.269.2023.08.30.12.13.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 12:13:39 -0700 (PDT) From: Douglas Anderson To: Mark Rutland , Catalin Marinas , Will Deacon , Sumit Garg , Daniel Thompson , Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org, Masayoshi Mizuma , "Rafael J . Wysocki" , Chen-Yu Tsai , Lecopzer Chen , Tomohiro Misono , Stephane Eranian , kgdb-bugreport@lists.sourceforge.net, Peter Zijlstra , Thomas Gleixner , Stephen Boyd , ito-yuichi@fujitsu.com, linux-perf-users@vger.kernel.org, Ard Biesheuvel , Douglas Anderson , Frederic Weisbecker , Ingo Molnar , linux-kernel@vger.kernel.org Subject: [PATCH v12 2/7] arm64: idle: Tag the arm64 idle functions as __cpuidle Date: Wed, 30 Aug 2023 12:11:23 -0700 Message-ID: <20230830121115.v12.2.I4baba13e220bdd24d11400c67f137c35f07f82c7@changeid> X-Mailer: git-send-email 2.42.0.283.g2d96d420d3-goog In-Reply-To: <20230830191314.1618136-1-dianders@chromium.org> References: <20230830191314.1618136-1-dianders@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230830_121352_404481_F36223A1 X-CRM114-Status: GOOD ( 18.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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's add these markings to arm64 cpuidle functions With this change we get useful backtraces like: NMI backtrace for cpu N skipped: idling at cpu_do_idle+0x94/0x98 instead of useless backtraces when dumping all processors using nmi_cpu_backtrace(). 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 Acked-by: Mark Rutland Reviewed-by: Stephen Boyd Acked-by: Sumit Garg Signed-off-by: Douglas Anderson --- (no changes since v11) Changes in v11: - Updated commit message as per Stephen. 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