Skip to content
Commit e9013785 authored by Felipe Rechia's avatar Felipe Rechia Committed by Michael Ellerman
Browse files

powerpc/process: Fix flush_all_to_thread for SPE

Fix a bug introduced by the creation of flush_all_to_thread() for
processors that have SPE (Signal Processing Engine) and use it to
compute floating-point operations.

>From userspace perspective, the problem was seen in attempts of
computing floating-point operations which should generate exceptions.
For example:

  fork();
  float x = 0.0 / 0.0;
  isnan(x);           // forked process returns False (should be True)

The operation above also should always cause the SPEFSCR FINV bit to
be set. However, the SPE floating-point exceptions were turned off
after a fork().

Kernel versions prior to the bug used flush_spe_to_thread(), which
first saves SPEFSCR register values in tsk->thread and then calls
giveup_spe(tsk).

After commit 579e633e, the save_all() function was called first
to giveup_spe(), and then the SPEFSCR register values were saved in
tsk->thread. This would save the SPEFSCR register values after
disabling SPE for that thread, causing the bug described above.

Fixes 579e633e

 ("powerpc: create flush_all_to_thread()")
Signed-off-by: default avatarFelipe Rechia <felipe.rechia@datacom.com.br>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 8dce6b22
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment