Received: by 2002:a05:622a:251a:b0:39a:b4a2:e86 with SMTP id cm26csp529477qtb; Wed, 19 Oct 2022 08:11:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5bDQycnjxq+HpL2c2ggys/qO4faPMIWIO8T8rD4L40iZU97FmqkaHXPvJbWOCnEWX+vyYu X-Received: by 2002:a17:907:7203:b0:792:56d7:2851 with SMTP id dr3-20020a170907720300b0079256d72851mr2515853ejc.268.1666192302438; Wed, 19 Oct 2022 08:11:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666192302; cv=none; d=google.com; s=arc-20160816; b=iis2iJbdhQmEvz6WjlkxH5SH/XYelnnif02FA46VQf2BmfkAhZDwl8RiW7TbGa3x3w VcjK7WDx416DcKwaM+rzOjpoTnnqQPR0lF/b14bBJ2X17eAkFaSp4lakJUh1tZZxvCPX 7GpSjdmDpd+jhbWWeXTiklSx/RJ1SjIvzjE5K3x2WzgXBeK3Dx8oBv6qO6EcQlPHoRSw fNChrp8iwt+3x/1xi9THoVl4psijWGBo4WJ5oiYDZ21Cj0oztbpGY1qUYHIv86ekJpBi jVYbwVJgjrBLq++SwhtuaATZGeNnoUZi0yNu4eoKjx4h6DbUzmzFW/w/pl88+D3EOna8 ASdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=l6JL8Q05OijoTEvKKyIiYa7K6VvZeDLREPexuqG68w4=; b=eRzv+KaEEOoM6LAsH06m4fIZjwB7RmtrSpJp6S2Awkx9n7V+2iPsFsmeyIwB93YwjP x4Jtvt8HL0Jcf1siMK89tzRj4RmO7T8AQZ2wlCUau/IuxtzLraQM0R6zdAkgFq+LSoQy uGBgrVQufYsRBJ66HTNRNkWH9ABz8EkEqkoo0lYDuu9iIda1GjfHZ/cBnsY6IHcsKcUv 1OWcBcVBvhlJgS66LECJCZRfQ+xcY6C1cBrBwSpD45VcX8EAJ6D9iZCymgdbw8HswLGM 169nwfpKkDOpDcB0yKAIiqJiDVxbxfJ/A9e6Yxh8SaDLLOBZP0aBlUFS2YQTu3QgWV0P s3EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=2lE2ZSVv; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n11-20020a05640205cb00b00452697eda4csi17237808edx.58.2022.10.19.08.11.14; Wed, 19 Oct 2022 08:11:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=2lE2ZSVv; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231931AbiJSPHD (ORCPT + 99 others); Wed, 19 Oct 2022 11:07:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229717AbiJSPFp (ORCPT ); Wed, 19 Oct 2022 11:05:45 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9DCD6573 for ; Wed, 19 Oct 2022 07:59:25 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1666191376; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l6JL8Q05OijoTEvKKyIiYa7K6VvZeDLREPexuqG68w4=; b=2lE2ZSVvaLYxX/mxts/imwzBNHAp8IFSDC/ai7lkxP1zyF6vpMFV8KAaG0pwB+zKzWkutn BNZQsjhTA+fE9mUGf/9zLZQuPNRIBu0owJpd7GDzfuULoEKri5Ic8olH4bE1eI5Rf1CKGy vTs3ThAfna4xN6EPjQmcBVcPNNwb7z99UsM+MaDiSMsHRWQQdQDukhcxIu7T4tOZ2TYmxg Bfdt5cy+/S+IRAvC/LS6NYxQYe0e79/FQQRYb/Mcd8jS8qxWB1iuXQe85SqXEhXYqiH8j4 +8mgUokSmCQOtAKhWeO3fUlqU5Flbi2cC2akX0Xw1B69Gv1ldKxWWm+8ITOUfQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1666191376; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l6JL8Q05OijoTEvKKyIiYa7K6VvZeDLREPexuqG68w4=; b=CQZkI2DXDnPwDZmhG2PVbvPciqqo6PQ6K7EPwjaFXRMKTNR/ZrE840g4rZSpD8aFVitZok a6Wx9DhxTm9LofBg== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Jason Wessel , Daniel Thompson , Douglas Anderson , Luis Chamberlain , Aaron Tomlin , kgdb-bugreport@lists.sourceforge.net Subject: [PATCH printk v2 26/38] kdb: use srcu console list iterator Date: Wed, 19 Oct 2022 17:01:48 +0206 Message-Id: <20221019145600.1282823-27-john.ogness@linutronix.de> In-Reply-To: <20221019145600.1282823-1-john.ogness@linutronix.de> References: <20221019145600.1282823-1-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,INVALID_DATE_TZ_ABSURD, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Guarantee safe iteration of the console list by using SRCU. Signed-off-by: John Ogness --- kernel/debug/kdb/kdb_io.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c index 550fe8b456ec..5c0bd93c3574 100644 --- a/kernel/debug/kdb/kdb_io.c +++ b/kernel/debug/kdb/kdb_io.c @@ -545,6 +545,7 @@ static void kdb_msg_write(const char *msg, int msg_len) { struct console *c; const char *cp; + int cookie; int len; if (msg_len == 0) @@ -558,7 +559,8 @@ static void kdb_msg_write(const char *msg, int msg_len) cp++; } - for_each_console(c) { + cookie = console_srcu_read_lock(); + for_each_console_srcu(c) { if (!console_is_enabled(c)) continue; if (c == dbg_io_ops->cons) @@ -577,6 +579,7 @@ static void kdb_msg_write(const char *msg, int msg_len) --oops_in_progress; touch_nmi_watchdog(); } + console_srcu_read_unlock(cookie); } int vkdb_printf(enum kdb_msgsrc src, const char *fmt, va_list ap) -- 2.30.2