From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.43 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792499340; b=4U/iLTThlDFptt7ExSku3mDS7zkZ+0/sn/D/HZfUd9pxemRDVWF1EQesj6dDASUs8Nbe 4qHa9JYRxMfUCEum3KzaNmDP8rbCxpPa28t2uUdTb23cIF96uCdq6q1i5LK+WhhgANLac OJa3O6f70r2sWJ9aJNhJwDY5oXgmzN/DntxqoxynCUe75OINCrj5LmXQUVoxZMTSU8Ybs j2as/8qNTecH6dZf16r0ig2l4t405Om1nuLW2Ag9WGvR1/sK3Q7MHbqfOIGs3T+0uFajo a2uQNhVF1JT5QI74gTFitpIwRhmDxzEsaCeQfptQYPHOjJkQf3AaDXjlDQr0F9wSLqA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792499340; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=lfZbqFmLr8Q6MECdNX562ifwqH83lxZBW8nCUfGoGTs=; b=SbGZFCJYdksUqapdtj7rMctuc0pnDvm3iI8HMhYUgGplyM+9q0TWreyK6sW2aEPN9VIJ Rri+2vUAGJaeDzEgyoQt+4mq7RwH8eIp6Uzgg/hXV4lIiqEZT8PHWYaQf60Mg29DWZ7tE c2jwC6z6sRFSIUQvK7F5yVy8R43239vageKTqNZC4GZQVSMl0RM25heSrDwNNpuiM2hn8 ilbsib3fJ+a3AfXc5rM5tagR42g0o/0/qdn5CmoNkNPQhXGuKBCCCN8KCYZjO1o124L9Q HdedPpygD9agweTzEy0b32uow37zfu7jg00DITxdzG3Entfw0aLj+VNC0HMwb7AG6Aw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=WHQn4ari; arc=none smtp.remote-ip=209.85.221.43 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83D70606A320 for ; Tue, 20 Oct 2026 12:28:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 83D70606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=WHQn4ari Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-48e20ed3b9dso501613f8f.2 for ; Tue, 20 Oct 2026 05:28:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1792499338; x=1793104138; darn=lists.linux.dev; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=lfZbqFmLr8Q6MECdNX562ifwqH83lxZBW8nCUfGoGTs=; b=WHQn4ari59bAFIEk+esWLdifXZw8tT78Pg7ft/Y1S3RgsyQsDvnFZBAWXQ9N3vfvSS 64N9O9pCslGSz6NyOKTHL4mbq2Rosc6aa05940xH4l3CjAN8DXoujPniLRtV2N6Iz7yB TeTIcJ7iPq8XA901niXtcwDdNeKe8BOrrxNhtAX4aPpWStruof99/fmw83Cl6OwJbwHB S+d+zSXcFCsOuVMQAd8Hvb6OQ8ATJVFw6QgaynL+A55QPacOd6Vr2HVdeH/OrD5sEJkU KZPqhS9DRJUW+hdKg7IfTT2y5kbDO5nEeg6+xXnZQ+d8DyYOYpYctHEWboxaZ/7JTgea F7Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792499338; x=1793104138; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=lfZbqFmLr8Q6MECdNX562ifwqH83lxZBW8nCUfGoGTs=; b=Zfc9CmQCqb28xlTT0ZvLBou0y0sJ4GfL9J7ea35e3rBNzb0IuJ2TWdI5kMZRoPMJYe ae8VWj4wT3J0ouHY2tKHlBfa8B/+ftqCAzqxxshcn8X/Nuo3TCh1HeIOua7VUwTTXRwf +qX8uTtbj/Rn+kPuVRrphMPOyAWvftPEinIdTPNYWSBHZ7/qJFFM2cFAsFJB5Qc29bTA jD9pHs85S4Y2Lk57o+f5inOC6PX6yswF5LIfo6TlcrS/zraP6e3aXm3BzK4NUTMaTEZ3 oO0ZgLgyaHLXh1MJUvINqBV2iQZnARV1pszBD0rmI5H6ruCT87PlnD5+POpHt2OiVtMV NtMQ== X-Forwarded-Encrypted: i=1; AKwUvBxJD6MaVWEyT0W2oeZpxq/QbfXH12m+m3Rq6gNu17Ims5bnmapo0hyRiaPWq6uSYEAEC6XdXPMkq06aoAQt1A==@lists.linux.dev X-Gm-Message-State: AFq9FYKtOfodgfjBob46ZhJD2QbHFJvWgjQtztRbiwg2uDwA9iUnz2et qWfqdvEA+VPf8S+Sc9k3+oJvmEJE07E+JgPmR+xsmN6yaQugdURiR1Ozndi/FRrZqUw= X-Gm-Gg: AYBFou1NmyzDCC2skd8Wdj44/drNOdKDvvoycwJx/YQVEq2Rq+f0RM87MAIpiqNRMG2 UJXRAdxpo8E3cXrpvG3sZrHFwAYX9X+lyH0F6ifFyujaTCqYmMfxAKObb6UQlsnFnN7/5ZyGN/0 vhW0nz7aJ1PnRKSEE104U5vXELJ99BQ9kg3VUhKStnKLSpbXw2Fb4NeSUxjPHdCjJwVPNJddWCj Gn/SGeHwDmNQXOmavoyKi1+FSw3WiAmmlAIt9zq7BagjvxtyVIpwm4ruB/dkkAmz9KcyzdQR17i 8FDdafjtoH2smh6oP77WmwhvkzoysiZ/PjunycqBBgN/tu1uRZT658JliUt5p2tAMNNRUD47AJC JgIGHmIKICygqc2yQwUE4vaX2aLmfDEonGgzVUw7iSOcy4TJc38EyTaIM1ZOcuXg3Iu5op70CB4 fiMYxtK5DZmHZhDpyYXv1yWwWJwyPcyfbquw/5u5NtGg/5UMOc03ltQv8Z/H6s0BD60fX+YvAEZ ZiKLlahq2o= X-Received: by 2002:a05:6000:4694:b0:48c:414f:cc12 with SMTP id ffacd0b85a97d-48e07f9c387mr16153415f8f.40.1792499337854; Tue, 20 Oct 2026 05:28:57 -0700 (PDT) Received: from pathway.suse.cz ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e1d6dbd33sm5588977f8f.8.2026.10.20.05.28.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2026 05:28:56 -0700 (PDT) Date: Tue, 20 Oct 2026 14:28:43 +0200 From: Petr Mladek To: Zack Rusin Cc: Andrew Morton , Baoquan He , Mike Rapoport , Pasha Tatashin , Pratyush Yadav , Dave Young , Borislav Petkov , Ajay Kaher , Alexey Makhalov , x86@kernel.org, Joel Granados , Thomas Gleixner , Ingo Molnar , Dave Hansen , "H. Peter Anvin" , virtualization@lists.linux.dev, bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, John Ogness , Steven Rostedt , Sergey Senozhatsky , Kees Cook , Jonathan Corbet , Bo Gan , Brennan Lamoreaux , kexec@lists.infradead.org, linux-doc@vger.kernel.org, "Guilherme G. Piccoli" , Maaz Mombasawala , Shuah Khan , Randy Dunlap , Stephen Brennan , Michael Kelley , Ian Forbes Subject: Re: [PATCH v2 3/6] panic: Allow postponing pre-kdump notifiers Message-ID: References: <52183acf25209275a9a57fe5d746f82d3b7efc3c.1790014793.git.zack.rusin@broadcom.com> X-Mailing-List: virtualization@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <52183acf25209275a9a57fe5d746f82d3b7efc3c.1790014793.git.zack.rusin@broadcom.com> On Mon 2026-09-28 13:55:37, Zack Rusin wrote: > Provide an escape hatch for debugging kdump failures that may involve > pre-kdump callbacks. Add panic_pre_kdump_postpone to skip their early > invocation in crash core without consuming the once-only guard. > > When enabled, the chain runs before kdump only when > crash_kexec_post_notifiers is also enabled. Leave the late panic call > unchanged so callbacks remain eligible if that path is reached. > Skipping the callbacks may prevent hypervisor crash handling. > > Suggested-by: Guilherme G. Piccoli > Link: https://lore.kernel.org/r/bc0bdd14-5e6a-0676-cd04-14fb0bb93cd5@igalia.com > Signed-off-by: Zack Rusin > --- > New in v2: optional postponement policy suggested by Guilherme. > > Documentation/admin-guide/kernel-parameters.txt | 14 ++++++++++++++ > include/linux/panic_notifier.h | 1 + > kernel/crash_core.c | 3 ++- > kernel/panic.c | 2 ++ > 4 files changed, 19 insertions(+), 1 deletion(-) > > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > index 33cd30996e47..3d722df30838 100644 > --- a/Documentation/admin-guide/kernel-parameters.txt > +++ b/Documentation/admin-guide/kernel-parameters.txt > @@ -4904,6 +4904,20 @@ Kernel parameters > This option should only be used for systems with the above > constraints as it might cause the panic operation to be less reliable. > > + panic_pre_kdump_postpone= > + [KNL] Defer pre-kdump notifiers to the late panic path. > + They run before kdump only when > + crash_kexec_post_notifiers is also enabled. If panic > + reaches the late path without entering kdump, they > + can still run there. > + Intended for debugging kexec/crash-dump failures. > + Skipping these callbacks may prevent correct crash > + handling by the hypervisor. > + Format: > + Default: 0 > + Writable at runtime via > + /sys/module/kernel/parameters/panic_pre_kdump_postpone. > + > panic_print= Bitmask for printing system info when panic happens. > User can chose combination of the following bits: > > diff --git a/include/linux/panic_notifier.h b/include/linux/panic_notifier.h > index 3ad390764a41..655ee5c77181 100644 > --- a/include/linux/panic_notifier.h > +++ b/include/linux/panic_notifier.h > @@ -11,5 +11,6 @@ extern struct atomic_notifier_head panic_pre_kdump_list; > void panic_notify_pre_kdump(char *msg); > > extern bool crash_kexec_post_notifiers; > +extern bool panic_pre_kdump_postpone; > > #endif /* _LINUX_PANIC_NOTIFIERS_H */ > diff --git a/kernel/crash_core.c b/kernel/crash_core.c > index 5d9fe9e00f39..d6b2293dd0fe 100644 > --- a/kernel/crash_core.c > +++ b/kernel/crash_core.c > @@ -140,7 +140,8 @@ void __noclone __crash_kexec(struct pt_regs *regs) > struct pt_regs fixed_regs; > > crash_setup_regs(&fixed_regs, regs); > - panic_notify_pre_kdump(NULL); > + if (!READ_ONCE(panic_pre_kdump_postpone)) > + panic_notify_pre_kdump(NULL); Honestly, it looks a bit confusing to me. The name "postpone" suggests that they will be called later. But they likely will never be called because the crash kernel will take over the control and eventually reboot the system. The panic() path will never run. Also there is: void oops_end(unsigned long flags, struct pt_regs *regs, int signr) { if (regs && kexec_should_crash(current)) crash_kexec(regs); where int kexec_should_crash(struct task_struct *p) { /* * If crash_kexec_post_notifiers is enabled, don't run * crash_kexec() here yet, which must be run after panic * notifiers in panic(). */ if (crash_kexec_post_notifiers) return 0; So, when: "crash_kexec_post_notifiers == true" then kexec_should_crash() returns "0" then crash_exec() is not called. The system might still call panic() but remember "crash_kexec_post_notifiers == true" so the notifiers are called before __crash_kexec(). So panic_notify_pre_kdump() will still get called before __crash_exec(). Is this intended, please? What is use case, please? Maybe, it would make sense to add "panic_pre_kdump_disable" which would completely disable the notifiers when they cause problems. Best Regards, Petr From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FD51606A321 for ; Tue, 20 Oct 2026 12:29:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=RdHLLUEz; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=gq9K9tje DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Type:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To :Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lfZbqFmLr8Q6MECdNX562ifwqH83lxZBW8nCUfGoGTs=; b=RdHLLUEzeJBcJfi55PWDam254f C1SriwudhM50FT8jKiPednG5Wy29EGCXU4eFo9HpkmV2V8y0X89+fHzyJzstt8VihOL1vuqFNcZnP VdbFDa3w7DUjB45Fa1bcH7229lz8+f+p72cfqfK9Oq8WM91fFTNYn3ZPzo3Q+KbiJDJbzJqUZNnxO OrkW1yh/KKkzZEF22/jqp7p2E5O/jDnCoH7tB1JjDmQUkNSeuAsCamOivjjAURpyNlOtaSMXdFg8q XdonDKIvUyY2ltvAm1vxlstD0W9U7Hs4JYNe44SQ1XgZ+iV8tYEFklwrKOdgqsEK4ZKBBxcnbW3ZX c2ge4RCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xJ8xi-00000009fMe-1tfh; Tue, 20 Oct 2026 12:29:02 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xJ8xf-00000009fLd-3Akz for kexec@lists.infradead.org; Tue, 20 Oct 2026 12:29:01 +0000 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-48df8fe8513so2743499f8f.0 for ; Tue, 20 Oct 2026 05:28:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1792499338; x=1793104138; darn=lists.infradead.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=lfZbqFmLr8Q6MECdNX562ifwqH83lxZBW8nCUfGoGTs=; b=gq9K9tjeEUHEur1QYCfFk5tS9xZFh6Y58Y2Vu9orYkZf4sLKMOXChu/sOam8tvEyTm DBUUsLRLbtvN83gNaOsBzVr9zXXAYymLQgyQ9Yysc2Z4kQgDJ2kQGW1GJNGdNepoK/6S FZTcuYCrvbIVQ1tVZwCGvOzmrWDGKTujqqmfaWJPSUF7EOEXHdQMnqgUVglwsIHhBbN0 K/OxayBhPb9F3x+w4ceoK4B8CnnVdhodJ/5EzdGMCM8q5THTLR8rTbpU81m+0kY+nazy JLf3aWy7nCgOqWSqvdRzFwB0sBlI8UTBtKFX3wEgqwZFFCf0o9iYXsc+GpuVncZhcibj QNuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792499338; x=1793104138; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=lfZbqFmLr8Q6MECdNX562ifwqH83lxZBW8nCUfGoGTs=; b=iE+2Ya/domxJuxbpnBAaywDdfdsWHgejzzrkVgcZnuuFEieLCD3+E9sw5EpjX9c8eo TEcQNbgd83CnJ7vsaqQJo7Xig3QMJkX6x9f+PSmLXvnVZCd4RajsJneM+7CAVqNwVFDW X4aNcVHxmt/lMJAV4WEbMsQRuD8bQkX61wz6d0tBsXhomXFR2u+qCY1O6kTsKIs6IvfF u+IoMJFS/pUY61wCu68gQItnaYJg/0HSSIN6Cw9GkBdmGtzUMnGEMzjxTFsUnSdbh2hT xMLTDRqeyuSaZiUbjhLeyNtnxCHBRRdshRw1tbcKr3ZSMRvNfT7/P88jvJ/Pa7F41U+8 W0FA== X-Forwarded-Encrypted: i=1; AKwUvBw99WyWnunoehfPb4oO2Q9BC7AQe828W9mkYGJSXyQ6sUI5PyGuPIEcjxNmsPYzlVNVSqzo7g==@lists.infradead.org X-Gm-Message-State: AFq9FYIhgHhzEkoOU3VMYG7XyEzEx4/G1IbhiRl9/aCoc9sDqz/0VGm1 1eG9Z+VW2R7DXh2AFKxgE8Zps/yy7reWSM0lZ8wFqtf+fCwSUtzrS9TKisGCqsP/deE= X-Gm-Gg: AYBFou1QkooNvSlNil3pzNVx/16YarmtN6JxbvJ9rN98hZVwtcmoloxwOPHPJ4BAzxW BYwPhrrWh8QnYcxLKlvLLa3OCX014dF2wENmPGlTkX2WiAqTlZ9pYL2FpxPUMVYVkz9EFsUVcBs xhvIGV83R+P+0uhZDrQix5tONQD84NmjdBzwDjTPb/SoMqWWDj8doV6fpHkPn1I3aUVylzIdC7u I/NCJWKvZMeOFnKQj9hnotwcuvuo2BQ3hD0D8ZZm1QW1/O2x+jmfhkwT1KqSbk+ftXewmWDDP8y FaKtvLNZ1ZA+zvzN3pXZgkJ+7JEqfmwGit5/8pjOtwJlmaiw98yP+JpeP44gJ/O224IwzNaABRO 5p8Aq9Kb+z+2bL9W9FyeGFChS4nJoMsRjDv2SouK+ICpss1toIRg/2oQ00QqKK4QlyUMbMHiGYA GnTgzExhZNhjyzGJhu3qACho2Z3h+Yl9abJ2gPVRduktp1nS8AN9+p8EENX4nnsew+KULIpHCo1 ddk+Ray9Vg= X-Received: by 2002:a05:6000:4694:b0:48c:414f:cc12 with SMTP id ffacd0b85a97d-48e07f9c387mr16153415f8f.40.1792499337854; Tue, 20 Oct 2026 05:28:57 -0700 (PDT) Received: from pathway.suse.cz ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e1d6dbd33sm5588977f8f.8.2026.10.20.05.28.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2026 05:28:56 -0700 (PDT) Date: Tue, 20 Oct 2026 14:28:43 +0200 From: Petr Mladek To: Zack Rusin Subject: Re: [PATCH v2 3/6] panic: Allow postponing pre-kdump notifiers Message-ID: References: <52183acf25209275a9a57fe5d746f82d3b7efc3c.1790014793.git.zack.rusin@broadcom.com> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <52183acf25209275a9a57fe5d746f82d3b7efc3c.1790014793.git.zack.rusin@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261020_052859_853468_66608CBD X-CRM114-Status: GOOD ( 28.09 ) X-Spam-Score: -2.1 (--) X-BeenThere: kexec@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, Kees Cook , Dave Hansen , Dave Young , Stephen Brennan , Bo Gan , "H. Peter Anvin" , Pasha Tatashin , Jonathan Corbet , Brennan Lamoreaux , x86@kernel.org, Joel Granados , Alexey Makhalov , Ingo Molnar , bcm-kernel-feedback-list@broadcom.com, Ajay Kaher , Baoquan He , John Ogness , virtualization@lists.linux.dev, Steven Rostedt , Maaz Mombasawala , Borislav Petkov , Shuah Khan , Michael Kelley , Pratyush Yadav , Randy Dunlap , kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Ian Forbes , Sergey Senozhatsky , Thomas Gleixner , Andrew Morton , Mike Rapoport Sender: "kexec" X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Mon 2026-09-28 13:55:37, Zack Rusin wrote: > Provide an escape hatch for debugging kdump failures that may involve > pre-kdump callbacks. Add panic_pre_kdump_postpone to skip their early > invocation in crash core without consuming the once-only guard. > > When enabled, the chain runs before kdump only when > crash_kexec_post_notifiers is also enabled. Leave the late panic call > unchanged so callbacks remain eligible if that path is reached. > Skipping the callbacks may prevent hypervisor crash handling. > > Suggested-by: Guilherme G. Piccoli > Link: https://lore.kernel.org/r/bc0bdd14-5e6a-0676-cd04-14fb0bb93cd5@igalia.com > Signed-off-by: Zack Rusin > --- > New in v2: optional postponement policy suggested by Guilherme. > > Documentation/admin-guide/kernel-parameters.txt | 14 ++++++++++++++ > include/linux/panic_notifier.h | 1 + > kernel/crash_core.c | 3 ++- > kernel/panic.c | 2 ++ > 4 files changed, 19 insertions(+), 1 deletion(-) > > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > index 33cd30996e47..3d722df30838 100644 > --- a/Documentation/admin-guide/kernel-parameters.txt > +++ b/Documentation/admin-guide/kernel-parameters.txt > @@ -4904,6 +4904,20 @@ Kernel parameters > This option should only be used for systems with the above > constraints as it might cause the panic operation to be less reliable. > > + panic_pre_kdump_postpone= > + [KNL] Defer pre-kdump notifiers to the late panic path. > + They run before kdump only when > + crash_kexec_post_notifiers is also enabled. If panic > + reaches the late path without entering kdump, they > + can still run there. > + Intended for debugging kexec/crash-dump failures. > + Skipping these callbacks may prevent correct crash > + handling by the hypervisor. > + Format: > + Default: 0 > + Writable at runtime via > + /sys/module/kernel/parameters/panic_pre_kdump_postpone. > + > panic_print= Bitmask for printing system info when panic happens. > User can chose combination of the following bits: > > diff --git a/include/linux/panic_notifier.h b/include/linux/panic_notifier.h > index 3ad390764a41..655ee5c77181 100644 > --- a/include/linux/panic_notifier.h > +++ b/include/linux/panic_notifier.h > @@ -11,5 +11,6 @@ extern struct atomic_notifier_head panic_pre_kdump_list; > void panic_notify_pre_kdump(char *msg); > > extern bool crash_kexec_post_notifiers; > +extern bool panic_pre_kdump_postpone; > > #endif /* _LINUX_PANIC_NOTIFIERS_H */ > diff --git a/kernel/crash_core.c b/kernel/crash_core.c > index 5d9fe9e00f39..d6b2293dd0fe 100644 > --- a/kernel/crash_core.c > +++ b/kernel/crash_core.c > @@ -140,7 +140,8 @@ void __noclone __crash_kexec(struct pt_regs *regs) > struct pt_regs fixed_regs; > > crash_setup_regs(&fixed_regs, regs); > - panic_notify_pre_kdump(NULL); > + if (!READ_ONCE(panic_pre_kdump_postpone)) > + panic_notify_pre_kdump(NULL); Honestly, it looks a bit confusing to me. The name "postpone" suggests that they will be called later. But they likely will never be called because the crash kernel will take over the control and eventually reboot the system. The panic() path will never run. Also there is: void oops_end(unsigned long flags, struct pt_regs *regs, int signr) { if (regs && kexec_should_crash(current)) crash_kexec(regs); where int kexec_should_crash(struct task_struct *p) { /* * If crash_kexec_post_notifiers is enabled, don't run * crash_kexec() here yet, which must be run after panic * notifiers in panic(). */ if (crash_kexec_post_notifiers) return 0; So, when: "crash_kexec_post_notifiers == true" then kexec_should_crash() returns "0" then crash_exec() is not called. The system might still call panic() but remember "crash_kexec_post_notifiers == true" so the notifiers are called before __crash_kexec(). So panic_notify_pre_kdump() will still get called before __crash_exec(). Is this intended, please? What is use case, please? Maybe, it would make sense to add "panic_pre_kdump_disable" which would completely disable the notifiers when they cause problems. Best Regards, Petr