3.10.43-stable review
Greg Kroah-Hartman
maintainercover 3.10.43-stable review
This is the start of the stable review cycle for the 3.10.43 release. There are 40 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed Jun 11 22:48:25 UTC 2014. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.43-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.10.43-rc1
Sergey Popovich <[email protected]>
netfilter: Fix potential use after free in ip6_route_me_harder()
Will Deacon <[email protected]>
ARM: perf: hook up perf_sample_event_took around pmu irq handling
Knut Petersen <[email protected]>
perf: Enforce 1 as lower limit for perf_event_max_sample_rate
Stephane Eranian <[email protected]>
perf: Fix interrupt handler timing harness
Dave Hansen <[email protected]>
perf: Drop sample rate when sampling is too slow
Nicholas Bellinger <[email protected]>
iser-target: Add missing target_put_sess_cmd for ImmedateData failure
Andrey Ryabinin <[email protected]>
mm: rmap: fix use-after-free in __put_anon_vma
Alan Stern <[email protected]>
USB: Avoid runtime suspend loops for HCDs that can't handle suspend/resume
Johan Hovold <[email protected]>
USB: io_ti: fix firmware download on big-endian machines (part 2)
Alexej Starschenko <[email protected]>
USB: serial: option: add support for Novatel E371 PCIe card
Greg Kroah-Hartman <[email protected]>
USB: cdc-wdm: properly include types.h
Bjørn Mork <[email protected]>
usb: cdc-wdm: export cdc-wdm uapi header
George McCollister <[email protected]>
USB: ftdi_sio: add NovaTech OrionLXm product ID
Takashi Iwai <[email protected]>
ALSA: hda/realtek - Fix COEF widget NID for ALC260 replacer fixup
Ronan Marquet <[email protected]>
ALSA: hda/realtek - Correction of fixup codes for PB V7900 laptop
Ian Abbott <[email protected]>
staging: comedi: ni_daq_700: add mux settling delay
Ben Hutchings <[email protected]>
Staging: speakup: Move pasting into a work item
Mathias Nyman <[email protected]>
xhci: delete endpoints from bandwidth list before freeing whole device
NeilBrown <[email protected]>
md: always set MD_RECOVERY_INTR when interrupting a reshape thread.
NeilBrown <[email protected]>
md: always set MD_RECOVERY_INTR when aborting a reshape or other "resync".
Chris Wilson <[email protected]>
drm/i915: Only copy back the modified fields to userspace from execbuffer
Lai Jiangshan <[email protected]>
sched: Fix hotplug vs. set_cpus_allowed_ptr()
Heinz Mauelshagen <[email protected]>
dm cache: always split discards on cache block boundaries
Andrey Ryabinin <[email protected]>
ARM: 8051/1: put_user: fix possible data corruption in put_user
Santosh Shilimkar <[email protected]>
ARM: OMAP4: Fix the boot regression with CPU_IDLE enabled
Laurent Pinchart <[email protected]>
ARM: OMAP3: clock: Back-propagate rate change from cam_mclk to dpll4_m5 on all OMAP3 platforms
Emil Goode <[email protected]>
ARM: imx: fix error handling in ipu device registration
Alex Deucher <[email protected]>
drm/radeon: handle non-VGA class pci devices with ATRM
Christian König <[email protected]>
drm/radeon: also try GART for CPU accessed buffers
Ben Skeggs <[email protected]>
drm/gf119-/disp: fix nasty bug which can clobber SOR0's clock setup
Jean Delvare <[email protected]>
hwmon: (ntc_thermistor) Fix OF device ID mapping
Jean Delvare <[email protected]>
hwmon: (ntc_thermistor) Fix dependencies
Johannes Berg <[email protected]>
Documentation: fix DOCBOOKS=... building
Naoya Horiguchi <[email protected]>
mm/memory-failure.c: fix memory leak by race between poison and unpoison
David Ahern <[email protected]>
perf evsel: Fix printing of perf_event_paranoid message
Peter Zijlstra <[email protected]>
perf: Fix race in removing an event
Peter Zijlstra <[email protected]>
perf: Limit perf_event_attr::sample_period to 63 bits
Jiri Olsa <[email protected]>
perf: Prevent false warning in perf_swevent_add
Thomas Gleixner <[email protected]>
sched: Sanitize irq accounting madness
Steven Rostedt (Red Hat) <[email protected]>
sched: Use CPUPRI_NR_PRIORITIES instead of MAX_RT_PRIO in cpupri check
-------------
Diffstat:
Documentation/DocBook/media/Makefile | 2 +- Documentation/sysctl/kernel.txt | 26 ++++ Makefile | 4 +- arch/arm/include/asm/uaccess.h | 3 +- arch/arm/kernel/perf_event.c | 11 +- arch/arm/mach-imx/devices/platform-ipu-core.c | 2 +- arch/arm/mach-omap2/cclock3xxx_data.c | 3 +- arch/arm/mach-omap2/cpuidle44xx.c | 25 +++- arch/x86/kernel/cpu/perf_event.c | 12 +- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 54 ++++---- drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c | 2 +- drivers/gpu/drm/radeon/radeon_bios.c | 14 +++ drivers/gpu/drm/radeon/radeon_object.c | 38 +++--- drivers/hwmon/Kconfig | 2 +- drivers/hwmon/ntc_thermistor.c | 15 ++- drivers/infiniband/ulp/isert/ib_isert.c | 2 + drivers/md/dm-cache-target.c | 2 + drivers/md/md.c | 5 +- drivers/staging/comedi/drivers/ni_daq_700.c | 2 + drivers/staging/speakup/main.c | 1 + drivers/staging/speakup/selection.c | 38 +++++- drivers/staging/speakup/speakup.h | 1 + drivers/usb/core/driver.c | 9 +- drivers/usb/core/hub.c | 15 ++- drivers/usb/host/xhci-mem.c | 20 +-- drivers/usb/serial/ftdi_sio.c | 2 + drivers/usb/serial/ftdi_sio_ids.h | 5 + drivers/usb/serial/io_ti.c | 2 +- drivers/usb/serial/io_usbvend.h | 2 +- drivers/usb/serial/option.c | 2 + include/linux/perf_event.h | 7 ++ include/uapi/linux/usb/Kbuild | 1 + include/uapi/linux/usb/cdc-wdm.h | 2 + kernel/cpu.c | 6 +- kernel/events/core.c | 157 ++++++++++++++++++++---- kernel/sched/core.c | 1 - kernel/sched/cpupri.c | 3 +- kernel/sched/cputime.c | 32 ++--- kernel/sysctl.c | 10 ++ mm/memory-failure.c | 2 + mm/rmap.c | 3 +- net/ipv6/netfilter.c | 6 +- sound/pci/hda/patch_realtek.c | 10 +- tools/perf/util/evsel.c | 2 +- 44 files changed, 422 insertions(+), 141 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/40 sched: Use CPUPRI_NR_PRIORITIES instead of MAX_RT_PRIO in cpupri check
3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (Red Hat)" <[email protected]>
commit 6227cb00cc120f9a43ce8313bb0475ddabcb7d01 upstream.
The check at the beginning of cpupri_find() makes sure that the task_pri variable does not exceed the cp->pri_to_cpu array length. But that length is CPUPRI_NR_PRIORITIES not MAX_RT_PRIO, where it will miss the last two priorities in that array.
As task_pri is computed from convert_prio() which should never be bigger than CPUPRI_NR_PRIORITIES, if the check should cause a panic if it is hit.
--- kernel/sched/cpupri.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/sched/cpupri.c +1 -2
@@ -70,8 +70,7 @@ int cpupri_find(struct cpupri *cp, strucint idx =0 ;int task_pri =convert_prio (p->prio); -if (task_pri >=MAX_RT_PRIO ) -return 0 ; +BUG_ON (task_pri >=CPUPRI_NR_PRIORITIES );for (idx =0 ; idx < task_pri; idx++) {struct cpupri_vec *vec = &cp->pri_to_cpu[idx];
Greg Kroah-Hartman
maintainerPATCH 2/40 sched: Sanitize irq accounting madness
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit 2d513868e2a33e1d5315490ef4c861ee65babd65 upstream.
Russell reported, that irqtime_account_idle_ticks() takes ages due to:
for (i = 0; i < ticks; i++)
irqtime_account_process_tick(current, 0, rq);It's sad, that this code was written way _AFTER_ the NOHZ idle functionality was available. I charge myself guitly for not paying attention when that crap got merged with commit abb74cefa ("sched:
Export ns irqtimes through /proc/stat")
So instead of looping nr_ticks times just apply the whole thing at once.
As a side note: The whole cputime_t vs. u64 business in that context wants to be cleaned up as well. There is no point in having all these back and forth conversions. Lets standardise on u64 nsec for all kernel internal accounting and be done with it. Everything else does not make sense at all for fine grained accounting. Frederic, can you please take care of that?
--- kernel/sched/cputime.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
kernel/sched/cputime.c +16 -16
@@ -326,50 +326,50 @@ out:* softirq as those do not count in task exec_runtime any more. */ static void irqtime_account_process_tick (struct task_struct *p,int user_tick, -struct rq *rq) +struct rq *rq,int ticks) { -cputime_t one_jiffy_scaled =cputime_to_scaled (cputime_one_jiffy); +cputime_t scaled =cputime_to_scaled (cputime_one_jiffy); +u64 cputime = (__force u64 ) cputime_one_jiffy;u64 *cpustat = kcpustat_this_cpu->cpustat;if (steal_account_process_tick ())return ; + cputime *= ticks; + scaled *= ticks; +if (irqtime_account_hi_update ()) { - cpustat[CPUTIME_IRQ ] += (__force u64 ) cputime_one_jiffy; + cpustat[CPUTIME_IRQ ] += cputime; }else if (irqtime_account_si_update ()) { - cpustat[CPUTIME_SOFTIRQ ] += (__force u64 ) cputime_one_jiffy; + cpustat[CPUTIME_SOFTIRQ ] += cputime; }else if (this_cpu_ksoftirqd () == p) {/* * ksoftirqd time do not get accounted in cpu_softirq_time. * So, we have to handle it separately here. * Also, p->stime needs to be updated for ksoftirqd. */ -__account_system_time (p, cputime_one_jiffy, one_jiffy_scaled, -CPUTIME_SOFTIRQ ); +__account_system_time (p, cputime, scaled,CPUTIME_SOFTIRQ ); }else if (user_tick) { -account_user_time (p, cputime_one_jiffy, one_jiffy_scaled); +account_user_time (p, cputime, scaled); }else if (p == rq->idle) { -account_idle_time (cputime_one_jiffy); +account_idle_time (cputime); }else if (p->flags &PF_VCPU ) {/* System time or guest time */ -account_guest_time (p, cputime_one_jiffy, one_jiffy_scaled); +account_guest_time (p, cputime, scaled); }else { -__account_system_time (p, cputime_one_jiffy, one_jiffy_scaled, -CPUTIME_SYSTEM ); +__account_system_time (p, cputime, scaled,CPUTIME_SYSTEM ); } }static void irqtime_account_idle_ticks (int ticks) { -int i;struct rq *rq =this_rq (); -for (i =0 ; i < ticks; i++) -irqtime_account_process_tick (current,0 , rq); +irqtime_account_process_tick (current,0 , rq, ticks); }#else /* CONFIG_IRQ_TIME_ACCOUNTING */ static inline void irqtime_account_idle_ticks (int ticks) {}static inline void irqtime_account_process_tick (struct task_struct *p,int user_tick, -struct rq *rq) {} +struct rq *rq,int nr_ticks) {}#endif /* CONFIG_IRQ_TIME_ACCOUNTING */ /*
@@ -464,7 +464,7 @@ void account_process_tick(struct task_streturn ;if (sched_clock_irqtime) { -irqtime_account_process_tick (p, user_tick, rq); +irqtime_account_process_tick (p, user_tick, rq,1 );return ; }
Greg Kroah-Hartman
maintainerPATCH 3/40 perf: Prevent false warning in perf_swevent_add
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
commit 39af6b1678afa5880dda7e375cf3f9d395087f6d upstream.
The perf cpu offline callback takes down all cpu context events and releases swhash->swevent_hlist.
This could race with task context software event being just scheduled on this cpu via perf_swevent_add while cpu hotplug code already cleaned up event's data.
The race happens in the gap between the cpu notifier code and the cpu being actually taken down. Note that only cpu ctx events are terminated in the perf cpu hotplug code.
It's easily reproduced with:
$ perf record -e faults perf bench sched pipe
while putting one of the cpus offline:
# echo 0 > /sys/devices/system/cpu/cpu1/online
Console emits following warning:
WARNING: CPU: 1 PID: 2845 at kernel/events/core.c:5672 perf_swevent_add+0x18d/0x1a0() Modules linked in: CPU: 1 PID: 2845 Comm: sched-pipe Tainted: G W 3.14.0+ #256 Hardware name: Intel Corporation Montevina platform/To be filled by O.E.M., BIOS AMVACRB1.86C.0066.B00.0805070703 05/07/2008 0000000000000009 ffff880077233ab8 ffffffff81665a23 0000000000200005 0000000000000000 ffff880077233af8 ffffffff8104732c 0000000000000046 ffff88007467c800 0000000000000002 ffff88007a9cf2a0 0000000000000001 Call Trace: [<ffffffff81665a23>] dump_stack+0x4f/0x7c [<ffffffff8104732c>] warn_slowpath_common+0x8c/0xc0 [<ffffffff8104737a>] warn_slowpath_null+0x1a/0x20 [<ffffffff8110fb3d>] perf_swevent_add+0x18d/0x1a0 [<ffffffff811162ae>] event_sched_in.isra.75+0x9e/0x1f0 [<ffffffff8111646a>] group_sched_in+0x6a/0x1f0 [<ffffffff81083dd5>] ? sched_clock_local+0x25/0xa0 [<ffffffff811167e6>] ctx_sched_in+0x1f6/0x450 [<ffffffff8111757b>] perf_event_sched_in+0x6b/0xa0 [<ffffffff81117a4b>] perf_event_context_sched_in+0x7b/0xc0 [<ffffffff81117ece>] __perf_event_task_sched_in+0x43e/0x460 [<ffffffff81096f1e>] ? put_lock_stats.isra.18+0xe/0x30 [<ffffffff8107b3c8>] finish_task_switch+0xb8/0x100 [<ffffffff8166a7de>] __schedule+0x30e/0xad0 [<ffffffff81172dd2>] ? pipe_read+0x3e2/0x560 [<ffffffff8166b45e>] ? preempt_schedule_irq+0x3e/0x70 [<ffffffff8166b45e>] ? preempt_schedule_irq+0x3e/0x70 [<ffffffff8166b464>] preempt_schedule_irq+0x44/0x70 [<ffffffff816707f0>] retint_kernel+0x20/0x30 [<ffffffff8109e60a>] ? lockdep_sys_exit+0x1a/0x90 [<ffffffff812a4234>] lockdep_sys_exit_thunk+0x35/0x67 [<ffffffff81679321>] ? sysret_check+0x5/0x56
Fixing this by tracking the cpu hotplug state and displaying the WARN only if current cpu is initialized properly.
--- kernel/events/core.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
kernel/events/core.c +12 -1
@@ -5044,6 +5044,9 @@ struct swevent_htable {/* Recursion avoidance in each contexts */ int recursion[PERF_NR_CONTEXTS ]; + +/* Keeps track of cpu being initialized/exited */ +bool online; }; static DEFINE_PER_CPU(struct swevent_htable, swevent_htable);
@@ -5290,8 +5293,14 @@ static int perf_swevent_add(struct perf_ hwc->state = !(flags &PERF_EF_START ); head =find_swevent_head (swhash, event); -if (WARN_ON_ONCE (!head)) +if (!head) { +/* +* We can race with cpu hotplug code. Do not +* WARN if the cpu just got unplugged. +*/ +WARN_ON_ONCE (swhash->online);return -EINVAL ; + }hlist_add_head_rcu (&event->hlist_entry, head);
@@ -7395,6 +7404,7 @@ static void __cpuinit perf_event_init_cpstruct swevent_htable *swhash = &per_cpu (swevent_htable, cpu);mutex_lock (&swhash->hlist_mutex); + swhash->online = true;if (swhash->hlist_refcount >0 ) {struct swevent_hlist *hlist;
@@ -7452,6 +7462,7 @@ static void perf_event_exit_cpu(int cpu)perf_event_exit_cpu_context (cpu);mutex_lock (&swhash->hlist_mutex); + swhash->online = false;swevent_hlist_release (swhash);mutex_unlock (&swhash->hlist_mutex); }
Greg Kroah-Hartman
maintainerPATCH 4/40 perf: Limit perf_event_attr::sample_period to 63 bits
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit 0819b2e30ccb93edf04876237b6205eef84ec8d2 upstream.
Vince reported that using a large sample_period (one with bit 63 set) results in wreckage since while the sample_period is fundamentally unsigned (negative periods don't make sense) the way we implement things very much rely on signed logic.
So limit sample_period to 63 bits to avoid tripping over this.
--- kernel/events/core.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/events/core.c +3 -0
@@ -6590,6 +6590,9 @@ SYSCALL_DEFINE5(perf_event_open,if (attr.freq) {if (attr.sample_freq > sysctl_perf_event_sample_rate)return -EINVAL ; + }else { +if (attr.sample_period & (1ULL <<63 )) +return -EINVAL ; }/*
Greg Kroah-Hartman
maintainerPATCH 5/40 perf: Fix race in removing an event
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit 46ce0fe97a6be7532ce6126bb26ce89fed81528c upstream.
When removing a (sibling) event we do:
raw_spin_lock_irq(&ctx->lock); perf_group_detach(event); raw_spin_unlock_irq(&ctx->lock); <hole> perf_remove_from_context(event); raw_spin_lock_irq(&ctx->lock); ... raw_spin_unlock_irq(&ctx->lock);
Now, assuming the event is a sibling, it will be 'unreachable' for things like ctx_sched_out() because that iterates the groups->siblings, and we just unhooked the sibling.
So, if during <hole> we get ctx_sched_out(), it will miss the event and not call event_sched_out() on it, leaving it programmed on the PMU.
The subsequent perf_remove_from_context() call will find the ctx is inactive and only call list_del_event() to remove the event from all other lists.
Hereafter we can proceed to free the event; while still programmed!
Close this hole by moving perf_group_detach() inside the same ctx->lock region(s) perf_remove_from_context() has.
The condition on inherited events only in __perf_event_exit_task() is likely complete crap because non-inherited events are part of groups too and we're tearing down just the same. But leave that for another patch.
Most-likely-Fixes: e03a9a55b4e ("perf: Change close() semantics for group events")
--- kernel/events/core.c | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-)
kernel/events/core.c +26 -21
@@ -1237,6 +1237,11 @@ group_sched_out(struct perf_event *group cpuctx->exclusive =0 ; } +struct remove_event { +struct perf_event *event; +bool detach_group; +}; +/* * Cross CPU call to remove a performance event *
@@ -1245,12 +1250,15 @@ group_sched_out(struct perf_event *group*/ static int __perf_remove_from_context (void *info) { -struct perf_event *event = info; +struct remove_event *re = info; +struct perf_event *event = re->event;struct perf_event_context *ctx = event->ctx;struct perf_cpu_context *cpuctx =__get_cpu_context (ctx);raw_spin_lock (&ctx->lock);event_sched_out (event, cpuctx, ctx); +if (re->detach_group) +perf_group_detach (event);list_del_event (event, ctx);if (!ctx->nr_events && cpuctx->task_ctx == ctx) { ctx->is_active =0 ;
@@ -1275,10 +1283,14 @@ static int __perf_remove_from_context(vo* When called from perf_event_exit_task, it's OK because the * context has been detached from its task. */ -static void perf_remove_from_context (struct perf_event *event) +static void perf_remove_from_context (struct perf_event *event,bool detach_group) {struct perf_event_context *ctx = event->ctx;struct task_struct *task = ctx->task; +struct remove_event re = { + .event = event, + .detach_group = detach_group, + };lockdep_assert_held (&ctx->mutex);
@@ -1287,12 +1299,12 @@ static void perf_remove_from_context(str* Per cpu events are removed via an smp call and * the removal is always successful. */ -cpu_function_call (event->cpu, __perf_remove_from_context, event); +cpu_function_call (event->cpu, __perf_remove_from_context, &re);return ; } retry: -if (!task_function_call (task, __perf_remove_from_context, event)) +if (!task_function_call (task, __perf_remove_from_context, &re))return ;raw_spin_lock_irq (&ctx->lock);
@@ -1309,6 +1321,8 @@ retry:* Since the task isn't running, its safe to remove the event, us * holding the ctx->lock ensures the task won't get scheduled in. */ +if (detach_group) +perf_group_detach (event);list_del_event (event, ctx);raw_spin_unlock_irq (&ctx->lock); }
@@ -3015,10 +3029,7 @@ int perf_event_release_kernel(struct per* to trigger the AB-BA case. */ mutex_lock_nested (&ctx->mutex,SINGLE_DEPTH_NESTING ); -raw_spin_lock_irq (&ctx->lock); -perf_group_detach (event); -raw_spin_unlock_irq (&ctx->lock); -perf_remove_from_context (event); +perf_remove_from_context (event, true);mutex_unlock (&ctx->mutex);free_event (event);
@@ -6739,7 +6750,7 @@ SYSCALL_DEFINE5(perf_event_open,struct perf_event_context *gctx = group_leader->ctx;mutex_lock (&gctx->mutex); -perf_remove_from_context (group_leader); +perf_remove_from_context (group_leader, false);/* * Removing from the context ends up with disabled
@@ -6749,7 +6760,7 @@ SYSCALL_DEFINE5(perf_event_open,perf_event__state_init (group_leader);list_for_each_entry (sibling, &group_leader->sibling_list, group_entry) { -perf_remove_from_context (sibling); +perf_remove_from_context (sibling, false);perf_event__state_init (sibling);put_ctx (gctx); }
@@ -6879,7 +6890,7 @@ void perf_pmu_migrate_context(struct pmumutex_lock (&src_ctx->mutex);list_for_each_entry_safe (event, tmp, &src_ctx->event_list, event_entry) { -perf_remove_from_context (event); +perf_remove_from_context (event, false);put_ctx (src_ctx);list_add (&event->event_entry, &events); }
@@ -6939,13 +6950,7 @@ __perf_event_exit_task(struct perf_eventstruct perf_event_context *child_ctx, struct task_struct *child) { -if (child_event->parent) { -raw_spin_lock_irq (&child_ctx->lock); -perf_group_detach (child_event); -raw_spin_unlock_irq (&child_ctx->lock); - } - -perf_remove_from_context (child_event); + perf_remove_from_context(child_event, !!child_event->parent);/* * It can happen that the parent exits first, and has events
@@ -7430,14 +7435,14 @@ static void perf_pmu_rotate_stop(structstatic void __perf_event_exit_context (void *__info) { +struct remove_event re = { .detach_group = false };struct perf_event_context *ctx = __info; -struct perf_event *event;perf_pmu_rotate_stop (ctx->pmu);rcu_read_lock (); -list_for_each_entry_rcu (event, &ctx->event_list, event_entry) -__perf_remove_from_context (event); +list_for_each_entry_rcu (re.event, &ctx->event_list, event_entry) +__perf_remove_from_context (&re);rcu_read_unlock (); }
Greg Kroah-Hartman
maintainerPATCH 6/40 perf evsel: Fix printing of perf_event_paranoid message
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Ahern <[email protected]>
commit b69e63a45f2d96a0dfe930ed20385058d4574d2f upstream.
message is currently shown as:
Error:
You may not have permission to collect %sstats. Consider tweaking /proc/sys/kernel/perf_event_paranoid:
Note the %sstats. With patch this becomes:
Error:
You may not have permission to collect stats. Consider tweaking /proc/sys/kernel/perf_event_paranoid:
--- tools/perf/util/evsel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/evsel.c +1 -1
@@ -1514,7 +1514,7 @@ int perf_evsel__open_strerror(struct perswitch (err) {case EPERM :case EACCES : -return scnprintf (msg, size,"%s" , +return scnprintf (msg, size,"You may not have permission to collect %sstats.\n" "Consider tweaking /proc/sys/kernel/perf_event_paranoid:\n" " -1 - Not paranoid at all\n"
Greg Kroah-Hartman
maintainerPATCH 7/40 mm/memory-failure.c: fix memory leak by race between poison and unpoison
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naoya Horiguchi <[email protected]>
commit 3e030ecc0fc7de10fd0da10c1c19939872a31717 upstream.
When a memory error happens on an in-use page or (free and in-use) hugepage, the victim page is isolated with its refcount set to one.
When you try to unpoison it later, unpoison_memory() calls put_page() for it twice in order to bring the page back to free page pool (buddy or free hugepage list). However, if another memory error occurs on the page which we are unpoisoning, memory_failure() returns without releasing the refcount which was incremented in the same call at first, which results in memory leak and unconsistent num_poisoned_pages statistics. This patch fixes it.
--- mm/memory-failure.c | 2 ++ 1 file changed, 2 insertions(+)
mm/memory-failure.c +2 -0
@@ -1153,6 +1153,8 @@ int memory_failure(unsigned long pfn, in*/ if (!PageHWPoison (p)) {printk (KERN_ERR "MCE %#lx: just unpoisoned\n" , pfn); +atomic_long_sub (nr_pages, &num_poisoned_pages); +put_page (hpage); res =0 ; goto out; }
Greg Kroah-Hartman
maintainerPATCH 8/40 Documentation: fix DOCBOOKS=... building
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit e60cbeedc48d80689c249ab5dcc3c31ad0452dea upstream.
Prior to commit 4266129964b8 ("[media] DocBook: Move all media docbook stuff into its own directory") it was possible to build only a single (or more) book(s) by calling, for example
make htmldocs DOCBOOKS=80211.xml
This now fails:
cp: target `.../Documentation/DocBook//media_api' is not a directory
Ignore errors from that copy to make this possible again.
--- Documentation/DocBook/media/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/DocBook/media/Makefile +1 -1
@@ -195,7 +195,7 @@ DVB_DOCUMENTED = \ # install_media_images = \ - $(Q)cp $(OBJIMGFILES) $(MEDIA_SRC_DIR)/v4l/*.svg $(MEDIA_OBJ_DIR)/media_api + $(Q)-cp $(OBJIMGFILES) $(MEDIA_SRC_DIR)/v4l/*.svg $(MEDIA_OBJ_DIR)/media_api $(MEDIA_OBJ_DIR)/%: $(MEDIA_SRC_DIR)/%.b64 $(Q)base64 -d $< >$@
Greg Kroah-Hartman
maintainerPATCH 9/40 hwmon: (ntc_thermistor) Fix dependencies
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean Delvare <[email protected]>
commit 59cf4243e557aa64ab2ef51280454aa1f3828e14 upstream.
In commit 9e8269de, support was added for ntc_thermistor devices being declared in the device tree and implemented on top of IIO. With that change, a dependency was added to the ntc_thermistor driver:
depends on (!OF && !IIO) || (OF && IIO)
This construct has the drawback that the driver can no longer be selected when OF is set and IIO isn't, nor when IIO is set and OF is not. This is a regression for the original users of the driver.
As the new code depends on IIO and is useless without OF, include it only if both are enabled, and set the dependencies accordingly. This is clearer, more simple and more correct.
--- drivers/hwmon/Kconfig | 2 +- drivers/hwmon/ntc_thermistor.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/hwmon/Kconfig +1 -1
@@ -944,7 +944,7 @@ config SENSORS_NCT6775 config SENSORS_NTC_THERMISTOR tristate "NTC thermistor support" - depends on (!OF && !IIO) || (OF && IIO) + depends on !OF || IIO=n || IIO help This driver supports NTC thermistors sensor reading and its interpretation. The driver can also monitor the temperature and
drivers/hwmon/ntc_thermistor.c +3 -1
@@ -141,7 +141,7 @@ struct ntc_data {char name[PLATFORM_NAME_SIZE ]; }; -#ifdef CONFIG_OF +#if defined(CONFIG_OF ) &&IS_ENABLED (CONFIG_IIO )static int ntc_adc_iio_read (struct ntc_thermistor_platform_data *pdata) {struct iio_channel *channel = pdata->chan;
@@ -223,6 +223,8 @@ ntc_thermistor_parse_dt(struct platform_ return NULL; } +#define ntc_match NULL +static void ntc_iio_channel_release (struct ntc_thermistor_platform_data *pdata) { }#endif
Greg Kroah-Hartman
maintainerPATCH 10/40 hwmon: (ntc_thermistor) Fix OF device ID mapping
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean Delvare <[email protected]>
commit ead82d6792ef5c600d535bca6ec50a4da14ff7c7 upstream.
The mapping from OF device IDs to platform device IDs is wrong. TYPE_NCPXXWB473 is 0, TYPE_NCPXXWL333 is 1, so ntc_thermistor_id[TYPE_NCPXXWB473] is { "ncp15wb473", TYPE_NCPXXWB473 } while
ntc_thermistor_id[TYPE_NCPXXWL333] is { "ncp18wb473", TYPE_NCPXXWB473 }.
So the name is wrong for all but the "ntc,ncp15wb473" entry, and the type is wrong for the "ntc,ncp15wl333" entry.
So map the entries by index, it is neither elegant nor robust but at least it is correct.
--- drivers/hwmon/ntc_thermistor.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/hwmon/ntc_thermistor.c +6 -5
@@ -44,6 +44,7 @@ struct ntc_compensation {unsigned int ohm; }; +/* Order matters, ntc_match references the entries by index */ static const struct platform_device_id ntc_thermistor_id[] = { {"ncp15wb473" ,TYPE_NCPXXWB473 }, {"ncp18wb473" ,TYPE_NCPXXWB473 },
@@ -163,15 +164,15 @@ static int ntc_adc_iio_read(struct ntc_tstatic const struct of_device_id ntc_match[] = { { .compatible ="ntc,ncp15wb473" , - .data = &ntc_thermistor_id[TYPE_NCPXXWB473 ] }, + .data = &ntc_thermistor_id[0 ] }, { .compatible ="ntc,ncp18wb473" , - .data = &ntc_thermistor_id[TYPE_NCPXXWB473 ] }, + .data = &ntc_thermistor_id[1 ] }, { .compatible ="ntc,ncp21wb473" , - .data = &ntc_thermistor_id[TYPE_NCPXXWB473 ] }, + .data = &ntc_thermistor_id[2 ] }, { .compatible ="ntc,ncp03wb473" , - .data = &ntc_thermistor_id[TYPE_NCPXXWB473 ] }, + .data = &ntc_thermistor_id[3 ] }, { .compatible ="ntc,ncp15wl333" , - .data = &ntc_thermistor_id[TYPE_NCPXXWL333 ] }, + .data = &ntc_thermistor_id[4 ] }, { }, };MODULE_DEVICE_TABLE (of, ntc_match);
Greg Kroah-Hartman
maintainerPATCH 11/40 drm/gf119-/disp: fix nasty bug which can clobber SOR0s clock setup
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Skeggs <[email protected]>
commit 0f1d360b2ee3a2a0f510d3f1bcd3f5ebe5d41265 upstream.
Fixes a LVDS bleed issue on Lenovo W530 that can occur under a number of circumstances.
--- drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c +1 -1
@@ -679,7 +679,7 @@ exec_clkcmp(struct nv50_disp_priv *priv, }if (outp ==8 ) -return false; +return conf; data =exec_lookup (priv, head, outp, ctrl, dcb, &ver, &hdr, &cnt, &len, &info1);if (data ==0x0000 )
Greg Kroah-Hartman
maintainerPATCH 16/40 ARM: OMAP4: Fix the boot regression with CPU_IDLE enabled
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Santosh Shilimkar <[email protected]>
commit 4b353a706a86598ba47307c47301c3c428b79e09 upstream.
On OMAP4 panda board, there have been several bug reports about boot hang and lock-ups with CPU_IDLE enabled. The root cause of the issue is missing interrupts while in idle state. Commit cb7094e8 {cpuidle / omap4 :
use CPUIDLE_FLAG_TIMER_STOP flag} moved the broadcast notifiers to common code for right reasons but on OMAP4 which suffers from a nasty ROM code bug with GIC, commit ff999b8a {ARM: OMAP4460: Workaround for ROM bug ..}, we loose interrupts which leads to issues like lock-up, hangs etc.
Patch reverts commit cb7094 {cpuidle / omap4 : use CPUIDLE_FLAG_TIMER_STOP flag} and 54769d6 {cpuidle: OMAP4: remove timer broadcast initialization} to avoid the issue. With this change, OMAP4 panda boards, the mentioned issues are getting fixed. We no longer loose interrupts which was the cause of the regression.
--- arch/arm/mach-omap2/cpuidle44xx.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/cpuidle44xx.c +21 -4
@@ -14,6 +14,7 @@#include <linux/cpuidle.h> #include <linux/cpu_pm.h> #include <linux/export.h> +#include <linux/clockchips.h> #include <asm/cpuidle.h> #include <asm/proc-fns.h>
@@ -80,6 +81,7 @@ static int omap_enter_idle_coupled(struc int index) {struct idle_statedata *cx = state_ptr + index; +int cpu_id =smp_processor_id ();/* * CPU0 has to wait and stay ON until CPU1 is OFF state.
@@ -104,6 +106,8 @@ static int omap_enter_idle_coupled(struc } } +clockevents_notify (CLOCK_EVT_NOTIFY_BROADCAST_ENTER , &cpu_id); +/* * Call idle CPU PM enter notifier chain so that * VFP and per CPU interrupt context is saved.
@@ -147,6 +151,8 @@ static int omap_enter_idle_coupled(struc (cx->mpu_logic_state == PWRDM_POWER_OFF))cpu_cluster_pm_exit (); +clockevents_notify (CLOCK_EVT_NOTIFY_BROADCAST_EXIT , &cpu_id); + fail:cpuidle_coupled_parallel_barrier (dev, &abort_barrier); cpu_done[dev->cpu] = false;
@@ -154,6 +160,16 @@ fail:return index; } +/* +* For each cpu, setup the broadcast timer because local timers +* stops for the states above C1. +*/ +static void omap_setup_broadcast_timer (void *arg) +{ +int cpu =smp_processor_id (); +clockevents_notify (CLOCK_EVT_NOTIFY_BROADCAST_ON , &cpu); +} +static struct cpuidle_driver omap4_idle_driver = { .name ="omap4_idle" , .owner =THIS_MODULE ,
@@ -171,8 +187,7 @@ static struct cpuidle_driver omap4_idle_/* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */ .exit_latency = 328 + 440, .target_residency = 960, - .flags =CPUIDLE_FLAG_TIME_VALID |CPUIDLE_FLAG_COUPLED | - CPUIDLE_FLAG_TIMER_STOP, + .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED, .enter = omap_enter_idle_coupled, .name = "C2", .desc = "CPUx OFF, MPUSS CSWR",
@@ -181,8 +196,7 @@ static struct cpuidle_driver omap4_idle_/* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */ .exit_latency = 460 + 518, .target_residency = 1100, - .flags =CPUIDLE_FLAG_TIME_VALID |CPUIDLE_FLAG_COUPLED | - CPUIDLE_FLAG_TIMER_STOP, + .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED, .enter = omap_enter_idle_coupled, .name = "C3", .desc = "CPUx OFF, MPUSS OSWR",
@@ -213,5 +227,8 @@ int __init omap4_idle_init(void)if (!cpu_clkdm[0 ] || !cpu_clkdm[1 ])return -ENODEV ; +/* Configure the broadcast timer on each cpu */ +on_each_cpu (omap_setup_broadcast_timer,NULL ,1 ); +return cpuidle_register (&omap4_idle_driver, cpu_online_mask); }
Greg Kroah-Hartman
maintainerPATCH 17/40 ARM: 8051/1: put_user: fix possible data corruption in put_user
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Ryabinin <[email protected]>
commit 537094b64b229bf3ad146042f83e74cf6abe59df upstream.
According to arm procedure call standart r2 register is call-cloberred. So after the result of x expression was put into r2 any following function call in p may overwrite r2. To fix this, the result of p expression must be saved to the temporary variable before the assigment x expression to __r2.
--- arch/arm/include/asm/uaccess.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/include/asm/uaccess.h +2 -1
@@ -164,8 +164,9 @@ extern int __put_user_8(void *, unsigned#define __put_user_check (x,p) \ ({ \ unsigned long __limit = current_thread_info()->addr_limit - 1; \ + const typeof(*(p)) __user *__tmp_p = (p); \ register const typeof(*(p)) __r2 asm("r2") = (x); \ - register const typeof(*(p)) __user *__p asm("r0") = (p);\ + register const typeof(*(p)) __user *__p asm("r0") = __tmp_p; \ register unsigned long __l asm("r1") = __limit; \ register int __e asm("r0"); \ switch (sizeof(*(__p))) { \
Greg Kroah-Hartman
maintainerPATCH 18/40 dm cache: always split discards on cache block boundaries
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heinz Mauelshagen <[email protected]>
commit f1daa838e861ae1a0fb7cd9721a21258430fcc8c upstream.
The DM cache target cannot cope with discards that span multiple cache blocks, so each discard bio that spans more than one cache block must get split by the DM core.
--- drivers/md/dm-cache-target.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/md/dm-cache-target.c +2 -0
@@ -1954,6 +1954,8 @@ static int cache_create(struct cache_arg ti->num_discard_bios =1 ; ti->discards_supported = true; ti->discard_zeroes_data_unsupported = true; +/* Discard bios must be split on a block boundary */ + ti->split_discard_bios = true; cache->features = ca->features; ti->per_bio_data_size =get_per_bio_data_size (cache);
Greg Kroah-Hartman
maintainerPATCH 19/40 sched: Fix hotplug vs. set_cpus_allowed_ptr()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lai Jiangshan <[email protected]>
commit 6acbfb96976fc3350e30d964acb1dbbdf876d55e upstream.
Lai found that:
WARNING: CPU: 1 PID: 13 at arch/x86/kernel/smp.c:124 native_smp_send_reschedule+0x2d/0x4b() ... migration_cpu_stop+0x1d/0x22
was caused by set_cpus_allowed_ptr() assuming that cpu_active_mask is always a sub-set of cpu_online_mask.
This isn't true since 5fbd036b552f ("sched: Cleanup cpu_active madness").
So set active and online at the same time to avoid this particular problem.
--- kernel/cpu.c | 6 ++++-- kernel/sched/core.c | 1 - 2 files changed, 4 insertions(+), 3 deletions(-)
kernel/cpu.c +4 -2
@@ -698,10 +698,12 @@ void set_cpu_present(unsigned int cpu, bvoid set_cpu_online (unsigned int cpu,bool online) { -if (online) +if (online) {cpumask_set_cpu (cpu,to_cpumask (cpu_online_bits)); -else +cpumask_set_cpu (cpu,to_cpumask (cpu_active_bits)); + }else {cpumask_clear_cpu (cpu,to_cpumask (cpu_online_bits)); + } }void set_cpu_active (unsigned int cpu,bool active)
kernel/sched/core.c +0 -1
@@ -5270,7 +5270,6 @@ static int __cpuinit sched_cpu_active(st unsigned long action, void *hcpu) {switch (action & ~CPU_TASKS_FROZEN ) { -case CPU_STARTING :case CPU_DOWN_FAILED :set_cpu_active ((long )hcpu, true);return NOTIFY_OK ;
Greg Kroah-Hartman
maintainerPATCH 20/40 drm/i915: Only copy back the modified fields to userspace from execbuffer
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit 9aab8bff7aa3bee567213ad3c1fdfb217bb980a2 upstream.
We only want to modifiy a single field in the userspace view of the execbuffer command buffer, so explicitly change that rather than copy everything back again.
This serves two purposes:
1. The single fields are much cheaper to copy (constant size so the copy uses special case code) and much smaller than the whole array.
2. We modify the array for internal use that need to be masked from the user.
Note: We need this backported since without it the next bugfix will blow up when userspace recycles batchbuffers and relocations.
--- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 54 +++++++++++++++++------------ 1 file changed, 32 insertions(+), 22 deletions(-)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +32 -22
@@ -635,9 +635,9 @@ i915_gem_execbuffer_relocate_slow(struct* relocations were valid. */ for (j =0 ; j < exec[i].relocation_count; j++) { -if (copy_to_user (&user_relocs[j].presumed_offset, - &invalid_offset, -sizeof (invalid_offset))) { +if (__copy_to_user (&user_relocs[j].presumed_offset, + &invalid_offset, +sizeof (invalid_offset))) { ret = -EFAULT ;mutex_lock (&dev->struct_mutex); goto err;
@@ -1151,18 +1151,21 @@ i915_gem_execbuffer(struct drm_device *d ret =i915_gem_do_execbuffer (dev, data, file, &exec2, exec2_list);if (!ret) { +struct drm_i915_gem_exec_object __user *user_exec_list = +to_user_ptr (args->buffers_ptr); +/* Copy the new buffer offsets back to the user's exec list. */ -for (i =0 ; i < args->buffer_count; i++) - exec_list[i].offset = exec2_list[i].offset; -/* ... and back out to userspace */ - ret =copy_to_user (to_user_ptr (args->buffers_ptr), - exec_list, -sizeof (*exec_list) * args->buffer_count); -if (ret) { - ret = -EFAULT ; -DRM_DEBUG ("failed to copy %d exec entries " -"back to user (%d)\n" , - args->buffer_count, ret); +for (i =0 ; i < args->buffer_count; i++) { + ret =__copy_to_user (&user_exec_list[i].offset, + &exec2_list[i].offset, +sizeof (user_exec_list[i].offset)); +if (ret) { + ret = -EFAULT ; +DRM_DEBUG ("failed to copy %d exec entries " +"back to user (%d)\n" , + args->buffer_count, ret); +break ; + } } }
@@ -1208,14 +1211,21 @@ i915_gem_execbuffer2(struct drm_device * ret =i915_gem_do_execbuffer (dev, data, file, args, exec2_list);if (!ret) {/* Copy the new buffer offsets back to the user's exec list. */ - ret =copy_to_user (to_user_ptr (args->buffers_ptr), - exec2_list, -sizeof (*exec2_list) * args->buffer_count); -if (ret) { - ret = -EFAULT ; -DRM_DEBUG ("failed to copy %d exec entries " -"back to user (%d)\n" , - args->buffer_count, ret); +struct drm_i915_gem_exec_object2 *user_exec_list = +to_user_ptr (args->buffers_ptr); +int i; + +for (i =0 ; i < args->buffer_count; i++) { + ret =__copy_to_user (&user_exec_list[i].offset, + &exec2_list[i].offset, +sizeof (user_exec_list[i].offset)); +if (ret) { + ret = -EFAULT ; +DRM_DEBUG ("failed to copy %d exec entries " +"back to user\n" , + args->buffer_count); +break ; + } } }
Greg Kroah-Hartman
maintainerPATCH 21/40 md: always set MD_RECOVERY_INTR when aborting a reshape or other "resync".
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit 3991b31ea072b070081ca3bfa860a077eda67de5 upstream.
If mddev->ro is set, md_to_sync will (correctly) abort. However in that case MD_RECOVERY_INTR isn't set.
If a RESHAPE had been requested, then ->finish_reshape() will be called and it will think the reshape was successful even though nothing happened.
Normally a resync will not be requested if ->ro is set, but if an array is stopped while a reshape is on-going, then when the array is started, the reshape will be restarted. If the array is also set read-only at this point, the reshape will instantly appear to success, resulting in data corruption.
Consequently, this patch is suitable for any -stable kernel.
--- drivers/md/md.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/md.c +3 -1
@@ -7338,8 +7338,10 @@ void md_do_sync(struct md_thread *thread/* just incase thread restarts... */ if (test_bit (MD_RECOVERY_DONE , &mddev->recovery))return ; -if (mddev->ro)/* never try to sync a read-only array */ +if (mddev->ro) {/* never try to sync a read-only array */ +set_bit (MD_RECOVERY_INTR , &mddev->recovery);return ; + }if (test_bit (MD_RECOVERY_SYNC , &mddev->recovery)) {if (test_bit (MD_RECOVERY_CHECK , &mddev->recovery))
Greg Kroah-Hartman
maintainerPATCH 22/40 md: always set MD_RECOVERY_INTR when interrupting a reshape thread.
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit 2ac295a544dcae9299cba13ce250419117ae7fd1 upstream.
Commit 8313b8e57f55b15e5b7f7fc5d1630bbf686a9a97
md: fix problem when adding device to read-only array with bitmap.
added a called to md_reap_sync_thread() which cause a reshape thread to be interrupted (in particular, it could cause md_thread() to never even call md_do_sync()).
However it didn't set MD_RECOVERY_INTR so ->finish_reshape() would not know that the reshape didn't complete.
This only happens when mddev->ro is set and normally reshape threads don't run in that situation. But raid5 and raid10 can start a reshape thread during "run" is the array is in the middle of a reshape. They do this even if ->ro is set.
So it is best to set MD_RECOVERY_INTR before abortingg the sync thread, just in case.
Though it rare for this to trigger a problem it can cause data corruption because the reshape isn't finished properly.
So it is suitable for any stable which the offending commit was applied to. (3.2 or later)
--- drivers/md/md.c | 1 + 1 file changed, 1 insertion(+)
drivers/md/md.c +1 -0
@@ -7790,6 +7790,7 @@ void md_check_recovery(struct mddev *mdd/* There is no thread, but we need to call * ->spare_active and clear saved_raid_disk */ +set_bit (MD_RECOVERY_INTR , &mddev->recovery);md_reap_sync_thread (mddev);clear_bit (MD_RECOVERY_NEEDED , &mddev->recovery); goto unlock;
Greg Kroah-Hartman
maintainerPATCH 24/40 Staging: speakup: Move pasting into a work item
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
commit d7500135802ca55b3f4e01a16544e8b34082f8c3 upstream.
Input is handled in softirq context, but when pasting we may need to sleep. speakup_paste_selection() currently tries to bodge this by busy-waiting if in_atomic(), but that doesn't help because the ldisc may also sleep.
For bonus breakage, speakup_paste_selection() changes the state of current, even though it's not running in process context.
Move it into a work item and make sure to cancel it on exit.
References: https://bugs.debian.org/735202
References: https://bugs.debian.org/744015
--- drivers/staging/speakup/main.c | 1 drivers/staging/speakup/selection.c | 40 +++++++++++++++++++++++++++++------- drivers/staging/speakup/speakup.h | 1 3 files changed, 35 insertions(+), 7 deletions(-)
drivers/staging/speakup/main.c +1 -0
@@ -2219,6 +2219,7 @@ static void __exit speakup_exit(void)unregister_keyboard_notifier (&keyboard_notifier_block);unregister_vt_notifier (&vt_notifier_block);speakup_unregister_devsynth (); +speakup_cancel_paste ();del_timer (&cursor_timer);kthread_stop (speakup_task); speakup_task =NULL ;
drivers/staging/speakup/selection.c +33 -7
@@ -4,6 +4,8 @@#include <linux/sched.h> #include <linux/device.h> /* for dev_warn */ #include <linux/selection.h> +#include <linux/workqueue.h> +#include <asm/cmpxchg.h> #include "speakup.h"
@@ -121,20 +123,24 @@ int speakup_set_selection(struct tty_strreturn 0 ; } -/* TODO: move to some helper thread, probably. That'd fix having to check for -* in_atomic(). */ -int speakup_paste_selection (struct tty_struct *tty) -{ +struct speakup_paste_work { +struct work_struct work; +struct tty_struct *tty; +}; + +static void __speakup_paste_selection (struct work_struct *work) +{ +struct speakup_paste_work *spw = + container_of(work, struct speakup_paste_work, work); +struct tty_struct *tty =xchg (&spw->tty,NULL );struct vc_data *vc = (struct vc_data *) tty->driver_data;int pasted =0 , count;DECLARE_WAITQUEUE (wait, current); +add_wait_queue (&vc->paste_wait, &wait);while (sel_buffer && sel_buffer_lth > pasted) {set_current_state (TASK_INTERRUPTIBLE );if (test_bit (TTY_THROTTLED , &tty->flags)) { -if (in_atomic ()) -/* if we are in an interrupt handler, abort */ -break ;schedule ();continue ; }
@@ -146,6 +152,26 @@ int speakup_paste_selection(struct tty_s }remove_wait_queue (&vc->paste_wait, &wait); current->state =TASK_RUNNING ; +tty_kref_put (tty); +} + +static struct speakup_paste_work speakup_paste_work = { + .work =__WORK_INITIALIZER (speakup_paste_work.work, + __speakup_paste_selection) +}; + +int speakup_paste_selection (struct tty_struct *tty) +{ +if (cmpxchg (&speakup_paste_work.tty,NULL , tty) !=NULL ) +return -EBUSY ; + +tty_kref_get (tty); +schedule_work_on (WORK_CPU_UNBOUND , &speakup_paste_work.work);return 0 ; } +void speakup_cancel_paste (void ) +{ +cancel_work_sync (&speakup_paste_work.work); +tty_kref_put (speakup_paste_work.tty); +}
drivers/staging/speakup/speakup.h +1 -0
@@ -77,6 +77,7 @@ extern void synth_buffer_clear(void);extern void speakup_clear_selection (void );extern int speakup_set_selection (struct tty_struct *tty);extern int speakup_paste_selection (struct tty_struct *tty); +extern void speakup_cancel_paste (void );extern void speakup_register_devsynth (void );extern void speakup_unregister_devsynth (void );extern void synth_write (const char *buf,size_t count);
Greg Kroah-Hartman
maintainerPATCH 25/40 staging: comedi: ni_daq_700: add mux settling delay
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit ffed54dced86723f352323f15789d9ad6bee25e1 upstream.
I got a patch from the original author, Fred Brooks, to add a small settling delay after setting the AI channel multiplexor. The lack of delay resulted in unstable or scrambled data on faster processors.
--- drivers/staging/comedi/drivers/ni_daq_700.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/comedi/drivers/ni_daq_700.c +2 -0
@@ -127,6 +127,8 @@ static int daq700_ai_rinsn(struct comedi/* write channel to multiplexer */ /* set mask scan bit high to disable scanning */ outb (chan |0x80 , dev->iobase +CMD_R1 ); +/* mux needs 2us to really settle [Fred Brooks]. */ +udelay (2 );/* convert n samples */ for (n =0 ; n < insn->n; n++) {
Greg Kroah-Hartman
maintainerPATCH 26/40 ALSA: hda/realtek - Correction of fixup codes for PB V7900 laptop
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ronan Marquet <[email protected]>
commit e30cf2d2bed3aed74a651c64de323ba26e4ff7d0 upstream.
Correcion of wrong fixup entries add in commit ca8f0424 to replace static model quirk for PB V7900 laptop (will model).
[note: the removal of ALC260_FIXUP_HP_PIN_0F chain is also needed as a
part of the fix; otherwise the pin is set up wrongly as a headphone, and user-space (PulseAudio) may be wrongly trying to detect the jack state -- tiwai]
--- sound/pci/hda/patch_realtek.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
sound/pci/hda/patch_realtek.c +2 -4
@@ -1590,12 +1590,10 @@ static const struct hda_fixup alc260_fix [ALC260_FIXUP_COEF] = { .type = HDA_FIXUP_VERBS, .v.verbs = (const struct hda_verb []) { - {0x20 ,AC_VERB_SET_COEF_INDEX ,0x07 }, - {0x20 ,AC_VERB_SET_PROC_COEF ,0x3040 }, + {0x1a ,AC_VERB_SET_COEF_INDEX ,0x07 }, + {0x1a ,AC_VERB_SET_PROC_COEF ,0x3040 }, { } }, - .chained = true, - .chain_id = ALC260_FIXUP_HP_PIN_0F, }, [ALC260_FIXUP_GPIO1] = { .type = HDA_FIXUP_VERBS,
Greg Kroah-Hartman
maintainerPATCH 27/40 ALSA: hda/realtek - Fix COEF widget NID for ALC260 replacer fixup
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 192a98e280e560510a62aca8cfa83b4ae7c095bb upstream.
The conversion to a fixup table for Replacer model with ALC260 in commit 20f7d928 took the wrong widget NID for COEF setups. Namely, NID 0x1a should have been used instead of NID 0x20, which is the common node for all Realtek codecs but ALC260.
--- sound/pci/hda/patch_realtek.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/hda/patch_realtek.c +2 -2
@@ -1608,8 +1608,8 @@ static const struct hda_fixup alc260_fix [ALC260_FIXUP_REPLACER] = { .type = HDA_FIXUP_VERBS, .v.verbs = (const struct hda_verb []) { - {0x20 ,AC_VERB_SET_COEF_INDEX ,0x07 }, - {0x20 ,AC_VERB_SET_PROC_COEF ,0x3050 }, + {0x1a ,AC_VERB_SET_COEF_INDEX ,0x07 }, + {0x1a ,AC_VERB_SET_PROC_COEF ,0x3050 }, { } }, .chained = true,
Greg Kroah-Hartman
maintainerPATCH 28/40 USB: ftdi_sio: add NovaTech OrionLXm product ID
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: George McCollister <[email protected]>
commit d0839d757e6294921c31b1c4ca4f1dcc5df63bcd upstream.
The NovaTech OrionLXm uses an onboard FTDI serial converter for JTAG and console access.
Here is the lsusb output:
Bus 004 Device 123: ID 0403:7c90 Future Technology Devices International, Ltd
--- drivers/usb/serial/ftdi_sio.c | 2 ++ drivers/usb/serial/ftdi_sio_ids.h | 5 +++++ 2 files changed, 7 insertions(+)
drivers/usb/serial/ftdi_sio.c +2 -0
@@ -583,6 +583,8 @@ static struct usb_device_id id_table_com { USB_DEVICE(FTDI_VID, FTDI_TAVIR_STK500_PID) }, { USB_DEVICE(FTDI_VID, FTDI_TIAO_UMPA_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, + { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLXM_PID), + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },/* * ELV devices: */
drivers/usb/serial/ftdi_sio_ids.h +5 -0
@@ -538,6 +538,11 @@*/ #define FTDI_TIAO_UMPA_PID 0x8a98/* TIAO/DIYGADGET USB Multi-Protocol Adapter */ +/* +* NovaTech product ids (FTDI_VID) +*/ +#define FTDI_NT_ORIONLXM_PID 0x7c90/* OrionLXm Substation Automation Platform */ +/********************************/ /** third-party VID/PID combos **/
Greg Kroah-Hartman
maintainerPATCH 31/40 USB: serial: option: add support for Novatel E371 PCIe card
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexej Starschenko <[email protected]>
commit 8a61ba3a47ac39f660702aa66a172185dd605a86 upstream.
Adds product ID for the Novatel E371 PCI Express Mini Card.
$ lsusb Bus 001 Device 024: ID 1410:9011 Novatel Wireless
$ usb-devices T: Bus=01 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#= 24 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=1410 ProdID=9011 Rev=00.03 S: Manufacturer=Novatel Wireless, Inc. S: Product=Novatel Wireless HSPA S: SerialNumber=012773002115811 C: #Ifs= 6 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 6 Alt= 0 #EPs= 1 Cls=02(commc) Sub=06 Prot=00 Driver=cdc_ether I: If#= 7 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
Tested with kernel 3.2.0.
--- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/option.c +2 -0
@@ -161,6 +161,7 @@ static void option_instat_callback(struc#define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED 0x9000#define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_HIGHSPEED 0x9001#define NOVATELWIRELESS_PRODUCT_E362 0x9010 +#define NOVATELWIRELESS_PRODUCT_E371 0x9011#define NOVATELWIRELESS_PRODUCT_G2 0xA010#define NOVATELWIRELESS_PRODUCT_MC551 0xB001
@@ -1012,6 +1013,7 @@ static const struct usb_device_id option/* Novatel Ovation MC551 a.k.a. Verizon USB551L */ { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC551, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_E362, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_E371, 0xff, 0xff, 0xff) }, { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) }, { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) },
Greg Kroah-Hartman
maintainerPATCH 32/40 USB: io_ti: fix firmware download on big-endian machines (part 2)
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit c03890ff5e24a4bf59059f2d179f427559b7330a upstream.
A recent patch that purported to fix firmware download on big-endian machines failed to add the corresponding sparse annotation to the i2c-header. This was reported by the kbuild test robot.
Adding the appropriate annotation revealed another endianess bug related to the i2c-header Size-field in a code path that is exercised when the firmware is actually being downloaded (and not just verified and left untouched unless older than the firmware at hand).
This patch adds the required sparse annotation to the i2c-header and makes sure that the Size-field is sent in little-endian byte order during firmware download also on big-endian machines.
Note that this patch is only compile-tested, but that there is no functional change for little-endian systems.
--- drivers/usb/serial/io_ti.c | 2 +- drivers/usb/serial/io_usbvend.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/serial/io_ti.c +1 -1
@@ -835,7 +835,7 @@ static int build_i2c_fw_hdr(__u8 *header firmware_rec = (struct ti_i2c_firmware_rec *)i2c_header->Data; i2c_header->Type =I2C_DESC_TYPE_FIRMWARE_BLANK ; - i2c_header->Size = (__u16 )buffer_size; + i2c_header->Size =cpu_to_le16 (buffer_size); i2c_header->CheckSum = cs; firmware_rec->Ver_Major = OperationalMajorVersion; firmware_rec->Ver_Minor = OperationalMinorVersion;
drivers/usb/serial/io_usbvend.h +1 -1
@@ -594,7 +594,7 @@ struct edge_boot_descriptor {struct ti_i2c_desc {__u8 Type;// Type of descriptor -__u16 Size;// Size of data only not including header +__le16 Size;// Size of data only not including header __u8 CheckSum;// Checksum (8 bit sum of data only) __u8 Data[0 ];// Data starts here } __attribute__((packed));
Greg Kroah-Hartman
maintainerPATCH 33/40 USB: Avoid runtime suspend loops for HCDs that cant handle suspend/resume
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 8ef42ddd9a53b73e6fc3934278710c27f80f324f upstream.
Not all host controller drivers have bus-suspend and bus-resume methods. When one doesn't, it will cause problems if runtime PM is enabled in the kernel. The PM core will attempt to suspend the controller's root hub, the suspend will fail because there is no bus-suspend routine, and a -EBUSY error code will be returned to the PM core. This will cause the suspend attempt to be repeated shortly thereafter, in a never-ending loop.
Part of the problem is that the original error code -ENOENT gets changed to -EBUSY in usb_runtime_suspend(), on the grounds that the PM core will interpret -ENOENT as meaning that the root hub has gotten into a runtime-PM error state. While this change is appropriate for real USB devices, it's not such a good idea for a root hub. In fact, considering the root hub to be in a runtime-PM error state would not be far from the truth. Therefore this patch updates usb_runtime_suspend() so that it adjusts error codes only for non-root-hub devices.
Furthermore, the patch attempts to prevent the problem from occurring in the first place by not enabling runtime PM by default for root hubs whose host controller driver doesn't have bus_suspend and bus_resume methods.
--- drivers/usb/core/driver.c | 9 ++++++--- drivers/usb/core/hub.c | 15 +++++++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-)
drivers/usb/core/driver.c +6 -3
@@ -1754,10 +1754,13 @@ int usb_runtime_suspend(struct device *dif (status == -EAGAIN || status == -EBUSY )usb_mark_last_busy (udev); -/* The PM core reacts badly unless the return code is 0, -* -EAGAIN, or -EBUSY, so always return -EBUSY on an error. +/* +* The PM core reacts badly unless the return code is 0, +* -EAGAIN, or -EBUSY, so always return -EBUSY on an error +* (except for root hubs, because they don't suspend through +* an upstream port like other USB devices). */ -if (status !=0 ) +if (status !=0 && udev->parent)return -EBUSY ;return status; }
drivers/usb/core/hub.c +13 -2
@@ -1683,8 +1683,19 @@ static int hub_probe(struct usb_interfac*/ pm_runtime_set_autosuspend_delay (&hdev->dev,0 ); -/* Hubs have proper suspend/resume support. */ -usb_enable_autosuspend (hdev); +/* +* Hubs have proper suspend/resume support, except for root hubs +* where the controller driver doesn't have bus_suspend and +* bus_resume methods. +*/ +if (hdev->parent) {/* normal device */ +usb_enable_autosuspend (hdev); + }else {/* root hub */ +const struct hc_driver *drv =bus_to_hcd (hdev->bus)->driver; + +if (drv->bus_suspend && drv->bus_resume) +usb_enable_autosuspend (hdev); + }if (hdev->level ==MAX_TOPO_LEVEL ) { dev_err(&intf->dev,
Greg Kroah-Hartman
maintainerPATCH 34/40 mm: rmap: fix use-after-free in __put_anon_vma
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Ryabinin <[email protected]>
commit 624483f3ea82598ab0f62f1bdb9177f531ab1892 upstream.
While working address sanitizer for kernel I've discovered use-after-free bug in __put_anon_vma.
For the last anon_vma, anon_vma->root freed before child anon_vma. Later in anon_vma_free(anon_vma) we are referencing to already freed anon_vma->root to check rwsem.
This fixes it by freeing the child anon_vma before freeing anon_vma->root.
--- mm/rmap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
mm/rmap.c +1 -2
@@ -1675,10 +1675,9 @@ void __put_anon_vma(struct anon_vma *ano {struct anon_vma *root = anon_vma->root; +anon_vma_free (anon_vma);if (root != anon_vma &&atomic_dec_and_test (&root->refcount))anon_vma_free (root); - -anon_vma_free (anon_vma); }#ifdef CONFIG_MIGRATION
Greg Kroah-Hartman
maintainerPATCH 35/40 iser-target: Add missing target_put_sess_cmd for ImmedateData failure
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit 6cc44a6fb46e1ecc1c28125aa8fa34d317aa9ea7 upstream.
This patch addresses a bug where an early exception for SCSI WRITE with ImmediateData=Yes was missing the target_put_sess_cmd() call to drop the extra se_cmd->cmd_kref reference obtained during the normal iscsit_setup_scsi_cmd() codepath execution.
This bug was manifesting itself during session shutdown within isert_cq_rx_comp_err() where target_wait_for_sess_cmds() would end up waiting indefinately for the last se_cmd->cmd_kref put to occur for the failed SCSI WRITE + ImmediateData descriptors.
This fix follows what traditional iscsi-target code already does for the same failure case within iscsit_get_immediate_data().
--- drivers/infiniband/ulp/isert/ib_isert.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/ulp/isert/ib_isert.c +2 -0
@@ -965,6 +965,8 @@ sequence_cmd:if (!rc && dump_payload == false && unsol_data)iscsit_set_unsoliticed_dataout (cmd); +else if (dump_payload && imm_data) +target_put_sess_cmd (conn->sess->se_sess, &cmd->se_cmd);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 36/40 perf: Drop sample rate when sampling is too slow
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Hansen <[email protected]>
commit 14c63f17b1fde5a575a28e96547a22b451c71fb5 upstream.
This patch keeps track of how long perf's NMI handler is taking, and also calculates how many samples perf can take a second. If the sample length times the expected max number of samples exceeds a configurable threshold, it drops the sample rate.
This way, we don't have a runaway sampling process eating up the CPU.
This patch can tend to drop the sample rate down to level where perf doesn't work very well. *BUT* the alternative is that my system hangs because it spends all of its time handling NMIs.
I'll take a busted performance tool over an entire system that's busted and undebuggable any day.
BTW, my suspicion is that there's still an underlying bug here. Using the HPET instead of the TSC is definitely a contributing factor, but I suspect there are some other things going on. But, I can't go dig down on a bug like that with my machine hanging all the time.
--- Documentation/sysctl/kernel.txt | 26 +++++++++++ arch/x86/kernel/cpu/perf_event.c | 12 ++++- include/linux/perf_event.h | 7 ++ kernel/events/core.c | 92 +++++++++++++++++++++++++++++++++++++-- kernel/sysctl.c | 9 +++ 5 files changed, 141 insertions(+), 5 deletions(-)
Documentation/sysctl/kernel.txt +26 -0
@@ -438,6 +438,32 @@ This file shows up if CONFIG_DEBUG_STACK ============================================================== +perf_cpu_time_max_percent: + +Hints to the kernel how much CPU time it should be allowed to +use to handle perf sampling events. If the perf subsystem +is informed that its samples are exceeding this limit, it +will drop its sampling frequency to attempt to reduce its CPU +usage. + +Some perf sampling happens in NMIs. If these samples +unexpectedly take too long to execute, the NMIs can become +stacked up next to each other so much that nothing else is +allowed to execute. + +0: disable the mechanism. Do not monitor or correct perf's + sampling rate no matter how CPU time it takes. + +1-100: attempt to throttle perf's sample rate to this + percentage of CPU. Note: the kernel calculates an + "expected" length of each sample event. 100 here means + 100% of that expected length. Even if this is set to + 100, you may still see sample throttling if this + length is exceeded. Set to 0 if you truly do not care + how much CPU is consumed. + +============================================================== + pid_max:
arch/x86/kernel/cpu/perf_event.c +11 -1
@@ -1252,10 +1252,20 @@ void perf_events_lapic_init(void)static int __kprobes perf_event_nmi_handler (unsigned int cmd,struct pt_regs *regs) { +int ret; +u64 start_clock; +u64 finish_clock; +if (!atomic_read (&active_events))return NMI_DONE ; -return x86_pmu.handle_irq (regs); + start_clock =local_clock (); + ret = x86_pmu.handle_irq (regs); + finish_clock =local_clock (); + +perf_sample_event_took (finish_clock - start_clock); + +return ret; }struct event_constraint emptyconstraint;
include/linux/perf_event.h +7 -0
@@ -695,10 +695,17 @@ static inline void perf_callchain_store(extern int sysctl_perf_event_paranoid;extern int sysctl_perf_event_mlock;extern int sysctl_perf_event_sample_rate; +extern int sysctl_perf_cpu_time_max_percent; + +extern void perf_sample_event_took (u64 sample_len_ns);extern int perf_proc_update_handler (struct ctl_table *table,int write,void __user *buffer,size_t *lenp,loff_t *ppos); +extern int perf_cpu_time_max_percent_handler (struct ctl_table *table,int write, +void __user *buffer,size_t *lenp, +loff_t *ppos); +static inline bool perf_paranoid_tracepoint_raw (void ) {
kernel/events/core.c +88 -4
108 lines not on this page · raw message
kernel/sysctl.c +9 -0
@@ -1050,6 +1050,15 @@ static struct ctl_table kern_table[] = { .mode = 0644, .proc_handler = perf_proc_update_handler, }, + { + .procname = "perf_cpu_time_max_percent", + .data = &sysctl_perf_cpu_time_max_percent, + .maxlen = sizeof(sysctl_perf_cpu_time_max_percent), + .mode = 0644, + .proc_handler = perf_cpu_time_max_percent_handler, + .extra1 = &zero, + .extra2 = &one_hundred, + },#endif #ifdef CONFIG_KMEMCHECK {
Greg Kroah-Hartman
maintainerPATCH 37/40 perf: Fix interrupt handler timing harness
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephane Eranian <[email protected]>
commit e5302920da9ef23f9d19d4e9ac85704cc25bee7a upstream.
This patch fixes a serious bug in:
14c63f17b1fd perf: Drop sample rate when sampling is too slow
There was an misunderstanding on the API of the do_div() macro. It returns the remainder of the division and this was not what the function expected leading to disabling the interrupt latency watchdog.
This patch also remove a duplicate assignment in perf_sample_event_took().
--- kernel/events/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/events/core.c +2 -2
@@ -182,7 +182,7 @@ void update_perf_cpu_limits(void)u64 tmp = perf_sample_period_ns; tmp *= sysctl_perf_cpu_time_max_percent; - tmp =do_div (tmp,100 ); +do_div (tmp,100 );atomic_set (&perf_sample_allowed_ns, tmp); }
@@ -230,7 +230,7 @@ DEFINE_PER_CPU(u64, running_sample_lengtvoid perf_sample_event_took (u64 sample_len_ns) {u64 avg_local_sample_len; -u64 local_samples_len =__get_cpu_var (running_sample_length); +u64 local_samples_len;if (atomic_read (&perf_sample_allowed_ns) ==0 )return ;
Greg Kroah-Hartman
maintainerPATCH 38/40 perf: Enforce 1 as lower limit for perf_event_max_sample_rate
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Knut Petersen <[email protected]>
commit 723478c8a471403c53cf144999701f6e0c4bbd11 upstream.
/proc/sys/kernel/perf_event_max_sample_rate will accept negative values as well as 0.
Negative values are unreasonable, and 0 causes a divide by zero exception in perf_proc_update_handler.
This patch enforces a lower limit of 1.
--- kernel/events/core.c | 2 +- kernel/sysctl.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
kernel/events/core.c +1 -1
@@ -190,7 +190,7 @@ int perf_proc_update_handler(struct ctl_ void __user *buffer, size_t *lenp, loff_t *ppos) { - int ret = proc_dointvec(table, write, buffer, lenp, ppos); + int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);if (ret || !write)return ret;
kernel/sysctl.c +1 -0
@@ -1049,6 +1049,7 @@ static struct ctl_table kern_table[] = { .maxlen = sizeof(sysctl_perf_event_sample_rate), .mode = 0644, .proc_handler = perf_proc_update_handler, + .extra1 = &one, }, { .procname = "perf_cpu_time_max_percent",
Greg Kroah-Hartman
maintainerPATCH 39/40 ARM: perf: hook up perf_sample_event_took around pmu irq handling
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 5f5092e72cc25a6a5785308270e0085b2b2772cc upstream.
Since we indirect all of our PMU IRQ handling through a dispatcher, it's trivial to hook up perf_sample_event_took to prevent applications such as oprofile from generating interrupt storms due to an unrealisticly low sample period.
--- arch/arm/kernel/perf_event.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
arch/arm/kernel/perf_event.c +9 -2
@@ -303,11 +303,18 @@ static irqreturn_t armpmu_dispatch_irq(istruct arm_pmu *armpmu = (struct arm_pmu *) dev;struct platform_device *plat_device = armpmu->plat_device;struct arm_pmu_platdata *plat =dev_get_platdata (&plat_device->dev); +int ret; +u64 start_clock, finish_clock; + start_clock =sched_clock ();if (plat && plat->handle_irq) -return plat->handle_irq (irq, dev, armpmu->handle_irq); + ret = plat->handle_irq (irq, dev, armpmu->handle_irq);else -return armpmu->handle_irq (irq, dev); + ret = armpmu->handle_irq (irq, dev); + finish_clock =sched_clock (); + +perf_sample_event_took (finish_clock - start_clock); +return ret; } static void
Greg Kroah-Hartman
maintainerPATCH 40/40 netfilter: Fix potential use after free in ip6_route_me_harder()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Popovich <[email protected]>
commit a8951d5814e1373807a94f79f7ccec7041325470 upstream.
Dst is released one line before we access it again with dst->error.
ip6_route_me_harder()
--- net/ipv6/netfilter.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/ipv6/netfilter.c +4 -2
@@ -30,13 +30,15 @@ int ip6_route_me_harder(struct sk_buff * .daddr = iph->daddr, .saddr = iph->saddr, }; +int err; dst =ip6_route_output (net, skb->sk, &fl6); -if (dst->error) { + err = dst->error; +if (err) {IP6_INC_STATS (net,ip6_dst_idev (dst),IPSTATS_MIB_OUTNOROUTES );LIMIT_NETDEBUG (KERN_DEBUG "ip6_route_me_harder: No more route.\n" );dst_release (dst); -return dst->error; +return err; }/* Drop old route. */
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.43 release. There are 40 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed Jun 11 22:48:25 UTC 2014. Anything received after that time might be too late.
Build results:
total: 143 pass: 136 skipped: 6 fail: 1
Qemu tests all passed.
Results are as expected.
Details are available at http://server.roeck-us.net:8010/builders.
Guenter