IP Library › Granted Patent US 9,063,762
Granted Patent B2
US 9,063,762 · App. 13/593,187 · Granted Jun 23, 2015

Methods, apparatus, and articles of manufacture to virtualize performance counters

Inventors: Benjamin C. Serebrin (Sunnyvale, CA); Daniel M. Hecht (San Francisco, CA)
Assignee: VMware, Inc.
G06F9/455G06F9/45533G06F9/45558G06F2009/45591G06F11/3466G06F2201/815G06F2201/86G06F2201/88
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 9,063,762
App. No.
13/593,187
Granted
Jun 23, 2015
Kind
B2
Abstract

Methods, apparatus, and articles of manufacture to virtualize performance counters are disclosed. An example method includes scheduling a virtual machine on a processor, incrementing a virtual performance counter in response to an occurrence of a speculative event during direct execution of guest instructions by the virtual machine on the processor, and incrementing the virtual performance counter in response to an occurrence of the speculative event during execution of emulated instructions by a hypervisor on behalf of the virtual machine on the processor.

Claims (55)

1. A method, comprising:

scheduling a virtual machine on a processor;

incrementing a first virtual performance counter in response to an occurrence of a speculative event during direct execution of first guest instructions by the virtual machine on the processor;

incrementing a second virtual performance counter in response to an occurrence of a non-speculative event during direct execution of the first guest instructions by the virtual machine on the processor;

executing emulated instructions on behalf of the virtual machine on the processor using a hypervisor, the second virtual performance counter not being incremented in response to an occurrence of the non-speculative event during the execution of the emulated instructions; and

incrementing the first virtual performance counter in response to an occurrence of the speculative event during the execution of the emulated instructions by the hypervisor.

2. A method as defined in claim 1 , further comprising returning a value of the first virtual performance counter in response to a second guest instruction.

3. A method as defined in claim 1 , further comprising de-scheduling the virtual machine and halting the first virtual performance counter when the virtual machine is de-scheduled.

4. A method as defined in claim 3 , further comprising storing a first value of the virtual performance counter when the virtual machine is de-scheduled and restoring the value of the first virtual performance counter when the virtual machine is subsequently scheduled.

5. A method as defined in claim 1 , further comprising

suspending the second virtual performance counter when direct execution of guest instructions ends.

6. A method as defined in claim 5 , further comprising

enabling the second virtual performance counter when emulation of the guest instructions has finished and guest instructions are subsequently directly executed by the virtual machine.

7. A method as defined in claim 1 , wherein the non-speculative event comprises at least one of a retired instruction or a branched instruction.

8. A method as defined in claim 1 , wherein the speculative event comprises at least one of a cache miss, a cache hit, a translation lookaside buffer miss, a translation lookaside buffer hit, or an unhalted reference cycle.

9. A method as defined in claim 1 , further comprising:

receiving a second virtual machine including a value corresponding to a third virtual performance counter;

scheduling the second virtual machine on the processor; and

restoring the value into the third virtual performance counter.

10. A method as defined in claim 9 , wherein the third virtual performance counter corresponds to a second speculative event different from the first speculative event.

11. An apparatus, comprising:

a processor; and

a hypervisor to:

schedule a virtual machine to execute guest instructions on the processor;

increment a first virtual performance counter in response to an occurrence of a speculative event during direct execution of guest instructions by the virtual machine on the processor;

increment a second virtual performance counter in response to an occurrence of a non-speculative event during the direct execution of the guest instructions;

execute second instructions to emulate a second guest instruction on behalf of the virtual machine; and

increment the first virtual performance counter in response to an occurrence of the speculative event during execution of the second instructions, the hypervisor to not increment the second virtual performance counter in response to an occurrence of the non-speculative event during the execution of the second instructions.

12. An apparatus as defined in claim 11 , wherein the non-speculative event comprises at least one of a retired instruction or a branched instruction.

