Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7749948rwi; Mon, 24 Oct 2022 20:08:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6KHp2s4kg2A66eLijMtqbaCB13DkXTkTG3p/O6n/VBmRFGBRrB9gmneA7V4svj3nUyYWKj X-Received: by 2002:a17:907:6d84:b0:78d:f2b0:14c8 with SMTP id sb4-20020a1709076d8400b0078df2b014c8mr29407191ejc.749.1666667320460; Mon, 24 Oct 2022 20:08:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666667320; cv=none; d=google.com; s=arc-20160816; b=TXVRyUnu0+Q3RiIMuIqbxUCjFWkaPdobSZdX+NarnvQjBBM+XJmpU6WlHGl20gUVE6 EroGabYgJJoiYWnQEjjNVyQzVW/PnnkyOT8EIrD9TuPvXeYGsX3asqdF64o++Tb6/Q8n sfUJcAHGt9hdgP1DAFWgLTB0yZ+gDmLv4V44/0IMYygNZySvdqVjNH795j+SPjo37Eik a/0o5QDfrHvVvT0bUsgGLvyTiJvee65XAEbReahbqKdCqgVFxEnAnTfu1ZMhbW9eU4Lz 0kgKxHK8YUf69DBqPv8N2M7clG/6/fAXYpMklO6GqdazRo27A+ioOmQuHpvPTBRw7+ze gHzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ak7zVpqmX9JbVC+MV80uP0uvch3zk3QEsTkNiYdThmU=; b=ozUzGTYyUVccS6iv0fHZYCIHhuKDwovU/YRUWnVcBEJZSSPUdueZxMZb4866b/Vzo8 ht5pBDHQ7mLc0+Eto/owzjG08oufSFlNZIgofPvXOAtSyEoDn5RTiRholtnMj2dJg+BM T/ybzIPAy2co+DmTz4z2Rx9aITtAdJC4KExbPH9jATXU3skDcVwl2NTbvrtkcspeZvwX KoWOw6KAz+UCrRNahi4kzxLVahjdIvhTMdQMO6Cj/xDRprBf1WjXVn2vZJ7SVvfT9MGy 8xSPHF6uW8JHS34vlLaDuBq5o1M7GxAa9XPXOGqWE2t4ay99MMcalA7PcG/D6/vIxkSM 844g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VVj2UZgj; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c20-20020aa7c994000000b00461af57d736si1363347edt.278.2022.10.24.20.08.15; Mon, 24 Oct 2022 20:08:40 -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=@chromium.org header.s=google header.b=VVj2UZgj; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231565AbiJYBVr (ORCPT + 99 others); Mon, 24 Oct 2022 21:21:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231559AbiJYBVY (ORCPT ); Mon, 24 Oct 2022 21:21:24 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0747D1ADBF for ; Mon, 24 Oct 2022 17:47:41 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id k2so8896689ejr.2 for ; Mon, 24 Oct 2022 17:47:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ak7zVpqmX9JbVC+MV80uP0uvch3zk3QEsTkNiYdThmU=; b=VVj2UZgjKW7iLjIjmZ1MR4SJ5NXqYaYawUi1oSjocuBXvgJSo1rjLFy22VbFw5RPlV DkOqzTtsYpyeXjE4kCEM3t9rf09NAAvTbdfwt+rF5iou7TooHHypkGX0YZMvHtZzssH7 oUyDUvwhrZaKJOilCm54ZNV0G4ux7Es875Bsk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ak7zVpqmX9JbVC+MV80uP0uvch3zk3QEsTkNiYdThmU=; b=onChU4uQt1oQetklQEMKE8w9aGZiTQZwI6EhoDRcXXJpGNpb2p3eDFzJFx/cGsyqbl XnmtLwLBkLFQCTB2XDncASOiGqvZ9+2d5/sl2/7ebZdFmnTvsSNq1g8c1+XsqU7pPzLQ PYPvvqxcbBDNGXZpPhqgss+QaJR2yDS33wCpHIDQ9TrLlpfEobx6RXH5E9opiatiNnkE kJq1mPIxBMmRae0m344xZH2KmtfBUKEnX9L6qSGQQbH23i0mUm/7gmhph8lEijRtYzqH 5/DfH2EmtQ+IcEPF/pgUl+jHlSYcvZJ5XU1A4LZTuAL8KVYDDKugprWFWCWZgNnDO/nj mtkA== X-Gm-Message-State: ACrzQf3SvQWiXUpdwdUX98x33BxqN8oIZBaIWc3+VhiW9L4FnmXBZP/J xPA1TdrU4edbNpqgyQWTaT7th3l8xJq+4Msv X-Received: by 2002:a17:906:5d04:b0:77f:ca9f:33d1 with SMTP id g4-20020a1709065d0400b0077fca9f33d1mr30036768ejt.526.1666658859201; Mon, 24 Oct 2022 17:47:39 -0700 (PDT) Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com. [209.85.221.42]) by smtp.gmail.com with ESMTPSA id f13-20020aa7d84d000000b00458d383a6ddsm645143eds.44.2022.10.24.17.47.38 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Oct 2022 17:47:38 -0700 (PDT) Received: by mail-wr1-f42.google.com with SMTP id k8so9836663wrh.1 for ; Mon, 24 Oct 2022 17:47:38 -0700 (PDT) X-Received: by 2002:adf:db4b:0:b0:236:5665:a925 with SMTP id f11-20020adfdb4b000000b002365665a925mr12828901wrj.617.1666658857911; Mon, 24 Oct 2022 17:47:37 -0700 (PDT) MIME-Version: 1.0 References: <20221019145600.1282823-1-john.ogness@linutronix.de> <20221019145600.1282823-27-john.ogness@linutronix.de> In-Reply-To: <20221019145600.1282823-27-john.ogness@linutronix.de> From: Doug Anderson Date: Mon, 24 Oct 2022 17:47:25 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH printk v2 26/38] kdb: use srcu console list iterator To: John Ogness Cc: Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Jason Wessel , Daniel Thompson , Luis Chamberlain , Aaron Tomlin , kgdb-bugreport@lists.sourceforge.net Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 Hi, On Wed, Oct 19, 2022 at 7:56 AM John Ogness wrote: > > 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) { Maybe it wouldn't hurt to also have a comment saying that normally the console_srcu_read_lock() wouldn't be enough given that we're poking into each individual console and calling ->write() but that we're relying on the fact that all the other CPUs are stopped at the moment and thus we should be safe. -Doug