Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/signal: Update comment for clarity

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>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220617043135.426897-1-rashmica@linux.ibm.com

authored by

Rashmica Gupta and committed by
Michael Ellerman
e4787e71 fcdb758c

+6 -3
+6 -3
arch/powerpc/kernel/signal_64.c
··· 377 377 unsafe_get_user(set->sig[0], &sc->oldmask, efault_out); 378 378 379 379 /* 380 - * Force reload of FP/VEC. 381 - * This has to be done before copying stuff into tsk->thread.fpr/vr 382 - * for the reasons explained in the previous comment. 380 + * Force reload of FP/VEC/VSX so userspace sees any changes. 381 + * Clear these bits from the user process' MSR before copying into the 382 + * thread struct. If we are rescheduled or preempted and another task 383 + * uses FP/VEC/VSX, and this process has the MSR bits set, then the 384 + * context switch code will save the current CPU state into the 385 + * thread_struct - possibly overwriting the data we are updating here. 383 386 */ 384 387 regs_set_return_msr(regs, regs->msr & ~(MSR_FP | MSR_FE0 | MSR_FE1 | MSR_VEC | MSR_VSX)); 385 388