Re: [PATCH 0/8] RFC: vcpu pinning at qemu start

Glauber Costa
2008-03-04T19:59:04Z

Anthony Liguori wrote:
> Glauber Costa wrote:
>> My main interest is in management tools being able to specify pinning
>> set ups at VM creation time.
>>
>> As I said, it can be done through tools like taskset, but then you'd
>> have to know:
>> * when are the threads created
>> * which thread ids corresponds to each cpu
>>
>> And of course, for an amount of time, the threads will be running in a
>> "wrong" cpu, which may affect workloads running there. (which is a
>> case cpu pinning usually tries to address)
>
> A management tool can start QEMU with -S to prevent any CPUs from
> running, query the VCPU=>thread id relationship (modifying info cpus
> would be a good thing to do for this), taskset, and then run 'cont' in
> the monitor if they desperately need this functionality. However, I
> don't think the vast majority of people need this particular functionality.

No, it can't. Because at the time qemu starts, no vcpu -> thread id
relationship exists at all. And we don't know when it will.

It would be a different story if there were some kind of api that could
warn qemu
> My feeling is that adding an interface to do this in QEMU encourages
> people to not use the existing Linux tools for this or worse yet, to
> think they can do a better job than Linux.

I agree with you that we should stick with linux tools, and that's why I
didn't provide any kind of runtime setting via qemu monitor to do this
(with the infrastructure, it would be trivial). taskset will do.

> The whole reason this exists
> in Xen is that Xen's schedulers were incapable of doing CPU migration
> historically (which is no longer true since the credit scheduler). It
> was necessary to specify pinning upon creation or you were stuck with
> round-robin placement. So libvirt has APIs for this because they were
> part of the Xen API because it was needed to get reasonable performance
> at some point in time on Xen. I don't think this behavior is useful for
> KVM though. Just because Xen does it doesn't imply that we should do it.
No, not just because xen does.

I do however feel it useful, since starting a vm and then let it run
unchanged is definitely an useful use case. And as I tried to show you,
I can't see a good way to do that for pinning.

> Regards,
>
> Anthony Liguori
>
>>
>>