From: David Vrabel <david.vrabel@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: David Vrabel <dvrabel@cantab.net>,
xen-devel <xen-devel@lists.xenproject.org>,
Keir Fraser <keir@xen.org>
Subject: Re: [PATCH 1/2] events/fifo: don't spin indefinitely when setting LINK
Date: Mon, 11 Nov 2013 16:56:53 +0000 [thread overview]
Message-ID: <52810C55.6070107@citrix.com> (raw)
In-Reply-To: <52811626020000780010206E@nat28.tlf.novell.com>
On 11/11/13 16:38, Jan Beulich wrote:
>>>> On 11.11.13 at 17:03, David Vrabel <david.vrabel@citrix.com> wrote:
>
>> + w = read_atomic(word);
>> +
>> + for ( try = 0; try < 4; try++ )
>> + {
>> + ret = try_set_link(word, &w, link);
>> + if ( ret >= 0 )
>> + {
>> + clear_bit(EVTCHN_FIFO_BUSY, word);
>
> Considering that this is another atomic operation, wouldn't it
> make sense to have the cmpxchg() at once clear the flag,
> and hence you'd need to clear it here only when ret == 0
> (which I understand isn't the common case)?
The common case (I believe, but haven't measured it) is the first
try_set_link() call without BUSY set.
In the loop, I suspect the mostly likely write by the guest is clearing
LINKED, i.e., ret == 0.
Still, it seems easy enough to have:
for ( try = 0; try < 4; try++ )
{
ret = try_set_link(word, &w, link);
if ( ret >= 0 )
{
if ( ret == 0 )
clear_bit(EVTCHN_FIFO_BUSY, word);
return ret;
}
}
David
next prev parent reply other threads:[~2013-11-11 16:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-11 16:03 [PATCHv3 0/2] Xen: FIFO-based event channel ABI fixes David Vrabel
2013-11-11 16:03 ` [PATCH 1/2] events/fifo: don't spin indefinitely when setting LINK David Vrabel
2013-11-11 16:38 ` Jan Beulich
2013-11-11 16:56 ` David Vrabel [this message]
2013-11-11 17:03 ` Jan Beulich
2013-11-11 16:03 ` [PATCH 2/2] events/fifo: don't corrupt queues if an old tail moves queues David Vrabel
2013-11-11 16:46 ` Jan Beulich
2013-11-11 17:47 ` David Vrabel
2013-11-12 8:14 ` Jan Beulich
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=52810C55.6070107@citrix.com \
--to=david.vrabel@citrix.com \
--cc=JBeulich@suse.com \
--cc=dvrabel@cantab.net \
--cc=keir@xen.org \
--cc=xen-devel@lists.xenproject.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.