12 Aug, 2008

1 commit


28 Jul, 2008

3 commits

  • Instead of a "cpu" arg with magic values NR_CPUS (any cpu) and ~0 (all
    cpus), pass a cpumask_t. Allow NULL for the common case (where we
    don't care which CPU the function is run on): temporary cpumask_t's
    are usually considered bad for stack space.

    This deprecates stop_machine_run, to be removed soon when all the
    callers are dead.

    Signed-off-by: Rusty Russell

    Rusty Russell
     
  • stop_machine creates a kthread which creates kernel threads. We can
    create those threads directly and simplify things a little. Some care
    must be taken with CPU hotunplug, which has special needs, but that code
    seems more robust than it was in the past.

    Signed-off-by: Rusty Russell
    Acked-by: Christian Borntraeger

    Rusty Russell
     
  • -allow stop_mahcine_run() to call a function on all cpus. Calling
    stop_machine_run() with a 'ALL_CPUS' invokes this new behavior.
    stop_machine_run() proceeds as normal until the calling cpu has
    invoked 'fn'. Then, we tell all the other cpus to call 'fn'.

    Signed-off-by: Jason Baron
    Signed-off-by: Mathieu Desnoyers
    Signed-off-by: Rusty Russell
    CC: Adrian Bunk
    CC: Andi Kleen
    CC: Alexey Dobriyan
    CC: Christoph Hellwig
    CC: mingo@elte.hu
    CC: akpm@osdl.org

    Jason Baron
     

19 Jul, 2008

1 commit

  • * This patch replaces the dangerous lvalue version of cpumask_of_cpu
    with new cpumask_of_cpu_ptr macros. These are patterned after the
    node_to_cpumask_ptr macros.

    In general terms, if there is a cpumask_of_cpu_map[] then a pointer to
    the cpumask_of_cpu_map[cpu] entry is used. The cpumask_of_cpu_map
    is provided when there is a large NR_CPUS count, reducing
    greatly the amount of code generated and stack space used for
    cpumask_of_cpu(). The pointer to the cpumask_t value is needed for
    calling set_cpus_allowed_ptr() to reduce the amount of stack space
    needed to pass the cpumask_t value.

    If there isn't a cpumask_of_cpu_map[], then a temporary variable is
    declared and filled in with value from cpumask_of_cpu(cpu) as well as
    a pointer variable pointing to this temporary variable. Afterwards,
    the pointer is used to reference the cpumask value. The compiler
    will optimize out the extra dereference through the pointer as well
    as the stack space used for the pointer, resulting in identical code.

    A good example of the orthogonal usages is in net/sunrpc/svc.c:

    case SVC_POOL_PERCPU:
    {
    unsigned int cpu = m->pool_to[pidx];
    cpumask_of_cpu_ptr(cpumask, cpu);

    *oldmask = current->cpus_allowed;
    set_cpus_allowed_ptr(current, cpumask);
    return 1;
    }
    case SVC_POOL_PERNODE:
    {
    unsigned int node = m->pool_to[pidx];
    node_to_cpumask_ptr(nodecpumask, node);

    *oldmask = current->cpus_allowed;
    set_cpus_allowed_ptr(current, nodecpumask);
    return 1;
    }

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

    Mike Travis
     

24 Jun, 2008

1 commit

  • Hidehiro Kawai noticed that sched_setscheduler() can fail in
    stop_machine: it calls sched_setscheduler() from insmod, which can
    have CAP_SYS_MODULE without CAP_SYS_NICE.

    Two cases could have failed, so are changed to sched_setscheduler_nocheck:
    kernel/softirq.c:cpu_callback()
    - CPU hotplug callback
    kernel/stop_machine.c:__stop_machine_run()
    - Called from various places, including modprobe()

    Signed-off-by: Rusty Russell
    Cc: Jeremy Fitzhardinge
    Cc: Hidehiro Kawai
    Cc: Andrew Morton
    Cc: linux-mm@kvack.org
    Cc: sugita
    Cc: Satoshi OSHIMA
    Signed-off-by: Ingo Molnar

    Rusty Russell
     

23 May, 2008

1 commit

  • On kvm I have seen some rare hangs in stop_machine when I used more guest
    cpus than hosts cpus. e.g. 32 guest cpus on 1 host cpu triggered the
    hang quite often. I could also reproduce the problem on a 4 way z/VM host with
    a 64 way guest.

    It turned out that the guest was consuming all available cpus mostly for
    spinning on scheduler locks like rq->lock. This is expected as the threads are
    calling yield all the time.
    The problem is now, that the host scheduling decisings together with the guest
    scheduling decisions and spinlocks not being fair managed to create an
    interesting scenario similar to a live lock. (Sometimes the hang resolved
    itself after some minutes)

    Changing stop_machine to yield the cpu to the hypervisor when yielding inside
    the guest fixed the problem for me. While I am not completely happy with this
    patch, I think it causes no harm and it really improves the situation for me.

    I used cpu_relax for yielding to the hypervisor, does that work on all
    architectures?

    p.s.: If you want to reproduce the problem, cpu hotplug and kprobes use
    stop_machine_run and both triggered the problem after some retries.

    Signed-off-by: Christian Borntraeger
    CC: Ingo Molnar
    Signed-off-by: Rusty Russell

    Christian Borntraeger
     

22 Apr, 2008

3 commits

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/juhl/trivial: (24 commits)
    DOC: A couple corrections and clarifications in USB doc.
    Generate a slightly more informative error msg for bad HZ
    fix typo "is" -> "if" in Makefile
    ext*: spelling fix prefered -> preferred
    DOCUMENTATION: Use newer DEFINE_SPINLOCK macro in docs.
    KEYS: Fix the comment to match the file name in rxrpc-type.h.
    RAID: remove trailing space from printk line
    DMA engine: typo fixes
    Remove unused MAX_NODES_SHIFT
    MAINTAINERS: Clarify access to OCFS2 development mailing list.
    V4L: Storage class should be before const qualifier (sn9c102)
    V4L: Storage class should be before const qualifier
    sonypi: Storage class should be before const qualifier
    intel_menlow: Storage class should be before const qualifier
    DVB: Storage class should be before const qualifier
    arm: Storage class should be before const qualifier
    ALSA: Storage class should be before const qualifier
    acpi: Storage class should be before const qualifier
    firmware_sample_driver.c: fix coding style
    MAINTAINERS: Add ati_remote2 driver
    ...

    Fixed up trivial conflicts in firmware_sample_driver.c

    Linus Torvalds
     
  • * 'semaphore' of git://git.kernel.org/pub/scm/linux/kernel/git/willy/misc:
    Deprecate the asm/semaphore.h files in feature-removal-schedule.
    Convert asm/semaphore.h users to linux/semaphore.h
    security: Remove unnecessary inclusions of asm/semaphore.h
    lib: Remove unnecessary inclusions of asm/semaphore.h
    kernel: Remove unnecessary inclusions of asm/semaphore.h
    include: Remove unnecessary inclusions of asm/semaphore.h
    fs: Remove unnecessary inclusions of asm/semaphore.h
    drivers: Remove unnecessary inclusions of asm/semaphore.h
    net: Remove unnecessary inclusions of asm/semaphore.h
    arch: Remove unnecessary inclusions of asm/semaphore.h

    Linus Torvalds
     
  • These are small cleanups all over the tree.

    Trivial style and comment changes to
    fs/select.c, kernel/signal.c, kernel/stop_machine.c & mm/pdflush.c

    Signed-off-by: Pavel Machek
    Signed-off-by: Jesper Juhl

    Pavel Machek
     

20 Apr, 2008

1 commit

  • * Use new set_cpus_allowed_ptr() function added by previous patch,
    which instead of passing the "newly allowed cpus" cpumask_t arg
    by value, pass it by pointer:

    -int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
    +int set_cpus_allowed_ptr(struct task_struct *p, const cpumask_t *new_mask)

    * Modify CPU_MASK_ALL

    Depends on:
    [sched-devel]: sched: add new set_cpus_allowed_ptr function

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

    Mike Travis
     

19 Apr, 2008

1 commit


07 Feb, 2008

1 commit


26 Jan, 2008

1 commit

  • Replace all lock_cpu_hotplug/unlock_cpu_hotplug from the kernel and use
    get_online_cpus and put_online_cpus instead as it highlights the
    refcount semantics in these operations.

    The new API guarantees protection against the cpu-hotplug operation, but
    it doesn't guarantee serialized access to any of the local data
    structures. Hence the changes needs to be reviewed.

    In case of pseries_add_processor/pseries_remove_processor, use
    cpu_maps_update_begin()/cpu_maps_update_done() as we're modifying the
    cpu_present_map there.

    Signed-off-by: Gautham R Shenoy
    Signed-off-by: Ingo Molnar

    Gautham R Shenoy
     

17 Jul, 2007

1 commit

  • stop_machine_run() does its work on "kstopmachine" thread having max
    priority. However that thread get such priority after woken up.
    Therefore, in the following case ...

    - "kstopmachine" try to run on CPU1

    - There is a real time process which doesn't relinquish CPU time
    voluntary on CPU1

    ... "kstopmachine" can't start to run and the CPU on which
    stop_machine_run() is runing hangs up. To fix this problem, call
    sched_setscheduler() before waking up that thread.

    Signed-off-by: Satoru Takeuchi
    Cc: Rusty Russell
    Cc: Ingo Molnar
    Cc: Oleg Nesterov
    Cc: Ashok Raj
    Cc: Gautham R Shenoy
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Satoru Takeuchi
     

11 May, 2007

1 commit

  • Add a call to hard_irq_disable() to stop_machine so that we make sure IRQs are
    really disabled and not only lazy-disabled on archs like powerpc as some users
    of stop_machine() may rely on that.

    [akpm@linux-foundation.org: build fix]
    Signed-off-by: Benjamin Herrenschmidt
    Acked-by: Rusty Russell
    Cc: Paul Mackerras
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Benjamin Herrenschmidt
     

09 May, 2007

1 commit

  • Replace call_smp_function with stop_machine_run in the Intel RNG driver.

    CPU A has done read_lock(&lock)
    CPU B has done write_lock_irq(&lock) and is waiting for A to release the lock.

    A third CPU calls call_smp_function and issues the IPI. CPU A takes CPU
    C's IPI. CPU B is waiting with interrupts disabled and does not see the
    IPI. CPU C is stuck waiting for CPU B to respond to the IPI.

    Deadlock.

    The solution is to use stop_machine_run instead of call_smp_function
    (call_smp_function should not be called in situations where the CPUs may be
    suspended).

    [haruo.tomita@toshiba.co.jp: fix a typo in mod_init()]
    [haruo.tomita@toshiba.co.jp: fix memory leak]
    Signed-off-by: Prarit Bhargava
    Cc: Jan Beulich
    Cc: "Tomita, Haruo"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Prarit Bhargava
     

30 Sep, 2006

1 commit


28 Aug, 2006

1 commit


04 Jul, 2006

1 commit


26 Jun, 2006

1 commit

  • - Update stop_machine.c to spawn stop_machine as kthreads rather than the
    deprecated kernel_threads.

    - Update stop_machine to use the more efficient kthread_bind() before
    running task in place of set_cpus_allowed() after.

    [akpm@osdl.org: remove now-wrong set_cpus_allowed()]
    Signed-off-by: Serge E. Hallyn
    Cc: Rusty Russell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Serge E. Hallyn
     

11 Jan, 2006

1 commit


14 Nov, 2005

1 commit

  • This fixes deadlock of stop_machine() vs. synchronous IPI send. The
    problem is that stop_machine() disables interrupts before disabling
    preemption on other CPUs. So if another CPU is preempted and then calls
    something like flush_tlb_all() it will deadlock with CPU doing
    stop_machine() and which can't process IPI due to disabled IRQs.

    I changed stop_machine() to do the same things exactly as it does on other
    CPUs, i.e. it should disable preemption first on _all_ CPUs including
    itself and only after that disable IRQs.

    Signed-off-by: Kirill Korotaev
    Cc: Rusty Russell
    Cc: "Andrey Savochkin"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kirill Korotaev
     

22 Jun, 2005

1 commit

  • This patch implements a number of smp_processor_id() cleanup ideas that
    Arjan van de Ven and I came up with.

    The previous __smp_processor_id/_smp_processor_id/smp_processor_id API
    spaghetti was hard to follow both on the implementational and on the
    usage side.

    Some of the complexity arose from picking wrong names, some of the
    complexity comes from the fact that not all architectures defined
    __smp_processor_id.

    In the new code, there are two externally visible symbols:

    - smp_processor_id(): debug variant.

    - raw_smp_processor_id(): nondebug variant. Replaces all existing
    uses of _smp_processor_id() and __smp_processor_id(). Defined
    by every SMP architecture in include/asm-*/smp.h.

    There is one new internal symbol, dependent on DEBUG_PREEMPT:

    - debug_smp_processor_id(): internal debug variant, mapped to
    smp_processor_id().

    Also, i moved debug_smp_processor_id() from lib/kernel_lock.c into a new
    lib/smp_processor_id.c file. All related comments got updated and/or
    clarified.

    I have build/boot tested the following 8 .config combinations on x86:

    {SMP,UP} x {PREEMPT,!PREEMPT} x {DEBUG_PREEMPT,!DEBUG_PREEMPT}

    I have also build/boot tested x64 on UP/PREEMPT/DEBUG_PREEMPT. (Other
    architectures are untested, but should work just fine.)

    Signed-off-by: Ingo Molnar
    Signed-off-by: Arjan van de Ven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ingo Molnar
     

01 May, 2005

1 commit


17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds