linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org
Subject: [GIT pull] x86/fpu for v5.11-rc1
Date: Mon, 14 Dec 2020 20:22:21 -0000	[thread overview]
Message-ID: <160797734154.10793.1671535872493484817.tglx@nanos> (raw)
In-Reply-To: 160797732939.10793.9152151866806316627.tglx@nanos

Linus,

please pull the latest x86/fpu branch from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-fpu-2020-12-14

up to:  cba08c5dc6dc: x86/fpu: Make kernel FPU protection RT friendly


X86 FPU updates:

 - Simplify the FPU protection for !RT kernels

 - Add the RT variant of FPU protections

Thanks,

	tglx

------------------>
Thomas Gleixner (2):
      x86/fpu: Simplify fpregs_[un]lock()
      x86/fpu: Make kernel FPU protection RT friendly


 arch/x86/include/asm/fpu/api.h | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/fpu/api.h b/arch/x86/include/asm/fpu/api.h
index dcd9503b1098..a5aba4ab0224 100644
--- a/arch/x86/include/asm/fpu/api.h
+++ b/arch/x86/include/asm/fpu/api.h
@@ -29,17 +29,32 @@ extern void fpregs_mark_activate(void);
  * A context switch will (and softirq might) save CPU's FPU registers to
  * fpu->state and set TIF_NEED_FPU_LOAD leaving CPU's FPU registers in
  * a random state.
+ *
+ * local_bh_disable() protects against both preemption and soft interrupts
+ * on !RT kernels.
+ *
+ * On RT kernels local_bh_disable() is not sufficient because it only
+ * serializes soft interrupt related sections via a local lock, but stays
+ * preemptible. Disabling preemption is the right choice here as bottom
+ * half processing is always in thread context on RT kernels so it
+ * implicitly prevents bottom half processing as well.
+ *
+ * Disabling preemption also serializes against kernel_fpu_begin().
  */
 static inline void fpregs_lock(void)
 {
-	preempt_disable();
-	local_bh_disable();
+	if (!IS_ENABLED(CONFIG_PREEMPT_RT))
+		local_bh_disable();
+	else
+		preempt_disable();
 }
 
 static inline void fpregs_unlock(void)
 {
-	local_bh_enable();
-	preempt_enable();
+	if (!IS_ENABLED(CONFIG_PREEMPT_RT))
+		local_bh_enable();
+	else
+		preempt_enable();
 }
 
 #ifdef CONFIG_X86_DEBUG_FPU


  parent reply	other threads:[~2020-12-14 20:39 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14 20:22 [GIT pull] core/entry for v5.11-rc1 Thomas Gleixner
2020-12-14 20:22 ` [GIT pull] core/rcu " Thomas Gleixner
2020-12-15  2:21   ` pr-tracker-bot
2020-12-14 20:22 ` [GIT pull] efi/core " Thomas Gleixner
2020-12-14 20:30   ` Thomas Gleixner
2020-12-24 21:59   ` pr-tracker-bot
2020-12-14 20:22 ` [GIT pull] irq/core " Thomas Gleixner
2020-12-15  2:02   ` Linus Torvalds
2020-12-15 14:19     ` Thomas Gleixner
2020-12-15 14:36       ` [GIT pull V2] " Thomas Gleixner
2020-12-16  1:00         ` pr-tracker-bot
2020-12-14 20:22 ` [GIT pull] locking/core " Thomas Gleixner
2020-12-15  2:21   ` pr-tracker-bot
2020-12-14 20:22 ` [GIT pull] perf/core " Thomas Gleixner
2020-12-15  2:21   ` pr-tracker-bot
2020-12-14 20:22 ` [GIT pull] perf/kprobes " Thomas Gleixner
2020-12-15  2:21   ` pr-tracker-bot
2020-12-14 20:22 ` [GIT pull] sched/core " Thomas Gleixner
2020-12-15  2:47   ` pr-tracker-bot
2020-12-14 20:22 ` [GIT pull] timers/core " Thomas Gleixner
2020-12-15  2:47   ` pr-tracker-bot
2020-12-14 20:22 ` [GIT pull] x86/apic " Thomas Gleixner
2020-12-15  3:07   ` pr-tracker-bot
2020-12-14 20:22 ` Thomas Gleixner [this message]
2020-12-15  3:07   ` [GIT pull] x86/fpu " pr-tracker-bot
2020-12-14 20:22 ` [GIT pull] core/mm " Thomas Gleixner
2020-12-15  2:47   ` pr-tracker-bot
2020-12-15  2:21 ` [GIT pull] core/entry " pr-tracker-bot

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=160797734154.10793.1671535872493484817.tglx@nanos \
    --to=tglx@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.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).