firefly-linux-kernel-4.4.55.git
10 years agoenable rockchip ion by default
CMY [Tue, 11 Feb 2014 07:31:10 +0000 (15:31 +0800)]
enable rockchip ion by default

10 years agork fb:use ion interface export by rockchip ion
yxj [Tue, 11 Feb 2014 07:26:04 +0000 (15:26 +0800)]
rk fb:use ion interface export by rockchip ion

10 years agork fb: add ion dam_buf support
yxj [Tue, 11 Feb 2014 06:44:08 +0000 (14:44 +0800)]
rk fb: add ion dam_buf support

10 years agoAdd rockchip ion
CMY [Mon, 10 Feb 2014 02:36:02 +0000 (10:36 +0800)]
Add rockchip ion

10 years agoclk: rk: change clk_core init-rate and the way to get cru&grf base
dkl [Tue, 11 Feb 2014 02:16:42 +0000 (10:16 +0800)]
clk: rk: change clk_core init-rate and the way to get cru&grf base

1. Change clk_core init-rate to 792 MHZ.
2. Use RK_CRU_VIRT & RK_GRF_VIRT to get cru&grf base.
3. Fix pll_wait_lock() func.

10 years agopwm: solve the bug sleeping function called from invalid context at kernel/mutex...
许盛飞 [Tue, 11 Feb 2014 03:19:03 +0000 (11:19 +0800)]
pwm: solve the bug sleeping function called from invalid context at kernel/mutex.c:413

10 years ago1.optimize the 'hdmi' global variables 2.fix some compile error
zwl [Mon, 10 Feb 2014 14:11:43 +0000 (22:11 +0800)]
1.optimize the 'hdmi' global variables 2.fix some compile error

10 years agoARM: rockchip: rockchip_defconfig merge android config
黄涛 [Mon, 10 Feb 2014 09:14:04 +0000 (17:14 +0800)]
ARM: rockchip: rockchip_defconfig merge android config

10 years agoMerge remote-tracking branch 'origin/upstream/linux-linaro-lsk-v3.10-android' into...
黄涛 [Mon, 10 Feb 2014 08:23:36 +0000 (16:23 +0800)]
Merge remote-tracking branch 'origin/upstream/linux-linaro-lsk-v3.10-android' into develop-3.10

10 years agoARM: rockchip: fix dma commit 1dcced23a5ed21220d42540a1e897db61cda66ba
黄涛 [Mon, 10 Feb 2014 06:19:24 +0000 (14:19 +0800)]
ARM: rockchip: fix dma commit 1dcced23a5ed21220d42540a1e897db61cda66ba

10 years agodma pl330: add device tree mode support, memcpy function ok,
宋秀杰 [Mon, 10 Feb 2014 03:14:48 +0000 (11:14 +0800)]
dma pl330: add device tree mode support, memcpy function ok,
but clock is not used now.

10 years agoclk: rockchip: add clk_gpu init to rate 200M
dkl [Mon, 10 Feb 2014 02:52:33 +0000 (10:52 +0800)]
clk: rockchip: add clk_gpu init to rate 200M

10 years agork616: update rk616 driver,add dts property
zwl [Sat, 8 Feb 2014 09:40:40 +0000 (17:40 +0800)]
rk616: update rk616 driver,add dts property

10 years agoARM: rockchip: update rockchip_defconfig to support mtd and rknand
黄涛 [Sat, 8 Feb 2014 08:39:23 +0000 (16:39 +0800)]
ARM: rockchip: update rockchip_defconfig to support mtd and rknand

10 years agorknand:remove debug log.
Zhaoyifeng [Sat, 8 Feb 2014 08:13:02 +0000 (16:13 +0800)]
rknand:remove debug log.

10 years agorockchip_defconfig : set default cpufreq governor to interactive
陈亮 [Sat, 8 Feb 2014 06:17:36 +0000 (22:17 -0800)]
rockchip_defconfig : set default cpufreq governor to interactive

10 years agork3188 : add dvfs && cpufreq
陈亮 [Sat, 8 Feb 2014 03:32:55 +0000 (19:32 -0800)]
rk3188 : add dvfs && cpufreq

10 years ago add rknand for debug
Zhaoyifeng [Sat, 8 Feb 2014 02:23:40 +0000 (10:23 +0800)]
add rknand for debug

10 years agoARM: rockchip: correct L2 latency setting
dkl [Fri, 7 Feb 2014 12:19:16 +0000 (20:19 +0800)]
ARM: rockchip: correct L2 latency setting

10 years agoclose pinctrl debug log
luowei [Fri, 7 Feb 2014 05:42:17 +0000 (13:42 +0800)]
close pinctrl debug log

10 years agoclk: rockchip: fix clk reg address description in dts
dkl [Fri, 7 Feb 2014 03:30:51 +0000 (11:30 +0800)]
clk: rockchip: fix clk reg address description in dts

1.Descripe cru address mapping in clocks node's "ranges" property, and
change children nodes' "reg" property accordingly.
2.Get cru base from clock_regs node's "reg" property.

10 years agoRecommit "clk: rockchip: add clk init data and enable clk init"
dkl [Fri, 7 Feb 2014 01:50:53 +0000 (09:50 +0800)]
Recommit "clk: rockchip: add clk init data and enable clk init"

This recommit commit 4673090895385ded057a23dcbdfff2ebe1f80f1b with
fix that lower clk_core init rate to 594 MHZ.

10 years agoMerge branch 'linux-linaro-lsk' into linux-linaro-lsk-android
Mark Brown [Mon, 27 Jan 2014 14:57:42 +0000 (14:57 +0000)]
Merge branch 'linux-linaro-lsk' into linux-linaro-lsk-android

10 years agoMerge tag 'v3.10.28' into linux-linaro-lsk
Mark Brown [Mon, 27 Jan 2014 14:57:25 +0000 (14:57 +0000)]
Merge tag 'v3.10.28' into linux-linaro-lsk

This is the 3.10.28 stable release

10 years agork fb:rename layer to win, add iomux for rk3188 lcdc
yxj [Mon, 20 Jan 2014 22:39:28 +0000 (06:39 +0800)]
rk fb:rename layer to win, add iomux for rk3188 lcdc

10 years agoupdate audio platform driver, add spdif codec dts property
陈金泉 [Sun, 26 Jan 2014 08:28:43 +0000 (16:28 +0800)]
update audio platform driver, add spdif codec dts property

10 years agoARM: rockchip: set rk3188 machine name RK30board to keep android happy
黄涛 [Sun, 26 Jan 2014 07:58:50 +0000 (15:58 +0800)]
ARM: rockchip: set rk3188 machine name RK30board to keep android happy

10 years agork:pmu:rk808&act8846:support dts for linux 3.1
张晴 [Sun, 26 Jan 2014 01:58:37 +0000 (09:58 +0800)]
rk:pmu:rk808&act8846:support dts for linux 3.1

10 years agoRevert "clk: rockchip: add clk init data and enable clk init"
dkl [Sun, 26 Jan 2014 01:34:30 +0000 (09:34 +0800)]
Revert "clk: rockchip: add clk init data and enable clk init"

This reverts commit 4673090895385ded057a23dcbdfff2ebe1f80f1b.

10 years agoLinux 3.10.28
Greg Kroah-Hartman [Sat, 25 Jan 2014 16:27:55 +0000 (08:27 -0800)]
Linux 3.10.28

10 years agoARM: 7938/1: OMAP4/highbank: Flush L2 cache before disabling
Taras Kondratiuk [Fri, 10 Jan 2014 00:27:08 +0000 (01:27 +0100)]
ARM: 7938/1: OMAP4/highbank: Flush L2 cache before disabling

commit b25f3e1c358434bf850220e04f28eebfc45eb634 upstream.

Kexec disables outer cache before jumping to reboot code, but it doesn't
flush it explicitly. Flush is done implicitly inside of l2x0_disable().
But some SoC's override default .disable handler and don't flush cache.
This may lead to a corrupted memory during Kexec reboot on these
platforms.

This patch adds cache flush inside of OMAP4 and Highbank outer_cache.disable()
handlers to make it consistent with default l2x0_disable().

Acked-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Wang Nan <wangnan0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agodrm/i915: Don't grab crtc mutexes in intel_modeset_gem_init()
Ville Syrjälä [Tue, 7 Jan 2014 14:15:36 +0000 (16:15 +0200)]
drm/i915: Don't grab crtc mutexes in intel_modeset_gem_init()

commit 7ad228b11ec26a820291c9f5a1168d6176580dc1 upstream.

When the pipe A force quirk is applied the code will attempt to grab
a crtc mutex during intel_modeset_setup_hw_state(). If we're already
holding all crtc mutexes this will obviously deadlock every time.

So instead of using drm_modeset_lock_all() just grab the
mode_config.mutex. This is enough to avoid the unlocked mutex warnings
from certain lower level functions.

The regression was introduced in:

 commit 027476642811f8559cbe00ef6cc54db230e48a20
 Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
 Date:   Mon Dec 2 11:08:06 2013 +0200

    drm/i915: Take modeset locks around intel_modeset_setup_hw_state()

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
[danvet: Add cc: stable since the offending commit has that, too.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoserial: amba-pl011: use port lock to guard control register access
Jon Medhurst [Tue, 10 Dec 2013 10:18:58 +0000 (10:18 +0000)]
serial: amba-pl011: use port lock to guard control register access

commit fe43390702a1b5741fdf217063b05c7612b38303 upstream.

When the pl011 is being used for a console, pl011_console_write forces
the control register (CR) to enable the UART for transmission and then
restores this to the original value afterwards. It does this while
holding the port lock.

Unfortunately, when the uart is started or shutdown - say in response to
userland using the serial device for a terminal - then this updates the
control register without any locking.

This means we can have

  pl011_console_write   Save CR
  pl011_startup         Initialise CR, e.g. enable receive
  pl011_console_write   Restore old CR with receive not enabled

this result is a serial port which doesn't respond to any input.

A similar race in reverse could happen when the device is shutdown.

We can fix these problems by taking the port lock when updating CR.

Signed-off-by: Jon Medhurst <tixy@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agomm: Make {,set}page_address() static inline if WANT_PAGE_VIRTUAL
Geert Uytterhoeven [Tue, 21 Jan 2014 23:48:47 +0000 (15:48 -0800)]
mm: Make {,set}page_address() static inline if WANT_PAGE_VIRTUAL

commit f92f455f67fef27929e6043499414605b0c94872 upstream.

{,set}page_address() are macros if WANT_PAGE_VIRTUAL.  If
!WANT_PAGE_VIRTUAL, they're plain C functions.

If someone calls them with a void *, this pointer is auto-converted to
struct page * if !WANT_PAGE_VIRTUAL, but causes a build failure on
architectures using WANT_PAGE_VIRTUAL (arc, m68k and sparc64):

  drivers/md/bcache/bset.c: In function `__btree_sort':
  drivers/md/bcache/bset.c:1190: warning: dereferencing `void *' pointer
  drivers/md/bcache/bset.c:1190: error: request for member `virtual' in something not a structure or union

Convert them to static inline functions to fix this.  There are already
plenty of users of struct page members inside <linux/mm.h>, so there's
no reason to keep them as macros.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agomd/raid5: Fix possible confusion when multiple write errors occur.
NeilBrown [Mon, 6 Jan 2014 02:19:42 +0000 (13:19 +1100)]
md/raid5: Fix possible confusion when multiple write errors occur.

commit 1cc03eb93245e63b0b7a7832165efdc52e25b4e6 upstream.

commit 5d8c71f9e5fbdd95650be00294d238e27a363b5c
    md: raid5 crash during degradation

Fixed a crash in an overly simplistic way which could leave
R5_WriteError or R5_MadeGood set in the stripe cache for devices
for which it is no longer relevant.
When those devices are removed and spares added the flags are still
set and can cause incorrect behaviour.

commit 14a75d3e07c784c004b4b44b34af996b8e4ac453
    md/raid5: preferentially read from replacement device if possible.

Fixed the same bug if a more effective way, so we can now revert
the original commit.

Reported-and-tested-by: Alexander Lyakas <alex.bolshoy@gmail.com>
Fixes: 5d8c71f9e5fbdd95650be00294d238e27a363b5c
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agomd/raid10: fix two bugs in handling of known-bad-blocks.
NeilBrown [Mon, 13 Jan 2014 23:38:09 +0000 (10:38 +1100)]
md/raid10: fix two bugs in handling of known-bad-blocks.

commit b50c259e25d9260b9108dc0c2964c26e5ecbe1c1 upstream.

If we discover a bad block when reading we split the request and
potentially read some of it from a different device.

The code path of this has two bugs in RAID10.
1/ we get a spin_lock with _irq, but unlock without _irq!!
2/ The calculation of 'sectors_handled' is wrong, as can be clearly
   seen by comparison with raid1.c

This leads to at least 2 warnings and a probable crash is a RAID10
ever had known bad blocks.

Fixes: 856e08e23762dfb92ffc68fd0a8d228f9e152160
Reported-by: Damian Nowak <spam@nowaker.net>
URL: https://bugzilla.kernel.org/show_bug.cgi?id=68181
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agomd/raid10: fix bug when raid10 recovery fails to recover a block.
NeilBrown [Sun, 5 Jan 2014 23:35:34 +0000 (10:35 +1100)]
md/raid10: fix bug when raid10 recovery fails to recover a block.

commit e8b849158508565e0cd6bc80061124afc5879160 upstream.

commit e875ecea266a543e643b19e44cf472f1412708f9
    md/raid10 record bad blocks as needed during recovery.

added code to the "cannot recover this block" path to record a bad
block rather than fail the whole recovery.
Unfortunately this new case was placed *after* r10bio was freed rather
than *before*, yet it still uses r10bio.
This is will crash with a null dereference.

So move the freeing of r10bio down where it is safe.

Fixes: e875ecea266a543e643b19e44cf472f1412708f9
Reported-by: Damian Nowak <spam@nowaker.net>
URL: https://bugzilla.kernel.org/show_bug.cgi?id=68181
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agomd: fix problem when adding device to read-only array with bitmap.
NeilBrown [Wed, 11 Dec 2013 23:13:33 +0000 (10:13 +1100)]
md: fix problem when adding device to read-only array with bitmap.

commit 8313b8e57f55b15e5b7f7fc5d1630bbf686a9a97 upstream.

If an array is started degraded, and then the missing device
is found it can be re-added and a minimal bitmap-based recovery
will bring it fully up-to-date.

If the array is read-only a recovery would not be allowed.
But also if the array is read-only and the missing device was
present very recently, then there could be no need for any
recovery at all, so we simply include the device in the read-only
array without any recovery.

However... if the missing device was removed a little longer ago
it could be missing some updates, but if a bitmap is present it will
be conditionally accepted pending a bitmap-based update.  We don't
currently detect this case properly and will include that old
device into the read-only array with no recovery even though it really
needs a recovery.

This patch keeps track of whether a bitmap-based-recovery is really
needed or not in the new Bitmap_sync rdev flag.  If that is set,
then the device will not be added to a read-only array.

Cc: Andrei Warkentin <andreiw@vmware.com>
Fixes: d70ed2e4fafdbef0800e73942482bb075c21578b
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agodrm/i915: fix DDI PLLs HW state readout code
Paulo Zanoni [Wed, 8 Jan 2014 13:12:27 +0000 (11:12 -0200)]
drm/i915: fix DDI PLLs HW state readout code

commit 0882dae983707455e97479e5e904e37673517ebc upstream.

Properly zero the refcounts and crtc->ddi_pll_set so the previous HW
state doesn't affect the result of reading the current HW state.

This fixes WARNs about WRPLL refcount if we have an HDMI monitor on
HSW and then suspend/resume.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64379
Tested-by: Qingshuai Tian <qingshuai.tian@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agonilfs2: fix segctor bug that causes file system corruption
Andreas Rohner [Wed, 15 Jan 2014 01:56:36 +0000 (17:56 -0800)]
nilfs2: fix segctor bug that causes file system corruption

commit 70f2fe3a26248724d8a5019681a869abdaf3e89a upstream.

There is a bug in the function nilfs_segctor_collect, which results in
active data being written to a segment, that is marked as clean.  It is
possible, that this segment is selected for a later segment
construction, whereby the old data is overwritten.

The problem shows itself with the following kernel log message:

  nilfs_sufile_do_cancel_free: segment 6533 must be clean

Usually a few hours later the file system gets corrupted:

  NILFS: bad btree node (blocknr=8748107): level = 0, flags = 0x0, nchildren = 0
  NILFS error (device sdc1): nilfs_bmap_last_key: broken bmap (inode number=114660)

The issue can be reproduced with a file system that is nearly full and
with the cleaner running, while some IO intensive task is running.
Although it is quite hard to reproduce.

This is what happens:

 1. The cleaner starts the segment construction
 2. nilfs_segctor_collect is called
 3. sc_stage is on NILFS_ST_SUFILE and segments are freed
 4. sc_stage is on NILFS_ST_DAT current segment is full
 5. nilfs_segctor_extend_segments is called, which
    allocates a new segment
 6. The new segment is one of the segments freed in step 3
 7. nilfs_sufile_cancel_freev is called and produces an error message
 8. Loop around and the collection starts again
 9. sc_stage is on NILFS_ST_SUFILE and segments are freed
    including the newly allocated segment, which will contain active
    data and can be allocated at a later time
10. A few hours later another segment construction allocates the
    segment and causes file system corruption

This can be prevented by simply reordering the statements.  If
nilfs_sufile_cancel_freev is called before nilfs_segctor_extend_segments
the freed segments are marked as dirty and cannot be allocated any more.

Signed-off-by: Andreas Rohner <andreas.rohner@gmx.net>
Reviewed-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Tested-by: Andreas Rohner <andreas.rohner@gmx.net>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agothp: fix copy_page_rep GPF by testing is_huge_zero_pmd once only
Hugh Dickins [Sun, 12 Jan 2014 09:25:21 +0000 (01:25 -0800)]
thp: fix copy_page_rep GPF by testing is_huge_zero_pmd once only

commit eecc1e426d681351a6026a7d3e7d225f38955b6c upstream.

We see General Protection Fault on RSI in copy_page_rep: that RSI is
what you get from a NULL struct page pointer.

  RIP: 0010:[<ffffffff81154955>]  [<ffffffff81154955>] copy_page_rep+0x5/0x10
  RSP: 0000:ffff880136e15c00  EFLAGS: 00010286
  RAX: ffff880000000000 RBX: ffff880136e14000 RCX: 0000000000000200
  RDX: 6db6db6db6db6db7 RSI: db73880000000000 RDI: ffff880dd0c00000
  RBP: ffff880136e15c18 R08: 0000000000000200 R09: 000000000005987c
  R10: 000000000005987c R11: 0000000000000200 R12: 0000000000000001
  R13: ffffea00305aa000 R14: 0000000000000000 R15: 0000000000000000
  FS:  00007f195752f700(0000) GS:ffff880c7fc20000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 0000000093010000 CR3: 00000001458e1000 CR4: 00000000000027e0
  Call Trace:
    copy_user_huge_page+0x93/0xab
    do_huge_pmd_wp_page+0x710/0x815
    handle_mm_fault+0x15d8/0x1d70
    __do_page_fault+0x14d/0x840
    do_page_fault+0x2f/0x90
    page_fault+0x22/0x30

do_huge_pmd_wp_page() tests is_huge_zero_pmd(orig_pmd) four times: but
since shrink_huge_zero_page() can free the huge_zero_page, and we have
no hold of our own on it here (except where the fourth test holds
page_table_lock and has checked pmd_same), it's possible for it to
answer yes the first time, but no to the second or third test.  Change
all those last three to tests for NULL page.

(Note: this is not the same issue as trinity's DEBUG_PAGEALLOC BUG
in copy_page_rep with RSI: ffff88009c422000, reported by Sasha Levin
in https://lkml.org/lkml/2013/3/29/103.  I believe that one is due
to the source page being split, and a tail page freed, while copy
is in progress; and not a problem without DEBUG_PAGEALLOC, since
the pmd_same check will prevent a miscopy from being made visible.)

Fixes: 97ae17497e99 ("thp: implement refcounting for huge zero page")
Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoftrace/x86: Load ftrace_ops in parameter not the variable holding it
Steven Rostedt [Wed, 13 Nov 2013 20:20:04 +0000 (15:20 -0500)]
ftrace/x86: Load ftrace_ops in parameter not the variable holding it

commit 1739f09e33d8f66bf48ddbc3eca615574da6c4f6 upstream.

Function tracing callbacks expect to have the ftrace_ops that registered it
passed to them, not the address of the variable that holds the ftrace_ops
that registered it.

Use a mov instead of a lea to store the ftrace_ops into the parameter
of the function tracing callback.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Link: http://lkml.kernel.org/r/20131113152004.459787f9@gandalf.local.home
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoSELinux: Fix possible NULL pointer dereference in selinux_inode_permission()
Steven Rostedt [Fri, 10 Jan 2014 02:46:34 +0000 (21:46 -0500)]
SELinux: Fix possible NULL pointer dereference in selinux_inode_permission()

commit 3dc91d4338d698ce77832985f9cb183d8eeaf6be upstream.

While running stress tests on adding and deleting ftrace instances I hit
this bug:

  BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
  IP: selinux_inode_permission+0x85/0x160
  PGD 63681067 PUD 7ddbe067 PMD 0
  Oops: 0000 [#1] PREEMPT
  CPU: 0 PID: 5634 Comm: ftrace-test-mki Not tainted 3.13.0-rc4-test-00033-gd2a6dde-dirty #20
  Hardware name:                  /DG965MQ, BIOS MQ96510J.86A.0372.2006.0605.1717 06/05/2006
  task: ffff880078375800 ti: ffff88007ddb0000 task.ti: ffff88007ddb0000
  RIP: 0010:[<ffffffff812d8bc5>]  [<ffffffff812d8bc5>] selinux_inode_permission+0x85/0x160
  RSP: 0018:ffff88007ddb1c48  EFLAGS: 00010246
  RAX: 0000000000000000 RBX: 0000000000800000 RCX: ffff88006dd43840
  RDX: 0000000000000001 RSI: 0000000000000081 RDI: ffff88006ee46000
  RBP: ffff88007ddb1c88 R08: 0000000000000000 R09: ffff88007ddb1c54
  R10: 6e6576652f6f6f66 R11: 0000000000000003 R12: 0000000000000000
  R13: 0000000000000081 R14: ffff88006ee46000 R15: 0000000000000000
  FS:  00007f217b5b6700(0000) GS:ffffffff81e21000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033^M
  CR2: 0000000000000020 CR3: 000000006a0fe000 CR4: 00000000000007f0
  Call Trace:
    security_inode_permission+0x1c/0x30
    __inode_permission+0x41/0xa0
    inode_permission+0x18/0x50
    link_path_walk+0x66/0x920
    path_openat+0xa6/0x6c0
    do_filp_open+0x43/0xa0
    do_sys_open+0x146/0x240
    SyS_open+0x1e/0x20
    system_call_fastpath+0x16/0x1b
  Code: 84 a1 00 00 00 81 e3 00 20 00 00 89 d8 83 c8 02 40 f6 c6 04 0f 45 d8 40 f6 c6 08 74 71 80 cf 02 49 8b 46 38 4c 8d 4d cc 45 31 c0 <0f> b7 50 20 8b 70 1c 48 8b 41 70 89 d9 8b 78 04 e8 36 cf ff ff
  RIP  selinux_inode_permission+0x85/0x160
  CR2: 0000000000000020

Investigating, I found that the inode->i_security was NULL, and the
dereference of it caused the oops.

in selinux_inode_permission():

isec = inode->i_security;

rc = avc_has_perm_noaudit(sid, isec->sid, isec->sclass, perms, 0, &avd);

Note, the crash came from stressing the deletion and reading of debugfs
files.  I was not able to recreate this via normal files.  But I'm not
sure they are safe.  It may just be that the race window is much harder
to hit.

What seems to have happened (and what I have traced), is the file is
being opened at the same time the file or directory is being deleted.
As the dentry and inode locks are not held during the path walk, nor is
the inodes ref counts being incremented, there is nothing saving these
structures from being discarded except for an rcu_read_lock().

The rcu_read_lock() protects against freeing of the inode, but it does
not protect freeing of the inode_security_struct.  Now if the freeing of
the i_security happens with a call_rcu(), and the i_security field of
the inode is not changed (it gets freed as the inode gets freed) then
there will be no issue here.  (Linus Torvalds suggested not setting the
field to NULL such that we do not need to check if it is NULL in the
permission check).

Note, this is a hack, but it fixes the problem at hand.  A real fix is
to restructure the destroy_inode() to call all the destructor handlers
from the RCU callback.  But that is a major job to do, and requires a
lot of work.  For now, we just band-aid this bug with this fix (it
works), and work on a more maintainable solution in the future.

Link: http://lkml.kernel.org/r/20140109101932.0508dec7@gandalf.local.home
Link: http://lkml.kernel.org/r/20140109182756.17abaaa8@gandalf.local.home
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agowriteback: Fix data corruption on NFS
Jan Kara [Fri, 13 Dec 2013 20:21:26 +0000 (04:21 +0800)]
writeback: Fix data corruption on NFS

commit f9b0e058cbd04ada76b13afffa7e1df830543c24 upstream.

Commit 4f8ad655dbc8 "writeback: Refactor writeback_single_inode()" added
a condition to skip clean inode. However this is wrong in WB_SYNC_ALL
mode because there we also want to wait for outstanding writeback on
possibly clean inode. This was causing occasional data corruption issues
on NFS because it uses sync_inode() to make sure all outstanding writes
are flushed to the server before truncating the inode and with
sync_inode() returning prematurely file was sometimes extended back
by an outstanding write after it was truncated.

So modify the test to also check for pages under writeback in
WB_SYNC_ALL mode.

Fixes: 4f8ad655dbc82cf05d2edc11e66b78a42d38bf93
Reported-and-tested-by: Dan Duval <dan.duval@oracle.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agohwmon: (coretemp) Fix truncated name of alarm attributes
Jean Delvare [Tue, 14 Jan 2014 14:59:55 +0000 (15:59 +0100)]
hwmon: (coretemp) Fix truncated name of alarm attributes

commit 3f9aec7610b39521c7c69d754de7265f6994c194 upstream.

When the core number exceeds 9, the size of the buffer storing the
alarm attribute name is insufficient and the attribute name is
truncated. This causes libsensors to skip these attributes as the
truncated name is not recognized.

Reported-by: Andreas Hollmann <hollmann@in.tum.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agovfs: In d_path don't call d_dname on a mount point
Eric W. Biederman [Sat, 9 Nov 2013 00:31:29 +0000 (16:31 -0800)]
vfs: In d_path don't call d_dname on a mount point

commit f48cfddc6729ef133933062320039808bafa6f45 upstream.

Aditya Kali (adityakali@google.com) wrote:
> Commit bf056bfa80596a5d14b26b17276a56a0dcb080e5:
> "proc: Fix the namespace inode permission checks." converted
> the namespace files into symlinks. The same commit changed
> the way namespace bind mounts appear in /proc/mounts:
>   $ mount --bind /proc/self/ns/ipc /mnt/ipc
> Originally:
>   $ cat /proc/mounts | grep ipc
>   proc /mnt/ipc proc rw,nosuid,nodev,noexec 0 0
>
> After commit bf056bfa80596a5d14b26b17276a56a0dcb080e5:
>   $ cat /proc/mounts | grep ipc
>   proc ipc:[4026531839] proc rw,nosuid,nodev,noexec 0 0
>
> This breaks userspace which expects the 2nd field in
> /proc/mounts to be a valid path.

The symlink /proc/<pid>/ns/{ipc,mnt,net,pid,user,uts} point to
dentries allocated with d_alloc_pseudo that we can mount, and
that have interesting names printed out with d_dname.

When these files are bind mounted /proc/mounts is not currently
displaying the mount point correctly because d_dname is called instead
of just displaying the path where the file is mounted.

Solve this by adding an explicit check to distinguish mounted pseudo
inodes and unmounted pseudo inodes.  Unmounted pseudo inodes always
use mount of their filesstem as the mnt_root  in their path making
these two cases easy to distinguish.

Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Reported-by: Aditya Kali <adityakali@google.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: adl_pci9111: fix incorrect irq passed to request_irq()
H Hartley Sweeten [Thu, 5 Dec 2013 20:43:28 +0000 (13:43 -0700)]
staging: comedi: adl_pci9111: fix incorrect irq passed to request_irq()

commit 48108fe3daa0d142f9b97178fdb23704ea3a407b upstream.

The dev->irq passed to request_irq() will always be 0 when the auto_attach
function is called. The pcidev->irq should be used instead to get the correct
irq number.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: addi_apci_1032: fix subdevice type/flags bug
H Hartley Sweeten [Mon, 9 Dec 2013 23:06:41 +0000 (16:06 -0700)]
staging: comedi: addi_apci_1032: fix subdevice type/flags bug

commit 90daf69a7a3f1d1a41018c799968a0bb896d65e0 upstream.

The SDF_CMD_READ should be one of the s->subdev_flags not part of
the s->type.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agomm/memory-failure.c: recheck PageHuge() after hugetlb page migrate successfully
Jianguo Wu [Thu, 19 Dec 2013 01:08:54 +0000 (17:08 -0800)]
mm/memory-failure.c: recheck PageHuge() after hugetlb page migrate successfully

commit a49ecbcd7b0d5a1cda7d60e03df402dd0ef76ac8 upstream.

After a successful hugetlb page migration by soft offline, the source
page will either be freed into hugepage_freelists or buddy(over-commit
page).  If page is in buddy, page_hstate(page) will be NULL.  It will
hit a NULL pointer dereference in dequeue_hwpoisoned_huge_page().

  BUG: unable to handle kernel NULL pointer dereference at 0000000000000058
  IP: [<ffffffff81163761>] dequeue_hwpoisoned_huge_page+0x131/0x1d0
  PGD c23762067 PUD c24be2067 PMD 0
  Oops: 0000 [#1] SMP

So check PageHuge(page) after call migrate_pages() successfully.

[wujg: backport to 3.10:
 - adjust context]

Signed-off-by: Jianguo Wu <wujianguo@huawei.com>
Tested-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoGFS2: Increase i_writecount during gfs2_setattr_chown
Bob Peterson [Mon, 6 Jan 2014 22:16:01 +0000 (17:16 -0500)]
GFS2: Increase i_writecount during gfs2_setattr_chown

commit 62e96cf81988101fe9e086b2877307b6adda5197 upstream.

This patch calls get_write_access in function gfs2_setattr_chown,
which merely increases inode->i_writecount for the duration of the
function. That will ensure that any file closes won't delete the
inode's multi-block reservation while the function is running.
It also ensures that a multi-block reservation exists when needed
for quota change operations during the chown.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoperf/x86/amd/ibs: Fix waking up from S3 for AMD family 10h
Robert Richter [Wed, 15 Jan 2014 14:57:29 +0000 (15:57 +0100)]
perf/x86/amd/ibs: Fix waking up from S3 for AMD family 10h

commit bee09ed91cacdbffdbcd3b05de8409c77ec9fcd6 upstream.

On AMD family 10h we see following error messages while waking up from
S3 for all non-boot CPUs leading to a failed IBS initialization:

 Enabling non-boot CPUs ...
 smpboot: Booting Node 0 Processor 1 APIC 0x1
 [Firmware Bug]: cpu 1, try to use APIC500 (LVT offset 0) for vector 0x400, but the register is already in use for vector 0xf9 on another cpu
 perf: IBS APIC setup failed on cpu #1
 process: Switch to broadcast mode on CPU1
 CPU1 is up
 ...
 ACPI: Waking up from system sleep state S3

Reason for this is that during suspend the LVT offset for the IBS
vector gets lost and needs to be reinialized while resuming.

The offset is read from the IBSCTL msr. On family 10h the offset needs
to be 1 as offset 0 is used for the MCE threshold interrupt, but
firmware assings it for IBS to 0 too. The kernel needs to reprogram
the vector. The msr is a readonly node msr, but a new value can be
written via pci config space access. The reinitialization is
implemented for family 10h in setup_ibs_ctl() which is forced during
IBS setup.

This patch fixes IBS setup after waking up from S3 by adding
resume/supend hooks for the boot cpu which does the offset
reinitialization.

Marking it as stable to let distros pick up this fix.

Signed-off-by: Robert Richter <rric@kernel.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1389797849-5565-1-git-send-email-rric.net@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoperf scripting perl: Fix build error on Fedora 12
Arnaldo Carvalho de Melo [Mon, 14 Oct 2013 21:25:12 +0000 (18:25 -0300)]
perf scripting perl: Fix build error on Fedora 12

commit 3b16ff89676d9902dc39976aee3cb0314ee37d93 upstream.

Cast __u64 to u64 to silence this warning on older distros, such as
Fedora 12:

    CC       /tmp/build/perf/util/scripting-engines/trace-event-perl.o
  cc1: warnings being treated as errors
  util/scripting-engines/trace-event-perl.c: In function ‘perl_process_tracepoint’:
  util/scripting-engines/trace-event-perl.c:285: error: format ‘%lu’ expects type ‘long unsigned int’, but argument 2 has type ‘__u64’
  make[1]: *** [/tmp/build/perf/util/scripting-engines/trace-event-perl.o] Error 1
  make: *** [install] Error 2
  make: Leaving directory `/home/acme/git/linux/tools/perf'
  [acme@fedora12 linux]$

Reported-by: Waiman Long <Waiman.Long@hp.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tom.zanussi@linux.intel.com>
Cc: Waiman Long <Waiman.Long@hp.com>
Link: http://lkml.kernel.org/n/tip-nlxofdqcdjfm0w9o6bgq4kqv@git.kernel.org
Link: http://lkml.kernel.org/r/1381265120-58532-1-git-send-email-Waiman.Long@hp.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Xie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoARM: 7815/1: kexec: offline non panic CPUs on Kdump panic
Vijaya Kumar K [Wed, 14 Aug 2013 12:28:28 +0000 (13:28 +0100)]
ARM: 7815/1: kexec: offline non panic CPUs on Kdump panic

commit 4f9b4fb7a2091eec339413a460b1665758401828 upstream.

In case of normal kexec kernel load, all cpu's are offlined
before calling machine_kexec().But in case crash panic cpus
are relaxed in machine_crash_nonpanic_core() SMP function
but not offlined.

When crash kernel is loaded with kexec and on panic trigger
machine_kexec() checks for number of cpus online.
If more than one cpu is online machine_kexec() fails to load
with below error

kexec: error: multiple CPUs still online

In machine_crash_nonpanic_core() SMP function, offline CPU
before cpu_relax

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: l00221744 <sdu.liu@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoclk: rockchip: add clk init data and enable clk init
dkl [Thu, 23 Jan 2014 09:23:47 +0000 (17:23 +0800)]
clk: rockchip: add clk init data and enable clk init

Mainly add rk3188 clk_core\cpu_clks\peri_clks init data and apply
it.

10 years agoAndroid: Fix up warnings introduced by 32 on 64 bit support
Mark Brown [Tue, 14 Jan 2014 20:10:14 +0000 (20:10 +0000)]
Android: Fix up warnings introduced by 32 on 64 bit support

Mostly type mismatches in printf() specifiers together with a missing
conversion of the trace header to use userptr32_t.

Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoAndroid: Add support for 32-bit Binder calls in a 64-bit kernel
Bintian Wang [Wed, 9 Oct 2013 10:52:57 +0000 (18:52 +0800)]
Android: Add support for 32-bit Binder calls in a 64-bit kernel

Android's IPC, Binder, does not support calls from a 32-bit userspace
in a 64 bit kernel. This patch adds support for syscalls coming from a
32-bit userspace in a 64-bit kernel.

Most of the changes were applied to types that change sizes between
32 and 64 bit world. This will also fix some of the issues around
checking the size of an incoming transaction package in the ioctl
switch. Since  the transaction's ioctl number are generated using
_IOC(dir,type,nr,size), a different userspace size will generate
a different ioctl number, thus switching by _IOC_NR is a better
solution.

The patch has been successfully tested on ARMv8 AEM and Versatile
Express V2P-CA9.

[Fixed up several conflicts with upstream -- broonie]

Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoMerge branch 'linaro-android-3.10-lsk' of git://git.linaro.org/people/jstultz/android...
Mark Brown [Wed, 22 Jan 2014 15:36:05 +0000 (15:36 +0000)]
Merge branch 'linaro-android-3.10-lsk' of git://git.linaro.org/people/jstultz/android into linux-linaro-lsk-android

10 years agoMerge branch 'linux-linaro-lsk' into linux-linaro-lsk-android
Mark Brown [Wed, 22 Jan 2014 15:35:34 +0000 (15:35 +0000)]
Merge branch 'linux-linaro-lsk' into linux-linaro-lsk-android

10 years agoMerge remote-tracking branch 'lsk/linux-linaro-lsk' into linux-linaro-lsk-android
Mark Brown [Wed, 22 Jan 2014 15:31:30 +0000 (15:31 +0000)]
Merge remote-tracking branch 'lsk/linux-linaro-lsk' into linux-linaro-lsk-android

10 years agoMerge remote-tracking branch 'lsk/v3.10/topic/arm32-cache' into linux-linaro-lsk
Mark Brown [Wed, 22 Jan 2014 15:28:30 +0000 (15:28 +0000)]
Merge remote-tracking branch 'lsk/v3.10/topic/arm32-cache' into linux-linaro-lsk

10 years agoARM: 7919/1: mm: refactor v7 cache cleaning ops to use way/index sequence
Lorenzo Pieralisi [Mon, 9 Dec 2013 17:06:53 +0000 (18:06 +0100)]
ARM: 7919/1: mm: refactor v7 cache cleaning ops to use way/index sequence

Set-associative caches on all v7 implementations map the index bits
to physical addresses LSBs and tag bits to MSBs. As the last level
of cache on current and upcoming ARM systems grows in size,
this means that under normal DRAM controller configurations, the
current v7 cache flush routine using set/way operations triggers a
DRAM memory controller precharge/activate for every cache line
writeback since the cache routine cleans lines by first fixing the
index and then looping through ways (index bits are mapped to lower
physical addresses on all v7 cache implementations; this means that,
with last level cache sizes in the order of MBytes, lines belonging
to the same set but different ways map to different DRAM pages).

Given the random content of cache tags, swapping the order between
indexes and ways loops do not prevent DRAM pages precharge and
activate cycles but at least, on average, improves the chances that
either multiple lines hit the same page or multiple lines belong to
different DRAM banks, improving throughput significantly.

This patch swaps the inner loops in the v7 cache flushing routine
to carry out the clean operations first on all sets belonging to
a given way (looping through sets) and then decrementing the way.

Benchmarks showed that by swapping the ordering in which sets and
ways are decremented in the v7 cache flushing routine, that uses
set/way operations, time required to flush caches is reduced
significantly, owing to improved writebacks throughput to the DRAM
controller.

Benchmarks results vary and depend heavily on the last level of
cache tag RAM content when cache is cleaned and invalidated, ranging
from 2x throughput when all tag RAM entries contain dirty lines
mapping to sequential pages of RAM to 1x (ie no improvement) when
all tag RAM accesses trigger a DRAM precharge/activate cycle, as the
current code implies on most DRAM controller configurations.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Nicolas Pitre <nico@linaro.org>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Reviewed-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
(cherry picked from commit 70f665fe77c54740d0fa8aaad5de2181d75af15e)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoMerge remote-tracking branch 'lsk/v3.10/topic/big.LITTLE' into linux-linaro-lsk
Mark Brown [Wed, 22 Jan 2014 12:43:08 +0000 (12:43 +0000)]
Merge remote-tracking branch 'lsk/v3.10/topic/big.LITTLE' into linux-linaro-lsk

10 years agoMerge branch 'for-lsk' of git://git.linaro.org/arm/big.LITTLE/mp into lsk-v3.10-big...
Mark Brown [Wed, 22 Jan 2014 12:33:23 +0000 (12:33 +0000)]
Merge branch 'for-lsk' of git://git.linaro.org/arm/big.LITTLE/mp into lsk-v3.10-big.LITTLE

Conflicts:
kernel/irq/irqdesc.c
linaro/configs/big-LITTLE-MP.conf

10 years agoHMP: Drop "sched: Fix sleep time double accounting in enqueue entity"
Mark Brown [Wed, 22 Jan 2014 11:18:53 +0000 (11:18 +0000)]
HMP: Drop "sched: Fix sleep time double accounting in enqueue entity"

This reverts commit f0862cb749c537c32de82912d30110098ddc6cd6.  Analysis
from Vincent Guittot:

With the current implementation, the load average statistics of a sched entity
change according to other activity on the CPU even if this activity is done
between the running window of the sched entity and have no influence on the
running duration of the task.

When a task wakes up on the same CPU, we currently update last_runnable_update
with the return  of __synchronize_entity_decay without updating the
runnable_avg_sum and runnable_avg_period accordingly. In fact, we have to sync
the load_contrib of the se with the rq's blocked_load_contrib before removing
it from the latter (with __synchronize_entity_decay) but we must keep
last_runnable_update unchanged for updating runnable_avg_sum/period during the
next update_entity_load_avg.

Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoHMP: Fix rt task allowed cpu mask restriction code on 1x1 system
Dietmar Eggemann [Thu, 16 Jan 2014 11:53:14 +0000 (11:53 +0000)]
HMP: Fix rt task allowed cpu mask restriction code on 1x1 system

There is an error scenario where on a 1x1 HMP system (weight of the
hmp_slow_cpu_mask is 1) the short-cut of restricting the allowed cpu mask
of an rt tasks leads to triggering a kernel bug in the rt sched class
set_cpus_allowed function set_cpus_allowed_rt().

In case the task is on the run-queue and the weight of the required cpu mask
is 1 and this is different to the p->nr_cpus_allowed value, this back-end
function interprets this in such a way that a task changed from being
migratable to not migratable anymore and decrements the rt_nr_migratory
counter.  There is a BUG_ON(!rq->rt.rt_nr_migratory) check in this code
path which triggers in this situation.

To circumvent this issue, set the number of allowed cpus for a task p to
the weight of the hmp_slow_cpu_mask before calling do_set_cpus_allowed()
in __setscheduler(). It will be set to this value in do_set_cpus_allowed()
after the call to the sched class related backend function any way.  By
doing this, set_cpus_allowed_rt() returns without trying to update the
rt_nr_migratory counter.

This patch has been tested with a test device driver requiring a threaded
irq handler on a TC2 system with a reduced cpu mask (1 Cortex A15, 1
Cortex A7).

Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agoHMP: Restrict irq_default_affinity to hmp_slow_cpu_mask
Dietmar Eggemann [Thu, 16 Jan 2014 19:44:10 +0000 (19:44 +0000)]
HMP: Restrict irq_default_affinity to hmp_slow_cpu_mask

This patch limits the default affinity mask for all irqs to the cluster of
the little cpus.

This patch has the positive side effect that an irq thread which has its
IRQTF_RUNTHREAD set inside irq_thread() -> irq_wait_for_interrupt() will
not overwrite its struct task_struct->cpus_allowed with a full cpu mask of
desc->irq_data.affinity in irq_thread_check_affinity() essentially reverting
patch "HMP: experimental: Force all rt tasks to start on little domain."
for this irq thread.

Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agosched: hmp: Fix potential task_struct memory leak
Chris Redpath [Fri, 10 Jan 2014 10:34:08 +0000 (10:34 +0000)]
sched: hmp: Fix potential task_struct memory leak

We use get_task_struct to increment the ref count on a task_struct
so that even if the task dies with a pending migration we are still
able to read the memory without causing a fault.

In the case of non-running tasks, we forgot to decrement the ref
count when we are done with the task.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agoconfig: Make packing present on TC2
Chris Redpath [Thu, 9 Jan 2014 10:41:13 +0000 (10:41 +0000)]
config: Make packing present on TC2

The scheduler will default packing to disabled, but this includes the
feature so that we can test it more easily.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agosched: hmp: Change TC2 packing config to disabled default if present
Chris Redpath [Thu, 9 Jan 2014 10:40:30 +0000 (10:40 +0000)]
sched: hmp: Change TC2 packing config to disabled default if present

Since TC2 power curves don't really have a utilisation hotspot where
packing makes sense, if it is present for a TC2 system at least make
it default to disabled.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agosched: hmp: Make idle balance behaviour normal when packing disabled
Chris Redpath [Thu, 9 Jan 2014 10:38:54 +0000 (10:38 +0000)]
sched: hmp: Make idle balance behaviour normal when packing disabled

The presence of packing permanently changed the idle balance
behaviour. Do not restrict idle balance on the smallest CPUs when
packing is present but disabled.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agosched: update runqueue clock before migrations away
Chris Redpath [Thu, 5 Dec 2013 17:57:46 +0000 (17:57 +0000)]
sched: update runqueue clock before migrations away

If we migrate a sleeping task away from a CPU which has the
tick stopped, then both the clock_task and decay_counter will
be out of date for that CPU and we will not decay load correctly
regardless of how often we update the blocked load.

This is only an issue for tasks which are not on a runqueue
(because otherwise that CPU would be awake) and simultaneously
the CPU the task previously ran on has had the tick stopped.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agosched: reset blocked load decay_count during synchronization
Chris Redpath [Thu, 5 Dec 2013 15:49:32 +0000 (15:49 +0000)]
sched: reset blocked load decay_count during synchronization

If an entity happens to sleep for less than one tick duration
the tracked load associated with that entity can be decayed by an
unexpectedly large amount if it is later migrated to a different
CPU. This can interfere with correct scheduling when entity load
is used for decision making.

The reason for this is that when an entity is dequeued and enqueued
quickly, such that se.avg.decay_count and cfs_rq.decay_counter
do not differ when that entity is enqueued again,
__synchronize_entity_decay skips the calculation step and also skips
clearing the decay_count. At a later time that entity may be
migrated and its load will be decayed incorrectly.

All users of this function expect decay_count to be zero'ed after
use.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agogenirq: Add default affinity mask command line option
Thomas Gleixner [Fri, 25 May 2012 14:59:47 +0000 (16:59 +0200)]
genirq: Add default affinity mask command line option

If we isolate CPUs, then we don't want random device interrupts on
them. Even w/o the user space irq balancer enabled we can end up with
irqs on non boot cpus.

Allow to restrict the default irq affinity mask.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agoconfig: Add config fragments for big LITTLE MP
Jon Medhurst [Tue, 21 Jan 2014 09:48:55 +0000 (09:48 +0000)]
config: Add config fragments for big LITTLE MP

This patch adds config fragments used to enable most of the features
used by big LITTLE MP.

This patch is the result of merging the following commits from the
Linaro Stable Kernel (LSK) 3.10 tree...

Commit 313c69010ed52a7bd52095708049e16c380c8e15
Commit 83952e566d1c41b2e0a70321e9d56cb8162f9a6d
Commit c4a782d985da03016e2b15aaef90bfc5cfe426f6
Commit 2732b0467a356e7cc08bf1e0f33481330335657a
Commit 7c88e2bd50fc093c96c912090b712b682ae72641
Commit 3231c8ce4b005f79ad27309907adc3de319e341c

Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agosched/debug: Add load-tracking statistics to task
Kamalesh Babulal [Tue, 25 Jun 2013 08:03:36 +0000 (13:33 +0530)]
sched/debug: Add load-tracking statistics to task

At present we print per-entity load-tracking statistics for
cfs_rq of cgroups/runqueues. Given that per task statistics
is maintained, it can be used to know the contribution made
by the task to its parenting cfs_rq level.

This patch adds per-task load-tracking statistics to /proc/<PID>/sched.

Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20130625080336.GA20175@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
(cherry picked from commit 939fd731eb88a0cdd9058d0b0143563172a217d7)

Signed-off-by: Jon Medhurst <tixy@linaro.org>
10 years agoARM: rockchip: update rockchip_defconfig to support devtmpfs
黄涛 [Wed, 22 Jan 2014 08:39:19 +0000 (16:39 +0800)]
ARM: rockchip: update rockchip_defconfig to support devtmpfs

10 years agoARM: rockchip: add rk3288 fpga support
黄涛 [Wed, 22 Jan 2014 08:13:20 +0000 (16:13 +0800)]
ARM: rockchip: add rk3288 fpga support

10 years agoARM: rockchip: rk3188 add RK3188_UART_SIZE
黄涛 [Wed, 22 Jan 2014 08:03:27 +0000 (16:03 +0800)]
ARM: rockchip: rk3188 add RK3188_UART_SIZE

10 years agoARM: rockchip: rk3188-tb remove wrong serial-id
黄涛 [Wed, 22 Jan 2014 08:01:17 +0000 (16:01 +0800)]
ARM: rockchip: rk3188-tb remove wrong serial-id

10 years agoclocksource: rockchip_timer: support count up and consistency with arch timer
黄涛 [Wed, 22 Jan 2014 07:55:19 +0000 (15:55 +0800)]
clocksource: rockchip_timer: support count up and consistency with arch timer

10 years agoPWM: add CONFIG_PWM_ROCKCHIP configuration
许盛飞 [Wed, 22 Jan 2014 01:24:06 +0000 (09:24 +0800)]
PWM: add CONFIG_PWM_ROCKCHIP configuration

10 years agoMerge remote-tracking branch 'lsk/linux-linaro-lsk' into linux-linaro-lsk-android
Mark Brown [Tue, 21 Jan 2014 19:19:37 +0000 (19:19 +0000)]
Merge remote-tracking branch 'lsk/linux-linaro-lsk' into linux-linaro-lsk-android

10 years agopwm: CONFIG_PWM_ROCKCHIPS rename CONFIG_PWM_ROCKCHIP
许盛飞 [Tue, 21 Jan 2014 12:03:22 +0000 (20:03 +0800)]
pwm: CONFIG_PWM_ROCKCHIPS rename CONFIG_PWM_ROCKCHIP

10 years agopwm-bl: rename of pwm-rockhip.c and change the backlight-driver configuration
许盛飞 [Tue, 21 Jan 2014 11:51:19 +0000 (19:51 +0800)]
pwm-bl: rename of pwm-rockhip.c and change the backlight-driver configuration

10 years agopwm-bl: change some warning
许盛飞 [Tue, 21 Jan 2014 10:47:26 +0000 (18:47 +0800)]
pwm-bl: change some warning

10 years agoChange path of audio platform device from rk to rockchip
陈金泉 [Tue, 21 Jan 2014 10:16:11 +0000 (18:16 +0800)]
Change path of audio platform device from rk to rockchip

10 years agopwm-bl: add pwm backlight driver for rockchip
许盛飞 [Tue, 21 Jan 2014 09:53:11 +0000 (17:53 +0800)]
pwm-bl: add pwm backlight driver for rockchip

10 years agoupdate codec driver
陈金泉 [Tue, 21 Jan 2014 09:24:35 +0000 (17:24 +0800)]
update codec driver

10 years agoclk: rockchip: add clk_core ops support
dkl [Tue, 21 Jan 2014 08:55:26 +0000 (16:55 +0800)]
clk: rockchip: add clk_core ops support

10 years agoclk: rockchip: add apll set_rate support
dkl [Mon, 20 Jan 2014 13:15:10 +0000 (21:15 +0800)]
clk: rockchip: add apll set_rate support

10 years agoARM: rockchip: rk_fiq_debugger use 32-bit read/write, workaround for rk3288
黄涛 [Tue, 21 Jan 2014 06:26:09 +0000 (14:26 +0800)]
ARM: rockchip: rk_fiq_debugger use 32-bit read/write, workaround for rk3288

10 years agoMerge remote-tracking branch 'lsk/v3.10/topic/pe-wq' into linux-linaro-lsk
Mark Brown [Mon, 20 Jan 2014 18:13:56 +0000 (18:13 +0000)]
Merge remote-tracking branch 'lsk/v3.10/topic/pe-wq' into linux-linaro-lsk

10 years agoARM: add support for the Cortex-A12 processor
Jonathan Austin [Fri, 6 Dec 2013 15:04:42 +0000 (15:04 +0000)]
ARM: add support for the Cortex-A12 processor

The A12 behaves as the A7/A15 does with respect to setting the SMP bit, and
doesn't require TLB ops broadcasting to be explicitly enabled like the A9 does.

Note that as the ACTLR cannot (usually) be written from non-secure, it is the
responsibility of the bootloader/firmware to set this bit per core - it is
done here in Linux as last resort in case of bad firmware.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Jonathan Austin <jonathan.austin@arm.com>
10 years agoclock: rockchip: ignore unused clocks temporarily.
dkl [Mon, 20 Jan 2014 11:36:52 +0000 (19:36 +0800)]
clock: rockchip: ignore unused clocks temporarily.

Include "clk_ignore_unused" in the bootargs to the kernel.

10 years agoRevert "rk_clk: not disable unused clocks temporarily"
dkl [Mon, 20 Jan 2014 11:31:05 +0000 (19:31 +0800)]
Revert "rk_clk: not disable unused clocks temporarily"

This reverts commit 97c8dc7c30de9e04136ce9d52c2cdda0bb828db8.

10 years agoARM: rockchip: rk3188 use timer-based delay
黄涛 [Mon, 20 Jan 2014 10:49:30 +0000 (18:49 +0800)]
ARM: rockchip: rk3188 use timer-based delay

10 years agoclocksource: rockchip_timer: support timer-based delay
黄涛 [Mon, 20 Jan 2014 10:49:12 +0000 (18:49 +0800)]
clocksource: rockchip_timer: support timer-based delay

10 years agork_clk: not disable unused clocks temporarily
dkl [Mon, 20 Jan 2014 09:40:16 +0000 (17:40 +0800)]
rk_clk: not disable unused clocks temporarily

10 years agork fb:base version for linux3.10
yxj [Tue, 14 Jan 2014 13:12:20 +0000 (21:12 +0800)]
rk fb:base version for linux3.10

10 years agork_clk: modify clk-ops.c to reuse and fit the common clk framework.
dkl [Fri, 17 Jan 2014 09:52:17 +0000 (17:52 +0800)]
rk_clk: modify clk-ops.c to reuse and fit the common clk framework.

After the .determine_rate operation was introduced, many ops and
clocks can be implemented more easily by the common clock framework,
and many unnessary old codes can be removed as a result.