From: Keir Fraser <keir.fraser@eu.citrix.com>
To: Jan Beulich <jbeulich@novell.com>
Cc: Yunhong Jiang <yunhong.jiang@intel.com>,
Haitao Shan <haitao.shan@intel.com>,
xen-devel@lists.xensource.com
Subject: Re: [PATCH] Re: Xen crash on dom0 shutdown
Date: Wed, 24 Sep 2008 12:45:52 +0100 [thread overview]
Message-ID: <C4FFE700.276F3%keir.fraser@eu.citrix.com> (raw)
In-Reply-To: <C4FFC32C.27684%keir.fraser@eu.citrix.com>
On 24/9/08 10:13, "Keir Fraser" <keir.fraser@eu.citrix.com> wrote:
>> How about this one? It doesn't exactly follow the path you suggested,
>> i.e. doesn't mess with event channels, but rather marks the
>> irq<->vector mapping as invalid, allowing only a subsequent event
>> channel unbind (i.e. close) to recover from that state (which seems
>> better in terms of requiring proper discipline in the guest, as it
>> prevents re-using the irq or vector without properly cleaning up).
>
> Yeah, this is the kind of thing I had in mind. I will work on this a bit more
> (e.g., need to synchronise on d->evtchn_lock to avoid racing
> EVTCHNOP_bind_pirq; also I'm afraid about leaking MSI vectors on domain
> destruction). Thanks.
Changeset 18539. I made the locking quite a bit stricter, by getting rid of
'irq_lock' and instead using 'evtchn_lock' (which may be better renamed now
to 'event_lock' since it isn't protecting just event channels now). Now the
pirq-to-vector mapping is protected by both evtchn_lock and irq_desc->lock.
A user of the mapping can protect themselves with either lock (whichever is
most convenient).
Some TODOs:
* There is no management of MSI vectors. They always leak! I didn't fix
that here since it isn't a mere synchronisation race; the code just isn't
there.
* I decided to WARN_ON(!spin_is_locked(&d->evtchn_lock)) in
pirq_guest_[un]bind(). The reason is that in any case those functions do not
expect to be re-entered -- they really want to be per-domain serialised.
Furthermore I am pretty certain that the HVM passthrough code is not
synchronising properly with changes to the pirq-to-vector mapping (it uses
domain_irq_to_vector() in many places with no care for locking) nor is it
synchronised with other users of pirq_guest_bind() --- a reasonable
semantics here would be that a domain pirq can be bound to once, either via
an event channel, or through a virtual PIC in HVM emulation context. I
therefore think that careful locking is required -- it may suffice to get
rid of (or at least make less use of) the hvm_domain.irq_lock and replace
its use with evtchn_lock (only consideration is that the latter is not
IRQ-safe). The WARN_ON() is a nice reminder of work to be done here. ;-)
Comments?
-- Keir
next prev parent reply other threads:[~2008-09-24 11:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-23 10:34 Xen crash on dom0 shutdown Jan Beulich
2008-09-23 11:27 ` Keir Fraser
2008-09-24 8:59 ` [PATCH] " Jan Beulich
2008-09-24 9:13 ` Keir Fraser
2008-09-24 11:31 ` Jiang, Yunhong
2008-09-24 11:45 ` Keir Fraser [this message]
2008-09-25 12:42 ` Shan, Haitao
2008-09-25 13:24 ` Jiang, Yunhong
2008-09-25 13:39 ` Keir Fraser
2008-09-25 14:17 ` Shan, Haitao
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=C4FFE700.276F3%keir.fraser@eu.citrix.com \
--to=keir.fraser@eu.citrix.com \
--cc=haitao.shan@intel.com \
--cc=jbeulich@novell.com \
--cc=xen-devel@lists.xensource.com \
--cc=yunhong.jiang@intel.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.