I / O real-time response method based on ARM microkernel Hypervisor

By introducing an adaptive scheduling mode switching mechanism in the ARM microkernel hypervisor and using a binary counter table and scheduling status counter to dynamically adjust the scheduling priority of the vCPU, the problem of I/O response delay in the virtualized environment is solved, and more efficient I/O task scheduling is achieved.

CN120762882APending Publication Date: 2025-10-10UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510801401.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-16
Publication Date
2025-10-10

AI Technical Summary

Technical Problem

The I/O response delay problem is prominent in existing virtualization environments, especially in high-frequency interruption and high-load scenarios. The existing boosting mechanism cannot effectively optimize I/O task scheduling, resulting in insufficient response speed.

Method used

Based on the adaptive scheduling mode switching mechanism of the ARM microkernel hypervisor, the scheduling mode and status of I/O tasks are recorded by maintaining a binary counter table, and the scheduling priority of the vCPU is dynamically adjusted to ensure that I/O tasks are scheduled in time among high-priority tasks.

Benefits of technology

It reduces unnecessary boosting switching overhead, improves I/O response speed, is applicable to a variety of I/O devices, has stronger versatility and portability, and avoids blind or false triggering of traditional boosting mechanisms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120762882A_ABST
    Figure CN120762882A_ABST
Patent Text Reader

Abstract

The invention discloses an I / O real-time response method based on an ARM microkernel Hypervisor, the Hypervisor maintains a binary counter table for each vCPU, the binary counter table comprises a scheduling mode identifier corresponding to each I / O task and a binary scheduling state counter, when an external device triggers an I / O event, the Hypervisor judges whether a target vCPU is in an idle state, if yes, the priority of the target vCPU is improved, operation is preempted, and if not, the target vCPU is in the idle state; and otherwise, acquiring a scheduling mode identifier of the target I / O task in the target vCPU, adopting a conventional scheduling mode or a Boosting scheduling mode according to the scheduling mode identifier, and realizing scheduling mode switching according to the value of the scheduling state counter in each scheduling mode. By means of support provided by an ARMv8 system structure, an adaptive scheduling mode switching mechanism based on the historical task scheduling condition is provided in a full virtualization mode, it is ensured that I / O tasks can still be scheduled in time between high-priority tasks, and the I / O response speed is increased.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of microkernel, and more specifically relates to an I / O real-time response method based on an ARM microkernel Hypervisor. BACKGROUND

[0002] A virtual machine monitor Hypervisor is a core component of virtualization technology, responsible for creating and managing multiple virtual computing environments on a single physical computing resource. These virtual environments are called virtual machines (VMs), and each virtual machine can run an independent operating system and application. The main responsibility of the Hypervisor is to abstract, allocate and manage physical resources such as CPU, memory, storage and network, while ensuring resource isolation and security between virtual machines. Type 1 Hypervisor refers to a Hypervisor that runs directly on physical hardware, also known as bare-metal Hypervisor, which does not rely on any host operating system and directly controls hardware resources and is responsible for running and managing guest operating systems. It is commonly used in servers and embedded devices, as it directly interacts with hardware, providing high performance and efficiency. Type 2 Hypervisor runs on the host operating system, relying on the host operating system to manage hardware resources. It runs as an application program of the host operating system and provides virtualization services for the guest operating system. It is more suitable for desktop virtualization environments, with high convenience but relatively low performance.

[0003] I / O performance mainly refers to the efficiency of handling input / output operations in virtual machines, including data transmission bandwidth, delay and overall throughput. In a virtualization environment, I / O response problems are particularly prominent, because I / O requests need to be switched multiple times between virtual machines, Hypervisors and physical hardware. This multi-level processing may cause high interrupt delay, which in turn affects real-time performance. Common problems include: high-frequency interrupt-induced context switch overhead, inefficient I / O data transmission path, and performance fluctuations caused by resource competition between virtual machines.

[0004] Boosting is a common mechanism for optimizing I / O response in a virtualization environment, and its core goal is to temporarily increase the scheduling priority of the vCPU when an I / O event arrives, so that it can quickly obtain CPU running rights, thereby reducing the scheduling delay of I / O tasks. Its basic principle is to adjust the scheduling priority of the vCPU based on the triggering time of the I / O event, so that the vCPU has higher competitiveness when the I / O task needs to be responded urgently, thereby reducing the waiting time of the I / O task in the scheduling queue. In addition, other researchers have proposed numerous I / O real-time response optimization methods:

[0005] The direct I / O virtualization solution significantly reduces the performance overhead of remote memory access to the device through optimization of the I / OMMU and DMA buffers. It combines the I / O page table allocation logic with the device's NUMA node to ensure that the page table is allocated to the device's local node, thereby reducing the latency caused by remote access. The hypervisor directly reads the hardware configuration information of the I / O device and dynamically discovers the location of the client virtual machine's DMA buffer. The DMA buffer of the remote node is migrated to the device's proximal node, limiting the device's memory access operations to the proximal end, further optimizing performance. This solution relies on the hardware architecture of I / OMMU and NUMA, has limited support for general hardware, and cannot directly optimize the processing efficiency of high-frequency interrupts.

[0006] The virtI / O_blk-based virtualization I / O performance optimization solution targets block device I / O in a virtualized environment, optimizing request processing to reduce response latency. When a bI / O request arrives, the BASE_BI / O module is used to store it in the target queue and detect whether there are adjacent requests in the queue. If adjacent requests are detected, they are merged into a larger request (virtblk_request), reducing the pressure on the system caused by small requests. A timer is set for bI / O requests without adjacent requests. After the timer expires, the priority of the request is increased and processing is triggered. A single kick operation is triggered by the merged request, allowing QEMU to process multiple requests at once. This solution is primarily targeted at virtI / O_blk-type devices and has limited applicability to other device types. In high-load scenarios, excessive queue adjustments may add additional overhead.

[0007] The I / O performance optimization solution based on optimized memory page allocation optimizes I / O page allocation and release processes, reducing the overhead caused by frequent page allocation and release, thereby indirectly improving I / O efficiency. This solution is limited to memory management and cannot directly improve I / O data transmission performance or interrupt processing latency. Its effectiveness is limited in I / O-intensive scenarios.

[0008] Xen uses Credit Scheduler for vCPU scheduling. Boosting mechanism is used to temporarily boost the priority of the vCPU when I / O event arrives, when the vCPU is in Idle state (i.e. no task is running in the last scheduling period), to ensure that it gets the first chance to run on physical CPU in the next scheduling period, to reduce the response latency of I / O task. When the vCPU is in Running state (i.e. currently executing a computing task), even if I / O event arrives, Hypervisor will not trigger Boosting, but wait for the vCPU time slice to end, and then Guest OS will perform normal task scheduling, to avoid unnecessary preemption to computing task. The implementation of this scheme will cause I / O task to wait for a long time under high computing load, affecting the I / O response speed. In addition, Boosting mechanism is triggered only based on the Idle state of vCPU, and cannot sense whether there is an urgent I / O task inside Guest OS, which may cause Boosting to be triggered mistakenly or unable to optimize critical I / O task.

[0009] KVM uses Linux kernel CFS scheduler for vCPU scheduling, and does not actively boost by default, but relies on Guest OS task scheduling. In this scheme, vCPU scheduling completely relies on Linux kernel CFS scheduler, and Hypervisor does not provide Boosting mechanism, and cannot actively optimize I / O task scheduling. The execution of I / O task completely depends on the scheduling strategy of Guest OS, and if computing task occupies high priority, I / O task may be scheduled for a long time, resulting in increased I / O response delay. In a multi-tenant or high I / O load environment, KVM lacks Boosting mechanism and cannot guarantee low delay of I / O task, which may reduce the overall I / O processing capability. SUMMARY

[0010] The purpose of the present application is to overcome the shortcomings of the prior art, and provide an I / O real-time response method based on ARM microkernel Hypervisor, which uses the support provided by ARMv8 architecture to provide an adaptive scheduling mode switching mechanism based on task history scheduling conditions in a full virtualization manner, to ensure that I / O task can still be scheduled in time among high priority tasks, and improve the I / O response speed.

[0011] In order to achieve the above-mentioned purpose of the application, the I / O real-time response method based on ARM microkernel Hypervisor comprises the following steps:

[0012] S1: The Hypervisor maintains a binary counter table for each vCPU, in which a scheduling mode flag and a binary scheduling status counter are maintained for each I / O task. When the scheduling mode flag is 0, the I / O task in the vCPU is in the normal scheduling mode. When the scheduling mode flag is 1, the I / O task in the vCPU is in the Boosting scheduling mode. The number of bits N in the scheduling status counter and the scheduling step size in different modes are set according to actual needs. The scheduling success adjustment step size in the normal scheduling mode is +α, and the scheduling failure adjustment step size is -β. The scheduling success adjustment step size in the Boosting scheduling mode is +β, and the scheduling failure adjustment step size is -α, where α>β>0.

[0013] S2: When an external device triggers an I / O event, the hypervisor intercepts the event and determines the target vCPU to which the I / O task belongs.

[0014] S3: The Hypervisor determines whether the target vCPU is in an idle state. If so, it proceeds to step S4; otherwise, it proceeds to step S5.

[0015] S4: The hypervisor increases the priority of the target vCPU and preempts the running process. After the process is complete, the hypervisor restores the priority of the target vCPU.

[0016] S5: The Hypervisor obtains the scheduling mode identifier of the target I / O task in the target vCPU and determines the scheduling state of the target vCPU according to the scheduling state identifier. If the target vCPU is in the normal scheduling mode, the process proceeds to step S6; otherwise, the process proceeds to step S7.

[0017] S6: The hypervisor performs regular scheduling on the target vCPU, including the following steps:

[0018] S6.1: The hypervisor adds the target vCPU to the scheduling queue and waits for scheduling by the scheduler;

[0019] S6.2: After the target vCPU is running, the Hypervisor determines whether the target I / O task is successfully scheduled. If yes, it proceeds to step S6.3; otherwise, it proceeds to step S6.4.

[0020] S6.3: The hypervisor determines whether the scheduling status counter of the target I / O task in the target vCPU has reached the maximum value. If not, the process proceeds to step S6.4; otherwise, the process proceeds to step S6.5.

[0021] S6.4: If the target I / O task is successfully scheduled, the scheduling status counter is incremented by +α; otherwise, the scheduling status counter is incremented by -β. This scheduling is completed.

[0022] S6.5: The hypervisor switches the target I / O task in the target vCPU from the normal scheduling mode to the boosting scheduling mode, setting the corresponding scheduling mode flag to 1, and then resets the scheduling state counter to 0. This scheduling is completed.

[0023] S7: The Hypervisor performs Boosting scheduling on the target vCPU, including the following steps:

[0024] S7.1: The hypervisor increases the priority of the target vCPU and preempts it.

[0025] S7.2: The Hypervisor determines whether the target I / O task is successfully scheduled. If not, it proceeds to step S7.3; otherwise, it proceeds to step 7.6.

[0026] S7.3: Restore the target vCPU's running priority and proceed to step S7.4;

[0027] S7.4: The hypervisor determines whether the scheduling status counter has reached the minimum value. If so, it proceeds to step S7.5; otherwise, it proceeds to step S7.9.

[0028] S7.5: The hypervisor switches the target I / O task in the target vCPU from the boosting scheduling mode to the normal scheduling mode, i.e., sets the corresponding scheduling mode flag to 0, and then resets the scheduling state counter to 0. This scheduling is completed.

[0029] S7.6: The hypervisor maintains the Boosting scheduling mode for the target I / O task in the target vCPU.

[0030] S7.7: The hypervisor determines whether an I / O task switch occurs on the target vCPU. If so, the process proceeds to step S7.8; otherwise, the process returns to step S7.6.

[0031] S7.8: Restore the target vCPU's running priority and proceed to step S7.9;

[0032] S7.9: When the target I / O task is successfully scheduled, the scheduling status counter is incremented by +β; otherwise, the scheduling status counter value is incremented by -α; this scheduling is completed.

[0033] The present invention is based on an I / O real-time response method of an ARM microkernel hypervisor. The hypervisor maintains a binary counter table for each vCPU, including a scheduling mode identifier corresponding to each I / O task and a binary scheduling status counter. When an external device triggers an I / O event, the hypervisor determines whether the target vCPU is in an idle state. If so, the hypervisor increases its priority and preempts the operation. Otherwise, the hypervisor obtains the scheduling mode identifier of the target I / O task in the target vCPU and adopts a conventional scheduling mode or a boosting scheduling mode according to the scheduling mode identifier. In each scheduling mode, the scheduling mode is switched according to the value of the scheduling status counter.

[0034] The present invention has the following beneficial effects:

[0035] 1) The present invention performs boosting trigger control based on a binary scheduling state counter. By dynamically adjusting the vCPU scheduling mode, unnecessary boosting switching overhead is reduced, ensuring that I / O tasks can still be scheduled in a timely manner among high-priority tasks, thereby improving I / O response speed.

[0036] 2) The present invention achieves I / O task awareness and optimization without the need for additional hardware support, has stronger versatility and portability, and is applicable to a variety of I / O devices such as Virtio, network, and storage, rather than being limited to specific I / O device types, thus improving the applicability of the solution;

[0037] 3) In the present invention, the hypervisor tracks the I / O task status through a scheduling status counter and adaptively adjusts the setting of the scheduling status counter based on the historical scheduling success rate of the I / O task, thereby adjusting the boosting triggering timing to avoid blind or false triggering of the traditional boosting mechanism;

[0038] 4) The present invention utilizes the information of the thread_info structure and the task_struct structure to accurately determine whether the target I / O task is successfully scheduled and whether the I / O task is switched, thereby more accurately controlling the scheduling process. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 This is a flowchart of a specific implementation of the I / O real-time response method based on the ARM microkernel Hypervisor of the present invention;

[0040] Figure 2 is an example diagram of a binary counter table in this embodiment;

[0041] Figure 3 It is a flow chart of conventional scheduling in the present invention;

[0042] Figure 4 It is a flowchart of Boosting scheduling in the present invention;

[0043] Figure 5 Schematic diagram of the scheduling mode switching in this embodiment;

[0044] Figure 6 This is the Linux kernel stack layout diagram in this embodiment;

[0045] Figure 7 This is a flowchart of obtaining the address of the task_struct structure in this embodiment;

[0046] Figure 8 is a detection timing diagram of the conventional scheduling mode in this embodiment;

[0047] Figure 9 This is a detection timing diagram of the Boosting scheduling mode in this embodiment. DETAILED DESCRIPTION

[0048] The following describes the specific embodiments of the present invention in conjunction with the accompanying drawings so that those skilled in the art can better understand the present invention. It should be noted that in the following description, when detailed descriptions of known functions and designs may dilute the main content of the present invention, such descriptions will be omitted here.

[0049] Example

[0050] Figure 1 This is a flow chart of a specific implementation of the I / O real-time response method based on the ARM microkernel Hypervisor of the present invention. Figure 1 As shown, the specific steps of the I / O real-time response method based on the ARM microkernel Hypervisor of the present invention include:

[0051] S101: Setting the scheduling status counter:

[0052] In the present invention, there are two scheduling modes for vCPU, namely conventional scheduling mode and Boosting scheduling mode. In order to record the historical scheduling status of I / O tasks in conventional scheduling mode and Boosting scheduling mode, and dynamically adjust the Boosting triggering strategy, in the present invention, the Hypervisor maintains a binary counter table for each vCPU, in which a scheduling mode identification flag and a binary scheduling status counter are maintained for each I / O task, wherein when the scheduling mode identification flag = 0, the I / O task in the vCPU is in conventional scheduling mode, and when the scheduling mode identification flag = 1, the I / O task in the vCPU is in Boosting scheduling mode. The number of bits N of the scheduling status counter and the scheduling step size in different modes are set according to actual needs, and the scheduling success adjustment step size in the conventional scheduling mode is +α, and the scheduling failure adjustment step size is -β, and the scheduling success adjustment step size in the Boosting scheduling mode is +β, and the scheduling failure adjustment step size is -α, wherein α>β>0.

[0053] In the design of the scheduling state counter, the number of bits, N, determines state stability and the ability to retain historical scheduling data. A higher number of bits results in slower state changes and more conservative boosting triggering; a lower number of bits results in faster state changes and more sensitive boosting triggering. The adjustment step size determines the speed of state changes, or the aggressiveness of the boosting trigger probability adjustment. A larger step size results in faster state changes and makes it easier for the system to trigger or cancel boosting. A smaller step size results in smoother state adjustments, reducing short-term jitter.

[0054] In this embodiment, the number of bits of the scheduling state counter N is set to 2. Table 1 is a table of setting adjustment steps in different scheduling modes in this embodiment.

[0055]

[0056] Table 1

[0057] Generally speaking, the default scheduling status flag of each I / O task in each vCPU is 0, and the default scheduling status counter is 00.

[0058] Figure 2 This is an example diagram of a binary counter table in this embodiment. Figure 2 As shown in the figure, in the vCPU structure, there is a table_ptr pointer pointing to the count_table structure, which stores the counter bit number and step range corresponding to each vCPU. In addition, the i / o_table_ptr pointer points to the binary counter table, which contains relevant information such as the identifier of each I / O task, the scheduling status counter value, and the scheduling mode flag.

[0059] S102: Hypervisor intercepts I / O event:

[0060] When an external device triggers an I / O event, the Hypervisor intercepts the event and determines the target vCPU to which the I / O task belongs.

[0061] S103: The Hypervisor determines whether the target vCPU is in an idle state. If so, the process proceeds to step S104; otherwise, the process proceeds to step S105.

[0062] S104: Triggering scheduling:

[0063] The hypervisor raises the priority of the target vCPU and preempts it. After the operation is complete, the hypervisor restores the priority of the target vCPU. This scheduling process ends.

[0064] S105: The Hypervisor obtains the scheduling mode identifier of the target I / O task in the target vCPU, and determines the scheduling state of the target vCPU according to the scheduling state identifier. If the target vCPU is in the normal scheduling mode, the process proceeds to step S106; otherwise, the process proceeds to step S107.

[0065] S106: Regular Scheduling:

[0066] In normal scheduling mode, the vCPU runs under the normal scheduling policy of the Hypervisor, without any additional priority increase, and is allocated based on the default rules of the scheduler. Figure 3 This is a flow chart of conventional scheduling in the present invention. Figure 3 As shown, the specific steps of conventional scheduling in the present invention include:

[0067] S301: Join the scheduling queue:

[0068] The Hypervisor adds the target vCPU to the scheduling queue and waits for scheduling by the scheduler.

[0069] S302: After the target vCPU is started, the Hypervisor determines whether the target I / O task is successfully scheduled. If yes, the process proceeds to step S303; otherwise, the process proceeds to step S304.

[0070] S303: The Hypervisor determines whether the scheduling status counter of the target I / O task in the target vCPU has reached the maximum value. If not, the process proceeds to step S304; otherwise, the process proceeds to step S305.

[0071] S304: Update the scheduling status counter:

[0072] If the target I / O task is successfully scheduled, the scheduling status counter is incremented by +α, otherwise the scheduling status counter is incremented by -β. This scheduling is completed.

[0073] S305: Scheduling mode switching:

[0074] The hypervisor switches the target I / O task in the target vCPU from the normal scheduling mode to the Boosting scheduling mode, setting the corresponding scheduling mode flag to 1, and then resets the scheduling state counter to 0. This scheduling is completed.

[0075] S107: Boosting Scheduling:

[0076] Boosting scheduling mode means that the hypervisor increases the priority of the vCPU and preempts the current vCPU to ensure that the corresponding tasks can be executed quickly. Figure 4 This is a flowchart of Boosting scheduling in the present invention. Figure 4 As shown, the specific steps of Boosting scheduling in the present invention include:

[0077] S401: Preemptive operation:

[0078] The hypervisor increases the priority of the target vCPU and preempts it.

[0079] S402: The Hypervisor determines whether the target I / O task is successfully scheduled. If not, the process proceeds to step S403; otherwise, the process proceeds to step S406.

[0080] S403: Restore target vCPU priority:

[0081] Restore the running priority of the target vCPU and proceed to step S404.

[0082] S404: The Hypervisor determines whether the scheduling status counter reaches the minimum value. If so, the process proceeds to step S405; otherwise, the process proceeds to step S409.

[0083] S405: Scheduling mode switching:

[0084] The hypervisor switches the target I / O task in the target vCPU from the Boosting scheduling mode to the normal scheduling mode, setting the corresponding scheduling mode flag to 0, and then resets the scheduling state counter to 0. This scheduling is completed.

[0085] S406: Maintaining Boosting scheduling mode:

[0086] The Hypervisor maintains the Boosting scheduling mode for the target I / O task in the target vCPU.

[0087] S407: The Hypervisor determines whether an I / O task switch occurs in the target vCPU. If so, the process proceeds to step S408; otherwise, the process returns to step S406.

[0088] S408: Restore target vCPU priority:

[0089] Restore the running priority of the target vCPU and proceed to step S409.

[0090] S409: Update the scheduling status counter:

[0091] If the target I / O task is successfully scheduled, the scheduling status counter is incremented by +β, otherwise the scheduling status counter is incremented by -α. This scheduling is completed.

[0092] According to the above process, the present invention will switch the scheduling mode. Next, the switching method of the scheduling mode is described using the number of bits and the adjustment step of the scheduling state counter shown in Table 1. Figure 5 This is a schematic diagram of the scheduling mode switching in this embodiment. Figure 5 As shown, the rules for switching the scheduling mode in this embodiment are as follows:

[0093] Conventional scheduling mode → Boosting scheduling mode: When the target vCPU is in conventional scheduling mode, the binary counter value corresponding to the I / O task is 11, and scheduling is successful in the next I / O event, a mode switch is triggered, and the conventional scheduling mode switches to the Boosting scheduling mode. The counter value defaults to 00.

[0094] Boosting scheduling mode → Regular scheduling mode: When a vCPU is in Boosting scheduling mode, the binary counter value corresponding to the I / O task is 00, and scheduling fails in the next I / O event. This triggers a mode switch from Boosting scheduling mode to Regular scheduling mode, and the counter value defaults to 00.

[0095] from Figure 5 The lowest and highest consecutive scheduling times of mode switching under the same scheduling status results can be counted. Table 2 is a statistical table of scheduling times of scheduling mode switching in this embodiment.

[0096]

[0097] Table 2

[0098] When the same scheduling state is maintained, the minimum and maximum number of mode switches is affected by the combination of the binary counter's number of bits and its step size. This, to a certain extent, reflects the resource overhead range within which the hypervisor selects the appropriate scheduling policy for the vCPU to which the I / O task belongs. By combining the vCPU's Boosting success rate, the system can dynamically adjust the counter configuration to optimize the scheduling policy, ensuring accurate Boosting triggering and efficient scheduling.

[0099] According to the mode switching rules, the minimum scheduling times Tmin for mode switching is always fixed at 2, that is, no matter what the step size is, at least two consecutive scheduling results must be consistent to complete the mode switching. max It depends on the number of bits N of the binary counter and the maximum value M of the absolute value of the adjustment step, and its calculation formula is as follows:

[0100]

[0101] in, Indicates rounding up.

[0102] To adapt different vCPUs to their respective I / O load characteristics, this embodiment proposes an adaptive Boosting trigger adjustment mechanism. Specifically, the hypervisor dynamically adjusts the scheduling state counter settings by analyzing the Boosting success rate of each vCPU. The core goal of this mechanism is to improve the scheduling success rate of I / O tasks for each vCPU in Boosting mode, reduce unnecessary vCPU switching, and improve the execution efficiency of I / O tasks. The specific methods of the adaptive Boosting trigger adjustment mechanism are as follows:

[0103] For each vCPU, the hypervisor maintains a Boosting success rate metric, P_global, which represents the ratio of successfully executed I / O tasks for that vCPU in Boosting scheduling mode. This metric reflects scheduling contention within the vCPU, specifically whether the guest OS can successfully schedule I / O tasks under Boosting. A high success rate indicates that Boosting is effective for the vCPU's I / O tasks and is suitable for a more aggressive Boosting triggering strategy. A low success rate indicates that Boosting may be ineffective and is suitable for a more conservative Boosting triggering strategy to reduce vCPU switching overhead.

[0104] Set the upper limit and lower limit of the Boosting success rate indicator P_global according to actual needs, and periodically judge the Boosting success rate indicator P_global to adjust the setting of the scheduling status counter. The specific method is as follows:

[0105] When P_global>upper, the I / O task is stable and has a high success rate. Therefore, reducing the number of bits in the scheduling state counter or increasing the value of the adjustment step parameter α can improve the boosting trigger tendency, which is suitable for low-latency tasks.

[0106] When lower <P_global≤upper,此时负载变化中等,Boosting适应性较好,因此保持当前调度状态计数器的设置不变,即维持当前Boosting触发机制;

[0107] When P_global ≤ lower, the load fluctuates greatly and Boosting misjudgments are frequent. Unnecessary scheduling needs to be reduced. Therefore, the number of bits in the scheduling state counter is increased or the value of the adjustment step parameter α is reduced to reduce the Boosting trigger tendency.

[0108] In practical applications, to facilitate adjustments, several scheduling state counter configuration examples can be pre-set. The degree to which each example improves the boosting triggering tendency can be evaluated and ranked. When the scheduling state counter needs to be adjusted, the previous or next example setting can be selected for adjustment. Table 3 shows an example table of scheduling state counter configuration examples in this embodiment.

[0109]

[0110] Table 3

[0111] In the present invention, it is necessary to determine whether the target I / O task is successfully scheduled. In order to accurately determine the running status of the target I / O task, this embodiment proposes a method for sensing the completion of I / O task execution. The hypervisor detects and monitors the execution status of the I / O task by reading the information in the task_struct structure of the Guest OS Linux. The specific method is as follows:

[0112] After the vCPU starts running, the hypervisor reads the task_struct structure of the guest OS Linux within a predetermined detection time window and extracts key scheduling metrics for the I / O task, including the task state and virtual runtime se.vruntime. If the task state changes within the detection time window, the I / O task transitions from a waiting state to a runnable state, and the virtual runtime se.vruntime increases by at or above the threshold within the detection time window, indicating that the task's cumulative runtime se.runtime increases significantly after the vCPU starts running, indicating that the task has obtained CPU resources for execution, the I / O task is successfully scheduled. If the task state remains unchanged within the detection time window, or the virtual runtime se.vruntime does not increase by at least the threshold within the detection time window, the I / O task scheduling fails.

[0113] In the ARMv8 architecture, the kernel stack size of each task is fixed at 8KB to ensure efficient task management. To facilitate quick access to task-related information, the thread_info structure is designed to be stored at the bottom of the task kernel stack. Figure 6 This is the Linux kernel stack layout diagram in this embodiment. Figure 6 As shown, since the kernel stack address is aligned to the 8KB stack size, the starting address of thread_info can be quickly calculated using the current kernel stack pointer (SP_EL1 register) through a bitwise AND operation. The calculation method is: SP_EL1&~(8KB-1). This operation accurately extracts the bottom address of the kernel stack and directly accesses the thread_info structure stored therein. By locating thread_info, the address of the task_struct structure associated with the task can be further obtained, supporting the efficient implementation of task scheduling and status monitoring. In a virtualized environment, the hypervisor obtains the guest virtual address (GVA) of thread_info, but it needs to be converted to the host virtual address (HVA) to correctly access the target data. Figure 7 This is a flowchart of obtaining the address of the task_struct structure in this embodiment. Figure 7 As shown, in this embodiment, the specific method of using the thread_info structure address to obtain the task_struct structure address is:

[0114] S701: GVA→GPA conversion

[0115] The guest virtual address GVA in the thread_info structure is converted to the guest physical address GPA (Guest Physical Address). This conversion belongs to Stage 1 address translation and is completed by the guest OS page table management. The specific process is as follows: the hypervisor first obtains the guest OS page table base address from the TTBRx_EL1 page table base address register, then converts this base address to the corresponding host virtual address HVA, and uses this HVA to access the guest OS page table. Then, by simulating the operation of the MMU, the GVA of the thread_info structure is converted to the GPA.

[0116] S702: GPA→HPA Conversion

[0117] The GPA of the thread_info structure is converted to the host physical address (HPA). This conversion belongs to Stage 2 address translation and is maintained by the hypervisor for the guest OS. The specific process is as follows: Before the virtual machine starts, the hypervisor allocates an address space for the guest OS and establishes a mapping relationship between the GPA and the HPA. The hypervisor can convert the GPA to the HPA using the base address and offset, without simulating the MMU address translation.

[0118] S703: HPA→HVA conversion

[0119] The Hypervisor uses address region division and offset calculation to convert the host physical address HPA of the thread_info structure into the host virtual address HVA, without the need for complex operations using the simulated MMU.

[0120] S704: Determine the task_struct structure HVA:

[0121] According to the host virtual address HVA of the thread_info structure and the address offset of the task_struct structure in the thread_info structure, the host virtual address HVA of the task_struct structure is determined, thereby achieving access to the task_struct structure.

[0122] In the Boosting scheduling mode of the present invention, the hypervisor also needs to determine whether an I / O task switch occurs on the target vCPU. To more accurately implement this determination, this embodiment detects whether an I / O task switch occurs based on the information in the thread_info structure and the task_struct structure. The specific method is as follows:

[0123] The hypervisor reads the thread_info structure and task_struct structure information of the Guest OS Linux within the predetermined detection time window, and extracts the task state, virtual runtime se.vruntime, and thread_info address from them. If the task state changes from running to blocked within the detection time window, the virtual runtime se.vruntime stops increasing and remains unchanged within the predetermined time, and the thread_info address changes, it indicates that the I / O task has switched. If any of the above conditions are not met, it indicates that the I / O task has not switched.

[0124] The judgment of successful I / O task scheduling and the judgment of I / O task switching can both be achieved by injecting interrupt status. Figure 8 This is a detection sequence diagram of the conventional scheduling mode in this embodiment. Figure 8 As shown, in the regular scheduling mode, the target vCPU waits for the scheduler to schedule it. When the target vCPU is running, it detects whether the I / O task is successfully scheduled within the detection time window. The detection process is as follows:

[0125] 1. After the target vCPU is scheduled to run by the scheduler, the Hypervisor starts detection within the detection time window.

[0126] 2. After the hypervisor injects a clock interrupt, it checks the task scheduling status and feeds the result into the binary counter of the I / O task and cancels the check. Regardless of the result, the target vCPU will continue to run.

[0127] 3. When the system clock interrupt is triggered again, the scheduler selects the appropriate vCPU to run according to the scheduling mechanism.

[0128] Figure 9 This is the detection timing diagram of the Boosting scheduling mode in this embodiment. Figure 9 As shown in the figure, in the Boosting scheduling mode, the vCPU preempts and runs. If no I / O task is scheduled to run within the monitoring time window, the scheduling status result is fed back as scheduling failure, and the target vCPU priority is immediately restored. If the I / O task is scheduled to run, the scheduling status result is fed back as scheduling success, and the target vCPU priority is maintained until the task switching state is detected.

[0129] Although the above describes the illustrative specific embodiments of the present invention to facilitate understanding of the present invention by those skilled in the art, it should be clear that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the appended claims, these changes are obvious, and all inventions and creations using the concepts of the present invention are protected.

Claims

1. A real-time I / O response method based on ARM microkernel Hypervisor, characterized in that: The following steps are involved: S1: The Hypervisor maintains a binary counter table for each vCPU, in which a scheduling mode flag and a binary scheduling status counter are maintained for each I / O task. When the scheduling mode flag is 0, the I / O task in the vCPU is in the normal scheduling mode. When the scheduling mode flag is 1, the I / O task in the vCPU is in the Boosting scheduling mode. The number of bits N in the scheduling status counter and the scheduling step size in different modes are set according to actual needs. The scheduling success adjustment step size in the normal scheduling mode is +α, and the scheduling failure adjustment step size is -β. The scheduling success adjustment step size in the Boosting scheduling mode is +β, and the scheduling failure adjustment step size is -α, where α>β>0. S2: When an external device triggers an I / O event, the hypervisor intercepts the event and determines the target vCPU to which the I / O task belongs. S3: The Hypervisor determines whether the target vCPU is in an idle state. If so, it proceeds to step S4; otherwise, it proceeds to step S5. S4: The hypervisor increases the priority of the target vCPU and preempts the running process. After the process is complete, the hypervisor restores the priority of the target vCPU. S5: The Hypervisor obtains the scheduling mode identifier of the target I / O task in the target vCPU and determines the scheduling state of the target vCPU according to the scheduling state identifier. If the target vCPU is in the normal scheduling mode, the process proceeds to step S6; otherwise, the process proceeds to step S7. S6: The hypervisor performs regular scheduling on the target vCPU, including the following steps: S6.1: The hypervisor adds the target vCPU to the scheduling queue and waits for scheduling by the scheduler; S6.2: After the target vCPU is running, the Hypervisor determines whether the target I / O task is successfully scheduled. If yes, it proceeds to step S6.3; otherwise, it proceeds to step S6.

