Re: KVM PMU virtualization

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

 



Jes Sorensen wrote:
> Hi,
> 
> It looks like several of us have been looking at how to use the PMU
> for virtualization. Rather than continuing to have discussions in
> smaller groups, I think it is a good idea we move it to the mailing
> lists to see what we can share and avoid duplicate efforts.
> 
> There are really two separate things to handle:
> 
> 1) Add support to perf to allow it to monitor a KVM guest from the
>    host.
> 
> 2) Allow guests access to the PMU (or an emulated PMU), making it
>    possible to run perf on applications running within the guest.
> 
> I know some of you have been looking at 1) and I am currently working
> on 2). I have been looking at various approaches, including whether it
> is feasible to share the PMU between the host and multiple guests. For
> now I am going to focus on allowing one guest to take control of the
> PMU, then later hopefully adding support for multiplexing it between
> multiple guests.

Given that perf can apply the PMU to individual host tasks, I don't see
fundamental problems multiplexing it between individual guests (which
can then internally multiplex it again).

Then the next challenge might be how to handle the case of both host and
guest trying to use PMU resources at the same time. For the sparse debug
registers resources I simply disable the effect of guest injected
breakpoints once the host wants to use them. The guest still sees its
programmed values, though. One could try to schedule free registers
between both, but given how rare such use cases are, I decided to go for
a simple approach. Probably the situation is not that different for the PMU.

> 
> Eventually we will see proper hardware PMU virtualization from Intel and
> AMD (admittedly I have only looked at the Intel specs so far), and by
> then be able to allow the host as well as the guests to share the PMU.
> 
> If anybody else is working on this, I'd love to hear about it so we can
> coordinate our efforts. The main purpose with this mail was really to
> being the discussion to the mailing list to avoid duplicated efforts.

I thought I've seen quite some code for PMU virtualization in Xen's HVM
code. Might be worth studying what they do already and adopt/extend it
for KVM.

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux