From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Julien Grall <julien.grall@arm.com>
Cc: Juergen Gross <jgross@suse.com>,
xen-devel <xen-devel@lists.xenproject.org>,
Stefano Stabellini <sstabellini@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Dave P Martin <dave.martin@arm.com>
Subject: Re: xen/evtchn and forced threaded irq
Date: Wed, 20 Feb 2019 12:07:26 -0500 [thread overview]
Message-ID: <21214d47-9c68-e6bf-007a-4047cc2b02f9__12462.0829870523$1550682519$gmane$org@oracle.com> (raw)
In-Reply-To: <a872d480-9f1b-6cd7-e507-ac4fcdf705af@arm.com>
On 2/20/19 9:15 AM, Julien Grall wrote:
> Hi Boris,
>
> Thank you for your answer.
>
> On 20/02/2019 00:02, Boris Ostrovsky wrote:
>> On Tue, Feb 19, 2019 at 05:31:10PM +0000, Julien Grall wrote:
>>> Hi all,
>>>
>>> I have been looking at using Linux RT in Dom0. Once the guest is
>>> started,
>>> the console is ending to have a lot of warning (see trace below).
>>>
>>> After some investigation, this is because the irq handler will now
>>> be threaded.
>>> I can reproduce the same error with the vanilla Linux when passing
>>> the option
>>> 'threadirqs' on the command line (the trace below is from 5.0.0-rc7
>>> that has
>>> not RT support).
>>>
>>> FWIW, the interrupt for port 6 is used to for the guest to
>>> communicate with
>>> xenstore.
>>>
>>> From my understanding, this is happening because the interrupt
>>> handler is now
>>> run in a thread. So we can have the following happening.
>>>
>>> Interrupt context | Interrupt thread
>>> |
>>> receive interrupt port 6 |
>>> clear the evtchn port |
>>> set IRQF_RUNTHREAD |
>>> kick interrupt thread |
>>> | clear IRQF_RUNTHREAD
>>> | call evtchn_interrupt
>>> receive interrupt port 6 |
>>> clear the evtchn port |
>>> set IRQF_RUNTHREAD |
>>> kick interrupt thread |
>>> | disable interrupt port 6
>>> | evtchn->enabled = false
>>> | [....]
>>> |
>>> | *** Handling the second
>>> interrupt ***
>>> | clear IRQF_RUNTHREAD
>>> | call evtchn_interrupt
>>> | WARN(...)
>>>
>>> I am not entirely sure how to fix this. I have two solutions in mind:
>>>
>>> 1) Prevent the interrupt handler to be threaded. We would also need to
>>> switch from spin_lock to raw_spin_lock as the former may sleep on
>>> RT-Linux.
>>>
>>> 2) Remove the warning
>>
>> I think access to evtchn->enabled is racy so (with or without the
>> warning) we can't use it reliably.
>
> Thinking about it, it would not be the only issue. The ring is sized
> to contain only one instance of the same event. So if you receive
> twice the event, you may overflow the ring.
Hm... That's another argument in favor of "unthreading" the handler.
>
>>
>> Another alternative could be to queue the irq if !evtchn->enabled and
>> handle it in evtchn_write() (which is where irq is supposed to be
>> re-enabled).
> What do you mean by queue? Is it queueing in the ring?
No, I was thinking about having a new structure for deferred interrupts.
-boris
> If so, wouldn't it be racy as described above?
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-02-20 17:07 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <5e256d9a-572c-e01e-7706-407f99245b00@arm.com>
2019-02-20 0:02 ` xen/evtchn and forced threaded irq Boris Ostrovsky
[not found] ` <20190220000209.GA4091@localhost.localdomain>
2019-02-20 14:15 ` Julien Grall
[not found] ` <a872d480-9f1b-6cd7-e507-ac4fcdf705af@arm.com>
2019-02-20 17:07 ` Boris Ostrovsky [this message]
[not found] ` <21214d47-9c68-e6bf-007a-4047cc2b02f9@oracle.com>
2019-02-20 18:05 ` Julien Grall
[not found] ` <8f7445d7-fa50-f3e9-44f5-cc2aebd020f4@arm.com>
2019-02-20 20:04 ` Boris Ostrovsky
[not found] ` <15bc52cb-82d8-4d2c-e5a8-c6ae8de90276@oracle.com>
2019-02-20 20:46 ` Julien Grall
[not found] ` <5df8888a-4a29-fccd-bac2-a9c170244029@arm.com>
2019-02-20 21:46 ` Boris Ostrovsky
[not found] ` <1574a7fe-a5ac-4bc2-d3f0-967d8d01e5f1@oracle.com>
2019-02-20 22:03 ` Julien Grall
[not found] ` <1100e6b1-6fa8-06f0-8ecc-b0699a2ce5f4@arm.com>
2019-02-21 8:07 ` Roger Pau Monné
[not found] ` <20190221080752.zy2qlzb4vi7tbu3p@Air-de-Roger>
2019-02-21 8:38 ` Julien Grall
2019-02-21 8:52 ` Juergen Gross
2019-02-21 9:14 ` Roger Pau Monné
[not found] ` <20190221091431.vqi53op37mvhi25z@Air-de-Roger>
2019-02-21 20:46 ` Julien Grall
2020-04-27 23:20 ` [Xen-devel] " Stefano Stabellini
2019-02-22 11:44 ` Jan Beulich
2019-02-22 12:38 ` Oleksandr Andrushchenko
[not found] ` <f7e78bf6-6e65-6d6c-c1ad-dca7f1e66b17@gmail.com>
2019-02-22 13:33 ` Julien Grall
[not found] ` <fe44917f-bbe9-3e0e-fdda-2eb4db9f25c2@arm.com>
2019-02-25 13:24 ` Oleksandr Andrushchenko
[not found] ` <13a9616c-2d9a-f90b-3358-f2dcadbbb64d@gmail.com>
2019-02-25 13:55 ` Julien Grall
[not found] ` <dbfd87e9-48fc-f641-9e24-ddb6c4f61135@arm.com>
2019-02-25 14:08 ` Oleksandr Andrushchenko
[not found] ` <1aeda04d-3420-fa50-ad33-a0b3e981f5e4@gmail.com>
2019-02-25 15:26 ` Julien Grall
2019-02-26 9:14 ` Roger Pau Monné
[not found] ` <20190226091420.klgldhotiecezw6h@Air-de-Roger>
2019-02-26 9:30 ` Andrew Cooper
[not found] ` <038b837c-63c0-afb7-ca7b-75f61af7518e@citrix.com>
2019-02-26 9:44 ` Roger Pau Monné
2019-02-26 9:45 ` Paul Durrant
[not found] ` <20190226094459.33y2ygrjei3sf3gk@Air-de-Roger>
2019-02-26 10:03 ` Julien Grall
[not found] ` <21c331d5-0cfa-6f7e-3db4-40b7ece45bc8@arm.com>
2019-02-26 10:17 ` Roger Pau Monné
[not found] ` <20190226101721.kh5vbrqdlnrtvhwh@Air-de-Roger>
2019-02-26 10:26 ` Julien Grall
[not found] ` <cdd5781c-3a60-b9f7-205f-fadeee88206e@arm.com>
2019-02-26 11:02 ` Roger Pau Monné
[not found] ` <20190226110231.46luhevhlmefdldo@Air-de-Roger>
2019-02-27 11:09 ` Julien Grall
2019-02-21 8:17 ` Juergen Gross
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='21214d47-9c68-e6bf-007a-4047cc2b02f9__12462.0829870523$1550682519$gmane$org@oracle.com' \
--to=boris.ostrovsky@oracle.com \
--cc=dave.martin@arm.com \
--cc=jgross@suse.com \
--cc=julien.grall@arm.com \
--cc=linux-kernel@vger.kernel.org \
--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 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).