Skip to contentSkip to conversation

Enhance perf to collect KVM guest os statistics from host side

PATCH In review Zhang, Yanmin 36 participants 377 messages Mar 16, 2010 – Apr 8, 2010 Page 2 of 2

Subsystems (5)
x86 KVM perf events KVM x86 +1 more subsystems
lore
Share & tools
lore
#92 lore raw

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

In reply to Ingo Molnar
Quoted 9 lines · Ingo Molnar
Quoted 6 lines · Avi Kivity
Quoted 4 lines · Ingo Molnar

Frankly, i was surprised (and taken slightly off base) by both Avi and Anthony suggesting such a clearly inferior "add a demon to the guest space" solution. It's a usability and deployment non-starter.

Quoted 6 lines
Quoted 4 lines

It's only clearly inferior if you ignore every consideration against it. It's definitely not a deployment non-starter, see the tons of daemons that come with any Linux system. [...]

Avi, please dont put arguments into my mouth that i never made.

Sorry, that was not the intent. I meant that putting things into the kernel have disadvantages that must be considered.

Quoted 9 lines

My (clearly expressed) argument was that:

_a new guest-side demon is a transparent instrumentation non-starter_

What is so hard to understand about that simple concept? Instrumentation is good if it's as transparent as possible.

Of course lots of other features can be done via a new user-space package ...

I believe you can deploy this daemon via a (default) package, without any hassle to users.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#129 lore raw

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

In reply to Avi Kivity
Quoted 5 lines · Avi Kivity
Quoted 2 lines

I.e. you are arguing for microkernel Linux, while you see me as arguing for a monolithic kernel.

No. I'm arguing for reducing bloat wherever possible. Kernel code is more expensive than userspace code in every metric possible.

1)

One of the primary design arguments of the micro-kernel design as well was to push as much into user-space as possible without impacting performance too much so you very much seem to be arguing for a micro-kernel design for the kernel.

I think history has given us the answer for that fight between microkernels and monolithic kernels.

Furthermore, to not engage in hypotheticals about microkernels: by your argument the Oprofile design was perfect (it was minimalistic kernel-space, with all the complexity in user-space), while perf was over-complex (which does many things in the kernel that could have been done in user-space).

Practical results suggest the exact opposite happened - Oprofile is being replaced by perf. How do you explain that?

2)

In your analysis you again ignore the package boundary costs and artifacts as if they didnt exist.

That was my main argument, and that is what we saw with oprofile and perf:
while maintaining more kernel-code may be more expensive, it sure pays off for getting us a much better solution in the end.

And getting a 'much better solution' to users is the goal of all this, isnt it?

I dont mind what you call 'bloat' per se if it's for a purpose that users find like a good deal. I have quite a bit of RAM in most of my systems, having 50K more or less included in the kernel image is far less important than having a healthy and vibrant development model and having satisfied users ...

Ingo

#168 lore raw

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

In reply to Avi Kivity
Quoted 11 lines · Avi Kivity
Quoted 9 lines · Ingo Molnar

Of course you could say the following:

' Thanks, I'll mark this for v2.6.36 integration. Note that we are not
able to add this to the v2.6.35 kernel queue anymore as the ongoing usability work already takes up all of the project's maintainer and testing bandwidth. If you want the feature to be merged sooner than that then please help us cut down on the TODO and BUGS list that can be found at XYZ. There's quite a few low hanging fruits there. '

Quoted 3 lines

That would be shooting at my own foot as well as the contributor's since I badly want that RCU stuff, and while a GUI would be nice, that itch isn't on my back.

I think this sums up the root cause of all the problems i see with KVM pretty well.

Thanks,

Ingo

#284 lore raw

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

In reply to Avi Kivity
Quoted 10 lines · Avi Kivity
Quoted 10 lines

Consider the _other_ examples that are a lot more clear:

' If you expose paravirt spilocks via KVM please also make sure the KVM
tooling can make use of it, has an option for it to configure it, and that it has sufficient efficiency statistics displayed in the tool for admins to monitor.'

' If you create this new paravirt driver then please also make sure it can
be configured in the tooling. '

Quoted 6 lines
Quoted 2 lines

' Please also add a testcase for this bug to tools/kvm/testcases/ so we dont
repeat this same mistake in the future. '

All three happen quite commonly in qemu/kvm development. Of course someone who develops a feature also develops a patch that exposes it in qemu. There are several test cases in qemu-kvm.git/kvm/user/test.

If that is the theory then it has failed to trickle through in practice. As you know i have reported a long list of usability problems with hardly a look. That list could be created by pretty much anyone spending a few minutes of getting a first impression with qemu-kvm.

So something is seriously wrong in KVM land, to pretty much anyone trying it for the first time. I have explained how i see the root cause of that, while you seem to suggest that there's nothing wrong to begin with. I guess we'll have to agree to disagree on that.

Thanks,

Ingo

#162 lore raw

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

In reply to Ingo Molnar
Quoted 10 lines · Ingo Molnar
Quoted 7 lines

If you want to improve this, you need to do the following:

1) Add a userspace daemon that uses vmchannel that runs in the guest and can fetch kallsyms and arbitrary modules. If that daemon lives in tools/perf, that's fine.

Adding any new daemon to an existing guest is a deployment and usability nightmare.

Quoted 9 lines

The basic rule of good instrumentation is to be transparent. The moment we have to modify the user-space of a guest just to monitor it, the purpose of transparent instrumentation is defeated.

That was one of the fundamental usability mistakes of Oprofile.

There is no 'perf' daemon - all the perf functionality is _built in_, and for very good reasons. It is one of the main reasons for perf's success as well.

The solution should be a long lived piece of code that runs without kernel privileges. How the code is delivered to the user is a separate problem.

If you want to argue that the kernel should build an initramfs that contains some things that always should be shipped with the kernel but don't need to be within the kernel, I think that's something that's long over due.

We could make it a kernel thread, but what's the point? It's much safer for it to be a userspace thread and it doesn't need to interact with the kernel in an intimate way.

Regards,

Anthony Liguori

#93 lore raw

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

In reply to Ingo Molnar
Quoted 13 lines · Ingo Molnar
Quoted 10 lines · Avi Kivity
Quoted 4 lines · Ingo Molnar

Frankly, i was surprised (and taken slightly off base) by both Avi and Anthony suggesting such a clearly inferior "add a demon to the guest space" solution. It's a usability and deployment non-starter.

It's only clearly inferior if you ignore every consideration against it. It's definitely not a deployment non-starter, see the tons of daemons that come with any Linux system. [...]

Quoted 6 lines

Avi, please dont put arguments into my mouth that i never made.

My (clearly expressed) argument was that:

_a new guest-side demon is a transparent instrumentation non-starter_

FWIW, there's no reason you couldn't consume a vmchannel port from within the kernel. I don't think the code needs to be in the kernel and from a security PoV, that suggests that it should be in userspace IMHO.

But if you want to make a kernel thread, knock yourself out. I have no objection to that from a qemu perspective. I can't see why Avi would mind either. I think it's papering around another problem (the kernel should control initrds IMHO) but that's a different topic.

Regards,

Anthony Liguori

#285 lore raw

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

In reply to Ingo Molnar
Quoted 5 lines · Ingo Molnar

If that is the theory then it has failed to trickle through in practice. As you know i have reported a long list of usability problems with hardly a look. That list could be created by pretty much anyone spending a few minutes of getting a first impression with qemu-kvm.

I think the point you're missing is that your list was from the perspective of someone looking at a desktop virtualization solution that had was graphically oriented.

As Avi has repeatedly mentioned, so far, that has not been the target audience of QEMU. The target audience tends to be: 1) people looking to do server virtualization and 2) people looking to do command line based development.

Usually, both (1) and (2) are working on machines that are remotely located. What's important to these users is that VMs be easily launchable from the command line, that there is a lot of flexibility in defining machine types, and that there is a programmatic way to interact with a given instance of QEMU. Those are the things that we've been focusing on recently.

The reason we don't have better desktop virtualization support is simple. No one is volunteering to do it and no company is funding development for it.

When you look at something like VirtualBox, what you're looking at is a long ago forked version of QEMU with a GUI added focusing on desktop virtualization.

There is no magic behind adding a better, more usable GUI to QEMU. It just takes resources.

I understand that you're trying to make the point that without catering to the desktop virtualization use case, we won't get as many developers as we could. Personally, I don't think that argument is accurate. If you look at VirtualBox, it's performance is terrible. Having a nice GUI hasn't gotten them the type of developers that can improve their performance.

No one is arguing that we wouldn't like to have a nicer UI. I'd love to merge any patch like that.

Regards,

Anthony Liguori

#169 lore raw

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

In reply to Ingo Molnar
Quoted 14 lines · Ingo Molnar
Quoted 11 lines · Avi Kivity
Quoted 9 lines · Ingo Molnar

Of course you could say the following:

' Thanks, I'll mark this for v2.6.36 integration. Note that we are not
able to add this to the v2.6.35 kernel queue anymore as the ongoing usability work already takes up all of the project's maintainer and testing bandwidth. If you want the feature to be merged sooner than that then please help us cut down on the TODO and BUGS list that can be found at XYZ. There's quite a few low hanging fruits there. '

Quoted 7 lines
Quoted 4 lines

That would be shooting at my own foot as well as the contributor's since I badly want that RCU stuff, and while a GUI would be nice, that itch isn't on my back.

I think this sums up the root cause of all the problems i see with KVM pretty well.

A good maintainer has to strike a balance between asking more of people than what they initially volunteer and getting people to implement the less fun things that are nonetheless required. The kernel can take this to an extreme because at the end of the day, it's the only game in town and there is an unending number of potential volunteers. Most other projects are not quite as fortunate.

When someone submits a patch set to QEMU implementing a new network backend for raw sockets, we can push back about how it fits into the entire stack wrt security, usability, etc. Ultimately, we can arrive at a different, more user friendly solution (networking helpers) and along with some time investment on my part, we can create a much nicer, more user friendly solution. Still command line based though.

Responding to such a patch set with, replace the SDL front end with a GTK one that lets you graphically configure networking, is not reasonable and the result would be one less QEMU contributor in the long run.

Overtime, we can, and are, pushing people to focus more on usability. But that doesn't get you a first class GTK GUI overnight. The only way you're going to get that is by having a contributor be specifically interesting in building such a thing.

We simply haven't had that in the past 5 years that I've been involved in the project. If someone stepped up to build this, I'd certainly support it in every way possible and there are probably some steps we could take to even further encourage this.

Regards,

Anthony Liguori

#286 lore raw

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

In reply to Ingo Molnar
Quoted 5 lines · Ingo Molnar

If that is the theory then it has failed to trickle through in practice. As you know i have reported a long list of usability problems with hardly a look. That list could be created by pretty much anyone spending a few minutes of getting a first impression with qemu-kvm.

Can you transfer your list to the following wiki page:

http://wiki.qemu.org/Features/Usability

This thread is so large that I can't find your note that contained the initial list.

I want to make sure this input doesn't die once this thread settles down.

Regards,

Anthony Liguori

#103 lore raw

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

In reply to Ingo Molnar
Quoted 45 lines · Ingo Molnar
Quoted 9 lines · Avi Kivity
Quoted 4 lines

Well, for what it's worth, I rarely ever use anything else. My virtual disks are raw so I can loop mount them easily, and I can also switch my guest kernels from outside... without ever needing to mount those disks.

Curious, what do you use them for?

btw, if you build your kernel outside the guest, then you already have access to all its symbols, without needing anything further.

There's two errors with your argument:

1) you are assuming that it's only about kernel symbols

Look at this 'perf report' output:

# Samples: 7127509216
#
# Overhead Command Shared Object Symbol

# ........  ..........  .............................  ......
#
     19.14%         git  git                            [.] lookup_object
     15.16%        perf  git                            [.] lookup_object
      4.74%        perf  libz.so.1.2.3                  [.] inflate
      4.52%         git  libz.so.1.2.3                  [.] inflate
      4.21%        perf  libz.so.1.2.3                  [.] inflate_table
      3.94%         git  libz.so.1.2.3                  [.] inflate_table
      3.29%         git  git                            [.] find_pack_entry_one
      3.24%         git  libz.so.1.2.3                  [.] inflate_fast
      2.96%        perf  libz.so.1.2.3                  [.] inflate_fast
      2.96%         git  git                            [.] decode_tree_entry
      2.80%        perf  libc-2.11.90.so                [.] __strlen_sse42
      2.56%         git  libc-2.11.90.so                [.] __strlen_sse42
      1.98%        perf  libc-2.11.90.so                [.] __GI_memcpy
      1.71%        perf  git                            [.] decode_tree_entry
      1.53%         git  libc-2.11.90.so                [.] __GI_memcpy
      1.48%         git  git                            [.] lookup_blob
      1.30%         git  git                            [.] process_tree
      1.30%        perf  git                            [.] process_tree
      0.90%        perf  git                            [.] tree_entry
      0.82%        perf  git                            [.] lookup_blob
      0.78%         git  [kernel.kallsyms]              [k] kstat_irqs_cpu
Quoted 8 lines

kernel symbols are only a small portion of the symbols. (a single line in this case)

To get to those other symbols we have to read the ELF symbols of those binaries in the guest filesystem, in the post-processing/reporting phase. This is both complex to do and relatively slow so we dont want to (and cannot) do this at sample time from IRQ context or NMI context ...

Okay. So a symbol server is necessary. Still, I don't think -kernel is a good reason for including the symbol server in the kernel itself. If someone uses it extensively together with perf, _and_ they can't put the symbol server in the guest for some reason, let them patch mkinitrd to include it.

Quoted 12 lines

Also, many aspects of reporting are interactive so it's done lazily or on-demand. So we need ready access to the guest filesystem - for those guests which decide to integrate with the host for this.

2) the 'SystemTap mistake'

You are assuming that the symbols of the kernel when it got built got saved properly and are discoverable easily. In reality those symbols can be erased by a make clean, can be modified by a new build, can be misplaced and can generally be hard to find because each distro puts them in a different installation path.

Quoted 4 lines

My 10+ years experience with kernel instrumentation solutions is that kernel-driven, self-sufficient, robust, trustable, well-enumerated sources of information work far better in practice.

What about line number information? And the source? Into the kernel with them as well?

Quoted 5 lines

The thing is, in this thread i'm forced to repeat the same basic facts again and again. Could you _PLEASE_, pretty please, when it comes to instrumentation details, at least _read the mails_ of the guys who actually ... write and maintain Linux instrumentation code? This is getting ridiculous really.

I've read every one of your emails. If I misunderstood or overlooked something, I apologize. The thread is very long and at times antagonistic so it's hard to keep all the details straight.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#121 lore raw

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

In reply to Ingo Molnar
Quoted 7 lines · Ingo Molnar
Quoted 4 lines

That includes the guest kernel. If you can deploy a new kernel in the guest, presumably you can deploy a userspace package.

Note that with perf we can instrument the guest with zero guest-kernel modifications as well.

Quoted 9 lines

We try to reduce the guest impact to a bare minimum, as the difficulties in deployment are function of the cross section surface to the guest.

Also, note that the kernel is special with regards to instrumentation: since this is the kernel project, we are doing kernel space changes, as we are doing them _anyway_. So adding symbol resolution capabilities would be a minimal addition to that - while adding a while new guest package for the demon would significantly increase the cross section surface.

It's true that for us, changing the kernel is easier than changing the rest of the guest. IMO we should still resist the temptation to go the easy path and do the right thing (I understand we disagree about what the right thing is).

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#130 lore raw

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

In reply to Ingo Molnar
Quoted 11 lines · Ingo Molnar
Quoted 6 lines · Avi Kivity
Quoted 3 lines

I.e. you are arguing for microkernel Linux, while you see me as arguing for a monolithic kernel.

No. I'm arguing for reducing bloat wherever possible. Kernel code is more expensive than userspace code in every metric possible.

1)

Quoted 8 lines

One of the primary design arguments of the micro-kernel design as well was to push as much into user-space as possible without impacting performance too much so you very much seem to be arguing for a micro-kernel design for the kernel.

I think history has given us the answer for that fight between microkernels and monolithic kernels.

I am not arguing for a microkernel. Again: reduce bloat where possible, kernel code is more expensive than userspace code.

Quoted 8 lines

Furthermore, to not engage in hypotheticals about microkernels: by your argument the Oprofile design was perfect (it was minimalistic kernel-space, with all the complexity in user-space), while perf was over-complex (which does many things in the kernel that could have been done in user-space).

Practical results suggest the exact opposite happened - Oprofile is being replaced by perf. How do you explain that?

I did not say that the amount of kernel and userspace code is the only factor deciding the quality of software. If that were so, microkernels would have won out long ago.

It may be that that perf has too much kernel code, and won against oprofile despite that because it was better in other areas. Or it may be that perf has exactly the right user/kernel division. Or maybe perf needs some of the code moved from userspace to the kernel. I don't know, I haven't examined the code.

The user/kernel boundary is only one metric for code quality. Nor is it always in favour of pushing things to userspace. Narrowing or simplifying an interface is often an argument in favour of pushing things into the kernel.

IMO the reason perf is more usable than oprofile has less to do with the kernel/userspace boundary and more do to with effort and attention spent on the userspace/user boundary.

Quoted 9 lines

2)

In your analysis you again ignore the package boundary costs and artifacts as if they didnt exist.

That was my main argument, and that is what we saw with oprofile and perf:
while maintaining more kernel-code may be more expensive, it sure pays off for getting us a much better solution in the end.

Package costs are real. We need to bear them. I don't think that because maintaining another package (and the interface between two packages) is more difficult, then the kernel size should increase.

Quoted 8 lines

And getting a 'much better solution' to users is the goal of all this, isnt it?

I dont mind what you call 'bloat' per se if it's for a purpose that users find like a good deal. I have quite a bit of RAM in most of my systems, having 50K more or less included in the kernel image is far less important than having a healthy and vibrant development model and having satisfied users ...

I'm not worried about 50K or so, I'm worried about a bug in those 50K taking down the guest.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#118 lore raw

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

In reply to Ingo Molnar
Quoted 44 lines · Ingo Molnar
Quoted 8 lines · Avi Kivity
Quoted 3 lines

Well, for what it's worth, I rarely ever use anything else. My virtual disks are raw so I can loop mount them easily, and I can also switch my guest kernels from outside... without ever needing to mount those disks.

Curious, what do you use them for?

btw, if you build your kernel outside the guest, then you already have access to all its symbols, without needing anything further.

There's two errors with your argument:

1) you are assuming that it's only about kernel symbols

Look at this 'perf report' output:

# Samples: 7127509216
#
# Overhead Command Shared Object Symbol

# ........  ..........  .............................  ......
#
    19.14%         git  git                            [.] lookup_object
    15.16%        perf  git                            [.] lookup_object
     4.74%        perf  libz.so.1.2.3                  [.] inflate
     4.52%         git  libz.so.1.2.3                  [.] inflate
     4.21%        perf  libz.so.1.2.3                  [.] inflate_table
     3.94%         git  libz.so.1.2.3                  [.] inflate_table
     3.29%         git  git                            [.] find_pack_entry_one
     3.24%         git  libz.so.1.2.3                  [.] inflate_fast
     2.96%        perf  libz.so.1.2.3                  [.] inflate_fast
     2.96%         git  git                            [.] decode_tree_entry
     2.80%        perf  libc-2.11.90.so                [.] __strlen_sse42
     2.56%         git  libc-2.11.90.so                [.] __strlen_sse42
     1.98%        perf  libc-2.11.90.so                [.] __GI_memcpy
     1.71%        perf  git                            [.] decode_tree_entry
     1.53%         git  libc-2.11.90.so                [.] __GI_memcpy
     1.48%         git  git                            [.] lookup_blob
     1.30%         git  git                            [.] process_tree
     1.30%        perf  git                            [.] process_tree
     0.90%        perf  git                            [.] tree_entry
     0.82%        perf  git                            [.] lookup_blob
     0.78%         git  [kernel.kallsyms]              [k] kstat_irqs_cpu
Quoted 2 lines

kernel symbols are only a small portion of the symbols. (a single line in this case)

Above example shows perf could summarize both kernel and application hot functions. If we collect guest os statistics from host side, we can't summarize detailed guest os application info because we couldn't get guest os's application process id from host side. So we could only get detailed kernel info and the total utilization percent of guest application processes.

Quoted 9 lines

To get to those other symbols we have to read the ELF symbols of those binaries in the guest filesystem, in the post-processing/reporting phase. This is both complex to do and relatively slow so we dont want to (and cannot) do this at sample time from IRQ context or NMI context ...

Also, many aspects of reporting are interactive so it's done lazily or on-demand. So we need ready access to the guest filesystem - for those guests which decide to integrate with the host for this.

#171 lore raw

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

In reply to Ingo Molnar
Quoted 14 lines · Ingo Molnar
Quoted 11 lines · Avi Kivity
Quoted 9 lines · Ingo Molnar

Of course you could say the following:

' Thanks, I'll mark this for v2.6.36 integration. Note that we are not
able to add this to the v2.6.35 kernel queue anymore as the ongoing usability work already takes up all of the project's maintainer and testing bandwidth. If you want the feature to be merged sooner than that then please help us cut down on the TODO and BUGS list that can be found at XYZ. There's quite a few low hanging fruits there. '

Quoted 7 lines
Quoted 4 lines

That would be shooting at my own foot as well as the contributor's since I badly want that RCU stuff, and while a GUI would be nice, that itch isn't on my back.

I think this sums up the root cause of all the problems i see with KVM pretty well.

I think we agree at last. Neither I nor my employer are interested in running qemu as a desktop-on-desktop tool, therefore I don't invest any effort in that direction, or require it from volunteers.

If you think a good GUI is so badly needed, either write one yourself, or convince someone else to do it.

(btw, why are you interested in desktop-on-desktop? one use case is developers, which don't really need fancy GUIs; a second is people who test out distributions, but that doesn't seem to be a huge population; and a third is people running Windows for some application that doesn't run on Linux - hopefully a small catergory as well. Seems to be quite a small target audience, compared to, say, video editing)

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#287 lore raw

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

In reply to Ingo Molnar
Quoted 16 lines · Ingo Molnar
Quoted 13 lines · Avi Kivity
Quoted 13 lines

Consider the _other_ examples that are a lot more clear:

' If you expose paravirt spilocks via KVM please also make sure the KVM
tooling can make use of it, has an option for it to configure it, and that it has sufficient efficiency statistics displayed in the tool for admins to monitor.'

' If you create this new paravirt driver then please also make sure it can
be configured in the tooling. '

' Please also add a testcase for this bug to tools/kvm/testcases/ so we dont
repeat this same mistake in the future. '

Quoted 9 lines
Quoted 4 lines

All three happen quite commonly in qemu/kvm development. Of course someone who develops a feature also develops a patch that exposes it in qemu. There are several test cases in qemu-kvm.git/kvm/user/test.

If that is the theory then it has failed to trickle through in practice. As you know i have reported a long list of usability problems with hardly a look. That list could be created by pretty much anyone spending a few minutes of getting a first impression with qemu-kvm.

It does happen in practice, just not in the GUI areas, since no one is working on them. I am not going to condition a qcow2 reliability fix to a gtk GUI.

Quoted 5 lines

So something is seriously wrong in KVM land, to pretty much anyone trying it for the first time. I have explained how i see the root cause of that, while you seem to suggest that there's nothing wrong to begin with. I guess we'll have to agree to disagree on that.

Not anyone trying it for the first time. RHEV-M users will see a polished GUI that can be used to manage thousands of guests and hosts. I presume IBM and Siemens (and all other contributors) users will also enjoy a good user experience with their respective products. Qemu is not the only GUI for kvm.

So far only one company was interested in a qemu GUI - the makers of virtualbox. Unfortunately they chose not to contribute that back to qemu, and no one was sufficiently motivated to pick out the bits and try to merge them.

Again, if you are interested in a qemu GUI, you either have to write it yourself or convince someone else to do it. My own plate is full and my priorities are clear.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#372 lore raw
In reply to Ingo Molnar
Quoted 9 lines · Ingo Molnar

Nice progress!

This bit:

Quoted 3 lines

1) perf kvm top
[root@lkp-ne01 norm]# perf kvm --host --guest --guestkallsyms=/home/ymzhang/guest/kallsyms --guestmodules=/home/ymzhang/guest/modules top

Quoted 4 lines

Will be really be painful to developers - to enter that long line while we have these things called 'computers' that ought to reduce human work. Also, it's incomplete, we need access to the guest system's binaries to do ELF symbol resolution and dwarf decoding.

Yes, I agree with you and Avi that we need the enhancement be user-friendly. One of my start points is to keep the tool having less dependency on other components. Admin/developers could write script wrappers quickly if perf has parameters to support the new capability.

Quoted 6 lines

So we really need some good, automatic way to get to the guest symbol space, so that if a developer types:

perf kvm top

Quoted 7 lines

Then the obvious thing happens by default. (which is to show the guest overhead)

There's no technical barrier on the perf tooling side to implement all that:
perf supports build-ids extensively and can deal with multiple symbol spaces - as long as it has access to it. The guest kernel could be ID-ed based on its /sys/kernel/notes and /sys/module/*/notes/.note.gnu.build-id build-ids.

I tried sshfs quickly. sshfs could mount root filesystem of guest os nicely. I could access the files quickly. However, it doesn't work when I access /proc/ and /sys/ because sshfs/scp depend on file size while the sizes of most files of /proc/ and /sys/ are 0.

Quoted 6 lines

So some sort of --guestmount option would be the natural solution, which points to the guest system's root: and a Qemu enumeration of guest mounts (which would be off by default and configurable) from which perf can pick up the target guest all automatically. (obviously only under allowed permissions so that such access is secure)

If sshfs could access /proc/ and /sys correctly, here is a design:
--guestmount points to a directory which consists of a list of sub-directories. Every sub-directory's name is just the qemu process id of guest os. Admin/developer mounts every guest os instance's root directory to corresponding sub-directory.

Then, perf could access all files. It's possible because guest os instance happens to be multi-threading in a process. One of the defects is the accessing to guest os becomes slow or impossible when guest os is very busy.

Quoted 40 lines

This would allow not just kallsyms access via $guest/proc/kallsyms but also gives us the full space of symbol features: access to the guest binaries for annotation and general symbol resolution, command/binary name identification, etc.

Such a mount would obviously not broaden existing privileges - and as an additional control a guest would also have a way to indicate that it does not wish a guest mount at all.

Unfortunately, in a previous thread the Qemu maintainer has indicated that he will essentially NAK any attempt to enhance Qemu to provide an easily discoverable, self-contained, transparent guest mount on the host side.

No technical justification was given for that NAK, despite my repeated requests to particulate the exact security problems that such an approach would cause.

If that NAK does not stand in that form then i'd like to know about it - it makes no sense for us to try to code up a solution against a standing maintainer NAK ...

The other option is some sysadmin level hackery to NFS-mount the guest or so. This is a vastly inferior method that brings us back to the absymal usability levels of OProfile:

1) it wont be guest transparent
2) has to be re-done for every guest image.
3) even if packaged it has to be gotten into every. single. Linux. distro. separately.
4) old Linux guests wont work out of box

In other words: it's very inconvenient on multiple levels and wont ever happen on any reasonable enough scale to make a difference to Linux.

Which is an unfortunate situation - and the ball is on the KVM/Qemu side so i can do little about it.

Thanks,

Ingo

#359 lore raw
In reply to Ingo Molnar
Quoted 4 lines · Ingo Molnar

Having access to the actual executable files that include the symbols achieves precisely that - with the additional robustness that all this functionality is concentrated into the host, while the guest side is kept minimal (and transparent).

If you want to access the guests file-system you need a piece of software running in the guest which gives you this access. But when you get an event this piece of software may not be runnable (if the guest is in an interrupt handler or any other non-preemptible code path). When the host finally gets access to the guests filesystem again the source of that event may already be gone (process has exited, module unloaded...). The only way to solve that is to pass the event information to the guest immediatly and let it collect the information we want.

Quoted 2 lines

It can decide whether it exposes the files. Nor are there any "security issues" to begin with.

I am not talking about security. Security was sufficiently flamed about already.

Quoted 2 lines

You need to be aware of the fact that symbol resolution is a separate step from call chain generation.

Same concern as above applies to call-chain generation too.

Quoted 5 lines
Quoted 3 lines

How we speak to the guest was already discussed in this thread. My personal opinion is that going through qemu is an unnecessary step and we can solve that more clever and transparent for perf.

Meaning exactly what?

Avi was against that but I think it would make sense to give names to virtual machines (with a default, similar to network interface names). Then we can create a directory in /dev/ with that name (e.g. /dev/vm/fedora/). Inside the guest a (priviledged) process can create some kind of named virt-pipe which results in a device file created in the guests directory (perf could create /dev/vm/fedora/perf for example). This file is used for guest-host communication.

Thanks,

Joerg

#360 lore raw
Quoted 4 lines · oerg Roedel
Quoted 2 lines

It can decide whether it exposes the files. Nor are there any "security issues" to begin with.

I am not talking about security. [...]

You were talking about security, in the portion of your mail that you snipped out, and which i replied to:

Quoted 2 lines
Quoted 2 lines

2. The guest can decide for its own if it want to pass this inforamtion to the host-perf. No security issues at all.

I understood that portion to mean what it says: that your claim that your proposal 'has no security issues at all', in contrast to my suggestion.

Quoted 1 line

[...] Security was sufficiently flamed about already.

All i saw was my suggestion to allow a guest to securely (and scalably and conveniently) integrate/mount its filesystems to the host if both sides (both the host and the guest) permit it, to make it easier for instrumentation to pick up symbol details.

I.e. if a guest runs then its filesystem may be present on the host side as:

/guests/Fedora-G1/
/guests/Fedora-G1/proc/
/guests/Fedora-G1/usr/
/guests/Fedora-G1/.../

( This feature would be configurable and would be default-off, to maintain the
current status quo. )

i.e. it's a bit like sshfs or NFS or loopback block mounts, just in an integrated and working fashion (sshfs doesnt work well with /proc for example) and more guest transparent (obviously sshfs or NFS exports need per guest configuration), and lower overhead than sshfs/NFS - i.e. without the (unnecessary) networking overhead.

That suggestion was 'countered' by an unsubstantiated claim by Anthony that this kind of usability feature would somehow be a 'security nighmare'.

In reality it is just an incremental, more usable, faster and more guest-transparent form of what is already possible today via:

- loopback mounts on host
- NFS exports
- SMB exports
- sshfs
- (and other mechanisms)

I wish there was at least flaming about it - as flames tend to have at least some specifics in them.

What i saw instead was a claim about a 'security nightmare', which was, when i asked for specifics, was followed by deafening silence. And you appear to have repeated that claim here, unwilling to back it up with specifics.

Thanks,

Ingo

#361 lore raw
In reply to oerg Roedel
Quoted 6 lines · oerg Roedel
Quoted 4 lines · Ingo Molnar

Having access to the actual executable files that include the symbols achieves precisely that - with the additional robustness that all this functionality is concentrated into the host, while the guest side is kept minimal (and transparent).

Quoted 8 lines

If you want to access the guests file-system you need a piece of software running in the guest which gives you this access. But when you get an event this piece of software may not be runnable (if the guest is in an interrupt handler or any other non-preemptible code path). When the host finally gets access to the guests filesystem again the source of that event may already be gone (process has exited, module unloaded...). The only way to solve that is to pass the event information to the guest immediatly and let it collect the information we want.

The very same is true of profiling in the host space as well (KVM is nothing special here, other than its unreasonable insistence on not enumerating readily available information in a more usable way).

So are you suggesting a solution to a perf problem we already solved differently? (and which i argue we solved in a better way)

We have solved that in the host space already (and quite elaborately so), and not via your suggestion of moving symbol resolution to a different stage, but by properly generating the right events to allow the post-processing stage to see processes that have already exited, to robustly handle files that have been rebuilt, etc.

Quoted 1 line

From an instrumentation POV it is fundamentally better to acquire the right

data and delay any complexities to the analysis stage (the perf model) than to complicate sampling (the oprofile dcookies model).

Your proposal of 'doing the symbol resolution in the guest context' is in essence re-arguing that very similar point that oprofile lost. Did you really intend to re-argue that point as well? If yes then please propose an alternative implementation for everything that perf does wrt. symbol lookups.

What we propose for 'perf kvm' right now is simply a straight-forward extension of the existing (and well working) symbol handling code to virtualization.

Quoted 4 lines
Quoted 2 lines

You need to be aware of the fact that symbol resolution is a separate step from call chain generation.

Same concern as above applies to call-chain generation too.

Best would be if you demonstrated any problems of the perf symbol lookup code you are aware of on the host side, as it has that exact design you are criticising here. We are eager to fix any bugs in it.

If you claim that it's buggy then that should very much be demonstratable - no need to go into theoretical arguments about it.

( You should be aware of the fact that perf currently works with 'processes
exiting prematurely' and similar scenarios just fine, so if you want to demonstrate that it's broken you will probably need a different example. )

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

How we speak to the guest was already discussed in this thread. My personal opinion is that going through qemu is an unnecessary step and we can solve that more clever and transparent for perf.

Meaning exactly what?

Quoted 7 lines

Avi was against that but I think it would make sense to give names to virtual machines (with a default, similar to network interface names). Then we can create a directory in /dev/ with that name (e.g. /dev/vm/fedora/). Inside the guest a (priviledged) process can create some kind of named virt-pipe which results in a device file created in the guests directory (perf could create /dev/vm/fedora/perf for example). This file is used for guest-host communication.

That is kind of half of my suggestion - the built-in enumeration guests and a guaranteed channel to them accessible to tools. (KVM already has its own special channel so it's not like channels of communication are useless.)

The other half of my suggestion is that if we bring this thought to its logical conclusion then we might as well walk the whole mile and not use quirky, binary API single-channel pipes. I.e. we could use this convenient, human-readable, structured, hierarchical abstraction to expose information in a finegrained, scalable way, which has a world-class implementation in Linux:
the 'VFS namespace'.

Thanks,

Ingo

#139 lore raw

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

In reply to Ingo Molnar
Quoted 1 line · Ingo Molnar

Lets see one example of that thought process in action: Oprofile.

Since you are talking so much about oProfile in this thread I think it is important to mention that the problem with oProfile was not the repository separation.

The problem was (and is) that the kernel and the user-space parts are maintained by different people who dont talk to each other or have a direction where they want to go with the project. Basically the reason of the oProfile failure is a disfunctional community. I told the kernel-maintainer several times to also maintain user-space but he didn't want that.

The situation with KVM is entirely different. Avi commits to kvm.git and qemu-kvm.git so he maintains both. Anthony is working to integrate the qemu-kvm changes into upstream qemu. Further these people work very closely together and the community around KVM works well too. The problems that oProfile has are not even in sight for KVM.

Joerg

#172 lore raw

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

In reply to Avi Kivity
Quoted 15 lines · Avi Kivity
Quoted 14 lines · Ingo Molnar
Quoted 12 lines · Avi Kivity
Quoted 8 lines · Ingo Molnar

Of course you could say the following:

' Thanks, I'll mark this for v2.6.36 integration. Note that we are not
able to add this to the v2.6.35 kernel queue anymore as the ongoing usability work already takes up all of the project's maintainer and testing bandwidth. If you want the feature to be merged sooner than that then please help us cut down on the TODO and BUGS list that can be found at XYZ. There's quite a few low hanging fruits there. '

That would be shooting at my own foot as well as the contributor's since I badly want that RCU stuff, and while a GUI would be nice, that itch isn't on my back.

Quoted 6 lines
Quoted 2 lines

I think this sums up the root cause of all the problems i see with KVM pretty well.

I think we agree at last. Neither I nor my employer are interested in running qemu as a desktop-on-desktop tool, therefore I don't invest any effort in that direction, or require it from volunteers.

Obviously your employer at least in part defers to you when it comes to KVM priorities.

So, just to make this really clear, _you_ are not interested in running qemu as a desktop-on-desktop tool, subsequently this kind of disinterest-for-desktop-usability trickled through the whole KVM stack and poisoned your attitude and your contributor's attitude.

Too sad really and it's doubly sad that you dont feel anything wrong about that.

Quoted 2 lines

If you think a good GUI is so badly needed, either write one yourself, or convince someone else to do it.

To a certain degree we are trying to do a small bit of that (see this very thread) - and you are NAK-ing and objecting the heck out of it via your unreasonable microkernelish and server-centric views.

With constant maintainer disinterest there's no wonder a non-desktop-oriented KVM becomes a self-fulfilling prophecy: you think the desktop does not matter, hence it becomes a reality in KVM space which you can constantly refer back to as a 'fact'.

Which i find dishonest and disingenious at best.

Quoted 6 lines

(btw, why are you interested in desktop-on-desktop? one use case is developers, which don't really need fancy GUIs; a second is people who test out distributions, but that doesn't seem to be a huge population; and a third is people running Windows for some application that doesn't run on Linux - hopefully a small catergory as well. Seems to be quite a small target audience, compared to, say, video editing)

I'm interested in desktop-on-desktop because i walk this world with open eyes and i care about Linux, and these days qemu-kvm is the first thing a new Linux user sees about Linux virtualization. I've observed several people i know in person to turn away from Linux and go back to Windows or go over to Apple because they had a much more mature solution.

I'd probably turn away from Linux myself if i were a newbie and if i were forced to use KVM on the desktop today.

Again, you dont seem to realize that you as a maintainer are at a central point where you have the ability to turn the self-fulfilling prophecy that 'nobody cares about the Linux desktop' into a reality - or where you have the ability to prevent it from happening. It is hugely harmful process, especially as you seem to delude yourself that you have nothing to do with it.

Anyway, it's good you expressed your views about this as this will help the chances of a fresh restart. (which chances are still not too good though)

Thanks,

Ingo

#173 lore raw

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

Quoted 28 lines · Ingo Molnar
Quoted 15 lines · Avi Kivity
Quoted 14 lines · Ingo Molnar
Quoted 12 lines · Avi Kivity
Quoted 8 lines · Ingo Molnar

Of course you could say the following:

' Thanks, I'll mark this for v2.6.36 integration. Note that we are not
able to add this to the v2.6.35 kernel queue anymore as the ongoing usability work already takes up all of the project's maintainer and testing bandwidth. If you want the feature to be merged sooner than that then please help us cut down on the TODO and BUGS list that can be found at XYZ. There's quite a few low hanging fruits there. '

That would be shooting at my own foot as well as the contributor's since I badly want that RCU stuff, and while a GUI would be nice, that itch isn't on my back.

Quoted 6 lines
Quoted 2 lines

I think this sums up the root cause of all the problems i see with KVM pretty well.

I think we agree at last. Neither I nor my employer are interested in running qemu as a desktop-on-desktop tool, therefore I don't invest any effort in that direction, or require it from volunteers.

Obviously your employer at least in part defers to you when it comes to KVM priorities.

Quoted 7 lines

So, just to make this really clear, _you_ are not interested in running qemu as a desktop-on-desktop tool, subsequently this kind of disinterest-for-desktop-usability trickled through the whole KVM stack and poisoned your attitude and your contributor's attitude.

Too sad really and it's doubly sad that you dont feel anything wrong about that.

Please, don't jump to unjust conclusions.

The whole point is that there's no money behind desktop-on-desktop virtualization. Thus nobody pays people to work on it. Thus nothing significant happens in that space.

If there was someone standing up to create a really decent desktop qemu front-end I'm confident we'd even officially suggest using that. In fact, that whole discussion did come up in the weekly Qemu/KVM community call and everybody agreed heavily that we do need a desktop client.

The problem is just that there is nobody standing up. And I hope you don't expect Avi to be the one creating a GUI.

Alex

#131 lore raw

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

In reply to Avi Kivity
Quoted 5 lines · Avi Kivity

IMO the reason perf is more usable than oprofile has less to do with the kernel/userspace boundary and more do to with effort and attention spent on the userspace/user boundary.

[...]

If you are interested in the first-hand experience of the people who are doing the perf work then here it is: by far the biggest reason for perf success and perf usability is the integration of the user-space tooling with the kernel-space bits, into a single repository and project.

The very move you are opposing so vehemently for KVM.

Oprofile went the way you proposed, and it was a failure. It failed not because it was bad technology (it was pretty decent and people used it), it was not a failure because the wrong people worked on it (to the contrary, very capable people worked on it), it was a failure in hindsight because it simply incorrectly split into two projects which stiffled the progress of each other.

Obviously 3 years ago you'd have seen a similar, big "Oprofile is NOT broken!" flamewar, had i posted the same observations about Oprofile that i expressed about KVM here. (In fact there was a similar, big flamewar about all this when perf was posted a year ago.)

And yes, (as you are aware of) i see very similar patterns of inefficiency in the KVM/Qemu tooling relationship as well, hence did i express my views about it.

Thanks,

Ingo

#122 lore raw

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

In reply to Avi Kivity
Quoted 17 lines · Avi Kivity
Quoted 7 lines · Ingo Molnar
Quoted 3 lines

That includes the guest kernel. If you can deploy a new kernel in the guest, presumably you can deploy a userspace package.

Note that with perf we can instrument the guest with zero guest-kernel modifications as well.

Quoted 8 lines

We try to reduce the guest impact to a bare minimum, as the difficulties in deployment are function of the cross section surface to the guest.

Also, note that the kernel is special with regards to instrumentation:
since this is the kernel project, we are doing kernel space changes, as we are doing them _anyway_. So adding symbol resolution capabilities would be a minimal addition to that - while adding a while new guest package for the demon would significantly increase the cross section surface.

Quoted 4 lines

It's true that for us, changing the kernel is easier than changing the rest of the guest. IMO we should still resist the temptation to go the easy path and do the right thing (I understand we disagree about what the right thing is).

It is not about the 'temptation to go the easy path'.

It is about finding the most pragmatic approach and realizing the cost of
inaction: sucky Linux, sucky KVM.

Let me give you an example: Linus's commit in v2.6.30 that changed the user-space policy of the EXT3 filesystem to make it more desktop capable:

bbae8bc: ext3: make default data ordering mode configurable

That changes was opposed vehemently with your kind of arguments: "such changes should be done by the distributions", "it should be done correctly", "the kernel should not implement policy", etc..

I can also tell you that this commit improved my desktop experience incredibly. Still, distros didnt do it for almost a decade of ext3 existence. Why?

Truth is that those kinds of "do it right" arguments are mistaken because they assume that we live in an ideal, 'perfect market' where all inefficiencies will get eliminated in the long run.

In reality the "market" for OSS software is imperfect:

- there's marginal costs of action - a too small change has difficulty getting over that

- there's costs of modularization (which are both technical and social)

- there's the power of the status quo acting against marginally good changes

- there's the power of entropy ripping Linux distributions apart making all-distro changes harder

So the solution to the "why dont the distributions do this" question you pose is exactly what i propose: _give a default, reference implementation of KVM tooling that has to be eclipsed_.

There's the unique position of the kernel that it can impose sanity in a more central way which acts as a reference implementation.

I.e. the kernel can very much improve quality all across the board by providing a sane default (in the ext3 case) - or, as in the case of perf, by providing a sane 'baseline' tooling. It should do the same for KVM as well.

If we dont do that, Linux will eventually stop mattering on the desktop - and some time after that, it will vanish from the server space as well. Then, may it be a decade down the line, you wont have a KVM hacking job left, and you wont know where all those forces eliminating your project came from.

But i told you now so you'll know ;-)

Reality is, the server space never was and never will be self-sustaining in the long run (as Novell has found it out with Netware), it is the desktop that dictates future markets. This is why i find your views about this naive and shortsighted.

Thanks,

Ingo

#362 lore raw
In reply to Ingo Molnar
Quoted 6 lines · Ingo Molnar

Best would be if you demonstrated any problems of the perf symbol lookup code you are aware of on the host side, as it has that exact design you are criticising here. We are eager to fix any bugs in it.

If you claim that it's buggy then that should very much be demonstratable - no need to go into theoretical arguments about it.

I am not claiming anything. I just try to imagine how your proposal will look like in practice and forgot that symbol resolution is done at a later point.
But even with defered symbol resolution we need more information from the guest than just the rip falling out of KVM. The guest needs to tell us about the process where the event happened (information that the host has about itself without any hassle) and which executable-files it was loaded from.

Quoted 12 lines
Quoted 7 lines

Avi was against that but I think it would make sense to give names to virtual machines (with a default, similar to network interface names). Then we can create a directory in /dev/ with that name (e.g. /dev/vm/fedora/). Inside the guest a (priviledged) process can create some kind of named virt-pipe which results in a device file created in the guests directory (perf could create /dev/vm/fedora/perf for example). This file is used for guest-host communication.

That is kind of half of my suggestion - the built-in enumeration guests and a guaranteed channel to them accessible to tools. (KVM already has its own special channel so it's not like channels of communication are useless.)

Quoted 6 lines

The other half of my suggestion is that if we bring this thought to its logical conclusion then we might as well walk the whole mile and not use quirky, binary API single-channel pipes. I.e. we could use this convenient, human-readable, structured, hierarchical abstraction to expose information in a finegrained, scalable way, which has a world-class implementation in Linux:
the 'VFS namespace'.

Probably. At least it is the solution that fits best into the current design of perf. But we should think about how this will be done. Raw disk access is no solution because we need to access virtual file-systems of the guest too. Network filesystems may be a solution but then we come back to the 'deployment-nightmare'.

Joerg

#104 lore raw

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

In reply to Avi Kivity
Quoted 6 lines · Avi Kivity
Quoted 3 lines

My 10+ years experience with kernel instrumentation solutions is that kernel-driven, self-sufficient, robust, trustable, well-enumerated sources of information work far better in practice.

What about line number information? And the source? Into the kernel with them as well?

Sigh. Please read the _very first_ suggestion i made, which solves all that. I rarely go into discussions without suggesting technical solutions - i'm not interested in flaming, i'm interested in real solutions.

Here it is, repeated for the Nth time:

Allow a guest to (optionally) integrate its VFS namespace with the host side as well. An example scheme would be:

/guests/Fedora-G1/
/guests/Fedora-G1/proc/
/guests/Fedora-G1/usr/
/guests/Fedora-G1/.../
/guests/OpenSuse-G2/
/guests/OpenSuse-G2/proc/
/guests/OpenSuse-G2/usr/
/guests/OpenSuse-G2/.../

( This feature would be configurable and would be default-off, to maintain
the current status quo. )

Line number information and the source (dwarf info) and ELF symbols are all provided and accessible via such an interface - no need to run any 'symbol demon' on the guest side.

And, obviously, having the guest VFS namespace (optionally) available on the host side also has far more uses than perf's symbol needs.

I was surprised no-one ever came up with such a suggestion - it is so obvious to allow the integration of the VFS namespaces. But given your explicit declaration of your KVM desktop usability indifference i'm kind of not surprised about that anymore.

Thanks,

Ingo

#170 lore raw

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

In reply to Anthony Liguori
Quoted 15 lines · Anthony Liguori
Quoted 14 lines · Ingo Molnar
Quoted 12 lines · Avi Kivity
Quoted 8 lines · Ingo Molnar

Of course you could say the following:

' Thanks, I'll mark this for v2.6.36 integration. Note that we are not
able to add this to the v2.6.35 kernel queue anymore as the ongoing usability work already takes up all of the project's maintainer and testing bandwidth. If you want the feature to be merged sooner than that then please help us cut down on the TODO and BUGS list that can be found at XYZ. There's quite a few low hanging fruits there. '

That would be shooting at my own foot as well as the contributor's since I badly want that RCU stuff, and while a GUI would be nice, that itch isn't on my back.

Quoted 6 lines
Quoted 2 lines

I think this sums up the root cause of all the problems i see with KVM pretty well.

A good maintainer has to strike a balance between asking more of people than what they initially volunteer and getting people to implement the less fun things that are nonetheless required. [...]

Sorry to be blunt, but i dont think there's a different way to say it: i am a user of the software you are maintaining (Qemu) and i dont think you have the basis to educate people about what a good maintainer should do to achieve a quality end result.

I think you could/should learn much from Linus and others who very much require quality to permeate the full dimension of a contribution (including usability), beyond the narrow, local scope of the contribution.

Thanks,

Ingo

#119 lore raw

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

In reply to Avi Kivity

[snip]

Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

I believe that -kernel use will be rare, though. It's a lot
easier to keep everything in one filesystem.

Well, for what it's worth, I rarely ever use anything else. My virtual disks are raw so I can loop mount them easily, and I can also switch my guest kernels from outside... without ever needing to mount those disks.

Curious, what do you use them for?

Various things, here is one use case which I think is under-used: read-only virtual disks with just one network application on them (no runlevels, sshd, user accounts, etc), a hell of a lot easier to maintain and secure than a full blown distro. Want a new kernel? boot a new VM and swap it for the old one with zero downtime (if your network app supports this sort of hot-swap - which a lot of cluster apps do)

Another reason for wanting to keep the kernel outside is to limit the potential points of failure: remove the partition table, remove the bootloader, remove even the ramdisk. Also makes it easier to switch to another solution (say UML) or another disk driver (as someone mentioned previously). In virtualized environments I often prefer to remove the ability to load kernel modules too, for obvious reasons.

Hope this helps.

Antoine

#140 lore raw

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

In reply to oerg Roedel
Quoted 9 lines · oerg Roedel
Quoted 1 line · Ingo Molnar

Lets see one example of that thought process in action: Oprofile.

Since you are talking so much about oProfile in this thread I think it is important to mention that the problem with oProfile was not the repository separation.

The problem was (and is) that the kernel and the user-space parts are maintained by different people [...]

Caused by: repository separation and the inevitable code and social fork a decade later.

Quoted 2 lines

[...] who dont talk to each other or have a direction where they want to go with the project. [...]

Caused by: repository separation and the inevitable code and social fork a decade later.

Quoted 2 lines

[...] Basically the reason of the oProfile failure is a disfunctional community. [...]

Caused by: repository separation and the inevitable code and social fork a decade later.

Quoted 5 lines

[...] I told the kernel-maintainer several times to also maintain user-space but he didn't want that.

The situation with KVM is entirely different. Avi commits to kvm.git and qemu-kvm.git so he maintains both. [...]

What you fail to realise (or what you fail to know, you werent around when Oprofile was written, i was) is that Oprofile _did_ have a functional single community when it was written. The tooling and the kernel bits was written by the same people.

But a decade is a long time and the drift happened due to the inevitability of the repository separation, and due to the _inability_ to reach a sane, usable solution within that framework of separation.

So i dont see much of a difference to the Oprofile situation really and i see many parallels. I also see similar kinds of desktop usability problems.

The difference is that we dont have KVM with a decade of history and we dont have a 'told you so' KVM reimplementation to show that proves the point. I guess it's a matter of time before that happens, because Qemu usability is so absymal today - so i guess we should suspend any discussions until that happens, no need to waste time on arguing hypoteticals.

I think you are rationalizing the status quo.

It's as if you argued in 1990 that the unification of East and West Germany wouldnt make much sense because despite clear problems and incompatibilites and different styles westerners were still allowed to visit eastern relatives and they both spoke the same language after all ;-)

Thanks,

Ingo

#363 lore raw
In reply to Joerg Roedel
Quoted 8 lines · Joerg Roedel
Quoted 6 lines · Ingo Molnar

Best would be if you demonstrated any problems of the perf symbol lookup code you are aware of on the host side, as it has that exact design you are criticising here. We are eager to fix any bugs in it.

If you claim that it's buggy then that should very much be demonstratable - no need to go into theoretical arguments about it.

Quoted 8 lines

I am not claiming anything. I just try to imagine how your proposal will look like in practice and forgot that symbol resolution is done at a later point.

But even with defered symbol resolution we need more information from the guest than just the rip falling out of KVM. The guest needs to tell us about the process where the event happened (information that the host has about itself without any hassle) and which executable-files it was loaded from.

Correct - for full information we need a good paravirt perf integration of the kernel bits to pass that through. (I.e. we want to 'integrate' the PID space as well, at least within the perf notion of PIDs.)

Initially we can do without that as well.

Quoted 4 lines

Probably. At least it is the solution that fits best into the current design of perf. But we should think about how this will be done. Raw disk access is no solution because we need to access virtual file-systems of the guest too. [...]

I never said anything about 'raw disk access'. Have you seen my proposal of (optional) VFS namespace integration? (It can be found repeated the Nth time in my mail you replied to)

Thanks,

Ingo

#175 lore raw

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

In reply to Ingo Molnar
Quoted 8 lines · Ingo Molnar
Quoted 5 lines

I think we agree at last. Neither I nor my employer are interested in running qemu as a desktop-on-desktop tool, therefore I don't invest any effort in that direction, or require it from volunteers.

Obviously your employer at least in part defers to you when it comes to KVM priorities.

In part, yes.

Quoted 5 lines

So, just to make this really clear, _you_ are not interested in running qemu as a desktop-on-desktop tool, subsequently this kind of disinterest-for-desktop-usability trickled through the whole KVM stack and poisoned your attitude and your contributor's attitude.

I am also disinterested in ppc virtualization, yet it happened. I am disinterested in ia64 virtualization, yet it happened. I am disinterested in s390 virtualization, yet it happened.

Linus doesn't care about virtualization, yet it happened.

I don't tell my contributor what to be interested in, only whether their patches are good or not. I can tell you that Red Hat contributors don't work on a desktop kvm GUI not because I discourage them, but because the product we are working on does not contain a desktop kvm GUI. Jan Kiszka contributed a lot of debugger features, fixes, and improvement, presumably he and/or his employer need that more than a kvm desktop GUI.

I can't see why you see anything wrong with this. People write patches for their own interest, not yours or mine.

Quoted 3 lines

Too sad really and it's doubly sad that you dont feel anything wrong about that.

It would be lovely to have a desktop kvm GUI. I don't feel I have to write it myself or compel others to write it. I don't feel sad about it.

Quoted 7 lines
Quoted 3 lines

If you think a good GUI is so badly needed, either write one yourself, or convince someone else to do it.

To a certain degree we are trying to do a small bit of that (see this very thread) - and you are NAK-ing and objecting the heck out of it via your unreasonable microkernelish and server-centric views.

The perf bits have nothing to do with a GUI or usability for general users. Calling them "unreasonable microkernelish sever-centric views" is just a way of not addressing them.

Quoted 5 lines

With constant maintainer disinterest there's no wonder a non-desktop-oriented KVM becomes a self-fulfilling prophecy: you think the desktop does not matter, hence it becomes a reality in KVM space which you can constantly refer back to as a 'fact'.

It's a fact that virtualization is happening in the data center, not on the desktop. You think a kvm GUI can become a killer application? fine, write one. You don't need any consent from me as kvm maintainer (if patches are needed to kvm that improve the desktop experience, I'll accept them, though they'll have to pass my unreasonable microkernelish filters). If you're right then the desktop kvm GUI will be a huge hit with zillions of developers and people will drop Windows and switch to Linux just to use it.

But my opinion is that it will end up like virtualbox, a nice app that you can use to run Windows-on-Linux, but is not all that useful.

Quoted 2 lines

Which i find dishonest and disingenious at best.

If you're going to use words like 'dishonest' then please don't send me any more email.

Quoted 7 lines
Quoted 7 lines

(btw, why are you interested in desktop-on-desktop? one use case is developers, which don't really need fancy GUIs; a second is people who test out distributions, but that doesn't seem to be a huge population; and a third is people running Windows for some application that doesn't run on Linux - hopefully a small catergory as well. Seems to be quite a small target audience, compared to, say, video editing)

Quoted 6 lines

I'm interested in desktop-on-desktop because i walk this world with open eyes and i care about Linux, and these days qemu-kvm is the first thing a new Linux user sees about Linux virtualization. I've observed several people i know in person to turn away from Linux and go back to Windows or go over to Apple because they had a much more mature solution.

Which distribution are they using? Most people would see virt-manager as the first thing, not open gnome-terminal and start typing in the qemu command line. While it's not perfect, it does have a shiny GUI with lots of tabs and buttons.

Quoted 9 lines

I'd probably turn away from Linux myself if i were a newbie and if i were forced to use KVM on the desktop today.

Again, you dont seem to realize that you as a maintainer are at a central point where you have the ability to turn the self-fulfilling prophecy that 'nobody cares about the Linux desktop' into a reality - or where you have the ability to prevent it from happening. It is hugely harmful process, especially as you seem to delude yourself that you have nothing to do with it.

It doesn't have to be me. Better to pick someone who has a clue about usability to design and guide this effort. That someone can work on qemu, or if they prefer, tools/kvm (we worked hard to avoid making kvm tied to a single userspace).

The kvm toolstack is maintained by multiple people - Marcelo and myself at the kernel level, Anthony and the other qemu maintainers at the qemu single-guest level, Daniel Veillard and Dan Berrange at the libvirt or host level, and Cole Robinson at the virt-manager or GUI level. It's unreasonable to ask one person to do all of this, just like Linus doesn't maintain the scheduler even though it is so important.

Quoted 3 lines

Anyway, it's good you expressed your views about this as this will help the chances of a fresh restart. (which chances are still not too good though)

All that's needed is to find someone with the skills, time, and interest.

Signature · 1 line
error compiling committee.c: too many arguments to function
#105 lore raw

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

In reply to Ingo Molnar
Quoted 21 lines · Ingo Molnar
Quoted 2 lines

What about line number information?  And the source?  Into the kernel with them as well?

Sigh. Please read the _very first_ suggestion i made, which solves all that. I rarely go into discussions without suggesting technical solutions - i'm not interested in flaming, i'm interested in real solutions.

Here it is, repeated for the Nth time:

Allow a guest to (optionally) integrate its VFS namespace with the host side as well. An example scheme would be:

  /guests/Fedora-G1/
  /guests/Fedora-G1/proc/
  /guests/Fedora-G1/usr/
  /guests/Fedora-G1/.../
  /guests/OpenSuse-G2/
  /guests/OpenSuse-G2/proc/
  /guests/OpenSuse-G2/usr/
  /guests/OpenSuse-G2/.../

Quoted 2 lines

 ( This feature would be configurable and would be default-off, to maintain the current status quo. )

Heh, funny. That would also solve my number one gripe with virtualization these days: how to get files in and out of guests without having to install extra packages on the guest side and fiddling with mount points on every single guest image I want to play with.

Pekka

#174 lore raw

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

In reply to Alexander Graf

Am Montag, den 22.03.2010, 12:23 +0100 schrieb Alexander Graf:

Quoted 21 lines
Quoted 7 lines
Quoted 3 lines

I think we agree at last. Neither I nor my employer are interested in running qemu as a desktop-on-desktop tool, therefore I don't invest any effort in that direction, or require it from volunteers.

Obviously your employer at least in part defers to you when it comes to KVM priorities.

Quoted 7 lines

So, just to make this really clear, _you_ are not interested in running qemu as a desktop-on-desktop tool, subsequently this kind of disinterest-for-desktop-usability trickled through the whole KVM stack and poisoned your attitude and your contributor's attitude.

Too sad really and it's doubly sad that you dont feel anything wrong about that.

Please, don't jump to unjust conclusions.

The whole point is that there's no money behind desktop-on-desktop virtualization. Thus nobody pays people to work on it. Thus nothing significant happens in that space.

Quoted 8 lines

If there was someone standing up to create a really decent desktop qemu front-end I'm confident we'd even officially suggest using that. In fact, that whole discussion did come up in the weekly Qemu/KVM community call and everybody agreed heavily that we do need a desktop client.

The problem is just that there is nobody standing up. And I hope you don't expect Avi to be the one creating a GUI.

Besides, Ingo could just go ahead and use libvirt together with virt-manager. It solves a few of the usability issues he came up with somewhere in this thread, is available even in every current distribution, and *actually* works quite well for the desktop usecase. It just desparatly needs more brainpower and manpower to make it a competitor to VirtualBox & Co, because its not as polished and featurecomplete yet. But I bet virt-managers maintainers welcome patches to fix and enhance usability. Most of the needed fixes probably wouldn't touch qemu at all, let alone kvm.

Sorry to chime in with my opinion, but this whole thread is incredibly boring and full of non-arguments yet really highly amusing.

Signature · 1 line
Lukas
#116 lore raw

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

In reply to Ingo Molnar
Quoted 14 lines · Ingo Molnar
Quoted 7 lines · Avi Kivity
Quoted 4 lines

My 10+ years experience with kernel instrumentation solutions is that kernel-driven, self-sufficient, robust, trustable, well-enumerated sources of information work far better in practice.

What about line number information? And the source? Into the kernel with them as well?

Sigh. Please read the _very first_ suggestion i made, which solves all that. I rarely go into discussions without suggesting technical solutions - i'm not interested in flaming, i'm interested in real solutions.

Quoted 7 lines

Here it is, repeated for the Nth time:

Allow a guest to (optionally) integrate its VFS namespace with the host side as well. An example scheme would be:

    /guests/Fedora-G1/

[...]

You're missing something. This sub-thread is about someone launching a kernel with 'qemu -kernel', the kernel lives outside the guest disk image, they don't want a custom initrd because it's hard to make.

Signature · 1 line
error compiling committee.c: too many arguments to function
#106 lore raw

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

In reply to Pekka Enberg
Quoted 22 lines · Pekka Enberg
Quoted 21 lines · Ingo Molnar
Quoted 2 lines

What about line number information?  And the source?  Into the kernel with them as well?

Sigh. Please read the _very first_ suggestion i made, which solves all that. I rarely go into discussions without suggesting technical solutions - i'm not interested in flaming, i'm interested in real solutions.

Here it is, repeated for the Nth time:

Allow a guest to (optionally) integrate its VFS namespace with the host side as well. An example scheme would be:

  /guests/Fedora-G1/
  /guests/Fedora-G1/proc/
  /guests/Fedora-G1/usr/
  /guests/Fedora-G1/.../
  /guests/OpenSuse-G2/
  /guests/OpenSuse-G2/proc/
  /guests/OpenSuse-G2/usr/
  /guests/OpenSuse-G2/.../

Quoted 8 lines
Quoted 2 lines

 ( This feature would be configurable and would be default-off, to maintain the current status quo. )

Heh, funny. That would also solve my number one gripe with virtualization these days: how to get files in and out of guests without having to install extra packages on the guest side and fiddling with mount points on every single guest image I want to play with.

FYI, for offline guests, you can use libguestfs[1] to access & change files inside the guest, and read-only access to running guests files. It provides access via a interactive shell, APIs in all major languages, and also has a FUSE mdule to expose it directly in the host VFS. It could probably be made to work read-write for running guests too if its agent were installed inside the guest & leverage the new Virtio-Serial channel for comms (avoiding any network setup requirements).

Regards,
Daniel

[1] http://libguestfs.org/

Signature · 4 lines
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
#176 lore raw

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

In reply to Avi Kivity
Quoted 15 lines · Avi Kivity
Quoted 6 lines · Ingo Molnar
Quoted 4 lines

I think we agree at last. Neither I nor my employer are interested in running qemu as a desktop-on-desktop tool, therefore I don't invest any effort in that direction, or require it from volunteers.

Obviously your employer at least in part defers to you when it comes to KVM priorities.

In part, yes.

Quoted 4 lines

So, just to make this really clear, _you_ are not interested in running qemu as a desktop-on-desktop tool, subsequently this kind of disinterest-for-desktop-usability trickled through the whole KVM stack and poisoned your attitude and your contributor's attitude.

Quoted 5 lines

I am also disinterested in ppc virtualization, yet it happened. I am disinterested in ia64 virtualization, yet it happened. I am disinterested in s390 virtualization, yet it happened.

Linus doesn't care about virtualization, yet it happened.

You should know the answer yourself: the difference is that usability is a core quality of any project.

I as a maintainer can be neutral towards a number of features and patch attributes that i dont consider key aspects. (although they can grow out to become key features in the future. SMP was a fringe thing 15 years ago.)

Usability is not an attribute you can ignore and i for sure am never neutral towards usability deficiencies in patches - i consider usability a key quality.

Quoted 2 lines

I don't tell my contributor what to be interested in, only whether their patches are good or not. [...]

Whether a feature is usable or not is sure a metric of 'goodness'.

You have restricted your metric of goodness artificially to not include usability. You do that by claiming that the user-space tooling of KVM, while being functionally absolutely essential for any user to even try out KVM, is 'separate' and has no quality connection with the kernel bits of KVM.

It is a convenient argument that allows you to do the kernel bits only. It is absolutely catastrophic to the user who'd like to see a usable solution and a single project who stands behind their tech.

Thus, _today_, after years of neglect, you can claim that none of the dozens of usability problems of KVM has anything to do with the features you are working on today. It's in a separate project (the so-called 'Qemu' package) after all - none of KVM's business.

In reality if you consider it a single project then those bugs were all usability problems introduced earlier on, years ago, when a piece of functionality was exposed via KVM. It adds up and now you claim they have nothing to do with current work.

This is why i consider that line of argument rather dishonest ...

Ingo

#107 lore raw

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

In reply to Daniel P. Berrange

Hi Daniel,

(I'm getting slightly off-topic, sorry about that.)

Daniel P. Berrange kirjoitti:

Quoted 22 lines
Quoted 14 lines
Quoted 14 lines

Here it is, repeated for the Nth time:

Allow a guest to (optionally) integrate its VFS namespace with the host side as well. An example scheme would be:

/guests/Fedora-G1/
/guests/Fedora-G1/proc/
/guests/Fedora-G1/usr/
/guests/Fedora-G1/.../
/guests/OpenSuse-G2/
/guests/OpenSuse-G2/proc/
/guests/OpenSuse-G2/usr/
/guests/OpenSuse-G2/.../

Quoted 7 lines
Quoted 2 lines

( This feature would be configurable and would be default-off, to maintain
the current status quo. )

Heh, funny. That would also solve my number one gripe with virtualization these days: how to get files in and out of guests without having to install extra packages on the guest side and fiddling with mount points on every single guest image I want to play with.

Quoted 7 lines

FYI, for offline guests, you can use libguestfs[1] to access & change files inside the guest, and read-only access to running guests files. It provides access via a interactive shell, APIs in all major languages, and also has a FUSE mdule to expose it directly in the host VFS. It could probably be made to work read-write for running guests too if its agent were installed inside the guest & leverage the new Virtio-Serial channel for comms (avoiding any network setup requirements).

Right. Thanks for the pointer.

The use case I am thinking of is working on an userspace project and wanting to test a piece of code on multiple distributions before pushing it out. That pretty much means being able to pull from the host git repository (or push to the guest repo) while the guest is running, maybe changing the code a bit and then getting the changes back to the host for the final push.

What I do now is I push the changes on the host side to a (private) remote branch and do the work through that. But that's pretty lame workaround in my opinion.

Pekka

#123 lore raw

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

In reply to Ingo Molnar
Quoted 5 lines · Ingo Molnar

Reality is, the server space never was and never will be self-sustaining in the long run (as Novell has found it out with Netware), it is the desktop that dictates future markets. This is why i find your views about this naive and shortsighted.

Yet Linux is gaining ground in the server and embedded space while struggling on the desktop. Apple is gaining ground on the desktop but is invisible on the server side (despite having a nice product - Xserve).

It's true Windows achieved server dominance through it's desktop power, but I don't think that's what keeping them there now.

In any case, I'm not going to write a kvm GUI. It doesn't match my skills, interest, or my employer's interest. If you wish to see a kvm GUI you have to write one yourself or convince someone to write it (perhaps convince Red Hat to fund such an effort beyond virt-manager).

Signature · 1 line
error compiling committee.c: too many arguments to function
#132 lore raw

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

In reply to Ingo Molnar
Quoted 7 lines · Ingo Molnar
Quoted 4 lines · Avi Kivity

IMO the reason perf is more usable than oprofile has less to do with the kernel/userspace boundary and more do to with effort and attention spent on the userspace/user boundary.

Quoted 7 lines
Quoted 2 lines

[...]

If you are interested in the first-hand experience of the people who are doing the perf work then here it is: by far the biggest reason for perf success and perf usability is the integration of the user-space tooling with the kernel-space bits, into a single repository and project.

Please take a look at the kvm integration code in qemu as a fraction of the whole code base.

Quoted 2 lines

The very move you are opposing so vehemently for KVM.

I don't want to fracture a working community.

Quoted 6 lines

Oprofile went the way you proposed, and it was a failure. It failed not because it was bad technology (it was pretty decent and people used it), it was not a failure because the wrong people worked on it (to the contrary, very capable people worked on it), it was a failure in hindsight because it simply incorrectly split into two projects which stiffled the progress of each other.

Every project that has some kernel footprint, except perf, is split like that. Are they all failures?

Seems like perf is also split, with sysprof being developed outside the kernel. Will you bring sysprof into the kernel? Will every feature be duplicated in prof and sysprof?

Signature · 1 line
error compiling committee.c: too many arguments to function
#117 lore raw

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

In reply to Avi Kivity
Quoted 6 lines · Avi Kivity
Quoted 6 lines

Here it is, repeated for the Nth time:

Allow a guest to (optionally) integrate its VFS namespace with the host side
as well. An example scheme would be:

Quoted 8 lines
Quoted 2 lines

   /guests/Fedora-G1/

[...]

You're missing something.  This sub-thread is about someone launching a kernel with 'qemu -kernel', the kernel lives outside the guest disk image, they don't want a custom initrd because it's hard to make.

Well, you know, I am missing your point here about initrd. Surely the guest kernels need to use sys_mount() at some point at which time they could just tell the host kernel where they can find the mount points? But maybe we're not talking about that kind of scenario here?

Pekka

#177 lore raw

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

In reply to Ingo Molnar
Quoted 2 lines · Ingo Molnar

This is why i consider that line of argument rather dishonest ...

I am not going to reply to any more email from you on this thread.

Signature · 1 line
error compiling committee.c: too many arguments to function
#108 lore raw

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

In reply to Daniel P. Berrange
Quoted 39 lines · Daniel P. Berrange
Quoted 22 lines · Pekka Enberg
Quoted 21 lines · Ingo Molnar
Quoted 2 lines

What about line number information? ?And the source? ?Into the kernel with them as well?

Sigh. Please read the _very first_ suggestion i made, which solves all that. I rarely go into discussions without suggesting technical solutions - i'm not interested in flaming, i'm interested in real solutions.

Here it is, repeated for the Nth time:

Allow a guest to (optionally) integrate its VFS namespace with the host side as well. An example scheme would be:

? /guests/Fedora-G1/
? /guests/Fedora-G1/proc/
? /guests/Fedora-G1/usr/
? /guests/Fedora-G1/.../
? /guests/OpenSuse-G2/
? /guests/OpenSuse-G2/proc/
? /guests/OpenSuse-G2/usr/
? /guests/OpenSuse-G2/.../

Quoted 7 lines
Quoted 2 lines

?( This feature would be configurable and would be default-off, to maintain ? ?the current status quo. )

Heh, funny. That would also solve my number one gripe with virtualization these days: how to get files in and out of guests without having to install extra packages on the guest side and fiddling with mount points on every single guest image I want to play with.

FYI, for offline guests, you can use libguestfs[1] to access & change files inside the guest, and read-only access to running guests files. It provides access via a interactive shell, APIs in all major languages, and also has a FUSE mdule to expose it directly in the host VFS. It could probably be made to work read-write for running guests too if its agent were installed inside the guest & leverage the new Virtio-Serial channel for comms (avoiding any network setup requirements).

Quoted 4 lines

Regards,
Daniel

[1] http://libguestfs.org/

Yes, this is the kind of functionality i'm suggesting.

I'd suggest a different implementation for live guests: to drive this from within the live guest side of KVM, i.e. basically a paravirt driver for guestfs. You'd pass file API guests to the guest directly, via the KVM ioctl or so - and get responses from the guest.

That will give true read-write access and completely coherent (and still transparent) VFS integration, with no host-side knowledge needed for the guest's low level (raw) filesystem structure. That's a big advantage.

Yes, it needs an 'aware' guest kernel - but that is a one-off transition overhead whose cost is zero in the long run. (i.e. all KVM kernels beyond a given version would have this ability - otherwise it's guest side distribution transparent)

Even 'offline' read-only access could be implemented by booting a minimal kernel via qemu -kernel and using a 'ro' boot option. That way you could eliminate all lowlevel filesystem knowledge from libguestfs. You could run ext4 or btrfs guest filesystems and FAT ones as well - with no restriction.

This would allow 'offline' access to Windows images as well: a FAT or ntfs enabled mini-kernel could be booted in read-only mode.

Thanks,

Ingo

#124 lore raw

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

In reply to Avi Kivity
Quoted 12 lines · Avi Kivity
Quoted 6 lines · Ingo Molnar

Reality is, the server space never was and never will be self-sustaining in the long run (as Novell has found it out with Netware), it is the desktop that
dictates future markets. This is why i find your views about this naive and shortsighted.

Yet Linux is gaining ground in the server and embedded space while struggling on the desktop. Apple is gaining ground on the desktop but is invisible on the server side (despite having a nice product - Xserve).

Quoted 7 lines

It's true Windows achieved server dominance through it's desktop power, but I don't think that's what keeping them there now.

In any case, I'm not going to write a kvm GUI. It doesn't match my skills, interest, or my employer's interest. If you wish to see a kvm GUI you have to write one yourself or convince someone to write it (perhaps convince Red Hat to fund such an effort beyond virt-manager).

It is planned to add support for SPICE remote desktop to virt-manager once that matures & is accepted into upstream KVM/QEMU. That will improve the guest/desktop interaction in many ways compared to VNC or SDL, with improved display resolution changing, copy+paste between host & guest, much better graphics performance, etc.

Development efforts aren't totally ignoring the desktop, more that they are focusing on remoting guest desktops, rather than interaction host desktop since that's where alot of demand is. This benefits single host desktops scenarios too, since there's alot of overlap in the problems faced there.

Regards,
Daniel

Signature · 4 lines
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
#133 lore raw

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

In reply to Avi Kivity

Hi Avi,

Quoted 3 lines · Avi Kivity

Seems like perf is also split, with sysprof being developed outside the kernel.  Will you bring sysprof into the kernel?  Will every feature be duplicated in prof and sysprof?

I am glad you brought it up! Sysprof was historically outside of the kernel (with it's own kernel module, actually). While the GUI was nice, it was much harder to set up compared to oprofile so it wasn't all that popular. Things improved slightly when Ingo merged the custom kernel module but the _userspace_ part of sysprof was lagging behind a bit. I don't know what's the situation now that they've switched over to perf syscalls but you probably get my point.

It would be nice if the two projects merged but I honestly don't see any fundamental problem with two (or more) co-existing projects. Friendly competition will ultimately benefit the users (think KDE and Gnome here).

Pekka

#109 lore raw

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

In reply to Ingo Molnar
Quoted 32 lines · Ingo Molnar
Quoted 9 lines · Daniel P. Berrange

FYI, for offline guests, you can use libguestfs[1] to access & change files inside the guest, and read-only access to running guests files. It provides access via a interactive shell, APIs in all major languages, and also has a FUSE mdule to expose it directly in the host VFS. It could probably be made to work read-write for running guests too if its agent were installed inside the guest & leverage the new Virtio-Serial channel for comms (avoiding any network setup requirements).

Quoted 4 lines

Regards,
Daniel

[1] http://libguestfs.org/

Yes, this is the kind of functionality i'm suggesting.

I'd suggest a different implementation for live guests: to drive this from within the live guest side of KVM, i.e. basically a paravirt driver for guestfs. You'd pass file API guests to the guest directly, via the KVM ioctl or so - and get responses from the guest.

That will give true read-write access and completely coherent (and still transparent) VFS integration, with no host-side knowledge needed for the guest's low level (raw) filesystem structure. That's a big advantage.

Yes, it needs an 'aware' guest kernel - but that is a one-off transition overhead whose cost is zero in the long run. (i.e. all KVM kernels beyond a given version would have this ability - otherwise it's guest side distribution transparent)

Quoted 7 lines

Even 'offline' read-only access could be implemented by booting a minimal kernel via qemu -kernel and using a 'ro' boot option. That way you could eliminate all lowlevel filesystem knowledge from libguestfs. You could run ext4 or btrfs guest filesystems and FAT ones as well - with no restriction.

This would allow 'offline' access to Windows images as well: a FAT or ntfs enabled mini-kernel could be booted in read-only mode.

This is close to the way libguestfs already works. It boots QEMU/KVM pointing to a minimal stripped down appliance linux OS image, containing a small agent it talks to over some form of vmchannel/serial/virtio-serial device. Thus the kernel in the appliance it runs is the only thing that needs to know about the filesystem/lvm/dm on-disk formats - libguestfs definitely does not want to be duplicating this detailed knowledge of on disk format itself. It is doing full read-write access to the guest filesystem in offline mode - one of the major use cases is disaster recovery from a unbootable guest OS image.

Regards,
Daniel

Signature · 4 lines
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
#110 lore raw

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

Quoted 8 lines · Daniel P. Berrange

This is close to the way libguestfs already works. It boots QEMU/KVM pointing to a minimal stripped down appliance linux OS image, containing a small agent it talks to over some form of vmchannel/serial/virtio-serial device. Thus the kernel in the appliance it runs is the only thing that needs to know about the filesystem/lvm/dm on-disk formats - libguestfs definitely does not want to be duplicating this detailed knowledge of on disk format itself. It is doing full read-write access to the guest filesystem in offline mode - one of the major use cases is disaster recovery from a unbootable guest OS image.

As Dan said, the 'daemon' part is separate and could be run as a standard part of a guest install, talking over vmchannel to the host. The only real issue I can see is adding access control to the daemon (currently it doesn't need it and doesn't do any). Doing it this way you'd be leveraging the ~250,000 lines of existing libguestfs code, bindings in multiple languages, tools etc.

Rich.

Signature · 4 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
#141 lore raw

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

In reply to Ingo Molnar
Quoted 8 lines · Ingo Molnar
Quoted 2 lines · Joerg Roedel

[...] Basically the reason of the oProfile failure is a disfunctional community. [...]

Caused by: repository separation and the inevitable code and social fork a decade later.

No, the split-repository situation was the smallest problem after all. Its was a community thing. If the community doesn't work a single-repo project will also fail. Look at the state of the alpha arch in Linux today, it is maintained in one repository but nobody really cares about it. Thus it is miles behine most other archs Linux supports today in quality and feature completeness.

Quoted 4 lines

What you fail to realise (or what you fail to know, you werent around when Oprofile was written, i was) is that Oprofile _did_ have a functional single community when it was written. The tooling and the kernel bits was written by the same people.

Yes, this was probably the time when everybody was enthusiastic about the feature and they could attract lots of developers. But situation changed over time.

Quoted 2 lines

So i dont see much of a difference to the Oprofile situation really and i see many parallels. I also see similar kinds of desktop usability problems.

The difference is that KVM has a working community with good developers and maintainers.

Quoted 5 lines

The difference is that we dont have KVM with a decade of history and we dont have a 'told you so' KVM reimplementation to show that proves the point. I guess it's a matter of time before that happens, because Qemu usability is so absymal today - so i guess we should suspend any discussions until that happens, no need to waste time on arguing hypoteticals.

We actually have lguest which is small. But it lacks functionality and the developer community KVM has attracted.

Quoted 1 line

I think you are rationalizing the status quo.

I see that there are issues with KVM today in some areas. You pointed out the desktop usability already. I personally have trouble with the qem-kvm.git because it is unbisectable. But repository unification doesn't solve the problem here.
The point for a single repository is that it simplifies the development process. I agree with you here. But the current process of KVM is not too difficult after all. I don't have to touch qemu sources for most of my work on KVM.

Quoted 4 lines

It's as if you argued in 1990 that the unification of East and West Germany wouldnt make much sense because despite clear problems and incompatibilites and different styles westerners were still allowed to visit eastern relatives and they both spoke the same language after all ;-)

Um, hmm. I don't think these situations have enough in common to compare them ;-)

Joerg

#113 lore raw

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

In reply to Daniel P. Berrange
Quoted 38 lines · Daniel P. Berrange
Quoted 37 lines · Ingo Molnar
Quoted 9 lines · Daniel P. Berrange

FYI, for offline guests, you can use libguestfs[1] to access & change files inside the guest, and read-only access to running guests files. It provides access via a interactive shell, APIs in all major languages, and also has a FUSE mdule to expose it directly in the host VFS. It could probably be made to work read-write for running guests too if its agent were installed inside the guest & leverage the new Virtio-Serial channel for comms (avoiding any network setup requirements).

Quoted 4 lines

Regards,
Daniel

[1] http://libguestfs.org/

Yes, this is the kind of functionality i'm suggesting.

I'd suggest a different implementation for live guests: to drive this from within the live guest side of KVM, i.e. basically a paravirt driver for guestfs. You'd pass file API guests to the guest directly, via the KVM ioctl or so - and get responses from the guest.

That will give true read-write access and completely coherent (and still transparent) VFS integration, with no host-side knowledge needed for the guest's low level (raw) filesystem structure. That's a big advantage.

Yes, it needs an 'aware' guest kernel - but that is a one-off transition overhead whose cost is zero in the long run. (i.e. all KVM kernels beyond a given version would have this ability - otherwise it's guest side distribution transparent)

Even 'offline' read-only access could be implemented by booting a minimal kernel via qemu -kernel and using a 'ro' boot option. That way you could eliminate all lowlevel filesystem knowledge from libguestfs. You could run ext4 or btrfs guest filesystems and FAT ones as well - with no restriction.

Quoted 4 lines
Quoted 2 lines

This would allow 'offline' access to Windows images as well: a FAT or ntfs enabled mini-kernel could be booted in read-only mode.

This is close to the way libguestfs already works. [...]

[ Oops, you are right - sorry for not looking more closely! I was confused by
the 'read only' aspect. ]

Quoted 8 lines

[...] It boots QEMU/KVM pointing to a minimal stripped down appliance linux OS image, containing a small agent it talks to over some form of vmchannel/serial/virtio-serial device. Thus the kernel in the appliance it runs is the only thing that needs to know about the filesystem/lvm/dm on-disk formats - libguestfs definitely does not want to be duplicating this detailed knowledge of on disk format itself. It is doing full read-write access to the guest filesystem in offline mode - one of the major use cases is disaster recovery from a unbootable guest OS image.

Just curious: any plans to extend this to include live read/write access as well?

I.e. to have the 'agent' (guestfsd) running universally, so that tools such as perf and by users could rely on the VFS integration as well, not just disaster recovery tools?

Without universal access to this feature it's not adequate for instrumentation purposes.

One option to achieve that would be to extend Qemu to allow 'qemu daemons' to run on the (Linux) guest side. These would be statically linked binaries that can run on any Linux system, and which could provide various built-in Qemu functionality from the guest side to the host side.

Thanks,

Ingo

#111 lore raw

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

In reply to Richard W.M. Jones
Quoted 10 lines · Richard W.M. Jones
Quoted 8 lines · Daniel P. Berrange

This is close to the way libguestfs already works. It boots QEMU/KVM pointing to a minimal stripped down appliance linux OS image, containing a small agent it talks to over some form of vmchannel/serial/virtio-serial device. Thus the kernel in the appliance it runs is the only thing that needs to know about the filesystem/lvm/dm on-disk formats - libguestfs definitely does not want to be duplicating this detailed knowledge of on disk format itself. It is doing full read-write access to the guest filesystem in offline mode - one of the major use cases is disaster recovery from a unbootable guest OS image.

Quoted 6 lines

As Dan said, the 'daemon' part is separate and could be run as a standard part of a guest install, talking over vmchannel to the host. The only real issue I can see is adding access control to the daemon (currently it doesn't need it and doesn't do any). Doing it this way you'd be leveraging the ~250,000 lines of existing libguestfs code, bindings in multiple languages, tools etc.

I think it would be a nice option to allow such guest-side "daemon's" to be executed in the guest context without _any_ guest-side support.

This would be possible by building such minimal daemons that use vmchannel, and which are built for generic x86 (maybe even built for 32-bit x86 so that they can run on any x86 distro). They could execute as the init task of any guest kernel - Qemu could 'blend in / replace' the binary as the init task of the guest temporarily - and some simple bootstrap code could then start the daemon and start the real init binary (and turn off the 'blending' of the init task).

That way any guest could be extended via such Qemu functionality - even without any kernel changes. Has anyone thought about (or coded) such a solution perhaps?

Ingo

#115 lore raw

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

In reply to Richard W.M. Jones
Quoted 8 lines · Richard W.M. Jones
Quoted 6 lines · Ingo Molnar

Just curious: any plans to extend this to include live read/write access as well?

I.e. to have the 'agent' (guestfsd) running universally, so that tools such as perf and by users could rely on the VFS integration as well, not just disaster recovery tools?

Quoted 8 lines

Totally. That's not to say there is a definite plan, but we're very open to doing this. We already wrote the daemon in such a way that it doesn't require the appliance part, but could run inside any existing guest (we've even ported bits of it to Windoze ...).

The only remaining issue is how access control would be handled. You obviously wouldn't want anything in the host that can get access to the vmchannel socket to start sending destructive write commands into guests.

By default i'd suggest to put it into a maximally restricted mount point. I.e. restrict access to only the security context running libguestfs or so.

( Which in practice will be the user starting the guest, so there will be
proper protection from other users while still allowing easy access to the user that has access already. )

Ingo

#114 lore raw

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

In reply to Ingo Molnar
Quoted 6 lines · Ingo Molnar

Just curious: any plans to extend this to include live read/write access as well?

I.e. to have the 'agent' (guestfsd) running universally, so that tools such as perf and by users could rely on the VFS integration as well, not just disaster recovery tools?

Totally. That's not to say there is a definite plan, but we're very open to doing this. We already wrote the daemon in such a way that it doesn't require the appliance part, but could run inside any existing guest (we've even ported bits of it to Windoze ...).

The only remaining issue is how access control would be handled. You obviously wouldn't want anything in the host that can get access to the vmchannel socket to start sending destructive write commands into guests.

Rich.

Signature · 4 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/
#112 lore raw

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

In reply to Richard W.M. Jones
Quoted 10 lines · Richard W.M. Jones
Quoted 8 lines · Daniel P. Berrange

This is close to the way libguestfs already works. It boots QEMU/KVM pointing to a minimal stripped down appliance linux OS image, containing a small agent it talks to over some form of vmchannel/serial/virtio-serial device. Thus the kernel in the appliance it runs is the only thing that needs to know about the filesystem/lvm/dm on-disk formats - libguestfs definitely does not want to be duplicating this detailed knowledge of on disk format itself. It is doing full read-write access to the guest filesystem in offline mode - one of the major use cases is disaster recovery from a unbootable guest OS image.

Quoted 6 lines

As Dan said, the 'daemon' part is separate and could be run as a standard part of a guest install, talking over vmchannel to the host. The only real issue I can see is adding access control to the daemon (currently it doesn't need it and doesn't do any). Doing it this way you'd be leveraging the ~250,000 lines of existing libguestfs code, bindings in multiple languages, tools etc.

I think we don't need per-guest-file access control. Probably we could apply the image-file permissions to all guestfs files. This would cover the usecases:

* perf for reading symbol information (needs ro-access only anyway)
* Desktop like host<->guest file copy

I have not looked into libguestfs yet but I guess this approach is easier to achieve.

Joerg

#125 lore raw

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

In reply to Avi Kivity
Quoted 9 lines · Avi Kivity
Quoted 5 lines · Ingo Molnar

Reality is, the server space never was and never will be self-sustaining in the long run (as Novell has found it out with Netware), it is the desktop that dictates future markets. This is why i find your views about this naive and shortsighted.

Yet Linux is gaining ground in the server and embedded space while struggling on the desktop. [...]

Frankly, Linux is mainly growing in the server space due to:

1) the server space is technically much simpler than the desktop space. It is far easier to code up a server performance feature than to make struggle through stupid (server-motivated) package boundaries and get something done on the desktop. It is far easier to code up a server app as that space is well standardized and servers tend to be compartmented. Integration between server apps is much less common than integration between desktop apps, hence the harm that our modularization idiocies cause less harm.

2) Linux's growth is still feeding on the remains of the destruction of Unix.

Linux is struggling on the desktop due to the desktop's inherent complexity, due to the lack of the Unix inertia and due to incompetence, insensitivity, intellectual arrogance and shortsightedness of server-centric thinking, like your arguments/position displayed in this very thread.

Quoted 2 lines

[...] Apple is gaining ground on the desktop but is invisible on the server side (despite having a nice product - Xserve).

But the thing is, Apple doesnt really care about the server space, yet. It is lucrative but it is a side-show: it will fall automatically to the 'winner' of the desktop (or gadget) of tomorrow.

Has the quick fall of Banyan Vines or Netware (both excellent all-around server products) taught you nothing?

We need a lot more desktop focus in the kernel community. The best method to achieve this, that i know of currently, is to simply have kernel developers think outside the kernel box and to have them do bits of user-space coding as well - and in particular desktop coding. To eat our own dogfood in essence. Suffer through crap we cause to user-space. To face the _real_ difficulties of users. We seem to have forgotten our roots.

Quoted 4 lines

[...]

It's true Windows achieved server dominance through it's desktop power, but I don't think that's what keeping them there now.

What is keeping them there is precisely that.

Quoted 4 lines

In any case, I'm not going to write a kvm GUI. It doesn't match my skills, interest, or my employer's interest. If you wish to see a kvm GUI you have to write one yourself or convince someone to write it (perhaps convince Red Hat to fund such an effort beyond virt-manager).

As a maintainer you certainly dont have to write a single line of code, if you dont want to. You 'just' need to care about the big picture and encourage/help the flow and balance of the whole project.

Ingo

#178 lore raw

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

In reply to Avi Kivity
Quoted 4 lines · Avi Kivity
Quoted 1 line · Ingo Molnar

This is why i consider that line of argument rather dishonest ...

I am not going to reply to any more email from you on this thread.

Because i pointed out that i consider a line of argument intellectually dishonest?

I did not say _you_ as a person are dishonest - doing that would be an ad honimen attack against your person. (In fact i dont think you are, to the contrary)

An argument can certainly be labeled dishonest in a fair discussion and it is not a personal attack against you to express my opinion about that.

Thanks,

Ingo

#179 lore raw

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

Quoted 12 lines · Ingo Molnar
Quoted 6 lines · Avi Kivity
Quoted 2 lines · Ingo Molnar

This is why i consider that line of argument rather dishonest ...

I am not going to reply to any more email from you on this thread.

Because i pointed out that i consider a line of argument intellectually dishonest?

Quoted 7 lines

I did not say _you_ as a person are dishonest - doing that would be an ad honimen attack against your person. (In fact i dont think you are, to the contrary)

An argument can certainly be labeled dishonest in a fair discussion and it is not a personal attack against you to express my opinion about that.

You're being excessively rude in this thread. That might be acceptable on LKML but it's not how the QEMU and KVM communities behave. This thread is a good example of why LKML has the reputation it has. Avi and I argue all of the time on qemu-devel and kvm-devel and it's never degraded into a series of personal attacks like this.

I've been trying very hard to turn this into a productive thread attempting to capture your feedback and give clear suggestions about how you can solve achieve your desired functionality.

What are you looking to achieve? To you just want to piss and moan about how terrible you think Avi and I are? Or do you want to try to actually help make things better?

If you want to help make things better, please focus on making constructive suggestions and clarifying what you see as requirements.

Regards,

Anthony Liguori

#280 lore raw

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

In reply to Ingo Molnar
Quoted 12 lines · Ingo Molnar
Quoted 6 lines · Avi Kivity
Quoted 2 lines · Ingo Molnar

This is why i consider that line of argument rather dishonest ...

I am not going to reply to any more email from you on this thread.

Because i pointed out that i consider a line of argument intellectually dishonest?

Quoted 8 lines

I did not say _you_ as a person are dishonest - doing that would be an ad honimen attack against your person. (In fact i dont think you are, to the contrary)

An argument can certainly be labeled dishonest in a fair discussion and it is not a personal attack against you to express my opinion about that.

Sigh, why am I drawn into this.

A person who uses dishonest arguments is a dishonest person. When you say I use a dishonest argument you are implying I am dishonest. Why do you argue with me at all if you think I am trying to cheat?

If you disagree with me, tell me I am wrong, not dishonest (or that my arguments are dishonest). And this is just one example in this thread. Seriously, tools/kvm would cause a loss of developers, not a gain, simply because of the style of argument of some people on this list. Maybe qemu/kernels is a better idea.

Again, if you want to talk to me, use the same language you'd like to hear yourself. Or maybe years of lkml made you so thick skinned you no longer understand how to interact with people.

Signature · 1 line
error compiling committee.c: too many arguments to function
#137 lore raw

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

In reply to Avi Kivity
Quoted 9 lines · Avi Kivity
Quoted 8 lines · Ingo Molnar
Quoted 5 lines · Avi Kivity

IMO the reason perf is more usable than oprofile has less to do with the kernel/userspace boundary and more do to with effort and attention spent on the userspace/user boundary.

[...]

Quoted 7 lines
Quoted 4 lines

If you are interested in the first-hand experience of the people who are doing the perf work then here it is: by far the biggest reason for perf success and perf usability is the integration of the user-space tooling with the kernel-space bits, into a single repository and project.

Please take a look at the kvm integration code in qemu as a fraction of the whole code base.

You have to admit that much of Qemu's past 2-3 years of development was motivated by Linux/KVM (i'd say more than 50% of the code). As such it's one and the same code base - you just continue to define Qemu to be different from KVM.

I very much remember how Qemu looked like _before_ KVM: it was a struggling, dying project. KVM clearly changed that.

Quoted 3 lines
Quoted 1 line

The very move you are opposing so vehemently for KVM.

I don't want to fracture a working community.

Would you accept (or at least not NAK) a new tools/kvm/ tool that builds tooling from grounds up, while leaving Qemu untouched? [assuming it's all clean code, etc.]

Although i have doubts about how well that would work 'against' your opinion:
such a tool would need lots of KVM-side features and a positive attitude from you to be really useful. There's a lot of missing functionality to cover.

Quoted 9 lines
Quoted 6 lines

Oprofile went the way you proposed, and it was a failure. It failed not because it was bad technology (it was pretty decent and people used it), it was not a failure because the wrong people worked on it (to the contrary, very capable people worked on it), it was a failure in hindsight because it simply incorrectly split into two projects which stiffled the progress of each other.

Every project that has some kernel footprint, except perf, is split like that. Are they all failures?

No. Did i ever claim KVM was a failure? I said it's hindered by this design aspect.

Are other Linux kernel tool projects affected by similar problems? You bet ...

Quoted 3 lines

Seems like perf is also split, with sysprof being developed outside the kernel. Will you bring sysprof into the kernel? Will every feature be duplicated in prof and sysprof?

I'd prefer if sysprof merged into perf as 'perf view' - but its maintainer does not want that - which is perfectly OK. So we are building equivalent functionality into perf instead.

Think about it like Firefox plugins: the main Firefox project picks up the functionality of the most popular Firefox plugins all the time. Session Saver, Tab Mix Plus, etc. were all in essence 'merged' (in functionality, not in code) into the 'reference' Firefox project.

I think that's a fundamentally healthy model: it allows extensions and thus give others an honest chance to show that you are potentially coding an inferior piece of code - but also express a clear opinion about what you consider a full, usable, high-quality reference implementation and constantly improve this reference implementation.

I dont think that can be argued to be a bad model. Yes, it takes a bit of thinking outside the box to do tools/kvm/ but of all people i'd expect some of that from you.

Ingo

#134 lore raw

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

In reply to Pekka Enberg
Quoted 15 lines · Pekka Enberg

Hi Avi,

Quoted 3 lines · Avi Kivity

Seems like perf is also split, with sysprof being developed outside the kernel. ?Will you bring sysprof into the kernel? ?Will every feature be duplicated in prof and sysprof?

I am glad you brought it up! Sysprof was historically outside of the kernel (with it's own kernel module, actually). While the GUI was nice, it was much harder to set up compared to oprofile so it wasn't all that popular. Things improved slightly when Ingo merged the custom kernel module but the _userspace_ part of sysprof was lagging behind a bit. I don't know what's the situation now that they've switched over to perf syscalls but you probably get my point.

Quoted 3 lines

It would be nice if the two projects merged but I honestly don't see any fundamental problem with two (or more) co-existing projects. Friendly competition will ultimately benefit the users (think KDE and Gnome here).

See my previous mail - what i see as the most healthy project model is to have a full solution reference implementation, connected to a flexible halo of plugins or sub-apps.

Firefox does that, KDE does that, and Gnome as well to a certain degree.

The 'halo' provides a constant feedback of new features, and it also provides competition and pressure on the 'main' code to be top-notch.

The problem i see with KVM is that there's no reference implementation! There is _only_ the KVM kernel part which is not functional in itself. Surrounded by a 'halo' - where none of the entities is really 'the' reference implementation we call 'KVM'.

This causes constant quality problems as the developers of the main project dont have constant pressure towards good quality (it is not their responsibility to care about user-space bits after all), plus it causes a lack of focus as well: integration between (friendly) competing user-space components is a lot harder than integration within a single framework such as Firefox.

I hope this explains my points about modularization a bit better! I suggested KVM to grow a user-space tool component in the kernel repo in tools/kvm/, which would become the reference implementation for tooling. User-space projects can still provide alternative tooling or can plug into this tooling, just like they are doing it now. So the main effect isnt even on those projects but on the kernel developers. The ABI remains and all the user-space packages and projects remain.

Yes, i thought Qemu would be a prime candidate to be the baseline for tools/kvm/, but i guess that has become socially impossible now after this flamewar. It's not a big problem in the big scheme of things: tools/kvm/ is best grown up from a small towards larger size anyway ...

Thanks,

Ingo

#180 lore raw

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

In reply to Anthony Liguori
Quoted 5 lines · Anthony Liguori

[...]

I've been trying very hard to turn this into a productive thread attempting to capture your feedback and give clear suggestions about how you can solve achieve your desired functionality.

I'm glad that we are at this more productive stage. I'm still trying to achieve the very same technological capabilities that i expressed in the first few mails when i reviewed the 'perf kvm' patch that was submitted by Yanmin.

The crux of the problem is very simple. To quote my earlier mail:

 |
 | - The inconvenience of having to type:
 |      perf kvm --host --guest --guestkallsyms=/home/ymzhang/guest/kallsyms \
 |               --guestmodules=/home/ymzhang/guest/modules top
 |
 |
 |   is very obvious even with a single guest. Now multiply that by more guests ...
 |

For example we want 'perf kvm top' to do something useful by default: it should find the first guest running and it should report its profile.

The tool shouldnt have to guess about where the guests are, what their namespaces is and how to talk to them. We also want easy symbolic access to guest, for example:

perf kvm -g OpenSuse-2 record sleep 1

I.e.:

- Easy default reference to guest instances, and a way for tools to reference them symbolically as well in the multi-guest case. Preferably something trustable and kernel-provided - not some indirect information like a PID file created by libvirt-manager or so.

- Guest-transparent VFS integration into the host, to recover symbols and debug info in binaries, etc.

There were a few responses to that but none really addressed those problems - they mostly tried to re-define the problem and suggested that i was wrong to want such capabilities and suggested various inferior approaches instead. See the thread for the details - i think i covered every technical suggestion that was made.

So we are still at an impasse as far as i can see. If i overlooked some suggestion that addresses these problems then please let me know ...

Thanks,

Ingo

#181 lore raw

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

Quoted 24 lines · Ingo Molnar
Quoted 6 lines · Anthony Liguori

[...]

I've been trying very hard to turn this into a productive thread attempting to capture your feedback and give clear suggestions about how you can solve achieve your desired functionality.

I'm glad that we are at this more productive stage. I'm still trying to achieve the very same technological capabilities that i expressed in the first few mails when i reviewed the 'perf kvm' patch that was submitted by Yanmin.

The crux of the problem is very simple. To quote my earlier mail:

  |
  | - The inconvenience of having to type:
  |      perf kvm --host --guest --guestkallsyms=/home/ymzhang/guest/kallsyms \
  |               --guestmodules=/home/ymzhang/guest/modules top
  |
  |
  |   is very obvious even with a single guest. Now multiply that by more guests ...
  |
Quoted 9 lines

For example we want 'perf kvm top' to do something useful by default: it should find the first guest running and it should report its profile.

The tool shouldnt have to guess about where the guests are, what their namespaces is and how to talk to them. We also want easy symbolic access to guest, for example:

perf kvm -g OpenSuse-2 record sleep 1

Two things are needed. The first thing needed is to be able to enumerate running guests and identify a symbolic name. I have a patch for this and it'll be posted this week or so. perf will need to have a QMP client and it will need to look in ${HOME}/.qemu/qmp/ to sockets to connect to.

This is too much to expect from a client and we've got a GSoC idea posted to make a nice library for tools to use to simplify this.

The sockets are named based on UUID and you'll have to connect to a guest and ask it for it's name. Some guests don't have names so we'll have to come up with a clever way to describe a nameless VM.

Quoted 7 lines

I.e.:

- Easy default reference to guest instances, and a way for tools to reference them symbolically as well in the multi-guest case. Preferably something trustable and kernel-provided - not some indirect information like a PID file created by libvirt-manager or so.

A guest is not a KVM concept. It's a qemu concept so it needs to be something provided by qemu. The other caveat is that you won't see guests created by libvirt because we're implementing this in terms of a default QMP device and libvirt will disable defaults. This is desired behaviour. libvirt wants to be in complete control and doesn't want a tool like perf interacting with a guest directly.

Quoted 3 lines

- Guest-transparent VFS integration into the host, to recover symbols and debug info in binaries, etc.

The way I'd like to see this implemented is a guest userspace daemon. I think having the guest userspace daemon be something that can be updated by the host is reasonable.

In terms of exposing that on the host, my preferred approach is QMP. I'd be happy with a QMP command that is essentially, guest_fs_read(filename) and guest_fd_readdir(path).

If desired, one could implement a fuse filesystem that interacted with all local qemu instances to expose this on the host. There's a lot of ugly things about fuse though so I think sticking to QMP is best (particularly with respect to root access of a fuse filesystem).

With just those couple things in place, perf should be able to do exactly what you want it to do.

Regards,

Anthony Liguroi

Quoted 13 lines

There were a few responses to that but none really addressed those problems - they mostly tried to re-define the problem and suggested that i was wrong to want such capabilities and suggested various inferior approaches instead. See the thread for the details - i think i covered every technical suggestion that was made.

So we are still at an impasse as far as i can see. If i overlooked some suggestion that addresses these problems then please let me know ...

Thanks,

Ingo

#281 lore raw

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

In reply to Avi Kivity
Quoted 13 lines · Avi Kivity
Quoted 12 lines · Ingo Molnar
Quoted 3 lines · Avi Kivity
Quoted 1 line · Ingo Molnar

This is why i consider that line of argument rather dishonest ...

I am not going to reply to any more email from you on this thread.

Because i pointed out that i consider a line of argument intellectually dishonest?

I did not say _you_ as a person are dishonest - doing that would be an ad honimen attack against your person. (In fact i dont think you are, to the contrary)

Quoted 7 lines
Quoted 3 lines

An argument can certainly be labeled dishonest in a fair discussion and it is not a personal attack against you to express my opinion about that.

Sigh, why am I drawn into this.

A person who uses dishonest arguments is a dishonest person. [...]

That's not how i understood that phrase - and i did not mean to suggest that you are dishonest and i do not think that you are dishonest (to the contrary).

Thanks,

Ingo

#186 lore raw

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

In reply to Ingo Molnar
Quoted 5 lines · Ingo Molnar
Quoted 2 lines · Anthony Liguori

[...]

Quoted 8 lines
Quoted 4 lines

I've been trying very hard to turn this into a productive thread attempting to capture your feedback and give clear suggestions about how you can solve achieve your desired functionality.

I'm glad that we are at this more productive stage. I'm still trying to achieve the very same technological capabilities that i expressed in the first few mails when i reviewed the 'perf kvm' patch that was submitted by Yanmin.

No, you're not. You're trying to fracture the qemu community with your tools/kvm proposal, you're explaining to me how I'm working on the wrong thing by concentrating on things that my employer needs rather than what you think kvm needs, and attaching various unsavoury labels to Anthony and myself. Any wonder we aren't getting anything done?

If you can commit to a reasonable conversation we might be able to make progress. Is this actually possible?

Quoted 18 lines

The crux of the problem is very simple. To quote my earlier mail:

  |
  | - The inconvenience of having to type:
  |      perf kvm --host --guest --guestkallsyms=/home/ymzhang/guest/kallsyms \
  |               --guestmodules=/home/ymzhang/guest/modules top
  |
  |
  |   is very obvious even with a single guest. Now multiply that by more guests ...
  |

For example we want 'perf kvm top' to do something useful by default: it should find the first guest running and it should report its profile.

The tool shouldnt have to guess about where the guests are, what their namespaces is and how to talk to them. We also want easy symbolic access to guest, for example:

Quoted 9 lines

perf kvm -g OpenSuse-2 record sleep 1

I.e.:

- Easy default reference to guest instances, and a way for tools to reference them symbolically as well in the multi-guest case. Preferably something trustable and kernel-provided - not some indirect information like a PID file created by libvirt-manager or so.

Usually 'layering violation' is trotted out at such suggestions. I don't like using the term, because sometimes the layers are incorrect and need to be violated. But it should be done explicitly, not as a shortcut for a minor feature (and profiling is a minor feature, most users will never use it, especially guest-from-host).

The fact is we have well defined layers today, kvm virtualizes the cpu and memory, qemu emulates devices for a single guest, libvirt manages guests. We break this sometimes but there has to be a good reason. So perf needs to talk to libvirt if it wants names. Could be done via linking, or can be done using a pluging libvirt drops into perf.

Quoted 9 lines

- Guest-transparent VFS integration into the host, to recover symbols and debug info in binaries, etc.

There were a few responses to that but none really addressed those problems - they mostly tried to re-define the problem and suggested that i was wrong to want such capabilities and suggested various inferior approaches instead. See the thread for the details - i think i covered every technical suggestion that was made.

You simply kept ignoring me when I said that if something can be kept out of the kernel without impacting performance, it should be. I don't want emergency patches closing some security hole or oops in a kernel symbol server.

The usability argument is a red herring. True, it takes time for things to trickle down to distributions and users. Those who can't wait can download the code and compile, it isn't that difficult.

Quoted 3 lines

So we are still at an impasse as far as i can see. If i overlooked some suggestion that addresses these problems then please let me know ...

The impasse is mostly due to you insisting on doing everything your way, in the kernel, and disregarding how libvirt/qemu/kvm does things. Learn the kvm ecosystem, you'll find it is quite easy to contribute code.

Signature · 1 line
error compiling committee.c: too many arguments to function
#282 lore raw

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

In reply to Ingo Molnar
Quoted 25 lines · Ingo Molnar
Quoted 22 lines · Avi Kivity
Quoted 20 lines · Ingo Molnar
Quoted 6 lines · Avi Kivity
Quoted 2 lines · Ingo Molnar

This is why i consider that line of argument rather dishonest ...

I am not going to reply to any more email from you on this thread.

Because i pointed out that i consider a line of argument intellectually dishonest?

I did not say _you_ as a person are dishonest - doing that would be an ad honimen attack against your person. (In fact i dont think you are, to the contrary)

An argument can certainly be labeled dishonest in a fair discussion and it is not a personal attack against you to express my opinion about that.

Quoted 7 lines
Quoted 4 lines

Sigh, why am I drawn into this.

A person who uses dishonest arguments is a dishonest person. [...]

That's not how i understood that phrase - and i did not mean to suggest that you are dishonest and i do not think that you are dishonest (to the contrary).

Word games.

Signature · 1 line
error compiling committee.c: too many arguments to function
#187 lore raw

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

In reply to Avi Kivity
Quoted 8 lines · Avi Kivity
Quoted 5 lines

There were a few responses to that but none really addressed those problems - they mostly tried to re-define the problem and suggested that i was wrong to want such capabilities and suggested various inferior approaches instead. See the thread for the details - i think i covered every technical suggestion that was made.

You simply kept ignoring me when I said that if something can be kept out of the kernel without impacting performance, it should be. I don't want emergency patches closing some security hole or oops in a kernel symbol server.

Or rather, explained how I am a wicked microkernelist. The herring were out in force today.

Signature · 1 line
error compiling committee.c: too many arguments to function
#142 lore raw

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

In reply to Joerg Roedel
Quoted 3 lines · Joerg Roedel

[...] Look at the state of the alpha arch in Linux today, it is maintained in one repository but nobody really cares about it. Thus it is miles behine most other archs Linux supports today in quality and feature completeness.

I dont know how you can find the situation of Alpha comparable, which is a legacy architecture for which no new CPU was manufactored in the past ~10 years.

The negative effects of physical obscolescence cannot be overcome even by the very best of development models ...

So this is a total non-argument in this context.

Quoted 7 lines · Ingo Molnar
Quoted 6 lines · Joerg Roedel
Quoted 3 lines

[...] Basically the reason of the oProfile failure is a disfunctional community. [...]

Quoted 6 lines
Quoted 2 lines

Caused by: repository separation and the inevitable code and social fork a decade later.

No, the split-repository situation was the smallest problem after all. Its was a community thing. If the community doesn't work a single-repo project will also fail. [...]

So, what do you think creates code communities and keeps them alive? Developers and code. And the wellbeing of developers are primarily influenced by the repository structure and by the development/maintenance process - i.e. by the 'fun' aspect. (i'm simplifying things there but that's the crux of it.)

So yes, i do claim that what stiffled and eventually killed off the Oprofile community was the split repository. None of the other Oprofile shortcomings were really unfixable, but this one was. It gave no way for the community to grow in a healthy way, after the initial phase. Features were more difficult and less fun to develop.

And yes, there were times when there was still active Oprofile development but the development process warning signs should have been noticed, and the community could have been kept alive by unification and similar measures. Instead what happened was a complete rewrite and a competitive replacement by perf. (Which isnt particularly nice to users btw. - they prefer more gradual transitions - but there was no other option, so many problems accumulated in Oprofile.)

I simply do not want to see KVM face the same fate, and yes i do see similar warnings signs.

Quoted 8 lines
Quoted 4 lines

What you fail to realise (or what you fail to know, you werent around when Oprofile was written, i was) is that Oprofile _did_ have a functional single community when it was written. The tooling and the kernel bits was written by the same people.

Yes, this was probably the time when everybody was enthusiastic about the feature and they could attract lots of developers. But situation changed over time.

The thing is, the drift was pre-programmed by having a split ...

Quoted 6 lines
Quoted 3 lines

So i dont see much of a difference to the Oprofile situation really and i see many parallels. I also see similar kinds of desktop usability problems.

The difference is that KVM has a working community with good developers and maintainers.

Oprofile certainly had good developers and maintainers as well. In the end it wasnt enough ...

Also, a project can easily still be 'alive' but not reach its full potential.

Why do you assume that my argument means that KVM isnt viable today? It can very well still be viable and even healthy - just not _as healthy_ as it could be ...

Quoted 9 lines
Quoted 6 lines

The difference is that we dont have KVM with a decade of history and we dont have a 'told you so' KVM reimplementation to show that proves the point. I guess it's a matter of time before that happens, because Qemu usability is so absymal today - so i guess we should suspend any discussions until that happens, no need to waste time on arguing hypoteticals.

We actually have lguest which is small. But it lacks functionality and the developer community KVM has attracted.

I suggested long ago to merge lguest into KVM to cover non-VMX/non-SVM execution.

Quoted 6 lines
Quoted 1 line

I think you are rationalizing the status quo.

I see that there are issues with KVM today in some areas. You pointed out the desktop usability already. I personally have trouble with the qem-kvm.git because it is unbisectable. But repository unification doesn't solve the problem here.

Why doesnt it solve the bisectability problem? The kernel repo is supposed to be bisectable so that problem would be solved.

Quoted 4 lines

The point for a single repository is that it simplifies the development process. I agree with you here. But the current process of KVM is not too difficult after all. I don't have to touch qemu sources for most of my work on KVM.

In my judgement you'd have to do that more frequently, if KVM was properly weighting its priorities. For example regarding this recent KVM commit of yours:

| commit ec1ff79084fccdae0dca9b04b89dcdf3235bbfa1
| Author: Joerg Roedel <[email protected]>
| Date:   Fri Oct 9 16:08:31 2009 +0200
|
|     KVM: SVM: Add tracepoint for invlpga instruction
|     
|     This patch adds a tracepoint for the event that the guest
|     executed the INVLPGA instruction.

With integrated KVM tooling i might have insisted for that new tracepoint to be available to users as well via some more meaningful tooling than just a pure tracepoint.

There's synergies like that all around the place.

You should realize that naturally developers will gravitate towards the most 'fun' aspects of a project. It is the task of the maintainer to keep the balance between fun and utility, bugs and features, quality and code-rot.

Quoted 8 lines
Quoted 5 lines

It's as if you argued in 1990 that the unification of East and West Germany wouldnt make much sense because despite clear problems and incompatibilites and different styles westerners were still allowed to visit eastern relatives and they both spoke the same language after all ;-)

Um, hmm. I don't think these situations have enough in common to compare them ;-)

Probably, but it's an interesting parallel nevertheless ;-)

Thanks,

Ingo

#188 lore raw

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

In reply to Avi Kivity
Quoted 7 lines · Avi Kivity
Quoted 4 lines

You simply kept ignoring me when I said that if something can be kept out of the kernel without impacting performance, it should be.  I don't want emergency patches closing some security hole or oops in a kernel symbol server.

Or rather, explained how I am a wicked microkernelist.  The herring were out in force today.

Well, if it's not being a "wicked microkernelist" then what is it? Performance is hardly the only motivation to put things into the kernel. Think kernel mode-setting and devtmpfs (with the ironic twist of original devfs being removed from the kernel) here, for example.

Pekka

#373 lore raw
In reply to Zhang, Yanmin

Em Mon, Mar 22, 2010 at 03:24:47PM +0800, Zhang, Yanmin escreveu:

Quoted 6 lines · Ingo Molnar
Quoted 5 lines

So some sort of --guestmount option would be the natural solution, which points to the guest system's root: and a Qemu enumeration of guest mounts (which would be off by default and configurable) from which perf can pick up the target guest all automatically. (obviously only under allowed permissions so that such access is secure)

Quoted 8 lines

If sshfs could access /proc/ and /sys correctly, here is a design:
--guestmount points to a directory which consists of a list of sub-directories. Every sub-directory's name is just the qemu process id of guest os. Admin/developer mounts every guest os instance's root directory to corresponding sub-directory.

Then, perf could access all files. It's possible because guest os instance happens to be multi-threading in a process. One of the defects is the accessing to guest os becomes slow or impossible when guest os is very busy.

If the MMAP events on the guest included a cookie that could later be used to query for the symtab of that DSO, we wouldn't need to access the guest FS at all, right?

With build-ids and debuginfo-install like tools the symbol resolution could be performed by using the cookies (build-ids) as keys to get to the *-debuginfo packages with matching symtabs (and DWARF for source annotation, etc).

We have that for the kernel as:

[acme@doppio linux-2.6-tip]$ l /sys/kernel/notes
-r--r--r-- 1 root root 36 2010-03-22 13:14 /sys/kernel/notes
[acme@doppio linux-2.6-tip]$ l /sys/module/ipv6/sections/.note.gnu.build-id -r--r--r-- 1 root root 4096 2010-03-22 13:38 /sys/module/ipv6/sections/.note.gnu.build-id [acme@doppio linux-2.6-tip]$

That way we would cover DSOs being reinstalled in long running 'perf record' sessions too.

This was discussed some time ago but would require help from the bits that load DSOs.

build-ids then would be first class citizens.

- Arnaldo

#190 lore raw

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

In reply to Avi Kivity
Quoted 11 lines · Avi Kivity
Quoted 11 lines

The crux of the problem is very simple. To quote my earlier mail:

 |
 | - The inconvenience of having to type:
 |      perf kvm --host --guest --guestkallsyms=/home/ymzhang/guest/kallsyms \
 |               --guestmodules=/home/ymzhang/guest/modules top
 |
 |
 |   is very obvious even with a single guest. Now multiply that by more guests ...
 |
Quoted 8 lines
Quoted 8 lines

For example we want 'perf kvm top' to do something useful by default: it should find the first guest running and it should report its profile.

The tool shouldnt have to guess about where the guests are, what their namespaces is and how to talk to them. We also want easy symbolic access to guest, for example:

perf kvm -g OpenSuse-2 record sleep 1

[ Sidenote: i still received no adequate suggestions about how to provide this
category of technical features. ]

Quoted 9 lines
Quoted 6 lines

I.e.:

- Easy default reference to guest instances, and a way for tools to reference them symbolically as well in the multi-guest case. Preferably something trustable and kernel-provided - not some indirect information like a PID file created by libvirt-manager or so.

Usually 'layering violation' is trotted out at such suggestions. [...]

That's weird, how can a feature request be a 'layering violation'?

If something that users find straightforward and usable is a layering violation to you (such as easily being able to access their own files on the host as well ...) then i think you need to revisit the definition of that term instead of trying to fix the user.

Quoted 20 lines

[...] I don't like using the term, because sometimes the layers are incorrect and need to be violated. But it should be done explicitly, not as a shortcut for a minor feature (and profiling is a minor feature, most users will never use it, especially guest-from-host).

The fact is we have well defined layers today, kvm virtualizes the cpu and memory, qemu emulates devices for a single guest, libvirt manages guests. We break this sometimes but there has to be a good reason. So perf needs to talk to libvirt if it wants names. Could be done via linking, or can be done using a pluging libvirt drops into perf.

Quoted 8 lines

- Guest-transparent VFS integration into the host, to recover symbols and debug info in binaries, etc.

There were a few responses to that but none really addressed those problems - they mostly tried to re-define the problem and suggested that i was wrong to want such capabilities and suggested various inferior approaches instead. See the thread for the details - i think i covered every technical suggestion that was made.

Quoted 4 lines

You simply kept ignoring me when I said that if something can be kept out of the kernel without impacting performance, it should be. I don't want emergency patches closing some security hole or oops in a kernel symbol server.

I never suggested an "in kernel space symbol server" which could oops, why would i have suggested that? Please point me to an email where i suggested that.

Quoted 3 lines

The usability argument is a red herring. True, it takes time for things to trickle down to distributions and users. Those who can't wait can download the code and compile, it isn't that difficult.

It's not just "download and compile", it's also "configure correctly for several separate major distributions" and "configure to per guest instance local rules".

It's far more fragile in practice than you make it appear to be, and since you yourself expressed that you are not interested much in the tooling side, how can you have adequate experience to judge such matters?

In fact for instrumentation it's beyond a critical threshold of fragility - instrumentation above all needs to be accessible, transparent and robust.

If you cannot see the advantages of a properly integrated solution then i suspect there's not much i can do to convince you.

And you ignored not just me but you ignored several people in this thread who thought the current status quo was inadequate and expressed interest in both the VFS integration and in the guest enumeration features.

Thanks,

Ingo

#182 lore raw

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

In reply to Anthony Liguori
Quoted 32 lines · Anthony Liguori
Quoted 22 lines · Ingo Molnar
Quoted 5 lines · Anthony Liguori

[...]

I've been trying very hard to turn this into a productive thread attempting to capture your feedback and give clear suggestions about how you can solve achieve your desired functionality.

I'm glad that we are at this more productive stage. I'm still trying to achieve the very same technological capabilities that i expressed in the first few mails when i reviewed the 'perf kvm' patch that was submitted by Yanmin.

The crux of the problem is very simple. To quote my earlier mail:

 |
 | - The inconvenience of having to type:
 |      perf kvm --host --guest --guestkallsyms=/home/ymzhang/guest/kallsyms \
 |               --guestmodules=/home/ymzhang/guest/modules top
 |
 |
 |   is very obvious even with a single guest. Now multiply that by more guests ...
 |
Quoted 8 lines

For example we want 'perf kvm top' to do something useful by default: it should find the first guest running and it should report its profile.

The tool shouldnt have to guess about where the guests are, what their namespaces is and how to talk to them. We also want easy symbolic access to guest, for example:

perf kvm -g OpenSuse-2 record sleep 1

Quoted 7 lines

Two things are needed. The first thing needed is to be able to enumerate running guests and identify a symbolic name. I have a patch for this and it'll be posted this week or so. perf will need to have a QMP client and it will need to look in ${HOME}/.qemu/qmp/ to sockets to connect to.

This is too much to expect from a client and we've got a GSoC idea posted to make a nice library for tools to use to simplify this.

Ok, that sounds interesting! I'd rather see some raw mechanism that 'perf kvm' could use instead of having to require yet another library (which generally dampens adoption of a tool). So i think we can work from there.

Btw., have you considered using Qemu's command name (task->comm[]) as the symbolic name? That way we could see the guest name in 'top' on the host - a nice touch.

Quoted 3 lines

The sockets are named based on UUID and you'll have to connect to a guest and ask it for it's name. Some guests don't have names so we'll have to come up with a clever way to describe a nameless VM.

I think just exposing the UUID in that lazy case would be adequate? It creates pressure for VM launchers to use better symbolic names.

Quoted 7 lines
Quoted 6 lines

I.e.:

- Easy default reference to guest instances, and a way for tools to reference them symbolically as well in the multi-guest case. Preferably something trustable and kernel-provided - not some indirect information like a PID file created by libvirt-manager or so.

Quoted 6 lines

A guest is not a KVM concept. It's a qemu concept so it needs to be something provided by qemu. The other caveat is that you won't see guests created by libvirt because we're implementing this in terms of a default QMP device and libvirt will disable defaults. This is desired behaviour. libvirt wants to be in complete control and doesn't want a tool like perf interacting with a guest directly.

Hm, this sucks for multiple reasons. Firstly, perf isnt a tool that 'interacts', it's an observation tool: just like 'top' is an observation tool.

We want to enable developers to see all activities on the system - regardless of who started the VM or who started the process. Imagine if we had a way to hide tasks to hide from 'top'. It would be rather awful.

Secondly, it tells us that the concept is fragile if it doesnt automatically enumerate all guests, regardless of how they were created.

Full system enumeration is generally best left to the kernel, as it can offer coherent access.

Ingo

#191 lore raw

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

In reply to Ingo Molnar
Quoted 17 lines · Ingo Molnar
Quoted 14 lines · Avi Kivity
Quoted 14 lines

The crux of the problem is very simple. To quote my earlier mail:

  |
  | - The inconvenience of having to type:
  |      perf kvm --host --guest --guestkallsyms=/home/ymzhang/guest/kallsyms \
  |               --guestmodules=/home/ymzhang/guest/modules top
  |
  |
  |   is very obvious even with a single guest. Now multiply that by more guests ...
  |

For example we want 'perf kvm top' to do something useful by default: it should find the first guest running and it should report its profile.

Quoted 9 lines
Quoted 6 lines
Quoted 6 lines

The tool shouldnt have to guess about where the guests are, what their namespaces is and how to talk to them. We also want easy symbolic access to guest, for example:

perf kvm -g OpenSuse-2 record sleep 1

[ Sidenote: i still received no adequate suggestions about how to provide this
category of technical features. ]

You need to integrate with libvirt to convert guest names something that can be used to obtain guest symbols.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

I.e.:

- Easy default reference to guest instances, and a way for tools to reference them symbolically as well in the multi-guest case. Preferably something trustable and kernel-provided - not some indirect information like a PID file created by libvirt-manager or so.

Quoted 5 lines
Quoted 3 lines

Usually 'layering violation' is trotted out at such suggestions. [...]

That's weird, how can a feature request be a 'layering violation'?

The 'something trustable and kernel-provided'. The kernel knows nothing about guest names.

Quoted 5 lines

If something that users find straightforward and usable is a layering violation to you (such as easily being able to access their own files on the host as well ...) then i think you need to revisit the definition of that term instead of trying to fix the user.

Here is the explanation, you left it quoted:

Quoted 11 lines
Quoted 10 lines

[...] I don't like using the term, because sometimes the layers are incorrect and need to be violated. But it should be done explicitly, not as a shortcut for a minor feature (and profiling is a minor feature, most users will never use it, especially guest-from-host).

The fact is we have well defined layers today, kvm virtualizes the cpu and memory, qemu emulates devices for a single guest, libvirt manages guests. We break this sometimes but there has to be a good reason. So perf needs to talk to libvirt if it wants names. Could be done via linking, or can be done using a pluging libvirt drops into perf.

Quoted 9 lines
Quoted 5 lines

You simply kept ignoring me when I said that if something can be kept out of the kernel without impacting performance, it should be. I don't want emergency patches closing some security hole or oops in a kernel symbol server.

I never suggested an "in kernel space symbol server" which could oops, why would i have suggested that? Please point me to an email where i suggested that.

You insisted that it be in the kernel. Later you relaxed that and said a daemon is fine. I'm not going to reread this thread, once is more than enough.

Quoted 8 lines
Quoted 4 lines

The usability argument is a red herring. True, it takes time for things to trickle down to distributions and users. Those who can't wait can download the code and compile, it isn't that difficult.

It's not just "download and compile", it's also "configure correctly for several separate major distributions" and "configure to per guest instance local rules".

That's life in Linux-land. Either you let distributions feed you cooked packages and relax, or you do the work yourself. If we had tools/everything/ it wouldn't be this way, but we don't.

Quoted 4 lines

It's far more fragile in practice than you make it appear to be, and since you yourself expressed that you are not interested much in the tooling side, how can you have adequate experience to judge such matters?

People on kvm-devel manage to build and run release tarballs and even directly from git. I build packages from source occasionally. It isn't fun but it doesn't take a PhD.

Quoted 6 lines

In fact for instrumentation it's beyond a critical threshold of fragility - instrumentation above all needs to be accessible, transparent and robust.

If you cannot see the advantages of a properly integrated solution then i suspect there's not much i can do to convince you.

Integration in Linux happens at the desktop or distribution level. You want to move it to the kernel level. It works for perf, great, but that doesn't mean it will work for everything else. Once perf grows a GUI, I expect it will stop working for perf as well (for example, if gtk breaks its API in a major release, which version will perf code for?)

Quoted 4 lines

And you ignored not just me but you ignored several people in this thread who thought the current status quo was inadequate and expressed interest in both the VFS integration and in the guest enumeration features.

I'm sorry. I don't reply to every email. If you want my opinion on something, you can ask me again.

Signature · 1 line
error compiling committee.c: too many arguments to function
#184 lore raw

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

In reply to Anthony Liguori
Quoted 6 lines · Anthony Liguori
Quoted 4 lines

- Easy default reference to guest instances, and a way for tools to reference them symbolically as well in the multi-guest case. Preferably something trustable and kernel-provided - not some indirect information like a PID file created by libvirt-manager or so.

A guest is not a KVM concept. [...]

Well, in a sense a guest is a KVM concept too: it's in essence represented via the 'vcpu state attached to a struct mm' abstraction that is attached to the /dev/kvm file descriptor attached to a Linux process.

Multiple vcpus can be started by the same process to represent SMP, but the whole guest notion is present: a Linux MM that carries KVM state.

In that sense when we type 'perf kvm list' we'd like to get a list of all currently present guests that the developer has permission to profile: i.e. we'd like a list of all [debuggable] Linux tasks that have a KVM instance attached to them.

A convenient way to do that would be to use the Qemu process's ->comm[] name, and to have a KVM ioctl that gets us a list of all vcpus that the querying task has ptrace permission to. [the standard permission check we do for instrumentation]

No need for communication with Qemu for that - just an ioctl, and an always-guaranteed result that works fine on a whole-system and on a per user basis as well.

Thanks,

Ingo

#143 lore raw

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

In reply to Ingo Molnar
Quoted 5 lines · mingo

[...]

Quoted 3 lines

No, the split-repository situation was the smallest problem after all. Its was a community thing. If the community doesn't work a single-repo project will also fail. [...]

Quoted 7 lines

So, what do you think creates code communities and keeps them alive? Developers and code. And the wellbeing of developers are primarily influenced by the repository structure and by the development/maintenance process - i.e. by the 'fun' aspect. (i'm simplifying things there but that's the crux of it.)

So yes, i do claim that what stiffled and eventually killed off the Oprofile community was the split repository. [...]

In your very previous paragraphs, you enumerate two separate causes:
"repository structure" and "development/maintenance process" as being sources of "fun". Please simply accept that the former is considered by many as absolutely trivial compared to the latter, and additional verbose repetition of your thesis will not change this.

- FChE

#144 lore raw

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

Hi Frank,

Quoted 5 lines · Frank Ch. Eigler

In your very previous paragraphs, you enumerate two separate causes:
"repository structure" and "development/maintenance process" as being sources of "fun".  Please simply accept that the former is considered by many as absolutely trivial compared to the latter, and additional verbose repetition of your thesis will not change this.

I can accept that many people consider it trivial but the problem is that we have _real data_ on kmemtrace and now perf that the amount of contributors is significantly smaller when your code is outside the kernel repository. Now admittedly both of them are pretty intimate with the kernel but Ingo's suggestion of putting kvm-qemu in tools/ is an interesting idea nevertheless.

It's kinda funny to see people argue that having an external repository is not a problem and that it's not a big deal if building something from the repository is slightly painful as long as it doesn't require a PhD when we have _real world_ experience that it _does_ limit developer base in some cases. Whether or not that applies to kvm remains to be seen but I've yet to see a convincing argument why it doesn't.

Pekka

#126 lore raw

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

In reply to Ingo Molnar
Quoted 24 lines · Ingo Molnar
Quoted 10 lines · Avi Kivity
Quoted 5 lines · Ingo Molnar

Reality is, the server space never was and never will be self-sustaining in the long run (as Novell has found it out with Netware), it is the desktop that dictates future markets. This is why i find your views about this naive and shortsighted.

Yet Linux is gaining ground in the server and embedded space while struggling on the desktop. [...]

Frankly, Linux is mainly growing in the server space due to:

1) the server space is technically much simpler than the desktop space. It is far easier to code up a server performance feature than to make struggle through stupid (server-motivated) package boundaries and get something done on the desktop. It is far easier to code up a server app as that space is well standardized and servers tend to be compartmented. Integration between server apps is much less common than integration between desktop apps, hence the harm that our modularization idiocies cause less harm.

Quoted 2 lines

2) Linux's growth is still feeding on the remains of the destruction of Unix.

Agreed (minus the 'package boundaries' stuff). Also, Linux is cheaper than Windows.

Quoted 5 lines

Linux is struggling on the desktop due to the desktop's inherent complexity, due to the lack of the Unix inertia and due to incompetence, insensitivity, intellectual arrogance and shortsightedness of server-centric thinking, like your arguments/position displayed in this very thread.

It's struggling because it isn't competitive technically with other desktops, because there is no application base, because of a chicken-and-egg problem with some drivers, because lack of a stable ABI means you can't get a driver CD with your device so you need a yet-unreleased kernel, because the zillion binary incompatible distributions mean that application developers don't know what to code and test for, because of lack of documentation, to name a few. At least it's improving all the time.

The incompetence, insensitivity, intellectual arrogance and shortsightedness of server-centric thinking of my arguments/position are a result of this, not the cause.

Quoted 7 lines
Quoted 3 lines

[...] Apple is gaining ground on the desktop but is invisible on the server side (despite having a nice product - Xserve).

But the thing is, Apple doesnt really care about the server space, yet. It is lucrative but it is a side-show: it will fall automatically to the 'winner' of the desktop (or gadget) of tomorrow.

It won't automatically fall to Apple, there's tons of middleware and server apps that need porting (the "ecosystem"), plus they need to work hard on improving their kernel which is desktop oriented. Looks like they're interesting in other things.

Quoted 3 lines

Has the quick fall of Banyan Vines or Netware (both excellent all-around server products) taught you nothing?

Not familiar with Banyan, but wasn't Netware a cooperative multitasking command line only thing? It couldn't compete with preemptive modern system with a nice GUI. Windows didn't need the desktop to win that fight.

Quoted 7 lines

We need a lot more desktop focus in the kernel community. The best method to achieve this, that i know of currently, is to simply have kernel developers think outside the kernel box and to have them do bits of user-space coding as well - and in particular desktop coding. To eat our own dogfood in essence. Suffer through crap we cause to user-space. To face the _real_ difficulties of users. We seem to have forgotten our roots.

Try it yourself and report the experience. Note: perf is not desktop development, it's kernel tooling development.

Quoted 7 lines
Quoted 5 lines

[...]

It's true Windows achieved server dominance through it's desktop power, but I don't think that's what keeping them there now.

What is keeping them there is precisely that.

Not at all. They have excellent development tools and lots of middleware and other third party products that make it easy to pick Windows. For example, Exchange is more or less standard for groupware, and they made C# and the technology around it easy to develop for, learning from Java's mistakes.

Quoted 9 lines
Quoted 5 lines

In any case, I'm not going to write a kvm GUI. It doesn't match my skills, interest, or my employer's interest. If you wish to see a kvm GUI you have to write one yourself or convince someone to write it (perhaps convince Red Hat to fund such an effort beyond virt-manager).

As a maintainer you certainly dont have to write a single line of code, if you dont want to. You 'just' need to care about the big picture and encourage/help the flow and balance of the whole project.

I haven't written that line of code, and no one else has either. Don't tell me they're all scared of me.

Signature · 1 line
error compiling committee.c: too many arguments to function
#145 lore raw

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

In reply to Pekka Enberg
Quoted 8 lines · Pekka Enberg

It's kinda funny to see people argue that having an external repository is not a problem and that it's not a big deal if building something from the repository is slightly painful as long as it doesn't require a PhD when we have _real world_ experience that it _does_ limit developer base in some cases. Whether or not that applies to kvm remains to be seen but I've yet to see a convincing argument why it doesn't.

qemu has non-Linux developers. Not all of their contributions are relevant to kvm but some are. If we pull qemu into tools/kvm, we lose them.

Signature · 1 line
error compiling committee.c: too many arguments to function
#192 lore raw

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

In reply to Avi Kivity
Quoted 5 lines · Avi Kivity
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

- Easy default reference to guest instances, and a way for tools to reference them symbolically as well in the multi-guest case. Preferably something trustable and kernel-provided - not some indirect information like a PID file created by libvirt-manager or so.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Usually 'layering violation' is trotted out at such suggestions. [...]

That's weird, how can a feature request be a 'layering violation'?

The 'something trustable and kernel-provided'. The kernel knows nothing about guest names.

The kernel certainly knows about other resources such as task names or network interface names or tracepoint names. This is kernel design 101.

Quoted 5 lines
Quoted 4 lines

If something that users find straightforward and usable is a layering violation to you (such as easily being able to access their own files on the host as well ...) then i think you need to revisit the definition of that term instead of trying to fix the user.

Quoted 12 lines

Here is the explanation, you left it quoted:

Quoted 10 lines
Quoted 10 lines

[...] I don't like using the term, because sometimes the layers are incorrect and need to be violated. But it should be done explicitly, not as a shortcut for a minor feature (and profiling is a minor feature, most users will never use it, especially guest-from-host).

The fact is we have well defined layers today, kvm virtualizes the cpu and memory, qemu emulates devices for a single guest, libvirt manages guests. We break this sometimes but there has to be a good reason. So perf needs to talk to libvirt if it wants names. Could be done via linking, or can be done using a pluging libvirt drops into perf.

This is really just the much-discredited microkernel approach for keeping global enumeration data that should be kept by the kernel ...

Lets look at the ${HOME}/.qemu/qmp/ enumeration method suggested by Anthony. There's numerous ways that this can break:

- Those special files can get corrupted, mis-setup, get out of sync, or can be hard to discover.

- The ${HOME}/.qemu/qmp/ solution suggested by Anthony has a very obvious design flaw: it is per user. When i'm root i'd like to query _all_ current guest images, not just the ones started by root. A system might not even have a notion of '${HOME}'.

- Apps might start KVM vcpu instances without adhering to the ${HOME}/.qemu/qmp/ access method.

- There is no guarantee for the Qemu process to reply to a request - while the kernel can always guarantee an enumeration result. I dont want 'perf kvm' to hang or misbehave just because Qemu has hung.

Really, for such reasons user-space is pretty poor at doing system-wide enumeration and resource management. Microkernels lost for a reason.

You are committing several grave design mistakes here.

Thanks,

Ingo

#146 lore raw

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

In reply to Avi Kivity
Quoted 11 lines · Avi Kivity
Quoted 7 lines · Pekka Enberg

It's kinda funny to see people argue that having an external repository is not a problem and that it's not a big deal if building something from the repository is slightly painful as long as it doesn't require a PhD when we have _real world_ experience that it _does_ limit developer base in some cases. Whether or not that applies to kvm remains to be seen but I've yet to see a convincing argument why it doesn't.

qemu has non-Linux developers. Not all of their contributions are relevant to kvm but some are. If we pull qemu into tools/kvm, we lose them.

Qemu had very few developers before KVM made use of it - i know it because i followed the project prior KVM.

So whatever development activitity Qemu has today, it's 99% [WAG] attributable to KVM. It might have non-Linux contributors, but they wouldnt be there if it wasnt for all the Linux contributors ...

Furthermore, those contributors wouldnt have to leave - they could simply use a different Git URI ...

Ingo

#152 lore raw

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

In reply to Pekka Enberg
Quoted 9 lines · Pekka Enberg

Hi Frank,

Quoted 5 lines · Frank Ch. Eigler

In your very previous paragraphs, you enumerate two separate causes:
"repository structure" and "development/maintenance process" as being sources of "fun". ?Please simply accept that the former is considered by many as absolutely trivial compared to the latter, and additional verbose repetition of your thesis will not change this.

Quoted 6 lines

I can accept that many people consider it trivial but the problem is that we have _real data_ on kmemtrace and now perf that the amount of contributors is significantly smaller when your code is outside the kernel repository. Now admittedly both of them are pretty intimate with the kernel but Ingo's suggestion of putting kvm-qemu in tools/ is an interesting idea nevertheless.

Correct.

Quoted 6 lines

It's kinda funny to see people argue that having an external repository is not a problem and that it's not a big deal if building something from the repository is slightly painful as long as it doesn't require a PhD when we have _real world_ experience that it _does_ limit developer base in some cases. Whether or not that applies to kvm remains to be seen but I've yet to see a convincing argument why it doesn't.

Yeah.

Also, if in fact the claim that the 'repository does not matter' is true then it doesnt matter that it's hosted in tools/kvm/ either, right?

I.e. it's a win-win situation. Worst-case nothing happens beyond a Git URI change. Best-case the project is propelled to never seen heights due to contribution advantages not contemplated and not experienced by the KVM guys before ...

Ingo

#154 lore raw

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

In reply to Ingo Molnar
Quoted 6 lines · Ingo Molnar

So, what do you think creates code communities and keeps them alive? Developers and code. And the wellbeing of developers are primarily influenced by the repository structure and by the development/maintenance process - i.e. by the 'fun' aspect. (i'm simplifying things there but that's the crux of it.)

There is nothing fun about having one repository or two. Who cares about this anyway?

tools/kvm/ probably will draw developers, simply because of the glory associated with kernel work. That's a bug, not a feature. It means that effort is not distributed according to how it's needed, but because of irrelevant considerations.

Quoted 3 lines

I simply do not want to see KVM face the same fate, and yes i do see similar warnings signs.

The number of kvm and qemu developers keeps increasing.

We're having a kvm forum in August where we all meet. Come and see for yourself.

Quoted 6 lines
Quoted 3 lines

We actually have lguest which is small. But it lacks functionality and the developer community KVM has attracted.

I suggested long ago to merge lguest into KVM to cover non-VMX/non-SVM execution.

Rusty posted some initial patches for pv-only kvm but he lost interest before they were completed. No one followed up.

btw, lguest has a single repository, userspace and kernel in the same repository, yet is practically dead.

Quoted 10 lines
Quoted 7 lines
Quoted 2 lines

I think you are rationalizing the status quo.

I see that there are issues with KVM today in some areas. You pointed out the desktop usability already. I personally have trouble with the qem-kvm.git because it is unbisectable. But repository unification doesn't solve the problem here.

Why doesnt it solve the bisectability problem? The kernel repo is supposed to be bisectable so that problem would be solved.

These days qemu-kvm.git is bisectable (though not always trivially). qemu.git doesn't have this problem.

Quoted 18 lines
Quoted 5 lines

The point for a single repository is that it simplifies the development process. I agree with you here. But the current process of KVM is not too difficult after all. I don't have to touch qemu sources for most of my work on KVM.

In my judgement you'd have to do that more frequently, if KVM was properly weighting its priorities. For example regarding this recent KVM commit of yours:

| commit ec1ff79084fccdae0dca9b04b89dcdf3235bbfa1
| Author: Joerg Roedel<[email protected]>
| Date:   Fri Oct 9 16:08:31 2009 +0200
|
|     KVM: SVM: Add tracepoint for invlpga instruction
|
|     This patch adds a tracepoint for the event that the guest
|     executed the INVLPGA instruction.
Quoted 4 lines

With integrated KVM tooling i might have insisted for that new tracepoint to be available to users as well via some more meaningful tooling than just a pure tracepoint.

Something I've wanted for a long time is to port kvm_stat to use tracepoints instead of the home-grown instrumentation. But that is unrelated to this new tracepoint. Other than that we're satisfied with ftrace.

Quoted 4 lines

You should realize that naturally developers will gravitate towards the most 'fun' aspects of a project. It is the task of the maintainer to keep the balance between fun and utility, bugs and features, quality and code-rot.

There are plenty of un-fun tasks (like fixing bugs and providing RAS features) that we're doing. We don't do this for fun but to satisfy our users.

Signature · 1 line
error compiling committee.c: too many arguments to function
#148 lore raw

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

In reply to Avi Kivity

Hi Avi,

Quoted 10 lines · Avi Kivity
Quoted 7 lines

It's kinda funny to see people argue that having an external repository is not a problem and that it's not a big deal if building something from the repository is slightly painful as long as it doesn't require a PhD when we have _real world_ experience that it _does_ limit developer base in some cases. Whether or not that applies to kvm remains to be seen but I've yet to see a convincing argument why it doesn't.

qemu has non-Linux developers.  Not all of their contributions are relevant to kvm but some are.  If we pull qemu into tools/kvm, we lose them.

Yeah, you probably would but the hypothesis is that you'd end up with a bigger net developer base for the _Linux_ version. Now you might not think that's important but I certainly do and I think Ingo does as well. ;-)

That said, pulling 400 KLOC of code into the kernel sounds really excessive. Would we need all that if we just do native virtualization and no actual emulation?

Pekka

#193 lore raw

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

In reply to Ingo Molnar
Quoted 7 lines · Ingo Molnar
Quoted 4 lines

The 'something trustable and kernel-provided'. The kernel knows nothing about guest names.

The kernel certainly knows about other resources such as task names or network interface names or tracepoint names. This is kernel design 101.

But it doesn't know about guest names. You can't trust task names since any user can create a task with any name. Network interfaces are root only so you can trust their names.

There are dozens or even hundreds of object classes the kernel does not know about and cannot enumerate. User names, for instance. X sessions. Windows (the screen artifact, not the OS). CIFS shares exported by this machine. Currently running applications (not processes).

btw, network interfaces would have been much better of using /dev/netif/name rather than having their own namespace, IMO, like disks.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

[...] I don't like using the term, because sometimes the layers are incorrect and need to be violated. But it should be done explicitly, not as a shortcut for a minor feature (and profiling is a minor feature, most users will never use it, especially guest-from-host).

Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

The fact is we have well defined layers today, kvm virtualizes the cpu and memory, qemu emulates devices for a single guest, libvirt manages guests. We break this sometimes but there has to be a good reason. So perf needs to talk to libvirt if it wants names. Could be done via linking, or can be done using a pluging libvirt drops into perf.

This is really just the much-discredited microkernel approach for keeping global enumeration data that should be kept by the kernel ...

I disagree it should be kept in the kernel. Why introduce a new namespace, with APIs to query it, manage it, rules regarding conflicts, then virtualize it for containers.

Quoted 3 lines

Lets look at the ${HOME}/.qemu/qmp/ enumeration method suggested by Anthony. There's numerous ways that this can break:

I don't like it either. We have libvirt for enumerating guests.

Quoted 11 lines

- Those special files can get corrupted, mis-setup, get out of sync, or can be hard to discover.

- The ${HOME}/.qemu/qmp/ solution suggested by Anthony has a very obvious design flaw: it is per user. When i'm root i'd like to query _all_ current guest images, not just the ones started by root. A system might not even have a notion of '${HOME}'.

- Apps might start KVM vcpu instances without adhering to the

    ${HOME}/.qemu/qmp/ access method.

- it doesn't work with nfs.

Quoted 4 lines

- There is no guarantee for the Qemu process to reply to a request - while the kernel can always guarantee an enumeration result. I dont want 'perf kvm' to hang or misbehave just because Qemu has hung.

If qemu doesn't reply, your guest is dead anyway.

Quoted 3 lines

Really, for such reasons user-space is pretty poor at doing system-wide enumeration and resource management. Microkernels lost for a reason.

Take a look at your desktop, userspace is doing all of that everywhere, from enumerating users and groups, to deciding how your disks are named. The kernel only provides the bare facilities.

Quoted 2 lines

You are committing several grave design mistakes here.

I am committing on the shoulders of giants.

Signature · 1 line
error compiling committee.c: too many arguments to function
#147 lore raw

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

In reply to Ingo Molnar
Quoted 12 lines · Ingo Molnar
Quoted 9 lines · Avi Kivity
Quoted 7 lines · Pekka Enberg

It's kinda funny to see people argue that having an external repository is not a problem and that it's not a big deal if building something from the repository is slightly painful as long as it doesn't require a PhD when we have _real world_ experience that it _does_ limit developer base in some cases. Whether or not that applies to kvm remains to be seen but I've yet to see a convincing argument why it doesn't.

Quoted 6 lines
Quoted 3 lines

qemu has non-Linux developers. Not all of their contributions are relevant to kvm but some are. If we pull qemu into tools/kvm, we lose them.

Qemu had very few developers before KVM made use of it - i know it because i followed the project prior KVM.

No argument.

Quoted 7 lines

So whatever development activitity Qemu has today, it's 99% [WAG] attributable to KVM. It might have non-Linux contributors, but they wouldnt be there if it wasnt for all the Linux contributors ...

Furthermore, those contributors wouldnt have to leave - they could simply use a different Git URI ...

tools/kvm would drop support for non-Linux hosts, for tcg, and for architectures which kvm doesn't support ("clean and minimal"). That would be the real win, not sharing the repository. But those other contributors would just stay with the original qemu.

Signature · 1 line
error compiling committee.c: too many arguments to function
#153 lore raw

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

In reply to Ingo Molnar
Quoted 8 lines · Ingo Molnar
Quoted 8 lines

It's kinda funny to see people argue that having an external repository is not a problem and that it's not a big deal if building something from the repository is slightly painful as long as it doesn't require a PhD when we have _real world_ experience that it _does_ limit developer base in some cases. Whether or not that applies to kvm remains to be seen but I've yet to see a convincing argument why it doesn't.

Quoted 5 lines

Yeah.

Also, if in fact the claim that the 'repository does not matter' is true then it doesnt matter that it's hosted in tools/kvm/ either, right?

Again, the second it's moved to tools/kvm/ we strip it off anything that kvm can't use.

Quoted 5 lines

I.e. it's a win-win situation. Worst-case nothing happens beyond a Git URI change. Best-case the project is propelled to never seen heights due to contribution advantages not contemplated and not experienced by the KVM guys before ...

You're exaggerating. There were 773 commits into qemu.git (excluding qemu-kvm.git) in the past three months. 162 for the same period for tools/perf. The pool is not that deep.

Signature · 1 line
error compiling committee.c: too many arguments to function
#149 lore raw

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

In reply to Pekka Enberg
Quoted 12 lines · Pekka Enberg

Hi Avi,

Quoted 8 lines · Avi Kivity
Quoted 8 lines

It's kinda funny to see people argue that having an external repository is not a problem and that it's not a big deal if building something from the repository is slightly painful as long as it doesn't require a PhD when we have _real world_ experience that it _does_ limit developer base in some cases. Whether or not that applies to kvm remains to be seen but I've yet to see a convincing argument why it doesn't.

Quoted 8 lines
Quoted 3 lines

qemu has non-Linux developers. Not all of their contributions are relevant to kvm but some are. If we pull qemu into tools/kvm, we lose them.

Yeah, you probably would but the hypothesis is that you'd end up with a bigger net developer base for the _Linux_ version. Now you might not think that's important but I certainly do and I think Ingo does as well. ;-)

You're probably correct, but the point is that non-Linux developers also contribute things which kvm benefits from. Not a whole lot, but some.

Quoted 4 lines

That said, pulling 400 KLOC of code into the kernel sounds really excessive. Would we need all that if we just do native virtualization and no actual emulation?

What is native virtualization and no actual emulation?

Signature · 1 line
error compiling committee.c: too many arguments to function
#189 lore raw

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

In reply to Pekka Enberg
Quoted 7 lines · Pekka Enberg
Quoted 5 lines · Avi Kivity
Quoted 5 lines

You simply kept ignoring me when I said that if something can be kept out of the kernel without impacting performance, it should be. I don't want emergency patches closing some security hole or oops in a kernel symbol server.

Quoted 5 lines
Quoted 3 lines

Or rather, explained how I am a wicked microkernelist. The herring were out in force today.

Well, if it's not being a "wicked microkernelist" then what is it?

I know I'm bad.

Quoted 4 lines

Performance is hardly the only motivation to put things into the kernel. Think kernel mode-setting and devtmpfs (with the ironic twist of original devfs being removed from the kernel) here, for example.

Motivations include privileged device access, needing to access physical memory, security, and keeping the userspace interface sane. There are others. I don't think any of them hold here.

Signature · 1 line
error compiling committee.c: too many arguments to function
#150 lore raw

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

In reply to Avi Kivity
Quoted 5 lines · Avi Kivity
Quoted 3 lines

That said, pulling 400 KLOC of code into the kernel sounds really excessive. Would we need all that if we just do native virtualization and no actual emulation?

What is native virtualization and no actual emulation?

What I meant with "actual emulation" was running architecture A code on architecture B what was qemu's traditional use case. So the question was how much of the 400 KLOC do we need for just KVM on all the architectures that it supports?

#138 lore raw

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

In reply to Ingo Molnar
Quoted 11 lines · Ingo Molnar
Quoted 9 lines
Quoted 6 lines

If you are interested in the first-hand experience of the people who are doing the perf work then here it is: by far the biggest reason for perf success and perf usability is the integration of the user-space tooling with the kernel-space bits, into a single repository and project.

Please take a look at the kvm integration code in qemu as a fraction of the whole code base.

You have to admit that much of Qemu's past 2-3 years of development was motivated by Linux/KVM (i'd say more than 50% of the code).

kvm certainly revitalized qemu development.

Quoted 4 lines

As such it's one
and the same code base - you just continue to define Qemu to be different from KVM.

It's not the same code base. kvm provides a cpu virtualization service, qemu uses it. There could be other users. qemu could go away one day and be replaced by something else (tools/kvm?), and kvm would be unaffected.

Quoted 3 lines

I very much remember how Qemu looked like _before_ KVM: it was a struggling, dying project. KVM clearly changed that.

I'm a hero.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The very move you are opposing so vehemently for KVM.

I don't want to fracture a working community.

Would you accept (or at least not NAK) a new tools/kvm/ tool that builds tooling from grounds up, while leaving Qemu untouched? [assuming it's all clean code, etc.]

I couldn't NAK tools/kvm any more than I could NAK a new project outside the kernel repository. IMO it would be duplicated effort, but like I mentioned before, I can't tell volunteers what to do, only recommend that they join the existing effort.

Quoted 4 lines

Although i have doubts about how well that would work 'against' your opinion:
such a tool would need lots of KVM-side features and a positive attitude from you to be really useful. There's a lot of missing functionality to cover.

Functionality that can be implemented in userspace will not be accepted into kvm unless there are very good reasons why it should be. Things that belong in kvm will be more than welcome.

Quoted 6 lines
Quoted 4 lines

Seems like perf is also split, with sysprof being developed outside the kernel. Will you bring sysprof into the kernel? Will every feature be duplicated in prof and sysprof?

I'd prefer if sysprof merged into perf as 'perf view' - but its maintainer does not want that - which is perfectly OK.

You spared him the flamewar, I hope.

Quoted 3 lines

So we are building equivalent
functionality into perf instead.

Ah, duplicating effort. Great.

Quoted 5 lines

Think about it like Firefox plugins: the main Firefox project picks up the functionality of the most popular Firefox plugins all the time. Session Saver, Tab Mix Plus, etc. were all in essence 'merged' (in functionality, not in code) into the 'reference' Firefox project.

There's a difference between absorbing a small plugin and duplicating a project.

Signature · 1 line
error compiling committee.c: too many arguments to function
#183 lore raw

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

In reply to Ingo Molnar
Quoted 5 lines · Ingo Molnar

Ok, that sounds interesting! I'd rather see some raw mechanism that 'perf kvm' could use instead of having to require yet another library (which generally dampens adoption of a tool). So i think we can work from there.

You can access the protocol directly if you don't want a library dependency.

Quoted 4 lines

Btw., have you considered using Qemu's command name (task->comm[]) as the symbolic name? That way we could see the guest name in 'top' on the host - a nice touch.

qemu-system-x86_64 -name Fedora,process=qemu-Fedora

Does exactly that. We don't make this default based on the element of least surprise. Many users expect to be able to do killall qemu-system-x86 and if we did this by default, that wouldn't work.

Quoted 7 lines
Quoted 4 lines

The sockets are named based on UUID and you'll have to connect to a guest and ask it for it's name. Some guests don't have names so we'll have to come up with a clever way to describe a nameless VM.

I think just exposing the UUID in that lazy case would be adequate? It creates pressure for VM launchers to use better symbolic names.

Yup.

Quoted 17 lines
Quoted 7 lines
Quoted 7 lines

I.e.:

- Easy default reference to guest instances, and a way for tools to reference them symbolically as well in the multi-guest case. Preferably something trustable and kernel-provided - not some indirect information like a PID file created by libvirt-manager or so.

Quoted 7 lines

A guest is not a KVM concept. It's a qemu concept so it needs to be something provided by qemu. The other caveat is that you won't see guests created by libvirt because we're implementing this in terms of a default QMP device and libvirt will disable defaults. This is desired behaviour. libvirt wants to be in complete control and doesn't want a tool like perf interacting with a guest directly.

Hm, this sucks for multiple reasons. Firstly, perf isnt a tool that 'interacts', it's an observation tool: just like 'top' is an observation tool.

Quoted 7 lines

We want to enable developers to see all activities on the system - regardless of who started the VM or who started the process. Imagine if we had a way to hide tasks to hide from 'top'. It would be rather awful.

Secondly, it tells us that the concept is fragile if it doesnt automatically enumerate all guests, regardless of how they were created.

Perf does interact with a guest though because it queries a guest to read it's file system.

I understand the point you're making though. If instead of doing a pull interface where the host queries the guest for files, if the guest pushed a small set of files at startup which the host cached, then you could potentially unconditionally expose a "read-only" socket that only exposed limited information.

Quoted 3 lines

Full system enumeration is generally best left to the kernel, as it can offer coherent access.

I don't see why qemu can't offer coherent access. The limitation today is intentional and if it's overly restrictive, we can figure out a means to change it.

Regards,

Anthony Liguori

Quoted 2 lines

Ingo

#185 lore raw

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

In reply to Ingo Molnar
Quoted 22 lines · Ingo Molnar
Quoted 7 lines · Anthony Liguori
Quoted 5 lines

- Easy default reference to guest instances, and a way for tools to reference them symbolically as well in the multi-guest case. Preferably something trustable and kernel-provided - not some indirect information like a PID file created by libvirt-manager or so.

A guest is not a KVM concept. [...]

Well, in a sense a guest is a KVM concept too: it's in essence represented via the 'vcpu state attached to a struct mm' abstraction that is attached to the /dev/kvm file descriptor attached to a Linux process.

Multiple vcpus can be started by the same process to represent SMP, but the whole guest notion is present: a Linux MM that carries KVM state.

In that sense when we type 'perf kvm list' we'd like to get a list of all currently present guests that the developer has permission to profile: i.e. we'd like a list of all [debuggable] Linux tasks that have a KVM instance attached to them.

Quoted 9 lines

A convenient way to do that would be to use the Qemu process's ->comm[] name, and to have a KVM ioctl that gets us a list of all vcpus that the querying task has ptrace permission to. [the standard permission check we do for instrumentation]

No need for communication with Qemu for that - just an ioctl, and an always-guaranteed result that works fine on a whole-system and on a per user basis as well.

You need a way to interact with the guest which means you need some type of device. All of the interesting devices are implemented in qemu so you're going to have to interact with qemu if you want meaningful interaction with a guest.

Regards,

Anthony Liguori

Quoted 4 lines

Thanks,

Ingo

#212 lore raw

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

In reply to Ingo Molnar
Quoted 48 lines · Ingo Molnar
Quoted 5 lines · Avi Kivity
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

- Easy default reference to guest instances, and a way for tools to reference them symbolically as well in the multi-guest case. Preferably something trustable and kernel-provided - not some indirect information like a PID file created by libvirt-manager or so.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Usually 'layering violation' is trotted out at such suggestions. [...]

That's weird, how can a feature request be a 'layering violation'?

The 'something trustable and kernel-provided'. The kernel knows nothing about guest names.

The kernel certainly knows about other resources such as task names or network interface names or tracepoint names. This is kernel design 101.

Quoted 5 lines
Quoted 5 lines

If something that users find straightforward and usable is a layering violation to you (such as easily being able to access their own files on the host as well ...) then i think you need to revisit the definition of that term instead of trying to fix the user.

Quoted 14 lines

Here is the explanation, you left it quoted:

Quoted 11 lines
Quoted 11 lines

[...] I don't like using the term, because sometimes the layers are incorrect and need to be violated. But it should be done explicitly, not as a shortcut for a minor feature (and profiling is a minor feature, most users will never use it, especially guest-from-host).

The fact is we have well defined layers today, kvm virtualizes the cpu and memory, qemu emulates devices for a single guest, libvirt manages guests. We break this sometimes but there has to be a good reason. So perf needs to talk to libvirt if it wants names. Could be done via linking, or can be done using a pluging libvirt drops into perf.

This is really just the much-discredited microkernel approach for keeping global enumeration data that should be kept by the kernel ...

Lets look at the ${HOME}/.qemu/qmp/ enumeration method suggested by Anthony. There's numerous ways that this can break:

- Those special files can get corrupted, mis-setup, get out of sync, or can be hard to discover.

Quoted 8 lines

- The ${HOME}/.qemu/qmp/ solution suggested by Anthony has a very obvious design flaw: it is per user. When i'm root i'd like to query _all_ current guest images, not just the ones started by root. A system might not even have a notion of '${HOME}'.

- Apps might start KVM vcpu instances without adhering to the

    ${HOME}/.qemu/qmp/ access method.

Not all KVM vcpus are running operating systems.

Transitive had a product that was using a KVM context to run their binary translator which allowed them full access to the host processes virtual address space range. In this case, there is no kernel and there are no devices.

That's what I mean by a guest being a userspace context. KVM simply provides a new CPU mode to userspace in the same way that vm8086 mode.

Regards,

Anthony Liguori

Quoted 13 lines

- There is no guarantee for the Qemu process to reply to a request - while the kernel can always guarantee an enumeration result. I dont want 'perf kvm' to hang or misbehave just because Qemu has hung.

Really, for such reasons user-space is pretty poor at doing system-wide enumeration and resource management. Microkernels lost for a reason.

You are committing several grave design mistakes here.

Thanks,

Ingo

#220 lore raw

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

In reply to Ingo Molnar
Quoted 14 lines · Ingo Molnar

This is really just the much-discredited microkernel approach for keeping global enumeration data that should be kept by the kernel ...

Lets look at the ${HOME}/.qemu/qmp/ enumeration method suggested by Anthony. There's numerous ways that this can break:

- Those special files can get corrupted, mis-setup, get out of sync, or can be hard to discover.

- The ${HOME}/.qemu/qmp/ solution suggested by Anthony has a very obvious design flaw: it is per user. When i'm root i'd like to query _all_ current guest images, not just the ones started by root. A system might not even have a notion of '${HOME}'.

Quoted 7 lines

- Apps might start KVM vcpu instances without adhering to the

    ${HOME}/.qemu/qmp/ access method.

- There is no guarantee for the Qemu process to reply to a request - while the kernel can always guarantee an enumeration result. I dont want 'perf kvm' to hang or misbehave just because Qemu has hung.

If your position basically boils down to, we can't trust userspace and we can always trust the kernel, I want to eliminate any userspace path, then I can't really help you out.

I believe we can come up with an infrastructure that satisfies your actual requirements within qemu but if you're also insisting upon the above implementation detail then there's nothing I can do.

Regards,

Anthony Liguori

#151 lore raw

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

In reply to Pekka Enberg
Quoted 6 lines · Pekka Enberg
Quoted 4 lines · Avi Kivity
Quoted 4 lines

That said, pulling 400 KLOC of code into the kernel sounds really excessive. Would we need all that if we just do native virtualization and no actual emulation?

Quoted 7 lines
Quoted 2 lines

What is native virtualization and no actual emulation?

What I meant with "actual emulation" was running architecture A code on architecture B what was qemu's traditional use case. So the question was how much of the 400 KLOC do we need for just KVM on all the architectures that it supports?

qemu is 620 KLOC. Without cpu emulation that drops to ~480 KLOC. Much of that is device emulation that is not supported by kvm now (like ARM) but some might be needed again in the future (like ARM).

x86-only is perhaps 300 KLOC, but kvm is not x86 only.

And that is with a rudimentary GUI. GUIs are heavy.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#135 lore raw

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

In reply to Ingo Molnar
Quoted 29 lines · Ingo Molnar
Quoted 16 lines · Pekka Enberg

Hi Avi,

Quoted 4 lines · Avi Kivity

Seems like perf is also split, with sysprof being developed outside the kernel. ?Will you bring sysprof into the kernel? ?Will every feature be duplicated in prof and sysprof?

I am glad you brought it up! Sysprof was historically outside of the kernel (with it's own kernel module, actually). While the GUI was nice, it was much harder to set up compared to oprofile so it wasn't all that popular. Things improved slightly when Ingo merged the custom kernel module but the _userspace_ part of sysprof was lagging behind a bit. I don't know what's the situation now that they've switched over to perf syscalls but you probably get my point.

Quoted 4 lines

It would be nice if the two projects merged but I honestly don't see any fundamental problem with two (or more) co-existing projects. Friendly competition will ultimately benefit the users (think KDE and Gnome here).

See my previous mail - what i see as the most healthy project model is to have a full solution reference implementation, connected to a flexible halo of plugins or sub-apps.

Firefox does that, KDE does that, and Gnome as well to a certain degree.

Quoted 8 lines

The 'halo' provides a constant feedback of new features, and it also provides competition and pressure on the 'main' code to be top-notch.

The problem i see with KVM is that there's no reference implementation! There is _only_ the KVM kernel part which is not functional in itself. Surrounded by a 'halo' - where none of the entities is really 'the' reference implementation we call 'KVM'.

The reference implementation is qemu-kvm.git, in the future qemu.git. Like the reference implementation of device-mapper is lvm2/device-mapper, not tools/device-mapper.

Quoted 3 lines

This causes constant quality problems as the developers of the main project dont have constant pressure towards good quality (it is not their responsibility to care about user-space bits after all),

The developers of the main project are very much aware that users don't call the ioctls directly but instead use qemu.

Quoted 5 lines

plus it causes a lack
of focus as well: integration between (friendly) competing user-space components is a lot harder than integration within a single framework such as Firefox.

We are very focused, just not on what you think we should be focused.

Quoted 8 lines

I hope this explains my points about modularization a bit better! I suggested KVM to grow a user-space tool component in the kernel repo in tools/kvm/, which would become the reference implementation for tooling. User-space projects can still provide alternative tooling or can plug into this tooling, just like they are doing it now. So the main effect isnt even on those projects but on the kernel developers. The ABI remains and all the user-space packages and projects remain.

Seems like wanton duplication of effort. Can we throw so many developer-years away on duplicate projects? Assuming not all are true volunteers (85% for 2.6.33) who will fund this duplicate effort?

Quoted 5 lines

Yes, i thought Qemu would be a prime candidate to be the baseline for tools/kvm/, but i guess that has become socially impossible now after this flamewar. It's not a big problem in the big scheme of things: tools/kvm/ is best grown up from a small towards larger size anyway ...

Qemu is open source, you can cp it into tools/kvm. Rewriting it from scratch is a mammoth effort, there's a reason kvm, Xen, and virtualbox all use qemu. Qemu itself copied code from bochs. Writing this stuff is hard, especially if there is something already working.

You'll probably get much better threading (the qemu device model is still single threaded), but it will take years to reach where qemu is already at.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#155 lore raw

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

In reply to Avi Kivity
Quoted 8 lines · Avi Kivity
Quoted 6 lines · Ingo Molnar

So, what do you think creates code communities and keeps them alive? Developers and code. And the wellbeing of developers are primarily influenced by the repository structure and by the development/maintenance process - i.e. by the 'fun' aspect. (i'm simplifying things there but that's the crux of it.)

Quoted 7 lines

There is nothing fun about having one repository or two. Who cares about this anyway?

tools/kvm/ probably will draw developers, simply because of the glory associated with kernel work. That's a bug, not a feature. It means that effort is not distributed according to how it's needed, but because of irrelevant considerations.

And yet your solution to that is to ... do all your work in the kernel space and declare the tooling as something that does not interest you? ;-)

Quoted 3 lines

Something I've wanted for a long time is to port kvm_stat to use tracepoints instead of the home-grown instrumentation. But that is unrelated to this new tracepoint. Other than that we're satisfied with ftrace.

Despite it being another in-kernel subsystem that by your earlier arguments should be done via a user-space package? ;-)

Quoted 8 lines
Quoted 4 lines

You should realize that naturally developers will gravitate towards the most 'fun' aspects of a project. It is the task of the maintainer to keep the balance between fun and utility, bugs and features, quality and code-rot.

There are plenty of un-fun tasks (like fixing bugs and providing RAS features) that we're doing. We don't do this for fun but to satisfy our users.

So which one is it, KVM developers are volunteers that do fun stuff and cannot be told about project priorities, or KVM developers are pros who do unfun stuff because they can be told about priorities?

I posit that it's both: and that priorities can be communicated - if only you try as a maintainer. All i'm suggesting is to add 'usable, unified user-space' to the list of unfun priorities, because it's possible and because it matters.

Ingo

#194 lore raw

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

In reply to Avi Kivity
Quoted 4 lines · Avi Kivity
Quoted 2 lines

Lets look at the ${HOME}/.qemu/qmp/ enumeration method suggested by Anthony. There's numerous ways that this can break:

I don't like it either. We have libvirt for enumerating guests.

We're stuck in a rut with libvirt and I think a lot of the dissatisfaction with qemu is rooted in that. It's not libvirt that's the probably, but the relationship between qemu and libvirt.

We add a feature to qemu and maybe after six month it gets exposed by libvirt. Release time lines of the two projects complicate the situation further. People that write GUIs are limited by libvirt because that's what they're told to use and when they need something simple, they're presented with first getting that feature implemented in qemu, then plumbed through libvirt.

It wouldn't be so bad if libvirt was basically a passthrough interface to qemu but it tries to model everything in a generic way which is more or less doomed to fail when you're adding lots of new features (as we are).

The list of things that libvirt doesn't support and won't any time soon is staggering.

libvirt serves an important purpose, but we need to do a better job in qemu with respect to usability. We can't just punt to libvirt.

Regards,

Anthony Liguori

#156 lore raw

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

In reply to Ingo Molnar
Quoted 5 lines · Ingo Molnar

I posit that it's both: and that priorities can be communicated - if only you try as a maintainer. All i'm suggesting is to add 'usable, unified user-space' to the list of unfun priorities, because it's possible and because it matters.

I've spent the past few months dealing with customers using the libvirt/qemu/kvm stack. Usability is a major problem and is a top priority for me. That is definitely a shift but that occurred before you started your thread.

But I disagree with your analysis of what the root of the problem is. It's a very kernel centric view and doesn't consider the interactions between userspace.

Regards,

Anthony Liguori

Quoted 2 lines

Ingo

#206 lore raw

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

In reply to Avi Kivity
Quoted 4 lines · Avi Kivity
Quoted 2 lines

Lets look at the ${HOME}/.qemu/qmp/ enumeration method suggested by Anthony. There's numerous ways that this can break:

I don't like it either. We have libvirt for enumerating guests.

Which has pretty much the same problems to the ${HOME}/.qemu/qmp/ solution, obviously.

Quoted 8 lines
Quoted 8 lines

- Those special files can get corrupted, mis-setup, get out of sync, or can be hard to discover.

- The ${HOME}/.qemu/qmp/ solution suggested by Anthony has a very obvious design flaw: it is per user. When i'm root i'd like to query _all_ current guest images, not just the ones started by root. A system might not even have a notion of '${HOME}'.

Quoted 4 lines
Quoted 2 lines

- Apps might start KVM vcpu instances without adhering to the ${HOME}/.qemu/qmp/ access method.

- it doesn't work with nfs.

So out of a list of 4 disadvantages your reply is that you agree with 3?

Quoted 5 lines
Quoted 3 lines

- There is no guarantee for the Qemu process to reply to a request - while the kernel can always guarantee an enumeration result. I dont want 'perf kvm' to hang or misbehave just because Qemu has hung.

If qemu doesn't reply, your guest is dead anyway.

Erm, but i'm talking about a dead tool here. There's a world of a difference between 'kvm top' not showing new entries (because the guest is dead), and 'perf kvm top' hanging due to Qemu hanging.

So it's essentially 4 our of 4. Yet your reply isnt "Ingo you are right" but "hey, too bad" ?

Quoted 6 lines
Quoted 2 lines

Really, for such reasons user-space is pretty poor at doing system-wide enumeration and resource management. Microkernels lost for a reason.

Take a look at your desktop, userspace is doing all of that everywhere, from enumerating users and groups, to deciding how your disks are named. The kernel only provides the bare facilities.

We dont do that for robust system instrumentation, for heaven's sake!

By your argument it would be perfectly fine to implement /proc purely via user-space, correct?

Quoted 3 lines
Quoted 1 line

You are committing several grave design mistakes here.

I am committing on the shoulders of giants.

Really, this is getting outright ridiculous. You agree with me that Anothony suggested a technically inferior solution, yet you even seem to be proud of it and are joking about it?

And _you_ are complaining about lkml-style hard-talk discussions?

Thanks,

Ingo

#159 lore raw

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

In reply to Ingo Molnar
Quoted 6 lines · Ingo Molnar

I dont know how you can find the situation of Alpha comparable, which is a legacy architecture for which no new CPU was manufactored in the past ~10 years.

The negative effects of physical obscolescence cannot be overcome even by the very best of development models ...

The maintainers of that architecture could at least continue to maintain it. But that is not the case. Most newer syscalls are not available and overall stability on alpha sucks (kernel crashed when I tried to start Xorg for example) but nobody cares about it. Hardware is still around and there are still some users of it.

Quoted 9 lines
Quoted 4 lines
Quoted 1 line · Joerg Roedel

No, the split-repository situation was the smallest problem after all. Its was a community thing. If the community doesn't work a single-repo project will also fail. [...]

So, what do you think creates code communities and keeps them alive? Developers and code. And the wellbeing of developers are primarily influenced by the repository structure and by the development/maintenance process - i.e. by the 'fun' aspect. (i'm simplifying things there but that's the crux of it.)

Right. A living community needs developers that write new code. And the repository structure is one important thing. But in my opinion it is not the most important one. With my 3-4 years experience in the kernel community I made the experience that the maintainers are the most important factor. I find a maintainer not commiting or caring about patches or not releasing new versions much worse than the wrong repository structure.
oProfile has this problem with its userspace part. I partly made this bad experience with x86-64 before the architecture merge. KVM does not have this problem.

Quoted 5 lines

So yes, i do claim that what stiffled and eventually killed off the Oprofile community was the split repository. None of the other Oprofile shortcomings were really unfixable, but this one was. It gave no way for the community to grow in a healthy way, after the initial phase. Features were more difficult and less fun to develop.

The biggest problem oProfile has is that it does not support per-process measuring. This is indeed not unfixable but it also doesn't fit well in the overall oProfile concept.

Quoted 2 lines

I simply do not want to see KVM face the same fate, and yes i do see similar warnings signs.

In fact, the development process in KVM has improved over time. In the early beginnings everything was kept in svn. Avi switched to git some day but at the time when we had these kvm-XX releases both kernel- and user-space together were unbisectable. This has improved to a point where the kernel-part could be bisected. The KVM maintainers and community have shown in the past that they can address problems with the development process if they come up.

Quoted 8 lines

Oprofile certainly had good developers and maintainers as well. In the end it wasnt enough ...

Also, a project can easily still be 'alive' but not reach its full potential.

Why do you assume that my argument means that KVM isnt viable today? It can very well still be viable and even healthy - just not _as healthy_ as it could be ...

I am not aware that I made you say anything ;-)

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

The difference is that we dont have KVM with a decade of history and we dont have a 'told you so' KVM reimplementation to show that proves the point. I guess it's a matter of time before that happens, because Qemu usability is so absymal today - so i guess we should suspend any discussions until that happens, no need to waste time on arguing hypoteticals.

Quoted 5 lines
Quoted 2 lines

We actually have lguest which is small. But it lacks functionality and the developer community KVM has attracted.

I suggested long ago to merge lguest into KVM to cover non-VMX/non-SVM execution.

That would have been the best. Rusty already started this work and presented it at the first KVM Forum. But I have never seen patches ...

Quoted 9 lines
Quoted 6 lines
Quoted 1 line

I think you are rationalizing the status quo.

I see that there are issues with KVM today in some areas. You pointed out the desktop usability already. I personally have trouble with the qem-kvm.git because it is unbisectable. But repository unification doesn't solve the problem here.

Why doesnt it solve the bisectability problem? The kernel repo is supposed to be bisectable so that problem would be solved.

Because Marcelo and Avi try to keep as close to upstream qemu as possible. So the qemu repo is regularly merged in qemu-kvm and if you want to bisect you may end up somewhere in the middle of the qemu repository which has only very minimal kvm-support.
The problem here is that two qemu repositorys exist. But the current effort of Anthony is directed to create a single qemu repository. But thats not done overnight.
Merging qemu into the kernel would make Linus in fact a qemu maintainer. I am not sure he wants to be that ;-)

Quoted 13 lines

In my judgement you'd have to do that more frequently, if KVM was properly weighting its priorities. For example regarding this recent KVM commit of yours:

| commit ec1ff79084fccdae0dca9b04b89dcdf3235bbfa1
| Author: Joerg Roedel <[email protected]>
| Date:   Fri Oct 9 16:08:31 2009 +0200
|
|     KVM: SVM: Add tracepoint for invlpga instruction
|     
|     This patch adds a tracepoint for the event that the guest
|     executed the INVLPGA instruction.
Quoted 5 lines

With integrated KVM tooling i might have insisted for that new tracepoint to be available to users as well via some more meaningful tooling than just a pure tracepoint.

There's synergies like that all around the place.

True. Tools for better analyzing kvm traces is for sure something that belongs to tools/kvm. I am not sure if anyone has such tools. If yes, they should send it upstream.

Quoted 10 lines
Quoted 8 lines
Quoted 5 lines

It's as if you argued in 1990 that the unification of East and West Germany wouldnt make much sense because despite clear problems and incompatibilites and different styles westerners were still allowed to visit eastern relatives and they both spoke the same language after all ;-)

Um, hmm. I don't think these situations have enough in common to compare them ;-)

Probably, but it's an interesting parallel nevertheless ;-)

That for sure ;-)

Joerg

#213 lore raw

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

In reply to Anthony Liguori
Quoted 45 lines · Anthony Liguori
Quoted 44 lines · Ingo Molnar
Quoted 9 lines · Avi Kivity
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines

- Easy default reference to guest instances, and a way for tools to reference them symbolically as well in the multi-guest case. Preferably something trustable and kernel-provided - not some indirect information like a PID file created by libvirt-manager or so.

Usually 'layering violation' is trotted out at such suggestions. [...]

That's weird, how can a feature request be a 'layering violation'?

The 'something trustable and kernel-provided'. The kernel knows nothing about guest names.

The kernel certainly knows about other resources such as task names or network interface names or tracepoint names. This is kernel design 101.

Quoted 4 lines
Quoted 4 lines

If something that users find straightforward and usable is a layering violation to you (such as easily being able to access their own files on the host as well ...) then i think you need to revisit the definition of that term instead of trying to fix the user.

Quoted 12 lines

Here is the explanation, you left it quoted:

Quoted 10 lines
Quoted 10 lines

[...] I don't like using the term, because sometimes the layers are incorrect and need to be violated. But it should be done explicitly, not as a shortcut for a minor feature (and profiling is a minor feature, most users will never use it, especially guest-from-host).

The fact is we have well defined layers today, kvm virtualizes the cpu and memory, qemu emulates devices for a single guest, libvirt manages guests. We break this sometimes but there has to be a good reason. So perf needs to talk to libvirt if it wants names. Could be done via linking, or can be done using a pluging libvirt drops into perf.

This is really just the much-discredited microkernel approach for keeping global enumeration data that should be kept by the kernel ...

Lets look at the ${HOME}/.qemu/qmp/ enumeration method suggested by Anthony. There's numerous ways that this can break:

- Those special files can get corrupted, mis-setup, get out of sync, or can be hard to discover.

- The ${HOME}/.qemu/qmp/ solution suggested by Anthony has a very obvious design flaw: it is per user. When i'm root i'd like to query _all_ current guest images, not just the ones started by root. A system might not even have a notion of '${HOME}'.

Quoted 4 lines
Quoted 2 lines

- Apps might start KVM vcpu instances without adhering to the ${HOME}/.qemu/qmp/ access method.

Not all KVM vcpus are running operating systems.

But we want to allow developers to instrument all of them ...

Quoted 4 lines

Transitive had a product that was using a KVM context to run their binary translator which allowed them full access to the host processes virtual address space range. In this case, there is no kernel and there are no devices.

And your point is that such vcpus should be excluded from profiling just because they fall outside the Qemu/libvirt umbrella?

That is a ridiculous position.

Ingo

#157 lore raw

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

In reply to Ingo Molnar
Quoted 14 lines · Ingo Molnar
Quoted 11 lines · Avi Kivity
Quoted 6 lines · Ingo Molnar

So, what do you think creates code communities and keeps them alive? Developers and code. And the wellbeing of developers are primarily influenced by the repository structure and by the development/maintenance process - i.e. by the 'fun' aspect. (i'm simplifying things there but that's the crux of it.)

There is nothing fun about having one repository or two. Who cares about this anyway?

Quoted 8 lines
Quoted 5 lines

tools/kvm/ probably will draw developers, simply because of the glory associated with kernel work. That's a bug, not a feature. It means that effort is not distributed according to how it's needed, but because of irrelevant considerations.

And yet your solution to that is to ... do all your work in the kernel space and declare the tooling as something that does not interest you? ;-)

I have done plenty of userspace work in qemu. I don't have a lack of interest in qemu, just in a desktop GUI. I'm not a GUI person and my employer doesn't have a desktop-on-desktop virtualization product that I know of.

Quoted 7 lines
Quoted 4 lines

Something I've wanted for a long time is to port kvm_stat to use tracepoints instead of the home-grown instrumentation. But that is unrelated to this new tracepoint. Other than that we're satisfied with ftrace.

Despite it being another in-kernel subsystem that by your earlier arguments should be done via a user-space package? ;-)

I'm satisfied with it as a user. Architecturally, I'd have preferred it to be a userspace tool. It might have improved usability as well to have something with --help instead of a set of debugfs files. But I'm a lot happier with ftrace existing as a kernel component than not at all.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

You should realize that naturally developers will gravitate towards the most 'fun' aspects of a project. It is the task of the maintainer to keep the balance between fun and utility, bugs and features, quality and code-rot.

Quoted 8 lines
Quoted 4 lines

There are plenty of un-fun tasks (like fixing bugs and providing RAS features) that we're doing. We don't do this for fun but to satisfy our users.

So which one is it, KVM developers are volunteers that do fun stuff and cannot be told about project priorities, or KVM developers are pros who do unfun stuff because they can be told about priorities?

From my point of view as maintainer, all contributors are volunteers, I can't tell any of them what to do. From the point of view of many of these volunteer's employers, they are wage slaves who do as they're told or else.

So: when someone sends me a patch I gratefully accept if it is good or point out the issues if not. At the secret Red Hat headquarters and the kvm weekly conference call I participate in deciding priorities and task assignments.

Quoted 4 lines

I posit that it's both: and that priorities can be communicated - if only you try as a maintainer. All i'm suggesting is to add 'usable, unified user-space' to the list of unfun priorities, because it's possible and because it matters.

So: I require a volunteer to write some GUI code before I accept a patch. Back at the Red Hat lair, we think of what features we drop from the product because the kvm maintainer has gone nuts.

The 'unified' part of your suggestion is not a requirement, but an implementation detail.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#221 lore raw

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

In reply to Anthony Liguori
Quoted 18 lines · Anthony Liguori
Quoted 17 lines · Ingo Molnar

This is really just the much-discredited microkernel approach for keeping global enumeration data that should be kept by the kernel ...

Lets look at the ${HOME}/.qemu/qmp/ enumeration method suggested by Anthony. There's numerous ways that this can break:

- Those special files can get corrupted, mis-setup, get out of sync, or can be hard to discover.

- The ${HOME}/.qemu/qmp/ solution suggested by Anthony has a very obvious design flaw: it is per user. When i'm root i'd like to query _all_ current guest images, not just the ones started by root. A system might not even have a notion of '${HOME}'.

- Apps might start KVM vcpu instances without adhering to the ${HOME}/.qemu/qmp/ access method.

Quoted 7 lines
Quoted 3 lines

- There is no guarantee for the Qemu process to reply to a request - while the kernel can always guarantee an enumeration result. I dont want 'perf kvm' to hang or misbehave just because Qemu has hung.

If your position basically boils down to, we can't trust userspace and we can always trust the kernel, I want to eliminate any userspace path, then I can't really help you out.

Why would you want to 'help me out'? I can tell a good solution from a bad one just fine.

You should instead read the long list of disadvantages above, invert them and list then as advantages for the kernel-based vcpu enumeration solution, apply common sense and go admit to yourself that indeed in this situation a kernel provided enumeration of vcpu contexts is the most robust solution.

It's really as simple as that :-)

Thanks,

Ingo

#158 lore raw

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

In reply to Ingo Molnar
Quoted 3 lines · Ingo Molnar

I posit that it's both: and that priorities can be communicated - if only you try as a maintainer. All i'm suggesting is to add 'usable, unified user-space' to the list of unfun priorities, because it's possible and because it matters.

IMHO blaming anybody for it but qemu maintainership is very unfair. They intentionally reinveinted a less self contained, inferior, underperforming, underfeatured wheel instead of doing the right thing and just making sure that it as self contained enough as possible to avoid risking destabilizing their existing codebase. What can anybody (without qemu git commit access) do about it unless qemu git maintainer change attitude, dumps its qemu/kvm-all.c nosense for good, and do the right thing so we can unify for real?

We need to move forward, including multithread the qemu core and be ready to include desktop virtualization protocol when they're ready for submission without being suggested to extend vnc instead to gain a similar speedup (i.e. yet another inferior wheel).

Unification means that _all_ qemu users, pure research, theoretical interest, Xen, virtualbox, weird pure software architecture, will be able to push their stuff in for the common good, but that also shall apply to KVM! It has to become clear that reinveinting inferior wheels instead of merging the real thing, is absolutely time wasteful, unnecessary, and it won't make any difference as far as KVM is concerned, proof is that 0% of userbase runs qemu git to run KVM (except the kvm-all.c developers to test it perhaps or somebody by mistake not adding -kvm prefix to command line maybe). I don't pretend to rate KVM as more important than all the rest of niche usages for qemu but it shall be _as_ important as the rest and it'd be nice one day to be able to install only qemu on a system and get something actually usable in production.

I very much like that qemu gets contributions from everywhere, it's also nice it can run without KVM (that is purely useful as a debugging tool to me but still...). I think it can all happen and unification should be the object for the gain of everyone in both qemu/kvm and even xen and all the rest.

#160 lore raw

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

In reply to Joerg Roedel
Quoted 4 lines · Joerg Roedel
Quoted 4 lines

Why doesnt it solve the bisectability problem? The kernel repo is supposed to be bisectable so that problem would be solved.

Quoted 8 lines

Because Marcelo and Avi try to keep as close to upstream qemu as possible. So the qemu repo is regularly merged in qemu-kvm and if you want to bisect you may end up somewhere in the middle of the qemu repository which has only very minimal kvm-support.
The problem here is that two qemu repositorys exist. But the current effort of Anthony is directed to create a single qemu repository. But thats not done overnight.

It's in fact possible to bisect qemu-kvm.git. If you end up in qemu.git, do a 'git bisect skip'. If you end up in a merge, call the merge point A, bisect A^1..A^2, each time merging A^1 before compiling (the merge is always trivial due to the way we do it).

Not fun, but it works. When we complete merging kvm integration into qemu.git, this problem will disappear.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#214 lore raw

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

In reply to Ingo Molnar
Quoted 8 lines · Ingo Molnar
Quoted 5 lines

Transitive had a product that was using a KVM context to run their binary translator which allowed them full access to the host processes virtual address space range. In this case, there is no kernel and there are no devices.

And your point is that such vcpus should be excluded from profiling just because they fall outside the Qemu/libvirt umbrella?

You don't instrument it the way you'd instrument an operating system so no, you don't want it to show up in perf kvm top.

Regards,

Anthony Liguori

Quoted 2 lines

Ingo

#195 lore raw

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

In reply to Anthony Liguori
Quoted 11 lines · Anthony Liguori
Quoted 5 lines · Avi Kivity
Quoted 3 lines

Lets look at the ${HOME}/.qemu/qmp/ enumeration method suggested by Anthony.
There's numerous ways that this can break:

I don't like it either. We have libvirt for enumerating guests.

We're stuck in a rut with libvirt and I think a lot of the dissatisfaction with qemu is rooted in that. It's not libvirt that's the probably, but the relationship between qemu and libvirt.

Quoted 6 lines

We add a feature to qemu and maybe after six month it gets exposed by libvirt. Release time lines of the two projects complicate the situation further. People that write GUIs are limited by libvirt because that's what they're told to use and when they need something simple, they're presented with first getting that feature implemented in qemu, then plumbed through libvirt.

That is somewhat unfair as a blanket statement!

While some features have had a long time delay & others are not supported at all, in many cases we have had zero delay. We have been supporting QMP, qdev, vhost-net since before the patches for those features were even merged in QEMU GIT! It varies depending on how closely QEMU & libvirt people have been working together on a feature, and on how strongly end users are demanding the features.

Quoted 6 lines

It wouldn't be so bad if libvirt was basically a passthrough interface to qemu but it tries to model everything in a generic way which is more or less doomed to fail when you're adding lots of new features (as we are).

The list of things that libvirt doesn't support and won't any time soon is staggering.

As previously discussed, we want to improve both the set of features supported, and make it much easier to support new features promptly. The QMP & qdev stuff has been a very good step forward in making it easier to support QEMU management. There have been a proposals from several people, yourself included, on how to improve libvirt's support for the full range of QEMU features. We're committed to looking at this and figuring out which proposals are practical to support, so we can improve QEMU & libvirt interaction for everyone.

Regards,
Daniel

Signature · 4 lines
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
#196 lore raw

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

Quoted 14 lines · Daniel P. Berrange
Quoted 12 lines · Anthony Liguori
Quoted 6 lines · Avi Kivity
Quoted 4 lines

Lets look at the ${HOME}/.qemu/qmp/ enumeration method suggested by Anthony.
There's numerous ways that this can break:

I don't like it either. We have libvirt for enumerating guests.

We're stuck in a rut with libvirt and I think a lot of the dissatisfaction with qemu is rooted in that. It's not libvirt that's the probably, but the relationship between qemu and libvirt.

Quoted 9 lines
Quoted 7 lines

We add a feature to qemu and maybe after six month it gets exposed by libvirt. Release time lines of the two projects complicate the situation further. People that write GUIs are limited by libvirt because that's what they're told to use and when they need something simple, they're presented with first getting that feature implemented in qemu, then plumbed through libvirt.

That is somewhat unfair as a blanket statement!

Sorry, you're certainly correct. Some features appear quickly, but others can take an awfully long time.

Quoted 7 lines
Quoted 7 lines

It wouldn't be so bad if libvirt was basically a passthrough interface to qemu but it tries to model everything in a generic way which is more or less doomed to fail when you're adding lots of new features (as we are).

The list of things that libvirt doesn't support and won't any time soon is staggering.

Quoted 9 lines

As previously discussed, we want to improve both the set of features supported, and make it much easier to support new features promptly. The QMP& qdev stuff has been a very good step forward in making it easier to support QEMU management. There have been a proposals from several people, yourself included, on how to improve libvirt's support for the full range of QEMU features. We're committed to looking at this and figuring out which proposals are practical to support, so we can improve QEMU& libvirt interaction for everyone.

Regards,

Anthony Liguori

Quoted 3 lines

Regards,
Daniel

#197 lore raw

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

In reply to Daniel P. Berrange
Quoted 19 lines · Daniel P. Berrange
Quoted 11 lines · Anthony Liguori
Quoted 5 lines · Avi Kivity
Quoted 3 lines

Lets look at the ${HOME}/.qemu/qmp/ enumeration method suggested by Anthony.
There's numerous ways that this can break:

I don't like it either. We have libvirt for enumerating guests.

We're stuck in a rut with libvirt and I think a lot of the dissatisfaction with qemu is rooted in that. It's not libvirt that's the probably, but the relationship between qemu and libvirt.

Quoted 6 lines

We add a feature to qemu and maybe after six month it gets exposed by libvirt. Release time lines of the two projects complicate the situation further. People that write GUIs are limited by libvirt because that's what they're told to use and when they need something simple, they're presented with first getting that feature implemented in qemu, then plumbed through libvirt.

Quoted 8 lines

That is somewhat unfair as a blanket statement!

While some features have had a long time delay & others are not supported at all, in many cases we have had zero delay. We have been supporting QMP, qdev, vhost-net since before the patches for those features were even merged in QEMU GIT! It varies depending on how closely QEMU & libvirt people have been working together on a feature, and on how strongly end users are demanding the features.

Yes. I think the point was that every layer in between brings potential slowdown and loss of features.

Hopefully this will go away with QMP. By then people can decide if they want to be hypervisor agnostic (libvirt) or tightly coupled with qemu (QMP). The best of both worlds would of course be a QMP pass-through in libvirt. No idea if that's easily possible.

Either way, things are improving. What people see at the end is virt-manager though. And if you compare if feature-wise as well as looks-wise vbox is simply superior. Several features lacking in lower layers too (pv graphics, always working absolute pointers, clipboard sharing, ...).

That said it doesn't mean we should resign. It means we know which areas to work on :-). And we know that our problem is not the kernel/userspace interface, but the qemu and above interfaces.

Alex

#207 lore raw

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

In reply to Ingo Molnar
Quoted 11 lines · Ingo Molnar
Quoted 5 lines · Avi Kivity
Quoted 3 lines

Lets look at the ${HOME}/.qemu/qmp/ enumeration method suggested by Anthony. There's numerous ways that this can break:

I don't like it either. We have libvirt for enumerating guests.

Which has pretty much the same problems to the ${HOME}/.qemu/qmp/ solution, obviously.

It doesn't follow. The libvirt daemon could/should own guests from all users. I don't know if it does so now, but nothing is preventing it technically.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

- Those special files can get corrupted, mis-setup, get out of sync, or can be hard to discover.

- The ${HOME}/.qemu/qmp/ solution suggested by Anthony has a very obvious design flaw: it is per user. When i'm root i'd like to query _all_ current guest images, not just the ones started by root. A system might not even have a notion of '${HOME}'.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

- Apps might start KVM vcpu instances without adhering to the

    ${HOME}/.qemu/qmp/ access method.

- it doesn't work with nfs.

So out of a list of 4 disadvantages your reply is that you agree with 3?

I agree with 1-3, disagree with 4, and add 5. Yes.

Quoted 11 lines
Quoted 7 lines
Quoted 5 lines

- There is no guarantee for the Qemu process to reply to a request - while the kernel can always guarantee an enumeration result. I dont want 'perf kvm' to hang or misbehave just because Qemu has hung.

If qemu doesn't reply, your guest is dead anyway.

Erm, but i'm talking about a dead tool here. There's a world of a difference between 'kvm top' not showing new entries (because the guest is dead), and 'perf kvm top' hanging due to Qemu hanging.

If qemu hangs, the guest hangs a few milliseconds later.

Quoted 3 lines

So it's essentially 4 our of 4. Yet your reply isnt "Ingo you are right" but "hey, too bad" ?

My reply is "you are right" (phrased earlier as "I don't like it either" meaning I agree with your dislike). One of your criticisms was invalid, IMO, and I pointed it out.

Quoted 9 lines
Quoted 7 lines
Quoted 3 lines

Really, for such reasons user-space is pretty poor at doing system-wide enumeration and resource management. Microkernels lost for a reason.

Take a look at your desktop, userspace is doing all of that everywhere, from enumerating users and groups, to deciding how your disks are named. The kernel only provides the bare facilities.

We dont do that for robust system instrumentation, for heaven's sake!

If qemu fails, you lose your guest. If libvirt forgets about a guest, you can't do anything with it any more. These are more serious problems than 'perf kvm' not working. Qemu and libvirt have to be robust anyway, we can rely on them. Like we have to rely on init, X, sshd, and a zillion other critical tools.

Quoted 3 lines

By your argument it would be perfectly fine to implement /proc purely via user-space, correct?

I would have preferred /proc to be implemented via syscalls called directly from tools, and good tools written to expose the information in it. When computers were slower 'top' would spend tons of time opening and closing all those tiny files and parsing them. Of course the kernel needs to provide the information.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

You are committing several grave design mistakes here.

I am committing on the shoulders of giants.

Really, this is getting outright ridiculous. You agree with me that Anothony suggested a technically inferior solution, yet you even seem to be proud of it and are joking about it?

The bit above this was:

Quoted 3 lines

Really, for such reasons user-space is pretty poor at doing system-wide enumeration and resource management. Microkernels lost for a reason.

In every Linux system userspace is doing or proxying much of the enumeration and resource management. So if enumerating guests in userspace is a mistake, then I am not alone in making it.

Quoted 2 lines

And _you_ are complaining about lkml-style hard-talk discussions?

There is a difference between joking and insulting people. I enjoy jokes but I dislike being insulted.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#217 lore raw

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

In reply to Ingo Molnar
Quoted 6 lines · Ingo Molnar
Quoted 6 lines

Transitive had a product that was using a KVM context to run their binary translator which allowed them full access to the host processes virtual address space range. In this case, there is no kernel and there are no devices.

Quoted 6 lines

And your point is that such vcpus should be excluded from profiling just because they fall outside the Qemu/libvirt umbrella?

That is a ridiculous position.

Non-guest vcpus will not be able to provide Linux-style symbols.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#222 lore raw

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

In reply to Ingo Molnar
Quoted 8 lines · Ingo Molnar
Quoted 5 lines

If your position basically boils down to, we can't trust userspace and we can always trust the kernel, I want to eliminate any userspace path, then I can't really help you out.

Why would you want to 'help me out'? I can tell a good solution from a bad one just fine.

You are basically making a kernel implementation a requirement, instead of something that follows from the requirement.

Quoted 5 lines

You should instead read the long list of disadvantages above, invert them and list then as advantages for the kernel-based vcpu enumeration solution, apply common sense and go admit to yourself that indeed in this situation a kernel provided enumeration of vcpu contexts is the most robust solution.

Having qemu enumerate guests one way or another is not a good idea IMO since it is focused on one guest and doesn't have a system-wide entity. A userspace system-wide entity will work just as well as kernel implementation, without its disadvantages.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#161 lore raw

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

In reply to Joerg Roedel
Quoted 5 lines · Joerg Roedel
Quoted 4 lines · Ingo Molnar

I dont know how you can find the situation of Alpha comparable, which is a legacy architecture for which no new CPU was manufactored in the past ~10 years.

Quoted 8 lines
Quoted 2 lines

The negative effects of physical obscolescence cannot be overcome even by the very best of development models ...

The maintainers of that architecture could at least continue to maintain it. But that is not the case. Most newer syscalls are not available and overall stability on alpha sucks (kernel crashed when I tried to start Xorg for example) but nobody cares about it. Hardware is still around and there are still some users of it.

You are arguing why maintainers do not act as you suggest, against the huge negative effects of physical obscolescence?

Please use common sense: they dont act because ... there are huge negative effects due to physical obscolescence?

No amount of development model engineering can offset that negative.

Thanks,

Ingo

#198 lore raw

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

In reply to Alexander Graf
Quoted 2 lines · Alexander Graf

Yes. I think the point was that every layer in between brings potential slowdown and loss of features.

Exactly. The more 'fragmented' a project is into sub-projects, without a single, unified, functional reference implementation in the center of it, the longer it takes to fix 'unsexy' problems like trivial usability bugs.

Furthermore, another negative effect is that many times features are implemented not in their technically best way, but in a way to keep them local to the project that originates them. This is done to keep deployment latencies and general contribution overhead down to a minimum. The moment you have to work with yet another project, the overhead adds up.

So developers rather go for the quicker (yet inferior) hack within the sub-project they have best access to.

Tell me this isnt happening in this space ;-)

Thanks,

Ingo

#199 lore raw

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

Quoted 9 lines · Ingo Molnar
Quoted 2 lines · Alexander Graf

Yes. I think the point was that every layer in between brings potential slowdown and loss of features.

Exactly. The more 'fragmented' a project is into sub-projects, without a single, unified, functional reference implementation in the center of it, the longer it takes to fix 'unsexy' problems like trivial usability bugs.

I agree to that part. As previously stated there are few people working on qemu that would go and implement higher level things though. So some solution is needed there.

Quoted 5 lines

Furthermore, another negative effect is that many times features are implemented not in their technically best way, but in a way to keep them local to the project that originates them. This is done to keep deployment latencies and general contribution overhead down to a minimum. The moment you have to work with yet another project, the overhead adds up.

I disagree there. Keeping things local and self-contained has been the UNIX secret. It works really well as long as the boundaries are well defined.

The problem we're facing is that we're simply lacking an active GUI / desktop user development community. We have desktop users, but nobody feels like tackling the issue of doing a great GUI project while talking to qemu-devel about his needs.

Quoted 2 lines

So developers rather go for the quicker (yet inferior) hack within the sub-project they have best access to.

Well - not necessarily hacks. It's more about project boundaries. Nothing is bad about that. You wouldn't want "ls" implemented in the Linux kernel either, right? :-)

Alex

#204 lore raw

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

In reply to Anthony Liguori
Quoted 7 lines · Anthony Liguori
Quoted 4 lines · Avi Kivity
Quoted 2 lines

Lets look at the ${HOME}/.qemu/qmp/ enumeration method suggested by Anthony. There's numerous ways that this can break:

I don't like it either. We have libvirt for enumerating guests.

We're stuck in a rut with libvirt and I think a lot of the dissatisfaction with qemu is rooted in that. It's not libvirt that's the probably, but the relationship between qemu and libvirt.

+1
The obvious reason why so many people still use shell scripts rather than libvirt is because if it just doesn't provide what they need.
Every time I've looked at it (and I've been looking for a better solution for many years), it seems that it would have provided most of the things I needed, but the remaining bits were unsolvable.

Shell scripts can be ugly, but you get total control.

Antoine

Quoted 16 lines

We add a feature to qemu and maybe after six month it gets exposed by libvirt. Release time lines of the two projects complicate the situation further. People that write GUIs are limited by libvirt because that's what they're told to use and when they need something simple, they're presented with first getting that feature implemented in qemu, then plumbed through libvirt.

It wouldn't be so bad if libvirt was basically a passthrough interface to qemu but it tries to model everything in a generic way which is more or less doomed to fail when you're adding lots of new features (as we are).

The list of things that libvirt doesn't support and won't any time soon is staggering.

libvirt serves an important purpose, but we need to do a better job in qemu with respect to usability. We can't just punt to libvirt.

Regards,

Anthony Liguori

Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#208 lore raw

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

In reply to Avi Kivity
Quoted 5 lines · Avi Kivity
Quoted 4 lines · Ingo Molnar
Quoted 2 lines · Avi Kivity
Quoted 2 lines

Lets look at the ${HOME}/.qemu/qmp/ enumeration method suggested by Anthony. There's numerous ways that this can break:

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

I don't like it either. We have libvirt for enumerating guests.

Which has pretty much the same problems to the ${HOME}/.qemu/qmp/ solution, obviously.

It doesn't follow. The libvirt daemon could/should own guests from all users. I don't know if it does so now, but nothing is preventing it technically.

It's hard for me to argue against a hypothetical implementation, but all user-space driven solutions for resource enumeration i've seen so far had weaknesses that kernel-based solutions dont have.

Quoted 18 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

- Those special files can get corrupted, mis-setup, get out of sync, or can be hard to discover.

- The ${HOME}/.qemu/qmp/ solution suggested by Anthony has a very obvious design flaw: it is per user. When i'm root i'd like to query _all_ current guest images, not just the ones started by root. A system might not even have a notion of '${HOME}'.

Quoted 4 lines
Quoted 3 lines
Quoted 2 lines

- Apps might start KVM vcpu instances without adhering to the ${HOME}/.qemu/qmp/ access method.

- it doesn't work with nfs.

So out of a list of 4 disadvantages your reply is that you agree with 3?

I agree with 1-3, disagree with 4, and add 5. Yes.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

- There is no guarantee for the Qemu process to reply to a request - while the kernel can always guarantee an enumeration result. I dont want 'perf kvm' to hang or misbehave just because Qemu has hung.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

If qemu doesn't reply, your guest is dead anyway.

Erm, but i'm talking about a dead tool here. There's a world of a difference between 'kvm top' not showing new entries (because the guest is dead), and 'perf kvm top' hanging due to Qemu hanging.

If qemu hangs, the guest hangs a few milliseconds later.

I think you didnt understand my point. I am talking about 'perf kvm top' hanging if Qemu hangs.

With a proper in-kernel enumeration the kernel would always guarantee the functionality, even if the vcpu does not make progress (i.e. it's "hung").

With this implemented in Qemu we lose that kind of robustness guarantee.

And especially during development (when developers use instrumentation the most) is it important to have robust instrumentation that does not hang along with the Qemu process.

Quoted 3 lines

If qemu fails, you lose your guest. If libvirt forgets about a guest, you can't do anything with it any more. These are more serious problems than 'perf kvm' not working. [...]

How on earth can you justify a bug ("perf kvm top" hanging) with that there are other bugs as well?

Basically you are arguing the equivalent that a gdb session would be fine to become unresponsive if the debugged task hangs. Fortunately ptrace is kernel-based and it never 'hangs' if the user-space process hangs somewhere.

This is an essential property of good instrumentation.

So the enumeration method you suggested is a poor, sub-part solution, simple as that.

Quoted 2 lines

[...] Qemu and libvirt have to be robust anyway, we can rely on them. Like we have to rely on init, X, sshd, and a zillion other critical tools.

We can still profile any of those tools without the profiler breaking if the debugged tool breaks ...

Quoted 8 lines
Quoted 2 lines

By your argument it would be perfectly fine to implement /proc purely via user-space, correct?

I would have preferred /proc to be implemented via syscalls called directly from tools, and good tools written to expose the information in it. When computers were slower 'top' would spend tons of time opening and closing all those tiny files and parsing them. Of course the kernel needs to provide the information.

(Then you'll be enjoyed to hear that perf has enabled exactly that, and that we are working towards that precise usecase.)

Ingo

#209 lore raw

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

Quoted 16 lines · Ingo Molnar
Quoted 13 lines · Avi Kivity
Quoted 11 lines · Ingo Molnar
Quoted 5 lines · Avi Kivity
Quoted 3 lines

Lets look at the ${HOME}/.qemu/qmp/ enumeration method suggested by Anthony. There's numerous ways that this can break:

I don't like it either. We have libvirt for enumerating guests.

Which has pretty much the same problems to the ${HOME}/.qemu/qmp/ solution, obviously.

Quoted 8 lines
Quoted 4 lines

It doesn't follow. The libvirt daemon could/should own guests from all users. I don't know if it does so now, but nothing is preventing it technically.

It's hard for me to argue against a hypothetical implementation, but all user-space driven solutions for resource enumeration i've seen so far had weaknesses that kernel-based solutions dont have.

Correct. kernel-based solutions also have issues.

Quoted 5 lines
Quoted 2 lines

If qemu hangs, the guest hangs a few milliseconds later.

I think you didnt understand my point. I am talking about 'perf kvm top' hanging if Qemu hangs.

Use non-blocking I/O, report that guest as dead. No point in profiling it, it isn't making any progress.

Quoted 5 lines

With a proper in-kernel enumeration the kernel would always guarantee the functionality, even if the vcpu does not make progress (i.e. it's "hung").

With this implemented in Qemu we lose that kind of robustness guarantee.

If qemu has a bug in the resource enumeration code, you can't profile one guest. If the kernel has a bug in the resource enumeration code, the system either panics or needs to be rebooted later.

Quoted 4 lines

And especially during development (when developers use instrumentation the most) is it important to have robust instrumentation that does not hang along with the Qemu process.

It's nice not to have kernel oopses either. So when code can be in userspace, that's where it should be.

Quoted 7 lines
Quoted 4 lines

If qemu fails, you lose your guest. If libvirt forgets about a guest, you can't do anything with it any more. These are more serious problems than 'perf kvm' not working. [...]

How on earth can you justify a bug ("perf kvm top" hanging) with that there are other bugs as well?

There's no reason for 'perf kvm top' to hang if some process is not responsive. That would be a perf bug.

Quoted 4 lines

Basically you are arguing the equivalent that a gdb session would be fine to become unresponsive if the debugged task hangs. Fortunately ptrace is kernel-based and it never 'hangs' if the user-space process hangs somewhere.

Neither gdb nor perf should hang.

Quoted 5 lines

This is an essential property of good instrumentation.

So the enumeration method you suggested is a poor, sub-part solution, simple as that.

Or, you misunderstood it.

Quoted 6 lines
Quoted 3 lines

[...] Qemu and libvirt have to be robust anyway, we can rely on them. Like we have to rely on init, X, sshd, and a zillion other critical tools.

We can still profile any of those tools without the profiler breaking if the debugged tool breaks ...

You can't profile without qemu.

Quoted 12 lines
Quoted 9 lines
Quoted 3 lines

By your argument it would be perfectly fine to implement /proc purely via user-space, correct?

I would have preferred /proc to be implemented via syscalls called directly from tools, and good tools written to expose the information in it. When computers were slower 'top' would spend tons of time opening and closing all those tiny files and parsing them. Of course the kernel needs to provide the information.

(Then you'll be enjoyed to hear that perf has enabled exactly that, and that we are working towards that precise usecase.)

Are you exporting /proc/pid data via the perf syscall? If so, I think that's a good move.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#203 lore raw

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

In reply to Ingo Molnar
Quoted 14 lines · Ingo Molnar

* Alexander Graf<[email protected]> wrote

Quoted 3 lines

Yes. I think the point was that every layer in between brings potential slowdown and loss of features.

Exactly. The more 'fragmented' a project is into sub-projects, without a single, unified, functional reference implementation in the center of it, the longer it takes to fix 'unsexy' problems like trivial usability bugs.

Furthermore, another negative effect is that many times features are implemented not in their technically best way, but in a way to keep them local to the project that originates them. This is done to keep deployment latencies and general contribution overhead down to a minimum. The moment you have to work with yet another project, the overhead adds up.

Quoted 5 lines

So developers rather go for the quicker (yet inferior) hack within the sub-project they have best access to.

Tell me this isnt happening in this space ;-)

Integration is hard, requires a wider set of technical skills and getting good test coverage becomes more difficult.
But I agree that it is worth the effort, kvm could reap large rewards from putting a greater emphasis on integration (ala vbox) - no matter how it is achieved (cowardly not taking sides on implementation decisions like repository locations).

Antoine

Quoted 8 lines

Thanks,

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

#200 lore raw

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

In reply to Alexander Graf
Quoted 8 lines · Alexander Graf
Quoted 5 lines

Furthermore, another negative effect is that many times features are implemented not in their technically best way, but in a way to keep them local to the project that originates them. This is done to keep deployment latencies and general contribution overhead down to a minimum. The moment you have to work with yet another project, the overhead adds up.

I disagree there. Keeping things local and self-contained has been the UNIX secret. It works really well as long as the boundaries are well defined.

The 'UNIX secret' works for text driven pipelined commands where we are essentially programming via narrow ASCII input of mathematical logic.

It doesnt work for a GUI that is a 2D/3D environment of millions of pixels, shaped by human visual perception of prettiness, familiarity and efficiency.

Quoted 4 lines

The problem we're facing is that we're simply lacking an active GUI / desktop user development community. We have desktop users, but nobody feels like tackling the issue of doing a great GUI project while talking to qemu-devel about his needs.

Have you made thoughts about why that might be so?

I think it's because of what i outlined above - that you are trying to apply the "UNIX secret" to GUIs - and that is a mistake.

A good GUI is almost at the _exact opposite spectrum_ of good command-line
tool: tightly integrated, with 'layering violations' designed into it all over the place:

look i can paste the text from an editor straight into a firefox form. I didnt go through any hiearchy of layers, i just took the shortest path between the apps!

In other words: in a GUI the output controls the design, for command-line tools the design controls the output.

It is no wonder Unix always had its problems with creating good GUIs that are efficient to humans. A good GUI works like the human brain, and the human brain does not mind 'layering violations' when that gets it a more efficient result.

Quoted 6 lines
Quoted 2 lines

So developers rather go for the quicker (yet inferior) hack within the sub-project they have best access to.

Well - not necessarily hacks. It's more about project boundaries. Nothing is bad about that. You wouldn't want "ls" implemented in the Linux kernel either, right? :-)

I guess you are talking to the wrong person as i actually have implemented ls functionality in the kernel, using async IO concepts and extreme threading ;-) It was a bit crazy, but was also the fastest FTP server ever running on this planet.

Ingo

#210 lore raw

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

In reply to Avi Kivity
Quoted 5 lines · Avi Kivity
Quoted 2 lines

I think you didnt understand my point. I am talking about 'perf kvm top' hanging if Qemu hangs.

Use non-blocking I/O, report that guest as dead. No point in profiling it, it isn't making any progress.

Erm, at what point do i decide that a guest is 'dead' versus 'just lagged due to lots of IO' ?

Also, do you realize that you increase complexity (the use of non-blocking IO), just to protect against something that wouldnt happen if the right solution was used in the first place?

Quoted 8 lines
Quoted 4 lines

With a proper in-kernel enumeration the kernel would always guarantee the functionality, even if the vcpu does not make progress (i.e. it's "hung").

With this implemented in Qemu we lose that kind of robustness guarantee.

If qemu has a bug in the resource enumeration code, you can't profile one guest. If the kernel has a bug in the resource enumeration code, the system either panics or needs to be rebooted later.

This is really simple code, not rocket science. If there's a bug in it we'll fix it. On the other hand a 500KLOC+ piece of Qemu code has lots of places to hang, so that is a large cross section.

Ingo

#215 lore raw

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

In reply to Anthony Liguori
Quoted 11 lines · Anthony Liguori
Quoted 7 lines · Ingo Molnar
Quoted 4 lines

Transitive had a product that was using a KVM context to run their binary translator which allowed them full access to the host processes virtual address space range. In this case, there is no kernel and there are no devices.

And your point is that such vcpus should be excluded from profiling just because they fall outside the Qemu/libvirt umbrella?

You don't instrument it the way you'd instrument an operating system so no, you don't want it to show up in perf kvm top.

Erm, why not? It's executing a virtualized CPU, so sure it makes sense to allow the profiling of it!

It might even not be the weird case you mentioned by some competing virtualization project to Qemu ...

So your argument is wrong on several technical levels, sorry.

Thanks,

Ingo

#218 lore raw

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

In reply to Avi Kivity
Quoted 7 lines · Avi Kivity
Quoted 6 lines · Ingo Molnar
Quoted 5 lines

Transitive had a product that was using a KVM context to run their binary translator which allowed them full access to the host processes virtual address space range. In this case, there is no kernel and there are no devices.

Quoted 7 lines
Quoted 5 lines

And your point is that such vcpus should be excluded from profiling just because they fall outside the Qemu/libvirt umbrella?

That is a ridiculous position.

Non-guest vcpus will not be able to provide Linux-style symbols.

And why do you say that it makes no sense to profile them?

Also, why do you define 'guest vcpus' to be 'Qemu started guest vcpus'? If some other KVM using project (which you encouraged just a few mails ago) starts a vcpu we still want to be able to profile them.

Ingo

#201 lore raw

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

In reply to Ingo Molnar
Quoted 9 lines · Ingo Molnar
Quoted 6 lines · Alexander Graf
Quoted 6 lines

Furthermore, another negative effect is that many times features are implemented not in their technically best way, but in a way to keep them local to the project that originates them. This is done to keep deployment latencies and general contribution overhead down to a minimum. The moment you have to work with yet another project, the overhead adds up.

Quoted 9 lines
Quoted 3 lines

I disagree there. Keeping things local and self-contained has been the UNIX secret. It works really well as long as the boundaries are well defined.

The 'UNIX secret' works for text driven pipelined commands where we are essentially programming via narrow ASCII input of mathematical logic.

It doesnt work for a GUI that is a 2D/3D environment of millions of pixels, shaped by human visual perception of prettiness, familiarity and efficiency.

Modularization is needed when a project exceeds the average developer's capacity. For kvm, it is logical to separate privileged cpu virtualization, from guest virtualization, from host management, from cluster management.

Quoted 10 lines
Quoted 5 lines

The problem we're facing is that we're simply lacking an active GUI / desktop user development community. We have desktop users, but nobody feels like tackling the issue of doing a great GUI project while talking to qemu-devel about his needs.

Have you made thoughts about why that might be so?

I think it's because of what i outlined above - that you are trying to apply the "UNIX secret" to GUIs - and that is a mistake.

Quoted 8 lines

A good GUI is almost at the _exact opposite spectrum_ of good command-line
tool: tightly integrated, with 'layering violations' designed into it all over the place:

look i can paste the text from an editor straight into a firefox form. I didnt go through any hiearchy of layers, i just took the shortest path between the apps!

Nope. You copied text from one application into the clipboard (or selection, or PRIMARY, or whatever
) and pasted text from the clipboard to another application. If firefox and your editor had to interact directly, all would be lost.

See - there was a global (for the session) third party, and it wasn't the kernel.

Quoted 3 lines

In other words: in a GUI the output controls the design, for command-line tools the design controls the output.

Not in GUIs that I've seen the internals of.

Quoted 5 lines

It is no wonder Unix always had its problems with creating good GUIs that are efficient to humans. A good GUI works like the human brain, and the human brain does not mind 'layering violations' when that gets it a more efficient result.

The problem is that only developers are involved, not people who understand human-computer interaction (in many cases, not human-human interaction either). Another problem is that a good GUI takes a lot of work so you need a lot of committed resources. A third problem is that it isn't a lot of fun, at least not the 20% of the work that take 800% of the time.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#211 lore raw

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

In reply to Ingo Molnar
Quoted 12 lines · Ingo Molnar
Quoted 6 lines · Avi Kivity
Quoted 3 lines

I think you didnt understand my point. I am talking about 'perf kvm top' hanging if Qemu hangs.

Use non-blocking I/O, report that guest as dead. No point in profiling it, it isn't making any progress.

Erm, at what point do i decide that a guest is 'dead' versus 'just lagged due to lots of IO' ?

qemu shouldn't block due to I/O (it does now, but there is work to fix it). Of course it could be swapping or other things.

Pick a timeout, everything we do has timeouts these days. It's the price we pay for protection: if you put something where a failure can't hurt you, you have to be prepared for failure, and you might have false alarms.

Is it so horrible for 'perf kvm top'? No user data loss will happen, surely?

On the other hand, if it's in the kernel and it fails, you will lose service or perhaps data.

Quoted 4 lines

Also, do you realize that you increase complexity (the use of non-blocking IO), just to protect against something that wouldnt happen if the right solution was used in the first place?

It's a tradeoff. Increasing the kernel code size vs. increasing userspace size.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

With a proper in-kernel enumeration the kernel would always guarantee the functionality, even if the vcpu does not make progress (i.e. it's "hung").

With this implemented in Qemu we lose that kind of robustness guarantee.

Quoted 9 lines
Quoted 4 lines

If qemu has a bug in the resource enumeration code, you can't profile one guest. If the kernel has a bug in the resource enumeration code, the system either panics or needs to be rebooted later.

This is really simple code, not rocket science. If there's a bug in it we'll fix it. On the other hand a 500KLOC+ piece of Qemu code has lots of places to hang, so that is a large cross section.

The kernel has tons of very simple code (and some very complex code as well), and tons of -stable updates as well.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#216 lore raw

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

In reply to Ingo Molnar
Quoted 10 lines · Ingo Molnar
Quoted 7 lines · Anthony Liguori
Quoted 5 lines · Ingo Molnar
Quoted 5 lines

Transitive had a product that was using a KVM context to run their binary translator which allowed them full access to the host processes virtual address space range. In this case, there is no kernel and there are no devices.

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

And your point is that such vcpus should be excluded from profiling just because they fall outside the Qemu/libvirt umbrella?

You don't instrument it the way you'd instrument an operating system so no, you don't want it to show up in perf kvm top.

Erm, why not? It's executing a virtualized CPU, so sure it makes sense to allow the profiling of it!

It may not make sense to have symbol tables for it, for example it isn't generated from source code but from binary code for another architecture.

Of course, just showing addresses is fine, but you don't need qemu for that.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#219 lore raw

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

In reply to Ingo Molnar
Quoted 11 lines · Ingo Molnar
Quoted 9 lines
Quoted 7 lines

And your point is that such vcpus should be excluded from profiling just because they fall outside the Qemu/libvirt umbrella?

That is a ridiculous position.

Non-guest vcpus will not be able to provide Linux-style symbols.

And why do you say that it makes no sense to profile them?

It makes sense to profile them, but you don't need to contact their userspace tool for that.

Quoted 5 lines

Also, why do you define 'guest vcpus' to be 'Qemu started guest vcpus'? If some other KVM using project (which you encouraged just a few mails ago) starts a vcpu we still want to be able to profile them.

Maybe it should provide a mechanism for libvirt to list it.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#223 lore raw

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

In reply to Avi Kivity
Quoted 11 lines · Avi Kivity
Quoted 7 lines · Ingo Molnar
Quoted 4 lines

If your position basically boils down to, we can't trust userspace and we can always trust the kernel, I want to eliminate any userspace path, then I can't really help you out.

Why would you want to 'help me out'? I can tell a good solution from a bad one just fine.

You are basically making a kernel implementation a requirement, instead of something that follows from the requirement.

No, i'm not.

Quoted 10 lines
Quoted 5 lines

You should instead read the long list of disadvantages above, invert them and list then as advantages for the kernel-based vcpu enumeration solution, apply common sense and go admit to yourself that indeed in this situation a kernel provided enumeration of vcpu contexts is the most robust solution.

Having qemu enumerate guests one way or another is not a good idea IMO since it is focused on one guest and doesn't have a system-wide entity. A userspace system-wide entity will work just as well as kernel implementation, without its disadvantages.

A system-wide user-space entity only solves one problem out of the 4 i listed, still leaving the other 3:

- Those special files can get corrupted, mis-setup, get out of sync, or can be hard to discover.

- Apps might start KVM vcpu instances without adhering to the system-wide access method.

- There is no guarantee for the system-wide process to reply to a request - while the kernel can always guarantee an enumeration result. I dont want 'perf kvm' to hang or misbehave just because the system-wide entity has hung.

Really, i think i have to give up and not try to convince you guys about this anymore - i dont think you are arguing constructively anymore and i dont want yet another pointless flamewar about this.

Please consider 'perf kvm' scrapped indefinitely, due to lack of robust KVM instrumentation features: due to lack of robust+universal vcpu/guest enumeration and due to lack of robust+universal symbol access on the KVM side. It was a really promising feature IMO and i invested two days of arguments into it trying to find a workable solution, but it was not to be.

Thanks,

Ingo

#224 lore raw

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

Quoted 12 lines · Ingo Molnar
Quoted 7 lines
Quoted 7 lines

You should instead read the long list of disadvantages above, invert them and list then as advantages for the kernel-based vcpu enumeration solution, apply common sense and go admit to yourself that indeed in this situation a kernel provided enumeration of vcpu contexts is the most robust solution.

Quoted 5 lines

Having qemu enumerate guests one way or another is not a good idea IMO since it is focused on one guest and doesn't have a system-wide entity. A userspace system-wide entity will work just as well as kernel implementation, without its disadvantages.

Quoted 6 lines

A system-wide user-space entity only solves one problem out of the 4 i listed, still leaving the other 3:

- Those special files can get corrupted, mis-setup, get out of sync, or can be hard to discover.

That's a hard requirement anyway. If it happens, we get massive data loss. Way more troubling than 'perf kvm top' doesn't work. So consider it fulfilled.

Quoted 3 lines

- Apps might start KVM vcpu instances without adhering to the system-wide access method.

Then you don't get their symbol tables. That happens anyway if the symbol server is not installed, not running, handing out fake data. So we have to deal with that anyway.

Quoted 5 lines

- There is no guarantee for the system-wide process to reply to a request - while the kernel can always guarantee an enumeration result. I dont want 'perf kvm' to hang or misbehave just because the system-wide entity has hung.

When you press a key there is no guarantee no component along the way will time out.

Quoted 10 lines

Really, i think i have to give up and not try to convince you guys about this anymore - i dont think you are arguing constructively anymore and i dont want yet another pointless flamewar about this.

Please consider 'perf kvm' scrapped indefinitely, due to lack of robust KVM instrumentation features: due to lack of robust+universal vcpu/guest enumeration and due to lack of robust+universal symbol access on the KVM side. It was a really promising feature IMO and i invested two days of arguments into it trying to find a workable solution, but it was not to be.

I am not going to push libvirt or a subset thereof into the kernel for 'perf kvm'.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#205 lore raw

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

In reply to Antoine Martin
Quoted 11 lines · Antoine Martin
Quoted 10 lines · Anthony Liguori
Quoted 5 lines · Avi Kivity
Quoted 3 lines

Lets look at the ${HOME}/.qemu/qmp/ enumeration method suggested by Anthony.
There's numerous ways that this can break:

I don't like it either. We have libvirt for enumerating guests.

We're stuck in a rut with libvirt and I think a lot of the dissatisfaction with qemu is rooted in that. It's not libvirt that's the probably, but the relationship between qemu and libvirt.

Quoted 6 lines

+1
The obvious reason why so many people still use shell scripts rather than libvirt is because if it just doesn't provide what they need. Every time I've looked at it (and I've been looking for a better solution for many years), it seems that it would have provided most of the things I needed, but the remaining bits were unsolvable.

If you happen to remember what missing features prevented you choosing libvirt, that would be invaluable information for us, to see if there are quick wins that will help out. We got very useful feedback when recently asking people this same question

http://rwmj.wordpress.com/2010/01/07/quick-quiz-what-stops-you-from-using-libvirt/

Allowing arbitrary passthrough of QEMU commands/args will solve some of these issues, but certainly far from solving all of them. eg guest cut+ paste, host side control of guest screen resolution, easier x509/TLS configuration for remote management, soft reboot, Windows desktop support for virt-manager, host network interface management/setup, etc

Regards,
Daniel

Signature · 4 lines
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
#225 lore raw

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

In reply to Avi Kivity
Quoted 8 lines · Avi Kivity
Quoted 6 lines · Ingo Molnar
Quoted 4 lines

If your position basically boils down to, we can't trust userspace and we can always trust the kernel, I want to eliminate any userspace path, then I can't really help you out.

Why would you want to 'help me out'? I can tell a good solution from a bad one just fine.

Quoted 8 lines

You are basically making a kernel implementation a requirement, instead of something that follows from the requirement.

Quoted 4 lines

You should instead read the long list of disadvantages above, invert them and list then as advantages for the kernel-based vcpu enumeration solution, apply common sense and go admit to yourself that indeed in this situation a kernel provided enumeration of vcpu contexts is the most robust solution.

Having qemu enumerate guests one way or another is not a good idea IMO since it is focused on one guest and doesn't have a system-wide entity.

There always needs to be a system wide entity. There are two ways to enumerate instances from that system wide entity. You can centralize the creation of instances and there by maintain an list of current instances. You can also allow instances to be created in a decentralized manner and provide a standard mechanism for instances to register themselves with the system wide entity.

IOW, it's the difference between asking libvirtd to exec(qemu) vs allowing a user to exec(qemu) and having qemu connect to a well known unix domain socket for libvirt to tell libvirtd that it exists.

The later approach has a number of advantages. libvirt already supports both models. The former is the '/system' uri and the later is the '/session' uri.

What I'm proposing, is to use the host file system as the system wide entity instead of libvirtd. libvirtd can monitor the host file system to participate in these activities but ultimately, moving this functionality out of libvirtd means that it becomes the standard mechanism for all qemu instances regardless of how they're launched.

Regards,

Anthony Liguori

Quoted 3 lines

A userspace system-wide entity will work just as well as kernel
implementation, without its disadvantages.

#374 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 12 lines · Arnaldo Carvalho de Melo

Em Mon, Mar 22, 2010 at 03:24:47PM +0800, Zhang, Yanmin escreveu:

Quoted 11 lines · Ingo Molnar
Quoted 5 lines

So some sort of --guestmount option would be the natural solution, which points to the guest system's root: and a Qemu enumeration of guest mounts (which would be off by default and configurable) from which perf can pick up the target guest all automatically. (obviously only under allowed permissions so that such access is secure)

If sshfs could access /proc/ and /sys correctly, here is a design:
--guestmount points to a directory which consists of a list of sub-directories. Every sub-directory's name is just the qemu process id of guest os. Admin/developer mounts every guest os instance's root directory to corresponding sub-directory.

Quoted 7 lines
Quoted 3 lines

Then, perf could access all files. It's possible because guest os instance happens to be multi-threading in a process. One of the defects is the accessing to guest os becomes slow or impossible when guest os is very busy.

If the MMAP events on the guest included a cookie that could later be used to query for the symtab of that DSO, we wouldn't need to access the guest FS at all, right?

It depends on specific sub commands. As for 'perf kvm top', developers want to see the profiling immediately. Even with 'perf kvm record', developers also want to see results quickly. At least I'm eager for the results when investigating a performance issue.

Quoted 5 lines

With build-ids and debuginfo-install like tools the symbol resolution could be performed by using the cookies (build-ids) as keys to get to the *-debuginfo packages with matching symtabs (and DWARF for source annotation, etc).

We can't make sure guest os uses the same os images, or don't know where we could find the original DVD images being used to install guest os.

Current perf does save build id, including both kernls's and other application lib/executables.

Quoted 11 lines

We have that for the kernel as:

[acme@doppio linux-2.6-tip]$ l /sys/kernel/notes
-r--r--r-- 1 root root 36 2010-03-22 13:14 /sys/kernel/notes
[acme@doppio linux-2.6-tip]$ l /sys/module/ipv6/sections/.note.gnu.build-id -r--r--r-- 1 root root 4096 2010-03-22 13:38 /sys/module/ipv6/sections/.note.gnu.build-id [acme@doppio linux-2.6-tip]$

That way we would cover DSOs being reinstalled in long running 'perf record' sessions too.

That's one of objectives of perf to support long running.

Quoted 7 lines

This was discussed some time ago but would require help from the bits that load DSOs.

build-ids then would be first class citizens.

- Arnaldo

#226 lore raw

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

In reply to Anthony Liguori
Quoted 10 lines · Anthony Liguori
Quoted 1 line

Having qemu enumerate guests one way or another is not a good idea IMO since it is focused on one guest and doesn't have a system-wide entity.

There always needs to be a system wide entity. There are two ways to enumerate instances from that system wide entity. You can centralize the creation of instances and there by maintain an list of current instances. You can also allow instances to be created in a decentralized manner and provide a standard mechanism for instances to register themselves with the system wide entity.

IOW, it's the difference between asking libvirtd to exec(qemu) vs allowing a user to exec(qemu) and having qemu connect to a well known unix domain socket for libvirt to tell libvirtd that it exists.

The later approach has a number of advantages. libvirt already supports both models. The former is the '/system' uri and the later is the '/session' uri.

What I'm proposing, is to use the host file system as the system wide entity instead of libvirtd. libvirtd can monitor the host file system to participate in these activities but ultimately, moving this functionality out of libvirtd means that it becomes the standard mechanism for all qemu instances regardless of how they're launched.

I don't like dropping sockets into the host filesystem, especially as they won't be cleaned up on abnormal exit. I also think this breaks our 'mechanism, not policy' policy. Someone may want to do something weird with qemu that doesn't work well with this.

We could allow starting monitors from the global configuration file, so a distribution can do this if it wants, but I don't think we should do this ourselves by default.

Signature · 1 line
error compiling committee.c: too many arguments to function
#136 lore raw

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

In reply to Ingo Molnar
Quoted 4 lines · Ingo Molnar

Yes, i thought Qemu would be a prime candidate to be the baseline for tools/kvm/, but i guess that has become socially impossible now after this flamewar. It's not a big problem in the big scheme of things: tools/kvm/ is best grown up from a small towards larger size anyway ...

I'm curious, where would you put the limit? Let's imagine a tools/kvm appears, be it qemu or not, that's outside the scope of my question. Would you put the legacy PC bios in there (seabios I guess)? The EFI bios? The windows-compiled paravirtual drivers? The Xorg paravirtual DDX ? Mesa (which includes the pv gallium drivers)? The libvirt-equivalent? The GUI?

That's not a rhetorical question btw, I really wonder where the limit should be.

OG.

#228 lore raw

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

In reply to Anthony Liguori

Am 22.03.2010 23:06, schrieb Anthony Liguori:

Quoted 11 lines · Avi Kivity
Quoted 2 lines

Having qemu enumerate guests one way or another is not a good idea IMO since it is focused on one guest and doesn't have a system-wide entity.

There always needs to be a system wide entity. There are two ways to enumerate instances from that system wide entity. You can centralize the creation of instances and there by maintain an list of current instances. You can also allow instances to be created in a decentralized manner and provide a standard mechanism for instances to register themselves with the system wide entity.

Quoted 3 lines

IOW, it's the difference between asking libvirtd to exec(qemu) vs allowing a user to exec(qemu) and having qemu connect to a well known unix domain socket for libvirt to tell libvirtd that it exists.

I think the latter is exactly what I would want for myself. I do see the advantages of having a central instance, but I really don't want to bother with libvirt configuration files or even GUIs just to get an ad-hoc VM up when I can simply run "qemu -hda hd.img -m 1024". Let alone that I usually want to have full control over qemu, including monitor access and small details available as command line options.

I know that I'm not the average user with these requirements, but still I am one user and do have these requirements. If I could just install libvirt, continue using qemu as I always did and libvirt picked my VMs up for things like global enumeration, that would be more or less the optimal thing for me.

Kevin

#229 lore raw

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

Quoted 25 lines · Kevin Wolf

Am 22.03.2010 23:06, schrieb Anthony Liguori:

Quoted 12 lines · Avi Kivity
Quoted 4 lines

Having qemu enumerate guests one way or another is not a good idea IMO since it is focused on one guest and doesn't have a system-wide entity.

There always needs to be a system wide entity. There are two ways to enumerate instances from that system wide entity. You can centralize the creation of instances and there by maintain an list of current instances. You can also allow instances to be created in a decentralized manner and provide a standard mechanism for instances to register themselves with the system wide entity.

Quoted 4 lines

IOW, it's the difference between asking libvirtd to exec(qemu) vs allowing a user to exec(qemu) and having qemu connect to a well known unix domain socket for libvirt to tell libvirtd that it exists.

I think the latter is exactly what I would want for myself. I do see the advantages of having a central instance, but I really don't want to bother with libvirt configuration files or even GUIs just to get an ad-hoc VM up when I can simply run "qemu -hda hd.img -m 1024". Let alone that I usually want to have full control over qemu, including monitor access and small details available as command line options.

Quoted 6 lines

I know that I'm not the average user with these requirements, but still I am one user and do have these requirements. If I could just install libvirt, continue using qemu as I always did and libvirt picked my VMs up for things like global enumeration, that would be more or less the optimal thing for me.

+1
And it would also make it more likely that users like us would convert to libvirt in the long run, by providing an easy and integrated transition path.
I've had another look at libvirt, and one of the things that is holding me back is the cost of moving existing scripts to libvirt. If it could just pick up what I have (at least in part), then I don't have to.

Antoine

Quoted 6 lines

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

#202 lore raw

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

In reply to Ingo Molnar

On Mon, 2010-03-22 at 21:21 +0100, Ingo Molnar wrote:
[...]

Quoted 1 line

Have you made thoughts about why that might be so?

Yes.

Forword: I assume with "GUI" you mean "a user interface for the classical desktop user with next to no interest in learning details or basics".
That doesn't mean the classical desktop user is silly, stupid or otherwise handicapped - it's just the lack of interest and/or time.

Quoted 2 lines

I think it's because of what i outlined above - that you are trying to apply the "UNIX secret" to GUIs - and that is a mistake.

No, it's the very same mechanism. But you just have to start at the correct point. In the kernel/device driver world, you start at the device.
And in the GUI world, you better start at the GUI (and not some kernel API, library API, GUI tool or toolchains or anywhere else).

Quoted 9 lines

A good GUI is almost at the _exact opposite spectrum_ of good command-line
tool: tightly integrated, with 'layering violations' designed into it all over the place:

look i can paste the text from an editor straight into a firefox form. I didnt go through any hiearchy of layers, i just took the shortest path between the apps!

In other words: in a GUI the output controls the design, for command-line

ACK, because you to make the GUI understandable to the intended users. If that means "hiding 90% of all possibilities and features", you just hide them.
Of course, the user of such an UI is quite limited doesn't use much of the functionality - because s/he can't access it through the GUI - (but presenting 100% - or even 40% - doesn't help either as s/he won't understand it anyways).

Quoted 1 line

tools the design controls the output.

ACK, because the user in this case (which is most of the time a developer, sys-admin, or similar techie) *wants* an 1:1 picture of the underlying model because s/he already *knows* the underlying model (and is willing and able to adapt the own workflow to the underlying models).

Quoted 1 line

It is no wonder Unix always had its problems with creating good GUIs that are

ACK. The clichee-Unix-person doesn't come from the "GUI world". So most of them are "trained" and used to look what's there and improve on it.

Quoted 3 lines

efficient to humans. A good GUI works like the human brain, and the human brain does not mind 'layering violations' when that gets it a more efficient result.

If this is the case, the layering/structure/design of the GUI is (very) badly defined/chosen (for whatever reason).

[ Most probably because some seasoned software developer designed the GUI-app *without* designing (and testing!) the GUI (or more to the
point: the look - how does it look like - and feel - how does it behave, what are the possible workflows, ... - of it) first. ]

Bernd

Signature · 2 lines
Bernd Petrovitsch                  Email : [email protected]
                     LUGA : http://www.luga.at
#375 lore raw
In reply to Zhang, Yanmin

Em Tue, Mar 23, 2010 at 11:14:41AM +0800, Zhang, Yanmin escreveu:

Quoted 7 lines · Arnaldo Carvalho de Melo
Quoted 6 lines

Em Mon, Mar 22, 2010 at 03:24:47PM +0800, Zhang, Yanmin escreveu:

Quoted 4 lines · Ingo Molnar

Then, perf could access all files. It's possible because guest os instance happens to be multi-threading in a process. One of the defects is the accessing to guest os becomes slow or impossible when guest os is very busy.

Quoted 7 lines
Quoted 3 lines

If the MMAP events on the guest included a cookie that could later be used to query for the symtab of that DSO, we wouldn't need to access the guest FS at all, right?

It depends on specific sub commands. As for 'perf kvm top', developers want to see the profiling immediately. Even with 'perf kvm record', developers also want to

That is not a problem, if you have the relevant buildids in your cache (Look in your machine at ~/.debug/), it will be as fast as ever.

If you use a distro that has its userspace with build-ids, you probably use it always without noticing :-)

Quoted 2 lines

see results quickly. At least I'm eager for the results when investigating a performance issue.

Sure thing.

Quoted 8 lines
Quoted 4 lines

With build-ids and debuginfo-install like tools the symbol resolution could be performed by using the cookies (build-ids) as keys to get to the *-debuginfo packages with matching symtabs (and DWARF for source annotation, etc).

We can't make sure guest os uses the same os images, or don't know where we could find the original DVD images being used to install guest os.

You don't have to have guest and host sharing the same OS image, you just have to somehow populate your buildid cache with what you need, be it using sshfs or what Ingo is suggesting once, or using what your vendor provides (debuginfo packages). And you just have to do it once, for the relevant apps, to have it in your buildid cache.

Quoted 2 lines

Current perf does save build id, including both kernls's and other application lib/executables.

Yeah, I know, I implemented it. :-)

Quoted 8 lines
Quoted 7 lines

We have that for the kernel as:

[acme@doppio linux-2.6-tip]$ l /sys/kernel/notes
-r--r--r-- 1 root root 36 2010-03-22 13:14 /sys/kernel/notes
[acme@doppio linux-2.6-tip]$ l /sys/module/ipv6/sections/.note.gnu.build-id -r--r--r-- 1 root root 4096 2010-03-22 13:38 /sys/module/ipv6/sections/.note.gnu.build-id [acme@doppio linux-2.6-tip]$

Quoted 4 lines
Quoted 2 lines

That way we would cover DSOs being reinstalled in long running 'perf record' sessions too.

That's one of objectives of perf to support long running.

But it doesn't fully supports right now, as I explained, build-ids are collected at the end of the record session, because we have to open the DSOs that had hits to get the 20 bytes cookie we need, the build-id.

If we had it in the PERF_RECORD_MMAP record, we would close this race, and the added cost at load time should be minimal, to get the ELF section with it and put it somewhere in task struct.

If only we could coalesce it a bit to reclaim this:

[acme@doppio linux-2.6-tip]$ pahole -C task_struct ../build/v2.6.34-rc1-tip+/kernel/sched.o | tail -5

	/* size: 5968, cachelines: 94, members: 150 */
	/* sum members: 5943, holes: 7, sum holes: 25 */
	/* bit holes: 1, sum bit holes: 28 bits */
	/* last cacheline: 16 bytes */
};

[acme@doppio linux-2.6-tip]$

8-)

Or at least get just one of those 4 bytes holes then we could stick it at the end to get our build-id there, accessing it would be done only at PERF_RECORD_MMAP injection time, i.e. close to the time when we actually are loading the executable mmap, i.e. close to the time when the loader is injecting the build-id, I guess the extra memory and processing costs would be in the noise.

Quoted 4 lines
Quoted 4 lines

This was discussed some time ago but would require help from the bits that load DSOs.

build-ids then would be first class citizens.

- Arnaldo

#364 lore raw
In reply to Joerg Roedel
Quoted 8 lines · Joerg Roedel
Quoted 6 lines · Ingo Molnar

Best would be if you demonstrated any problems of the perf symbol lookup code you are aware of on the host side, as it has that exact design you are criticising here. We are eager to fix any bugs in it.

If you claim that it's buggy then that should very much be demonstratable - no need to go into theoretical arguments about it.

Quoted 8 lines

I am not claiming anything. I just try to imagine how your proposal will look like in practice and forgot that symbol resolution is done at a later point.
But even with defered symbol resolution we need more information from the guest than just the rip falling out of KVM. The guest needs to tell us about the process where the event happened (information that the host has about itself without any hassle) and which executable-files it was loaded from.

Slightly tangential, but there is another case that has some of the same problems: profiling other language runtimes than C and C++, say Python. At the moment profilers will generally tell you what is going on inside the python runtime, but not what the python program itself is doing.

