[kvm-unit-tests PATCH] x86: Align incw instruction to avoid split lock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A split lock is any atomic operation whose operand crosses two cache
lines. Since the operand spans two cache lines and the operation must
be atomic, the system locks the bus while the CPU accesses the two cache
lines. The bus lock operation is heavy weight and can cause
severe performance degradation.

Here's the log when run x86 test cases:
[ 3572.765921] x86/split lock detection: #AC: qemu-system-x86/24383
took a split_lock trap at address: 0x400306

Root caused 'cpu_online_count' spans two cache lines,
"lock incw cpu_online_count" instruction causes split lock.
'cpu_online_count' is the type of word(two bytes) and
therefore it needs to be aligned to 2 bytes to avoid split lock.

Signed-off-by: Junming Liu <junming.liu@xxxxxxxxx>
---
 x86/cstart.S   | 1 +
 x86/cstart64.S | 1 +
 2 files changed, 2 insertions(+)

diff --git a/x86/cstart.S b/x86/cstart.S
index 2c0eec7..6db6a38 100644
--- a/x86/cstart.S
+++ b/x86/cstart.S
@@ -143,6 +143,7 @@ ap_init:
 online_cpus:
 	.fill (max_cpus + 7) / 8, 1, 0
 
+.align 2
 cpu_online_count:	.word 1
 
 .code16
diff --git a/x86/cstart64.S b/x86/cstart64.S
index ff79ae7..7272452 100644
--- a/x86/cstart64.S
+++ b/x86/cstart64.S
@@ -256,4 +256,5 @@ ap_init:
 	jne 1b
 	ret
 
+.align 2
 cpu_online_count:	.word 1
-- 
2.17.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux