[PATCH V3 04/17] syscalls: compat: Fix the missing part for __SYSCALL_COMPAT

2022-01-19 Thread guoren
From: Guo Ren Make "uapi asm unistd.h" could be used for architectures' COMPAT mode. The __SYSCALL_COMPAT is first used in riscv. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Cc: Arnd Bergmann --- include/uapi/asm-generic/unistd.h | 4 ++-- tools/include/uapi/asm-generic/unistd.h | 4

[PATCH V3 03/17] asm-generic: compat: Cleanup duplicate definitions

2022-01-19 Thread guoren
From: Guo Ren There are 7 64bit architectures that support Linux COMPAT mode to run 32bit applications. A lot of definitions are duplicate: - COMPAT_USER_HZ - COMPAT_RLIM_INFINITY - COMPAT_OFF_T_MAX - __compat_uid_t, __compat_uid_t - compat_dev_t - compat_ipc_pid_t - struct compat_flock -

[PATCH V3 02/17] fs: stat: compat: Add __ARCH_WANT_COMPAT_STAT

2022-01-19 Thread guoren
From: Guo Ren RISC-V doesn't neeed compat_stat, so using __ARCH_WANT_COMPAT_STAT to exclude unnecessary SYSCALL functions. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- arch/arm64/include/asm/unistd.h | 1 + arch/mips/include/asm/unistd.h| 2 ++ arch/pari

[PATCH V3 01/17] kconfig: Add SYSVIPC_COMPAT for all architectures

2022-01-19 Thread guoren
From: Guo Ren The existing per-arch definitions are pretty much historic cruft. Move SYSVIPC_COMPAT into init/Kconfig. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Acked-by: Arnd Bergmann Cc: Christoph Hellwig --- arch/arm64/Kconfig | 4 arch/mips/Kconfig| 5 - arch/parisc/K

[PATCH V3 00/17] riscv: compat: Add COMPAT mode support for rv64

2022-01-19 Thread guoren
ycon=sbi" -netdev user,id=net0 -device virtio-net-device,netdev=net0 QEMU emulator version 6.2.50 (v6.2.0-29-g196d7182c8) OpenSBI v0.9 [0.00] Linux version 5.16.0-rc6-00017-g750f87086bdd-dirty (guoren@guoren-Z87-HD3) (riscv64-unknown-linux-gnu-gcc (GCC) 10.2.0, GNU ld (GNU Binuti

[PATCH V2 17/17] riscv: compat: Add COMPAT Kbuild skeletal support

2021-12-28 Thread guoren
From: Guo Ren Adds initial skeletal COMPAT Kbuild (Runing 32bit U-mode on 64bit S-mode) support. - Setup kconfig & dummy functions for compiling. - Implement compat_start_thread by the way. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Cc: Arnd Bergmann --- arch/riscv/Kconfig | 19

[PATCH V2 16/17] riscv: compat: Add UXL_32 support in start_thread

2021-12-28 Thread guoren
From: Guo Ren If the current task is in COMPAT mode, set SR_UXL_32 in status for returning userspace. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Cc: Arnd Bergmann --- arch/riscv/kernel/process.c | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/riscv/kernel/process.c b/arch/ri

[PATCH V2 15/17] riscv: compat: ptrace: Add compat_arch_ptrace implement

2021-12-28 Thread guoren
From: Guo Ren Now, you can use native gdb on riscv64 for rv32 app debugging. $ uname -a Linux buildroot 5.16.0-rc4-00036-gbef6b82fdf23-dirty #53 SMP Mon Dec 20 23:06:53 CST 2021 riscv64 GNU/Linux $ cat /proc/cpuinfo processor : 0 hart: 0 isa : rv64imafdcsuh mmu

[PATCH V2 14/17] riscv: compat: signal: Add rt_frame implementation

2021-12-28 Thread guoren
From: Guo Ren Implement compat_setup_rt_frame for sigcontext save & restore. The main process is the same with signal, but the rv32 pt_regs' size is different from rv64's, so we needs convert them. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Cc: Arnd Bergmann --- arch/riscv/kernel/Makefile

[PATCH V2 13/17] riscv: compat: vdso: Add setup additional pages implementation

