Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1697794pxm; Thu, 24 Feb 2022 07:50:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJzBNq0NUnz3MA0yKvPn6ZwZ9ULlFZZqmMaeg2s8p8/excvF1Li6Xx0IqELVlAmxDDTELWAb X-Received: by 2002:a17:906:50b:b0:6d0:9ebc:b9df with SMTP id j11-20020a170906050b00b006d09ebcb9dfmr2792863eja.67.1645717819186; Thu, 24 Feb 2022 07:50:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645717819; cv=none; d=google.com; s=arc-20160816; b=zllbU7wJ7wGROYP4/GCMcpgTXiAjwgJG9b3MkjoqZJllu50z+w0cdnx5qYbXv7N7CM HrHundCKBeGEl//iKjw79jdC/Rv7MVUy+7xhYf73q9+D9brlJ9clplnfs8SXRbP68zhd o/wSTlby6RVhf1c3KTGsIvZTfOz3VaXQI1z9mrHa3Qb9n9p+P5YrfBlL8yeprgS/YQ24 kQ7rTufAfPncBw12dE9zHw7PtrpvdTmGmsk4mEo6/DETYm14Hr2PtIemXcg2yTXDA/Bf GQE0W9gxN+iyWOFtgqc9IfSRItOt3aHmFAoKHVDQHo73oAj/5M2dRSBWspjEsB0T5Gct 1G0w== 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=ZYPeVKALkpzTcxeDHSPKHl3ouv2OXHzIcU99Wn4FqEE=; b=mp6C/0yJbhZiqvV7kyRpLxlb2iKyBblkma6wpx1Xf3eQ5eCrYq9yuEkl5SODizMJt2 k8t2FF0hM3J/ENgvui7xuAqHGkK2ba02H75x35KWgO1pjgKUCFNuhKiQSyAfx81txao0 50hNuadv34SRegSh8wK2aSKa3WJJOPT1KyRzIK7I5L03VoPXTVlxjXEF9dBcJz8gOq/w 6fIVpRzkIp7vxk2ceJ1+kQNw5NE+naO1QcjQqdp+Nnv5pfd+Vbo5Pyjv3Lylo4hdja6I Qb+V4yBdMsazKKAhjrVmyTcWjmdvRtjlhO6ZZ5N7yfrWUPtzKsTjJXIURkwjEhN+N4qx piiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=Cw6YjhKu; 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 s18si1874469ejo.274.2022.02.24.07.49.52; Thu, 24 Feb 2022 07:50:19 -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=Cw6YjhKu; 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 S235442AbiBXOeR (ORCPT + 99 others); Thu, 24 Feb 2022 09:34:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234775AbiBXOeP (ORCPT ); Thu, 24 Feb 2022 09:34:15 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C19A31637F7 for ; Thu, 24 Feb 2022 06:33:45 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 7D58A2170C; Thu, 24 Feb 2022 14:33:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1645713224; 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=ZYPeVKALkpzTcxeDHSPKHl3ouv2OXHzIcU99Wn4FqEE=; b=Cw6YjhKu8m89zCWkFi0lEEBT2Wze3QHi96fuJf0DPr33md7zsQOxRExOlIcooI9VVbjRdY CLxSYw9GnN3J+vVIvXzMFL7SxzaNfZWgcKk1YU74A80zG4O0+jbfM/7Zf4YvdldoYRk5f9 e19tvFQl3S04GoiLUdY7K39qzAiTwDA= Received: from suse.cz (unknown [10.100.216.66]) (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 21EB4A3B83; Thu, 24 Feb 2022 14:33:44 +0000 (UTC) Date: Thu, 24 Feb 2022 15:33:42 +0100 From: Petr Mladek To: Sergey Senozhatsky Cc: "Guilherme G. Piccoli" , linux-kernel@vger.kernel.org, bhe@redhat.com, akpm@linux-foundation.org, anton@enomsg.org, ccross@android.com, dyoung@redhat.com, feng.tang@intel.com, john.ogness@linutronix.de, keescook@chromium.org, kernel@gpiccoli.net, kexec@lists.infradead.org, rostedt@goodmis.org, tony.luck@intel.com, vgoyal@redhat.com Subject: Re: [PATCH V6] panic: Move panic_print before kmsg dumpers Message-ID: References: <20220214141308.841525-1-gpiccoli@igalia.com> <7e15bc6a-ceae-aa3a-0a86-18d24181b0ed@igalia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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,T_SCC_BODY_TEXT_LINE 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 Wed 2022-02-23 01:27:35, Sergey Senozhatsky wrote: > On (22/02/22 11:10), Guilherme G. Piccoli wrote: > > On 21/02/2022 23:06, Sergey Senozhatsky wrote: > > > On (22/02/14 11:13), Guilherme G. Piccoli wrote: > > > [...] > > > By additional panic_print messages you mean that panic_print_sys_info() > > > will print everything (except PANIC_PRINT_ALL_PRINTK_MSG) twice? > > > > > > Do we really need to dump everything twice? show_mem(), show_state(), > > > ftrace_dump(DUMP_ALL). That's quite a bit of extra data. > > > > > > > Oh no, we don't print everything twice, that'd be insane heh > > My bad! I did not spot the `return` at the end of the new branch. > > + if (console_flush) { > + if (panic_print & PANIC_PRINT_ALL_PRINTK_MSG) > + console_flush_on_panic(CONSOLE_REPLAY_ALL); > + return; > + } > > Hmm. Yeah, well, that's a bit of a tricky interface now > > panic() > // everything (if corresponding bits set), no console flush > panic_print_sys_info(false) > ... > // console flush only if corresponding bit set > panic_print_sys_info(true) I agree that self-explaining names are always better than true/false. It is pity that replay the log is handled in panic_print at all. I sometimes hide these tricks into wrappers. We could rename: panic_printk_sys_info() -> panic_print_handler() and add wrappers: void panic_print_sys_info() { panic_printk_handler(false); } void panic_print_log_replay() { panic_printk_handler(true); } Or just split panic_printk_sys_info() into these two functions. > If everyone is fine then OK. > > But I _personally_ would look into changing this to something like this: > > #define EARLY_PANIC_MASK (PANIC_PRINT_FOO | PANIC_PRINT_BAR | ...) > #define LATE_PANIC_MASK (PANIC_PRINT_ALL_PRINTK_MSG) These lists cause merge and backporting conflicts. I vote to avoid this approach ;-) > panic() > panic_print_sys_info(panic_print & EARLY_PANIC_MASK) > ... > panic_print_sys_info(panic_print & LATE_PANIC_MASK) That said, I could live with the patch as is. I leave the decision to Andrew. Feel free to use: Reviewed-by: Petr Mladek Best Regards, Petr