On 01/26, Rik van Riel wrote: > > On 01/24/2015 03:20 PM, Oleg Nesterov wrote: > > > Now the questions: > > > > - This doesn't hurt, but does it really need __thread_fpu_end? > > > > Perhaps this is because we do not check the error code returned by > > __save_init_fpu? although I am not sure I understand the comment > > above fpu_save_init correctly... > > Looking at the code some more, I do not see any call site of > save_init_fpu() that actually needs or wants __thread_fpu_end(), > with or without eager fpu mode.
Yes. But probably it is needed if __save_init_fpu() returns 0. But this is minor, __thread_fpu_end() doesn't hurt correctness-wise if !eager. > It looks like we can get rid of that. Agreed, but probably this needs a separate change. > > - What about do_bounds() ? Should not it use save_init_fpu() > > rather than fpu_save_init() ? > > I suppose do_bounds() probably should save the fpu context while > not preemptible, plus it also needs the __thread_has_fpu() check. Otherwise fpu_save_init() can save the wrong FPU state afaics. > but that may also mean moving conditional_sti() > until after save_init_fpu() or __save_init_fpu() has been called. Agreed, this can work too. > > - Why unlazy_fpu() always does __save_init_fpu() even if > > use_eager_fpu? > > > > and note that in this case __thread_fpu_end() is wrong if > > use_eager_fpu, but fortunately the only possible caller of > > unlazy_fpu() is coredump. fpu_copy() checks use_eager_fpu(). > > > > - Is unlazy_fpu()->__save_init_fpu() safe wrt __kernel_fpu_begin() > > from irq? > > > > I mean, is it safe if __save_init_fpu() path is interrupted by > > another __save_init_fpu() + restore_fpu_checking() from > > __kernel_fpu_begin/end? > > I got lost in the core dump code trying to figure out whether this is > safe or broken. I'll need some more time to look through that code... It is called indirectly by regset code, see xstateregs_get()->init_fpu(). The coredumping task can't return to user-mode and use FPU in this case, so this is not that bad. Still unlazy_fpu()->__thread_fpu_end() is wrong if eager. And I forgot to mention, the "else" branch in unlazy_fpu() makes no sense. And note that save_init_fpu() and unlazy_fpu() is the same thing (if we fix/cleanup them). Oh. I'll try to finish my cleanups and send them tomorrow. Unless you do this ;) Oleg. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/