Data processing method, device, electronic device and readable storage medium
By including hardware acceleration parameter items in the configuration file of the virtual machine and calling the hardware acceleration unit for encryption and decryption processing, the problem of high CPU usage in the virtual machine is solved, and the data processing efficiency and host performance are improved.
Patent Information
- Application Number
- CN202211729714.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2042-12-30
AI Technical Summary
During the operation of the virtual machine, in the existing technology, the central processing unit completes encryption and decryption operations, resulting in high CPU usage and poor processing efficiency.
By including the hardware acceleration parameter item in the configuration file of the virtual machine and adding the parameter value of the hardware acceleration parameter item in the command parameters of the storage processor, the hardware acceleration unit is called to perform encryption and decryption processing, thereby avoiding encryption and decryption operations through the CPU.
It optimizes the overall performance of the host, improves data processing efficiency, releases the computing power of the CPU, and significantly reduces the CPU load.
Smart Images

Figure CN116302314B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a data processing method, device, electronic device and readable storage medium. Background Art
[0002] With the gradual development of computer networks, virtual machines are increasingly used in various fields. Users can isolate virtual machines from host machines and build an independent computer system.
[0003] During the operation of the virtual machine, a simulated processor (Quick EMUlator, QEMU) is usually used to provide simulated storage for the virtual machine. For security reasons, the simulated storage data is usually encrypted, so that when the virtual machine accesses the data, it is necessary to encrypt and decrypt the data. In the prior art, the encryption and decryption operations are usually completed by the central processing unit (CPU), which leads to CPU occupancy and poor processing efficiency. Summary of the invention
[0004] The purpose of the embodiments of the present invention is to provide a data processing method, device, electronic device and readable storage medium to at least solve the above problems. The specific technical solution is as follows:
[0005] In a first aspect of the present invention, a data processing method is provided, which is applied to a host machine including a virtual machine. The method may include:
[0006] Upon receiving a startup instruction for the virtual machine, obtaining a configuration file of the virtual machine;
[0007] In a case where the configuration file includes a hardware acceleration parameter item, adding a parameter value of the hardware acceleration parameter item to a command parameter of a storage processor of the virtual machine;
[0008] In response to an access instruction to target data, the storage processor calls a hardware acceleration unit indicated by a parameter value in the command parameter to perform encryption and decryption processing on the target data;
[0009] The storage processor performs access operations on the target data that has been encrypted and decrypted.
[0010] In a second aspect of the present invention, a data processing device is provided, which is applied to a host machine including a virtual machine. The device may include:
[0011] A configuration file acquisition module, configured to acquire a configuration file of the virtual machine upon receiving a startup instruction for the virtual machine;
[0012] A parameter item adding module, configured to add a parameter value of the hardware acceleration parameter item to a command parameter of the storage processor of the virtual machine when the configuration file includes the hardware acceleration parameter item;
[0013] an encryption and decryption processing module, configured to perform encryption and decryption processing on the target data by invoking a hardware acceleration unit indicated by a parameter value in the command parameter through the storage processor in response to an access instruction to the target data;
[0014] The execution module is used to perform access operations on the target data after encryption and decryption processing through the storage processor.
[0015] A third aspect of the present invention further provides an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0016] Memory, used to store computer programs;
[0017] The processor is used to perform any of the above-mentioned data processing methods when executing the program stored in the memory.
[0018] In a fourth aspect of the implementation of the present invention, a computer-readable storage medium is further provided, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to perform any of the above-mentioned data processing methods.
[0019] In a fifth aspect of the implementation of the present invention, there is also provided a computer program product comprising instructions, which, when executed on a computer, enables the computer to perform any of the above-mentioned data processing methods.
[0020] The embodiment of the present invention obtains the configuration file of the virtual machine when receiving a startup instruction for the virtual machine; adds the parameter value of the hardware acceleration parameter item to the command parameter of the storage processor of the virtual machine when the configuration file contains the hardware acceleration parameter item; in response to the access instruction to the target data, the storage processor calls the hardware acceleration unit indicated by the parameter value in the command parameter to perform encryption and decryption processing on the target data; and the storage processor performs access operations on the target data after encryption and decryption processing. In this way, by adding the parameter value of the corresponding hardware acceleration parameter item to the command parameter of the storage processor when the configuration file of the virtual machine contains the hardware acceleration parameter item, when the target data is accessed, the storage processor can call the hardware acceleration unit indicated by the hardware acceleration parameter item to perform encryption and decryption processing during operation, without the need for the CPU to perform encryption and decryption operations, thereby releasing the CPU's computing power, optimizing the overall performance of the host machine, and thus improving data processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.
[0022] Figure 1 is a flow chart of steps of a data processing method provided by an embodiment of the present invention;
[0023] Figure 2 is a schematic diagram of a scenario provided by an embodiment of the present invention;
[0024] Figure 3 It is a structural block diagram of a data processing device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0025] The technical solutions in the embodiments of the present invention will be described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0026] Figure 1 is a flowchart of a data processing method provided by an embodiment of the present invention, which can be applied to a host machine including a virtual machine, such as Figure 1 As shown, the method may include the following steps:
[0027] Step 101: upon receiving a startup instruction for the virtual machine, obtain a configuration file of the virtual machine.
[0028] The host machine can be any server that has a virtualized environment deployed. Accordingly, the virtual machine refers to an independent computer system running on the host machine, which can be controlled by the cloud platform. Accordingly, the virtual machine can also be called a cloud host. The startup instruction can be issued by the cloud platform.
[0029] Specifically, when a virtual machine is created, relevant operating parameters are set for the virtual machine, and the set parameters are often saved in the form of Extensible Markup Language (XML), thereby generating a configuration file in XML format for the virtual machine. Accordingly, when a startup instruction for the virtual machine is received, it is necessary to obtain a configuration file to provide the necessary parameters for the normal operation of the virtual machine. Specifically, the above configuration file can be obtained through a specified configuration file storage location, which is not limited in the embodiment of the present invention.
[0030] Step 102: When the configuration file includes a hardware acceleration parameter item, add a parameter value of the hardware acceleration parameter item to a command parameter of the storage processor of the virtual machine.
[0031] The storage processor is a virtual operating system simulator (Quick EMUlator, QEMU), which can also be called a QEMU component, which can provide simulated storage to the virtual machine at the back end. The hardware acceleration parameter item is a parameter item for specifying a hardware acceleration unit, which can also be called an attribute. The name of the parameter item can be set by yourself, for example, it can be a hwaccel attribute.
[0032] Among them, the command parameters of the above-mentioned storage processor refer to the command line parameters of QEMU. It can be understood that the command line parameters are often used to provide corresponding parameters to the component when it is started, so that it can run according to the command parameters. Therefore, in an embodiment of the present invention, the parameter value of the hardware acceleration parameter item can be added to the command parameters of QEMU, so that QEMU can obtain the parameter value indicated by the parameter item during operation.
[0033] Furthermore, the host machine can manage the virtual machine through the virtualization management component (Libvirt). At the same time, the host machine can start the virtual machine through Libvirt and add a hardware acceleration parameter item (hw-accel) to the QEMU command parameter (blockdev) during the startup process. This can be achieved by adding a hardware acceleration engine type field and corresponding processing logic to the Libvirt code.
[0034] Specifically, when the configuration file includes a hardware acceleration parameter item, it indicates that the current host machine has a hardware acceleration unit that can be used by the virtual machine. Therefore, the embodiment of the present invention can add the hardware acceleration parameter item and the specific parameter value to the command parameters of the QEMU component at this time. It can be understood that different parameter values can be used to specify different hardware acceleration units, which can be specifically set according to the parameter value of the hardware acceleration parameter item in the configuration file. When the hardware acceleration parameter item in the configuration file includes multiple parameter values, it indicates that the current host machine has multiple hardware acceleration units available for use. At this time, any parameter value can be selected and added to the command parameters of QEMU. The embodiment of the present invention does not limit the selection method.
[0035] Step 103: In response to an instruction to access target data, the storage processor calls a hardware acceleration unit indicated by a parameter value in the command parameter to perform encryption and decryption processing on the target data.
[0036] Step 104: The storage processor performs access operations on the target data that has been encrypted and decrypted.
[0037] The access operation may include storage and reading operations, and accordingly, the access instruction may include an instruction to store target data and / or an instruction to read target data.
[0038] The above-mentioned hardware acceleration unit is a hardware module existing on the host machine, which can also be called a hardware acceleration engine. Different from the CPU, it is a hardware module used for encryption and decryption calculations. It can be any model of hardware acceleration engine. The embodiment of the present invention does not limit the specific model of the hardware acceleration engine.
[0039] Specifically, since the storage of the virtual machine is provided by the above-mentioned QEMU, when the virtual machine performs read and write operations on the storage, QEMU will intercept the read and write operations and simulate the read and write operations in the back end. Therefore, it can be understood that all access operations require the virtual machine to interact with the above-mentioned QEMU. In the process of interaction between the virtual machine and QEMU, for security reasons, it is often necessary to encrypt the simulated access, usually using a hard disk encryption format (Linux Unified Key Setup, LUKS). LUKS supports multiple encryption algorithms and multiple encryption modes.
[0040] The encryption and decryption processing may include encryption and decryption. Furthermore, when performing storage or reading operations on target data, QEMU needs to perform corresponding encryption or decryption operations on the target data. At this time, the parameter value of the hardware acceleration parameter item in the command parameter can be used to call the corresponding hardware acceleration engine to perform encryption and decryption operations, and then perform corresponding storage or reading operations on the data after encryption and decryption processing. Specifically, the QEMU component can implement the call to the hardware acceleration unit through the interface indicated by the parameter value of the hardware parameter item.
[0041] In summary, the embodiment of the present invention obtains the configuration file of the virtual machine when receiving the startup instruction for the virtual machine; when the configuration file contains the hardware acceleration parameter item, the parameter value of the hardware acceleration parameter item is added to the command parameter of the storage processor of the virtual machine; in response to the access instruction to the target data, the storage processor calls the hardware acceleration unit indicated by the parameter value in the command parameter to perform encryption and decryption processing on the target data; and the storage processor performs access operations on the encrypted and decrypted target data. In this way, by adding the parameter value of the corresponding hardware acceleration parameter item to the command parameter of the storage processor when the configuration file of the virtual machine contains the hardware acceleration parameter item, when the target data is accessed, the storage processor can call the hardware acceleration unit indicated by the hardware acceleration parameter item to perform encryption and decryption processing during operation, without the need for the CPU to perform encryption and decryption operations, thereby releasing the CPU's computing power, optimizing the overall performance of the host machine, and thus improving data processing efficiency.
[0042] Optionally, before the above operation of adding the parameter value of the hardware acceleration parameter item to the command parameters of the storage processor of the virtual machine, the embodiment of the present invention may further include the following steps:
[0043] Step 201: Convert the configuration file from an initial structure to a resolvable structure to obtain a configuration file with a resolvable structure.
[0044] Step 202: Determine data stored in the encrypted storage structure from the configuration file of the resolvable structure, and detect the data stored in the encrypted storage structure.
[0045] Step 203: When the hardware acceleration parameter item is detected, extract the parameter value of the hardware acceleration parameter item from the data stored in the encrypted storage structure.
[0046] Among them, the above-mentioned initial structure refers to the XML structure, which is the original structure of the configuration file. The above-mentioned parsable structure refers to the structure of the configuration file in the memory. The embodiment of the present invention converts the configuration file from the original XML structure to the structure in the memory, and the content in the configuration file can be obtained by reading the memory.
[0047] Among them, the above-mentioned encrypted storage structure refers to a data structure used to store data required for encryption, and its structure in the memory is usually a virStorageEncryption structure, and in the XML format it is usually an Encryption node structure. It can be understood that what is stored in the encrypted storage structure is data that can be used by the virtual machine during the encrypted storage process, so the embodiment of the present invention only needs to detect the data in this structure, and there is no need to detect data in other structures. Specifically, the encrypted storage structure can be pre-marked, and then the marked encrypted storage structure can be obtained from the various data structures in the configuration file, and the data stored therein can be read to obtain the data stored in the encrypted storage structure.
[0048] Specifically, the configuration file of the initial structure can be parsed by an XML parsing algorithm to obtain the configuration file of the above-mentioned parsable structure, and the data in the encrypted storage structure in the configuration file can be traversed. When the above-mentioned hardware acceleration parameter item is found, it indicates that the current virtual machine is configured with a usable hardware acceleration unit, and thus the parameter value of the hardware acceleration parameter item can be further extracted and added to the command line parameters of QEMU. Among them, the identifiers or names of different parameter items are different. The embodiment of the present invention can store the identifiers or names of the hardware acceleration parameter items in advance, so that when traversing the data in the encrypted storage structure, the identifiers or names of each parameter item can be used for comparison until the identifier of the hardware acceleration parameter item is compared, and it can be determined that the above-mentioned hardware acceleration parameter item has been detected.
[0049] In an embodiment of the present invention, before adding the parameter value of the hardware acceleration parameter item to the command parameters of the storage processor of the virtual machine, the configuration file is converted from an initial structure to a parsable structure to obtain a configuration file of a parsable structure; the data stored in the encrypted storage structure is determined from the configuration file of the parsable structure, and the data stored in the encrypted storage structure is detected; when the hardware acceleration parameter item is detected, the parameter value of the hardware acceleration parameter item is extracted from the data stored in the encrypted storage structure. In this way, by converting the configuration file to a parsable structure, each data contained in the configuration file can be detected, and by detecting the data stored in the encrypted storage structure, when the hardware acceleration parameter item is detected, the parameter value is extracted, and then the hardware acceleration unit configured in the configuration file can be obtained, so that the hardware acceleration unit configured for the virtual machine can be called in the subsequent data access process, thereby improving the efficiency of encrypted access.
[0050] Optionally, the operation of performing encryption and decryption processing on the target data by calling the hardware acceleration unit indicated by the parameter value in the command parameter by the storage processor may specifically include the following steps in this embodiment of the present invention:
[0051] Step 301: Start the storage processor to obtain the command parameters through the storage processor.
[0052] Step 302: When the command parameters acquired by the storage processor include the hardware acceleration parameter item, the storage processor initializes the hardware acceleration unit indicated by the parameter value.
[0053] Step 303: Call the initialized hardware acceleration unit to perform encryption and decryption processing.
[0054] Among them, the above-mentioned operation of starting the storage processor can be implemented by the libvirt component in the aforementioned steps. During the startup process of the storage processor, the storage processor will first automatically read the set command parameter (blockdev). If the command parameter contains a hardware acceleration parameter item, the value of the string indicated by the parameter item can be further read (for example, hw-accel=XYZ) to obtain the corresponding hardware acceleration unit.
[0055] Among them, the initialization operation can enable the hardware acceleration unit to be used normally in the subsequent process. Specifically, the above initialization operation can be implemented by calling the initialization interface of the hardware acceleration unit. The initialization operations of different hardware acceleration units may be different, and the embodiments of the present invention do not limit this.
[0056] In the embodiment of the present invention, the storage processor is started to obtain the command parameters through the storage processor; when the command parameters obtained by the storage processor contain the hardware acceleration parameter items, the storage processor initializes the hardware acceleration unit indicated by the parameter value; and the initialized hardware acceleration unit is called to perform encryption and decryption processing. In this way, by detecting the command parameters during the startup of the storage processor, and performing the initialization operation on the hardware acceleration unit indicated by the detection result, the hardware acceleration unit can be initialized during the startup of the storage processor, so that when the hardware acceleration unit needs to be called later, the initialized hardware acceleration unit can be directly used to implement the corresponding operation, which further improves the calling efficiency of the hardware acceleration unit.
[0057] Optionally, the embodiment of the present invention may further include the following steps:
[0058] Step 401: Add attribute information of the hardware acceleration unit stored in a target data structure to designated data; the designated data includes data required for use in the process of performing the encrypted access.
[0059] The operation of initializing the hardware acceleration unit indicated by the parameter value by the storage processor may specifically include the following steps in this embodiment of the present invention:
[0060] Step 402: Initialize the hardware acceleration unit indicated by the parameter value based on the attribute information.
[0061] The above-mentioned specified data refers to the data required by the storage processor in the encryption and decryption process, which is usually stored in the QCryptoCipherBuiltin structure to provide the storage processor with the data required in the encryption and decryption process. The above-mentioned target data structure can be added under the above-mentioned QCryptoCipherBuiltin, and can be defined as a QCryptoCipherBuiltinKAE structure, and of course can also be defined as other structures, which is not limited in the embodiment of the present invention.
[0062] The attribute information of the hardware acceleration unit refers to the relevant context of the hardware acceleration engine, which may include the type, interface, optional encryption and decryption algorithms, initialization vector and other necessary information of the hardware acceleration engine.
[0063] Furthermore, during the initialization operation, the corresponding initialization operation can be performed on the indicated hardware acceleration engine through the attribute information stored in the target data structure. Specifically, the interface and initialization vector of the hardware acceleration engine can be obtained from the attribute information, and the corresponding initialization operation can be performed based on the interface and the initialization vector.
[0064] In the embodiment of the present invention, the attribute information of the hardware acceleration unit stored in the target data structure is added to the specified data; the specified data includes the data required for the encrypted access process; the hardware acceleration unit indicated by the parameter value is initialized based on the attribute information. In this way, by adding the attribute information stored in the target data structure to the specified data required for the encrypted storage process, the hardware acceleration unit can be initialized through the attribute information when the storage processor performs the corresponding access operation, and the data required for the encrypted access process can also be provided to the hardware acceleration unit, so as to realize encryption and decryption acceleration through the hardware acceleration unit and improve the efficiency of encrypted access.
[0065] Optionally, the access instruction includes a storage instruction indicating that the operation is a storage operation, and the target data includes first target data; the embodiment of the present invention may further include the following steps:
[0066] Step 501: Acquire, through the storage processor, the data to be stored indicated by the storage operation as the first target data.
[0067] The operation of the hardware acceleration unit performing encryption and decryption processing after the above-mentioned call initialization may specifically include:
[0068] Step 502: Call the hardware acceleration unit to perform encryption processing on the first target data.
[0069] The operation of performing access operation on the target data after encryption and decryption by the storage processor may specifically include the following steps in the embodiment of the present invention:
[0070] Step 503: Store the encrypted first target data through the storage processor.
[0071] Among them, the operation indicated by the instruction can be determined by the information carried in the access instruction of the virtual machine. Specifically, when the address of the data to be processed indicated in the access instruction is an address in the storage processor, it can be considered that the operation indicated by the access instruction is a read operation. Correspondingly, when the address of the data to be processed indicated in the access instruction is not an address in the storage processor but an external address or an address in the hard disk, it can be considered that the operation indicated by the access instruction is a storage operation.
[0072] The storage operation refers to the operation that the virtual machine needs to write the data to be stored into the simulated storage. Accordingly, the first target data is the data to be stored. Specifically, when the virtual machine performs the storage operation, QEMU will intercept the data to be stored and encrypt it. In the embodiment of the present invention, QEMU can call the specified hardware acceleration unit to perform the corresponding encryption operation on the data to be stored, realize encryption acceleration, and after obtaining the encrypted LUKS format data, the encrypted data is stored through the storage processor (QEMU).
[0073] In an embodiment of the present invention, the access instruction includes a storage instruction indicating a storage operation, and the target data includes first target data; the data to be stored indicated by the storage operation is obtained by the storage processor as the first target data; the hardware acceleration unit is called to perform encryption processing on the first target data; the storage processor performs an access operation on the target data after encryption and decryption processing, including: storing the first target data after encryption processing by the storage processor. In this way, according to the needs of the virtual machine, the hardware acceleration unit can perform corresponding encryption operations for the encryption requirements of the storage operation, thereby accelerating the encryption process and improving data storage efficiency.
[0074] Optionally, the access instruction further includes a storage instruction indicating that the operation is a read operation, and the target data further includes second target data. The embodiment of the present invention may further include the following steps:
[0075] Step 601: Obtain, through the storage processor, the to-be-read data indicated by the read operation as the second target data.
[0076] The operation of the hardware acceleration unit performing encryption and decryption processing after the above-mentioned call initialization may further include:
[0077] Step 602: calling the hardware acceleration unit to perform decryption processing on the second target data;
[0078] The above-mentioned operation of performing the access operation on the target data after the encryption and decryption processing by the storage processor may specifically include:
[0079] Step 603: Send the second target data after decryption to the virtual machine through the storage processor.
[0080] The above-mentioned read operation refers to an operation in which the virtual machine needs to read the data stored in the storage processor. Accordingly, the above-mentioned second target data is the data to be read, which is usually stored in QEMU.
[0081] Specifically, when the virtual machine needs to read any encrypted data, QEMU will obtain the encrypted data to be read and decrypt it. In an embodiment of the present invention, when the storage processor needs to decrypt the data to be read, QEMU can implement the corresponding decryption operation by calling the hardware acceleration unit to accelerate the decryption, and after obtaining the decrypted data to be read, decrypt the data through the storage processor (QEMU) and pass it to the virtual machine.
[0082] In an embodiment of the present invention, the access instruction also includes a storage instruction indicating a read operation, and the target data also includes second target data; the storage processor obtains the data to be read indicated by the read operation as the second target data; the hardware acceleration unit is called to perform decryption processing on the second target data; and the storage processor sends the second target data after decryption processing to the virtual machine. In this way, according to the needs of the virtual machine, the hardware acceleration unit can perform corresponding decryption operations for the decryption requirements of the read operation, thereby accelerating the decryption process and improving data reading efficiency.
[0083] Optionally, before the operation of obtaining the configuration file of the virtual machine, the embodiment of the present invention may further include the following steps:
[0084] Step 701: When the host machine includes a hardware acceleration unit, a configuration file including the hardware acceleration parameter items is generated in advance for the virtual machine.
[0085] The above-mentioned operation of generating a configuration file can be implemented through the Libvirt component, which can manage virtual machines and provide corresponding interfaces for the cloud platform to use.
[0086] Specifically, in the process of configuring the virtual machine, the Libvirt component can be configured in XML format based on actual needs. If the virtual machine needs to use encrypted storage in LUKS format, the encryption node can be configured for the disk subnode of XML. Accordingly, the corresponding hardware acceleration parameter item hwaccel can be configured under the encryption node to generate a configuration file containing the hardware acceleration parameter items.
[0087] Specifically, the hardware modules available for use by the host machine can be stored in advance in the form of a data table, so that when the data table is retrieved to contain a hardware acceleration engine, it is determined that the host machine contains a hardware acceleration unit. Correspondingly, when it is not retrieved, it is determined that the host machine does not contain a hardware acceleration unit.
[0088] In the embodiment of the present invention, when the host machine includes a hardware acceleration unit, a configuration file including the hardware acceleration parameter items is generated for the virtual machine in advance. In this way, when the host machine includes a hardware acceleration unit, a configuration file including the hardware acceleration parameter items can be generated for the virtual machine, so that the virtual machine can use the corresponding hardware acceleration unit based on the configuration file during operation, thereby improving the processing efficiency of the virtual machine.
[0089] Figure 2 is a schematic diagram of a scenario provided by an embodiment of the present invention, such as Figure 2 As shown, the scenario may include the following operations:
[0090] First, you can configure the cloud host (vm configuration) to get the virtual machine configuration file.
[0091] Secondly, the cloud management platform can call Libvirt to start the cloud host interface and issue virtual machine startup instructions. During the virtual machine startup process, the Libvirt component can parse the virtual machine configuration file to obtain the cloud host configuration information.
[0092] Again, when the virtual machine needs to access the simulated storage, QEMU in the virtualization component (Virtualization Components) is started, QEMU initializes the hardware acceleration engine through the parameter items in the command parameters, and when the access data needs to be encrypted, the storage encryption module in QEMU performs corresponding encryption and decryption on the processing data through the storage driver in the virtual machine system (Guest OS). At this time, since the virtual machine is configured with a hardware acceleration engine, and the relevant parameter items and parameter values of the hardware acceleration engine are set in QEMU, the embodiment of the present invention can call the corresponding hardware acceleration engine through the hardware acceleration driver in the host system (Host OS) to realize encryption and decryption acceleration. It can be understood that the hardware acceleration engine belongs to the hardware level (Hardware), and accordingly, the other operation parts in the figure belong to the software level (Software).
[0093] The embodiments of the present invention have conducted a large number of experiments through the above operations. The actual test results show that after the embodiments of the present invention accelerate the encryption and decryption of stored data, the encryption and decryption performance is significantly improved in most scenarios. At the same time, the computing power of the host CPU is released, the CPU load is significantly reduced, and computing resources are saved.
[0094] Figure 3 is a structural block diagram of a data processing device 80 provided in an embodiment of the present invention, which can be applied to a host machine including a virtual machine, such as Figure 3 As shown, the device 80 may include:
[0095] The configuration file acquisition module 801 is used to acquire the configuration file of the virtual machine when receiving the startup instruction of the virtual machine;
[0096] A parameter item adding module 802 is used to add a parameter value of the hardware acceleration parameter item to the command parameters of the storage processor of the virtual machine when the configuration file includes the hardware acceleration parameter item;
[0097] The encryption and decryption processing module 803 is used to perform encryption and decryption processing on the target data by calling the hardware acceleration unit indicated by the parameter value in the command parameter through the storage processor in response to the access instruction to the target data;
[0098] The execution module 804 is used to perform access operations on the target data after encryption and decryption processing through the storage processor.
[0099] Optionally, the device 80 further includes:
[0100] a structure conversion module, configured to convert the configuration file from an initial structure to a resolvable structure before the parameter item adding module 702 adds the parameter value of the hardware acceleration parameter item to the command parameter of the storage processor of the virtual machine, so as to obtain a configuration file of the resolvable structure;
[0101] A detection module, used to determine the data stored in the encrypted storage structure from the configuration file of the resolvable structure, and detect the data stored in the encrypted storage structure;
[0102] The parameter value extraction module is used to extract the parameter value of the hardware acceleration parameter item from the data stored in the encrypted storage structure when the hardware acceleration parameter item is detected.
[0103] Optionally, the encryption and decryption processing module 803 includes:
[0104] A command parameter acquisition submodule, used for starting the storage processor to acquire the command parameter through the storage processor;
[0105] an initialization submodule, configured to initialize, through the storage processor, a hardware acceleration unit indicated by the parameter value when the command parameter acquired by the storage processor includes the hardware acceleration parameter item;
[0106] The calling submodule is used to call the initialized hardware acceleration unit to perform encryption and decryption processing.
[0107] Optionally, the device 80 further includes:
[0108] An attribute information adding module, used for adding attribute information of the hardware acceleration unit stored in a target data structure to designated data; the designated data includes data required for use in the process of performing the encrypted access;
[0109] The initialization submodule is specifically used to initialize the hardware acceleration unit indicated by the parameter value based on the attribute information.
[0110] Optionally, the access instruction includes a storage instruction indicating that the operation is a storage operation, and the target data includes first target data; and the device 80 further includes:
[0111] a to-be-stored data acquisition module, configured to acquire, through the storage processor, the to-be-stored data indicated by the storage operation as the first target data;
[0112] The encryption and decryption processing module is specifically used to call the hardware acceleration unit to perform encryption processing on the first target data;
[0113] The execution module 804 is specifically used to: store the first target data after encryption through the storage processor.
[0114] Optionally, the access instruction further includes a storage instruction indicating that the operation is a read operation, and the target data further includes second target data; and the device 80 further includes:
[0115] a to-be-read data acquisition module, configured to acquire, through the storage processor, the to-be-read data indicated by the read operation as the second target data;
[0116] The encryption and decryption processing module is further configured to call the hardware acceleration unit to perform decryption processing on the second target data;
[0117] The execution module 804 is further specifically configured to: send the second target data after decryption to the virtual machine through the storage processor.
[0118] Optionally, the device 80 further includes:
[0119] The configuration file generating module is used to generate a configuration file including the hardware acceleration parameter items for the virtual machine in advance when the host machine includes a hardware acceleration unit before the configuration file acquiring module 701 acquires the configuration file of the virtual machine.
[0120] In summary, the embodiment of the present invention obtains the configuration file of the virtual machine when receiving the startup instruction for the virtual machine; when the configuration file contains the hardware acceleration parameter item, the parameter value of the hardware acceleration parameter item is added to the command parameter of the storage processor of the virtual machine; in response to the access instruction to the target data, the storage processor calls the hardware acceleration unit indicated by the parameter value in the command parameter to perform encryption and decryption processing on the target data; and the storage processor performs access operations on the encrypted and decrypted target data. In this way, by adding the parameter value of the corresponding hardware acceleration parameter item to the command parameter of the storage processor when the configuration file of the virtual machine contains the hardware acceleration parameter item, when the target data is accessed, the storage processor can call the hardware acceleration unit indicated by the hardware acceleration parameter item to perform encryption and decryption processing during operation, without the need for the CPU to perform encryption and decryption operations, thereby releasing the CPU's computing power, optimizing the overall performance of the host machine, and thus improving data processing efficiency.
[0121] In another embodiment of the present invention, an electronic device is provided, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0122] Memory, used to store computer programs;
[0123] The processor is used to perform any of the above-mentioned data processing methods when executing the program stored in the memory.
[0124] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions. When the instructions are executed on a computer, the computer performs the data processing method described in any one of the above embodiments.
[0125] In another embodiment of the present invention, a computer program product including instructions is provided, which, when executed on a computer, enables the computer to perform any of the data processing methods described in the above embodiments.
[0126] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0127] It should be noted that the various data-related processes in the embodiments of the present application are all carried out in compliance with the corresponding data protection laws and policies of the country where the device is located, and with the authorization given by the owner of the corresponding device.
[0128] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article 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 process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0129] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0130] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A data processing method, applied to a host machine including a virtual machine, characterized in that: The method comprises: Upon receiving a startup instruction for the virtual machine, obtaining a configuration file of the virtual machine; In a case where the configuration file includes a hardware acceleration parameter item, adding a parameter value of the hardware acceleration parameter item to a command parameter of a storage processor of the virtual machine; In response to an access instruction to target data, the storage processor calls a hardware acceleration unit indicated by a parameter value in the command parameter to perform encryption and decryption processing on the target data; The storage processor performs access operations on the target data that has been encrypted and decrypted.
2. The method according to claim 1, characterized in that Before adding the parameter value of the hardware acceleration parameter item to the command parameters of the storage processor of the virtual machine, the method further includes: Converting the configuration file from an initial structure to a resolvable structure to obtain a configuration file with a resolvable structure; Determining data stored in the encrypted storage structure from the configuration file of the resolvable structure, and detecting the data stored in the encrypted storage structure; When the hardware acceleration parameter item is detected, a parameter value of the hardware acceleration parameter item is extracted from the data stored in the encrypted storage structure.
3. The method according to claim 1, characterized in that: The step of calling the hardware acceleration unit indicated by the parameter value in the command parameter by the storage processor to perform encryption and decryption processing on the target data includes: Starting the storage processor to obtain the command parameter through the storage processor; In a case where the command parameter acquired by the storage processor includes the hardware acceleration parameter item, initializing the hardware acceleration unit indicated by the parameter value through the storage processor; The initialized hardware acceleration unit is called to perform encryption and decryption processing.
4. The method according to claim 3, characterized in that The method further comprises: Adding attribute information of the hardware acceleration unit stored in a target data structure to the designated data; the designated data includes data required for use in the process of performing encrypted access; Initializing the hardware acceleration unit indicated by the parameter value by the storage processor includes: The hardware acceleration unit indicated by the parameter value is initialized based on the attribute information.
5. The method according to claim 3, characterized in that: The access instruction includes a storage instruction indicating that the operation is a storage operation, and the target data includes first target data; the method further includes: Acquire, by the storage processor, the data to be stored indicated by the storage operation as the first target data; The calling of the initialized hardware acceleration unit to perform encryption and decryption processing includes: calling the hardware acceleration unit to perform encryption processing on the first target data; The performing access operations on the encrypted and decrypted target data by the storage processor includes: storing the encrypted first target data by the storage processor.
6. The method according to claim 5, characterized in that The access instruction further includes an instruction indicating that the operation is a read operation, and the target data further includes second target data; the method further includes: Acquire, by the storage processor, the to-be-read data indicated by the read operation as the second target data; The calling of the initialized hardware acceleration unit to perform encryption and decryption processing further includes: calling the hardware acceleration unit to perform decryption processing on the second target data; The performing access operations on the encrypted and decrypted target data by the storage processor also includes: sending the decrypted second target data to the virtual machine by the storage processor.
7. The method according to claim 1, characterized in that Before obtaining the configuration file of the virtual machine, the method further includes: In the case where the host machine includes a hardware acceleration unit, a configuration file including the hardware acceleration parameter items is generated in advance for the virtual machine.
8. A data processing device, applied to a host machine including a virtual machine, characterized in that: The device comprises: A configuration file acquisition module, configured to acquire a configuration file of the virtual machine upon receiving a startup instruction for the virtual machine; A parameter item adding module, configured to add a parameter value of the hardware acceleration parameter item to a command parameter of the storage processor of the virtual machine when the configuration file includes the hardware acceleration parameter item; an encryption and decryption processing module, configured to perform encryption and decryption processing on the target data by invoking a hardware acceleration unit indicated by a parameter value in the command parameter through the storage processor in response to an access instruction to the target data; The execution module is used to perform access operations on the target data after encryption and decryption processing through the storage processor.
9. The device according to claim 8, characterized in that The device also includes: a structure conversion module, configured to convert the configuration file from an initial structure to a resolvable structure before the parameter item adding module adds the parameter value of the hardware acceleration parameter item to the command parameter of the storage processor of the virtual machine, so as to obtain a configuration file of the resolvable structure; A detection module, used to determine the data stored in the encrypted storage structure from the configuration file of the resolvable structure, and detect the data stored in the encrypted storage structure; The parameter value extraction module is used to extract the parameter value of the hardware acceleration parameter item from the data stored in the encrypted storage structure when the hardware acceleration parameter item is detected.
10. The device according to claim 8, characterized in that The encryption and decryption processing module includes: A command parameter acquisition submodule, used for starting the storage processor to acquire the command parameter through the storage processor; an initialization submodule, configured to initialize, through the storage processor, a hardware acceleration unit indicated by the parameter value when the command parameter acquired by the storage processor includes the hardware acceleration parameter item; The calling submodule is used to call the initialized hardware acceleration unit to perform encryption and decryption processing.
11. The device according to claim 10, characterized in that The device also includes: An attribute information adding module, used to add attribute information of the hardware acceleration unit stored in a target data structure to designated data; the designated data includes data required for use in the process of encrypted access; The initialization submodule is specifically used to initialize the hardware acceleration unit indicated by the parameter value based on the attribute information.
12. The device according to claim 10, characterized in that The access instruction includes a storage instruction indicating that the operation is a storage operation, and the target data includes first target data; the device further includes: a to-be-stored data acquisition module, configured to acquire, through the storage processor, the to-be-stored data indicated by the storage operation as the first target data; The encryption and decryption processing module is specifically used to call the hardware acceleration unit to perform encryption processing on the first target data; The execution module is specifically used to: store the first target data after encryption through the storage processor.
13. The device according to claim 12, characterized in that The access instruction further includes an instruction indicating that the operation is a read operation, and the target data further includes second target data; the device further includes: a to-be-read data acquisition module, configured to acquire, through the storage processor, the to-be-read data indicated by the read operation as the second target data; The encryption and decryption processing module is further configured to call the hardware acceleration unit to perform decryption processing on the second target data; The execution module is further specifically used to: send the second target data after decryption to the virtual machine through the storage processor.
14. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing any of the methods of claims 1-7 when executing a program stored in a memory.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
