Message ID | 20221116162152.193147-14-john.ogness@linutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp232773wru; Wed, 16 Nov 2022 08:24:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf7S9HROEmLy0diCLlQAuRjDGTPwDZxzPLNpndCQ23TAj2Yjmj4EYpYb1x4WuOpJ8Xa1LJ7P X-Received: by 2002:a05:6402:40a:b0:461:a5ac:61d4 with SMTP id q10-20020a056402040a00b00461a5ac61d4mr19939813edv.340.1668615862907; Wed, 16 Nov 2022 08:24:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668615862; cv=none; d=google.com; s=arc-20160816; b=y1GDabFK/mfPz1moscEajZrGSClyKYXQX/LlJ6AsTODeG4lyoKJuP+sgy8TyBZdTpp aebLPRInRkeYNU7eekSGbDyq8TpOYJjf5ba2CyBm4trTD6KYNbSa2KK0+npvEjdtpnqc gDgddJRuZmU2+JKL8T9lTCG8EDRqzZ2flKYV4+gneCM4aQ4QDODDrQBeJi9r+aVB4Enm 4YChu7zzBDQob2iypXGDSfJEZ/mmG1ikVo7EPjitQAaTGIFR1THhGQvmM8BBvXWQ4rjq FMGVE+yGvXnFyVxWSNTlrpxqYAVCP6fdIJuQm6Ms+IqoAofA7jjJLLHiJfnEooxYSu1E TJyQ== 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=GEhKO0dJc2f16pdA5isP3tyKiWxAMb8gJwHLg9bJtvU=; b=s+bMFaF6nYlNeeIrZzoYLmAvntKR53XJAGs80b5Q+3WUD2gAW2bPl5Z9tcVkSn/Xc7 2Rn7a09UGxMihdS1VgB8s5Dr6w2UUtbXis3sc2t6I3FJXWw94fDqao0ci6LLIqRl+z1V xxHlwR6iYz6Mto8Eexa/vu/n1GciwS+qdIq0ShOAhr/ZqKkrCnNUNBE+8w9b51tMSE0I 2Q5r8YJWyGY0JGHUavKP3Gi9yWV9J6PIYhUzOwLFW3KsRocBoVrDWPOvezuIwFyqtkp1 vnJayt/ftQYktqg6ZKWy9DiX5AjEgBIJTA5W9a+UGhA0zMmT6AWUx2plX3w459V32ajp dqAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=oIuBdriz; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=OZ7EGuhs; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o22-20020a509b16000000b00462e23be64fsi13010272edi.578.2022.11.16.08.23.57; Wed, 16 Nov 2022 08:24:22 -0800 (PST) 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=oIuBdriz; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=OZ7EGuhs; 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 S238258AbiKPQXH (ORCPT <rfc822;just.gull.subs@gmail.com> + 99 others); Wed, 16 Nov 2022 11:23:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234314AbiKPQWH (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 16 Nov 2022 11:22:07 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25EF849B6B for <linux-kernel@vger.kernel.org>; Wed, 16 Nov 2022 08:22:05 -0800 (PST) From: John Ogness <john.ogness@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668615723; 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=GEhKO0dJc2f16pdA5isP3tyKiWxAMb8gJwHLg9bJtvU=; b=oIuBdriz4JcEynWjZAm586o5EvapOAFjcQM7Y2h/jaFjTqDiY6uPhp8aLR8nBjL3sNQ3Dd wHZzRlW7PVlMFZSrjuZBAdlaxGYKCPXOLT+eJt0Bx/Bf77XSVU/Sdj0fUXPID4f2JKMYWO xth7HR45tX4LCgAiYQR9UtjW3xY/OwKJbQ+MTsyvDkIBwVQsRDJgcmxvXQmLUsb4ji4IMo 1l0xna2GGygbTY1KnRexudbFu2wA9TeXsj853JqPUmudt8ywLyxwW5Iiqh0Ree6FU5BaTz iM41PTKy8qkj5y2nB37PhrfFjKOUabUIaaJMqZLYTWFwtJKpjb3tdQms5EUKig== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668615723; 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=GEhKO0dJc2f16pdA5isP3tyKiWxAMb8gJwHLg9bJtvU=; b=OZ7EGuhsAVFVp8NSWYxYiCIDMCwa1My5MhuROv6LAzBXyKI2zB/l2XJjq2B5TvLEf2EdaF XZjkrE4iliwyN5CQ== To: Petr Mladek <pmladek@suse.com> Cc: Sergey Senozhatsky <senozhatsky@chromium.org>, Steven Rostedt <rostedt@goodmis.org>, Thomas Gleixner <tglx@linutronix.de>, linux-kernel@vger.kernel.org, Richard Weinberger <richard@nod.at>, Anton Ivanov <anton.ivanov@cambridgegreys.com>, Johannes Berg <johannes@sipsolutions.net>, linux-um@lists.infradead.org Subject: [PATCH printk v5 13/40] um: kmsg_dumper: use srcu console list iterator Date: Wed, 16 Nov 2022 17:27:25 +0106 Message-Id: <20221116162152.193147-14-john.ogness@linutronix.de> In-Reply-To: <20221116162152.193147-1-john.ogness@linutronix.de> References: <20221116162152.193147-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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749670546981606235?= X-GMAIL-MSGID: =?utf-8?q?1749670546981606235?= |
Series |
reduce console_lock scope
|
|
Commit Message
John Ogness
Nov. 16, 2022, 4:21 p.m. UTC
Rather than using the console_lock to guarantee safe console list traversal, use srcu console list iteration. Signed-off-by: John Ogness <john.ogness@linutronix.de> Reviewed-by: Petr Mladek <pmladek@suse.com> --- arch/um/kernel/kmsg_dump.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/arch/um/kernel/kmsg_dump.c b/arch/um/kernel/kmsg_dump.c index 40abf1e9ccb1..427dd5a61a38 100644 --- a/arch/um/kernel/kmsg_dump.c +++ b/arch/um/kernel/kmsg_dump.c @@ -16,29 +16,26 @@ static void kmsg_dumper_stdout(struct kmsg_dumper *dumper, struct console *con; unsigned long flags; size_t len = 0; + int cookie; /* * If no consoles are available to output crash information, dump * the kmsg buffer to stdout. */ - if (!console_trylock()) - return; - - for_each_console(con) { + cookie = console_srcu_read_lock(); + for_each_console_srcu(con) { /* * The ttynull console and disabled consoles are ignored * since they cannot output. All other consoles are * expected to output the crash information. */ if (strcmp(con->name, "ttynull") != 0 && - (con->flags & CON_ENABLED)) { + (console_srcu_read_flags(con) & CON_ENABLED)) { break; } } - - console_unlock(); - + console_srcu_read_unlock(cookie); if (con) return;