From: vdso@mailbox.org
To: mhklinux@outlook.com
Cc: "mhkelley58@gmail.com" <mhkelley58@gmail.com>,
"haiyangz@microsoft.com" <haiyangz@microsoft.com>,
"wei.liu@kernel.org" <wei.liu@kernel.org>,
"decui@microsoft.com" <decui@microsoft.com>,
"kys@microsoft.com" <kys@microsoft.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
"dan.carpenter@linaro.org" <dan.carpenter@linaro.org>
Subject: Re: [PATCH v2 1/1] Drivers: hv: Always do Hyper-V panic notification in hv_kmsg_dump()
Date: Wed, 31 Dec 2025 23:54:38 -0800 (PST) [thread overview]
Message-ID: <2102622831.80983.1767254078431@app.mailbox.org> (raw)
In-Reply-To: <20251231201447.1399-1-mhklinux@outlook.com>
> On 12/31/2025 12:14 PM mhkelley58@gmail.com wrote:
>
>
> From: Michael Kelley <mhklinux@outlook.com>
>
> hv_kmsg_dump() currently skips the panic notification entirely if it
> doesn't get any message bytes to pass to Hyper-V due to an error from
> kmsg_dump_get_buffer(). Skipping the notification is undesirable because
> it leaves the Hyper-V host uncertain about the state of a panic'ed guest.
>
> Fix this by always doing the panic notification, even if bytes_written
> is zero. Also ensure that bytes_written is initialized, which fixes a
> kernel test robot warning. The warning is actually bogus because
> kmsg_dump_get_buffer() happens to set bytes_written even if it fails, and
> in the kernel test robot's CONFIG_PRINTK not set case, hv_kmsg_dump() is
> never called. But do the initialization for robustness and to quiet the
> static checker.
>
> Fixes: 9c318a1d9b50 ("Drivers: hv: move panic report code from vmbus to hv early init code")
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/all/202512172103.OcUspn1Z-lkp@intel.com/
> Signed-off-by: Michael Kelley <mhklinux@outlook.com>
Reviewed-by: Roman Kisel <vdso@mailbox.org>
> ---
> Changes in v2:
> * Reworked patch to focus on always sending the panic message, with
> resolving the uninitialized variable report as a side effect. See
> discussion on v1 of the patch [1]
>
> [1] https://lore.kernel.org/linux-hyperv/20251219160832.1628-1-mhklinux@outlook.com/
>
> drivers/hv/hv_common.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c
> index 0a3ab7efed46..f1c17fb60dc1 100644
> --- a/drivers/hv/hv_common.c
> +++ b/drivers/hv/hv_common.c
> @@ -195,13 +195,15 @@ static void hv_kmsg_dump(struct kmsg_dumper *dumper,
>
> /*
> * Write dump contents to the page. No need to synchronize; panic should
> - * be single-threaded.
> + * be single-threaded. Ignore failures from kmsg_dump_get_buffer() since
> + * panic notification should be done even if there is no message data.
> + * Don't assume bytes_written is set in case of failure, so initialize it.
> */
> kmsg_dump_rewind(&iter);
> - kmsg_dump_get_buffer(&iter, false, hv_panic_page, HV_HYP_PAGE_SIZE,
> + bytes_written = 0;
> + (void)kmsg_dump_get_buffer(&iter, false, hv_panic_page, HV_HYP_PAGE_SIZE,
> &bytes_written);
> - if (!bytes_written)
> - return;
> +
> /*
> * P3 to contain the physical address of the panic page & P4 to
> * contain the size of the panic data in that page. Rest of the
> @@ -210,7 +212,7 @@ static void hv_kmsg_dump(struct kmsg_dumper *dumper,
> hv_set_msr(HV_MSR_CRASH_P0, 0);
> hv_set_msr(HV_MSR_CRASH_P1, 0);
> hv_set_msr(HV_MSR_CRASH_P2, 0);
> - hv_set_msr(HV_MSR_CRASH_P3, virt_to_phys(hv_panic_page));
> + hv_set_msr(HV_MSR_CRASH_P3, bytes_written ? virt_to_phys(hv_panic_page) : 0);
> hv_set_msr(HV_MSR_CRASH_P4, bytes_written);
>
> /*
> --
> 2.25.1
next prev parent reply other threads:[~2026-01-01 8:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-31 20:14 [PATCH v2 1/1] Drivers: hv: Always do Hyper-V panic notification in hv_kmsg_dump() mhkelley58
2026-01-01 7:54 ` vdso [this message]
2026-01-15 7:01 ` Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2102622831.80983.1767254078431@app.mailbox.org \
--to=vdso@mailbox.org \
--cc=dan.carpenter@linaro.org \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhkelley58@gmail.com \
--cc=mhklinux@outlook.com \
--cc=wei.liu@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox