Re: [RFC] Unify KVM kernel-space and user-space code into a single project

Joerg Roedel
2010-03-24T16:40:00Z

On Wed, Mar 24, 2010 at 06:09:30PM +0200, Avi Kivity wrote:
> On 03/24/2010 05:59 PM, Joerg Roedel wrote:
>>
>>
>>>> I am not tied to /sys/kvm. We could also use /proc/<pid>/kvm/ for
>>>> example. This would keep anything in the process space (except for the
>>>> global list of VMs which we should have anyway).
>>>>
>>>>
>>> How about ~/.qemu/guests/$pid?
>>>
>> That makes it hard for perf to find it and even harder to get a list of
>> all VMs.
>
> Looks trivial to find a guest, less so with enumerating (still doable).

Not so trival and even more likely to break. Even it perf has the pid of
the process and wants to find the directory it has to do:

1. Get the uid of the process
2. Find the username for the uid
3. Use the username to find the home-directory

Steps 2. and 3. need nsswitch and/or pam access to get this information
from whatever source the admin has configured. And depending on what the
source is it may be temporarily unavailable causing nasty timeouts. In
short, there are many weak parts in that chain making it more likely to
break.
A kernel-based approach with /proc/<pid>/kvm does not have those issues
(and to repeat myself, it is independent from the userspace being used).

Joerg