All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Butsykin <pbutsykin@virtuozzo.com>
To: Sergio Lopez <slp@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, Fam Zheng <famz@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3] util/async: use atomic_mb_set in qemu_bh_cancel
Date: Wed, 8 Nov 2017 17:32:23 +0300	[thread overview]
Message-ID: <baa6250c-cb3f-76cd-2562-f7e89f418be5@virtuozzo.com> (raw)
In-Reply-To: <CAAiTLFXHC5LS7NdmL6oO+QfiLh1fj+k8_74OnH6TFwzDx5EAgw@mail.gmail.com>

On 08.11.2017 17:24, Sergio Lopez wrote:
> On Wed, Nov 8, 2017 at 3:15 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
>> On 08/11/2017 15:10, Sergio Lopez wrote:
>>>> I'm not quite sure that the pre-fetched is involved in this issue,
>>>> because pre-fetch reading a certain addresses should be invalidated by
>>>> write on another core to the same addresses. In our case write
>>>> req->state = THREAD_DONE should invalidate read req->state == THREAD_DONE.
>>>> I am inclined to think that there is a memory-reordering read with
>>>> write. It's a very real case for x86 and I don't see the reasons which
>>>> can prevent it:
>>>>
>>> Yes, you're right. This is actually a memory reordering issue. I'm
>>> going to rewrite that paragraph.
>>
>> Well, memory reordering _is_ caused by speculative prefetching, delayed
>> cache invalidation (store buffers), and so on.
>>
>> But it's probably better indeed to replace "pre-fetched" with
>> "outdated".  Whoever commits the patch can do the substitution (I can too).
>>
> 
> Alternatively, if we want to explicitly mention the memory barrier, we
> can replace the third paragraph with something like this:
> 
> <snip>
> This was considered to be safe, as the completion function restarts the
> loop just after the call to qemu_bh_cancel. But, as this loop lacks a HW
> memory barrier, the read of req->state may actually happen _before_ the
> call, seeing it still as THREAD_QUEUED, and ending the completion
> function without having processed a pending TPE linked at pool->head:
> </snip>

Yes, that's better. Thank you.

> ---
> Sergio
> 

  reply	other threads:[~2017-11-08 14:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-08  6:34 [Qemu-devel] [PATCH v3] util/async: use atomic_mb_set in qemu_bh_cancel Sergio Lopez
2017-11-08  9:24 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2017-11-08 13:50 ` [Qemu-devel] " Pavel Butsykin
2017-11-08 14:10   ` Sergio Lopez
2017-11-08 14:15     ` Paolo Bonzini
2017-11-08 14:24       ` Sergio Lopez
2017-11-08 14:32         ` Pavel Butsykin [this message]
2017-11-08 19:21           ` Stefan Hajnoczi
2017-11-08 16:36       ` Pavel Butsykin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=baa6250c-cb3f-76cd-2562-f7e89f418be5@virtuozzo.com \
    --to=pbutsykin@virtuozzo.com \
    --cc=famz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=slp@redhat.com \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.