# US 2013/0160012 A1 · Timer access from user mode through a shared memory page

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2013/0160012 A1
- Document ID: US20130160012A1
- Status: Published application
- Kind: A1
- Application number: 13/770,941
- Filed: 2013-02-19
- Published: 2013-06-20
- Earliest claimed: 2009-03-30
- Assignees: Microsoft Corporation
- Inventors: Shuvabrata Ganguly; Jason S. Wohlgemuth; Allen Marshall
- Web page: https://patentgrep.com/patent/US20130160012A1

## CPC

- G06F 9/45533: {Hypervisors; Virtual machine monitors}
- G06F 9/45558: {Hypervisor-specific management and integration aspects}
- G06F 2009/45583: {Memory management, e.g. access or allocation}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A computing system in which a software component executing on a platform can reliably and efficiently obtain state information about a component supported by the platform through the use of a shared memory page. State information may be supplied by the platform, but any state translation information needed to map the state information as supplied to a format as used may be provided through the shared page. In a virtualized environment, the state translation information can be used to map the value of a virtual timer counter or other component from a value provided by a virtual processor to a normalized reference time that will yield the same result, regardless of whether the software component is migrated to or from another virtual processor. Use of a shared page avoids the inefficiency of an intercept into a virtualized environment or a system calls in native mode operation.

## Claims

### Claim 1

A method performed on a computing device comprising a processor and storage coupled with the processor, the method comprising:
executing a hypervisor that manages execution of virtual machines on the computing device, the virtual machines including a virtual machine comprising an operating system and a user-mode application running within the operating system, the virtual machine further comprising a virtual processor;
providing a shared memory that is shared by both the hypervisor and the virtual machine, the shared memory comprising a timestamp counter (TSC) location to store TSC information; and
populating, by the hypervisor, the TSC location with time translation information computed by the hypervisor, the time translation information thereby becoming accessible by the operating system, or by an application executing therein, or by both the operating system and the application.

### Claim 2 (depends on 1)

A method according to claim 1, further comprising restoring the virtual machine from a suspended state by the hypervisor, and as part of the restoring: evaluating timer information in the TSC location that was stored in the TSC location when the virtual machine was suspended, and based on the evaluating computing time translation information.

### Claim 3 (depends on 2)

A method according to claim 2, wherein the evaluating is performed using the timer information and a time value from a physical TSC of the processor.

### Claim 4 (depends on 2)

A method according to claim 2, further comprising setting a TSC offset of a virtual TSC managed by the hypervisor and used by the virtual machine, the virtual TSC comprising an element of a virtual processor of the virtual machine.

### Claim 5 (depends on 1)

A method according to claim 1, wherein the time translation information comprises scale information obtained according to a frequency of a physical TSC of the processor.

### Claim 6 (depends on 5)

A method according to claim 5, wherein the virtual processor comprises a virtual TSC, the method further comprising:
reading, by the operating system or the user-mode application, the scale information from the TSC location;
obtaining a time value from the virtual TSC; and
computing a reference time according to the scale information and the time value.

### Claim 7

One or more computer-readable storage media, the storage media not comprising a signal, the storage media storing information to enable a computing device, comprising a processor and storage, to perform a process, the process comprising:
executing a hypervisor that manages execution of a virtual machine on the computer, the virtual machine hosting an operating system and an application executable by the operating system;
providing a shared memory that is shared between by both the hypervisor and the virtual machine such that both the hypervisor and the operating system or the application can directly access the shared memory, the shared memory storing time information about a time stamp counter (TSC) on a computer that previously hosted the virtual machine; and
computing a reference time by the operating system or the application accessing the time information in the shared memory.

### Claim 8 (depends on 7)

One or more computer-readable storage media according to claim 7, wherein the shared memory is used by the hypervisor to determine whether the virtual machine has been migrated.

### Claim 9 (depends on 7)

One or more computer-readable storage media according to claim 7, wherein the shared memory is used by the operating system or the user-mode application to determine whether to compute a reference time by either issuing a call that will result in an interrupt to the hypervisor or by obtaining a time value from a virtual TSC.

### Claim 10 (depends on 7)

One or more computer-readable storage media according to claim 7, wherein the application or the operating system has a reference time computing process to compute a reference time, wherein the reference time computing process determines whether to attempt to access a virtual TSC based the shared memory.

### Claim 11 (depends on 10)

One or more computer-readable storage media according to claim 10, wherein the reference time computing process updates the shared memory after the virtual machine has been restored.

### Claim 12 (depends on 7)

One or more computer-readable storage media according to claim 7, wherein the virtual machine originated from another computing device and the hypervisor updates the shared memory when restoring the virtual machine.

### Claim 13 (depends on 7)

One or more computer-readable storage media according to claim 7, the process further comprising determining whether the computing device comprises a physical TSC and storing an indication of the determination in the shared memory.

### Claim 14 (depends on 13)

One or more computer-readable storage media according to claim 13, wherein the indication comprises a flag that controls whether the application or operating system will attempt to use a virtual TSC.

### Claim 15

A computer comprising storage coupled with a processor, the storage including memory, the computer further comprising:
a hypervisor stored on the storage and executed by the processor, the hypervisor managing a virtual machine, the virtual machine comprising a virtual processor implemented by the hypervisor, the virtual machine hosting a software component executing in the virtual machine;
a shared memory portion of the memory, wherein the shared memory is accessible by the hypervisor and the operating system; and
the hypervisor, storing TSC information in the shared memory for availability to the software component.

### Claim 16 (depends on 15)

A computer according to claim 15, wherein, when resuming the virtual machine from a suspended state, the hypervisor populates the shared memory with the TSC information.

### Claim 17 (depends on 15)

A computer according to claim 15, wherein the software component determines whether to attempt to access a virtual TSC.

### Claim 18 (depends on 15)

A computer according to claim 15, wherein the shared memory is updated with new TSC information responsive to resuming the virtual machine on another computer.

### Claim 19 (depends on 15)

A computer according to claim 15, the computer not comprising a physical TSC, and the hypervisor determines that a physical TSC is not available and updates the shared memory accordingly.

### Claim 20 (depends on 19)

A computer according to claim 19, wherein the software component determines to issue a timer call that will interrupt the hypervisor based on the updated shared memory.
