lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1446088263.8018.435.camel@redhat.com>
Date:	Wed, 28 Oct 2015 21:11:03 -0600
From:	Alex Williamson <alex.williamson@...hat.com>
To:	Paolo Bonzini <pbonzini@...hat.com>
Cc:	Yunhong Jiang <yunhong.jiang@...ux.intel.com>, kvm@...r.kernel.org,
	linux-kernel@...r.kernel.org, Marcelo Tosatti <mtosatti@...hat.com>
Subject: Re: [RFC PATCH] VFIO: Add a parameter to force nonthread IRQ

On Wed, 2015-10-28 at 18:05 +0100, Paolo Bonzini wrote:
> 
> On 28/10/2015 17:00, Alex Williamson wrote:
> > > Alex, would it make sense to use the IRQ bypass infrastructure always,
> > > not just for VT-d, to do the MSI injection directly from the VFIO
> > > interrupt handler and bypass the eventfd?  Basically this would add an
> > > RCU-protected list of consumers matching the token to struct
> > > irq_bypass_producer, and a
> > > 
> > > 	int (*inject)(struct irq_bypass_consumer *);
> > > 
> > > callback to struct irq_bypass_consumer.  If any callback returns true,
> > > the eventfd is not signaled.
> >
> > Yeah, that might be a good idea, it's probably more plausible than
> > making the eventfd_signal() code friendly to call from hard interrupt
> > context.  On the vfio side can we use request_threaded_irq() directly
> > for this?
> 
> I don't know if that gives you a non-threaded IRQ with the real-time
> kernel...  CCing Marcelo to get some insight.
> 
> > Making the hard irq handler return IRQ_HANDLED if we can use
> > the irq bypass manager or IRQ_WAKE_THREAD if we need to use the eventfd.
> > I think we need some way to get back to irq thread context to use
> > eventfd_signal().
> 
> 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.  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,

Alex

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