Skip to content

[PW_SID:955381] riscv: Add Zicbop & prefetchw support#322

Closed
linux-riscv-bot wants to merge 5 commits into
workflow__riscv__fixesfrom
pw955381
Closed

[PW_SID:955381] riscv: Add Zicbop & prefetchw support#322
linux-riscv-bot wants to merge 5 commits into
workflow__riscv__fixesfrom
pw955381

Conversation

@linux-riscv-bot
Copy link
Copy Markdown

PR for series 955381 applied to workflow__riscv__fixes

Name: riscv: Add Zicbop & prefetchw support
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=955381
Version: 3

Linux RISC-V bot and others added 5 commits April 16, 2025 18:23
The S-type instructions are first introduced and then used to define the
encoding of the Zicbop prefetching instructions.

Co-developed-by: Guo Ren <guoren@kernel.org>
Signed-off-by: Guo Ren <guoren@kernel.org>
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Zicbop introduces cache blocks prefetching instructions, add the
necessary support for the kernel to use it in the coming commits.

Co-developed-by: Guo Ren <guoren@kernel.org>
Signed-off-by: Guo Ren <guoren@kernel.org>
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Enable Linux prefetch and prefetchw primitives using Zicbop.

Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Signed-off-by: Guo Ren <guoren@kernel.org>
Link: https://lore.kernel.org/r/20231231082955.16516-3-guoren@kernel.org
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The cost of changing a cacheline from shared to exclusive state can be
significant, especially when this is triggered by an exclusive store,
since it may result in having to retry the transaction.

This patch makes use of prefetch.w to prefetch cachelines for write
prior to lr/sc loops when using the xchg_small atomic routine.

This patch is inspired by commit 0ea366f ("arm64: atomics:
prefetch the destination word for write prior to stxr").

Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Signed-off-by: Guo Ren <guoren@kernel.org>
Link: https://lore.kernel.org/r/20231231082955.16516-4-guoren@kernel.org
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,1/4] riscv: Introduce Zicbop instructions"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 99.78 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,1/4] riscv: Introduce Zicbop instructions"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1240.77 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,1/4] riscv: Introduce Zicbop instructions"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1549.62 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,1/4] riscv: Introduce Zicbop instructions"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 19.21 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,1/4] riscv: Introduce Zicbop instructions"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 20.50 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,1/4] riscv: Introduce Zicbop instructions"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.50 seconds
Result: ERROR
Output:

WARNING: space prohibited between function name and open parenthesis '('
#51: FILE: arch/riscv/include/asm/insn-def.h:66:
+	.4byte	((\opcode << INSN_S_OPCODE_SHIFT) |		\

WARNING: Avoid unnecessary line continuations
#51: FILE: arch/riscv/include/asm/insn-def.h:66:
+	.4byte	((\opcode << INSN_S_OPCODE_SHIFT) |		\

ERROR: Macros with complex values should be enclosed in parentheses
#63: FILE: arch/riscv/include/asm/insn-def.h:78:
+#define __INSN_S(...)	insn_s __VA_ARGS__

total: 1 errors, 2 warnings, 0 checks, 124 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Commit 59186719d518 ("riscv: Introduce Zicbop instructions") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
ERROR: Macros with complex values should be enclosed in parentheses
WARNING: Avoid unnecessary line continuations
WARNING: space prohibited between function name and open parenthesis '('


@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,1/4] riscv: Introduce Zicbop instructions"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 37.95 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,1/4] riscv: Introduce Zicbop instructions"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,1/4] riscv: Introduce Zicbop instructions"
kdoc
Desc: Detects for kdoc errors
Duration: 0.85 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,1/4] riscv: Introduce Zicbop instructions"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,1/4] riscv: Introduce Zicbop instructions"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,1/4] riscv: Introduce Zicbop instructions"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.29 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v3,2/4] riscv: Add support for Zicbop"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 99.45 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v3,2/4] riscv: Add support for Zicbop"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1699.40 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v3,2/4] riscv: Add support for Zicbop"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 2260.54 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v3,2/4] riscv: Add support for Zicbop"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 19.36 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v3,2/4] riscv: Add support for Zicbop"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 20.50 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v3,2/4] riscv: Add support for Zicbop"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 2.84 seconds
Result: ERROR
Output:

ERROR: Macros with complex values should be enclosed in parentheses
#99: FILE: arch/riscv/include/asm/insn-def.h:267:
+#define nop()           __asm__ __volatile__ ("nop")

ERROR: Macros with complex values should be enclosed in parentheses
#101: FILE: arch/riscv/include/asm/insn-def.h:269:
+#define nops(n)         __asm__ __volatile__ (__nops(n))

total: 2 errors, 0 warnings, 0 checks, 152 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Commit 427d475ce6bf ("riscv: Add support for Zicbop") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
ERROR: Macros with complex values should be enclosed in parentheses


@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v3,2/4] riscv: Add support for Zicbop"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 38.21 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v3,2/4] riscv: Add support for Zicbop"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v3,2/4] riscv: Add support for Zicbop"
kdoc
Desc: Detects for kdoc errors
Duration: 0.91 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v3,2/4] riscv: Add support for Zicbop"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v3,2/4] riscv: Add support for Zicbop"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v3,2/4] riscv: Add support for Zicbop"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.29 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v3,3/4] riscv: Add ARCH_HAS_PREFETCH[W] support with Zicbop"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 99.51 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v3,3/4] riscv: Add ARCH_HAS_PREFETCH[W] support with Zicbop"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1690.45 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v3,3/4] riscv: Add ARCH_HAS_PREFETCH[W] support with Zicbop"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 2259.68 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v3,3/4] riscv: Add ARCH_HAS_PREFETCH[W] support with Zicbop"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 19.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v3,3/4] riscv: Add ARCH_HAS_PREFETCH[W] support with Zicbop"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 20.26 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v3,3/4] riscv: Add ARCH_HAS_PREFETCH[W] support with Zicbop"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.54 seconds
Result: ERROR
Output:

ERROR: #define of 'ARCH_HAS_PREFETCH' is wrong - use Kconfig variables or standard guards instead
#44: FILE: arch/riscv/include/asm/processor.h:150:
+#define ARCH_HAS_PREFETCH

CHECK: spaces preferred around that '%' (ctx:BxV)
#47: FILE: arch/riscv/include/asm/processor.h:153:
+	__asm__ __volatile__(PREFETCH_ASM(%0) : : "r" (x) : "memory");
 	                                  ^

ERROR: #define of 'ARCH_HAS_PREFETCHW' is wrong - use Kconfig variables or standard guards instead
#50: FILE: arch/riscv/include/asm/processor.h:156:
+#define ARCH_HAS_PREFETCHW

CHECK: spaces preferred around that '%' (ctx:BxV)
#53: FILE: arch/riscv/include/asm/processor.h:159:
+	__asm__ __volatile__(PREFETCHW_ASM(%0) : : "r" (x) : "memory");
 	                                   ^

total: 2 errors, 0 warnings, 2 checks, 36 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Commit c6cad1b08f6d ("riscv: Add ARCH_HAS_PREFETCH[W] support with Zicbop") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
CHECK: spaces preferred around that '%' (ctx:BxV)
ERROR: #define of 'ARCH_HAS_PREFETCH' is wrong - use Kconfig variables or standard guards instead
ERROR: #define of 'ARCH_HAS_PREFETCHW' is wrong - use Kconfig variables or standard guards instead


@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v3,3/4] riscv: Add ARCH_HAS_PREFETCH[W] support with Zicbop"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 38.06 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v3,3/4] riscv: Add ARCH_HAS_PREFETCH[W] support with Zicbop"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 1.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v3,3/4] riscv: Add ARCH_HAS_PREFETCH[W] support with Zicbop"
kdoc
Desc: Detects for kdoc errors
Duration: 0.90 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v3,3/4] riscv: Add ARCH_HAS_PREFETCH[W] support with Zicbop"
module-param
Desc: Detect module_param changes
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v3,3/4] riscv: Add ARCH_HAS_PREFETCH[W] support with Zicbop"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v3,3/4] riscv: Add ARCH_HAS_PREFETCH[W] support with Zicbop"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.31 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v3,4/4] riscv: xchg: Prefetch the destination word for sc.w"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 100.75 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v3,4/4] riscv: xchg: Prefetch the destination word for sc.w"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1697.86 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v3,4/4] riscv: xchg: Prefetch the destination word for sc.w"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 2260.58 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v3,4/4] riscv: xchg: Prefetch the destination word for sc.w"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 19.80 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v3,4/4] riscv: xchg: Prefetch the destination word for sc.w"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 20.49 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v3,4/4] riscv: xchg: Prefetch the destination word for sc.w"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.60 seconds
Result: WARNING
Output:

CHECK: Consider using #include <linux/processor.h> instead of <asm/processor.h>
#33: FILE: arch/riscv/include/asm/cmpxchg.h:16:
+#include <asm/processor.h>

CHECK: spaces preferred around that '%' (ctx:BxV)
#41: FILE: arch/riscv/include/asm/cmpxchg.h:41:
+		       PREFETCHW_ASM(%5)					\
 		                     ^

total: 0 errors, 0 warnings, 2 checks, 22 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Commit 796c12293ad5 ("riscv: xchg: Prefetch the destination word for sc.w") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 2 checks, 22 lines checked
CHECK: Consider using #include <linux/processor.h> instead of <asm/processor.h>
CHECK: spaces preferred around that '%' (ctx:BxV)


@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v3,4/4] riscv: xchg: Prefetch the destination word for sc.w"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 38.49 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v3,4/4] riscv: xchg: Prefetch the destination word for sc.w"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v3,4/4] riscv: xchg: Prefetch the destination word for sc.w"
kdoc
Desc: Detects for kdoc errors
Duration: 0.91 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v3,4/4] riscv: xchg: Prefetch the destination word for sc.w"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v3,4/4] riscv: xchg: Prefetch the destination word for sc.w"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v3,4/4] riscv: xchg: Prefetch the destination word for sc.w"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot linux-riscv-bot force-pushed the workflow__riscv__fixes branch from 6c2725a to c8da138 Compare April 24, 2025 20:46
@linux-riscv-bot linux-riscv-bot deleted the pw955381 branch April 29, 2025 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants