diff mbox

[XEN,RFC,V2,12/17] xl: Add interface to handle qemu disaggregation

Message ID 51efcbff92f713286b5839884769ef34ab0c39f7.1345552068.git.julien.grall@citrix.com
State New
Headers show

Commit Message

Julien Grall Aug. 22, 2012, 12:31 p.m. UTC
This patch modifies libxl interface for qemu disaggregation.
For the moment, due to some dependencies between devices, we
can't let the user choose which QEMU emulate a device.

Moreoever this patch adds an "id" field to nic interface.
It will be used in config file to specify which QEMU handle
the network card.

A possible disaggregation is:
    - UI: Emulate graphic card, USB, keyboard, mouse, default devices
    (PIIX4, root bridge, ...)
    - IDE: Emulate disk
    - Serial: Emulate serial port
    - Audio: Emulate audio card
    - Net: Emulate one or more network cards, multiple QEMU can emulate
    different card. The emulated card is specified with its nic ID.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
---
 tools/libxl/libxl.h         |    3 +++
 tools/libxl/libxl_types.idl |   15 +++++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

Comments

Ian Campbell Aug. 23, 2012, 1:30 p.m. UTC | #1
On Wed, 2012-08-22 at 13:31 +0100, Julien Grall wrote:
> This patch modifies libxl interface for qemu disaggregation.

I'd rather see the interfaces changes in the same patch as the
implementation of the new interfaces.

> For the moment, due to some dependencies between devices, we
> can't let the user choose which QEMU emulate a device.
> 
> Moreoever this patch adds an "id" field to nic interface.
> It will be used in config file to specify which QEMU handle
> the network card.

Is domid+devid not sufficient to identify which nic?

