linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yunhong Jiang <yunhong.jiang@linux.intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Alex Williamson <alex.williamson@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Marcelo Tosatti <mtosatti@redhat.com>
Subject: Re: [RFC PATCH] VFIO: Add a parameter to force nonthread IRQ
Date: Thu, 29 Oct 2015 23:16:46 -0700	[thread overview]
Message-ID: <20151030061646.GA18979@jnakajim-build> (raw)
In-Reply-To: <5631EAC8.1080805@redhat.com>

On Thu, Oct 29, 2015 at 10:45:44AM +0100, Paolo Bonzini wrote:
> 
> 
> On 29/10/2015 04:11, Alex Williamson wrote:
> > > The irqfd is already able to schedule a work item, because it runs with
> > > interrupts disabled, so I think we can always return IRQ_HANDLED.
> >
> > I'm confused by this.  The problem with adding IRQF_NO_THREAD to our
> > current handler is that it hits the spinlock that can sleep in
> > eventfd_signal() and the waitqueue further down the stack before we get
> > to the irqfd.  So if we split to a non-threaded handler vs a threaded
> > handler, where the non-threaded handler either returns IRQ_HANDLED or
> > IRQ_WAKE_THREAD to queue the threaded handler, there's only so much that
> > the non-threaded handler can do before we start running into the same
> > problem.
> 
> You're right.  I thought schedule_work used raw spinlocks (and then
> everything would be done in the inject callback), but I was wrong.
> 
> Basically where irqfd_wakeup now does schedule_work, it would need to
> return IRQ_WAKE_THREAD.  The threaded handler then can just do the
> eventfd_signal.
> 

And with this change, we even don't need the module option anymore, we first 
try the primary handler, which is in hard irq context, and if failed, then
threaded irq handler. Am I right?

Paolo/Alex, do you want to work on the patch yourself? If not, I will be 
happy to try this method.

Thanks
--jyh

> Paolo
> 
> > I think that means that the non-threaded handler needs to
> > return IRQ_WAKE_THREAD if we need to use the current eventfd_signal()
> > path, such as if the bypass path is not available.  If we can get
> > through the bypass path and the KVM irqfd side is safe for the
> > non-threaded handler, inject succeeds and we return IRQ_HANDLED, right?
> > Thanks,

  reply	other threads:[~2015-10-30  6:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-27  1:20 [RFC PATCH] VFIO: Add a parameter to force nonthread IRQ Yunhong Jiang
2015-10-27  3:37 ` Alex Williamson
2015-10-27  6:35   ` Yunhong Jiang
2015-10-27  9:29     ` Paolo Bonzini
2015-10-27 21:26       ` Yunhong Jiang
2015-10-28  0:44         ` Paolo Bonzini
2015-10-28 16:00           ` Alex Williamson
2015-10-28 17:05             ` Paolo Bonzini
2015-10-28 23:54               ` Marcelo Tosatti
2015-10-29  3:11               ` Alex Williamson
2015-10-29  9:45                 ` Paolo Bonzini
2015-10-30  6:16                   ` Yunhong Jiang [this message]
2015-11-02  9:17                     ` Paolo Bonzini
2015-10-28 17:50           ` Yunhong Jiang
2015-10-28 18:18             ` Alex Williamson
2015-10-28 21:46               ` Yunhong Jiang
2015-10-28 18:28             ` Paolo Bonzini

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=20151030061646.GA18979@jnakajim-build \
    --to=yunhong.jiang@linux.intel.com \
    --cc=alex.williamson@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.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;
as well as URLs for NNTP newsgroup(s).