lkml.org 
[lkml]   [2015]   [Apr]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH Bugfix v2 2/4] x86/xsaves: Define and use user_xstate_size for xstate size in signal context
    On 04/21/2015 09:51 PM, Fenghua Yu wrote:
    > +static int copy_to_user_xstate(void __user *buf_fx, struct xsave_struct *xsave)

    I was thinking about this a bit more. I think uncompacting the xsave
    state from the kernel buffer in to the user buffer in software is
    probably a bad idea.

    It would nice, eventually, to not need to memset() the entire xsave
    state when we initialize it. It could be a lot bigger some day, and we
    might start to notice the memset() cost. We can't do this unless we're
    careful about copying uninitialized parts of the task xstate buffer out
    to userspace.

    The whole reason we've gone down this path is that we are
    !user_has_fpu(), so there is no FPU state in the registers which we can
    xsave directly. Perhaps we should enable the FPU hardware, restore the
    state to the registers (from the xstate buffer), and then use
    xsave_user() to write the user xstate buffer.

    This *might* even be faster. But, it *is* a slow (and rare) path, so it
    does not really matter what we do performance-wise. What I've described
    above should be a lot less code than what we've got now. It makes the
    hardware do the hard work.


    \
     
     \ /
      Last update: 2015-04-29 16:21    [W:3.135 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site