Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tcg: Do not elide memory barriers for !CF_PARALLEL in system mode #236

Merged
merged 1 commit into from
Aug 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion tcg/tcg-op.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,19 @@ void tcg_gen_op6(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3,

void tcg_gen_mb(TCGBar mb_type)
{
if (tcg_ctx->tb_cflags & CF_PARALLEL) {
#ifdef CONFIG_USER_ONLY
bool parallel = tcg_ctx->tb_cflags & CF_PARALLEL;
#else
/*
* It is tempting to elide the barrier in a uniprocessor context.
* However, even with a single cpu we have i/o threads running in
* parallel, and lack of memory order can result in e.g. virtio
* queue entries being read incorrectly.
*/
bool parallel = true;
#endif

if (parallel) {
tcg_gen_op1(INDEX_op_mb, mb_type);
}
}
Expand Down
Loading