From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Dave Martin <Dave.Martin@arm.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
linux-rt-users@vger.kernel.org,
Catalin Marinas <catalin.marinas@arm.com>,
Mike Galbraith <efault@gmx.de>, Will Deacon <will.deacon@arm.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Thomas Gleixner <tglx@linutronix.de>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH RT v2] arm64: fpsimd: use a local_lock() in addition to local_bh_disable()
Date: Tue, 24 Jul 2018 17:15:20 +0200 [thread overview]
Message-ID: <CAKv+Gu_WdooOKAvqBJCespZmYYNLcmYsy2cxJ-MP4pjKhPaqrw@mail.gmail.com> (raw)
In-Reply-To: <20180724144522.GA4240@e103592.cambridge.arm.com>
On 24 July 2018 at 16:45, Dave Martin <Dave.Martin@arm.com> wrote:
> On Wed, Jul 18, 2018 at 11:24:48AM +0200, Sebastian Andrzej Siewior wrote:
>> On 2018-07-18 11:12:10 [+0200], To Dave Martin wrote:
>> > > > - if (may_use_simd()) {
>> > > > + if (!IS_ENABLED(CONFIG_PREEMPT_RT_BASE) && may_use_simd()) {
>> > >
>> > > I suspect this is wrong -- see comments on the commit message.
>>
>> I'm sorry, I pressed send too early, I was aiming for the draft folder.
>> So yes, based on that EFI that might be interruptible, let me try to
>> look at the initial issue again and maybe I get another idea how to deal
>> with this.
>> One question: If EFI is interruptible that means, we call into EFI - how
>> do we get out? Does EFI enable interrupts and the kernel receives an
>> interrupt and treats this EFI call like a regular context switch?
>
> AFAIK the only safe way to get out permanently is for the call to
> return. Note, I've not gone through the spec in fine detail myself.
>
> The OS may handle interrupts occurring during the EFI call, but we
> still have to return to EFI afterwards to finish off the call. From
> the Linux perspective, I think this means that EFI calls are non-
> preemptible.
>
> Under RT, I'm pretty sure that we can't safely resume the interrupted
> EFI call on a different cpu from the one it was interrupted on. Even
> if it doesn't say this explicitly in the UEFI spec, I think it will be
> assumed in implementations.
>
This is a can of worms I would rather not open, although I don't think
the UEFI spec makes it explicit that you cannot migrate runtime
service calls while in progress.
Also, I don't think EFI calls are worth obsessing about, given that
they shouldn't be that common under normal operation. I know that RT
is not about the common case but about the worst case, though. What
problem is migrating a non-preemptible task intended to solve?
>
> Certain EFI calls are not long-running and may need to be called from
> interrupt context in Linux,
This suggests that the need to be called in interrupt context is a
property of the firmware implementation but it is not.
In the kernel, we have efi-pstore which may attempt to invoke runtime
services to record the kernel's dying gasp into a EFI variable. Other
than that, I don't think there are any reasons to call EFI services
from non-process context.
> which means that there may be live kernel-
> mode NEON state. This is why there are separate FPSIMD/SVE percpu stash
> buffers for EFI specifically.
>
So given the above, and the fact that you can panic() in an interrupt
handler, we needed those buffers, although I wonder if we'd ever reach
the point where we end up resuming execution of the code that uses the
restored contents of those buffers.
> Does this make sense? It's is probably not very clear, but I'm trying
> to hide the fact that I haven't looked at the UEFI spec for ages...
>
> Cheers
> ---Dave
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2018-07-24 15:15 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-17 12:40 [PATCH RT] arm64: fpsimd: use a local_lock() in addition to local_bh_disable() Sebastian Andrzej Siewior
2018-05-17 18:19 ` Dave Martin
2018-05-18 12:46 ` Dave Martin
2018-05-23 14:34 ` Sebastian Andrzej Siewior
2018-05-23 14:31 ` Sebastian Andrzej Siewior
2018-05-23 14:55 ` Dave Martin
2018-05-22 17:10 ` Steven Rostedt
2018-05-22 17:21 ` Sebastian Andrzej Siewior
2018-05-22 17:24 ` Steven Rostedt
2018-05-22 17:33 ` Sebastian Andrzej Siewior
2018-07-11 13:25 ` Steven Rostedt
2018-07-11 13:31 ` Sebastian Andrzej Siewior
2018-07-11 13:33 ` Steven Rostedt
2018-07-13 17:49 ` [PATCH RT v2] " Sebastian Andrzej Siewior
2018-07-13 17:50 ` [PATCH RT] locallock: add local_lock_bh() Sebastian Andrzej Siewior
2018-07-13 22:03 ` [PATCH RT v2] arm64: fpsimd: use a local_lock() in addition to local_bh_disable() Mike Galbraith
2018-07-15 7:22 ` Mike Galbraith
2018-07-18 10:30 ` Mike Galbraith
2018-07-18 9:27 ` Sebastian Andrzej Siewior
2018-07-18 10:28 ` Mike Galbraith
2018-07-18 10:36 ` Sebastian Andrzej Siewior
2018-07-16 15:17 ` Dave Martin
2018-07-18 9:12 ` Sebastian Andrzej Siewior
2018-07-18 9:24 ` Sebastian Andrzej Siewior
2018-07-24 14:45 ` Dave Martin
2018-07-24 15:15 ` Ard Biesheuvel [this message]
2018-07-24 13:46 ` Steven Rostedt
2018-07-24 13:57 ` Sebastian Andrzej Siewior
2018-07-26 15:06 ` [PATCH RT v3] arm64: fpsimd: use preemp_disable " Sebastian Andrzej Siewior
2018-07-27 3:17 ` Mike Galbraith
2018-07-27 7:56 ` Sebastian Andrzej Siewior
2018-07-27 15:35 ` Dave Martin
2018-07-27 16:26 ` Sebastian Andrzej Siewior
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=CAKv+Gu_WdooOKAvqBJCespZmYYNLcmYsy2cxJ-MP4pjKhPaqrw@mail.gmail.com \
--to=ard.biesheuvel@linaro.org \
--cc=Dave.Martin@arm.com \
--cc=bigeasy@linutronix.de \
--cc=catalin.marinas@arm.com \
--cc=efault@gmx.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=will.deacon@arm.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).