From patchwork Mon Nov 2 11:44:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 11873707 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D27E9C2D0A3 for ; Mon, 2 Nov 2020 11:47:50 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 76259222B9 for ; Mon, 2 Nov 2020 11:47:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="0TNIfOXV"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Vr5aHR13" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 76259222B9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To: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:List-Owner; bh=VINxPcshE56Kbg0totfdNvzJN5+5VXbpb1ewJZ1R9/I=; b=0TNIfOXVBfyEmVYNu6GHhKlBWM FK1L8QvdhBpRjS1tDsQO9/3HAuHkv/Hnjc7UClsC1IwZ6oU/hxdWboZX8wUJkGLX5dzeKMmUz33NF S1gH7QRh0NhQ2Hq+kbAO1fQpssj30fsomdTzmCSLklHt3iUxRa8lOLk9NharkYvsW1Z4Z6Bwn/j9H eB+4sqEKqjKePrOu253X56RI8g5STKVRSciy9q2Qd9rrmczsIXcI/dk9wsUibgXXulRWiLPIZVzQ2 oSP7HNToLsDJyUWeIU+fUbRNwdjLvEg1c6S1ZT7FLmWTzjbChcm+/t2FOLPdtjBFPWIzXiHOeRKX6 3M6bb3LQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZYIq-0007dc-VO; Mon, 02 Nov 2020 11:47:13 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZYID-0007MZ-N0 for linux-arm-kernel@lists.infradead.org; Mon, 02 Nov 2020 11:46:34 +0000 Received: by mail-pg1-x543.google.com with SMTP id z24so10582931pgk.3 for ; Mon, 02 Nov 2020 03:46:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=onEvuddY7rjjmRNmF3inPaMsobQ6rmeVGOOE4kPhESY=; b=Vr5aHR13z2KIKtAwzdZ9s6RuU5nLQfx+2eKHmCn96yKknRT+ZskWrmJ8yaTYMU7fWA Duj06UU0FTvBMzrM2Pr/1EXdpd1MkKR4u8DSzE/cXXoIu/RyDBkLJKKUe93TQP2Wm5rf hFSWBvw5Qb1z4J3oRSY2qvEi1w86g4+e8BnVTllmTnVFPa87+8BVL0rk0aw9OP0YW0+D bwK9KSCqGu+AEQ7O7WhQ7SxBEVE5VEzdhEXC3uirBEKqUUTcFVohi3NdE8QMeghI5cde SX0R4CrRZA8D4lI4ATcq/88Bapzxz3tX8ALazIlthY7XTG13blWgKV/JHywhVKn9l2pS e8wA== 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:in-reply-to :references; bh=onEvuddY7rjjmRNmF3inPaMsobQ6rmeVGOOE4kPhESY=; b=tDOWXDQ6ffMz9zE2lhqsrbyDzopXMgQFbsINHcbffmGL1zA2fhIoz0EujQfb43lZis rD8PP/tSyXZUxbC3ORIGmb7P2XqpOps4+xoHqHrxURovTHszIvQ75rYNm82KNpB+1LnP BFE3242bkf4/c1Dd7aD+P62Wut/B9s9GV/t0pkrab4bPjNJobKnwhmqVU1s1ubBqM7se CTpt4eB7celwj9zYBYOaNn6dStwF6t7Z/1/GwytADTxInTzwnW0eqytpHaom9E9loEWu tfiSofuGIUPoNLameZlhuHOo6+4Re0F/6hASg1cZw24Jm3FtyfoysqVc1ZPOX9enwAuB xNaA== X-Gm-Message-State: AOAM5329pz0hUjzoZtu8XaXIT/E9YweUDEMFJSeMhhmHA1YHOz7RyUFU BG3NwersN2v/0gaAGH0yyklvHw== X-Google-Smtp-Source: ABdhPJz6Klrso4Ngfvn20QS7DmYsk6GOwWNXcIzsTkWC0MaK8geg5GBT9xWeV6BPg/9LlQGCX5EAwA== X-Received: by 2002:a17:90a:d104:: with SMTP id l4mr12488404pju.194.1604317591809; Mon, 02 Nov 2020 03:46:31 -0800 (PST) Received: from localhost.localdomain ([122.173.169.225]) by smtp.gmail.com with ESMTPSA id y5sm14276184pfq.79.2020.11.02.03.46.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Nov 2020 03:46:31 -0800 (PST) From: Sumit Garg To: maz@kernel.org, catalin.marinas@arm.com, will@kernel.org, daniel.thompson@linaro.org Subject: [PATCH v7 6/7] kgdb: Expose default CPUs roundup fallback mechanism Date: Mon, 2 Nov 2020 17:14:46 +0530 Message-Id: <1604317487-14543-7-git-send-email-sumit.garg@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1604317487-14543-1-git-send-email-sumit.garg@linaro.org> References: <1604317487-14543-1-git-send-email-sumit.garg@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201102_064633_914246_AD3B08D0 X-CRM114-Status: GOOD ( 18.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, Sumit Garg , tsbogend@alpha.franken.de, linux-kernel@vger.kernel.org, jason@lakedaemon.net, ito-yuichi@fujitsu.com, mpe@ellerman.id.au, x86@kernel.org, linux@armlinux.org.uk, dianders@chromium.org, mingo@redhat.com, bp@alien8.de, julien.thierry.kdev@gmail.com, jason.wessel@windriver.com, kgdb-bugreport@lists.sourceforge.net, tglx@linutronix.de, msys.mizuma@gmail.com, davem@davemloft.net, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a new API kgdb_smp_call_nmi_hook() to expose default CPUs roundup mechanism to a particular archichecture as a runtime fallback if it detects to not support NMI roundup. Currently such an architecture example is arm64 supporting pseudo NMIs feature which is only available on platforms which have support for GICv3 or later version. Signed-off-by: Sumit Garg --- include/linux/kgdb.h | 12 ++++++++++++ kernel/debug/debug_core.c | 8 +++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h index 0d6cf64..4190f13 100644 --- a/include/linux/kgdb.h +++ b/include/linux/kgdb.h @@ -200,6 +200,18 @@ kgdb_arch_handle_qxfer_pkt(char *remcom_in_buffer, extern void kgdb_call_nmi_hook(void *ignored); /** + * kgdb_smp_call_nmi_hook - Provide default fallback mechanism to + * round-up CPUs + * + * If you're using the default implementation of kgdb_roundup_cpus() + * this function will be called. And if an arch detects at runtime to + * not support NMI based roundup then it can fallback to default + * mechanism using this API. + */ + +extern void kgdb_smp_call_nmi_hook(void); + +/** * kgdb_roundup_cpus - Get other CPUs into a holding pattern * * On SMP systems, we need to get the attention of the other CPUs diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c index 1e75a89..ae785d8 100644 --- a/kernel/debug/debug_core.c +++ b/kernel/debug/debug_core.c @@ -241,7 +241,7 @@ void __weak kgdb_call_nmi_hook(void *ignored) } NOKPROBE_SYMBOL(kgdb_call_nmi_hook); -void __weak kgdb_roundup_cpus(void) +void kgdb_smp_call_nmi_hook(void) { call_single_data_t *csd; int this_cpu = raw_smp_processor_id(); @@ -273,6 +273,12 @@ void __weak kgdb_roundup_cpus(void) kgdb_info[cpu].rounding_up = false; } } +NOKPROBE_SYMBOL(kgdb_smp_call_nmi_hook); + +void __weak kgdb_roundup_cpus(void) +{ + kgdb_smp_call_nmi_hook(); +} NOKPROBE_SYMBOL(kgdb_roundup_cpus); #endif