1. 19 11月, 2012 4 次提交
  2. 29 10月, 2012 1 次提交
    • F
      ARM: 7565/1: sched: stop sched_clock() during suspend · 6a4dae5e
      Felipe Balbi 2 提交于
      The scheduler imposes a requirement to sched_clock()
      which is to stop the clock during suspend, if we don't
      do that any RT thread will be rescheduled in the future
      which might cause any sort of problems.
      
      This became an issue on OMAP when we converted omap-i2c.c
      to use threaded IRQs, it turned out that depending on how
      much time we spent on suspend, the I2C IRQ thread would
      end up being rescheduled so far in the future that I2C
      transfers would timeout and, because omap_hsmmc depends
      on an I2C-connected device to detect if an MMC card is
      inserted in the slot, our rootfs would just vanish.
      
      arch/arm/kernel/sched_clock.c already had an optional
      implementation (sched_clock_needs_suspend()) which would
      handle scheduler's requirement properly, what this patch
      does is simply to make that implementation non-optional.
      
      Note that this has the side-effect that printk timings
      won't reflect the actual time spent on suspend so other
      methods to measure that will have to be used.
      
      This has been tested with beagleboard XM (OMAP3630) and
      pandaboard rev A3 (OMAP4430). Suspend to RAM is now working
      after this patch.
      
      Thanks to Kevin Hilman for helping out with debugging.
      Acked-by: NKevin Hilman <khilman@ti.com>
      Acked-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      6a4dae5e
  3. 22 10月, 2012 2 次提交
    • L
      ARM: 7560/1: SMP_TWD: use DIV_ROUND_CLOSEST() for periodic mode · ad17a26e
      Linus Walleij 提交于
      The periodic mode is currently calculated by a simple division
      but we should pay more attention to our integer arithmetics.
      Also delete a comment that does not make any sense.
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      ad17a26e
    • W
      ARM: 7559/1: smp: switch away from the idmap before updating init_mm.mm_count · 5f40b909
      Will Deacon 提交于
      When booting a secondary CPU, the primary CPU hands two sets of page
      tables via the secondary_data struct:
      
      	(1) swapper_pg_dir: a normal, cacheable, shared (if SMP) mapping
      	    of the kernel image (i.e. the tables used by init_mm).
      
      	(2) idmap_pgd: an uncached mapping of the .idmap.text ELF
      	    section.
      
      The idmap is generally used when enabling and disabling the MMU, which
      includes early CPU boot. In this case, the secondary CPU switches to
      swapper as soon as it enters C code:
      
      	struct mm_struct *mm = &init_mm;
      	unsigned int cpu = smp_processor_id();
      
      	/*
      	 * All kernel threads share the same mm context; grab a
      	 * reference and switch to it.
      	 */
      	atomic_inc(&mm->mm_count);
      	current->active_mm = mm;
      	cpumask_set_cpu(cpu, mm_cpumask(mm));
      	cpu_switch_mm(mm->pgd, mm);
      
      This causes a problem on ARMv7, where the identity mapping is treated as
      strongly-ordered leading to architecturally UNPREDICTABLE behaviour of
      exclusive accesses, such as those used by atomic_inc.
      
      This patch re-orders the secondary_start_kernel function so that we
      switch to swapper before performing any exclusive accesses.
      
      Cc: <stable@vger.kernel.org>
      Cc: David McKay <david.mckay@st.com>
      Reported-by: NGilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      5f40b909
  4. 18 10月, 2012 2 次提交
  5. 15 10月, 2012 1 次提交
    • R
      ARM: fix oops on initial entry to userspace with Thumb2 kernels · 68687c84
      Russell King 提交于
      Daniel Mack reports an oops at boot with the latest kernels:
      
        Internal error: Oops - undefined instruction: 0 [#1] SMP THUMB2
        Modules linked in:
        CPU: 0    Not tainted  (3.6.0-11057-g584df1d #145)
        PC is at cpsw_probe+0x45a/0x9ac
        LR is at trace_hardirqs_on_caller+0x8f/0xfc
        pc : [<c03493de>]    lr : [<c005e81f>]    psr: 60000113
        sp : cf055fb0  ip : 00000000  fp : 00000000
        r10: 00000000  r9 : 00000000  r8 : 00000000
        r7 : 00000000  r6 : 00000000  r5 : c0344555  r4 : 00000000
        r3 : cf057a40  r2 : 00000000  r1 : 00000001  r0 : 00000000
        Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM Segment user
        Control: 50c5387d  Table: 8f3f4019  DAC: 00000015
        Process init (pid: 1, stack limit = 0xcf054240)
        Stack: (0xcf055fb0 to 0xcf056000)
        5fa0:                                     00000001 00000000 00000000 00000000
        5fc0: cf055fb0 c000d1a8 00000000 00000000 00000000 00000000 00000000 00000000
        5fe0: 00000000 be9b3f10 00000000 b6f6add0 00000010 00000000 aaaabfaf a8babbaa
      
      The analysis of this is as follows.  In init/main.c, we issue:
      
      	kernel_thread(kernel_init, NULL, CLONE_FS | CLONE_SIGHAND);
      
      This creates a new thread, which falls through to the ret_from_fork
      assembly, with r4 set NULL and r5 set to kernel_init.  You can see
      this in your oops dump register set - r5 is 0xc0344555, which is the
      address of kernel_init plus 1 which marks the function as Thumb code.
      
      Now, let's look at this code a little closer - this is what the
      disassembly looks like:
      
        c000d180 <ret_from_fork>:
        c000d180:       f03a fe08       bl      c0047d94 <schedule_tail>
        c000d184:       2d00            cmp     r5, #0
        c000d186:       bf1e            ittt    ne
        c000d188:       4620            movne   r0, r4
        c000d18a:       46fe            movne   lr, pc <-- XXXXXXX
        c000d18c:       46af            movne   pc, r5
        c000d18e:       46e9            mov     r9, sp
        c000d190:       ea4f 3959       mov.w   r9, r9, lsr #13
        c000d194:       ea4f 3949       mov.w   r9, r9, lsl #13
        c000d198:       e7c8            b.n     c000d12c <ret_to_user>
        c000d19a:       bf00            nop
        c000d19c:       f3af 8000       nop.w
      
      This code was introduced in 9fff2fa0 (arm: switch to saner
      kernel_execve() semantics).  I have marked one instruction, and it's
      the significant one - I'll come back to that later.
      
      Eventually, having had a successful call to kernel_execve(), kernel_init()
      returns zero.
      
      In returning, it uses the value in 'lr' which was set by the instruction
      I marked above.  Unfortunately, this causes lr to contain 0xc000d18e -
      an even address.  This switches the ISA to ARM on return but with a non
      word aligned PC value.
      
      So, what do we end up executing?  Well, not the instructions above - yes
      the opcodes, but they don't mean the same thing in ARM mode.  In ARM mode,
      it looks like this instead:
      
        c000d18c:       46e946af        strbtmi r4, [r9], pc, lsr #13
        c000d190:       3959ea4f        ldmdbcc r9, {r0, r1, r2, r3, r6, r9, fp, sp, lr, pc}^
        c000d194:       3949ea4f        stmdbcc r9, {r0, r1, r2, r3, r6, r9, fp, sp, lr, pc}^
        c000d198:       bf00e7c8        svclt   0x0000e7c8
        c000d19c:       8000f3af        andhi   pc, r0, pc, lsr #7
        c000d1a0:       e88db092        stm     sp, {r1, r4, r7, ip, sp, pc}
        c000d1a4:       46e81fff                        ; <UNDEFINED> instruction: 0x46e81fff
        c000d1a8:       8a00f3ef        bhi     0xc004a16c
        c000d1ac:       0a0cf08a        beq     0xc03493dc
      
      I have included more above, because it's relevant.  The PSR flags which
      we can see in the oops dump are nZCv, so Z and C are set.
      
      All the above ARM instructions are not executed, except for two.
      c000d1a0, which has no writeback, and writes below the current stack
      pointer (and that data is lost when we take the next exception.) The
      other instruction which is executed is c000d1ac, which takes us to...
      0xc03493dc.  However, remember that bit 1 of the PC got set.  So that
      makes the PC value 0xc03493de.
      
      And that value is the value we find in the oops dump for PC.  What is
      the instruction here when interpreted in ARM mode?
      
             0:       f71e150c                ; <UNDEFINED> instruction: 0xf71e150c
      
      and there we have our undefined instruction (remember that the 'never'
      condition code, 0xf, has been deprecated and is now always executed as
      it is now being used for additional instructions.)
      
      This path also nicely explains the state of the stack we see in the oops
      dump too.
      
      The above is a consistent and sane story for how we got to the oops
      dump, which all stems from the instruction at 0xc000d18a being wrong.
      Reported-by: NDaniel Mack <zonque@gmail.com>
      Tested-by: NDaniel Mack <zonque@gmail.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      68687c84
  6. 13 10月, 2012 1 次提交
  7. 10 10月, 2012 1 次提交
    • A
      ARM: export set_irq_flags · 05c76982
      Arnd Bergmann 提交于
      The recently added Emma Mobile GPIO driver calls set_irq_flags
      and irq_set_chip_and_handler for the interrupts it exports and
      it can be built as a module, which currently fails with
      
      ERROR: "set_irq_flags" [drivers/gpio/gpio-em.ko] undefined!
      
      We either need to replace the call to set_irq_flags with something
      else or export that function. This patch does the latter.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Magnus Damm <damm@opensource.se>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Rafael J. Wysocki <rjw@sisk.pl>
      Cc: Russell King <rmk+kernel@arm.linux.org.uk>
      05c76982
  8. 09 10月, 2012 1 次提交
    • A
      ARM: kprobes: make more tests conditional · 5c5b06c3
      Arnd Bergmann 提交于
      The mls instruction is not available in ARMv6K or below, so we
      should make the test conditional on at least ARMv7. ldrexd/strexd
      are available in ARMv6K or ARMv7, which we can test by checking
      the CONFIG_CPU_32v6K symbol.
      
      /tmp/ccuMTZ8D.s: Assembler messages:
      /tmp/ccuMTZ8D.s:22188: Error: selected processor does not support ARM mode `mls r0,r1,r2,r3'
      /tmp/ccuMTZ8D.s:22222: Error: selected processor does not support ARM mode `mlshi r7,r8,r9,r10'
      /tmp/ccuMTZ8D.s:22252: Error: selected processor does not support ARM mode `mls lr,r1,r2,r13'
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NJon Medhurst <tixy@yxit.co.uk>
      Acked-by: NNicolas Pitre <nicolas.pitre@linaro.org>
      Cc: Russell King <rmk+kernel@arm.linux.org.uk>
      Cc: Leif Lindholm <leif.lindholm@arm.com>
      5c5b06c3
  9. 01 10月, 2012 4 次提交
  10. 27 9月, 2012 3 次提交
  11. 25 9月, 2012 2 次提交
  12. 22 9月, 2012 1 次提交
  13. 20 9月, 2012 5 次提交
    • A
      don't bother exporting kernel_execve() · 1cedd692
      Al Viro 提交于
      most of the architectures don't and there's not a single
      caller outside of core kernel.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      1cedd692
    • M
      ARM: 7535/1: Reprogram smp_twd based on new common clk framework notifiers · 2b25d9f6
      Mike Turquette 提交于
      Running cpufreq driver on imx6q, the following warning is seen.
      
      $ BUG: sleeping function called from invalid context at kernel/mutex.c:269
      
      <snip>
      
      stack backtrace:
      Backtrace:
      [<80011d64>] (dump_backtrace+0x0/0x10c) from [<803fc164>] (dump_stack+0x18/0x1c)
       r6:bf8142e0 r5:bf814000 r4:806ac794 r3:bf814000
      [<803fc14c>] (dump_stack+0x0/0x1c) from [<803fd444>] (print_usage_bug+0x250/0x2b
      8)
      [<803fd1f4>] (print_usage_bug+0x0/0x2b8) from [<80060f90>] (mark_lock+0x56c/0x67
      0)
      [<80060a24>] (mark_lock+0x0/0x670) from [<80061a20>] (__lock_acquire+0x98c/0x19b
      4)
      [<80061094>] (__lock_acquire+0x0/0x19b4) from [<80062f14>] (lock_acquire+0x68/0x
      7c)
      [<80062eac>] (lock_acquire+0x0/0x7c) from [<80400f28>] (mutex_lock_nested+0x78/0
      x344)
       r7:00000000 r6:bf872000 r5:805cc858 r4:805c2a04
      [<80400eb0>] (mutex_lock_nested+0x0/0x344) from [<803089ac>] (clk_get_rate+0x1c/
      0x58)
      [<80308990>] (clk_get_rate+0x0/0x58) from [<80013c48>] (twd_update_frequency+0x1
      8/0x50)
       r5:bf253d04 r4:805cadf4
      [<80013c30>] (twd_update_frequency+0x0/0x50) from [<80068e20>] (generic_smp_call
      _function_single_interrupt+0xd4/0x13c)
       r4:bf873ee0 r3:80013c30
      [<80068d4c>] (generic_smp_call_function_single_interrupt+0x0/0x13c) from [<80013
      34c>] (handle_IPI+0xc0/0x194)
       r8:00000001 r7:00000000 r6:80574e48 r5:bf872000 r4:80593958
      [<8001328c>] (handle_IPI+0x0/0x194) from [<800084e8>] (gic_handle_irq+0x58/0x60)
       r8:00000000 r7:bf873f8c r6:bf873f58 r5:80593070 r4:f4000100
      r3:00000005
      [<80008490>] (gic_handle_irq+0x0/0x60) from [<8000e124>] (__irq_svc+0x44/0x60)
      Exception stack(0xbf873f58 to 0xbf873fa0)
      3f40:                                                       00000001 00000001
      3f60: 00000000 bf814000 bf872000 805cab48 80405aa4 80597648 00000000 412fc09a
      3f80: bf872000 bf873fac bf873f70 bf873fa0 80063844 8000f1f8 20000013 ffffffff
       r6:ffffffff r5:20000013 r4:8000f1f8 r3:bf814000
      [<8000f1b8>] (default_idle+0x0/0x4c) from [<8000f428>] (cpu_idle+0x98/0x114)
      [<8000f390>] (cpu_idle+0x0/0x114) from [<803f9834>] (secondary_start_kernel+0x11
      c/0x140)
      [<803f9718>] (secondary_start_kernel+0x0/0x140) from [<103f9234>] (0x103f9234)
       r6:10c03c7d r5:0000001f r4:4f86806a r3:803f921c
      
      It looks that the warning is caused by that twd_update_frequency() gets
      called from an atomic context while it calls clk_get_rate() where a
      mutex gets held.
      
      To fix the warning, let's convert common clk users over to clk notifiers
      in place of CPUfreq notifiers.  This works out nicely for Cortex-A9
      MPcore designs that scale all CPUs at the same frequency.
      
      Platforms that have not been converted to the common clk framework and
      support CPUfreq will rely on the old mechanism.  Once these platforms
      are converted over fully then we can remove the CPUfreq-specific bits
      for good.
      Signed-off-by: NMike Turquette <mturquette@linaro.org>
      Signed-off-by: NShawn Guo <shawn.guo@linaro.org>
      Reviewed-by: NLinus Walleij <linus.walleij@linaro.org>
      Reviewed-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      2b25d9f6
    • S
      ARM: 7536/1: smp: Formalize an IPI for wakeup · 559a5939
      Stephen Boyd 提交于
      Remove the offset from ipi_msg_type and assume that SGI0 is the
      wakeup interrupt now that all WFI hotplug users call
      gic_raise_softirq() with 0 instead of 1. This allows us to
      track how many wakeup interrupts are sent and also removes the
      unknown IPI printk message for WFI hotplug based systems.
      Reviewed-by: NNicolas Pitre <nico@linaro.org>
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      559a5939
    • W
      ARM: 7525/1: ptrace: use updated syscall number for syscall auditing · ebb5e15c
      Will Deacon 提交于
      When tracing system calls, a debugger may change the syscall number
      in response to a SIGTRAP on syscall entry.
      
      This patch ensures that the new syscall number is passed to the audit
      code.
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      ebb5e15c
    • W
      ARM: 7524/1: support syscall tracing · 1f66e06f
      Wade Farnsworth 提交于
      As specified by ftrace-design.txt, TIF_SYSCALL_TRACEPOINT was
      added, as well as NR_syscalls in asm/unistd.h.  Additionally,
      __sys_trace was modified to call trace_sys_enter and
      trace_sys_exit when appropriate.
      
      Tests #2 - #4 of "perf test" now complete successfully.
      Signed-off-by: NSteven Walter <stevenrwalter@gmail.com>
      Signed-off-by: NWade Farnsworth <wade_farnsworth@mentor.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      1f66e06f
  14. 19 9月, 2012 6 次提交
  15. 16 9月, 2012 3 次提交
  16. 14 9月, 2012 3 次提交