11 May, 2010

2 commits

  • Unbreak FPU emulation, broken by checkin
    86603283326c9e95e5ad4e9fdddeec93cac5d9ad:
    x86: Introduce 'struct fpu' and related API

    Signed-off-by: H. Peter Anvin
    Cc: Avi Kivity
    Cc: Suresh Siddha
    LKML-Reference:

    H. Peter Anvin
     
  • Currently all fpu state access is through tsk->thread.xstate. Since we wish
    to generalize fpu access to non-task contexts, wrap the state in a new
    'struct fpu' and convert existing access to use an fpu API.

    Signal frame handlers are not converted to the API since they will remain
    task context only things.

    Signed-off-by: Avi Kivity
    Acked-by: Suresh Siddha
    LKML-Reference:
    Signed-off-by: H. Peter Anvin

    Avi Kivity
     

28 Mar, 2009

1 commit


05 Mar, 2009

1 commit

  • Impact: fix math-emu related crash while using GDB/ptrace

    init_fpu() calls finit to initialize a task's xstate, while finit always
    works on the current task. If we use PTRACE_GETFPREGS on another
    process and both processes did not already use floating point, we get
    a null pointer exception in finit.

    This patch creates a new function finit_task that takes a task_struct
    parameter. finit becomes a wrapper that simply calls finit_task with
    current. On the plus side this avoids many calls to get_current which
    would each resolve to an inline assembler mov instruction.

    An empty finit_task has been added to i387.h to avoid linker errors in
    case the compiler still emits the call in init_fpu when
    CONFIG_MATH_EMULATION is not defined.

    The declaration of finit in i387.h has been removed as the remaining
    code using this function gets its prototype from fpu_proto.h.

    Signed-off-by: Daniel Glöckner
    Cc: Suresh Siddha
    Cc: "Pallipadi Venkatesh"
    Cc: Arjan van de Ven
    Cc: Bill Metzenthen
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Daniel Glöckner
     

10 Feb, 2009

2 commits

  • Impact: cleanup

    On x86_32, %gs is handled lazily. It's not saved and restored on
    kernel entry/exit but only when necessary which usually is during task
    switch but there are few other places. Currently, it's done by
    calling savesegment() and loadsegment() explicitly. Define
    get_user_gs(), set_user_gs() and task_user_gs() and use them instead.

    While at it, clean up register access macros in signal.c.

    This cleans up code a bit and will help future changes.

    Signed-off-by: Tejun Heo
    Signed-off-by: Ingo Molnar

    Tejun Heo
     
  • do_device_not_available() is the handler for #NM and it declares that
    it takes a unsigned long and calls math_emu(), which takes a long
    argument and surprisingly expects the stack frame starting at the zero
    argument would match struct math_emu_info, which isn't true regardless
    of configuration in the current code.

    This patch makes do_device_not_available() take struct pt_regs like
    other exception handlers and initialize struct math_emu_info with
    pointer to it and pass pointer to the math_emu_info to math_emulate()
    like normal C functions do. This way, unless gcc makes a copy of
    struct pt_regs in do_device_not_available(), the register frame is
    correctly accessed regardless of kernel configuration or compiler
    used.

    This doesn't fix all math_emu problems but it at least gets it
    somewhat working.

    Signed-off-by: Tejun Heo
    Signed-off-by: Ingo Molnar

    Tejun Heo
     

09 Feb, 2009

1 commit

  • Impact: cleanup

    * Come on, struct info? s/struct info/struct math_emu_info/

    * Use struct pt_regs and kernel_vm86_regs instead of defining its own
    register frame structure.

    Signed-off-by: Tejun Heo
    Signed-off-by: Ingo Molnar

    Tejun Heo
     

18 Jun, 2008

1 commit

  • Before:
    total: 6 errors, 1 warnings, 117 lines checked

    After:
    total: 0 errors, 1 warnings, 117 lines checked

    paolo@paolo-desktop:~/linux.trees.git$ md5sum /tmp/reg_constant.o.*
    780388a3056d58fb759efaf190d5d3d1 /tmp/reg_constant.o.after
    780388a3056d58fb759efaf190d5d3d1 /tmp/reg_constant.o.before

    paolo@paolo-desktop:~/linux.trees.git$ size /tmp/reg_constant.o.*
    text data bss dec hex filename
    457 0 0 457 1c9 /tmp/reg_constant.o.after
    457 0 0 457 1c9 /tmp/reg_constant.o.before

    Signed-off-by: Paolo Ciarrocchi
    Signed-off-by: Ingo Molnar

    Paolo Ciarrocchi
     

04 Jun, 2008

1 commit

  • Fix the math emulation that got broken with the recent lazy allocation of FPU
    area. init_fpu() need to be added for the math-emulation path aswell
    for the FPU area allocation.

    math emulation enabled kernel booted fine with this, in the presence
    of "no387 nofxsr" boot param.

    Signed-off-by: Suresh Siddha
    Cc: hpa@zytor.com
    Cc: mingo@elte.hu
    Signed-off-by: Thomas Gleixner

    Suresh Siddha
     

20 Apr, 2008

1 commit

  • Split the FPU save area from the task struct. This allows easy migration
    of FPU context, and it's generally cleaner. It also allows the following
    two optimizations:

    1) only allocate when the application actually uses FPU, so in the first
    lazy FPU trap. This could save memory for non-fpu using apps. Next patch
    does this lazy allocation.

    2) allocate the right size for the actual cpu rather than 512 bytes always.
    Patches enabling xsave/xrstor support (coming shortly) will take advantage
    of this.

    Signed-off-by: Suresh Siddha
    Signed-off-by: Arjan van de Ven
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Suresh Siddha
     

17 Apr, 2008

2 commits

  • arch/x86/math-emu/reg_ld_str.c:380: warning: 'l[0]' may be used uninitialized in this function
    arch/x86/math-emu/reg_ld_str.c:380: warning: 'l[1]' may be used uninitialized in this function

    I can't actually spot the bug here. There's one obvious place, but fixing
    that didn't shut the warning up.

    Cc: Andi Kleen
    Signed-off-by: Andrew Morton
    Signed-off-by: Ingo Molnar

    Andrew Morton
     
  • arch/x86/math-emu/fpu_entry.c:555: warning: 'entry_sel_off.empty' is used uninitialized in this function

    Presumably it's harmless, but I'll sleep better at night knowing that we
    initialised it.

    Cc: Andi Kleen
    Signed-off-by: Andrew Morton
    Signed-off-by: Ingo Molnar

    Andrew Morton
     

30 Jan, 2008

5 commits

  • arch/x86/math-emu/errors.c:163: warning: format '%ld' expects type 'long int', but argument 3 has type 'u32'
    arch/x86/math-emu/errors.c:175: warning: format '%ld' expects type 'long int', but argument 3 has type 'u32'
    arch/x86/math-emu/errors.c:175: warning: format '%ld' expects type 'long int', but argument 4 has type 'u32'
    arch/x86/math-emu/errors.c:175: warning: format '%ld' expects type 'long int', but argument 5 has type 'u32'
    arch/x86/math-emu/errors.c:175: warning: format '%ld' expects type 'long int', but argument 6 has type 'u32'

    Signed-off-by: Andrew Morton
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Andrew Morton
     
  • This removes a bunch of dead code that is no longer needed now
    that the user_regset interfaces are being used for all these jobs.

    Signed-off-by: Roland McGrath
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Roland McGrath
     
  • This converts the ptrace/signal accessors for i387 math_emu
    state to the user_regset interface style, and calls these
    from the old interfaces.

    It also cleans up math_emulate's ptrace check to be a
    single-step check, which is what it really wants.

    Signed-off-by: Roland McGrath
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Roland McGrath
     
  • manually clean up some of the damage that lindent caused.
    (this is a separate commit so that in the unlikely case of
    a typo we can bisect it down to the manual edits.)

    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Ingo Molnar
     
  • lindent these files:
    errors lines of code errors/KLOC
    arch/x86/math-emu/ 2236 9424 237.2
    arch/x86/math-emu/ 128 8706 14.7

    no other changes. No code changed:

    text data bss dec hex filename
    5589802 612739 3833856 10036397 9924ad vmlinux.before
    5589802 612739 3833856 10036397 9924ad vmlinux.after

    the intent of this patch is to ease the automated tracking of kernel
    code quality - it's just much easier for us to maintain it if every file
    in arch/x86 is supposed to be clean.

    NOTE: it is a known problem of lindent that it causes some style damage
    of its own, but it's a safe tool (well, except for the gcc array range
    initializers extension), so we did the bulk of the changes via lindent,
    and did the manual fixups in a followup patch.

    the resulting math-emu code has been tested by Thomas Gleixner on a real
    386 DX CPU as well, and it works fine.

    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Ingo Molnar
     

15 Oct, 2007

1 commit

  • Only in very rare cases is it needed to change CFLAGS
    outside of arch/*/Makefile.
    Fix up all wrong cases - in most cases
    the use of EXTRA_CFLAGS is the only thing needed.

    Signed-off-by: Sam Ravnborg

    Sam Ravnborg
     

11 Oct, 2007

1 commit