[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 13/34] tcg: Add atomic helpers

From: Leon Alrae
Subject: Re: [Qemu-devel] [PATCH v3 13/34] tcg: Add atomic helpers
Date: Tue, 13 Sep 2016 13:32:31 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Sep 12, 2016 at 09:13:10AM -0700, Richard Henderson wrote:
> On 09/12/2016 12:59 AM, Leon Alrae wrote:
> >On Fri, Sep 09, 2016 at 09:26:29AM -0700, Richard Henderson wrote:
> >>On 09/09/2016 07:46 AM, Leon Alrae wrote:
> >>>Wouldn't it be useful if tcg.h provided also aliases for _le/_be atomic
> >>>helpers (equivalent to helper_ret_X_mmu) so that in target-* code we 
> >>>wouldn't
> >>>need to care about the endianness (specifically I'm thinking about SC in 
> >>>MIPS
> >>>where I need to select between helper_atomic_cmpxchgl_le_mmu() and
> >>>helper_atomic_cmpxchgl_be_mmu()).
> >>
> >>Perhaps.  I would have hoped that you could do the SC inline now
> >>though, and tcg_gen_atomic_cmpxchg() will do the selection for you.
> >
> >On every SC we need to do the virtual -> physical address translation as we
> >have to compare the physical address against that of the preceeding LL.
> >This operation seems too complex to be inlined :(
> What happens if you do virtual address comparisons, like everyone
> else?  It might not be strictly correct, but in practice I bet its
> no worse than using cmpxchg in the first place.

Yeah, probably true. Moreover, MIPS Instruction Set Manual explicitly says
that an RMW sequence must use the same address in the LL and SC (virtual
address, physical address, cacheability and coherency attributes must be
identical). Otherwise the result of the SC is not predictable.

I'll try to come up with simpler SC implementation using virtual
addresses and tcg_gen_atomic_cmpxchg().


reply via email to

[Prev in Thread] Current Thread [Next in Thread]