Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Apr 2013 13:45:50 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-virtualization@freebsd.org
Cc:        Alexander Motin <mav@freebsd.org>, KY Srinivasan <kys@microsoft.com>, "Abhishek Gupta \(LIS\)" <abgupta@microsoft.com>
Subject:   Re: Proposal for better support of hypervisors and their synthetic drivers at boot-time
Message-ID:  <201304291345.50635.jhb@freebsd.org>
In-Reply-To: <CADFB2gwLvnRLzL5VBOYSWURduW3j6y9=VqGO8LVtOfGkgQdWTQ@mail.gmail.com>
References:  <CADFB2gwLvnRLzL5VBOYSWURduW3j6y9=VqGO8LVtOfGkgQdWTQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
I know Alexander replied about the ATA bits already, but I wanted to reply to 
two of your other points below:

On Tuesday, April 23, 2013 10:07:03 am Larry Melia wrote:
> (1) Move the call to init_param1() (in sys/kern/subr_parm.c), which is used
> for hypervisor detection, to an earlier point in the boot process.
> Presently, it appears to be called after the ATA driver is selected, which
> is too late in the boot process. (This was discovered after some testing
> with the ATA driver.) Therefore, before the bus drivers and native
> controllers are detected and selected, discovery of a host hypervisor
> should be done first.
> 
> (3) Upgrade the init_param1() function (in sys/kern/subr_parm.c) to use the
> more recent approach to hypervisor detection. This approach uses the
> CPU-identify functions to retrieve a unique signature consisting of a fixed
> string of ASCII characters. This was done on Linux about five years. For
> backward compatibility, however, the existing logic would be retained, but
> augmented with this new approach. It would also be conditionally added only
> for x86/AMD64 builds.

I definitely agree with these proposals.  In addition, our current hypervisor 
detection code is completely x86-specific and does not belong in MI code.  The 
only bits that should be MI are the vm_guest variable and the VM_GUEST 
constants.  I would argue that most of the VM_GUEST constants (for specific 
VMs which we do not have currently) should be MD as well.

Each platform that supports hypervisors would install its own SYSINIT to set 
vm_guest instead of doing it directly from init_param1().

Making the VM_GUEST_FOO constants be MD macros means you can use #ifdef to 
test for them.  Thus:

#ifdef VM_GUEST_HYPERV
/* Include a hyper-V specific driver. */
#endif

The current enum approach doesn't allow for that.

-- 
John Baldwin



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