Re: AMD DC graphics display code enables -mhard-float, -msse, -msse2 without any visible FPU state protection
From: Peter Zijlstra
Date: Thu Apr 09 2020 - 13:09:29 EST
On Thu, Apr 09, 2020 at 05:59:56PM +0200, Peter Zijlstra wrote:
> On Thu, Apr 02, 2020 at 04:13:08PM +0200, Peter Zijlstra wrote:
> > On Thu, Apr 02, 2020 at 09:33:54AM +0200, Christian König wrote:
>
> > > yes, using the floating point calculations in the display code has been a
> > > source of numerous problems and confusion in the past.
> > >
> > > The calls to kernel_fpu_begin() and kernel_fpu_end() are hidden behind the
> > > DC_FP_START() and DC_FP_END() macros which are supposed to hide the
> > > architecture depend handling for x86 and PPC64.
> > >
> > > This originated from the graphics block integrated into AMD CPU (where we
> > > knew which fp unit we had), but as far as I know is now also used for
> > > dedicated AMD GPUs as well.
> > >
> > > I'm not really a fan of this either, but so far we weren't able to convince
> > > the hardware engineers to not use floating point calculations for the
> > > display stuff.
> I'll need another approach, let me consider.
Christian; it says these files are generated, does that generator know
which functions are wholly in FPU context and which are not?
My current thinking is that if I annotate all functions that are wholly
inside kernel_fpu_start() with an __fpu function attribute, then I can
verify that any call from regular text to fpu text only happens inside
kernel_fpu_begin()/end(). And I can ensure that all !__fpu annotation
fuctions only contain !fpu instructions.
Can that generator add the __fpu function attribute or is that something
that would need to be done manually (which seems like it would be
painful, since it is quite a bit of code) ?