mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-05 09:56:55 +07:00
a750036f35
With the write lock path simply subtracting RW_LOCK_BIAS there is, on large systems, the theoretical possibility of overflowing the 32-bit value that was used so far (namely if 128 or more CPUs manage to do the subtraction, but don't get to do the inverse addition in the failure path quickly enough). A first measure is to modify RW_LOCK_BIAS itself - with the new value chosen, it is good for up to 2048 CPUs each allowed to nest over 2048 times on the read path without causing an issue. Quite possibly it would even be sufficient to adjust the bias a little further, assuming that allowing for significantly less nesting would suffice. However, as the original value chosen allowed for even more nesting levels, to support more than 2048 CPUs (possible currently only for 64-bit kernels) the lock itself gets widened to 64 bits. Signed-off-by: Jan Beulich <jbeulich@novell.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/4E258E0D020000780004E3F0@nat28.tlf.novell.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
45 lines
783 B
ArmAsm
45 lines
783 B
ArmAsm
/* Slow paths of read/write spinlocks. */
|
|
|
|
#include <linux/linkage.h>
|
|
#include <asm/alternative-asm.h>
|
|
#include <asm/frame.h>
|
|
#include <asm/rwlock.h>
|
|
|
|
#ifdef CONFIG_X86_32
|
|
# define __lock_ptr eax
|
|
#else
|
|
# define __lock_ptr rdi
|
|
#endif
|
|
|
|
ENTRY(__write_lock_failed)
|
|
CFI_STARTPROC
|
|
FRAME
|
|
0: LOCK_PREFIX
|
|
WRITE_LOCK_ADD($RW_LOCK_BIAS) (%__lock_ptr)
|
|
1: rep; nop
|
|
cmpl $WRITE_LOCK_CMP, (%__lock_ptr)
|
|
jne 1b
|
|
LOCK_PREFIX
|
|
WRITE_LOCK_SUB($RW_LOCK_BIAS) (%__lock_ptr)
|
|
jnz 0b
|
|
ENDFRAME
|
|
ret
|
|
CFI_ENDPROC
|
|
END(__write_lock_failed)
|
|
|
|
ENTRY(__read_lock_failed)
|
|
CFI_STARTPROC
|
|
FRAME
|
|
0: LOCK_PREFIX
|
|
READ_LOCK_SIZE(inc) (%__lock_ptr)
|
|
1: rep; nop
|
|
READ_LOCK_SIZE(cmp) $1, (%__lock_ptr)
|
|
js 1b
|
|
LOCK_PREFIX
|
|
READ_LOCK_SIZE(dec) (%__lock_ptr)
|
|
js 0b
|
|
ENDFRAME
|
|
ret
|
|
CFI_ENDPROC
|
|
END(__read_lock_failed)
|