From patchwork Wed Apr 19 22:56:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13217687 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 00AC1C6FD18 for ; Thu, 20 Apr 2023 00:01:40 +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=xDKkLmCWvbTH+7ypxaqNMJca16ABJBq6XaFZQqqr2qs=; b=Fl1FLwoILf11tq 2t68bCYxGOXQaKfsqVluTnuARMHkFpNs65VbdxGKWqKV8xm4H8b9ca0tjTPhLHQXV+fhdBXTTnTIs He2WSf1Ju46tRb9puVphFD7CwSs3i8fnkahn/MHIEBXJhGI1Kn8kCNt5Ie/JMlAw3ycEJqzAshqLf I2+sHESQkBqqd94vmb6eqvnlP8vCQgQd5KYQQ4FfCOgIuPg3JMWmU+A+wd4Lh8JuDAylweEHV5xLv 7XbCu4kQT4W36vUkohPxCPjfHUpLvgq9fyGLukK186f0qavmVDXO4Z9d943iE4VqZvCF0B4zQi2nR Uv2ufM9uine5cxoFjHcA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ppHj8-006gdw-07; Thu, 20 Apr 2023 00:00:42 +0000 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ppGjm-006Yzy-04 for linux-arm-kernel@lists.infradead.org; Wed, 19 Apr 2023 22:57:19 +0000 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-51f597c97c5so255683a12.0 for ; Wed, 19 Apr 2023 15:57:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1681945037; x=1684537037; 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=g22FS7H3jiae+Nq35iKba9yRyiXUFZk5tjGcb2Ngrro=; b=I12V15zv0C6apw691aW9levIxgdcSXiKj994KdL77DgbZjGB9+wGZjupAC8Yjj+94l I2rEcmLlXEU/axqyDoo0R6CwAxucD+HcDQl0ePN+qZMHOnthxCTrHLDkn/xVoMejl+qb Me8n3aplq6CQK1d9jjQseR8w1Z4mM8oCUhL24= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681945037; x=1684537037; 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=g22FS7H3jiae+Nq35iKba9yRyiXUFZk5tjGcb2Ngrro=; b=PFYDE7oP9YshqD7WRnyMwu/K1NwxXtge1hwqmgcaSF/gaFpWWb9kfLBGZizuQaaX50 WBla6ThbGM8TUr77MtOxTgbZ2AG0kFCJ+Qclfo3nHsDItc3kcwwaWCaL2YPdMeu4aWEY 9lyLeqllType6XLn5gUFoIhK0BnRyB577Ic9B5ByDT+izsusybf+2MOgxxm4FEQA9b00 J6DmymS9Ihg9gTNafLuAlEQ/pq0zmOJJS1pThTSpxRzLvoGTXAZD9KT99Vjc72afKDO5 M2n5TtmdFNpS8q4981eI93j6hiA0aI/jDCJd9FYcCzdL0Zf1VvdqHWNjEB2DuKrzngxf RISw== X-Gm-Message-State: AAQBX9d2FfWNsL3uZtceSjW8qTaBxfwUsvAp6K9ZPYIl7LwrNo+o+xWF a4rJQYI9cwW8KUElflnxooybvALvb7nUyuufYFQ= X-Google-Smtp-Source: AKy350ZwQMfndFrterU/j3ICOpzairok4fxxMIEh8n95ls1l91IwUIv+MTPvdfsHLoUmgY2boXCeJA== X-Received: by 2002:a17:90a:6707:b0:247:6619:61de with SMTP id n7-20020a17090a670700b00247661961demr4179810pjj.46.1681945037310; Wed, 19 Apr 2023 15:57:17 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:8b1:fa03:670e:b784]) by smtp.gmail.com with ESMTPSA id h15-20020a17090aea8f00b00246ea338c96sm1847101pjz.53.2023.04.19.15.57.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 15:57:16 -0700 (PDT) From: Douglas Anderson To: Catalin Marinas , Will Deacon , Sumit Garg , Daniel Thompson , Marc Zyngier , Mark Rutland Cc: ito-yuichi@fujitsu.com, kgdb-bugreport@lists.sourceforge.net, Chen-Yu Tsai , Masayoshi Mizuma , Peter Zijlstra , Ard Biesheuvel , "Rafael J . Wysocki" , linux-arm-kernel@lists.infradead.org, Stephen Boyd , Lecopzer Chen , Thomas Gleixner , linux-perf-users@vger.kernel.org, Douglas Anderson , Jason Wessel , linux-kernel@vger.kernel.org Subject: [PATCH v8 07/10] kgdb: Expose default CPUs roundup fallback mechanism Date: Wed, 19 Apr 2023 15:56:01 -0700 Message-ID: <20230419155341.v8.7.I21d92f8974c8e4001a5982fea6c98da1bed33ef5@changeid> X-Mailer: git-send-email 2.40.0.634.g4ca3ef3211-goog In-Reply-To: <20230419225604.21204-1-dianders@chromium.org> References: <20230419225604.21204-1-dianders@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230419_155718_054865_E3A96D80 X-CRM114-Status: GOOD ( 15.44 ) 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 From: Sumit Garg 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 Tested-by: Chen-Yu Tsai Signed-off-by: Douglas Anderson --- (no changes since v1) 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 258cdde8d356..87713bd390f3 100644 --- a/include/linux/kgdb.h +++ b/include/linux/kgdb.h @@ -199,6 +199,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 * diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c index d5e9ccde3ab8..14d40a7d6a4b 100644 --- a/kernel/debug/debug_core.c +++ b/kernel/debug/debug_core.c @@ -238,7 +238,7 @@ NOKPROBE_SYMBOL(kgdb_call_nmi_hook); static DEFINE_PER_CPU(call_single_data_t, kgdb_roundup_csd) = CSD_INIT(kgdb_call_nmi_hook, NULL); -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(); @@ -269,6 +269,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