Evaluation of X32 ABI for Virtualization and Cloud
Upcoming SlideShare
Loading in...5
×
 

Evaluation of X32 ABI for Virtualization and Cloud

on

  • 1,715 views

As the Linux 3.4 has x32 ABI support, we think it's the right time for us to evaluate x32 ABI for virtualization and the cloud. The x32 ABI provides a model in x86-64 psABI with 32-bit address space, ...

As the Linux 3.4 has x32 ABI support, we think it's the right time for us to evaluate x32 ABI for virtualization and the cloud. The x32 ABI provides a model in x86-64 psABI with 32-bit address space, with 16 64-bit integer registers (8 additional integer registers), 8 additional SSE registers, etc., compared to the conventional x86 32-bit ABI. We look at performance improvements and memory saving gained by x32 applications, and discuss how x32 can be helpful for Xen and the clouds.

Statistics

Views

Total Views
1,715
Views on SlideShare
1,663
Embed Views
52

Actions

Likes
0
Downloads
6
Comments
0

3 Embeds 52

http://www.xen.org 28
http://xen.org 16
http://www-archive.xenproject.org 8

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Evaluation of X32 ABI for Virtualization and Cloud Evaluation of X32 ABI for Virtualization and Cloud Presentation Transcript

  • Evaluation of X32 ABI for Virtualization and Cloud Jun Nakajima Intel Corporation 1Wednesday, August 29, 12 1
  • Agenda • What is X32 ABI? • Benefits for Virtualization & Cloud • Evaluation of X32 • Summary 2Wednesday, August 29, 12 2
  • x32 ABI Basics • x86-64 ABI but with 32-bit longs and pointers • 64-bit arithmetic • Fully utilize modern x86 • 8 additional integer registers (16 total) • 8 additional SSE registers • SSE for FP math • 64-bit kernel is required - Linux kernel 3.4 has support for x32 Same memory footprint as x86 with advantages of x86-64. No hardware changes are required. 3Wednesday, August 29, 12 3
  • ABI Comparison i386 x86-64 x32Integer registers 6 15 15FP registers 8 16 16Pointers 4 bytes 8 bytes 4 bytes64-bit arithmetic No Yes YesFloating point x87 SSE SSECalling convention Memory Registers RegistersPIC prologue 2-3 insn None None 4Wednesday, August 29, 12 4
  • The x32 Performance Advantage • In the order of Expected Contribution: - Efficient Position Independent Code - Efficient Function Parameter Passing - Efficient 64-bit Arithmetic - Efficient Floating Point Operations X32 is expected to give a 10-20% performance boost for C, C++ 5Wednesday, August 29, 12 5
  • Efficient Position Independent Code extern int x, y, z; void foo () { z = x * y; } i386 psABI x32 psABI call __i686.get_pc_thunk.cx movl x@GOTPCREL(%rip), %edx addl $_GLOBAL_OFFSET_TABLE_, %ecx movl y@GOTPCREL(%rip), %eax movl!y@GOT(%ecx), %eax movl (%rax), %rax movl!x@GOT(%ecx), %edx imull (%rdx), %rax movl!(%eax), %eax movl z@GOTPCREL(%rip), %edx imull! (%edx), %eax movl %rax, (%rdx) movl!z@GOT(%ecx), %edx ret movl!%eax, (%edx) ret __i686.get_pc_thunk.cx: movl!(%esp), %ecx ret X32 PIC code is shorter and faster 6Wednesday, August 29, 12 6
  • Efficient Function Parameter Passing void bar (int x, int y, int z); void foo (int x, int y, int z) { bar (y, z, x); } i386 psABI x32 psABI subl $28, %esp subl $8, %esp movl 32(%esp), %eax movl %edi, %eax movl %eax, 8(%esp) movl %esi, %edi movl 40(%esp), %eax movl %edx, %esi movl %eax, 4(%esp) movl %eax, %edx movl 36(%esp), %eax call bar movl %eax, (%esp) addl $8, %esp call bar ret addl $28, %esp ret X32 passes parameters in registers 7Wednesday, August 29, 12 7
  • Efficient 64-bit Integer Arithmetic extern long long x, y, z; void foo () { z = x * y; } i386 psABI x32 psABI ! movl! x+4, %edx ! movq! x(%rip), %rax ! movl! y+4, %eax ! imulq! y(%rip), %rax ! imull! y, %edx ! movq! %rax, z(%rip) ! imull! x, %eax ! ret ! leal! (%edx,%eax), %ecx ! movl! %eax y, ! mull! x ! addl! %ecx, %edx ! movl! %eax, z ! movl! %edx, z+4 ! ret X32 provides very efficient 64-bit integer support (3 instructions vs. 10 instructions). 8Wednesday, August 29, 12 8
  • Efficient Floating Point Operation extern double bar; float foo () { return bar * bar; } i386 psABI x32 psABI subl $12, %esp movsd bar(%rip), %xmm0 movsd bar, %xmm0 mulsd %xmm0, %xmm0 mulsd %xmm0, %xmm0 ret movsd %xmm0, (%esp) fldl (%esp) addl $12, %esp ret X32 doesn’t use X87 to return FP values 9Wednesday, August 29, 12 9
  • Agenda • What is X32 ABI? • Benefits for Virtualization & Cloud • Evaluation of X32 • Summary 10Wednesday, August 29, 12 10
  • Characteristics of Virtualization • TLB misses in guests can be more expensive - Need to walk through both guest page tables and HAP (Hardware Assisted Paging) page tables • Utilization of cache can be higher because of additional components - Hypervisor, driver domains - Other VMs 11Wednesday, August 29, 12 11
  • Advantage of x32 in Virtualization • Over x86 - Generic performance advantages of x32 - Better cache utilization • fewer instructions, passing arguments in registers • Over x86-64 - Efficient guest page table structures • Only 4GB virtual address space – Single PML4 and 4 PDP directory entries in a row - Better cache utilization • 4-byte pointers 12Wednesday, August 29, 12 12
  • Advantage of x32 in Cloud • Performance/memory is crucial in Cloud - 32-bit address space is still sufficient for many apps - Use memory for data, not for 8-byte pointers • Use unified (64-bit) kernel - Use x32 ABI for 32-bit apps - Traditional x86 and x86-64 apps can run as well Add x32 support to the list of OS images for Cloud 13Wednesday, August 29, 12 13
  • How should we use x32 in Xen? • x32 apps in HVM Linux - Xen doesn’t need to know about x32 • x32 apps in PV Linux - Performance with x32 can regress because of 64-bit PV issues - Should be run in HVM container • x32 PV Linux - 32-bit PV Linux with more registers used - Practically insignificant Run x32 apps in HVM 14Wednesday, August 29, 12 14
  • Agenda • What is X32 ABI? • Benefits for Virtualization & Cloud • Evaluation of X32 • Summary 15Wednesday, August 29, 12 15
  • Configurations • VM - HVM (Linux) with 1GB/4GM memory - VCPUs (1, 2) - i386, x32, x86-64 apps • Simple Web Applications - mysql-server (5.1.52) (run remotely, 64-bit) - apache (2.2.22), php (5.4.4), varnish • Compiled for i386, x32, x86-64 ABI 16Wednesday, August 29, 12 16
  • Simple Web Apps (1) $ ab -c $concurrency -n $requests http://$guestip/drupal/ index.php 1GB, 2 VCPUs 1GB, 1 VCPU Request (/sec.) (Higher is better)250" 8250#200" 8200#150" 8150# i386" i386# x86_64" 8100# x86_64#100" x32" x32# 8050# 50" 8000# 0" # 100/1000" 10/1000" Concurrency/Requests 1000/100000# No Varnish Enable X-Drupal-Cache Enable Varnish Enable X-Drupal-Cache 17Wednesday, August 29, 12 17
  • Simple Web Apps (2) $ ab -c $concurrency -n $requests http://$guestip/drupal/ index.php Request (/sec.) (Higher is better) 4GB, 2 VCPUs 230.00% 225.00% 220.00% 215.00% 210.00% 205.00% x86_64% 200.00% x32% 195.00% 190.00% 185.00% 180.00% 100/1000% 10/1000% Concurrency/Requests No Varnish Enable X-Drupal-Cache 18Wednesday, August 29, 12 18
  • Issues Found • Some apps are not x32 clean - Code assumes 64-bit long and pointers using __amd64__ or __x86_64__ - Assembly code that assumes 64-bit long and pointers 19Wednesday, August 29, 12 19
  • Agenda • What is X32 ABI? • Benefits for Virtualization & Cloud • Evaluation of X32 • Summary 20Wednesday, August 29, 12 20
  • Summary • Generic advantages of x32 apps - See for details and status of x32 ABI: • https://sites.google.com/site/x32abi/ • Virtualization and Cloud can take more advantage of x32 apps • Preliminary results look promising - x32 was always better than i386 or x86-64 with simple Web apps* • Build and test more Web apps *: Intel internal measurements 21Wednesday, August 29, 12 21