IP Library Granted Patent US 12,032,989
Granted Patent B2
US 12,032,989 · App. 17/698,402 · Granted Jul 9, 2024

Timer processing method, apparatus, electronic device and computer storage medium

Inventors: Yun Xu (Hangzhou, CN); Yibin Shen (Hangzhou, CN); Xiantao Zhang (Hangzhou, CN)
Assignee: Alibaba Group Holding Limited
G06F9/4825G06F9/45558G06F2009/45575
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 12,032,989
App. No.
17/698,402
Granted
Jul 9, 2024
Kind
B2
Abstract

Timer processing method, apparatus, electronic device and computer storage medium are provided. The timer processing method includes: determining to perform timer switching on a virtual local timer used by a virtual processor according to preset timer switching condition(s); determining a physical processor that runs the virtual processor, and switching a physical local timer currently used by the physical processor to a physical global timer; and performing a timer configuration for the virtual processor to enable the physical local timer to act as a timer of the virtual processor. Through the embodiments of the present disclosure, additional overheads of a virtual machine system caused by operations of conversion of virtual timer and physical timer are avoided.

Claims (53)

1. A method implemented by a computing device, the method comprising:

determining to perform timer switching on a virtual local timer used by a virtual processor according to one or more preset timer switching conditions;

determining a physical processor of the computing device that runs the virtual processor, and switching a physical local timer currently used by the physical processor to a physical global timer, to enable the physical processor to perform operations on the physical global timer, wherein a clock interrupt generated by the physical local timer is delivered to the physical processor of the computing device only, and a clock interrupt generated by the physical global timer is delivered to any physical processor of the computing device; and

performing a timer configuration for the virtual processor to enable the physical local timer to act as a timer of the virtual processor.

2. The method according to claim 1 , wherein: performing the timer configuration for the virtual processor to enable the physical local timer to act as the timer of the virtual processor comprises:

adapting the virtual local timer of the virtual processor to the physical local timer, and constructing a processing function for interrupt processing for the virtual processor after adaptation; and

stopping the virtual local timer, and setting a permission for the virtual processor to directly access the physical local timer.

3. The method according to claim 2 , wherein adapting the virtual local timer of the virtual processor to the physical local timer, and constructing the processing function for the interrupt processing for the virtual processor after the adaptation comprise:

configuring an interrupt number of the virtual processor for the physical local timer as a preset interrupt number, and binding the preset interrupt number to the processing function for the interrupt processing, wherein the processing function is used for converting the interrupt number of the virtual processor for the virtual local timer into the preset interrupt number, and performing timer timeout processing.

4. The method according to claim 2 , wherein:

adapting the virtual local timer of the virtual processor to the physical local timer comprises: adapting an operation of the virtual processor on the virtual local timer to the physical local timer through a virtual machine monitor; and

stopping the virtual local timer, and setting the permission for the virtual processor to directly access the physical local timer comprises: stopping the virtual local timer, and setting the permission for the virtual processor to directly access the physical local timer through the virtual machine monitor.

5. The method according to claim 1 , wherein determining to perform the timer switching of the virtual local timer used by the virtual processor according to the one or more preset timer switching conditions comprises:

determining to perform the timer switching of the virtual local timer used by the virtual processor according to a running state of the virtual processor.

6. The method according to claim 5 , wherein determining to perform the timer switching of the virtual local timer used by the virtual processor according to the running state of the virtual processor comprises:

determining to perform the timer switching of the virtual local timer used by the virtual processor if the virtual processor is in a virtual local timer enabled state and the virtual processor is scheduled to run.

7. The method according to claim 1 , wherein the physical local timer comprises an advanced programmable interrupt controller (APIC) timer, and the physical global timer comprises a high precision event timer (HPET).

8. One or more computer readable media storing executable instructions that, when executed by one or more processors, cause the one or more processors to perform acts comprising:

determining to perform timer switching on a virtual local timer used by a virtual processor according to one or more preset timer switching conditions;

determining a physical processor that runs the virtual processor, and switching a physical local timer currently used by the physical processor to a physical global timer; and

performing a timer configuration for the virtual processor to enable the physical local timer to act as a timer of the virtual processor.

9. The one or more computer readable media according to claim 8 , wherein:

performing the timer configuration for the virtual processor to enable the physical local timer to act as the timer of the virtual processor comprises:

adapting the virtual local timer of the virtual processor to the physical local timer, and constructing a processing function for interrupt processing for the virtual processor after adaptation; and

stopping the virtual local timer, and setting a permission for the virtual processor to directly access the physical local timer.

