06 Oct, 2010

2 commits

  • Since powerpc uses -Werror on arch powerpc, the build was broken like
    this:

    cc1: warnings being treated as errors
    arch/powerpc/kernel/module.c: In function 'module_finalize':
    arch/powerpc/kernel/module.c:66: error: unused variable 'err'

    Signed-off-by: Stephen Rothwell
    Signed-off-by: Linus Torvalds

    Stephen Rothwell
     
  • With all the recent module loading cleanups, we've minimized the code
    that sits under module_mutex, fixing various deadlocks and making it
    possible to do most of the module loading in parallel.

    However, that whole conversion totally missed the rather obscure code
    that adds a new module to the list for BUG() handling. That code was
    doubly obscure because (a) the code itself lives in lib/bugs.c (for
    dubious reasons) and (b) it gets called from the architecture-specific
    "module_finalize()" rather than from generic code.

    Calling it from arch-specific code makes no sense what-so-ever to begin
    with, and is now actively wrong since that code isn't protected by the
    module loading lock any more.

    So this commit moves the "module_bug_{finalize,cleanup}()" calls away
    from the arch-specific code, and into the generic code - and in the
    process protects it with the module_mutex so that the list operations
    are now safe.

    Future fixups:
    - move the module list handling code into kernel/module.c where it
    belongs.
    - get rid of 'module_bug_list' and just use the regular list of modules
    (called 'modules' - imagine that) that we already create and maintain
    for other reasons.

    Reported-and-tested-by: Thomas Gleixner
    Cc: Rusty Russell
    Cc: Adrian Bunk
    Cc: Andrew Morton
    Cc: stable@kernel.org
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

05 Oct, 2010

1 commit


23 Sep, 2010

1 commit

  • Make sigreturn zero regs->trap, make do_signal() do the same on all
    paths. As it is, signal interrupting e.g. read() from fd 512 (==
    ERESTARTSYS) with another signal getting unblocked when the first
    handler finishes will lead to restart one insn earlier than it ought
    to. Same for multiple signals with in-kernel handlers interrupting
    that sucker at the same time. Same for multiple signals of any kind
    interrupting that sucker on 64bit...

    Signed-off-by: Al Viro
    Acked-by: Paul Mackerras
    Signed-off-by: Linus Torvalds

    Al Viro
     

15 Sep, 2010

1 commit

  • compat_alloc_user_space() expects the caller to independently call
    access_ok() to verify the returned area. A missing call could
    introduce problems on some architectures.

    This patch incorporates the access_ok() check into
    compat_alloc_user_space() and also adds a sanity check on the length.
    The existing compat_alloc_user_space() implementations are renamed
    arch_compat_alloc_user_space() and are used as part of the
    implementation of the new global function.

    This patch assumes NULL will cause __get_user()/__put_user() to either
    fail or access userspace on all architectures. This should be
    followed by checking the return value of compat_access_user_space()
    for NULL in the callers, at which time the access_ok() in the callers
    can also be removed.

    Reported-by: Ben Hawkes
    Signed-off-by: H. Peter Anvin
    Acked-by: Benjamin Herrenschmidt
    Acked-by: Chris Metcalf
    Acked-by: David S. Miller
    Acked-by: Ingo Molnar
    Acked-by: Thomas Gleixner
    Acked-by: Tony Luck
    Cc: Andrew Morton
    Cc: Arnd Bergmann
    Cc: Fenghua Yu
    Cc: H. Peter Anvin
    Cc: Heiko Carstens
    Cc: Helge Deller
    Cc: James Bottomley
    Cc: Kyle McMartin
    Cc: Martin Schwidefsky
    Cc: Paul Mackerras
    Cc: Ralf Baechle
    Cc:

    H. Peter Anvin
     

10 Sep, 2010

1 commit

  • The slab.h header is required to use the kmalloc() family of functions.
    Due to recent kernel changes, this header must be directly included by
    code that calls into the memory allocator.

    Without this patch, any code which includes this header fails to build.

    Signed-off-by: Ira W. Snyder
    Cc: Dan Williams
    Cc: Benjamin Herrenschmidt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ira W. Snyder
     

09 Sep, 2010

2 commits

  • Tighten up time timing around the gpio reset functionality. Add a 200ns
    delay before remuxing the pins back to ac97 to comply with the ac97 spec.

    Signed-off-by: Eric Millbrandt
    Signed-off-by: Grant Likely

    Eric Millbrandt
     
  • This function is implemented as though the function of_get_next_child does
    not increment the reference count of its result, but actually it does.
    Thus the patch adds of_node_put in error handling code and drops a call to
    of_node_get.

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

    //
    @r exists@
    local idexpression x;
    expression E1;
    position p1,p2;
    @@

    x@p1 = of_get_next_child(...);
    ... when != x = E1
    of_node_get@p2(x)

    @script:python@
    p1 << r.p1;
    p2 << r.p2;
    @@

    cocci.print_main("call",p1)
    cocci.print_secs("get",p2)
    //

    Signed-off-by: Julia Lawall
    Signed-off-by: Grant Likely

    Julia Lawall
     

02 Sep, 2010

1 commit

  • The dlpar code can cause a deadlock to occur when making the RTAS
    configure-connector call. This occurs because we make kmalloc calls,
    which can block, while parsing the rtas_data_buf and holding the
    rtas_data_buf_lock. This an cause issues if someone else attempts
    to grab the rtas_data_bug_lock.

    This patch alleviates this issue by copying the contents of the rtas_data_buf
    to a local buffer before parsing. This allows us to only hold the
    rtas_data_buf_lock around the RTAS configure-connector calls.

    Signed-off-by: Nathan Fontenot
    Signed-off-by: Benjamin Herrenschmidt

    Nathan Fontenot
     

01 Sep, 2010

7 commits

  • clk_get() should return an ERR_PTR value on error, not NULL.

    Signed-off-by: Akinobu Mita
    Signed-off-by: Grant Likely

    Akinobu Mita
     
  • This is needed for proper PCI-E support on P1021 SoCs.

    Signed-off-by: Anton Vorontsov
    Signed-off-by: Kumar Gala

    Anton Vorontsov
     
  • Add a call to of_node_put in the error handling code following a call to
    of_find_compatible_node.

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

    //
    @r exists@
    local idexpression x;
    expression E,E1;
    statement S;
    @@

    *x =
    (of_find_node_by_path
    |of_find_node_by_name
    |of_find_node_by_phandle
    |of_get_parent
    |of_get_next_parent
    |of_get_next_child
    |of_find_compatible_node
    |of_match_node
    )(...);
    ...
    if (x == NULL) S
    ;
    |
    * return ...;
    )
    }
    ...>
    of_node_put(x);
    //

    Signed-off-by: Julia Lawall
    Acked-by: Timur Tabi
    Signed-off-by: Kumar Gala

    Julia Lawall
     
  • The function of_iomap returns the result of calling ioremap, so iounmap
    should be called on the result in the error handling code, as done in the
    normal exit of the function.

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

    //
    @r exists@
    local idexpression x;
    expression E,E1;
    identifier l;
    statement S;
    @@

    *x = of_iomap(...);
    ... when != iounmap(x)
    when != if (...) { ... iounmap(x); ... }
    when != E = x
    when any
    (
    if (x == NULL) S
    |
    if (...) {
    ... when != iounmap(x)
    when != if (...) { ... iounmap(x); ... }
    (
    return ;
    |
    * return ...;
    )
    }
    )
    ... when != x = E1
    when any
    iounmap(x);
    //

    Signed-off-by: Julia Lawall
    Signed-off-by: Kumar Gala

    Julia Lawall
     
  • Fixes the following compile problem on E500 platforms:
    arch/powerpc/sysdev/fsl_rio.c: In function 'fsl_rio_mcheck_exception':
    arch/powerpc/sysdev/fsl_rio.c:248: error: 'MCSR_MASK' undeclared (first use in this function)

    Also fixes the compile problem on non-E500 platforms.

    Signed-off-by: Li Yang
    Signed-off-by: Kumar Gala

    Li Yang
     
  • arch/powerpc/platforms/85xx/p1022_ds.c:22:23: error: linux/lmb.h: No such file or directory
    arch/powerpc/platforms/85xx/p1022_ds.c: In function 'p1022_ds_setup_arch':
    arch/powerpc/platforms/85xx/p1022_ds.c:100: error: implicit declaration of function 'memblock_end_of_DRAM'
    arch/powerpc/platforms/85xx/p1022_ds.c: At top level:
    arch/powerpc/platforms/85xx/p1022_ds.c:147: error: 'udbg_progress' undeclared here (not in a function)
    make[2]: *** [arch/powerpc/platforms/85xx/p1022_ds.o] Error 1

    Signed-off-by: Kumar Gala

    Kumar Gala
     
  • Commit 99d8238f berobbed the for_each loop of its iterator! Let's be
    nice and give it back, so it compiles for us.

    CC: Anton Vorontsov
    Signed-off-by: Alexander Graf
    Signed-off-by: Kumar Gala

    Alexander Graf
     

31 Aug, 2010

3 commits

  • In f761622e59433130bc33ad086ce219feee9eb961 we changed
    early_setup_secondary so it's called using the proper kernel stack
    rather than the emergency one.

    Unfortunately, this stack pointer can't be used when translation is off
    on PHYP as this stack pointer might be outside the RMO. This results in
    the following on all non zero cpus:
    cpu 0x1: Vector: 300 (Data Access) at [c00000001639fd10]
    pc: 000000000001c50c
    lr: 000000000000821c
    sp: c00000001639ff90
    msr: 8000000000001000
    dar: c00000001639ffa0
    dsisr: 42000000
    current = 0xc000000016393540
    paca = 0xc000000006e00200
    pid = 0, comm = swapper

    The original patch was only tested on bare metal system, so it never
    caught this problem.

    This changes __secondary_start so that we calculate the new stack
    pointer but only start using it after we've called early_setup_secondary.

    With this patch, the above problem goes away.

    Signed-off-by: Michael Neuling
    Signed-off-by: Benjamin Herrenschmidt

    Michael Neuling
     
  • Commit 0fe1ac48 ("powerpc/perf_event: Fix oops due to
    perf_event_do_pending call") moved the call to perf_event_do_pending
    in timer_interrupt() down so that it was after the irq_enter() call.
    Unfortunately this moved it after the code that checks whether it
    is time for the next decrementer clock event. The result is that
    the call to perf_event_do_pending() won't happen until the next
    decrementer clock event is due. This was pointed out by Milton
    Miller.

    This fixes it by moving the check for whether it's time for the
    next decrementer clock event down to the point where we're about
    to call the event handler, after we've called perf_event_do_pending.

    This has the side effect that on old pre-Core99 Powermacs where we
    use the ppc_n_lost_interrupts mechanism to replay interrupts, a
    replayed interrupt will incur a little more latency since it will
    now do the code from the irq_enter down to the irq_exit, that it
    used to skip. However, these machines are now old and rare enough
    that this doesn't matter. To make it clear that ppc_n_lost_interrupts
    is only used on Powermacs, and to speed up the code slightly on
    non-Powermac ppc32 machines, the code that tests ppc_n_lost_interrupts
    is now conditional on CONFIG_PMAC as well as CONFIG_PPC32.

    Signed-off-by: Paul Mackerras
    Cc: stable@kernel.org
    Signed-off-by: Benjamin Herrenschmidt

    Paul Mackerras
     
  • Call kexec purgatory code correctly. We were getting lucky before.
    If you examine the powerpc 32bit kexec "purgatory" code you will
    see it expects the following:

    >From kexec-tools: purgatory/arch/ppc/v2wrap_32.S
    -> calling convention:
    -> r3 = physical number of this cpu (all cpus)
    -> r4 = address of this chunk (master only)

    As such, we need to set r3 to the current core, r4 happens to be
    unused by purgatory at the moment but we go ahead and set it
    here as well

    Signed-off-by: Matthew McClintock
    Signed-off-by: Benjamin Herrenschmidt

    Matthew McClintock
     

29 Aug, 2010

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
    Input: pxa27x_keypad - remove input_free_device() in pxa27x_keypad_remove()
    Input: mousedev - fix regression of inverting axes
    Input: uinput - add devname alias to allow module on-demand load
    Input: hil_kbd - fix compile error
    USB: drop tty argument from usb_serial_handle_sysrq_char()
    Input: sysrq - drop tty argument form handle_sysrq()
    Input: sysrq - drop tty argument from sysrq ops handlers

    Linus Torvalds
     

24 Aug, 2010

20 commits

  • MPIC_U3_HT_IRQS is selected both by PPC_PMAC64 and PPC_MAPLE, but depends
    on PPC_MAPLE, so a PPC_PMAC64-only config gets this warning:

    warning: (PPC_PMAC64 && PPC_PMAC && POWER4 || PPC_MAPLE && PPC64 && PPC_BOOK3S) selects MPIC_U3_HT_IRQS which has unmet direct dependencies (PPC_MAPLE)

    Fix that by removing the dependency on PPC_MAPLE.

    Signed-off-by: Andreas Schwab
    Signed-off-by: Benjamin Herrenschmidt

    Andreas Schwab
     
  • Signed-off-by: Andreas Schwab
    Signed-off-by: Benjamin Herrenschmidt

    Andreas Schwab
     
  • pci_device_to_OF_node() can return null, and list_for_each_entry will
    never enter the loop when dev is NULL, so it looks like this test is
    a typo.

    Reported-by: Julia Lawall
    Signed-off-by: Grant Likely
    Signed-off-by: Benjamin Herrenschmidt

    Grant Likely
     
  • Commit e32e78c5ee8aadef020fbaecbe6fb741ed9029fd
    (powerpc: fix build with make 3.82) introduced a
    typo in uImage target and broke building uImage:

    make: *** No rule to make target `uImage'. Stop.

    Signed-off-by: Anatolij Gustschin
    Cc: stable
    Signed-off-by: Benjamin Herrenschmidt

    Anatolij Gustschin
     
  • As early setup calls down to slb_initialize(), we must have kstack
    initialised before checking "should we add a bolted SLB entry for our kstack?"

    Failing to do so means stack access requires an SLB miss exception to refill
    an entry dynamically, if the stack isn't accessible via SLB(0) (kernel text
    & static data). It's not always allowable to take such a miss, and
    intermittent crashes will result.

    Primary CPUs don't have this issue; an SLB entry is not bolted for their
    stack anyway (as that lives within SLB(0)). This patch therefore only
    affects the init of secondaries.

    Signed-off-by: Matt Evans
    Cc: stable
    Signed-off-by: Benjamin Herrenschmidt

    Matt Evans
     
  • When looking at some issues with the virtual ethernet driver I noticed
    that TCE allocation was following a very strange pattern:

    address 00e9000 length 2048
    address 0409000 length 2048
    Signed-off-by: Benjamin Herrenschmidt

    Anton Blanchard
     
  • I'm sick of seeing ppc64_runlatch_off in our profiles, so inline it
    into the callers. To avoid a mess of circular includes I didn't add
    it as an inline function.

    Signed-off-by: Anton Blanchard
    Acked-by: Olof Johansson
    Signed-off-by: Benjamin Herrenschmidt

    Anton Blanchard
     
  • The 'smt_enabled=X' boot option does not handle values of X > 2.
    For Power 7 processors with smt modes of 0,1,2,3, and 4 this does
    not work. This patch allows the smt_enabled option to be set to
    any value limited to a max equal to the number of threads per
    core.

    Signed-off-by: Nathan Fontenot
    Signed-off-by: Benjamin Herrenschmidt

    Nathan Fontenot
     
  • All IRQs are migrated away from a CPU that is being offlined so the
    following messages suggest a problem when the system is behaving as
    designed:

    IRQ 262 affinity broken off cpu 1
    IRQ 17 affinity broken off cpu 0
    IRQ 18 affinity broken off cpu 0
    IRQ 19 affinity broken off cpu 0
    IRQ 256 affinity broken off cpu 0
    IRQ 261 affinity broken off cpu 0
    IRQ 262 affinity broken off cpu 0

    Don't print these messages when the CPU is not online.

    Signed-off-by: Darren Hart
    Acked-by: Will Schmidt
    Cc: Thomas Gleixner
    Cc: Nathan Fontenot
    Cc: Robert Jennings
    Cc: Brian King
    Signed-off-by: Benjamin Herrenschmidt

    Signed-off-by: Darren Hart
     
  • During CPU offline/online tests __cpu_up would flood the logs with
    the following message:

    Processor 0 found.

    This provides no useful information to the user as there is no context
    provided, and since the operation was a success (to this point) it is expected
    that the CPU will come back online, providing all the feedback necessary.

    Change the "Processor found" message to DBG() similar to other such messages in
    the same function. Also, add an appropriate log level for the "Processor is
    stuck" message.

    Signed-off-by: Darren Hart
    Acked-by: Will Schmidt
    Cc: Thomas Gleixner
    Cc: Nathan Fontenot
    Cc: Robert Jennings
    Cc: Brian King
    Signed-off-by: Benjamin Herrenschmidt

    Signed-off-by: Darren Hart
     
  • start_secondary() is called shortly after _start and also via

    cpu_idle()->cpu_die()->pseries_mach_cpu_die()

    start_secondary() expects a preempt_count() of 0. pseries_mach_cpu_die() is
    called via the cpu_idle() routine with preemption disabled, resulting in the
    following repeating message during rapid cpu offline/online tests
    with CONFIG_PREEMPT=y:

    BUG: scheduling while atomic: swapper/0/0x00000002
    Modules linked in: autofs4 binfmt_misc dm_mirror dm_region_hash dm_log [last unloaded: scsi_wait_scan]
    Call Trace:
    [c00000010e7079c0] [c0000000000133ec] .show_stack+0xd8/0x218 (unreliable)
    [c00000010e707aa0] [c0000000006a47f0] .dump_stack+0x28/0x3c
    [c00000010e707b20] [c00000000006e7a4] .__schedule_bug+0x7c/0x9c
    [c00000010e707bb0] [c000000000699d9c] .schedule+0x104/0x800
    [c00000010e707cd0] [c000000000015b24] .cpu_idle+0x1c4/0x1d8
    [c00000010e707d70] [c0000000006aa1b4] .start_secondary+0x398/0x3d4
    [c00000010e707e30] [c000000000008278] .start_secondary_resume+0x10/0x14

    Move the cpu_die() call inside the existing preemption enabled block of
    cpu_idle(). This is safe as the idle task is affined to a single CPU so the
    debug_smp_processor_id() tests (from cpu_should_die()) won't trigger as we are
    in a "migration disabled" region.

    Signed-off-by: Darren Hart
    Acked-by: Will Schmidt
    Cc: Thomas Gleixner
    Cc: Nathan Fontenot
    Cc: Robert Jennings
    Cc: Brian King
    Signed-off-by: Benjamin Herrenschmidt

    Signed-off-by: Darren Hart
     
  • list_for_each_entry binds its first argument to a non-null value, and thus
    any null test on the value of that argument is superfluous.

    The semantic patch that makes this change is as follows:
    (http://coccinelle.lip6.fr/)

    //
    @@
    iterator I;
    expression x,E,E1,E2;
    statement S,S1,S2;
    @@

    I(x,...) { }
    //

    Signed-off-by: Julia Lawall
    Signed-off-by: Benjamin Herrenschmidt

    Julia Lawall
     
  • for_each_node_by_name binds its first argument to a non-null value, and
    thus any null test on the value of that argument is superfluous.

    The semantic patch that makes this change is as follows:
    (http://coccinelle.lip6.fr/)

    //
    @@
    iterator I;
    expression x,E;
    @@

    I(x,...) { }
    //

    Signed-off-by: Julia Lawall
    Signed-off-by: Benjamin Herrenschmidt

    Julia Lawall
     
  • for_each_node_by_name only exits when its first argument is NULL, and a
    subsequent call to of_node_put on that argument is unnecessary.

    The semantic patch that makes this change is as follows:
    (http://coccinelle.lip6.fr/)

    //
    @@
    iterator name for_each_node_by_name;
    expression np,E;
    identifier l;
    @@

    for_each_node_by_name(np,...) {
    ... when != break;
    when != goto l;
    }
    ... when != np = E
    - of_node_put(np);
    //

    Signed-off-by: Julia Lawall
    Reviewed-by: Grant Likely
    Signed-off-by: Benjamin Herrenschmidt

    Julia Lawall
     
  • During kdump we run the crash handlers first then stop all other CPUs.
    We really want to stop all CPUs as close to the fail as possible and also
    have a very controlled environment for running the crash handlers, so it
    makes sense to reverse the order.

    Signed-off-by: Anton Blanchard
    Acked-by: Matt Evans
    Signed-off-by: Benjamin Herrenschmidt

    Anton Blanchard
     
  • The code is wrapped in an #if 0, but it's wrong so we may as well fix it.

    Signed-off-by: Anton Blanchard
    Signed-off-by: Benjamin Herrenschmidt

    Anton Blanchard
     
  • Use is_32bit_task() helper to test 32 bit binary.

    Signed-off-by: Denis Kirjanov
    Signed-off-by: Benjamin Herrenschmidt

    Denis Kirjanov
     
  • Some modules (like eHCA) want to map all of kernel memory, for this to
    work with a relocated kernel, we need to export kernstart_addr so
    modules can use PHYSICAL_START and memstart_addr so they could use
    MEMORY_START. Note that the 32bit code already exports these symbols.

    Signed-off-By: Sonny Rao

    Signed-off-by: Benjamin Herrenschmidt

    Sonny Rao
     
  • This makes the 64-bit kernel use 64-bit signed integers for the counter
    (effectively supporting 32-bit of active count in the semaphore), thus
    avoiding things like overflow of the mmap_sem if you use a really crazy
    number of threads

    Note: Ideally the type in the structure should be atomic_long_t rather
    than "long". However, there's some nasty issues with that. It needs to
    be initialized statically -and- lib/rwsem.c does things like

    sem->count = RWSEM_UNLOCKED_VALUE;

    Now, if you mix in the fact that atomic_* types are actually structures
    with one member and note typedefs of a scalar, it makes its really nasty.

    So I stuck to what we did before using a long and casts for now.

    Signed-off-by: Benjamin Herrenschmidt

    Benjamin Herrenschmidt
     
  • Benjamin Herrenschmidt