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>
next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail=_C99E4D6A-FEDF-4AB4-A2F9-E2F8C3A89B06 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Nov 2, 2023, at 5:30 PM, Mateusz Guzik <mjguzik@gmail.com> wrote: >=20 > On 11/2/23, Zhenlei Huang <zlei@freebsd.org <mailto:zlei@freebsd.org>> = wrote: >> Sorry I committed too fast. >>=20 >> I should give credentials to Souradeep in the commit message. >>=20 >> Thank him for the analysis ! >>=20 >=20 > 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 .=20 >=20 >>> On Nov 2, 2023, at 5:09 PM, Zhenlei Huang <zlei@FreeBSD.org> wrote: >>>=20 >>> The branch main has been updated by zlei: >>>=20 >>> URL: >>> = https://cgit.FreeBSD.org/src/commit/?id=3D63bf943d4af17799cef21e2bb78dd280= 03ce1ce5 >>>=20 >>> 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 >>>=20 >>> Hyper-V: vmbus: Add NULL check for vmbus_res >>>=20 >>> 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. >>>=20 >>> For real Hyper-V, both gen1 and gen2 have vmbus_res then they are = not >>> affected by this change. >>>=20 >>> 1. https://www.qemu.org/docs/master/system/i386/hyperv.html >>>=20 >>> 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(-) >>>=20 >>> 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 =3D 0; >>>=20 >>> if (sc->vmbus_flags & VMBUS_FLAG_ATTACHED) >>> return (0); >>> @@ -1416,10 +1416,12 @@ vmbus_doattach(struct vmbus_softc *sc) >>>=20 >>> /* Coherency attribute */ >>> dev_res =3D devclass_get_device(devclass_find("vmbus_res"), 0); >>> - handle =3D acpi_get_handle(dev_res); >>> + if (dev_res !=3D NULL) { >>> + handle =3D acpi_get_handle(dev_res); >>>=20 >>> - if (ACPI_FAILURE(acpi_GetInteger(handle, "_CCA", &coherent))) >>> - coherent =3D 0; >>> + if (ACPI_FAILURE(acpi_GetInteger(handle, "_CCA", = &coherent))) >>> + coherent =3D 0; >>> + } >>> if (bootverbose) >>> device_printf(sc->vmbus_dev, "Bus is%s = cache-coherent\n", >>> coherent ? "" : " not"); >>=20 >>=20 >>=20 >>=20 >=20 >=20 > --=20 > Mateusz Guzik <mjguzik gmail.com <http://gmail.com/>> --Apple-Mail=_C99E4D6A-FEDF-4AB4-A2F9-E2F8C3A89B06 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; = charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; line-break: after-white-space;" class=3D""><br = class=3D""><div><br class=3D""><blockquote type=3D"cite" class=3D""><div = class=3D"">On Nov 2, 2023, at 5:30 PM, Mateusz Guzik <<a = href=3D"mailto:mjguzik@gmail.com" class=3D"">mjguzik@gmail.com</a>> = wrote:</div><br class=3D"Apple-interchange-newline"><div class=3D""><meta = charset=3D"UTF-8" class=3D""><span style=3D"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=3D"">On 11/2/23, Zhenlei Huang <</span><a = href=3D"mailto:zlei@freebsd.org" style=3D"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=3D"">zlei@freebsd.org</a><span = style=3D"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=3D"">> = wrote:</span><br style=3D"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=3D""><blockquote type=3D"cite" style=3D"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=3D"">Sorry = I committed too fast.<br class=3D""><br class=3D"">I should give = credentials to Souradeep in the commit message.<br class=3D""><br = class=3D"">Thank him for the analysis !<br class=3D""><br = class=3D""></blockquote><br style=3D"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=3D""><span style=3D"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=3D"">again this kind of change you can revert and recommit with = proper</span><br style=3D"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=3D""><span style=3D"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=3D"">authorship, = as long as it happens fast</span><br style=3D"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=3D""></div></blockquote><div><br = class=3D""></div><div>I'm really <span style=3D"caret-color: rgb(0, = 0, 0); color: rgb(0, 0, 0);" class=3D"">really</span> sorry for = that.</div><div>I realized that until the commit has been MFCed into = stable/14 and releng/14.0 . <br class=3D""></div><br = class=3D""><blockquote type=3D"cite" class=3D""><div class=3D""><br = style=3D"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=3D""><blockquote type=3D"cite" style=3D"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=3D""><blockquote type=3D"cite" class=3D"">On Nov 2, 2023, at 5:09 = PM, Zhenlei Huang <<a href=3D"mailto:zlei@FreeBSD.org" = class=3D"">zlei@FreeBSD.org</a>> wrote:<br class=3D""><br = class=3D"">The branch main has been updated by zlei:<br class=3D""><br = class=3D"">URL:<br class=3D""><a = href=3D"https://cgit.FreeBSD.org/src/commit/?id=3D63bf943d4af17799cef21e2b= b78dd28003ce1ce5" = class=3D"">https://cgit.FreeBSD.org/src/commit/?id=3D63bf943d4af17799cef21= e2bb78dd28003ce1ce5</a><br class=3D""><br class=3D"">commit = 63bf943d4af17799cef21e2bb78dd28003ce1ce5<br class=3D"">Author: = Zhenlei Huang <zlei@FreeBSD.org><br = class=3D"">AuthorDate: 2023-11-02 09:07:11 +0000<br class=3D"">Commit: = Zhenlei Huang <zlei@FreeBSD.org><br = class=3D"">CommitDate: 2023-11-02 09:07:11 +0000<br class=3D""><br = class=3D""> Hyper-V: vmbus: Add NULL check for vmbus_res<br = class=3D""><br class=3D""> QEMU emulates Hyper-V [1] but = lacks the emulation for vmbus_res, thus<br class=3D"">no<br = class=3D""> coherence information is available. Add NULL = check for it and fallback<br class=3D""> to no coherence. = This will prevent FreeBSD guests from panic on QEMU<br = class=3D""> with the Hyper-V enlightenment hv-synic = enabled.<br class=3D""><br class=3D""> For real Hyper-V, both = gen1 and gen2 have vmbus_res then they are not<br = class=3D""> affected by this change.<br class=3D""><br = class=3D""> 1. = https://www.qemu.org/docs/master/system/i386/hyperv.html<br class=3D""><br= class=3D""> PR: = 27= 4810<br class=3D""> Reviewed by: mhorne, = emaste, delphij, whu<br class=3D""> Diagnosed by: = mhorne<br class=3D""> Fixes: = e7a9817b8d32 = Hyper-V: vmbus: implementat<br class=3D"">bus_get_dma_tag in vmbus<br = class=3D""> Insta-MFC approved by: re (delphij) for = 14.0-RC4<br class=3D""> Differential Revision: = https://reviews.freebsd.org/D42414<br class=3D"">---<br = class=3D"">sys/dev/hyperv/vmbus/vmbus.c | 10 ++++++----<br class=3D"">1 = file changed, 6 insertions(+), 4 deletions(-)<br class=3D""><br = class=3D"">diff --git a/sys/dev/hyperv/vmbus/vmbus.c = b/sys/dev/hyperv/vmbus/vmbus.c<br class=3D"">index = ee412e643b4f..0ea401507b79 100644<br class=3D"">--- = a/sys/dev/hyperv/vmbus/vmbus.c<br class=3D"">+++ = b/sys/dev/hyperv/vmbus/vmbus.c<br class=3D"">@@ -1393,7 +1393,7 @@ = vmbus_doattach(struct vmbus_softc *sc)<br class=3D""><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>int = ret;<br class=3D""><span class=3D"Apple-tab-span" style=3D"white-space: = pre;"> </span>device_t dev_res;<br class=3D""><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>ACPI_HANDLE handle;<br class=3D"">-<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>unsigned int coherent;<br = class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>unsigned int coherent =3D 0;<br class=3D""><br class=3D""><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>if = (sc->vmbus_flags & VMBUS_FLAG_ATTACHED)<br class=3D""><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>return = (0);<br class=3D"">@@ -1416,10 +1416,12 @@ vmbus_doattach(struct = vmbus_softc *sc)<br class=3D""><br class=3D""><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>/* = Coherency attribute */<br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>dev_res =3D = devclass_get_device(devclass_find("vmbus_res"), 0);<br = class=3D"">-<span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>handle =3D acpi_get_handle(dev_res);<br class=3D"">+<span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>if = (dev_res !=3D NULL) {<br class=3D"">+<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>handle =3D = acpi_get_handle(dev_res);<br class=3D""><br class=3D"">-<span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>if = (ACPI_FAILURE(acpi_GetInteger(handle, "_CCA", &coherent)))<br = class=3D"">-<span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span><span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>coherent =3D 0;<br class=3D"">+<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>if = (ACPI_FAILURE(acpi_GetInteger(handle, "_CCA", &coherent)))<br = class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span><span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span><span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>coherent =3D 0;<br class=3D"">+<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>}<br class=3D""><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>if = (bootverbose)<br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>device_printf(sc->vmbus_dev, = "Bus is%s cache-coherent\n",<br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>coherent ? "" : " not");<br = class=3D""></blockquote><br class=3D""><br class=3D""><br class=3D""><br = class=3D""></blockquote><br style=3D"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=3D""><br style=3D"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=3D""><span style=3D"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=3D"">--<span class=3D"Apple-converted-space"> </span></span><br= style=3D"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=3D""><span style=3D"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=3D"">Mateusz Guzik = <mjguzik<span class=3D"Apple-converted-space"> </span></span><a = href=3D"http://gmail.com/" style=3D"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=3D"">gmail.com</a><span = style=3D"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=3D"">></span></div></blockquote></div><br class=3D""><div = class=3D""> <div><br class=3D""></div> </div> <br class=3D""></body></html>= --Apple-Mail=_C99E4D6A-FEDF-4AB4-A2F9-E2F8C3A89B06--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?06D3671F-870E-4E50-A075-4CB4C73D2BDD>