public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH] arm64: use non-global mappings for UEFI runtime regions
Date: Tue, 17 Nov 2015 17:17:09 +0000	[thread overview]
Message-ID: <20151117171709.GB12266@leverpostej> (raw)
In-Reply-To: <CAKv+Gu8Z=Jb-x1ZL7YSYpLWsEBqh7z0EQ0myg2Gz5asAuHdNbg@mail.gmail.com>

> >> > For backporting, I'm not sure that this is necessarily safe prior to
> >> > Will's rework of the ASID allocator. I think we can IPI in this context,
> >> > and it looks like the cpu_set_reserved_ttbr0() in flush_context() would
> >> > save us from the problem described above, but I may have missed
> >> > something.
> >> >
> >> > Will, are you aware of anything that could bite us here?
> >>
> >> Can we guarantee that efi_virtmap_{load,unload} are called with interrupts
> >> enabled?
> >
> > Unfortuantely, it looks like we can guarantee interrupts are _disabled_.
> >
> > Every function in drivers/firmware/efi/runtime-wrappers.c which uses
> > efi_call_virt (and hence efi_virtmap_{load,unload}) wraps the call in a
> > spin_lock_irq{save,restore} pair. Those appear to be the only uses of
> > efi_call_virt.
> >
> 
> There is actually no need from the UEFI pov to invoke the UEFI runtime
> services with interrupts disabled, this is simply an implementation
> detail of the kernel support, and I think it is primarily for x86 (but
> I have to dig up the old thread for the details)
> 
> And even if we stick with spin_lock_irqsave(), we could refactor the
> runtime wrappers to perform the mm switch outside of them.

Ok.

I'm only thinking about stable here.

In the context of a stable backport, I think the simplest thing to do is
always go via the resesrved ttbr0 to perform the TLB flush, and
hand-code the save/restore of the active mm's TTBR0_EL1 value rather
than going through cpu_switch_mm (which I believe we can't call with
interrupts disabled).

It doesn't look like it's easy to stash the value given
efi_virtmap_{load,unload} are separate functions, and I don't think we
can just restore from current->active_mm in case there was a concurrent
rollover on another CPU.

Mark.

  parent reply	other threads:[~2015-11-17 17:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-17  8:53 [RFC PATCH] arm64: use non-global mappings for UEFI runtime regions Ard Biesheuvel
2015-11-17 15:25 ` Mark Rutland
2015-11-17 16:34   ` Will Deacon
2015-11-17 16:48     ` Mark Rutland
2015-11-17 17:00       ` Ard Biesheuvel
2015-11-17 17:05         ` Ard Biesheuvel
2015-11-17 17:05         ` Will Deacon
2015-11-17 17:17         ` Mark Rutland [this message]
2015-11-18  6:42           ` Ard Biesheuvel
2015-11-18 12:01             ` Mark Rutland
2015-11-17 17:01     ` Ard Biesheuvel
2015-11-17 17:07       ` Will Deacon
2015-11-17 17:08 ` Will Deacon
2015-11-17 17:11   ` Ard Biesheuvel
2015-11-17 17:21     ` Will Deacon
2015-11-18  9:43 ` Catalin Marinas

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=20151117171709.GB12266@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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