[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 01/11] util/qht: Document memory ordering ass
From: |
Sergey Fedorov |
Subject: |
Re: [Qemu-devel] [PATCH v3 01/11] util/qht: Document memory ordering assumptions |
Date: |
Fri, 15 Jul 2016 16:18:39 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 |
On 15/07/16 15:51, Paolo Bonzini wrote:
>
> On 15/07/2016 14:37, Sergey Fedorov wrote:
>> I understand why an implied wmb can be expected after the entry is
>> removed: so that the caller can trash the contents of the object
>> removed. However that would require double-check on lookup side to make
>> sure the entry hadn't been removed after the first lookup (something
>> like seqlock read side). But I have no idea why we might like to promise
>> wmb before the removal. Could you please share your point regarding this?
> The reasoning was to make qht_remove() "look to be ordered" with respect
> to writes. So anything after remove wouldn't bleed into it, nor would
> anything before.
>
> In the case of this series, it would let you remove the smp_wmb() after
> tb_mark_invalid(). However, it's also okay to only handle qht_insert()
> and qht_lookup(), and keep the memory barrier after the TB is marked
> invalid (though it is unnecessary).
>
I'm pretty sure the smp_wmb() after tb_mark_invalid() is unnecessary
anyway. We don't rely on it at all because we're to recheck for
tb_is_invalid() under tb_lock before tb_add_jump(). However we have to
invalidate the CPU state atomically since we're going to check for it
out of tb_lock.
Kind regards,
Sergey
- Re: [Qemu-devel] [PATCH v3 01/11] util/qht: Document memory ordering assumptions, (continued)
Re: [Qemu-devel] [PATCH v3 01/11] util/qht: Document memory ordering assumptions, Paolo Bonzini, 2016/07/13
Re: [Qemu-devel] [PATCH v3 01/11] util/qht: Document memory ordering assumptions, Sergey Fedorov, 2016/07/15
Re: [Qemu-devel] [PATCH v3 01/11] util/qht: Document memory ordering assumptions, Paolo Bonzini, 2016/07/15
Re: [Qemu-devel] [PATCH v3 01/11] util/qht: Document memory ordering assumptions,
Sergey Fedorov <=
[Qemu-devel] [PATCH v3 03/11] tcg: Prepare safe tb_jmp_cache lookup out of tb_lock, Sergey Fedorov, 2016/07/12
[Qemu-devel] [PATCH v3 02/11] cpu-exec: Pass last_tb by value to tb_find_fast(), Sergey Fedorov, 2016/07/12
[Qemu-devel] [PATCH v3 04/11] tcg: Prepare safe access to tb_flushed out of tb_lock, Sergey Fedorov, 2016/07/12
[Qemu-devel] [PATCH v3 05/11] target-i386: Remove redundant HF_SOFTMMU_MASK, Sergey Fedorov, 2016/07/12
[Qemu-devel] [PATCH v3 08/11] tcg: set up tb->page_addr before insertion, Sergey Fedorov, 2016/07/12