From patchwork Thu Mar 16 15:56:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Andrushchenko X-Patchwork-Id: 9628799 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 468FC6048C for ; Thu, 16 Mar 2017 15:56:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37D0E2866E for ; Thu, 16 Mar 2017 15:56:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C74928675; Thu, 16 Mar 2017 15:56:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ADEA02866E for ; Thu, 16 Mar 2017 15:56:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=AlDxDwtNVSbBLHoDuEU8u7SeUAmCWeFpUuG/WcreP0o=; b=Bbq WEPBLtEiC366zv3ZXih/9gHzWlBTMrsf96jdBp9fbdnrdcYqFL2S6778c6BlwXD+n8z4mgiGZCUYp MJK5ri0s09P2eIvbRhNtNwFd1eBNmMGoRyWbgCOSqCVrT0Kinx9ciIg00AvjiqH+L7/FNoQRIT72V GUmAEo9bR8f1RvauVVUQR0cbUMufXZA/teowk1Nn/IVu5qCu0u2s/uWA2q0d7FShvQaNRJq2Ls5c/ Qc6lL1AKgGlqWe1KvdwLe42Q6DWPCgygF7xoX4ZxRIWL2tZPTn9UQnznVwP7sKW7FIuiPrCdRu+9x CytmEAz+Ass5DEjUms7+I0DdE2qQY+g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1coXlV-0005vF-BG; Thu, 16 Mar 2017 15:56:37 +0000 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1coXlR-0005tX-89 for linux-arm-kernel@lists.infradead.org; Thu, 16 Mar 2017 15:56:35 +0000 Received: by mail-wm0-x243.google.com with SMTP id x124so4824118wmf.3 for ; Thu, 16 Mar 2017 08:56:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=V4RwuQck7cZy86D2wbUg9DTSMEVZFCVB8CxePrre5dU=; b=TifR9DdCLT0ERFXCOkCQWWz5+jF9+8ij9PScGnZ1jyqyDhQP/habY7EJA79ZZALIJG HkaLVM4TtE0F/V3FOP5wISVecGyBnWUcnFYN763nxXMEq61XaaBzLTiXV0ZZvHfSjeE6 mOf9u7MceBfQYpyY4jBjnqMgHiuilxXOwSXfBgkQb+d91xuS27p3+f/zlVR7FhoVeFqK YbeIVm1JV3CACMQcwvS10V2FF9b3akFRSf40rSUbCpZitj+fV7AAzl+vcoFBj5NeJAtz KGRq/lDC8N+qkiJlvDaB65a8CVnyhdww0GNfpM2/C08AyJSej5e7M2YFo9QTPsTxoJpM 5Jag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=V4RwuQck7cZy86D2wbUg9DTSMEVZFCVB8CxePrre5dU=; b=Ox2leUJaCHu9/5qWehERMHtiVPVjo2PEcZiTAJ5I5MUqCzOu4ZNyY94RrITaNR+1eA v8g6cWm+xraGJRbZOvt4vrw5JxkScZfRevDrVRiWWOg6sG4Mr6YdAMW8bOiHxpdamFxl 09k4Qjyt1Auc18Js2yhIhLf2JhSFmwSkFsENOlgBllIwj6toO+oz0rBjeNipQ4L3iBYs 6Ip8065pGiUGLvFbKl6UOOmBi4I5MQ/bcB88BAXcJ+5g/yPE4QLWCBfRO73/J8ojla93 5qJOqanZkfCpJta4dcPzWe2g6oKPtdj0JdElIaGqBajPmmH6ZxviMxXEbXZg9Lcnkwk7 6Lgw== X-Gm-Message-State: AFeK/H0GuSZ7iJxMavOuWUgfiIlbPOuK712vKye/MR4XbpGqziLygL0IsUGDzQMw//uoVA== X-Received: by 10.28.135.21 with SMTP id j21mr9298544wmd.70.1489679770960; Thu, 16 Mar 2017 08:56:10 -0700 (PDT) Received: from a2k-HP-ProDesk-600-G2-SFF.kyiv.epam.com (ll-51.209.223.85.sovam.net.ua. [85.223.209.51]) by smtp.gmail.com with ESMTPSA id y1sm4748349wme.15.2017.03.16.08.56.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Mar 2017 08:56:10 -0700 (PDT) From: Oleksandr Andrushchenko To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] arm64: add support for on-demand backtrace of other CPUs Date: Thu, 16 Mar 2017 17:56:04 +0200 Message-Id: <1489679764-14408-1-git-send-email-andr2000@gmail.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170316_085633_449492_2A5FB251 X-CRM114-Status: GOOD ( 10.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Oleksandr Andrushchenko , vlad.babchuk@gmail.com, catalin.marinas@arm.com, will.deacon@arm.com, andrii.anisov@gmail.com, olekstysh@gmail.com, al1img@gmail.com, joculator@gmail.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Oleksandr Andrushchenko Add missing support for on-demand backtrace of other CPUs for ARM64. Signed-off-by: Oleksandr Andrushchenko --- arch/arm64/include/asm/irq.h | 6 ++++++ arch/arm64/kernel/smp.c | 20 +++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/irq.h b/arch/arm64/include/asm/irq.h index b77197d941fc..56e09c0e8eaf 100644 --- a/arch/arm64/include/asm/irq.h +++ b/arch/arm64/include/asm/irq.h @@ -56,5 +56,11 @@ static inline bool on_irq_stack(unsigned long sp, int cpu) return (low <= sp && sp <= high); } +#ifdef CONFIG_SMP +extern void arch_trigger_cpumask_backtrace(const cpumask_t *mask, + bool exclude_self); +#define arch_trigger_cpumask_backtrace arch_trigger_cpumask_backtrace +#endif + #endif /* !__ASSEMBLER__ */ #endif diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index ef1caae02110..70175d3ec0e5 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -78,7 +79,8 @@ enum ipi_msg_type { IPI_CPU_STOP, IPI_TIMER, IPI_IRQ_WORK, - IPI_WAKEUP + IPI_WAKEUP, + IPI_CPU_BACKTRACE }; #ifdef CONFIG_ARM64_VHE @@ -883,6 +885,12 @@ void handle_IPI(int ipinr, struct pt_regs *regs) break; #endif + case IPI_CPU_BACKTRACE: + irq_enter(); + nmi_cpu_backtrace(regs); + irq_exit(); + break; + default: pr_crit("CPU%u: Unknown IPI message 0x%x\n", cpu, ipinr); break; @@ -956,3 +964,13 @@ bool cpus_are_stuck_in_kernel(void) return !!cpus_stuck_in_kernel || smp_spin_tables; } + +static void raise_nmi(cpumask_t *mask) +{ + smp_cross_call(mask, IPI_CPU_BACKTRACE); +} + +void arch_trigger_cpumask_backtrace(const cpumask_t *mask, bool exclude_self) +{ + nmi_trigger_cpumask_backtrace(mask, exclude_self, raise_nmi); +}