Wait optimizer for recording an order of first entry into a wait mode by a virtual central processing unit
AssigneeAmazon Technologies, Inc.
InventorAli Ghassan Saidi
Life of this patent
Estimating the term…
Abstract
A wait optimizer circuit can be coupled to a processor to monitor an entry of a virtual CPU (vCPU) into a wait mode to acquire a ticket lock. The wait optimizer can introduce an amount of delay, while the vCPU is in the wait mode, with an assumption that the spinlock may be resolved before sending a wake up signal to the processor for rescheduling. The wait optimizer can also record a time stamp only for a first entry of the vCPU from a plurality of entries into the wait mode within a window of time. The time stamps for vCPUs contending for the same ticket lock can be used by a hypervisor executing on the processor for rescheduling the vCPUs.
Claims20
A computing system comprising:
- a processor configured to execute instructions for a hypervisor and a set of virtual CPUs (vCPUs);
- a processing circuit external to the processor and coupled to the processor, wherein the processing circuit is configured to:
- monitor a signal from the processor to detect a first entry of a respective vCPU of the set of vCPUs into a respective wait mode from a plurality of entries of the respective vCPU into the respective wait mode within a respective window of time for the respective vCPU while the respective vCPU is waiting to acquire a ticket lock held by another vCPU of the set of vCPUs, the respective window of time for the respective vCPU being initiated by the first entry of the respective vCPU into the respective wait mode, wherein subsequent entries of the plurality of entries of the respective vCPU into the respective wait mode after the first entry are caused by false wake ups;
- record a time stamp and a ticket lock address associated with the respective vCPU upon only the first entry of the respective vCPU into the respective wait mode within the respective window of time;
- while the respective vCPU is waiting to acquire the ticket lock in the respective wait mode, count using a respective timer until the respective timer reaches a respective predetermined value determined by the hypervisor;
- and
- upon the respective timer reaching the respective predetermined value, send an event signal to the processor to wake up the respective vCPU to compare a first value stored at the ticket lock address with a second value stored in a memory, wherein the first value indicates a now serving ticket number and the second value indicates a ticket number of the respective vCPU, and wherein the respective vCPU acquires the ticket lock when the first value matches the second value stored in the memory.
A method, comprising:
- executing, by a processor, instructions for a hypervisor and a set of virtual CPUs (vCPUs);
- monitoring, by a processing circuit external to the processor and coupled to the processor, a signal from the processor to detect a first entry of a respective vCPU of the set of vCPUs into a respective wait mode from a plurality of entries of the respective vCPU into the respective wait mode within a respective window of time for the respective vCPU while the respective vCPU is waiting to acquire a ticket lock held by another vCPU of the set of vCPUs, the respective window of time for the respective vCPU being initiated by the first entry of the respective vCPU into the respective wait mode, wherein subsequent entries of the plurality of entries of the respective vCPU into the respective wait mode after the first entry are caused by false wake ups;
- recording, by the processing circuit, a time stamp and a ticket lock address associated with the respective vCPU upon only the first entry of the respective vCPU into the respective wait mode within the respective window of time;
- while the respective vCPU is waiting to acquire the ticket lock in the respective wait mode, counting, by the processing circuit, using a respective timer until the respective timer reaches a respective predetermined value determined by the hypervisor;
- and
- upon the respective timer reaching the respective predetermined value, sending an event signal by the processing circuit to the processor to wake up the respective vCPU to compare a first value stored at the ticket lock address with a second value stored in a memory, wherein the first value indicates a now serving ticket number and the second value indicates a ticket number of the respective vCPU, and wherein the respective vCPU acquires the ticket lock when the first value matches the second value stored in the memory.
An integrated circuit, comprising:
- an event monitor circuit configured to monitor a signal from a host processor external to the integrated circuit to detect an entry of a given vCPU of a set of vCPUs executing on the host processor into a wait mode to acquire a ticket lock held by another vCPU of the set of vCPUs;
- a delay register circuit configured to store a value corresponding to an amount of delay to introduce when the given vCPU of the set of vCPUs enters the wait mode;
- a time window register circuit configured to provide a respective window of time for the given vCPU, during which subsequent entries into the wait mode by the given vCPU after a first entry of the given vCPU into the wait mode are ignored, wherein the subsequent entries into the wait mode by the given vCPU after the first entry of the given vCPU into the wait mode are caused by false wake ups;
- a first entry time register circuit configured to record a time stamp corresponding to only the first entry of the given vCPU into the wait mode within the respective window of time for the given vCPU;
- a lock address register circuit configured to store a ticket lock address of the ticket lock that is contended for by the set of vCPUs;
- and
- a timer circuit configured to, while the given vCPU is waiting to acquire the ticket lock in the wait mode, count until a counter value of the timer circuit reaches the value stored in the delay register circuit,
- wherein the integrated circuit is configured to, upon the counter value of the timer circuit reaches the value stored in the delay register circuit, send an event signal to the host processor to wake up the given vCPU to compare a first value stored at the ticket lock address with a second value stored in a memory, wherein the first value indicates a now serving ticket number and the second value indicates a ticket number of the given vCPU, and wherein the given vCPU acquires the ticket lock when the first value matches the second value stored in the memory.
Dependencies are inferred from the claim text.