Skip to content

[PW_SID:1141715] riscv: vector: preserve state when scheduling at nonzero depth - #2424

Open
linux-riscv-bot wants to merge 2 commits into
workflow__riscv__fixesfrom
pw1141715
Open

[PW_SID:1141715] riscv: vector: preserve state when scheduling at nonzero depth#2424
linux-riscv-bot wants to merge 2 commits into
workflow__riscv__fixesfrom
pw1141715

Conversation

@linux-riscv-bot

Copy link
Copy Markdown

PR for series 1141715 applied to workflow__riscv__fixes

Name: riscv: vector: preserve state when scheduling at nonzero depth
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1141715
Version: 1

Linux RISC-V bot and others added 2 commits August 4, 2026 02:48
The IN_SCHEDULE shortcut lets __switch_to_vector() discard Vector state at
a voluntary schedule point, where Vector registers are caller-saved.
Switch-in can then enable Vector without restoring state.

An interrupt or fault can also schedule at nonzero Vector nesting depth.
This triggers:

  WARNING: arch/riscv/include/asm/vector.h:376 at __schedule+0xfbc/0x10b4

The shortcut is then also taken on switch-in, so it skips NEED_RESTORE and
riscv_v_context_nesting_end() resumes with stale Vector registers. In the
vector usercopy loop, an interrupt between vsetvli and vle8.v/vse8.v can
therefore resume with another task's vl, vtype and vector registers. The
scalar loop state survives, so the copy can use the wrong vector length and
silently corrupt user data. A sleeping page fault in vectorized usercopy
can reach the same switch without CONFIG_PREEMPTION.

Use the shortcut only at depth zero. Nonzero-depth switches retain the
existing save and NEED_RESTORE protocol.

Fixes: d1049fc ("riscv: vector: Support calling schedule() for preemptible Vector")
Cc: stable@vger.kernel.org
Assisted-by: Codex:gpt-5.6-luna
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "riscv: vector: preserve state when scheduling at nonzero depth"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 117.36 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "riscv: vector: preserve state when scheduling at nonzero depth"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1403.73 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "riscv: vector: preserve state when scheduling at nonzero depth"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1746.90 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "riscv: vector: preserve state when scheduling at nonzero depth"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 19.87 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "riscv: vector: preserve state when scheduling at nonzero depth"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 28.16 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "riscv: vector: preserve state when scheduling at nonzero depth"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 2.29 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "riscv: vector: preserve state when scheduling at nonzero depth"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 79.33 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "riscv: vector: preserve state when scheduling at nonzero depth"
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: "riscv: vector: preserve state when scheduling at nonzero depth"
kdoc
Desc: Detects for kdoc errors
Duration: 0.71 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "riscv: vector: preserve state when scheduling at nonzero depth"
module-param
Desc: Detect module_param changes
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "riscv: vector: preserve state when scheduling at nonzero depth"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "riscv: vector: preserve state when scheduling at nonzero depth"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
linux-riscv-bot force-pushed the workflow__riscv__fixes branch 2 times, most recently from abf8962 to 9fa746d Compare August 8, 2026 18:30
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