Message ID | 1334418796-11473-3-git-send-email-apw@canonical.com |
---|---|
State | Not Applicable |
Delegated to: | David Miller |
Headers | show |
O> +#ifdef CONFIG_X86 > + /* On Hyper-V hypervisors the disks are exposed on both the emulated > + * SATA controller and on the paravirtualised drivers. The CD/DVD > + * devices are only exposed on the emulated controller. Request we > + * ignore ATA devices on this host. > + */ > + if (prefer_ms_hyperv && x86_hyper == &x86_hyper_ms_hyperv) { > + host->flags |= ATA_HOST_IGNORE_ATA; > + dev_info(&pdev->dev, "Hyper-V hypervisor detected, ignoring ATA disks\n"); > + } > +#endif Does hyper-v not set its own unique and identifable pci subvendor/subdevice ? Alan -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> -----Original Message----- > From: Alan Cox [mailto:alan@lxorguk.ukuu.org.uk] > Sent: Saturday, April 14, 2012 12:02 PM > To: Andy Whitcroft > Cc: Jeff Garzik; linux-ide@vger.kernel.org; linux-kernel@vger.kernel.org; KY > Srinivasan; Mike Sterling > Subject: Re: [PATCH 2/2] ata_piix: defer disks to the Hyper-V drivers by default > > O> +#ifdef CONFIG_X86 > > + /* On Hyper-V hypervisors the disks are exposed on both the emulated > > + * SATA controller and on the paravirtualised drivers. The CD/DVD > > + * devices are only exposed on the emulated controller. Request we > > + * ignore ATA devices on this host. > > + */ > > + if (prefer_ms_hyperv && x86_hyper == &x86_hyper_ms_hyperv) { > > + host->flags |= ATA_HOST_IGNORE_ATA; > > + dev_info(&pdev->dev, "Hyper-V hypervisor detected, ignoring > ATA disks\n"); > > + } > > +#endif > > Does hyper-v not set its own unique and identifable pci > subvendor/subdevice ? Number of elements of the virtual BIOS we present the guest can be used to detect that we are running on Hyper-V. Additionally, we are exporting state based on CPU detection which is what Andy is using here. As far as I know these are the only ways to detect that we are running on Hyper-V. Regards, K. Y > > Alan > > -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Add support for ignoring disks devices on specific host controllers to libata. Use this support to trigger us to ignore Hyper-V disk devices on the emulated SATA device based on the system DMI information. Jeff, I believe the first patch is what you had in mind in your comments. Alan, the piix sadly has no subvendor/subdevice identifiers at all though we are able to detect the platform from the DMI information, this any better? -apw V3 - switch detection method to DMI information V2 - create a generic libata quirk - switch detection to piix_init_one Andy Whitcroft (2): libata: add a host flag to ignore detected ATA devices ata_piix: defer disks to the Hyper-V drivers by default drivers/ata/ata_piix.c | 20 ++++++++++++++++++++ drivers/ata/libata-core.c | 7 +++++++ include/linux/libata.h | 1 + 3 files changed, 28 insertions(+)
On Mon, 16 Apr 2012 12:20:27 +0100 Andy Whitcroft <apw@canonical.com> wrote: > Add support for ignoring disks devices on specific host controllers to > libata. Use this support to trigger us to ignore Hyper-V disk devices > on the emulated SATA device based on the system DMI information. > > Jeff, I believe the first patch is what you had in mind in your comments. > Alan, the piix sadly has no subvendor/subdevice identifiers at all So its 0x0000,0x0000 ? > though we are able to detect the platform from the DMI information, > this any better? What happens if you have a PIIX device which is being passed through from the underlying hardware or will hyper-v never support pass through ? Alan -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 04/16/2012 07:20 AM, Andy Whitcroft wrote: > Jeff, I believe the first patch is what you had in mind in your comments. > Alan, the piix sadly has no subvendor/subdevice identifiers at all > though we are able to detect the platform from the DMI information, > this any better? Please post "lspci -vvv" for this device... -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Apr 16, 2012 at 11:32:22AM -0400, Jeff Garzik wrote: > On 04/16/2012 07:20 AM, Andy Whitcroft wrote: > >Jeff, I believe the first patch is what you had in mind in your comments. > >Alan, the piix sadly has no subvendor/subdevice identifiers at all > >though we are able to detect the platform from the DMI information, > >this any better? > > Please post "lspci -vvv" for this device... lspci -nnvvv: 00:07.1 IDE interface [0101]: Intel Corporation 82371AB/EB/MB PIIX4 IDE [8086:7111] (rev 01) (prog-if 80 [Master]) Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 0 Region 0: [virtual] Memory at 000001f0 (32-bit, non-prefetchable) [size=8] Region 1: [virtual] Memory at 000003f0 (type 3, non-prefetchable) [size=1] Region 2: [virtual] Memory at 00000170 (32-bit, non-prefetchable) [size=8] Region 3: [virtual] Memory at 00000370 (type 3, non-prefetchable) [size=1] Region 4: I/O ports at ffa0 [size=16] Kernel driver in use: ata_piix -apw -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Apr 16, 2012 at 12:26:34PM +0100, Alan Cox wrote: > On Mon, 16 Apr 2012 12:20:27 +0100 > Andy Whitcroft <apw@canonical.com> wrote: > > > Add support for ignoring disks devices on specific host controllers to > > libata. Use this support to trigger us to ignore Hyper-V disk devices > > on the emulated SATA device based on the system DMI information. > > > > Jeff, I believe the first patch is what you had in mind in your comments. > > Alan, the piix sadly has no subvendor/subdevice identifiers at all > > So its 0x0000,0x0000 ? > > > though we are able to detect the platform from the DMI information, > > this any better? > > What happens if you have a PIIX device which is being passed through from > the underlying hardware or will hyper-v never support pass through ? A good question indeed. KY perhaps you can comment. -apw -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> -----Original Message----- > From: Andy Whitcroft [mailto:apw@canonical.com] > Sent: Monday, April 16, 2012 2:29 PM > To: Alan Cox > Cc: Jeff Garzik; linux-ide@vger.kernel.org; linux-kernel@vger.kernel.org; KY > Srinivasan; Mike Sterling > Subject: Re: [PATCH 0/2] Hyper-V disk support V3 > > On Mon, Apr 16, 2012 at 12:26:34PM +0100, Alan Cox wrote: > > On Mon, 16 Apr 2012 12:20:27 +0100 > > Andy Whitcroft <apw@canonical.com> wrote: > > > > > Add support for ignoring disks devices on specific host controllers to > > > libata. Use this support to trigger us to ignore Hyper-V disk devices > > > on the emulated SATA device based on the system DMI information. > > > > > > Jeff, I believe the first patch is what you had in mind in your comments. > > > Alan, the piix sadly has no subvendor/subdevice identifiers at all > > > > So its 0x0000,0x0000 ? > > > > > though we are able to detect the platform from the DMI information, > > > this any better? > > > > What happens if you have a PIIX device which is being passed through from > > the underlying hardware or will hyper-v never support pass through ? The notion of "pass through" in Hyper-V is a little different. IDE devices can be configured under either one of the supported controllers and these devices can either be virtual disks (VHDs) or physical disks. In either case these will be presented to the guest as IDE devices. Regards, K. Y -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> The notion of "pass through" in Hyper-V is a little different. IDE devices can be configured > under either one of the supported controllers and these devices can either be virtual disks > (VHDs) or physical disks. In either case these will be presented to the guest as IDE devices. So what ensures that by skipping it at the ATA device level we will always find it as a VHD ? Alan -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> -----Original Message----- > From: Alan Cox [mailto:alan@lxorguk.ukuu.org.uk] > Sent: Wednesday, April 18, 2012 4:13 PM > To: KY Srinivasan > Cc: Andy Whitcroft; Jeff Garzik; linux-ide@vger.kernel.org; linux- > kernel@vger.kernel.org; Mike Sterling > Subject: Re: [PATCH 0/2] Hyper-V disk support V3 > > > The notion of "pass through" in Hyper-V is a little different. IDE devices can be > configured > > under either one of the supported controllers and these devices can either be > virtual disks > > (VHDs) or physical disks. In either case these will be presented to the guest as > IDE devices. > > So what ensures that by skipping it at the ATA device level we will > always find it as a VHD ? If the Hyper-V storage driver is present, then the Hyper-V storage driver will manage the root device (and other devices skipped by the ata driver). So, the check if we are running on Hyper-V is not enough to skip the device in the ata_piix driver; we need to also make sure that the Hyper-V block driver is available to handle the skipped devices. I think the correct approach here is to have a kernel (or an ata_piix module parameter) that can be set to override the skipping of the block device by the ata driver. Distros that are including the Hyper-V storage driver can set this parameter so that when running on Hyper-V, ata can skip the block device. Regards, K. Y > > Alan > > -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Apr 18, 2012 at 09:12:35PM +0100, Alan Cox wrote: > > The notion of "pass through" in Hyper-V is a little different. IDE devices can be configured > > under either one of the supported controllers and these devices can either be virtual disks > > (VHDs) or physical disks. In either case these will be presented to the guest as IDE devices. > > So what ensures that by skipping it at the ATA device level we will > always find it as a VHD ? My understanding of things is that the if you have disks assigned to the guest that they will always appear both on the virtualised SATA contoller and on the paravirtualised driver channel. So that assuming a valid configuration in which both drivers initialise they will be picked up by one or the other. KY for clarity are we saying the only way a disk can appear in the guest is either on the emulated controller or paravirtualised, we will never expose real devices into the guest. Reading my own statement that ought to imply we really should only default preferring paravirtualised to 'on' when the hyperv paravirtualised drivers is enabled too; easy enough to do. Howeever in a perfect world the override would also have the inverse effect even if the paravirtualised driver initialises first; not so easy but I assume we with some fiddling we could make both drivers handle the same parameter. /me considers this further. -apw -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi! Shortly: 1) The flag to disable the Hyper-V IDE drivers is: ata_piix.prefer_ms_hyperv=02) #ifdef CONFIG_X86 #if defined(CONFIG_HYPERV_STORAGE) || defined(CONFIG_HYPERV_STORAGE_MODULE) #define ATA_PIIX_IGNORE_ATA_DISKS_ON_HYPERV 1 #endif #endif --- >>Alan Cox: >> So what ensures that by >> skipping it at the ATA device level we will always find it as a VHD ? > KY Srinivasan: > So, the check if we are running on Hyper-V is not enough > to skip the device in the ata_piix driver; > we need to also make sure that the Hyper-V block driver is available to handle the skipped devices. > I think the correct approach here is to have a kernel (or an ata_piix module parameter) > that can be set to override the skipping of the block device by the ata driver. Already implemented, see: module_param(prefer_ms_hyperv, int, 0); and work as need in real life: http://www.mail-archive.com/ubuntu-bugs@lists.ubuntu.com/msg3482442.html == Tim Miller Dyck Wed, 14 Mar 2012 07:15:52 -0700 . . . The boot flags can be viewed by pressing F5? F6? (one of those) on the setup boot screen and then navigating to the boot line with cursor keys and adding the boot parameter below before the double dash at the end of the line. The flag to disable the Hyper-V IDE drivers is: ata_piix.prefer_ms_hyperv=0 . . . == > Distros that are including the Hyper-V storage driver can set this parameter so > that when running on Hyper-V, ata can skip the block device. Best: Distros that are not-including the Hyper-V storage driver don't worry about "ata can skip" etc.: See re-incarnatin Olaf Hering idea: #ifdef CONFIG_X86 #if defined(CONFIG_HYPERV_STORAGE) || defined(CONFIG_HYPERV_STORAGE_MODULE) #define ATA_PIIX_IGNORE_ATA_DISKS_ON_HYPERV 1 #endif #endif and #ifdef CONFIG_X86 replace to #ifdef ATA_PIIX_IGNORE_ATA_DISKS_ON_HYPERV Best regards, Victor Miasnikov Blog: http://vvm.blog.tut.by/ -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> -----Original Message----- > From: Andy Whitcroft [mailto:apw@canonical.com] > Sent: Thursday, April 19, 2012 3:40 AM > To: Alan Cox > Cc: KY Srinivasan; Jeff Garzik; linux-ide@vger.kernel.org; linux- > kernel@vger.kernel.org; Mike Sterling > Subject: Re: [PATCH 0/2] Hyper-V disk support V3 > > On Wed, Apr 18, 2012 at 09:12:35PM +0100, Alan Cox wrote: > > > The notion of "pass through" in Hyper-V is a little different. IDE devices can > be configured > > > under either one of the supported controllers and these devices can either > be virtual disks > > > (VHDs) or physical disks. In either case these will be presented to the guest as > IDE devices. > > > > So what ensures that by skipping it at the ATA device level we will > > always find it as a VHD ? > > My understanding of things is that the if you have disks assigned to the > guest that they will always appear both on the virtualised SATA contoller > and on the paravirtualised driver channel. So that assuming a valid > configuration in which both drivers initialise they will be picked up by > one or the other. > > KY for clarity are we saying the only way a disk can appear in the guest > is either on the emulated controller or paravirtualised, we will never > expose real devices into the guest. You are right. Depending on how the device is configured for the guest, even in the pass through case, the device will show up as either an emulated device (if configured under the IDE controllers) or as a device under the synthetic scsi controller (as seen by the guest). The storvsc driver can handle both these configurations while the native ata driver can only handle emulated devices. Since, presently we can only boot off of a device configured under the IDE controller, we have the issue which your patch addresses. K. Y -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Add support for ignoring disks devices on specific host controllers to libata. Use this support to trigger us to ignore Hyper-V disk devices on the emulated SATA device based on the system DMI information. I have cleaned up the Hyper-V detection so it is only included when the paravirtualised drivers are enabled. I have also reintroduced the override which had mysteriously gone missing in V3. Comments? -apw V4 - only enable the quirk when the paravirtualised drivers are compiled - fix up the command line flag to disable this support V3 - switch detection method to DMI information V2 - create a generic libata quirk - switch detection to piix_init_one Andy Whitcroft (2): libata: add a host flag to ignore detected ATA devices ata_piix: defer disks to the Hyper-V drivers by default drivers/ata/ata_piix.c | 20 ++++++++++++++++++++ drivers/ata/libata-core.c | 7 +++++++ include/linux/libata.h | 1 + 3 files changed, 28 insertions(+)
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 68013f9..b52d8ab 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c @@ -94,6 +94,9 @@ #include <scsi/scsi_host.h> #include <linux/libata.h> #include <linux/dmi.h> +#ifdef CONFIG_X86 +#include <asm/hypervisor.h> +#endif #define DRV_NAME "ata_piix" #define DRV_VERSION "2.13" @@ -1567,6 +1570,11 @@ static bool piix_broken_system_poweroff(struct pci_dev *pdev) * Zero on success, or -ERRNO value. */ +#ifdef CONFIG_X86 +static int prefer_ms_hyperv = 1; +module_param(prefer_ms_hyperv, int, 0); +#endif + static int __devinit piix_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) { @@ -1667,6 +1675,18 @@ static int __devinit piix_init_one(struct pci_dev *pdev, } host->flags |= ATA_HOST_PARALLEL_SCAN; +#ifdef CONFIG_X86 + /* On Hyper-V hypervisors the disks are exposed on both the emulated + * SATA controller and on the paravirtualised drivers. The CD/DVD + * devices are only exposed on the emulated controller. Request we + * ignore ATA devices on this host. + */ + if (prefer_ms_hyperv && x86_hyper == &x86_hyper_ms_hyperv) { + host->flags |= ATA_HOST_IGNORE_ATA; + dev_info(&pdev->dev, "Hyper-V hypervisor detected, ignoring ATA disks\n"); + } +#endif + pci_set_master(pdev); return ata_pci_sff_activate_host(host, ata_bmdma_interrupt, sht); }
When we are hosted on a Microsoft Hyper-V hypervisor the guest disks are exposed both via the Hyper-V paravirtualised drivers and via an emulated SATA disk drive. In this case we want to use the paravirtualised drivers if we can as they are much more efficient. Note that the Hyper-V paravirtualised drivers only expose the virtual hard disk devices, the CDROM/DVD devices must still be enumerated. Mark the host controller ATA_HOST_IGNORE_ATA to prevent enumeration of disk devices. BugLink: http://bugs.launchpad.net/bugs/929545 BugLink: http://bugs.launchpad.net/bugs/942316 Signed-off-by: Andy Whitcroft <apw@canonical.com> --- drivers/ata/ata_piix.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)