2021-12-28 Thread guoren
From: Guo Ren Reconstruct __setup_additional_pages() by appending vdso info pointer argument to meet compat_vdso_info requirement. And change vm_special_mapping *dm, *cm initialization into static. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Cc: Arnd Bergmann --- arch/riscv/include/asm/elf

[PATCH V2 12/17] riscv: compat: vdso: Add rv32 VDSO base code implementation

2021-12-28 Thread guoren
From: Guo Ren There is no vgettimeofday supported in rv32 that makes simple to generate rv32 vdso code which only needs riscv64 compiler. Other architectures need change compiler or -m (machine parameter) to support vdso32 compiling. If rv32 support vgettimeofday (which cause C compile) in future

[PATCH V2 11/17] riscv: compat: Add elf.h implementation

2021-12-28 Thread guoren
From: Guo Ren Implement necessary type and macro for compat elf. See the code comment for detail. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Cc: Arnd Bergmann --- arch/riscv/include/asm/elf.h | 49 +++- 1 file changed, 48 insertions(+), 1 deletion(-) diff

[PATCH V2 10/17] riscv: compat: syscall: Add entry.S implementation

2021-12-28 Thread guoren
From: Guo Ren Implement the entry of compat_sys_call_table[] in asm. Ref to riscv-privileged spec 4.1.1 Supervisor Status Register (sstatus): BIT[32:33] = UXL[1:0]: - 1:32 - 2:64 - 3:128 Signed-off-by: Guo Ren Signed-off-by: Guo Ren Cc: Arnd Bergmann --- arch/riscv/include/asm/csr.h |

[PATCH V2 09/17] riscv: compat: syscall: Add compat_sys_call_table implementation

2021-12-28 Thread guoren
From: Guo Ren Implement compat_syscall_table.c with compat_sys_call_table & fixup system call such as truncate64,pread64,fallocate which need two regs to indicate 64bit-arg (copied from arm64). Signed-off-by: Guo Ren Signed-off-by: Guo Ren Cc: Arnd Bergmann --- arch/riscv/include/asm/syscall

[PATCH V2 08/17] riscv: compat: Re-implement TASK_SIZE for COMPAT_32BIT

2021-12-28 Thread guoren
From: Guo Ren Make TASK_SIZE from const to dynamic detect TIF_32BIT flag function. Refer to arm64 to implement DEFAULT_MAP_WINDOW_64 for efi-stub. Limit 32-bit compatible process in 0-2GB virtual address range (which is enough for real scenarios), because it could avoid address sign extend probl

[PATCH V2 07/17] riscv: compat: Add basic compat date type implementation

2021-12-28 Thread guoren
From: Guo Ren Implement asm/compat.h for struct compat_xxx, RLIM_INFINITY, OFF_T_MAX, is_compat_task, compat_user_regset, regset convert. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Cc: Arnd Bergmann --- arch/riscv/include/asm/compat.h | 132 +++ arch/riscv/inc

[PATCH V2 06/17] riscv: Fixup difference with defconfig

