WO2023193687A1 - 一种共享内存的访问方法、装置、设备和存储介质 - Google Patents

一种共享内存的访问方法、装置、设备和存储介质 Download PDF

Info

Publication number
WO2023193687A1
WO2023193687A1 PCT/CN2023/086008 CN2023086008W WO2023193687A1 WO 2023193687 A1 WO2023193687 A1 WO 2023193687A1 CN 2023086008 W CN2023086008 W CN 2023086008W WO 2023193687 A1 WO2023193687 A1 WO 2023193687A1
Authority
WO
WIPO (PCT)
Prior art keywords
virtual machine
shared
address
virtual
physical memory
Prior art date
Application number
PCT/CN2023/086008
Other languages
English (en)
French (fr)
Inventor
张朝鹏
Original Assignee
科东(广州)软件科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 科东(广州)软件科技有限公司 filed Critical 科东(广州)软件科技有限公司
Publication of WO2023193687A1 publication Critical patent/WO2023193687A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/06Addressing a physical block of locations, e.g. base addressing, module addressing, memory dedication
    • G06F12/0615Address space extension
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0806Multiuser, multiprocessor or multiprocessing cache systems
    • G06F12/084Multiuser, multiprocessor or multiprocessing cache systems with a shared cache
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/10Address translation
    • G06F12/1009Address translation using page tables, e.g. page table structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45583Memory management, e.g. access or allocation

Definitions

  • Embodiments of the present invention relate to the field of communication technology, and in particular, to a shared memory access method, apparatus, equipment and storage medium.
  • multiple virtual machines are usually configured and installed in one computer device.
  • the processes in different virtual machines have their own virtual addresses, and the matching virtual physical memory address is determined based on the virtual address, and the matching virtual physical memory address is determined based on the determined
  • the virtual physical memory address implements access to the real physical memory address corresponding to the virtual machine.
  • Embodiments of the present invention provide a shared memory access method, device, equipment and storage medium to achieve access to shared memory of multiple virtual machines.
  • embodiments of the present invention provide a shared memory access method, which includes: using a specified real physical memory address as a reserved real physical memory address, and the reserved real physical memory address corresponds to a reserved memory area;
  • each extended page table includes a correspondence between the reserved real physical memory address and the shared virtual physical memory address
  • a standard interface for accessing the reserved memory area is provided to each virtual machine.
  • the corresponding standard interface of each virtual machine implements calling the kernel driver of the virtual machine.
  • the kernel driver of each virtual machine implements querying the virtual machine.
  • the reserved memory area is accessed according to the corresponding relationship in the extended page table.
  • embodiments of the present invention provide a shared memory access device, including: a configuration module configured to use a specified real physical memory address as a reserved real physical memory address, and the reserved real physical memory address corresponds to the reserved real physical memory address.
  • Reserve memory area configured to use a specified real physical memory address as a reserved real physical memory address, and the reserved real physical memory address corresponds to the reserved real physical memory address.
  • the extended page table building module is used to build the extended page table corresponding to each virtual machine when creating a virtual machine.
  • each extended page table contains the corresponding relationship between the reserved real physical memory address and the shared virtual physical memory address;
  • a standard interface providing module is used to provide each virtual machine with a standard interface for accessing the reserved memory area.
  • the corresponding standard interface of each virtual machine implements the call of the kernel driver of the virtual machine.
  • the above kernel driver is used to query the extended page table corresponding to the virtual machine;
  • a shared memory access module configured to access the reserved memory area according to the corresponding relationship in the extended page table when receiving a shared memory access request initiated by the virtual machine side by calling the standard interface.
  • an embodiment of the present invention provides a computer device.
  • the computer device includes:
  • processors one or more processors
  • a storage device for storing one or more programs
  • the one or more processors When the one or more programs are executed by the one or more processors, the one or more processors implement the shared memory access method as described above.
  • embodiments of the present invention provide a computer-readable storage medium on which a computer program is stored.
  • the program is executed by a processor, the above-mentioned shared memory access method is implemented.
  • the technical solution of the embodiment of the present invention configures a fixed area shared by multiple virtual machines as a shared real physical memory address and provides a corresponding standard interface, so that processes in different virtual machines can run on different operating systems.
  • Figure 1 is a flow chart of a shared memory access method provided by Embodiment 1 of the present invention.
  • FIG. 2 is a schematic diagram of an application scenario of the shared memory access method provided by Embodiment 1 of the present invention.
  • Figure 3 is a flow chart of a shared memory access method provided by Embodiment 2 of the present invention.
  • Figure 4 is a schematic structural diagram of a shared memory access device provided in Embodiment 3 of the present invention.
  • FIG. 5 is a schematic structural diagram of a computer device provided in Embodiment 4 of the present invention.
  • Figure 1 is a flow chart of a shared memory access method provided in Embodiment 1 of the present invention. This embodiment can be applied to the situation of accessing shared memory in a computer device. The method can be performed by the shared memory in the embodiment of the present invention.
  • the access device can be implemented in the form of hardware and/or software. As shown in Figure 1, the method includes:
  • Step S101 Use the specified real physical memory address as the reserved real physical memory address, and the reserved real physical memory address corresponds to the reserved memory area.
  • use the specified real physical memory address as the reserved real physical memory address including:
  • the specified real physical memory address is written in the kernel startup parameters of the computer system in advance; when the kernel is started, the specified real physical memory address is used as the reserved real physical memory address according to the startup parameters.
  • the computer device includes multiple real physical memory addresses, so in this embodiment, the specified real physical memory address is written in the kernel startup parameters of the computer system in advance. And when the kernel starts, the specified real physical memory address is used as the reserved real physical memory address according to the startup parameters, and the access permissions for the reserved real physical memory addresses are also set.
  • the access permissions include prohibiting the computer operating system from accessing the reserved memory. Regional access. For example, the prohibition is to prohibit the memory management module of the computer operating system from accessing the reserved memory area.
  • the address range of 0x 000-eee can be used as the specified real physical memory address according to the user instructions, and the specified real physical memory address 0x 000-eee can be Written into the kernel startup parameter memmap of the computer system, when the kernel starts, the specified real physical memory address will be reserved based on the specified real physical memory address 0x 000-eee contained in the computer system kernel startup parameter memmap.
  • Real physical memory address, and set the access permissions for the area corresponding to the reserved real physical memory address is only an example and does not limit the range of reserved real physical memory addresses.
  • Step S102 When creating a virtual machine, build an extended page table corresponding to each virtual machine.
  • each extended page table contains the corresponding relationship between the reserved real physical memory address and the shared virtual physical memory address.
  • a virtual machine creation instruction when a virtual machine creation instruction is received, since the virtual machine creation instruction contains the number of virtual machines to be created, a specified number of virtual machines will be created according to the virtual machine creation instruction, as shown in Figure 2, as A schematic diagram of the application scenario of this embodiment, and the specific description takes the creation of n virtual machines as an example.
  • the specific number of virtual machines created is not limited in this embodiment.
  • the computer operating system in this embodiment may be a Linux system. Of course, this embodiment is only an example and does not limit the specific type of the computer operating system. Moreover, the computer operating system in this embodiment is a system that has been pre-compiled.
  • the pre-compiled process includes: adjusting the virtual machine creation logic so that when building the virtual machine extended page table, the configured reserved real physical memory address and the virtual machine's are established. The relationship between shared virtual physical memory addresses; modify the system files used by the virtual machine so that the virtual machine sets the shared virtual physical memory address as reserved memory.
  • the computer operating system in this embodiment will also build an extended page table EPT corresponding to each virtual machine to realize the virtual physical memory address in each virtual machine and the computer operating system Correspondence to the real physical memory addresses in It is configured to share the real physical memory address and is identified in the EPT corresponding to each virtual machine.
  • the corresponding reserved memory area is used as the shared memory area shared by each virtual machine. Specifically, it can be represented by HPA.
  • Each virtual machine can save data to the shared memory area, and can also read data saved by itself and other virtual machines from the shared memory area.
  • the extended page table of each virtual machine will contain the reserved real physical memory address of the computer device, that is, the corresponding relationship between the shared real physical memory address and the shared virtual physical memory address in the virtual machine, as shown in Table 1 below.
  • the shared address is marked in Table 1, that is, X is the reserved real physical address in the computer operating system, and X has a corresponding relationship with the shared virtual physical memory address a in virtual machine 1, that is, in virtual machine 1
  • the process can access the shared real physical memory address X in the computer device.
  • Table 1 is only an example of the extended page table corresponding to virtual machine 1, and does not limit the specific number of correspondences between virtual physical memory addresses and real physical memory addresses contained in virtual machine 1.
  • the specific form of the extended page table corresponding to other virtual machines is roughly the same as the above-mentioned Table 1, and will not be described again in this embodiment.
  • the operating system running on the created virtual machine can be a windows operating system or an intewell operating system. This implementation does not limit the specific type of operating system running on the created virtual machine.
  • the operating system running on the virtual machine is an operating system whose driver has been pre-compiled. The pre-compiled driver can run the shared virtual physical memory address as a shared memory area.
  • Step S103 Provide each virtual machine with a standard interface for accessing the reserved memory area.
  • each virtual machine with a standard interface for accessing the reserved memory area, including: configuring an SDK service in the virtual machine, and providing a standard interface associated with the kernel driver for virtual machine applications in the SDK.
  • the standard interface includes a shared memory creation interface, an opening interface and an access interface, which respectively select memory from the reserved memory area to create shared memory, open other virtual machines or itself based on the shared virtual address of the shared memory in the virtual machine. Shared memory created, accessing other virtual machines or shared memory created by itself.
  • the computer operating system in this embodiment will also provide each created virtual machine with a standard interface for accessing the reserved memory area.
  • the SDK provides A standard interface associated with the kernel driver for virtual machine applications. Since virtual machine applications can include multiple applications, in order to ensure that the kernel driver can accurately distinguish which application is making the call, each application can be passed through a different The standard interface is associated with the kernel driver, so that different applications can accurately call the kernel driver through different standard interfaces.
  • the kernel driver of a virtual machine does not belong to the memory management module of the computer operating system. Therefore, the corresponding standard interface of each virtual machine implements the call to the kernel driver of the virtual machine without calling the memory management module of the computer operating system.
  • Step S104 When receiving a shared memory access request initiated by calling a standard interface on the virtual machine side, the reserved memory area is accessed according to the corresponding relationship in the extended page table.
  • each virtual machine's corresponding standard interface queries the extended page table through the virtual machine's kernel driver.
  • the reserved memory area when receiving a shared memory access request initiated by a virtual machine calling a standard interface, access the reserved memory area according to the corresponding relationship in the extended page table, including: determining the shared virtual address of the virtual machine; When an application requests access to a shared virtual address by calling a standard interface, it obtains the shared virtual physical memory address by querying the address mapping table.
  • the address mapping table contains the correspondence between the shared virtual address and the shared virtual physical memory address; through query expansion
  • the page table obtains the reserved real physical memory address that matches the shared virtual physical memory address, and accesses the reserved memory area corresponding to the reserved real physical memory address.
  • determine the shared virtual address of the virtual machine including: determining the specified virtual machine according to the user's login request, receiving the shared virtual address acquisition request through the application in the specified virtual machine; and using the kernel driver in the specified virtual machine to obtain the shared virtual address according to the shared virtual address.
  • Obtain the request filter the virtual addresses contained in the specified virtual machine, and determine the shared virtual address; establish the corresponding relationship between the shared virtual address and the shared virtual physical memory address, and save the corresponding relationship to the address mapping table of the specified virtual machine.
  • the corresponding standard interface of each virtual machine calls the kernel driver to realize the correspondence between the shared virtual address of the virtual machine and the shared virtual physical memory address through the address mapping table.
  • the corresponding standard interface of each virtual machine queries the address mapping table and extended page table through the kernel driver of the virtual machine to obtain the mapping relationship between the shared virtual address of the shared memory and the real physical memory address, so that the corresponding standard interface of each virtual machine passes
  • the kernel driver of the virtual machine implements access to the shared memory without the involvement of the computer operating system and has nothing to do with the computer operating system.
  • the designated virtual machine can be determined based on the virtual machine identifier, that is, which virtual machine in the computer operating system the user is currently logged in to. machine.
  • Each virtual machine contains applications that interact with users, kernel drivers, and SDK development kits that connect applications to the kernel drivers. Therefore, when a user logs into a specified virtual machine, such as virtual machine 1, and wants to access shared memory, he or she can receive a shared virtual address acquisition request through the application in the specified virtual machine.
  • the kernel driver in virtual machine 1 can obtain the corresponding address through the application.
  • the standard interface receives the shared address acquisition request and filters the virtual addresses contained in virtual machine 1 based on the preconfigured shared address size.
  • the shared address is also identified in Table 2, that is, ⁇ is the shared virtual address determined through screening in virtual machine 1, and ⁇ has a corresponding relationship with the shared virtual physical memory address a in virtual machine 1, that is, The process in virtual machine 1 indirectly accesses the shared virtual physical memory address a by accessing the shared virtual address ⁇ .
  • Table 2 is only an example of the address mapping table of virtual machine 1, and does not limit the specific content or form of the address mapping table of virtual machine 1.
  • the specific form of the address mapping table for other virtual machines is roughly the same as the above-mentioned Table 2, and will not be described again in this embodiment.
  • the specific value ⁇ of the shared virtual address will be fed back to the user through the application program to respond to the shared virtual address acquisition request.
  • the shared virtual physical memory address when receiving an access request for a shared virtual address from an application in the virtual machine by calling a standard interface, obtain the shared virtual physical memory address by querying the address mapping table, including: determining the specified standard that matches the specified virtual machine application Interface; the application in the specified virtual machine receives an access request to the shared virtual address by calling the specified standard interface; and obtains the shared virtual physical memory address that matches the shared virtual address by querying the address mapping table.
  • the relationship between the shared virtual address GVA, the shared virtual physical memory address GPA and the shared real physical memory address HPA will be determined.
  • machine for example, the specified standard interface matched by the application of virtual machine 1.
  • the address mapping table contains the shared virtual address and the shared virtual address.
  • the address mapping table shown in Table 2 is queried through the shared virtual address ⁇ determined by the application to obtain the shared virtual physical memory address a that matches the shared virtual address.
  • the kernel driver after obtaining the shared virtual physical memory address a, the kernel driver will be called through the designated interface matched by the application, and the extended page table shown in Table 2 will be queried through the kernel driver to obtain the shared virtual physical memory address that matches the shared virtual physical memory address a.
  • Real physical memory address X Since multiple virtual machines in a computer device can share the real physical memory address Access to shared data in virtual machines.
  • virtual machine 2 saves data that needs to be shared with other virtual machines into the shared real physical memory address X.
  • the user When the user only logs in to virtual machine 1, accesses the shared real physical memory address X through virtual machine 1.
  • the shared data of virtual machine 2 can be obtained from address X, so that data access to virtual machine 2 can be achieved without logging in to virtual machine 2 again.
  • this embodiment only illustrates the shared data in virtual machine 2 by sharing the real physical memory address X.
  • the shared data of other virtual machines can also be accessed by sharing the real physical memory address X in the same way. This is roughly the same and will not be described again in this embodiment.
  • the complete process of two virtual machines communicating through shared memory includes the following processes:
  • Virtual machine 1 selects a memory block from the reserved real physical memory to create shared memory through the shared memory creation interface in the standard interface. Through the above process, it obtains the shared virtual address GVA, shared virtual physical memory address GPA and shared memory of virtual machine 1. The three-way relationship between the real physical memory address HPA and the name of the shared memory (associated with the matched reserved real physical memory) is passed to virtual machine 2.
  • the application of virtual machine 1 and the application of virtual machine 2 communicate based on the shared memory through the shared memory access interface in their respective standard interfaces.
  • the application of virtual machine 1 and the application of virtual machine 2 directly access the corresponding shared virtual address of the shared memory.
  • GVA provides access without the participation of the computer operating system's memory management module.
  • a fixed area shared by multiple virtual machines is configured as a shared real physical memory address and a corresponding standard interface is provided, so that processes in different virtual machines, even if they run on different operating systems, can Shared memory located in a fixed area can be accessed according to the provided standard interface, thereby achieving efficient data exchange between virtual machines.
  • Figure 3 is a flow chart of a shared memory access method provided in Embodiment 2 of the present invention. This embodiment is based on the above embodiment. After using the specified real physical memory address as the reserved real physical memory address, the preset Leave access rights to real physical memory addresses, and set access rights to shared virtual physical memory addresses when creating a virtual machine. As shown in Figure 3, the method includes:
  • Step S201 Use the specified real physical memory address as the reserved real physical memory address, and the reserved real physical memory address corresponds to the reserved memory area.
  • use the specified real physical memory address as the reserved real physical memory address including:
  • the specified real physical memory address is written in the kernel startup parameters of the computer system in advance; when the kernel is started, the specified real physical memory address is configured as a reserved real physical memory address according to the startup parameters.
  • Step S202 Set the access permission to reserve a real physical memory address.
  • the access rights include prohibiting the computer operating system from accessing the reserved memory area. Therefore, when it is determined that the computer operating system has received an access request to the reserved real physical memory address, the request will be intercepted, or the reserved real physical memory address will be intercepted. The identity of the user accessing the memory address is verified. For example, when an illegal user is determined to be an illegal user, the computer operating system Linux is prohibited from accessing the reserved memory area corresponding to the reserved real physical memory address, so as to prevent the illegal user from accessing the data saved in the reserved memory area through the computer operating system. Modify to protect the security of data saved in the reserved memory area.
  • a computer operating system that does not pass the standard interface of this example, such as the memory management module of Linux, has no access rights to the reserved real physical memory address.
  • this embodiment is only an example, and does not limit the specific setting method of the access rights of the reserved real physical memory address. As long as the security of the data in the reserved memory area can be guaranteed, everything is included in this application. Within the scope of protection, this embodiment does not limit it.
  • Step S203 when creating a virtual machine, build an extended page table corresponding to each virtual machine, configure the shared virtual physical memory address of the virtual machine as a reserved area, and set access permissions for the shared virtual physical memory address.
  • the access rights include prohibiting the operating system in the virtual machine from accessing the reserved area, and the setting method of the access rights to the shared virtual physical memory address is roughly the same as the setting method of the access rights to the reserved memory area mentioned above. In this embodiment, no Let’s go into details.
  • the operating system windows running on the virtual machine is prohibited from accessing the shared virtual physical memory address a reserved in Table 2 above to prevent illegal users from accessing all the shared memory areas through the virtual physical memory address in the virtual machine operating system. Saves data modifications, thus protecting the security of the data saved in the shared memory area.
  • the memory management module on the virtual machine operating system that does not pass the standard interface of this instance does not have access rights to the virtual physical memory address.
  • Step S204 Provide each virtual machine with a standard interface for accessing the reserved memory area.
  • each virtual machine with a standard interface for accessing the reserved memory area, including: configuring an SDK service in the virtual machine, and providing a standard interface associated with the kernel driver for virtual machine applications in the SDK.
  • Step S205 When receiving a shared memory access request initiated by calling a standard interface on the virtual machine side, the reserved memory area is accessed according to the corresponding relationship in the extended page table.
  • a shared memory access request initiated by calling a standard interface on the virtual machine side when receiving a shared memory access request initiated by calling a standard interface on the virtual machine side, it also includes: calling a kernel driver based on the standard interface, and querying the extended page table through the kernel driver.
  • the reserved memory area when receiving a shared memory access request initiated by a virtual machine calling a standard interface, access the reserved memory area according to the corresponding relationship in the extended page table, including: determining the shared virtual address of the virtual machine; When an application requests access to a shared virtual address by calling a standard interface, it obtains the shared virtual physical memory address by querying the address mapping table.
  • the address mapping table contains the correspondence between the shared virtual address and the shared virtual physical memory address; through query expansion
  • the page table obtains the reserved real physical memory address that matches the shared virtual physical memory address, and accesses the reserved memory area corresponding to the reserved real physical memory address.
  • determine the shared virtual address of the virtual machine including: determining the specified virtual machine according to the user's login request, receiving the shared virtual address acquisition request through the application in the specified virtual machine; and using the kernel driver in the specified virtual machine to obtain the shared virtual address according to the shared virtual address.
  • Obtain the request filter the virtual addresses contained in the specified virtual machine, and determine the shared virtual address; establish the corresponding relationship between the shared virtual address and the shared virtual physical memory address, and save the corresponding relationship to the address mapping table of the specified virtual machine.
  • the access result after obtaining the access result for the shared content, the access result will be verified, specifically to verify whether the access result has obvious errors or is inconsistent with the actual situation, for example, to determine whether the access result It is blank data or garbled data, and an obvious error occurs when determining the access result; when it is determined that the access result contains the shared data of virtual machine 1, the data type is text data, but when creating virtual machine 2, since virtual machine 2 has been determined It is responsible for image storage, so all that is saved is image data. In this case, although the data is obtained, it is determined that the access result is inconsistent with the actual situation. In the above case, it is determined that the verification fails. Of course, this embodiment is only an example and does not limit the specific form of verification failure.
  • an alarm prompt will be issued in time, which can be provided in the form of pictures or sounds. Display, so that users can promptly perform equipment or software configuration maintenance according to alarm prompts, thereby improving the efficiency and accuracy of shared memory access.
  • this embodiment only uses pictures or sounds as examples to illustrate the alarm prompt. As long as it can serve as a reminder to the user, it is within the protection scope of the present application and is not limited in this embodiment.
  • a fixed area shared by multiple virtual machines is configured as a shared real physical memory address and a corresponding standard interface is provided, so that processes in different virtual machines, even if they run on different operating systems, can Shared memory located in a fixed area can be accessed according to the provided standard interface, thereby achieving efficient data exchange between virtual machines.
  • the access rights to shared or even physical memory addresses, as well as the access rights to shared virtual physical memory addresses the security of data saved in shared memory is guaranteed.
  • FIG. 4 is a schematic structural diagram of a shared memory access device provided in Embodiment 3 of the present invention. As shown in Figure 4, the device includes: a reservation module 410, an extended page table construction module 420, a standard interface providing module and a shared memory access module 440.
  • the reservation module 410 is used to configure the specified real physical memory address as a reserved real physical memory address, and the reserved real physical memory address corresponds to the reserved memory area;
  • the extended page table building module 420 is used to build an extended page table corresponding to each virtual machine when creating a virtual machine, wherein each extended page table contains the corresponding relationship between the reserved real physical memory address and the shared virtual physical memory address. ;
  • the standard interface providing module 430 is used to provide each virtual machine with a standard interface for accessing the reserved memory area;
  • the shared memory access module 440 is configured to access the reserved memory area according to the corresponding relationship in the extended page table when receiving a shared memory access request initiated by the virtual machine side by calling a standard interface.
  • shared memory access modules include:
  • the shared virtual address determination subunit is used to determine the shared virtual address of the virtual machine
  • the memory address acquisition subunit in the shared virtual area is used to obtain the shared virtual physical memory address by querying the address mapping table when receiving an access request for the shared virtual address from an application in the virtual machine by calling the standard interface, where the address mapping table Contains the correspondence between the shared virtual address and the shared virtual physical memory address;
  • the shared memory access subunit is used to obtain the reserved real physical memory address that matches the shared virtual physical memory address by querying the extended page table, and access the reserved memory area corresponding to the reserved real physical memory address.
  • the device also includes:
  • the first access rights setting module is used to set the access rights of reserved real physical memory addresses.
  • the access rights include prohibiting the computer operating system from accessing the reserved memory area;
  • the second access permission setting module is used to configure the shared virtual physical memory address of the virtual machine as a reserved area and set the access permission for the shared virtual physical memory address.
  • the access permission includes prohibiting the operating system in the virtual machine from accessing the reserved area.
  • the shared virtual address determination subunit is used to determine the designated virtual machine based on the user's login request, and receive the shared virtual address acquisition request through the application in the designated virtual machine;
  • the kernel driver in the specified virtual machine filters the virtual addresses contained in the specified virtual machine according to the shared virtual address acquisition request to determine the shared virtual address;
  • the memory address acquisition subunit in the shared virtual area is used to determine the specified standard interface that matches the application of the specified virtual machine
  • the application in the specified virtual machine receives the access request to the shared virtual address by calling the specified standard interface
  • the standard interface provides a module for configuring the SDK service in the virtual machine, and provides a standard interface associated with the kernel driver for virtual machine applications in the SDK;
  • the device also includes an extended page table query module, which is used to call the kernel driver based on a standard interface and query the extended page table through the kernel driver.
  • an extended page table query module which is used to call the kernel driver based on a standard interface and query the extended page table through the kernel driver.
  • the configuration module is used to pre-write the specified real physical memory address in the kernel startup parameters of the computer system
  • the specified real physical memory address is configured to reserve the real physical memory address according to the startup parameters.
  • the shared memory access device provided by the embodiment of the present invention can execute the shared memory access method provided by any embodiment of the present invention, and has corresponding functional modules and beneficial effects for executing the method.
  • FIG. 5 shows a schematic structural diagram of an electronic device 10 that can be used to implement embodiments of the present invention.
  • Electronic devices are intended to refer to various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers.
  • Electronic devices may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (eg, helmets, glasses, watches, etc.), and other similar computing devices.
  • the components shown herein, their connections and relationships, and their functions are examples only and are not intended to limit the implementation of the invention described and/or claimed herein.
  • the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores There is a computer program that can be executed by at least one processor.
  • the processor 11 can perform the operation according to the computer program stored in the read-only memory (ROM) 12 or loaded from the storage unit 18 into the random access memory (RAM) 13. Perform various appropriate actions and processing.
  • RAM 13 various programs and data required for the operation of the electronic device 10 can also be stored.
  • the processor 11, the ROM 12 and the RAM 13 are connected to each other via the bus 14.
  • An input/output (I/O) interface 15 is also connected to bus 14 .
  • the I/O interface 15 Multiple components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc. etc.; and communication unit 19, such as network card, modem, wireless communication transceiver, etc.
  • the communication unit 19 allows the electronic device 10 to exchange information/data with other devices through computer networks such as the Internet and/or various telecommunications networks.
  • Processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processing processor (DSP), and any appropriate processor, controller, microcontroller, etc.
  • the processor 11 executes various methods and processes described above, such as shared memory access methods.
  • the shared memory access method may be implemented as a computer program, which is tangibly included in a computer-readable storage medium, such as the storage unit 18 .
  • part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19.
  • the processor 11 may be configured to perform the shared memory access method in any other suitable manner (eg, by means of firmware).
  • Various implementations of the systems and techniques described above may be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip implemented in a system (SOC), load programmable logic device (CPLD), computer hardware, firmware, software, and/or a combination thereof.
  • FPGAs field programmable gate arrays
  • ASICs application specific integrated circuits
  • ASSPs application specific standard products
  • SOC system
  • CPLD load programmable logic device
  • computer hardware firmware, software, and/or a combination thereof.
  • These various embodiments may include implementation in one or more computer programs executable and/or interpreted on a programmable system including at least one programmable processor, the programmable processor
  • the processor which may be a special purpose or general purpose programmable processor, may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
  • An output device may be a special purpose or general purpose programmable processor, may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
  • An output device may be a special purpose or general purpose programmable processor, may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
  • Computer programs for implementing the methods of the invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that the computer program, when executed by the processor, causes the functions/operations specified in the flowcharts and/or block diagrams to be implemented.
  • a computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
  • a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device.
  • Computer-readable storage media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any suitable combination of the foregoing.
  • the computer-readable storage medium may be a machine-readable signal medium.
  • machine-readable storage media would include one or more wire-based electrical connections, laptop disks, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • RAM random access memory
  • ROM read only memory
  • EPROM or flash memory erasable programmable read only memory
  • CD-ROM portable compact disk read-only memory
  • magnetic storage device or any suitable combination of the above.
  • the systems and techniques described herein may be implemented on an electronic device having a display device (eg, a CRT (cathode ray tube) or LCD (liquid crystal display)) for displaying information to the user monitor); and a keyboard and pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device.
  • a display device eg, a CRT (cathode ray tube) or LCD (liquid crystal display)
  • a keyboard and pointing device e.g., a mouse or a trackball
  • Other kinds of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
  • the systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., A user's computer having a graphical user interface or web browser through which the user can interact with implementations of the systems and technologies described herein), or including such backend components, middleware components, or any combination of front-end components in a computing system.
  • the components of the system may be interconnected by any form or medium of digital data communication (eg, a communications network). Examples of communication networks include: local area network (LAN), wide area network (WAN), blockchain network, and the Internet.
  • Computing systems may include clients and servers.
  • Clients and servers are generally remote from each other and typically interact over a communications network.
  • the relationship of client and server is created by computer programs running on corresponding computers and having a client-server relationship with each other.
  • the server can be a cloud server, also known as cloud computing server or cloud host. It is a host product in the cloud computing service system to solve the problems of difficult management and weak business scalability in traditional physical hosts and VPS services. defect.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Memory System Of A Hierarchy Structure (AREA)
  • Storage Device Security (AREA)

