[go: up one dir, main page]

CN114564436B - Memory initialization method supporting heterogeneous CPUs in Qemu emulator - Google Patents

Memory initialization method supporting heterogeneous CPUs in Qemu emulator

Info

Publication number
CN114564436B
CN114564436B CN202210196042.1A CN202210196042A CN114564436B CN 114564436 B CN114564436 B CN 114564436B CN 202210196042 A CN202210196042 A CN 202210196042A CN 114564436 B CN114564436 B CN 114564436B
Authority
CN
China
Prior art keywords
memory
cross
region
calling
qemu
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN202210196042.1A
Other languages
Chinese (zh)
Other versions
CN114564436A (en
Inventor
赵玉龙
张鲁飞
孙茹君
王宇
李祥
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuxi Jiangnan Computing Technology Institute
Original Assignee
Wuxi Jiangnan Computing Technology Institute
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 Wuxi Jiangnan Computing Technology Institute filed Critical Wuxi Jiangnan Computing Technology Institute
Priority to CN202210196042.1A priority Critical patent/CN114564436B/en
Publication of CN114564436A publication Critical patent/CN114564436A/en
Application granted granted Critical
Publication of CN114564436B publication Critical patent/CN114564436B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F15/00Digital computers in general; Data processing equipment in general
    • G06F15/16Combinations of two or more digital computers each having at least an arithmetic unit, a program unit and a register, e.g. for a simultaneous processing of several programs
    • G06F15/163Interprocessor communication
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5044Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering hardware capabilities
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本发明公开一种在Qemu模拟器中支持异构CPU的内存初始化方法,针对X86+申威AI的异构模型,包括以下步骤:步骤1、按照Qemu默认的初始化方式,从地址0开始,对X86CPU的内存进行初始化;步骤2、分析X86以及申威架构对地址范围的使用情况,内存范围从SW_PHYS_ADDR_START(1<<59)开始,对申威AI处理器的内存进行初始化。本发明通过隔离内存范围的方式对不同架构的CPU内存进行隔离,并使用不同的方式进行初始化,实现了异构CPU的内存初始化,为在同一个Qemu模拟环境中实现X86+AI加速卡的全系统模拟奠定了基础。The present invention discloses a memory initialization method that supports heterogeneous CPUs in the Qemu simulator. For the heterogeneous model of X86+Shenwei AI, the method includes the following steps: Step 1: Initialize the memory of the X86 CPU starting from address 0 according to the default initialization method of Qemu; Step 2: Analyze the usage of the address range by the X86 and Shenwei architectures, and initialize the memory of the Shenwei AI processor starting from SW_PHYS_ADDR_START (1<<59). The present invention isolates the memory of CPUs of different architectures by isolating the memory range and initializes them in different ways, thereby realizing memory initialization of heterogeneous CPUs and laying the foundation for realizing full-system simulation of X86+AI accelerator cards in the same Qemu simulation environment.

Description

Memory initialization method for supporting heterogeneous CPU in Qemu simulator
Technical Field
The invention relates to a memory initialization method for supporting heterogeneous CPUs in a Qemu simulator, which is used for a domestic AI acceleration card simulator and belongs to the technical field of computation.
Background
Qemu (full Quick Emulator) is a system-wide simulator and virtual machine monitor (Virtual Machine Monitor, VMM) that is open-source and plays an important role in hardware development and basic software development. The Qemu simulates virtual memory, and the core is to maintain a virtual machine physical address space, wherein the address space is convenient for Qemu management, memory is provided for a virtual machine side, display and export are convenient, and a memory view is provided for a platform side.
In current Qemu, the memory is initially designed mainly for a single architecture, and the memory is initialized and allocated for the CPU of the single architecture starting from 0. Therefore, the memory management of the existing Qemu simulator is performed for a single CPU architecture, and cannot support heterogeneous CPU operation, mainly the memory layout problem. From the Qemu perspective, the physical address of the memory range (memory_region) of the virtual machine under a single architecture is laid out from 0, and the physical address is increased according to the size, and in the heterogeneous mode, the memory range for heterogeneous CPUs is planned, and the two cannot have cross conflict.
Disclosure of Invention
The invention aims to provide a memory initialization method for supporting heterogeneous CPUs in a Qemu simulator, which aims to solve the problem of initializing memories at bottom layers of different types of CPUs when the same Qemu simulator simulates heterogeneous CPUs at the same time.
In order to achieve the above objective, the present invention provides a memory initialization method for supporting heterogeneous CPUs in a Qemu simulator, which aims at a heterogeneous model of x86+shenwei AI, and includes the following steps:
Step 1, initializing the memory of the X86CPU from the address 0 according to a Qemu default initialization mode, wherein the specific flow is as follows:
Step 11, analyzing the condition of the memory to be initialized according to the parameters in the pc_init1;
Step 12, calling the function cpu_exec_init_all to initialize the io and the memory_map_init respectively, wherein the io_mem_init is responsible for creating a memory area of the io, and the memory_map_init is used for creating two parts of memory address spaces of the address_space_memory and the system_memory;
step 13, calling pc_memory_init to initialize the memory needed in X86;
Step2, analyzing the use condition of the X86 and Shenwei architecture on the address range, wherein the memory range STARTs from sw_phys_addr_start (1 < < 59), and initializing the memory of the Shenwei AI processor, and the specific flow is as follows:
step 21, newly creating a memory area (MemoryRegion) type pointer ram;
Step 22, assigning a name airam-xx for each core group continuous segment storage control;
step 23, setting the address range of each continuous segment memory control;
step 24, calling a memory_region_allocation_system_memory function to allocate four continuous memory areas;
step 25, calling a function memory_region_add_display to add sub-regions to the four continuous memory regions newly created in step 24;
step 26, completing the allocation of the continuous memory;
step 27, designating a cross section name as ram_cross;
Step 28, setting an address range of cross section memory control;
Step 29, calling a memory_region_allocation_system_memory function to allocate a cross section memory area;
Step 210, calling a function memory_region_add_display to add a sub-region to the cross-section memory region created in step 29;
Step 211, completing the cross section memory allocation.
Due to the application of the technical scheme, compared with the prior art, the invention has the following advantages:
The memory initialization method supporting heterogeneous CPUs in the Qemu simulator is oriented to the Qemu simulator with coexistence of X86 and Shenwei AI, the memories of CPUs of different architectures are isolated in a memory range isolation mode, and initialization is carried out in different modes, so that the memory initialization of the heterogeneous CPUs is realized, and a foundation is laid for realizing full-system simulation of the X86+AI accelerator card in the same Qemu simulation environment.
Detailed Description
The invention provides a memory initialization method for supporting heterogeneous CPU in Qemu simulator, which simulates two large memories, namely X86 memory and Shenwei AI memory (including cross section);
in the simulator, the X86 memory range (memory_region) begins from 0 address by adopting Qemu default allocation mode, and the memory on the card must be separated from the X86 memory and cannot collide with various IO addresses;
in order to support the operation of the X86 and Shenwei AI processors in the simulator, the initialization of the corresponding memories of the two CPUs are as follows:
the memory initialization of the X86CPU starts from address 0 and is performed according to the Qemu default initialization mode:
1) In pc_init1, firstly analyzing the condition of the memory to be initialized according to parameters (host_type, ram_size);
2) The method comprises the steps that the function cpu_exec_init_all calls io_mem_init and memory_map_init to initialize io and memory respectively;
3) io_mem_init is mainly responsible for creating the memory area of io (MemoryRegion);
4) memory_map_init is mainly used for creating two parts of memory address spaces, namely address_space_memory and system_memory;
5) Finally, the pc_memory_init is called to initialize the memory needed in X86.
After the memory of the X86CPU is initialized according to a default path, the memory of the Shenwei AI processor needs to be initialized, firstly, the use condition of the X86 and Shenwei architecture on the address range is analyzed, and finally, the memory range of Shenwei AI STARTs from SW_PHYS_ADDR_START (1 < < 59), and the on-card memory initialization flow is as follows:
1) Newly creating a memory area (MemoryRegion) type pointer ram;
2) Assigning a name airam-xx to each core group continuation segment store;
3) Setting the address range of each continuous segment memory control;
4) Calling a memory_region_allocation_system_memory function to allocate four continuous memory areas;
5) Calling a function memory_region_add_display to add sub-regions for the newly built four continuous memory regions, namely, associating with memory control;
6) Completing the allocation of the continuous section memory;
7) Designating the name of the cross section as ram_cross;
8) Setting an address range of the cross section memory control;
9) Calling a memory_region_allocation_system_memory function to allocate a cross-section memory area;
10 Calling a function memory_region_add_display to add a sub-region for the newly built cross-section memory region;
11 Completing the cross-section memory allocation.
Four continuous sections and one cross section are respectively distributed in the flow, and a section of memory is independently distributed in the cross section for facilitating the processing.
In order to facilitate a better understanding of the present invention, the terms used herein will be briefly explained below:
Qemu Quick Emulator, a full system simulator with a source;
The isomerism mainly means that the CPU adopts different instruction sets and the architecture design is different.
AI ARTIFICIAL INTELLIGENCE, artificial intelligence.
Accelerator card is a specially designed processor product for accelerating algorithm execution, and in the AI field, the accelerator card is generally connected with a server by adopting a PCIe interface.
Management core and main core under many-core architecture, the core of CPU having many processing cores specially responsible for management function is called management core, also called main core.
The core specially responsible for the operation function in the numerous processing cores owned by the cpu is called an operation core, also called a slave core.
When the memory initialization method supporting the heterogeneous CPU in the Qemu simulator is adopted, the Qemu simulator facing the coexistence of X86 and Shenwei AI isolates the CPU memories of different architectures in a memory range isolation mode and initializes the memories by different modes, so that the memory initialization of the heterogeneous CPU is realized, and a foundation is laid for realizing the full-system simulation of the X86+AI acceleration card in the same Qemu simulation environment.
The above embodiments are provided to illustrate the technical concept and features of the present invention and are intended to enable those skilled in the art to understand the content of the present invention and implement the same, and are not intended to limit the scope of the present invention. All equivalent changes or modifications made in accordance with the spirit of the present invention should be construed to be included in the scope of the present invention.

