01 Nov, 2011

1 commit

  • These files were implicitly getting EXPORT_SYMBOL via device.h
    which was including module.h, but that will be fixed up shortly.

    By fixing these now, we can avoid seeing things like:

    arch/x86/kernel/rtc.c:29: warning: type defaults to ‘int’ in declaration of ‘EXPORT_SYMBOL’
    arch/x86/kernel/pci-dma.c:20: warning: type defaults to ‘int’ in declaration of ‘EXPORT_SYMBOL’
    arch/x86/kernel/e820.c:69: warning: type defaults to ‘int’ in declaration of ‘EXPORT_SYMBOL_GPL’

    [ with input from Randy Dunlap and also
    from Stephen Rothwell ]

    Signed-off-by: Paul Gortmaker

    Paul Gortmaker
     

20 Aug, 2010

1 commit

  • TSC's get reset after suspend/resume (even on cpu's with invariant TSC
    which runs at a constant rate across ACPI P-, C- and T-states). And in
    some systems BIOS seem to reinit TSC to arbitrary large value (still
    sync'd across cpu's) during resume.

    This leads to a scenario of scheduler rq->clock (sched_clock_cpu()) less
    than rq->age_stamp (introduced in 2.6.32). This leads to a big value
    returned by scale_rt_power() and the resulting big group power set by the
    update_group_power() is causing improper load balancing between busy and
    idle cpu's after suspend/resume.

    This resulted in multi-threaded workloads (like kernel-compilation) go
    slower after suspend/resume cycle on core i5 laptops.

    Fix this by recomputing cyc2ns_offset's during resume, so that
    sched_clock() continues from the point where it was left off during
    suspend.

    Reported-by: Florian Pritz
    Signed-off-by: Suresh Siddha
    Cc: # [v2.6.32+]
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Suresh Siddha
     

19 Jul, 2010

1 commit


08 Jun, 2010

1 commit

  • Save/restore MISC_ENABLE register on suspend/resume.
    This fixes OOPS (invalid opcode) on resume from STR on Asus P4P800-VM,
    which wakes up with MWAIT disabled.

    Fixes https://bugzilla.kernel.org/show_bug.cgi?id=15385

    Signed-off-by: Ondrej Zary
    Tested-by: Alan Stern
    Acked-by: H. Peter Anvin
    Signed-off-by: Rafael J. Wysocki

    Ondrej Zary
     

08 Apr, 2010

1 commit

  • …git/x86/linux-2.6-tip

    * 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-tip:
    x86: Fix double enable_IR_x2apic() call on SMP kernel on !SMP boards
    x86: Increase CONFIG_NODES_SHIFT max to 10
    ibft, x86: Change reserve_ibft_region() to find_ibft_region()
    x86, hpet: Fix bug in RTC emulation
    x86, hpet: Erratum workaround for read after write of HPET comparator
    bootmem, x86: Fix 32bit numa system without RAM on node 0
    nobootmem, x86: Fix 32bit numa system without RAM on node 0
    x86: Handle overlapping mptables
    x86: Make e820_remove_range to handle all covered case
    x86-32, resume: do a global tlb flush in S4 resume

    Linus Torvalds
     

31 Mar, 2010

1 commit

  • Colin King reported a strange oops in S4 resume code path (see below). The test
    system has i5/i7 CPU. The kernel doesn't open PAE, so 4M page table is used.
    The oops always happen a virtual address 0xc03ff000, which is mapped to the
    last 4k of first 4M memory. Doing a global tlb flush fixes the issue.

    EIP: 0060:[] EFLAGS: 00010086 CPU: 0
    EIP is at copy_loop+0xe/0x15
    EAX: 36aeb000 EBX: 00000000 ECX: 00000400 EDX: f55ad46c
    ESI: 0f800000 EDI: c03ff000 EBP: f67fbec4 ESP: f67fbea8
    DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
    ...
    ...
    CR2: 00000000c03ff000

    Tested-by: Colin Ian King
    Signed-off-by: Shaohua Li
    LKML-Reference:
    Acked-by: Rafael J. Wysocki
    Signed-off-by: H. Peter Anvin
    Cc:

    Shaohua Li
     

30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

08 Nov, 2009

1 commit

  • This patch rebase the implementation of the breakpoints API on top of
    perf events instances.

    Each breakpoints are now perf events that handle the
    register scheduling, thread/cpu attachment, etc..

    The new layering is now made as follows:

    ptrace kgdb ftrace perf syscall
    \ | / /
    \ | / /
    /
    Core breakpoint API /
    /
    | /
    | /

    Breakpoints perf events

    |
    |

    Breakpoints PMU ---- Debug Register constraints handling
    (Part of core breakpoint API)
    |
    |

    Hardware debug registers

    Reasons of this rewrite:

    - Use the centralized/optimized pmu registers scheduling,
    implying an easier arch integration
    - More powerful register handling: perf attributes (pinned/flexible
    events, exclusive/non-exclusive, tunable period, etc...)

    Impact:

    - New perf ABI: the hardware breakpoints counters
    - Ptrace breakpoints setting remains tricky and still needs some per
    thread breakpoints references.

    Todo (in the order):

    - Support breakpoints perf counter events for perf tools (ie: implement
    perf_bpcounter_event())
    - Support from perf tools

    Changes in v2:

    - Follow the perf "event " rename
    - The ptrace regression have been fixed (ptrace breakpoint perf events
    weren't released when a task ended)
    - Drop the struct hw_breakpoint and store generic fields in
    perf_event_attr.
    - Separate core and arch specific headers, drop
    asm-generic/hw_breakpoint.h and create linux/hw_breakpoint.h
    - Use new generic len/type for breakpoint
    - Handle off case: when breakpoints api is not supported by an arch

    Changes in v3:

    - Fix broken CONFIG_KVM, we need to propagate the breakpoint api
    changes to kvm when we exit the guest and restore the bp registers
    to the host.

    Changes in v4:

    - Drop the hw_breakpoint_restore() stub as it is only used by KVM
    - EXPORT_SYMBOL_GPL hw_breakpoint_restore() as KVM can be built as a
    module
    - Restore the breakpoints unconditionally on kvm guest exit:
    TIF_DEBUG_THREAD doesn't anymore cover every cases of running
    breakpoints and vcpu->arch.switch_db_regs might not always be
    set when the guest used debug registers.
    (Waiting for a reliable optimization)

    Changes in v5:

    - Split-up the asm-generic/hw-breakpoint.h moving to
    linux/hw_breakpoint.h into a separate patch
    - Optimize the breakpoints restoring while switching from kvm guest
    to host. We only want to restore the state if we have active
    breakpoints to the host, otherwise we don't care about messed-up
    address registers.
    - Add asm/hw_breakpoint.h to Kbuild
    - Fix bad breakpoint type in trace_selftest.c

    Changes in v6:

    - Fix wrong header inclusion in trace.h (triggered a build
    error with CONFIG_FTRACE_SELFTEST

    Signed-off-by: Frederic Weisbecker
    Cc: Prasad
    Cc: Alan Stern
    Cc: Peter Zijlstra
    Cc: Arnaldo Carvalho de Melo
    Cc: Steven Rostedt
    Cc: Ingo Molnar
    Cc: Jan Kiszka
    Cc: Jiri Slaby
    Cc: Li Zefan
    Cc: Avi Kivity
    Cc: Paul Mackerras
    Cc: Mike Galbraith
    Cc: Masami Hiramatsu
    Cc: Paul Mundt

    Frederic Weisbecker
     

18 Oct, 2009

1 commit


18 Sep, 2009

1 commit


07 Sep, 2009

1 commit


27 Aug, 2009

1 commit


22 Aug, 2009

1 commit

  • SDM Vol 3a section titled "MTRR considerations in MP systems" specifies
    the need for synchronizing the logical cpu's while initializing/updating
    MTRR.

    Currently Linux kernel does the synchronization of all cpu's only when
    a single MTRR register is programmed/updated. During an AP online
    (during boot/cpu-online/resume) where we initialize all the MTRR/PAT registers,
    we don't follow this synchronization algorithm.

    This can lead to scenarios where during a dynamic cpu online, that logical cpu
    is initializing MTRR/PAT with cache disabled (cr0.cd=1) etc while other logical
    HT sibling continue to run (also with cache disabled because of cr0.cd=1
    on its sibling).

    Starting from Westmere, VMX transitions with cr0.cd=1 don't work properly
    (because of some VMX performance optimizations) and the above scenario
    (with one logical cpu doing VMX activity and another logical cpu coming online)
    can result in system crash.

    Fix the MTRR initialization by doing rendezvous of all the cpus. During
    boot and resume, we delay the MTRR/PAT init for APs till all the
    logical cpu's come online and the rendezvous process at the end of AP's bringup,
    will initialize the MTRR/PAT for all AP's.

    For dynamic single cpu online, we synchronize all the logical cpus and
    do the MTRR/PAT init on the AP that is coming online.

    Signed-off-by: Suresh Siddha
    Signed-off-by: H. Peter Anvin

    Suresh Siddha
     

08 Jul, 2009

1 commit

  • Patch 08687aec71bc9134fe336e561f6did877bacf74fc0a (x86: unify
    power/cpu_(32|64).c) renamed cpu_32.c to cpu.c, but did not update
    the special compilation flags for the file for the new name.

    This patch fixes the compilation flags, and therefore fixes resume
    from suspend on my Acer Aspire One.

    [rjw: The regression from 2.6.30 fixed by this patch is tracked as
    http://bugzilla.kernel.org/show_bug.cgi?id=13661]

    Signed-off-by: Peter Chubb
    Signed-off-by: Rafael J. Wysocki

    Peter Chubb
     

24 Jun, 2009

1 commit


17 Jun, 2009

1 commit

  • Conflicts:
    arch/x86/Kconfig
    arch/x86/kernel/traps.c
    arch/x86/power/cpu.c
    arch/x86/power/cpu_32.c
    kernel/Makefile

    Semantic conflict:
    arch/x86/kernel/hw_breakpoint.c

    Merge reason: Resolve the conflicts, move from put_cpu_no_sched() to
    put_cpu() in arch/x86/kernel/hw_breakpoint.c.

    Signed-off-by: Ingo Molnar

    Ingo Molnar
     

13 Jun, 2009

6 commits

  • This is the last unification step. Here we do remove one of the files
    and rename the left one as cpu.c, as both are now the same.
    Also update power/Makefile, telling it to build cpu.o, instead of
    cpu_(32|64).o

    Signed-off-by: Sergio Luis
    Signed-off-by: Lauro Salmito
    Signed-off-by: Rafael J. Wysocki

    Sergio Luis
     
  • In this step, we do unify the copyright notes for both files
    cpu_32.c and cpu_64.c, making such files exactly the same.
    It's the last step before the actual unification, that will
    rename one of them to cpu.c and remove the other one.

    Signed-off-by: Sergio Luis
    Signed-off-by: Lauro Salmito
    Signed-off-by: Rafael J. Wysocki

    Sergio Luis
     
  • In this step we do unify cpu_32.c and cpu_64.c functions that
    work on restoring the saved processor state. Also, we do
    eliminate the forward declaration of fix_processor_context()
    for X86_64, as it's not needed anymore.

    Signed-off-by: Sergio Luis
    Signed-off-by: Lauro Salmito
    Signed-off-by: Rafael J. Wysocki

    Sergio Luis
     
  • In this step we do unify cpu_32.c and cpu_64.c functions that
    work on saving the processor state.

    Signed-off-by: Sergio Luis
    Signed-off-by: Lauro Salmito
    Signed-off-by: Rafael J. Wysocki

    Sergio Luis
     
  • Aiming total unification of cpu_32.c and cpu_64.c, in this step
    we do unify the global variables and existing forward declarations
    for such files.

    Signed-off-by: Sergio Luis
    Signed-off-by: Lauro Salmito
    Signed-off-by: Rafael J. Wysocki

    Sergio Luis
     
  • First step towards the unification of cpu_32.c and cpu_64.c.
    This commit unifies the headers of such files, making both
    of them use the same header files. It also remove the uneeded
    .

    Signed-off-by: Sergio Luis
    Signed-off-by: Lauro Salmito
    Signed-off-by: Rafael J. Wysocki

    Sergio Luis
     

03 Jun, 2009

2 commits

  • This patch enables the use of wrapper routines to access the debug/breakpoint
    registers on cpu management.

    The hardcoded debug registers save and restore operations for threads
    breakpoints are replaced by wrappers.

    And now that we handle the kernel breakpoints too, we also need to handle them
    on cpu hotplug operations.

    [ Impact: adapt new hardware breakpoint api to cpu hotplug ]

    Original-patch-by: Alan Stern
    Signed-off-by: K.Prasad
    Reviewed-by: Alan Stern
    Signed-off-by: Frederic Weisbecker

    K.Prasad
     
  • The generic hardware breakpoint interface provides an abstraction of
    hardware breakpoints in front of specific arch implementations for both kernel
    and user side breakpoints.
    This includes execution breakpoints and read/write breakpoints, also known as
    "watchpoints".

    This patch introduces header files containing constants, structure definitions
    and declaration of functions used by the hardware breakpoint core and x86
    specific code.
    It also introduces an array based storage for the debug-register values in
    'struct thread_struct', while modifying all users of debugreg member in the
    structure.

    [ Impact: add headers for new hardware breakpoint interface ]

    Original-patch-by: Alan Stern
    Signed-off-by: K.Prasad
    Reviewed-by: Alan Stern
    Signed-off-by: Frederic Weisbecker

    K.Prasad
     

04 Apr, 2009

1 commit

  • The __restore_processor_state() fn restores %gs on resume from S3. As
    such, it cannot be protected by the stack-protector guard since %gs will
    not be correct on function entry.

    There are only a few other fns in this file and it should not negatively
    impact kernel security that they will also have the stack-protector
    guard removed (and so it's not worth moving them to another file).

    Without this change, S3 resume on a kernel built with
    CONFIG_CC_STACKPROTECTOR_ALL=y will fail.

    Signed-off-by: Joseph Cihula
    Tested-by: Chris Wright
    Cc: Arjan van de Ven
    Cc: Tejun Heo
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Joseph Cihula
     

01 Apr, 2009

1 commit

  • Make the following header file changes:

    - remove arch ifdefs and asm/suspend.h from linux/suspend.h
    - add asm/suspend.h to disk.c (for arch_prepare_suspend())
    - add linux/io.h to swsusp.c (for ioremap())
    - x86 32/64 bit compile fixes

    Signed-off-by: Magnus Damm
    Cc: Paul Mundt
    Acked-by: "Rafael J. Wysocki"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Magnus Damm
     

14 Feb, 2009

1 commit


13 Nov, 2008

1 commit

  • Impact: fix crash during hibernation on 32-bit NUMA

    The NUMA code on x86_32 creates special memory mapping that allows
    each node's pgdat to be located in this node's memory. For this
    purpose it allocates a memory area at the end of each node's memory
    and maps this area so that it is accessible with virtual addresses
    belonging to low memory. As a result, if there is high memory,
    these NUMA-allocated areas are physically located in high memory,
    although they are mapped to low memory addresses.

    Our hibernation code does not take that into account and for this
    reason hibernation fails on all x86_32 systems with CONFIG_NUMA=y and
    with high memory present. Fix this by adding a special mapping for
    the NUMA-allocated memory areas to the temporary page tables created
    during the last phase of resume.

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Ingo Molnar

    Rafael J. Wysocki
     

12 Oct, 2008

1 commit


05 Sep, 2008

1 commit


28 Aug, 2008

1 commit


20 Aug, 2008

1 commit


18 Aug, 2008

1 commit

  • arch/x86/power/cpu_32.c __save_processor_state calls read_cr4()
    only a i486 CPU doesn't have the CR4 register. Trying to read it
    produces an invalid opcode oops during suspend to disk.

    Use the safe rc4 reading op instead. If the value to be written is
    zero the write is skipped.

    arch/x86/power/hibernate_asm_32.S
    done: swapped the use of %eax and %ecx to use jecxz for
    the zero test and jump over store to %cr4.
    restore_image: s/%ecx/%eax/ to be consistent with done:

    In addition to __save_processor_state, acpi_save_state_mem,
    efi_call_phys_prelog, and efi_call_phys_epilog had checks added
    (acpi restore was in assembly and already had a check for
    non-zero). There were other reads and writes of CR4, but MCE and
    virtualization shouldn't be executed on a i486 anyway.

    Signed-off-by: David Fries
    Acked-by: H. Peter Anvin
    Signed-off-by: Ingo Molnar

    David Fries
     

08 Jul, 2008

1 commit


17 Apr, 2008

1 commit

  • Before:
    total: 15 errors, 3 warnings, 133 lines checked
    After:
    total: 0 errors, 0 warnings, 138 lines checked

    No code changed:

    arch/x86/power/cpu_32.o:

    text data bss dec hex filename
    739 0 84 823 337 cpu_32.o.before
    739 0 84 823 337 cpu_32.o.after

    md5:
    eb0726223a5e26b195e65f0ae2c0ec66 cpu_32.o.before.asm
    eb0726223a5e26b195e65f0ae2c0ec66 cpu_32.o.after.asm

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

    Paolo Ciarrocchi
     

19 Feb, 2008

1 commit


10 Feb, 2008

4 commits

  • In some suspend and hibernation files in arch/x86/power there are
    comments referring to arch/x86-64 and arch/i386 . Update them to
    reflect the current code layout.

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Rafael J. Wysocki
     
  • Move the hibernation-specific code from arch/x86/power/suspend_64.c
    to a separate file (hibernate_64.c) and the CPU-handling code to
    cpu_64.c (in line with the corresponding 32-bit code).

    Simplify arch/x86/power/Makefile .

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Rafael J. Wysocki
     
  • Rename cpu.c, suspend.c and swsusp.S in arch/x86/power to cpu_32.c,
    hibernate_32.c and hibernate_asm_32.S, respectively, and update the
    purpose and copyright information in these files.

    Update the Makefile in arch/x86/power to reflect the above changes.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Rafael J. Wysocki
     
  • Move arch/x86/kernel/suspend_64.c to arch/x86/power .

    Move arch/x86/kernel/suspend_asm_64.S to arch/x86/power
    as hibernate_asm_64.S .

    Update purpose and copyright information in
    arch/x86/power/suspend_64.c and
    arch/x86/power/hibernate_asm_64.S .

    Update the Makefiles in arch/x86, arch/x86/kernel and
    arch/x86/power to reflect the above changes.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Rafael J. Wysocki