mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Jan Kiszka <jan.kiszka@web.de>, Avi Kivity <avi@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	kvm <kvm@vger.kernel.org>, Tom Lyon <pugs@cisco.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH v3 2/4] genirq: Inform handler about line sharing state
Date: Wed, 15 Dec 2010 15:49:27 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.2.00.1012151534540.12146@localhost6.localdomain6> (raw)
In-Reply-To: <4D08CE44.6000407@siemens.com>

On Wed, 15 Dec 2010, Jan Kiszka wrote:

> Am 15.12.2010 14:04, Thomas Gleixner wrote:
> > On Wed, 15 Dec 2010, Jan Kiszka wrote:
> >> Am 14.12.2010 21:54, Thomas Gleixner wrote:
> >>> On Mon, 13 Dec 2010, Jan Kiszka wrote:
> >>>> @@ -943,6 +950,9 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id)
> >>>>  	/* Make sure it's not being used on another CPU: */
> >>>>  	synchronize_irq(irq);
> >>>>  
> >>>> +	if (single_handler)
> >>>> +		desc->irq_data.drv_status &= ~IRQS_SHARED;
> >>>> +
> >>>
> >>> What's the reason to clear this flag outside of the desc->lock held
> >>> region.
> >>
> >> We need to synchronize the irq first before clearing the flag.
> >>
> >> The problematic scenario behind this: An IRQ started in shared mode,
> >> this the line was unmasked after the hardirq. Now we clear IRQS_SHARED
> >> before calling into the threaded handler. And that handler may now think
> >> that the line is still masked as IRQS_SHARED is set.
> > 
> > That should read "not set" I guess.
> 
> Can't remember who wrote this, but that guy might have been too tired
> for clear sentences: Yes, of course, we could run into troubles, if
> IRQS_SHARED was _not_ set while the IRQ line is unmasked between hard
> and threaded handler.

Right.

As a side note, the current implementation requires that you lookup
irq_data.drv_status for every invocation of the handler or have a
reference to irq_data.drv_status somewhere locally, which I don't like
either.

I have an evil and nasy idea how to avoid that, need to look how ugly
it gets. Worst case we need to go back to that notification thing
which I wanted really avoid in the first place.
 
Though I like the register_mutex idea which came out of this a lot as
it allows us to reduce desc->lock held and interrupt disabled regions
quite nicely.

/me goes back to stare at the code

> > Hmm, needs more thoughts :(
> 
> Be warned, might be painful.

Bah, my brain became pain resistant when I started hacking that code.

Thanks,

	tglx

  reply	other threads:[~2010-12-15 14:50 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-13 22:59 [PATCH v3 0/4] KVM & genirq: Enable adaptive IRQ sharing for passed-through devices Jan Kiszka
2010-12-13 22:59 ` [PATCH v3 1/4] genirq: Introduce driver-readable IRQ status word Jan Kiszka
2010-12-14 20:47   ` Thomas Gleixner
2010-12-14 23:10     ` Jan Kiszka
2010-12-13 22:59 ` [PATCH v3 2/4] genirq: Inform handler about line sharing state Jan Kiszka
2010-12-14 20:54   ` Thomas Gleixner
2010-12-14 23:00     ` Jan Kiszka
2010-12-15 13:04       ` Thomas Gleixner
2010-12-15 14:18         ` Jan Kiszka
2010-12-15 14:49           ` Thomas Gleixner [this message]
2010-12-15 15:41           ` Thomas Gleixner
2010-12-15 15:49             ` Jan Kiszka
2010-12-15 16:02               ` Thomas Gleixner
2010-12-14 21:46   ` Thomas Gleixner
2010-12-14 23:01     ` Jan Kiszka
2010-12-15  8:05       ` Thomas Gleixner
2010-12-15  9:37         ` Jan Kiszka
2010-12-15  9:48           ` Thomas Gleixner
2010-12-16 13:13   ` Thomas Gleixner
2010-12-16 20:26     ` Jan Kiszka
2010-12-16 21:28       ` change of email address: pugs@cisco.com -> pugs@ieee.org Tom Lyon
2010-12-17  8:18       ` [PATCH v3 2/4] genirq: Inform handler about line sharing state Jan Kiszka
2010-12-17 10:23         ` Thomas Gleixner
2010-12-17 10:31           ` Jan Kiszka
2010-12-17 10:41             ` Thomas Gleixner
2010-12-17 10:48               ` Jan Kiszka
2010-12-17 15:25                 ` Thomas Gleixner
2010-12-17 16:06                   ` Jan Kiszka
2010-12-17 16:32                     ` Thomas Gleixner
2010-12-18 18:11                       ` Michael S. Tsirkin
2010-12-13 22:59 ` [PATCH v3 3/4] genirq: Add support for IRQF_COND_ONESHOT Jan Kiszka
2010-12-13 22:59 ` [PATCH v3 4/4] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices Jan Kiszka
2010-12-14  8:53 ` [PATCH v3 0/4] KVM & genirq: Enable adaptive IRQ sharing for passed-through devices Avi Kivity
2010-12-14 22:01 ` Thomas Gleixner

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=alpine.LFD.2.00.1012151534540.12146@localhost6.localdomain6 \
    --to=tglx@linutronix.de \
    --cc=alex.williamson@redhat.com \
    --cc=avi@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=jan.kiszka@web.de \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pugs@cisco.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®