Skip to contentSkip to conversation

Fix xm pci-detach for inactive devices

PATCH In review Simon Horman 3 participants 5 messages May 26, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix xm pci-detach for inactive devices

In the case where a device is attached to an inactive domain and then removed before the domain is activated it won't have a vslot assigned, but it should still be valid to remove it.

I don't think that there are any other cases where vslot can be invalid.

Lightly tested

Cc Zhai Edwin <[email protected]>
Cc Masaki Kanno <[email protected]>
tools/python/xen/xend/XendDomainInfo.py +0 -3
Index: xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py
===================================================================
@@ -1130,9 +1130,6 @@ class XendDomainInfo:
         if devnum >= pci_len:
             raise VmError("Device @ vslot 0x%x doesn't exist." % (vslot))
 
-        if vslot == AUTO_PHP_SLOT:
-            raise VmError("Device @ vslot 0x%x doesn't support hotplug." % (vslot))
-
         # Check the co-assignment.
         # To pci-detach a device D from domN, we should ensure: for each DD in the
         # list of D's co-assignment devices, DD is not assigned (to domN).
Acked-by on v1 1/1
#1 lore raw

Hi Simon,

I agree to your thought.

Best regards,
Kan

Quoted 9 lines · Simon Horman

In the case where a device is attached to an inactive domain and then removed before the domain is activated it won't have a vslot assigned, but it should still be valid to remove it.

I don't think that there are any other cases where vslot can be invalid.

Lightly tested

Quoted 7 lines
Cc Zhai Edwin <[email protected]>
Cc Masaki Kanno <[email protected]>

Index: xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-unstable.hg.orig/tools/python/xen/xend/XendDomainInfo.py 2009-05

-26

Quoted 20 lines

14:37:15.000000000 +1000
+++ xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py 2009-05-26 14:
37:18.000000000 +1000

tools/python/xen/xend/XendDomainInfo.py +0 -3
@@ -1130,9 +1130,6 @@ class XendDomainInfo:
        if devnum >= pci_len:
            raise VmError("Device @ vslot 0x%x doesn't exist." % (vslot))
 
-        if vslot == AUTO_PHP_SLOT:
-            raise VmError("Device @ vslot 0x%x doesn't support hotplug." %
 (vslot))
-
        # Check the co-assignment.
        # To pci-detach a device D from domN, we should ensure: for each 

DD in the

        # list of D's co-assignment devices, DD is not assigned (to domN).

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw
In reply to Simon Horman

Simon,
What does inactive domain means?
How does it lead an invalid vslot?

Quoted 29 lines · Simon Horman

In the case where a device is attached to an inactive domain and then removed before the domain is activated it won't have a vslot assigned, but it should still be valid to remove it.

I don't think that there are any other cases where vslot can be invalid.

Lightly tested

Cc Zhai Edwin <[email protected]>
Cc Masaki Kanno <[email protected]>

Index: xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py
===================================================================

tools/python/xen/xend/XendDomainInfo.py +0 -3
@@ -1130,9 +1130,6 @@ class XendDomainInfo:
         if devnum >= pci_len:
             raise VmError("Device @ vslot 0x%x doesn't exist." % (vslot))
 
-        if vslot == AUTO_PHP_SLOT:
-            raise VmError("Device @ vslot 0x%x doesn't support hotplug." % (vslot))
-
         # Check the co-assignment.
         # To pci-detach a device D from domN, we should ensure: for each DD in the
         # list of D's co-assignment devices, DD is not assigned (to domN).
Signature · 2 lines
best rgds,
edwin
#3 lore raw
Quoted 3 lines · Edwin

Simon,
What does inactive domain means?
How does it lead an invalid vslot?

Hi Edwin,

An inactive domain means one that has been created but is stopped. An invalid vslot can occur in this case if the vslot is to be automatically assigned by qemu-dm. This is because the request will not be sent to qemu-dm until the domain is started.

e.g.:

$ xm new hvm.conf
$ xm pci-attach hvm 00:1d.0
$ xm pci-list hvm
-    0x0      0x00  0x1d   0x0   <- '-' means the vslot has not been determined
$ xm pci-detach hvm 00:1d.0      <- will fail without this change

Or alternatively:

$ xm new hvm.conf
$ xm pci-attach hvm 00:1d.0
$ xm pci-list hvm
-    0x0      0x00  0x1d   0x0   <- '-' means the vslot has not been determined
$ xm start hvm
$ xm pci-list hvm
0x7  0x0      0x00  0x1d   0x0   <- vslot 0x7 was allocated after the
                                    domain started
$ xm pci-detach hvm 00:1d.0      <- will work with or without this patch

Attaching devices to inactive domains was recently fixed (added?) by Kanno-san.

Quoted 33 lines
Quoted 28 lines · Simon Horman

In the case where a device is attached to an inactive domain and then removed before the domain is activated it won't have a vslot assigned, but it should still be valid to remove it.

I don't think that there are any other cases where vslot can be invalid.

Lightly tested

Cc Zhai Edwin <[email protected]>
Cc Masaki Kanno <[email protected]>

Index: xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py
===================================================================

tools/python/xen/xend/XendDomainInfo.py +0 -2
@@ -1130,9 +1130,6 @@ class XendDomainInfo:
         if devnum >= pci_len:
             raise VmError("Device @ vslot 0x%x doesn't exist." % (vslot))
 -        if vslot == AUTO_PHP_SLOT:
-            raise VmError("Device @ vslot 0x%x doesn't support hotplug." % (vslot))
-
         # Check the co-assignment.
         # To pci-detach a device D from domN, we should ensure: for each DD in the
         # list of D's co-assignment devices, DD is not assigned (to domN).
Signature · 2 lines
best rgds,
edwin
#4 lore raw

I see.
Looks fine for me.

Thanks,

Quoted 76 lines · Simon Horman
Quoted 4 lines · Edwin

Simon,
What does inactive domain means?
How does it lead an invalid vslot?

Hi Edwin,

An inactive domain means one that has been created but is stopped. An invalid vslot can occur in this case if the vslot is to be automatically assigned by qemu-dm. This is because the request will not be sent to qemu-dm until the domain is started.

e.g.:

$ xm new hvm.conf
$ xm pci-attach hvm 00:1d.0
$ xm pci-list hvm
-    0x0      0x00  0x1d   0x0   <- '-' means the vslot has not been determined
$ xm pci-detach hvm 00:1d.0      <- will fail without this change

Or alternatively:

$ xm new hvm.conf
$ xm pci-attach hvm 00:1d.0
$ xm pci-list hvm
-    0x0      0x00  0x1d   0x0   <- '-' means the vslot has not been determined
$ xm start hvm
$ xm pci-list hvm
0x7  0x0      0x00  0x1d   0x0   <- vslot 0x7 was allocated after the
                                    domain started
$ xm pci-detach hvm 00:1d.0      <- will work with or without this patch

Attaching devices to inactive domains was recently fixed (added?) by Kanno-san.

Quoted 35 lines
Quoted 29 lines · Simon Horman

In the case where a device is attached to an inactive domain and then removed before the domain is activated it won't have a vslot assigned, but it should still be valid to remove it.

I don't think that there are any other cases where vslot can be invalid.

Lightly tested

Cc Zhai Edwin <[email protected]>
Cc Masaki Kanno <[email protected]>

Index: xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py
===================================================================

tools/python/xen/xend/XendDomainInfo.py +0 -2
@@ -1130,9 +1130,6 @@ class XendDomainInfo:
         if devnum >= pci_len:
             raise VmError("Device @ vslot 0x%x doesn't exist." % (vslot))
 -        if vslot == AUTO_PHP_SLOT:
-            raise VmError("Device @ vslot 0x%x doesn't support hotplug." % (vslot))
-
         # Check the co-assignment.
         # To pci-detach a device D from domN, we should ensure: for each DD in the
         # list of D's co-assignment devices, DD is not assigned (to domN).
Signature · 2 lines
best rgds,
edwin
Signature · 2 lines
best rgds,
edwin