10 Sep, 2010

1 commit

  • Create attributes:

    /sys/devices/system/cpu/cpuX/topology/book_id
    /sys/devices/system/cpu/cpuX/topology/book_siblings

    which show the book id and the book siblings of a cpu.

    Unlike the attributes for SMT and MC these attributes are only present if
    CONFIG_SCHED_BOOK is set. There is no reason to pollute sysfs for every
    architecture with unused attributes.

    Signed-off-by: Heiko Carstens
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Heiko Carstens
     

28 May, 2010

1 commit


12 Jan, 2009

1 commit


08 Jan, 2009

1 commit

  • Due to changeset ba84be2338d3a2b6020d39279335bb06fcd332e1 ("remove
    linux/hardirq.h from asm-generic/local.h") the sparc64 build started
    failing on drivers/base/topology.c:

    drivers/base/topology.c: In function ‘show_physical_package_id’:
    drivers/base/topology.c:103: error: implicit declaration of function ‘cpu_data’
    drivers/base/topology.c:103: error: request for member ‘proc_id’ in something not a structure or union
    drivers/base/topology.c: In function ‘show_core_id’:
    drivers/base/topology.c:106: error: request for member ‘core_id’ in something not a structure or union

    Adding the obvious fix of including asm/cpudata.h into asm/topology.h on
    sparc64 doesn't fix it, in fact it makes things worse because of the
    header file dependency chain:

    linux/gfp.h --> linux/mmzone.h --> linux/topology.h -->
    asm/topology.h --> asm/cpudata.h --> linux/percpu.h -->
    linux/slab.h

    which results in:

    include/linux/slub_def.h: In function ‘kmalloc_large’:
    include/linux/slub_def.h:209: error: implicit declaration of function ‘__get_free_pages’
    include/linux/slub_def.h:209: error: ‘__GFP_COMP’ undeclared (first use in this function)
    include/linux/slub_def.h:209: error: (Each undeclared identifier is reported only once
    include/linux/slub_def.h:209: error: for each function it appears in.)
    include/linux/slub_def.h:209: warning: cast to pointer from integer of different size

    The simplest thing to do is to add yet another one-off hack like parts
    of the guilty changeset did, by putting an explicit linux/hardirq.h
    include into drivers/base/topology.c

    Signed-off-by: David S. Miller
    Signed-off-by: Linus Torvalds

    David Miller
     

13 Dec, 2008

1 commit

  • …t_scnprintf to take pointers.

    Impact: change calling convention of existing cpumask APIs

    Most cpumask functions started with cpus_: these have been replaced by
    cpumask_ ones which take struct cpumask pointers as expected.

    These four functions don't have good replacement names; fortunately
    they're rarely used, so we just change them over.

    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    Signed-off-by: Mike Travis <travis@sgi.com>
    Acked-by: Ingo Molnar <mingo@elte.hu>
    Cc: paulus@samba.org
    Cc: mingo@redhat.com
    Cc: tony.luck@intel.com
    Cc: ralf@linux-mips.org
    Cc: Greg Kroah-Hartman <gregkh@suse.de>
    Cc: cl@linux-foundation.org
    Cc: srostedt@redhat.com

    Rusty Russell
     

22 Jul, 2008

1 commit

  • This allow to dynamically generate attributes and share show/store
    functions between attributes. Right now most attributes are generated
    by special macros and lots of duplicated code. With the attribute
    passed it's instead possible to attach some data to the attribute
    and then use that in shared low level functions to do different things.

    I need this for the dynamically generated bank attributes in the x86
    machine check code, but it'll allow some further cleanups.

    I converted all users in tree to the new show/store prototype. It's a single
    huge patch to avoid unbisectable sections.

    Runtime tested: x86-32, x86-64
    Compiled only: ia64, powerpc
    Not compile tested/only grep converted: sh, arm, avr32

    Signed-off-by: Andi Kleen
    Signed-off-by: Greg Kroah-Hartman

    Andi Kleen
     

16 Jul, 2008

1 commit


08 Jul, 2008

1 commit

  • * Introduce a new PER_CPU macro called "EARLY_PER_CPU". This is
    used by some per_cpu variables that are initialized and accessed
    before there are per_cpu areas allocated.

    ["Early" in respect to per_cpu variables is "earlier than the per_cpu
    areas have been setup".]

    This patchset adds these new macros:

    DEFINE_EARLY_PER_CPU(_type, _name, _initvalue)
    EXPORT_EARLY_PER_CPU_SYMBOL(_name)
    DECLARE_EARLY_PER_CPU(_type, _name)

    early_per_cpu_ptr(_name)
    early_per_cpu_map(_name, _idx)
    early_per_cpu(_name, _cpu)

    The DEFINE macro defines the per_cpu variable as well as the early
    map and pointer. It also initializes the per_cpu variable and map
    elements to "_initvalue". The early_* macros provide access to
    the initial map (usually setup during system init) and the early
    pointer. This pointer is initialized to point to the early map
    but is then NULL'ed when the actual per_cpu areas are setup. After
    that the per_cpu variable is the correct access to the variable.

    The early_per_cpu() macro is not very efficient but does show how to
    access the variable if you have a function that can be called both
    "early" and "late". It tests the early ptr to be NULL, and if not
    then it's still valid. Otherwise, the per_cpu variable is used
    instead:

    #define early_per_cpu(_name, _cpu) \
    (early_per_cpu_ptr(_name) ? \
    early_per_cpu_ptr(_name)[_cpu] : \
    per_cpu(_name, _cpu))

    A better method is to actually check the pointer manually. In the
    case below, numa_set_node can be called both "early" and "late":

    void __cpuinit numa_set_node(int cpu, int node)
    {
    int *cpu_to_node_map = early_per_cpu_ptr(x86_cpu_to_node_map);

    if (cpu_to_node_map)
    cpu_to_node_map[cpu] = node;
    else
    per_cpu(x86_cpu_to_node_map, cpu) = node;
    }

    * Add a flag "arch_provides_topology_pointers" that indicates pointers
    to topology cpumask_t maps are available. Otherwise, use the function
    returning the cpumask_t value. This is useful if cpumask_t set size
    is very large to avoid copying data on to/off of the stack.

    * The coverage of CONFIG_DEBUG_PER_CPU_MAPS has been increased while
    the non-debug case has been optimized a bit.

    * Remove an unreferenced compiler warning in drivers/base/topology.c

    * Clean up #ifdef in setup.c

    For inclusion into sched-devel/latest tree.

    Based on:
    git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
    + sched-devel/latest .../mingo/linux-2.6-sched-devel.git

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

    Mike Travis
     

13 Jun, 2008

2 commits

  • simplify drivers/base/topology.c a bit.

    Signed-off-by: Ben Hutchings
    Signed-off-by: Ingo Molnar

    Ben Hutchings
     
  • This can result in an empty topology directory in sysfs, and requires
    in-kernel users to protect all uses with #ifdef - see
    .

    The documentation of CPU topology specifies what the defaults should be if
    only partial information is available from the hardware. So we can
    provide these defaults as a fallback.

    This patch:

    - Adds default definitions of the 4 topology macros to
    - Changes drivers/base/topology.c to use the topology macros unconditionally
    and to cope with definitions that aren't lvalues
    - Updates documentation accordingly

    [ From: Andrew Morton
    - fold now-duplicated code
    - fix layout
    ]

    Signed-off-by: Ben Hutchings
    Cc: Vegard Nossum
    Cc: Nick Piggin
    Cc: Chandra Seetharaman
    Cc: Suresh Siddha
    Cc: Mike Travis
    Cc: Christoph Lameter
    Cc: John Hawkes
    Cc: Zhang, Yanmin
    Signed-off-by: Andrew Morton
    Signed-off-by: Ingo Molnar

    Ben Hutchings
     

20 Apr, 2008

1 commit

  • * Cleaned up references to cpumask_scnprintf() and added new
    cpulist_scnprintf() interfaces where appropriate.

    * Fix some small bugs (or code efficiency improvments) for various uses
    of cpumask_scnprintf.

    * Clean up some checkpatch errors.

    Signed-off-by: Mike Travis
    Signed-off-by: Ingo Molnar

    Mike Travis
     

19 Oct, 2007

1 commit

  • By previous cpu hotplug notifier change, we don't need to track topology_dev
    existence for each cpu by topology_dev_map.

    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Akinobu Mita
    Cc: Gautham R Shenoy
    Cc: Oleg Nesterov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Akinobu Mita
     

10 May, 2007

1 commit

  • Since nonboot CPUs are now disabled after tasks and devices have been
    frozen and the CPU hotplug infrastructure is used for this purpose, we need
    special CPU hotplug notifications that will help the CPU-hotplug-aware
    subsystems distinguish normal CPU hotplug events from CPU hotplug events
    related to a system-wide suspend or resume operation in progress. This
    patch introduces such notifications and causes them to be used during
    suspend and resume transitions. It also changes all of the
    CPU-hotplug-aware subsystems to take these notifications into consideration
    (for now they are handled in the same way as the corresponding "normal"
    ones).

    [oleg@tv-sign.ru: cleanups]
    Signed-off-by: Rafael J. Wysocki
    Cc: Gautham R Shenoy
    Cc: Pavel Machek
    Signed-off-by: Oleg Nesterov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     

08 Dec, 2006

1 commit

  • There was lots of #ifdef noise in the kernel due to hotcpu_notifier(fn,
    prio) not correctly marking 'fn' as used in the !HOTPLUG_CPU case, and thus
    generating compiler warnings of unused symbols, hence forcing people to add
    #ifdefs.

    the compiler can skip truly unused functions just fine:

    text data bss dec hex filename
    1624412 728710 3674856 6027978 5bfaca vmlinux.before
    1624412 728710 3674856 6027978 5bfaca vmlinux.after

    [akpm@osdl.org: topology.c fix]
    Signed-off-by: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ingo Molnar
     

02 Dec, 2006

1 commit

  • Take return value of sysfs_create_group() into account. That function got
    called in case of CPU_ONLINE notification. Since callbacks are not allowed
    to fail on CPU_ONLINE notification do the sysfs group creation on
    CPU_UP_PREPARE notification.

    Also remember if creation succeeded in a bitmask. So it's possible to know
    whether it's legal to call sysfs_remove_group or not.

    In addition some other minor stuff:

    - since CPU_UP_PREPARE might fail add CPU_UP_CANCELED handling as well.
    - use hotcpu_notifier instead of register_hotcpu_notifier.
    - #ifdef code that isn't needed in the !CONFIG_HOTPLUG_CPU case.

    Signed-off-by: Heiko Carstens
    Acked-by: Cornelia Huck
    Signed-off-by: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    Heiko Carstens
     

19 Oct, 2006

1 commit


01 Aug, 2006

1 commit


28 Jun, 2006

2 commits

  • Make notifier_blocks associated with cpu_notifier as __cpuinitdata.

    __cpuinitdata makes sure that the data is init time only unless
    CONFIG_HOTPLUG_CPU is defined.

    Signed-off-by: Chandra Seetharaman
    Cc: Ashok Raj
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Chandra Seetharaman
     
  • In 2.6.17, there was a problem with cpu_notifiers and XFS. I provided a
    band-aid solution to solve that problem. In the process, i undid all the
    changes you both were making to ensure that these notifiers were available
    only at init time (unless CONFIG_HOTPLUG_CPU is defined).

    We deferred the real fix to 2.6.18. Here is a set of patches that fixes the
    XFS problem cleanly and makes the cpu notifiers available only at init time
    (unless CONFIG_HOTPLUG_CPU is defined).

    If CONFIG_HOTPLUG_CPU is defined then cpu notifiers are available at run
    time.

    This patch reverts the notifier_call changes made in 2.6.17

    Signed-off-by: Chandra Seetharaman
    Cc: Ashok Raj
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Chandra Seetharaman
     

26 Apr, 2006

1 commit


04 Feb, 2006

1 commit

  • The patch implements cpu topology exportation by sysfs.

    Items (attributes) are similar to /proc/cpuinfo.

    1) /sys/devices/system/cpu/cpuX/topology/physical_package_id:
    represent the physical package id of cpu X;
    2) /sys/devices/system/cpu/cpuX/topology/core_id:
    represent the cpu core id to cpu X;
    3) /sys/devices/system/cpu/cpuX/topology/thread_siblings:
    represent the thread siblings to cpu X in the same core;
    4) /sys/devices/system/cpu/cpuX/topology/core_siblings:
    represent the thread siblings to cpu X in the same physical package;

    To implement it in an architecture-neutral way, a new source file,
    driver/base/topology.c, is to export the 5 attributes.

    If one architecture wants to support this feature, it just needs to
    implement 4 defines, typically in file include/asm-XXX/topology.h.
    The 4 defines are:
    #define topology_physical_package_id(cpu)
    #define topology_core_id(cpu)
    #define topology_thread_siblings(cpu)
    #define topology_core_siblings(cpu)

    The type of **_id is int.
    The type of siblings is cpumask_t.

    To be consistent on all architectures, the 4 attributes should have
    deafult values if their values are unavailable. Below is the rule.

    1) physical_package_id: If cpu has no physical package id, -1 is the
    default value.

    2) core_id: If cpu doesn't support multi-core, its core id is 0.

    3) thread_siblings: Just include itself, if the cpu doesn't support
    HT/multi-thread.

    4) core_siblings: Just include itself, if the cpu doesn't support
    multi-core and HT/Multi-thread.

    So be careful when declaring the 4 defines in include/asm-XXX/topology.h.

    If an attribute isn't defined on an architecture, it won't be exported.

    Thank Nathan, Greg, Andi, Paul and Venki.

    The patch provides defines for i386/x86_64/ia64.

    Signed-off-by: Zhang, Yanmin
    Cc: Ingo Molnar
    Cc: Nick Piggin
    Cc: Greg KH
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Zhang, Yanmin