Bug 698732 - add xen-emul-unplug support to rhel5
Summary: add xen-emul-unplug support to rhel5
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel-xen
Version: 5.7
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Don Dutile (Red Hat)
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 460821
Blocks: 514490
TreeView+ depends on / blocked
 
Reported: 2011-04-21 16:05 UTC by Laszlo Ersek
Modified: 2011-11-02 14:36 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 460821
Environment:
Last Closed: 2011-11-02 14:36:05 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
#1 Backport xen-emul-unplug support from upstream (16.37 KB, patch)
2011-04-21 16:09 UTC, Laszlo Ersek
no flags Details | Diff
#2 add XEN defines to pci IDs (657 bytes, patch)
2011-04-21 16:10 UTC, Laszlo Ersek
no flags Details | Diff
#3 skip xen-vnif registration if 8139 registered with same MAC address (4.92 KB, patch)
2011-04-21 16:11 UTC, Laszlo Ersek
no flags Details | Diff
#4 netfront: add xennet to module alias (705 bytes, patch)
2011-04-21 16:12 UTC, Laszlo Ersek
no flags Details | Diff

Comment 1 Laszlo Ersek 2011-04-21 16:09:18 UTC
Created attachment 493909 [details]
#1 Backport xen-emul-unplug support from upstream

Comment 2 Laszlo Ersek 2011-04-21 16:10:01 UTC
Created attachment 493910 [details]
#2 add XEN defines to pci IDs

Comment 3 Laszlo Ersek 2011-04-21 16:11:22 UTC
Created attachment 493911 [details]
#3 skip xen-vnif registration if 8139 registered with same MAC address

Comment 4 Laszlo Ersek 2011-04-21 16:12:15 UTC
Created attachment 493912 [details]
#4 netfront: add xennet to module alias

Comment 5 Yufang Zhang 2011-04-22 07:10:21 UTC
Happily to see this feature get into rhel5.

Comment 6 Laszlo Ersek 2011-06-10 11:25:22 UTC
sanity testing hints from Don:

(a) PV guests are not affected
(b) ide=disable doesn't affect the above xen pv connections
(c) attach/dettach of blk & net devices still works
(d) device assignment/pci-passthrough still works
(e) mutiple ide devices assigned to a guest get multiple xvd's connected to those block backends
(f) HVM guests that were re-built & configured to use pv-on-hvm still work
    (1) guest xml's spec xvda & vnif for block & net
    (2) guest has ide=disable set
    (3) (new) initrd (due to kernel update) still works
      i.e., regression testing for existing xen hvm guests using pv-on-hvm

Comment 7 Laszlo Ersek 2011-06-20 10:14:24 UTC
What about the following case:

Suppose the sysadmin originally configured two disk devices for an HVM domain:
- "tap:aio:/image/file,xvda,w" as hard disk (PV-on-HVM driver for performance),
- "file:/another/image/file.iso,hdc:cdrom,r" as CD-ROM (paravirt CD-ROM is not
  supported)

1. The sysadmin doesn't change the VM config file

  1.1. #ifdef avoid_rhel5_regression (though this macro is not defined by the
       patch)
    - xen_unplug_emulated_devices() will unplug the CD-ROM, and set
      XEN_UNPLUG_ALL_IDE_DISKS in "xen_platform_pci_unplug"
    - blkfront will refuse to drive the CD-ROM
    - the guest loses the CD-ROM

  1.2. #ifndef avoid_rhel5_regression (currently)
    - xen_unplug_emulated_devices() will unplug the CD-ROM
    - blkfront will try to drive th CD-ROM and probably break
    - the guest loses the CD-ROM in addition

2. The sysadmin decides to add "xen_emul_unplug=never" (either to keep his
   CD-ROM, or just so)
  - xen_unplug_emulated_devices() will return early and leave
    "xen_platform_pci_unplug" initialized to 0
  - boot_wait_for_devices() won't call wait_for_devices()
  - the kernel might try to mount the root fs on /dev/xvda1 before blkfront
    initializes xvda fully.

Additionally, the added "xen_ide_unplug_unsupported" variable is never read.

I believe the patch needs further work.

Comment 8 Paolo Bonzini 2011-06-30 11:56:49 UTC
xen_unplug_emulated_devices() will not unplug the CD-ROM:

    static void _ide_unplug_harddisks(int start)
    {
        IDEState *s;
        int i, j;
    
        if (!principal_ide_controller) {
            fprintf(stderr, "No principal controller?\n");
            return;
        }
        /* wait for outstanding aio requests */
        qemu_aio_flush();
        for (i = start; i < 4; i++) {
            s = principal_ide_controller->ide_if + i;
            if (!s->bs)
                continue; /* drive not present */
            if (s->is_cdrom)
                continue; /* cdrom */
            bdrv_close(s->bs);
            s->bs = NULL;
            ide_reset(s);
        }
    }

Comment 9 Don Dutile (Red Hat) 2011-06-30 18:57:13 UTC
wrt c#8: 
Paolo,  I forgot about that skip-cdrom-unplug check, so you are correct.
So what I believe that means is that you can't connect to the cdrom via pv-block driver, but the cdrom can be connected via the emulated ide.

So, the patch set would be an improvement, since ide=disable would prevent cdrom use, where the xen_unplug=all would enable cdrom use if ide=disable is removed from the kernel cmdline.

Comment 10 Miroslav Rezanina 2011-11-02 14:36:05 UTC
Closing as wontfix for risks introduces by this patch.


Note You need to log in before you can comment on or make changes to this bug.