To fix that problem, it seems like we need some way to have python export what is going on. Maybe the same mechanism could be used to both access what is going on in qemu and python.

Soren

#365 lore raw
Quoted 4 lines · Soeren Sandmann

To fix that problem, it seems like we need some way to have python export what is going on. Maybe the same mechanism could be used to both access what is going on in qemu and python.

oprofile already has an interface to let JITs export information about the JITed code. C Python is not a JIT, but presumably one of the python JITs could do it.

http://oprofile.sourceforge.net/doc/devel/index.html

I know it's not envogue anymore and you won't be a approved cool kid if you do, but you could just use oprofile?

Ok presumably one would need to do a python interface for this first. I believe it's currently only implemented for Java and Mono. I presume it might work today with IronPython on Mono.

IMHO it doesn't make sense to invent another interface for this, although I'm sure someone will propose just that.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#366 lore raw
Quoted 11 lines · Andi Kleen
Quoted 4 lines · Soeren Sandmann

To fix that problem, it seems like we need some way to have python export what is going on. Maybe the same mechanism could be used to both access what is going on in qemu and python.

oprofile already has an interface to let JITs export information about the JITed code. C Python is not a JIT, but presumably one of the python JITs could do it.

http://oprofile.sourceforge.net/doc/devel/index.html

It's not that I personally want to profile a particular python program. I'm interested in the more general problem of extracting more information from profiled user space programs than just stack traces.

Examples:

- What is going on inside QEMU?

- Which client is the X server servicing?

- What parts of a python/shell/scheme/javascript program is taking the most CPU time?

I don't think the oprofile JIT interface solves any of these problems. (In fact, I don't see why the JIT problem is even hard. The JIT compiler can just generate a little ELF file with symbols in it, and the profiler can pick it up through the mmap events that you get through the perf interface).

Quoted 2 lines

I know it's not envogue anymore and you won't be a approved cool kid if you do, but you could just use oprofile?

I am bringing this up because I want to extend sysprof to be more useful.

Soren

#230 lore raw

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

In reply to Anthony Liguori
Quoted 6 lines · Anthony Liguori

There always needs to be a system wide entity. There are two ways to enumerate instances from that system wide entity. You can centralize the creation of instances and there by maintain an list of current instances. You can also allow instances to be created in a decentralized manner and provide a standard mechanism for instances to register themselves with the system wide entity.

And this system wide entity is the kvm module. It creates instances of 'struct kvm' and destroys them. I see no problem if we just attach a name to every instance with a good default value like kvm0, kvm1 ... or guest0, guest1 ... User-space can override the name if it wants. The kvm module takes care about the names being unique.
This is very much the same as network card numbering is implemented in the kernel.
Forcing perf to talk to qemu or even libvirt produces to much overhead imho. Instrumentation only produces useful results with low overhead.