Abstract

本申请实施例公开了一种共享内存的访问方法,包括:将指定的真实物理内存地址配置为预留真实物理内存地址,预留真实物理内存地址对应预留内存区域;创建虚拟机时,构建每个虚拟机所对应的扩展页表;向各虚拟机提供访问预留内存区域的标准接口;当接收到虚拟机侧调用标准接口发起的共享内存访问请求时,根据扩展页表中的对应关系访问预留内存区域。通过配置多个虚拟机所共用的一个固定区域作为共享真实物理内存地址,并提供所对应的标准接口,从而不同虚拟机中的进程,即使运行在不同的操作系统上,也可以根据所提供的标准接口,实现对位于固定区域的共享内存进行访问,从而实现了高效的虚拟机间数据交换。

Description

一种共享内存的访问方法、装置、设备和存储介质 技术领域
本发明实施例涉及通信技术领域,尤其涉及一种共享内存的访问方法、装置、设备和存储介质。
背景技术
传统计算机系统中,通常在一台计算机设备中会配置安装多个虚拟机,不同虚拟机中的进程都有自己的虚拟地址,并根据虚拟地址确定所匹配的虚拟物理内存地址,并根据所确定的虚拟物理内存地址实现对该虚拟机所对应的真实物理内存地址的访问。
但由于不同虚拟机中的进程,运行在不同的操作系统上,虽然每个虚拟机分别都分配有自身所独有的一段真实物理内存地址,但运行在不同虚拟机上的进程无法通过标准的应用程序编程接口,对不同虚拟机中位于固定区域的共享内存进行访问,从而无法提供高效的虚拟机间数据交换。
发明内容
本发明实施例提供了一种共享内存的访问方法、装置、设备和存储介质,以实现对多个虚拟机共享内存的访问。
第一方面,本发明实施例提供了一种共享内存的访问方法,包括:将指定的真实物理内存地址作为预留真实物理内存地址,所述预留真实物理内存地址对应预留内存区域;
创建虚拟机时,构建每个虚拟机所对应的扩展页表,其中,每个所述扩展页表中包含所述预留真实物理内存地址与共享虚拟物理内存地址的对应关系;
向各所述虚拟机提供访问预留内存区域的标准接口,每个虚拟机相应的所述标准接口实现对该虚拟机的内核驱动的调用,每个虚拟机的所述内核驱动实现查询该虚拟机所对应的扩展页表;
当接收到所述虚拟机侧调用所述标准接口发起的共享内存访问请求时,根据所述扩展页表中的对应关系访问所述预留内存区域。
由上,通过配置多个虚拟机所共用的一个固定区域作为共享真实物理内存地址,并提供所对应的标准接口,从而不同虚拟机中的进程,即使运行在不同的计算机操作系统上,也可以根据所提供的标准接口,在虚拟机层面实现对位于固定区域的共享内存进行访问,从而实现了高效的虚拟机间数据交换。
第二方面,本发明实施例提供了一种共享内存的访问装置,包括:配置模块,用于将指定的真实物理内存地址作为预留真实物理内存地址,所述预留真实物理内存地址对应预留内存区域;
扩展页表构建模块,用于创建虚拟机时,构建每个虚拟机所对应的扩展页表,其 中,每个所述扩展页表中包含所述预留真实物理内存地址与共享虚拟物理内存地址的对应关系;
标准接口提供模块,用于向各所述虚拟机提供访问预留内存区域的标准接口,每个虚拟机相应的所述标准接口实现对该虚拟机的内核驱动的调用,每个虚拟机的所述内核驱动用于查询该虚拟机所对应的扩展页表;
共享内存访问模块,用于当接收到所述虚拟机侧调用所述标准接口发起的共享内存访问请求时,根据所述扩展页表中的对应关系访问所述预留内存区域。
由上,通过配置多个虚拟机所共用的一个固定区域作为共享真实物理内存地址,并提供所对应的标准接口,从而不同虚拟机中的进程,即使运行在不同的计算机操作系统上,也可以根据所提供的标准接口,在虚拟机层面实现对位于固定区域的共享内存进行访问,从而实现了高效的虚拟机间数据交换。
第三方面,本发明实施例提供了一种计算机设备,计算机设备包括:
一个或多个处理器;
存储装置,用于存储一个或多个程序,
当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如上所述的共享内存的访问方法。
第四方面,本发明实施例提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现如上所述的共享内存的访问方法。
本发明实施例的技术方案,通过配置多个虚拟机所共用的一个固定区域作为共享真实物理内存地址,并提供所对应的标准接口,从而不同虚拟机中的进程,即使运行在不同的操作系统上,也可以根据所提供的标准接口,实现对位于固定区域的共享内存进行访问,从而实现了高效的虚拟机间数据交换。
附图说明
为了更清楚地说明本发明实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本发明的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。
图1是本发明实施例一提供的共享内存的访问方法的流程图;
图2是本发明实施例一提供的共享内存的访问方法的应用场景示意图;
图3是本发明实施例二提供的共享内存的访问方法的流程图;
图4是本发明实施例三提供的共享内存的访问装置的结构示意图;
图5是本发明实施例四提供的计算机设备的结构示意图。
具体实施方式
为了使本技术领域的人员更好地理解本发明方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分的实施例,而不是全部的实施例。基于本发明中的实施例,本领 域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本发明保护的范围。
需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本发明的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
实施例一
图1为本发明实施例一提供的一种共享内存的访问方法的流程图,本实施例可适用于对计算机设备中的共享内存进行访问的情况,该方法可以由本发明实施例中的共享内存的访问装置来执行,该装置可以采用硬件和/或软件的形式实现。如图1所示,该方法包括:
步骤S101,将指定的真实物理内存地址作为预留真实物理内存地址,预留真实物理内存地址对应预留内存区域。
可选的,将指定的真实物理内存地址作为预留真实物理内存地址,包括:
预先在计算机系统的内核启动参数中写入指定的真实物理内存地址;在内核启动时,根据启动参数将指定的真实物理内存地址作为预留真实物理内存地址。
其中,在计算机设备中包括多个真实物理内存地址,因此本实施方式中会预先在计算机系统的内核启动参数中写入所指定的真实物理内存地址。并在内核启动时,根据启动参数将所指定的真实物理内存地址作为预留真实物理内存地址,并且还会设置预留真实物理内存地址的访问权限,访问权限包括禁止计算机操作系统对预留内存区域的访问。示例地,该禁止为禁止计算机操作系统的内存管理模块对预留内存区域的访问。例如,计算机设备所包含的真实物理内存地址为0x000-fff,则可以根据用户指令将0x 000-eee的地址区间作为指定的真实物理内存地址,并将所指定的真实物理内存地址0x 000-eee写入计算机系统的内核启动参数memmap中,在内核启动时,会根据计算机系统内核启动参数memmap中所包含的指定的真实物理内存地址0x 000-eee,将所指定的真实物理内存地址作为预留真实物理内存地址,并对预留真实物理内存地址所对应区域的访问权限进行设定。当然,本实施方式中仅是举例说明,而并不对预留真实物理内存地址的区间范围进行限定。
步骤S102,创建虚拟机时,构建每个虚拟机所对应的扩展页表。
其中,每个扩展页表中包含预留真实物理内存地址与共享虚拟物理内存地址的对应关系。
具体的说,当接收到虚拟机创建指令时,由于在虚拟机创建指令中包含待创建的虚拟机数量,因此会根据虚拟机创建指令创建出指定数量的虚拟机,如图2所示,为本实施方式的应用场景示意图,并且具体是以创建n个虚拟机为例进行说明,本实施方式中并不限定所创建的虚拟机的具体数量。
需要说明的是,本实施方式中的计算机操作系统具体可以是linux系统,当然,本实施方式中仅是举例说明,而并不对计算机操作系统的具体类型进行限定。并且本实施方式中的计算机操作系统为经过预先编译处理的系统,预先编译处理包括:调整虚拟机创建逻辑,使得构建虚拟机扩展页表时建立起配置的预留真实物理内存地址与虚拟机的共享虚拟物理内存地址的关联关系;修改虚拟机使用的系统文件,使得虚拟机把共享虚拟物理内存地址设置为保留内存。
其中,在创建完指定数量的虚拟机之后,本实施方式中的计算机操作系统还会构建每个虚拟机所对应的扩展页表EPT,以实现每个虚拟机中虚拟物理内存地址与计算机操作系统中真实物理内存地址的对应,由于已经将一部分指定的真实物理内存地址作为预留真实物理内存地址,因此在构建每个虚拟机所对应的EPT时,还会将之前的预留真实物理内存地址配置为共享真实物理内存地址,并在每个虚拟机所对应的EPT中进行标识,相应的预留内存区域就作为各虚拟机所共用的共享内存区域,具体可以用HPA进行表示。每个虚拟机都可以向该共享内存区域中保存数据,同时还可以从该共享内存区域中读取自身以及其它虚拟机所保存的数据。因此每个虚拟机的扩展页表中会包含计算机设备的预留真实物理内存地址即共享真实物理内存地址与虚拟机中的共享虚拟物理内存地址的对应关系,如下表1所示,为针对虚拟机1所创建的扩展页表的示例:
表1
其中,在表1中针对共享地址进行了标记,即X为计算机操作系统中的预留真实物理内地址,并且X与虚拟机1中的共享虚拟物理内存地址a具有对应关系,即虚拟1中的进程通过访问共享虚拟物理内存地址a,用符号GPA表示,就可以实现对计算机设备中的共享真实物理内存地址X的访问。当然,表1仅是对虚拟机1所对应的扩展页表进行举例说明,而并不对虚拟机1中所包含的虚拟物理内存地址与真实物理内存地址的对应关系的具体数量进行限定。针对其它虚拟机所对应的扩展页表的具体形式与上述表1大致相同,本实施方式中不再进行赘述。
值得一提的是,在所创建的虚拟机上运行的操作系统具体可以是windows操作系统,或者为intewell操作系统,本实施方式中并不限定创建的虚拟机上所运行的操作系统的具体类型,并且虚拟机上运行的操作系统为驱动程序经过预先编译处理的操作系统,其中,经过预先编译处理的驱动程序可将共享虚拟物理内存地址运行为共享内存区域。
还值得一提的是,每个虚拟机所对应的扩展页表合成一个扩展页表。
步骤S103,向各虚拟机提供访问预留内存区域的标准接口。
可选的,向各虚拟机提供访问预留内存区域的标准接口,包括:在虚拟机中配置SDK服务,在SDK中提供面向虚拟机应用的与内核驱动关联的标准接口。在一些实 施例中,该标准接口包括共享内存的创建接口、打开接口和访问接口,分别基于共享内存在虚拟机中的共享虚拟地址从预留内存区域中选择内存创建共享内存、打开其他虚拟机或自身创建的共享内存、访问其他虚拟机或自身创建的共享内存。
具体的说,本实施方式中的计算机操作系统还会向所创建的各虚拟机,提供访问预留内存区域的标准接口,具体是通过每个虚拟机中所配置的SDK服务,在SDK中提供面向虚拟机应用的与内核驱动关联的标准接口,由于面向虚拟机的应用可以包括多个,为了保证内核驱动能够准确区分出具体是哪个应用在进行调用,因此可以使每个应用分别通过不同的标准接口与内核驱动关联,从而实现不同应用通过不同标准接口实现对内核驱动的准确调用。虚拟机的内核驱动不属于计算机操作系统的内存管理模块。因此,每个虚拟机相应的标准接口实现对该虚拟机的内核驱动的调用,无需调用计算机操作系统的内存管理模块。
步骤S104,当接收到虚拟机侧调用标准接口发起的共享内存访问请求时,根据扩展页表中的对应关系访问预留内存区域。
可选的,当接收到虚拟机侧调用标准接口发起的共享内存访问请求时,还包括:基于标准接口调用内核驱动,通过内核驱动查询扩展页表。因此,每个虚拟机相应的标准接口通过该虚拟机的内核驱动的查询扩展页表。
可选的,当接收到虚拟机调用标准接口发起的共享内存访问请求时,根据扩展页表中的对应关系访问预留内存区域,包括:确定虚拟机的共享虚拟地址;在接收到虚拟机中的应用通过调用标准接口对共享虚拟地址的访问请求时,通过查询地址映射表获取共享虚拟物理内存地址,其中,地址映射表中包含共享虚拟地址与共享虚拟物理内存地址的对应关系;通过查询扩展页表获取与共享虚拟物理内存地址所匹配的预留真实物理内存地址,并对预留真实物理内存地址所对应的预留内存区域进行访问。可选的,确定虚拟机的共享虚拟地址,包括:根据用户的登录请求确定指定虚拟机,通过指定虚拟机中的应用接收共享虚拟地址获取请求;通过指定虚拟机中的内核驱动根据共享虚拟地址获取请求,对指定虚拟机中所包含的虚拟地址进行筛选,确定出共享虚拟地址;建立共享虚拟地址与共享虚拟物理内存地址的对应关系,并将对应关系保存到指定虚拟机的地址映射表中。因此,每个虚拟机相应的标准接口调用内核驱动通过地址映射表实现虚拟机的共享虚拟地址与共享虚拟物理内存地址的对应关系。每个虚拟机相应的标准接口通过该虚拟机的内核驱动查询地址映射表和扩展页表,获得共享内存的共享虚拟地址与真实物理内存地址的映射关系,从而每个虚拟机相应的标准接口通过该虚拟机的内核驱动实现对共享内存的访问,无需计算机操作系统的参与,与计算机操作系统无关。
具体的说,当确定接收到用户的登录请求时,由于在登录请求中包含虚拟机标识,因此可以根据虚拟机标识确定出指定虚拟机,即用户当前登录的具体是计算机操作系统中的哪个虚拟机。在每个虚拟机中都包含与用户进行交互的应用、内核驱动,以及应用与内核驱动进行连接的SDK开发工具包。因此当用户登录指定虚拟机,例如虚拟机1后,如果想要访问共享内存,则可以通过指定虚拟机中的应用接收共享虚拟地址获取请求,虚拟机1中的内核驱动可以获取通过应用对应的标准接口接收共享地址获取请求,根据预先配置的共享地址大小,从虚拟机1中所包含的虚拟地址中进行筛 选,获取符合共享地址大小的共享虚拟机地址β,并用符号GVA表示,因为共享虚拟物理内存地址GPA在上述步骤中已经确定为a,因此建立共享虚拟地址β与共享虚拟物理内存地址a的对应关系,并将对应关系保存到指定虚拟机的地址映射表中,由于在地址映射表中预先保存有虚拟地址与虚拟物理内存地址的对应关系,因此通过保存上述对应关系,以实现对地址映射表的更新,如下表2所示为虚拟机1的地址映射表的示例:
表2
其中,在表2中同样也对共享地址进行了标识,即β为虚拟机1中通过筛选所确定的共享虚拟地址,并且β与虚拟机1中的共享虚拟物理内存地址a具有对应关系,即虚拟机1中的进程通过访问共享虚拟地址β间接实现对共享虚拟物理内存地址a的访问。当然,表2仅是对虚拟机1的地址映射表进行举例说明,而并不对虚拟机1的地址映射表的具体内容或形式进行限定。针对其它虚拟机的地址映射表的具体形式与上述表2大致相同,本实施方式中不再进行赘述。
另外,在确定出共享虚拟地址之后,还会将共享虚拟地址的具体数值β通过应用程序向用户反馈,以对共享虚拟地址获取请求进行响应。
可选的,在接收到虚拟机中的应用通过调用标准接口对共享虚拟地址的访问请求时,通过查询地址映射表获取共享虚拟物理内存地址,包括:确定与指定虚拟机应用所匹配的指定标准接口;指定虚拟机中的应用通过调用指定标准接口接收对共享虚拟地址的访问请求;通过查询地址映射表获取与共享虚拟地址所匹配的共享虚拟物理内存地址。
具体的说,由于在上述步骤中根据表1和表2已经确定了共享虚拟地址GVA、共享虚拟物理内存地址GPA以及共享真实物理内存地址HPA三者之间的关系,因此会确定出与指定虚拟机,例如虚拟机1的应用所匹配的指定标准接口,当虚拟机1中的应用通过调用指定标准接口接收对共享虚拟地址的访问请求时,由于在地址映射表中包含共享虚拟地址与共享虚拟物理内存地址的对应关系,因此会通过应用所确定的共享虚拟地址β查询表2所示的地址映射表,以获取与共享虚拟地址所匹配的共享虚拟物理内存地址a。
其中,在获取到共享虚拟物理内存地址a之后,会通过应用所匹配的指定接口调用内核驱动,通过内核驱动查询表2所示的扩展页表,以获取与共享虚拟物理内存地址所匹配的共享真实物理内存地址X,由于计算机设备中的多个虚拟机可以共同使用共享真实物理内存地址X,并将需要共享的数据在地址X中进行保存,因此用户通过登录指定虚拟机就可以实现对其它虚拟机中共享数据的访问。
例如,虚拟机2将需要与其他虚拟机共享的数据保存到了共享真实物理内存地址X中,当用户仅登录虚拟机1的情况下,通过虚拟机1访问共享真实物理内存地址X, 就可以从地址X中获取到虚拟机2的共享数据,从而在无需重新登录虚拟机2的情况下,就可以实现对虚拟机2的数据访问。当然,本实施方式中仅是以通过共享真实物理内存地址X对虚拟机2中的共享数据进行举例说明,当然还可以通过共享真实物理内存地址X对其它虚拟机的共享数据进行访问,方式与此大致相同,本实施方式中不进行赘述。
例如,从两个虚拟机通过共享内存进行通信的完整过程来说,包括以下过程:
1)虚拟机1通过标准接口中共享内存创建接口从预留真实物理内存选择内存块创建共享内存,通过上述过程获得共享内存在虚拟机1的共享虚拟地址GVA、共享虚拟物理内存地址GPA和共享真实物理内存地址HPA的三者关系,并把共享内存的名字(与匹配出的预留真实物理内存关联)传给虚拟机2。
2)虚拟机2通过标准接口中共享内存打开接口则根据共享内存名打开该共享内存,通过上述过程确定该共享内存在虚拟机2的共享虚拟地址GVA与共享真实物理内存地址HPA的关系。
3)虚拟机1的应用与虚拟机2的应用通过各自的标准接口中共享内存访问接口基于该共享内存进行通信,虚拟机1的应用与虚拟机2的应用直接对共享内存相应的共享虚拟地址GVA进行访问,无需计算机操作系统的内存管理模块参加。
本申请实施例,通过配置多个虚拟机所共用的一个固定区域作为共享真实物理内存地址,并提供所对应的标准接口,从而不同虚拟机中的进程,即使运行在不同的操作系统上,也可以根据所提供的标准接口,实现对位于固定区域的共享内存进行访问,从而实现了高效的虚拟机间数据交换。
实施例二
图3为本发明实施例二提供的一种共享内存的访问方法的流程图,本实施例以上述实施例为基础,在将指定的真实物理内存地址作为预留真实物理内存地址之后,设置预留真实物理内存地址的访问权限,以及创建虚拟机时,设置共享虚拟物理内存地址的访问权限。如图3所示,该方法包括:
步骤S201,将指定的真实物理内存地址作为预留真实物理内存地址,预留真实物理内存地址对应预留内存区域。
可选的,将指定的真实物理内存地址作为预留真实物理内存地址,包括:
预先在计算机系统的内核启动参数中写入指定的真实物理内存地址;在内核启动时,根据启动参数将指定的真实物理内存地址配置为预留真实物理内存地址。
步骤S202,设置预留真实物理内存地址的访问权限。
其中,访问权限包括禁止计算机操作系统对预留内存区域的访问,因此当确定接收到计算机操作系统对预留真实物理内存地址的访问请求时,会针对该请求进行拦截,或者对预留真实物理内存地址的访问用户的身份进行校验。例如,当确定为非法用户时,禁止计算机操作系统linux,对预留真实物理内存地址所对应的预留内存区域的访问,以避免非法用户通过计算机操作系统对预留内存区域中所保存数据的修改,从而保护预留内存区域中所保存数据的安全性。还例如,未通过本实例的标准接口的计算机操作系统如linux的内存管理模块对预留真实物理内存地址也无访问权限。当 然,本实施方式中仅是举例说明,而并不对预留真实物理内存地址的访问权限的具体设置方式进行限定,只要能够保证预留内存区域中数据的安全性,则都是在本申请的保护范围内,本实施方式中并不对其进行限定。
步骤S203,创建虚拟机时,构建每个虚拟机所对应的扩展页表,将虚拟机的共享虚拟物理内存地址配置为保留区域,并设置共享虚拟物理内存地址的访问权限。
其中,访问权限包括禁止虚拟机中的操作系统对保留区域的访问,对共享虚拟物理内存地址访问权限的设置方式,与上述预留内存区域的访问权限的设置方式大致相同,本实施方式中不再进行赘述。
例如,禁止虚拟机上运行的操作系统windows,对上述表2中所保留的共享虚拟物理内存地址a的访问,以避免非法用户通过虚拟机操作系统中的虚拟物理内存地址对共享内存区域中所保存数据的修改,从而保护共享内存区域中所保存数据的安全性。还例如,未通过本实例的标准接口的虚拟机操作系统上的内存管理模块对虚拟物理内存地址也无访问权限。
步骤S204,向各虚拟机提供访问预留内存区域的标准接口。
可选的,向各虚拟机提供访问预留内存区域的标准接口,包括:在虚拟机中配置SDK服务,在SDK中提供面向虚拟机应用的与内核驱动关联的标准接口。
步骤S205,当接收到虚拟机侧调用标准接口发起的共享内存访问请求时,根据扩展页表中的对应关系访问预留内存区域。
可选的,当接收到虚拟机侧调用标准接口发起的共享内存访问请求时,还包括:基于标准接口调用内核驱动,通过内核驱动查询扩展页表。
可选的,当接收到虚拟机调用标准接口发起的共享内存访问请求时,根据扩展页表中的对应关系访问预留内存区域,包括:确定虚拟机的共享虚拟地址;在接收到虚拟机中的应用通过调用标准接口对共享虚拟地址的访问请求时,通过查询地址映射表获取共享虚拟物理内存地址,其中,地址映射表中包含共享虚拟地址与共享虚拟物理内存地址的对应关系;通过查询扩展页表获取与共享虚拟物理内存地址所匹配的预留真实物理内存地址,并对预留真实物理内存地址所对应的预留内存区域进行访问。
可选的,确定虚拟机的共享虚拟地址,包括:根据用户的登录请求确定指定虚拟机,通过指定虚拟机中的应用接收共享虚拟地址获取请求;通过指定虚拟机中的内核驱动根据共享虚拟地址获取请求,对指定虚拟机中所包含的虚拟地址进行筛选,确定出共享虚拟地址;建立共享虚拟地址与共享虚拟物理内存地址的对应关系,并将对应关系保存到指定虚拟机的地址映射表中。
具体的说,本实施方式中在获取到针对共享内容的访问结果之后,会对访问结果进行校验,具体是校验访问结果是否出现明显错误或者与实际情况不符的情况,例如,确定访问结果为空白数据或乱码数据,在确定访问结果为出现明显错误;当确定访问结果中包含虚拟机1的共享数据,数据类型为文本数据,但由于在创建虚拟机2时,由于已经确定虚拟机2是负责图片存储的,因此保存的全部为图片数据,在这种情况下虽然获取到数据,则确定访问结果为与实际情况不符,在上述情况下则确定校验不通过。当然,本实施方式中仅是举例说明,而并不对校验未通过的具体形式进行限定。在校验未通过时,会及时发出报警提示,具体可以采用图片或声音的形式进行报警提 示,以使用户根据报警提示及时进行设备或软件配置的检修,从而提高共享内存访问的效率以及准确性。当然,本实施方式中仅是以图片或声音为例对报警提示进行说明,只要能够对用户起到提示作用,则都是在本申请的保护范围内,本实施方式中并不对其进行限定。
本申请实施例,通过配置多个虚拟机所共用的一个固定区域作为共享真实物理内存地址,并提供所对应的标准接口,从而不同虚拟机中的进程,即使运行在不同的操作系统上,也可以根据所提供的标准接口,实现对位于固定区域的共享内存进行访问,从而实现了高效的虚拟机间数据交换。并且通过对共享甚至物理内存地址的访问权限,以及共享虚拟物理内存地址的访问权限进行设置,保证共享内存中所保存数据的安全性。
实施例三
图4为本发明实施例三提供的一种共享内存的访问装置的结构示意图。如图4所示,该装置包括:预留模块410、扩展页表构建模块420、标准接口提供模块和共享内存访问模块440。
其中,预留模块410,用于将指定的真实物理内存地址配置为预留真实物理内存地址,预留真实物理内存地址对应预留内存区域;
扩展页表构建模块420,用于创建虚拟机时,构建每个虚拟机所对应的扩展页表,其中,每个扩展页表中包含预留真实物理内存地址与共享虚拟物理内存地址的对应关系;
标准接口提供模块430,用于向各虚拟机提供访问预留内存区域的标准接口;
共享内存访问模块440,用于当接收到虚拟机侧调用标准接口发起的共享内存访问请求时,根据扩展页表中的对应关系访问预留内存区域。
可选的,共享内存访问模块包括:
共享虚拟地址确定子单元,用于确定虚拟机的共享虚拟地址;
共享虚拟区里内存地址获取子单元,用于在接收到虚拟机中的应用通过调用标准接口对共享虚拟地址的访问请求时,通过查询地址映射表获取共享虚拟物理内存地址,其中,地址映射表中包含共享虚拟地址与共享虚拟物理内存地址的对应关系;
共享内存访问子单元,用于通过查询扩展页表获取与共享虚拟物理内存地址所匹配的预留真实物理内存地址,并对预留真实物理内存地址所对应的预留内存区域进行访问。
可选的,装置还包括:
第一访问权限设置模块,用于设置预留真实物理内存地址的访问权限,访问权限包括禁止计算机操作系统对预留内存区域的访问;
第二访问权限设置模块,用于将虚拟机的共享虚拟物理内存地址配置为保留区域,并设置共享虚拟物理内存地址的访问权限,访问权限包括禁止虚拟机中的操作系统对保留区域的访问。
可选的,共享虚拟地址确定子单元,用于根据用户的登录请求确定指定虚拟机,通过指定虚拟机中的应用接收共享虚拟地址获取请求;
通过指定虚拟机中的内核驱动根据共享虚拟地址获取请求,对指定虚拟机中所包含的虚拟地址进行筛选,确定出共享虚拟地址;
建立共享虚拟地址与共享虚拟物理内存地址的对应关系,并将对应关系保存到指定虚拟机的地址映射表中。
可选的,共享虚拟区里内存地址获取子单元,用于确定与指定虚拟机的应用所匹配的指定标准接口;
指定虚拟机中的应用通过调用指定标准接口接收对共享虚拟地址的访问请求;
通过查询地址映射表获取与共享虚拟地址所匹配的共享虚拟物理内存地址。
可选的,标准接口提供模块,用于在虚拟机中配置SDK服务,在SDK中提供面向虚拟机应用的与内核驱动关联的标准接口;
装置还包括扩展页表查询模块,用于基于标准接口调用内核驱动,通过内核驱动查询扩展页表。
可选的,配置模块,用于预先在计算机系统的内核启动参数中写入指定的真实物理内存地址;
在内核启动时,根据启动参数将指定的真实物理内存地址配置为预留真实物理内存地址。
本发明实施例所提供的共享内存的访问装置可执行本发明任意实施例所提供的共享内存的访问方法,具备执行方法相应的功能模块和有益效果。
实施例四
图5示出了可以用来实施本发明的实施例的电子设备10的结构示意图。电子设备旨在表示各种形式的数字计算机,诸如,膝上型计算机、台式计算机、工作台、个人数字助理、服务器、刀片式服务器、大型计算机、和其它适合的计算机。电子设备还可以表示各种形式的移动装置,诸如,个人数字处理、蜂窝电话、智能电话、可穿戴设备(如头盔、眼镜、手表等)和其它类似的计算装置。本文所示的部件、它们的连接和关系、以及它们的功能仅仅作为示例,并且不意在限制本文中描述的和/或者要求的本发明的实现。
如图5所示,电子设备10包括至少一个处理器11,以及与至少一个处理器11通信连接的存储器,如只读存储器(ROM)12、随机访问存储器(RAM)13等,其中,存储器存储有可被至少一个处理器执行的计算机程序,处理器11可以根据存储在只读存储器(ROM)12中的计算机程序或者从存储单元18加载到随机访问存储器(RAM)13中的计算机程序,来执行各种适当的动作和处理。在RAM 13中,还可存储电子设备10操作所需的各种程序和数据。处理器11、ROM 12以及RAM 13通过总线14彼此相连。输入/输出(I/O)接口15也连接至总线14。
电子设备10中的多个部件连接至I/O接口15,包括:输入单元16,例如键盘、鼠标等;输出单元17,例如各种类型的显示器、扬声器等;存储单元18,例如磁盘、光盘等;以及通信单元19,例如网卡、调制解调器、无线通信收发机等。通信单元19允许电子设备10通过诸如因特网的计算机网络和/或各种电信网络与其他设备交换信息/数据。
处理器11可以是各种具有处理和计算能力的通用和/或专用处理组件。处理器11的一些示例包括但不限于中央处理单元(CPU)、图形处理单元(GPU)、各种专用的人工智能(AI)计算芯片、各种运行机器学习模型算法的处理器、数字信号处理器(DSP)、以及任何适当的处理器、控制器、微控制器等。处理器11执行上文所描述的各个方法和处理,例如共享内存的访问方法。
在一些实施例中,共享内存的访问方法可被实现为计算机程序,其被有形地包含于计算机可读存储介质,例如存储单元18。在一些实施例中,计算机程序的部分或者全部可以经由ROM 12和/或通信单元19而被载入和/或安装到电子设备10上。当计算机程序加载到RAM 13并由处理器11执行时,可以执行上文描述的共享内存的访问方法的一个或多个步骤。备选地,在其他实施例中,处理器11可以通过其他任何适当的方式(例如,借助于固件)而被配置为执行共享内存的访问方法。
本文中以上描述的系统和技术的各种实施方式可以在数字电子电路系统、集成电路系统、场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、芯片上系统的系统(SOC)、负载可编程逻辑设备(CPLD)、计算机硬件、固件、软件、和/或它们的组合中实现。这些各种实施方式可以包括:实施在一个或者多个计算机程序中,该一个或者多个计算机程序可在包括至少一个可编程处理器的可编程系统上执行和/或解释,该可编程处理器可以是专用或者通用可编程处理器,可以从存储系统、至少一个输入装置、和至少一个输出装置接收数据和指令,并且将数据和指令传输至该存储系统、该至少一个输入装置、和该至少一个输出装置。
用于实施本发明的方法的计算机程序可以采用一个或多个编程语言的任何组合来编写。这些计算机程序可以提供给通用计算机、专用计算机或其他可编程数据处理装置的处理器,使得计算机程序当由处理器执行时使流程图和/或框图中所规定的功能/操作被实施。计算机程序可以完全在机器上执行、部分地在机器上执行,作为独立软件包部分地在机器上执行且部分地在远程机器上执行或完全在远程机器或服务器上执行。
在本发明的上下文中,计算机可读存储介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的计算机程序。计算机可读存储介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。备选地,计算机可读存储介质可以是机器可读信号介质。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
为了提供与用户的交互,可以在电子设备上实施此处描述的系统和技术,该电子设备具有:用于向用户显示信息的显示装置(例如,CRT(阴极射线管)或者LCD(液晶显示器)监视器);以及键盘和指向装置(例如,鼠标或者轨迹球),用户可以通过该键盘和该指向装置来将输入提供给电子设备。其它种类的装置还可以用于提供与用户的交互;例如,提供给用户的反馈可以是任何形式的传感反馈(例如,视觉反馈、 听觉反馈、或者触觉反馈);并且可以用任何形式(包括声输入、语音输入或者、触觉输入)来接收来自用户的输入。
可以将此处描述的系统和技术实施在包括后台部件的计算系统(例如,作为数据服务器)、或者包括中间件部件的计算系统(例如,应用服务器)、或者包括前端部件的计算系统(例如,具有图形用户界面或者网络浏览器的用户计算机,用户可以通过该图形用户界面或者该网络浏览器来与此处描述的系统和技术的实施方式交互)、或者包括这种后台部件、中间件部件、或者前端部件的任何组合的计算系统中。可以通过任何形式或者介质的数字数据通信(例如,通信网络)来将系统的部件相互连接。通信网络的示例包括:局域网(LAN)、广域网(WAN)、区块链网络和互联网。
计算系统可以包括客户端和服务器。客户端和服务器一般远离彼此并且通常通过通信网络进行交互。通过在相应的计算机上运行并且彼此具有客户端-服务器关系的计算机程序来产生客户端和服务器的关系。服务器可以是云服务器,又称为云计算服务器或云主机,是云计算服务体系中的一项主机产品,以解决了传统物理主机与VPS服务中,存在的管理难度大,业务扩展性弱的缺陷。
应该理解,可以使用上面所示的各种形式的流程,重新排序、增加或删除步骤。例如,本发明中记载的各步骤可以并行地执行也可以顺序地执行也可以不同的次序执行,只要能够实现本发明的技术方案所期望的结果,本文在此不进行限制。
上述具体实施方式,并不构成对本发明保护范围的限制。本领域技术人员应该明白的是,根据设计要求和其他因素,可以进行各种修改、组合、子组合和替代。任何在本发明的精神和原则之内所作的修改、等同替换和改进等,均应包含在本发明保护范围之内。

