[2.5 Question] Is TIF_USEDFPU cleared for a new process?

From: Jun Sun (jsun@mvista.com)
Date: Fri Feb 07 2003 - 20:13:16 EST


In 2.4, this flag is cleared in the common code, copy_flags(),
when a new process is created. Not so anymore in 2.5. I wonder
if it ever cleared.

I looked at the code (2.5.59) a couple of times and can't seem
to find any place it is cleared for a new process.

Assuming it is not cleared, I am interested in knowing what
would happen, especially in the following scenario:

1) the new process is switched on, runs without using any FPU

2) the new process is switched off. Because the TIF_USEDFPU
   is set, it will execute 'fnsave' or 'fxsave'.

   a) if FPU is enabled at this moment, we will save bogus FPU
      contents back into new process's thread structure.
   b) if FPU is not enabled, we will go through the trap, restore
      FPU registers from the thread structure, and then save
      the same value back into the thread structure again.

Either a) or b) is bad. Is this scenario real or just fictitious?

Please cc your reply to my email address. Thanks.

Jun
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Feb 07 2003 - 22:00:25 EST