On Mon, 25 Aug 2025 13:46:45 +0530
Harsh Prateek Bora <hars...@linux.ibm.com> wrote:

> On 8/21/25 21:26, Igor Mammedov wrote:
> > the helpers form load-acquire/store-release pair and use them to replace
> > open-coded checkers/setters consistently across the code, which
> > ensures that appropriate barriers are in place in case checks happen
> > outside of BQL.
> > 
> > Signed-off-by: Igor Mammedov <imamm...@redhat.com>
> > Reviewed-by: Peter Xu <pet...@redhat.com>
> > Reviewed-by: Jason J. Herne <jjhe...@linux.ibm.com>
> > ---
...
> > --- a/accel/tcg/cpu-exec.c
> > +++ b/accel/tcg/cpu-exec.c
> > @@ -778,7 +778,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
> >        */
> >       qatomic_set_mb(&cpu->neg.icount_decr.u16.high, 0);
> >   
> > -    if (unlikely(qatomic_read(&cpu->interrupt_request))) {
> > +    if (unlikely(cpu_test_interrupt(cpu, ~0))) {
> >           int interrupt_request;
> >           bql_lock();
> >           interrupt_request = cpu->interrupt_request;
> > @@ -786,7 +786,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
> >               /* Mask out external interrupts for this step. */
> >               interrupt_request &= ~CPU_INTERRUPT_SSTEP_MASK;
> >           }
> > -        if (interrupt_request & CPU_INTERRUPT_DEBUG) {
> > +        if (cpu_test_interrupt(cpu, CPU_INTERRUPT_DEBUG)) {
> >               cpu->interrupt_request &= ~CPU_INTERRUPT_DEBUG;  
> 
> Do we need a helper for instances like these (logical &) as well ?
> I see a couple more such instances below.

there is more than a couple tree wide,
perhaps they are candidate for replacement with already existing
cpu_reset_interrupt().
Though I'd prefer to do it on top of this series if necessary.



Reply via email to