commit 29b5f720990fafc302a034468455426dd662e101
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Thu Feb 13 13:48:15 2014 -0800

    Linux 3.10.30

commit 0df520d4597fedba4eeea99726919d2ecf0452e9
Author: Dirk Brandewie <dirk.j.brandewie@intel.com>
Date:   Mon Oct 21 09:20:33 2013 -0700

    intel_pstate: Correct calculation of min pstate value
    
    commit 7244cb62d96e735847dc9d08f870550df896898c upstream.
    
    The minimum pstate is supposed to be a percentage of the maximum P
    state available.  Calculate min using max pstate and not the
    current max which may have been limited by the user
    
    Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e34ce30f3226936bf8f43dc3d2616acd268a8cd2
Author: Brennan Shacklett <brennan@genyes.org>
Date:   Mon Oct 21 09:20:32 2013 -0700

    intel_pstate: Improve accuracy by not truncating until final result
    
    commit d253d2a52676cfa3d89b8f0737a08ce7db665207 upstream.
    
    This patch addresses Bug 60727
    (https://bugzilla.kernel.org/show_bug.cgi?id=60727)
    which was due to the truncation of intermediate values in the
    calculations, which causes the code to consistently underestimate the
    current cpu frequency, specifically 100% cpu utilization was truncated
    down to the setpoint of 97%. This patch fixes the problem by keeping
    the results of all intermediate calculations as fixed point numbers
    rather scaling them back and forth between integers and fixed point.
    
    References: https://bugzilla.kernel.org/show_bug.cgi?id=60727
    Signed-off-by: Brennan Shacklett <bpshacklett@gmail.com>
    Acked-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3dc642a3984abb4e34b7514a5d569a50402410b7
Author: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Date:   Tue Oct 1 10:28:41 2013 -0700

    intel_pstate: fix no_turbo
    
    commit 1ccf7a1cdafadd02e33e8f3d74370685a0600ec6 upstream.
    
    When sysfs for no_turbo is set, then also some p states in turbo regions
    are observed. This patch will set IDA Engage bit when no_turbo is set to
    explicitly disengage turbo.
    
    Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Acked-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0b977de88f1e043efd664e59cfe783fbd09c02b9
Author: Nell Hardcastle <nell@spicious.com>
Date:   Sun Jun 30 15:58:57 2013 -0700

    intel_pstate: Add Haswell CPU models
    
    commit 6cdcdb793791f776ea9408581b1242b636d43b37 upstream.
    
    Enable the intel_pstate driver for Haswell CPUs. One missing Ivy Bridge
    model (0x3E) is also included. Models referenced from
    tools/power/x86/turbostat/turbostat.c:has_nehalem_turbo_ratio_limit
    
    Signed-off-by: Nell Hardcastle <nell@spicious.com>
    Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
    Acked-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d9e8fada0c0161f6fe2499a1b7dc9ce18e20fec2
Author: John Stultz <john.stultz@linaro.org>
Date:   Tue Dec 10 17:18:18 2013 -0800

    timekeeping: Avoid possible deadlock from clock_was_set_delayed
    
    commit 6fdda9a9c5db367130cf32df5d6618d08b89f46a upstream.
    
    As part of normal operaions, the hrtimer subsystem frequently calls
    into the timekeeping code, creating a locking order of
      hrtimer locks -> timekeeping locks
    
    clock_was_set_delayed() was suppoed to allow us to avoid deadlocks
    between the timekeeping the hrtimer subsystem, so that we could
    notify the hrtimer subsytem the time had changed while holding
    the timekeeping locks. This was done by scheduling delayed work
    that would run later once we were out of the timekeeing code.
    
    But unfortunately the lock chains are complex enoguh that in
    scheduling delayed work, we end up eventually trying to grab
    an hrtimer lock.
    
    Sasha Levin noticed this in testing when the new seqlock lockdep
    enablement triggered the following (somewhat abrieviated) message:
    
    [  251.100221] ======================================================
    [  251.100221] [ INFO: possible circular locking dependency detected ]
    [  251.100221] 3.13.0-rc2-next-20131206-sasha-00005-g8be2375-dirty #4053 Not tainted
    [  251.101967] -------------------------------------------------------
    [  251.101967] kworker/10:1/4506 is trying to acquire lock:
    [  251.101967]  (timekeeper_seq){----..}, at: [<ffffffff81160e96>] retrigger_next_event+0x56/0x70
    [  251.101967]
    [  251.101967] but task is already holding lock:
    [  251.101967]  (hrtimer_bases.lock#11){-.-...}, at: [<ffffffff81160e7c>] retrigger_next_event+0x3c/0x70
    [  251.101967]
    [  251.101967] which lock already depends on the new lock.
    [  251.101967]
    [  251.101967]
    [  251.101967] the existing dependency chain (in reverse order) is:
    [  251.101967]
    -> #5 (hrtimer_bases.lock#11){-.-...}:
    [snipped]
    -> #4 (&rt_b->rt_runtime_lock){-.-...}:
    [snipped]
    -> #3 (&rq->lock){-.-.-.}:
    [snipped]
    -> #2 (&p->pi_lock){-.-.-.}:
    [snipped]
    -> #1 (&(&pool->lock)->rlock){-.-...}:
    [  251.101967]        [<ffffffff81194803>] validate_chain+0x6c3/0x7b0
    [  251.101967]        [<ffffffff81194d9d>] __lock_acquire+0x4ad/0x580
    [  251.101967]        [<ffffffff81194ff2>] lock_acquire+0x182/0x1d0
    [  251.101967]        [<ffffffff84398500>] _raw_spin_lock+0x40/0x80
    [  251.101967]        [<ffffffff81153e69>] __queue_work+0x1a9/0x3f0
    [  251.101967]        [<ffffffff81154168>] queue_work_on+0x98/0x120
    [  251.101967]        [<ffffffff81161351>] clock_was_set_delayed+0x21/0x30
    [  251.101967]        [<ffffffff811c4bd1>] do_adjtimex+0x111/0x160
    [  251.101967]        [<ffffffff811e2711>] compat_sys_adjtimex+0x41/0x70
    [  251.101967]        [<ffffffff843a4b49>] ia32_sysret+0x0/0x5
    [  251.101967]
    -> #0 (timekeeper_seq){----..}:
    [snipped]
    [  251.101967] other info that might help us debug this:
    [  251.101967]
    [  251.101967] Chain exists of:
      timekeeper_seq --> &rt_b->rt_runtime_lock --> hrtimer_bases.lock#11
    
    [  251.101967]  Possible unsafe locking scenario:
    [  251.101967]
    [  251.101967]        CPU0                    CPU1
    [  251.101967]        ----                    ----
    [  251.101967]   lock(hrtimer_bases.lock#11);
    [  251.101967]                                lock(&rt_b->rt_runtime_lock);
    [  251.101967]                                lock(hrtimer_bases.lock#11);
    [  251.101967]   lock(timekeeper_seq);
    [  251.101967]
    [  251.101967]  *** DEADLOCK ***
    [  251.101967]
    [  251.101967] 3 locks held by kworker/10:1/4506:
    [  251.101967]  #0:  (events){.+.+.+}, at: [<ffffffff81154960>] process_one_work+0x200/0x530
    [  251.101967]  #1:  (hrtimer_work){+.+...}, at: [<ffffffff81154960>] process_one_work+0x200/0x530
    [  251.101967]  #2:  (hrtimer_bases.lock#11){-.-...}, at: [<ffffffff81160e7c>] retrigger_next_event+0x3c/0x70
    [  251.101967]
    [  251.101967] stack backtrace:
    [  251.101967] CPU: 10 PID: 4506 Comm: kworker/10:1 Not tainted 3.13.0-rc2-next-20131206-sasha-00005-g8be2375-dirty #4053
    [  251.101967] Workqueue: events clock_was_set_work
    
    So the best solution is to avoid calling clock_was_set_delayed() while
    holding the timekeeping lock, and instead using a flag variable to
    decide if we should call clock_was_set() once we've released the locks.
    
    This works for the case here, where the do_adjtimex() was the deadlock
    trigger point. Unfortuantely, in update_wall_time() we still hold
    the jiffies lock, which would deadlock with the ipi triggered by
    clock_was_set(), preventing us from calling it even after we drop the
    timekeeping lock. So instead call clock_was_set_delayed() at that point.
    
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Prarit Bhargava <prarit@redhat.com>
    Cc: Richard Cochran <richardcochran@gmail.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Sasha Levin <sasha.levin@oracle.com>
    Reported-by: Sasha Levin <sasha.levin@oracle.com>
    Tested-by: Sasha Levin <sasha.levin@oracle.com>
    Signed-off-by: John Stultz <john.stultz@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 29a16182858f1aea2715aa96ecd19763e75d6def
Author: Borislav Petkov <bp@alien8.de>
Date:   Sat Jul 20 19:00:23 2013 +0200

    rtc-cmos: Add an alarm disable quirk
    
    commit d5a1c7e3fc38d9c7d629e1e47f32f863acbdec3d upstream.
    
    41c7f7424259f ("rtc: Disable the alarm in the hardware (v2)") added the
    functionality to disable the RTC wake alarm when shutting down the box.
    
    However, there are at least two b0rked BIOSes we know about:
    
    https://bugzilla.novell.com/show_bug.cgi?id=812592
    https://bugzilla.novell.com/show_bug.cgi?id=805740
    
    where, when wakeup alarm is enabled in the BIOS, the machine reboots
    automatically right after shutdown, regardless of what wakeup time is
    programmed.
    
    Bisecting the issue lead to this patch so disable its functionality with
    a DMI quirk only for those boxes.
    
    Cc: Brecht Machiels <brecht@mos6581.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: John Stultz <john.stultz@linaro.org>
    Cc: Rabin Vincent <rabin.vincent@stericsson.com>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    [jstultz: Changed variable name for clarity, added extra dmi entry]
    Tested-by: Brecht Machiels <brecht@mos6581.org>
    Tested-by: Borislav Petkov <bp@suse.de>
    Signed-off-by: John Stultz <john.stultz@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 226e0f713f585c549f4200bb8a69b6753dff28d0
Author: John Stultz <john.stultz@linaro.org>
Date:   Wed Dec 11 19:10:36 2013 -0800

    timekeeping: Fix missing timekeeping_update in suspend path
    
    commit 330a1617b0a6268d427aa5922c94d082b1d3e96d upstream.
    
    Since 48cdc135d4840 (Implement a shadow timekeeper), we have to
    call timekeeping_update() after any adjustment to the timekeeping
    structure in order to make sure that any adjustments to the structure
    persist.
    
    In the timekeeping suspend path, we udpate the timekeeper
    structure, so we should be sure to update the shadow-timekeeper
    before releasing the timekeeping locks. Currently this isn't done.
    
    In most cases, the next time related code to run would be
    timekeeping_resume, which does update the shadow-timekeeper, but
    in an abundence of caution, this patch adds the call to
    timekeeping_update() in the suspend path.
    
    Cc: Sasha Levin <sasha.levin@oracle.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Prarit Bhargava <prarit@redhat.com>
    Cc: Richard Cochran <richardcochran@gmail.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: John Stultz <john.stultz@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a8ad6b67721e81c2e181ae3e0f3aea79da779cd7
Author: John Stultz <john.stultz@linaro.org>
Date:   Tue Dec 10 17:13:35 2013 -0800

    timekeeping: Fix CLOCK_TAI timer/nanosleep delays
    
    commit 04005f6011e3b504cd4d791d9769f7cb9a3b2eae upstream.
    
    A think-o in the calculation of the monotonic -> tai time offset
    results in CLOCK_TAI timers and nanosleeps to expire late (the
    latency is ~2x the tai offset).
    
    Fix this by adding the tai offset from the realtime offset instead
    of subtracting.
    
    Cc: Sasha Levin <sasha.levin@oracle.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Prarit Bhargava <prarit@redhat.com>
    Cc: Richard Cochran <richardcochran@gmail.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: John Stultz <john.stultz@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 77535a0a168b2bf7c4aa35a20792a6e895844424
Author: John Stultz <john.stultz@linaro.org>
Date:   Wed Dec 11 18:50:25 2013 -0800

    timekeeping: Fix lost updates to tai adjustment
    
    commit f55c07607a38f84b5c7e6066ee1cfe433fa5643c upstream.
    
    Since 48cdc135d4840 (Implement a shadow timekeeper), we have to
    call timekeeping_update() after any adjustment to the timekeeping
    structure in order to make sure that any adjustments to the structure
    persist.
    
    Unfortunately, the updates to the tai offset via adjtimex do not
    trigger this update, causing adjustments to the tai offset to be
    made and then over-written by the previous value at the next
    update_wall_time() call.
    
    This patch resovles the issue by calling timekeeping_update()
    right after setting the tai offset.
    
    Cc: Sasha Levin <sasha.levin@oracle.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Prarit Bhargava <prarit@redhat.com>
    Cc: Richard Cochran <richardcochran@gmail.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: John Stultz <john.stultz@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1499a3eb0473cad61fb2ed8f2e5247f4568a5786
Author: Steven Rostedt <rostedt@goodmis.org>
Date:   Fri Feb 7 14:42:35 2014 -0500

    ftrace: Have function graph only trace based on global_ops filters
    
    commit 23a8e8441a0a74dd612edf81dc89d1600bc0a3d1 upstream.
    
    Doing some different tests, I discovered that function graph tracing, when
    filtered via the set_ftrace_filter and set_ftrace_notrace files, does
    not always keep with them if another function ftrace_ops is registered
    to trace functions.
    
    The reason is that function graph just happens to trace all functions
    that the function tracer enables. When there was only one user of
    function tracing, the function graph tracer did not need to worry about
    being called by functions that it did not want to trace. But now that there
    are other users, this becomes a problem.
    
    For example, one just needs to do the following:
    
     # cd /sys/kernel/debug/tracing
     # echo schedule > set_ftrace_filter
     # echo function_graph > current_tracer
     # cat trace
    [..]
     0)               |  schedule() {
     ------------------------------------------
     0)    <idle>-0    =>   rcu_pre-7
     ------------------------------------------
    
     0) ! 2980.314 us |  }
     0)               |  schedule() {
     ------------------------------------------
     0)   rcu_pre-7    =>    <idle>-0
     ------------------------------------------
    
     0) + 20.701 us   |  }
    
     # echo 1 > /proc/sys/kernel/stack_tracer_enabled
     # cat trace
    [..]
     1) + 20.825 us   |      }
     1) + 21.651 us   |    }
     1) + 30.924 us   |  } /* SyS_ioctl */
     1)               |  do_page_fault() {
     1)               |    __do_page_fault() {
     1)   0.274 us    |      down_read_trylock();
     1)   0.098 us    |      find_vma();
     1)               |      handle_mm_fault() {
     1)               |        _raw_spin_lock() {
     1)   0.102 us    |          preempt_count_add();
     1)   0.097 us    |          do_raw_spin_lock();
     1)   2.173 us    |        }
     1)               |        do_wp_page() {
     1)   0.079 us    |          vm_normal_page();
     1)   0.086 us    |          reuse_swap_page();
     1)   0.076 us    |          page_move_anon_rmap();
     1)               |          unlock_page() {
     1)   0.082 us    |            page_waitqueue();
     1)   0.086 us    |            __wake_up_bit();
     1)   1.801 us    |          }
     1)   0.075 us    |          ptep_set_access_flags();
     1)               |          _raw_spin_unlock() {
     1)   0.098 us    |            do_raw_spin_unlock();
     1)   0.105 us    |            preempt_count_sub();
     1)   1.884 us    |          }
     1)   9.149 us    |        }
     1) + 13.083 us   |      }
     1)   0.146 us    |      up_read();
    
    When the stack tracer was enabled, it enabled all functions to be traced, which
    now the function graph tracer also traces. This is a side effect that should
    not occur.
    
    To fix this a test is added when the function tracing is changed, as well as when
    the graph tracer is enabled, to see if anything other than the ftrace global_ops
    function tracer is enabled. If so, then the graph tracer calls a test trampoline
    that will look at the function that is being traced and compare it with the
    filters defined by the global_ops.
    
    As an optimization, if there's no other function tracers registered, or if
    the only registered function tracers also use the global ops, the function
    graph infrastructure will call the registered function graph callback directly
    and not go through the test trampoline.
    
    Fixes: d2d45c7a03a2 "tracing: Have stack_tracer use a separate list of functions"
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b6c5a8d32c2e2fea5a574365cef91bbfe75d861c
Author: Steven Rostedt <rostedt@goodmis.org>
Date:   Fri Feb 7 14:42:01 2014 -0500

    ftrace: Fix synchronization location disabling and freeing ftrace_ops
    
    commit a4c35ed241129dd142be4cadb1e5a474a56d5464 upstream.
    
    The synchronization needed after ftrace_ops are unregistered must happen
    after the callback is disabled from becing called by functions.
    
    The current location happens after the function is being removed from the
    internal lists, but not after the function callbacks were disabled, leaving
    the functions susceptible of being called after their callbacks are freed.
    
    This affects perf and any externel users of function tracing (LTTng and
    SystemTap).
    
    Fixes: cdbe61bfe704 "ftrace: Allow dynamically allocated function tracers"
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a0d0a2a5a36361f7695bb243bf7ea499f0c82fd2
Author: Steven Rostedt <rostedt@goodmis.org>
Date:   Fri Feb 7 14:41:17 2014 -0500

    ftrace: Synchronize setting function_trace_op with ftrace_trace_function
    
    commit 405e1d834807e51b2ebd3dea81cb51e53fb61504 upstream.
    
    ftrace_trace_function is a variable that holds what function will be called
    directly by the assembly code (mcount). If just a single function is
    registered and it handles recursion itself, then the assembly will call that
    function directly without any helper function. It also passes in the
    ftrace_op that was registered with the callback. The ftrace_op to send is
    stored in the function_trace_op variable.
    
    The ftrace_trace_function and function_trace_op needs to be coordinated such
    that the called callback wont be called with the wrong ftrace_op, otherwise
    bad things can happen if it expected a different op. Luckily, there's no
    callback that doesn't use the helper functions that requires this. But
    there soon will be and this needs to be fixed.
    
    Use a set_function_trace_op to store the ftrace_op to set the
    function_trace_op to when it is safe to do so (during the update function
    within the breakpoint or stop machine calls). Or if dynamic ftrace is not
    being used (static tracing) then we have to do a bit more synchronization
    when the ftrace_trace_function is set as that takes affect immediately
    (as oppose to dynamic ftrace doing it with the modification of the trampoline).
    
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1505c0baa0a8e3dc311a90b25eb24cc46b0894ea
Author: Seth Heasley <seth.heasley@intel.com>
Date:   Wed Jun 19 16:59:57 2013 -0700

    i2c: i801: SMBus patch for Intel Coleto Creek DeviceIDs
    
    commit f39901c1befa556bc91902516a3e2e460000b4a8 upstream.
    
    This patch adds the i801 SMBus Controller DeviceIDs for the Intel Coleto Creek PCH.
    
    Signed-off-by: Seth Heasley <seth.heasley@intel.com>
    Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
    Cc: "Chan, Wei Sern" <wei.sern.chan@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 090f74fcaa3d2488978001f6bf83031a2e69ff25
Author: Seth Heasley <seth.heasley@intel.com>
Date:   Wed Jun 19 17:04:25 2013 -0700

    mfd: lpc_ich: iTCO_wdt patch for Intel Coleto Creek DeviceIDs
    
    commit 283aae8ab88e695a660c610d6535ca44bc5b8835 upstream.
    
    This patch adds the LPC Controller DeviceIDs for iTCO Watchdog for
    the Intel Coleto Creek PCH.
    
    Signed-off-by: Seth Heasley <seth.heasley@intel.com>
    Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
    Cc: "Chan, Wei Sern" <wei.sern.chan@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b4760389e5d8ae0a75c8d0fcbd38927c5c61d0b5
Author: James Ralston <james.d.ralston@intel.com>
Date:   Thu May 9 12:38:53 2013 -0700

    mfd: lpc_ich: Add support for Intel Avoton SoC
    
    commit 8477128fe0c3c455e9dfb1ba7ad7e6d09489d33c upstream.
    
    This patch adds the LPC Controller Device IDs for Watchdog and GPIO for
    Intel Avoton SoC, to the lpc_ich driver.
    
    Signed-off-by: James Ralston <james.d.ralston@intel.com>
    Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
    Cc: "Chan, Wei Sern" <wei.sern.chan@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9a572c7dab8d9b09ce61b7ba5e9e4a2b9b7a2936
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed Feb 5 14:13:56 2014 +1000

    drm/mgag200: fix typo causing bw limits to be ignored on some chips
    
    commit ec22b4aa993abbd18f5bbbcb20a1c56be3b1d38b upstream.
    
    mode->mdev otherwise the bw limits never kick in.
    
    Reported in RHEL testing.
    
    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 37c5725adba40457dac8705b880348d789394238
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Jan 21 14:34:51 2014 -0800

    drm/cirrus: correct register values for 16bpp
    
    commit 2510538fa000dd13a3e57b79bf073ffb1748976c upstream.
    
    When the mode is set with 16bpp on QEMU, the output gets totally broken.
    The culprit is the bogus register values set for 16bpp, which was likely
    copied from from a wrong place.
    
    Addresses https://bugzilla.novell.com/show_bug.cgi?id=799216
    
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>
    Cc: David Airlie <airlied@linux.ie>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9b8de40c9a462c53a245b3bc7cddff3e34e879ef
Author: Stanislaw Gruszka <sgruszka@redhat.com>
Date:   Sat Jan 25 10:13:37 2014 +0100

    i915: remove pm_qos request on error
    
    commit 22accca01713b13dac386ca90b787aadf88f6551 upstream.
    
    Not removing pm qos request and free memory for it can cause crash,
    when some other driver use pm qos. For example, this oops:
    
    BUG: unable to handle kernel paging request at fffffffffffffff8
    IP: [<ffffffff81307a6b>] plist_add+0x5b/0xd0
    Call Trace:
     [<ffffffff810acf25>] pm_qos_update_target+0x125/0x1e0
     [<ffffffff810ad071>] pm_qos_add_request+0x91/0x100
     [<ffffffffa053ec14>] e1000_open+0xe4/0x5b0 [e1000e]
    
    was caused by earlier i915 probe failure:
    
    [drm:i915_report_and_clear_eir] *ERROR* EIR stuck: 0x00000010, masking
    [drm:init_ring_common] *ERROR* render ring initialization failed ctl 0001f001 head 00003004 tail 00000000 start 00003000
    [drm:i915_driver_load] *ERROR* failed to init modeset
    i915: probe of 0000:00:02.0 failed with error -5
    
    Bug report:
    http://bugzilla.redhat.com/show_bug.cgi?id=1057533
    
    Reported-by: Giandomenico De Tullio <ghisha@gmail.com>
    Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
    [danvet: Drop unnecessary code movement.]
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b557693e060e1b946a52308c5d2bad851f103ef8
Author: Todd Previte <tprevite@gmail.com>
Date:   Thu Jan 23 00:13:41 2014 -0700

    drm/i915: VLV2 - Fix hotplug detect bits
    
    commit 232a6ee9af8adb185640f67fcaaa9014a9aa0573 upstream.
    
    Add new definitions for hotplug live status bits for VLV2 since they're
    in reverse order from the gen4x ones.
    
    Changelog:
    - Restored gen4 bit definitions
    - Added new definitions for VLV2
    - Added platform check for IS_VALLEYVIEW() in dp_detect to use the correct
      bit defintions
    - Replaced a lost trailing brace for the added switch()
    
    Signed-off-by: Todd Previte <tprevite@gmail.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73951
    [danvet: Switch to _VLV postfix instead of prefix and regroupg
    comments again so that the g4x warning is right next to those defines.
    Also add a _G4X suffix for those special ones. Also cc stable.]
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 11f367131a70c8ad1e9f3159d0c6ef05989eb648
Author: Akash Goel <akash.goel@intel.com>
Date:   Mon Jan 13 16:24:45 2014 +0530

    drm/i915: Fix the offset issue for the stolen GEM objects
    
    commit ec14ba47791965d2c08e0a681ff44eacbf3c4553 upstream.
    
    The 'offset' field of the 'scatterlist' structure was wrongly
    programmed with the offset value from the base of stolen area,
    whereas this field indicates the offset from where the interested
    data starts within the first PAGE pointed to by 'scattterlist'
    structure. As a result when a new GEM object allocated from stolen
    area is mapped to GTT, it could lead to an overwrite of GTT entries
    as the page count calculation will go wrong, refer the function
    'sg_page_count'.
    
    v2: Modified the commit message. (Chris)
    
    Signed-off-by: Akash Goel <akash.goel@intel.com>
    Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71908
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=69104
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 98e0694d0e679e7018b6617f48fa04b7b888cef3
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Jan 2 14:32:35 2014 +0000

    drm/i915: Flush outstanding requests before allocating new seqno
    
    commit 304d695c3dc8eb65206b9eaf16f8d1a41510d1cf upstream.
    
    In very rare cases (such as a memory failure stress test) it is possible
    to fill the entire ring without emitting a request. Under this
    circumstance, the outstanding request is flushed and waited upon. After
    space on the ring is cleared, we return to emitting the new command -
    except that we just cleared the seqno allocated for this operation and
    trigger the sanity check that a request is only ever emitted with a
    valid seqno. The fix is to rearrange the code to make sure the
    allocation of the seqno for this operation is after any required flushes
    of outstanding operations.
    
    The bug exists since the preallocation was introduced in
    commit 9d7730914f4cd496e356acfab95b41075aa8eae8
    Author: Chris Wilson <chris@chris-wilson.co.uk>
    Date:   Tue Nov 27 16:22:52 2012 +0000
    
        drm/i915: Preallocate next seqno before touching the ring
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
    Cc: Mika Kuoppala <mika.kuoppala@intel.com>
    Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
    Reviewed-by: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c3c43400a29dba30a581c97a6eb6952d187c3e07
Author: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Date:   Tue Nov 12 13:34:08 2013 +0100

    drm/nouveau: fix m2mf copy to tiled gart
    
    commit ce8f7699f2b6ffe4aa8368b8d9d370875accaa5f upstream.
    
    Commit de7b7d59d54852c introduced tiled GART, but a linear copy is
    still performed. This may result in errors on eviction, fix it by
    checking tiling from memtype.
    
    Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
    Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4f66403630544a1e5ad3b041fe0dba9db16ff6d9
Author: Mikulas Patocka <mpatocka@redhat.com>
Date:   Mon Jan 13 19:37:54 2014 -0500

    dm sysfs: fix a module unload race
    
    commit 2995fa78e423d7193f3b57835f6c1c75006a0315 upstream.
    
    This reverts commit be35f48610 ("dm: wait until embedded kobject is
    released before destroying a device") and provides an improved fix.
    
    The kobject release code that calls the completion must be placed in a
    non-module file, otherwise there is a module unload race (if the process
    calling dm_kobject_release is preempted and the DM module unloaded after
    the completion is triggered, but before dm_kobject_release returns).
    
    To fix this race, this patch moves the completion code to dm-builtin.c
    which is always compiled directly into the kernel if BLK_DEV_DM is
    selected.
    
    The patch introduces a new dm_kobject_holder structure, its purpose is
    to keep the completion and kobject in one place, so that it can be
    accessed from non-module code without the need to export the layout of
    struct mapped_device to that code.
    
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b77d17778310cbe015bd1978a48b1e418b9370d1
Author: Alex Deucher <alexander.deucher@amd.com>
Date:   Mon Jan 27 18:29:35 2014 -0500

    drm/radeon/DCE4+: clear bios scratch dpms bit (v2)
    
    commit 6802d4bad83f50081b2788698570218aaff8d10e upstream.
    
    The BlankCrtc table in some DCE8 boards has some
    logic shortcuts for the vbios when this bit is set.
    Clear it for driver use.
    
    v2: fix typo
    
    Bug:
    https://bugs.freedesktop.org/show_bug.cgi?id=73420
    
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3ca2c5c6827a5064c175010ecd8fdcf10b1b5db2
Author: Alex Deucher <alexander.deucher@amd.com>
Date:   Mon Jan 27 11:54:44 2014 -0500

    drm/radeon: fix DAC interrupt handling on DCE5+
    
    commit e9a321c6b2ac954a7dbf235f419c255a424a1273 upstream.
    
    DCE5 and newer hardware only has 1 DAC.  Use the correct
    offset.  This may fix display problems on certain board
    configurations.
    
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0c53f878f2d970218ab1008319835a95217b0681
Author: Alex Deucher <alexander.deucher@amd.com>
Date:   Thu Jan 16 18:11:47 2014 -0500

    drm/radeon: set the full cache bit for fences on r7xx+
    
    commit d45b964a22cad962d3ede1eba8d24f5cee7b2a92 upstream.
    
    Needed to properly flush the read caches for fences.
    
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9fa65bf6c0e158b96a6b2a6e84dc631de6fed3c1
Author: Alex Deucher <alexander.deucher@amd.com>
Date:   Thu Jan 16 18:02:59 2014 -0500

    drm/radeon: fix surface sync in fence on cayman (v2)
    
    commit 10e9ffae463396c5a25fdfe8a48d7c98a87f6b85 upstream.
    
    We need to set the engine bit to select the ME and
    also set the full cache bit.  Should help stability
    on TN and cayman.
    
    V2: fix up surface sync in ib execute as well
    
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9b0b183e7cd9e9bbef81fe5e0bcc8e1345bd186a
Author: Alex Deucher <alexander.deucher@amd.com>
Date:   Mon Jan 13 16:47:05 2014 -0500

    drm/radeon: disable ss on DP for DCE3.x
    
    commit d8e24525094200601236fa64a54cf73e3d682f2e upstream.
    
    Seems to cause problems with certain DP monitors.
    
    Bug:
    https://bugs.freedesktop.org/show_bug.cgi?id=40699
    
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 064fb5b674e83757c60f85c7f4d846a13168f484
Author: Marek Olšák <marek.olsak@amd.com>
Date:   Wed Jan 8 18:16:26 2014 +0100

    drm/radeon: skip colorbuffer checking if COLOR_INFO.FORMAT is set to INVALID
    
    commit 56492e0fac2dbaf7735ffd66b206a90624917789 upstream.
    
    This fixes a bug which was causing rejections of valid GPU commands
    from userspace.
    
    Signed-off-by: Marek Olšák <marek.olsak@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 118807851f3d5aadbbf966af63c882e5bb8cb89c
Author: Malcolm Priestley <tvboxspy@gmail.com>
Date:   Tue Dec 24 13:18:46 2013 -0300

    m88rs2000: set symbol rate accurately
    
    commit dd4491dfb9eb4fa3bfa7dc73ba989e69fbce2e10 upstream.
    
    Current setting of symbol rate is not very actuate causing
    loss of lock.
    
    Covert temp to u64 and use mclk to calculate from big number.
    
    Calculate symbol rate by dividing symbol rate by 1000 times
    1 << 24 and dividing sum by mclk.
    
    Add other symbol rate settings to function registers 0xa0-0xa3.
    
    In set_frontend add changes to register 0xf1 this must be done
    prior call to fe_reset. Register 0x00 doesn't need a second
    write of 0x1
    
    Applied after patch
    m88rs2000: add m88rs2000_set_carrieroffset
    
    Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
    Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cf5b0cc26c7aff4bb8cbf0f5f411ce2249acc7e2
Author: Malcolm Priestley <tvboxspy@gmail.com>
Date:   Tue Dec 24 13:17:12 2013 -0300

    m88rs2000: add m88rs2000_set_carrieroffset
    
    commit 06af15d1b6f45c60358feab88004472e5428f01c upstream.
    
    Set the carrier offset correctly using the default mclk values.
    
    Add function m88rs2000_get_mclk to calculate the mclk value
    against crystal frequency which will later be used for
    other functions.
    
    Add function m88rs2000_set_carrieroffset to calculate
    and set the offset value.
    
    variable offset becomes a signed value.
    
    Register 0x86 is set the appropriate value according to
    remainder value of frequency % 192857 calculation as
    shown.
    
    Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
    Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 427f7ae89d26e64849063c134d0292f2228995e9
Author: Olivier Grenie <olivier.grenie@parrot.com>
Date:   Thu Dec 12 09:26:22 2013 -0300

    dib8000: fix regression with dib807x
    
    commit d67350f8c4e67f5eba627e1fd111f16257ca9c95 upstream.
    
    Commit 173a64cb3fcf broke support for some dib807x versions.
    
    Fix it by providing backward compatibility with the older versions.
    
    [mkrufky@linuxtv.org: conflict handling and CodingStyle fixes]
    
    Signed-off-by: Olivier Grenie <olivier.grenie@parrot.com>
    Acked-by: Patrick Boettcher <pboettcher@kernellabs.com>
    Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 775d3a3410297abde40af312fdad258ddb654afe
Author: Mauro Carvalho Chehab <m.chehab@samsung.com>
Date:   Mon Jan 13 05:59:30 2014 -0200

    nxt200x: increase write buffer size
    
    commit fa1e1de6bb679f2c86da3311bbafee7eaf78f125 upstream.
    
    The buffer size on nxt200x is not enough:
    
    	...
    	> Dec 20 10:52:04 rich kernel: [   31.747949] nxt200x: nxt200x_writebytes: i2c wr reg=002c: len=255 is too big!
    	...
    
    Increase it to 256 bytes.
    
    Reported-by: Rich Freeman <rich0@gentoo.org>
    Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 222708235bb90510b026256ba45abb24debfa951
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Tue Dec 3 10:12:51 2013 -0300

    media: s5p_mfc: remove s5p_mfc_get_node_type() function
    
    commit b80cb8dc4162bc954cc71efec192ed89f2061573 upstream.
    
    s5p_mfc_get_node_type() relies on get_index() helper function, which in
    turn relies on video_device index numbers assigned on driver
    registration. All this code is not really needed, because there is
    already access to respective video_device structures via common
    s5p_mfc_dev structure. This fixes the issues introduced by patch
    1056e4388b0454917a512618c8416a98628fc9ce ("v4l2-dev: Fix race condition
    on __video_register_device"), which has been merged in v3.12-rc1.
    
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Signed-off-by: Kamil Debski <k.debski@samsung.com>
    Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 549ac1ac8cf1e7c696501ed8e53956f6c64b217e
Author: Mauro Carvalho Chehab <m.chehab@samsung.com>
Date:   Fri Dec 13 10:35:03 2013 -0300

    dib8000: make 32 bits read atomic
    
    commit 5ac64ba12aca3bef18e61c866583155a3bbf81c4 upstream.
    
    As the dvb-frontend kthread can be called anytime, it can race
    with some get status ioctl. So, it seems better to avoid one to
    race with the other while reading a 32 bits register.
    I can't see any other reason for having a mutex there at I2C, except
    to provide such kind of protection, as the I2C core already has a
    mutex to protect I2C transfers.
    
    Note: instead of this approach, it could eventually remove the dib8000
    specific mutex for it, and either group the 4 ops into one xfer or
    to manually control the I2C mutex. The main advantage of the current
    approach is that the changes are smaller and more puntual.
    
    Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
    Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
    Acked-by: Patrick Boettcher <pboettcher@kernellabs.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8bed1b8f616b58441801d0f0fb277099b467c055
Author: Antti Palosaari <crope@iki.fi>
Date:   Mon Dec 16 21:08:04 2013 -0300

    media: anysee: fix non-working E30 Combo Plus DVB-T
    
    commit c57f87e62368c33ebda11a4993380c8e5a19a5c5 upstream.
    
    PLL was attached twice to frontend0 leaving frontend1 without a tuner.
    frontend0 is DVB-C and frontend1 is DVB-T.
    
    Signed-off-by: Antti Palosaari <crope@iki.fi>
    Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 06bdd77c7098caba92d420ebc3a63ef12aae524f
Author: David Rientjes <rientjes@google.com>
Date:   Thu Jan 30 15:46:11 2014 -0800

    mm, oom: base root bonus on current usage
    
    commit 778c14affaf94a9e4953179d3e13a544ccce7707 upstream.
    
    A 3% of system memory bonus is sometimes too excessive in comparison to
    other processes.
    
    With commit a63d83f427fb ("oom: badness heuristic rewrite"), the OOM
    killer tries to avoid killing privileged tasks by subtracting 3% of
    overall memory (system or cgroup) from their per-task consumption.  But
    as a result, all root tasks that consume less than 3% of overall memory
    are considered equal, and so it only takes 33+ privileged tasks pushing
    the system out of memory for the OOM killer to do something stupid and
    kill dhclient or other root-owned processes.  For example, on a 32G
    machine it can't tell the difference between the 1M agetty and the 10G
    fork bomb member.
    
    The changelog describes this 3% boost as the equivalent to the global
    overcommit limit being 3% higher for privileged tasks, but this is not
    the same as discounting 3% of overall memory from _every privileged task
    individually_ during OOM selection.
    
    Replace the 3% of system memory bonus with a 3% of current memory usage
    bonus.
    
    By giving root tasks a bonus that is proportional to their actual size,
    they remain comparable even when relatively small.  In the example
    above, the OOM killer will discount the 1M agetty's 256 badness points
    down to 179, and the 10G fork bomb's 262144 points down to 183500 points
    and make the right choice, instead of discounting both to 0 and killing
    agetty because it's first in the task list.
    
    Signed-off-by: David Rientjes <rientjes@google.com>
    Reported-by: Johannes Weiner <hannes@cmpxchg.org>
    Acked-by: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Michal Hocko <mhocko@suse.cz>
    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>

commit dd6eab0527ac15c07d79c8f81fbb3085eb8e282a
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Jan 8 11:40:20 2014 +0900

    radeon/pm: Guard access to rdev->pm.power_state array
    
    commit 370169516e736edad3b3c5aa49858058f8b55195 upstream.
    
    It's never allocated on systems without an ATOMBIOS or COMBIOS ROM.
    
    Should fix an oops I encountered while resetting the GPU after a lockup
    on my PowerBook with an RV350.
    
    Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 06dd2b2c5d81c8a6c13c5a731f2ca73a7d7f07ff
Author: Alex Deucher <alexander.deucher@amd.com>
Date:   Tue Jan 7 10:05:02 2014 -0500

    drm/radeon: warn users when hw_i2c is enabled (v2)
    
    commit d195178297de9a91246519dbfa98952b70f9a9b6 upstream.
    
    The hw i2c engines are disabled by default as the
    current implementation is still experimental.  Print
    a warning when users enable it so that it's obvious
    when the option is enabled.
    
    v2: check for non-0 rather than 1
    
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 88972eec55f81c2500ee2923023850faa13edb67
Author: Joe Thornber <ejt@redhat.com>
Date:   Tue Jan 21 11:07:32 2014 +0000

    dm space map metadata: fix bug in resizing of thin metadata
    
    commit fca028438fb903852beaf7c3fe1cd326651af57d upstream.
    
    This bug was introduced in commit 7e664b3dec431e ("dm space map metadata:
    fix extending the space map").
    
    When extending a dm-thin metadata volume we:
    
    - Switch the space map into a simple bootstrap mode, which allocates
      all space linearly from the newly added space.
    - Add new bitmap entries for the new space
    - Increment the reference counts for those newly allocated bitmap
      entries
    - Commit changes to disk
    - Switch back out of bootstrap mode.
    
    But, the disk commit may allocate space itself, if so this fact will be
    lost when switching out of bootstrap mode.
    
    The bug exhibited itself as an error when the bitmap_root, with an
    erroneous ref count of 0, was subsequently decremented as part of a
    later disk commit.  This would cause the disk commit to fail, and thinp
    to enter read_only mode.  The metadata was not damaged (thin_check
    passed).
    
    The fix is to put the increments + commit into a loop, running until
    the commit has not allocated extra space.  In practise this loop only
    runs twice.
    
    With this fix the following device mapper testsuite test passes:
     dmtest run --suite thin-provisioning -n thin_remove_works_after_resize
    
    Signed-off-by: Joe Thornber <ejt@redhat.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f15396a3699d02f863e80623e0771d3f95f08974
Author: Joe Thornber <ejt@redhat.com>
Date:   Tue Jan 7 15:49:02 2014 +0000

    dm space map metadata: fix extending the space map
    
    commit 7e664b3dec431eebf0c5df5ff704d6197634cf35 upstream.
    
    When extending a metadata space map we should do the first commit whilst
    still in bootstrap mode -- a mode where all blocks get allocated in the
    new area.
    
    That way the commit overhead is allocated from the newly added space.
    Otherwise we risk running out of space.
    
    With this fix, and the previous commit "dm space map common: make sure
    new space is used during extend", the following device mapper testsuite
    test passes:
     dmtest run --suite thin-provisioning -n /resize_metadata_no_io/
    
    Signed-off-by: Joe Thornber <ejt@redhat.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 247373410ad9f7f4dfc6a7a9c0bb4bcd0af59491
Author: Joe Thornber <ejt@redhat.com>
Date:   Tue Jan 7 15:47:59 2014 +0000

    dm space map common: make sure new space is used during extend
    
    commit 12c91a5c2d2a8e8cc40a9552313e1e7b0a2d9ee3 upstream.
    
    When extending a low level space map we should update nr_blocks at
    the start so the new space is used for the index entries.
    
    Otherwise extend can fail, e.g.: sm_metadata_extend call sequence
    that fails:
     -> sm_ll_extend
        -> dm_tm_new_block -> dm_sm_new_block -> sm_bootstrap_new_block
        => returns -ENOSPC because smm->begin == smm->ll.nr_blocks
    
    Signed-off-by: Joe Thornber <ejt@redhat.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit eef2b6df86323b5c9eaee154174afb1976741f38
Author: Mikulas Patocka <mpatocka@redhat.com>
Date:   Mon Jan 6 23:01:22 2014 -0500

    dm: wait until embedded kobject is released before destroying a device
    
    commit be35f486108227e10fe5d96fd42fb2b344c59983 upstream.
    
    There may be other parts of the kernel holding a reference on the dm
    kobject.  We must wait until all references are dropped before
    deallocating the mapped_device structure.
    
    The dm_kobject_release method signals that all references are dropped
    via completion.  But dm_kobject_release doesn't free the kobject (which
    is embedded in the mapped_device structure).
    
    This is the sequence of operations:
    * when destroying a DM device, call kobject_put from dm_sysfs_exit
    * wait until all users stop using the kobject, when it happens the
      release method is called
    * the release method signals the completion and should return without
      delay
    * the dm device removal code that waits on the completion continues
    * the dm device removal code drops the dm_mod reference the device had
    * the dm device removal code frees the mapped_device structure that
      contains the kobject
    
    Using kobject this way should avoid the module unload race that was
    mentioned at the beginning of this thread:
    https://lkml.org/lkml/2014/1/4/83
    
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 025d61e0f163e55a7a7b08975640c5c75c2690b8
Author: Mike Snitzer <snitzer@redhat.com>
Date:   Tue Dec 17 13:19:11 2013 -0500

    dm thin: initialize dm_thin_new_mapping returned by get_next_mapping
    
    commit 16961b042db8cc5cf75d782b4255193ad56e1d4f upstream.
    
    As additional members are added to the dm_thin_new_mapping structure
    care should be taken to make sure they get initialized before use.
    
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Acked-by: Joe Thornber <ejt@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 614319dfb0fb5da7fd2f96eb06df96bd3a04cbdd
Author: Joe Thornber <ejt@redhat.com>
Date:   Tue Dec 17 12:09:40 2013 -0500

    dm thin: fix discard support to a previously shared block
    
    commit 19fa1a6756ed9e92daa9537c03b47d6b55cc2316 upstream.
    
    If a snapshot is created and later deleted the origin dm_thin_device's
    snapshotted_time will have been updated to reflect the snapshot's
    creation time.  The 'shared' flag in the dm_thin_lookup_result struct
    returned from dm_thin_find_block() is an approximation based on
    snapshotted_time -- this is done to avoid 0(n), or worse, time
    complexity.  In this case, the shared flag would be true.
    
    But because the 'shared' flag reflects an approximation a block can be
    incorrectly assumed to be shared (e.g. false positive for 'shared'
    because the snapshot no longer exists).  This could result in discards
    issued to a thin device not being passed down to the pool's underlying
    data device.
    
    To fix this we double check that a thin block is really still in-use
    after a mapping is removed using dm_pool_block_is_used().  If the
    reference count for a block is now zero the discard is allowed to be
    passed down.
    
    Also add a 'definitely_not_shared' member to the dm_thin_new_mapping
    structure -- reflects that the 'shared' flag in the response from
    dm_thin_find_block() can only be held as definitive if false is
    returned.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1043527
    
    Signed-off-by: Joe Thornber <ejt@redhat.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 42e0de9d0e77debb0a34024729cd34068af68bd8
Author: Weston Andros Adamson <dros@netapp.com>
Date:   Tue Dec 17 12:16:11 2013 -0500

    sunrpc: Fix infinite loop in RPC state machine
    
    commit 6ff33b7dd0228b7d7ed44791bbbc98b03fd15d9d upstream.
    
    When a task enters call_refreshresult with status 0 from call_refresh and
    !rpcauth_uptodatecred(task) it enters call_refresh again with no rate-limiting
    or max number of retries.
    
    Instead of trying forever, make use of the retry path that other errors use.
    
    This only seems to be possible when the crrefresh callback is gss_refresh_null,
    which only happens when destroying the context.
    
    To reproduce:
    
    1) mount with sec=krb5 (or sec=sys with krb5 negotiated for non FSID specific
       operations).
    
    2) reboot - the client will be stuck and will need to be hard rebooted
    
    BUG: soft lockup - CPU#0 stuck for 22s! [kworker/0:2:46]
    Modules linked in: rpcsec_gss_krb5 nfsv4 nfs fscache ppdev crc32c_intel aesni_intel aes_x86_64 glue_helper lrw gf128mul ablk_helper cryptd serio_raw i2c_piix4 i2c_core e1000 parport_pc parport shpchp nfsd auth_rpcgss oid_registry exportfs nfs_acl lockd sunrpc autofs4 mptspi scsi_transport_spi mptscsih mptbase ata_generic floppy
    irq event stamp: 195724
    hardirqs last  enabled at (195723): [<ffffffff814a925c>] restore_args+0x0/0x30
    hardirqs last disabled at (195724): [<ffffffff814b0a6a>] apic_timer_interrupt+0x6a/0x80
    softirqs last  enabled at (195722): [<ffffffff8103f583>] __do_softirq+0x1df/0x276
    softirqs last disabled at (195717): [<ffffffff8103f852>] irq_exit+0x53/0x9a
    CPU: 0 PID: 46 Comm: kworker/0:2 Not tainted 3.13.0-rc3-branch-dros_testing+ #4
    Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/31/2013
    Workqueue: rpciod rpc_async_schedule [sunrpc]
    task: ffff8800799c4260 ti: ffff880079002000 task.ti: ffff880079002000
    RIP: 0010:[<ffffffffa0064fd4>]  [<ffffffffa0064fd4>] __rpc_execute+0x8a/0x362 [sunrpc]
    RSP: 0018:ffff880079003d18  EFLAGS: 00000246
    RAX: 0000000000000005 RBX: 0000000000000007 RCX: 0000000000000007
    RDX: 0000000000000007 RSI: ffff88007aecbae8 RDI: ffff8800783d8900
    RBP: ffff880079003d78 R08: ffff88006e30e9f8 R09: ffffffffa005a3d7
    R10: ffff88006e30e7b0 R11: ffff8800783d8900 R12: ffffffffa006675e
    R13: ffff880079003ce8 R14: ffff88006e30e7b0 R15: ffff8800783d8900
    FS:  0000000000000000(0000) GS:ffff88007f200000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007f3072333000 CR3: 0000000001a0b000 CR4: 00000000001407f0
    Stack:
     ffff880079003d98 0000000000000246 0000000000000000 ffff88007a9a4830
     ffff880000000000 ffffffff81073f47 ffff88007f212b00 ffff8800799c4260
     ffff8800783d8988 ffff88007f212b00 ffffe8ffff604800 0000000000000000
    Call Trace:
     [<ffffffff81073f47>] ? trace_hardirqs_on_caller+0x145/0x1a1
     [<ffffffffa00652d3>] rpc_async_schedule+0x27/0x32 [sunrpc]
     [<ffffffff81052974>] process_one_work+0x211/0x3a5
     [<ffffffff810528d5>] ? process_one_work+0x172/0x3a5
     [<ffffffff81052eeb>] worker_thread+0x134/0x202
     [<ffffffff81052db7>] ? rescuer_thread+0x280/0x280
     [<ffffffff81052db7>] ? rescuer_thread+0x280/0x280
     [<ffffffff810584a0>] kthread+0xc9/0xd1
     [<ffffffff810583d7>] ? __kthread_parkme+0x61/0x61
     [<ffffffff814afd6c>] ret_from_fork+0x7c/0xb0
     [<ffffffff810583d7>] ? __kthread_parkme+0x61/0x61
    Code: e8 87 63 fd e0 c6 05 10 dd 01 00 01 48 8b 43 70 4c 8d 6b 70 45 31 e4 a8 02 0f 85 d5 02 00 00 4c 8b 7b 48 48 c7 43 48 00 00 00 00 <4c> 8b 4b 50 4d 85 ff 75 0c 4d 85 c9 4d 89 cf 0f 84 32 01 00 00
    
    And the output of "rpcdebug -m rpc -s all":
    
    RPC:    61 call_refresh (status 0)
    RPC:    61 call_refresh (status 0)
    RPC:    61 refreshing RPCSEC_GSS cred ffff88007a413cf0
    RPC:    61 refreshing RPCSEC_GSS cred ffff88007a413cf0
    RPC:    61 call_refreshresult (status 0)
    RPC:    61 refreshing RPCSEC_GSS cred ffff88007a413cf0
    RPC:    61 call_refreshresult (status 0)
    RPC:    61 refreshing RPCSEC_GSS cred ffff88007a413cf0
    RPC:    61 call_refresh (status 0)
    RPC:    61 call_refreshresult (status 0)
    RPC:    61 call_refresh (status 0)
    RPC:    61 call_refresh (status 0)
    RPC:    61 refreshing RPCSEC_GSS cred ffff88007a413cf0
    RPC:    61 call_refreshresult (status 0)
    RPC:    61 call_refresh (status 0)
    RPC:    61 refreshing RPCSEC_GSS cred ffff88007a413cf0
    RPC:    61 call_refresh (status 0)
    RPC:    61 refreshing RPCSEC_GSS cred ffff88007a413cf0
    RPC:    61 refreshing RPCSEC_GSS cred ffff88007a413cf0
    RPC:    61 call_refreshresult (status 0)
    RPC:    61 call_refresh (status 0)
    RPC:    61 call_refresh (status 0)
    RPC:    61 call_refresh (status 0)
    RPC:    61 call_refresh (status 0)
    RPC:    61 call_refreshresult (status 0)
    RPC:    61 refreshing RPCSEC_GSS cred ffff88007a413cf0
    
    Signed-off-by: Weston Andros Adamson <dros@netapp.com>
    Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 305a7c624df026dbdde23eb880549db7df0ad7b9
