From patchwork Fri Jul 28 00:02:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Ogness X-Patchwork-Id: 12733 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp88481vqg; Thu, 27 Jul 2023 17:07:22 -0700 (PDT) X-Google-Smtp-Source: APBJJlF5QHZEKJaZQPp1xdT5iqDc3kjC1eB6ltAMxtYLeG/WqvDwhRVjxgHnD1hNkjNWzYCBQrQ8 X-Received: by 2002:a05:6a20:840d:b0:12d:23ea:9ccc with SMTP id c13-20020a056a20840d00b0012d23ea9cccmr124923pzd.39.1690502842243; Thu, 27 Jul 2023 17:07:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690502842; cv=none; d=google.com; s=arc-20160816; b=NGFfcNAVHbK/HWMh1bQzu1fwQP1a5GIqcliGuwcw5NnBNjFUNY+sJ+bchNBUxsjRnn to7qly+xLrH2zBZSTBNks65v74+zIbZBCDN3wIEt3GMF3ZBBDtXyYoEM1LkMq8JA8wEW ML5xw57sxpo1eDt45IOONUEOy/LnRMV9QkTMmzVTKC2LsG5d1F9sQ4V0H5A94Vqpx4q/ OdM2eexdYtaXPmVh99taSMuNTDbDRiC3oAgzBRw84x6/Xh2VKd6VKo71YD5wTUAGWrHq us8f+Bc2mwAri22X8NtTi977FZ4oUrG1ZOvfRBirSngi3yDVUuxpa94qcAQKEcdiVS/L hBJg== 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=7VJGt1oaLzPzNdavyJrVicoAw+051RIQFfoOM0HgoeU=; fh=I/6bvJz6sWq8p1xoNUgGjc7lme65GQ/wcdq821dg0a8=; b=Mff8QZmzleXYpQMth9Lt52wiZQgnYAtceEIiO/Q3cTnH52OgNkFS+n2ZBjAY1J6ivn DsZpUornKTdsHzbnP9XPcdCVzy5plNd3Wny48IP5vPfn+OukYX/b0hUGS1m59UGkx0CL HLM/qyExBoKKrrrvqGEfxJX8o91um5hDahXFuuz227PnKPSl1a3snHNs51G9mW8o1D+S PPDpZCW1Z74Z9ECpfVmDVMX+Ps5Ws002ZgBV1opnyIaaaBLhSmGUwKa3NVd7uvqwLDdj inZLKFF0KOjzE7QcSpeeQtrYBW60P8TNAX7RIU2tXF54IRIs+L2+RKlyIsUzpfK1e9rX 2ZMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=dQK4Uv3J; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=FRGww273; 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 h132-20020a62838a000000b0067bc790ce11si482480pfe.161.2023.07.27.17.07.01; Thu, 27 Jul 2023 17:07:22 -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=dQK4Uv3J; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=FRGww273; 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 S231572AbjG1ACp (ORCPT + 99 others); Thu, 27 Jul 2023 20:02:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229621AbjG1ACl (ORCPT ); Thu, 27 Jul 2023 20:02:41 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C65F71FC4 for ; Thu, 27 Jul 2023 17:02:39 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1690502556; 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=7VJGt1oaLzPzNdavyJrVicoAw+051RIQFfoOM0HgoeU=; b=dQK4Uv3Jodc5Kva/yhj7snHQMbc4IQxTJMp4U872Rxlxuappy4YirzsNEJmcF+0S/uJmRk 962OlizcyNyzUieKkvemuiiUUnujNDvPQRzqpfJQzFlmiA2a9+F0n/Qtq+i9K5xSlXgdrc Y1hAKdbcW9wlhERuxx1l64FrMQC3cG05hRJ4CRXI8AZb+fmY7VZKhGa6UtvDSNUZ8Z9Gve wvujpa/2zcMhMVXs6mdF93jR46ON1sCb5cXFwtlD7ZvuVLcBgQQsxBDLwXcoTSFbV5jjiE l/07s4ZkDCBnRXxoC6sn0BcwvnyhKPpRHspEKHh+ME/ERTsxn5v/oqib0K0AFw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1690502556; 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=7VJGt1oaLzPzNdavyJrVicoAw+051RIQFfoOM0HgoeU=; b=FRGww273bt+j0G7gz/jDlCvorOZWl24p2vIVefkL/ZJvV5Q1bemqEJiBEf869gCwu9JLzP KFKmOA+icKLXn4Ag== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: [PATCH printk v2 0/8] wire up nbcon consoles Date: Fri, 28 Jul 2023 02:08:25 +0206 Message-Id: <20230728000233.50887-1-john.ogness@linutronix.de> MIME-Version: 1.0 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,T_SCC_BODY_TEXT_LINE, 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772620708026807871 X-GMAIL-MSGID: 1772620708026807871 Hi, This is v2 of a series to introduce the new non-BKL (nbcon) consoles. This series is only a subset of the original v1 [0]. In particular, this series represents patches 5-10 of the v1 series. For information about the motivation of the atomic consoles, please read the cover letter of v1. This series focuses on wiring up the printk subsystem to be able to use the nbcon consoles and implement their ownership interfaces and rules. This series does _not_ include threaded printing, atomic printing regions, or nbcon drivers. Those features will be added in separate follow-up series. There is not much that has _not_ changed since v1. Here is an attempt to list the changes: - new naming: OLD NEW bkl legacy nobkl nbcon CON_NO_BKL CON_NBCON cons_() nbcon_() - rather than allocating context objects per-cpu, per-prio, and per-console, require the context object to sit on the stack - serialize nbcon consoles with the console_lock until there are no more boot consoles registered - update @have_boot_console and @have_legacy_console on unregister_console() - only use @nbcon_seq for the nbcon sequence counter - avoid console lock in __pr_flush() if there are only nbcon consoles - use only 1 state variable instead of CUR and REQ states - replace saved states in the context with boolean flags - use atomic long for nbcon_seq, expanded as needed on 32bit systems - instead of the owner performing the handover, now the owner gives up ownership and the waiter takes ownership - remove unnecessary state and context fields - simplify sequence tracking by only allowing incrementing (positive) updates - simplify buffer handling by only allowing hostile takeovers in the single panic context - remove early buffer handling because there is no early window - carefully consider individual state bits rather than performing general set compares - split the code for various locking strategies based on complete methods rather than functional pieces John Ogness [0] https://lore.kernel.org/lkml/20230302195618.156940-1-john.ogness@linutronix.de John Ogness (1): printk: Provide debug_store() for nbcon debugging Thomas Gleixner (7): printk: Add non-BKL (nbcon) console basic infrastructure printk: nbcon: Add acquire/release logic printk: nbcon: Add buffer management printk: nbcon: Add sequence handling printk: nbcon: Add ownership state functions printk: nbcon: Add emit function and callback function for atomic printing printk: nbcon: Add functions for drivers to mark unsafe regions include/linux/console.h | 132 +++++ kernel/printk/Makefile | 2 +- kernel/printk/internal.h | 29 ++ kernel/printk/printk.c | 156 ++++-- kernel/printk/printk_nbcon.c | 955 +++++++++++++++++++++++++++++++++++ 5 files changed, 1243 insertions(+), 31 deletions(-) create mode 100644 kernel/printk/printk_nbcon.c base-commit: 132a90d1527fedba2d95085c951ccf00dbbebe41