On Tue, Nov 24, 2015 at 07:25:37 -0500, John Ferlan wrote:
On 11/20/2015 10:22 AM, Peter Krempa wrote:
> Instead of directly accessing the array add a helper to do this.
> ---
> src/qemu/qemu_cgroup.c | 3 ++-
> src/qemu/qemu_domain.c | 20 ++++++++++++++++++++
> src/qemu/qemu_domain.h | 1 +
> src/qemu/qemu_driver.c | 7 ++++---
> src/qemu/qemu_process.c | 5 ++---
> 5 files changed, 29 insertions(+), 7 deletions(-)
>
I believe technically it's a "tid" and not a "pid", but since 1/2
the
code calls it one way and the other calls it a different way it's a coin
flip on whether it... Theoretically different than vm->pid too
(although I am still trying to recall why vcpupids[0] was being compared
to vm->pid)
Couple of other places according to cscope that still reference vcpupids[]:
qemuDomainObjPrivateXMLFormat
qemuDomainObjPrivateXMLParse
These will be refactored later. Both the formatter and parser will
format also the corresponding cpu ID to the thread ID.
What about the innocent bystanders? IOW: What gets called with a now
potentially "0" for pid if the passed vcpu is out of bounds? Where 0 is
self/current process for some I believe. Not that this is any less worse
than what theoretically could happen with some out of range fetch, but
the question is more towards should we not make the call then? If the
goal is to make the code better, then perhaps the "error condition"
should be checked.
virCgroupAddTask
qemuGetProcessInfo
virProcessGetAffinity
virProcessSetAffinity
qemuProcessSetSchedParams
None of those should be ever called if the thread is 0. Currently it's
impossible and later the caller will need to make sure that this is the
case. Otherwise things will break.
Peter