Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp9089437rwb; Thu, 24 Nov 2022 07:59:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf6W3TpFZS/jDb2LrDzWF8PxGbAYElu8QpKZsr8Pyqqc6efkMhJOZSUFJ6+aer1qaKBn8MrW X-Received: by 2002:aa7:c6c3:0:b0:469:646:97ff with SMTP id b3-20020aa7c6c3000000b00469064697ffmr27488211eds.402.1669305563117; Thu, 24 Nov 2022 07:59:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669305563; cv=none; d=google.com; s=arc-20160816; b=js2XOc2Tl0kyfjuNF/R5CxMfIb6ofbwRBcZnMWuxtmct+X1hpcvp2xl5JdSDqV/Giu GMjEpG2MIc529belkGc0SKADv8OHc0p9x9rKd/w2yM21PlUXd7qprBrsibfaidJfmyh2 7WRQLIgkQc40xq521EDE4lTv65KjTk9pj93NT2Fcj3zowj82evaki2KHgMww2cKUPjfQ GeXsM7m96dhLq2LIWoDzt/0AcvRGccJz6DPy8Bs5D3Fd2uJ98m+89xwTteyFaZkj1fEN mFgUQqWDmZRN2vlMB9dH/jZKchzfVu8rlW1uVli2ILbqQVDUCEj7sQJy78SDZb/0o8YT NCOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=gS76IAALQy+FQNDcUOeFvVits3ROZomZNjOflNybLy4=; b=OsY7xA4mX+WvJUaOpbNL5VKQQNuY6pc7tgGphzkMJ1f/8Jixeh4AhJn8+/zjVmGayA C+2diMiOWnbYJN4cpBRfiX6BAgKUkeuQeJrX+YNjYafoWzDQbylmdzDYjlXwnVM4l95y JWhDjawWwZ2Rmj5fiI7ni6uI6jBDi4eeGfQaZkwVEGkKnGVreqAxp0eUxaeae4zxQiHf QewjDii6pKzSqHtQUuiBLq7VuoNSXVy+dkR32xfRFeHnHJOrvbkN6jQJWEkJw61k72ca iRKn/HJ1pjE9h39gSJwPQmG9LbqAHfdM/9gq0wf8PJ678oI7R+qWMIF+WdFYbXno6W/W V1Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=b1FIFJOl; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ft31-20020a170907801f00b007a5cdd9550esi380697ejc.201.2022.11.24.07.59.01; Thu, 24 Nov 2022 07:59:23 -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=@suse.com header.s=susede1 header.b=b1FIFJOl; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230017AbiKXPWz (ORCPT + 86 others); Thu, 24 Nov 2022 10:22:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230043AbiKXPWi (ORCPT ); Thu, 24 Nov 2022 10:22:38 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45AF065B6 for ; Thu, 24 Nov 2022 07:22:31 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id B9EF41F889; Thu, 24 Nov 2022 15:22:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1669303349; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gS76IAALQy+FQNDcUOeFvVits3ROZomZNjOflNybLy4=; b=b1FIFJOlMhFfC1gUTQ0+GOe8/iA375IgvFmrRncg9fJV66v2X0+n6qCdSom6+Y3bH+/cFf uGjoLW5GbFYNeiIoku506OnOZrPf+uPhs9m9EI1veZfeNwBOgAWuFuBwqyQIpHr/XKHz8e +OaXTssS7kwhYjghbOsPrQmd4Ad588Y= Received: from suse.cz (unknown [10.100.201.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 884832C141; Thu, 24 Nov 2022 15:22:29 +0000 (UTC) Date: Thu, 24 Nov 2022 16:22:29 +0100 From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH printk v2 5/7] printk: Use struct console_buffers Message-ID: References: <20221123231400.614679-1-john.ogness@linutronix.de> <20221123231400.614679-6-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221123231400.614679-6-john.ogness@linutronix.de> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 On Thu 2022-11-24 00:19:58, John Ogness wrote: > From: Thomas Gleixner > > Replace the separately allocated output buffers with a single > instance of struct console_buffers. > > Note that the buffer size of devkmsg_user.text_buf, when replaced > with console_buffers.text, reduces from CONSOLE_EXT_LOG_MAX to > CONSOLE_LOG_MAX. However, the buffer is only used to read ringbuffer > records. These records have a maximum size of LOG_LINE_MAX, which > is defined as CONSOLE_LOG_MAX - PREFIX_MAX. > > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -2007,6 +2007,10 @@ static int console_trylock_spinning(void) > return 1; > } > > +#if DROPPED_TEXT_MAX > CONSOLE_EXT_LOG_MAX > +#error "DROPPED_TEXT_MAX too large for console_buffers->ext_text" > +#endif A better solution would be to remove DROPPED_TEXT_MAX completely and pass the buffer size to call_console_driver(). I mean to do: static void call_console_driver(struct console *con, const char *text, size_t len, - char *dropped_text) + char *dropped_text, size_t dropped_text_size) { size_t dropped_len; - if (con->dropped && dropped_text) { - dropped_len = snprintf(dropped_text, DROPPED_TEXT_MAX, + if (con->dropped && dropped_text && dropped_text_size) { + dropped_len = snprintf(dropped_text, dropped_text_size, "** %lu printk messages dropped **\n", con->dropped); con->dropped = 0; con->write(con, dropped_text, dropped_len); } con->write(con, text, len); } The rest looks good. And it is a nice clean up. Best Regards, Petr