> A possible disaggregation is:
>     - UI: Emulate graphic card, USB, keyboard, mouse, default devices
>     (PIIX4, root bridge, ...)
>     - IDE: Emulate disk
>     - Serial: Emulate serial port
>     - Audio: Emulate audio card
>     - Net: Emulate one or more network cards, multiple QEMU can emulate
>     different card. The emulated card is specified with its nic ID.
> 
> Signed-off-by: Julien Grall <julien.grall@citrix.com>
> ---
>  tools/libxl/libxl.h         |    3 +++
>  tools/libxl/libxl_types.idl |   15 +++++++++++++++
>  2 files changed, 18 insertions(+), 0 deletions(-)
> 
> diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
> index c614d6f..71d4808 100644
> --- a/tools/libxl/libxl.h
> +++ b/tools/libxl/libxl.h
> @@ -307,6 +307,7 @@ void libxl_cpuid_dispose(libxl_cpuid_policy_list *cpuid_list);
>  #define LIBXL_PCI_FUNC_ALL (~0U)
>  
>  typedef uint32_t libxl_domid;
> +typedef uint32_t libxl_dmid;
>  
>  /*
>   * Formatting Enumerations.
> @@ -478,12 +479,14 @@ typedef struct {
>      libxl_domain_build_info b_info;
>  
>      int num_disks, num_nics, num_pcidevs, num_vfbs, num_vkbs;
> +    int num_dms;
>  
>      libxl_device_disk *disks;
>      libxl_device_nic *nics;
>      libxl_device_pci *pcidevs;
>      libxl_device_vfb *vfbs;
>      libxl_device_vkb *vkbs;
> +    libxl_dm *dms;
>  
>      libxl_action_on_shutdown on_poweroff;
>      libxl_action_on_shutdown on_reboot;
> diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
> index daa8c79..36c802a 100644
> --- a/tools/libxl/libxl_types.idl
> +++ b/tools/libxl/libxl_types.idl
> @@ -246,6 +246,20 @@ libxl_domain_sched_params = Struct("domain_sched_params",[
>      ("extratime",    integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT'}),
>      ])
>  
> +libxl_dm_cap = Enumeration("dm_cap", [
> +    (1, "UI"), # Emulate all UI + default device

What does "default device" equate too?

> +    (2, "IDE"), # Emulate IDE
> +    (4, "SERIAL"), # Emulate Serial
> +    (8, "AUDIO"), # Emulate audio
> +    ])
> +
> +libxl_dm = Struct("dm", [
> +    ("name",         string),
> +    ("path",         string),
> +    ("capabilities",   uint64),

uint64 and not libxl_dm_cap?

> +    ("vifs",         libxl_string_list),
> +    ])
> +
>  libxl_domain_build_info = Struct("domain_build_info",[
>      ("max_vcpus",       integer),
>      ("avail_vcpus",     libxl_bitmap),
> @@ -367,6 +381,7 @@ libxl_device_nic = Struct("device_nic", [
>      ("nictype", libxl_nic_type),
>      ("rate_bytes_per_interval", uint64),
>      ("rate_interval_usecs", uint32),
> +    ("id", string),
>      ])
>  
>  libxl_device_pci = Struct("device_pci", [
Julien Grall Aug. 24, 2012, 12:56 p.m. UTC | #2
On 08/23/2012 02:30 PM, Ian Campbell wrote:
> On Wed, 2012-08-22 at 13:31 +0100, Julien Grall wrote:
>    
>> This patch modifies libxl interface for qemu disaggregation.
>>      
> I'd rather see the interfaces changes in the same patch as the
> implementation of the new interfaces.
>
>    
>> For the moment, due to some dependencies between devices, we
>> can't let the user choose which QEMU emulate a device.
>>
>> Moreoever this patch adds an "id" field to nic interface.
>> It will be used in config file to specify which QEMU handle
>> the network card.
>>      
> Is domid+devid not sufficient to identify which nic?
>    
Is the user can specify or find devid easily ?
I added "id" because, I would like that the user
can identify without any problem a network
interface.

>> A possible disaggregation is:
>>      - UI: Emulate graphic card, USB, keyboard, mouse, default devices
>>      (PIIX4, root bridge, ...)
>>      - IDE: Emulate disk
>>      - Serial: Emulate serial port
>>      - Audio: Emulate audio card
>>      - Net: Emulate one or more network cards, multiple QEMU can emulate
>>      different card. The emulated card is specified with its nic ID.
>>
>> Signed-off-by: Julien Grall<julien.grall@citrix.com>
>> ---
>>   tools/libxl/libxl.h         |    3 +++
>>   tools/libxl/libxl_types.idl |   15 +++++++++++++++
>>   2 files changed, 18 insertions(+), 0 deletions(-)
>>
>> diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
>> index c614d6f..71d4808 100644
>> --- a/tools/libxl/libxl.h
>> +++ b/tools/libxl/libxl.h
>> @@ -307,6 +307,7 @@ void libxl_cpuid_dispose(libxl_cpuid_policy_list *cpuid_list);
>>   #define LIBXL_PCI_FUNC_ALL (~0U)
>>
>>   typedef uint32_t libxl_domid;
>> +typedef uint32_t libxl_dmid;
>>
>>   /*
>>    * Formatting Enumerations.
>> @@ -478,12 +479,14 @@ typedef struct {
>>       libxl_domain_build_info b_info;
>>
>>       int num_disks, num_nics, num_pcidevs, num_vfbs, num_vkbs;
>> +    int num_dms;
>>
>>       libxl_device_disk *disks;
>>       libxl_device_nic *nics;
>>       libxl_device_pci *pcidevs;
>>       libxl_device_vfb *vfbs;
>>       libxl_device_vkb *vkbs;
>> +    libxl_dm *dms;
>>
>>       libxl_action_on_shutdown on_poweroff;
>>       libxl_action_on_shutdown on_reboot;
>> diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
>> index daa8c79..36c802a 100644
>> --- a/tools/libxl/libxl_types.idl
>> +++ b/tools/libxl/libxl_types.idl
>> @@ -246,6 +246,20 @@ libxl_domain_sched_params = Struct("domain_sched_params",[
>>       ("extratime",    integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT'}),
>>       ])
>>
>> +libxl_dm_cap = Enumeration("dm_cap", [
>> +    (1, "UI"), # Emulate all UI + default device
>>      
> What does "default device" equate too?
>    
The following devices:
    - i440fx
    - piix3
    - piix4
    - dma
    - xen apic
    - xen platform


>> +    (2, "IDE"), # Emulate IDE
>> +    (4, "SERIAL"), # Emulate Serial
>> +    (8, "AUDIO"), # Emulate audio
>> +    ])
>> +
>> +libxl_dm = Struct("dm", [
>> +    ("name",         string),
>> +    ("path",         string),
>> +    ("capabilities",   uint64),
>>      
> uint64 and not libxl_dm_cap?
>    
Will be fixed in the next patch version.
Ian Campbell Aug. 24, 2012, 1:03 p.m. UTC | #3
On Fri, 2012-08-24 at 13:56 +0100, Julien Grall wrote:
> On 08/23/2012 02:30 PM, Ian Campbell wrote:
> > On Wed, 2012-08-22 at 13:31 +0100, Julien Grall wrote:
> >    
> >> This patch modifies libxl interface for qemu disaggregation.
> >>      
> > I'd rather see the interfaces changes in the same patch as the
> > implementation of the new interfaces.
> >
> >    
> >> For the moment, due to some dependencies between devices, we
> >> can't let the user choose which QEMU emulate a device.
> >>
> >> Moreoever this patch adds an "id" field to nic interface.
> >> It will be used in config file to specify which QEMU handle
> >> the network card.
> >>      
> > Is domid+devid not sufficient to identify which nic?
> >    
> Is the user can specify or find devid easily ?
> I added "id" because, I would like that the user
> can identify without any problem a network
> interface.

At the libxl level the libxl_device_nic struct has a devid in it.

That's not to say that xl can't add a layer of naming and indirection on
top.

> >> @@ -246,6 +246,20 @@ libxl_domain_sched_params = Struct("domain_sched_params",[
> >>       ("extratime",    integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT'}),
> >>       ])
> >>
> >> +libxl_dm_cap = Enumeration("dm_cap", [
> >> +    (1, "UI"), # Emulate all UI + default device
> >>      
> > What does "default device" equate too?
> >    
> The following devices:
>     - i440fx
>     - piix3
>     - piix4
>     - dma
>     - xen apic
>     - xen platform

So this is more like "CORE" than "UI"?

Is there a reason why UI (which I guess means the VGA, spice and VFB
devices?) are required to be in the same emulator as these?

> >> +    (2, "IDE"), # Emulate IDE
> >> +    (4, "SERIAL"), # Emulate Serial
> >> +    (8, "AUDIO"), # Emulate audio
> >> +    ])
> >> +
Julien Grall Aug. 24, 2012, 1:23 p.m. UTC | #4
On 08/24/2012 02:03 PM, Ian Campbell wrote:
>
>>>> @@ -246,6 +246,20 @@ libxl_domain_sched_params = Struct("domain_sched_params",[
>>>>        ("extratime",    integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT'}),
>>>>        ])
>>>>
>>>> +libxl_dm_cap = Enumeration("dm_cap", [
>>>> +    (1, "UI"), # Emulate all UI + default device
>>>>
>>>>          
>>> What does "default device" equate too?
>>>
>>>        
>> The following devices:
>>      - i440fx
>>      - piix3
>>      - piix4
>>      - dma
>>      - xen apic
>>      - xen platform
>>      
> So this is more like "CORE" than "UI"?
>
> Is there a reason why UI (which I guess means the VGA, spice and VFB
> devices?) are required to be in the same emulator as these?
>
>    

VGA, keyboard and mouse (that can be plug via USB) need
to be in the same emulator. Otherwise we can't use VNC or
something like that.

I made this choice, after discussion with Stefano, because
theses devices depends each others. For instance, keyboard
emulates A20.
diff mbox

Patch

diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index c614d6f..71d4808 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -307,6 +307,7 @@  void libxl_cpuid_dispose(libxl_cpuid_policy_list *cpuid_list);
 #define LIBXL_PCI_FUNC_ALL (~0U)
 
 typedef uint32_t libxl_domid;
+typedef uint32_t libxl_dmid;
 
 /*
  * Formatting Enumerations.
@@ -478,12 +479,14 @@  typedef struct {
     libxl_domain_build_info b_info;
 
     int num_disks, num_nics, num_pcidevs, num_vfbs, num_vkbs;
+    int num_dms;
 
     libxl_device_disk *disks;
     libxl_device_nic *nics;
     libxl_device_pci *pcidevs;
     libxl_device_vfb *vfbs;
     libxl_device_vkb *vkbs;
+    libxl_dm *dms;
 
     libxl_action_on_shutdown on_poweroff;
     libxl_action_on_shutdown on_reboot;
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index daa8c79..36c802a 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -246,6 +246,20 @@  libxl_domain_sched_params = Struct("domain_sched_params",[
     ("extratime",    integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT'}),
     ])
 
+libxl_dm_cap = Enumeration("dm_cap", [
+    (1, "UI"), # Emulate all UI + default device
+    (2, "IDE"), # Emulate IDE
+    (4, "SERIAL"), # Emulate Serial
+    (8, "AUDIO"), # Emulate audio
+    ])
+
+libxl_dm = Struct("dm", [
+    ("name",         string),
+    ("path",         string),
+    ("capabilities",   uint64),
+    ("vifs",         libxl_string_list),
+    ])
+
 libxl_domain_build_info = Struct("domain_build_info",[
     ("max_vcpus",       integer),
     ("avail_vcpus",     libxl_bitmap),
@@ -367,6 +381,7 @@  libxl_device_nic = Struct("device_nic", [
     ("nictype", libxl_nic_type),
     ("rate_bytes_per_interval", uint64),
     ("rate_interval_usecs", uint32),
+    ("id", string),
     ])
 
 libxl_device_pci = Struct("device_pci", [