Yosuke Iwamatsu
2008-Feb-21 11:01 UTC
[Xen-devel] [PATCH 1/3][RFC] PV Passthrough PCI Device Hotplug Support (Tools Part)
Tools part of PV PCI hotplug, applied to xen-unstable.hg cs17042. Most of this part will be changed to adjust latest xen-unstable, since there already exists HVM PCI hotplug code. Thanks, ------------------- Yosuke Iwamatsu NEC Corporation _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2008-Feb-22 10:04 UTC
Re: [Xen-devel] [PATCH 1/3][RFC] PV Passthrough PCI Device Hotplug Support (Tools Part)
On 21/2/08 11:01, "Yosuke Iwamatsu" <y-iwamatsu@ab.jp.nec.com> wrote:> Tools part of PV PCI hotplug, applied to xen-unstable.hg cs17042. > > Most of this part will be changed to adjust latest xen-unstable, > since there already exists HVM PCI hotplug code.I applied the other two patches (the Xen and Linux pieces) so please just re-submit this one. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Yosuke Iwamatsu
2008-Feb-22 10:19 UTC
Re: [Xen-devel] [PATCH 1/3][RFC] PV Passthrough PCI Device Hotplug Support (Tools Part)
Keir Fraser wrote:> On 21/2/08 11:01, "Yosuke Iwamatsu" <y-iwamatsu@ab.jp.nec.com> wrote: > >> Tools part of PV PCI hotplug, applied to xen-unstable.hg cs17042. >> >> Most of this part will be changed to adjust latest xen-unstable, >> since there already exists HVM PCI hotplug code. > > I applied the other two patches (the Xen and Linux pieces) so please just > re-submit this one.Thanks! Now I''m going to look into xend and see how I can get along with the existing HVM pcihp code. -- Yosuke _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Yosuke Iwamatsu
2008-Mar-10 01:19 UTC
[Xen-devel] [PATCH] PV Passthrough PCI Device Hotplug Support (Tools Part)
Hi, This is the updated patch of PV PCI passthrough hotplug (tools portion). Changes to xm command: - Let ''xm pci-attach'' command use <domain:bus:slot.func> expression rather than use separated arguments like <domain> <bus> <slot> <func>. This is the same expression of the domain configuration file and I believe it is more user-friendly. - Let ''xm pci-detach'' command use the same <domain:bus:slot.func> expression. Formerly, <virtual slot> was used as the key to indicate which device we were detaching. But for the current implementation of PV PCI hotplug, virtual slots don''t have much meaning. I think using the same physical device name in both attachment and detachment is appropriate here. Changes to xend: - Both attach and detach commands are received by device_configure() and handled by pci_device_configure(). - HVM specific processings are done in hvm_pci_create_device() and hvm_destroyPCIDevice(). The major problem I encoutered during this work is that, I don''t have a vt-d enabled machine and could not confirm that HVM PCI hotplug would still work after modifications :-( Then I hacked libxc a little to pretend as if there existed a vt-d hardware, and could see HVM PCI attach/detach working correctly. So now I''m pretty sure that we can do both PV and HVM hotplugs with this patch, but I would appreciate it if someone could test this on a real vt-d machine. Regards, ------------------- Yosuke Iwamatsu NEC Corporation _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Masaki Kanno
2008-Mar-10 02:04 UTC
Re: [Xen-devel] [PATCH] PV Passthrough PCI Device Hotplug Support(Tools Part)
Hi Iwamatsu, def xm_pci_detach(args): - arg_check(args, ''pci-detach'', 2) - dom = args[0] - dev = args[1] - server.xend.domain.destroyDevice(dom, ''dpci'', dev) + arg_check(args, ''pci-detach'', 2, 2) <----------------- here!! + (dom, pci) = parse_pci_configuration(args, ''Closing'') + server.xend.domain.device_configure(dom, pci) + The last "2" is not necessary. With your patch, the following strange error message is shown. # xm pci-detach Error: ''xm pci-detach'' requires between 2 and 2 arguments. ^^^^^^^^^^^^^^^ Usage: xm pci-detach <Domain> <virtual slot> Remove a domain''s pass-through pci device. Best regards, Kan Mon, 10 Mar 2008 10:19:10 +0900, Yosuke Iwamatsu wrote:>Hi, > >This is the updated patch of PV PCI passthrough hotplug (tools portion). > >Changes to xm command: >- Let ''xm pci-attach'' command use <domain:bus:slot.func> expression > rather than use separated arguments like <domain> <bus> <slot> <func>. > This is the same expression of the domain configuration file and I > believe it is more user-friendly. >- Let ''xm pci-detach'' command use the same <domain:bus:slot.func> > expression. Formerly, <virtual slot> was used as the key to indicate > which device we were detaching. But for the current implementation of > PV PCI hotplug, virtual slots don''t have much meaning. I think using > the same physical device name in both attachment and detachment is > appropriate here. > >Changes to xend: >- Both attach and detach commands are received by device_configure() > and handled by pci_device_configure(). >- HVM specific processings are done in hvm_pci_create_device() and > hvm_destroyPCIDevice(). > >The major problem I encoutered during this work is that, I don''t have >a vt-d enabled machine and could not confirm that HVM PCI hotplug would >still work after modifications :-( >Then I hacked libxc a little to pretend as if there existed a vt-d >hardware, and could see HVM PCI attach/detach working correctly. >So now I''m pretty sure that we can do both PV and HVM hotplugs with >this patch, but I would appreciate it if someone could test this on >a real vt-d machine. > >Regards, >------------------- >Yosuke Iwamatsu > NEC Corporation >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Yosuke Iwamatsu
2008-Mar-10 02:26 UTC
Re: [Xen-devel] [PATCH] PV Passthrough PCI Device Hotplug Support(Tools Part)
Masaki Kanno wrote:> Hi Iwamatsu, > > def xm_pci_detach(args): > - arg_check(args, ''pci-detach'', 2) > - dom = args[0] > - dev = args[1] > - server.xend.domain.destroyDevice(dom, ''dpci'', dev) > + arg_check(args, ''pci-detach'', 2, 2) <----------------- here!! > + (dom, pci) = parse_pci_configuration(args, ''Closing'') > + server.xend.domain.device_configure(dom, pci) > + > > The last "2" is not necessary.All right. The revised patch is attached. -- Yosuke _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Zhai, Edwin
2008-Mar-10 07:17 UTC
[Xen-devel] Re: [PATCH] PV Passthrough PCI Device Hotplug Support (Tools Part)
Yosuke, Thanks for you work. I have tested your patch works on HVM VT-d side. One suggestion is error handling for user input. e.g. following input error should be caught by xm: [root@vt-gang32 ~]# xm pci-attach EdwinHVMDomainVtd2 0:2.0.0 (should be 0:2:0.0) Error: pci: failed to locate device and parse it''s resources - [Errno 2] No such file or directory: ''/sys/bus/pci/devices/0000:00:02.0/driver'' Usage: xm pci-attach <Domain> <domain:bus:slot.func> [virtual slot] On Mon, Mar 10, 2008 at 10:19:10AM +0900, Yosuke Iwamatsu wrote:> Hi, > > This is the updated patch of PV PCI passthrough hotplug (tools portion). > > Changes to xm command: > - Let ''xm pci-attach'' command use <domain:bus:slot.func> expression > rather than use separated arguments like <domain> <bus> <slot> <func>. > This is the same expression of the domain configuration file and I > believe it is more user-friendly. > - Let ''xm pci-detach'' command use the same <domain:bus:slot.func> > expression. Formerly, <virtual slot> was used as the key to indicate > which device we were detaching. But for the current implementation of > PV PCI hotplug, virtual slots don''t have much meaning. I think using > the same physical device name in both attachment and detachment is > appropriate here. > > Changes to xend: > - Both attach and detach commands are received by device_configure() > and handled by pci_device_configure(). > - HVM specific processings are done in hvm_pci_create_device() and > hvm_destroyPCIDevice(). > > The major problem I encoutered during this work is that, I don''t have > a vt-d enabled machine and could not confirm that HVM PCI hotplug would > still work after modifications :-( > Then I hacked libxc a little to pretend as if there existed a vt-d > hardware, and could see HVM PCI attach/detach working correctly. > So now I''m pretty sure that we can do both PV and HVM hotplugs with > this patch, but I would appreciate it if someone could test this on > a real vt-d machine. > > Regards, > ------------------- > Yosuke Iwamatsu > NEC Corporation >-- best rgds, edwin _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Yosuke Iwamatsu
2008-Mar-10 11:22 UTC
[Xen-devel] Re: [PATCH] PV Passthrough PCI Device Hotplug Support (Tools Part)
Zhai, Edwin wrote:> Yosuke, > > Thanks for you work. > I have tested your patch works on HVM VT-d side.I''m relieved to hear that. Thank you.> > One suggestion is error handling for user input. e.g. following input error > should be caught by xm: > > [root@vt-gang32 ~]# xm pci-attach EdwinHVMDomainVtd2 0:2.0.0 (should be > 0:2:0.0) > > Error: pci: failed to locate device and parse it''s resources - [Errno 2] No such > file or directory: ''/sys/bus/pci/devices/0000:00:02.0/driver'' > Usage: xm pci-attach <Domain> <domain:bus:slot.func> [virtual slot]Okay. The small patch below should fix the issue. (applied after the previous patch) Thanks, Yosuke Iwamatsu --------- xm: Fix parsing pci device name. Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com> diff -r 9233270dfe6a tools/python/xen/xm/main.py --- a/tools/python/xen/xm/main.py Mon Mar 10 17:58:25 2008 +0900 +++ b/tools/python/xen/xm/main.py Mon Mar 10 20:26:49 2008 +0900 @@ -2240,7 +2240,7 @@ def parse_pci_configuration(args, state) pci_match = re.match(r"((?P<domain>[0-9a-fA-F]{1,4})[:,])?" + \ r"(?P<bus>[0-9a-fA-F]{1,2})[:,]" + \ r"(?P<slot>[0-9a-fA-F]{1,2})[.,]" + \ - r"(?P<func>[0-9a-fA-F])", pci_dev_str) + r"(?P<func>[0-7])$", pci_dev_str) if pci_match == None: raise OptionError("Invalid argument: %s %s" % (pci_dev_str,vslt)) pci_dev_info = pci_match.groupdict(''0'') _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel