From: David Vrabel <david.vrabel@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>, Keir Fraser <keir@xen.org>
Subject: Re: [PATCH 3/3] evtchn/fifo: don't spin indefinitely when setting LINK
Date: Mon, 4 Nov 2013 16:30:33 +0000 [thread overview]
Message-ID: <5277CBA9.1060006@citrix.com> (raw)
In-Reply-To: <5277C3EC02000078000FF21F@nat28.tlf.novell.com>
On 04/11/13 14:57, Jan Beulich wrote:
>>>> On 04.11.13 at 15:52, David Vrabel <david.vrabel@citrix.com> wrote:
>> On 04/11/13 14:39, Jan Beulich wrote:
>>>>>> On 31.10.13 at 16:03, David Vrabel <david.vrabel@citrix.com> wrote:
>>>> If the buggy or malicious guest does cause the loop to exit early, the
>>>> newly pending event will be unreachable by the guest and it and
>>>> subsequent events may be lost.
>>>
>>> ... yet here it is not really clear which guest the last "guest" refers
>>> to (i.e. it's fine if the malicious guest harms itself, but the change
>>> would be pointless if the malicious guest could still harm the other
>>> one).
>>
>> The malicious guest loses the event.
>
> So then "that guest" would perhaps be more precise than "the
> guest"?
Yes. I'll improve the commit message to be clearer.
>>>> @@ -90,6 +92,8 @@ static void evtchn_fifo_set_pending(struct vcpu *v, struct evtchn *evtchn)
>>>> event_word_t *tail_word;
>>>> bool_t linked = 0;
>>>>
>>>> + evtchn->q = q;
>>>> +
>>>> spin_lock_irqsave(&q->lock, flags);
>>>>
>>>> /*
>>>
>>> I fail to see how this change is related to the rest of the patch.
>>
>> This is needed so the correct queue lock is used in evtchn_fifo_unmask().
>
> I guessed that, but I wasn't able to immediately see why that would
> not have been a requirement before.
An event now has two queues associated with it.
1. The queue it is supposed to be on. This is found with
evtchn->notify_vcpu_id and evtchn->priority when an event is being linked.
2. The queue the event is on right now (the new evtchn->q), until this
patch we didn't care which queue an event was on, only that it was on
some queue.
These are not necessarily the same since an event may be moved between
VCPUs or have its priority changed while it is already on a queue.
Some additional notes on the locking:
The locking in the FIFO-based ABI is designed on the assumption that
every hypervisor operation on an event channel (set pending, unmask) is
done while holding a per-event channel spin lock.
Currently, the per-event locking is done with the coarser per-domain
event_lock.
The queue lock serializes adding events and clearing MASKED on tail events.
The event lock also protects evtchn->q and the evtchn->q->tail ==
evtchn->port test.
David
next prev parent reply other threads:[~2013-11-04 16:30 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-31 15:03 [PATCHv2 0/3] Xen: FIFO-based event channel ABI fixes David Vrabel
2013-10-31 15:03 ` [PATCH 1/3] MAINTAINERS: Add FIFO-based event channel ABI maintainer David Vrabel
2013-11-04 14:29 ` Jan Beulich
2013-11-05 21:06 ` Keir Fraser
2013-11-06 11:49 ` David Vrabel
2013-11-06 12:40 ` Jan Beulich
2013-10-31 15:03 ` [PATCH 2/3] evtchn: don't lose pending state if FIFO event array page is missing David Vrabel
2013-11-04 14:29 ` Jan Beulich
2013-11-05 21:07 ` Keir Fraser
2013-10-31 15:03 ` [PATCH 3/3] evtchn/fifo: don't spin indefinitely when setting LINK David Vrabel
2013-10-31 18:13 ` Boris Ostrovsky
2013-11-04 14:39 ` Jan Beulich
2013-11-04 14:52 ` David Vrabel
2013-11-04 14:57 ` Jan Beulich
2013-11-04 16:30 ` David Vrabel [this message]
2013-11-05 14:18 ` Jan Beulich
2013-11-04 15:07 ` Ian Campbell
2013-11-04 15:11 ` David Vrabel
2013-11-05 14:19 ` Jan Beulich
2013-11-05 14:25 ` Jan Beulich
2013-11-06 13:38 ` David Vrabel
2013-11-06 15:01 ` Boris Ostrovsky
2013-11-06 15:07 ` David Vrabel
2013-11-10 21:21 ` Matt Wilson
2013-10-31 15:13 ` [PATCHv2 0/3] Xen: FIFO-based event channel ABI fixes David Vrabel
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=5277CBA9.1060006@citrix.com \
--to=david.vrabel@citrix.com \
--cc=JBeulich@suse.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).