Skip to contentSkip to conversation

Create new vcpu_op() hypercall. Replaces old boot_vcpu()

Xen-changelog Ryan Harper 3 participants 11 messages Oct 3, 2005 – Oct 5, 2005 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 8 lines · Xen patchbot -unstable

# HG changeset patch
# User [email protected]
# Node ID 85f92475b9437fcd10bf1ae105f53b0abe963050 # Parent dd87869f877ca9c68c97f36b3870908fb279edb9 Create new vcpu_op() hypercall. Replaces old boot_vcpu() hypercall and vcpu-related schedop commands.

Both do_boot_vcpu() and now VCPU_CREATE rely on domU kernel playing nice and not making the hypercall more than has been indicated in the shared table when we built the domain (nr_vcpus). Wouldn't it be better to have the domain creation hypercall specify the number of vcpus for a domain (as well as a cpumap to indicate which physical cpus are to be used) and alloc vcpu structures at that point leaving the vcpu_ops() to get context and unpause the vcpu?

If I put together a patch that mode the above change, would that be considered?

Signature · 5 lines
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
[email protected]
#2 lore raw
Quoted 10 lines · Ryan Harper

Both do_boot_vcpu() and now VCPU_CREATE rely on domU kernel playing nice and not making the hypercall more than has been indicated in the shared table when we built the domain (nr_vcpus). Wouldn't it be better to have the domain creation hypercall specify the number of vcpus for a domain (as well as a cpumap to indicate which physical cpus are to be used) and alloc vcpu structures at that point leaving the vcpu_ops() to get context and unpause the vcpu?

If I put together a patch that mode the above change, would that be considered?

I think there's not much in it -- allocating on demand vs. allocate at domain build time. I think the simplest patch would be for Xen to be passed a max_vcpuid or max_vcpus and apply the appropriate simple check at VCPUOP_create.

I'd take a patch that adds a new dom0 op to set that value (DOM0_SET_MAX_VCPUS or somesuch), applies the appropriate check inside Xen. Also that plumbs that hypercall into the Python wrapper, and adds a call to that command in xend (both during initial build and on save/restore).

-- Keir

#3 lore raw
Quoted 20 lines · Keir Fraser
Quoted 11 lines · Ryan Harper

Both do_boot_vcpu() and now VCPU_CREATE rely on domU kernel playing nice
and not making the hypercall more than has been indicated in the shared table when we built the domain (nr_vcpus). Wouldn't it be better to have the domain creation hypercall specify the number of vcpus for a domain (as well as a cpumap to indicate which physical cpus are to be used) and alloc vcpu structures at that point leaving the vcpu_ops() to get context and unpause the vcpu?

If I put together a patch that mode the above change, would that be considered?

I think there's not much in it -- allocating on demand vs. allocate at domain build time. I think the simplest patch would be for Xen to be passed a max_vcpuid or max_vcpus and apply the appropriate simple check at VCPUOP_create.

Quoted 5 lines

I'd take a patch that adds a new dom0 op to set that value (DOM0_SET_MAX_VCPUS or somesuch), applies the appropriate check inside Xen. Also that plumbs that hypercall into the Python wrapper, and adds a call to that command in xend (both during initial build and on save/restore).

I was also thinking toward NUMA systems where I'd like to know which physical cpus are being utilized for a given domain so when we allocate memory for a domain we can try to localize those allocations to the cpus that will be using it. Currently domain memory allocation happens before secondary processors are selected.

I'd rather see domain creation take both max_vcpus and cpu placement bitmaps instead, but if that is not acceptable for 3.0, I'll go ahead and work up the patch as described since it needs to be resolved for 3.0.

Signature · 5 lines
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
[email protected]
#4 lore raw
Quoted 10 lines · Ryan Harper

I was also thinking toward NUMA systems where I'd like to know which physical cpus are being utilized for a given domain so when we allocate memory for a domain we can try to localize those allocations to the cpus that will be using it. Currently domain memory allocation happens before secondary processors are selected.

