Messages in this thread | | | Date | Thu, 29 Jan 2015 22:21:23 +0100 | From | Oleg Nesterov <> | Subject | Re: [PATCH RFC] x86,fpu: merge save_init_fpu & unlazy_fpu |
| |
On 01/29, Rik van Riel wrote: > > The functions save_init_fpu and unlazy_fpu do essentially the > same thing:
Yes ;) Could you look at 1-3 I sent ?
> Callers of init_fpu do want __thread_fpu_end, so move the call to > __thread_fpu_end into init_fpu.
I don't think so... Contrary, I think this __thread_fpu_end() is simply wrong.
> static inline void save_init_fpu(struct task_struct *tsk) > { > - WARN_ON_ONCE(!__thread_has_fpu(tsk)); > - > - if (use_eager_fpu()) { > - __save_fpu(tsk); > - return; > - } > - > preempt_disable(); > - __save_init_fpu(tsk); > - __thread_fpu_end(tsk); > + if (__thread_has_fpu(tsk)) { > + if (use_eager_fpu()) > + __save_fpu(tsk); > + else > + __save_init_fpu(tsk);
See the changelog in 2/3. I think we still need __thread_fpu_end() if __save_init_fpu() returns 0. In this case (_I think_) the state of FPU doesn't match the saved state. IOW, "save_init" == "save" + "init" (I guess), and that "init" can (say) reset some control register to default value.
> + } else if (!use_eager_fpu()) > + tsk->thread.fpu_counter = 0;
See 1/3, I think this should be simply removed.
> @@ -245,8 +233,10 @@ int init_fpu(struct task_struct *tsk) > int ret; > > if (tsk_used_math(tsk)) { > - if (cpu_has_fpu && tsk == current) > - unlazy_fpu(tsk); > + if (cpu_has_fpu && tsk == current) { > + save_init_fpu(tsk); > + __thread_fpu_end(tsk);
See above.
Oleg.
| |