Always save/restore performance counters when HVM guest switching VCPU
Quoted 13 lines · ----- [email protected] wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
On 04.03.13 at 13:42, George Dunlap <[email protected]>
Quoted 1 line · wrote:
On Fri, Mar 1, 2013 at 8:49 PM, <[email protected]>
Quoted 9 lines · wrote:
Quoted 8 lines
From: Suravee Suthikulpanit <[email protected]>
Currently, the performance counter registers are saved/restores when the HVM guest switchs VCPUs only if they are running. However, PERF has one check where it writes the MSR and read back the value to check if the MSR is working. This has shown to fails the check if the VCPU is moved in between rdmsr and wrmsr and resulting in the values are different.
Quoted 6 lines
Quoted 1 line
Many moons ago (circa 2005) when I used performance counters, I
found
Quoted 4 lines
that adding them to the save/restore path added a non-neligible overhead -- something like 5% slow-down. Do you have any reason to believe this is no longer the case? Have you done any benchmarks before and after?
I was doing some VPMU tracing a couple of weeks ago and by looking at trace timestamps I think I saw about 4000 cycles on VPMU save and ~9000 cycles on restore. Don't remember what it was percentage-wise of a whole context switch.
This was on Intel.
-boris
Quoted 19 lines
Quoted 3 lines
If there is a performance slow-down, you may have to implement something like the "lazy FPU" save/restore, where you remove access
to
Quoted 1 line
the VPMU MSRs to detect that the guest is accessing them.
Suravee,
without addressing George's concerns, I don't think you can expect the patch to be committed (the more that Boris, along with his ack, also asked to adjust the description).
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 20 lines · Boris Ostrovsky
Quoted 6 lines · ----- [email protected] wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
On 04.03.13 at 13:42, George Dunlap <[email protected]>
Quoted 1 line · wrote:
On Fri, Mar 1, 2013 at 8:49 PM, <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
From: Suravee Suthikulpanit <[email protected]>
Quoted 12 lines
Quoted 7 lines
Quoted 6 lines
Currently, the performance counter registers are saved/restores when the HVM guest switchs VCPUs only if they are running. However, PERF has one check where it writes the MSR and read back the value to check if the MSR is working. This has shown to fails the check if the VCPU is moved in between rdmsr and wrmsr and resulting in the values are different.
Many moons ago (circa 2005) when I used performance counters, I
found
Quoted 4 lines
that adding them to the save/restore path added a non-neligible overhead -- something like 5% slow-down. Do you have any reason to believe this is no longer the case? Have you done any benchmarks before and after?
Quoted 6 lines
I was doing some VPMU tracing a couple of weeks ago and by looking at trace timestamps I think I saw about 4000 cycles on VPMU save and ~9000 cycles on restore. Don't remember what it was percentage-wise of a whole context switch.
This was on Intel.
That's a really hefty expense to make all users pay on every context switch, on behalf of a random check in a piece of software that only a handful of people are going to be actually using.
I'm having a hard time telling what PERF is being talked about here -- couldn't this check be fixed on their side, by perhaps checking the CPUID leaf for the existence of Xen?
If not I think a "lazy vpmu activation" is going to be the only option.
-George
Quoted 33 lines
Quoted 1 line
Quoted 1 line · George Dunlap
Quoted 20 lines · Boris Ostrovsky
Quoted 6 lines · ----- [email protected] wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
On 04.03.13 at 13:42, George Dunlap <[email protected]>
Quoted 1 line · wrote:
On Fri, Mar 1, 2013 at 8:49 PM, <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
From: Suravee Suthikulpanit <[email protected]>
Quoted 12 lines
Quoted 7 lines
Quoted 6 lines
Currently, the performance counter registers are saved/restores when the HVM guest switchs VCPUs only if they are running. However, PERF has one check where it writes the MSR and read back the value to check if the MSR is working. This has shown to fails the check if the VCPU is moved in between rdmsr and wrmsr and resulting in the values are different.
Many moons ago (circa 2005) when I used performance counters, I
found
Quoted 4 lines
that adding them to the save/restore path added a non-neligible overhead -- something like 5% slow-down. Do you have any reason to believe this is no longer the case? Have you done any benchmarks before and after?
Quoted 6 lines
I was doing some VPMU tracing a couple of weeks ago and by looking at trace timestamps I think I saw about 4000 cycles on VPMU save and ~9000 cycles on restore. Don't remember what it was percentage-wise of a whole context switch.
This was on Intel.
That's a really hefty expense to make all users pay on every context switch, on behalf of a random check in a piece of software that only a handful of people are going to be actually using.
Quoted 5 lines
I'm having a hard time telling what PERF is being talked about here -- couldn't this check be fixed on their side, by perhaps checking the CPUID leaf for the existence of Xen?
If not I think a "lazy vpmu activation" is going to be the only option.
Fully agree.
Jan