4. S6.3: The hypervisor determines whether the scheduling status counter of the target I / O task in the target vCPU has reached the maximum value. If not, the process proceeds to step S6.4; otherwise, the process proceeds to step S6.

5. S6.4: If the target I / O task is successfully scheduled, the scheduling status counter is incremented by +α; otherwise, the scheduling status counter is incremented by -β. This scheduling is completed. S6.5: The hypervisor switches the target I / O task in the target vCPU from the normal scheduling mode to the boosting scheduling mode, setting the corresponding scheduling mode flag to 1, and then resets the scheduling state counter to 0. This scheduling is completed. S7: The Hypervisor performs Boosting scheduling on the target vCPU, including the following steps: S7.1: The hypervisor increases the priority of the target vCPU and preempts it. S7.2: The Hypervisor determines whether the target I / O task is successfully scheduled. If not, it proceeds to step S7.3; otherwise, it proceeds to step 7.

6. S7.3: Resume the running priority of the target vCPU and proceed to step S7.4; S7.4: The Hypervisor determines whether the scheduling status counter reaches the minimum value. If so, proceed to step S7.5; otherwise, proceed to step S7.9; S7.5: The Hypervisor switches the target I / O task in the target vCPU from the Boosting scheduling mode to the normal scheduling mode, i.e., sets the corresponding scheduling mode flag to 0, and then resets the scheduling status counter to 0; this scheduling ends; S7.6: The Hypervisor keeps the target I / O task in the target vCPU in the Boosting scheduling mode unchanged; S7.7: The Hypervisor determines whether an I / O task switch occurs in the target vCPU. If so, proceed to step S7.8; otherwise, return to step S7.6; S7.8: Resume the running priority of the target vCPU and proceed to step S7.9; S7.9: When the target I / O task is successfully scheduled, increment the scheduling status counter by +β; otherwise, increment the value of the scheduling status counter by -α; this scheduling ends.

2. The I / O real-time response method according to claim 1, characterized in that: The scheduling status counter is adjusted using an adaptive Boosting trigger adjustment mechanism. The specific method is as follows: For each vCPU, the Hypervisor maintains a Boosting success rate metric P_global, which represents the ratio of I / O tasks successfully executed by the vCPU in the Boosting scheduling mode. Set the upper limit upper and lower limit lower of the Boosting success rate metric P_global according to actual needs, and periodically judge the Boosting success rate metric P_global to adjust the setting of the scheduling status counter. The specific method is as follows: When P_global > upper, reduce the number of bits of the scheduling status counter or increase the value of the adjustment step parameter α to increase the Boosting trigger tendency; When lower < P_global ≤ upper, keep the current setting of the scheduling status counter unchanged; [[ID= 3. The I / O real-time response method according to claim 2, characterized in that: ​ 4. The I / O real-time response method according to claim 1, characterized in that: ​ After the vCPU starts running, the hypervisor reads the task_struct structure of the guest OS Linux within a predetermined detection time window and extracts key scheduling metrics for the I / O task, including the task state and virtual runtime se.vruntime. If the task state changes within the detection time window, the I / O task transitions from a waiting state to a runnable state, and the virtual runtime se.vruntime increases by at or above the threshold within the detection time window, indicating that the task's cumulative runtime se.runtime increases significantly after the vCPU starts running, indicating that the task has obtained CPU resources for execution, the I / O task is successfully scheduled. If the task state remains unchanged within the detection time window, or the virtual runtime se.vruntime does not increase by at least the threshold within the detection time window, the I / O task scheduling fails.

5. The I / O real-time response method according to claim 4, characterized in that: The address of the task_struct structure is determined by the following method: 1) Convert the client virtual address GVA of the thread_info structure to the client physical address GPA; 2) Convert the client physical address GPA of the thread_info structure to the host physical address HPA; 3) The hypervisor uses address region division and offset calculation to convert the host physical address HPA of the thread_info structure into the host virtual address HVA; 4) Determine the host virtual address HVA of the task_struct structure based on the host virtual address HVA of the thread_info structure and the address offset of the task_struct structure in the thread_info structure.

6. The I / O real-time response method according to claim 1, characterized in that: The method for determining whether the I / O task is switched is: The hypervisor reads the thread_info structure and task_struct structure information of the Guest OS Linux within the predetermined detection time window, and extracts the task state, virtual runtime se.vruntime, and thread_info address from them. If the task state changes from running to blocked within the detection time window, the virtual runtime se.vruntime stops increasing and remains unchanged within the predetermined time, and the thread_info address changes, it indicates that the I / O task has switched. If any of the above conditions are not met, it indicates that the I / O task has not switched.