Interrupt processing method and device of intelligent automobile operating system and vehicle terminal
By using the object tree in the smart car operating system to obtain interrupt information and allocate interrupts according to CPU affinity and load, the problem of low interrupt processing efficiency in the smart car operating system is solved and the execution efficiency is improved.
Patent Information
- Application Number
- CN202411954886.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-25
Smart Images

Figure CN119883556A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to vehicle terminal technology, and in particular to an interrupt processing method, device and vehicle terminal for an intelligent automobile operating system. Background Art
[0002] At present, in order to realize intelligent driving of vehicle terminals, an on-board intelligent automobile operating system can be deployed on the vehicle terminal. The operating system of the macro-kernel architecture is decoupled, and a single function or module (such as file system, device driver, etc.) is separated from the kernel and deployed as an independent service in an independent operating environment; the kernel only retains a few functions and provides these services with basic capabilities such as communication, so that they can cooperate with each other to complete the functions required by the operating system. This architecture is called a microkernel. Under the microkernel architecture, services are completely isolated from each other. Even if a single service fails or is attacked by security, it will not directly cause the entire operating system to crash or be compromised, thereby effectively improving the reliability and security of the operating system. In addition, the microkernel architecture brings about a further separation of mechanism and strategy, and it is also more convenient to customize different services for different scenarios, so as to better adapt to different application requirements.
[0003] In the prior art, the monolithic kernel is also called a single kernel. Its characteristic is that all modules of the operating system kernel (including process scheduling, memory management, file system, device driver, etc.) run in kernel state and have the ability to directly operate hardware. Such operating systems include UNIX / Linux, FreeBSD, etc. In the operating system code, there are usually directories like arch / arm / , which are used to encapsulate the function implementation related to the architecture. However, as the kernel functions of the monolithic kernel operating system continue to grow, the complexity of the system continues to increase, causing more problems in terms of reliability and security. This is because under the monolithic kernel architecture, all kernel modules run in privileged space, and a single point of error may cause the entire system to crash or be hacked.
[0004] However, in the prior art, since the GICv2 / v3 interrupt controller in the Linux kernel only supports using a single CPU or all CPUs in the system as the CPU that responds to a certain interrupt, this will bring two problems. When only a single CPU is used as the target CPU, this will cause the CPU interrupt load to be too high. For the Linux system, the system will frequently switch contexts, resulting in excessive overhead and low execution efficiency. Alternatively, when all CPUs in the system are used as the response CPUs of a certain interrupt, this will bring uncertainty. The interrupt processing and the task with affinity to the interrupt are not on the same CPU, which will increase the number of cache reconstructions and reduce the execution efficiency of the program. Summary of the invention
[0005] The present application provides an interrupt processing method, device and vehicle terminal of an intelligent automobile operating system, which are used to solve the technical problem of low interrupt processing efficiency of the intelligent automobile operating system.
[0006] In a first aspect, the present application provides an interrupt processing method for an intelligent automobile operating system, comprising:
[0007] S1. In the interrupt balancing cycle of the intelligent automobile operating system, the interrupt information of each node in each level is obtained through a preset object tree; wherein the interrupt information is the load information of the interrupt on each node, and the nodes include the CPU and other nodes;
[0008] S2, searching for a target interruption that needs to be evenly distributed in the plurality of interruption information;
[0009] S3. If it is determined that the target interrupt has a preset CPU affinity range, determine a CPU with the lowest load among multiple CPUs within the CPU affinity range, and allocate the target interrupt to the CPU with the lowest load.
[0010] Furthermore, the interrupt information includes an interrupt type of the interrupt, an interrupt level corresponding to the interrupt type, an interrupt count, an interrupt load, and a CPU load.
[0011] Furthermore, the interrupt count includes the sum of the number of interrupts generated on each CPU counted in the current interrupt balancing cycle and the sum of the number of interrupts generated on each CPU counted in the previous interrupt balancing cycle;
[0012] The interrupt load is determined based on the sum of the interrupt times of each CPU counted in the current interrupt balancing cycle and the sum of the interrupt times counted in the last interrupt balancing cycle.
[0013] Furthermore, in the interrupt balancing cycle of the intelligent automobile operating system, after obtaining the interrupt information of each node in each level through a preset object tree, the method includes:
[0014] Determining the load of each node in each level according to the load of the CPU;
[0015] According to the load of each node in each level, the accumulated execution time of software / hardware interrupts in the intelligent automobile operating system is determined.
[0016] Furthermore, searching for a target interrupt that needs to be evenly distributed in a plurality of interrupt information includes:
[0017] S21. According to a preset balancing algorithm, the interrupt information and the accumulated execution time of the software / hardware interrupts, a target interrupt that needs to be evenly distributed is searched in a plurality of interrupt information.
[0018] Furthermore, the method further comprises:
[0019] If it is determined that the target interrupt does not have a preset CPU affinity range, the CPU with the lowest load is determined among multiple CPUs in the smart car operating system, and the target interrupt is allocated to the CPU with the lowest load.
[0020] In a second aspect, the present application provides an interrupt processing device for an intelligent automobile operating system, comprising:
[0021] An acquisition module is used to acquire interrupt information of each node in each level through a preset object tree during an interrupt balancing cycle of an intelligent automobile operating system; wherein the interrupt information is load information of interrupts on respective nodes, and the nodes include CPU and other nodes;
[0022] A search module, used for searching the target interruption that needs to be evenly distributed in the plurality of interruption information;
[0023] The first allocation module is used to determine the CPU with the lowest load among multiple CPUs within the CPU affinity range if it is determined that the target interrupt has a preset CPU affinity range, and allocate the target interrupt to the CPU with the lowest load.
[0024] Furthermore, the interrupt information includes an interrupt type of the interrupt, an interrupt level corresponding to the interrupt type, an interrupt count, an interrupt load, and a CPU load.
[0025] Furthermore, the interrupt count includes the sum of the number of interrupts generated on each CPU counted in the current interrupt balancing cycle and the sum of the number of interrupts generated on each CPU counted in the previous interrupt balancing cycle;
[0026] The interrupt load is determined based on the sum of the interrupt times of each CPU counted in the current interrupt balancing cycle and the sum of the interrupt times counted in the last interrupt balancing cycle.
[0027] Furthermore, the device also includes:
[0028] A first determination module is used to determine the load of each node in each level according to the load of the CPU after obtaining the interrupt information of each node in each level through a preset object tree during the interrupt balancing cycle of the intelligent automobile operating system;
[0029] The second determination module is used to determine the accumulated execution time of software / hardware interrupts in the intelligent automobile operating system according to the load of each node in each level.
[0030] Furthermore, the search module is specifically used to:
[0031] According to a preset balancing algorithm, the interrupt information and the accumulated execution time of the software / hardware interrupts, a target interrupt that needs to be evenly distributed is searched in a plurality of interrupt information. Further, the device further includes:
[0032] The second allocation module is used to determine the CPU with the lowest load among multiple CPUs in the smart car operating system if it is determined that the target interrupt does not have a preset CPU affinity range, and allocate the target interrupt to the CPU with the lowest load.
[0033] In a third aspect, the present application provides a vehicle terminal, comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, and when the processor executes the computer program, the method described in the first aspect is implemented.
[0034] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method described in the first aspect.
[0035] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the method described in the first aspect when executed by a processor.
[0036] The present application provides an interrupt processing method, device and vehicle terminal for an intelligent automobile operating system. In the interrupt balancing cycle of the intelligent automobile operating system, the interrupt information of each node in each level is obtained through a preset object tree; wherein the interrupt information is the load information of the interrupt on each node, and the node includes the CPU and other nodes. Search for the target interrupt that needs to be evenly distributed among multiple interrupt information. If it is determined that the target interrupt has a preset CPU affinity range, the CPU with the lowest load is determined among the multiple CPUs within the CPU affinity range, and the target interrupt is assigned to the CPU with the lowest load. In this scheme, it is determined whether the target interrupt has a preset CPU affinity range. If it is determined that the target interrupt has a preset CPU affinity range, the CPU with the lowest load is determined among the multiple CPUs within the CPU affinity range, and the target interrupt is assigned to the CPU with the lowest load. Therefore, compared to the prior art that does not support setting multiple CPUs as target CPUs for a certain interrupt, the present application can set multiple CPUs for a certain interrupt as the CPU that responds to the interrupt request by setting the CPU affinity range through software. This can not only alleviate the problem of a certain CPU causing excessive system overhead due to an "interrupt storm", but also alleviate the cache reconstruction caused by uncertainty, improve the execution efficiency of the program, and solve the technical problem of low interrupt processing efficiency in the smart car operating system. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0038] Figure 1 A flowchart of an interrupt processing method for an intelligent automobile operating system provided in an embodiment of the present application;
[0039] Figure 2 A schematic diagram of the structure of an interrupt processing method for an intelligent automobile operating system provided in an embodiment of the present application;
[0040] Figure 3 A flowchart of another interrupt processing method for an intelligent automobile operating system provided in an embodiment of the present application;
[0041] Figure 4 A flowchart of another interrupt processing method of an intelligent automobile operating system provided in an embodiment of the present application;
[0042] Figure 5 A schematic diagram of the structure of an interrupt processing device for an intelligent automobile operating system provided in an embodiment of the present application;
[0043] Figure 6A schematic diagram of the structure of another interrupt processing device of an intelligent automobile operating system provided in an embodiment of the present application;
[0044] Figure 7 A schematic diagram of the structure of a vehicle terminal provided in an embodiment of the present application.
[0045] The above drawings show clear embodiments of the present disclosure, which will be described in more detail below. These drawings and text descriptions are not intended to limit the scope of the present disclosure in any way, but to illustrate the concepts of the present disclosure to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0046] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present disclosure.
[0047] At present, in order to realize intelligent driving of vehicle terminals, an on-board intelligent automobile operating system can be deployed on the vehicle terminal. The operating system of the macro-kernel architecture is decoupled, and a single function or module (such as file system, device driver, etc.) is separated from the kernel and deployed as an independent service in an independent operating environment; the kernel only retains a few functions and provides these services with basic capabilities such as communication, so that they can cooperate with each other to complete the functions required by the operating system. This architecture is called a microkernel. Under the microkernel architecture, services are completely isolated from each other. Even if a single service fails or is attacked by security, it will not directly cause the entire operating system to crash or be compromised, thereby effectively improving the reliability and security of the operating system. In addition, the microkernel architecture brings about a further separation of mechanism and strategy, and it is also more convenient to customize different services for different scenarios, so as to better adapt to different application requirements.
[0048] In the prior art, the monolithic kernel is also called a single kernel. Its characteristic is that all modules of the operating system kernel (including process scheduling, memory management, file system, device driver, etc.) run in kernel state and have the ability to directly operate hardware. Such operating systems include UNIX / Linux, FreeBSD, etc. In the operating system code, there are usually directories like arch / arm / , which are used to encapsulate the function implementation related to the architecture. However, as the kernel functions of the monolithic kernel operating system continue to grow, the complexity of the system continues to increase, causing more problems in terms of reliability and security. This is because under the monolithic kernel architecture, all kernel modules run in privileged space, and a single point of error may cause the entire system to crash or be hacked.
[0049] In one example, in the Linux kernel, the GICv2 / v3 interrupt controller only supports using a single CPU or all CPUs in the system as the CPU that responds to an interrupt. This will cause two problems. When only a single CPU is used as the target CPU, this will cause the CPU interrupt load to be too high. For the Linux system, the system will frequently switch contexts, resulting in excessive overhead and low execution efficiency. Alternatively, when all CPUs in the system are used as the CPUs that respond to an interrupt, this will bring uncertainty. The interrupt processing and the task with the interrupt affinity are not on the same CPU, which will increase the number of cache rebuilds and reduce the execution efficiency of the program.
[0050] First, the terms in this application are explained:
[0051] Interrupt: An event in a computer system that interrupts the execution of a program, usually caused by a hardware device or other software component. When an interrupt occurs, the CPU immediately stops the currently executing instruction and instead executes the interrupt-related handler or interrupt service routine.
[0052] Interrupts can be divided into two types: hardware interrupts and software interrupts.
[0053] Hardware interrupt: Hardware interrupt is caused by the computer's hardware devices (such as network card, keyboard, mouse, etc.). These devices can send interrupt request (IRQ) signals to notify the CPU of certain events, such as data transmission completion, key input, etc. The CPU will suspend the current task and jump to the corresponding interrupt handler to handle this event.
[0054] Software interrupt: A software interrupt is triggered by a program or the operating system itself. In a software interrupt, the instruction executed by the CPU triggers a software interrupt instruction (such as the INT instruction), which then transfers to the specified interrupt service routine for execution. Software interrupts are usually used to implement system calls, exception handling, error handling, etc.
[0055] System overhead: The additional burden or cost incurred by a system when performing a task or operation. It is caused by the additional computation, storage, communication, or other resource consumption required by the system. System overhead may adversely affect the performance of the system, resulting in delayed response time, decreased throughput, or reduced resource utilization.
[0056] Interrupt Storm: refers to a situation in which the system continuously receives a large number of interrupt requests within a certain period of time, resulting in excessive occupation of system resources, thus affecting the normal operation of the system.
[0057] Cache Rebuilding: refers to the process of regenerating or reconstructing cache content in a computer system. Cache reconstruction usually occurs when the cache is invalid or the data is updated to ensure the consistency of the data in the cache with the underlying data. Specifically, in a cache system, in order to improve the speed and efficiency of data access, a cache is usually used to store the most frequently accessed copies of data. When the underlying data changes (for example, it is modified, deleted, or added), the data in the cache becomes inconsistent, and cache reconstruction is required to update the cache content.
[0058] CPU Load: refers to the workload or load of the CPU running tasks in a period of time. It reflects the CPU's busyness and the use of its processing power. CPU load is usually expressed as a percentage, indicating the proportion of the time the CPU is executing tasks to the total time. For example, a CPU load of 50% means that the CPU is half of the time in that period of time to execute tasks, and the other half of the time is idle.
[0059] The present application provides an interrupt processing method, device and vehicle terminal for an intelligent automobile operating system, aiming to solve the above technical problems of the prior art.
[0060] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0061] Figure 1 A flowchart of an interrupt processing method for an intelligent automobile operating system provided in an embodiment of the present application is shown as follows: Figure 1 As shown, the method includes:
[0062] Step 101, in the interrupt balancing cycle of the intelligent automobile operating system, the interrupt information of each node in each level is obtained through a preset object tree; wherein the interrupt information is the load information of the interrupt on each node, and the nodes include the CPU and other nodes.
[0063] Exemplarily, the execution subject of this embodiment may be a vehicle terminal, and the vehicle terminal includes a vehicle-mounted / vehicle computer, etc., which is not limited. The vehicle terminal is deployed with an intelligent vehicle operating system, and the intelligent vehicle operating system may be a Linux system, and an interrupt balancing program is deployed in the intelligent vehicle operating system. First, according to the system information of the interrupt balancing program running in the intelligent vehicle operating system, an object tree is pre-established, and the object tree contains each node in each level, and the interrupt information of each node in each level is obtained in each interrupt balancing cycle, so as to provide a basis for redistributing interrupts. The interrupt information is the load information of the interrupt on each node, and the node includes the CPU and other nodes.
[0064] Specifically, the interrupt information includes the interrupt type of the interrupt, the interrupt level corresponding to the interrupt type, the interrupt count, the interrupt load, and the CPU load. Among them, there is a preset mapping relationship between the interrupt type and the interrupt level. The interrupt count includes: for each CPU, the sum of the number of interrupts generated on each CPU counted in the current interrupt balancing cycle, and the sum of the number of interrupts generated on each CPU counted in the last interrupt balancing cycle. The interrupt load represents the burden brought by the increase in interrupts during the two statistics, that is, the number of interrupt requests obtained is determined based on the sum of the number of interrupts of each CPU counted in the current interrupt balancing cycle and the sum of the number of interrupts of each CPU counted in the last interrupt balancing cycle. The CPU load obtains the number of interrupts on the CPU in the interrupt balancing cycle, and then divides it by the number of interrupts on the CPU to obtain the load at each interruption (which can be understood as the interrupt load average). With this parameter, the load of each interrupt in the system can be calculated based on the number of interrupts in the cycle * the interrupt load average.
[0065] In irqbalance, the time consumed by interrupts can be used to measure the burden of the CPU. The method for calculating the load of the CPU node is to obtain the load information of the CPU, and then calculate the cumulative execution time of the software / hardware interrupts since the startup of the smart car operating system (in jiffies). Specifically, in the CPU topology structure, the load of the parent node is the sum of the loads of the child nodes. The CPU is the leaf node of the object tree. With the load of the leaf node, the calculation method of the parent node load is: the parent node load is equal to the average of the sum of the loads of each child node. For example, the cache node has two CPU child nodes, the load of the CPU0 node is 100, and the load of the CPU1 node is 200, then the load of the cache node is (100+200) / 2=150. And so on, calculations are performed from bottom to top.
[0066] For example, Figure 2 A schematic diagram of a method for interrupt handling in an intelligent automobile operating system provided in an embodiment of the present application is shown in FIG. Figure 2 As shown in the figure, interrupt balancing is based on the "object tree", and objecttree is a hierarchical structure established through the topological structure of the smart car operating system. According to the structure of the smart car operating system, the smart car operating system can be divided into four layers from top to bottom: node->package->cache->cpu. Taking a 16-core dual-way server as an example, the system has two NUMA nodes, each node contains two clusters, each cluster contains 4 cores, and shares the L2 cache. Among them,
[0067] (1) Each node is an object, described by struct topo_obj.
[0068] (2) Nodes between upper and lower layers are managed through parent / child pointers.
[0069] (3) Each layer has a global linked list head pointer, which is used to organize and manage all nodes on the same layer.
[0070] Step 102: Search for a target interrupt that needs to be evenly distributed in multiple interrupt information.
[0071] Exemplarily, according to the interrupt type in the interrupt information, the interrupt level corresponding to the interrupt type, the interrupt count, the interrupt load, the CPU load, etc., the target interrupt that needs to be evenly distributed is found.
[0072] Step 103: If it is determined that the target interrupt has a preset CPU affinity range, then determine the CPU with the lowest load among multiple CPUs within the CPU affinity range, and allocate the target interrupt to the CPU with the lowest load.
[0073] For example, during the initial operation, only the object tree and interrupt database are established, and after one operation cycle, interrupt balancing is performed based on the interrupt information of the CPU load and interrupt load, and the CPU affinity range is determined and set. Alternatively, the CPU affinity range is directly set, etc., which is not limited.
[0074] In this step, the vehicle terminal determines whether the target interrupt has a preset CPU affinity range. If it is determined that the target interrupt has a preset CPU affinity range, the CPU with the lowest load is determined among the multiple CPUs within the CPU affinity range, and the target interrupt is assigned to the CPU with the lowest load.
[0075] In an embodiment of the present application, in the interrupt balancing cycle of the intelligent automobile operating system, the interrupt information of each node in each level is obtained through a preset object tree; wherein the interrupt information is the load information of the interrupt on each node, and the node includes the CPU and other nodes. The target interrupt that needs to be evenly distributed is searched in multiple interrupt information. If it is determined that the target interrupt has a preset CPU affinity range, the CPU with the lowest load is determined among the multiple CPUs within the CPU affinity range, and the target interrupt is allocated to the CPU with the lowest load. In this scheme, it is determined whether the target interrupt has a preset CPU affinity range. If it is determined that the target interrupt has a preset CPU affinity range, the CPU with the lowest load is determined among the multiple CPUs within the CPU affinity range, and the target interrupt is allocated to the CPU with the lowest load. Therefore, compared with the prior art that does not support setting multiple CPUs as target CPUs for a certain interrupt, the present application can set multiple CPUs as the CPU that responds to the interrupt request for a certain interrupt by setting the CPU affinity range through software, which can not only alleviate a certain CPU from causing the system overhead to be too high due to the "interrupt storm", but also alleviate the cache reconstruction caused by uncertainty, improve the execution efficiency of the program, and solve the technical problem of low interrupt processing efficiency of the intelligent automobile operating system.
[0076] Figure 3 A flowchart of another interrupt processing method of an intelligent automobile operating system provided in an embodiment of the present application is shown as follows: Figure 3 As shown, the method includes:
[0077] Step 201, in the interrupt balancing cycle of the intelligent automobile operating system, the interrupt information of each node in each level is obtained through a preset object tree; wherein the interrupt information is the load information of the interrupt on each node, and the nodes include the CPU and other nodes.
[0078] In one example, the interrupt information includes an interrupt type of the interrupt, an interrupt level corresponding to the interrupt type, an interrupt count, an interrupt load, and a CPU load.
[0079] In one example, the interrupt count includes the sum of the number of interrupts generated on each CPU counted in the current interrupt balancing period and the sum of the number of interrupts generated on each CPU counted in the previous interrupt balancing period.
[0080] The interrupt load is determined based on the sum of the interrupt times of each CPU counted in the current interrupt balancing cycle and the sum of the interrupt times counted in the previous interrupt balancing cycle.
[0081] For example, this step can be referred to Figure 1 Step 101 in the above is not described in detail.
[0082] Step 202: Determine the load of each node in each level according to the CPU load.
[0083] For example, in the CPU topology, the load of the parent node is the sum of the loads of the child nodes. The CPU is the leaf node of the object tree. With the load of the leaf node, the calculation method of the parent node load is: the parent node load is equal to the average of the sum of the loads of each child node. For example, the cache node has two CPU child nodes, the load of the CPU0 node is 100, and the load of the CPU1 node is 200, then the load of the cache node is (100+200) / 2=150. And so on, the calculation is performed from bottom to top.
[0084] Step 203: Determine the accumulated execution time of software / hardware interrupts in the smart car operating system according to the load of each node in each level.
[0085] Exemplarily, the accumulated execution time of software / hardware interrupts in the smart car operating system is determined based on the execution time used by the load of each node in each level.
[0086] Step 204: Search for a target interrupt that needs to be evenly distributed in multiple interrupt information according to a preset balancing algorithm, interrupt information, and accumulated execution time of software / hardware interrupts.
[0087] Exemplarily, the target interruption that needs to be evenly distributed may be searched for in multiple interruption information according to a preset balancing algorithm.
[0088] Step 205: If it is determined that the target interrupt has a preset CPU affinity range, then determine the CPU with the lowest load among multiple CPUs within the CPU affinity range, and allocate the target interrupt to the CPU with the lowest load.
[0089] For example, during the initial operation, only the object tree and interrupt database are established, and after one operation cycle, interrupt balancing is performed based on the interrupt information of the CPU load and interrupt load, and the CPU affinity range is determined and set. Alternatively, the CPU affinity range is directly set, etc., which is not limited.
[0090] In this step, the vehicle terminal determines whether the target interrupt has a preset CPU affinity range. If it is determined that the target interrupt has a preset CPU affinity range, the CPU with the lowest load is determined among the multiple CPUs within the CPU affinity range, and the target interrupt is assigned to the CPU with the lowest load.
[0091] Step 206: If it is determined that the target interrupt does not fall within the preset CPU affinity range, a CPU with the lowest load is determined among multiple CPUs in the smart car operating system, and the target interrupt is allocated to the CPU with the lowest load.
[0092] Exemplarily, if it is determined that the target interrupt does not have a preset CPU affinity range, the CPU with the lowest load is determined among all CPUs in the smart car operating system, and the target interrupt is allocated to the CPU with the lowest load.
[0093] In an embodiment of the present application, in the interrupt balancing cycle of the intelligent automobile operating system, the interrupt information of each node in each level is obtained through a preset object tree; wherein the interrupt information is the load information of the interrupt on each node, and the node includes the CPU and other nodes. According to the load of the CPU, the load of each node in each level is determined. According to the load of each node in each level, the accumulated execution time of the software / hardware interrupts accumulated in the intelligent automobile operating system is determined. According to the preset balancing algorithm, interrupt information and the accumulated execution time of the software / hardware interrupts, the target interrupt that needs to be evenly distributed is searched in multiple interrupt information. If it is determined that the target interrupt has a preset CPU affinity range, the CPU with the lowest load is determined among the multiple CPUs within the CPU affinity range, and the target interrupt is assigned to the CPU with the lowest load. If it is determined that the target interrupt does not have a preset CPU affinity range, the CPU with the lowest load is determined among the multiple CPUs in the intelligent automobile operating system, and the target interrupt is assigned to the CPU with the lowest load. Therefore, compared to the prior art that does not support setting multiple CPUs as target CPUs for a certain interrupt, the present application can set multiple CPUs for a certain interrupt as the CPU that responds to the interrupt request by setting the CPU affinity range through software. This can not only alleviate the problem of a certain CPU causing excessive system overhead due to an "interrupt storm", but also alleviate the cache reconstruction caused by uncertainty, improve the execution efficiency of the program, and solve the technical problem of low interrupt processing efficiency in the smart car operating system.
[0094] Figure 4 A flowchart of another interrupt processing method of an intelligent automobile operating system provided in an embodiment of the present application is shown as follows: Figure 4 As shown, the method includes:
[0095] (1) Establish an object tree / interrupt database. Specifically, establish an object tree based on the system information of the current interrupt balancing program, such as the number of nodes and CPUs in the system, the number of interrupts, the initial state of the interrupt load and the initial state of the CPU load during initial operation.
[0096] (2) Clear the last statistical information. Specifically, interrupt balancing is performed once in an interrupt balancing cycle. Each time interrupt balancing is performed, the interrupt load and CPU load of the current cycle are re-counted, and the last statistical information needs to be invalidated.
[0097] (3) Read / proc / interrupts to obtain interrupts and record the interrupt count.
[0098] (4) Read / proc / stat to obtain the load information of each CPU, and calculate the load of each node at each level and the load of each interrupt in turn.
[0099] (5) Use the balancing algorithm to find the target interrupt that needs to be reallocated.
[0100] (6) Determine whether the target interrupt has a specified CPU affinity range; if not, add the target interrupt to be reallocated to a new node of the system's global CPU; if specified, add the target interrupt to be reallocated to a node within the CPU affinity range. Specifically, when each interrupt balancing cycle arrives, if the interrupt to be reallocated has a CPU affinity restriction, that is, if the user specifies the CPU affinity of the interrupt to be reallocated, then only a suitable CPU node is searched within the CPU affinity range.
[0101] (7) Configure the CPU affinity range of the hardware.
[0102] Figure 5 A schematic diagram of the structure of an interrupt processing device of an intelligent automobile operating system provided in an embodiment of the present application is shown in FIG. Figure 5 As shown, the device comprises:
[0103] The acquisition module 31 is used to obtain the interrupt information of each node in each level through a preset object tree during the interrupt balancing cycle of the intelligent automobile operating system; wherein the interrupt information is the load information of the interrupt on each node, and the nodes include the CPU and other nodes.
[0104] The search module 32 is used to search for a target interruption that needs to be evenly distributed in multiple interruption information.
[0105] The first allocation module 33 is configured to determine the CPU with the lowest load among multiple CPUs within the CPU affinity range if it is determined that the target interrupt has a preset CPU affinity range, and allocate the target interrupt to the CPU with the lowest load.
[0106] The device of this embodiment can execute the technical solution in the above method. Its specific implementation process and technical principles are the same and will not be repeated here.
[0107] Figure 6A schematic diagram of the structure of another interrupt processing device of an intelligent automobile operating system provided in an embodiment of the present application, Figure 5 Based on the exemplary embodiments, Figure 6 As shown, the interrupt information includes the interrupt type of the interrupt, the interrupt level corresponding to the interrupt type, the interrupt count, the interrupt load and the CPU load.
[0108] In one example, the interrupt count includes the sum of the number of interrupts generated on each CPU counted in the current interrupt balancing period and the sum of the number of interrupts generated on each CPU counted in the previous interrupt balancing period.
[0109] The interrupt load is determined based on the sum of the interrupt times of each CPU counted in the current interrupt balancing cycle and the sum of the interrupt times counted in the previous interrupt balancing cycle.
[0110] In one example, the device further includes:
[0111] The first determination module 41 is used to determine the load of each node in each level according to the CPU load after obtaining the interrupt information of each node in each level through a preset object tree during the interrupt balancing cycle of the intelligent automobile operating system.
[0112] The second determination module 42 is used to determine the accumulated execution time of software / hardware interrupts in the intelligent automobile operating system according to the load of each node in each level.
[0113] In one example, the search module 32 is specifically configured to:
[0114] According to the preset balancing algorithm, interrupt information and the accumulated execution time of software / hardware interrupts, the target interrupt that needs to be evenly distributed is searched in the multiple interrupt information. In one example, the device also includes:
[0115] The second allocation module 43 is used to determine the CPU with the lowest load among multiple CPUs in the smart car operating system if it is determined that the target interrupt does not have a preset CPU affinity range, and allocate the target interrupt to the CPU with the lowest load.
[0116] The device of this embodiment can execute the technical solution in the above method. Its specific implementation process and technical principles are the same and will not be repeated here.
[0117] Figure 7 A schematic diagram of the structure of a vehicle terminal provided in an embodiment of the present application is shown in FIG. Figure 7 As shown, the vehicle terminal includes: a memory 51 and a processor 52 .
[0118] The memory 51 stores a computer program that can be executed on the processor 52 .
[0119] The processor 52 is configured to execute the method provided in the above embodiment.
[0120] The vehicle terminal further includes a receiver 53 and a transmitter 54. The receiver 53 is used to receive instructions and data sent by an external device, and the transmitter 54 is used to send instructions and data to the external device.
[0121] The embodiment of the present application also provides a non-temporary computer-readable storage medium. When the instructions in the storage medium are executed by the processor of the vehicle terminal, the vehicle terminal can execute the method provided by the above embodiment.
[0122] An embodiment of the present application also provides a computer program product, which includes: a computer program, which is stored in a readable storage medium, and at least one processor of the vehicle terminal can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the vehicle terminal executes the solution provided by any of the above embodiments.
[0123] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0124] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. An interrupt processing method for an intelligent automobile operating system, characterized in that: include: S1. In the interrupt balancing cycle of the intelligent automobile operating system, the interrupt information of each node in each level is obtained through a preset object tree; wherein the interrupt information is the load information of the interrupt on each node, and the nodes include the CPU and other nodes; S2, searching for a target interruption that needs to be evenly distributed in the plurality of interruption information; S3. If it is determined that the target interrupt has a preset CPU affinity range, determine a CPU with the lowest load among multiple CPUs within the CPU affinity range, and allocate the target interrupt to the CPU with the lowest load.
2. The method according to claim 1, characterized in that: The interrupt information includes an interrupt type of the interrupt, an interrupt level corresponding to the interrupt type, an interrupt count, an interrupt load, and a CPU load.
3. The method according to claim 2, characterized in that The interrupt count includes the sum of the number of interrupts generated on each CPU counted in the current interrupt balancing cycle and the sum of the number of interrupts generated on each CPU counted in the previous interrupt balancing cycle; The interrupt load is determined based on the sum of the interrupt times of each CPU counted in the current interrupt balancing cycle and the sum of the interrupt times counted in the last interrupt balancing cycle.
4. The method according to claim 3, characterized in that In the interrupt balancing cycle of the intelligent automobile operating system, after obtaining the interrupt information of each node in each level through a preset object tree, the method further includes: Determining the load of each node in each level according to the load of the CPU; According to the load of each node in each level, the accumulated execution time of software / hardware interrupts in the intelligent automobile operating system is determined.
5. The method according to claim 4, characterized in that The step of searching for a target interrupt that needs to be evenly distributed in a plurality of interrupt information includes: S21. According to a preset balancing algorithm, the interrupt information and the accumulated execution time of the software / hardware interrupts, a target interrupt that needs to be evenly distributed is searched in a plurality of interrupt information.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: If it is determined that the target interrupt does not have a preset CPU affinity range, the CPU with the lowest load is determined among multiple CPUs in the smart car operating system, and the target interrupt is allocated to the CPU with the lowest load.
7. An interrupt processing device for an intelligent automobile operating system, characterized in that: include: An acquisition module is used to acquire interrupt information of each node in each level through a preset object tree during an interrupt balancing cycle of an intelligent automobile operating system; wherein the interrupt information is load information of interrupts on respective nodes, and the nodes include CPU and other nodes; A search module, used for searching the target interruption that needs to be evenly distributed in the plurality of interruption information; The first allocation module is used to determine the CPU with the lowest load among multiple CPUs within the CPU affinity range if it is determined that the target interrupt has a preset CPU affinity range, and allocate the target interrupt to the CPU with the lowest load.
8. A vehicle terminal, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program executable on the processor, and the processor implements the method according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 6 when executed by a processor.
10. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 6 when being executed by a processor.
Citation Information
Cited By
Method and device for improving execution efficiency of compute-intensive tasks and medium
CN121166378A