Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1330464 > unrolled thread
| Started by | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| First post | 2016-02-09 18:00 +0100 |
| Last post | 2016-02-11 17:10 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH] efi: runtime-wrappers: run UEFI Runtime Services with interrupts enabled Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-02-09 18:00 +0100
Re: [PATCH] efi: runtime-wrappers: run UEFI Runtime Services with interrupts enabled Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-11 17:10 +0100
| From | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| Date | 2016-02-09 18:00 +0100 |
| Subject | Re: [PATCH] efi: runtime-wrappers: run UEFI Runtime Services with interrupts enabled |
| Message-ID | <r0jNU-6Mt-15@gated-at.bofh.it> |
On 8 February 2016 at 20:37, Andy Lutomirski <luto@amacapital.net> wrote: > On Feb 4, 2016 5:58 AM, "Ard Biesheuvel" <ard.biesheuvel@linaro.org> wrote: >> >> OK, since Sai has confirmed that Windows leaves interrupts enabled when >> calling the EFI variable store related runtime services, we should be able >> to do the same for Linux, or at least be slightly more confident that we >> won't have to back out this change later. > > Could this use a mutex instead of a spinlock? > When I first started working on this code, I proposed using a mutex, but at the time, we still had the efi-pstore case to worry about http://article.gmane.org/gmane.linux.kernel.efi/4112 In the mean time, we have modified the efi-pstore code so it simply gives up when the EFI varstore is busy, and we also got rid of the NMI special case where locks are ignored. In summary, it sounds to me that moving to a mutex should be feasible, but I am only really familiar with the ARM side of the implementation, which is far less complex than the x86 side, so Matt should confirm. @Matt? > Can someone with a mixed mode setup read a variable in a loop and make > sure it doesn't crash and burn? It should work fine, but explicit > testing would be nice. (It's interesting mainly because doing a mixed > mode call with interrupts on can result in a non-IST CPL0 to CPL0 > exception delivery, which won't result in a stack switch. This could > easily trigger a stack overflow, logic bug, microcode bug, or > as-yet-unknown CPU "feature". > > Hmm. We should also audit the mixed mode entry code to make sure that > the high bits of RSP are explicitly clear before switching into compat > mode. If I had to make a guess about how CPUs behave, I'd guess > pessimistically: Intel CPUs clear the high bits of RSP when switching > into long mode due to interrupt delivery, and AMD CPUs leave them set > just to mess with us. > > Also, a WARN_ON(in_interrupt()) somewhere might be a good sanity check. >
[toc] | [next] | [standalone]
| From | Matt Fleming <matt@codeblueprint.co.uk> |
|---|---|
| Date | 2016-02-11 17:10 +0100 |
| Message-ID | <r11YC-2Ij-29@gated-at.bofh.it> |
| In reply to | #1330464 |
On Tue, 09 Feb, at 05:52:34PM, Ard Biesheuvel wrote: > On 8 February 2016 at 20:37, Andy Lutomirski <luto@amacapital.net> wrote: > > On Feb 4, 2016 5:58 AM, "Ard Biesheuvel" <ard.biesheuvel@linaro.org> wrote: > >> > >> OK, since Sai has confirmed that Windows leaves interrupts enabled when > >> calling the EFI variable store related runtime services, we should be able > >> to do the same for Linux, or at least be slightly more confident that we > >> won't have to back out this change later. > > > > Could this use a mutex instead of a spinlock? > > > > When I first started working on this code, I proposed using a mutex, > but at the time, we still had the efi-pstore case to worry about > http://article.gmane.org/gmane.linux.kernel.efi/4112 > > In the mean time, we have modified the efi-pstore code so it simply > gives up when the EFI varstore is busy, and we also got rid of the NMI > special case where locks are ignored. In summary, it sounds to me that > moving to a mutex should be feasible, but I am only really familiar > with the ARM side of the implementation, which is far less complex > than the x86 side, so Matt should confirm. You cannot touch mutexes from interrupt context, not even to perform a mutex_trylock(), and that's the problem. Since the efi-pstore code can run from interrupt context we need to use a locking primitive that works, even though we have all that non-blocking logic.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web