All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] ata_piix: defer disks to the Hyper-V paravirtualised drivers by default
@ 2012-03-29 17:28 Andy Whitcroft
  2012-03-30  9:14   ` Victor Miasnikov
                   ` (3 more replies)
  0 siblings, 4 replies; 36+ messages in thread
From: Andy Whitcroft @ 2012-03-29 17:28 UTC (permalink / raw)
  To: Jeff Garzik, linux-ide
  Cc: Andy Whitcroft, linux-kernel, K. Y. Srinivasan, Mike Sterling

When we are hosted on a Hyper-V hypervisor the guest disks are exposed
both via the Hyper-V paravirtualised drivers and via an emulated SATA disk
controller.  We want to use the paravirtualised drivers where possible as
they are much more performant.  The Hyper-V paravirtualised drivers only
expose the virtual hard disk devices, the CDROM/DVD devices must still
be enumerated on the virtualised SATA controller.  As we have no control
over kernel probe order for these two drivers especially when one driver
is builtin to the kernel and the other a module, we need to prevent the
ata_piix driver from claiming the disks devices by default when running
on a Hyper-V hypervisor.

When enumerating the drives look at the aquired device ID and if it
appears to be a disk device then report it as disconnected.  Limit this
behaviour to when we have detected a Hyper-V hypervisor.  Finally allow
this behaviour to be overriden via a new module parameter.

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 |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

    This was discovered when doing some boot testing on a Hyper-V
    host.  Performance was found to be bad as out builtin ata_piix
    driver was grabbing the disks.  I am Cc:ing a couple of the
    Microsoft people who worked on the HV driver set as well.

    Note that the device id data is converted from device to host
    order in the caller which makes examining the data problematic.
    As this code only make sense on X86 and we know we are in
    matching order we can access the data without first fixing it.
    Alternativly we could add a new callback from the ata core
    after the code has been fixed for validation.

    Comments?

    -apw

diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 68013f9..64895f8 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"
@@ -188,6 +191,29 @@ static int piix_pci_device_resume(struct pci_dev *pdev);
 
 static unsigned int in_module_init = 1;
 
+static int prefer_ms_hyperv = 1;
+
+unsigned int ata_piix_read_id(struct ata_device *dev,
+					struct ata_taskfile *tf, u16 *id)
+{
+	int ret = ata_do_dev_read_id(dev, tf, id);
+
+#ifdef CONFIG_X86
+	/* XXX: note that the device id is in little-endian order, the caller
+	 * will shift it to host order, but we are working with little-endian.
+	 * As this is _only_ used on x86 we can actually directly access it
+	 * as host is also little-endian.
+	 */
+	if (!ret && prefer_ms_hyperv && x86_hyper == &x86_hyper_ms_hyperv &&
+							ata_id_is_ata(id)) {
+		ata_dev_printk(dev, KERN_WARNING, "ATA disk ignored deferring to Hyper-V paravirt driver\n");
+
+		return AC_ERR_DEV|AC_ERR_NODEV_HINT;
+	}
+#endif
+	return ret;
+}
+
 static const struct pci_device_id piix_pci_tbl[] = {
 	/* Intel PIIX3 for the 430HX etc */
 	{ 0x8086, 0x7010, PCI_ANY_ID, PCI_ANY_ID, 0, 0, piix_pata_mwdma },
@@ -359,6 +385,7 @@ static struct ata_port_operations piix_pata_ops = {
 	.set_piomode		= piix_set_piomode,
 	.set_dmamode		= piix_set_dmamode,
 	.prereset		= piix_pata_prereset,
+	.read_id		= ata_piix_read_id,
 };
 
 static struct ata_port_operations piix_vmw_ops = {
@@ -1703,3 +1730,5 @@ static void __exit piix_exit(void)
 
 module_init(piix_init);
 module_exit(piix_exit);
+
+module_param(prefer_ms_hyperv, int, 0);
-- 
1.7.9.1


^ permalink raw reply related	[flat|nested] 36+ messages in thread
* [ 00/91] 3.4.1-stable review
@ 2012-05-27  1:09 Greg KH
  2012-05-28 14:18 ` [ 00/91] 3.4.1-stable review Fw: [PATCH 1/2] libata: add a host flag to ignore detected ATA devices FW: use hv_storvsc instead of ata_piix to handle the IDE disks devices ( but not for the CD-ROM) Victor Miasnikov
  0 siblings, 1 reply; 36+ messages in thread
From: Greg KH @ 2012-05-27  1:09 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: torvalds, akpm, alan

Note, I've tested this release a bit differently than I have in the
past.  For this release, I've only tested it on one machine, my laptop,
with a pretty minimal configuration to save on build times.  That means,
while this release works for me, it might not for you, and it might not
even build at all for you.  Please test to verify that I haven't messed
anything up.  I'll give everyone at least an extra day than "normal" for
this review cycle before I cut a final 3.4.1 release.

--------------

This is the start of the stable review cycle for the 3.4.1 release.
There are 92 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Wed May 30 00:30:00 UTC 2012.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
	kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.4.1-rc1.gz
and the diffstat can be found below.

thanks,

greg k-h

-------------
 Documentation/HOWTO                       | 32 ++++++++--------
 Makefile                                  |  4 +-
 arch/arm/boot/dts/tegra-cardhu.dts        |  2 +-
 arch/arm/include/asm/cacheflush.h         |  2 +-
 arch/arm/kernel/traps.c                   |  4 +-
 arch/powerpc/kernel/idle.c                | 14 +++----
 arch/s390/mm/fault.c                      | 14 ++++++-
 arch/sparc/Kconfig                        |  3 ++
 arch/sparc/kernel/systbls_64.S            |  2 +-
 arch/tile/include/asm/bitops.h            | 12 +++---
 arch/um/include/asm/pgtable.h             | 10 ++++-
 arch/x86/Makefile                         |  1 +
 arch/x86/kernel/cpu/mcheck/mce-severity.c | 16 +++++---
 arch/x86/kernel/cpu/mcheck/mce.c          |  8 ++++
 arch/x86/kernel/cpu/perf_event_amd.c      | 11 +++++-
 arch/x86/pci/xen.c                        |  4 ++
 arch/x86/tools/relocs.c                   | 12 ++++++
 drivers/gpio/gpio-mpc8xxx.c               |  3 +-
 drivers/gpu/drm/gma500/psb_device.c       |  6 ++-
 drivers/gpu/drm/i915/i915_irq.c           |  9 ++---
 drivers/gpu/drm/i915/i915_reg.h           | 15 ++++++++
 drivers/gpu/drm/i915/intel_display.c      | 19 +++++++++-
 drivers/gpu/drm/nouveau/nouveau_bo.c      |  2 +-
 drivers/hid/hid-logitech-dj.c             |  5 ++-
 drivers/hid/hid-wiimote-core.c            | 16 +++-----
 drivers/hid/usbhid/hid-core.c             | 61 ++++++++++++++++++++++++++++---
 drivers/i2c/busses/i2c-davinci.c          |  2 +-
 drivers/i2c/busses/i2c-tegra.c            | 13 +++----
 drivers/infiniband/core/umem.c            |  2 +-
 drivers/infiniband/hw/cxgb4/cm.c          | 13 ++++---
 drivers/iommu/dmar.c                      |  4 +-
 drivers/iommu/intel-iommu.c               | 17 ++++++---
 drivers/isdn/gigaset/capi.c               | 26 ++++++-------
 drivers/isdn/gigaset/ev-layer.c           |  4 +-
 drivers/md/md.c                           |  2 +-
 drivers/media/dvb/siano/smsusb.c          |  2 +
 drivers/media/video/uvc/uvc_v4l2.c        |  2 +-
 drivers/mmc/core/cd-gpio.c                |  3 ++
 drivers/mmc/core/sdio.c                   |  2 +-
 drivers/mmc/core/sdio_irq.c               | 11 ++++--
 drivers/mmc/host/omap_hsmmc.c             |  2 +-
 drivers/net/wireless/b43legacy/main.c     |  2 -
 drivers/net/wireless/ipw2x00/ipw2200.c    | 21 +++--------
 drivers/net/wireless/iwlwifi/iwl-6000.c   |  4 +-
 drivers/regulator/core.c                  |  2 +
 drivers/scsi/isci/init.c                  |  2 +-
 drivers/scsi/mpt2sas/mpt2sas_base.c       |  6 +--
 drivers/spi/spi-fsl-spi.c                 |  2 +-
 drivers/staging/android/persistent_ram.c  | 19 +---------
 drivers/staging/comedi/comedi_fops.c      |  2 +-
 drivers/tty/hvc/hvc_xen.c                 |  4 +-
 drivers/tty/serial/8250/8250.c            |  9 +++--
 drivers/tty/serial/8250/8250_pci.c        | 18 +++++++++
 drivers/tty/serial/mxs-auart.c            |  2 +
 drivers/tty/serial/serial_core.c          |  1 +
 drivers/usb/class/cdc-wdm.c               | 31 +++++++++++-----
 drivers/usb/core/devio.c                  | 33 +++++++++++++----
 drivers/usb/core/hub.c                    |  4 ++
 drivers/usb/core/quirks.c                 |  3 ++
 drivers/usb/core/urb.c                    | 21 +++++++++++
 drivers/usb/gadget/fsl_udc_core.c         |  2 +
 drivers/usb/host/ehci-omap.c              | 18 ++++-----
 drivers/usb/host/ehci-pci.c               |  4 +-
 drivers/usb/host/ehci-platform.c          |  2 -
 drivers/usb/host/ohci-at91.c              | 11 +++++-
 drivers/usb/host/pci-quirks.c             | 32 +++++++++++++++-
 drivers/usb/host/xhci-hub.c               | 22 ++++++-----
 drivers/usb/host/xhci-mem.c               | 27 ++++++++++++++
 drivers/usb/host/xhci-pci.c               |  1 +
 drivers/usb/host/xhci-ring.c              | 22 +++++++++--
 drivers/usb/host/xhci.c                   | 12 +++++-
 drivers/usb/host/xhci.h                   |  3 ++
 drivers/usb/misc/usbtest.c                | 17 ++++++---
 drivers/usb/otg/gpio_vbus.c               |  8 ++--
 drivers/usb/serial/ftdi_sio.c             |  1 +
 drivers/usb/serial/ftdi_sio_ids.h         |  8 ++++
 drivers/usb/serial/ti_usb_3410_5052.c     |  6 ++-
 drivers/usb/serial/ti_usb_3410_5052.h     |  1 +
 drivers/usb/serial/usb-serial.c           |  9 ++++-
 drivers/usb/storage/unusual_devs.h        |  7 ++++
 drivers/video/sh_mobile_lcdcfb.c          |  5 ++-
 drivers/video/sh_mobile_lcdcfb.h          |  1 +
 drivers/xen/events.c                      |  5 ++-
 fs/aio.c                                  | 30 +++++++--------
 include/linux/mmc/host.h                  |  2 +
 include/linux/usb.h                       |  3 ++
 include/xen/events.h                      |  3 ++
 init/main.c                               |  7 ++--
 kernel/workqueue.c                        |  9 ++++-
 mm/mempolicy.c                            | 41 +++++++++------------
 net/wireless/reg.c                        | 10 +++++
 security/selinux/selinuxfs.c              |  1 +
 tools/usb/ffs-test.c                      |  2 +-
 93 files changed, 629 insertions(+), 281 deletions(-)


^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2012-06-05  4:59 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-29 17:28 [PATCH 1/1] ata_piix: defer disks to the Hyper-V paravirtualised drivers by default Andy Whitcroft
2012-03-30  9:14 ` Victor Miasnikov
2012-03-30  9:14   ` Victor Miasnikov
2012-04-10 16:08 ` KY Srinivasan
2012-04-12 15:55 ` Andy Whitcroft
2012-04-12 20:03 ` Jeff Garzik
2012-04-13  7:37   ` Andy Whitcroft
2012-04-14 15:53   ` [PATCH 0/2] Hyper-V disk support Andy Whitcroft
2012-04-14 15:53     ` [PATCH 1/2] libata: add a host flag to ignore detected ATA devices Andy Whitcroft
2012-04-14 15:53     ` [PATCH 2/2] ata_piix: defer disks to the Hyper-V drivers by default Andy Whitcroft
2012-04-14 16:02       ` Alan Cox
2012-04-15  0:10         ` KY Srinivasan
2012-04-16 11:20         ` [PATCH 0/2] Hyper-V disk support V3 Andy Whitcroft
2012-04-16 11:20           ` [PATCH 1/2] libata: add a host flag to ignore detected ATA devices Andy Whitcroft
2012-04-16 11:20           ` [PATCH 2/2] UBUNTU: SAUCE: ata_piix: defer disks to the Hyper-V drivers by default Andy Whitcroft
2012-04-16 11:28             ` Sergei Shtylyov
2012-04-16 11:26           ` [PATCH 0/2] Hyper-V disk support V3 Alan Cox
2012-04-16 18:29             ` Andy Whitcroft
2012-04-16 18:41               ` KY Srinivasan
2012-04-18 20:12                 ` Alan Cox
2012-04-18 20:21                   ` KY Srinivasan
2012-04-19  8:15                     ` 1) boot flag to disable the Hyper-V IDE drivers: ata_piix.prefer_ms_hyperv=0 2) PIIX_IGNORE_ATA_ON_HYPERV Re: [PATCH 0/2] Hyper-V disk support V3 RE: use hv_storvsc instead of ata_piix to handle the IDE disks devices ( but not for the CD-ROM) Victor Miasnikov
2012-04-19  8:15                       ` Victor Miasnikov
2012-04-19  7:40                   ` [PATCH 0/2] Hyper-V disk support V3 Andy Whitcroft
2012-04-19 13:17                     ` KY Srinivasan
2012-04-19 14:33                     ` [PATCH 0/2] Hyper-V disk support V4 Andy Whitcroft
2012-04-19 14:33                       ` [PATCH 1/2] libata: add a host flag to ignore detected ATA devices Andy Whitcroft
2012-04-19 14:33                       ` [PATCH 2/2] ata_piix: defer disks to the Hyper-V drivers by default Andy Whitcroft
2012-04-19 15:54                         ` Sergei Shtylyov
2012-05-04 21:15                           ` [PATCH 0/2] Hyper-V disk support V5 Andy Whitcroft
2012-05-04 21:15                             ` [PATCH 1/2] libata: add a host flag to ignore detected ATA devices Andy Whitcroft
2012-05-07 19:43                               ` Jeff Garzik
2012-05-04 21:15                             ` [PATCH 2/2] ata_piix: defer disks to the Hyper-V drivers by default Andy Whitcroft
2012-04-16 15:32           ` [PATCH 0/2] Hyper-V disk support V3 Jeff Garzik
2012-04-16 18:28             ` Andy Whitcroft
2012-05-27  1:09 [ 00/91] 3.4.1-stable review Greg KH
2012-05-28 14:18 ` [ 00/91] 3.4.1-stable review Fw: [PATCH 1/2] libata: add a host flag to ignore detected ATA devices FW: use hv_storvsc instead of ata_piix to handle the IDE disks devices ( but not for the CD-ROM) Victor Miasnikov
2012-05-28 20:35   ` Greg KH
2012-05-29  6:34     ` Linux on Hyper-V 1) cd006086fa5d ata_piix: defer disks to the Hyper-V drivers by default 2) db63a4c8115a libata: add a host flag to ignore detected ATA device " Victor Miasnikov
2012-06-01  9:20       ` Greg KH
2012-06-01 16:17         ` Linux on Hyper-V 1) cd006086fa5d ata_piix: defer disks to the Hyper-V drivers by default 2) db63a4c8115a libata: add a host flag to ignore detected ATA device FW: use hv_storvsc instead of ata_piix to handle the IDE disks devices ( but not for the CD-R Victor Miasnikov
2012-06-01 16:26           ` Greg KH
2012-06-01 19:23             ` Linux on Hyper-V 1) cd006086fa5d ata_piix: defer disks to the Hyper-V drivers by default 2) db63a4c8115a libata: add a host flag to ignore detected ATA device FW: use hv_storvsc instead of ata_piix to handle the IDE disks devices ( but not for the KY Srinivasan
2012-06-02  1:22               ` Greg KH
2012-06-04 12:33                 ` Victor Miasnikov
2012-06-05  4:59                   ` [PATCH 2/2] ata_piix: defer disks to the Hyper-V drivers by default Jonathan Nieder

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.