Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp11893991rwl; Tue, 3 Jan 2023 06:19:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXsxnu0NdaHmhi8s1sgcVluHxnnEIIKKwhvGvdMEqoP5B6rmO9VRivIwujHPmP1kMahHboDA X-Received: by 2002:a17:902:f78e:b0:186:a43b:a5 with SMTP id q14-20020a170902f78e00b00186a43b00a5mr51428247pln.13.1672755558519; Tue, 03 Jan 2023 06:19:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672755558; cv=none; d=google.com; s=arc-20160816; b=fOmUKEFs1W9w4yG9sl85nop1UGlh+ubquUE8zJTBQMQRdmeK3BB6LzkkJ61bpAfqDV qdjS1jWWu1petgz5RKTYbSgK9ukM+FlxpXh/BWfkuAwl8qfFaTEb/3iPGb2ho3MJIalx tzl39Bru08LtaHC/TQ+venqVrv45AX8qnEZVnCstUY3iJoPNN5+gqwIBkhfgXEU8wYvh nIv7QXwE86rmFbXM5E6XzrP9a0maOzbLrEtTfn0FMyfcN6t0ASG6ePz77ZIMqOx9LouD KCV5qrDVty6XaXNI90bkhjVEiymcKAMX+68vUPPHsWmDEiw6KZR5K6tv9MgkhCaogYdP l2Kw== 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=PaRbhhHoqreUbFey3ucxqIdyeoCz0oWvNnlSyJt1keE=; b=U14ZL1/7DsBVlojwZ5e7Q+Sk8irPnV/NSficMg2oZwByHuYCjZzfKkZu1kb/JncPeI 9awCA4rmo27KTfBjQjui+wltNtQsxHbnKqJgXW4n/Kj/sNGtgSEGLhmBYtWUMlc36n49 QZyzMH4xOg1llELOlzCe4W6KNjrSFwC3rMIOGs3E/GN1cehhElOShILf+Zs0WIa+3MFO y0EgeZPetrzN+bbP/o729L1P0MyCCp5eXChNWu0gcBk8nYYFALj4nbz7jVG9u5LI2Okx Ej5yTYsxesIJ1q6OXVpAZrUMqbdVyKVmt1WuSK5GGFrku7hSuV0ZHVL6E6ZJcVZP0d1P TzZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="g2knTZ/X"; 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 q9-20020a170902dac900b00188c26e5be1si34849924plx.551.2023.01.03.06.19.11; Tue, 03 Jan 2023 06:19:18 -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="g2knTZ/X"; 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 S237602AbjACOFJ (ORCPT + 61 others); Tue, 3 Jan 2023 09:05:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237680AbjACOE7 (ORCPT ); Tue, 3 Jan 2023 09:04:59 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B569C10B67 for ; Tue, 3 Jan 2023 06:04:57 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 6917867675; Tue, 3 Jan 2023 14:04:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1672754696; 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=PaRbhhHoqreUbFey3ucxqIdyeoCz0oWvNnlSyJt1keE=; b=g2knTZ/XxipHkKpvZN4eEk2Ar0WdWmw6iP7ZiSwEIcgUK7YDcWAKJEse7janWxrGS/8AAx OEFUkjcHZIOvSeyImDq7iBMe046zG+eyB57tYf9qDKLoHaOJYqZv+OvdQ8PJxHCQ7bX+/i ZWbwWdUzMn/vx3ub+DtEPg6YKudKe84= 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 286052C141; Tue, 3 Jan 2023 14:04:56 +0000 (UTC) Date: Tue, 3 Jan 2023 15:04:55 +0100 From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH printk v3 5/6] printk: introduce console_get_next_message() and console_message Message-ID: References: <20221221202704.857925-1-john.ogness@linutronix.de> <20221221202704.857925-6-john.ogness@linutronix.de> <87bknva1jg.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87bknva1jg.fsf@jogness.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-12-22 16:47:39, John Ogness wrote: > On 2022-12-21, John Ogness wrote: > > +static bool console_emit_next_record(struct console *con, bool *handover, int cookie) > > +{ > > + bool is_extended = console_srcu_read_flags(con) & CON_EXTENDED; > > + static char dropped_text[DROPPED_TEXT_MAX]; > > + static struct console_buffers cbufs; > > + static struct console_message cmsg = { > > + .cbufs = &cbufs, > > + }; > > @cmsg should not be static. The whole point of the console_message > wrapper struct is so that it can sit on the stack. Well, it might actually be better to keep it static for now. It always points to static struct console_buffers cbufs anyway. It would make sense to have it on stack only when it uses different buffers. Which brings the question. Does it makes sense to use the same buffers by different struct console_message? Will it be safe in any situation? I did not want to complicate it yesterday. I think that I have already proposed this. But this brings back the question whether it makes sense to have two structures at all. I still think that it would be easier and even more safe to put everything into struct console_message. I mean to have: struct console_message { char buf[CONSOLE_EXT_LOG_MAX]; char scratch_buf[LOG_LINE_MAX]; unsigned int len; u64 seq; unsigned long dropped; }; Best Regards, Petr