Joerg

#227 lore raw

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

In reply to Avi Kivity
Quoted 6 lines · Avi Kivity
Quoted 5 lines · Anthony Liguori
Quoted 1 line

Having qemu enumerate guests one way or another is not a good idea IMO since it is focused on one guest and doesn't have a system-wide entity.

There always needs to be a system wide entity. There are two ways to enumerate instances from that system wide entity. You can centralize the creation of instances and there by maintain an list of current instances. You can also allow instances to be created in a decentralized manner and provide a standard mechanism for instances to register themselves with the system wide entity.

Quoted 7 lines
Quoted 5 lines

IOW, it's the difference between asking libvirtd to exec(qemu) vs allowing a user to exec(qemu) and having qemu connect to a well known unix domain socket for libvirt to tell libvirtd that it exists.

The later approach has a number of advantages. libvirt already supports both models. The former is the '/system' uri and the later is the '/session' uri.

What I'm proposing, is to use the host file system as the system wide entity instead of libvirtd. libvirtd can monitor the host file system to participate in these activities but ultimately, moving this functionality out of libvirtd means that it becomes the standard mechanism for all qemu instances regardless of how they're launched.

I don't like dropping sockets into the host filesystem, especially as they won't be cleaned up on abnormal exit. I also think this breaks our 'mechanism, not policy' policy. Someone may want to do something weird with qemu that doesn't work well with this.

