Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1438623
| From | Benjamin Herrenschmidt <benh@kernel.crashing.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [v4] powerpc: Export thread_struct.used_vr/used_vsr to user space |
| Date | 2016-07-07 15:30 +0200 |
| Message-ID | <rShxp-7rQ-35@gated-at.bofh.it> (permalink) |
| References | <rSfvz-69Q-7@gated-at.bofh.it> <rShnI-7n8-17@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, 2016-07-07 at 15:12 +0200, Laurent Dufour wrote:
>
> Basically, CRIU checkpoints the process register's state through the
> ptrace API, and it restores it through a signal frame at restart time.
> This is quite odd but that the way it works on all the CRIU's supported
> architectures.
>
> Obviously everything is done from/in user space, so the sigframe
> building too.
> Since we can't know from user space if the thread has used or not the
> Altivec/VSX registers, since we can't rely on the MSR bits, we always
> dump these registers.
Right, however is that an issue ? These days with glibc using V{M,S}X
for things like memcpy I would think there is little to gain in trying
to avoid dumping them.
> > Alternately, when restoring, can you setup the sigframe with the Altivec/VSX
> > fields populated, and the kernel will then load them, regardless of whether
> > they were actually used or not prior to the checkpoint?
>
> In the case of Altivec/VSX fields, we currently force the kernel to
> retrieve them from the signal frame by setting MSR_VEC/MSR_VSX so
> restore_sigcontext() will copy them to the kernel thread's state.
Yup, that's the way to go.
> However this doesn't touch to used_vsr and used_vr which may remain at 0.
That would be a kernel bug.
> 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 ?
Cheers,
Ben.
> Cheers,
> Laurent.
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v4] powerpc: Export thread_struct.used_vr/used_vsr to user space wei.guo.simon@gmail.com - 2016-07-07 10:00 +0200
Re: [v4] powerpc: Export thread_struct.used_vr/used_vsr to user space Michael Ellerman <mpe@ellerman.id.au> - 2016-07-07 13:20 +0200
Re: [v4] powerpc: Export thread_struct.used_vr/used_vsr to user space Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2016-07-07 15:20 +0200
Re: [v4] powerpc: Export thread_struct.used_vr/used_vsr to user space Benjamin Herrenschmidt <benh@kernel.crashing.org> - 2016-07-07 15:30 +0200
Re: [v4] powerpc: Export thread_struct.used_vr/used_vsr to user space Benjamin Herrenschmidt <benh@kernel.crashing.org> - 2016-07-07 15:40 +0200
Re: [v4] powerpc: Export thread_struct.used_vr/used_vsr to user space Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2016-07-07 15:50 +0200
Re: [v4] powerpc: Export thread_struct.used_vr/used_vsr to user space Simon Guo <wei.guo.simon@gmail.com> - 2016-07-08 07:40 +0200
csiph-web