All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel@lists.xenproject.org,
	David Vrabel <david.vrabel@citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>
Subject: Re: [PATCHv1 1/2] passthrough: use per-interrupt lock when injecting an interrupt
Date: Fri, 30 Oct 2015 10:45:33 -0400	[thread overview]
Message-ID: <20151030144533.GB22037@l.oracle.com> (raw)
In-Reply-To: <5631F0DB02000078000AFBE9@prv-mh.provo.novell.com>

On Thu, Oct 29, 2015 at 03:11:39AM -0600, Jan Beulich wrote:
> >>> On 28.10.15 at 21:18, <konrad.wilk@oracle.com> wrote:
> >> > @@ -481,6 +489,8 @@ int pt_irq_destroy_bind(
> >> >      pirq = pirq_info(d, machine_gsi);
> >> >      pirq_dpci = pirq_dpci(pirq);
> >> >  
> >> > +    spin_lock(&pirq_dpci->lock);
> >> 
> >> Considering that code further down in this function checks
> >> pirq_dpci to be non-NULL, this doesn't look safe (or else those
> >> checks should go away, as after this addition they would be
> >> likely to trigger e.g. Coverity warnings).
> > 
> > ?  The checks are for pirq_dpci->dom.
> 
> What about
> 
>         /* clear the mirq info */
>         if ( pirq_dpci && (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
> 
> and
> 
>     if ( pirq_dpci && (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) &&
>          list_empty(&pirq_dpci->digl_list) )

Yes. I was looking at the function code (pt_irq_create_bind) not the
pt_irq_destroy_bind!
> 
> ? In fact I can't spot any access to pirq_dpci->dom in this function.
> 
> >> > @@ -675,7 +687,7 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
> >> >  {
> >> >      ASSERT(d->arch.hvm_domain.irq.dpci);
> >> >  
> >> > -    spin_lock(&d->event_lock);
> >> > +    spin_lock(&pirq_dpci->lock);
> >> >      if ( test_and_clear_bool(pirq_dpci->masked) )
> >> >      {
> >> >          struct pirq *pirq = dpci_pirq(pirq_dpci);
> >> 
> >> Along the same lines - it's not obvious that the uses of pirq here are
> >> safe with event_lock no longer held. In particular I wonder about
> >> send_guest_pirq() - despite the other use in __do_IRQ_guest() not
> >> doing any locking either I'm not convinced this is correct.
> > 
> > 
> > It seems that the event channel mechanism only uses the event channel
> > lock when expanding and initializing (FIFO). For the old mechanism
> > it was for binding, closing (uhuh), status, reset, and set_priority.
> 
> Well, the event lock is also used for some pIRQ management iirc.

Correct - pirq_guest_bind, pirq_guest_unbind, map_domain_pirq,
map_domain_emuirq_pirq, unmap_domain_pirq_emuirq, and so on.

> 
> Jan
> 

  reply	other threads:[~2015-10-30 14:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-23 11:05 passthrough: improve interrupt injection locking David Vrabel
2015-10-23 11:05 ` [PATCHv1 1/2] passthrough: use per-interrupt lock when injecting an interrupt David Vrabel
2015-10-27 11:56   ` Jan Beulich
2015-10-28 20:18     ` Konrad Rzeszutek Wilk
2015-10-29  9:11       ` Jan Beulich
2015-10-30 14:45         ` Konrad Rzeszutek Wilk [this message]
2015-10-23 11:05 ` [PATCHv1 2/2] passthrough: improve locking when iterating over interrupts bound to VMs David Vrabel
2015-10-27 12:44   ` Jan Beulich
2015-10-27 13:11     ` David Vrabel
2015-10-28 20:42   ` Konrad Rzeszutek Wilk
2015-10-23 12:37 ` passthrough: improve interrupt injection locking Ian Campbell
2015-10-23 12:38   ` David Vrabel
2015-10-23 12:45     ` Ian Campbell

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=20151030144533.GB22037@l.oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=david.vrabel@citrix.com \
    --cc=ian.campbell@citrix.com \
    --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.