Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5335119pxb; Wed, 26 Jan 2022 09:38:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJzqz5ae5vyuD5aeuDaHpKqYQLtPhTQ1tuGiqOlQsu+ycJbf+jCsWEZzc9p3YThw5YD/hEe0 X-Received: by 2002:aa7:84cf:0:b0:4c8:7234:e6ca with SMTP id x15-20020aa784cf000000b004c87234e6camr17040156pfn.35.1643218734469; Wed, 26 Jan 2022 09:38:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643218734; cv=none; d=google.com; s=arc-20160816; b=LrYvkrS8qQlpv1lRfHUWhwRjLV7fb9U6/KbhSxIB1Xfhxa8z16OtWi7cGv/uIgvA0d Jf9ktGW0xw9n41RqLElb5L+R/gAkqmPDW9xqndcxC1RRbf70zukWWYR2Un2H3rJWhV5K ffJzT2go9+DP80TGV7PB1mgZQpr63xTAmga0FgP5cBumcmTuWIjigrv5ty/PP9OBMowO oPCw3N9jIu8sck/CrZiu37a8jafdpkmVMDk++HlLijAuhuP5iMJBdVXZ4Zf3I+Iuv2U4 y+XTdWko3PHXsclPvHrJqBrrjTQp5qXNtxdhpO21PETsmpvM/jHkX3eKEWJOOX0khWOo j4WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=cgymQfGSuilmwHq8hbN9u09QSfRSsdRkrdxNQudh6GM=; b=P0BJ1D0eDFrOXxiHTXwvKq3vNuNfKN7mTGaXN0UmzYYPxV7P8dpKOzAqbaPpJ6UbUE +F0UpMfCjkma21Ly0ZvA+RigXiN139b99ksaz/EgasAEkkdFIHNwOVeEPcR4nE5KQDoc Mry2CLtV3K89vGKnC5d3LBJPm92FS3tHaThI92FTdywtbpiPgIO1icM4wMbbcnCd47Pr vHxSMgxMBb+9DLqm0mdy6JXE6LJepDl4aUyX2GCq8q+OqDh9ot9zFAl2n19mQN/HQfZb EOPadoSjRZHngpLehQAVpKOmwgY+KmswWepuCfQd2GTJOgieuGQqlFiDbq6mVa1lkobr hZvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=jBKA6KJ0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f6si3287827pjp.153.2022.01.26.09.38.38; Wed, 26 Jan 2022 09:38:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=jBKA6KJ0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237209AbiAZD3k (ORCPT + 99 others); Tue, 25 Jan 2022 22:29:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:29902 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237206AbiAZD3g (ORCPT ); Tue, 25 Jan 2022 22:29:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643167776; h=from:from:reply-to:subject:subject: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=cgymQfGSuilmwHq8hbN9u09QSfRSsdRkrdxNQudh6GM=; b=jBKA6KJ0KSt3SiN0qlCsqLVq2jRBcFJkTUBfmarUNm/2lWgkPemJAtVbKIuY9f3Jcr+Rx5 obt2HKxcJSGbsuGYA/pfizM7HplA4pokpuz7ynh10q+ZeLHcI1+ZxseZpNRk3Sri5bawb6 d+TZahDgwJ7oV23jxIyxS+kE+eO4fsE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-661-XpXrAHkVMhOIpAcPZt8Wig-1; Tue, 25 Jan 2022 22:29:32 -0500 X-MC-Unique: XpXrAHkVMhOIpAcPZt8Wig-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A2DA91DDE9; Wed, 26 Jan 2022 03:29:30 +0000 (UTC) Received: from localhost (ovpn-12-215.pek2.redhat.com [10.72.12.215]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 46BD54E2B7; Wed, 26 Jan 2022 03:29:21 +0000 (UTC) Date: Wed, 26 Jan 2022 11:29:19 +0800 From: Baoquan He To: "Guilherme G. Piccoli" Cc: Petr Mladek , linux-kernel@vger.kernel.org, akpm@linux-foundation.org, kernel@gpiccoli.net, senozhatsky@chromium.org, rostedt@goodmis.org, john.ogness@linutronix.de, feng.tang@intel.com, kexec@lists.infradead.org, dyoung@redhat.com, keescook@chromium.org, anton@enomsg.org, ccross@android.com, tony.luck@intel.com Subject: Re: [PATCH V3] panic: Move panic_print before kmsg dumpers Message-ID: <20220126032919.GB2086@MiWiFi-R3L-srv> References: <20220114183046.428796-1-gpiccoli@igalia.com> <20220119071318.GA4977@MiWiFi-R3L-srv> <20220120085115.GB18398@MiWiFi-R3L-srv> <63621138-2a41-26c2-524e-d889068f157a@igalia.com> <20220121023119.GB4579@MiWiFi-R3L-srv> <20220122103121.GB2596@MiWiFi-R3L-srv> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/22/22 at 10:49am, Guilherme G. Piccoli wrote: > On 22/01/2022 07:31, Baoquan He wrote: > > [...] > > From my old POV, I took pstore as a necessity on handheld devices or > > embeded system, e.g on Andriod. In that case, reserving crashkernel > > memory to enable kdump to save kernel log, it sounds not so > > cost-effective, since memory on those systems is usually not big. > > I am also interested in any new use case where people deploy these > > and why it's needed, to widen my view. > > Hi Baoquan, that's great to hear. Indeed, I feel pstore is unfortunately > not very used in non-embedded devices - if you see kdump/error-report > userspace tooling, like on Red Hat/Fedora, Debian/Ubuntu and so on, they > never rely on pstore. And the configuration is not straightforward for > the users...I think that's a good thing to change, since pstore is much > less resource consuming than kdump. > But of course, not a discussion related to this patch specifically, just > me thinking out loud heh > > > > [...] > > It's my bad. My thought is panic_print and kmsg_dump can be coupled, but > > they should decouple with panic_notifier. When panic_print is enabled, > > we do not expect to execute panic_notifier? My personal opinion. > > > > I missed the change at line 8, sorry for the caused misunderstanding. > > Now the chance of holding C-programmer-prize of the year comes back > > again. > > > > void panic() > > { > > 1 if (!_crash_kexec_post_notifiers && !panic_print) { > > 2 __crash_kexec(NULL); > > 3 smp_send_stop(); > > 4 } else { > > 5 crash_smp_send_stop(); > > 6 } > > > > if (_crash_kexec_post_notifiers) > > 8 atomic_notifier_call_chain(&panic_notifier_list, 0, buf); > > 9 panic_print_sys_info(false); > > 10 kmsg_dump(KMSG_DUMP_PANIC); > > 11 if (_crash_kexec_post_notifiers || panic_print) > > 12 __crash_kexec(NULL); > > ... > > debug_locks_off(); > > console_flush_on_panic(CONSOLE_FLUSH_PENDING); > > panic_print_sys_info(true); > > Hmm, yeah, I still don't think I'm a brilliant C programmer heh > Again, in the code above, I can't see how we would reach > "__crash_kexec(NULL)" after printing the extra info of panic_print, if > we don't have panic notifiers enabled. Missed this one. Above code will allow any of _crash_kexec_post_notifiers and panic_print to execute, then crash dump in L11. L5 -> L11 Since you have posted v4, let's ignore it anyway. > > So, indeed the code currently don't really tightly couple "panic_print" > with the panic notifiers. We could change that in another patch series, > based on what Petr suggested in the filter thread (I know you're > following there as well, thanks bu the way!), but for now, they are > completely independent. My plan, following Petr suggestions here and if > you agree, is to re-submit this patch with some changes, but in the end > the code will allow users that have kdump enabled + panic_print > -"crash_kexec_post_notifiers" to have "panic_print_sys_info(false)" > executing before the "__crash_kexec(NULL)". > > But also, we can add "crash_kexec_post_notifiers" and it will still > work; finally, pstore is gonna be able to collect the logs from > "panic_print" as well (the main purpose of this patch). > > Once that's all resolved, my goal is to jump into the panic notifiers > refactor suggested in the other thread. Let me know if you agree with > these steps/plans, and I'll work them. I am glad to see any improvement from refactory. As for panic_notifier, I have expressed my concern and worry about the plan. So, if no any new action added before kdump switching, it's welcomed.