Fast context switching technology for ARM Processors

Source: Internet
Author: User

5.3.1 fcse Overview

Roman; "> fcse (fast context switch extension, fast context switch) is located between the CPU and MMU. If the two processes use the same virtual address space, the two processes use the same virtual address space. The quick context switching mechanism changes the virtual addresses of each process. In this way, all the other parts of the system see the virtual addresses changed by the quick context switching mechanism. The quick context switching mechanism converts the virtual space of each process into different virtual space, so that you do not need to remap the virtual address to the physical address during inter-process switching.

Fcse: by modifying the virtual addresses of different processes in the system, it avoids the ing of virtual addresses to physical addresses during inter-process switching, this reduces the huge overhead of rebuilding MMU, making cache and TLB invalid, rebuilding cache and TLB content, and thus improves the system performance.

5.3.2 fcse Principle

In the arm system, 4 GB of virtual space is divided into 128 process space blocks. The size of each process space block is 32 MB. Each process space block can contain a process. The process can use the virtual address space 0x00000000 ~ 0x01ffffff, the address range is the virtual space of the process seen by the CPU. The number of the system's 128 process space blocks is 0 ~ 127, numberedIThe virtual address space actually used by the process in the process space block isI* 0x02000000I* 0x02000000 + 0x01ffffff. This address space is the virtual address space occupied by the process seen in other parts of the system except the CPU.

The quick context switching mechanism changes each virtual address sent by the CPU according to the preceding rules and then sends it to other parts of the system. The conversion process is 5-1.

Figure 5-1 fcse schematic diagram

Figure 5-1 The algorithm for changing the addresses from VA to MVA is as follows:

If (va [31: 25] = 0b0000000) then

MVA = va | (PID <25)

Else

MVA = va

If va [31: 25] is not equal to 0, the address VA is the virtual address used by the process to access data and commands in other processes. In this case, the pid of the accessed process cannot be 0. On the contrary, if va [31: 25] is equal to 0, it indicates that the access address VA is in the address space of the process itself. Therefore, you need to switch the process context to convert Va to MVA, the PID in the above formula is the PID of the process.

5.3.3 fcse Programming Interface

Roman; "> the ARM processor uses the C13 registers of the CP15 coprocessor to implement the fcse function. For details about the C13 registers, see section 4.1.2" CP15 registers ". To perform process switching, first clear the write cache, and then write the page table address of the new process to the C2 register of CP15, then, write the PID of the new process to the maximum 7 bits of the C13 register of CP15. If the processor does not support the fcse function, the cache and tlbs are invalid, and then the system needs to re-build the cache and tlbs. Next we will compare the differences between the XScale processor and the memory switching operation functions in the armv6 processor process switching:

Roman; "> the memory switching operation function in XScale processor process switching is as follows:

. Align 5

Entry (cpu_xscale_switch_mm)

Clean_d_cache R1, R2; the data cache between the address indicated by R1 and the address indicated by R2 is invalid.

MCR P15, 0, IP, C7, C5, 0; make the cache of all the system commands invalid

MCR P15, 0, IP, C7, C10, 4; clear write buffer

MCR P15, 0, R0, C2, C0, 0; load the new page table address

MCR P15, 0, IP, C8, C7, 0; make all system data and command tlbs cache invalid

Cpwait_ret LR, IP; Return

Roman; "> the memory switching operation function in armv6 processor process switching is as follows:

Entry (cpu_v6_switch_mm)

MoV R2, #0

LDR R1, [R1, # mm_context_id]; obtain the PID of the new process. The PID is actually the ID of the mm_context_t member structure context in the struct mm_struct structure of the new process.

MCR P15, 0, R2, C7, C10, 4; clear write buffer

MCR P15, 0, R0, C2, C0, 0; load the new page table address

MCR P15, 0, R1, C13, C0, 1; set the context PID

MoV PC, LR; Return

In the ARM processor, only the armv6 and later processors support the fcse function.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.