2021-12-28 Thread guoren
From: Guo Ren Let's follow the origin patch's spirit: The only difference between rv32_defconfig and defconfig is that rv32_defconfig has CONFIG_ARCH_RV32I=y. This is helpful to compare rv64-compat-rv32 v.s. rv32-linux. Fixes: 1b937e8faa87ccfb ("RISC-V: Add separate defconfig for 32bit system

[PATCH V2 05/17] syscalls: compat: Fix the missing part for __SYSCALL_COMPAT

2021-12-28 Thread guoren
From: Guo Ren Make "uapi asm unistd.h" could be used for architectures' COMPAT mode. The __SYSCALL_COMPAT is first used in riscv. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Cc: Arnd Bergmann --- include/uapi/asm-generic/unistd.h | 4 ++-- tools/include/uapi/asm-generic/unistd.h | 4

[PATCH V2 04/17] asm-generic: compat: Cleanup duplicate definitions

2021-12-28 Thread guoren
From: Guo Ren There are 7 64bit architectures that support Linux COMPAT mode to run 32bit applications. A lot of definitions are duplicate: - COMPAT_USER_HZ - COMPAT_RLIM_INFINITY - COMPAT_OFF_T_MAX - __compat_uid_t, __compat_uid_t - compat_dev_t - compat_ipc_pid_t - struct compat_flock -

[PATCH V2 03/17] asm-generic: fcntl: compat: Remove duplicate definitions

2021-12-28 Thread guoren
From: Guo Ren Remove duplicate F_GETLK64,F_SETLK64,F_SETLKW64 definitions in arch/*/include/asm/compat.h. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Cc: Arnd Bergmann --- arch/arm64/include/asm/compat.h | 4 arch/powerpc/include/asm/compat.h | 4 arch/s390/include/asm/compat.h

[PATCH V2 02/17] fs: stat: compat: Add __ARCH_WANT_COMPAT_STAT

2021-12-28 Thread guoren
From: Guo Ren RISC-V doesn't neeed compat_stat, so using __ARCH_WANT_COMPAT_STAT to exclude unnecessary SYSCALL functions. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Cc: Arnd Bergmann --- arch/arm64/include/asm/unistd.h | 1 + arch/mips/include/asm/unistd.h| 2 ++ arch/parisc/includ

[PATCH V2 01/17] kconfig: Add SYSVIPC_COMPAT for all architectures

2021-12-28 Thread guoren
From: Guo Ren The existing per-arch definitions are pretty much historic cruft. Move SYSVIPC_COMPAT into init/Kconfig. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Cc: Arnd Bergmann Cc: Christoph Hellwig --- arch/arm64/Kconfig | 4 arch/mips/Kconfig| 5 - arch/parisc/Kconfig

[PATCH V2 00/17] riscv: compat: Add COMPAT mode support for rv64

2021-12-28 Thread guoren
ycon=sbi" -netdev user,id=net0 -device virtio-net-device,netdev=net0 QEMU emulator version 6.2.50 (v6.2.0-29-g196d7182c8) OpenSBI v0.9 [0.00] Linux version 5.16.0-rc6-00017-g750f87086bdd-dirty (guoren@guoren-Z87-HD3) (riscv64-unknown-linux-gnu-gcc (GCC) 10.2.0, GNU ld (GNU Binuti

[PATCH V3 8/8] sched: mips: Remove unused TASK_SIZE_OF

2021-12-27 Thread guoren
From: Guo Ren This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- arch/mips/include/asm/processor.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/mips/incl

[PATCH V3 7/8] sched: arm64: Remove unused TASK_SIZE_OF

2021-12-27 Thread guoren
From: Guo Ren This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- arch/arm64/include/asm/processor.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm64/inc

[PATCH V3 6/8] sched: parisc: Remove unused TASK_SIZE_OF

2021-12-27 Thread guoren
From: Guo Ren This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- arch/parisc/include/asm/processor.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --gi

[PATCH V3 5/8] sched: s390: Remove unused TASK_SIZE_OF

2021-12-27 Thread guoren
From: Guo Ren This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- arch/s390/include/asm/processor.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git

[PATCH V3 4/8] sched: powerpc: Remove unused TASK_SIZE_OF

2021-12-27 Thread guoren
From: Guo Ren This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- arch/powerpc/include/asm/task_size_64.h | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) di

[PATCH V3 3/8] sched: sparc: Remove unused TASK_SIZE_OF

2021-12-27 Thread guoren
From: Guo Ren This macro isn't used in Linux, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- arch/sparc/include/asm/processor_64.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/sparc/inclu

[PATCH V3 2/8] sched: x86: Remove unused TASK_SIZE_OF

2021-12-27 Thread guoren
From: Guo Ren This macro isn't used in Linux, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- arch/x86/include/asm/page_64_types.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/x86/include/a

[PATCH V3 1/8] sched: Remove unused TASK_SIZE_OF

2021-12-27 Thread guoren
From: Guo Ren This macro isn't used in Linux, now. Delete in include/linux/sched.h and arch's include/asm. This would confuse people who are implementing the COMPAT feature for architecture. Here is the comment by Arnd: Looking through the git history, I see commit a06db751c321 ("pagemap: check

[PATCH V3 0/8] sched: Remove unused TASK_SIZE_OF for all archs

2021-12-27 Thread guoren
From: Guo Ren This macro isn't used in Linux, now. Delete in include/linux/sched.h and arch's include/asm. This would confuse people who are implementing the COMPAT feature for architecture. Changes in v3: - Fixup Documentation/process/submitting-patches.rst, add sender Signed-off-by. Chang

[PATCH V2 8/8] sched: mips: Remove unused TASK_SIZE_OF

2021-12-24 Thread guoren
From: Guo Ren This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- arch/mips/include/asm/processor.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/mips/include/asm/processor.h b/a

[PATCH V2 7/8] sched: arm64: Remove unused TASK_SIZE_OF

2021-12-24 Thread guoren
From: Guo Ren This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- arch/arm64/include/asm/processor.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm64/include/asm/processor.h b/

[PATCH V2 6/8] sched: parisc: Remove unused TASK_SIZE_OF

2021-12-24 Thread guoren
From: Guo Ren This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- arch/parisc/include/asm/processor.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/parisc/include/

[PATCH V2 5/8] sched: s390: Remove unused TASK_SIZE_OF

2021-12-24 Thread guoren
From: Guo Ren This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- arch/s390/include/asm/processor.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/s390/include/asm/

[PATCH V2 4/8] sched: powerpc: Remove unused TASK_SIZE_OF

2021-12-24 Thread guoren
From: Guo Ren This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- arch/powerpc/include/asm/task_size_64.h | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/arch/powerpc/

[PATCH V2 3/8] sched: sparc: Remove unused TASK_SIZE_OF

2021-12-24 Thread guoren
From: Guo Ren This macro isn't used in Linux, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- arch/sparc/include/asm/processor_64.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/sparc/include/asm/processor_64.h b

[PATCH V2 2/8] sched: x86: Remove unused TASK_SIZE_OF

2021-12-24 Thread guoren
From: Guo Ren This macro isn't used in Linux, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- arch/x86/include/asm/page_64_types.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/x86/include/asm/page_64_types.h b/ar

[PATCH V2 1/8] sched: Remove unused TASK_SIZE_OF

2021-12-24 Thread guoren
From: Guo Ren This macro isn't used in Linux, now. Delete in include/linux/sched.h and arch's include/asm. This would confuse people who are implementing the COMPAT feature for architecture. Here is the comment by Arnd: Looking through the git history, I see commit a06db751c321 ("pagemap: check

[PATCH V2 0/8] sched: Remove unused TASK_SIZE_OF

2021-12-24 Thread guoren
From: Guo Ren This macro isn't used in Linux, now. Delete in include/linux/sched.h and arch's include/asm. This would confuse people who are implementing the COMPAT feature for architecture. Changes in v2: - Add Arnd's comment in main patch - Optimize coding convention with Christophe's advise

[PATCH 8/8] sched: mips: Remove unused TASK_SIZE_OF

2021-12-21 Thread guoren
From: Guo Ren This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren --- arch/mips/include/asm/processor.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/process

[PATCH 7/8] sched: arm64: Remove unused TASK_SIZE_OF

2021-12-21 Thread guoren
From: Guo Ren This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren --- arch/arm64/include/asm/processor.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/proce

[PATCH 6/8] sched: parisc: Remove unused TASK_SIZE_OF

2021-12-21 Thread guoren
From: Guo Ren This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren --- arch/parisc/include/asm/processor.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/parisc/include/asm/processor.h b/arch/pari

[PATCH 5/8] sched: s390: Remove unused TASK_SIZE_OF

2021-12-21 Thread guoren
From: Guo Ren This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren --- arch/s390/include/asm/processor.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/s390/include/asm/processor.h b/arch/s390/inc

[PATCH 4/8] sched: powerpc: Remove unused TASK_SIZE_OF

2021-12-21 Thread guoren
From: Guo Ren This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren --- arch/powerpc/include/asm/task_size_64.h | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/include/asm/task_size_64.h

[PATCH 3/8] sched: sparc: Remove unused TASK_SIZE_OF

2021-12-21 Thread guoren
From: Guo Ren This macro isn't used in Linux, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren --- arch/sparc/include/asm/processor_64.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/sparc/include/asm/processor_64.h b/arch/sparc/include/asm/proc

[PATCH 2/8] sched: x86: Remove unused TASK_SIZE_OF

2021-12-21 Thread guoren
From: Guo Ren This macro isn't used in Linux, now. Delete in include/linux/sched.h and arch's include/asm. Signed-off-by: Guo Ren --- arch/x86/include/asm/page_64_types.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_t

[PATCH 1/8] sched: Remove unused TASK_SIZE_OF

2021-12-21 Thread guoren
From: Guo Ren This macro isn't used in Linux, now. Delete in include/linux/sched.h and arch's include/asm. This would confuse people who are implementing the COMPAT feature for architecture. Signed-off-by: Guo Ren --- include/linux/sched.h | 4 1 file changed, 4 deletions(-) diff --git a

[PATCH 0/8] sched: Remove unused TASK_SIZE_OF

2021-12-21 Thread guoren
From: Guo Ren This macro isn't used in Linux, now. Delete in include/linux/sched.h and arch's include/asm. This would confuse people who are implementing the COMPAT feature for architecture. Guo Ren (8): sched: Remove unused TASK_SIZE_OF sched: x86: Remove unused TASK_SIZE_OF sched: sparc:

[PATCH v6 9/9] powerpc/qspinlock: Add ARCH_USE_QUEUED_SPINLOCKS_XCHG32

2021-03-31 Thread guoren
From: Guo Ren We don't have native hw xchg16 instruction, so let qspinlock generic code to deal with it. Using the full-word atomic xchg instructions implement xchg16 has the semantic risk for atomic operations. This patch cancels the dependency of on qspinlock generic code on architecture's xc

[PATCH v6 8/9] xtensa: qspinlock: Add ARCH_USE_QUEUED_SPINLOCKS_XCHG32

2021-03-31 Thread guoren
From: Guo Ren We don't have native hw xchg16 instruction, so let qspinlock generic code to deal with it. Using the full-word atomic xchg instructions implement xchg16 has the semantic risk for atomic operations. This patch cancels the dependency of on qspinlock generic code on architecture's xc

[PATCH v6 7/9] sparc: qspinlock: Add ARCH_USE_QUEUED_SPINLOCKS_XCHG32

2021-03-31 Thread guoren
From: Guo Ren We don't have native hw xchg16 instruction, so let qspinlock generic code to deal with it. Using the full-word atomic xchg instructions implement xchg16 has the semantic risk for atomic operations. This patch cancels the dependency of on qspinlock generic code on architecture's xc

[PATCH v6 6/9] openrisc: qspinlock: Add ARCH_USE_QUEUED_SPINLOCKS_XCHG32

2021-03-31 Thread guoren
From: Guo Ren We don't have native hw xchg16 instruction, so let qspinlock generic code to deal with it. Using the full-word atomic xchg instructions implement xchg16 has the semantic risk for atomic operations. This patch cancels the dependency of on qspinlock generic code on architecture's xc

[PATCH v6 5/9] csky: Convert custom spinlock/rwlock to generic qspinlock/qrwlock

2021-03-31 Thread guoren
From: Guo Ren Update the C-SKY port to use the generic qspinlock and qrwlock. C-SKY only support ldex.w/stex.w with word(double word) size & align access. So it must select XCHG32 to let qspinlock only use word atomic xchg_tail. Default is still ticket lock. Signed-off-by: Guo Ren Cc: Waiman

[PATCH v6 4/9] csky: locks: Optimize coding convention

2021-03-31 Thread guoren
From: Guo Ren - Using smp_cond_load_acquire in arch_spin_lock by Peter's advice. - Using __smp_acquire_fence in arch_spin_trylock - Using smp_store_release in arch_spin_unlock All above are just coding conventions and won't affect the function. TODO in smp_cond_load_acquire for architectu

[PATCH v6 3/9] riscv: locks: Introduce ticket-based spinlock implementation

2021-03-31 Thread guoren
From: Guo Ren This patch introduces a ticket lock implementation for riscv, along the same lines as the implementation for arch/arm & arch/csky. We still use qspinlock as default. Signed-off-by: Guo Ren Cc: Peter Zijlstra Cc: Anup Patel Cc: Arnd Bergmann --- arch/riscv/Kconfig

[PATCH v6 2/9] riscv: Convert custom spinlock/rwlock to generic qspinlock/qrwlock

2021-03-31 Thread guoren
From: Michael Clark Update the RISC-V port to use the generic qspinlock and qrwlock. This patch requires support for xchg_xtail for full-word which are added by a previous patch: Guo added select ARCH_USE_QUEUED_SPINLOCKS_XCHG32 in Kconfig Guo fixed up compile error which made by below include

[PATCH v6 1/9] locking/qspinlock: Add ARCH_USE_QUEUED_SPINLOCKS_XCHG32

2021-03-31 Thread guoren
From: Guo Ren Some architectures don't have sub-word swap atomic instruction, they only have the full word's one. The sub-word swap only improve the performance when: NR_CPUS < 16K * 0- 7: locked byte * 8: pending * 9-15: not used * 16-17: tail index * 18-31: tail cpu (+1) The 9-15 b

[PATCH v6 0/9] riscv: Add qspinlock/qrwlock

2021-03-31 Thread guoren
From: Guo Ren Current riscv is still using baby spinlock implementation. It'll cause fairness and cache line bouncing problems. Many people are involved and pay the efforts to improve it: - The first version of patch was made in 2019.1: https://lore.kernel.org/linux-riscv/20190211043829.300

[PATCH v5 7/7] xtensa: qspinlock: Add ARCH_USE_QUEUED_SPINLOCKS_XCHG32

2021-03-27 Thread guoren
From: Guo Ren We don't have native hw xchg16 instruction, so let qspinlock generic code to deal with it. Using the full-word atomic xchg instructions implement xchg16 has the semantic risk for atomic operations. This patch cancels the dependency of on qspinlock generic code on architecture's xc

[PATCH v5 6/7] sparc: qspinlock: Add ARCH_USE_QUEUED_SPINLOCKS_XCHG32

2021-03-27 Thread guoren
From: Guo Ren We don't have native hw xchg16 instruction, so let qspinlock generic code to deal with it. Using the full-word atomic xchg instructions implement xchg16 has the semantic risk for atomic operations. This patch cancels the dependency of on qspinlock generic code on architecture's xc

[PATCH v5 5/7] openrisc: qspinlock: Add ARCH_USE_QUEUED_SPINLOCKS_XCHG32

2021-03-27 Thread guoren
From: Guo Ren We don't have native hw xchg16 instruction, so let qspinlock generic code to deal with it. Using the full-word atomic xchg instructions implement xchg16 has the semantic risk for atomic operations. This patch cancels the dependency of on qspinlock generic code on architecture's xc

[PATCH v5 4/7] powerpc/qspinlock: Add ARCH_USE_QUEUED_SPINLOCKS_XCHG32

2021-03-27 Thread guoren
From: Guo Ren We don't have native hw xchg16 instruction, so let qspinlock generic code to deal with it. Using the full-word atomic xchg instructions implement xchg16 has the semantic risk for atomic operations. This patch cancels the dependency of on qspinlock generic code on architecture's xc

[PATCH v5 3/7] csky: Convert custom spinlock/rwlock to generic qspinlock/qrwlock

2021-03-27 Thread guoren
From: Guo Ren Update the C-SKY port to use the generic qspinlock and qrwlock. C-SKY only support ldex.w/stex.w with word(double word) size & align access. So it must select XCHG32 to let qspinlock only use word atomic xchg_tail. Signed-off-by: Guo Ren Cc: Waiman Long Cc: Peter Zijlstra Cc: W

[PATCH v5 2/7] riscv: Convert custom spinlock/rwlock to generic qspinlock/qrwlock

2021-03-27 Thread guoren
From: Michael Clark Update the RISC-V port to use the generic qspinlock and qrwlock. This patch requires support for xchg_xtail for full-word which are added by a previous patch: Guo added select ARCH_USE_QUEUED_SPINLOCKS_XCHG32 in Kconfig Guo fixed up compile error which made by below include

[PATCH v5 1/7] locking/qspinlock: Add ARCH_USE_QUEUED_SPINLOCKS_XCHG32

2021-03-27 Thread guoren
From: Guo Ren Some architectures don't have sub-word swap atomic instruction, they only have the full word's one. The sub-word swap only improve the performance when: NR_CPUS < 16K * 0- 7: locked byte * 8: pending * 9-15: not used * 16-17: tail index * 18-31: tail cpu (+1) The 9-15 b

[PATCH v5 0/7] riscv: Add qspinlock/qrwlock

2021-03-27 Thread guoren
From: Guo Ren Current riscv is still using baby spinlock implementation. It'll cause fairness and cache line bouncing problems. Many people are involved and pay the efforts to improve it: - The first version of patch was made in 2019.1: https://lore.kernel.org/linux-riscv/20190211043829.300

<    1   2   3