[MIPS] FPU affinity for MT ASE.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
#define cpu_has_sb1_cache (cpu_data[0].options & MIPS_CPU_SB1_CACHE)
|
||||
#endif
|
||||
#ifndef cpu_has_fpu
|
||||
#define cpu_has_fpu (cpu_data[0].options & MIPS_CPU_FPU)
|
||||
#define cpu_has_fpu (current_cpu_data.options & MIPS_CPU_FPU)
|
||||
#endif
|
||||
#ifndef cpu_has_32fpr
|
||||
#define cpu_has_32fpr (cpu_data[0].options & MIPS_CPU_32FPR)
|
||||
|
@@ -21,6 +21,10 @@
|
||||
#include <asm/processor.h>
|
||||
#include <asm/current.h>
|
||||
|
||||
#ifdef CONFIG_MIPS_MT_FPAFF
|
||||
#include <asm/mips_mt.h>
|
||||
#endif
|
||||
|
||||
struct sigcontext;
|
||||
struct sigcontext32;
|
||||
|
||||
|
@@ -134,6 +134,12 @@ struct thread_struct {
|
||||
|
||||
/* Saved fpu/fpu emulator stuff. */
|
||||
union mips_fpu_union fpu;
|
||||
#ifdef CONFIG_MIPS_MT_FPAFF
|
||||
/* Emulated instruction count */
|
||||
unsigned long emulated_fp;
|
||||
/* Saved per-thread scheduler affinity mask */
|
||||
cpumask_t user_cpus_allowed;
|
||||
#endif /* CONFIG_MIPS_MT_FPAFF */
|
||||
|
||||
/* Saved state of the DSP ASE, if available. */
|
||||
struct mips_dsp_state dsp;
|
||||
@@ -159,6 +165,12 @@ struct thread_struct {
|
||||
#define MF_N32 MF_32BIT_ADDR
|
||||
#define MF_N64 0
|
||||
|
||||
#ifdef CONFIG_MIPS_MT_FPAFF
|
||||
#define FPAFF_INIT 0, INIT_CPUMASK,
|
||||
#else
|
||||
#define FPAFF_INIT
|
||||
#endif /* CONFIG_MIPS_MT_FPAFF */
|
||||
|
||||
#define INIT_THREAD { \
|
||||
/* \
|
||||
* saved main processor registers \
|
||||
@@ -173,6 +185,10 @@ struct thread_struct {
|
||||
* saved fpu/fpu emulator stuff \
|
||||
*/ \
|
||||
INIT_FPU, \
|
||||
/* \
|
||||
* fpu affinity state (null if not FPAFF) \
|
||||
*/ \
|
||||
FPAFF_INIT \
|
||||
/* \
|
||||
* saved dsp/dsp emulator stuff \
|
||||
*/ \
|
||||
|
@@ -155,6 +155,37 @@ extern asmlinkage void *resume(void *last, void *next, void *next_ti);
|
||||
|
||||
struct task_struct;
|
||||
|
||||
#ifdef CONFIG_MIPS_MT_FPAFF
|
||||
|
||||
/*
|
||||
* Handle the scheduler resume end of FPU affinity management. We do this
|
||||
* inline to try to keep the overhead down. If we have been forced to run on
|
||||
* a "CPU" with an FPU because of a previous high level of FP computation,
|
||||
* but did not actually use the FPU during the most recent time-slice (CU1
|
||||
* isn't set), we undo the restriction on cpus_allowed.
|
||||
*
|
||||
* We're not calling set_cpus_allowed() here, because we have no need to
|
||||
* force prompt migration - we're already switching the current CPU to a
|
||||
* different thread.
|
||||
*/
|
||||
|
||||
#define switch_to(prev,next,last) \
|
||||
do { \
|
||||
if (cpu_has_fpu && \
|
||||
(prev->thread.mflags & MF_FPUBOUND) && \
|
||||
(!(KSTK_STATUS(prev) & ST0_CU1))) { \
|
||||
prev->thread.mflags &= ~MF_FPUBOUND; \
|
||||
prev->cpus_allowed = prev->thread.user_cpus_allowed; \
|
||||
} \
|
||||
if (cpu_has_dsp) \
|
||||
__save_dsp(prev); \
|
||||
next->thread.emulated_fp = 0; \
|
||||
(last) = resume(prev, next, next->thread_info); \
|
||||
if (cpu_has_dsp) \
|
||||
__restore_dsp(current); \
|
||||
} while(0)
|
||||
|
||||
#else
|
||||
#define switch_to(prev,next,last) \
|
||||
do { \
|
||||
if (cpu_has_dsp) \
|
||||
@@ -163,6 +194,7 @@ do { \
|
||||
if (cpu_has_dsp) \
|
||||
__restore_dsp(current); \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* On SMP systems, when the scheduler does migration-cost autodetection,
|
||||
|
Reference in New Issue
Block a user