IP Library Granted Patent US 12699580
Granted Patent B2
US 12699580 · App. 17/971,808 · Granted Aug 4, 2026

Paravirtual pause loops in guest user space

Inventor: Bandan Das (Westford, MA)
Assignee: Red Hat, Inc.
G06F9/45558G06F2009/4557G06F2009/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 12699580
App. No.
17/971,808
Granted
Aug 4, 2026
Kind
B2
Abstract

Paravirtual pause loops in guest user space are provided by implementing, by a hypervisor for a virtualization environment, a paravirtual sleep command from a certain virtual machine of a plurality of virtual machines operating in the virtualization environment, the paravirtual sleep command indicating an instruction and a resource that the certain virtual machine is waiting on to perform the instruction; adding an entry to a work queue managed by the hypervisor for the plurality of virtual machines; and in response to the resource becoming available for the certain virtual machine: removing the entry from the work queue; and waking the certain virtual machine to perform the instruction with the resource.

Claims (55)

1 . A method, comprising:

publicizing, by a hypervisor to a plurality of virtual machines operating in a virtualization environment, a code segment comprising a paravirtual sleep command that is a hypervisor controlled spin loop configured to wait for availability of a requested resource by a requesting virtual machine before waking the requesting virtual machine upon the availability of the requested resource;

based on the publicized code segment, receiving, by a guest operating system associated with a certain virtual machine of the plurality of virtual machines operating on the hypervisor for the virtualization environment, an instance of the paravirtual sleep command associated with the certain virtual machine of the plurality of virtual machines operating in the virtualization environment, the instance of the paravirtual sleep command indicating an instruction and a resource that the certain virtual machine is waiting on to perform the instruction;

based on the instance of the paravirtual sleep command associated with the certain virtual machine, implementing, by the hypervisor, the paravirtual sleep command to transfer a responsibility of implementing the instance of the paravirtual sleep command and monitoring availability of the resource from the guest operating system of the certain virtual machine to the hypervisor, wherein implementing the instance of the paravirtual sleep command and monitoring the availability of the resource includes:

adding an entry to a work queue managed by the hypervisor for the certain virtual machine of the plurality of virtual machines; and

in response to the resource becoming available for the certain virtual machine:

removing the entry from the work queue; and

waking the certain virtual machine to perform the instruction with the resource.

2 . The method of claim 1 , wherein waking the certain virtual machine includes scheduling a virtual central processing unit (VCPU) to perform the instruction.

3 . The method of claim 1 , wherein the hypervisor adds the entry to the work queue according to a First-In-First-Out schema, wherein determining whether the resource has become available for the certain virtual machine includes determining that no other virtual machines of the plurality of virtual machines are associated with entries for the resource that were added to the work queue before the entry was added to the work queue.

4 . The method of claim 1 , wherein the hypervisor adds the entry to the work queue according to a privilege level schema, wherein determining whether the resource has become available for the certain virtual machine includes determining that no other virtual machines of the plurality of virtual machines with a higher privilege level for the resource than the certain virtual machine are associated with entries for the resource currently in the work queue.

5 . The method of claim 1 , further comprising:

implementing, by the hypervisor, a second paravirtual sleep command from the certain virtual machine, the second paravirtual sleep command indicating a second instruction and a second resource that the certain virtual machine is waiting on to perform the second instruction, wherein the second resource is different from the resource;

adding a second entry to the work queue managed by the hypervisor for the plurality of virtual machines; and

in response to the second resource becoming available for the certain virtual machine:

removing the second entry from the work queue; and

waking the certain virtual machine to perform the second instruction with the second resource.

6 . The method of claim 1 , wherein the hypervisor stores an address of the resource on a first register of a physical processor monitoring the work queue and stores a release condition for the resource on a second register of the physical processor.

7 . A system, comprising:

a processor; and

a memory, including instructions that when executed by the processor perform operations including:

publicizing, by a hypervisor to a plurality of virtual machines operating in a virtualization environment, a code segment comprising a paravirtual sleep command that is a hypervisor controlled spin loop configured to wait for availability of a requested resource by a requesting virtual machine before waking the requesting virtual machine upon the availability of the requested resource;

based on the publicized code segment, receiving, by a guest operating system associated with a certain virtual machine of the plurality of virtual machines operating on the hypervisor for the virtualization environment, an instance of the paravirtual sleep command associated with the certain virtual machine of the plurality of virtual machines operating in the virtualization environment, the instance of the paravirtual sleep command indicating an instruction and a resource that the certain virtual machine is waiting on to perform the instruction;

based on the instance of the paravirtual sleep command associated with the certain virtual machine, implementing, by the hypervisor, the paravirtual sleep command to transfer a responsibility of implementing the instance of the paravirtual sleep command and monitoring availability of the resource from the guest operating system of the certain virtual machine to the hypervisor, wherein implementing the instance of the paravirtual sleep command and monitoring the availability of the resource includes:

in response to implementing the paravirtual sleep command, adding an entry to a work queue managed by the hypervisor for the certain virtual machine of the plurality of virtual machines; and

in response to the resource becoming available for the certain virtual machine:

removing the entry from the work queue; and

waking the certain virtual machine to perform the instruction with the resource.

8 . The system of claim 7 , wherein waking the certain virtual machine includes scheduling a virtual central processing unit (VCPU) to perform the instruction.

9 . The system of claim 7 , wherein the hypervisor adds the entry to the work queue according to a First-In-First-Out schema, wherein determining whether the resource has become available for the certain virtual machine includes determining that no other virtual machines of the plurality of virtual machines are associated with entries for the resource that were added to the work queue before the entry was added to the work queue.

10 . The system of claim 7 , wherein the hypervisor adds the entry to the work queue according to a privilege level schema, wherein determining whether the resource has become available for the certain virtual machine includes determining that no other virtual machines of the plurality of virtual machines with a higher privilege level for the resource than the certain virtual machine are associated with entries for the resource currently in the work queue.

11 . The system of claim 7 , the operations further comprising:

implementing, by the hypervisor, a second paravirtual sleep command from the certain virtual machine, the second paravirtual sleep command indicating a second instruction and a second resource that the certain virtual machine is waiting on to perform the second instruction, wherein the second resource is different from the resource;

adding a second entry to the work queue managed by the hypervisor for the plurality of virtual machines; and

in response to the second resource becoming available for the certain virtual machine:

removing the second entry from the work queue; and

waking the certain virtual machine to perform the second instruction with the second resource.

12 . The system of claim 7 , wherein the hypervisor stores an address of the resource on a first register of a physical processor monitoring the work queue and stores a release condition for the resource on a second register of the physical processor.

13 . A memory, including instructions that when executed by a processor perform operations including:

publicizing, by a hypervisor to a plurality of virtual machines operating in a virtualization environment, a code segment comprising a paravirtual sleep command that is a hypervisor controlled spin loop configured to wait for availability of a requested resource by a requesting virtual machine before waking the requesting virtual machine upon the availability of the requested resource;

based on the publicized code segment, receiving, by a guest operating system associated with a certain virtual machine of the plurality of virtual machines operating on the hypervisor for the virtualization environment, an instance of the paravirtual sleep command associated with the certain virtual machine of the plurality of virtual machines operating in the virtualization environment, the instance of the paravirtual sleep command indicating an instruction and a resource that the certain virtual machine is waiting on to perform the instruction;

based on the instance of the paravirtual sleep command associated with the virtual machine, implementing, by the hypervisor, the paravirtual sleep command to transfer a responsibility of implementing the instance of the paravirtual sleep command and monitoring availability of the resource from the guest operating system of the certain virtual machine to the hypervisor, wherein implementing the instance of the paravirtual sleep command and monitoring the availability of the resource includes:

in response to implementing the paravirtual sleep command, adding an entry to a work queue managed by the hypervisor for the certain virtual machine of the plurality of virtual machines; and

in response to the resource becoming available for the certain virtual machine:

removing the entry from the work queue; and

waking the certain virtual machine to perform the instruction with the resource.

14 . The memory of claim 13 , wherein waking the certain virtual machine includes scheduling a virtual central processing unit (VCPU) to perform the instruction.

15 . The memory of claim 13 , wherein the hypervisor adds the entry to the work queue according to a First-In-First-Out schema, wherein determining whether the resource has become available for the certain virtual machine includes determining that no other virtual machines of the plurality of virtual machines are associated with entries for the resource that were added to the work queue before the entry was added to the work queue.

16 . The memory of claim 13 , wherein the hypervisor adds the entry to the work queue according to a privilege level schema, wherein determining whether the resource has become available for the certain virtual machine includes determining that no other virtual machines of the plurality of virtual machines with a higher privilege level for the resource than the certain virtual machine are associated with entries for the resource currently in the work queue.

17 . The memory of claim 13 , the operations further comprising:

implementing, by the hypervisor, a second paravirtual sleep command from the certain virtual machine, the second paravirtual sleep command indicating a second instruction and a second resource that the certain virtual machine is waiting on to perform the second instruction, wherein the second resource is different from the resource;

adding a second entry to the work queue managed by the hypervisor for the plurality of virtual machines; and

in response to the second resource becoming available for the certain virtual machine:

removing the second entry from the work queue; and

waking the certain virtual machine to perform the second instruction with the second resource.