From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DED2C433EF for ; Tue, 9 Nov 2021 01:17:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5F9FA61A35 for ; Tue, 9 Nov 2021 01:17:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229879AbhKIBTl (ORCPT ); Mon, 8 Nov 2021 20:19:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:44354 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242266AbhKIBRL (ORCPT ); Mon, 8 Nov 2021 20:17:11 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5F0F761A4F; Tue, 9 Nov 2021 01:06:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636420008; bh=2Fz1alJR0sRa2U93z50qxHzPvVUeyZ90gC0q24iS+fI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QpdSq6q6q/VLgWJgVYJ1hbyl21HMjJmlNb4rdWpghObedZKkG7no1Tvk20eFxDxjM 1HED0qlwsCfnSY+Ad/+bKdTEC1AA83PISEw5byHkzwXfVPgDC5YI/xvbI0u3wxRsHc f+FXGWG7M0W6FCjYRL6Hwm5q5fUgPbfkwpwkEUN1iGC0NDkhgoe2c1vMKfHdLV+qCB 4ZzJbOwI9SulFufqz8Zm/DuSsfnz+GEJknF3wnr8YWqtJ6Ce49+Brb95X9fL+Xc3Iz nOT6d9tUkv9RUnqE0FhtgUXLkPuZoD9YgKF4ABgcSpTFvi6ShlhF2a2N0JSCmhF8B2 iF0uFJWAC4rOw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sven Schnelle , Helge Deller , Sasha Levin , James.Bottomley@HansenPartnership.com, valentin.schneider@arm.com, peterz@infradead.org, mingo@kernel.org, ardb@kernel.org, linux-parisc@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 47/47] parisc/kgdb: add kgdb_roundup() to make kgdb work with idle polling Date: Mon, 8 Nov 2021 12:50:31 -0500 Message-Id: <20211108175031.1190422-47-sashal@kernel.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211108175031.1190422-1-sashal@kernel.org> References: <20211108175031.1190422-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Sven Schnelle [ Upstream commit 66e29fcda1824f0427966fbee2bd2c85bf362c82 ] With idle polling, IPIs are not sent when a CPU idle, but queued and run later from do_idle(). The default kgdb_call_nmi_hook() implementation gets the pointer to struct pt_regs from get_irq_reqs(), which doesn't work in that case because it was not called from the IPI interrupt handler. Fix it by defining our own kgdb_roundup() function which sents an IPI_ENTER_KGDB. When that IPI is received on the target CPU kgdb_nmicallback() is called. Signed-off-by: Sven Schnelle Signed-off-by: Helge Deller Signed-off-by: Sasha Levin --- arch/parisc/kernel/smp.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c index 5e26dbede5fc2..ae4fc8769c38b 100644 --- a/arch/parisc/kernel/smp.c +++ b/arch/parisc/kernel/smp.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -74,7 +75,10 @@ enum ipi_message_type { IPI_CALL_FUNC, IPI_CPU_START, IPI_CPU_STOP, - IPI_CPU_TEST + IPI_CPU_TEST, +#ifdef CONFIG_KGDB + IPI_ENTER_KGDB, +#endif }; @@ -170,7 +174,12 @@ ipi_interrupt(int irq, void *dev_id) case IPI_CPU_TEST: smp_debug(100, KERN_DEBUG "CPU%d is alive!\n", this_cpu); break; - +#ifdef CONFIG_KGDB + case IPI_ENTER_KGDB: + smp_debug(100, KERN_DEBUG "CPU%d ENTER_KGDB\n", this_cpu); + kgdb_nmicallback(raw_smp_processor_id(), get_irq_regs()); + break; +#endif default: printk(KERN_CRIT "Unknown IPI num on CPU%d: %lu\n", this_cpu, which); @@ -226,6 +235,12 @@ send_IPI_allbutself(enum ipi_message_type op) } } +#ifdef CONFIG_KGDB +void kgdb_roundup_cpus(void) +{ + send_IPI_allbutself(IPI_ENTER_KGDB); +} +#endif inline void smp_send_stop(void) { send_IPI_allbutself(IPI_CPU_STOP); } -- 2.33.0