Re: [PATCH 32/34] qemu: Add helper to retrieve vCPU pid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]