CN116501447B - Xen-based hard real-time implementation system - Google Patents

Xen-based hard real-time implementation system Download PDF

Info

Publication number
CN116501447B
CN116501447B CN202310727515.0A CN202310727515A CN116501447B CN 116501447 B CN116501447 B CN 116501447B CN 202310727515 A CN202310727515 A CN 202310727515A CN 116501447 B CN116501447 B CN 116501447B
Authority
CN
China
Prior art keywords
real
virtual machine
time
scheduling
xen
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310727515.0A
Other languages
Chinese (zh)
Other versions
CN116501447A (en
Inventor
张云飞
申利飞
崔彦召
马帅
袁烨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kirin Software Co Ltd
Original Assignee
Kirin Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kirin Software Co Ltd filed Critical Kirin Software Co Ltd
Priority to CN202310727515.0A priority Critical patent/CN116501447B/en
Publication of CN116501447A publication Critical patent/CN116501447A/en
Application granted granted Critical
Publication of CN116501447B publication Critical patent/CN116501447B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5077Logical partitioning of resources; Management or configuration of virtualized resources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45591Monitoring or debugging support
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5011Pool
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention relates to a hard real-time implementation system based on Xen, comprising: the system comprises a first common domain virtual machine, a real-time domain virtual machine and a plurality of other common domain virtual machines, wherein the real-time domain virtual machine and the plurality of other common domain virtual machines are created based on the first common domain virtual machine; the virtual machine monitor is connected between the hardware and the virtual machine operating system; the real-time domain virtual machine is loaded with a hard real-time RTOS system; the first common domain virtual machine, other common domain virtual machines and the real-time domain virtual machine select tasks through a scheduling framework of the first common domain virtual machine, the other common domain virtual machines and the real-time domain virtual machine to execute on the VCPU to complete secondary scheduling, and then the virtual machine monitor Xen selects the VCPU to execute on a corresponding CPU according to a VCPU scheduling algorithm to complete primary scheduling. In the invention, in the actual service, a small amount of CPU is divided for real-time control, so that the virtual scene is not lost too much. But the real time domain real time is greatly enhanced. And the scheduling delay and the interruption delay of the real-time domain have little difference from those of the situation without the Hypervisor.

Description

Xen-based hard real-time implementation system
Technical Field
The invention relates to the technical field of virtualization real-time performance improvement, in particular to a hard real-time implementation system based on Xen.
Background
With the improvement of hardware capability, virtualization technology is increasingly widely applied. Wherein Xen is a popular virtualization software, and can run multiple virtual machines on one physical machine. The application scene mainly comprises: data center virtualization, virtual desktops, cloud scenarios, and the like. The general cloud scene mainly depends on a data center server, and more hardware resources including resources such as a CPU (Central processing Unit), a display card and a hard disk are virtualized, so that enterprises are helped to improve the utilization rate of the resources, reduce the cost and improve the flexibility and the reliability, and the enterprises are promoted to better adapt to challenges in the digital era. In this scenario, the requirement for virtualization is mainly flexible application, cost reduction and synergy, but the real-time performance of virtualization is not concerned too much. With the increase of services such as internet of things, intelligent manufacturing, automatic driving and the like, different requirements are also put on virtualization, which is called real-time virtualization. In this scenario we need some virtualization capability, but also pay attention to real-time performance. Taking the application of Xen on automotive electronics as an example, xen can be used to construct an autopilot system, integrating various sensors and control units together to achieve a highly automated driving experience, and also to construct automotive safety systems such as anti-collision systems, lane keeping systems, and adaptive cruise control systems, among others. In this scenario, it is apparent that we are more concerned about the real-time capability of Xen, i.e. whether the control system can react within a certain time, as this will directly affect the safety of the driver and passengers, rather than about how much resources can be virtualized by virtualization.
Xen can provide some real-time performance, but it has some drawbacks in terms of real-time. The following main points are:
scheduling delay: xen emulates a real physical CPU by VCPU (virtual CPU), and one physical CPU may correspond to a plurality of VCPUs. This is why it can emulate virtual machines far exceeding its own number of CPUs. However, this also causes a problem that multiple VCPUs share a physical CPU, so that the virtual machine where the VCPU is located cannot execute in time. Meanwhile, different VCPUs switch on the physical CPU, need to save the context of the current virtual machine, restore the context of the virtual machine that needs to be run, and so on. These operations all require a certain time, resulting in scheduling delays. In addition, the Xen scheduler runs in the hypervisor, not in the virtual machine. This means that the scheduling of virtual machines is affected by the hypervisor, potentially resulting in more scheduling delays. Particularly in high load situations, scheduling delays may be more pronounced when multiple virtual machines contend for the resources of the hypervisor.
Interrupt processing: the Xen interrupt handling mechanism is done in the virtual machine, which may lead to some interrupt handling delay. In particular, during the virtual interrupt injection process, xen wakes up the VCPU to which the interrupt is to be injected, and the interrupt corresponding function can be processed only after the corresponding VCPU starts to execute. However, the wake-up VCPU still needs to rely on the scheduling algorithm of Xen itself, which cannot ensure that the VCPU to which the interrupt is to be injected has the highest priority, and cannot ensure that the VCPU can preempt the CPU resource for execution. This will result in the response of the interrupt being delayed, with the delay time being dependent on when the VCPU into which the interrupt is injected is scheduled to run, which severely affects the real-time nature of the Guest OS interrupt response. In high load situations, interrupt handling delays may be more pronounced.
Time virtualization: xen uses a time virtualization technique to simulate physical time, which may introduce some error in some cases. This may affect the real-time performance of some applications that require high precision time stamping.
Disclosure of Invention
In order to solve the defects existing in the prior art, the invention provides a hard real-time implementation system based on Xen, which comprises:
the system comprises a first common domain virtual machine dom0, and one real-time domain virtual machine RTdom and a plurality of other common domain virtual machines domu which are created based on the first common domain virtual machine dom 0;
the virtual machine monitor Xen is connected among hardware, a first common domain virtual machine dom0, other common domain virtual machines domu and an operating system where a real-time domain virtual machine RTdom is located;
a hard real-time RTOS system is loaded on the real-time domain virtual machine RTdom;
the first general domain virtual machine dom0, other general domain virtual machines domu and the real-time domain virtual machine RTdom select tasks through a scheduling framework Scheduler of the first general domain virtual machine dom0 and the other general domain virtual machines domu to be executed on the VCPU to complete secondary scheduling, and then the virtual machine monitor Xen selects the VCPU according to a VCPU scheduling algorithm to be executed on a corresponding CPU to complete primary scheduling.
The virtual machine monitor Xen is provided with a common domain CPU pool and a real-time domain CPU pool which are isolated from each other;
the first common domain virtual machine dom0 and other common domain virtual machines domu share a common domain CPU pool and a set of hardware, and are used for processing the multi-virtualization service of the client;
the real time domain CPU pool is used for the real time domain virtual machine RTdom and is used for processing the real time control service.
The virtual machine monitor Xen builds a bind scheduling algorithm and a Crodit 2 scheduling algorithm through an interface provided by a scheduling framework Xen Scheduler thereof to realize primary scheduling, the bind scheduling algorithm is bound with a real-time domain CPU pool for use by the real-time domain CPU pool when the real-time domain CPU pool is created, and the Crodit 2 scheduling algorithm is bound with a common domain CPU pool for use by the common domain CPU pool when the common domain CPU pool is created.
The bind scheduling algorithm closes a scheduling timer driven by the physical clock timer when initializing, and simultaneously reserves a virtual clock timer.
The Credit2 scheduling algorithm provides a Credit value for each VCPU in the first common domain virtual machine dom0 and other common domain virtual machines domu, the Credit value is used for marking at least the time that the VCPU should run, the VCPU ready queues are arranged in descending order according to the number of Credit, and when each scheduling is performed, the VCPU executed last time is compared with the Credit value of the head VCPU, and more VCPUs with the rest Credit are selected to use CPU resources in the common domain CPU pool.
The bind scheduling algorithm maintains a queue for the VCPU in the real-time domain virtual machine RTdom based on the real-time domain CPU pool, and only one VCPU entity is reserved in the queue corresponding to each CPU.
And directly binding the interrupt required by the real-time domain virtual machine RTdom to the CPU in the real-time domain CPU pool by using the parameter setting interrupt route in the configuration file for creating the real-time domain virtual machine RTdom.
And adding an 'xen' keyword to a corresponding device node in a device tree of the first common domain virtual machine dom0, and mapping a physical address of the peripheral into a virtual address of the real-time domain virtual machine RTdom to enable the real-time domain virtual machine RTdom to acquire the control right of the peripheral.
The invention divides the Xen virtual machine into two types of a common domain and a real-time domain, wherein the common domain is used for completing the traditional virtualized service, and the real-time domain is used for only performing hard real-time control tasks. Based on the method, the exclusive control of the VCPU to the CPU is realized by dividing the CPU pool and bind scheduling, so that scheduling delay is eliminated, interrupt delay is reduced, and clock precision is improved. This is the basis for Xen implementation in hard real time. Meanwhile, interrupt redirection and equipment direct connection technologies are used in the real-time domain, so that time delay caused by real-time domain IO virtualization is eliminated, and the real-time performance of the real-time domain is further improved.
Drawings
Fig. 1: the invention relates to a logical framework diagram of a Xen-based hard real-time implementation system.
Fig. 2: the Xen-based hard real-time implementation system of the invention is a logic diagram of a bind scheduling algorithm in the system.
Detailed Description
In order to further understand the technical scheme and beneficial effects of the present invention, the technical scheme and beneficial effects thereof will be described in detail with reference to the accompanying drawings.
In order to solve the problem that Xen is insufficient in real-time performance in real-time virtualization scenes of services such as the Internet of things, intelligent manufacturing, automobile driving and the like. The Xen can meet the virtualization requirements of virtual resources and flexible configuration, and can also be qualified for processing emergency tasks. And the real-time performance of the system reaches the hard real-time standard. The present invention classifies the dom of Xen into two types, dom0 and RTdom, as shown in FIG. 1. Wherein dom0 is Xen common domain virtual machine, this type of virtual machine emphasizes resource virtualization and VCPU scheduling, and satisfies the requirement of service scene on virtualization. RTdom is a real-time domain virtual machine, a type that is intended to meet hard real-time requirements to handle real-time tasks. The normal domain dom can be based on the existing functionality of Xen. The improvement of the invention is mainly to create a real time domain RTdom. And the bind scheduling is used in RTdom, so that only one VCPU exists in the VCPU queue corresponding to the CPU, and therefore, no VCPU scheduling delay exists for RTdom. The corresponding interrupt processing can also be directly distributed to the target VCPU, so that interrupt delay caused by scheduling is further reduced. In this case, the physical clock in the client is equal to the virtual clock, ensuring the real-time performance of the virtual machine high precision time application in RTdom.
The Linux system loaded with the xen image becomes dom0 after startup. dom0 is a special virtual machine that is the first virtual machine to be started and has privileges to directly access physical hardware resources such as processors, memory, networks, disks, etc. through a secure interface provided by Xen through a driver itself. The virtual device, network, storage and other resources can be provided for other virtual machines through a back-end driver (back), and the other virtual machines use a front-end driver (front) to interact data with the back-end driver. Backend operates the actual hardware by invoking a system driver to respond to the front's request. dom0 is also responsible for managing other virtual machines in Xen systems, such as creating, deleting, starting and stopping virtual machines, etc. The dom0 performs virtual machine scheduling by the Credit2 algorithm. The design purpose of the algorithm is to enable each VCPU to occupy CPU resources more fairly, keep lower scheduling overhead, have global load balancing function, and provide better response sensitivity for Guest OS. By using the management function of dom0, a plurality of virtual machines based on fair scheduling and hardware multiplexing can be created through the algorithm so as to meet various virtualization demands of clients and maximally multiplex hardware resources of a CPU.
The Xen virtualization system includes Xen at the Hypervisor (virtual machine monitor) layer and an operating system at the client. Hypervisor is a generic term for virtual machine monitors, xen as used herein is one of the Hypervisor, represented by the middle box in FIG. 1, with the lower layer being Hardware Hardware and the upper layer being the guest operating systems dom0 and RTdom. The Scheduler in Xen is in fig. 1 "Xen Scheduler", which is responsible for scheduling the VCPUs of clients, called primary scheduling. Schedulers in clients such as dom0 and RTdom are "schedulers" in the client box of fig. 1, which are responsible for scheduling Task tasks in the client, referred to as secondary scheduling. The two schedulers are respectively at different layers and each schedules their own object.
To meet the real-time scenario requirement, we also need to create an RTdom. As shown in fig. 1, on the Xen platform, the Scheduler of the Guest OS and the Scheduler Xen Scheduler of the Xen themselves together form a two-level schedule, herein called a second-level schedule of the Guest OS to tasks, and called a first-level schedule of the Xen to VCPUs. The two-level scheduling model abstracts the execution behavior of tasks inside the Guest OS on the CPU, which is very suitable for analyzing whether the RTOS running on Xen still meets the real-time requirements of real-time tasks. The main body participating in the scheduling mainly comprises Task running in the guest OS, a scheduler of the guest OS, a VCPU and a scheduler of Xen. Under the two-stage scheduling framework, the Guest OS selects tasks according to a scheduling algorithm of the Guest OS to be executed on the VCPU, and then Xen selects the VCPU according to the VCPU scheduling algorithm to be executed on the CPU.
From the two-stage scheduling concept analyzed above, the scheduling delay of one system=the primary scheduling delay+the secondary scheduling delay. Therefore, both levels of scheduling must be hard and real-time to meet the requirement of the whole system for hard and real-time. However, the existing RTOS is quite large, and the hard real-time property of the secondary scheduling can be met by loading a hard real-time RTOS, so that the primary scheduling of xen is changed into the hard real-time scheduling. Thus, the two-stage scheduling consisting of the hard real-time RTOS and the hard real-time Xen is a hard real-time virtualization system. The focus of the present invention is on how to improve Xen so that it has hard real-time capabilities. First, in order to realize hard real-time, the virtual machine must monopolize hardware, and multiplexing cannot be performed. Thus, the real-time performance of the virtualization can be improved to the greatest extent.
Taking the ARMv8 architecture and Xen 4.15.4 version of virtualization software as an example, we do the following.
1. Creating a CPU pool
Two CPU pools are created in order to isolate the physical CPUs of the real and normal domains so that the two domains do not affect each other. It is assumed here that the system has a total of n+m CPUs, dom0 uses CPU Pool-0, including CPU0-CPU n-1, RTdom uses CPU Pool rtpool, including CPU n-CPU n+m. Pool-0 is used for multiple virtualization services for clients, multiple virtual machines can be created that share a CPU Pool and a set of hardware such as (Network Interface, UART, DSIK, etc.). rtpool is used only for guest real-time scenarios and can only be used for one virtual machine (RTdom). In practical cases, n is far greater than m, and even some scenarios only need one CPU (m=0) to complete the real-time control service.
2. bond scheduling implementation
Xen Scheduler is a Xen scheduling framework, and the invention constructs a bind scheduling algorithm by using an interface provided by the scheduling framework. When creating the CPU pool, the physical CPU is bound together with the scheduling algorithm. Pool-0 uses the Credit2 algorithm and rtpool uses the bind algorithm. As shown in FIG. 2, the bind schedule and Credit2 algorithm coexist in the Xen scheduler. The bind scheduling implementation is specifically as follows:
(1) Xen generates a clock interrupt through the arm's generictimer while also providing the system clock. The clock of Xen can be simply divided into a physical clock and a virtual clock, the virtual clock is normally equal to the physical clock plus an offset, but the clock offset is equal to 0 in bind scheduling, so the physical clock is the virtual clock at this time. The bind algorithm firstly closes the dispatching timer driven by the physical clock timer, so that the dispatching timer can not be frequently entered periodically, the RTOS system is ensured not to be interrupted, meanwhile, the virtual clock timer is reserved, so that the maintenance of the timer is not needed after the generation of the virtual clock timer interrupt by the genericity timer, and the clock interrupt is directly injected into the RTdom virtual machine to provide a dispatching clock for the RTOS system.
Thus, the clock is injected into the RTOS through the xen, so that an operating scheduling clock is provided for the RTOS, and a basic guarantee, namely the scheduling clock, is provided for the RTOS to operate.
(2) The scheduling algorithm maintains a scheduling queue for each physical CPU, so that each CPU selects VCPU from the own scheduling queue, scheduling of each CPU is performed in parallel, the condition that a plurality of CPUs wait for a global scheduling lock is avoided, and the CPU utilization rate is improved. The Credit2 algorithm provides a Credit value for each VCPU, the Credit value is used for identifying at least the time that the VCPU should run, the VCPU ready queues are also arranged in descending order according to the number of the Credit, and each time of scheduling, the CPU compares the VCPU executed last time with the Credit value of the VCPU at the head of the queue, and selects more VCPUs with the remaining Credit to use the CPU resource, so that each VCPU can use the CPU resource more fairly. The bind algorithm also maintains a VCPU queue for the CPU, but only one VCPU entity is reserved in the queue, so that the VCPU is equivalent to the CPU. The schedule timer has been turned off at bind schedule initialization, while VCPU queue initialization is completed. After the system normally operates, the CPU directly operates the VCPU entity in the queue without breaking the timer, and the CPU is not trapped into the scheduler of the Hypervisor by the client, so that the virtualization loss of Xen is greatly reduced. Thus, the scheduling delay problem of primary scheduling is solved.
3. Interrupt redirection
Under ARM64 architecture, the redistributor of gicv3 connects the dispatched interrupt to the target CPU, and we can directly bind the interrupt required by RTdom to the CPU in rtpool by setting interrupt route. And Xen also provides an interface that can be set directly using the "irqs= [ irq1, irq2, irq3 … … irqn ]" parameters in creating a configuration file for RTdom. Wherein the number in brackets is the interrupt number that needs to be bound to RTdom. After the interrupt occurs, it is first captured by the Hypervisor and then interrupt injection is performed. Unlike the previous, interrupts are injected directly into the target VCPU, and do not need to be stored in the VCPU's buffer until the target VCPU is scheduled for further processing. Since after steps 1, 2 this interrupt sent target VCPU must be the running VCPU. Thus, the problem of interrupt delay is solved.
4. passthrough device pass through
For the peripheral devices (such as Network Interface and UART) which need to be accessed by the RTdom, the device control right is transferred to the RTdom in a device pass-through mode (passthrough). The main implementation method is that corresponding equipment nodes in the equipment tree in the dom0 are added with 'xen' keywords. The physical address of the peripheral is mapped into the virtual address of RTdom using "iomem= [" START, NUM [ @ GFN ] ",.+ -.). Where the START parameter represents the starting physical address of the peripheral, NUM represents the number of 4K size pages to map, and GFN represents the starting memory address to map to the client. Xen establishes a page table mapping of client virtual addresses to real physical addresses for RTdom through the iomem parameter list, so that RTdom can directly access peripheral physical addresses through the page table without trapping in Xen.
And the interrupt redirection in the step 3 can be added to realize the direct connection of RTdom to hardware equipment. Therefore, the RTdom can directly control hardware without entering the Hypervisor layer every time when accessing the equipment, thereby greatly reducing the virtualization loss.
The invention has the following technical effects: the invention divides the Xen virtual machine into two types of a common domain and a real-time domain, wherein the common domain is used for completing the traditional virtualized service, and the real-time domain is used for only performing hard real-time control tasks. Based on the method, the exclusive control of the VCPU to the CPU is realized by dividing the CPU pool and bind scheduling, so that scheduling delay is eliminated, interrupt delay is reduced, and clock precision is improved. This is the basis for Xen implementation in hard real time. Meanwhile, interrupt redirection and equipment direct connection technologies are used in the real-time domain, so that time delay caused by real-time domain IO virtualization is eliminated, and the real-time performance of the real-time domain is further improved.
In the invention, in the actual service, only a small amount of CPU is divided for real-time control, and the virtual scene is not lost too much. But the real time domain real time is greatly enhanced. And the scheduling delay and the interruption delay of the real-time domain have little difference from those of the situation without the Hypervisor.
Although the present invention has been described with reference to the above preferred embodiments, it should be understood that the present invention is not limited to the above embodiments, and that various changes and modifications can be made herein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (4)

1. A Xen-based hard real-time implementation system comprising:
the system comprises a first common domain virtual machine dom0, and one real-time domain virtual machine RTdom and a plurality of other common domain virtual machines domu which are created based on the first common domain virtual machine dom 0;
the virtual machine monitor Xen is connected among hardware, a first common domain virtual machine dom0, other common domain virtual machines domu and an operating system where a real-time domain virtual machine RTdom is located;
a hard real-time RTOS system is loaded on the real-time domain virtual machine RTdom;
selecting tasks by a first common domain virtual machine dom0, other common domain virtual machines domu and a real-time domain virtual machine RTdom through a scheduling framework Scheduler of the first common domain virtual machine domu and the other common domain virtual machines domu to be executed on a VCPU to complete secondary scheduling, and then selecting the VCPU by a virtual machine monitor Xen according to a VCPU scheduling algorithm to be executed on a corresponding CPU to complete primary scheduling;
the virtual machine monitor Xen is provided with a common domain CPU pool and a real-time domain CPU pool which are isolated from each other;
the first common domain virtual machine dom0 and other common domain virtual machines domu share a common domain CPU pool and a set of hardware, and are used for processing the multi-virtualization service of the client;
the real-time domain CPU pool is used for the real-time domain virtual machine RTdom and is used for processing the real-time control service;
the virtual machine monitor Xen constructs a bind scheduling algorithm and a Crodit 2 scheduling algorithm through an interface provided by a scheduling framework Xen Scheduler thereof so as to realize primary scheduling, the bind scheduling algorithm is bound with a real-time domain CPU pool for use by the real-time domain CPU pool when the real-time domain CPU pool is created, and the Crodit 2 scheduling algorithm is bound with a common domain CPU pool for use by the common domain CPU pool when the common domain CPU pool is created;
when the bind scheduling algorithm is initialized, closing a scheduling timer driven by a physical clock timer, and simultaneously reserving a virtual clock timer;
the bind scheduling algorithm maintains a queue for the VCPUs in the real-time domain virtual machine RTdom based on the real-time domain CPU pool, and only one VCPU entity is reserved in the queue corresponding to each CPU.
2. The Xen-based hard real-time implementation system of claim 1, wherein the Credit2 scheduling algorithm provides a Credit value for each VCPU in the first domain virtual machine dom0 and other domain virtual machines domu for identifying at least a time that the VCPU should run, the VCPU ready queues are arranged in descending order according to how many credits, and each time scheduling, the last executed VCPU is compared with the Credit value of the first VCPU, and more VCPUs than the remaining credits are selected to use CPU resources in the domain CPU pool.
3. The Xen-based hard real-time implementation system of claim 1, wherein creating the configuration file of the real-time domain virtual machine RTdom directly binds interrupts required by the real-time domain virtual machine RTdom to CPUs in the real-time domain CPU pool by setting interrupt routing using parameters.
4. The Xen-based hard real-time implementation system according to claim 1, wherein the real-time domain virtual machine RTdom obtains the control right of the peripheral device by adding an "Xen, passthrough" key to a corresponding device node in a device tree of the first normal domain virtual machine dom0, and mapping the physical address of the peripheral device to the virtual address of the real-time domain virtual machine RTdom.
CN202310727515.0A 2023-06-20 2023-06-20 Xen-based hard real-time implementation system Active CN116501447B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310727515.0A CN116501447B (en) 2023-06-20 2023-06-20 Xen-based hard real-time implementation system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310727515.0A CN116501447B (en) 2023-06-20 2023-06-20 Xen-based hard real-time implementation system

Publications (2)

Publication Number Publication Date
CN116501447A CN116501447A (en) 2023-07-28
CN116501447B true CN116501447B (en) 2023-09-26

Family

ID=87316797

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310727515.0A Active CN116501447B (en) 2023-06-20 2023-06-20 Xen-based hard real-time implementation system

Country Status (1)

Country Link
CN (1) CN116501447B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117453352B (en) * 2023-12-21 2024-04-09 麒麟软件有限公司 Equipment straight-through method under Xen

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2001035209A2 (en) * 1999-11-09 2001-05-17 University Of Victoria Innovation And Development Corporation Modified move to rear list system and methods for thread scheduling
CN101512359A (en) * 2006-07-10 2009-08-19 阿斯特瑞昂公司 System and method for performing processing in a testing system
CN101894047A (en) * 2010-06-24 2010-11-24 北京航空航天大学 Kernel virtual machine scheduling policy-based implementation method
CN102012835A (en) * 2010-12-22 2011-04-13 北京航空航天大学 Virtual central processing unit (CPU) scheduling method capable of supporting software real-time application
CN102193853A (en) * 2010-03-12 2011-09-21 三星电子株式会社 Virtual machine monitor and scheduling method thereof
CN102857363A (en) * 2012-05-04 2013-01-02 运软网络科技(上海)有限公司 Automatic computing system and method for virtual networking
CN113419820A (en) * 2021-07-02 2021-09-21 广州市品高软件股份有限公司 Deployment method of real-time virtual machine and cloud platform

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3470980A1 (en) * 2017-10-10 2019-04-17 OpenSynergy GmbH Control unit, method for operating a control unit, method for configuring a virtualization system of a control unit

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2001035209A2 (en) * 1999-11-09 2001-05-17 University Of Victoria Innovation And Development Corporation Modified move to rear list system and methods for thread scheduling
CN101512359A (en) * 2006-07-10 2009-08-19 阿斯特瑞昂公司 System and method for performing processing in a testing system
CN102193853A (en) * 2010-03-12 2011-09-21 三星电子株式会社 Virtual machine monitor and scheduling method thereof
CN101894047A (en) * 2010-06-24 2010-11-24 北京航空航天大学 Kernel virtual machine scheduling policy-based implementation method
CN102012835A (en) * 2010-12-22 2011-04-13 北京航空航天大学 Virtual central processing unit (CPU) scheduling method capable of supporting software real-time application
CN102857363A (en) * 2012-05-04 2013-01-02 运软网络科技(上海)有限公司 Automatic computing system and method for virtual networking
CN113419820A (en) * 2021-07-02 2021-09-21 广州市品高软件股份有限公司 Deployment method of real-time virtual machine and cloud platform

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
Xen的I/O虚拟化性能分析与优化;刘佩等;《计算机系统应用》;第第 26 卷卷(第第 7 期期);10-16 *
一种基于资源预分配的虚拟机软实时调度方法;丁晓波;马中;戴新发;黄伟华;;计算机工程与科学(第05期);全文 *
改进遗传算法在电网调度自动化系统中的应用;董如来;章书剑;;安徽电力(第01期);全文 *

Also Published As

Publication number Publication date
CN116501447A (en) 2023-07-28

Similar Documents

Publication Publication Date Title
US7757231B2 (en) System and method to deprivilege components of a virtual machine monitor
EP3039540B1 (en) Virtual machine monitor configured to support latency sensitive virtual machines
CN106844007B (en) Virtualization method and system based on spatial multiplexing
US9019826B2 (en) Hierarchical allocation of network bandwidth for quality of service
US7797699B2 (en) Method and apparatus for scheduling virtual machine access to shared resources
EP1997021B1 (en) Framework for domain-specific run-time environment acceleration using virtualization technology
EP1628214B1 (en) Systems and methods for implementing an operating system in a virtual machine environment
JP4882005B2 (en) Optimized interrupt transmission in a virtual environment
US8918784B1 (en) Providing service quality levels through CPU scheduling
US9239765B2 (en) Application triggered state migration via hypervisor
US20050251806A1 (en) Enhancement of real-time operating system functionality using a hypervisor
US11150951B2 (en) Releasable resource based preemptive scheduling
US10521257B2 (en) Method, non-transitory computer readable recording medium, and apparatus for scheduling virtual machine monitor
US20120291027A1 (en) Apparatus and method for managing hypercalls in a hypervisor and the hypervisor thereof
CN116501447B (en) Xen-based hard real-time implementation system
WO2007024444A1 (en) Method and apparatus for supporting universal serial bus devices in a virtualized environment
CN114138422B (en) Scalable NVMe storage virtualization method and system
WO2021238702A1 (en) Task scheduling method, computing device and storage medium
Golchin et al. Boomerang: Real-time i/o meets legacy systems
Xia et al. Hypervisor mechanisms to manage FPGA reconfigurable accelerators
US11934890B2 (en) Opportunistic exclusive affinity for threads in a virtualized computing system
US8424013B1 (en) Methods and systems for handling interrupts across software instances and context switching between instances having interrupt service routine registered to handle the interrupt
CN114281529A (en) Distributed virtualized client operating system scheduling optimization method, system and terminal
US20230229473A1 (en) Adaptive idling of virtual central processing unit
Bollella Slotted priorities: supporting real-time computing within general-purpose operating systems

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant