safe/jmp/linux-2.6
14 years agosh: unwinder: cacheline align slab cache objects.
Paul Mundt [Sat, 22 Aug 2009 10:03:25 +0000 (19:03 +0900)]
sh: unwinder: cacheline align slab cache objects.

The CIE and FDE structs are big enough and accessed regularly enough in
certain configurations to make cacheline alignment useful.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agoMerge branch 'sh/dwarf-unwinder'
Paul Mundt [Fri, 21 Aug 2009 20:37:14 +0000 (05:37 +0900)]
Merge branch 'sh/dwarf-unwinder'

Conflicts:
arch/sh/kernel/cpu/sh3/entry.S

14 years agosh64: dummy unwinder BUG wrappers.
Paul Mundt [Fri, 21 Aug 2009 20:31:45 +0000 (05:31 +0900)]
sh64: dummy unwinder BUG wrappers.

sh64 does not yet support GENERIC_BUG, but still wants unwinder support.
Alias UNWINDER_BUG and UNWINDER_BUG_ON to their BUG counterparts until
the conversion to GENERIC_BUG is completed.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: unwinder: Use a special bug flag for unwinder traps.
Paul Mundt [Fri, 21 Aug 2009 20:28:25 +0000 (05:28 +0900)]
sh: unwinder: Use a special bug flag for unwinder traps.

This simplifies the unwinder trap handling, dropping the use of the
special trapa vector and simply piggybacking on top of the BUG support. A
new BUGFLAG_UNWINDER is added for flagging the unwinder fault, before
continuing on with regular BUG dispatch.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agoMerge branch 'sh/dwarf-unwinder' of git://github.com/mfleming/linux-2.6 into sh/dwarf...
Paul Mundt [Fri, 21 Aug 2009 18:49:58 +0000 (03:49 +0900)]
Merge branch 'sh/dwarf-unwinder' of git://github.com/mfleming/linux-2.6 into sh/dwarf-unwinder

14 years agosh: Export unwind_stack() to satisfy modular oprofile.
Paul Mundt [Fri, 21 Aug 2009 18:43:15 +0000 (03:43 +0900)]
sh: Export unwind_stack() to satisfy modular oprofile.

If the oprofile code is built as a module, unwind_stack() as used by the
oprofile backtrace code is not available, causing build breakage.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: Handle the DWARF op, DW_CFA_undefined
Matt Fleming [Thu, 20 Aug 2009 18:53:49 +0000 (19:53 +0100)]
sh: Handle the DWARF op, DW_CFA_undefined

Allow a DWARF register to have an undefined value. When applied to the
DWARF return address register this lets lets us label a function as
having no direct caller, e.g. kernel_thread_helper().

Signed-off-by: Matt Fleming <matt@console-pimps.org>
14 years agosh: Fix bug calculating the end of the FDE instructions
Matt Fleming [Thu, 20 Aug 2009 18:42:34 +0000 (19:42 +0100)]
sh: Fix bug calculating the end of the FDE instructions

The 'end' member of struct dwarf_fde denotes one byte past the end of
the CFA instruction stream for an FDE. The value of 'end' was being
calcualted incorrectly, it was being set too high. This resulted in
dwarf_cfa_execute_insns() interpreting data past the end of valid
instructions, thus causing all sorts of weird crashes.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
14 years agosh: Setup the frame pointer in handle_interrupt
Matt Fleming [Thu, 20 Aug 2009 16:00:21 +0000 (17:00 +0100)]
sh: Setup the frame pointer in handle_interrupt

When CONFIG_DWARF_UNWINDER is enabled setup r14 in handle_interrupt, so
that we can figure out what function was running when we were
interrupted.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
14 years agosh: unwinder: Introduce UNWINDER_BUG() and UNWINDER_BUG_ON()
Matt Fleming [Sun, 16 Aug 2009 20:54:48 +0000 (21:54 +0100)]
sh: unwinder: Introduce UNWINDER_BUG() and UNWINDER_BUG_ON()

We can't assume that if we execute the unwinder code and the unwinder
was already running that it has faulted. Clearly two kernel threads can
invoke the unwinder at the same time and may be running simultaneously.

The previous approach used BUG() and BUG_ON() in the unwinder code to
detect whether the unwinder was incapable of unwinding the stack, and
that the next available unwinder should be used instead. A better
approach is to explicitly invoke a trap handler to switch unwinders when
the current unwinder cannot continue.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
14 years agosh: unwinder: Set the flags for DW_CFA_val_offset ops as DWARF_VAL_OFFSET
Matt Fleming [Sun, 16 Aug 2009 14:56:35 +0000 (15:56 +0100)]
sh: unwinder: Set the flags for DW_CFA_val_offset ops as DWARF_VAL_OFFSET

The handling of DW_CFA_val_offset ops was incorrectly using the
DWARF_REG_OFFSET flag but the register's value cannot be calculated
using the DWARF_REG_OFFSET method. Create a new flag to indicate that a
different method must be used to calculate the register's value even
though there is no implementation for DWARF_VAL_OFFSET yet; it's mainly
just a place holder.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
14 years agosh: unwinder: Fix memory leak and create our own kmem cache
Matt Fleming [Sun, 16 Aug 2009 14:44:08 +0000 (15:44 +0100)]
sh: unwinder: Fix memory leak and create our own kmem cache

Plug a memory leak in dwarf_unwinder_dump() where we didn't free the
memory that we had previously allocated for the DWARF frames and DWARF
registers.

Now is also a opportune time to implement our own mempool and kmem
cache. It's a good idea to have a certain number of frame and register
objects in reserve at all times, so that we are guaranteed to have our
allocation satisfied even when memory is scarce. Since we have pools to
allocate from we can implement the registers for each frame as a linked
list as opposed to a sparsely populated array. Whilst it's true that the
lookup time for a linked list is larger than for arrays, there's only
usually a maximum of 8 registers per frame. So the overhead isn't that
much of a concern.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
14 years agosh: Add initial support for SH7757 CPU subtype
Yoshihiro Shimoda [Fri, 21 Aug 2009 07:30:28 +0000 (16:30 +0900)]
sh: Add initial support for SH7757 CPU subtype

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agousb: r8a66597-udc: implement the set_wedge method
Yoshihiro Shimoda [Thu, 20 Aug 2009 07:01:06 +0000 (07:01 +0000)]
usb: r8a66597-udc: implement the set_wedge method

fix the problem that MSC Tests of USBCV detects some warnings.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: update kfr2r09 defconfig
Magnus Damm [Thu, 20 Aug 2009 14:02:24 +0000 (14:02 +0000)]
sh: update kfr2r09 defconfig

Update the kfr2r09 defconfig with support for LCDC and USB gadget.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: add kfr2r09 romimage defconfig
Magnus Damm [Thu, 20 Aug 2009 14:01:24 +0000 (14:01 +0000)]
sh: add kfr2r09 romimage defconfig

Add romImage defconfig for the kfr2r09 board. This defconfig
should be used to build the kernel based boot loader.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: jump to p1 during boot on kfr2r09
Magnus Damm [Thu, 20 Aug 2009 13:59:26 +0000 (13:59 +0000)]
sh: jump to p1 during boot on kfr2r09

Add a P1 jump to the the kfr2r09 romimage code. With this
patch applied the initial zImage assembly code will run
with instruction cache enabled.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: invalidate icache and tlbs during boot on kfr2r09
Magnus Damm [Thu, 20 Aug 2009 13:58:38 +0000 (13:58 +0000)]
sh: invalidate icache and tlbs during boot on kfr2r09

Add instruction cache and TLB invalidation code for the
the kfr2r09 romimage target.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: i2c compile fix for kfr2r09
Magnus Damm [Thu, 20 Aug 2009 13:57:36 +0000 (13:57 +0000)]
sh: i2c compile fix for kfr2r09

Fix the kfr2r09 board code so it compiles if CONFIG_I2C=n.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: enable rtc-ds1302 in snapgear_defconfig.
Paul Mundt [Thu, 20 Aug 2009 06:06:47 +0000 (15:06 +0900)]
sh: enable rtc-ds1302 in snapgear_defconfig.

This is the only board that presently supports this rtc, so make sure it
is enabled by default to get some build coverage.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agortc: rtc-ds1302: Kill off unused variables.
Paul Mundt [Thu, 20 Aug 2009 06:06:04 +0000 (15:06 +0900)]
rtc: rtc-ds1302: Kill off unused variables.

There were a few stray unused variables left over, kill them off.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: DSP save/restore ordering and a0 sign extension fixups.
Paul Mundt [Thu, 20 Aug 2009 05:02:20 +0000 (14:02 +0900)]
sh: DSP save/restore ordering and a0 sign extension fixups.

As an excellent indicator of how much testing the DSP code gets, a couple
of rather glaring bugs in the DSP save/restore paths were found:

- In the DSP restore case a0 needs to be popped off before a0g,
  or the value of a0g is clobbered by the MSB of a0 in the case
  of sign extension.

- Beyond that, the save and restore orders were out of sync,
  so this fixes that up as well. At the same time, we switch over
  to using movs.l for both the save and restore of the general DSP
  registers as opposed to using sts.l (which was initially put in
  place to work around a bug in ancient binutils versions which
  the kernel no longer supports).

Reported-by: Chee Soon Yip <yip.cheesoon@renesas.com>
Cc: Chu Lih Kwek <kwek.chulih@renesas.com>,
Cc: General Lai <general.lai@renesas.com>,
Cc: Robert Cozens <Robert.Cozens@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: Better description of SH-4 PTEA register update.
Michael Trimarchi [Thu, 20 Aug 2009 04:27:44 +0000 (13:27 +0900)]
sh: Better description of SH-4 PTEA register update.

Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agortc: rtc-sh fixes
Alessandro Zummo [Thu, 20 Aug 2009 04:25:11 +0000 (13:25 +0900)]
rtc: rtc-sh fixes

- simplifies irq set freq
- ioctl() was duplicating functionalities of rtc-dev core
- corrected initialization sequence
- use platform_driver_probe

Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Cc: Angelo Castello <angelo.castello@st.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Jamie Lenehan <lenehan@twibble.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agortc: rtc-ds1302 fixes
Alessandro Zummo [Thu, 20 Aug 2009 03:31:49 +0000 (12:31 +0900)]
rtc: rtc-ds1302 fixes

- removed spinlock protection, it's handled by the rtc class
- use platform_driver_probe
- return appropriate code for rtc_read_time
- style issues

Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: Fix up the CONFIG_FTRACE_SYSCALLS=n build.
Paul Mundt [Thu, 20 Aug 2009 03:07:46 +0000 (12:07 +0900)]
sh: Fix up the CONFIG_FTRACE_SYSCALLS=n build.

-tip can't be bothered keeping interfaces stable long enough for anyone
to use them without having their builds broken without notification, so
just ifdef around the problematic symbols until the new interfaces become
available upstream.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agoMerge branch 'sh/r8a66597-udc'
Paul Mundt [Thu, 20 Aug 2009 02:54:38 +0000 (11:54 +0900)]
Merge branch 'sh/r8a66597-udc'

14 years agosh: add r8a66597 usb1 gadget to the se7724 board
Magnus Damm [Wed, 19 Aug 2009 09:52:02 +0000 (09:52 +0000)]
sh: add r8a66597 usb1 gadget to the se7724 board

Add USB gadget support for port CN26 on the Solution Engine 7724
board. The r8a66597-udc driver is hooked up as a platform device
and some registers are configured to enable the USB in gadget mode.
The hardware driving the USB port is the on-chip USB1 block in
the sh7724 processor configured as USB gadget controller.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: add r8a66597 usb0 gadget to the kfr2r09 board
Magnus Damm [Wed, 19 Aug 2009 14:39:15 +0000 (14:39 +0000)]
sh: add r8a66597 usb0 gadget to the kfr2r09 board

Add USB gadget support for port YC301 on the KFR2R09 board.

The r8a66597-udc driver is hooked up as a platform device,
clocks are enabled via I2C and some registers are configured
to enable the USB in gadget mode. The hardware driving the
USB port is the on-chip USB0 block in the sh7724 processor
configured as USB gadget controller.

This board is using external hardware to detect USB hotplug
events and allows the processor to dynamically start and stop
clocks. This well thought out hardware feature is unused at
this point and plug and play is unfortunately unsupported.
To properly support all hardware features the USB gadget
stack may need some adjustment.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agousb: r8a66597-udc disable interrupts on shutdown fix
Magnus Damm [Wed, 19 Aug 2009 14:26:10 +0000 (14:26 +0000)]
usb: r8a66597-udc disable interrupts on shutdown fix

This patch improves the disable_controller() function in the
r8a66597-udc driver to disable all interrupts and also clear
status flags. With this patch in place the driver survives
kexec.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agousb: r8a66597-udc buffer management update
Magnus Damm [Wed, 19 Aug 2009 14:19:08 +0000 (14:19 +0000)]
usb: r8a66597-udc buffer management update

This patch updates the r8a66597-udc buffer management code.

Use fixed buffers for bulk and isochronous pipes, also make
sure to handle the isochronous-as-bulk case. With fixed buffers
there is no need to keep track of used buffers with bi_bufnum.

Also, this fixes a potential buffer offset problem where the
base offset incorrectly varies with the number of pipes used.

The m66592 driver recently got fixed in a similar way.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agousb: add clock support to r8a66597 gadget driver
Magnus Damm [Wed, 19 Aug 2009 09:50:49 +0000 (09:50 +0000)]
usb: add clock support to r8a66597 gadget driver

Add support for the clock framework to the r8a66597 gadget driver.
This is needed to control the clock driving the USB block.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agousb: gadget: R8A66597 peripheral controller support.
Yoshihiro Shimoda [Wed, 19 Aug 2009 04:59:39 +0000 (04:59 +0000)]
usb: gadget: R8A66597 peripheral controller support.

While in-tree support for the R8A66597 host side has been supported for
some time, the peripheral side has so far been unsupported. This adds a
new USB gadget driver which bridges the gap and finally wires up the
peripheral side as well.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Tested-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: Add mach-types entry for EcoVec board.
Paul Mundt [Thu, 20 Aug 2009 01:14:29 +0000 (10:14 +0900)]
sh: Add mach-types entry for EcoVec board.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: Add EcoVec (SH7724) board support
Kuninori Morimoto [Wed, 19 Aug 2009 12:08:33 +0000 (12:08 +0000)]
sh: Add EcoVec (SH7724) board support

This adds preliminary support for the EcoVec board.

Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: Add SH7724 support to NR_ONCHIP_DMA_CHANNELS
Kuninori Morimoto [Wed, 19 Aug 2009 10:24:15 +0000 (10:24 +0000)]
sh: Add SH7724 support to NR_ONCHIP_DMA_CHANNELS

This patch also update help comment

Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: USB0 resource area fix for ms7724se
Kuninori Morimoto [Wed, 19 Aug 2009 00:12:15 +0000 (00:12 +0000)]
sh: USB0 resource area fix for ms7724se

Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: Prevent heartbeat from scribbling over non-LED bits.
Kuninori Morimoto [Tue, 18 Aug 2009 07:00:20 +0000 (07:00 +0000)]
sh: Prevent heartbeat from scribbling over non-LED bits.

While most platforms implement LED banks in sets of 8/16/32, some use
different configurations. This adds a LED mask to the heartbeat platform
data to allow platforms to constrain the bitmap, which is otherwise
derived from the register size.

Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: clkfwk: Support additional IFC divisor on SH7724.
Kuninori Morimoto [Tue, 18 Aug 2009 06:51:47 +0000 (06:51 +0000)]
sh: clkfwk: Support additional IFC divisor on SH7724.

This patch updates the FRQCRA.IFC divisor values for SH7724. Despite
not being initially documented, the / 3 mode is also support for the IFC
division.

Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: mach-kfr2409: add FLLFRQ value for PLL correction.
Kuninori Morimoto [Tue, 18 Aug 2009 06:51:28 +0000 (06:51 +0000)]
sh: mach-kfr2409: add FLLFRQ value for PLL correction.

FLLFRQ setting is needed to use correct PLL clock for kfr2409.

Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: Add a few missing irqflags tracing markers.
Matt Fleming [Tue, 18 Aug 2009 02:35:09 +0000 (11:35 +0900)]
sh: Add a few missing irqflags tracing markers.

save_regs contains an SR modification without an irqflags annotation,
which resulted in a missing TRACE_IRQS_OFF in the interrupt exception
path on SH-3/SH4.

I've also moved the TRACE_IRQS_OFF/ON annotation when returning from the
interrupt to just before we call __restore_all. This seems like the most
logical place to put this because the annotation is for when we restore
the SR register so we should delay the annotation until as last as
possible.

We were also missing a TRACE_IRQS_OFF in resume_kernel when
CONFIG_PREEMPT is enabled.

The end result is that this fixes up the lockdep engine debugging support
with CONFIG_PREEMPT enabled on all SH-3/4 parts.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: SuperH Mobile Software Standby support for cpuidle
Magnus Damm [Mon, 17 Aug 2009 09:41:40 +0000 (09:41 +0000)]
sh: SuperH Mobile Software Standby support for cpuidle

This patch adds "SuperH Mobile Standby Mode [SF]" to the list
of cpuidle sleep modes. If the software latency requirements
from cpuidle are met together with fulfilled hardware
requirements then deep sleep modes can be entered.

Tested on sh7722 and sh7724 with "Sleep Mode", "Sleep Mode + SF"
and "Software Standby Mode + SF" together with a multimedia
work load and flood ping without packet drop.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: rework SuperH Mobile sleep code exception handling
Magnus Damm [Mon, 17 Aug 2009 09:27:29 +0000 (09:27 +0000)]
sh: rework SuperH Mobile sleep code exception handling

This patch updates the exception handling in the sleep code
for SuperH Mobile. With the patch applied the sleep code
always rewrites the VBR and resumes from the exception vector,
re-initializes hardware and jumps straight to the original
interrupt vector.

Tested on sh7722 and sh7724 with "Sleep Mode", "Sleep Mode + SF"
and "Software Standby Mode + SF" with CONFIG_SUSPEND.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: unwinder: Move initialization to early_initcall() and tidy up locking.
Paul Mundt [Sun, 16 Aug 2009 20:07:38 +0000 (05:07 +0900)]
sh: unwinder: Move initialization to early_initcall() and tidy up locking.

This moves the initialization over to an early_initcall(). This fixes up
some lockdep interaction issues. At the same time, kill off some
superfluous locking in the init path.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: Add support for DWARF GNU extensions
Matt Fleming [Sun, 16 Aug 2009 00:44:33 +0000 (01:44 +0100)]
sh: Add support for DWARF GNU extensions

Also, remove the "fix" to DW_CFA_def_cfa_register where we reset the
frame's cfa_offset to 0. This action is incorrect when handling
DW_CFA_def_cfa_register as the DWARF spec specifically states that the
previous contents of cfa_offset should be used with the new
register. The reason that I thought cfa_offset should be reset to 0 was
because it was being assigned a bogus value prior to executing the
DW_CFA_def_cfa_register op. It turns out that the bogus cfa_offset value
came from interpreting .cfi_escape pseudo-ops (those used by the GNU
extensions) as CFA_DW_def_cfa ops.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
14 years agosh: Try again at getting the initial return address for an unwind
Matt Fleming [Sat, 15 Aug 2009 22:10:57 +0000 (23:10 +0100)]
sh: Try again at getting the initial return address for an unwind

The previous hack for calculating the return address for the first frame
we unwind (dwarf_unwinder_dump) didn't always work. The problem was that
it assumed once it read the rule for calculating the return address,
there would be no new rules for calculating it. This isn't true because
the way in which the CFA is calculated can change as you progress
through a function and the return address is figured out using the
CFA. Therefore, the way to calculate the return address can change.

So, instead of using some offset from the beginning of
dwarf_unwind_stack which is just a flakey approach, and instead of
executing instructions from the FDE until the return address is setup,
we now figure out the pc in dwarf_unwind_stack() just before we call
dwarf_cfa_execute_insns().

Signed-off-by: Matt Fleming <matt@console-pimps.org>
14 years agosh: Merge the _32/_64 variants of arch/sh/kernel/Makefile.
Paul Mundt [Sat, 15 Aug 2009 18:35:26 +0000 (03:35 +0900)]
sh: Merge the _32/_64 variants of arch/sh/kernel/Makefile.

This uses the BITS export as per x86 in order to allow the same Makefile
to be used.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agoMerge branch 'sh/stable-updates'
Paul Mundt [Sat, 15 Aug 2009 03:59:42 +0000 (12:59 +0900)]
Merge branch 'sh/stable-updates'

14 years agosh: sh7724 ddr self-refresh changes
Magnus Damm [Sat, 15 Aug 2009 02:53:42 +0000 (02:53 +0000)]
sh: sh7724 ddr self-refresh changes

This patch updates the SuperH Mobile sleep assembly code with
support for DBSC memory controller found in the sh7724 processor.

Without this fix the memory hooked up to the sh7724 processor
will never enter self-refresh mode before suspending to ram. The
effect of this is that the memory contents most likeley will be
lost upon resume which may or may not be what you want.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: use in-soc KEYSC on se7724
Magnus Damm [Sat, 15 Aug 2009 02:53:34 +0000 (02:53 +0000)]
sh: use in-soc KEYSC on se7724

This patch updates the Solution Engine 7724 board code to use
in-SoC KEYSC resources for the keyboard platform device. Using
the in-SoC key scan controller fixes a crash-during-resume issue.

Without this patch the KEYSC hardware block located in the board
specific FPGA is used together with an external IRQ which is
routed through the FPGA and handled by some board specific demux
code. This board specific FPGA interrupt code does not implement
desc->set_wake() so the enable_irq_wake() call in the sh_keysc
driver will fail at suspend-to-ram time and the disable_irq_wake()
will bomb out when resuming.

Changing the platform data to use the in-SoC KEYSC hardware makes
the se7724 board support code less special which is a good thing.
Also, the board specific KEYSC pin setup code selects in-SoC pin
functions already which makes the current FPGA platform device data
look like a typo.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: CMT suspend/resume
Magnus Damm [Sat, 15 Aug 2009 02:53:25 +0000 (02:53 +0000)]
sh: CMT suspend/resume

This patch updates the SuperH CMT driver with suspend and resume
callbacks for the suspend-to-ram case. This patch stops the CMT
channel at suspend time to avoid unwanted wake up events.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: skip disabled LCDC channels
Magnus Damm [Sat, 15 Aug 2009 02:53:16 +0000 (02:53 +0000)]
sh: skip disabled LCDC channels

This patch updates the SuperH Mobile LCDC driver to skip
over disabled channels. Without this patch suspend-to-ram
operation will crash if deferred io is enabled.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: Set the cfa_offset to 0 if we see a DW_CFA_def_cfa_register op
Matt Fleming [Fri, 14 Aug 2009 23:04:00 +0000 (00:04 +0100)]
sh: Set the cfa_offset to 0 if we see a DW_CFA_def_cfa_register op

The way that the CFA is calculated can change as we progress through a
function. If we see a DW_CFA_def_cfa_register op we need to reset the
frame's cfa_offset value which may have been previously setup.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: delay slot future proofing via EXPMASK on SH-4A parts.
Paul Mundt [Fri, 14 Aug 2009 22:43:21 +0000 (07:43 +0900)]
sh: delay slot future proofing via EXPMASK on SH-4A parts.

This implements EXPMASK initialization code for SH-4A parts, where it is
possible to disable compat features that will go away in newer cores.
Presently this includes disabling support for non-nop instructions in the
rte delay slot, as well as a sleep instruction being placed in a delay
slot (neither of which the kernel does any longer). As a result of this,
any future offenders will have illegal slot exceptions generated for
them.

Associative writes for the memory-mapped cache array are still left
enabled, until such a point that special cache operations for SH-4A are
provided to move off of the current (and rather dated) SH-4 versions.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: Make sure rte delay slots are nopped out on all parts.
Paul Mundt [Fri, 14 Aug 2009 22:41:45 +0000 (07:41 +0900)]
sh: Make sure rte delay slots are nopped out on all parts.

Future SH parts do not support any instruction but a nop in the rte delay
slot, so make the change for all offending parts. SH-5 is excluded from
this, and already has its own set of restrictions with regards to rte
delay slot handling.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: stacktrace: Properly terminate the trace entry buffer.
Paul Mundt [Fri, 14 Aug 2009 16:11:37 +0000 (01:11 +0900)]
sh: stacktrace: Properly terminate the trace entry buffer.

This inserts a ULONG_MAX entry at the end of the valid entries in the
stack trace buffer so the default code doesn't need to scan to the end of
available slots. This also makes the trace buffer termination behaviour
consistent with the other architectures.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: flag the default unwinder as reliable.
Paul Mundt [Fri, 14 Aug 2009 16:09:03 +0000 (01:09 +0900)]
sh: flag the default unwinder as reliable.

This flags the default unwinder as reliable, as it tends to be reliable
enough for the purposes of the stacktrace buffer. We leave the unreliable
cases for the unwind methods that we know to be completely broken.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: stacktrace: Add reliability checks in address saving ops.
Paul Mundt [Fri, 14 Aug 2009 16:05:46 +0000 (01:05 +0900)]
sh: stacktrace: Add reliability checks in address saving ops.

This adopts the reliability checks from the x86 stacktrace code so known
bad addresses are not recorded in the stack trace buffer.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: unwinder: Convert frame allocations to GFP_ATOMIC.
Paul Mundt [Fri, 14 Aug 2009 14:58:37 +0000 (23:58 +0900)]
sh: unwinder: Convert frame allocations to GFP_ATOMIC.

save_stack_trace_tsk() and friends can be called from atomic context (as
triggered by latencytop), and subsequently hit two problematic allocation
points that were using GFP_KERNEL (these were dwarf_unwind_stack() and
dwarf_frame_alloc_regs()). Convert these over to GFP_ATOMIC and get
latencytop working with the DWARF unwinder.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agoLinux 2.6.31-rc6 v2.6.31-rc6
Linus Torvalds [Thu, 13 Aug 2009 22:43:34 +0000 (15:43 -0700)]
Linux 2.6.31-rc6

14 years agogenirq: prevent wakeup of freed irq thread
Linus Torvalds [Thu, 13 Aug 2009 20:05:10 +0000 (13:05 -0700)]
genirq: prevent wakeup of freed irq thread

free_irq() can remove an irqaction while the corresponding interrupt
is in progress, but free_irq() sets action->thread to NULL
unconditionally, which might lead to a NULL pointer dereference in
handle_IRQ_event() when the hard interrupt context tries to wake up
the handler thread.

Prevent this by moving the thread stop after synchronize_irq(). No
need to set action->thread to NULL either as action is going to be
freed anyway.

This fixes a boot crash reported against preempt-rt which uses the
mainline irq threads code to implement full irq threading.

[ tglx: removed local irqthread variable ]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
14 years agoMerge branch 'sh/dwarf-unwinder'
Paul Mundt [Thu, 13 Aug 2009 20:10:57 +0000 (05:10 +0900)]
Merge branch 'sh/dwarf-unwinder'

14 years agosh: Delete DWARF_ARCH_UNWIND_OFFSET
Matt Fleming [Thu, 13 Aug 2009 19:41:31 +0000 (20:41 +0100)]
sh: Delete DWARF_ARCH_UNWIND_OFFSET

Trying to figure out the best value for DWARF_ARCH_UNWIND_OFFSET is
tricky at best. Various things can change the size (and offset from the
beginning of the function) of the prologue. Notably, turning on ftrace
adds calls to mcount at the beginning of functions, thereby pushing the
prologue further into the function.

So replace DWARF_ARCH_UNWIND_OFFSET with some code that continues to
execute CFA instructions until the value of return address register is
defined. This is safe to do because we know that the return address must
have been pushed onto the frame before our first function call; we just
can't figure out where at compile-time.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: oprofile: Kill off dead valid_kernel_stack().
Paul Mundt [Thu, 13 Aug 2009 19:59:50 +0000 (04:59 +0900)]
sh: oprofile: Kill off dead valid_kernel_stack().

This is no longer used, kill it off.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agoMerge branch 'perfcounters-fixes-for-linus' of git://git.kernel.org/pub/scm/linux...
Linus Torvalds [Thu, 13 Aug 2009 19:24:33 +0000 (12:24 -0700)]
Merge branch 'perfcounters-fixes-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip

* 'perfcounters-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  perf_counter: Report the cloning task as parent on perf_counter_fork()
  perf_counter: Fix an ipi-deadlock
  perf: Rework/fix the whole read vs group stuff
  perf_counter: Fix swcounter context invariance
  perf report: Don't show unresolved DSOs and symbols when -S/-d is used
  perf tools: Add a general option to enable raw sample records
  perf tools: Add a per tracepoint counter attribute to get raw sample
  perf_counter: Provide hw_perf_counter_setup_online() APIs
  perf list: Fix large list output by using the pager
  perf_counter, x86: Fix/improve apic fallback
  perf record: Add missing -C option support for specifying profile cpu
  perf tools: Fix dso__new handle() to handle deleted DSOs
  perf tools: Fix fallback to cplus_demangle() when bfd_demangle() is not available
  perf report: Show the tid too in -D
  perf record: Fix .tid and .pid fill-in when synthesizing events
  perf_counter, x86: Fix generic cache events on P6-mobile CPUs
  perf_counter, x86: Fix lapic printk message

14 years agoMerge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Thu, 13 Aug 2009 19:09:16 +0000 (12:09 -0700)]
Merge branch 'core-fixes-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip

* 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  futex: Fix handling of bad requeue syscall pairing
  futex: Fix compat_futex to be same as futex for REQUEUE_PI
  locking, sched: Give waitqueue spinlocks their own lockdep classes
  futex: Update futex_q lock_ptr on requeue proxy lock

14 years agoMerge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Thu, 13 Aug 2009 19:08:44 +0000 (12:08 -0700)]
Merge branch 'x86-fixes-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip

* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86: Fix oops in identify_cpu() on CPUs without CPUID
  x86: Clear incorrectly forced X86_FEATURE_LAHF_LM flag
  x86, mce: therm_throt - change when we print messages
  x86: Add reboot quirk for every 5 series MacBook/Pro

14 years agoMerge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec...
Linus Torvalds [Thu, 13 Aug 2009 18:17:40 +0000 (11:17 -0700)]
Merge branch 'upstream-linus' of git://git./linux/kernel/git/jlbec/ocfs2

* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2: (22 commits)
  ocfs2: Fix possible deadlock when extending quota file
  ocfs2: keep index within status_map[]
  ocfs2: Initialize the cluster we're writing to in a non-sparse extend
  ocfs2: Remove redundant BUG_ON in __dlm_queue_ast()
  ocfs2/quota: Release lock for error in ocfs2_quota_write.
  ocfs2: Define credit counts for quota operations
  ocfs2: Remove syncjiff field from quota info
  ocfs2: Fix initialization of blockcheck stats
  ocfs2: Zero out padding of on disk dquot structure
  ocfs2: Initialize blocks allocated to local quota file
  ocfs2: Mark buffer uptodate before calling ocfs2_journal_access_dq()
  ocfs2: Make global quota files blocksize aligned
  ocfs2: Use ocfs2_rec_clusters in ocfs2_adjust_adjacent_records.
  ocfs2: Fix deadlock on umount
  ocfs2: Add extra credits and access the modified bh in update_edge_lengths.
  ocfs2: Fail ocfs2_get_block() immediately when a block needs allocation
  ocfs2: Fix error return in ocfs2_write_cluster()
  ocfs2: Fix compilation warning for fs/ocfs2/xattr.c
  ocfs2: Initialize count in aio_write before generic_write_checks
  ocfs2: log the actual return value of ocfs2_file_aio_write()
  ...

14 years agosh: unwinder: Restore put_unaligned() for an unaligned destination.
Paul Mundt [Thu, 13 Aug 2009 18:06:13 +0000 (03:06 +0900)]
sh: unwinder: Restore put_unaligned() for an unaligned destination.

The destination address might be unaligned, so set it with
put_unaligned() for safety. This restores the previous behaviour, albeit
through the proper API.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agoMerge branch 'for-linus' of git://neil.brown.name/md
Linus Torvalds [Thu, 13 Aug 2009 17:59:29 +0000 (10:59 -0700)]
Merge branch 'for-linus' of git://neil.brown.name/md

* 'for-linus' of git://neil.brown.name/md:
  md: allow upper limit for resync/reshape to be set when array is read-only
  md/raid5: Properly remove excess drives after shrinking a raid5/6
  md/raid5: make sure a reshape restarts at the correct address.
  md/raid5: allow new reshape modes to be restarted in the middle.
  md: never advance 'events' counter by more than 1.
  Remove deadlock potential in md_open

14 years agoMerge branch 'sh/for-2.6.31' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal...
Linus Torvalds [Thu, 13 Aug 2009 17:57:53 +0000 (10:57 -0700)]
Merge branch 'sh/for-2.6.31' of git://git./linux/kernel/git/lethal/sh-2.6

* 'sh/for-2.6.31' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6:
  sh: fix i2c init order on ap325rxa V2
  sh: fix i2c init order on Migo-R V2
  sh: convert processor device setup functions to arch_initcall()

14 years agoMake sock_sendpage() use kernel_sendpage()
Linus Torvalds [Thu, 13 Aug 2009 15:28:36 +0000 (08:28 -0700)]
Make sock_sendpage() use kernel_sendpage()

kernel_sendpage() does the proper default case handling for when the
socket doesn't have a native sendpage implementation.

Now, arguably this might be something that we could instead solve by
just specifying that all protocols should do it themselves at the
protocol level, but we really only care about the common protocols.
Does anybody really care about sendpage on something like Appletalk? Not
likely.

Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Julien TINNES <julien@cr0.org>
Acked-by: Tavis Ormandy <taviso@sdf.lonestar.org>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agosh: unwinder: Fix up usage of unaligned accessors.
Paul Mundt [Thu, 13 Aug 2009 17:10:59 +0000 (02:10 +0900)]
sh: unwinder: Fix up usage of unaligned accessors.

This was using internal symbols for unaligned accesses, bypassing the
exposed interface for variable sized safe accesses. This converts all of
the __get_unaligned_cpuXX() users over to get_unaligned() directly,
relying on the cast to select the proper internal routine.

Additionally, the __put_unaligned_cpuXX() case is superfluous given that
the destination address is aligned in all of the current cases, so just
drop that outright.

Furthermore, this switches to the asm/unaligned.h header instead of the
asm-generic version, which was silently bypassing the SH-4A optimized
unaligned ops.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: Add CFI annotations for exception return.
Matt Fleming [Sun, 2 Aug 2009 21:40:11 +0000 (22:40 +0100)]
sh: Add CFI annotations for exception return.

Annotate various assembly code paths with CFI assembler directives so
that DWARF unwind info is available for the unwinder.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: Setup the frame register in asm code
Matt Fleming [Sun, 2 Aug 2009 21:33:26 +0000 (22:33 +0100)]
sh: Setup the frame register in asm code

In order to use DWARF unwinder info the frame register has to contain a
valid value. Whilst GCC takes care of this for C code, we have to do it
ourselves for assembly.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: dwarf unwinder support.
Matt Fleming [Thu, 13 Aug 2009 16:58:43 +0000 (01:58 +0900)]
sh: dwarf unwinder support.

This is a first cut at a generic DWARF unwinder for the kernel. It's
still lacking DWARF64 support and the DWARF expression support hasn't
been tested very well but it is generating proper stacktraces on SH for
WARN_ON() and NULL dereferences.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agoperf_counter: Report the cloning task as parent on perf_counter_fork()
Peter Zijlstra [Thu, 13 Aug 2009 14:14:42 +0000 (16:14 +0200)]
perf_counter: Report the cloning task as parent on perf_counter_fork()

A bug in (9f498cc: perf_counter: Full task tracing) makes
profiling multi-threaded apps it go belly up.

[ output as: (PID:TID):(PPID:PTID) ]

 # ./perf report -D | grep FORK
0x4b0 [0x18]: PERF_EVENT_FORK: (3237:3237):(3236:3236)
0xa10 [0x18]: PERF_EVENT_FORK: (3237:3238):(3236:3236)
0xa70 [0x18]: PERF_EVENT_FORK: (3237:3239):(3236:3236)
0xad0 [0x18]: PERF_EVENT_FORK: (3237:3240):(3236:3236)
0xb18 [0x18]: PERF_EVENT_FORK: (3237:3241):(3236:3236)

Shows us that the test (27d028d perf report: Update for the new
FORK/EXIT events) in builtin-report.c:

        /*
         * A thread clone will have the same PID for both
         * parent and child.
         */
        if (thread == parent)
                return 0;

Will clearly fail.

The problem is that perf_counter_fork() reports the actual
parent, instead of the cloning thread.

Fixing that (with the below patch), yields:

 # ./perf report -D | grep FORK
0x4c8 [0x18]: PERF_EVENT_FORK: (1590:1590):(1589:1589)
0xbd8 [0x18]: PERF_EVENT_FORK: (1590:1591):(1590:1590)
0xc80 [0x18]: PERF_EVENT_FORK: (1590:1592):(1590:1590)
0x3338 [0x18]: PERF_EVENT_FORK: (1590:1593):(1590:1590)
0x66b0 [0x18]: PERF_EVENT_FORK: (1590:1594):(1590:1590)

Which both makes more sense and doesn't confuse perf report
anymore.

Reported-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: paulus@samba.org
Cc: Anton Blanchard <anton@samba.org>
Cc: Arjan van de Ven <arjan@infradead.org>
LKML-Reference: <1250172882.5241.62.camel@twins>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
14 years agoperf_counter: Fix an ipi-deadlock
Peter Zijlstra [Thu, 13 Aug 2009 09:47:54 +0000 (11:47 +0200)]
perf_counter: Fix an ipi-deadlock

perf_pending_counter() is called from IRQ context and will call
perf_counter_disable(), however perf_counter_disable() uses
smp_call_function_single() which doesn't fancy being used with
IRQs disabled due to IPI deadlocks.

Fix this by making it use the local __perf_counter_disable()
call and teaching the counter_sched_out() code about pending
disables as well.

This should cover the case where a counter migrates before the
pending queue gets processed.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Corey J Ashford <cjashfor@us.ibm.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: stephane eranian <eranian@googlemail.com>
LKML-Reference: <20090813103655.244097721@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
14 years agoperf: Rework/fix the whole read vs group stuff
Peter Zijlstra [Thu, 13 Aug 2009 09:47:53 +0000 (11:47 +0200)]
perf: Rework/fix the whole read vs group stuff

Replace PERF_SAMPLE_GROUP with PERF_SAMPLE_READ and introduce
PERF_FORMAT_GROUP to deal with group reads in a more generic
way.

This allows you to get group reads out of read() as well.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Corey J Ashford <cjashfor@us.ibm.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: stephane eranian <eranian@googlemail.com>
LKML-Reference: <20090813103655.117411814@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
14 years agosh: Use the new stack unwinder API
Matt Fleming [Tue, 11 Aug 2009 21:43:20 +0000 (22:43 +0100)]
sh: Use the new stack unwinder API

Instead of implementing our own stack unwinder via dump_trace() we
should use the new stack unwinder API because it is more modular. This
change allows us to decouple the interface for generating stacktraces
from the implementation of a stack unwinder.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: Allow multiple stack unwinders to be setup
Matt Fleming [Thu, 13 Aug 2009 10:49:03 +0000 (19:49 +0900)]
sh: Allow multiple stack unwinders to be setup

Provide an interface for registering stack unwinders, where each
unwinder is given a rating that describes its accuracy and
complexity. The more accurate an unwinder is, the more complex it is.

If a the current stack unwinder faults, then the stack unwinder with the
next highest accuracy will be used in its place (provided one is
available). For example, this allows unwinders, such as the DWARF
unwinder, to liberally sprinkle BUG()s to catch badly formed DWARF debug
info.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agoperf_counter: Fix swcounter context invariance
Peter Zijlstra [Thu, 13 Aug 2009 07:51:55 +0000 (09:51 +0200)]
perf_counter: Fix swcounter context invariance

perf_swcounter_is_counting() uses a lock, which means we cannot
use swcounters from NMI or when holding that particular lock,
this is unintended.

The below removes the lock, this opens up race window, but not
worse than the swcounters already experience due to RCU
traversal of the context in perf_swcounter_ctx_event().

This also fixes the hard lockups while opening a lockdep
tracepoint counter.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: stephane eranian <eranian@googlemail.com>
Cc: Corey J Ashford <cjashfor@us.ibm.com>
LKML-Reference: <1250149915.10001.66.camel@twins>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
14 years agoperf report: Don't show unresolved DSOs and symbols when -S/-d is used
Arnaldo Carvalho de Melo [Wed, 12 Aug 2009 21:19:57 +0000 (18:19 -0300)]
perf report: Don't show unresolved DSOs and symbols when -S/-d is used

We're interested in just those symbols/DSOs, so filter out the
unresolved ones.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <20090812211957.GE3495@ghostprotocols.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
14 years agoperf tools: Add a general option to enable raw sample records
Frederic Weisbecker [Thu, 13 Aug 2009 08:27:19 +0000 (10:27 +0200)]
perf tools: Add a general option to enable raw sample records

While we can enable the perf sample records per tracepoint
counter, we may also want to enable this option for every
tracepoint counters to open, so that we don't need to add a
:record flag for all of them.

Add the -R, --raw-samples options for this purpose.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <1250152039-7284-2-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
14 years agoperf tools: Add a per tracepoint counter attribute to get raw sample
Frederic Weisbecker [Thu, 13 Aug 2009 08:27:18 +0000 (10:27 +0200)]
perf tools: Add a per tracepoint counter attribute to get raw sample

Add a new flag field while opening a tracepoint perf counter:

-e tracepoint_subsystem:tracepoint_name:flags

This is intended to be generic although for now it only supports the
r[e[c[o[r[d]]]]] flag:

./perf record -e workqueue:workqueue_insertion:record
./perf record -e workqueue:workqueue_insertion:r

will have the same effect: enabling the raw samples record for
the given tracepoint counter.

In the future, we may want to support further flags, separated
by commas.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <1250152039-7284-1-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
14 years agoperf_counter: Provide hw_perf_counter_setup_online() APIs
Ingo Molnar [Thu, 13 Aug 2009 08:13:22 +0000 (10:13 +0200)]
perf_counter: Provide hw_perf_counter_setup_online() APIs

Provide weak aliases for hw_perf_counter_setup_online(). This is
used by the BTS patches (for v2.6.32), but it interacts with
fixes so propagate this upstream. (it has no effect as of yet)

Also export perf_counter_output() to architecture code.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
14 years agoperf list: Fix large list output by using the pager
Arnaldo Carvalho de Melo [Wed, 12 Aug 2009 17:44:59 +0000 (14:44 -0300)]
perf list: Fix large list output by using the pager

When /sys/kernel/debug is mounted the list can be imense, so
use the pager like the other tools.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <20090812174459.GB3495@ghostprotocols.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
14 years agosh: Use the generalized stacktrace ops
Matt Fleming [Fri, 7 Aug 2009 15:11:19 +0000 (16:11 +0100)]
sh: Use the generalized stacktrace ops

Copy the stacktrace ops code from x86 and provide a central function for
use by functions that need to dump a callstack.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: use printk_once
Marcin Slusarz [Sun, 9 Aug 2009 19:53:59 +0000 (19:53 +0000)]
sh: use printk_once

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: linux-sh@vger.kernel.org
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agoMerge branch 'sh/stable-updates'
Paul Mundt [Thu, 13 Aug 2009 02:48:01 +0000 (11:48 +0900)]
Merge branch 'sh/stable-updates'

14 years agosh: fix i2c init order on ap325rxa V2
Magnus Damm [Fri, 7 Aug 2009 03:52:18 +0000 (03:52 +0000)]
sh: fix i2c init order on ap325rxa V2

Convert the AP325RXA board code to register devices at
arch_initcall() time instead of device_initcall(). This
fix unbreaks pcf8563 RTC driver support.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: fix i2c init order on Migo-R V2
Magnus Damm [Thu, 13 Aug 2009 02:39:02 +0000 (11:39 +0900)]
sh: fix i2c init order on Migo-R V2

Convert the Migo-R board code to register devices at
arch_initcall() time instead of __initcall(). This fix
unbreaks migor_ts touch screen driver support.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agosh: convert processor device setup functions to arch_initcall()
Magnus Damm [Wed, 22 Jul 2009 15:14:29 +0000 (15:14 +0000)]
sh: convert processor device setup functions to arch_initcall()

Convert the processor platform device setup
functions from __initcall() and sometimes
device_initcall() to arch_initcall().

This makes sure that the platform devices are
registered a bit earlier so the devices are
available when drivers register using initcall
levels earlier than device_initcall().

A good example is platform devices needed by
i2c-sh_mobile.c which registers a bit earlier
using subsys_initcall().

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agomd: allow upper limit for resync/reshape to be set when array is read-only
NeilBrown [Thu, 13 Aug 2009 00:41:50 +0000 (10:41 +1000)]
md: allow upper limit for resync/reshape to be set when array is read-only

Normally we only allow the upper limit for a reshape to be decreased
when the array not performing a sync/recovery/reshape, otherwise there
could be races.  But if an array is part-way through a reshape when it
is assembled the reshape is started immediately leaving no window
to set an upper bound.

If the array is started read-only, the reshape will be suspended until
the array becomes writable, so that provides a window during which it
is perfectly safe to reduce the upper limit of a reshape.

So: allow the upper limit (sync_max) to be reduced even if the reshape
thread is running, as long as the array is still read-only.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agomd/raid5: Properly remove excess drives after shrinking a raid5/6
NeilBrown [Thu, 13 Aug 2009 00:41:49 +0000 (10:41 +1000)]
md/raid5: Properly remove excess drives after shrinking a raid5/6

We were removing the drives, from the array, but not
removing symlinks from /sys/.... and not marking the device
as having been removed.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agomd/raid5: make sure a reshape restarts at the correct address.
NeilBrown [Thu, 13 Aug 2009 00:13:00 +0000 (10:13 +1000)]
md/raid5: make sure a reshape restarts at the correct address.

This "if" don't allow for the possibility that the number of devices
doesn't change, and so sector_nr isn't set correctly in that case.
So change '>' to '>='.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agomd/raid5: allow new reshape modes to be restarted in the middle.
NeilBrown [Thu, 13 Aug 2009 00:06:24 +0000 (10:06 +1000)]
md/raid5: allow new reshape modes to be restarted in the middle.

md/raid5 doesn't allow a reshape to restart if it involves writing
over the same part of disk that it would be reading from.
This happens at the beginning of a reshape that increases the number
of devices, at the end of a reshape that decreases the number of
devices, and continuously for a reshape that does not change the
number of devices.

The current code is correct for the "increase number of devices"
case as the critical section at the start is handled by userspace
performing a backup.

It does not work for reducing the number of devices, or the
no-change case.
For 'reducing', we need to invert the test.  For no-change we cannot
really be sure things will be safe, so simply require the array
to be read-only, which is how the user-space code which carefully
starts such arrays works.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agomd: never advance 'events' counter by more than 1.
NeilBrown [Wed, 12 Aug 2009 23:54:02 +0000 (09:54 +1000)]
md: never advance 'events' counter by more than 1.

When assembling arrays, md allows two devices to have different event
counts as long as the difference is only '1'.  This is to cope with
a system failure between updating the metadata on two difference
devices.

However there are currently times when we update the event count by
2.  This was done to keep the event count even when the array is clean
and odd when it is dirty, which allows us to avoid writing common
update to spare devices and so allow those spares to go to sleep.

This is bad for the above reason.  So change it to never increase by
two.  This means that the alignment between 'odd/even' and
'clean/dirty' might take a little longer to attain, but that is only a
small cost.  The spares will get a few more updates but that will
still be spared (;-) most updates and can still go to sleep.

Prior to this patch there was a small chance that after a crash an
array would fail to assemble due to the overly large event count
mismatch.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoMerge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
Linus Torvalds [Wed, 12 Aug 2009 16:55:46 +0000 (09:55 -0700)]
Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block

* 'for-linus' of git://git.kernel.dk/linux-2.6-block:
  Remove double removal of blktrace directory

14 years agoRemove double removal of blktrace directory
Alan D. Brunelle [Fri, 7 Aug 2009 16:01:08 +0000 (12:01 -0400)]
Remove double removal of blktrace directory

commit fd51d251e4cdb21f68e9dbc4336514d64a105a79
Author: Stefan Raspl <raspl@linux.vnet.ibm.com>
Date:   Tue May 19 09:59:08 2009 +0200

    blktrace: remove debugfs entries on bad path

added in an explicit invocation of debugfs_remove for bt->dir, in
blk_remove_buf_file_callback we are also getting the directory removed. On
occasion I am seeing memory corruption that I have bisected down to
this commit. [The testing involves a (long) series of I/O benchmarks
with blktrace invoked around the actual runs.] I believe that this
committed patch is correct, but the problem actually lies in the code
in blk_remove_buf_file_callback.

With this patch I am able to consistently get complete runs whereas
previously I could not get a single run to complete.

The first part of the patch simply moves the debugfs_remove below the
relay_close: the relay_close call will remove files under bt->dir, and
so we should not remove the directory until all the files we created
have been removed. (Note: This is not sufficient to fix the problem -
the file system code has ref counts on the directoy, so our invocation
does not cause the directory to actually be removed. Nonetheless, we
should not rely upon that feature.)

Signed-off-by: Alan D. Brunelle <alan.brunelle@hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>