Network operation center bandwidth monitoring method and device, medium and equipment
By monitoring NOC monitoring files in the operating system kernel and calling trusted firmware, enabling the control registers of the NOC module, reading and displaying bandwidth values, the problem of insufficient NOC bandwidth monitoring in the existing technology is solved, and automatic monitoring and efficient debugging are achieved.
Patent Information
- Application Number
- CN202510312524.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-17
- Publication Date
- 2025-06-06
AI Technical Summary
The prior art lacks an effective network operation center (NOC) bandwidth monitoring method, which makes it difficult to directly obtain the detailed information of the system bandwidth usage when bandwidth allocation is insufficient, thereby affecting the debugging efficiency and stability of the system.
Through the method executed by the operating system kernel, the strings in the pre-built NOC monitoring file are monitored, the security monitoring call instruction is called to enable trusted firmware, the control register address of the NOC module in DDR memory is determined, and the bandwidth value is read for display.
It realizes automatic monitoring of the bandwidth value of NOC module, simplifies the system debugging process, improves debugging efficiency, reduces misjudgment and misjudgment, and enhances the stability and reliability of the system.
Smart Images

Figure CN120104438A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network-on-chip technology, and in particular to a method, device, medium and equipment for monitoring bandwidth of a network operation center. Background Art
[0002] In a multi-core heterogeneous SOC (System on Chip in English, Network on Chip in Chinese), NOC (Network Operations Center in English, Network Operation Center in Chinese) is a technology that realizes the interconnection of complex systems. The main responsibility of NOC is to communicate data between various components inside the chip, including processor cores, memory controllers, graphics processing units GPUs, neural processing units (NPUs), etc. The bandwidth of NOC determines the speed of data communication between these components, including their communication speed with DDR memory. Among them, DDR is Double Data Rate in English, which means double data rate in Chinese. In other words, the bandwidth of NOC determines the speed at which each component accesses DDR memory. If the bandwidth of NOC is large enough, then each component can quickly read data from or write data to DDR memory, thereby improving the performance of the system.
[0003] NOC bandwidth refers to the amount of data that can be transmitted through the NOC per unit time, usually measured in bits per second (bps) or bytes per second (Bps). If the NOC bandwidth is insufficient, the following problems may occur:
[0004] 1. Performance degradation: If your application or system requires a large amount of data transfer, insufficient bandwidth to the NOC may limit the performance of your application or system. For example, if application A requires a large amount of memory access or needs to frequently transfer data between different processor cores, insufficient bandwidth to the NOC may cause application A to run slowly.
[0005] 2. Increased latency: Insufficient NOC bandwidth may increase the latency of data transmission, which may affect applications that require real-time or low latency, such as video playback or gaming.
[0006] 3. System instability: In extreme cases, insufficient bandwidth of the NOC may cause system instability or even system crash. This is because if data cannot be transmitted to where they are needed in a timely manner, some important system operations may not be able to proceed normally.
[0007] The current existing technology has obvious defects, that is, there is no practical method for NOC bandwidth monitoring. In practical applications, when the system has insufficient bandwidth allocation, due to the lack of effective monitoring methods, it is impossible to directly obtain the detailed information of the system bandwidth usage. This defect brings great difficulties to the debugging of the system. The debugging personnel often need to spend a lot of time and energy to troubleshoot the problem, which is not only inefficient, but also prone to misjudgment and missed judgment, which seriously affects the stability and reliability of the system. Summary of the invention
[0008] In order to solve at least one of the above technical problems, the present invention provides a network operation center bandwidth monitoring method and device, medium, and equipment.
[0009] According to a first aspect, a network operation center bandwidth monitoring method provided by an embodiment of the present invention is executed by an operating system kernel, and the method includes:
[0010] When a first character string indicating a start is written into a pre-built network operation center monitoring file, the trusted firmware in the secure world is called through a secure monitoring call instruction, so that the trusted firmware determines the physical address of the control register corresponding to each network operation center module in the double data rate memory according to the physical address of each network operation center module, and enables the control register corresponding to the network operation center module by writing a first preset value into the physical address of the control register corresponding to the network operation center module;
[0011] After the control register corresponding to each network operation center module is enabled, the data register corresponding to the control register is read to obtain the bandwidth value of the network operation center module;
[0012] The bandwidth display operation is performed according to the bandwidth values of each network operation center module that are read.
[0013] In one embodiment, the network operation center module includes at least one of a network operation center module for connecting to an application processor, a network operation center module for connecting to a graphics processing unit, and a network operation center module for connecting to a double data rate memory controller.
[0014] In one embodiment, the method further comprises:
[0015] When a second character string indicating stop is written into the network operation center monitoring file, the trusted firmware in the secure world is called through a security monitoring call instruction, so that the trusted firmware closes the control register corresponding to each network operation center module by writing a second preset value to the physical address of the control register corresponding to the network operation center module;
[0016] If a control register corresponding to a network operation center module is turned off, the data register corresponding to the control register cannot be read.
[0017] In one embodiment, the process by which the trusted firmware determines the physical address of the control register corresponding to each network operation center module in the double data rate memory based on the physical address of each network operation center module includes: the trusted firmware adds the physical address of each network operation center module to the offset of each memory area of the network operation center module in the double data rate memory to obtain the physical address of each memory area of the network operation center module in the double data rate memory, and adds the physical address of each memory area of the network operation center module in the double data rate memory to the first preset offset to obtain the physical address of the control register corresponding to each memory area of the network operation center module in the double data rate memory.
[0018] In one embodiment, the method further comprises:
[0019] Convert the physical base address of each network operation center module to a kernel virtual address;
[0020] Correspondingly, after the control register corresponding to each network operation center module is enabled, reading the data register corresponding to the control register to obtain the bandwidth value of the network operation center module includes:
[0021] After the control register corresponding to each network operation center module is enabled, determining the memory virtual address of the data register corresponding to the control register corresponding to each memory area of the network operation center module in the double data rate memory; wherein the memory virtual address of the data register is the address obtained by adding the kernel virtual address corresponding to the memory area in the double data rate memory of the network operation center module to the second preset offset;
[0022] According to the memory virtual address of the data register corresponding to the control register corresponding to each memory area in the double data rate memory of each network operation center module, the data register is read to obtain the bandwidth value of the network operation center module.
[0023] In one embodiment, converting the physical base address of each network operation center module into a kernel virtual address includes:
[0024] Load the network operation center monitoring driver module;
[0025] The physical base address of each network operation center module is converted into a kernel virtual address through the network operation center monitoring driver module.
[0026] In one embodiment, the bandwidth display operation is performed according to the read bandwidth values of the respective network operation center modules, including:
[0027] Displaying the bandwidth value read by each network operation center module in the data register corresponding to the control register corresponding to each memory area in the double data rate memory;
[0028] And / or, based on the bandwidth values read from the data registers corresponding to the control registers corresponding to the respective memory areas in the double data rate memory of each network operation center module, the total bandwidth value corresponding to the network operation center module is calculated, and the total bandwidth value corresponding to the network operation center module is displayed.
[0029] According to the second aspect, the network operation center bandwidth monitoring device provided by the embodiment of the present invention is deployed on the operating system kernel, and the device includes:
[0030] a first calling module, configured to call the trusted firmware in the secure world through a security monitoring calling instruction when a first character string indicating a start is written into a pre-built network operation center monitoring file, so that the trusted firmware determines the physical address of the control register corresponding to each network operation center module in the double data rate memory according to the physical address of each network operation center module, and enables the control register corresponding to the network operation center module by writing a first preset value into the physical address of the control register corresponding to the network operation center module;
[0031] The bandwidth reading module is used to read the data register corresponding to each network operation center module after the control register corresponding to the control register is enabled, so as to obtain the bandwidth value of the network operation center module;
[0032] The bandwidth display module is used to perform bandwidth display operations according to the bandwidth values of each network operation center module read.
[0033] In one embodiment, the network operation center module may include at least one of a network operation center module for connecting to an application processor, a network operation center module for connecting to a graphics processing unit, and a network operation center module for connecting to a double data rate memory controller.
[0034] In one embodiment, the device may further include:
[0035] The second calling module is used to call the trusted firmware in the secure world through a security monitoring calling instruction when it detects that a second character string indicating stop is written into the network operation center monitoring file, so that the trusted firmware closes the control register corresponding to each network operation center module by writing a second preset value to the physical address of the control register corresponding to the network operation center module; wherein, if the control register corresponding to a network operation center module is closed, the data register corresponding to the control register cannot be read.
[0036] In one embodiment, the process by which the trusted firmware determines the physical address of the control register corresponding to each network operation center module in the double data rate memory based on the physical address of each network operation center module includes: the trusted firmware adds the physical address of each network operation center module to the offset of each memory area of the network operation center module in the double data rate memory to obtain the physical address of each memory area of the network operation center module in the double data rate memory, and adds the physical address of each memory area of the network operation center module in the double data rate memory to the first preset offset to obtain the physical address of the control register corresponding to each memory area of the network operation center module in the double data rate memory.
[0037] In one embodiment, the device may further include:
[0038] An address translation module, used to translate the physical base address of each network operation center module into a kernel virtual address;
[0039] Correspondingly, the bandwidth reading module is specifically used for: after the control register corresponding to each network operation center module is enabled, determining the memory virtual address of the data register corresponding to the control register corresponding to each memory area of the network operation center module in the double data rate memory; wherein the memory virtual address of the data register is the address obtained by adding the kernel virtual address corresponding to the memory area of the network operation center module in the double data rate memory and the second preset offset; according to the memory virtual address of the data register corresponding to the control register corresponding to each memory area of each network operation center module in the double data rate memory, reading the data register to obtain the bandwidth value of the network operation center module.
[0040] In one embodiment, the address conversion module is specifically used to: load a network operation center monitoring driver module; and convert the physical base address of each network operation center module into a kernel virtual address through the network operation center monitoring driver module.
[0041] In one embodiment, the bandwidth display module is specifically used to: display the bandwidth value read from the data register corresponding to the control register corresponding to each memory area in the double data rate memory of each network operation center module; and / or, based on the bandwidth value read from the data register corresponding to the control register corresponding to each memory area in the double data rate memory of each network operation center module, calculate the total bandwidth value corresponding to the network operation center module, and display the total bandwidth value corresponding to the network operation center module.
[0042] According to the third aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute the method provided in the first aspect.
[0043] According to a fourth aspect, a computing device provided by an embodiment of the present invention includes a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method provided by the first aspect is implemented.
[0044] The embodiment of the present invention has the following technical effects: when the operating system kernel detects that the first character string is written into the NOC monitoring file, the trusted firmware in the secure world is called through the security monitoring call instruction, so that the trusted firmware determines the physical address of the control register corresponding to the NOC module in the DDR memory according to the physical address of each NOC module, and enables the control register corresponding to the NOC module. After the control register corresponding to each NOC module is enabled, the operating system kernel reads the data register corresponding to the control register to obtain the bandwidth value of the NOC module, and then performs bandwidth display operation according to the bandwidth value of each NOC module read. It can be seen that the embodiment of the present invention can realize the automatic monitoring of the bandwidth value of the NOC module, facilitate the debugging of the system, and do not need the debugging personnel to spend a lot of time and energy to troubleshoot problems, which not only improves efficiency, but also reduces misjudgment and missed judgment, and improves the stability and reliability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0046] Figure 1 It is a flow chart of a method for monitoring bandwidth of a network operation center in one embodiment of the present invention;
[0047] Figure 2It is a structural block diagram of a bandwidth monitoring device of a network operation center in one embodiment of the present invention. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be described clearly and completely below. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.
[0049] In a first aspect, an embodiment of the present invention provides a network operation center bandwidth monitoring method, the method is executed by an operating system kernel, see Figure 1 , the method comprises the following steps S110 to S130:
[0050] S110, when a first character string indicating a start is written into a pre-built NOC monitoring file, calling a trusted firmware in a secure world through a security monitoring call instruction, so that the trusted firmware determines a physical address of a control register corresponding to each NOC module in a DDR memory according to the physical address of the NOC module, and enables the control register corresponding to the NOC module by writing a first preset value into the physical address of the control register corresponding to the NOC module;
[0051] The first character string, for example, start, when the character string "start" is written into the NOC monitoring file, indicates that the bandwidth monitoring operation is to be started.
[0052] Among them, the security monitoring call instruction is SMC.
[0053] Among them, the operating system kernel is deployed in the non-secure world, and the trusted firmware is deployed in the secure world. The call from the non-secure world to the secure world can be implemented through the SMC driver mechanism. That is, the SMC driver mechanism is a mechanism for transferring from the non-secure world to the secure world. The application running in the non-secure world can use the security monitoring call instruction to request the code running in the secure world to perform privileged operations, such as accessing system resources and executing system calls. The SMC driver mechanism provides a universal, standard, scalable, and high-performance way for communication between the non-secure world and the secure world.
[0054] Among them, the trusted firmware can be ARM trusted firmware, namely ARM Trusted Firmware, referred to as ATF, which is an open source software component used to provide a secure boot and operating environment in ARM architecture systems. It provides a trusted firmware implementation for embedded systems, supporting key functions such as secure boot, authentication and authorization. The ARM architecture is a processor architecture based on a reduced instruction set computer, known for its high efficiency, low power consumption and high performance, and is widely used in mobile devices, embedded systems, the Internet of Things and other fields.
[0055] NOC stands for Network Operations Center, which is a centralized organization that houses network switching equipment, management systems, and storage devices. It is also a monitoring center with hardware and software components. NOC module stands for Network Operations Center module.
[0056] Among them, DDR, which stands for Double Data Rate, means double data rate in Chinese, and DDR memory is double data rate memory.
[0057] The first preset value is, for example, 1.
[0058] In one embodiment, the NOC module may include at least one of a NOC module for connecting to an application processor, a NOC module for connecting to a graphics processing unit, and a NOC module for connecting to a DDR memory controller.
[0059] For example, the NOC modules used to connect to the application processor are AP0_NOC and AP1_NOC. AP0_NOC is a NOC interface connected to application processor 0, namely AP0, and includes at least one port. AP1_NOC is a NOC interface connected to application processor 1, namely AP1, and includes at least one port.
[0060] For example, a NOC module for connecting to a graphics processing unit, that is, a NOC interface for connecting to a GPU, can be abbreviated as GPU_NOC, and the interface includes at least one port.
[0061] For example, a NOC module for connecting to a DDR memory controller is DDR_NOC, and an interface for connecting to a DDR memory controller includes at least one port. DDR_NOC can ensure that data can be efficiently transmitted between the memory and the processing unit, and optimize memory bandwidth and latency.
[0062] It can be seen that when the first string is written into the NOC monitoring file, the trusted firmware in the secure world is called. The trusted firmware can determine the physical address of the control register corresponding to the NOC module in the DDR memory according to the physical address of each NOC module, and write the first preset value to the physical address of the control register corresponding to the NOC module, so that the control register corresponding to the NOC module is enabled.
[0063] S120, after the control register corresponding to each NOC module is enabled, read the data register corresponding to the control register to obtain the bandwidth value of the NOC module;
[0064] It is understandable that the data register corresponding to the NOC module can be read only after the control register corresponding to the control register is enabled, and the bandwidth value of the NOC module is recorded in the data register. Therefore, the bandwidth value of the NOC module can be obtained by reading the data register corresponding to the control register.
[0065] S130 , performing bandwidth display operation according to the read bandwidth values of the respective NOC modules.
[0066] That is, after reading the bandwidth values of the respective NOC modules, subsequent bandwidth display operations can be performed.
[0067] In one embodiment, the method further comprises:
[0068] When a second character string indicating stop is detected in the NOC monitoring file, the trusted firmware in the secure world is called through a security monitoring call instruction, so that the trusted firmware closes the control register corresponding to each NOC module by writing a second preset value to the physical address of the control register corresponding to the NOC module; wherein, if the control register corresponding to a NOC module is closed, the data register corresponding to the control register cannot be read.
[0069] The second character string, for example, stop, indicates stopping the bandwidth monitoring operation.
[0070] The second preset value is, for example, 0.
[0071] It can be seen that when the second character string is written into the NOC monitoring file, the operating system kernel calls the trusted firmware, and the trusted firmware writes the second preset value to the physical address of the control register corresponding to each NOC module, thereby closing the control register corresponding to the NOC module, so that the bandwidth value in the data register corresponding to the control register cannot be read, thereby stopping the bandwidth monitoring work.
[0072] In one embodiment, the process of the trusted firmware determining the physical address of the control register corresponding to each NOC module in the DDR memory according to the physical address of each NOC module includes: the trusted firmware adds the physical address of each NOC module to the offset of each memory area of the NOC module in the DDR memory to obtain the physical address of each memory area of the NOC module in the DDR memory, and adds the physical address of each memory area of the NOC module in the DDR memory to the first preset offset to obtain the physical address of the control register corresponding to each memory area of the NOC module in the DDR memory.
[0073] There may be multiple memory areas in the DDR memory, for example, memory area 1 and memory area 0.
[0074] For example, the process by which the trusted firmware determines the physical address of the control register corresponding to the NOC module in the DDR memory may include: adding the physical address of each NOC module to the offset of memory area 1 and memory area 0 of the NOC module in the DDR memory, respectively, to obtain the physical address of memory area 1 and memory area 0 of the NOC module in the DDR memory, and adding the physical address of memory area 1 and memory area 0 of the NOC module in the DDR memory to the first preset offset, respectively, to obtain the physical address of the control register corresponding to memory area 1 and memory area 0 of the NOC module in the DDR memory.
[0075] In one embodiment, the method further comprises: converting the physical base address of each NOC module into a kernel virtual address;
[0076] Correspondingly, after the control register corresponding to each NOC module is enabled, the data register corresponding to the control register is read to obtain the bandwidth value of the NOC module, including:
[0077] After the control register corresponding to each NOC module is enabled, determine the memory virtual address of the data register corresponding to the control register corresponding to each memory area of the NOC module in the DDR memory; wherein the memory virtual address of the data register is the address obtained by adding the kernel virtual address corresponding to the memory area of the NOC module in the DDR memory to the second preset offset;
[0078] According to the memory virtual address of the data register corresponding to the control register corresponding to each memory area of each NOC module in the DDR memory, the data register is read to obtain the bandwidth value of the NOC module.
[0079] It is understandable that in the Linux kernel, the physical address cannot be accessed directly, and the physical address needs to be converted into a virtual address before it can be accessed. That is, the operating system kernel cannot use physical addresses, but can only use kernel virtual addresses, and the trusted firmware can only use physical addresses, so the operating system kernel can only convert the physical base address of each NOC module into a kernel virtual address. In this case, after the control register corresponding to each NOC module is enabled, the operating system kernel adds the kernel virtual address corresponding to each memory area of a NOC module in the DDR memory to the second preset offset, and obtains the memory virtual address of the data register corresponding to the control register corresponding to the memory area of the NOC module in the DDR memory, and then reads data according to the memory virtual address, and obtains the bandwidth value corresponding to the memory area of the NOC module in the DDR memory.
[0080] Furthermore, converting the physical base address of each NOC module into a kernel virtual address may include:
[0081] Load NOC monitoring driver module;
[0082] The physical base address of each NOC module is converted into a kernel virtual address through the NOC monitoring driver module.
[0083] The NOC monitoring driver module, namely NOC Monitor, is a tool or system for monitoring the NOC (network operation center), which is mainly used to monitor and manage network switching equipment, management systems, and storage devices. The main functions of NOC Monitor include monitoring all backbone links and network equipment, ensuring the continuous operation of servers and their services, providing quality support for internal or external customers, and providing fault repair functions for all networks and systems.
[0084] It can be seen that when address conversion is required, the NOC monitoring driver module is loaded, and then the NOC monitoring driver module converts the physical base address of the NOC module into a kernel virtual address.
[0085] For example, define a global structure object sn, which contains struct noc_ddr_regap0, struct noc_ddr_reg ap1, struct noc_ddr_reg gpu, and struct noc_ddr_reg ddr sub-members. Use the ioremap function to map the physical address NOC_AP0_REG_BASE of AP0_NOC to the kernel virtual address, and save the virtual address to the virt_addr member in the member object ap0 of sn. Similarly, map the physical address NOC_AP1_REG_BASE of AP1_NOC, the physical address NOC_GPU_REG_BASE of GPU_NOC, and the physical address NOC_DDR_REG_BASE of DDR_NOC to the kernel virtual address, and save the kernel virtual address to the virt_addr member in each object.
[0086] In one embodiment, performing bandwidth display operation according to the read bandwidth values of each NOC module may include:
[0087] Display the bandwidth value read from the data register corresponding to the control register of each memory area in the DDR memory of each NOC module;
[0088] And / or, according to the bandwidth value read from the data register corresponding to the control register corresponding to each memory area in the DDR memory of each NOC module, the total bandwidth value corresponding to the NOC module is calculated, and the total bandwidth value corresponding to the NOC module is displayed.
[0089] For example, the bandwidth value read from the data register corresponding to the control register of each NOC module in the DDR memory area 1 and the memory area 0 is directly displayed. The total bandwidth value of the NOC module in the DDR memory can also be calculated based on the bandwidth value read from the data register corresponding to the control register of each NOC module in the DDR memory area 1 and the memory area 0, so as to display the total bandwidth value.
[0090] In actual scenarios, trusted firmware is required to perform some configuration operations, such as initial setting of parameters for each NOC module. Parameters, such as port priority, mode, bandwidth value, and saturation value. The parameters are explained as follows:
[0091] (1) Priority: Indicates the priority of each NOC module in accessing memory, which is set based on the mode. It is set through the two fields P0 and P1. P0 represents the low throughput priority in the regulator mode. In some modes, there is a write permission priority in the four modes of Fixed, Limiter, Bypass, and Regulator. P1 represents the high throughput priority in the regulator mode. There is a read permission priority in the four modes of Fixed, Limiter, Bypass, and Regulator.
[0092] (2) Mode: There are four modes: Fixed (static priority), Limiter (this mode means setting the expected bandwidth. When the expected bandwidth is exceeded, subsequent data transmission will be blocked), Bypass (this mode means passing through without setting the priority), and Regulator (this mode means setting the expected bandwidth. When the bandwidth is higher than the expected bandwidth, the low priority is used; when the bandwidth is lower than the expected bandwidth, the high priority is used).
[0093] (3) Bandwidth: The critical value of the throughput for accessing memory. This bandwidth is not the bandwidth value that needs to be monitored in this article.
[0094] (4) Saturation value saturaton: defines the bandwidth counter size.
[0095] Each NOC module has several ports, and each port has a noc base address reg_base, which is set by the internal hardware of the soc. The noc base address reg_base is added with the offsets corresponding to priority, mode, bandwidth and saturaton, and the corresponding addresses of priority, mode, bandwidth and saturaton can be obtained, and the corresponding parameter values can be written into the addresses. In this way, the noc parameters of each port are initialized.
[0096] In addition to the initial setting of parameters for each NOC module, the ATF trusted firmware can also declare a runtime service through DECLARE_RT_SVC. The structure of this service contains various properties and methods of the runtime service, such as the name of the service, SMC type, processing function, etc. This structure will be used by the framework code of the ATF trusted firmware to call these functions at the appropriate time. The processing function name is set to sip_smc_handler. In this processing function, multiple parameters will be received, including the FID and register values of the SMC. The full spelling of FID in English is Function Identifier, and its Chinese name is function identifier. It is used to find the corresponding processing function.
[0097] DECLARE_RT_SVC is a macro that defines a set of services. That is, DECLARE_RT_SVC is used in the ATF trusted component to declare and register runtime services. These services allow specific communications and function calls between the secure world and the non-secure world. Custom runtime services can be implemented by defining the service name, call type, and processing function.
[0098] Among them, NOC monitoring files, for example, / proc / se_noc_monitor files. Specifically, the / proc / se_noc_monitor file can be created in the kernel by calling the proc_create function. When the / proc / se_noc_monitor file is created, the struct proc_ops interface will be defined. The struct proc_ops interface will implement the following two functions:
[0099] (1) noc_monitor_open: When you enter the debug mode and use the cat / proc / se_noc_monitor command, the NOC bandwidth values of AP0 / AP1 / GPU / DDR are displayed.
[0100] (2) noc_monitor_write: When entering debug mode and writing the start or stop string to the / proc / se_noc_monitor file, the secure monitoring call instruction will be used to enter the trusted firmware, starting the transition from the non-secure world to the secure world.
[0101] Specifically, the service processing function sip_smc_handler of the ATF trusted component can realize the call entry from the non-secure world to the secure world. In this function, two smc_fids are defined, namely SIP_NOC_TRUST_START and SIP_NOC_TRUST_STOP. In the kernel driver, the security monitoring call instruction is used to switch from the non-secure world to the secure world. The smc_fids passed in are NOC_TRUST_DDR_START and NOC_TRUST_DDR_STOP to ATF to start or stop the NOC function.
[0102] Among them, NOC_TRUST_DDR_START and NOC_TRUST_DDR_STOP correspond to SIP_NOC_TRUST_START and SIP_NOC_TRUST_STOP in the ATF trusted component respectively.
[0103] The SMC call process is as follows: When the NOC monitoring function needs to be enabled, the arm_smccc_smc function is called in the NOC_MONITOR driver, and the function passes in smc_fid, which is NOC_TRUST_DDR_START. The arm_smccc_smc function is usually used to execute SMC instructions in ARM architecture systems to communicate between the non-secure world and the secure world. When the NOC monitoring function needs to be disabled, the arm_smccc_smc function is called in the NOC_MONITOR driver, and smc_fid is passed in, which is NOC_TRUST_DDR_STOP.
[0104] Specifically, when the operating system kernel calls the trusted firmware in the secure world through the security monitoring call instruction, if the incoming smc_fid = NOC_TRUST_DDR_START, then the noc_monitor_start function is called, and the noc_config function is called in the function, thereby calculating the following address:
[0105] AP0_DDR0_NOC=
[0106] NOC_AP0_REG_BASE+NOC_AP0_DDR0_OFFSET;
[0107] AP0_DDR1_NOC=
[0108] NOC_AP0_REG_BASE+NOC_AP0_DDR1_OFFSET;
[0109] AP1_DDR0_NOC=
[0110] NOC_AP1_REG_BASE+NOC_AP1_DDR0_OFFSET;
[0111] AP1_DDR1_NOC=
[0112] NOC_AP1_REG_BASE+NOC_AP1_DDR1_OFFSET;
[0113] GPU_DDR0_NOC=
[0114] NOC_GPU_REG_BASE+NOC_GPU_DDR0_OFFSET;
[0115] GPU_DDR1_NOC=
[0116] NOC_GPU_REG_BASE+NOC_GPU_DDR1_OFFSET;
[0117] DDR_DDR0_NOC=
[0118] NOC_DDR_REG_BASE+NOC_DDR_DDR0_OFFSET;
[0119] DDR_DDR1_NOC=
[0120] NOC_DDR_REG_BASE+NOC_DDR_DDR1_OFFSET.
[0121] Among them, AP0_DDR0_NOC is the physical address of DDR0 of the AP0_NOC module in the DDR memory. AP0_DDR1_NOC is the physical address of DDR1 of the AP0_NOC module in the DDR memory. AP1_DDR0_NOC is the physical address of DDR0 of the AP1_NOC module in the DDR memory. AP1_DDR1_NOC is the physical address of DDR1 of the AP1_NOC module in the DDR memory. GPU_DDR0_NOC is the physical address of DDR0 of the GPU_NOC module in the DDR memory. GPU_DDR1_NOC is the physical address of DDR1 of the GPU_NOC module in the DDR memory. DDR_DDR0_NOC is the physical address of DDR0 of the DDR_NOC module in the DDR memory. DDR_DDR1_NOC is the physical address of DDR1 of the DDR_NOC module in the DDR memory.
[0122] Among them, NOC_AP0_REG_BASE is the physical address of the AP0_NOC module. NOC_AP1_REG_BASE is the physical address of the AP1_NOC module. NOC_GPU_REG_BASE is the physical address of the GPU_NOC module. NOC_DDR_REG_BASE is the physical address of the DDR_NOC module.
[0123] Among them, NOC_AP0_DDR0_OFFSET is the offset of the memory area DDR0 of the AP0_NOC module in the DDR memory. NOC_AP0_DDR1_OFFSET is the offset of the memory area DDR1 of the AP0_NOC module in the DDR memory. NOC_AP1_DDR0_OFFSET is the offset of the memory area DDR0 of the AP1_NOC module in the DDR memory. NOC_AP1_DDR1_OFFSET is the offset of the memory area DDR1 of the AP1_NOC module in the DDR memory. NOC_GPU_DDR0_OFFSET is the offset of the memory area DDR0 of the GPU_NOC module in the DDR memory. NOC_GPU_DDR1_OFFSET is the offset of the memory area DDR1 of the GPU_NOC module in the DDR memory. NOC_DDR_DDR0_OFFSET is the offset of the memory area DDR0 of the DDR_NOC module in the DDR memory. NOC_DDR_DDR1_OFFSET is the offset of the memory area DDR1 of the DDR_NOC module in the DDR memory.
[0124] Next, call the noc_enable function, which has two parameters: one is the NOC physical address, and the other is the enable state value 1, as follows:
[0125] (1) Use the writel function to write enable = 1 to the AP0_DDR0_NOC+NOC_CFG_CTRL_REG address to enable the AP0_DDR0 control register.
[0126] (2) Use the writel function to write enable=1 to the AP0_DDR1_NOC+NOC_CFG_CTRL_REG address to enable the AP0_DDR1 control register.
[0127] (3) Use the writel function to write enable=1 to the AP1_DDR0_NOC+NOC_CFG_CTRL_REG address to enable the AP1_DDR0 control register.
[0128] (4) Use the writel function to write enable=1 to the AP1_DDR1_NOC+NOC_CFG_CTRL_REG address to enable the AP1_DDR0 control register.
[0129] (5) Use the writel function to write enable=1 to the GPU_DDR0_NOC+NOC_CFG_CTRL_REG address to enable the GPU_DDR0 control register.
[0130] (6) Use the writel function to write enable=1 to the GPU_DDR1_NOC+NOC_CFG_CTRL_REG address to enable the GPU_DDR1 control register.
[0131] (7) Use the writel function to write enable=1 to the DDR_DDR0_NOC+NOC_CFG_CTRL_REG address to enable the DDR_DDR0 control register.
[0132] (8) Use the writel function to write enable=1 to the DDR_DDR1_NOC+NOC_CFG_CTRL_REG address to enable the DDR_DDR1 control register.
[0133] Among them, NOC_CFG_CTRL_REG is the first preset offset.
[0134] The configuration is now complete, waiting for the operating system kernel to read the NOC bandwidth.
[0135] Next, the operating system kernel can use the readrw function to read the data registers corresponding to the control registers of the NOC modules of AP0, AP1, GPU, and DDR in each memory area in the DDR memory, thereby obtaining the bandwidth values of the NOC modules of AP0, AP1, GPU, and DDR in each memory area in the DDR memory, for example, the bandwidth values of memory area 0 and memory area 1 of the NOC modules of AP0, AP1, GPU, and DDR in the DDR memory, respectively, and then calculate the total bandwidth value of each NOC module in the DDR memory, and then provide an interface for the upper application layer to directly obtain the bandwidth value, or write it to the kernel log subsystem.
[0136] Specifically, the operating system kernel implements the noc_monitor_read function to save the bandwidth values read by DDR0_NOC and DDR1_NOC.
[0137] In the noc_monitor_read function: add NOC_AP0_DDR0_OFFSET and NOC_AP0_DDR1_OFFSET to the virt_addr member object in the member object ap0 of sn, and get the ap0_ddr0_base address and ap0_ddr1_base address. The ap0_ddr0_base address and ap0_ddr1_base address are the kernel virtual addresses corresponding to the memory area ddr0 and the memory area ddr1 of the AP0_NOC module in the DDR memory, respectively. Read the value in ap0_ddr0_base+NOC_CNTR0_VAL_REG through the readw function and save it to ddr0_val in the member object ap0 of sn, and read the value in ap0_ddr1_base+NOC_CNTR1_VAL_REG through the readw function and save it to ddr1_val in the member object ap0 of sn. Among them, NOC_CNTR0_VAL_REG is the second preset offset.
[0138] The same is true for the reading process of other NOC modules.
[0139] At this point, the bandwidth value is read and can be displayed directly. For example, the bandwidth value of each NOC module is displayed through ddr0_val and ddr1_val respectively. You can also perform certain operations on the read bandwidth values, for example, calculate the total bandwidth value of the AP0_NOC module.
[0140] After the reading is completed, the NOC monitoring function is stopped. At this time, when the operating system kernel enters the trusted firmware through the security monitoring call instruction, if the received smc_fid = NOC_TRUST_DDR_STOP, the noc_enable function is called. This function has two parameters: one is the NOC physical address, and the other is the enable state value 0, as follows:
[0141] (1) Write the value of enable=0 to the address AP0_DDR0_NOC+NOC_CFG_CTRL_REG through the writel function to turn off the AP0_DDR0 control register.
[0142] (2) Write the value of enable=0 to the AP0_DDR1_NOC+NOC_CFG_CTRL_REG address through the writel function to turn off the AP0_DDR1 control register.
[0143] (3) Write the value of enable=0 to the address of AP1_DDR0_NOC+NOC_CFG_CTRL_REG through the writel function to close the AP1_DDR0 control register.
[0144] (4) Write the value of enable=0 to the address of AP1_DDR1_NOC+NOC_CFG_CTRL_REG through the writel function to close the AP1_DDR1 control register.
[0145] At this point, the control registers corresponding to each NOC module are closed.
[0146] In summary, the embodiments of the present invention can realize automatic monitoring of the bandwidth value of the NOC module, facilitate the debugging of the system, and do not require the debugging personnel to spend a lot of time and energy to troubleshoot the problem. This not only improves efficiency, but also reduces misjudgments and missed judgments, thereby improving the stability and reliability of the system.
[0147] In a second aspect, an embodiment of the present invention provides a network operation center bandwidth monitoring device, wherein the device is deployed on an operating system kernel, see Figure 2 , the device 100 comprises:
[0148] The first calling module 110 is used to call the trusted firmware in the secure world through a security monitoring calling instruction when a first character string indicating a start is written into a pre-built network operation center monitoring file, so that the trusted firmware determines the physical address of the control register corresponding to each network operation center module in the double data rate memory according to the physical address of each network operation center module, and enables the control register corresponding to the network operation center module by writing a first preset value into the physical address of the control register corresponding to the network operation center module;
[0149] The bandwidth reading module 120 is used to read the data register corresponding to each network operation center module after the control register corresponding to the control register is enabled, so as to obtain the bandwidth value of the network operation center module;
[0150] The bandwidth display module 130 is used to perform bandwidth display operations according to the bandwidth values of the respective network operation center modules read.
[0151] In one embodiment, the network operation center module includes at least one of a network operation center module for connecting to an application processor, a network operation center module for connecting to a graphics processing unit, and a network operation center module for connecting to a double data rate memory controller.
[0152] In one embodiment, the device may further include:
[0153] The second calling module is used to call the trusted firmware in the secure world through a security monitoring calling instruction when it detects that a second character string indicating stop is written into the network operation center monitoring file, so that the trusted firmware closes the control register corresponding to each network operation center module by writing a second preset value to the physical address of the control register corresponding to the network operation center module; wherein, if the control register corresponding to a network operation center module is closed, the data register corresponding to the control register cannot be read.
[0154] In one embodiment, the process by which the trusted firmware determines the physical address of the control register corresponding to each network operation center module in the double data rate memory based on the physical address of each network operation center module includes: the trusted firmware adds the physical address of each network operation center module to the offset of each memory area of the network operation center module in the double data rate memory to obtain the physical address of each memory area of the network operation center module in the double data rate memory, and adds the physical address of each memory area of the network operation center module in the double data rate memory to the first preset offset to obtain the physical address of the control register corresponding to each memory area of the network operation center module in the double data rate memory.
[0155] In one embodiment, the device may further include:
[0156] An address translation module, used to translate the physical base address of each network operation center module into a kernel virtual address;
[0157] Correspondingly, the bandwidth reading module is specifically used for: after the control register corresponding to each network operation center module is enabled, determining the memory virtual address of the data register corresponding to the control register corresponding to each memory area of the network operation center module in the double data rate memory; wherein the memory virtual address of the data register is the address obtained by adding the kernel virtual address corresponding to the memory area of the network operation center module in the double data rate memory and the second preset offset; according to the memory virtual address of the data register corresponding to the control register corresponding to each memory area of each network operation center module in the double data rate memory, reading the data register to obtain the bandwidth value of the network operation center module.
[0158] In one embodiment, the address conversion module is specifically used to: load a network operation center monitoring driver module; and convert the physical base address of each network operation center module into a kernel virtual address through the network operation center monitoring driver module.
[0159] In one embodiment, the bandwidth display module is specifically used to: display the bandwidth value read from the data register corresponding to the control register corresponding to each memory area in the double data rate memory of each network operation center module; and / or, based on the bandwidth value read from the data register corresponding to the control register corresponding to each memory area in the double data rate memory of each network operation center module, calculate the total bandwidth value corresponding to the network operation center module, and display the total bandwidth value corresponding to the network operation center module.
[0160] It is understandable that the explanation, specific implementation, beneficial effects, examples, etc. of the relevant contents in the device provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.
[0161] In a third aspect, an embodiment of the present invention provides a computer-readable medium, on which computer instructions are stored. When the computer instructions are executed by a processor, the processor executes the method provided in the first aspect.
[0162] Specifically, a system or device equipped with a storage medium can be provided, on which software program code that implements the functions of any of the above-mentioned embodiments is stored, and a computer (or CPU or MPU) of the system or device can be enabled to read and execute the program code stored in the storage medium.
[0163] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.
[0164] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer by a communication network.
[0165] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.
[0166] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or to a memory provided in an expansion module connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or expansion module is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.
[0167] It is understandable that the explanation, specific implementation methods, beneficial effects, examples, etc. of the relevant contents in the computer-readable medium provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.
[0168] In a fourth aspect, an embodiment of the present specification provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements the method in any embodiment of the specification.
[0169] It is understandable that the explanation, specific implementation, beneficial effects, examples, etc. of the relevant contents in the computing device provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.
[0170] It should be noted that the terms used in the present invention are only for describing specific embodiments, rather than limiting the scope of the present application. As shown in the present specification and claims, unless the context clearly indicates an exception, the words "one", "a", "a kind of" and / or "the" do not specifically refer to the singular, but may also include the plural. The terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such a process, method or device. In the absence of further restrictions, the elements defined by the sentence "include one..." do not exclude the presence of other identical elements in the process, method or device including the elements.
[0171] It should also be noted that the terms "center", "up", "down", "left", "right", "vertical", "horizontal", "inside", "outside", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention. Unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", etc. should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be an indirect connection through an intermediate medium, or it can be a connection between the two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0172] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the technical solutions of the embodiments of the present invention.
Claims
1. A network operation center bandwidth monitoring method, characterized in that: The method is executed by an operating system kernel, and the method includes: When a first character string indicating a start is written into a pre-built network operation center monitoring file, the trusted firmware in the secure world is called through a secure monitoring call instruction, so that the trusted firmware determines the physical address of the control register corresponding to each network operation center module in the double data rate memory according to the physical address of each network operation center module, and enables the control register corresponding to the network operation center module by writing a first preset value into the physical address of the control register corresponding to the network operation center module; After the control register corresponding to each network operation center module is enabled, the data register corresponding to the control register is read to obtain the bandwidth value of the network operation center module; The bandwidth display operation is performed according to the bandwidth values of each network operation center module that are read.
2. The method according to claim 1, characterized in that The network operation center module includes at least one of a network operation center module for connecting to an application processor, a network operation center module for connecting to a graphics processing unit, and a network operation center module for connecting to a double data rate memory controller.
3. The method according to claim 1, characterized in that Also includes: When a second character string indicating stop is written into the network operation center monitoring file, the trusted firmware in the secure world is called through a security monitoring call instruction, so that the trusted firmware closes the control register corresponding to each network operation center module by writing a second preset value to the physical address of the control register corresponding to the network operation center module; If a control register corresponding to a network operation center module is turned off, the data register corresponding to the control register cannot be read.
4. The method according to claim 1, characterized in that: The process by which the trusted firmware determines the physical address of the control register corresponding to each network operation center module in the double data rate memory based on the physical address of each network operation center module includes: the trusted firmware adds the physical address of each network operation center module to the offset of each memory area of the network operation center module in the double data rate memory to obtain the physical address of each memory area of the network operation center module in the double data rate memory, and adds the physical address of each memory area of the network operation center module in the double data rate memory to the first preset offset to obtain the physical address of the control register corresponding to each memory area of the network operation center module in the double data rate memory.
5. The method according to claim 4, characterized in that Also includes: Convert the physical base address of each network operation center module to a kernel virtual address; Correspondingly, after the control register corresponding to each network operation center module is enabled, reading the data register corresponding to the control register to obtain the bandwidth value of the network operation center module includes: After the control register corresponding to each network operation center module is enabled, determining the memory virtual address of the data register corresponding to the control register corresponding to each memory area of the network operation center module in the double data rate memory; wherein the memory virtual address of the data register is the address obtained by adding the kernel virtual address corresponding to the memory area in the double data rate memory of the network operation center module to the second preset offset; According to the memory virtual address of the data register corresponding to the control register corresponding to each memory area in the double data rate memory of each network operation center module, the data register is read to obtain the bandwidth value of the network operation center module.
6. The method according to claim 5, characterized in that The step of converting the physical base address of each network operation center module into a kernel virtual address includes: Load the network operation center monitoring driver module; The physical base address of each network operation center module is converted into a kernel virtual address through the network operation center monitoring driver module.
7. The method according to claim 4, characterized in that The bandwidth display operation is performed according to the read bandwidth values of the respective network operation center modules, including: Displaying the bandwidth value read by each network operation center module in the data register corresponding to the control register corresponding to each memory area in the double data rate memory; And / or, based on the bandwidth values read from the data registers corresponding to the control registers corresponding to the respective memory areas in the double data rate memory of each network operation center module, the total bandwidth value corresponding to the network operation center module is calculated, and the total bandwidth value corresponding to the network operation center module is displayed.
8. A network operation center bandwidth monitoring device, characterized in that: The device is deployed on the operating system kernel, and the device includes: a first calling module, configured to call the trusted firmware in the secure world through a security monitoring calling instruction when a first character string indicating a start is written into a pre-built network operation center monitoring file, so that the trusted firmware determines the physical address of the control register corresponding to each network operation center module in the double data rate memory according to the physical address of each network operation center module, and enables the control register corresponding to the network operation center module by writing a first preset value into the physical address of the control register corresponding to the network operation center module; The bandwidth reading module is used to read the data register corresponding to each network operation center module after the control register corresponding to the control register is enabled, so as to obtain the bandwidth value of the network operation center module; The bandwidth display module is used to perform bandwidth display operations according to the bandwidth values of each network operation center module read.
9. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed in a computer, the computer is caused to execute the method according to any one of claims 1 to 7.
10. A computing device, characterized in that The method comprises a memory and a processor, wherein the memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 7 is implemented.