Self-adaptive management and control method and device for PCIe equipment and electronic equipment

By quantifying the weight levels of PCIe devices and adjusting the coefficients based on their parameters and device types, adaptive management of PCIe devices is achieved, solving the problem of rigid device management in existing technologies and improving performance and efficiency.

CN121785979APending Publication Date: 2026-04-03XINHUASAN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-25
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

The existing PCIe device management strategies are rigid and cannot adapt to the differentiated needs of physical network card pass-through, virtual network cards, and PCIe switch cascading.

Method used

By acquiring parameters of PCIe devices, such as PCIe hop count to the root consortium, PCIe link speed, NUMA distance, and ACS enabled status, and combining these with device type to determine adjustment coefficients, the weight level of devices can be quantified to achieve adaptive management.

Benefits of technology

It improves the performance of PCIe devices, reduces virtual NIC latency across NUMA, compresses PCIe switch broadcast latency, increases throughput, and reduces resource configuration error rate and maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121785979A_ABST
    Figure CN121785979A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an adaptive management and control method and device for PCIe equipment and electronic equipment. According to the embodiment, the weight of the PCIe device is quantized based on the four dimensions of PCIe hops from the PCIe device to the root complex, the PCIe link speed of the PCIe device, the NUMA distance of the PCIe device and whether the PCIe device starts the ACS or not in combination with the adjustment coefficients corresponding to the values under the four dimensions under the device type of the PCIe device, so that the PCIe device is managed and controlled in a self-adaptive mode based on the weight. And adaptive management and control of the PCIe equipment are realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to network communication technology, and in particular to adaptive control methods, apparatus and electronic devices for PCIe devices. Background Technology

[0002] The Peripheral Component Interconnect Express (PCIe) is a high-speed serial computer expansion bus standard characterized by high bandwidth and low latency, and is widely used in computers and peripheral devices. Taking servers as an example, server peripherals include devices such as root complexes, PCIe endpoint devices, and switches.

[0003] Here, the Root Complex, typically integrated within the CPU or chipset, serves as the command center of the PCIe architecture. It connects the CPU to PCIe endpoint devices, managing and configuring devices, coordinating data transmission, and so on. PCIe endpoint devices, such as graphics cards, network cards, sound cards, and solid-state drives (SSDs), directly perform specific functions and interact with the CPU and memory. A switch is used to expand the PCIe bus, converting one PCIe port into multiple ports to enable the connection and data exchange of multiple devices.

[0004] Currently, the management of PCIe devices is based on static policies, which leads to rigid management of PCIe devices. Summary of the Invention

[0005] This application provides an adaptive management method, apparatus, and electronic device for PCIe devices to achieve adaptive management of PCIe devices.

[0006] This application provides an adaptive management method for PCIe devices, the method comprising: Obtain the first to fourth parameters of the PCIe device; wherein, the first parameter is used to indicate the number of PCIe hops from the PCIe device to the Root Complex; the second parameter is used to indicate the PCIe link speed of the PCIe device; the third parameter is used to indicate the NUMA distance of the PCIe device; and the fourth parameter is used to indicate whether the PCIe device has Access Control Service (ACS) enabled. Based on the device type of the PCIe device, determine the adjustment coefficients corresponding to the first to fourth parameters of the PCIe device under that device type; The weight level of the PCIe device is determined based on the first parameter to the fourth parameter and the adjustment coefficients corresponding to the first parameter to the fourth parameter respectively. Based on the weight level of the PCIe device, corresponding control measures are implemented for the PCIe device.

[0007] An adaptive control device for PCIe devices, the device comprising: The acquisition unit is used to obtain the first to fourth parameters of the PCIe device; wherein, the first parameter is used to indicate the number of PCIe hops from the PCIe device to the Root Complex; the second parameter is used to indicate the PCIe link speed of the PCIe device; the third parameter is used to indicate the NUMA distance of the PCIe device; and the fourth parameter is used to indicate whether the PCIe device has access control service ACS enabled. The determining unit is configured to determine, based on the device type of the PCIe device, the adjustment coefficients corresponding to the first to fourth parameters of the PCIe device under the device type; The processing unit is configured to determine the weight level of the PCIe device based on the first parameter to the fourth parameter and the adjustment coefficients corresponding to the first parameter to the fourth parameter respectively; and to perform corresponding control on the PCIe device based on the weight level of the PCIe device.

[0008] An electronic device comprising: Processor; and Computer-readable storage medium; The computer-readable storage medium stores computer program instructions that, when executed by the processor, perform the steps in the method described above.

[0009] As can be seen from the above technical solutions, this embodiment can quantify the weight of the PCIe device based on four dimensions: the number of PCIe hops from the PCIe device to the root association, the PCIe link speed of the PCIe device, the NUMA distance of the PCIe device, and whether the PCIe device has ACS enabled. It also combines the adjustment coefficients corresponding to the four dimensions under the device type of the PCIe device to quantify the weight of the PCIe device. This allows for adaptive management of the PCIe device based on the weight, thus achieving adaptive management of the PCIe device and avoiding the rigid management of the PCIe device caused by the existing static strategy.

[0010] Furthermore, this embodiment takes into account the number of PCIe hops from the PCIe device to the root association when quantifying the weight of the PCIe device. This is equivalent to taking into account the impact of PCIe hop depth on latency, ensuring that the final quantified weight of the PCIe device is accurate, so as to accurately adaptively manage the PCIe device and improve performance.

[0011] Furthermore, this embodiment takes into account the NUMA distance of the PCIe device when quantifying the weight of the PCIe device, which is equivalent to taking into account the performance loss of cross-node access caused by the NUMA topology, so as to better adaptively manage the PCIe device and improve performance.

[0012] Furthermore, this embodiment considers whether the PCIe device supports ACS when quantifying the weight of the PCIe device, so as to predict the DMA attack risk of the pass-through device in advance, and better realize the adaptive management and control of the PCIe device, thereby improving performance. Attached Figure Description

[0013] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0014] Figure 1 A flowchart illustrating the method provided in this application embodiment; Figure 2 This is a structural diagram of the device provided in the embodiments of this application; Figure 3 This is a hardware structure diagram provided for an embodiment of this application. Detailed Implementation

[0015] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0016] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.

[0017] In PCIe scenarios, physical network interface card (NIC) passthrough, PCIe switch cascading, and virtual NIC (vNIC) are three different methods of utilizing PCIe resources and configuring networks. The differences between the three lie in the allocation logic of PCIe resources, the network data forwarding path, and the applicable scenarios.

[0018] Physical network interface card passthrough refers to directly assigning a server's physical network interface card (NIC) to a virtual machine (VM) or container, granting the VM or container exclusive hardware access to that NIC.

[0019] PCIe Switch cascading refers to using a PCIe Switch as a standalone hardware component (usually onboard or external expansion card). One end connects to the server's root complex, while the other end provides multiple PCIe ports. Each PCIe port can connect to a physical network interface card (NIC). All NICs connected to the PCIe Switch share the bandwidth of the upstream PCIe link, i.e., the link between the PCIe Switch and the root complex. The PCIe Switch is responsible for routing and forwarding PCIe transactions.

[0020] A virtual network interface card (NIC) is a network interface simulated by the host hypervisor or operating system. It does not correspond to a physical NIC but uses the host's physical NIC to forward data. Essentially, it is a logical interface for network virtualization. For example, a Single Root I / O Virtualization (SRIOV) NIC (also called a virtual NIC) is based on the SR-IOV function of a physical NIC. The physical NIC is divided into multiple virtual functions (VFs), and each VF is assigned as an independent virtual NIC to the virtual machine. The physical function (PF) of the physical NIC is managed by the host.

[0021] The current method of managing PCIe devices using static policies results in rigid management of PCIe devices, making it unable to adapt to the differentiated needs of physical network card pass-through, virtual network cards, and PCIe switch cascading.

[0022] Based on the above-mentioned technical problems, embodiments of this application provide an adaptive management method, apparatus, and electronic device for PCIe devices to achieve adaptive management of PCIe devices.

[0023] To enable those skilled in the art to better understand the technical solutions provided in the embodiments of this application, and to make the above-mentioned objectives, features and advantages of the embodiments of this application more apparent and understandable, the technical solutions in the embodiments of this application will be further described in detail below with reference to the accompanying drawings.

[0024] See Figure 1 , Figure 1 This is a flowchart illustrating a method provided in an embodiment of this application. This method can be applied to electronic devices such as servers. These electronic devices include PCIe devices such as physical network interface cards (NICs), PCIe switches, and virtual NICs.

[0025] like Figure 1 As shown, the process may include the following steps: Step 101: Obtain the first to fourth parameters of the PCIe device; wherein, the first parameter is used to indicate the number of PCIe hops from the PCIe device to the root federation; the second parameter is used to indicate the PCIe link speed of the PCIe device; the third parameter is used to indicate the NUMA distance of the PCIe device; and the fourth parameter is used to indicate whether the PCIe device has access control service (ACS) enabled.

[0026] In this embodiment, for each PCIe device, the distance from the PCIe device to the root federation in the PCIe device connection topology of the aforementioned electronic device, such as a server, can be calculated, for example, the minimum distance. This distance, for example, the minimum distance, is the PCIe hop count from the PCIe device to the root federation.

[0027] As one embodiment, the PCIe link speed of the PCIe device can be obtained by reading the PCIe device's Capability register. Optionally, the PCIe link speed of the PCIe device can be the maximum link speed supported by the PCIe device recorded in the PCIe device's Capability register, or the actual link speed of the PCIe device; this embodiment does not specifically limit this. Here, the unit of PCIe link speed is, for example, GT / s.

[0028] In practical applications, the aforementioned electronic devices, such as servers, are divided into multiple Non-Unified Memory Access (NUMA) nodes. Each NUMA node contains an independent CPU, local memory, and a directly connected PCIe controller / slot. The affiliation of a PCIe device is determined by the NUMA node it is physically connected to. In one implementation, such as a PCIe device directly connecting to a local NUMA node, the CPU or / or memory latency for accessing that local NUMA node is the lowest. Here, the local NUMA node of a PCIe device refers to the NUMA node that is physically closest to the PCIe device, has the lowest access latency, and the highest bandwidth. The local NUMA node of a PCIe device can be viewed through the / sys filesystem on Linux. In another implementation, the PCIe device remotely connects to a non-local NUMA node, such as through inter-node interconnects (e.g., Intel UPI, AMD Infinity Fabric). In this case, the CPU or / or memory latency for accessing the remotely connected non-local NUMA node is relatively high.

[0029] As an example, the NUMA distance of the PCIe device refers to the distance between the PCIe device and the currently connected NUMA node. It can be the distance between the PCIe device and the local NUMA node, or the distance between the PCIe device and a non-local NUMA node.

[0030] The NUMA distance of a PCIe device is used to measure the relative latency of accessing the CPU and / or memory on different NUMA nodes. NUMA distance is a relative latency value (unitless, typically based on a local distance of 10), with higher values ​​indicating higher latency. For example, the distance between a PCIe device and its local NUMA node is usually 10 (baseline); within the same server, the distance between the PCIe device and non-local NUMA nodes on the same server may be 15, 20, or 30 (depending on the interconnect architecture); across servers (such as via PCIe Over Fabrics), the distance between the PCIe device and NUMA nodes on other servers may reach 50+.

[0031] As an example, this embodiment can read the NUMA distance of the PCIe device through the operating system or firmware (such as ACPI).

[0032] In this embodiment, whether a PCIe device enables ACS can be determined by reading and parsing the register set with ID 0x0D in the PCIe Extended Capability of the PCIe device. ACS is used to provide isolation between PCIe devices in the PCIe device connection topology, with the core function of preventing DMA attacks and ensuring the security of PCIe passthrough / virtualization. For example, it prevents DMA access between different PCIe devices on the same PCIe bus (isolates device memory); ensures that transactions of downstream devices of the PCIe switch are correctly routed to avoid address conflicts; and allows the hypervisor to securely pass information sent by PCIe devices to virtual machines (preventing virtual machines from accessing host / other virtual machine memory through devices), etc.

[0033] Optionally, the header of the above PCIe expansion capability is 16 bytes. If bit 4 in ACS Capability (ID=0x0D) is 1, it means that ACS is enabled; otherwise, it means that ACS is disabled.

[0034] As an example, if the fourth parameter is a first value, such as 1, it means that the PCIe device has ACS enabled; if the fourth parameter is a second value, such as 0, it means that the PCIe device has ACS disabled.

[0035] Step 102: Based on the device type of the PCIe device, determine the adjustment coefficients corresponding to the first to fourth parameters of the PCIe device under that device type.

[0036] In this embodiment, to accommodate the differentiated requirements of physical network card pass-through, virtual network card, and PCIe switch cascading, at least one of the adjustment coefficients corresponding to the first to fourth parameters of different PCIe devices is different.

[0037] For example, if a PCIe device is a physical network interface card (NIC) used in a pass-through application, and the primary requirement for a NIC is protection against DMA attacks, then the adjustment coefficients for the first to fourth parameters of the PCIe device can be set accordingly. For instance, the adjustment coefficients for the first to fourth parameters might fall within the following ranges: α∈[0.2,0.4], β∈[0.3,0.5], δ∈[0.4,0.6], γ∈[0.6,0.9]. This represents the adjustment coefficient corresponding to the first parameter. This represents the adjustment coefficient corresponding to the second parameter. This represents the adjustment coefficient corresponding to the third parameter. This represents the adjustment coefficient corresponding to the fourth parameter.

[0038] For example, if a PCIe device belongs to the PCIeSwitch type under PCIe Switch cascading applications, such as a PCIe Switch, the primary requirement for a PCIe Switch is topology hop count optimization. Based on this requirement, adjustment coefficients can be set for the first to fourth parameters of the PCIe device. For example, the adjustment coefficients for the first to fourth parameters can be set to the following ranges: α∈[0.4,0.6], β∈[0.2,0.4], δ∈[0.1,0.3], γ∈[0.3,0.5].

[0039] For example, if a PCIe device is a virtual network interface card (NIC), the primary requirements for a virtual NIC are bandwidth and NUMA affinity. Based on these requirements, adjustment coefficients can be set for the first to fourth parameters of the PCIe device. For instance, the adjustment coefficients for the first to fourth parameters could be in the following ranges: α∈[0.1,0.3], β∈[0.5,0.7], δ∈[0.6,0.8], γ∈[0.2,0.4].

[0040] As described above, for PCIe devices of different device types, at least one of the weighting coefficients corresponding to the first to fourth parameters is different.

[0041] The weight coefficients corresponding to the first to fourth parameters of the same PCIe device meet the normalization requirement, that is, α+β+γ+δ=1, to avoid the weights being biased towards a single dimension.

[0042] Step 103: Determine the weight level of the PCIe device based on the first to fourth parameters of the PCIe device and the adjustment coefficients corresponding to the first to fourth parameters.

[0043] As one example, the weight level of the PCIe device is positively correlated with the inverse of the number of PCIe hops from the PCIe device to the root association; and / or, The weight level of the PCIe device is positively correlated with the logarithm of the PCIe link speed; and / or, The weight level of the PCIe device is positively correlated with the aforementioned fourth parameter. For example, when the PCIe device has ACS enabled, its fourth parameter is a first value, such as 1; when the PCIe device has ACS disabled, its fourth parameter is a second value, such as 0; and / or, The weight level of the PCIe device is positively correlated with the inverse of the ratio of the aforementioned NUMA distance to the system's maximum NUMA distance.

[0044] Here, the maximum NUMA distance of the system is the maximum distance between the farthest NUMA node (or PCIe device and NUMA node) in the aforementioned electronic devices, such as servers.

[0045] Optionally, in this embodiment, the weight level of the PCIe device can be calculated according to the following formula: ; W indicates the weight level of the PCIe device. This represents the adjustment factor corresponding to the first parameter of the PCIe device, where H represents the number of PCIe hops from the PCIe device to the root association, as indicated by the first parameter of the PCIe device, such as the minimum number of hops. This represents the adjustment factor corresponding to the second parameter of the PCIe device. The second parameter of the PCIe device indicates the PCIe link speed of the PCIe device. This represents the adjustment factor corresponding to the third parameter of the PCIe device. The third parameter of the PCIe device indicates the ratio of the PCIe device's NUMA distance to the system's maximum NUMA distance. This represents the adjustment factor corresponding to the fourth parameter of the PCIe device. This refers to the fourth parameter mentioned above.

[0046] Taking a PCIe device as a physical network card as an example, if the parameters of the physical network card are as follows: H=2, S=32, A=1, D=0.4, then the weight level W of the physical network card is calculated as follows: W = 0.3×(1 / 2) + 0.4×log2(32) + 0.8×1 +0.5×(1 / 0.4) = 0.15 + 0.4×5 + 0.8 + 1.25 = 4.2.

[0047] Taking a PCIe device as a virtual network card (SR-IOV) as an example, if the parameters of the virtual network card are as follows: H=3, S=16, ACS=0, D=0.2, calculate the weight level W of the physical network card: W = 0.2×(1 / 3) + 0.6×log2(16) +0.3×0 + 0.7×(1 / 0.2) = 0.07 + 0.6×4 + 0 + 3.5 = 6.17.

[0048] Step 104: Based on the weight level of the PCIe device, perform corresponding control measures on the PCIe device.

[0049] For example, if the PCIe device is a physical network card in a physical network card pass-through application, and it is determined that ACS needs to be enabled based on the weight level of the PCIe device, such as if the weight level of the PCIe device is less than a first set threshold (e.g., 6), then when the PCIe device has already enabled ACS, control the PCIe device to continue to maintain the already enabled ACS, and when the PCIe device has not enabled ACS, control the PCIe device to enable ACS.

[0050] For example, assuming the PCIe device is a virtual network interface card (NIC), if its weight level determines that it should be preferentially bound to the local NUMA node (e.g., the weight level is greater than a second preset threshold, such as 6), then when the PCIe device is not bound to the local NUMA node, the system controls it to switch to binding to the local NUMA node; when the PCIe device is already bound to the local NUMA node, the system controls it to continue binding to the local NUMA node. This ensures that high-weight PCIe devices are preferentially bound to the local NUMA node.

[0051] It should be noted that the above is just a simple example of how to perform corresponding control on a PCIe device based on its weight level, and is not intended to be limiting.

[0052] This concludes the process. Figure 1 The process is shown below.

[0053] pass Figure 1 As shown in the process, this embodiment can quantify the weight of the PCIe device based on four dimensions: the number of PCIe hops from the PCIe device to the root federation, the PCIe link speed of the PCIe device, the NUMA distance of the PCIe device, and whether the PCIe device has ACS enabled. Combined with the adjustment coefficients corresponding to the four dimensions under the device type of the PCIe device, the weight of the PCIe device can be quantified. This allows for adaptive management of the PCIe device based on the weight, thus achieving adaptive management of the PCIe device and avoiding the rigid management of the PCIe device caused by the existing static strategy.

[0054] Furthermore, this embodiment takes into account the number of PCIe hops from the PCIe device to the root association when quantifying the weight of the PCIe device. This is equivalent to taking into account the impact of PCIe hop depth on latency, ensuring that the final quantified weight of the PCIe device is accurate, so as to accurately adaptively manage the PCIe device and improve performance.

[0055] Furthermore, this embodiment takes into account the NUMA distance of the PCIe device when quantifying the weight of the PCIe device, which is equivalent to taking into account the performance loss of cross-node access caused by the NUMA topology, so as to better adaptively manage the PCIe device and improve performance.

[0056] Furthermore, this embodiment considers whether the PCIe device supports ACS when quantifying the weight of the PCIe device, so as to predict the DMA attack risk of the pass-through device in advance, and better realize the adaptive management and control of the PCIe device, thereby improving performance.

[0057] Experiments revealed that using the method provided in this embodiment to adaptively manage virtual network interface cards (NICs) can reduce cross-NUMA latency by 42%. When using the method to adaptively manage PCIe switches, PCIe switch broadcast latency fluctuations are reduced to ±5%, and throughput is increased by 40%. Regarding security hardening, the method provided in this embodiment eliminates the risk of physical NIC passthrough isolation failure, enables automatic triggering of ACS (Advanced Communication Assist) to block DMA attacks. In terms of resource configuration, the method provided in this embodiment reduces the PCIe device resource configuration error rate from 19.3% to 0.8%, and further reduces virtual machine startup latency by 67% (6s → 2s), resulting in a 35% reduction in operational costs.

[0058] The methods provided in the embodiments of this application have been described above. The apparatus provided in the embodiments of this application is described below: See Figure 2 , Figure 2 This is a structural diagram of the device provided in an embodiment of this application. Figure 2 As shown, the device includes: The acquisition unit is used to obtain the first to fourth parameters of the PCIe device; wherein, the first parameter is used to indicate the number of PCIe hops from the PCIe device to the Root Complex; the second parameter is used to indicate the PCIe link speed of the PCIe device; the third parameter is used to indicate the NUMA distance of the PCIe device; and the fourth parameter is used to indicate whether the PCIe device has access control service ACS enabled. The determining unit is configured to determine, based on the device type of the PCIe device, the adjustment coefficients corresponding to the first to fourth parameters under the device type; The processing unit is configured to determine the weight level of the PCIe device based on the first parameter to the fourth parameter and the adjustment coefficients corresponding to the first parameter to the fourth parameter respectively; and to perform corresponding control on the PCIe device based on the weight level of the PCIe device.

[0059] Optionally, the device type is any of the following: Physical network interface card (NIC) types used in physical NIC passthrough applications; PCIe Switch types in PCIe Switch cascading applications; Virtual network adapter type; And / or, for different device types, at least one of the weighting coefficients corresponding to the first to fourth parameters is different; for the same device type, the weighting coefficients corresponding to the first to fourth parameters meet the normalization requirements; and / or, The weight level is positively correlated with the inverse of the PCIe hop count; and / or, The weight level is positively correlated with the logarithm of the PCIe link speed; and / or, The weight level is positively correlated with the ACS value of the PCIe device, where the ACS value indicates that the Access Control Service (ACS) is enabled; and / or, The weight level is positively correlated with the inverse of the ratio of the NUMA distance to the system's maximum NUMA distance; and / or, Based on the weight level of the PCIe device, the corresponding control measures implemented for the PCIe device include: Assuming the PCIe device is a physical network interface card (NIC) used in a pass-through application, if the PCIe device's weight level determines that ACS needs to be enabled, then if the PCIe device already has ACS enabled, control the PCIe device to maintain the enabled ACS; if the PCIe device does not have ACS enabled, control the PCIe device to enable ACS; and / or, Based on the weight level of the PCIe device, the corresponding control measures implemented for the PCIe device include: If the PCIe device is a virtual network interface card (NIC), and based on the PCIe device's weight level, it is determined that the virtual NIC should be preferentially bound to the local NUMA node, then when the PCIe device is not bound to the local NUMA node, the PCIe device should be controlled to switch to binding to the local NUMA node; and when the PCIe device is already bound to the local NUMA node, the PCIe device should be controlled to continue binding to the local NUMA node; and / or, The determination of the weight level of the PCIe device based on the first to fourth parameters and the adjustment coefficients corresponding to the first to fourth parameters includes: The weight level of the PCIe device is calculated using the following formula: ; Where W represents the weight level of the PCIe device, This indicates the adjustment factor corresponding to the first parameter, where H represents the number of PCIe hops from the PCIe device to the Root Complex, as indicated by the first parameter. This represents the adjustment coefficient corresponding to the second parameter. The second parameter indicates the PCIe link speed of the PCIe device. This represents the adjustment coefficient corresponding to the third parameter. This indicates the ratio of the NUMA distance of the PCIe device, as indicated by the third parameter, to the maximum NUMA distance of the system. This represents the adjustment coefficient corresponding to the fourth parameter. This represents the fourth parameter of the PCIe device.

[0060] This application also provides a hardware structure corresponding to the above-described device. This hardware structure is an electronic device, such as… Figure 3 As shown, the electronic device includes: Processor; and Computer-readable storage medium; The computer-readable storage medium stores computer program instructions that, when executed by the processor, perform the steps of the above method.