10. The one or more computer readable media according to claim 9 , wherein adapting the virtual local timer of the virtual processor to the physical local timer, and constructing the processing function for the interrupt processing for the virtual processor after the adaptation comprise:

configuring an interrupt number of the virtual processor for the physical local timer as a preset interrupt number, and binding the preset interrupt number to the processing function for the interrupt processing, wherein the processing function is used for converting the interrupt number of the virtual processor for the virtual local timer into the preset interrupt number, and performing timer timeout processing.

11. The one or more computer readable media according to claim 9 , wherein:

adapting the virtual local timer of the virtual processor to the physical local timer comprises: adapting an operation of the virtual processor on the virtual local timer to the physical local timer through a virtual machine monitor; and

stopping the virtual local timer, and setting the permission for the virtual processor to directly access the physical local timer comprises: stopping the virtual local timer, and setting the permission for the virtual processor to directly access the physical local timer through the virtual machine monitor.

12. The one or more computer readable media according to claim 8 , wherein determining to perform the timer switching of the virtual local timer used by the virtual processor according to the one or more preset timer switching conditions comprises:

determining to perform the timer switching of the virtual local timer used by the virtual processor according to a running state of the virtual processor.

13. The one or more computer readable media according to claim 12 , wherein determining to perform the timer switching of the virtual local timer used by the virtual processor according to the running state of the virtual processor comprises:

determining to perform the timer switching of the virtual local timer used by the virtual processor if the virtual processor is in a virtual local timer enabled state and the virtual processor is scheduled to run.

14. The one or more computer readable media according to claim 8 , wherein the physical local timer comprises an advanced programmable interrupt controller (APIC) timer, and the physical global timer comprises a high precision event timer (HPET).

15. An apparatus comprising:

one or more processors; and

memory storing executable instructions that, when executed by the one or more processors, cause the one or more processors to perform acts comprising:

determining to perform timer switching on a virtual local timer used by a virtual processor according to one or more preset timer switching conditions;

determining a physical processor that runs the virtual processor, and switching a physical local timer currently used by the physical processor to a physical global timer; and

performing a timer configuration for the virtual processor to enable the physical local timer to act as a timer of the virtual processor.

16. The apparatus according to claim 15 , wherein: performing the timer configuration for the virtual processor to enable the physical local timer to act as the timer of the virtual processor comprises:

adapting the virtual local timer of the virtual processor to the physical local timer, and constructing a processing function for interrupt processing for the virtual processor after adaptation; and

stopping the virtual local timer, and setting a permission for the virtual processor to directly access the physical local timer.

17. The apparatus according to claim 16 , wherein adapting the virtual local timer of the virtual processor to the physical local timer, and constructing the processing function for the interrupt processing for the virtual processor after the adaptation comprise:

configuring an interrupt number of the virtual processor for the physical local timer as a preset interrupt number, and binding the preset interrupt number to the processing function for the interrupt processing, wherein the processing function is used for converting the interrupt number of the virtual processor for the virtual local timer into the preset interrupt number, and performing timer timeout processing.

18. The apparatus according to claim 16 , wherein:

adapting the virtual local timer of the virtual processor to the physical local timer comprises: adapting an operation of the virtual processor on the virtual local timer to the physical local timer through a virtual machine monitor; and

stopping the virtual local timer, and setting the permission for the virtual processor to directly access the physical local timer comprises: stopping the virtual local timer, and setting the permission for the virtual processor to directly access the physical local timer through the virtual machine monitor.

19. The apparatus according to claim 15 , wherein determining to perform the timer switching of the virtual local timer used by the virtual processor according to the one or more preset timer switching conditions comprises:

determining to perform the timer switching of the virtual local timer used by the virtual processor according to a running state of the virtual processor.

20. The apparatus according to claim 19 , wherein determining to perform the timer switching of the virtual local timer used by the virtual processor according to the running state of the virtual processor comprises:

determining to perform the timer switching of the virtual local timer used by the virtual processor if the virtual processor is in a virtual local timer enabled state and the virtual processor is scheduled to run.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 29, 2026
From: ALIBABA GROUP HOLDING LIMITED
To: CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PRIVATE LIMITED
Reel/Frame 075499/0384 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded May 9, 2024
From: XU, YUN; SHEN, YIBIN; ZHANG, XIANTAO
To: ALIBABA GROUP HOLDING LIMITED
Reel/Frame 067366/0285 →
Priority Claims (1)
CN 201910913341.0 · Sep 25, 2019 · national
Continuity (2)
Continuation PCTCN2020116465 · Sep 21, 2020
Related Publication 20220206840A1 · Jun 30, 2022