Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Nov 2023 17:40:00 +0800
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        Mateusz Guzik <mjguzik@gmail.com>
Cc:        "src-committers@freebsd.org" <src-committers@freebsd.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@freebsd.org>, Souradeep Chakrabarti <schakrabarti@microsoft.com>
Subject:   Re: git: 63bf943d4af1 - main - Hyper-V: vmbus: Add NULL check for vmbus_res
Message-ID:  <06D3671F-870E-4E50-A075-4CB4C73D2BDD@FreeBSD.org>
In-Reply-To: <CAGudoHG9Xq0dnObd=jUQ9YkY158K92hqiQA6MEM2sK4CRJEteA@mail.gmail.com>
References:  <202311020909.3A299SXQ075865@gitrepo.freebsd.org> <2E6A685B-A8E4-48A2-B21A-422AFBEA4440@FreeBSD.org> <CAGudoHG9Xq0dnObd=jUQ9YkY158K92hqiQA6MEM2sK4CRJEteA@mail.gmail.com>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]


> On Nov 2, 2023, at 5:30 PM, Mateusz Guzik <mjguzik@gmail.com> wrote:
> 
> On 11/2/23, Zhenlei Huang <zlei@freebsd.org <mailto:zlei@freebsd.org>> wrote:
>> Sorry I committed too fast.
>> 
>> I should give credentials to Souradeep in the commit message.
>> 
>> Thank him for the analysis !
>> 
> 
> again this kind of change you can revert and recommit with proper
> authorship, as long as it happens fast

I'm really really sorry for that.
I realized that until the commit has been MFCed into stable/14 and releng/14.0 . 

> 
>>> On Nov 2, 2023, at 5:09 PM, Zhenlei Huang <zlei@FreeBSD.org> wrote:
>>> 
>>> The branch main has been updated by zlei:
>>> 
>>> URL:
>>> https://cgit.FreeBSD.org/src/commit/?id=63bf943d4af17799cef21e2bb78dd28003ce1ce5
>>> 
>>> commit 63bf943d4af17799cef21e2bb78dd28003ce1ce5
>>> Author:     Zhenlei Huang <zlei@FreeBSD.org>
>>> AuthorDate: 2023-11-02 09:07:11 +0000
>>> Commit:     Zhenlei Huang <zlei@FreeBSD.org>
>>> CommitDate: 2023-11-02 09:07:11 +0000
>>> 
>>>   Hyper-V: vmbus: Add NULL check for vmbus_res
>>> 
>>>   QEMU emulates Hyper-V [1] but lacks the emulation for vmbus_res, thus
>>> no
>>>   coherence information is available. Add NULL check for it and fallback
>>>   to no coherence. This will prevent FreeBSD guests from panic on QEMU
>>>   with the Hyper-V enlightenment hv-synic enabled.
>>> 
>>>   For real Hyper-V, both gen1 and gen2 have vmbus_res then they are not
>>>   affected by this change.
>>> 
>>>   1. https://www.qemu.org/docs/master/system/i386/hyperv.html
>>> 
>>>   PR:             274810
>>>   Reviewed by:    mhorne, emaste, delphij, whu
>>>   Diagnosed by:   mhorne
>>>   Fixes:          e7a9817b8d32 Hyper-V: vmbus: implementat
>>> bus_get_dma_tag in vmbus
>>>   Insta-MFC approved by:  re (delphij) for 14.0-RC4
>>>   Differential Revision:  https://reviews.freebsd.org/D42414
>>> ---
>>> sys/dev/hyperv/vmbus/vmbus.c | 10 ++++++----
>>> 1 file changed, 6 insertions(+), 4 deletions(-)
>>> 
>>> diff --git a/sys/dev/hyperv/vmbus/vmbus.c b/sys/dev/hyperv/vmbus/vmbus.c
>>> index ee412e643b4f..0ea401507b79 100644
>>> --- a/sys/dev/hyperv/vmbus/vmbus.c
>>> +++ b/sys/dev/hyperv/vmbus/vmbus.c
>>> @@ -1393,7 +1393,7 @@ vmbus_doattach(struct vmbus_softc *sc)
>>> 	int ret;
>>> 	device_t dev_res;
>>> 	ACPI_HANDLE handle;
>>> -	unsigned int coherent;
>>> +	unsigned int coherent = 0;
>>> 
>>> 	if (sc->vmbus_flags & VMBUS_FLAG_ATTACHED)
>>> 		return (0);
>>> @@ -1416,10 +1416,12 @@ vmbus_doattach(struct vmbus_softc *sc)
>>> 
>>> 	/* Coherency attribute */
>>> 	dev_res =  devclass_get_device(devclass_find("vmbus_res"), 0);
>>> -	handle = acpi_get_handle(dev_res);
>>> +	if (dev_res != NULL) {
>>> +		handle = acpi_get_handle(dev_res);
>>> 
>>> -	if (ACPI_FAILURE(acpi_GetInteger(handle, "_CCA", &coherent)))
>>> -		coherent = 0;
>>> +		if (ACPI_FAILURE(acpi_GetInteger(handle, "_CCA", &coherent)))
>>> +			coherent = 0;
>>> +	}
>>> 	if (bootverbose)
>>> 		device_printf(sc->vmbus_dev, "Bus is%s cache-coherent\n",
>>> 			coherent ? "" : " not");
>> 
>> 
>> 
>> 
> 
> 
> -- 
> Mateusz Guzik <mjguzik gmail.com <http://gmail.com/>>;




[-- Attachment #2 --]
<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Nov 2, 2023, at 5:30 PM, Mateusz Guzik &lt;<a href="mailto:mjguzik@gmail.com" class="">mjguzik@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta charset="UTF-8" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">On 11/2/23, Zhenlei Huang &lt;</span><a href="mailto:zlei@freebsd.org" style="font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">zlei@freebsd.org</a><span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">&gt; wrote:</span><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">Sorry I committed too fast.<br class=""><br class="">I should give credentials to Souradeep in the commit message.<br class=""><br class="">Thank him for the analysis !<br class=""><br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">again this kind of change you can revert and recommit with proper</span><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">authorship, as long as it happens fast</span><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""></div></blockquote><div><br class=""></div><div>I'm really&nbsp;<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class="">really</span>&nbsp;sorry for that.</div><div>I realized that until the commit has been MFCed into stable/14 and releng/14.0 .&nbsp;<br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" class="">On Nov 2, 2023, at 5:09 PM, Zhenlei Huang &lt;<a href="mailto:zlei@FreeBSD.org" class="">zlei@FreeBSD.org</a>&gt; wrote:<br class=""><br class="">The branch main has been updated by zlei:<br class=""><br class="">URL:<br class=""><a href="https://cgit.FreeBSD.org/src/commit/?id=63bf943d4af17799cef21e2bb78dd28003ce1ce5" class="">https://cgit.FreeBSD.org/src/commit/?id=63bf943d4af17799cef21e2bb78dd28003ce1ce5</a><br class=""><br class="">commit 63bf943d4af17799cef21e2bb78dd28003ce1ce5<br class="">Author: &nbsp;&nbsp;&nbsp;&nbsp;Zhenlei Huang &lt;zlei@FreeBSD.org&gt;<br class="">AuthorDate: 2023-11-02 09:07:11 +0000<br class="">Commit: &nbsp;&nbsp;&nbsp;&nbsp;Zhenlei Huang &lt;zlei@FreeBSD.org&gt;<br class="">CommitDate: 2023-11-02 09:07:11 +0000<br class=""><br class="">&nbsp;&nbsp;Hyper-V: vmbus: Add NULL check for vmbus_res<br class=""><br class="">&nbsp;&nbsp;QEMU emulates Hyper-V [1] but lacks the emulation for vmbus_res, thus<br class="">no<br class="">&nbsp;&nbsp;coherence information is available. Add NULL check for it and fallback<br class="">&nbsp;&nbsp;to no coherence. This will prevent FreeBSD guests from panic on QEMU<br class="">&nbsp;&nbsp;with the Hyper-V enlightenment hv-synic enabled.<br class=""><br class="">&nbsp;&nbsp;For real Hyper-V, both gen1 and gen2 have vmbus_res then they are not<br class="">&nbsp;&nbsp;affected by this change.<br class=""><br class="">&nbsp;&nbsp;1. https://www.qemu.org/docs/master/system/i386/hyperv.html<br class=""><br class="">&nbsp;&nbsp;PR: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;274810<br class="">&nbsp;&nbsp;Reviewed by: &nbsp;&nbsp;&nbsp;mhorne, emaste, delphij, whu<br class="">&nbsp;&nbsp;Diagnosed by: &nbsp;&nbsp;mhorne<br class="">&nbsp;&nbsp;Fixes: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e7a9817b8d32 Hyper-V: vmbus: implementat<br class="">bus_get_dma_tag in vmbus<br class="">&nbsp;&nbsp;Insta-MFC approved by: &nbsp;re (delphij) for 14.0-RC4<br class="">&nbsp;&nbsp;Differential Revision: &nbsp;https://reviews.freebsd.org/D42414<br class="">---<br class="">sys/dev/hyperv/vmbus/vmbus.c | 10 ++++++----<br class="">1 file changed, 6 insertions(+), 4 deletions(-)<br class=""><br class="">diff --git a/sys/dev/hyperv/vmbus/vmbus.c b/sys/dev/hyperv/vmbus/vmbus.c<br class="">index ee412e643b4f..0ea401507b79 100644<br class="">--- a/sys/dev/hyperv/vmbus/vmbus.c<br class="">+++ b/sys/dev/hyperv/vmbus/vmbus.c<br class="">@@ -1393,7 +1393,7 @@ vmbus_doattach(struct vmbus_softc *sc)<br class=""><span class="Apple-tab-span" style="white-space: pre;">	</span>int ret;<br class=""><span class="Apple-tab-span" style="white-space: pre;">	</span>device_t dev_res;<br class=""><span class="Apple-tab-span" style="white-space: pre;">	</span>ACPI_HANDLE handle;<br class="">-<span class="Apple-tab-span" style="white-space: pre;">	</span>unsigned int coherent;<br class="">+<span class="Apple-tab-span" style="white-space: pre;">	</span>unsigned int coherent = 0;<br class=""><br class=""><span class="Apple-tab-span" style="white-space: pre;">	</span>if (sc-&gt;vmbus_flags &amp; VMBUS_FLAG_ATTACHED)<br class=""><span class="Apple-tab-span" style="white-space: pre;">	</span><span class="Apple-tab-span" style="white-space: pre;">	</span>return (0);<br class="">@@ -1416,10 +1416,12 @@ vmbus_doattach(struct vmbus_softc *sc)<br class=""><br class=""><span class="Apple-tab-span" style="white-space: pre;">	</span>/* Coherency attribute */<br class=""><span class="Apple-tab-span" style="white-space: pre;">	</span>dev_res = &nbsp;devclass_get_device(devclass_find("vmbus_res"), 0);<br class="">-<span class="Apple-tab-span" style="white-space: pre;">	</span>handle = acpi_get_handle(dev_res);<br class="">+<span class="Apple-tab-span" style="white-space: pre;">	</span>if (dev_res != NULL) {<br class="">+<span class="Apple-tab-span" style="white-space: pre;">	</span><span class="Apple-tab-span" style="white-space: pre;">	</span>handle = acpi_get_handle(dev_res);<br class=""><br class="">-<span class="Apple-tab-span" style="white-space: pre;">	</span>if (ACPI_FAILURE(acpi_GetInteger(handle, "_CCA", &amp;coherent)))<br class="">-<span class="Apple-tab-span" style="white-space: pre;">	</span><span class="Apple-tab-span" style="white-space: pre;">	</span>coherent = 0;<br class="">+<span class="Apple-tab-span" style="white-space: pre;">	</span><span class="Apple-tab-span" style="white-space: pre;">	</span>if (ACPI_FAILURE(acpi_GetInteger(handle, "_CCA", &amp;coherent)))<br class="">+<span class="Apple-tab-span" style="white-space: pre;">	</span><span class="Apple-tab-span" style="white-space: pre;">	</span><span class="Apple-tab-span" style="white-space: pre;">	</span>coherent = 0;<br class="">+<span class="Apple-tab-span" style="white-space: pre;">	</span>}<br class=""><span class="Apple-tab-span" style="white-space: pre;">	</span>if (bootverbose)<br class=""><span class="Apple-tab-span" style="white-space: pre;">	</span><span class="Apple-tab-span" style="white-space: pre;">	</span>device_printf(sc-&gt;vmbus_dev, "Bus is%s cache-coherent\n",<br class=""><span class="Apple-tab-span" style="white-space: pre;">	</span><span class="Apple-tab-span" style="white-space: pre;">	</span><span class="Apple-tab-span" style="white-space: pre;">	</span>coherent ? "" : " not");<br class=""></blockquote><br class=""><br class=""><br class=""><br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">--<span class="Apple-converted-space">&nbsp;</span></span><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Mateusz Guzik &lt;mjguzik<span class="Apple-converted-space">&nbsp;</span></span><a href="http://gmail.com/" style="font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">gmail.com</a><span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">&gt;</span></div></blockquote></div><br class=""><div class="">
<div><br class=""></div>

</div>
<br class=""></body></html>
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?06D3671F-870E-4E50-A075-4CB4C73D2BDD>