Claims (1)

1. A memory initialization method for supporting heterogeneous CPU in Qemu simulator is characterized by comprising the following steps of:
Step 1, initializing the memory of the X86CPU from the address 0 according to a Qemu default initialization mode, wherein the specific flow is as follows:
Step 11, analyzing the condition of the memory to be initialized according to the parameters in the pc_init1;
Step 12, calling the function cpu_exec_init_all to initialize the io and the memory_map_init respectively, wherein the io_mem_init is responsible for creating a memory area of the io, and the memory_map_init is used for creating two parts of memory address spaces of the address_space_memory and the system_memory;
step 13, calling pc_memory_init to initialize the memory needed in X86;
Step 2, analyzing the use condition of the X86 and Shenwei architecture on the address range, and initializing the memory of the Shenwei AI processor from the sw_phys_addr_start, wherein the specific flow is as follows:
step 21, newly creating a memory area type pointer ram;
Step 22, assigning a name airam-xx for each core group continuous segment storage control;
step 23, setting the address range of each continuous segment memory control;
step 24, calling a memory_region_allocation_system_memory function to allocate four continuous memory areas;
step 25, calling a function memory_region_add_display to add sub-regions to the four continuous memory regions newly created in step 24;
step 26, completing the allocation of the continuous memory;
step 27, designating a cross section name as ram_cross;
Step 28, setting an address range of cross section memory control;
Step 29, calling a memory_region_allocation_system_memory function to allocate a cross section memory area;
Step 210, calling a function memory_region_add_display to add a sub-region to the cross-section memory region created in step 29;
Step 211, completing the cross section memory allocation.
CN202210196042.1A 2022-03-02 2022-03-02 Memory initialization method supporting heterogeneous CPUs in Qemu emulator Active CN114564436B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210196042.1A CN114564436B (en) 2022-03-02 2022-03-02 Memory initialization method supporting heterogeneous CPUs in Qemu emulator

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210196042.1A CN114564436B (en) 2022-03-02 2022-03-02 Memory initialization method supporting heterogeneous CPUs in Qemu emulator

