linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/signal: Update comment for clarity
@ 2022-06-17  4:31 Rashmica Gupta
  2022-07-29 13:03 ` Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: Rashmica Gupta @ 2022-06-17  4:31 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: npiggin

The comment being referred to was deleted in commit af1bbc3dd3d5 ("powerpc:
Remove UP only lazy floating point and vector optimisations").

Add a bit more detail so it's clear why we need to clear the FP/VEC/VSX
bits here.

Signed-off-by: Rashmica Gupta <rashmica@linux.ibm.com>
---
 arch/powerpc/kernel/signal_64.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 472596a109e2..86bb5bb4c143 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -377,9 +377,12 @@ static long notrace __unsafe_restore_sigcontext(struct task_struct *tsk, sigset_
 		unsafe_get_user(set->sig[0], &sc->oldmask, efault_out);
 
 	/*
-	 * Force reload of FP/VEC.
-	 * This has to be done before copying stuff into tsk->thread.fpr/vr
-	 * for the reasons explained in the previous comment.
+	 * Force reload of FP/VEC/VSX so userspace sees any changes.
+	 * Clear these bits from the user process' MSR before copying into the
+	 * thread struct. If we are rescheduled or preempted and another task
+	 * uses FP/VEC/VSX, and this process has the MSR bits set, then the
+	 * context switch code will save the current CPU state into the
+	 * thread_struct - possibly overwriting the data we are updating here.
 	 */
 	regs_set_return_msr(regs, regs->msr & ~(MSR_FP | MSR_FE0 | MSR_FE1 | MSR_VEC | MSR_VSX));
 
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] powerpc/signal: Update comment for clarity
  2022-06-17  4:31 [PATCH] powerpc/signal: Update comment for clarity Rashmica Gupta
@ 2022-07-29 13:03 ` Michael Ellerman
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2022-07-29 13:03 UTC (permalink / raw)
  To: Rashmica Gupta, linuxppc-dev; +Cc: npiggin

On Fri, 17 Jun 2022 14:31:35 +1000, Rashmica Gupta wrote:
> The comment being referred to was deleted in commit af1bbc3dd3d5 ("powerpc:
> Remove UP only lazy floating point and vector optimisations").
> 
> Add a bit more detail so it's clear why we need to clear the FP/VEC/VSX
> bits here.
> 
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc/signal: Update comment for clarity
      https://git.kernel.org/powerpc/c/e4787e71ae2de3f60bc04fe09d1be4ef628b6c68

cheers

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-29 13:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-17  4:31 [PATCH] powerpc/signal: Update comment for clarity Rashmica Gupta
2022-07-29 13:03 ` Michael Ellerman

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).