Task scheduling system and method for on-chip heterogeneous multiprocessor system based on BPF
By using BPF bytecode and virtual machine technology in an on-chip heterogeneous multiprocessor system, the calculation tasks are scheduled to be executed in real-time operating system, which solves the problems of insufficient resource utilization and high design costs, and realizes efficient utilization of processor resources and performance improvement.
Patent Information
- Application Number
- CN202310617362.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-29
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2043-05-29
AI Technical Summary
Existing on-chip heterogeneous multiprocessor systems are difficult to coordinately manage Cortex-A and Cortex-M processor resources, resulting in insufficient utilization of processor resources, high design costs, and difficult to transplant scheduling algorithms.
A BPF-based task scheduling system is adopted, and BPF bytecode is transmitted between Linux and the real-time operating system through the scheduling module, and a BPF virtual machine is used to perform computing tasks in the real-time operating system to achieve load balancing and maximum resource utilization.
The computing tasks of Cortex-A and Cortex-M processors have been parallelized, which improves system performance, reduces the CPU usage of Cortex-A processors, makes full use of the computing power of the real-time operating system, and significantly improves the computing throughput rate. and system performance.
Smart Images

Figure CN119045959A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a technology in the field of computer processing, in particular to a task scheduling system and method for a heterogeneous multi-processor system on a chip based on a Berkeley Packet Filter (BPF). Background Art
[0002] Homogeneous multiprocessors on a chip usually integrate multiple general-purpose processors (CPUs) of the same architecture, while the newly launched heterogeneous multiprocessors on a chip based on Arm Cortex technology in recent years integrate general-purpose processors of two different architectures, Arm Cortex-A and Cortex-M, at the same time, which have unique advantages in improving system throughput and execution rate. Existing hardware and software architectures based on heterogeneous multiprocessors on a chip find it difficult to manage processor resources under two operating systems at the same time, and general scheduling algorithms often focus on a single system and cannot coordinate remote processor resources. Although the open source asymmetric multiprocessing framework (OpenAMP) and remote processor messaging protocol (RPMsg) provide support for inter-core communication of heterogeneous multiprocessors on a chip, in actual application scenarios, the two operating systems run independently, and the resources are isolated from each other and cannot be managed collaboratively. Secondly, the existing on-chip heterogeneous multi-processor scheduling methods focus on how to program computing tasks to different GPUs or DSPs to reduce the load of general-purpose processors, but this often requires additional hardware resources and design costs, and requires programmers to program according to the specifications of GPUs or DSPs. It is also difficult to port the code to other system platforms. In addition, there are great differences between the two operating systems, including instruction sets, compiler systems, and middleware software, which also brings difficulties to the porting of scheduling algorithms. Due to these limitations, the scheduling of the two systems cannot be synchronized, so that at a certain moment, the general-purpose operating system (such as Linux) may be overloaded and unable to process user requests in time, but the real-time operating system is still idle or underloaded, doing nothing, resulting in the processor, as the most valuable resource, not being coordinated and fully utilized.
[0003] In general, these existing on-chip homogeneous multi-processor or on-chip heterogeneous multi-processor system solutions have some limitations in processor resource utilization, design cost or operating system, and cannot fully utilize the Cortex-A and Cortex-M processor resources of the on-chip heterogeneous multi-processor system based on ARMCortex technology. Summary of the invention
[0004] In view of the limitation that the existing Cortex-M does not support Linux and the defect that computing tasks need to be deployed to DSP in advance according to DSP programming specifications, which leads to additional development workload, the present invention proposes a task scheduling system and method for on-chip heterogeneous multi-processor system based on BPF, which achieves a certain load balancing and maximizes the utilization of the system's on-chip heterogeneous multi-processor resources without increasing the hardware design cost.
[0005] The present invention is achieved through the following technical solutions:
[0006] The present invention relates to a task scheduling system of a heterogeneous multi-processor operating system on a chip, comprising: a scheduling module and a sending module located at a general operating system Linux end, a receiving module located at a real-time operating system end, a BPF bytecode parsing and execution module and a computing module, wherein: the scheduling module makes a scheduling decision for a computing task according to a predefined scheduling strategy and system operation status information, and schedules the computing task to the real-time operating system end for execution; the sending module sends the BPF bytecode in an ELF file format to the real-time operating system end according to an instruction of the scheduling module, and waits for receiving an execution result returned by the real-time operating system end; the receiving module for monitoring BPF requests receives the BPF bytecode file from the Linux end according to an inter-core communication mechanism, sends the BPF bytecode parsing and execution module after receiving the BPF bytecode file, waits for the calculation result and sends it back to the Linux end; the BPF bytecode parsing and execution module performs parsing and execution processing of the BPF bytecode according to the BPF file received by the receiving module, calls the computing module to process the computing task, obtains the execution result and returns it to the receiving module; the computing module executes and processes the computing task according to extended BPF helper function list information, and returns the calculation result to the BPF bytecode parsing and execution module.
[0007] The scheduling module is responsible for loading the executable file containing the BPF bytecode of the computing task into the memory, making scheduling decisions based on the scheduling conditions, and deploying the BPF file to the real-time operating system for processing through the sending module when the scheduling conditions are met; otherwise, the scheduling module will not remotely deploy the task, and the computing task will run normally on the Linux side according to the original code logic.
[0008] The scheduling conditions include: when the Linux system is in a high-load state, a scheduling request can be executed to reduce the CPU occupancy of the Linux side; when the Linux system is in an idle or normal state, the application can actively initiate a scheduling request to the scheduling module to reserve more CPU bandwidth for Linux or reduce power consumption; the scheduling request does not affect the stability and reliability of the real-time operating system itself. When a high-priority real-time task appears in the real-time operating system, the currently scheduled computing task will be suspended and wait for rescheduling and execution.
[0009] The scheduling conditions are formulated and expanded according to actual application scenarios and user needs.
[0010] The deployment means that the scheduling module will decide whether to schedule the computing task to run on the remote Cortex-M processor according to the predetermined configuration parameters (for example, whether to prioritize the deployment of tasks to the remote processor) or the system status (for example, the Linux system has reached or exceeded 80% of the processor occupancy rate); when the scheduling conditions are met, the scheduling module will schedule the computing task to run on the real-time operating system where the remote Cortex-M processor is located. The executable file (ELF format) containing the BPF bytecode is transmitted by the sending module to the real-time operating system for subsequent processing. At the same time, the Linux system releases the processor resources and waits for the processing results, so that the Cortex-A processor on the Linux side takes up less time and has more bandwidth to process other tasks, while the Cortex-M processor on the real-time operating system side is fully utilized to process these deployed tasks, so that the processor resources of the entire system are more effectively utilized.
[0011] The receiving module uses the inter-core communication mechanism between Cortex-A and Cortex-M and the API interface provided by OpenAMP to listen to the BPF request on the virtual serial port device, and packages the data and sends it to the BPF bytecode parsing and execution module for subsequent processing.
[0012] The BPF bytecode parsing and execution module parses and executes BPF bytecode on the real-time operating system side based on lightweight BPF virtual machine technology, that is, verifies and parses the BPF bytecode sent from the host processor, executes BPF instructions, and can perform more computing tasks through the extended computing module (ERHF) to achieve an effect similar to a remote procedure call (RPC). The module includes: a BPF bytecode verifier, a BPF bytecode parser and a BPF virtual machine.
[0013] The BPF virtual machine includes: a 512KB stack and 11 registers. The function call uses only 5 parameters (registers r1-r5), register r0 is used to store the return value of the function, and the PC register points to the BPF bytecode currently being executed. After receiving the BPF bytecode data from the BPF request listener, the BPF bytecode verifier checks the integrity of the executable file containing the BPF bytecode. When the check is successful, the BPF bytecode parser will parse and execute each BPF bytecode in turn. When the check fails or a parsing error occurs, the error code will be returned to the Linux side, indicating that the scheduling execution failed, corrective measures need to be taken, or the original Linux scheduling needs to be executed. During the instruction parsing process, when the current BPF bytecode is a normal BPF instruction, such as a memory access instruction, it will be executed normally. After execution, the next instruction will be parsed and executed. When the current BPF bytecode is an E-RHF instruction, it will enter the calculation module (ERHF), run the corresponding custom processing function, and complete the calculation task. When the execution of the calculation module is completed, it will return from E-RHF to the BPF bytecode where the jump occurred and continue execution. When the current BPF bytecode is the end instruction, it will exit the execution module and return the calculation result to the Linux end.
[0014] The computing module described, based on the extended remote helper function (E-RHF), extends the BPF auxiliary function under Linux from the original predefined Linux kernel auxiliary function to any custom function, thereby greatly enriching the supported functional range and expanding the interface of various functions, so that E-RHF can truly serve as a computing module on the real-time operating system side. E-RHF is defined and implemented on the real-time operating system side, and the code of the computing task, such as cumulative summation, matrix multiplication, etc. in the C code or function, is transplanted or implemented in the real-time operating system side. These relatively complex computing codes, and these remote BPF auxiliary functions are called in the BPF bytecode. This is equivalent to establishing a mapping of remote function calls from Linux to the real-time operating system side, which not only solves the limitations of the BPF instruction set, so that the BPF extended function has richer function processing capabilities, but also further improves the execution efficiency of these computing codes.
[0015] The present invention relates to a task scheduling method for an on-chip heterogeneous multi-processor system based on the above system, which uses BPF virtual machine technology and BPF bytecode as a transmission carrier between the general operating system Linux and the real-time operating system of the on-chip heterogeneous multi-processor, and schedules part of the computing tasks of the application program in the general operating system Linux to the real-time operating system in real time and executes them in its BPF instruction parsing and BPF virtual machine.
[0016] The BPF virtual machine technology refers to: pre-analyzing the type of application to be processed, identifying computing tasks or functions that are suitable for scheduling to a real-time operating system and can be compiled into BPF bytecode, pre-processing and compiling them into BPF bytecode, and generating an executable file containing BPF bytecode; then adding the calling logic for the BPF bytecode in the application to be processed and defining the scheduling trigger conditions of the scheduling module; finally, in the execution stage, the scheduling module schedules the executable file containing the BPF bytecode to the real-time operating system for execution, and the BPF bytecode parsing and execution module and the computing module on the real-time operating system side perform the parsing and execution of BPF instructions and computing tasks respectively.
[0017] The analysis and identification refers to: selecting some non-human-computer interaction or running time-insensitive background service programs in the Linux system as the programs to be processed, and further selecting some of the pure computing tasks with relatively simple logic but consuming processors as the targets of analysis and processing. Such computing tasks or functions include but are not limited to cumulative summation, matrix multiplication, etc.
[0018] The preprocessing refers to: generating a BPF bytecode file, transplanting or implementing a computing task function in the E-RHF of the real-time operating system, and adding a scheduling request call to the original Linux application, specifically including:
[0019] ① Split and encapsulate the calculation-related code, compile it into BPF bytecode using LLVM / Clang tools, and generate an executable file (Executable and Linkable Format, ELF).
[0020] ② Port or implement relatively complex computing task functions in the real-time operating system, add them to the E-RHF module, call these remote BPF auxiliary functions in the BPF bytecode, and thus establish a one-to-one remote function call.
[0021] ③Add a scheduling request call in the original code on the Linux side and generate a unique request number to distinguish the request.
[0022] The computing tasks or functions include but are not limited to accumulation and summation, matrix multiplication, etc.
[0023] The executable file introduces an extended remote help function E-RHF, expands the supported functions from the original predefined Linux kernel help functions to any custom functions, transplants or implements the compiled computing tasks or functions on the real-time operating system side, and calls the corresponding remote BPF function in the BPF bytecode, that is, establishes a mapping relationship between remote function calls from the general operating system to the real-time operating system.
[0024] The above-mentioned addition complies with the operation logic of the original application program, and can schedule the BPF bytecode through the scheduling module when the corresponding scheduling triggering conditions are met.
[0025] The scheduling triggering conditions include, but are not limited to, configuring through environment variables, detecting system processor usage, etc.
[0026] The real-time scheduling means that when a computing task meets the scheduling trigger conditions, its corresponding executable file is sent to the real-time operating system end through the sending module and processed by the real-time operating system, and the general operating system Linux end releases processor resources and waits for processing results; when the computing task does not meet the scheduling trigger conditions, it runs normally on the general operating system Linux according to the original logic.
[0027] The real-time operating system processing means that when the receiving module receives the executable file, the BPF bytecode is output to the BPF bytecode parsing and execution module. After the BPF bytecode parsing and execution module checks the integrity of the executable file containing the BPF bytecode, each BPF bytecode is parsed and executed in sequence.
[0028] The parsing means: according to the BPF bytecode instruction set, the BPF bytecode is interpreted as the corresponding execution statement and executed. The extended remote help function E-RHF instruction runs the corresponding custom processing function through the computing module, completes the computing task, and returns to the BPF bytecode when the jump occurs after the execution is completed. Technical Effects
[0029] The present invention uses BPF bytecode as a transmission carrier between the Cortex-A and Cortex-M processors. Under the action of the scheduling module, the application program schedules part of the computing tasks to be executed on the Cortex-M processor, thereby realizing the parallelization of the computing tasks of the Cortex-A and Cortex-M processors, and the E-RHF module of the real-time operating system can efficiently complete the computing tasks. Compared with the prior art, the present invention utilizes existing hardware resources, makes little change to the original application program, and does not change the original program running logic when the scheduling condition is not triggered. The computing tasks or function codes of the general operating system Linux end can be relatively easily ported to the real-time operating system, and can make full use of the original scheduling algorithm of the real-time operating system. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 It is a schematic diagram of the system of the present invention;
[0031] Figure 2 It is a flow chart of the present invention;
[0032] Figure 3 It is a schematic diagram of the source file preprocessing process in the embodiment;
[0033] Figure 4 It is a schematic diagram of the implementation and execution of the ERHF instruction in the embodiment;
[0034] Figure 5 It is a schematic diagram for comparing the performance improvement of the embodiment in a single-core case;
[0035] Figure 6 It is a schematic diagram for comparing the performance improvements of the embodiments when the system is under high load. DETAILED DESCRIPTION
[0036] like Figure 1 As shown, this embodiment relates to a task scheduling system for a heterogeneous multi-processor system on a chip based on BPF, including: a scheduling module and a sending module located in the general operating system Linux part, and a BPF bytecode parsing and execution module, a calculation module and a receiving module located in the real-time operating system part. In this embodiment, the Cortex-A processor serves as a local processor and the Cortex-M processor serves as a remote processor. Based on various basic software and hardware components, the corresponding virtual devices, such as virtual serial port devices, are accessed on the Linux and real-time operating system ends respectively, and the message passing and content sharing between heterogeneous processors are completed through the remote processor message passing protocol.
[0037] like Figure 2 As shown in the figure, the on-chip heterogeneous multi-processor system task scheduling method based on the above system in this embodiment first Figure 1 The sample application in is analyzed, preprocessed and compiled into BPF bytecode. Then the sample application is scheduled and processed by the scheduling module, and the sending module sends the BPF bytecode to the real-time operating system through the virtual device and remote processor message passing protocol. The real-time operating system then processes it, and the Linux side releases processor resources and waits for the processing results. On the real-time operating system side, when the receiving module receives the BPF bytecode from Linux, it is handed over to the BPF instruction parsing and execution module for corresponding parsing, and the calculation module performs related computing task operations. After processing, the results are returned to the Linux side, which specifically includes the following steps:
[0038] Step 1) Analyze the application type: The instruction set of the BPF virtual machine currently supports basic arithmetic, memory access, and jump instructions. Combining the capabilities of the BPF virtual machine and the real-time operating system, a portion of pure computing tasks with relatively simple logic but consuming processors will be used as the target of analysis and processing. Then, considering the certain delay that will inevitably be caused by the deployment of tasks to the real-time operating system, including inter-core transmission, instruction parsing and execution, remote call processing, and the performance differences between the Cortex-A and Cortex-M processors, this method is more suitable for some non-human-computer interaction types or some background service tasks that are not sensitive to running time.
[0039] Step 2) Preprocess the application source file and generate BPF bytecode: Through step 1), the program tasks are analyzed and preprocessed to identify calculation-related tasks, such as cumulative summation, matrix multiplication, and other C language codes or functions, and then these calculation-related codes are re-segmented and packaged, and the code parts that need to be scheduled and redeployed are compiled into BPF bytecode using LLVM / Clang tools, and finally an executable file (Executable and Linkable Format, ELF) is generated. In addition, the call to BPF bytecode is added to the calling process of the original code, and the corresponding trigger conditions of the scheduling module are defined (such as through environment variable configuration or detection of system processor usage) to ensure that these modifications comply with the original program running logic, and that the scheduling module can schedule the BPF bytecode to run on the real-time operating system when the corresponding conditions are met. The whole process is as follows: Figure 3 shown.
[0040] Step 3) Define and use the extended remote helper function E-RHF: Based on the concept of BPF helper function, the extended remote helper function E-RHF is introduced as a computing module, which extends the BPF helper function from the original predefined Linux kernel helper function to any custom function. The extended remote helper function E-RHF converts the computing tasks identified in step 2), such as cumulative summation, matrix multiplication, and other C language codes or functions, into Figure 4 As shown, these relatively complex computational codes are ported or implemented on the real-time operating system side, and these remote BPF functions are called in the BPF code.
[0041] Step 4) Scheduling of computing tasks on the Linux side. After the offline phase of packaging and compiling computing tasks is completed, when the sample program is running, the scheduling module decides whether to deploy the computing tasks to the remote Cortex-M processor according to the configuration parameters (such as whether to deploy them to the remote processor first) or the system status (such as the processor occupancy rate of the Linux system has reached or exceeded 80%). When the above scheduling conditions are not met, the sample program will run normally on the Linux side according to the original code logic, such as Figure 2 shown.
[0042] Step 5) After the scheduling module in step 4) redeploys the computing task, the sending module sends the BPF bytecode file to the real-time operating system through the virtual device and remote processor messaging protocol, which is then processed by the real-time operating system. The Linux side releases the processor resources and waits for the processing results.
[0043] Step 6) When the BPF request listener of the receiving module of the real-time operating system receives the BPF bytecode data from the general operating system, it sends it to the BPF bytecode parsing and execution module (BPF virtual machine).
[0044] Step 7) The BPF virtual machine on the real-time operating system side checks whether the BPF bytecode in ELF format is correct. If the check is successful, each BPF bytecode will be parsed in order: for ordinary BPF instructions, it will be executed directly, and the next instruction will be parsed after completion; for the extended remote helper function E-RHF instruction, it will enter the calculation module E-RHF to run the corresponding calculation task function (that is, the transplanted or re-implemented C language code or function such as cumulative summation, matrix multiplication, etc.), thereby achieving an effect similar to a remote system call, such as Figure 4 As shown. When the E-RHF computing task function is executed, it will return to the BPF bytecode where the jump occurred and continue to parse the next instruction. When the end instruction is encountered, the BPF virtual machine will exit and the previously obtained calculation results will be returned to the Linux end through the virtual device and remote processor message passing protocol.
[0045] After specific practical experiments, the invention is deployed on an on-chip heterogeneous multi-processor embedded platform and the running performance data of some typical computing programs are measured, and the performance differences of the scheduling method of the ordinary Linux system and the scheduling method of the present invention in these programs are compared. The embodiment takes matrix calculation and cyclic redundancy check (CRC) calculation as example programs, and uses the above-mentioned implementation method to enable the example program to determine whether the test case runs on the Linux system or the real-time operating system according to the configuration parameters or the system load status, and compares the key performance indicator of the number of iterations per second under various use cases. The embodiment selects STM32MP157 as the hardware reference platform, using dual ArmCortex-A7 processors (operating frequency 800 MHz) and single Cortex-M4 processor (operating frequency 209 MHz) architecture. The software operating system is the Linux (Yocto+Kernel 5.4.31) system running on the Cortex-A7 processor and the Tencent Internet of Things terminal operating system (TencentOS tiny) running on the Cortex-M4 processor.
[0046] Single-core performance comparison: CRC test case 1 runs a single CRC test program under the Linux system, records the corresponding running time, and converts it into the number of iterations per second. CRC test case 1 uses the existing Linux scheduling technology, and does not utilize the full computing power of the Linux system's processor. When the system is idle, it only runs on a single Cortex-A7. In contrast, CRC test case 2 will run a CRC test program in the Linux system and the real-time operating system respectively through computational parallelism according to the scheduling method of the present invention, so that the computing power of a single Cortex-A7 and a single Cortex-M4 can be utilized at the same time.
[0047] By recording and comparing the results of the two test cases at different iteration times (Table 1), the number of iterations per second of the CRC test case 2 of the present invention is increased by about 24% compared with the conventional CRC test case 1. Figure 5 shown.
[0048] Table 1 Comparison of CRC test case results (single core)
[0049] The results of matrix calculation test cases 1 and 2 (as shown in Table 2) also reached similar conclusions. Test case 1 runs a single matrix test program under the Linux system. Test case 2 runs a matrix test program under the Linux system and the real-time operating system at the same time according to the method of the present invention. As the number of test cycles increases, the impact of the inter-core transmission overhead gradually decreases. With the help of the present invention, the number of iterations per second is increased by 20% to 25% compared with test case 1. Figure 5 shown.
[0050] Table 2 Comparison of matrix calculation test case results (single core)
[0051] Overall performance comparison under high load: Improving the overall computing performance of the system under high load is also one of the main application scenarios of the present invention. To evaluate the processor integer computing performance of a multi-processor system under high load, it is necessary to run two or more test programs to put the system in a high load state, record the corresponding running time, and compare the number of iterations per second under different test cases.
[0052] Matrix test case 3 runs two matrix test programs under the Linux system, records the corresponding running time, and converts it into the number of iterations per second. Under the existing Linux scheduling technology, this test case will run on two Cortex-A7s at the same time, causing the Linux system to enter a high-load state. Of course, in this scenario, the Cortex-M4 does not participate in the calculation and is still in an idle state. Matrix test case 4 runs two matrix test programs under the Linux system according to the method of the present invention, and simultaneously schedules one matrix test program to run on a real-time operating system, so that the computing power of two Cortex-A7s and a single Cortex-M4 can be utilized at the same time. By recording and comparing the results of the two groups of test cases at different numbers of iterations (Table 3), the number of iterations per second of the matrix test case 4 using the present invention is increased by about 12% compared to the conventional matrix test case 3. Figure 6 As shown, the present invention provides about 12% additional integer computing power for the entire Linux system. In addition, as the number of test cycles increases, the impact of inter-core transmission overhead and program startup time consumption gradually decreases, and the calculation results gradually tend to be stable.
[0053] Similar conclusions were obtained in CRC test cases 3 and 4, such as Figure 6 In general, in the above matrix and CRC test cases, the present invention significantly improves the computing performance of a single core (about 24%) and the entire system (about 12%) by computing parallelism compared to the common Linux scheduling method.
[0054] Table 3 Comparison of matrix calculation test case results (high load)
[0055] In summary, the experimental results of the embodiments show that the present invention can improve the computing throughput and system performance of the entire platform through computational parallelism, provide a computing power equivalent to 24% of a single Cortex-A7 processor for a single computing task, and reduce the processor occupancy of the general operating system Linux side by about 12% when the system is under high load, that is, fully utilize processor resources while providing an additional 12% computing power for the general operating system Linux.
[0056] Compared with the prior art, the present invention utilizes the characteristics of the BPF virtual machine and BPF bytecode and extends the portability of remote BPF function calls to overcome the problems and limitations of the prior art solutions. Its advantage lies in making full use of the Cortex-A and Cortex-M processors of the on-chip heterogeneous multi-processor system. Compared with the existing Linux scheduling method, it optimizes the processor resource utilization and significantly reduces the processor load of the Linux system on the Cortex-A processor. By parallelizing calculations, the computing throughput and system performance of the entire platform are improved, and the resulting computing performance improvement can better serve embedded application systems.
[0057] The above-mentioned specific implementation can be partially adjusted in different ways by those skilled in the art without departing from the principle and purpose of the present invention. The protection scope of the present invention shall be based on the claims and shall not be limited by the above-mentioned specific implementation. Each implementation scheme within its scope shall be subject to the constraints of the present invention.
Claims
1. A task scheduling system for a heterogeneous multi-processor system on a chip based on the above system, characterized in that: include: The invention discloses a scheduling module and a sending module located at the Linux end of a general operating system, a receiving module, a BPF bytecode parsing and execution module and a computing module located at the real-time operating system end, wherein: the scheduling module makes scheduling decisions for computing tasks according to a predefined scheduling strategy and system operation status information, and schedules the computing tasks to the real-time operating system end for execution; the sending module sends the BPF bytecode in the ELF file format to the real-time operating system end according to the instruction of the scheduling module, and waits for the execution result returned by the real-time operating system end; the receiving module for monitoring BPF requests receives the BPF bytecode file from the Linux end according to the inter-core communication mechanism, sends it to the BPF bytecode parsing and execution module after receiving it, waits for the calculation result and sends it back to the Linux end; the BPF bytecode parsing and execution module performs BPF bytecode parsing and execution processing according to the BPF file received by the receiving module, calls the computing module to process the computing task, and obtains the execution result and returns it to the receiving module; the computing module executes and processes the computing task according to the extended BPF helper function list information, and returns the calculation result to the BPF bytecode parsing and execution module.
2. The on-chip heterogeneous multi-processor system task scheduling system based on the above system according to claim 1 is characterized in that: The scheduling module loads the executable file containing the BPF bytecode of the computing task into the memory, makes scheduling decisions according to the scheduling conditions, and deploys the BPF file to the real-time operating system for processing through the sending module when the scheduling conditions are met; Otherwise, the scheduling module will not perform remote deployment tasks, and the computing tasks will run normally on the Linux side according to the original code logic; The scheduling conditions include: when the Linux system is in a high load state, executing the scheduling request, thereby reducing the CPU occupancy of the Linux end; When the Linux system is in idle or normal state, the application actively initiates a scheduling request to the scheduling module, thereby reserving more CPU bandwidth for Linux or reducing power consumption; the scheduling request does not affect the stability and reliability of the real-time operating system itself. When a high-priority real-time task appears in the real-time operating system, the currently scheduled computing task will be paused and wait for rescheduling.
3. The on-chip heterogeneous multi-processor system task scheduling system based on the above system according to claim 2 is characterized in that: The deployment means that the scheduling module will decide whether to schedule the computing task to run on the remote Cortex-M processor according to the predetermined configuration parameters or system status; when the scheduling conditions are met, the scheduling module will schedule the computing task to run on the real-time operating system where the remote Cortex-M processor is located, and the executable file containing the BPF bytecode is transmitted by the sending module to the real-time operating system for subsequent processing, and the Linux system releases the processor resources and waits for the processing results.
4. The on-chip heterogeneous multi-processor system task scheduling system based on the above system according to claim 1 is characterized in that: The receiving module uses the inter-core communication mechanism between Cortex-A and Cortex-M and the API interface provided by OpenAMP to listen to the BPF request on the virtual serial port device, and packages the data and sends it to the BPF bytecode parsing and execution module for subsequent processing.
5. The on-chip heterogeneous multi-processor system task scheduling system based on the above system according to claim 1 is characterized in that: The BPF bytecode parsing and execution module parses and executes BPF bytecode on the real-time operating system side based on lightweight BPF virtual machine technology, that is, verifies and parses BPF bytecode sent from the host processor, executes BPF instructions, and performs more computing tasks through an extended computing module, which includes: a BPF bytecode verifier, a BPF bytecode parser and a BPF virtual machine; After receiving the BPF bytecode data from the BPF request listener, the BPF bytecode verifier checks the integrity of the executable file containing the BPF bytecode. When the check is successful, the BPF bytecode parser will parse and execute each BPF bytecode in turn; otherwise, an error code is returned to the Linux side, indicating that the scheduling execution failed and corrective measures need to be taken or the original Linux schedule needs to be executed; During the instruction parsing process, when the current BPF bytecode is an ordinary BPF instruction, it will be executed normally. After execution, the next instruction will be parsed and executed; when the current BPF bytecode is an E-RHF instruction, the corresponding custom processing function will be run through the calculation module (ERHF) until the calculation task is completed; when the execution of the calculation module is completed, the instruction will return from the E-RHF to the BPF bytecode where the jump occurred and continue to execute; when the current BPF bytecode is the end instruction, it will exit the execution module and return the calculation result to the Linux end.
6. The on-chip heterogeneous multi-processor system task scheduling system based on the above system according to claim 5 is characterized in that: The BPF virtual machine includes: a 512KB stack and 11 registers, wherein: the second to sixth registers r1-r5 are used for 5 parameters used in function calls, the first register r0 is used to store the return value of the function, and the PC register points to the BPF bytecode currently being executed.
7. The on-chip heterogeneous multi-processor system task scheduling system based on the above system according to claim 1 is characterized in that: The computing module extends the BPF auxiliary function under Linux from the original predefined Linux kernel auxiliary function to any custom function based on the extended remote helper function, defines and implements E-RHF on the real-time operating system side, transplants or implements the code of the computing task in the real-time operating system side, and calls the remote BPF auxiliary function in the BPF bytecode.
8. A method for scheduling tasks in a heterogeneous multi-processor system on a chip based on the system according to any one of claims 1 to 7, characterized in that: Using BPF virtual machine technology, BPF bytecode is used as the transmission carrier between the general operating system Linux and the real-time operating system of the on-chip heterogeneous multiprocessor, and some computing tasks of the application in the general operating system Linux are scheduled to the real-time operating system in real time and executed in its BPF instruction parsing and BPF virtual machine; The BPF virtual machine technology refers to: pre-analyzing the type of application to be processed, identifying computing tasks or functions suitable for scheduling to the real-time operating system and capable of being compiled into BPF bytecode, pre-processing and compiling them into BPF bytecode, and generating an executable file containing BPF bytecode; then adding the calling logic for BPF bytecode to the application to be processed and defining the scheduling trigger conditions of the scheduling module; Finally, in the execution stage, the scheduling module schedules the executable file containing the BPF bytecode to the real-time operating system for execution, and the BPF bytecode parsing and execution module and the computing module on the real-time operating system side perform the parsing and execution and computing tasks of the BPF instructions respectively.
9. The method for scheduling tasks in a heterogeneous multi-processor system on a chip according to claim 8, wherein: The preprocessing refers to: generating a BPF bytecode file, transplanting or implementing a computing task function in the E-RHF of the real-time operating system, and adding a scheduling request call to the original Linux application, specifically including: ① Split and encapsulate the calculation-related code, compile it into BPF bytecode using LLVM / Clang tools, and generate an executable file; ② Port or implement relatively complex computing task functions in the real-time operating system, add them to the E-RHF module, and call these remote BPF auxiliary functions in the BPF bytecode to establish a one-to-one remote function call; ③Add a scheduling request call in the original code on the Linux side and generate a unique request number to distinguish the request.
10. The method for scheduling tasks in a heterogeneous multi-processor system on a chip according to claim 8, wherein: The executable file introduces an extended remote help function E-RHF, expands the supported functions from the original predefined Linux kernel help functions to any custom functions, transplants or implements the compiled computing tasks or functions on the real-time operating system side, and calls the corresponding remote BPF function in the BPF bytecode, that is, establishes a mapping relationship between remote function calls from the general operating system to the real-time operating system.
Citation Information
Patent Citations
Paralleling multi-processor virtual machine system
CN101183315A
Method for sensing link event in information network system and operation system thereof
CN110493140A
Method for designing embedded SPARC processor operating system for multi-task processing
CN111209046A
Computing storage unit, system including same and method of building batch requests
CN114201111A
Fifth generation (5G) new radio channel equalization
WO2021207429A1
