Re: [PATCH V3] LoongArch: Provide kernel fpu functions
From: Xi Ruoyao
Date: Mon Mar 06 2023 - 08:01:56 EST
On Mon, 2023-03-06 at 20:49 +0800, Huacai Chen wrote:
> > > + if (!is_fpu_owner())
> > > + enable_fpu();
> > > + else
> > > + _save_fp(¤t->thread.fpu);
> > Do we need initialize fcsr rather than using random fcsr value
> > of other processes? There may be fpu exception enabled by
> > other tasks.
> Emm, I think initialize fcsr to 0 is better here.
I guess it's necessary: if we use a "dirty" FSCR0 with some exceptions
enabled (esp. inaccurate exception which is expected as disabled by most
developers), we may end up oops with a kernel FPE...
--
Xi Ruoyao <xry111@xxxxxxxxxxx>
School of Aerospace Science and Technology, Xidian University