Author: Boaz Harrosh <bharrosh@panasas.com>
Date:   Wed Jan 22 20:34:54 2014 +0200

    pnfs: Proper delay for NFS4ERR_RECALLCONFLICT in layout_get_done
    
    commit ed7e5423014ad89720fcf315c0b73f2c5d0c7bd2 upstream.
    
    An NFS4ERR_RECALLCONFLICT is returned by server from a GET_LAYOUT
    only when a Server Sent a RECALL do to that GET_LAYOUT, or
    the RECALL and GET_LAYOUT crossed on the wire.
    In any way this means we want to wait at most until in-flight IO
    is finished and the RECALL can be satisfied.
    
    So a proper wait here is more like 1/10 of a second, not 15 seconds
    like we have now. In case of a server bug we delay exponentially
    longer on each retry.
    
    Current code totally craps out performance of very large files on
    most pnfs-objects layouts, because of how the map changes when the
    file has grown into the next raid group.
    
    [Stable: This will patch back to 3.9. If there are earlier still
     maintained trees, please tell me I'll send a patch]
    
    Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
    Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit daab6e7df44ba7d4281379c6ac5780e10d133286
Author: Weston Andros Adamson <dros@primarydata.com>
Date:   Sun Jan 19 22:45:36 2014 -0500

    nfs4: fix discover_server_trunking use after free
    
    commit abad2fa5ba67725a3f9c376c8cfe76fbe94a3041 upstream.
    
    If clp is new (cl_count = 1) and it matches another client in
    nfs4_discover_server_trunking, the nfs_put_client will free clp before
    ->cl_preserve_clid is set.
    
    Signed-off-by: Weston Andros Adamson <dros@primarydata.com>
    Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 14ff66ce27e91666bf55e415104fdec9f9b18668
Author: Trond Myklebust <trond.myklebust@primarydata.com>
Date:   Fri Jan 17 17:03:41 2014 -0500

    NFSv4.1: Handle errors correctly in nfs41_walk_client_list
    
    commit 64590daa9e0dfb3aad89e3ab9230683b76211d5b upstream.
    
    Both nfs41_walk_client_list and nfs40_walk_client_list expect the
    'status' variable to be set to the value -NFS4ERR_STALE_CLIENTID
    if the loop fails to find a match.
    The problem is that the 'pos->cl_cons_state > NFS_CS_READY' changes
    the value of 'status', and sets it either to the value '0' (which
    indicates success), or to the value EINTR.
    
    Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c19422192bfb29a3c9ed00961f317b6f46f14923
Author: Weston Andros Adamson <dros@primarydata.com>
Date:   Mon Jan 13 16:54:45 2014 -0500

    nfs4.1: properly handle ENOTSUP in SECINFO_NO_NAME
    
    commit 78b19bae0813bd6f921ca58490196abd101297bd upstream.
    
    Don't check for -NFS4ERR_NOTSUPP, it's already been mapped to -ENOTSUPP
    by nfs4_stat_to_errno.
    
    This allows the client to mount v4.1 servers that don't support
    SECINFO_NO_NAME by falling back to the "guess and check" method of
    nfs4_find_root_sec.
    
    Signed-off-by: Weston Andros Adamson <dros@primarydata.com>
    Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit afce3609db524d801a8fc4096810fa6844062f65
Author: Trond Myklebust <Trond.Myklebust@netapp.com>
Date:   Wed Dec 4 17:39:23 2013 -0500

    NFSv4: OPEN must handle the NFS4ERR_IO return code correctly
    
    commit c7848f69ec4a8c03732cde5c949bd2aa711a9f4b upstream.
    
    decode_op_hdr() cannot distinguish between an XDR decoding error and
    the perfectly valid errorcode NFS4ERR_IO. This is normally not a
    problem, but for the particular case of OPEN, we need to be able
    to increment the NFSv4 open sequence id when the server returns
    a valid response.
    
    Reported-by: J Bruce Fields <bfields@fieldses.org>
    Link: http://lkml.kernel.org/r/20131204210356.GA19452@fieldses.org
    Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4371c272186d393fbb401a743867a209f3e218ae
Author: Daniel Santos <daniel.santos@pobox.com>
Date:   Sun Jan 5 17:39:26 2014 -0600

    spidev: fix hang when transfer_one_message fails
    
    commit e120cc0dcf2880a4c5c0a6cb27b655600a1cfa1d upstream.
    
    This corrects a problem in spi_pump_messages() that leads to an spi
    message hanging forever when a call to transfer_one_message() fails.
    This failure occurs in my MCP2210 driver when the cs_change bit is set
    on the last transfer in a message, an operation which the hardware does
    not support.
    
    Rationale
    Since the transfer_one_message() returns an int, we must presume that it
    may fail.  If transfer_one_message() should never fail, it should return
    void.  Thus, calls to transfer_one_message() should properly manage a
    failure.
    
    Fixes: ffbbdd21329f3 (spi: create a message queueing infrastructure)
    Signed-off-by: Daniel Santos <daniel.santos@pobox.com>
    Signed-off-by: Mark Brown <broonie@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d12825478189af51a0feb66744700bfbee257a25
Author: Jonas Gorski <jogo@openwrt.org>
Date:   Tue Dec 17 21:42:07 2013 +0100

    spi/bcm63xx: don't substract prepend length from total length
    
    commit 86b3bde003e6bf60ccb9c09b4115b8a2f533974c upstream.
    
    The spi command must include the full message length including any
    prepended writes, else transfers larger than 256 bytes will be
    incomplete.
    
    Signed-off-by: Jonas Gorski <jogo@openwrt.org>
    Acked-by: Florian Fainelli <florian@openwrt.org>
    Signed-off-by: Mark Brown <broonie@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5509a949855b0d0b4a3a12be431aa2f069ac8330
Author: Ira Weiny <ira.weiny@intel.com>
Date:   Wed Dec 18 08:41:37 2013 -0800

    IB/qib: Fix QP check when looping back to/from QP1
    
    commit 6e0ea9e6cbcead7fa8c76e3e3b9de4a50c5131c5 upstream.
    
    The GSI QP type is compatible with and should be allowed to send data
    to/from any UD QP.  This was found when testing ibacm on the same node
    as an SA.
    
    Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
    Signed-off-by: Ira Weiny <ira.weiny@intel.com>
    Signed-off-by: Roland Dreier <roland@purestorage.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ba68845589338d5105b51415a6ca9607bdc475e8
Author: Max Filippov <jcmvbkbc@gmail.com>
Date:   Wed Dec 25 05:20:36 2013 +0400

    xtensa: xtfpga: fix definitions of platform devices
    
    commit a558d99263936b8a67d4eff8918745a77bfd8c31 upstream.
    
    Remove __initdata attribute, as the devices may be used after init
    sections are freed.
    
    Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ed6161470c6c8c45d97211d2426eb050dc382a4a
Author: Boaz Harrosh <bharrosh@panasas.com>
Date:   Thu Nov 21 17:58:08 2013 +0200

    ore: Fix wrong math in allocation of per device BIO
    
    commit aad560b7f63b495f48a7232fd086c5913a676e6f upstream.
    
    At IO preparation we calculate the max pages at each device and
    allocate a BIO per device of that size. The calculation was wrong
    on some unaligned corner cases offset/length combination and would
    make prepare return with -ENOMEM. This would be bad for pnfs-objects
    that would in that case IO through MDS. And fatal for exofs were it
    would fail writes with EIO.
    
    Fix it by doing the proper math, that will work in all cases. (I
    ran a test with all possible offset/length combinations this time
    round).
    
    Also when reading we do not need to allocate for the parity units
    since we jump over them.
    
    Also lower the max_io_length to take into account the parity pages
    so not to allocate BIOs bigger than PAGE_SIZE
    
    Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c9f36c5a61a49fd873fc38aa447934ef2417d1d8
Author: Michael Grzeschik <m.grzeschik@pengutronix.de>
Date:   Fri Nov 29 14:14:29 2013 +0100

    mtd: mxc_nand: remove duplicated ecc_stats counting
    
    commit 0566477762f9e174e97af347ee9c865f908a5647 upstream.
    
    The ecc_stats.corrected count variable will already be incremented in
    the above framework-layer just after this callback.
    
    Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
    Signed-off-by: Brian Norris <computersforpeace@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c953495fd19e3a96a2f927941d3b1423fc294132
Author: Heiko Carstens <heiko.carstens@de.ibm.com>
Date:   Fri Jan 31 07:50:36 2014 +0100

    tile: remove compat_sys_lookup_dcookie declaration to fix compile error
    
    commit 5a5e75f4714a592f31e57f248b8f5c866f278b8d upstream.
    
    With commit d8d14bd09cdd ("fs/compat: fix lookup_dcookie() parameter
    handling") I changed the type of the len parameter of the
    lookup_dcookie() syscall.
    
    However I missed that there was still a stale declaration in
    arch/tile/..  which now causes a compile error on tile:
    
      In file included from fs/dcookies.c:28:0:
      include/linux/compat.h:425:17: error: conflicting types for 'compat_sys_lookup_dcookie'
      fs/dcookies.c:207:1: error: conflicting types for 'compat_sys_lookup_dcookie'
    
    Simply remove the declaration in the tile architecture, which is only a
    leftover from before the different compat lookup_dcookie() versions have
    been merged.  The correct declaration is now in include/linux/compat.h
    
    The build error was reported by Fenguang's build bot.
    
    Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
    Acked-by: Chris Metcalf <cmetcalf@tilera.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7462402eae491665f58f434dbf45bd964cbf8b79
Author: Heiko Carstens <heiko.carstens@de.ibm.com>
Date:   Wed Jan 29 14:05:46 2014 -0800

    fs/compat: fix lookup_dcookie() parameter handling
    
    commit d8d14bd09cddbaf0168d61af638455a26bd027ff upstream.
    
    Commit d5dc77bfeeab ("consolidate compat lookup_dcookie()") coverted all
    architectures to the new compat_sys_lookup_dcookie() syscall.
    
    The "len" paramater of the new compat syscall must have the type
    compat_size_t in order to enforce zero extension for architectures where
    the ABI requires that the caller of a function performed zero and/or
    sign extension to 64 bit of all parameters.
    
    Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
    Cc: Martin Schwidefsky <schwidefsky@de.ibm.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>

commit 9580348ce827b7026c12f2fde1da7d064c338dc6
Author: Heiko Carstens <heiko.carstens@de.ibm.com>
Date:   Wed Jan 29 14:05:44 2014 -0800

    fs/compat: fix parameter handling for compat readv/writev syscalls
    
    commit dfd948e32af2e7b28bcd7a490c0a30d4b8df2a36 upstream.
    
    We got a report that the pwritev syscall does not work correctly in
    compat mode on s390.
    
    It turned out that with commit 72ec35163f9f ("switch compat readv/writev
    variants to COMPAT_SYSCALL_DEFINE") we lost the zero extension of a
    couple of syscall parameters because the some parameter types haven't
    been converted from unsigned long to compat_ulong_t.
    
    This is needed for architectures where the ABI requires that the caller
    of a function performed zero and/or sign extension to 64 bit of all
    parameters.
    
    Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
    Cc: Martin Schwidefsky <schwidefsky@de.ibm.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>

commit 060168af7cbbade31561f3a1efbc1bac91ee2166
Author: Heiko Carstens <heiko.carstens@de.ibm.com>
Date:   Mon Jan 27 17:07:19 2014 -0800

    compat: fix sys_fanotify_mark
    
    commit 592f6b842f64e416c7598a1b97c649b34241e22d upstream.
    
    Commit 91c2e0bcae72 ("unify compat fanotify_mark(2), switch to
    COMPAT_SYSCALL_DEFINE") added a new unified compat fanotify_mark syscall
    to be used by all architectures.
    
    Unfortunately the unified version merges the split mask parameter in a
    wrong way: the lower and higher word got swapped.
    
    This was discovered with glibc's tst-fanotify test case.
    
    Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
    Reported-by: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
    Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
    Acked-by: "David S. Miller" <davem@davemloft.net>
    Acked-by: Al Viro <viro@ZenIV.linux.org.uk>
    Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    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>

commit 1ea15c440a24bc3f3f091e8867412c96b6efac82
Author: Mark Brown <broonie@linaro.org>
Date:   Mon Jan 27 00:32:14 2014 +0000

    ACPI / init: Flag use of ACPI and ACPI idioms for power supplies to regulator API
    
    commit 49a12877d2777cadcb838981c3c4f5a424aef310 upstream.
    
    There is currently no facility in ACPI to express the hookup of voltage
    regulators, the expectation is that the regulators that exist in the
    system will be handled transparently by firmware if they need software
    control at all. This means that if for some reason the regulator API is
    enabled on such a system it should assume that any supplies that devices
    need are provided by the system at all relevant times without any software
    intervention.
    
    Tell the regulator core to make this assumption by calling
    regulator_has_full_constraints(). Do this as soon as we know we are using
    ACPI so that the information is available to the regulator core as early
    as possible. This will cause the regulator core to pretend that there is
    an always on regulator supplying any supply that is requested but that has
    not otherwise been mapped which is the behaviour expected on a system with
    ACPI.
    
    Should the ability to specify regulators be added in future revisions of
    ACPI then once we have support for ACPI mappings in the kernel the same
    assumptions will apply. It is also likely that systems will default to a
    mode of operation which does not require any interpretation of these
    mappings in order to be compatible with existing operating system releases
    so it should remain safe to make these assumptions even if the mappings
    exist but are not supported by the kernel.
    
    Signed-off-by: Mark Brown <broonie@linaro.org>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0e2d79ded075f612ba63178c6eaefe6ee7d8dd75
Author: Josh Triplett <josh@joshtriplett.org>
Date:   Tue Aug 20 17:20:14 2013 -0700

    turbostat: Use GCC's CPUID functions to support PIC
    
    commit 2b92865e648ce04a39fda4f903784a5d01ecb0dc upstream.
    
    turbostat uses inline assembly to call cpuid.  On 32-bit x86, on systems
    that have certain security features enabled by default that make -fPIC
    the default, this causes a build error:
    
    turbostat.c: In function ‘check_cpuid’:
    turbostat.c:1906:2: error: PIC register clobbered by ‘ebx’ in ‘asm’
      asm("cpuid" : "=a" (fms), "=c" (ecx), "=d" (edx) : "a" (1) : "ebx");
      ^
    
    GCC provides a header cpuid.h, containing a __get_cpuid function that
    works with both PIC and non-PIC.  (On PIC, it saves and restores ebx
    around the cpuid instruction.)  Use that instead.
    
    Signed-off-by: Josh Triplett <josh@joshtriplett.org>
    Signed-off-by: Len Brown <len.brown@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 73cb6cf10ef0ce902cb13b5bcb2c9c653e9a7798
Author: Josh Triplett <josh@joshtriplett.org>
Date:   Tue Aug 20 17:20:12 2013 -0700

    turbostat: Don't put unprocessed uapi headers in the include path
    
    commit b731f3119de57144e16c19fd593b8daeb637843e upstream.
    
    turbostat's Makefile puts arch/x86/include/uapi/ in the include path, so
    that it can include <asm/msr.h> from it.  It isn't in general safe to
    include even uapi headers directly from the kernel tree without
    processing them through scripts/headers_install.sh, but asm/msr.h
    happens to work.
    
    However, that include path can break with some versions of system
    headers, by overriding some system headers with the unprocessed versions
    directly from the kernel source.  For instance:
    
    In file included from /build/x86-generic/usr/include/bits/sigcontext.h:28:0,
                     from /build/x86-generic/usr/include/signal.h:339,
                     from /build/x86-generic/usr/include/sys/wait.h:31,
                     from turbostat.c:27:
    ../../../../arch/x86/include/uapi/asm/sigcontext.h:4:28: fatal error: linux/compiler.h: No such file or directory
    
    This occurs because the system bits/sigcontext.h on that build system
    includes <asm/sigcontext.h>, and asm/sigcontext.h in the kernel source
    includes <linux/compiler.h>, which scripts/headers_install.sh would have
    filtered out.
    
    Since turbostat really only wants a single header, just include that one
    header rather than putting an entire directory of kernel headers on the
    include path.
    
    In the process, switch from msr.h to msr-index.h, since turbostat just
    wants the MSR numbers.
    
    Signed-off-by: Josh Triplett <josh@joshtriplett.org>
    Signed-off-by: Len Brown <len.brown@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d6d76c6649ec10061810780c0d2398a0232ed1d3
Author: Li Zefan <lizefan@huawei.com>
Date:   Tue Sep 10 11:43:37 2013 +0800

    slub: Fix calculation of cpu slabs
    
    commit 8afb1474db4701d1ab80cd8251137a3260e6913e upstream.
    
      /sys/kernel/slab/:t-0000048 # cat cpu_slabs
      231 N0=16 N1=215
      /sys/kernel/slab/:t-0000048 # cat slabs
      145 N0=36 N1=109
    
    See, the number of slabs is smaller than that of cpu slabs.
    
    The bug was introduced by commit 49e2258586b423684f03c278149ab46d8f8b6700
    ("slub: per cpu cache for partial pages").
    
    We should use page->pages instead of page->pobjects when calculating
    the number of cpu partial slabs. This also fixes the mapping of slabs
    and nodes.
    
    As there's no variable storing the number of total/active objects in
    cpu partial slabs, and we don't have user interfaces requiring those
    statistics, I just add WARN_ON for those cases.
    
    Acked-by: Christoph Lameter <cl@linux.com>
    Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
    Signed-off-by: Li Zefan <lizefan@huawei.com>
    Signed-off-by: Pekka Enberg <penberg@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6bf1831daef67ae1a1b183ebed11885ea9bf9e1d
Author: Ludovic Desroches <ludovic.desroches@atmel.com>
Date:   Wed Nov 20 16:01:11 2013 +0100

    mmc: atmel-mci: fix timeout errors in SDIO mode when using DMA
    
    commit 66b512eda74d59b17eac04c4da1b38d82059e6c9 upstream.
    
    With some SDIO devices, timeout errors can happen when reading data.
    To solve this issue, the DMA transfer has to be activated before sending
    the command to the device. This order is incorrect in PDC mode. So we
    have to take care if we are using DMA or PDC to know when to send the
    MMC command.
    
    Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
    Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
    Signed-off-by: Chris Ball <cjb@laptop.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1e06335d339132ecbb4196ede2cf1c2b618b0121
Author: Ray Jui <rjui@broadcom.com>
Date:   Sat Oct 26 11:03:44 2013 -0700

    mmc: fix host release issue after discard operation
    
    commit f662ae48ae67dfd42739e65750274fe8de46240a upstream.
    
    Under function mmc_blk_issue_rq, after an MMC discard operation,
    the MMC request data structure may be freed in memory. Later in
    the same function, the check of req->cmd_flags & MMC_REQ_SPECIAL_MASK
    is dangerous and invalid. It causes the MMC host not to be released
    when it should.
    
    This patch fixes the issue by marking the special request down before
    the discard/flush operation.
    
    Reported by: Harold (SoonYeal) Yang <haroldsy@broadcom.com>
    Signed-off-by: Ray Jui <rjui@broadcom.com>
    Reviewed-by: Seungwon Jeon <tgih.jun@samsung.com>
    Acked-by: Seungwon Jeon <tgih.jun@samsung.com>
    Signed-off-by: Chris Ball <cjb@laptop.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 48526149964e69fc54a06c409e13d36990386464
Author: Johannes Weiner <hannes@cmpxchg.org>
Date:   Wed Jan 29 14:05:41 2014 -0800

    mm/page-writeback.c: do not count anon pages as dirtyable memory
    
    commit a1c3bfb2f67ef766de03f1f56bdfff9c8595ab14 upstream.
    
    The VM is currently heavily tuned to avoid swapping.  Whether that is
    good or bad is a separate discussion, but as long as the VM won't swap
    to make room for dirty cache, we can not consider anonymous pages when
    calculating the amount of dirtyable memory, the baseline to which
    dirty_background_ratio and dirty_ratio are applied.
    
    A simple workload that occupies a significant size (40+%, depending on
    memory layout, storage speeds etc.) of memory with anon/tmpfs pages and
    uses the remainder for a streaming writer demonstrates this problem.  In
    that case, the actual cache pages are a small fraction of what is
    considered dirtyable overall, which results in an relatively large
    portion of the cache pages to be dirtied.  As kswapd starts rotating
    these, random tasks enter direct reclaim and stall on IO.
    
    Only consider free pages and file pages dirtyable.
    
    Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
    Reported-by: Tejun Heo <tj@kernel.org>
    Tested-by: Tejun Heo <tj@kernel.org>
    Reviewed-by: Rik van Riel <riel@redhat.com>
    Cc: Mel Gorman <mgorman@suse.de>
    Cc: Wu Fengguang <fengguang.wu@intel.com>
    Reviewed-by: Michal Hocko <mhocko@suse.cz>
    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>

commit 03381bd28963f97a976d4742468359f12474ea39
Author: Johannes Weiner <hannes@cmpxchg.org>
Date:   Wed Jan 29 14:05:39 2014 -0800

    mm/page-writeback.c: fix dirty_balance_reserve subtraction from dirtyable memory
    
    commit a804552b9a15c931cfc2a92a2e0aed1add8b580a upstream.
    
    Tejun reported stuttering and latency spikes on a system where random
    tasks would enter direct reclaim and get stuck on dirty pages.  Around
    50% of memory was occupied by tmpfs backed by an SSD, and another disk
    (rotating) was reading and writing at max speed to shrink a partition.
    
    : The problem was pretty ridiculous.  It's a 8gig machine w/ one ssd and 10k
    : rpm harddrive and I could reliably reproduce constant stuttering every
    : several seconds for as long as buffered IO was going on on the hard drive
    : either with tmpfs occupying somewhere above 4gig or a test program which
    : allocates about the same amount of anon memory.  Although swap usage was
    : zero, turning off swap also made the problem go away too.
    :
    : The trigger conditions seem quite plausible - high anon memory usage w/
    : heavy buffered IO and swap configured - and it's highly likely that this
    : is happening in the wild too.  (this can happen with copying large files
    : to usb sticks too, right?)
    
    This patch (of 2):
    
    The dirty_balance_reserve is an approximation of the fraction of free
    pages that the page allocator does not make available for page cache
    allocations.  As a result, it has to be taken into account when
    calculating the amount of "dirtyable memory", the baseline to which
    dirty_background_ratio and dirty_ratio are applied.
    
    However, currently the reserve is subtracted from the sum of free and
    reclaimable pages, which is non-sensical and leads to erroneous results
    when the system is dominated by unreclaimable pages and the
    dirty_balance_reserve is bigger than free+reclaimable.  In that case, at
    least the already allocated cache should be considered dirtyable.
    
    Fix the calculation by subtracting the reserve from the amount of free
    pages, then adding the reclaimable pages on top.
    
    [akpm@linux-foundation.org: fix CONFIG_HIGHMEM build]
    Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
    Reported-by: Tejun Heo <tj@kernel.org>
    Tested-by: Tejun Heo <tj@kernel.org>
    Reviewed-by: Rik van Riel <riel@redhat.com>
    Cc: Mel Gorman <mgorman@suse.de>
    Cc: Wu Fengguang <fengguang.wu@intel.com>
    Reviewed-by: Michal Hocko <mhocko@suse.cz>
    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>

commit 9fa1577a45d333d37b0dd7e56524c351bab6a21b
Author: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Date:   Thu Jan 23 15:53:14 2014 -0800

    mm/memory-failure.c: shift page lock from head page to tail page after thp split
    
    commit 54b9dd14d09f24927285359a227aa363ce46089e upstream.
    
    After thp split in hwpoison_user_mappings(), we hold page lock on the
    raw error page only between try_to_unmap, hence we are in danger of race
    condition.
    
    I found in the RHEL7 MCE-relay testing that we have "bad page" error
    when a memory error happens on a thp tail page used by qemu-kvm:
    
      Triggering MCE exception on CPU 10
      mce: [Hardware Error]: Machine check events logged
      MCE exception done on CPU 10
      MCE 0x38c535: Killing qemu-kvm:8418 due to hardware memory corruption
      MCE 0x38c535: dirty LRU page recovery: Recovered
      qemu-kvm[8418]: segfault at 20 ip 00007ffb0f0f229a sp 00007fffd6bc5240 error 4 in qemu-kvm[7ffb0ef14000+420000]
      BUG: Bad page state in process qemu-kvm  pfn:38c400
      page:ffffea000e310000 count:0 mapcount:0 mapping:          (null) index:0x7ffae3c00
      page flags: 0x2fffff0008001d(locked|referenced|uptodate|dirty|swapbacked)
      Modules linked in: hwpoison_inject mce_inject vhost_net macvtap macvlan ...
      CPU: 0 PID: 8418 Comm: qemu-kvm Tainted: G   M        --------------   3.10.0-54.0.1.el7.mce_test_fixed.x86_64 #1
      Hardware name: NEC NEC Express5800/R120b-1 [N8100-1719F]/MS-91E7-001, BIOS 4.6.3C19 02/10/2011
      Call Trace:
        dump_stack+0x19/0x1b
        bad_page.part.59+0xcf/0xe8
        free_pages_prepare+0x148/0x160
        free_hot_cold_page+0x31/0x140
        free_hot_cold_page_list+0x46/0xa0
        release_pages+0x1c1/0x200
        free_pages_and_swap_cache+0xad/0xd0
        tlb_flush_mmu.part.46+0x4c/0x90
        tlb_finish_mmu+0x55/0x60
        exit_mmap+0xcb/0x170
        mmput+0x67/0xf0
        vhost_dev_cleanup+0x231/0x260 [vhost_net]
        vhost_net_release+0x3f/0x90 [vhost_net]
        __fput+0xe9/0x270
        ____fput+0xe/0x10
        task_work_run+0xc4/0xe0
        do_exit+0x2bb/0xa40
        do_group_exit+0x3f/0xa0
        get_signal_to_deliver+0x1d0/0x6e0
        do_signal+0x48/0x5e0
        do_notify_resume+0x71/0xc0
        retint_signal+0x48/0x8c
    
    The reason of this bug is that a page fault happens before unlocking the
    head page at the end of memory_failure().  This strange page fault is
    trying to access to address 0x20 and I'm not sure why qemu-kvm does
    this, but anyway as a result the SIGSEGV makes qemu-kvm exit and on the
    way we catch the bad page bug/warning because we try to free a locked
    page (which was the former head page.)
    
    To fix this, this patch suggests to shift page lock from head page to
    tail page just after thp split.  SIGSEGV still happens, but it affects
    only error affected VMs, not a whole system.
    
    Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
    Cc: Andi Kleen <andi@firstfloor.org>
    Cc: Wanpeng Li <liwanp@linux.vnet.ibm.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>

commit 186b643ae0c6db1816c93b9b98daf583ef62c372
Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
Date:   Mon Jan 13 13:33:09 2014 -0800

    audit: correct a type mismatch in audit_syscall_exit()
    
    commit 06bdadd7634551cfe8ce071fe44d0311b3033d9e upstream.
    
    audit_syscall_exit() saves a result of regs_return_value() in intermediate
    "int" variable and passes it to __audit_syscall_exit(), which expects its
    second argument as a "long" value.  This will result in truncating the
    value returned by a system call and making a wrong audit record.
    
    I don't know why gcc compiler doesn't complain about this, but anyway it
    causes a problem at runtime on arm64 (and probably most 64-bit archs).
    
    Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Eric Paris <eparis@redhat.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Eric Paris <eparis@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 34210beebddf8a2bd655086b61dbe3b72e7bc7c5
Author: Richard Guy Briggs <rgb@redhat.com>
Date:   Thu Sep 12 23:03:51 2013 -0400

    audit: reset audit backlog wait time after error recovery
    
    commit e789e561a50de0aaa8c695662d97aaa5eac9d55f upstream.
    
    When the audit queue overflows and times out (audit_backlog_wait_time), the
    audit queue overflow timeout is set to zero.  Once the audit queue overflow
    timeout condition recovers, the timeout should be reset to the original value.
    
    See also:
    	https://lkml.org/lkml/2013/9/2/473
    
    Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
    Signed-off-by: Dan Duval <dan.duval@oracle.com>
    Signed-off-by: Chuck Anderson <chuck.anderson@oracle.com>
    Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
    Signed-off-by: Eric Paris <eparis@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d840f9899a6bc8bd88b3c87cd067ddf39a6ada45
Author: Miklos Szeredi <mszeredi@suse.cz>
Date:   Wed Jan 22 19:36:57 2014 +0100

    fuse: fix pipe_buf_operations
    
    commit 28a625cbc2a14f17b83e47ef907b2658576a32aa upstream.
    
    Having this struct in module memory could Oops when if the module is
    unloaded while the buffer still persists in a pipe.
    
    Since sock_pipe_buf_ops is essentially the same as fuse_dev_pipe_buf_steal
    merge them into nosteal_pipe_buf_ops (this is the same as
    default_pipe_buf_ops except stealing the page from the buffer is not
    allowed).
    
    Reported-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 329f4557c93a1aa769896155deefa363f01283e5
Author: Bjorn Helgaas <bhelgaas@google.com>
Date:   Fri Jan 17 14:57:29 2014 -0700

    Revert "EISA: Initialize device before its resources"
    
    commit 765ee51f9a3f652959b4c7297d198a28e37952b4 upstream.
    
    This reverts commit 26abfeed4341872364386c6a52b9acef8c81a81a.
    
    In the eisa_probe() force_probe path, if we were unable to request slot
    resources (e.g., [io 0x800-0x8ff]), we skipped the slot with "Cannot
    allocate resource for EISA slot %d" before reading the EISA signature in
    eisa_init_device().
    
    Commit 26abfeed4341 moved eisa_init_device() earlier, so we tried to read
    the EISA signature before requesting the slot resources, and this caused
    hangs during boot.
    
    Link: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1251816
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 32df365df6fe849e54101681b8278ff6a8d7482b
Author: Alex Williamson <alex.williamson@redhat.com>
Date:   Tue Jan 21 15:48:18 2014 -0800

    intel-iommu: fix off-by-one in pagetable freeing
    
    commit 08336fd218e087cc4fcc458e6b6dcafe8702b098 upstream.
    
    dma_pte_free_level() has an off-by-one error when checking whether a pte
    is completely covered by a range.  Take for example the case of
    attempting to free pfn 0x0 - 0x1ff, ie.  512 entries covering the first
    2M superpage.
    
    The level_size() is 0x200 and we test:
    
      static void dma_pte_free_level(...
    	...
    
    	if (!(0 > 0 || 0x1ff < 0 + 0x200)) {
    		...
    	}
    
    Clearly the 2nd test is true, which means we fail to take the branch to
    clear and free the pagetable entry.  As a result, we're leaking
    pagetables and failing to install new pages over the range.
    
    This was found with a PCI device assigned to a QEMU guest using vfio-pci
    without a VGA device present.  The first 1M of guest address space is
    mapped with various combinations of 4K pages, but eventually the range
    is entirely freed and replaced with a 2M contiguous mapping.
    intel-iommu errors out with something like:
    
      ERROR: DMA PTE for vPFN 0x0 already set (to 5c2b8003 not 849c00083)
    
    In this case 5c2b8003 is the pointer to the previous leaf page that was
    neither freed nor cleared and 849c00083 is the superpage entry that
    we're trying to replace it with.
    
    Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
    Cc: David Woodhouse <dwmw2@infradead.org>
    Cc: Joerg Roedel <joro@8bytes.org>
    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>

commit 25f43284e1fa20779186481d014997196c70fc50
Author: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Date:   Tue Jan 21 15:48:41 2014 -0800

    arch/sh/kernel/kgdb.c: add missing #include <linux/sched.h>
    
    commit 53a52f17d96c8d47c79a7dafa81426317e89c7c1 upstream.
    
      arch/sh/kernel/kgdb.c: In function 'sleeping_thread_to_gdb_regs':
      arch/sh/kernel/kgdb.c:225:32: error: implicit declaration of function 'task_stack_page' [-Werror=implicit-function-declaration]
      arch/sh/kernel/kgdb.c:242:23: error: dereferencing pointer to incomplete type
      arch/sh/kernel/kgdb.c:243:22: error: dereferencing pointer to incomplete type
      arch/sh/kernel/kgdb.c: In function 'singlestep_trap_handler':
      arch/sh/kernel/kgdb.c:310:27: error: 'SIGTRAP' undeclared (first use in this function)
      arch/sh/kernel/kgdb.c:310:27: note: each undeclared identifier is reported only once for each function it appears in
    
    This was introduced by commit 16559ae48c76 ("kgdb: remove #include
    <linux/serial_8250.h> from kgdb.h").
    
    [geert@linux-m68k.org: reworded and reformatted]
    Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
    Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
    Reported-by: Fengguang Wu <fengguang.wu@intel.com>
    Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    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>

commit f74bb7400b79ea730fc5626dc9172d1c236a7498
Author: Steven Rostedt (Red Hat) <rostedt@goodmis.org>
Date:   Thu Jan 23 12:27:59 2014 -0500

    tracing: Check if tracing is enabled in trace_puts()
    
    commit 3132e107d608f8753240d82d61303c500fd515b4 upstream.
    
    If trace_puts() is used very early in boot up, it can crash the machine
    if it is called before the ring buffer is allocated. If a trace_printk()
    is used with no arguments, then it will be converted into a trace_puts()
    and suffer the same fate.
    
    Fixes: 09ae72348ecc "tracing: Add trace_puts() for even faster trace_printk() tracing"
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fb23eaf401bf37602ff9a222d99980ea4d219765
Author: Steven Rostedt (Red Hat) <rostedt@goodmis.org>
Date:   Tue Jan 14 10:19:46 2014 -0500

    tracing: Have trace buffer point back to trace_array
    
    commit dced341b2d4f06668efaab33f88de5d287c0f45b upstream.
    
    The trace buffer has a descriptor pointer that goes back to the trace
    array. But it was never assigned. Luckily, nothing uses it (yet), but
    it will in the future.
    
    Although nothing currently uses this, if any of the new features get
    backported to older kernels, and because this is such a simple change,
    I'm marking it for stable too.
    
    Fixes: 12883efb670c "tracing: Consolidate max_tr into main trace_array structure"
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f6333f55fc53a7b4202679cd0e975e67e13003d2
Author: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date:   Mon Jan 6 21:28:15 2014 +0900

    SELinux: Fix memory leak upon loading policy
    
    commit 8ed814602876bec9bad2649ca17f34b499357a1c upstream.
    
    Hello.
    
    I got below leak with linux-3.10.0-54.0.1.el7.x86_64 .
    
    [  681.903890] kmemleak: 5538 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
    
    Below is a patch, but I don't know whether we need special handing for undoing
    ebitmap_set_bit() call.
    ----------
    >>From fe97527a90fe95e2239dfbaa7558f0ed559c0992 Mon Sep 17 00:00:00 2001
    From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Date: Mon, 6 Jan 2014 16:30:21 +0900
    Subject: SELinux: Fix memory leak upon loading policy
    
    Commit 2463c26d "SELinux: put name based create rules in a hashtable" did not
    check return value from hashtab_insert() in filename_trans_read(). It leaks
    memory if hashtab_insert() returns error.
    
      unreferenced object 0xffff88005c9160d0 (size 8):
        comm "systemd", pid 1, jiffies 4294688674 (age 235.265s)
        hex dump (first 8 bytes):
          57 0b 00 00 6b 6b 6b a5                          W...kkk.
        backtrace:
          [<ffffffff816604ae>] kmemleak_alloc+0x4e/0xb0
          [<ffffffff811cba5e>] kmem_cache_alloc_trace+0x12e/0x360
          [<ffffffff812aec5d>] policydb_read+0xd1d/0xf70
          [<ffffffff812b345c>] security_load_policy+0x6c/0x500
          [<ffffffff812a623c>] sel_write_load+0xac/0x750
          [<ffffffff811eb680>] vfs_write+0xc0/0x1f0
          [<ffffffff811ec08c>] SyS_write+0x4c/0xa0
          [<ffffffff81690419>] system_call_fastpath+0x16/0x1b
          [<ffffffffffffffff>] 0xffffffffffffffff
    
    However, we should not return EEXIST error to the caller, or the systemd will
    show below message and the boot sequence freezes.
    
      systemd[1]: Failed to load SELinux policy. Freezing.
    
    Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Acked-by: Eric Paris <eparis@redhat.com>
    Signed-off-by: Paul Moore <pmoore@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>