On 8/26/25 10:47, Igor Mammedov wrote:
While overhead might be issue, it's better to have correcteness 1st.
(that's why blanket tree wide change to make sure we don't miss places that
set/test interrupts).
Looking more at it, I found at least one place that sets interrupts
without bql:
if (ctl_has_irq(env)) {
cpu_set_interrupt(cs, CPU_INTERRUPT_VIRQ);
}
I'm going to squash this in:
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 1dee9d4c76e..5c3397fe108 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -959,12 +959,13 @@ static inline bool cpu_test_interrupt(CPUState *cpu, int
mask)
* @cpu: The CPU to set pending interrupt(s) on.
* @mask: The interrupts to set.
*
- * Sets interrupts in @mask as pending on @cpu.
+ * Sets interrupts in @mask as pending on @cpu. Unlike @cpu_interrupt,
+ * this does not kick the vCPU.
*/
static inline void cpu_set_interrupt(CPUState *cpu, int mask)
{
- qatomic_store_release(&cpu->interrupt_request,
- cpu->interrupt_request | mask);
+ /* Pairs with cpu_test_interrupt(). */
+ qatomic_or(&cpu->interrupt_request, mask);
}
/**