Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Mar 2023 09:31:51 -0500
From:      Kyle Evans <kevans@freebsd.org>
To:        Yuri <yuri@aetern.org>
Cc:        Kyle Evans <kevans@freebsd.org>, John-Mark Gurney <jmg@freebsd.org>, src-committers@freebsd.org,  dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: 2fee87562948 - main - abstract out the vm detection via smbios..
Message-ID:  <CACNAnaFoexhcW7ZV0_3M6ai1otxWmmNV8g0s3G90uEm1njTOYw@mail.gmail.com>
In-Reply-To: <b69e63db-341c-552b-0fd5-11a8519356ad@aetern.org>
References:  <202303030055.3230tl3S091663@gitrepo.freebsd.org> <CACNAnaG0S42fBbmdnutjM0v0Tm-peR1NngU-_P2C1xqKAUFQYA@mail.gmail.com> <b69e63db-341c-552b-0fd5-11a8519356ad@aetern.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Mar 16, 2023 at 7:29=E2=80=AFAM Yuri <yuri@aetern.org> wrote:
>
> Kyle Evans wrote:
> > On Thu, Mar 2, 2023 at 6:55=E2=80=AFPM John-Mark Gurney <jmg@freebsd.or=
g> wrote:
> >>
> >> The branch main has been updated by jmg:
> >>
> >> URL: https://cgit.FreeBSD.org/src/commit/?id=3D2fee8756294820ff9ec6f8d=
17324e7d8a0a45040
> >>
> >> commit 2fee8756294820ff9ec6f8d17324e7d8a0a45040
> >> Author:     John-Mark Gurney <jmg@FreeBSD.org>
> >> AuthorDate: 2023-02-23 20:59:50 +0000
> >> Commit:     John-Mark Gurney <jmg@FreeBSD.org>
> >> CommitDate: 2023-03-03 00:54:21 +0000
> >>
> >>     abstract out the vm detection via smbios..
> >>
> >>     This makes the detection of VMs common between platforms that
> >>     have SMBios.
> >>
> >>     Reviewed by:            imp, kib
> >>     Differential Revision:  https://reviews.freebsd.org/D38800
> >> ---
> >>  sys/amd64/amd64/machdep.c    |   3 ++
> >>  sys/arm64/arm64/machdep.c    |   4 ++
> >>  sys/conf/files.arm64         |   2 +
> >>  sys/conf/files.x86           |   1 +
> >>  sys/dev/smbios/smbios.h      |   4 ++
> >>  sys/dev/smbios/smbios_subr.c | 104 ++++++++++++++++++++++++++++++++++=
+++++++++
> >>  sys/i386/i386/machdep.c      |   3 ++
> >>  sys/x86/x86/identcpu.c       |  57 ------------------------
> >>  8 files changed, 121 insertions(+), 57 deletions(-)
> >>
> >> diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
> >> index f33f2c6509f0..480db1ed2c31 100644
> >> --- a/sys/amd64/amd64/machdep.c
> >> +++ b/sys/amd64/amd64/machdep.c
> >> [... snip ...]
> >> @@ -1315,6 +1317,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfre=
e)
> >>
> >>         identify_cpu1();
> >>         identify_hypervisor();
> >> +       identify_hypervisor_smbios();
> >>         identify_cpu_fixup_bsp();
> >>         identify_cpu2();
> >>         initializecpucache();
> >
> > This brings in a behavior change that I don't think you intended.
> > Previously, we wouldn't let smbios clobber a vm_guest detected from
> > cpuid due to an early return, but nothing is stopping it from
> > happening now. I think this call should've been protected behind a
> > `vm_guest =3D=3D VM_GUEST_NO || vm_guest =3D=3D VM_GUEST_VM` (the latte=
r being
> > "CPUID2_HV was set but we couldn't determine anything useful after
> > that"), perhaps?
>
> (sorry, don't have the original message, replying here)
>
> This also seem to have broken Hyper-V VM boot:
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D270239.
>
> Gen2 VM boots again with this commit reverted.

Sorry, I should have led with this. A private report had indicated to
me as such and that they had bisected it down to this commit. They've
since confirmed that on HyperV:

smbios.system.product=3D"Virtual Machine"

and that avoiding the smbios detection if vm_guest has a specific
vendor already set does indeed fix it.

Thanks,

Kyle Evans



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaFoexhcW7ZV0_3M6ai1otxWmmNV8g0s3G90uEm1njTOYw>