Claims (11)

  1. 一种共享内存的访问方法,其特征在于,应用于计算机操作系统,包括:
    将指定的真实物理内存地址作为预留真实物理内存地址,所述预留真实物理内存地址对应预留内存区域;
    创建虚拟机时,构建每个虚拟机所对应的扩展页表,其中,每个所述扩展页表中包含所述预留真实物理内存地址与共享虚拟物理内存地址的对应关系;
    向各所述虚拟机提供访问预留内存区域的标准接口,每个虚拟机相应的所述标准接口实现对该虚拟机的内核驱动的调用,每个虚拟机的所述内核驱动实现查询该虚拟机所对应的扩展页表;
    当接收到所述虚拟机侧调用所述标准接口发起的共享内存访问请求时,根据所述扩展页表中的对应关系访问所述预留内存区域。
  2. 根据权利要求1所述的方法,其特征在于,所述当接收到所述虚拟机调用所述标准接口发起的共享内存访问请求时,根据所述扩展页表中的对应关系访问所述预留内存区域,包括:
    确定所述虚拟机的共享虚拟地址;
    在接收到虚拟机中的应用通过调用所述标准接口对所述共享虚拟地址的访问请求时,通过查询地址映射表获取共享虚拟物理内存地址,其中,所述地址映射表中包含共享虚拟地址与共享虚拟物理内存地址的对应关系;
    通过查询所述扩展页表获取与所述共享虚拟物理内存地址所匹配的预留真实物理内存地址,并对所述预留真实物理内存地址所对应的预留内存区域进行访问。
  3. 根据权利要求1所述的方法,其特征在于,所述将指定的真实物理内存地址作为预留真实物理内存地址之后,还包括:设置所述预留真实物理内存地址的访问权限,所述访问权限包括禁止所述计算机操作系统对所述预留内存区域的访问;
    创建虚拟机时,还包括:将所述虚拟机的共享虚拟物理内存地址配置为保留区域,并设置所述共享虚拟物理内存地址的访问权限,所述访问权限包括禁止虚拟机中的操作系统对所述保留区域的访问。
  4. 根据权利要求2所述的方法,其特征在于,所述确定所述虚拟机的共享虚拟地址,包括:通过所述虚拟机的内核驱动确定所述虚拟机的共享虚拟地址和建立所述虚拟机的共享虚拟地址与共享虚拟物理内存地址的对应关系。
  5. 根据权利要求4所述的方法,其特征在于,所述通过所述虚拟机的内核驱动确定所述虚拟机的共享虚拟地址和建立所述虚拟机的共享虚拟地址与共享虚拟物理内存地址的对应关系,包括:
    根据用户的登录请求确定所述虚拟机,通过所述虚拟机中的应用接收共享虚拟地址获取请求;
    通过所述虚拟机中的内核驱动根据所述共享虚拟地址获取请求,对所述虚拟机中所包含的虚拟地址进行筛选,确定出所述共享虚拟地址;
    建立所述共享虚拟地址与共享虚拟物理内存地址的对应关系,并将所述对应关系保存到所述虚拟机的地址映射表中。
  6. 根据权利要求5所述的方法,其特征在于,所述在接收到虚拟机中的应用通过调用所述标准接口对所述共享虚拟地址的访问请求时,通过查询地址映射表获取共享虚拟物理内存地址,包括:
    确定与所述指定虚拟机的应用所匹配的指定标准接口;
    所述指定虚拟机中的应用通过调用所述指定标准接口接收对所述共享虚拟地址的访问请求;
    通过查询所述地址映射表获取与所述共享虚拟地址所匹配的所述共享虚拟物理内存地址。
  7. 根据权利要求1所述的方法,其特征在于,所述向各所述虚拟机提供访问预留内存区域的标准接口,包括:在所述虚拟机中配置SDK服务,在所述SDK中提供面向虚拟机应用的与内核驱动关联的所述标准接口;
    所述当接收到所述虚拟机侧调用所述标准接口发起的共享内存访问请求时,还包括:基于所述标准接口调用内核驱动,通过所述内核驱动查询所述扩展页表。
  8. 根据权利要求1至7中任一项所述的方法,其特征在于,所述将指定的真实物理内存地址作为预留真实物理内存地址,包括:
    预先在所述计算机操作系统的内核启动参数中写入所述指定的真实物理内存地址;
    在所述内核启动时,根据所述启动参数将所述指定的真实物理内存作为预留真实物理内存地址。
  9. 一种共享内存的访问装置,其特征在于,包括:
    预留模块,用于将指定的真实物理内存地址作为预留真实物理内存地址,所述预留真实物理内存地址对应预留内存区域;
    扩展页表构建模块,用于创建虚拟机时,构建每个虚拟机所对应的扩展页表,其中,每个所述扩展页表中包含所述预留真实物理内存地址与共享虚拟物理内存地址的对应关系;
    标准接口提供模块,用于向各所述虚拟机提供访问预留内存区域的标准接口,每个虚拟机相应的所述标准接口实现对该虚拟机的内核驱动的调用,每个虚拟机的所述内核驱动用于查询该虚拟机所对应的扩展页表;
    共享内存访问模块,用于当接收到所述虚拟机侧调用所述标准接口发起的共享内存访问请求时,根据所述扩展页表中的对应关系访问所述预留内存区域。
  10. 一种计算机设备,其特征在于,所述计算机设备包括:
    一个或多个处理器;
    存储装置,用于存储一个或多个程序,
    当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-8中任一所述的方法。
  11. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现如权利要求1-8中任一所述的方法。
PCT/CN2023/086008 2022-04-08 2023-04-03 一种共享内存的访问方法、装置、设备和存储介质 WO2023193687A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210367614.8A CN114936064B (zh) 2022-04-08 2022-04-08 一种共享内存的访问方法、装置、设备和存储介质
CN202210367614.8 2022-04-08

Publications (1)

Publication Number Publication Date
WO2023193687A1 true WO2023193687A1 (zh) 2023-10-12

Family

ID=82862377

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/086008 WO2023193687A1 (zh) 2022-04-08 2023-04-03 一种共享内存的访问方法、装置、设备和存储介质

Country Status (2)

Country Link
CN (1) CN114936064B (zh)
WO (1) WO2023193687A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114936064B (zh) * 2022-04-08 2023-03-31 科东(广州)软件科技有限公司 一种共享内存的访问方法、装置、设备和存储介质
CN115357416B (zh) * 2022-10-19 2023-03-24 南京芯驰半导体科技有限公司 一种跨系统进行数据处理的方法及装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101819564A (zh) * 2009-02-26 2010-09-01 国际商业机器公司 协助在虚拟机之间进行通信的方法和装置
US20190004841A1 (en) * 2017-06-30 2019-01-03 Microsoft Technology Licensing, Llc Memory Sharing For Virtual Machines
CN110008692A (zh) * 2019-03-22 2019-07-12 联想(北京)有限公司 一种信息处理方法、装置与存储介质
CN111679921A (zh) * 2020-06-09 2020-09-18 Oppo广东移动通信有限公司 内存共享方法、内存共享装置及终端设备
CN114936064A (zh) * 2022-04-08 2022-08-23 科东(广州)软件科技有限公司 一种共享内存的访问方法、装置、设备和存储介质

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108243118B (zh) * 2016-12-27 2020-06-26 华为技术有限公司 转发报文的方法和物理主机
CN107329790B (zh) * 2017-06-30 2021-01-15 联想(北京)有限公司 一种数据处理方法和电子设备
CN110928646B (zh) * 2019-11-22 2023-02-17 海光信息技术股份有限公司 一种访问共享内存的方法、装置、处理器和计算机系统
CN111813584A (zh) * 2020-08-05 2020-10-23 Oppo广东移动通信有限公司 内存共享方法、装置、电子设备及存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101819564A (zh) * 2009-02-26 2010-09-01 国际商业机器公司 协助在虚拟机之间进行通信的方法和装置
US20190004841A1 (en) * 2017-06-30 2019-01-03 Microsoft Technology Licensing, Llc Memory Sharing For Virtual Machines
CN110008692A (zh) * 2019-03-22 2019-07-12 联想(北京)有限公司 一种信息处理方法、装置与存储介质
CN111679921A (zh) * 2020-06-09 2020-09-18 Oppo广东移动通信有限公司 内存共享方法、内存共享装置及终端设备
CN114936064A (zh) * 2022-04-08 2022-08-23 科东(广州)软件科技有限公司 一种共享内存的访问方法、装置、设备和存储介质

