lkml.org 
[lkml]   [2010]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 05/10] x86, xsave: make xsave_cntxt_init() static
From
Date
On Tue, 2010-07-20 at 11:50 -0700, Robert Richter wrote:
> There is a lot of cross referencing between fpu and xsave code. This
> patch reduces this by making xsave_cntxt_init() a static function.
>
> Signed-off-by: Robert Richter <robert.richter@amd.com>
> ---
> arch/x86/include/asm/xsave.h | 1 -
> arch/x86/kernel/i387.c | 5 ++---
> arch/x86/kernel/xsave.c | 9 +++++++--
> 3 files changed, 9 insertions(+), 6 deletions(-)

Perhaps we can fold this patch into
[PATCH 06/10] x86, xsave: do not initialize xsave in fpu_init()

and probably do fpu_init() first followed by xsave_init() so that
fpu_init() will set xstate_size based on fpu features and xsave_init()
can later overwrite xstate_size based on xstate features.

thanks.

>
> diff --git a/arch/x86/include/asm/xsave.h b/arch/x86/include/asm/xsave.h
> index 94d5f84..4d3b5d1 100644
> --- a/arch/x86/include/asm/xsave.h
> +++ b/arch/x86/include/asm/xsave.h
> @@ -28,7 +28,6 @@ extern u64 pcntxt_mask;
> extern struct xsave_struct *init_xstate_buf;
> extern u64 xstate_fx_sw_bytes[USER_XSTATE_FX_SW_WORDS];
>
> -extern void xsave_cntxt_init(void);
> extern void xsave_init(void);
> extern void update_regset_xstate_info(unsigned int size, u64 xstate_mask);
> extern int init_fpu(struct task_struct *child);
> diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
> index 2f32ef0..196b8c7 100644
> --- a/arch/x86/kernel/i387.c
> +++ b/arch/x86/kernel/i387.c
> @@ -66,10 +66,9 @@ void __cpuinit init_thread_xstate(void)
> return;
> }
>
> - if (cpu_has_xsave) {
> - xsave_cntxt_init();
> + if (cpu_has_xsave)
> + /* xstate_size was already initialized */
> return;
> - }
>
> if (cpu_has_fxsr)
> xstate_size = sizeof(struct i387_fxsave_struct);
> diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c
> index ab9ad48..c46082d 100644
> --- a/arch/x86/kernel/xsave.c
> +++ b/arch/x86/kernel/xsave.c
> @@ -429,10 +429,13 @@ static void __init setup_xstate_init(void)
> /*
> * Enable and initialize the xsave feature.
> */
> -void __ref xsave_cntxt_init(void)
> +static void __cpuinit xsave_cntxt_init(void)
> {
> unsigned int eax, ebx, ecx, edx;
>
> + if (!cpu_has_xsave)
> + return;
> +
> cpuid_count(0xd, 0, &eax, &ebx, &ecx, &edx);
> pcntxt_mask = eax + ((u64)edx << 32);
>
> @@ -469,7 +472,9 @@ void __cpuinit xsave_init(void)
> /*
> * Boot processor to setup the FP and extended state context info.
> */
> - if (!smp_processor_id())
> + if (!smp_processor_id()) {
> + xsave_cntxt_init();
> init_thread_xstate();
> + }
> __xsave_init();
> }



\
 
 \ /
  Last update: 2010-07-21 00:23    [from the cache]
©2003-2011 Jasper Spaans