Publications (2)

Publication Number Publication Date
CN114564436A CN114564436A (en) 2022-05-31
CN114564436B true CN114564436B (en) 2025-09-05

Family

ID=81715622

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210196042.1A Active CN114564436B (en) 2022-03-02 2022-03-02 Memory initialization method supporting heterogeneous CPUs in Qemu emulator

Country Status (1)

Country Link
CN (1) CN114564436B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108984427A (en) * 2018-07-12 2018-12-11 北京中科网威信息技术有限公司 The processing method and processing device of memory in a kind of equipment based on Shen prestige framework
CN109857522A (en) * 2019-03-01 2019-06-07 哈尔滨工业大学 A kind of virtualization layer fault filling method towards KVM

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3043269B1 (en) * 2010-09-24 2017-07-26 Intel Corporation Sharing virtual functions in a shared virtual memory between heterogeneous processors of a computing platform
CN108334399A (en) * 2018-01-10 2018-07-27 天津理工大学 A kind of multi-source heterogeneous cloud form state data capture method based on cloud probe
TWI686696B (en) * 2018-08-14 2020-03-01 財團法人工業技術研究院 Compute node, failure detection method thereof and cloud data processing system
CN112559119B (en) * 2019-09-25 2022-01-04 阿里巴巴集团控股有限公司 Virtual machine migration method and device, electronic equipment and storage medium
CN112363824B (en) * 2020-10-12 2022-07-22 北京大学 A memory virtualization method and system under the Shenwei architecture

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108984427A (en) * 2018-07-12 2018-12-11 北京中科网威信息技术有限公司 The processing method and processing device of memory in a kind of equipment based on Shen prestige framework
CN109857522A (en) * 2019-03-01 2019-06-07 哈尔滨工业大学 A kind of virtualization layer fault filling method towards KVM

