From 4e2cd478208531c47343290f15b577d40c82649c Mon Sep 17 00:00:00 2001 From: Anup Patel Date: Mon, 20 May 2019 11:20:53 +0530 Subject: lib: Flush everything when remote TLB flush range is too large On latest Linux kernel (i.e. 5.2-rc1), we get large TLB flush request for user space addresses (typically, start=x and end=-1). This is caused by Linux kernel commit a21344dfc6 ("riscv: fix sbi_remote_sfence_vma{,_asid}"). It's not practical to execute large number of sfence instructions for a large TLB flush range because it takes too much time and eventually causes CPU stall in Linux kernel. This patch addresses above issue by upgrading TLB flush range to TLB flush all whenever TLB flush range is greater than 1GB. Signed-off-by: Anup Patel Reviewed-by: Atish Patra --- include/sbi/riscv_asm.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/sbi/riscv_asm.h b/include/sbi/riscv_asm.h index 357bcb4f..704c53c2 100644 --- a/include/sbi/riscv_asm.h +++ b/include/sbi/riscv_asm.h @@ -31,7 +31,9 @@ #define PAGE_SHIFT (12) #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) #define PAGE_MASK (~(PAGE_SIZE - 1)) -#define SBI_TLB_FLUSH_ALL ((unsigned long)-1) + +#define SBI_TLB_FLUSH_ALL ((unsigned long)-1) +#define SBI_TLB_FLUSH_MAX_SIZE (1UL << 30) #define REG_L __REG_SEL(ld, lw) #define REG_S __REG_SEL(sd, sw) -- cgit v1.3.1