Re: [RFC] [PATCH] cache pollution aware __copy_from_user_ll()

From: Akira Tsukamoto
Date: Wed Aug 17 2005 - 09:24:06 EST


On Wed, 17 Aug 2005 14:10:34 +0900
Hiro Yoshioka <lkml.hyoshiok@xxxxxxxxx> mentioned:
> On 8/17/05, Akira Tsukamoto <akira-t@xxxxxxxxxxxxx> wrote:
> > Anyway, going back to copy_user topic,
> > big remaining issues are
> > 1)store/restore floating point register (80/64bytes) twice every time by
> > surrounding with kernel_fpu_begin()/kernel_fpu_end() is big penalty
>
> I don't know. If nobody uses MMX/XMM, then there is no need
> to save and restore.

I think you are misunderstanding between
1)lazy fpu save handling for user space task
2)kernel_fpu_begin()/kernel_fpu_end() inside the kernel

> > 2)after pagefault not always come back to copy function and corrupts fp register
>
> I'm trying to understand this mechanism but I don't
> understand very well.

My explanation was a bit ambiguous, see the code below.
Where the fp register saved? It saves fp register *inside* task_struct,

static inline void kernel_fpu_begin(void)
+ if (tsk->flags & PF_USEDFPU) {
+ asm volatile("rex64 ; fxsave %0 ; fnclex"
+ : "=m" (tsk->thread.i387.fxsave));

static inline void save_init_fpu( struct task_struct *tsk )
+ if ( cpu_has_fxsr ) {
+ asm volatile( "fxrstor %0"
+ : : "m" (tsk->thread.i387.fxsave) );

What happens, during your copy function, if memory is not allocated and
generates pagefualt and goto reclaim memories and go into task switch
and change to other task.

--
Akira Tsukamoto


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/