Also Published As

Publication number Publication date
CN114564436A (en) 2022-05-31

Similar Documents

Publication Publication Date Title
US8621458B2 (en) Systems and methods for exposing processor topology for virtual machines
CN101751284B (en) I/O resource scheduling method for distributed virtual machine monitor
CN101968746B (en) A kind of implementation method of kernel virtual machine Organizational Structure Mode
US7260702B2 (en) Systems and methods for running a legacy 32-bit x86 virtual machine on a 64-bit x86 processor
CN101271401B (en) A server farm system with a single system image
US20050198632A1 (en) Method, apparatus and system for dynamically reassigning a physical device from one virtual machine to another
US20060184938A1 (en) Method, apparatus and system for dynamically reassigning memory from one virtual machine to another
US20100262722A1 (en) Dynamic Assignment of Graphics Processing Unit to a Virtual Machine
CN105930201B (en) A kind of functional simulator of restructural application specific processor core
JPS6057438A (en) Virtual computer system control device
CN102799465B (en) Virtual interrupt management method and device of distributed virtual system
JP2009110518A (en) Dynamic allocation of virtual machine device
CN103793260A (en) Platform virtualization system
US20190205259A1 (en) Exitless extended page table switching for nested hypervisors
CN101425046A (en) Method for implementing distributed I/O resource virtualizing technique
CN101876954A (en) A virtual machine control system and its working method
CN114138423A (en) Virtualization construction system and method based on domestic GPU graphics card
CN107491340A (en) Across the huge virtual machine realization method of physical machine
CN118132195A (en) CXL memory pooling system simulation method and device based on gem5
CN113626131B (en) Method, chip, board card and storage medium for realizing thermal migration
CN111353263A (en) Software and hardware design and verification platform system
CN114564436B (en) Memory initialization method supporting heterogeneous CPUs in Qemu emulator
US20070038996A1 (en) Remote I/O for virtualized systems
CN107766122B (en) Method and device for setting available memory space of host machine
CN103902767B (en) Multinuclear emulator based on QEMU and SystemC

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant