SlideShare a Scribd company logo
1 of 29
Download to read offline
Coherent Page Table updates
Julien Grall <julien.grall@arm.com>
Xen Developper Summit 2016
© ARM 2016
Scope
This talk is about handling page table updates on ARM.
Focussing on architectural guarantees.
The Architecture Reference Manual (”ARM ARM”) is authoritative.
2 © ARM 2016
Memory virtualisation
Hardware virtualisation of memory is achieved via two stages of page table.
3 © ARM 2016
Special considerations apply to
translation table updates ...
ARM ARM
4 © ARM 2016
Page table updates
Page tables update may require to use a break-before-make sequence.
It is a sequence required by the ARM ARM to update page table entries.
Required for certain update of the tables.
Ensures that a coherent view of the page tables is used by all observers.
5 © ARM 2016
Why do we care?
Page tables are shared between CPUs.
CPUs may still run during updates.
6 © ARM 2016
What could happen?
TLB caching could break coherency.
A processor may see erroneous data or corrupt data.
This has been seen on various micro-architectures.
A TLB conflict might be generated.
IMPLEMENTATION DEFINED
Either stage 1 or stage 2 abort
7 © ARM 2016
Page table entry
An entry can point to either a block mapping, translation table or a page descriptor.
Note that whilst ARM supports different granules (4KB, 16KB and 64KB), Xen only supports 4KB.
8 © ARM 2016
Page table entry - 2
Each block mapping and page descriptor contains information such as:
Access permission: read, write, execute never
Memory type: Device or Normal memory
Shareability: non-shareable, inner-shareable, outer-shareable
Cacheability
Access flag
Contiguous bit
Non-Global bit
9 © ARM 2016
TLB entries
TLB is a structure which caches results of the translation table walks.
Each TLB entry
contains data from the page descriptor.
is tagged by ASID and VMID.
10 © ARM 2016
Contiguous bit
It indicates whether the entry is one of a number of adjacent page table entries that point to a
contiguous output address range.
The number of adjacent entries depends on the page size.
For instance with 4KB, it will be 16 entries.
The TLB is allowed to cache a contiguous region in a single entry.
11 © ARM 2016
Address Space Identifier
The Address Space Identifier (ASID)
identifies pages associated to a single address space (e.g. a process).
applies for EL1 (kernel) and EL0 (userspace) translation regime.
provides a mechanism for changing process-specific table without requiring TLB invalidation.
is cached by the TLB entries.
12 © ARM 2016
Virtual Machine Identifier
The Virtual Machine Identifier (VMID)
identifies the current virtual machine (Non-Secure EL1 & EL0).
has its own independent ASID space.
is cached by the TLB entries so no TLB invalidation is required when switching between VM.
13 © ARM 2016
Non-Global (nG) bit
The non-Global bit applies only for Stage-1 page tables.
nG 0 means the region is available for all ASIDs.
nG 1 means the region is restricted to the current ASID.
Global mapping can be invalidated by using any ASID.
14 © ARM 2016
Break-Before-Make
15 © ARM 2016
When to use it?
Changing the size of the block
Replacing a block mapping with a translation table
Replacing a translation table with block mapping
Setting/Unsetting the contiguous bit
Changing the output address if one of the entry is writeable
Changing the memory type
Changing the cacheability attributes
Creating global entry that might overlaps non-global entries
16 © ARM 2016
When it is not necessary?
Changing the permission of an entry
Changing the access flag
17 © ARM 2016
TLBs are not allowed to hold any
translation that generates a Translation
Fault, an Address size Fault, or an
Access Flag fault.
18 © ARM 2016
Steps
It is a 4 steps approach:
1. Replace the old entry with an invalid entry
2. Invalidate the cached old entries with a broadcasting TLB invalidation instruction
3. Wait for the completion of the TLB instruction with a dsb followed by an isb
4. Write the new entry
19 © ARM 2016
How does it ensure coherency?
The new and old entries will not be simultaneously visible to the other vCPUs.
Break: Step 1 will remove the old entry
Step 2-3 will ensure that all the processors see the update
Make: Step 4 will make the new entry visible
Note that because the entry is invalid until step 4, the software may receive spurious fault.
Spurious faults can be handled by some locking/serialization.
20 © ARM 2016
Xen and Break-Before-Make
21 © ARM 2016
Where?
Xen handles page tables in various places for
the hypervisor page tables
the stage-2 to protect each guest
22 © ARM 2016
Hypervisor memory layout - AArch32
23 © ARM 2016
Xenheap vs Domheap
Xenheap pages are always mapped in the virtual address space
Usually small (i.e at most 1GB on AArch32 by default)
Mostly used to allocate Xen internal memory
Domheap pages are mapped on-demand
The code has to explicitely map/unmap the page when accessing it
On AArch32, the mapping is only done for the current CPU
Pages are often tied to a specific domain.
Used to allocate, for instance, guest RAM, stage-2 page table...
AArch64 has a large virtual address space (64 bits), so the two heaps are merged.
24 © ARM 2016
Hypervisor memory layout - AArch64
25 © ARM 2016
Hypervisor page table handling
This has not yet been looked into details. Page tables are modified at runtime for
Mapping a page from the domheap (only for AArch32).
per-CPU mapping
map domain page
Mapping contiguously page in the virtual memory.
common for all CPUs
create xen entries
26 © ARM 2016
Stage-2 page table handling
Stage-2 page tables are updated while the vCPUs are running
break-before-make needs to be considered when
inserting a new mapping (the entry could hold a valid mapping)
Shattering a superpage
break-before-make is not necessary for memaccess operations
memaccess is only changing the permission
however break-before-make is still required when shattering superpage
27 © ARM 2016
Upstreaming
An RFC has been posted on xen-devel
https://lists.xen.org/archives/html/xen-devel/2016-07/msg02952.html
Only handle stage-2 page tables
Comments, reviews, testing are more than welcomed
28 © ARM 2016
The trademarks featured in this presentation are registered and/or unregistered trademarks of ARM limited
(or its subsidiaries) in the EU and/or elsewhere. All rights reserved. All other marks featured may be
trademarks of their respective owners.
Copyright © 2016 ARM Limited
© ARM 2016

More Related Content

What's hot

Linux Kernel Image
Linux Kernel ImageLinux Kernel Image
Linux Kernel Image
艾鍗科技
 
Message Signaled Interrupts
Message Signaled InterruptsMessage Signaled Interrupts
Message Signaled Interrupts
Anshuman Biswal
 
Embedded_Linux_Booting
Embedded_Linux_BootingEmbedded_Linux_Booting
Embedded_Linux_Booting
Rashila Rr
 

What's hot (20)

Slab Allocator in Linux Kernel
Slab Allocator in Linux KernelSlab Allocator in Linux Kernel
Slab Allocator in Linux Kernel
 
Decompressed vmlinux: linux kernel initialization from page table configurati...
Decompressed vmlinux: linux kernel initialization from page table configurati...Decompressed vmlinux: linux kernel initialization from page table configurati...
Decompressed vmlinux: linux kernel initialization from page table configurati...
 
malloc & vmalloc in Linux
malloc & vmalloc in Linuxmalloc & vmalloc in Linux
malloc & vmalloc in Linux
 
Page cache in Linux kernel
Page cache in Linux kernelPage cache in Linux kernel
Page cache in Linux kernel
 
Linux Memory Management with CMA (Contiguous Memory Allocator)
Linux Memory Management with CMA (Contiguous Memory Allocator)Linux Memory Management with CMA (Contiguous Memory Allocator)
Linux Memory Management with CMA (Contiguous Memory Allocator)
 
ACPI Debugging from Linux Kernel
ACPI Debugging from Linux KernelACPI Debugging from Linux Kernel
ACPI Debugging from Linux Kernel
 
Introduction to armv8 aarch64
Introduction to armv8 aarch64Introduction to armv8 aarch64
Introduction to armv8 aarch64
 
qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...
qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...
qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...
 
Kernel Recipes 2015: Representing device-tree peripherals in ACPI
Kernel Recipes 2015: Representing device-tree peripherals in ACPIKernel Recipes 2015: Representing device-tree peripherals in ACPI
Kernel Recipes 2015: Representing device-tree peripherals in ACPI
 
Q4.11: ARM Architecture
Q4.11: ARM ArchitectureQ4.11: ARM Architecture
Q4.11: ARM Architecture
 
U-Boot Porting on New Hardware
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New Hardware
 
Virtualization Support in ARMv8+
Virtualization Support in ARMv8+Virtualization Support in ARMv8+
Virtualization Support in ARMv8+
 
Linux Kernel Image
Linux Kernel ImageLinux Kernel Image
Linux Kernel Image
 
Message Signaled Interrupts
Message Signaled InterruptsMessage Signaled Interrupts
Message Signaled Interrupts
 
Linux MMAP & Ioremap introduction
Linux MMAP & Ioremap introductionLinux MMAP & Ioremap introduction
Linux MMAP & Ioremap introduction
 
Embedded_Linux_Booting
Embedded_Linux_BootingEmbedded_Linux_Booting
Embedded_Linux_Booting
 
Qemu JIT Code Generator and System Emulation
Qemu JIT Code Generator and System EmulationQemu JIT Code Generator and System Emulation
Qemu JIT Code Generator and System Emulation
 
Qemu Introduction
Qemu IntroductionQemu Introduction
Qemu Introduction
 
New Ways to Find Latency in Linux Using Tracing
New Ways to Find Latency in Linux Using TracingNew Ways to Find Latency in Linux Using Tracing
New Ways to Find Latency in Linux Using Tracing
 
System Device Tree and Lopper: Concrete Examples - ELC NA 2022
System Device Tree and Lopper: Concrete Examples - ELC NA 2022System Device Tree and Lopper: Concrete Examples - ELC NA 2022
System Device Tree and Lopper: Concrete Examples - ELC NA 2022
 

Viewers also liked

LinuxCon Japan 13 : 10 years of Xen and Beyond
LinuxCon Japan 13 : 10 years of Xen and BeyondLinuxCon Japan 13 : 10 years of Xen and Beyond
LinuxCon Japan 13 : 10 years of Xen and Beyond
The Linux Foundation
 

Viewers also liked (20)

XPDS16: Porting Xen on ARM to a new SOC - Julien Grall, ARM
XPDS16: Porting Xen on ARM to a new SOC - Julien Grall, ARMXPDS16: Porting Xen on ARM to a new SOC - Julien Grall, ARM
XPDS16: Porting Xen on ARM to a new SOC - Julien Grall, ARM
 
XPDS16: Patch review for non-maintainers - George Dunlap, Citrix Systems R&D...
 XPDS16: Patch review for non-maintainers - George Dunlap, Citrix Systems R&D... XPDS16: Patch review for non-maintainers - George Dunlap, Citrix Systems R&D...
XPDS16: Patch review for non-maintainers - George Dunlap, Citrix Systems R&D...
 
Fosdem 17 - Towards a HVM-like Dom0 for Xen
Fosdem 17 - Towards a HVM-like Dom0 for XenFosdem 17 - Towards a HVM-like Dom0 for Xen
Fosdem 17 - Towards a HVM-like Dom0 for Xen
 
XPDS16: Scope and Performance of Credit-2 Scheduler. - Anshul Makkar, Ctirix...
XPDS16:  Scope and Performance of Credit-2 Scheduler. - Anshul Makkar, Ctirix...XPDS16:  Scope and Performance of Credit-2 Scheduler. - Anshul Makkar, Ctirix...
XPDS16: Scope and Performance of Credit-2 Scheduler. - Anshul Makkar, Ctirix...
 
XPDS16: CPUID handling for guests - Andrew Cooper, Citrix
XPDS16:  CPUID handling for guests - Andrew Cooper, CitrixXPDS16:  CPUID handling for guests - Andrew Cooper, Citrix
XPDS16: CPUID handling for guests - Andrew Cooper, Citrix
 
XPDS16: High-Performance Virtualization for HPC Cloud on Xen - Jun Nakajima &...
XPDS16: High-Performance Virtualization for HPC Cloud on Xen - Jun Nakajima &...XPDS16: High-Performance Virtualization for HPC Cloud on Xen - Jun Nakajima &...
XPDS16: High-Performance Virtualization for HPC Cloud on Xen - Jun Nakajima &...
 
XPDS16: Hypervisor-based Security: Vicarious Learning via Introspektioneerin...
XPDS16:  Hypervisor-based Security: Vicarious Learning via Introspektioneerin...XPDS16:  Hypervisor-based Security: Vicarious Learning via Introspektioneerin...
XPDS16: Hypervisor-based Security: Vicarious Learning via Introspektioneerin...
 
XPDS16: Making Migration More Secure - John Shackleton, Adventium Labs
XPDS16: Making Migration More Secure - John Shackleton, Adventium LabsXPDS16: Making Migration More Secure - John Shackleton, Adventium Labs
XPDS16: Making Migration More Secure - John Shackleton, Adventium Labs
 
XPDS16: Xen Orchestra: building a Cloud on top of Xen - Olivier Lambert & Jul...
XPDS16: Xen Orchestra: building a Cloud on top of Xen - Olivier Lambert & Jul...XPDS16: Xen Orchestra: building a Cloud on top of Xen - Olivier Lambert & Jul...
XPDS16: Xen Orchestra: building a Cloud on top of Xen - Olivier Lambert & Jul...
 
XPDS16: Live Migration of vGPU - Xiao Zheng, Intel Asia-Pacific Research & De...
XPDS16: Live Migration of vGPU - Xiao Zheng, Intel Asia-Pacific Research & De...XPDS16: Live Migration of vGPU - Xiao Zheng, Intel Asia-Pacific Research & De...
XPDS16: Live Migration of vGPU - Xiao Zheng, Intel Asia-Pacific Research & De...
 
XPDS16: libvirt and Tools: What's New and What's Next - James Fehlig, SUSE
XPDS16: libvirt and Tools: What's New and What's Next - James Fehlig, SUSEXPDS16: libvirt and Tools: What's New and What's Next - James Fehlig, SUSE
XPDS16: libvirt and Tools: What's New and What's Next - James Fehlig, SUSE
 
Fosdem17 - Mixed License FOSS Projects
Fosdem17 - Mixed License FOSS ProjectsFosdem17 - Mixed License FOSS Projects
Fosdem17 - Mixed License FOSS Projects
 
XPDS16: Xen Scalability Analysis - Weidong Han, Zhichao Huang & Wei Yang, Huawei
XPDS16: Xen Scalability Analysis - Weidong Han, Zhichao Huang & Wei Yang, HuaweiXPDS16: Xen Scalability Analysis - Weidong Han, Zhichao Huang & Wei Yang, Huawei
XPDS16: Xen Scalability Analysis - Weidong Han, Zhichao Huang & Wei Yang, Huawei
 
XPDS16: Xen Development Update
XPDS16: Xen Development UpdateXPDS16: Xen Development Update
XPDS16: Xen Development Update
 
XPDS16: Live scalability for vGPU using gScale - Xiao Zheng, Intel
XPDS16: Live scalability for vGPU using gScale - Xiao Zheng, IntelXPDS16: Live scalability for vGPU using gScale - Xiao Zheng, Intel
XPDS16: Live scalability for vGPU using gScale - Xiao Zheng, Intel
 
LinuxCon Japan 13 : 10 years of Xen and Beyond
LinuxCon Japan 13 : 10 years of Xen and BeyondLinuxCon Japan 13 : 10 years of Xen and Beyond
LinuxCon Japan 13 : 10 years of Xen and Beyond
 
Xen summit amd_2010v3
Xen summit amd_2010v3Xen summit amd_2010v3
Xen summit amd_2010v3
 
XPDS13: On Paravirualizing TCP - Congestion Control on Xen VMs - Luwei Cheng,...
XPDS13: On Paravirualizing TCP - Congestion Control on Xen VMs - Luwei Cheng,...XPDS13: On Paravirualizing TCP - Congestion Control on Xen VMs - Luwei Cheng,...
XPDS13: On Paravirualizing TCP - Congestion Control on Xen VMs - Luwei Cheng,...
 
XPDS16: AMD's virtualization memory encryption technology - Brijesh Singh, A...
XPDS16:  AMD's virtualization memory encryption technology - Brijesh Singh, A...XPDS16:  AMD's virtualization memory encryption technology - Brijesh Singh, A...
XPDS16: AMD's virtualization memory encryption technology - Brijesh Singh, A...
 
Cobbler Summit - Automated Xen VM Deployment
Cobbler Summit - Automated Xen VM DeploymentCobbler Summit - Automated Xen VM Deployment
Cobbler Summit - Automated Xen VM Deployment
 

Similar to XPDS16: Keeping coherency on ARM - Julien Grall, ARM

directCell - Cell/B.E. tightly coupled via PCI Express
directCell - Cell/B.E. tightly coupled via PCI ExpressdirectCell - Cell/B.E. tightly coupled via PCI Express
directCell - Cell/B.E. tightly coupled via PCI Express
Heiko Joerg Schick
 
MySQL 5.5&5.6 new features summary
MySQL 5.5&5.6 new features summaryMySQL 5.5&5.6 new features summary
MySQL 5.5&5.6 new features summary
Louis liu
 
8086 MICROPROCESSOR
8086 MICROPROCESSOR8086 MICROPROCESSOR
8086 MICROPROCESSOR
Alxus Shuvo
 
Vstoragetamsupportday1 110311121032-phpapp02
Vstoragetamsupportday1 110311121032-phpapp02Vstoragetamsupportday1 110311121032-phpapp02
Vstoragetamsupportday1 110311121032-phpapp02
Suresh Kumar
 

Similar to XPDS16: Keeping coherency on ARM - Julien Grall, ARM (20)

XPDDS19: Keeping Coherency on Arm: Reborn - Julien Grall, Arm ltd
XPDDS19: Keeping Coherency on Arm: Reborn - Julien Grall, Arm ltdXPDDS19: Keeping Coherency on Arm: Reborn - Julien Grall, Arm ltd
XPDDS19: Keeping Coherency on Arm: Reborn - Julien Grall, Arm ltd
 
3
33
3
 
DAT Education
DAT EducationDAT Education
DAT Education
 
Large and Giant Pages
Large and Giant PagesLarge and Giant Pages
Large and Giant Pages
 
C programming session10
C programming  session10C programming  session10
C programming session10
 
Embedded C programming session10
Embedded C programming  session10Embedded C programming  session10
Embedded C programming session10
 
EC8791 ARM Processor and Peripherals.pptx
EC8791 ARM Processor and Peripherals.pptxEC8791 ARM Processor and Peripherals.pptx
EC8791 ARM Processor and Peripherals.pptx
 
Emulex 16Gb FC Single-port and Dual-port HBAs for IBM System x
Emulex 16Gb FC Single-port and Dual-port HBAs for  IBM System xEmulex 16Gb FC Single-port and Dual-port HBAs for  IBM System x
Emulex 16Gb FC Single-port and Dual-port HBAs for IBM System x
 
Design of AMBA AHB interface around OpenRISC 1200 processor and comparing the...
Design of AMBA AHB interface around OpenRISC 1200 processor and comparing the...Design of AMBA AHB interface around OpenRISC 1200 processor and comparing the...
Design of AMBA AHB interface around OpenRISC 1200 processor and comparing the...
 
directCell - Cell/B.E. tightly coupled via PCI Express
directCell - Cell/B.E. tightly coupled via PCI ExpressdirectCell - Cell/B.E. tightly coupled via PCI Express
directCell - Cell/B.E. tightly coupled via PCI Express
 
Arm11
Arm11Arm11
Arm11
 
Org-&-Arch-2.ppt
Org-&-Arch-2.pptOrg-&-Arch-2.ppt
Org-&-Arch-2.ppt
 
S09mid2sol
S09mid2solS09mid2sol
S09mid2sol
 
vSphere vStorage: Troubleshooting Performance
vSphere vStorage: Troubleshooting PerformancevSphere vStorage: Troubleshooting Performance
vSphere vStorage: Troubleshooting Performance
 
Online Architecture Assignment Help
Online Architecture Assignment HelpOnline Architecture Assignment Help
Online Architecture Assignment Help
 
MySQL 5.5&5.6 new features summary
MySQL 5.5&5.6 new features summaryMySQL 5.5&5.6 new features summary
MySQL 5.5&5.6 new features summary
 
8086 MICROPROCESSOR
8086 MICROPROCESSOR8086 MICROPROCESSOR
8086 MICROPROCESSOR
 
Technical sales education enterprise- svc and ibm flash best practices update
Technical sales education   enterprise- svc and ibm flash best practices updateTechnical sales education   enterprise- svc and ibm flash best practices update
Technical sales education enterprise- svc and ibm flash best practices update
 
LECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.ppt
LECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.pptLECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.ppt
LECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.ppt
 
Vstoragetamsupportday1 110311121032-phpapp02
Vstoragetamsupportday1 110311121032-phpapp02Vstoragetamsupportday1 110311121032-phpapp02
Vstoragetamsupportday1 110311121032-phpapp02
 

More from The Linux Foundation

More from The Linux Foundation (20)

ELC2019: Static Partitioning Made Simple
ELC2019: Static Partitioning Made SimpleELC2019: Static Partitioning Made Simple
ELC2019: Static Partitioning Made Simple
 
XPDDS19: How TrenchBoot is Enabling Measured Launch for Open-Source Platform ...
XPDDS19: How TrenchBoot is Enabling Measured Launch for Open-Source Platform ...XPDDS19: How TrenchBoot is Enabling Measured Launch for Open-Source Platform ...
XPDDS19: How TrenchBoot is Enabling Measured Launch for Open-Source Platform ...
 
XPDDS19 Keynote: Xen in Automotive - Artem Mygaiev, Director, Technology Solu...
XPDDS19 Keynote: Xen in Automotive - Artem Mygaiev, Director, Technology Solu...XPDDS19 Keynote: Xen in Automotive - Artem Mygaiev, Director, Technology Solu...
XPDDS19 Keynote: Xen in Automotive - Artem Mygaiev, Director, Technology Solu...
 
XPDDS19 Keynote: Xen Project Weather Report 2019 - Lars Kurth, Director of Op...
XPDDS19 Keynote: Xen Project Weather Report 2019 - Lars Kurth, Director of Op...XPDDS19 Keynote: Xen Project Weather Report 2019 - Lars Kurth, Director of Op...
XPDDS19 Keynote: Xen Project Weather Report 2019 - Lars Kurth, Director of Op...
 
XPDDS19 Keynote: Unikraft Weather Report
XPDDS19 Keynote:  Unikraft Weather ReportXPDDS19 Keynote:  Unikraft Weather Report
XPDDS19 Keynote: Unikraft Weather Report
 
XPDDS19 Keynote: Secret-free Hypervisor: Now and Future - Wei Liu, Software E...
XPDDS19 Keynote: Secret-free Hypervisor: Now and Future - Wei Liu, Software E...XPDDS19 Keynote: Secret-free Hypervisor: Now and Future - Wei Liu, Software E...
XPDDS19 Keynote: Secret-free Hypervisor: Now and Future - Wei Liu, Software E...
 
XPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, Xilinx
XPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, XilinxXPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, Xilinx
XPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, Xilinx
 
XPDDS19 Keynote: Patch Review for Non-maintainers - George Dunlap, Citrix Sys...
XPDDS19 Keynote: Patch Review for Non-maintainers - George Dunlap, Citrix Sys...XPDDS19 Keynote: Patch Review for Non-maintainers - George Dunlap, Citrix Sys...
XPDDS19 Keynote: Patch Review for Non-maintainers - George Dunlap, Citrix Sys...
 
XPDDS19: Memories of a VM Funk - Mihai Donțu, Bitdefender
XPDDS19: Memories of a VM Funk - Mihai Donțu, BitdefenderXPDDS19: Memories of a VM Funk - Mihai Donțu, Bitdefender
XPDDS19: Memories of a VM Funk - Mihai Donțu, Bitdefender
 
OSSJP/ALS19: The Road to Safety Certification: Overcoming Community Challeng...
OSSJP/ALS19:  The Road to Safety Certification: Overcoming Community Challeng...OSSJP/ALS19:  The Road to Safety Certification: Overcoming Community Challeng...
OSSJP/ALS19: The Road to Safety Certification: Overcoming Community Challeng...
 
OSSJP/ALS19: The Road to Safety Certification: How the Xen Project is Making...
 OSSJP/ALS19: The Road to Safety Certification: How the Xen Project is Making... OSSJP/ALS19: The Road to Safety Certification: How the Xen Project is Making...
OSSJP/ALS19: The Road to Safety Certification: How the Xen Project is Making...
 
XPDDS19: Speculative Sidechannels and Mitigations - Andrew Cooper, Citrix
XPDDS19: Speculative Sidechannels and Mitigations - Andrew Cooper, CitrixXPDDS19: Speculative Sidechannels and Mitigations - Andrew Cooper, Citrix
XPDDS19: Speculative Sidechannels and Mitigations - Andrew Cooper, Citrix
 
XPDDS19: QEMU PV Backend 'qdevification'... What Does it Mean? - Paul Durrant...
XPDDS19: QEMU PV Backend 'qdevification'... What Does it Mean? - Paul Durrant...XPDDS19: QEMU PV Backend 'qdevification'... What Does it Mean? - Paul Durrant...
XPDDS19: QEMU PV Backend 'qdevification'... What Does it Mean? - Paul Durrant...
 
XPDDS19: Status of PCI Emulation in Xen - Roger Pau Monné, Citrix Systems R&D
XPDDS19: Status of PCI Emulation in Xen - Roger Pau Monné, Citrix Systems R&DXPDDS19: Status of PCI Emulation in Xen - Roger Pau Monné, Citrix Systems R&D
XPDDS19: Status of PCI Emulation in Xen - Roger Pau Monné, Citrix Systems R&D
 
XPDDS19: [ARM] OP-TEE Mediator in Xen - Volodymyr Babchuk, EPAM Systems
XPDDS19: [ARM] OP-TEE Mediator in Xen - Volodymyr Babchuk, EPAM SystemsXPDDS19: [ARM] OP-TEE Mediator in Xen - Volodymyr Babchuk, EPAM Systems
XPDDS19: [ARM] OP-TEE Mediator in Xen - Volodymyr Babchuk, EPAM Systems
 
XPDDS19: Bringing Xen to the Masses: The Story of Building a Community-driven...
XPDDS19: Bringing Xen to the Masses: The Story of Building a Community-driven...XPDDS19: Bringing Xen to the Masses: The Story of Building a Community-driven...
XPDDS19: Bringing Xen to the Masses: The Story of Building a Community-driven...
 
XPDDS19: Will Robots Automate Your Job Away? Streamlining Xen Project Contrib...
XPDDS19: Will Robots Automate Your Job Away? Streamlining Xen Project Contrib...XPDDS19: Will Robots Automate Your Job Away? Streamlining Xen Project Contrib...
XPDDS19: Will Robots Automate Your Job Away? Streamlining Xen Project Contrib...
 
XPDDS19: Client Virtualization Toolstack in Go - Nick Rosbrook & Brendan Kerr...
XPDDS19: Client Virtualization Toolstack in Go - Nick Rosbrook & Brendan Kerr...XPDDS19: Client Virtualization Toolstack in Go - Nick Rosbrook & Brendan Kerr...
XPDDS19: Client Virtualization Toolstack in Go - Nick Rosbrook & Brendan Kerr...
 
XPDDS19: Core Scheduling in Xen - Jürgen Groß, SUSE
XPDDS19: Core Scheduling in Xen - Jürgen Groß, SUSEXPDDS19: Core Scheduling in Xen - Jürgen Groß, SUSE
XPDDS19: Core Scheduling in Xen - Jürgen Groß, SUSE
 
XPDDS19: Implementing AMD MxGPU - Jonathan Farrell, Assured Information Security
XPDDS19: Implementing AMD MxGPU - Jonathan Farrell, Assured Information SecurityXPDDS19: Implementing AMD MxGPU - Jonathan Farrell, Assured Information Security
XPDDS19: Implementing AMD MxGPU - Jonathan Farrell, Assured Information Security
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 

XPDS16: Keeping coherency on ARM - Julien Grall, ARM

  • 1. Coherent Page Table updates Julien Grall <julien.grall@arm.com> Xen Developper Summit 2016 © ARM 2016
  • 2. Scope This talk is about handling page table updates on ARM. Focussing on architectural guarantees. The Architecture Reference Manual (”ARM ARM”) is authoritative. 2 © ARM 2016
  • 3. Memory virtualisation Hardware virtualisation of memory is achieved via two stages of page table. 3 © ARM 2016
  • 4. Special considerations apply to translation table updates ... ARM ARM 4 © ARM 2016
  • 5. Page table updates Page tables update may require to use a break-before-make sequence. It is a sequence required by the ARM ARM to update page table entries. Required for certain update of the tables. Ensures that a coherent view of the page tables is used by all observers. 5 © ARM 2016
  • 6. Why do we care? Page tables are shared between CPUs. CPUs may still run during updates. 6 © ARM 2016
  • 7. What could happen? TLB caching could break coherency. A processor may see erroneous data or corrupt data. This has been seen on various micro-architectures. A TLB conflict might be generated. IMPLEMENTATION DEFINED Either stage 1 or stage 2 abort 7 © ARM 2016
  • 8. Page table entry An entry can point to either a block mapping, translation table or a page descriptor. Note that whilst ARM supports different granules (4KB, 16KB and 64KB), Xen only supports 4KB. 8 © ARM 2016
  • 9. Page table entry - 2 Each block mapping and page descriptor contains information such as: Access permission: read, write, execute never Memory type: Device or Normal memory Shareability: non-shareable, inner-shareable, outer-shareable Cacheability Access flag Contiguous bit Non-Global bit 9 © ARM 2016
  • 10. TLB entries TLB is a structure which caches results of the translation table walks. Each TLB entry contains data from the page descriptor. is tagged by ASID and VMID. 10 © ARM 2016
  • 11. Contiguous bit It indicates whether the entry is one of a number of adjacent page table entries that point to a contiguous output address range. The number of adjacent entries depends on the page size. For instance with 4KB, it will be 16 entries. The TLB is allowed to cache a contiguous region in a single entry. 11 © ARM 2016
  • 12. Address Space Identifier The Address Space Identifier (ASID) identifies pages associated to a single address space (e.g. a process). applies for EL1 (kernel) and EL0 (userspace) translation regime. provides a mechanism for changing process-specific table without requiring TLB invalidation. is cached by the TLB entries. 12 © ARM 2016
  • 13. Virtual Machine Identifier The Virtual Machine Identifier (VMID) identifies the current virtual machine (Non-Secure EL1 & EL0). has its own independent ASID space. is cached by the TLB entries so no TLB invalidation is required when switching between VM. 13 © ARM 2016
  • 14. Non-Global (nG) bit The non-Global bit applies only for Stage-1 page tables. nG 0 means the region is available for all ASIDs. nG 1 means the region is restricted to the current ASID. Global mapping can be invalidated by using any ASID. 14 © ARM 2016
  • 16. When to use it? Changing the size of the block Replacing a block mapping with a translation table Replacing a translation table with block mapping Setting/Unsetting the contiguous bit Changing the output address if one of the entry is writeable Changing the memory type Changing the cacheability attributes Creating global entry that might overlaps non-global entries 16 © ARM 2016
  • 17. When it is not necessary? Changing the permission of an entry Changing the access flag 17 © ARM 2016
  • 18. TLBs are not allowed to hold any translation that generates a Translation Fault, an Address size Fault, or an Access Flag fault. 18 © ARM 2016
  • 19. Steps It is a 4 steps approach: 1. Replace the old entry with an invalid entry 2. Invalidate the cached old entries with a broadcasting TLB invalidation instruction 3. Wait for the completion of the TLB instruction with a dsb followed by an isb 4. Write the new entry 19 © ARM 2016
  • 20. How does it ensure coherency? The new and old entries will not be simultaneously visible to the other vCPUs. Break: Step 1 will remove the old entry Step 2-3 will ensure that all the processors see the update Make: Step 4 will make the new entry visible Note that because the entry is invalid until step 4, the software may receive spurious fault. Spurious faults can be handled by some locking/serialization. 20 © ARM 2016
  • 22. Where? Xen handles page tables in various places for the hypervisor page tables the stage-2 to protect each guest 22 © ARM 2016
  • 23. Hypervisor memory layout - AArch32 23 © ARM 2016
  • 24. Xenheap vs Domheap Xenheap pages are always mapped in the virtual address space Usually small (i.e at most 1GB on AArch32 by default) Mostly used to allocate Xen internal memory Domheap pages are mapped on-demand The code has to explicitely map/unmap the page when accessing it On AArch32, the mapping is only done for the current CPU Pages are often tied to a specific domain. Used to allocate, for instance, guest RAM, stage-2 page table... AArch64 has a large virtual address space (64 bits), so the two heaps are merged. 24 © ARM 2016
  • 25. Hypervisor memory layout - AArch64 25 © ARM 2016
  • 26. Hypervisor page table handling This has not yet been looked into details. Page tables are modified at runtime for Mapping a page from the domheap (only for AArch32). per-CPU mapping map domain page Mapping contiguously page in the virtual memory. common for all CPUs create xen entries 26 © ARM 2016
  • 27. Stage-2 page table handling Stage-2 page tables are updated while the vCPUs are running break-before-make needs to be considered when inserting a new mapping (the entry could hold a valid mapping) Shattering a superpage break-before-make is not necessary for memaccess operations memaccess is only changing the permission however break-before-make is still required when shattering superpage 27 © ARM 2016
  • 28. Upstreaming An RFC has been posted on xen-devel https://lists.xen.org/archives/html/xen-devel/2016-07/msg02952.html Only handle stage-2 page tables Comments, reviews, testing are more than welcomed 28 © ARM 2016
  • 29. The trademarks featured in this presentation are registered and/or unregistered trademarks of ARM limited (or its subsidiaries) in the EU and/or elsewhere. All rights reserved. All other marks featured may be trademarks of their respective owners. Copyright © 2016 ARM Limited © ARM 2016