13. An apparatus as defined in claim 11 , wherein the hypervisor is to enable the second virtual performance counter when emulation of the second guest instruction has finished and third guest instructions are subsequently directly executed by the virtual machine.

14. An apparatus as defined in claim 11 , wherein the speculative event comprises at least one of a cache miss, a cache hit, a translation lookaside buffer miss, a translation lookaside buffer hit, or an unhalted reference cycle.

15. An apparatus as defined in claim 11 , wherein the hypervisor comprises a device emulator to emulate a physical hardware counter to provide the first virtual performance counter.

16. An apparatus as defined in claim 11 , wherein the hypervisor comprises:

a harmonization layer to convert a third virtual performance counter to count speculative or non-speculative events; and

a scheduler to restore a value of the third virtual performance counter in response to the virtual machine being scheduled on the processor.

17. A tangible computer readable storage medium comprising computer readable instructions which, when executed, cause a computer to at least:

increment a first virtual performance counter in response to a speculative event during direct execution of guest instructions by a virtual machine on a processor; and

increment a second virtual performance counter in response to a non-speculative event during direct execution of the guest instructions by the virtual machine on the processor;

execute emulated instructions on behalf of the virtual machine using the hypervisor, the second virtual performance counter not being incremented in response to the non-speculative event during execution of the emulated instructions; and

increment the first virtual performance counter in response to the speculative event during the execution of the emulated instructions by the hypervisor.

18. A medium as defined in claim 17 , wherein the instructions further cause the computer to return a value of the first virtual performance counter in response to a second guest instruction.

19. A medium as defined in claim 17 , wherein the instructions further cause the computer to de-schedule the virtual machine and halt the first virtual performance counter when the virtual machine is de-scheduled.

20. A medium as defined in claim 19 , wherein the instructions further cause the computer to:

store a value of the first virtual performance counter when the virtual machine is de-scheduled; and

restore the value of the first virtual performance counter when the virtual machine is subsequently scheduled.

21. A medium as defined in claim 17 , wherein the instructions further cause the computer to

suspend the second virtual performance counter when direct execution of guest instructions ends.

22. A medium as defined in claim 21 , wherein the instructions further cause the computer to

enable the second virtual performance counter when emulation of the guest instructions has finished and guest instructions are subsequently directly executed by the virtual machine.

23. A medium as defined in claim 17 , wherein the non-speculative event comprises at least one of a retired instruction or a branched instruction.

24. A medium as defined in claim 17 , wherein the speculative event comprises at least one of a cache miss, a cache hit, a translation lookaside buffer miss, a translation lookaside buffer hit, or an unhalted reference cycle.

25. A medium as defined in claim 17 , wherein the instructions further cause the computer to:

schedule a second virtual machine including a value corresponding to a third virtual performance counter on a processor; and

restore the value into the third virtual performance counter.

26. A medium as defined in claim 25 , wherein the third virtual performance counter corresponds to a second speculative event different from the first speculative event.

Assignments (3)
CHANGE OF NAME Recorded Apr 15, 2024
From: VMWARE, INC.
To: VMWARE LLC
Reel/Frame 067102/0395 →
CORRECTIVE ASSIGNMENT TO CORRECT THE ASSIGNEE NAME PREVIOUSLY RECORDED AT REEL: 029174 FRAME: 0298. ASSIGNOR(S) HEREBY CONFIRMS THE ASSIGNMENT . Recorded Jan 16, 2023
From: SEREBRIN, BENJAMIN C.; HECHT, DANIEL M.
To: VMWARE, INC.
Reel/Frame 062389/0831 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 23, 2012
From: SEREBRIN, BENJAMIN C.; HECHT, DANIEL M.
To: VMWARE, INC. A DELAWARE CORPORATION
Reel/Frame 029174/0298 →
Continuity (2)
Provisional Application 61527728 · Aug 26, 2011
Related Publication 20130219389A1 · Aug 22, 2013