Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1091466rdb; Tue, 19 Sep 2023 22:02:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEo2x1PDEGh0x3Egx5fpQeL8j/aU9BtONNOIJNTEox+ggia3jGnAIDKN3eYeylRka4o4UVN X-Received: by 2002:a05:6a20:7d9b:b0:140:61f8:53f6 with SMTP id v27-20020a056a207d9b00b0014061f853f6mr2235387pzj.29.1695186133710; Tue, 19 Sep 2023 22:02:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695186133; cv=none; d=google.com; s=arc-20160816; b=K/5RdK4796bJNmmEzniyHoBzSx4cwCjKUsCAGNeSig/2sK4xMDXR0Aw1YKdtGWTzNv dX27KGI3RT4Lg0XN+ROol1UpqHF15x64Nn1o8s33iqO9SbW5oDlQ24566PpSzuL0eTQJ Hwm7EjAdKbZcFAFwHa5b9Vkfnp3grF5FUtD1uUhlfqFiuNNAUCyiGfes9shyMKvZzm1B x0fToIhAGgmuHrqm5IE2meAen9elcQyVsR6yJqi0rbtxpOw30ZdO4sm/CKX/NJ/Q6zbL d1FdMhtU3dWDUbj6xydQ6mxVneXCd8kp/SoQFXU7XS6ku0JvBrdOa3HRxEHoFEe/fuVI 9fOg== 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 :message-id:date:subject:cc:to:dkim-signature:dkim-signature:from; bh=nzxvbCzxz7qN1cIIZLKetlqtaurCcasvn+7mrQhoMjQ=; fh=LsXrtpVp2OrricHLQixItWf0/ibVpc6j6U1GpAnOhe8=; b=0NjobAZ9C8IQS2eq9RMA2x7+AtXo4uheOojYAQdi8oBiPwou9lgRwXFSpOJWweA6Fd l8ObkgppPfY6M2Xewh4ImhG858aQBvYr3CL9iFoFsQVPWwbIE9auAxLdkc8FaqTuPt0c 0BDwlPX2t2V6bQeQGRdtgo87bm1vnz9aUlDDJrF75ADTww2B4rgjD5l3UYCbjBgWa+jF IPxqjJzXJnSVhJJKDl6Udi+7H61O9A9dzMbjeLM0AYiRaUA8KJnio/Y9Pkvk31hYJ8VQ /D1I8/bRCeRvE2tSpgS4WFqOhl6NRfENXuOC0S4S5owzsDzimX1QhBRYHKbqRqA/td6Z ZZ2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Wje53M87; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id 193-20020a6301ca000000b00578a2466521si3095668pgb.676.2023.09.19.22.02.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 22:02:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Wje53M87; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id BAE5C8096598; Tue, 19 Sep 2023 16:09:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233379AbjISXJT (ORCPT + 99 others); Tue, 19 Sep 2023 19:09:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229853AbjISXJP (ORCPT ); Tue, 19 Sep 2023 19:09:15 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7081C5; Tue, 19 Sep 2023 16:09:09 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1695164945; 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; bh=nzxvbCzxz7qN1cIIZLKetlqtaurCcasvn+7mrQhoMjQ=; b=Wje53M876JfN5LLQw13s9jsLTYcM2iz2WsfsaJu1W25CEL3pj+JTS+9I8pptJ91VghY1TB /BpZQTyJqSG/SmIN4XwVWp318BLJLsiLHhzgwA9xdiKfQI6Dk/r3sqeQ25f5Xmzj8nCItS e4E5j/0yFp2hZ5uWd7zkbRKxZauodtkxwqWqzaA0jySwiAeyHvsatXijBiGKTBtiINwMdI da0JT2/GWnckhmZW/P/DLSz0YFTPZc8y02wBFckUDlL9NwSTkxeKOMPQYgZinC4L3Ym20H tCU0rKNLcUwdxTx9RR41zPkcNx9lZOtmC1UrPZ32IZCLXsdJl+9VdoEK9xaU7A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1695164945; 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; bh=nzxvbCzxz7qN1cIIZLKetlqtaurCcasvn+7mrQhoMjQ=; b=DdRh7TWdKUGH21ctW9qq2wUhtGIl/XOtFOH2ddBrMZl2ejFzOfgrzYJ6MsZ3hQsFEyrBk0 KH+1iKo400MLNqAA== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Kees Cook , Luis Chamberlain , Andrew Morton , Peter Zijlstra , Josh Poimboeuf , Andy Shevchenko , "Guilherme G. Piccoli" , Arnd Bergmann , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Mathieu Desnoyers , Lai Jiangshan , Zqiang , rcu@vger.kernel.org, Ingo Molnar , Will Deacon , Waiman Long Subject: [PATCH printk v2 00/11] wire up nbcon atomic printing Date: Wed, 20 Sep 2023 01:14:45 +0206 Message-Id: <20230919230856.661435-1-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INVALID_DATE_TZ_ABSURD, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 19 Sep 2023 16:09:23 -0700 (PDT) Hi, This is v2 of a series to wire up the nbcon consoles so that they actually perform atomic printing. This series is only a subset of the original v1 [0]. In particular, this series represents patches 14 and 16-18 of the v1 series. For information about the motivation of the atomic consoles, please read the cover letter of v1. This series focuses on providing the functionality and marking of atomic printing sections as well as wiring up the nbcon atomic printing to the general console_flush_all() function. This series does _not_ include threaded printing or nbcon drivers. Those features will be added in separate follow-up series. Note that the behavior of atomic printing in priority-elevated atomic printing sections differs from the legacy consoles. With atomic printing, the full set of urgent messages (WARN/OOPS/PANIC) are first stored into the ringbuffer and then afterwards flushed. This makes sure the full backtraces are available in the ringbuffer, even if they do not make it out to the console(s). This is in accordance with what was discussed at LPC 2022 [1]. A lot has changed since v1 and the patches no longer correlate 1:1. Here is an attempt to list the changes: - Rather than flushing the full ringbuffer with one nbcon console before moving to the next nbcon console, adapt the same flushing strategy as the legacy consoles: rotation through the consoles, one record at a time. - Introduce nbcon_atomic_emit_one() to perform the "lock, emit one record, unlock" pattern. (This is only a helper function.) - Introduce nbcon_console_emit_next_record() to act as the nbcon variant of console_emit_next_record(). This allows straight forward integration of nbcon consoles into console_flush_all(). - nbcon_atomic_flush() no longer takes any arguments. These were awkward for the caller. The context object is now hidden from the caller. - Introduce __nbcon_atomic_flush_all() as an internal helper function in order to hide the ability to attempt unsafe hostile takeovers from outside nbcon.c. - For printk_trigger_flush(), migration is disabled instead of preemption. - Add atomic write enforcement to oops and lockdep. - Comments and kerneldoc updated. John Ogness [0] https://lore.kernel.org/lkml/20230302195618.156940-1-john.ogness@linutronix.de [1] https://lore.kernel.org/lkml/875yheqh6v.fsf@jogness.linutronix.de John Ogness (7): printk: Make console_is_usable() available to nbcon printk: Let console_is_usable() handle nbcon printk: Add @flags argument for console_is_usable() printk: nbcon: Wire up nbcon into console_flush_all() panic: Add atomic write enforcement to oops rcu: Add atomic write enforcement for rcu stalls lockdep: Add atomic write enforcement for lockdep splats Thomas Gleixner (4): printk: nbcon: Provide functions to mark atomic write sections printk: nbcon: Provide function for atomic flushing printk: nbcon: Wire up nbcon console atomic flushing panic: Add atomic write enforcement to warn/panic include/linux/console.h | 4 + include/linux/printk.h | 6 + kernel/locking/lockdep.c | 7 ++ kernel/panic.c | 66 +++++++++++ kernel/printk/internal.h | 37 ++++++ kernel/printk/nbcon.c | 246 ++++++++++++++++++++++++++++++++++++++- kernel/printk/printk.c | 67 +++++------ kernel/rcu/tree_stall.h | 6 + 8 files changed, 396 insertions(+), 43 deletions(-) base-commit: 9757acd0a700ba4a0d16dde4ba820eb052aba1a7 -- 2.39.2