trans_rvv.c.inc: mark_vs_dirty() before loads and stores
commit944b6dfd3d67236882f2bc09d1d30ed923268e16
authorDaniel Henrique Barboza <dbarboza@ventanamicro.com>
Wed, 6 Mar 2024 17:19:24 +0000 (6 14:19 -0300)
committerAlistair Francis <alistair.francis@wdc.com>
Fri, 8 Mar 2024 10:48:03 +0000 (8 20:48 +1000)
tree7f9f7493e97ec1268e60b518bb4baa1190f57a88
parente231ec8f677d94ee38316bce8e8bad3e324b0434
trans_rvv.c.inc: mark_vs_dirty() before loads and stores

While discussing a problem with how we're (not) setting vstart_eq_zero
Richard had the following to say w.r.t the conditional mark_vs_dirty()
calls on load/store functions [1]:

"I think it's required to have stores set dirty unconditionally, before
the operation.

Consider a store that traps on the 2nd element, leaving vstart = 2, and
exiting to the main loop via exception. The exception enters the kernel
page fault handler. The kernel may need to fault in the page for the
process, and in the meantime task switch.

If vs dirty is not already set, the kernel won't know to save vector
state on task switch."

Do a mark_vs_dirty() before both loads and stores.

[1] https://lore.kernel.org/qemu-riscv/72c7503b-0f43-44b8-aa82-fbafed2aac0c@linaro.org/

Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20240306171932.549549-2-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
target/riscv/insn_trans/trans_rvv.c.inc