[0061] Based on the same application concept as the above method, this application embodiment also provides a machine-readable storage medium storing a plurality of computer instructions, which, when executed by a processor, can implement the method disclosed in the above examples of this application.

[0062] For example, the aforementioned machine-readable storage medium can be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, messages, etc. For instance, machine-readable storage media can be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drives (such as hard disk drives), solid-state drives, any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or combinations thereof.

[0063] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which can take the form of a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email sending and receiving device, game console, tablet computer, wearable device, or any combination of these devices.

[0064] For ease of description, the above devices are described separately by function as various units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware.

[0065] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, embodiments of this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0066] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable message processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable message processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0067] Furthermore, these computer program instructions can also be stored in a computer-readable storage medium that can direct a computer or other programmable message processing device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in the process. Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0068] These computer program instructions can also be loaded onto a computer or other programmable message processing device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable device for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0069] The above description is merely an embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of this application should be included within the scope of the claims of this application.

Claims

1. An adaptive control method for PCIe devices, characterized in that, The method includes: Obtain the first to fourth parameters of the PCIe device; wherein, the first parameter is used to indicate the number of PCIe hops from the PCIe device to the Root Complex; the second parameter is used to indicate the PCIe link speed of the PCIe device; the third parameter is used to indicate the NUMA distance of the PCIe device; and the fourth parameter is used to indicate whether the PCIe device has Access Control Service (ACS) enabled. Based on the device type of the PCIe device, determine the adjustment coefficients corresponding to the first to fourth parameters of the PCIe device under that device type; The weight level of the PCIe device is determined based on the first parameter to the fourth parameter and the adjustment coefficients corresponding to the first parameter to the fourth parameter respectively. Based on the weight level of the PCIe device, corresponding control measures are implemented for the PCIe device.

2. The method according to claim 1, characterized in that, The device type is any of the following: Physical network interface card (NIC) types used in physical NIC passthrough applications; PCIe Switch types in PCIe Switch cascading applications; Virtual network adapter type.

3. The method according to claim 1, characterized in that, At least one of the weighting coefficients for the first to fourth parameters of PCIe devices under different device types is different; The weighting coefficients corresponding to the first to fourth parameters of the same PCIe device meet the normalization requirements.

4. The method according to claim 1, characterized in that, The weight level is positively correlated with the inverse of the PCIe hop count; and / or, The weight level is positively correlated with the logarithm of the PCIe link speed; and / or, The weight level is positively correlated with the ACS value of the PCIe device, where the ACS value indicates that the Access Control Service (ACS) is enabled; and / or, The weight level is positively correlated with the inverse of the ratio of the NUMA distance to the system's maximum NUMA distance.

5. The method according to claim 1, characterized in that, Based on the weight level of the PCIe device, the corresponding control measures implemented for the PCIe device include: If the PCIe device is a physical network card in a physical network card pass-through application, and it is determined that ACS needs to be enabled based on the weight level of the PCIe device, then if the PCIe device has already enabled ACS, control the PCIe device to continue to maintain the enabled ACS; if the PCIe device has not enabled ACS, control the PCIe device to enable ACS.

6. The method according to claim 1, characterized in that, Based on the weight level of the PCIe device, the corresponding control measures implemented for the PCIe device include: If the PCIe device is a virtual network interface card (NIC), and the weight level of the PCIe device determines that it is necessary to prioritize binding the virtual NIC to the local NUMA node, then when the PCIe device is not bound to the local NUMA node, the PCIe device is controlled to switch to binding to the local NUMA node; when the PCIe device is already bound to the local NUMA node, the PCIe device is controlled to continue binding to the local NUMA node.

