17 Jan, 2012

1 commit

  • When suspending, there was a large list of warnings going something like:

    Device 'machinecheck1' does not have a release() function, it is broken and must be fixed

    This patch turns the static mce_devices into dynamically allocated, and
    properly frees them when they are removed from the system. It solves
    the warning messages on my laptop here.

    Reported-by: "Srivatsa S. Bhat"
    Reported-by: Linus Torvalds
    Tested-by: Djalal Harouni
    Cc: Kay Sievers
    Cc: Tony Luck
    Cc: Borislav Petkov
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Linus Torvalds

    Greg Kroah-Hartman
     

08 Jan, 2012

1 commit

  • * 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (73 commits)
    arm: fix up some samsung merge sysdev conversion problems
    firmware: Fix an oops on reading fw_priv->fw in sysfs loading file
    Drivers:hv: Fix a bug in vmbus_driver_unregister()
    driver core: remove __must_check from device_create_file
    debugfs: add missing #ifdef HAS_IOMEM
    arm: time.h: remove device.h #include
    driver-core: remove sysdev.h usage.
    clockevents: remove sysdev.h
    arm: convert sysdev_class to a regular subsystem
    arm: leds: convert sysdev_class to a regular subsystem
    kobject: remove kset_find_obj_hinted()
    m86k: gpio - convert sysdev_class to a regular subsystem
    mips: txx9_sram - convert sysdev_class to a regular subsystem
    mips: 7segled - convert sysdev_class to a regular subsystem
    sh: dma - convert sysdev_class to a regular subsystem
    sh: intc - convert sysdev_class to a regular subsystem
    power: suspend - convert sysdev_class to a regular subsystem
    power: qe_ic - convert sysdev_class to a regular subsystem
    power: cmm - convert sysdev_class to a regular subsystem
    s390: time - convert sysdev_class to a regular subsystem
    ...

    Fix up conflicts with 'struct sysdev' removal from various platform
    drivers that got changed:
    - arch/arm/mach-exynos/cpu.c
    - arch/arm/mach-exynos/irq-eint.c
    - arch/arm/mach-s3c64xx/common.c
    - arch/arm/mach-s3c64xx/cpu.c
    - arch/arm/mach-s5p64x0/cpu.c
    - arch/arm/mach-s5pv210/common.c
    - arch/arm/plat-samsung/include/plat/cpu.h
    - arch/powerpc/kernel/sysfs.c
    and fix up cpu_is_hotpluggable() as per Greg in include/linux/cpu.h

    Linus Torvalds
     

22 Dec, 2011

1 commit

  • This moves the 'cpu sysdev_class' over to a regular 'cpu' subsystem
    and converts the devices to regular devices. The sysdev drivers are
    implemented as subsystem interfaces now.

    After all sysdev classes are ported to regular driver core entities, the
    sysdev implementation will be entirely removed from the kernel.

    Userspace relies on events and generic sysfs subsystem infrastructure
    from sysdev devices, which are made available with this conversion.

    Cc: Haavard Skinnemoen
    Cc: Hans-Christian Egtvedt
    Cc: Tony Luck
    Cc: Fenghua Yu
    Cc: Arnd Bergmann
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Martin Schwidefsky
    Cc: Heiko Carstens
    Cc: Paul Mundt
    Cc: "David S. Miller"
    Cc: Chris Metcalf
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: "H. Peter Anvin"
    Cc: Borislav Petkov
    Cc: Tigran Aivazian
    Cc: Len Brown
    Cc: Zhang Rui
    Cc: Dave Jones
    Cc: Peter Zijlstra
    Cc: Russell King
    Cc: Andrew Morton
    Cc: Arjan van de Ven
    Cc: "Rafael J. Wysocki"
    Cc: "Srivatsa S. Bhat"
    Signed-off-by: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Kay Sievers
     

21 Dec, 2011

1 commit

  • Several fields in struct cpuinfo_x86 were not defined for the
    !SMP case, likely to save space. However, those fields still
    have some meaning for UP, and keeping them allows some #ifdef
    removal from other files. The additional size of the UP kernel
    from this change is not significant enough to worry about
    keeping up the distinction:

    text data bss dec hex filename
    4737168 506459 972040 6215667 5ed7f3 vmlinux.o.before
    4737444 506459 972040 6215943 5ed907 vmlinux.o.after

    for a difference of 276 bytes for an example UP config.

    If someone wants those 276 bytes back badly then it should
    be implemented in a cleaner way.

    Signed-off-by: Kevin Winchester
    Cc: Steffen Persvold
    Link: http://lkml.kernel.org/r/1324428742-12498-1-git-send-email-kjwinchester@gmail.com
    Signed-off-by: Ingo Molnar

    Kevin Winchester
     

16 Jun, 2011

1 commit

  • There are many functions named mce_* so use a new prefix for the subset
    of functions related to sysfs support.

    And since f3c6ea1b06c71b43f751b36bd99345369fe911af introduces
    syscore_ops, use the prefix mce_syscore for some functions related to
    power management which were in sysdev_class before.

    Before: After:
    mce_device mce_sysdev
    mce_sysclass mce_sysdev_class
    mce_attrs mce_sysdev_attrs
    mce_dev_initialized mce_sysdev_initialized
    mce_create_device mce_sysdev_create
    mce_remove_device mce_sysdev_remove

    mce_suspend mce_syscore_suspend
    mce_shutdown mce_syscore_shutdown
    mce_resume mce_syscore_resume

    Signed-off-by: Hidetoshi Seto
    Acked-by: Tony Luck
    Link: http://lkml.kernel.org/r/4DEED81B.8020506@jp.fujitsu.com
    Signed-off-by: Borislav Petkov

    Hidetoshi Seto
     

13 May, 2011

1 commit

  • b may be added to a list, but is not removed before being freed
    in the case of an error. This is done in the corresponding
    deallocation function, so the code here has been changed to
    follow that.

    The sematic match that finds this problem is as follows:
    (http://coccinelle.lip6.fr/)

    //
    @@
    expression E,E1,E2;
    identifier l;
    @@

    *list_add(&E->l,E1);
    ... when != E1
    when != list_del(&E->l)
    when != list_del_init(&E->l)
    when != E = E2
    *kfree(E);//

    Signed-off-by: Julia Lawall
    Cc: Borislav Petkov
    Cc: Robert Richter
    Cc: Yinghai Lu
    Cc: Andreas Herrmann
    Cc:
    Link: http://lkml.kernel.org/r/1305294731-12127-1-git-send-email-julia@diku.dk
    Signed-off-by: Ingo Molnar

    Julia Lawall
     

26 Jan, 2011

1 commit

  • cpu_info is already with per_cpu, We can take llc_shared_map out
    of cpu_info, and declare it as per_cpu variable directly.

    So later referencing could be simple and directly instead of
    diving to find cpu_info at first.

    Also could make smp_store_cpu_info() much simple to avoid to do
    save and restore trick.

    Signed-off-by: Yinghai Lu
    Cc: Hans Rosenfeld
    Cc: Alok N Kataria
    Cc: Stephen Hemminger
    Cc: Hans J. Koch
    Cc: Tejun Heo
    Cc: Borislav Petkov
    Cc: Andreas Herrmann
    Cc: Robert Richter
    Cc: Suresh Siddha
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Yinghai Lu
     

26 Oct, 2010

4 commits


20 Oct, 2010

1 commit

  • We want the BIOS to setup the EILVT APIC registers. The offsets
    were hardcoded and BIOS settings were overwritten by the OS.
    Now, the subsystems for MCE threshold and IBS determine the LVT
    offset from the registers the BIOS has setup. If the BIOS setup
    is buggy on a family 10h system, a workaround enables IBS. If
    the OS determines an invalid register setup, a "[Firmware Bug]:
    " error message is reported.

    We need this change also for upcomming cpu families.

    Signed-off-by: Robert Richter
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Robert Richter
     

11 Oct, 2010

1 commit

  • This fixes possible cases of not collecting valid error info in
    the MCE error thresholding groups on F10h hardware.

    The current code contains a subtle problem of checking only the
    Valid bit of MSR0000_0413 (which is MC4_MISC0 - DRAM
    thresholding group) in its first iteration and breaking out if
    the bit is cleared.

    But (!), this MSR contains an offset value, BlkPtr[31:24], which
    points to the remaining MSRs in this thresholding group which
    might contain valid information too. But if we bail out only
    after we checked the valid bit in the first MSR and not the
    block pointer too, we miss that other information.

    The thing is, MC4_MISC0[BlkPtr] is not predicated on
    MCi_STATUS[MiscV] or MC4_MISC0[Valid] and should be checked
    prior to iterating over the MCI_MISCj thresholding group,
    irrespective of the MC4_MISC0[Valid] setting.

    Signed-off-by: Borislav Petkov
    Cc:
    Signed-off-by: Ingo Molnar

    Borislav Petkov
     

05 Sep, 2010

1 commit

  • kobject_add_internal failed for threshold_bank2 with -EEXIST,
    don't try to register things with the same name in the same
    directory:

    Pid: 1, comm: swapper Tainted: G W 2.6.31 #1
    Call Trace:
    [] ? kobject_add_internal+0x156/0x180
    [] ? kobject_add+0x66/0x6b
    [] ? kobject_init+0x42/0x82
    [] ? kobject_create_and_add+0x34/0x63
    [] ? threshold_create_bank+0x14f/0x259
    [] ? mce_create_device+0x8d/0x1b8
    [] ? threshold_init_device+0x3f/0x80
    [] ? threshold_init_device+0x0/0x80
    [] ? do_one_initcall+0x4f/0x143
    [] ? kernel_init+0x14c/0x1a2
    [] ? child_rip+0xa/0x20
    [] ? kernel_init+0x0/0x1a2
    [] ? child_rip+0x0/0x20
    kobject_create_and_add: kobject_add error: -17

    (Probably the for_each_cpu loop should be entirely removed.)

    Signed-off-by: Andreas Herrmann
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Andreas Herrmann
     

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 Mar, 2010

1 commit

  • Constify struct sysfs_ops.

    This is part of the ops structure constification
    effort started by Arjan van de Ven et al.

    Benefits of this constification:

    * prevents modification of data that is shared
    (referenced) by many other structure instances
    at runtime

    * detects/prevents accidental (but not intentional)
    modification attempts on archs that enforce
    read-only kernel data at runtime

    * potentially better optimized code as the compiler
    can assume that the const data cannot be changed

    * the compiler/linker move const data into .rodata
    and therefore exclude them from false sharing

    Signed-off-by: Emese Revfy
    Acked-by: David Teigland
    Acked-by: Matt Domsch
    Acked-by: Maciej Sosnowski
    Acked-by: Hans J. Koch
    Acked-by: Pekka Enberg
    Acked-by: Jens Axboe
    Acked-by: Stephen Hemminger
    Signed-off-by: Greg Kroah-Hartman

    Emese Revfy
     

20 Sep, 2009

1 commit


16 Sep, 2009

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu: (46 commits)
    powerpc64: convert to dynamic percpu allocator
    sparc64: use embedding percpu first chunk allocator
    percpu: kill lpage first chunk allocator
    x86,percpu: use embedding for 64bit NUMA and page for 32bit NUMA
    percpu: update embedding first chunk allocator to handle sparse units
    percpu: use group information to allocate vmap areas sparsely
    vmalloc: implement pcpu_get_vm_areas()
    vmalloc: separate out insert_vmalloc_vm()
    percpu: add chunk->base_addr
    percpu: add pcpu_unit_offsets[]
    percpu: introduce pcpu_alloc_info and pcpu_group_info
    percpu: move pcpu_lpage_build_unit_map() and pcpul_lpage_dump_cfg() upward
    percpu: add @align to pcpu_fc_alloc_fn_t
    percpu: make @dyn_size mandatory for pcpu_setup_first_chunk()
    percpu: drop @static_size from first chunk allocators
    percpu: generalize first chunk allocator selection
    percpu: build first chunk allocators selectively
    percpu: rename 4k first chunk allocator to page
    percpu: improve boot messages
    percpu: fix pcpu_reclaim() locking
    ...

    Fix trivial conflict as by Tejun Heo in kernel/sched.c

    Linus Torvalds
     

04 Sep, 2009

1 commit

  • This fixes threshold_bank4 support on multi-node processors.

    The correct mask to use is llc_shared_map, representing an internal
    node on Magny-Cours.

    We need to create 2 sets of symlinks for sibling shared banks -- one
    set for each internal node, symlinks of each set should target the
    first core on same internal node.

    Currently only one set is created where all symlinks are targeting
    the first core of the entire socket.

    Signed-off-by: Andreas Herrmann
    Signed-off-by: H. Peter Anvin

    Andreas Herrmann
     

24 Jun, 2009

1 commit

  • Currently, the following three different ways to define percpu arrays
    are in use.

    1. DEFINE_PER_CPU(elem_type[array_len], array_name);
    2. DEFINE_PER_CPU(elem_type, array_name[array_len]);
    3. DEFINE_PER_CPU(elem_type, array_name)[array_len];

    Unify to #1 which correctly separates the roles of the two parameters
    and thus allows more flexibility in the way percpu variables are
    defined.

    [ Impact: cleanup ]

    Signed-off-by: Tejun Heo
    Reviewed-by: Christoph Lameter
    Cc: Ingo Molnar
    Cc: Tony Luck
    Cc: Benjamin Herrenschmidt
    Cc: Thomas Gleixner
    Cc: Jeremy Fitzhardinge
    Cc: linux-mm@kvack.org
    Cc: Christoph Lameter
    Cc: David S. Miller

    Tejun Heo
     

17 Jun, 2009

1 commit