The approach I've taken (which I accidentally committed and reverted) was to set this up as the default qmp device much like we have a default monitor device. A user is capable of overriding this by manually specifying a qmp device or by disabling defaults.

Quoted 1 line

We could allow starting monitors from the global configuration file, so a distribution can do this if it wants, but I don't think we should do this ourselves by default.

I've looked at making default devices globally configurable. We'll get there but I think that's orthogonal to setting up a useful default qmp device.

Regards,

Anthony Liguori

#370 lore raw
In reply to Andi Kleen

Em Tue, Mar 23, 2010 at 02:49:01PM +0100, Andi Kleen escreveu:

Quoted 5 lines
Quoted 3 lines · Soeren Sandmann

To fix that problem, it seems like we need some way to have python export what is going on. Maybe the same mechanism could be used to both access what is going on in qemu and python.

Quoted 8 lines

oprofile already has an interface to let JITs export information about the JITed code. C Python is not a JIT, but presumably one of the python JITs could do it.

http://oprofile.sourceforge.net/doc/devel/index.html

I know it's not envogue anymore and you won't be a approved cool kid if you do, but you could just use oprofile?

perf also has supports for this and Pekka Enberg's jato uses it:

http://penberg.blogspot.com/2009/06/jato-has-profiler.html

- Arnaldo

#367 lore raw
In reply to Soeren Sandmann
Quoted 4 lines · Soeren Sandmann

Examples:

- What is going on inside QEMU?

That's something the JIT interface could answer.

Quoted 4 lines

- Which client is the X server servicing?

- What parts of a python/shell/scheme/javascript program is taking the most CPU time?

I suspect for those you rather need event based tracers of some sort, similar to kernel trace points. Otherwise you would need own separate stacks and other complications.

systemtap has some effort to use the dtrace instrumentation that crops up in more and more user programs for this. It wouldn't surprise me if that was already in python and other programs you're interested in.

I presume right now it only works if you apply the utrace monstrosity though, but perhaps the new uprobes patches floating around will come to rescue.

There also was some effort to have a pure user space daemon based approach for LTT, but I believe that currently needs own trace points.

Again I fully expect someone to reinvent the wheel here and afterwards complain about "community inefficiences" :-)

Quoted 5 lines

I don't think the oprofile JIT interface solves any of these problems. (In fact, I don't see why the JIT problem is even hard. The JIT compiler can just generate a little ELF file with symbols in it, and the profiler can pick it up through the mmap events that you get through the perf interface).

That would require keeping those temporary ELF files for potentially unlimited time around (profilers today look at the ELF files at the final analysis phase, which might be weeks away)

Also that would be a lot of overhead for the JIT and most likely be a larger scale rewrite for a given JIT code base.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#368 lore raw

Em Tue, Mar 23, 2010 at 03:20:11PM +0100, Andi Kleen escreveu:

Quoted 10 lines
Quoted 5 lines · Soeren Sandmann

I don't think the oprofile JIT interface solves any of these problems. (In fact, I don't see why the JIT problem is even hard. The JIT compiler can just generate a little ELF file with symbols in it, and the profiler can pick it up through the mmap events that you get through the perf interface).

That would require keeping those temporary ELF files for potentially unlimited time around (profilers today look at the ELF files at the final analysis phase, which might be weeks away)

'perf record' will traverse the perf.data file just collected and, if the binaries have build-ids, will stash them in ~/.debug/, keyed by build-id just like the -debuginfo packages do.

So only the binaries with hits. Also one can use 'perf archive' to create a tar.bz2 file with the files with hits for the specified perf.data file, that can then be transfered to another machine, whatever arch, untarred at ~/.debug and then the report can be done there.

As it is done by build-id, multiple 'perf record' sessions share files in the cache.

Right now the whole ELF file (or /proc/kallsyms copy) is stored if collected from the DSO directly, or the bits that are stored in -debuginfo files if we find it installed (so smaller). We could strip that down further by storing just the ELF sections needed to make sense of the symtab.

- Arnaldo

#369 lore raw
In reply to Soeren Sandmann
Quoted 6 lines · Soeren Sandmann

[...]
- What is going on inside QEMU?
- Which client is the X server servicing?
- What parts of a python/shell/scheme/javascript program is taking the most CPU time?
[...]

These kinds of questions usually require navigation through internal data of the user-space process ("Where in this linked list is this pointer?"), and often also correlating them with history ("which socket/fd was most recently serviced?").

Systemtap excels at letting one express such things.

- FChE

maintainer
#371 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 10 lines · Arnaldo Carvalho de Melo

Em Tue, Mar 23, 2010 at 02:49:01PM +0100, Andi Kleen escreveu:

Quoted 9 lines
Quoted 3 lines · Soeren Sandmann

To fix that problem, it seems like we need some way to have python export what is going on. Maybe the same mechanism could be used to both access what is going on in qemu and python.

oprofile already has an interface to let JITs export information about the JITed code. C Python is not a JIT, but presumably one of the python JITs could do it.

Quoted 8 lines
Quoted 4 lines

http://oprofile.sourceforge.net/doc/devel/index.html

I know it's not envogue anymore and you won't be a approved cool kid if you do, but you could just use oprofile?

perf also has supports for this and Pekka Enberg's jato uses it:

http://penberg.blogspot.com/2009/06/jato-has-profiler.html

Right, we need to move that into a library though (always meant to do that, never got around to doing it).

That way the app can link against a dso with weak empty stubs and have perf record LD_PRELOAD a version that has a suitable implementation.

That all has the advantage of not exposing the actual interface like we do now.

#231 lore raw

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

In reply to Joerg Roedel
Quoted 9 lines · Joerg Roedel
Quoted 7 lines · Anthony Liguori

There always needs to be a system wide entity. There are two ways to enumerate instances from that system wide entity. You can centralize the creation of instances and there by maintain an list of current instances. You can also allow instances to be created in a decentralized manner and provide a standard mechanism for instances to register themselves with the system wide entity.

Quoted 6 lines

And this system wide entity is the kvm module. It creates instances of 'struct kvm' and destroys them. I see no problem if we just attach a name to every instance with a good default value like kvm0, kvm1 ... or guest0, guest1 ... User-space can override the name if it wants. The kvm module takes care about the names being unique.

So, two users can't have a guest named MyGuest each? What about namespace support? There's a lot of work in virtualizing all kernel namespaces, you're adding to that. What about notifications when guests are added or removed?

Quoted 6 lines

This is very much the same as network card numbering is implemented in the kernel.
Forcing perf to talk to qemu or even libvirt produces to much overhead imho. Instrumentation only produces useful results with low overhead.

It's a setup cost only.

Signature · 1 line
error compiling committee.c: too many arguments to function
#232 lore raw

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

Quoted 9 lines · Avi Kivity
Quoted 6 lines · Joerg Roedel

And this system wide entity is the kvm module. It creates instances of 'struct kvm' and destroys them. I see no problem if we just attach a name to every instance with a good default value like kvm0, kvm1 ... or guest0, guest1 ... User-space can override the name if it wants. The kvm module takes care about the names being unique.

Quoted 3 lines

So, two users can't have a guest named MyGuest each? What about namespace support? There's a lot of work in virtualizing all kernel namespaces, you're adding to that.

This enumeration is a very small and non-intrusive feature. Making it aware of namespaces is easy too.

Quoted 1 line

What about notifications when guests are added or removed?

Who would be the consumer of such notifications? A 'perf kvm list' can live without I guess. If we need them later we can still add them.

Quoted 7 lines
Quoted 5 lines

This is very much the same as network card numbering is implemented in the kernel.
Forcing perf to talk to qemu or even libvirt produces to much overhead imho. Instrumentation only produces useful results with low overhead.

It's a setup cost only.

My statement was not limited to enumeration, I should have been more clear about that. The guest filesystem access-channel is another affected part. The 'perf kvm top' command will access the guest filesystem regularly and going over qemu would be more overhead here. Providing this in the KVM module directly also has the benefit that it would work out-of-the-box with different userspaces too. Or do we want to limit 'perf kvm' to the libvirt-qemu-kvm software stack?

Sidenote: I really think we should come to a conclusion about the
concept. KVM integration into perf is very useful feature to analyze virtualization workloads.

Thanks,

Joerg

maintainer
#233 lore raw

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

Quoted 3 lines · Joerg Roedel

Sidenote: I really think we should come to a conclusion about the
concept. KVM integration into perf is very useful feature to analyze virtualization workloads.

I always start my things with bare kvm, It would be very unwelcome to mandate libvirt, or for that matter running a particular userspace in the guest.

#234 lore raw

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

In reply to Joerg Roedel
Quoted 7 lines · Joerg Roedel
Quoted 3 lines · Avi Kivity

So, two users can't have a guest named MyGuest each?  What about namespace support?  There's a lot of work in virtualizing all kernel namespaces, you're adding to that.

This enumeration is a very small and non-intrusive feature. Making it aware of namespaces is easy too.

an outsider's comment: this path leads to a filesystem... which could be a very nice idea. it could have a directory for each VM, with pseudo-files with all the guest's status, and even the memory it's
using. perf could simply watch those files. in fact, such a
filesystem could be the main userleve/kernel interface.

but i'm sure such a layour was considered (and rejected) very early in the KVM design. i don't think there's anything new to make it more desirable than it was back then.

Signature · 1 line
Javier
#376 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 60 lines · Arnaldo Carvalho de Melo

Em Tue, Mar 23, 2010 at 11:14:41AM +0800, Zhang, Yanmin escreveu:

Quoted 7 lines · Arnaldo Carvalho de Melo
Quoted 6 lines

Em Mon, Mar 22, 2010 at 03:24:47PM +0800, Zhang, Yanmin escreveu:

Quoted 4 lines · Ingo Molnar

Then, perf could access all files. It's possible because guest os instance happens to be multi-threading in a process. One of the defects is the accessing to guest os becomes slow or impossible when guest os is very busy.

Quoted 7 lines
Quoted 3 lines

If the MMAP events on the guest included a cookie that could later be used to query for the symtab of that DSO, we wouldn't need to access the guest FS at all, right?

It depends on specific sub commands. As for 'perf kvm top', developers want to see the profiling immediately. Even with 'perf kvm record', developers also want to

That is not a problem, if you have the relevant buildids in your cache (Look in your machine at ~/.debug/), it will be as fast as ever.

If you use a distro that has its userspace with build-ids, you probably use it always without noticing :-)

Quoted 2 lines

see results quickly. At least I'm eager for the results when investigating a performance issue.

Sure thing.

Quoted 8 lines
Quoted 4 lines

With build-ids and debuginfo-install like tools the symbol resolution could be performed by using the cookies (build-ids) as keys to get to the *-debuginfo packages with matching symtabs (and DWARF for source annotation, etc).

We can't make sure guest os uses the same os images, or don't know where we could find the original DVD images being used to install guest os.

You don't have to have guest and host sharing the same OS image, you just have to somehow populate your buildid cache with what you need, be it using sshfs or what Ingo is suggesting once, or using what your vendor provides (debuginfo packages). And you just have to do it once, for the relevant apps, to have it in your buildid cache.

Quoted 2 lines

Current perf does save build id, including both kernls's and other application lib/executables.

Yeah, I know, I implemented it. :-)

Quoted 8 lines
Quoted 7 lines

We have that for the kernel as:

[acme@doppio linux-2.6-tip]$ l /sys/kernel/notes
-r--r--r-- 1 root root 36 2010-03-22 13:14 /sys/kernel/notes
[acme@doppio linux-2.6-tip]$ l /sys/module/ipv6/sections/.note.gnu.build-id -r--r--r-- 1 root root 4096 2010-03-22 13:38 /sys/module/ipv6/sections/.note.gnu.build-id [acme@doppio linux-2.6-tip]$

Quoted 4 lines
Quoted 2 lines

That way we would cover DSOs being reinstalled in long running 'perf record' sessions too.

That's one of objectives of perf to support long running.

Quoted 7 lines

But it doesn't fully supports right now, as I explained, build-ids are collected at the end of the record session, because we have to open the DSOs that had hits to get the 20 bytes cookie we need, the build-id.

If we had it in the PERF_RECORD_MMAP record, we would close this race, and the added cost at load time should be minimal, to get the ELF section with it and put it somewhere in task struct.

Well, you are improving upon perfection.

Quoted 10 lines

If only we could coalesce it a bit to reclaim this:

[acme@doppio linux-2.6-tip]$ pahole -C task_struct ../build/v2.6.34-rc1-tip+/kernel/sched.o | tail -5

	/* size: 5968, cachelines: 94, members: 150 */
	/* sum members: 5943, holes: 7, sum holes: 25 */
	/* bit holes: 1, sum bit holes: 28 bits */
	/* last cacheline: 16 bytes */
};

[acme@doppio linux-2.6-tip]$

That reminds me I listened to your presentation on 2007 OLS. :)

Quoted 16 lines

8-)

Or at least get just one of those 4 bytes holes then we could stick it at the end to get our build-id there, accessing it would be done only at PERF_RECORD_MMAP injection time, i.e. close to the time when we actually are loading the executable mmap, i.e. close to the time when the loader is injecting the build-id, I guess the extra memory and processing costs would be in the noise.

Quoted 4 lines
Quoted 4 lines

This was discussed some time ago but would require help from the bits that load DSOs.

build-ids then would be first class citizens.

- Arnaldo

#235 lore raw

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

In reply to Joerg Roedel
Quoted 12 lines · Joerg Roedel
Quoted 10 lines · Avi Kivity
Quoted 7 lines · Joerg Roedel

And this system wide entity is the kvm module. It creates instances of 'struct kvm' and destroys them. I see no problem if we just attach a name to every instance with a good default value like kvm0, kvm1 ... or guest0, guest1 ... User-space can override the name if it wants. The kvm module takes care about the names being unique.

Quoted 7 lines
Quoted 4 lines

So, two users can't have a guest named MyGuest each? What about namespace support? There's a lot of work in virtualizing all kernel namespaces, you're adding to that.

This enumeration is a very small and non-intrusive feature. Making it aware of namespaces is easy too.

It's easier (and safer and all the other boring bits) not to do it at all in the kernel.

Quoted 5 lines
Quoted 2 lines

What about notifications when guests are added or removed?

Who would be the consumer of such notifications? A 'perf kvm list' can live without I guess. If we need them later we can still add them.

System-wide monitoring needs to work equally well for guests started before or after the monitor. Even disregarding that, if you introduce an API, people will start using it and complaining if it's incomplete.

The equivalent functionality for network interfaces is in netlink.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

This is very much the same as network card numbering is implemented in the kernel.
Forcing perf to talk to qemu or even libvirt produces to much overhead imho. Instrumentation only produces useful results with low overhead.

Quoted 7 lines
Quoted 2 lines

It's a setup cost only.

My statement was not limited to enumeration, I should have been more clear about that. The guest filesystem access-channel is another affected part. The 'perf kvm top' command will access the guest filesystem regularly and going over qemu would be more overhead here.

Why? Also, the real cost would be accessing the filesystem, not copying data over qemu.

Quoted 4 lines

Providing this in the KVM module directly also has the benefit that it would work out-of-the-box with different userspaces too. Or do we want to limit 'perf kvm' to the libvirt-qemu-kvm software stack?

Other userspaces can also provide this functionality, like they have to provide disk, network, and display emulation. The kernel is not a huge library.

Quoted 5 lines

Sidenote: I really think we should come to a conclusion about the
concept. KVM integration into perf is very useful feature to
analyze virtualization workloads.

Agreed.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#275 lore raw

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

In reply to Joerg Roedel
Quoted 4 lines · Joerg Roedel

Sidenote: I really think we should come to a conclusion about the
concept. KVM integration into perf is very useful feature to analyze virtualization workloads.

Agreed. I especially would like to see instruction/branch tracing working this way. This would a lot of the benefits of a simulator on a real CPU.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#276 lore raw

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

Quoted 10 lines · Andi Kleen
Quoted 4 lines · Joerg Roedel

Sidenote: I really think we should come to a conclusion about the
concept. KVM integration into perf is very useful feature to
analyze virtualization workloads.

Agreed. I especially would like to see instruction/branch tracing working this way. This would a lot of the benefits of a simulator on a real CPU.

If you're profiling a single guest it makes more sense to do this from inside the guest - you can profile userspace as well as the kernel.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#277 lore raw

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

Quoted 2 lines

If you're profiling a single guest it makes more sense to do this from inside the guest - you can profile userspace as well as the kernel.

I'm interested in debugging the guest without guest cooperation.

In many cases qemu's new gdb stub works for that, but in some cases I would prefer instruction/branch traces over standard gdb style debugging.

I used to use that very successfully with simulators in the past for some hard bugs.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#278 lore raw

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

Quoted 9 lines · Andi Kleen
Quoted 3 lines

If you're profiling a single guest it makes more sense to do this from inside the guest - you can profile userspace as well as the kernel.

I'm interested in debugging the guest without guest cooperation.

In many cases qemu's new gdb stub works for that, but in some cases I would prefer instruction/branch traces over standard gdb style debugging.

Isn't gdb supposed to be able to use branch traces? It makes sense to expose them via the gdb stub then. Not to say an external tool doesn't make sense.

Signature · 1 line
error compiling committee.c: too many arguments to function
#279 lore raw

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

Quoted 4 lines · Avi Kivity
Quoted 3 lines · Andi Kleen
Quoted 3 lines

If you're profiling a single guest it makes more sense to do this from inside the guest - you can profile userspace as well as the kernel.

Quoted 8 lines
Quoted 6 lines

I'm interested in debugging the guest without guest cooperation.

In many cases qemu's new gdb stub works for that, but in some cases I would prefer instruction/branch traces over standard gdb style debugging.

Isn't gdb supposed to be able to use branch traces?

AFAIK not. The ptrace interface is only used by idb I believe. I might be wrong on that.

Not sure if there is even a remote protocol command for branch traces either.

There's a concept of "tracepoints" in the protocol, but it doesn't quite match at.

Quoted 3 lines

It makes sense to
expose them via the gdb stub then. Not to say an external tool doesn't make sense.

Ok that would work for me too. As long as I can set start/stop triggers and pipe the log somewhere it's fine for me.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#236 lore raw

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

In reply to Avi Kivity
Quoted 7 lines · Avi Kivity
Quoted 3 lines · Joerg Roedel

This enumeration is a very small and non-intrusive feature. Making it aware of namespaces is easy too.

It's easier (and safer and all the other boring bits) not to do it at all in the kernel.

For the KVM stack is doesn't matter where it is implemented. It is as easy in qemu or libvirt as in the kernel. I also don't see big risks. On the perf side and for its users it is a lot easier to have this in the kernel.
I for example always use plain qemu when running kvm guests and never used libvirt. The only central entity I have here is the kvm kernel modules. I don't want to start using it only to be able to use perf kvm.

Quoted 5 lines
Quoted 2 lines

Who would be the consumer of such notifications? A 'perf kvm list' can live without I guess. If we need them later we can still add them.

System-wide monitoring needs to work equally well for guests started before or after the monitor.

Could be easily done using notifier chains already in the kernel. Probably implemented with much less than 100 lines of additional code.

Quoted 2 lines

Even disregarding that, if you introduce an API, people will start using it and complaining if it's incomplete.

There is nothing wrong with that. We only need to define what this API should be used for to prevent rank growth. It could be an instrumentation-only API for example.

Quoted 8 lines
Quoted 5 lines

My statement was not limited to enumeration, I should have been more clear about that. The guest filesystem access-channel is another affected part. The 'perf kvm top' command will access the guest filesystem regularly and going over qemu would be more overhead here.

Why? Also, the real cost would be accessing the filesystem, not copying data over qemu.

When measuring cache-misses any additional (and in this case unnecessary) copy-overhead result in less appropriate results.

Quoted 7 lines
Quoted 3 lines

Providing this in the KVM module directly also has the benefit that it would work out-of-the-box with different userspaces too. Or do we want to limit 'perf kvm' to the libvirt-qemu-kvm software stack?

Other userspaces can also provide this functionality, like they have to provide disk, network, and display emulation. The kernel is not a huge library.

This has nothing to do with a library. It is about entity and resource management which is what os kernels are about. The virtual machine is the entity (similar to a process) and we want to add additional access channels and names to it.

Joerg

maintainer
#283 lore raw

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

In reply to Avi Kivity
Quoted 6 lines · Avi Kivity

(btw, why are you interested in desktop-on-desktop? one use case is developers, which don't really need fancy GUIs; a second is people who test out distributions, but that doesn't seem to be a huge population; and a third is people running Windows for some application that doesn't run on Linux - hopefully a small catergory as well.

This third category is pretty well served by virt-manager. It has its quirks and shortcomings, but at least it exists.

Paolo

#237 lore raw

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

In reply to Joerg Roedel
Quoted 11 lines · Joerg Roedel
Quoted 9 lines · Avi Kivity
Quoted 4 lines · Joerg Roedel

This enumeration is a very small and non-intrusive feature. Making it aware of namespaces is easy too.

It's easier (and safer and all the other boring bits) not to do it at all in the kernel.

Quoted 8 lines

For the KVM stack is doesn't matter where it is implemented. It is as easy in qemu or libvirt as in the kernel. I also don't see big risks. On the perf side and for its users it is a lot easier to have this in the kernel.
I for example always use plain qemu when running kvm guests and never used libvirt. The only central entity I have here is the kvm kernel modules. I don't want to start using it only to be able to use perf kvm.

You can always provide the kernel and module paths as command line parameters. It just won't be transparently usable, but if you're using qemu from the command line, presumably you can live with that.

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

Who would be the consumer of such notifications? A 'perf kvm list' can live without I guess. If we need them later we can still add them.

System-wide monitoring needs to work equally well for guests started before or after the monitor.

Could be easily done using notifier chains already in the kernel. Probably implemented with much less than 100 lines of additional code.

And a userspace interface for that.

Quoted 7 lines
Quoted 3 lines

Even disregarding that, if you introduce an API, people will start using it and complaining if it's incomplete.

There is nothing wrong with that. We only need to define what this API should be used for to prevent rank growth. It could be an instrumentation-only API for example.

If we make an API, I'd like it to be generally useful.

It's a total headache. For example, we'd need security module hooks to determine access permissions. So far we managed to avoid that since kvm doesn't allow you to access any information beyond what you provided it directly.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

My statement was not limited to enumeration, I should have been more clear about that. The guest filesystem access-channel is another affected part. The 'perf kvm top' command will access the guest filesystem regularly and going over qemu would be more overhead here.

Quoted 6 lines
Quoted 3 lines

Why? Also, the real cost would be accessing the filesystem, not copying data over qemu.

When measuring cache-misses any additional (and in this case unnecessary) copy-overhead result in less appropriate results.

Copying the objects is a one time cost. If you run perf for more than a second or two, it would fetch and cache all of the data. It's really the same problem with non-guest profiling, only magnified a bit.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Providing this in the KVM module directly also has the benefit that it would work out-of-the-box with different userspaces too. Or do we want to limit 'perf kvm' to the libvirt-qemu-kvm software stack?

Quoted 9 lines
Quoted 4 lines

Other userspaces can also provide this functionality, like they have to provide disk, network, and display emulation. The kernel is not a huge library.

This has nothing to do with a library. It is about entity and resource management which is what os kernels are about. The virtual machine is the entity (similar to a process) and we want to add additional access channels and names to it.

kvm.ko has only a small subset of the information that is used to define a guest.

Signature · 1 line
error compiling committee.c: too many arguments to function
#238 lore raw

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

Quoted 5 lines · Avi Kivity

On 03/24/2010 01:59 PM, Joerg Roedel wrote:

You can always provide the kernel and module paths as command line parameters. It just won't be transparently usable, but if you're using qemu from the command line, presumably you can live with that.

I don't want the tool for myself only. A typical perf user expects that it works transparent.

Quoted 4 lines
Quoted 2 lines

Could be easily done using notifier chains already in the kernel. Probably implemented with much less than 100 lines of additional code.

And a userspace interface for that.

Not necessarily. The perf event is configured to measure systemwide kvm by userspace. The kernel side of perf takes care that it stays system-wide even with added vm instances. So in this case the consumer for the notifier would be the perf kernel part. No userspace interface required.

Quoted 1 line

If we make an API, I'd like it to be generally useful.

Thats hard to do at this point since we don't know what people will use it for. We should keep it simple in the beginning and add new features as they are requested and make sense in this context.

Quoted 4 lines

It's a total headache. For example, we'd need security module hooks to determine access permissions. So far we managed to avoid that since kvm doesn't allow you to access any information beyond what you provided it directly.

Depends on how it is designed. A filesystem approach was already mentioned. We could create /sys/kvm/ for example to expose information about virtual machines to userspace. This would not require any new security hooks.

Quoted 3 lines

Copying the objects is a one time cost. If you run perf for more than a second or two, it would fetch and cache all of the data. It's really the same problem with non-guest profiling, only magnified a bit.

I don't think we can cache filesystem data of a running guest on the host. It is too hard to keep such a cache coherent.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Other userspaces can also provide this functionality, like they have to provide disk, network, and display emulation. The kernel is not a huge library.

If two userspaces run in parallel what is the single instance where perf can get a list of guests from?

Quoted 2 lines

kvm.ko has only a small subset of the information that is used to define a guest.

The subset is not small. It contains all guest vcpus, the complete interrupt routing hardware emulation and manages event the guests memory.

Joerg

#239 lore raw

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

Quoted 8 lines · Joerg Roedel
Quoted 5 lines

You can always provide the kernel and module paths as command line parameters. It just won't be transparently usable, but if you're using qemu from the command line, presumably you can live with that.

I don't want the tool for myself only. A typical perf user expects that it works transparent.

A typical kvm user uses libvirt, so we can integrate it with that.

Quoted 11 lines
Quoted 5 lines
Quoted 3 lines

Could be easily done using notifier chains already in the kernel. Probably implemented with much less than 100 lines of additional code.

And a userspace interface for that.

Not necessarily. The perf event is configured to measure systemwide kvm by userspace. The kernel side of perf takes care that it stays system-wide even with added vm instances. So in this case the consumer for the notifier would be the perf kernel part. No userspace interface required.

Someone needs to know about the new guest to fetch its symbols. Or do you want that part in the kernel too?

Quoted 6 lines
Quoted 2 lines

If we make an API, I'd like it to be generally useful.

Thats hard to do at this point since we don't know what people will use it for. We should keep it simple in the beginning and add new features as they are requested and make sense in this context.

IMO this use case is to rare to warrant its own API, especially as there are alternatives.

Quoted 10 lines
Quoted 5 lines

It's a total headache. For example, we'd need security module hooks to determine access permissions. So far we managed to avoid that since kvm doesn't allow you to access any information beyond what you provided it directly.

Depends on how it is designed. A filesystem approach was already mentioned. We could create /sys/kvm/ for example to expose information about virtual machines to userspace. This would not require any new security hooks.

Who would set the security context on those files? Plus, we need cgroup support so you can't see one container's guests from an unrelated container.

Quoted 7 lines
Quoted 4 lines

Copying the objects is a one time cost. If you run perf for more than a second or two, it would fetch and cache all of the data. It's really the same problem with non-guest profiling, only magnified a bit.

I don't think we can cache filesystem data of a running guest on the host. It is too hard to keep such a cache coherent.

I don't see any choice. The guest can change its symbols at any time (say by kexec), without any notification.

Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Other userspaces can also provide this functionality, like they have to provide disk, network, and display emulation. The kernel is not a huge library.

If two userspaces run in parallel what is the single instance where perf can get a list of guests from?

I don't know. Surely that's solvable though.

Quoted 7 lines
Quoted 3 lines

kvm.ko has only a small subset of the information that is used to define a guest.

The subset is not small. It contains all guest vcpus, the complete interrupt routing hardware emulation and manages event the guests memory.

It doesn't contain most of the mmio and pio address space. Integration with qemu would allow perf to tell us that the guest is hitting the interrupt status register of a virtio-blk device in pci slot 5 (the information is already available through the kvm_mmio trace event, but only qemu can decode it).

Signature · 1 line
error compiling committee.c: too many arguments to function
#240 lore raw

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

Quoted 6 lines · Avi Kivity
Quoted 2 lines · Joerg Roedel

I don't want the tool for myself only. A typical perf user expects that it works transparent.

A typical kvm user uses libvirt, so we can integrate it with that.

Someone who uses libvirt and virt-manager by default is probably not interested in this feature at the same level a kvm developer is. And developers tend not to use libvirt for low-level kvm development. A number of developers have stated in this thread already that they would appreciate a solution for guest enumeration that would not involve libvirt.

Quoted 2 lines

Someone needs to know about the new guest to fetch its symbols. Or do you want that part in the kernel too?

The samples will be tagged with the guest-name (and some additional information perf needs). Perf userspace can access the symbols then through /sys/kvm/guest0/fs/...

Quoted 6 lines
Quoted 4 lines

Depends on how it is designed. A filesystem approach was already mentioned. We could create /sys/kvm/ for example to expose information about virtual machines to userspace. This would not require any new security hooks.

Who would set the security context on those files?

An approach like: "The files are owned and only readable by the same user that started the vm." might be a good start. So a user can measure its own guests and root can measure all of them.

Quoted 2 lines

Plus, we need cgroup support so you can't see one container's guests from an unrelated container.

cgroup support is an issue but we can solve that too. Its in general still less complex than going through the whole libvirt-qemu-kvm stack.

Quoted 4 lines

Integration with qemu would allow perf to tell us that the guest is hitting the interrupt status register of a virtio-blk device in pci slot 5 (the information is already available through the kvm_mmio trace event, but only qemu can decode it).

Yeah that would be interesting information. But it is more related to tracing than to pmu measurements.
The information which you mentioned above are probably better captured by an extension of trace-events to userspace.

Joerg

#271 lore raw

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

In reply to Avi Kivity
Quoted 24 lines · Avi Kivity
Quoted 8 lines · Joerg Roedel
Quoted 5 lines

You can always provide the kernel and module paths as command line parameters. It just won't be transparently usable, but if you're using qemu from the command line, presumably you can live with that.

I don't want the tool for myself only. A typical perf user expects that it works transparent.

A typical kvm user uses libvirt, so we can integrate it with that.

Quoted 11 lines
Quoted 5 lines
Quoted 3 lines

Could be easily done using notifier chains already in the kernel. Probably implemented with much less than 100 lines of additional code.

And a userspace interface for that.

Not necessarily. The perf event is configured to measure systemwide kvm by userspace. The kernel side of perf takes care that it stays system-wide even with added vm instances. So in this case the consumer for the notifier would be the perf kernel part. No userspace interface required.

Quoted 2 lines

Someone needs to know about the new guest to fetch its symbols. Or do you want that part in the kernel too?

How about we add a virtio "guest file system access" device? The guest would then expose its own file system using that device.

On the host side this would simply be a -virtioguestfs unix:/tmp/guest.fs and you'd get a unix socket that gives you full access to the guest file system by using commands. I envision something like:

SEND: GET /proc/version
RECV: Linux version 2.6.27.37-0.1-default (geeko@buildhost) (gcc version 4.3.2 [gcc-4_3-branch revision 141291] (SUSE Linux) ) #1 SMP 2009-10-15 14:56:58 +0200

Now all we need is integration in perf to enumerate virtual machines based on libvirt. If you want to run qemu-kvm directly, just go with --guestfs=/tmp/guest.fs and perf could fetch all required information automatically.

This should solve all issues while staying 100% in user space, right?

Alex

#241 lore raw

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

In reply to Joerg Roedel
Quoted 8 lines · Joerg Roedel
Quoted 6 lines · Avi Kivity
Quoted 3 lines · Joerg Roedel

I don't want the tool for myself only. A typical perf user expects that it works transparent.

Quoted 9 lines
Quoted 2 lines

A typical kvm user uses libvirt, so we can integrate it with that.

Someone who uses libvirt and virt-manager by default is probably not interested in this feature at the same level a kvm developer is. And developers tend not to use libvirt for low-level kvm development. A number of developers have stated in this thread already that they would appreciate a solution for guest enumeration that would not involve libvirt.

So would I. But when I weigh the benefit of truly transparent system-wide perf integration for users who don't use libvirt but do use perf, versus the cost of transforming kvm from a single-process API to a system-wide API with all the complications that I've listed, it comes out in favour of not adding the API.

Those few users can probably script something to cover their needs.

Quoted 7 lines
Quoted 3 lines

Someone needs to know about the new guest to fetch its symbols. Or do you want that part in the kernel too?

The samples will be tagged with the guest-name (and some additional information perf needs). Perf userspace can access the symbols then through /sys/kvm/guest0/fs/...

I take that as a yes? So we need a virtio-serial client in the kernel (which might be exploitable by a malicious guest if buggy) and a fs-over-virtio-serial client in the kernel (also exploitable).

Quoted 11 lines
Quoted 7 lines
Quoted 5 lines

Depends on how it is designed. A filesystem approach was already mentioned. We could create /sys/kvm/ for example to expose information about virtual machines to userspace. This would not require any new security hooks.

Who would set the security context on those files?

An approach like: "The files are owned and only readable by the same user that started the vm." might be a good start. So a user can measure its own guests and root can measure all of them.

That's not how sVirt works. sVirt isolates a user's VMs from each other, so if a guest breaks into qemu it can't break into other guests owned by the same user.

The users who need this API (!libvirt and perf) probably don't care about sVirt, but a new API must not break it.

Quoted 6 lines
Quoted 3 lines

Plus, we need cgroup support so you can't see one container's guests from an unrelated container.

cgroup support is an issue but we can solve that too. Its in general still less complex than going through the whole libvirt-qemu-kvm stack.

It's a tradeoff. IMO, going through qemu is the better way, and also provides more information.

Quoted 10 lines
Quoted 5 lines

Integration with qemu would allow perf to tell us that the guest is hitting the interrupt status register of a virtio-blk device in pci slot 5 (the information is already available through the kvm_mmio trace event, but only qemu can decode it).

Yeah that would be interesting information. But it is more related to tracing than to pmu measurements.
The information which you mentioned above are probably better captured by an extension of trace-events to userspace.

It's all related. You start with perf, see a problem with mmio, call up a histogram of mmio or interrupts or whatever, then zoom in on the misbehaving device.

Signature · 1 line
error compiling committee.c: too many arguments to function
#272 lore raw

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

In reply to Alexander Graf
Quoted 5 lines · Alexander Graf
Quoted 4 lines

Someone needs to know about the new guest to fetch its symbols. Or do you want that part in the kernel too?

Quoted 8 lines

How about we add a virtio "guest file system access" device? The guest would then expose its own file system using that device.

On the host side this would simply be a -virtioguestfs unix:/tmp/guest.fs and you'd get a unix socket that gives you full access to the guest file system by using commands. I envision something like:

The idea is to use a dedicated channel over virtio-serial. If the channel is present the file server can serve files over it.

Quoted 5 lines

SEND: GET /proc/version
RECV: Linux version 2.6.27.37-0.1-default (geeko@buildhost) (gcc version 4.3.2 [gcc-4_3-branch revision 141291] (SUSE Linux) ) #1 SMP 2009-10-15 14:56:58 +0200

Quoted 7 lines

Now all we need is integration in perf to enumerate virtual machines based on libvirt. If you want to run qemu-kvm directly, just go with --guestfs=/tmp/guest.fs and perf could fetch all required information automatically.

This should solve all issues while staying 100% in user space, right?

Yeah, needs a fuse filesystem to populate the host namespace (kind of sshfs over virtio-serial).

Signature · 1 line
error compiling committee.c: too many arguments to function
#273 lore raw

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

Quoted 9 lines · Avi Kivity
Quoted 8 lines · Alexander Graf
Quoted 4 lines

Someone needs to know about the new guest to fetch its symbols. Or do you want that part in the kernel too?

How about we add a virtio "guest file system access" device? The guest would then expose its own file system using that device.

Quoted 8 lines
Quoted 5 lines

On the host side this would simply be a -virtioguestfs unix:/tmp/guest.fs and you'd get a unix socket that gives you full access to the guest file system by using commands. I envision something like:

The idea is to use a dedicated channel over virtio-serial. If the channel is present the file server can serve files over it.

The file server being a kernel module inside the guest? We want to be able to serve things as early and hassle free as possible, so in this case I agree with Ingo that a kernel module is superior.

Quoted 11 lines
Quoted 11 lines

SEND: GET /proc/version
RECV: Linux version 2.6.27.37-0.1-default (geeko@buildhost) (gcc version 4.3.2 [gcc-4_3-branch revision 141291] (SUSE Linux) ) #1 SMP 2009-10-15 14:56:58 +0200

Now all we need is integration in perf to enumerate virtual machines based on libvirt. If you want to run qemu-kvm directly, just go with --guestfs=/tmp/guest.fs and perf could fetch all required information automatically.

Quoted 5 lines
Quoted 2 lines

This should solve all issues while staying 100% in user space, right?

Yeah, needs a fuse filesystem to populate the host namespace (kind of sshfs over virtio-serial).

I don't see why we need a fuse filesystem. We can of course create one later on. But for now all you need is a user connecting to that socket.

Alex

#242 lore raw

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

In reply to Avi Kivity
Quoted 10 lines · Avi Kivity
Quoted 6 lines · Joerg Roedel

Someone who uses libvirt and virt-manager by default is probably not interested in this feature at the same level a kvm developer is. And developers tend not to use libvirt for low-level kvm development. A number of developers have stated in this thread already that they would appreciate a solution for guest enumeration that would not involve libvirt.

So would I.

Great.

Quoted 5 lines

But when I weigh the benefit of truly transparent system-wide perf integration for users who don't use libvirt but do use perf, versus the cost of transforming kvm from a single-process API to a system-wide API with all the complications that I've listed, it comes out in favour of not adding the API.

Its not a transformation, its an extension. The current per-process /dev/kvm stays mostly untouched. Its all about having something like this:

$ cd /sys/kvm/guest0
$ ls -l
-r-------- 1 root root 0 2009-08-17 12:05 name
dr-x------ 1 root root 0 2009-08-17 12:05 fs
$ cat name
guest0
$ # ...

The fs/ directory is used as the mount point for the guest root fs.

Quoted 7 lines
Quoted 3 lines

The samples will be tagged with the guest-name (and some additional information perf needs). Perf userspace can access the symbols then through /sys/kvm/guest0/fs/...

I take that as a yes? So we need a virtio-serial client in the kernel (which might be exploitable by a malicious guest if buggy) and a fs-over-virtio-serial client in the kernel (also exploitable).

What I meant was: perf-kernel puts the guest-name into every sample and perf-userspace accesses /sys/kvm/guest_name/fs/ later to resolve the symbols. I leave the question of how the guest-fs is exposed to the host out of this discussion. We should discuss this seperatly.

Quoted 7 lines
Quoted 3 lines

An approach like: "The files are owned and only readable by the same user that started the vm." might be a good start. So a user can measure its own guests and root can measure all of them.

That's not how sVirt works. sVirt isolates a user's VMs from each other, so if a guest breaks into qemu it can't break into other guests owned by the same user.

If a vm breaks into qemu it can access the host file system which is the bigger problem. In this case there is no isolation anymore. From that context it can even kill other VMs of the same user independent of a hypothetical /sys/kvm/.

Quoted 8 lines
Quoted 4 lines

Yeah that would be interesting information. But it is more related to tracing than to pmu measurements. The information which you mentioned above are probably better captured by an extension of trace-events to userspace.

It's all related. You start with perf, see a problem with mmio, call up a histogram of mmio or interrupts or whatever, then zoom in on the misbehaving device.

Yes, but its different from the implementation point-of-view. For the user it surely all plays together.

Joerg

#274 lore raw

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

In reply to Alexander Graf
Quoted 18 lines · Alexander Graf
Quoted 16 lines · Avi Kivity
Quoted 14 lines · Alexander Graf
Quoted 5 lines

Someone needs to know about the new guest to fetch its symbols. Or do you want that part in the kernel too?

How about we add a virtio "guest file system access" device? The guest would then expose its own file system using that device.

On the host side this would simply be a -virtioguestfs unix:/tmp/guest.fs and you'd get a unix socket that gives you full access to the guest file system by using commands. I envision something like:

Quoted 7 lines
Quoted 3 lines

The idea is to use a dedicated channel over virtio-serial. If the channel is present the file server can serve files over it.

The file server being a kernel module inside the guest? We want to be able to serve things as early and hassle free as possible, so in this case I agree with Ingo that a kernel module is superior.

No, just a daemon. If it's important enough we can get distributions to package it by default, and then it will be hassle free. If "early enough" is also so important, we can get it to start up on initrd. If it's really critical, we can patch grub to serve the files as well.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

SEND: GET /proc/version
RECV: Linux version 2.6.27.37-0.1-default (geeko@buildhost) (gcc version 4.3.2 [gcc-4_3-branch revision 141291] (SUSE Linux) ) #1 SMP 2009-10-15 14:56:58 +0200

Now all we need is integration in perf to enumerate virtual machines based on libvirt. If you want to run qemu-kvm directly, just go with --guestfs=/tmp/guest.fs and perf could fetch all required information automatically.

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

This should solve all issues while staying 100% in user space, right?

Yeah, needs a fuse filesystem to populate the host namespace (kind of sshfs over virtio-serial).

I don't see why we need a fuse filesystem. We can of course create one later on. But for now all you need is a user connecting to that socket.

If the perf app knows the protocol, no problem. But leave perf with pure filesystem access and hide the details in fuse.

Signature · 1 line
error compiling committee.c: too many arguments to function
#243 lore raw

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

In reply to Joerg Roedel
Quoted 19 lines · Joerg Roedel
Quoted 7 lines

But when I weigh the benefit of truly transparent system-wide perf integration for users who don't use libvirt but do use perf, versus the cost of transforming kvm from a single-process API to a system-wide API with all the complications that I've listed, it comes out in favour of not adding the API.

Its not a transformation, its an extension. The current per-process /dev/kvm stays mostly untouched. Its all about having something like this:

$ cd /sys/kvm/guest0
$ ls -l
-r-------- 1 root root 0 2009-08-17 12:05 name
dr-x------ 1 root root 0 2009-08-17 12:05 fs
$ cat name
guest0
$ # ...
Quoted 2 lines

The fs/ directory is used as the mount point for the guest root fs.

The problem is /sys/kvm, not /sys/kvm/fs.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

The samples will be tagged with the guest-name (and some additional information perf needs). Perf userspace can access the symbols then through /sys/kvm/guest0/fs/...

Quoted 9 lines
Quoted 4 lines

I take that as a yes? So we need a virtio-serial client in the kernel (which might be exploitable by a malicious guest if buggy) and a fs-over-virtio-serial client in the kernel (also exploitable).

What I meant was: perf-kernel puts the guest-name into every sample and perf-userspace accesses /sys/kvm/guest_name/fs/ later to resolve the symbols. I leave the question of how the guest-fs is exposed to the host out of this discussion. We should discuss this seperatly.

How I see it: perf-kernel puts the guest pid into every sample, and perf-userspace uses that to resolve to a mountpoint served by fuse, or to a unix domain socket that serves the files.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

An approach like: "The files are owned and only readable by the same user that started the vm." might be a good start. So a user can measure its own guests and root can measure all of them.

Quoted 9 lines
Quoted 4 lines

That's not how sVirt works. sVirt isolates a user's VMs from each other, so if a guest breaks into qemu it can't break into other guests owned by the same user.

If a vm breaks into qemu it can access the host file system which is the bigger problem. In this case there is no isolation anymore. From that context it can even kill other VMs of the same user independent of a hypothetical /sys/kvm/.

It cannot. sVirt labels the disk image and other files qemu needs with the appropriate label, and everything else is off limits. Even if you run the guest as root, it won't have access to other files.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Yeah that would be interesting information. But it is more related to tracing than to pmu measurements. The information which you mentioned above are probably better captured by an extension of trace-events to userspace.

Quoted 7 lines
Quoted 4 lines

It's all related. You start with perf, see a problem with mmio, call up a histogram of mmio or interrupts or whatever, then zoom in on the misbehaving device.

Yes, but its different from the implementation point-of-view. For the user it surely all plays together.

We need qemu to cooperate for mmio tracing, and we can cooperate with qemu for symbol resolution. If it prevents adding another kernel API, that's a win from my POV.

Signature · 1 line
error compiling committee.c: too many arguments to function
#256 lore raw

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

In reply to Joerg Roedel
Quoted 4 lines · Joerg Roedel
Quoted 4 lines
Quoted 3 lines

An approach like: "The files are owned and only readable by the same user that started the vm." might be a good start. So a user can measure its own guests and root can measure all of them.

Quoted 8 lines
Quoted 3 lines

That's not how sVirt works. sVirt isolates a user's VMs from each other, so if a guest breaks into qemu it can't break into other guests owned by the same user.

If a vm breaks into qemu it can access the host file system which is the bigger problem. In this case there is no isolation anymore. From that context it can even kill other VMs of the same user independent of a hypothetical /sys/kvm/.

No it can't. With sVirt every single VM has a custom security label and the policy only allows it access to disks / files with a matching label, and prevents it attacking any other VMs or processes on the host. THis confines the scope of any exploit in QEMU to those resources the admin has explicitly assigned to the guest.

Regards,
Daniel

Signature · 4 lines
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
#257 lore raw

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

Quoted 14 lines · Daniel P. Berrange
Quoted 4 lines · Joerg Roedel
Quoted 4 lines
Quoted 3 lines

An approach like: "The files are owned and only readable by the same user that started the vm." might be a good start. So a user can measure its own guests and root can measure all of them.

Quoted 8 lines
Quoted 3 lines

That's not how sVirt works. sVirt isolates a user's VMs from each other, so if a guest breaks into qemu it can't break into other guests owned by the same user.

If a vm breaks into qemu it can access the host file system which is the bigger problem. In this case there is no isolation anymore. From that context it can even kill other VMs of the same user independent of a hypothetical /sys/kvm/.

Quoted 5 lines

No it can't. With sVirt every single VM has a custom security label and the policy only allows it access to disks / files with a matching label, and prevents it attacking any other VMs or processes on the host. THis confines the scope of any exploit in QEMU to those resources the admin has explicitly assigned to the guest.

Even better. So a guest which breaks out can't even access its own /sys/kvm/ directory. Perfect, it doesn't need that access anyway.

Joerg

#258 lore raw

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

Quoted 11 lines · Joerg Roedel
Quoted 7 lines

No it can't. With sVirt every single VM has a custom security label and the policy only allows it access to disks / files with a matching label, and prevents it attacking any other VMs or processes on the host. THis confines the scope of any exploit in QEMU to those resources the admin has explicitly assigned to the guest.

Even better. So a guest which breaks out can't even access its own /sys/kvm/ directory. Perfect, it doesn't need that access anyway.

But what security label does that directory have? How can we make sure that whoever needs access to those files, gets them?

Automatically created objects don't work well with that model. They're simply missing information.

Signature · 1 line
error compiling committee.c: too many arguments to function
#244 lore raw

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

In reply to Avi Kivity
Quoted 9 lines · Avi Kivity
Quoted 8 lines · Joerg Roedel
$ cd /sys/kvm/guest0
$ ls -l
-r-------- 1 root root 0 2009-08-17 12:05 name
dr-x------ 1 root root 0 2009-08-17 12:05 fs
$ cat name
guest0
$ # ...
Quoted 3 lines
Quoted 1 line

The fs/ directory is used as the mount point for the guest root fs.

The problem is /sys/kvm, not /sys/kvm/fs.

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).

Quoted 8 lines
Quoted 4 lines

What I meant was: perf-kernel puts the guest-name into every sample and perf-userspace accesses /sys/kvm/guest_name/fs/ later to resolve the symbols. I leave the question of how the guest-fs is exposed to the host out of this discussion. We should discuss this seperatly.

How I see it: perf-kernel puts the guest pid into every sample, and perf-userspace uses that to resolve to a mountpoint served by fuse, or to a unix domain socket that serves the files.

We need a bit more information than just the qemu-pid, but yes, this would also work out.

Quoted 8 lines
Quoted 4 lines

If a vm breaks into qemu it can access the host file system which is the bigger problem. In this case there is no isolation anymore. From that context it can even kill other VMs of the same user independent of a hypothetical /sys/kvm/.

It cannot. sVirt labels the disk image and other files qemu needs with the appropriate label, and everything else is off limits. Even if you run the guest as root, it won't have access to other files.

See my reply to Daniel's email.

Quoted 6 lines
Quoted 2 lines

Yes, but its different from the implementation point-of-view. For the user it surely all plays together.

We need qemu to cooperate for mmio tracing, and we can cooperate with qemu for symbol resolution. If it prevents adding another kernel API, that's a win from my POV.

Thats true. Probably qemu can inject this information in the kvm-trace-events stream.

Joerg

#245 lore raw

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

Quoted 12 lines · Joerg Roedel
Quoted 10 lines · Avi Kivity
Quoted 8 lines · Joerg Roedel
$ cd /sys/kvm/guest0
$ ls -l
-r-------- 1 root root 0 2009-08-17 12:05 name
dr-x------ 1 root root 0 2009-08-17 12:05 fs
$ cat name
guest0
$ # ...
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The fs/ directory is used as the mount point for the guest root fs.

The problem is /sys/kvm, not /sys/kvm/fs.

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?

Signature · 1 line
error compiling committee.c: too many arguments to function
#259 lore raw

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

In reply to Avi Kivity
Quoted 9 lines · Avi Kivity
Quoted 2 lines · Joerg Roedel

Even better. So a guest which breaks out can't even access its own /sys/kvm/ directory. Perfect, it doesn't need that access anyway.

But what security label does that directory have? How can we make sure that whoever needs access to those files, gets them?

Automatically created objects don't work well with that model. They're simply missing information.

If we go the /proc/<pid>/kvm way then the directory should probably inherit the label from /proc/<pid>/?
Same could be applied to /sys/kvm/guest/ if we decide for it. The VM is still bound to a single process with a /proc/<pid> after all.

Joerg

#260 lore raw

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

Quoted 7 lines · Joerg Roedel
Quoted 5 lines · Avi Kivity
Quoted 3 lines · Joerg Roedel

Even better. So a guest which breaks out can't even access its own /sys/kvm/ directory. Perfect, it doesn't need that access anyway.

Quoted 9 lines
Quoted 6 lines

But what security label does that directory have? How can we make sure that whoever needs access to those files, gets them?

Automatically created objects don't work well with that model. They're simply missing information.

If we go the /proc/<pid>/kvm way then the directory should probably inherit the label from /proc/<pid>/?

That's a security policy. The security people like their policies outside the kernel.

For example, they may want a label that allows a trace context to read the data, and also qemu itself for introspection.

Quoted 3 lines

Same could be applied to /sys/kvm/guest/ if we decide for it. The VM is still bound to a single process with a /proc/<pid> after all.

Ditto.

Signature · 1 line
error compiling committee.c: too many arguments to function
#246 lore raw

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

In reply to Avi Kivity
Quoted 15 lines · Avi Kivity
Quoted 14 lines · Joerg Roedel
Quoted 12 lines · Avi Kivity
Quoted 10 lines · Joerg Roedel
$ cd /sys/kvm/guest0
$ ls -l
-r-------- 1 root root 0 2009-08-17 12:05 name
dr-x------ 1 root root 0 2009-08-17 12:05 fs
$ cat name
guest0
$ # ...

The fs/ directory is used as the mount point for the guest root fs.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

The problem is /sys/kvm, not /sys/kvm/fs.

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. With /proc/<pid>/kvm/guest we could symlink all guest directories to /proc/kvm/ and perf reads the list from there. Also perf can easily derive the directory for a guest from its pid. Last but not least its kernel-created and thus independent from the userspace part being used.

Joerg

maintainer
#267 lore raw

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

In reply to Joerg Roedel
Quoted 4 lines · Joerg Roedel

What I meant was: perf-kernel puts the guest-name into every sample and perf-userspace accesses /sys/kvm/guest_name/fs/ later to resolve the symbols. I leave the question of how the guest-fs is exposed to the host out of this discussion. We should discuss this seperatly.

I'd much prefer a pid like suggested later, keeps the samples smaller.

But that said, we need guest kernel events like mmap and context switches too, otherwise we simply can't make sense of guest userspace addresses, we need to know the guest address space layout.

So aside from a filesystem content, we first need mmap and context switch events to find the files we need to access.

And while I appreciate all the security talk, its basically pointless anyway, the host can access it anyway, everybody agrees on that, but still you're arguing the case..

#247 lore raw

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

In reply to Joerg Roedel
Quoted 11 lines · Joerg Roedel
Quoted 9 lines
Quoted 7 lines

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).

Quoted 6 lines

With /proc/<pid>/kvm/guest we could symlink all guest
directories to /proc/kvm/ and perf reads the list from there. Also perf can easily derive the directory for a guest from its pid. Last but not least its kernel-created and thus independent from the userspace part being used.

Doesn't perf already has a dependency on naming conventions for finding debug information?

Signature · 1 line
error compiling committee.c: too many arguments to function
#268 lore raw

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

In reply to Peter Zijlstra
Quoted 8 lines · Peter Zijlstra
Quoted 5 lines · Joerg Roedel

What I meant was: perf-kernel puts the guest-name into every sample and perf-userspace accesses /sys/kvm/guest_name/fs/ later to resolve the symbols. I leave the question of how the guest-fs is exposed to the host out of this discussion. We should discuss this seperatly.

Quoted 6 lines

I'd much prefer a pid like suggested later, keeps the samples smaller.

But that said, we need guest kernel events like mmap and context switches too, otherwise we simply can't make sense of guest userspace addresses, we need to know the guest address space layout.

The kernel knows some of the address space layout, qemu knows all of it.

Quoted 3 lines

So aside from a filesystem content, we first need mmap and context switch events to find the files we need to access.

This only works for the guest kernel, we don't know anything about guest processes [1].

Quoted 4 lines

And while I appreciate all the security talk, its basically pointless anyway, the host can access it anyway, everybody agrees on that, but still you're arguing the case..

root can access anything, but we're not talking about root. The idea is to protect against a guest that has exploited its qemu and is now attacking the host and its fellow guests. uid protection is no good since we want to isolate the guest from host processes belonging to the same uid and from other guests running under the same uid.

[1] We can find out guest pids if we teach the kernel what to dereference, i.e. gs:offset1->offset2->offset3. Of course this varies from kernel to kernel, so we need some kind of bytecode that we can run in perf nmi context. Kind of what we need to run an unwinder for -fomit-frame-pointer.

Signature · 1 line
error compiling committee.c: too many arguments to function
#261 lore raw

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

In reply to Avi Kivity
Quoted 9 lines · Avi Kivity
Quoted 2 lines · Joerg Roedel

If we go the /proc/<pid>/kvm way then the directory should probably inherit the label from /proc/<pid>/?

That's a security policy. The security people like their policies outside the kernel.

For example, they may want a label that allows a trace context to read the data, and also qemu itself for introspection.

Hm, I am not a security expert. But is this not only one entity more for sVirt to handle? I would leave that decision to the sVirt developers. Does attaching the same label as for the VM resources mean that root could not access it anymore?

Joerg

#262 lore raw

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

Quoted 7 lines · Joerg Roedel
Quoted 5 lines · Avi Kivity
Quoted 3 lines · Joerg Roedel

If we go the /proc/<pid>/kvm way then the directory should probably inherit the label from /proc/<pid>/?

Quoted 7 lines
Quoted 6 lines

That's a security policy. The security people like their policies outside the kernel.

For example, they may want a label that allows a trace context to read the data, and also qemu itself for introspection.

Hm, I am not a security expert.

I'm out of my depth here as well.

Quoted 5 lines

But is this not only one entity more for
sVirt to handle? I would leave that decision to the sVirt developers. Does attaching the same label as for the VM resources mean that root could not access it anymore?

IIUC processes run under a context, and there's a policy somewhere that tells you which context can access which label (and with what permissions). There was a server on the Internet once that gave you root access and invited you to attack it. No idea if anyone succeeded or not (I got bored after about a minute).

So it depends on the policy. If you attach the same label, that means all files with the same label have the same access permissions. I think.

Signature · 1 line
error compiling committee.c: too many arguments to function
#269 lore raw

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

In reply to Peter Zijlstra
Quoted 7 lines · Peter Zijlstra
Quoted 4 lines · Joerg Roedel

What I meant was: perf-kernel puts the guest-name into every sample and perf-userspace accesses /sys/kvm/guest_name/fs/ later to resolve the symbols. I leave the question of how the guest-fs is exposed to the host out of this discussion. We should discuss this seperatly.

Quoted 5 lines

I'd much prefer a pid like suggested later, keeps the samples smaller.

But that said, we need guest kernel events like mmap and context switches too, otherwise we simply can't make sense of guest userspace addresses, we need to know the guest address space layout.

With the filesystem approach all we need is the pid of the guest process. Then we can access proc/<pid>/maps of the guest and read out the address space layout, no?

Joerg

#263 lore raw

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

In reply to Avi Kivity
Quoted 7 lines · Avi Kivity
Quoted 5 lines · Joerg Roedel

But is this not only one entity more for
sVirt to handle? I would leave that decision to the sVirt developers. Does attaching the same label as for the VM resources mean that root could not access it anymore?

Quoted 8 lines

IIUC processes run under a context, and there's a policy somewhere that tells you which context can access which label (and with what permissions). There was a server on the Internet once that gave you root access and invited you to attack it. No idea if anyone succeeded or not (I got bored after about a minute).

So it depends on the policy. If you attach the same label, that means all files with the same label have the same access permissions. I think.

So if this is true we can introduce a 'trace' label and add all contexts that should be allowed to trace to it.
But we probably should leave the details to the security experts ;-)

Joerg

#264 lore raw

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

Quoted 16 lines · Joerg Roedel
Quoted 14 lines · Avi Kivity
Quoted 6 lines · Joerg Roedel

But is this not only one entity more for
sVirt to handle? I would leave that decision to the sVirt developers. Does attaching the same label as for the VM resources mean that root could not access it anymore?

IIUC processes run under a context, and there's a policy somewhere that tells you which context can access which label (and with what permissions). There was a server on the Internet once that gave you root access and invited you to attack it. No idea if anyone succeeded or not (I got bored after about a minute).

Quoted 7 lines
Quoted 3 lines

So it depends on the policy. If you attach the same label, that means all files with the same label have the same access permissions. I think.

So if this is true we can introduce a 'trace' label and add all contexts that should be allowed to trace to it.
But we probably should leave the details to the security experts ;-)

That's just what I want to do. Leave it in userspace and then they can deal with it without telling us about it.

Signature · 1 line
error compiling committee.c: too many arguments to function
#248 lore raw

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

In reply to Avi Kivity
Quoted 8 lines · Avi Kivity
Quoted 7 lines · Joerg Roedel
Quoted 7 lines
Quoted 7 lines

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).

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

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

#265 lore raw

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

In reply to Avi Kivity
Quoted 4 lines · Avi Kivity

On 03/24/2010 06:31 PM, Joerg Roedel wrote:

That's just what I want to do. Leave it in userspace and then they can deal with it without telling us about it.

They can't do that with a directory in /proc?

maintainer
#270 lore raw

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

In reply to Joerg Roedel
Quoted 10 lines · Joerg Roedel
Quoted 9 lines · Peter Zijlstra
Quoted 4 lines · Joerg Roedel

What I meant was: perf-kernel puts the guest-name into every sample and perf-userspace accesses /sys/kvm/guest_name/fs/ later to resolve the symbols. I leave the question of how the guest-fs is exposed to the host out of this discussion. We should discuss this seperatly.

I'd much prefer a pid like suggested later, keeps the samples smaller.

Quoted 7 lines
Quoted 3 lines

But that said, we need guest kernel events like mmap and context switches too, otherwise we simply can't make sense of guest userspace addresses, we need to know the guest address space layout.

With the filesystem approach all we need is the pid of the guest process. Then we can access proc/<pid>/maps of the guest and read out the address space layout, no?

No, what if it maps new things after you read it? But still getting the pid of the guest process seems non trivial without guest kernel support.

#249 lore raw

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

In reply to Joerg Roedel
Quoted 10 lines · Joerg Roedel
Quoted 3 lines

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

Quoted 6 lines

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.

It's true. If the kernel provides something, there are fewer things that can break. But if your system is so broken that you can't resolve uids, fix that before running perf. Must we design perf for that case?

After all, 'ls -l' will break under the same circumstances. It's hard to imagine doing useful work when that doesn't work.

Quoted 3 lines

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).

It has other issues, which are IMO more problematic.

Signature · 1 line
error compiling committee.c: too many arguments to function
#266 lore raw

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

In reply to Joerg Roedel
Quoted 7 lines · Joerg Roedel
Quoted 4 lines

That's just what I want to do. Leave it in userspace and then they can deal with it without telling us about it.

They can't do that with a directory in /proc?

I don't know.

Signature · 1 line
error compiling committee.c: too many arguments to function
#250 lore raw

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

In reply to Avi Kivity
Quoted 4 lines · Avi Kivity

It's true. If the kernel provides something, there are fewer things that can break. But if your system is so broken that you can't resolve uids, fix that before running perf. Must we design perf for that case?

After all, 'ls -l' will break under the same circumstances. It's hard to imagine doing useful work when that doesn't work.

Also, perf itself will hang if it needs to access a file using autofs or nfs, and those are broken.

Signature · 1 line
error compiling committee.c: too many arguments to function
#252 lore raw

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

In reply to Avi Kivity

Em Wed, Mar 24, 2010 at 06:09:30PM +0200, Avi Kivity escreveu:

Quoted 2 lines

Doesn't perf already has a dependency on naming conventions for finding debug information?

It looks at several places, from most symbol rich (/usr/lib/debug/, aka -debuginfo packages, where we have full symtabs) to poorest (the packaged binary, where we may just have a .dynsym).

In an ideal world, it would just get the build-id (a SHA1 cookie that is in an ELF session inserted in every binary (aka DSOs), kernel module, kallsyms or vmlinux file) and use that to look first in a local cache (implemented in perf for a long time already) or in some symbol server.

For instance, for a random perf.data file I collected here in my machine I have:

[acme@doppio linux-2.6-tip]$ perf buildid-list | grep libpthread 5c68f7afeb33309c78037e374b0deee84dd441f6 /lib64/libpthread-2.10.2.so [acme@doppio linux-2.6-tip]$

So I don't have to access /lib64/libpthread-2.10.2.so directly, nor some convention to get a debuginfo in a local file like:

/usr/lib/debug/lib64/libpthread-2.10.2.so.debug

Instead the tools look at:

[acme@doppio linux-2.6-tip]$ l ~/.debug/.build-id/5c/68f7afeb33309c78037e374b0deee84dd441f6
lrwxrwxrwx 1 acme acme 73 2010-01-06 18:53 /home/acme/.debug/.build-id/5c/68f7afeb33309c78037e374b0deee84dd441f6 -> ../../lib64/libpthread-2.10.2.so/5c68f7afeb33309c78037e374b0deee84dd441f6*

To find the file for that specific build-id, not the one installed in my machine (or on the different machine, of a different architecture) that may be completely unrelated, a new one, or one for a different arch.

- Arnaldo

#253 lore raw

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

Quoted 26 lines · Arnaldo Carvalho de Melo

Em Wed, Mar 24, 2010 at 06:09:30PM +0200, Avi Kivity escreveu:

Quoted 3 lines

Doesn't perf already has a dependency on naming conventions for finding debug information?

It looks at several places, from most symbol rich (/usr/lib/debug/, aka -debuginfo packages, where we have full symtabs) to poorest (the packaged binary, where we may just have a .dynsym).

In an ideal world, it would just get the build-id (a SHA1 cookie that is in an ELF session inserted in every binary (aka DSOs), kernel module, kallsyms or vmlinux file) and use that to look first in a local cache (implemented in perf for a long time already) or in some symbol server.

For instance, for a random perf.data file I collected here in my machine I have:

[acme@doppio linux-2.6-tip]$ perf buildid-list | grep libpthread 5c68f7afeb33309c78037e374b0deee84dd441f6 /lib64/libpthread-2.10.2.so [acme@doppio linux-2.6-tip]$

So I don't have to access /lib64/libpthread-2.10.2.so directly, nor some convention to get a debuginfo in a local file like:

/usr/lib/debug/lib64/libpthread-2.10.2.so.debug

Quoted 9 lines

Instead the tools look at:

[acme@doppio linux-2.6-tip]$ l ~/.debug/.build-id/5c/68f7afeb33309c78037e374b0deee84dd441f6
lrwxrwxrwx 1 acme acme 73 2010-01-06 18:53 /home/acme/.debug/.build-id/5c/68f7afeb33309c78037e374b0deee84dd441f6 -> ../../lib64/libpthread-2.10.2.so/5c68f7afeb33309c78037e374b0deee84dd441f6*

To find the file for that specific build-id, not the one installed in my machine (or on the different machine, of a different architecture) that may be completely unrelated, a new one, or one for a different arch.

Thanks. I believe qemu could easily act as a symbol server for this use case.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#254 lore raw

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

Em Wed, Mar 24, 2010 at 08:20:10PM +0200, Avi Kivity escreveu:

Quoted 32 lines · Arnaldo Carvalho de Melo
Quoted 31 lines

Em Wed, Mar 24, 2010 at 06:09:30PM +0200, Avi Kivity escreveu:

Quoted 3 lines

Doesn't perf already has a dependency on naming conventions for finding debug information?

It looks at several places, from most symbol rich (/usr/lib/debug/, aka -debuginfo packages, where we have full symtabs) to poorest (the packaged binary, where we may just have a .dynsym).

In an ideal world, it would just get the build-id (a SHA1 cookie that is in an ELF session inserted in every binary (aka DSOs), kernel module, kallsyms or vmlinux file) and use that to look first in a local cache (implemented in perf for a long time already) or in some symbol server.

For instance, for a random perf.data file I collected here in my machine I have:

[acme@doppio linux-2.6-tip]$ perf buildid-list | grep libpthread 5c68f7afeb33309c78037e374b0deee84dd441f6 /lib64/libpthread-2.10.2.so [acme@doppio linux-2.6-tip]$

So I don't have to access /lib64/libpthread-2.10.2.so directly, nor some convention to get a debuginfo in a local file like:

/usr/lib/debug/lib64/libpthread-2.10.2.so.debug

Instead the tools look at:

[acme@doppio linux-2.6-tip]$ l ~/.debug/.build-id/5c/68f7afeb33309c78037e374b0deee84dd441f6
lrwxrwxrwx 1 acme acme 73 2010-01-06 18:53 /home/acme/.debug/.build-id/5c/68f7afeb33309c78037e374b0deee84dd441f6 -> ../../lib64/libpthread-2.10.2.so/5c68f7afeb33309c78037e374b0deee84dd441f6*

Quoted 6 lines
Quoted 3 lines

To find the file for that specific build-id, not the one installed in my machine (or on the different machine, of a different architecture) that may be completely unrelated, a new one, or one for a different arch.

Thanks. I believe qemu could easily act as a symbol server for this use case.

Agreed, but it doesn't even have to :-)

We just need to get the build-id in the PERF_RECORD_MMAP event somehow and then get this symbol from elsewhere, say the same DVD/RHN channel/Debian Repository/embedded developer toolkit image not stripped/whatever.

Or it may already be in the local cache from last week's perf report session :-)

- Arnaldo

#255 lore raw

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

In reply to Avi Kivity
Quoted 32 lines · Avi Kivity
Quoted 31 lines · Arnaldo Carvalho de Melo

Em Wed, Mar 24, 2010 at 06:09:30PM +0200, Avi Kivity escreveu:

Quoted 3 lines

Doesn't perf already has a dependency on naming conventions for finding debug information?

It looks at several places, from most symbol rich (/usr/lib/debug/, aka -debuginfo packages, where we have full symtabs) to poorest (the packaged binary, where we may just have a .dynsym).

In an ideal world, it would just get the build-id (a SHA1 cookie that is in an ELF session inserted in every binary (aka DSOs), kernel module, kallsyms or vmlinux file) and use that to look first in a local cache (implemented in perf for a long time already) or in some symbol server.

For instance, for a random perf.data file I collected here in my machine I have:

[acme@doppio linux-2.6-tip]$ perf buildid-list | grep libpthread 5c68f7afeb33309c78037e374b0deee84dd441f6 /lib64/libpthread-2.10.2.so [acme@doppio linux-2.6-tip]$

So I don't have to access /lib64/libpthread-2.10.2.so directly, nor some convention to get a debuginfo in a local file like:

/usr/lib/debug/lib64/libpthread-2.10.2.so.debug

Instead the tools look at:

[acme@doppio linux-2.6-tip]$ l ~/.debug/.build-id/5c/68f7afeb33309c78037e374b0deee84dd441f6
lrwxrwxrwx 1 acme acme 73 2010-01-06 18:53 /home/acme/.debug/.build-id/5c/68f7afeb33309c78037e374b0deee84dd441f6 -> ../../lib64/libpthread-2.10.2.so/5c68f7afeb33309c78037e374b0deee84dd441f6*

Quoted 7 lines
Quoted 4 lines

To find the file for that specific build-id, not the one installed in my machine (or on the different machine, of a different architecture) that may be completely unrelated, a new one, or one for a different arch.

Thanks. I believe qemu could easily act as a symbol server for this use case.

I spent a couple of days to investigate why sshfs/fuse doesn't work well with procfs and sysfs. Just after my patch against fuse is ready almost, I found fuse already supports such access by direct I/O. With parameter -o direct_io, it could work well.

Here is an example to mount / from a guest os. #sshfs -p 5551 -o direct_io localhost:/ guestmount

We can read files and write files if permission is ok.

I will go ahead to support multiple guest os instance statistics parsing.

Yanmin

#251 lore raw

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

In reply to Avi Kivity
Quoted 18 lines · Avi Kivity
Quoted 10 lines · Joerg Roedel
Quoted 3 lines

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

Quoted 6 lines

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.

Quoted 3 lines

It's true. If the kernel provides something, there are fewer things that can break. But if your system is so broken that you can't resolve uids, fix that before running perf. Must we design perf for that case?

uid to username can fail when using chroots, or worse point to an incorrect location (and yes, I do use this)

Sorry if this has been covered / discussion has moved on. Just catching up with the 500+ messages in my inbox..

Antoine

Quoted 10 lines

After all, 'ls -l' will break under the same circumstances. It's hard to imagine doing useful work when that doesn't work.

Quoted 3 lines

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).

It has other issues, which are IMO more problematic.