7. The method according to claim 1, characterized in that, The determination of the weight level of the PCIe device based on the first to fourth parameters and the adjustment coefficients corresponding to the first to fourth parameters includes: The weight level of the PCIe device is calculated using the following formula: ; Where W represents the weight level of the PCIe device, This indicates the adjustment factor corresponding to the first parameter, where H represents the number of PCIe hops from the PCIe device to the Root Complex, as indicated by the first parameter. This represents the adjustment coefficient corresponding to the second parameter. The second parameter indicates the PCIe link speed of the PCIe device. This represents the adjustment coefficient corresponding to the third parameter. This indicates the ratio of the NUMA distance of the PCIe device, as indicated by the third parameter, to the maximum NUMA distance of the system. This represents the adjustment coefficient corresponding to the fourth parameter. This represents the fourth parameter of the PCIe device.

8. An adaptive control device for PCIe devices, characterized in that, The device includes: The acquisition unit is used to obtain the first to fourth parameters of the PCIe device; wherein, the first parameter is used to indicate the number of PCIe hops from the PCIe device to the Root Complex; the second parameter is used to indicate the PCIe link speed of the PCIe device; the third parameter is used to indicate the NUMA distance of the PCIe device; and the fourth parameter is used to indicate whether the PCIe device has access control service ACS enabled. The determining unit is configured to determine, based on the device type of the PCIe device, the adjustment coefficients corresponding to the first to fourth parameters of the PCIe device under the device type; The processing unit is configured to determine the weight level of the PCIe device based on the first parameter to the fourth parameter and the adjustment coefficients corresponding to the first parameter to the fourth parameter respectively; and to perform corresponding control on the PCIe device based on the weight level of the PCIe device.

9. The apparatus according to claim 8, characterized in that, The device type is any of the following: Physical network interface cards (NICs) in physical NIC passthrough applications; PCIe Switch in PCIe Switch Cascading Applications; Virtual network adapter; And / or, for different device types, at least one of the weighting coefficients corresponding to the first to fourth parameters is different; for the same device type, the weighting coefficients corresponding to the first to fourth parameters meet the normalization requirements; and / or, The weight level is positively correlated with the inverse of the PCIe hop count; And / or, The weight level is positively correlated with the logarithm of the PCIe link speed; and / or, The weight level is positively correlated with the ACS value of the PCIe device, where the ACS value indicates that the Access Control Service (ACS) is enabled; and / or, The weight level is positively correlated with the inverse of the ratio of the NUMA distance to the system's maximum NUMA distance; And / or, Based on the weight level of the PCIe device, the corresponding control measures implemented for the PCIe device include: Assuming the PCIe device is a physical network interface card (NIC) used in a pass-through application, if the PCIe device's weight level determines that ACS needs to be enabled, then if the PCIe device already has ACS enabled, control the PCIe device to maintain the enabled ACS; if the PCIe device does not have ACS enabled, control the PCIe device to enable ACS; and / or, Based on the weight level of the PCIe device, the corresponding control measures implemented for the PCIe device include: If the PCIe device is a virtual network interface card (NIC), and based on the PCIe device's weight level, it is determined that the virtual NIC should be preferentially bound to the local NUMA node, then when the PCIe device is not bound to the local NUMA node, the PCIe device should be controlled to switch to binding to the local NUMA node; and when the PCIe device is already bound to the local NUMA node, the PCIe device should be controlled to continue binding to the local NUMA node; and / or, The determination of the weight level of the PCIe device based on the first to fourth parameters and the adjustment coefficients corresponding to the first to fourth parameters includes: The weight level of the PCIe device is calculated using the following formula: ; Where W represents the weight level of the PCIe device, This indicates the adjustment factor corresponding to the first parameter, where H represents the number of PCIe hops from the PCIe device to the Root Complex, as indicated by the first parameter. This represents the adjustment coefficient corresponding to the second parameter. The second parameter indicates the PCIe link speed of the PCIe device. This represents the adjustment coefficient corresponding to the third parameter. This indicates the ratio of the NUMA distance of the PCIe device, as indicated by the third parameter, to the maximum NUMA distance of the system. This represents the adjustment coefficient corresponding to the fourth parameter. This represents the fourth parameter of the PCIe device.

10. An electronic device, characterized in that, The electronic device includes: Processor; and Computer-readable storage medium; The computer-readable storage medium stores computer program instructions that, when executed by the processor, perform the steps of the method according to any one of claims 1 to 7.