From patchwork Sat Sep 16 19:19:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Ogness X-Patchwork-Id: 14111 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1936491vqi; Sat, 16 Sep 2023 19:29:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFbj5gBr1ybsZ6stmTJo0A9KiXVbZgPbrbxiT0GO9VIYv1SjLoQ4L9afSJY8YOWWpiqNAAN X-Received: by 2002:a17:90a:6c06:b0:274:77b7:660 with SMTP id x6-20020a17090a6c0600b0027477b70660mr6593859pjj.24.1694917799550; Sat, 16 Sep 2023 19:29:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694917799; cv=none; d=google.com; s=arc-20160816; b=tyMT6U0r/exYqmR9vfu/Lcx1dEtZL0Lc0W3epcG3EGYvBkIHhSKk62Hp/rhiZs3X1o 2D+bIetGSeMMm6iY7JRZju8K11mndL+JzaHuzkifU3J11qqOXXcexm9NQfsB1PytXIP1 MbJ390/Cvfu7/F8L+wAU0OcSy1i9RdXm/yYQ+3fFSbbKtNdtrQVB4oz+wHwMNwCeyiJ8 paGzc5kuoJaamXG5CQykK/4F+L+GhReQC76BxgbovSk8tTM5o+ZpF5+FiqxESTcodETa 41X03c2ygc8bKU3G342k0oXg3UY/68K6C8IkbFcvLvntsPtBKdTWcCs2KLfv9P3LcTeS L/Tg== 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=ypaWc5Og+ko+YhlZxCoeIG9EwGQFApQm6ipFjJd/eyo=; fh=/NZX815RJy/ecOe1WbZ023sSZUJKZnpaeIZwQG5Ym7U=; b=lERAR3npz3XNvGgXce2OW4Rd1mntD+CBO/hTXWB0TEO07BWmtwat0Y/dq9VVzw1VsO fwvJUf5jlP4Z+pW7beSBtCDi41feuspuXI9ni88hd6JPxx40M9hWg5/SL/X5w0qs+kos +o2wyWZ/4IS80a2jSamEkwEmOmVQAimwJSbusJg6Vr4lJaT7QQu7xboNlVvm5m0R/XwR E3W/SO2Tb//xkk8l8Jg2xC6MbViMW2GUn1Y5urtbG49V0wqJ2ubsUawOZ63vetfFZ7Ry uEMQqR0ezas20DX8P15lv/VqArAnmhzMTXo7v3vFZc7jXmwJS/JzIBNuulxvmf3WNQIK iKGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=sXQTslrX; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id f6-20020a17090ab94600b00263a985aba5si7826649pjw.149.2023.09.16.19.29.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 19:29:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=sXQTslrX; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id CF97983B5B56; Sat, 16 Sep 2023 12:22:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237290AbjIPTUv (ORCPT + 29 others); Sat, 16 Sep 2023 15:20:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231954AbjIPTUU (ORCPT ); Sat, 16 Sep 2023 15:20:20 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D39C186 for ; Sat, 16 Sep 2023 12:20:15 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1694892013; 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=ypaWc5Og+ko+YhlZxCoeIG9EwGQFApQm6ipFjJd/eyo=; b=sXQTslrXSUNhuY3Y1oIEkt5g/U3qacYDD+q3dOQWrp0h/eVurpRHGp39kUvrg3sqEu8mQ1 PB8SPxXuFF4AldaBtcWQ9XcObap7TGNMJYIYSIfvAcyjquCIP1Etfb9qkYvx3BLoR0ZaSD nG+L9gYA7//AnMrMjm+kdZYJO89Z0cgEVjPSA54/XBQs6sbRcPekj1OcqF0Goh+3BcDgJg rD8Z5gW/mPocYYbbQNOALaTy82h6w1PTY3pGCl9hOxDlmHPg/pHPBsBQjEfQJiR/IEOg8W PEkM3FGNxPGBPcXL/esJM4mMJ2uH8151flFE2o7+uMEULBOwIk/tfNMwtXBpBg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1694892013; 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=ypaWc5Og+ko+YhlZxCoeIG9EwGQFApQm6ipFjJd/eyo=; b=IIBRzTUqihn24cm8qcNIbOE7bP13aiYNxUohq5mUVsSMBd2FK8MPwRmE4j6VttYE0OQc6L T0LECY2SHu+4UJAQ== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: [PATCH printk v5 0/8] provide nbcon base Date: Sat, 16 Sep 2023 21:25:59 +0206 Message-Id: <20230916192007.608398-1-john.ogness@linutronix.de> MIME-Version: 1.0 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,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Sat, 16 Sep 2023 12:22:09 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777250126884098151 X-GMAIL-MSGID: 1777250126884098151 Hi, This is v5 of a series to introduce the new non-BKL (nbcon) consoles. v4 is here [0]. For information about the motivation of the atomic consoles, please read the cover letter of v1 [1]. This series focuses on providing the base functionality of the nbcon consoles. In particular, it implements the ownership and priority semantics for nbcon consoles. This series does _not_ include threaded printing, atomic printing regions, or nbcon drivers. Those features will be added in separate follow-up series. The changes since v4: - Remove nbcon_seq_init() and use nbcon_seq_force() instead. - For nbcon_seq_force(), use the oldest record if the specified record no longer exists. - For all try_acquire_*() variants, do not update the nbcon state on success since it was not used. - For nbcon_context_try_acquire_requested(), replace the cmpxhg loop with a single cmpxchg. - For nbcon_context_try_acquire_requested(), remove an explicit check for @unsafe_takeover. The nbcon_waiter_matches() check is enough to detect unsafe hostile takeovers. - Rename nbcon_context_acquire_hostile() back to nbcon_context_try_acquire_hostile(). - Decide in nbcon_context_try_acquire_hostile() if an unsafe hostile acquire is allowed rather than at the end of and after nbcon_context_try_acquire_handover(). - For register_console(), call nbcon_free() if it is a braille console. - Change many comments as suggested by pmladek. In the feedback thread I mentioned some other comment changes that I made. - Added various WARN_ON_ONCE() checks as suggested by pmladek. John Ogness [0] https://lore.kernel.org/lkml/20230908185008.468566-1-john.ogness@linutronix.de [1] https://lore.kernel.org/lkml/20230302195618.156940-1-john.ogness@linutronix.de John Ogness (1): printk: Make static printk buffers available to nbcon 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 ownership state functions printk: nbcon: Add sequence handling printk: nbcon: Add emit function and callback function for atomic printing printk: nbcon: Allow drivers to mark unsafe regions and check state include/linux/console.h | 129 +++++ kernel/printk/Makefile | 2 +- kernel/printk/internal.h | 31 ++ kernel/printk/nbcon.c | 1029 ++++++++++++++++++++++++++++++++++++++ kernel/printk/printk.c | 78 ++- 5 files changed, 1245 insertions(+), 24 deletions(-) create mode 100644 kernel/printk/nbcon.c base-commit: 189f53ec666838729ab29a220ca4c1e1f1359f95