Am 08.03.2013 um 11:37 schrieb Paul Mackerras <pau...@samba.org>:

> On Thu, Mar 07, 2013 at 03:00:52PM +0100, Alexander Graf wrote:
>> 
>> Could you please (in a quick and drafty way) try and see if setting the IRQ 
>> arch (using enable_cap) after the vcpu got created would work for you?
>> 
>> That enable_cap would then have to loop through all devices and notify irq 
>> controllers that a new cpu got spawned.
>> All vcpu local payloads would have to get allocated and initialized outside 
>> of vcpu_create too then.
> 
> So, the first thing I noticed is that KVM_ENABLE_CAP is a vcpu ioctl,
> not a vm ioctl.  Apparently qemu calls it once for every vcpu when it
> calls it on ppc targets.  That means that it doesn't have to loop
> through all vcpus; it just needs to connect up the one it's called
> for, which simplifies things.

That's the point, yes :). And if for some weird reason one vcpu isn't connected 
to the interrupt controller (or to a different one), we can model that too ;).

> I'm coding it up now and porting my XICS emulation to the kvm device
> API proposed by Scott.  It looks like it's going to be OK.  

Awesome! Scott is going to prototype whether using fds as tokens makes sense. 
But even if we change it to an fd model, there should be very little work to do 
to move xics to it too if it's already modeled for create_device.

> I have
> used the first argument (cap->args[0]) to specify which interrupt
> controller you want to connect the vcpu to.

Ah, nice idea. So you basically make the vcpu connection explicit. Perfect! 
Then just pass the interrupt controller pin id in cap->args[1] so we don't need 
to guess which vcpu we're talking about and all is well :). No implicit 
assumptions left in the kernel.

> 
>> I don't have a good feeling for how hard this would be and whether locking 
>> would become overly difficult. I think it's fair to restrict the enable_cap 
>> to only work when no other vcpu is running. Of course, not requiring a 
>> stopped machine would make hotplug easier for user space :).
> 
> Since it's a per-vcpu ioctl, I'm expecting userspace to enable the
> capability for each hotplugged vcpu.

Yes, and also establish the link to the interrupt controller manually through 
that, so configuration is 100% in user space's hands.

This whole thing is starting to get a consistent structure - very nice!


Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to