On 10/23/26 12:53, Stian Halseth wrote:
Hi Alex,
On Fri, 2026-10-23 at 18:05 +0100, Alex Bennée wrote:
I wonder how much:
/* flush must be done */
if (cpu_in_serial_context(cpu)) {
trace_tb_gen_code_buffer_overflow("tcg_tb_alloc");
tb_flush__exclusive_or_serial();
goto buffer_overflow;
}
actually saves? Because we are skipping both cleanup in cpu_loop_exit
(the mem helpers) and cpu_exec_longjmp_cleanup which we get to when
we jump out.
Not much, as far as I can measure. I timed the sparc64 reproducer with
-tb-size 1, where the buffer flushes constantly, so the worst case for
the longjmp, with three variants on current master:
- this patch (keep the shortcut, drop last_tb)
- flush in place, then leave through cpu_loop_exit()
- drop the shortcut, back to queue_tb_flush() + cpu_loop_exit()
All three fix the crash and pass test-xpage-chain and tb-link, and the
run times are within noise of each other.
Dropping the shortcut looks like the cleaner fix though. no last_tb
bookkeeping, and the cleanup you mention runs again. Richard, would you
prefer that as v2, or is there a case where the in-place retry matters,
e.g. cpu_exec_step_atomic?
I don't think in-place retry matters anywhere. I suspect it was a case
of premature optimization because "obviously" no other thread can
interfere here.
r~