Skip to content

[PW_SID:993555] riscv: Add helpers use_alternative_{likely,unlikely} - #811

Closed
linux-riscv-bot wants to merge 6 commits into
workflow__riscv__fixesfrom
pw993555
Closed

[PW_SID:993555] riscv: Add helpers use_alternative_{likely,unlikely}#811
linux-riscv-bot wants to merge 6 commits into
workflow__riscv__fixesfrom
pw993555

Conversation

@linux-riscv-bot

Copy link
Copy Markdown

PR for series 993555 applied to workflow__riscv__fixes

Name: riscv: Add helpers use_alternative_{likely,unlikely}
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=993555
Version: 1

Introduce convenience helpers use_alternative_likely() and
use_alternative_unlikely() to implement the pattern of using asm goto to
check if an alternative is selected. Existing code will be converted in
subsequent patches.

Similar to arm64 alternative_has_cap_{likely,unlikely}, but for riscv,
alternatives are not all CPU capabilities.

Suggested-by: Aydın Mercan <aydin@mercan.dev>
Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Use use_alternative_unlikely() to check for RISCV_ISA_EXT_SVVPTC,
replacing the use of asm goto with ALTERNATIVE.

The "unlikely" variant is used to match the behavior of the original
implementation using ALTERNATIVE("nop", "j %l[svvptc]", ...).

Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Use use_alternative_likely() to check for RISCV_ISA_EXT_ZBB, replacing
the use of asm goto with ALTERNATIVE.

The "likely" variant is used to match the behavior of the original
implementation using ALTERNATIVE("j %l[no_zbb]", "nop", ...).

Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Use use_alternative_likely() to check for RISCV_ISA_EXT_ZBB, replacing
the use of asm goto with ALTERNATIVE.

The "likely" variant is used to match the behavior of the original
implementation using ALTERNATIVE("j %l[legacy]", "nop", ...).

Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Use use_alternative_likely() to check for RISCV_ISA_EXT_ZBB, replacing
the use of asm goto with ALTERNATIVE.

The "likely" variant is used to match the behavior of the original
implementation using ALTERNATIVE("j %l[legacy]", "nop", ...).

Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Use use_alternative_likely() to check for RISCV_ISA_EXT_ZAWRS, replacing
the use of asm goto with ALTERNATIVE.

The "likely" variant is used to match the behavior of the original
implementation using ALTERNATIVE("j %l[no_zawrs]", "nop", ...).

Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/6] riscv: Introduce use_alternative_{likely,unlikely}"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 104.25 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/6] riscv: Introduce use_alternative_{likely,unlikely}"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 2228.65 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/6] riscv: Introduce use_alternative_{likely,unlikely}"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 2886.21 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/6] riscv: Introduce use_alternative_{likely,unlikely}"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 21.22 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/6] riscv: Introduce use_alternative_{likely,unlikely}"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 22.14 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/6] riscv: Introduce use_alternative_{likely,unlikely}"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.72 seconds
Result: WARNING
Output:

CHECK: spaces preferred around that '%' (ctx:WxV)
#58: FILE: arch/riscv/include/asm/alternative-macros.h:187:
+	asm goto(ALTERNATIVE("j %l[no_alt]", "nop", %[vendor_id], %[patch_id], 1)
 	                                            ^

CHECK: spaces preferred around that '%' (ctx:WxV)
#58: FILE: arch/riscv/include/asm/alternative-macros.h:187:
+	asm goto(ALTERNATIVE("j %l[no_alt]", "nop", %[vendor_id], %[patch_id], 1)
 	                                                          ^

CHECK: spaces preferred around that '%' (ctx:WxV)
#76: FILE: arch/riscv/include/asm/alternative-macros.h:205:
+	asm goto(ALTERNATIVE("nop", "j %l[alt]", %[vendor_id], %[patch_id], 1)
 	                                         ^

CHECK: spaces preferred around that '%' (ctx:WxV)
#76: FILE: arch/riscv/include/asm/alternative-macros.h:205:
+	asm goto(ALTERNATIVE("nop", "j %l[alt]", %[vendor_id], %[patch_id], 1)
 	                                                       ^

total: 0 errors, 0 warnings, 4 checks, 77 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 1b92b2bfe6a8 ("riscv: Introduce use_alternative_{likely,unlikely}") 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, 4 checks, 77 lines checked
CHECK: spaces preferred around that '%' (ctx:WxV)


@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/6] riscv: Introduce use_alternative_{likely,unlikely}"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 74.91 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/6] riscv: Introduce use_alternative_{likely,unlikely}"
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 1: "[1/6] riscv: Introduce use_alternative_{likely,unlikely}"
kdoc
Desc: Detects for kdoc errors
Duration: 0.89 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/6] riscv: Introduce use_alternative_{likely,unlikely}"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/6] riscv: Introduce use_alternative_{likely,unlikely}"
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: "[1/6] riscv: Introduce use_alternative_{likely,unlikely}"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/6] riscv: pgtable: Convert to use_alternative_unlikely"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 103.07 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/6] riscv: pgtable: Convert to use_alternative_unlikely"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 2206.25 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/6] riscv: pgtable: Convert to use_alternative_unlikely"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 2884.09 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/6] riscv: pgtable: Convert to use_alternative_unlikely"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 21.33 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/6] riscv: pgtable: Convert to use_alternative_unlikely"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 22.29 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/6] riscv: pgtable: Convert to use_alternative_unlikely"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.05 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/6] riscv: pgtable: Convert to use_alternative_unlikely"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 75.16 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/6] riscv: pgtable: Convert to use_alternative_unlikely"
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 2: "[2/6] riscv: pgtable: Convert to use_alternative_unlikely"
kdoc
Desc: Detects for kdoc errors
Duration: 0.88 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/6] riscv: pgtable: Convert to use_alternative_unlikely"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/6] riscv: pgtable: Convert to use_alternative_unlikely"
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: "[2/6] riscv: pgtable: Convert to use_alternative_unlikely"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 4: "[4/6] riscv: hweight: Convert to use_alternative_likely"
kdoc
Desc: Detects for kdoc errors
Duration: 0.88 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 4: "[4/6] riscv: hweight: Convert to use_alternative_likely"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 4: "[4/6] riscv: hweight: Convert to use_alternative_likely"
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: "[4/6] riscv: hweight: Convert to use_alternative_likely"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 5: "[5/6] riscv: bitops: Convert to use_alternative_likely"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 103.75 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 5: "[5/6] riscv: bitops: Convert to use_alternative_likely"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 2206.45 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 5: "[5/6] riscv: bitops: Convert to use_alternative_likely"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 2906.69 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 5: "[5/6] riscv: bitops: Convert to use_alternative_likely"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 20.85 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 5: "[5/6] riscv: bitops: Convert to use_alternative_likely"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 22.16 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 5: "[5/6] riscv: bitops: Convert to use_alternative_likely"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.76 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 5: "[5/6] riscv: bitops: Convert to use_alternative_likely"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 74.65 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 5: "[5/6] riscv: bitops: Convert to use_alternative_likely"
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 5: "[5/6] riscv: bitops: Convert to use_alternative_likely"
kdoc
Desc: Detects for kdoc errors
Duration: 0.82 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 5: "[5/6] riscv: bitops: Convert to use_alternative_likely"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 5: "[5/6] riscv: bitops: Convert to use_alternative_likely"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 5: "[5/6] riscv: bitops: Convert to use_alternative_likely"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.28 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 6: "[6/6] riscv: cmpxchg: Convert to use_alternative_likely"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 104.19 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 6: "[6/6] riscv: cmpxchg: Convert to use_alternative_likely"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 2237.74 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 6: "[6/6] riscv: cmpxchg: Convert to use_alternative_likely"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 2884.18 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 6: "[6/6] riscv: cmpxchg: Convert to use_alternative_likely"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 22.90 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 6: "[6/6] riscv: cmpxchg: Convert to use_alternative_likely"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 22.13 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 6: "[6/6] riscv: cmpxchg: Convert to use_alternative_likely"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.62 seconds
Result: WARNING
Output:

CHECK: Lines should not end with a '('
#83: FILE: arch/riscv/include/asm/cmpxchg.h:381:
+			asm volatile(

CHECK: Lines should not end with a '('
#100: FILE: arch/riscv/include/asm/cmpxchg.h:398:
+			asm volatile(

CHECK: Lines should not end with a '('
#112: FILE: arch/riscv/include/asm/cmpxchg.h:410:
+			asm volatile(

CHECK: Lines should not end with a '('
#133: FILE: arch/riscv/include/asm/cmpxchg.h:421:
+			asm volatile(

total: 0 errors, 0 warnings, 4 checks, 135 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 5dbd28a55f1f ("riscv: cmpxchg: Convert to use_alternative_likely") 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, 4 checks, 135 lines checked
CHECK: Lines should not end with a '('


@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 6: "[6/6] riscv: cmpxchg: Convert to use_alternative_likely"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 74.38 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 6: "[6/6] riscv: cmpxchg: Convert to use_alternative_likely"
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 6: "[6/6] riscv: cmpxchg: Convert to use_alternative_likely"
kdoc
Desc: Detects for kdoc errors
Duration: 0.83 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 6: "[6/6] riscv: cmpxchg: Convert to use_alternative_likely"
module-param
Desc: Detect module_param changes
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 6: "[6/6] riscv: cmpxchg: Convert to use_alternative_likely"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.21 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 6: "[6/6] riscv: cmpxchg: Convert to use_alternative_likely"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.29 seconds
Result: PASS

@linux-riscv-bot
linux-riscv-bot deleted the pw993555 branch August 28, 2025 01:01
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