Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8088232rwb; Wed, 23 Nov 2022 15:26:07 -0800 (PST) X-Google-Smtp-Source: AA0mqf6ymqHXS/W7JAZr9fPMmoA8aPe4i1qFXRJanPRpSOorpJ3VE06IIKA66kChD+jgBYTWIAqA X-Received: by 2002:a17:90a:a595:b0:218:b050:d693 with SMTP id b21-20020a17090aa59500b00218b050d693mr17665771pjq.130.1669245967329; Wed, 23 Nov 2022 15:26:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669245967; cv=none; d=google.com; s=arc-20160816; b=yQ9WOrZGBgkfEX+HMDIPWD5Yj1bhsK0/CSp41UhfyF6EYf2RRBMDXidYFsUrCn41Ik f/Tr4XCWgRXFj5wq06zptjqDzmUUZLmGCETqk9Mif+YrUHJb1Gw5K2yIFgejictaiZKA mFAFHNw0d0HvSyzVoZn8dKlTSMrE5VIQichCYVMKBKoIhihhXvdG28oT+J6Gy4tb03m6 YSw3eHEE4/KXiSNwe1fzIbwUDct41EiB5qOVmxNoadNT/0Z42M+Uc5KG5TwDIQ92OXmA ns1AB3vfPKs70vzP8ZPkcz8Lc6UXgAd/+6CBlElFXLj/YR+YGipKiJgDCqZiYbDKwNC6 vR7g== 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=otGSdvebbiUS4OgzfTAUBgwc0OiYKvwDmMVYgIzL0BA=; b=QWxKgVdWKPZg3mspyrFpYu9yguYILWnlpekvvYrOzsoLOuLwBYllr5IujMoueolIm/ DiTKMAQ3hdHFWF7/yP2guswLDjYgZ3pDHDBVwzaefAzEUkVRTBXd9oYm/rn0DXPo3zRm shgHyzQ40hXgiXZncrlphtP/oaYdDdLw27y2thGK3moQfLWNfx4LCXzDrYZUgaoiC3Ld l8bTohyLhWEeRVzP/VoVsGdQ9K5MSGrwYRDtt7o6oGFV6HdjW/gTbOj+ZMdi6YcFBiRk ujl4AISFfPaZvWlBeOirS/LIugyjZOiTJUAi2ZHbLr+dEHV/OO6XtQ2cDx5Ndi4KCBbw AiBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=rquhVYTN; 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::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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u15-20020a170902e80f00b0017a0e7aaf6bsi19459338plg.128.2022.11.23.15.25.56; Wed, 23 Nov 2022 15:26:07 -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=rquhVYTN; 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::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 S229754AbiKWXOR (ORCPT + 88 others); Wed, 23 Nov 2022 18:14:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbiKWXON (ORCPT ); Wed, 23 Nov 2022 18:14:13 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0398F6BDEE for ; Wed, 23 Nov 2022 15:14:11 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669245249; 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=otGSdvebbiUS4OgzfTAUBgwc0OiYKvwDmMVYgIzL0BA=; b=rquhVYTNPTKQiPyllGm5f6jOvJlrNNxmWcvlITagDymRBgo9zpxKsDyfv4/qGN1EaIjmy5 P6irPKpPMq5FtXmu+VvyWF6TgZoa4lSwt7iKP3J7JcYU6R0Obao1QMNTRp+MRlsk+lChOh Q9ppGi7NalhKpgV//dmHa4TJCTQroFNw+U/tAqqn2ynwP6+Pje8XrBf3WwkpM3fUDrHN9O KJuq3DILsV/Wi4BrW4RMcb6nA/rpLZL9z6PGyWYT/muPizJVKGvURxvj54yLeBB+tatMkF CgBM12cBsCIjBJqygKPZp6v48j+ZN3IrY/cw+WegLHC6F4rLfgwfvB7uxgasDA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669245249; 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=otGSdvebbiUS4OgzfTAUBgwc0OiYKvwDmMVYgIzL0BA=; b=jlE+CN9ICkgjgjOFNsrlDg7OYEKZYTBEqieQrtG4FN+b98rLsIOvuXzB2X9NUiHce/0R9k gFqt629lcVdp/wCQ== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: [PATCH printk v2 0/7] printk: cleanup buffer handling Date: Thu, 24 Nov 2022 00:19:53 +0106 Message-Id: <20221123231400.614679-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: X-Mailing-List: linux-kernel@vger.kernel.org Hi, This is v2 of a series to cleanup buffer handling and prepare for code sharing with the upcoming threaded/atomic consoles. v1 is patches 13-18 of [0]. Changes since v1: - Explain why console.h was chosen for buffer size defines. - Keep DROPPED_TEXT_MAX define in printk.c. - Put new BIT()-macro usage for console flags into its own commit. - Modify descriptions for console flags as suggested. - Add argument names and types to console callback definitions to satisfy checkpatch.pl complaints. - Avoid temporary usage of an ext_text/dropped_text union mid-series. - Rename various structures, fields, and functions: struct cons_text_buf -> struct console_buffers struct cons_outbuf_desc -> struct console_message cons_outbuf_desc.txtbuf -> console_message.cbufs cons_outbuf_desc.len -> console_message.outbuf_len cons_outbuf_desc.extmsg -> console_message.is_extmsg cons_fill_outbuf() -> console_get_next_message() cons_print_dropped() -> msg_print_dropped() - Remove cons_outbuf_desc->dropped and make @dropped an argument of msg_print_dropped() instead. - Use "ext_text" and "ext_text_size" names for stack variables when they refer to console_buffers->ext_text. - Add a compile-time verification that DROPPED_TEXT_MAX is less than CONSOLE_EXT_LOG_MAX - CONSOLE_LOG_MAX since the code expects that a dropped+regular message will fit in console_buffers->ext_text. - Replace hard-coded CONSOLE_LOG_MAX and CONSOLE_EXT_LOG_MAX usage with sizeof() usage. - For dropped messages, copy the regular message to append the dropped message, instead of copying the dropped message to prepend the regular message. Now it is not a hack and there is no need for the __no_randomize_layout annotation. - Reset console->dropped explicitly instead of relying on msg_print_dropped() side-effects. - Rework and expand comments and commit messages as requested. John Ogness [0] https://lore.kernel.org/lkml/20220924000454.3319186-1-john.ogness@linutronix.de Thomas Gleixner (7): printk: Move buffer size defines console: Use BIT() macros for @flags values console: Document struct console printk: Add struct console_buffers printk: Use struct console_buffers printk: Use an output buffer descriptor struct for emit printk: Handle dropped message smarter include/linux/console.h | 139 ++++++++++++++++++----- include/linux/printk.h | 2 - kernel/printk/printk.c | 240 ++++++++++++++++++++++++++-------------- 3 files changed, 269 insertions(+), 112 deletions(-) base-commit: 11f1e536902b38bffab9913f8908309daf7e53e1 -- 2.30.2