Re: [v4] powerpc: Export thread_struct.used_vr/used_vsr to user space
From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2016-07-08 08:26:50
Laurent Dufour [off-list ref] writes:
On 07/07/2016 15:21, Benjamin Herrenschmidt wrote:quoted
On Thu, 2016-07-07 at 15:12 +0200, Laurent Dufour wrote:quoted
Most of the time this is fine, but in the case a thread which has really used those registers is catching a signal just after the restore and before it has touched to these registers again (and so set used_vsr/vr), these registers will not be pushed in the newly built signal frame since setup_sigcontext() check for used_vsr/vr before pushing the registers on the stack. This may be an issue in the case the thread wants to changed those registers (don't ask me why :)) in the stacked signal frame from the signal handler since they will not be there... Being able to get and set the used_vr and used_vsr thread's variables, fixes this issue.I think the right fix is that if a restore_sigcontext() has the MSR bits set, it should set the corresponding used_* flag. Or is there a reason why that won't work ?I got your point and I agree that most of the time now, the Altivec/VSX registers are used by libc. In that case is there still a need for the lazy Altivec/VSX registers dump in the signal frame ?
Probably not for new programs. But it could conceivably break old software.
I'm fine with your proposal, except that every restarted process will have the used_vr/used_vsx turned on after the restart since we can't check if these registers were used or not at checkpoint time. But that may be a minor point...
Yeah I'd argue that's not worth worrying about, at least for now. If it *is* a problem then we can fix it later. cheers