All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Sergey Fedorov <serge.fdrv@gmail.com>, qemu-devel@nongnu.org
Cc: sergey.fedorov@linaro.org, alex.bennee@linaro.org
Subject: Re: [Qemu-devel] [PATCH] atomics: add volatile_read/volatile_set
Date: Mon, 18 Jul 2016 19:11:55 +0200	[thread overview]
Message-ID: <4c479cb3-a8ef-caab-4dbc-3bfd014c7a0a@redhat.com> (raw)
In-Reply-To: <578D0CD6.3080005@gmail.com>



On 18/07/2016 19:07, Sergey Fedorov wrote:
> On 18/07/16 20:00, Paolo Bonzini wrote:
>>
>> On 18/07/2016 18:57, Sergey Fedorov wrote:
>>> On 18/07/16 19:53, Paolo Bonzini wrote:
>>>> On 18/07/2016 18:52, Sergey Fedorov wrote:
>>>>> So how are we going to use them?
>>>> Instead of atomic_read/atomic_set when marking invalid TBs.
>>> But shouldn't they be atomic to avoid reading torn writes?
>> A torn write would probably fail to match anyway, but even if it doesn't
>> it is indistinguishable from a race, isn't it?
> 
> I'm afraid, torn write can happen to be a false match against a wrong
> TB. In case of a race with atomic access we either get the right TB or
> an invalid one which couldn't match any valid CPU state. Probably, we
> have to make sure (and document this) that TB invalidation process
> cannot make a partially invalidated TB which can match any meaningful
> CPU state.

x86 is atomic (because flags are 32-bit); those that have cs_base==0 are
safe against torn writes too.  Only SPARC perhaps could use
"tb->cs_base|=1" instead in case 0xffffffff........ matches another TB.

Paolo

>>
>> By the way, tb_cmp should also use volatile_read.
> 
> You are right, we must user the save type of access in tb_cmp().
> 
> Thanks,
> Sergey
> 

  reply	other threads:[~2016-07-18 17:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-18 14:17 [Qemu-devel] [PATCH] atomics: add volatile_read/volatile_set Paolo Bonzini
2016-07-18 16:52 ` Sergey Fedorov
2016-07-18 16:53   ` Paolo Bonzini
2016-07-18 16:57     ` Sergey Fedorov
2016-07-18 17:00       ` Paolo Bonzini
2016-07-18 17:07         ` Sergey Fedorov
2016-07-18 17:11           ` Paolo Bonzini [this message]
2016-07-18 17:17             ` Sergey Fedorov
2016-07-18 17:22               ` Paolo Bonzini
2016-07-18 17:25                 ` Sergey Fedorov
2016-07-18 17:28                   ` Paolo Bonzini
2016-07-18 17:31                     ` Sergey Fedorov
2016-07-18 17:58                       ` Paolo Bonzini
2016-07-18 19:04                         ` Sergey Fedorov
2016-07-18 20:54                           ` Paolo Bonzini

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=4c479cb3-a8ef-caab-4dbc-3bfd014c7a0a@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=serge.fdrv@gmail.com \
    --cc=sergey.fedorov@linaro.org \
    /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.