[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC 20/38] tcg/i386: implement fences
From: |
Emilio G. Cota |
Subject: |
Re: [Qemu-devel] [RFC 20/38] tcg/i386: implement fences |
Date: |
Mon, 24 Aug 2015 23:02:40 -0400 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Sun, Aug 23, 2015 at 18:32:51 -0700, Paolo Bonzini wrote:
>
>
> On 23/08/2015 17:23, Emilio G. Cota wrote:
> > + case INDEX_op_fence_load:
> > + tcg_out_fence(s, 0xe8);
> > + break;
> > + case INDEX_op_fence_full:
> > + tcg_out_fence(s, 0xf0);
> > + break;
> > + case INDEX_op_fence_store:
> > + tcg_out_fence(s, 0xf8);
> > + break;
> > +
>
> lfence and sfence are not needed in generated code; all loads are
> acquires and all stores are release on x86.
lfence and sfence here serve two purposes:
1) Template for other architectures
2) x86 code does sometimes have lfence/sfence (e.g. movntq+sfence),
so I guessed they should remain in the translated code.
If on x86 we always ignore the Write-Combining from the
guest, maybe we could claim the l/sfence pair here is really unnecessary.
I'm no x86 expert so for a first stab I decided to put them there.
I didn't intend to translate say *all* PPC/ARM load barriers
into lfences when generating x86, which is I think your point.
> Also, on targets that do not have MFENCE you want to generate something
> like "lock addl $0, (%esp)".
Good point, will fix.
Thanks,
Emilio
- [Qemu-devel] [RFC 11/38] qemu-thread: handle spurious futex_wait wakeups, (continued)
- [Qemu-devel] [RFC 11/38] qemu-thread: handle spurious futex_wait wakeups, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 13/38] cputlb: add physical address to CPUTLBEntry, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 14/38] softmmu: add helpers to get ld/st physical addresses, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 17/38] aie: add target helpers, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 15/38] radix-tree: add generic lockless radix tree module, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 16/38] aie: add module for Atomic Instruction Emulation, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 20/38] tcg/i386: implement fences, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 29/38] tcg: export have_tb_lock, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 25/38] cpu: add barriers around cpu->tcg_exit_req, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 23/38] cpu-exec: grab iothread lock during interrupt handling, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 24/38] cpu-exec: reset mmap_lock after exiting the CPU loop, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 09/38] rcu: fix comment with s/rcu_gp_lock/rcu_registry_lock/, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 30/38] translate-all: add tb_lock assertions, Emilio G. Cota, 2015/08/23