All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <Julien.Grall@arm.com>
To: "Roger Pau Monné" <roger.pau@citrix.com>,
	"Julien Grall" <julien.grall@gmail.com>
Cc: Juergen Gross <jgross@suse.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Marc Zyngier <Marc.Zyngier@arm.com>,
	Andrew Cooper <Andrew.Cooper3@citrix.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Jan Beulich <JBeulich@suse.com>,
	xen-devel <xen-devel@lists.xenproject.org>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Dave P Martin <Dave.Martin@arm.com>
Subject: Re: xen/evtchn and forced threaded irq
Date: Thu, 21 Feb 2019 20:46:31 +0000	[thread overview]
Message-ID: <e25aaeea-f6bf-1217-f416-726c4e3588f2__27997.4740509473$1550782059$gmane$org@arm.com> (raw)
In-Reply-To: <20190221091431.vqi53op37mvhi25z@Air-de-Roger>

Hi Roger,

On 21/02/2019 09:14, Roger Pau Monné wrote:
> On Thu, Feb 21, 2019 at 08:38:39AM +0000, Julien Grall wrote:
>> Hi Roger,
>>
>> On Thu, 21 Feb 2019, 08:08 Roger Pau Monné, <roger.pau@citrix.com> wrote:
>>
>>> FWIW, you can also mask the interrupt while waiting for the thread to
>>> execute the interrupt handler. Ie:
>>>
>>
>> Thank you for providing steps, however where would the masking be done? By
>> the irqchip or a custom solution?
>
> I'm not familiar with the irqchip infrastructure in Linux, what I
> proposed below is what FreeBSD does when running interrupt handlers in
> deferred threads IIRC.
>
> If irqchip has a specific handler to dispatch to a thread, then that's
> the place where the masking should happen. Likely, the unmasking
> should be done by the irq handling infrastructure after the thread
> executing the interrupt handler has finished.
>
> Isn't there a similar way to handle interrupts in threads for Linux?

Linux has a flag (IRQF_ONESHOT) to mask interrupt until the interrupt
handler has been run. It is set for all interrupts handler that have
been forced to be threaded.

However, it looks like the flag is been ignored by the irqchip handler
we use (handle_edge_irq). Doing a bit of digging, IRQF_ONESHOT use to be
handled in handle_edge_irq until the following commit from 2009:

commit 4dbc9ca219b0f294332e734528f7b82211700170
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Thu Aug 27 09:38:49 2009 +0200

     genirq: Do not mask oneshot edge type interrupts

     Masking oneshot edge type interrupts is wrong as we might lose an
     interrupt which is issued when the threaded handler is handling the
     device. We can keep the irq unmasked safely as with edge type
     interrupts there is no danger of interrupt floods. If the threaded
     handler has not yet finished then IRQTF_RUNTHREAD is set which will
     keep the handler thread active.

     Debugged and verified in preempt-rt.

     Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

Furthermore, it is pretty clear from the comment on top of
handle_edge_irq that the same interrupt can come-up before the first one
is one is handled by the associated event handler.

I am still trying to figure out whether the issue lies in the evtchn
driver or the Xen irqchip (events_base.c). I will have a closer look and
come back with updates here.

Cheers,

--
Julien Grall
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2019-02-21 20:46 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-19 17:31 xen/evtchn and forced threaded irq Julien Grall
2019-02-20  0:02 ` Boris Ostrovsky
2019-02-20 14:15   ` Julien Grall
2019-02-20 14:15   ` Julien Grall
2019-02-20 17:07     ` Boris Ostrovsky
2019-02-20 18:05       ` Julien Grall
2019-02-20 20:04         ` Boris Ostrovsky
2019-02-20 20:46           ` Julien Grall
2019-02-20 21:46             ` Boris Ostrovsky
2019-02-20 21:46             ` Boris Ostrovsky
2019-02-20 22:03               ` Julien Grall
2019-02-21  8:07                 ` Roger Pau Monné
2019-02-21  8:07                 ` [Xen-devel] " Roger Pau Monné
2019-02-21  8:38                   ` Julien Grall
2019-02-21  8:52                     ` [Xen-devel] " Juergen Gross
2019-02-21  8:52                     ` Juergen Gross
2019-02-21  9:14                     ` Roger Pau Monné
2019-02-21  9:14                     ` [Xen-devel] " Roger Pau Monné
2019-02-21 20:46                       ` Julien Grall
2019-02-21 20:46                       ` Julien Grall [this message]
2020-04-27 23:20                     ` Stefano Stabellini
2020-04-27 23:20                       ` Stefano Stabellini
2019-02-22 11:44                 ` Jan Beulich
2019-02-22 11:44                 ` Jan Beulich
2019-02-20 22:03               ` Julien Grall
2019-02-22 12:38             ` Oleksandr Andrushchenko
2019-02-22 12:38             ` [Xen-devel] " Oleksandr Andrushchenko
2019-02-22 13:33               ` Julien Grall
2019-02-25 13:24                 ` Oleksandr Andrushchenko
2019-02-25 13:24                 ` [Xen-devel] " Oleksandr Andrushchenko
2019-02-25 13:55                   ` Julien Grall
2019-02-25 13:55                   ` [Xen-devel] " Julien Grall
2019-02-25 14:08                     ` Oleksandr Andrushchenko
2019-02-25 14:08                     ` [Xen-devel] " Oleksandr Andrushchenko
2019-02-25 15:26                       ` Julien Grall
2019-02-25 15:26                       ` [Xen-devel] " Julien Grall
2019-02-26  9:14                     ` Roger Pau Monné
2019-02-26  9:14                     ` [Xen-devel] " Roger Pau Monné
2019-02-26  9:30                       ` Andrew Cooper
2019-02-26  9:30                       ` [Xen-devel] " Andrew Cooper
2019-02-26  9:44                         ` Roger Pau Monné
2019-02-26  9:44                         ` [Xen-devel] " Roger Pau Monné
2019-02-26 10:03                           ` Julien Grall
2019-02-26 10:03                           ` [Xen-devel] " Julien Grall
2019-02-26 10:17                             ` Roger Pau Monné
2019-02-26 10:17                             ` [Xen-devel] " Roger Pau Monné
2019-02-26 10:26                               ` Julien Grall
2019-02-26 10:26                               ` [Xen-devel] " Julien Grall
2019-02-26 11:02                                 ` Roger Pau Monné
2019-02-26 11:02                                 ` [Xen-devel] " Roger Pau Monné
2019-02-27 11:09                                   ` Julien Grall
2019-02-27 11:09                                   ` [Xen-devel] " Julien Grall
2019-02-26  9:45                         ` Paul Durrant
2019-02-26  9:45                         ` Paul Durrant
2019-02-22 13:33               ` Julien Grall
2019-02-20 20:46           ` Julien Grall
2019-02-20 20:04         ` Boris Ostrovsky
2019-02-20 18:05       ` Julien Grall
2019-02-20 17:07     ` Boris Ostrovsky
2019-02-20  0:02 ` Boris Ostrovsky
2019-02-21  8:17 ` Juergen Gross
2019-02-21  8:17 ` Juergen Gross
  -- strict thread matches above, loose matches on Subject: below --
2019-02-19 17:31 Julien Grall

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='e25aaeea-f6bf-1217-f416-726c4e3588f2__27997.4740509473$1550782059$gmane$org@arm.com' \
    --to=julien.grall@arm.com \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=Dave.Martin@arm.com \
    --cc=JBeulich@suse.com \
    --cc=Marc.Zyngier@arm.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jgross@suse.com \
    --cc=julien.grall@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --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.