I'd rather see domain creation take both max_vcpus and cpu placement bitmaps instead, but if that is not acceptable for 3.0, I'll go ahead and work up the patch as described since it needs to be resolved for 3.0.

I'd rather keep single-purpose dom0 ops than have createdomain become a 'union of everything'.

There is already a dom0 op for pinning a vcpu. Right now it can't be used before the domain starts for other than vcpu0 since it requires VCPUOP_create to allocate the vcpu structure, but fixing that is unrelated to whether pin info is passed to DOM0_CREATEDOMAIN. As you say, it's also not critical to fix for 3.0.

-- Keir

#5 lore raw
In reply to Ryan Harper
Quoted 9 lines · Ryan Harper
Quoted 8 lines · Xen patchbot -unstable

# HG changeset patch
# User [email protected]
# Node ID 85f92475b9437fcd10bf1ae105f53b0abe963050 # Parent dd87869f877ca9c68c97f36b3870908fb279edb9 Create new vcpu_op() hypercall. Replaces old boot_vcpu() hypercall and vcpu-related schedop commands.

btw, this patch also regressed vcpu-{enable/disable} for dom0 and domU.

Signature · 5 lines
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
[email protected]
#6 lore raw
Quoted 9 lines · Ryan Harper
Quoted 8 lines · Ryan Harper
Quoted 7 lines · Xen patchbot -unstable

# HG changeset patch
# User [email protected]
# Node ID 85f92475b9437fcd10bf1ae105f53b0abe963050 # Parent dd87869f877ca9c68c97f36b3870908fb279edb9 Create new vcpu_op() hypercall. Replaces old boot_vcpu() hypercall and vcpu-related schedop commands.

Quoted 3 lines
Quoted 1 line
Quoted 1 line

btw, this patch also regressed vcpu-{enable/disable} for dom0 and domU.

Actually this was just the first changeset where I noticed. The break is further back. I'll reply in a bit with the changeset where this was broken.

Signature · 5 lines
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
[email protected]
#7 lore raw
Quoted 5 lines · Ryan Harper
Quoted 1 line

btw, this patch also regressed vcpu-{enable/disable} for dom0 and domU.

Actually this was just the first changeset where I noticed. The break is further back. I'll reply in a bit with the changeset where this was broken.

I see problems on smp save/restore -- secondary cpus end up looping forever (I think waiting for their state to be CPU_UP_PREPARE in play_dead()). I'm sure there's a similar problem in vcpu-up/down logic. I don't think it can be very hard to fix. :-)

-- Keir

#8 lore raw
Quoted 6 lines · Keir Fraser
Quoted 3 lines · Ryan Harper
Quoted 2 lines

btw, this patch also regressed vcpu-{enable/disable} for dom0 and domU.

Quoted 8 lines
Quoted 3 lines

Actually this was just the first changeset where I noticed. The break is further back. I'll reply in a bit with the changeset where this was broken.

I see problems on smp save/restore -- secondary cpus end up looping forever (I think waiting for their state to be CPU_UP_PREPARE in play_dead()). I'm sure there's a similar problem in vcpu-up/down logic. I don't think it can be very hard to fix. :-)

Actually, hotplug works fine via sysfs:
(echo 0 > /sys/devices/system/cpu/cpu1/online), but the store watches for hotplug don't seem to get triggered. I can confirm the writes to the store (with xs_tdb_dump), and with some debugging in the kernel I can see that the watches never fire.

Last changeset where vcpu-disable works is:

changeset:   7141:a39510ad5c591ee84592924e718c90d746f90097
user:        emellor@ewan
date:        Fri Sep 30 05:55:49 2005
summary:     Added cache-control headers to pages returned by HTTP server so that pages
Signature · 5 lines
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
[email protected]
#9 lore raw
Quoted 22 lines · Ryan Harper
Quoted 6 lines · Keir Fraser
Quoted 3 lines · Ryan Harper
Quoted 2 lines

btw, this patch also regressed vcpu-{enable/disable} for dom0 and domU.

Quoted 8 lines
Quoted 3 lines

Actually this was just the first changeset where I noticed. The break is further back. I'll reply in a bit with the changeset where this was broken.

I see problems on smp save/restore -- secondary cpus end up looping forever (I think waiting for their state to be CPU_UP_PREPARE in play_dead()). I'm sure there's a similar problem in vcpu-up/down logic. I don't think it can be very hard to fix. :-)

Actually, hotplug works fine via sysfs:
(echo 0 > /sys/devices/system/cpu/cpu1/online), but the store watches for hotplug don't seem to get triggered. I can confirm the writes to the store (with xs_tdb_dump), and with some debugging in the kernel I can see that the watches never fire.

Quoted 6 lines

Last changeset where vcpu-disable works is:

changeset:   7141:a39510ad5c591ee84592924e718c90d746f90097
user:        emellor@ewan
date:        Fri Sep 30 05:55:49 2005
summary:     Added cache-control headers to pages returned by HTTP server so that pages

Or to put it another way, the changeset that broke it is 7142:Within the store, split the persistent information regarding a VM from the transient information regarding a domain.

This suggests that the recent changes to the paths have broken something; presumably whatever is watching is watching for the wrong thing now. Do you know which path is being changed, and which path was being changed in the working changeset?

Ewan.

#10 lore raw
Quoted 31 lines · Ewan Mellor
Quoted 22 lines · Ryan Harper
Quoted 6 lines · Keir Fraser
Quoted 3 lines · Ryan Harper
Quoted 2 lines

btw, this patch also regressed vcpu-{enable/disable} for dom0 and domU.

Quoted 8 lines
Quoted 3 lines

Actually this was just the first changeset where I noticed. The break is further back. I'll reply in a bit with the changeset where this was broken.

I see problems on smp save/restore -- secondary cpus end up looping forever (I think waiting for their state to be CPU_UP_PREPARE in play_dead()). I'm sure there's a similar problem in vcpu-up/down logic. I don't think it can be very hard to fix. :-)

Actually, hotplug works fine via sysfs:
(echo 0 > /sys/devices/system/cpu/cpu1/online), but the store watches for hotplug don't seem to get triggered. I can confirm the writes to the store (with xs_tdb_dump), and with some debugging in the kernel I can see that the watches never fire.

Quoted 6 lines

Last changeset where vcpu-disable works is:

changeset:   7141:a39510ad5c591ee84592924e718c90d746f90097
user:        emellor@ewan
date:        Fri Sep 30 05:55:49 2005
summary:     Added cache-control headers to pages returned by HTTP server so that pages
Quoted 7 lines

Or to put it another way, the changeset that broke it is 7142:Within the store, split the persistent information regarding a VM from the transient information regarding a domain.

This suggests that the recent changes to the paths have broken something; presumably whatever is watching is watching for the wrong thing now. Do you know which path is being changed, and which path was being changed in the working changeset?

The vcpu hotplug watch is triggered on any writes to /cpu. It will then examine the node value to see if the change was made to /cpu/cpu#/availability, (e.g. /cpu/1/availability), if the full path of the change is correct, it examines the change values which are either 'online' or 'offline' and invokes the vcpu_up/down handlers if the write is a state change.

I only ever see one trigger and the value is 'cpu' but I can confirm that tdb sees the full write ('/cpu/1/availabilty', 'offline').

Signature · 5 lines
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
[email protected]
#11 lore raw
Quoted 9 lines · Ryan Harper

The vcpu hotplug watch is triggered on any writes to /cpu. It will then examine the node value to see if the change was made to /cpu/cpu#/availability, (e.g. /cpu/1/availability), if the full path of the change is correct, it examines the change values which are either 'online' or 'offline' and invokes the vcpu_up/down handlers if the write is a state change.

I only ever see one trigger and the value is 'cpu' but I can confirm that tdb sees the full write ('/cpu/1/availabilty', 'offline').

Thanks Ryan, that's been very helpful. This is now bug #280.

Cheers,

Ewan.