Also Published As

Publication number Publication date
CN114936064B (zh) 2023-03-31
CN114936064A (zh) 2022-08-23

Similar Documents

Publication Publication Date Title
WO2023193687A1 (zh) 一种共享内存的访问方法、装置、设备和存储介质
US11044230B2 (en) Dynamically opening ports for trusted application processes hosted in containers
WO2020233039A1 (zh) 用户操作权限控制方法、装置、设备及介质
EP3432549B1 (en) Method and apparatus for processing user requests
US10394731B2 (en) System on a chip comprising reconfigurable resources for multiple compute sub-systems
US9225707B1 (en) Cloud computing and integrated cloud drive
US20210144147A1 (en) System and method for externally-delegated access control and authorization
WO2019179026A1 (zh) 电子装置、集群访问域名自动生成方法及存储介质
WO2018040525A1 (zh) 资源池的处理方法、装置和设备
US20180198777A1 (en) Implementing single sign-on in a transaction processing system
US20190317783A1 (en) Methods, apparatus, and systems for providing access to serial ports of virtual machines in self-deployed virtual applications
US20160364577A1 (en) Compromise free cloud data encryption and security
CN103685608A (zh) 一种自动配置安全虚拟机ip地址的方法及装置
US11546228B2 (en) Zero-touch configuration of network devices using hardware metadata
WO2020168757A1 (zh) 网络系统访问方法、装置、计算机设备及可读存储介质
CN111083166A (zh) 云数据库设置白名单的方法、装置及计算机存储介质
US11785054B2 (en) Deriving system architecture from security group relationships
WO2019001280A1 (zh) 异构虚拟计算资源的管理方法、相关设备及存储介质
WO2021051569A1 (zh) 一种数据隔离方法、装置、计算机设备及存储介质
CN113612643B (zh) 云手机的网络配置方法、装置、设备以及存储介质
WO2022133827A1 (zh) 一种任务处理请求的处理方法、装置以及区块链节点设备
US11163537B1 (en) Tiered application pattern
US11301557B2 (en) System and method for data processing device management
CN111325456B (zh) 资产数据处理方法和装置、计算机系统和存储介质
US10558359B2 (en) Device and method for virtual storage

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23784250

Country of ref document: EP

Kind code of ref document: A1