--- /dev/null
+From ba2d8ce9db0a61505362bb17b8899df3d3326146 Mon Sep 17 00:00:00 2001
+From: Dan Williams <dcbw@redhat.com>
+Date: Thu, 8 Nov 2012 12:47:41 -0600
+Subject: cdc-acm: implement TIOCSSERIAL to avoid blocking close(2)
+
+From: Dan Williams <dcbw@redhat.com>
+
+commit ba2d8ce9db0a61505362bb17b8899df3d3326146 upstream.
+
+Some devices (ex Nokia C7) simply don't respond at all when data is sent
+to some of their USB interfaces. The data gets stuck in the TTYs queue
+and sits there until close(2), which them blocks because closing_wait
+defaults to 30 seconds (even though the fd is O_NONBLOCK). This is
+rarely desired. Implement the standard mechanism to adjust closing_wait
+and let applications handle it how they want to.
+
+See also 02303f73373aa1da19dbec510ec5a4e2576f9610 for usb_wwan.c.
+
+Signed-off-by: Dan Williams <dcbw@redhat.com>
+Acked-by: Oliver Neukum <oneukum@suse.de>
+Tested-by: Aleksander Morgado <aleksander@gnu.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/class/cdc-acm.c | 38 ++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 38 insertions(+)
+
+--- a/drivers/usb/class/cdc-acm.c
++++ b/drivers/usb/class/cdc-acm.c
+@@ -788,6 +788,10 @@ static int get_serial_info(struct acm *a
+ tmp.flags = ASYNC_LOW_LATENCY;
+ tmp.xmit_fifo_size = acm->writesize;
+ tmp.baud_base = le32_to_cpu(acm->line.dwDTERate);
++ tmp.close_delay = acm->port.close_delay / 10;
++ tmp.closing_wait = acm->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ?
++ ASYNC_CLOSING_WAIT_NONE :
++ acm->port.closing_wait / 10;
+
+ if (copy_to_user(info, &tmp, sizeof(tmp)))
+ return -EFAULT;
+@@ -795,6 +799,37 @@ static int get_serial_info(struct acm *a
+ return 0;
+ }
+
++static int set_serial_info(struct acm *acm,
++ struct serial_struct __user *newinfo)
++{
++ struct serial_struct new_serial;
++ unsigned int closing_wait, close_delay;
++ int retval = 0;
++
++ if (copy_from_user(&new_serial, newinfo, sizeof(new_serial)))
++ return -EFAULT;
++
++ close_delay = new_serial.close_delay * 10;
++ closing_wait = new_serial.closing_wait == ASYNC_CLOSING_WAIT_NONE ?
++ ASYNC_CLOSING_WAIT_NONE : new_serial.closing_wait * 10;
++
++ mutex_lock(&acm->port.mutex);
++
++ if (!capable(CAP_SYS_ADMIN)) {
++ if ((close_delay != acm->port.close_delay) ||
++ (closing_wait != acm->port.closing_wait))
++ retval = -EPERM;
++ else
++ retval = -EOPNOTSUPP;
++ } else {
++ acm->port.close_delay = close_delay;
++ acm->port.closing_wait = closing_wait;
++ }
++
++ mutex_unlock(&acm->port.mutex);
++ return retval;
++}
++
+ static int acm_tty_ioctl(struct tty_struct *tty,
+ unsigned int cmd, unsigned long arg)
+ {
+@@ -805,6 +840,9 @@ static int acm_tty_ioctl(struct tty_stru
+ case TIOCGSERIAL: /* gets serial port data */
+ rv = get_serial_info(acm, (struct serial_struct __user *) arg);
+ break;
++ case TIOCSSERIAL:
++ rv = set_serial_info(acm, (struct serial_struct __user *) arg);
++ break;
+ }
+
+ return rv;
--- /dev/null
+From 70f77b3f7ec010ff9624c1f2e39a81babc9e2429 Mon Sep 17 00:00:00 2001
+From: Dan Carpenter <dan.carpenter@oracle.com>
+Date: Sat, 9 Jun 2012 19:10:27 +0300
+Subject: ftrace: Clear bits properly in reset_iter_read()
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+commit 70f77b3f7ec010ff9624c1f2e39a81babc9e2429 upstream.
+
+There is a typo here where '&' is used instead of '|' and it turns the
+statement into a noop. The original code is equivalent to:
+
+ iter->flags &= ~((1 << 2) & (1 << 4));
+
+Link: http://lkml.kernel.org/r/20120609161027.GD6488@elgon.mountain
+
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/trace/ftrace.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/kernel/trace/ftrace.c
++++ b/kernel/trace/ftrace.c
+@@ -2368,7 +2368,7 @@ static void reset_iter_read(struct ftrac
+ {
+ iter->pos = 0;
+ iter->func_pos = 0;
+- iter->flags &= ~(FTRACE_ITER_PRINTALL & FTRACE_ITER_HASH);
++ iter->flags &= ~(FTRACE_ITER_PRINTALL | FTRACE_ITER_HASH);
+ }
+
+ static void *t_start(struct seq_file *m, loff_t *pos)
--- /dev/null
+From 12f8f74b2a4d26c4facfa7ef99487cf0930f6ef7 Mon Sep 17 00:00:00 2001
+From: Zheng Liu <gnehzuil.liu@gmail.com>
+Date: Thu, 8 Nov 2012 16:58:46 -0800
+Subject: perf test: fix a build error on builtin-test
+
+From: Zheng Liu <gnehzuil.liu@gmail.com>
+
+commit 12f8f74b2a4d26c4facfa7ef99487cf0930f6ef7 upstream.
+
+Recently I build perf and get a build error on builtin-test.c. The error is as
+following:
+
+$ make
+ CC perf.o
+ CC builtin-test.o
+cc1: warnings being treated as errors
+builtin-test.c: In function ‘sched__get_first_possible_cpu’:
+builtin-test.c:977: warning: implicit declaration of function ‘CPU_ALLOC’
+builtin-test.c:977: warning: nested extern declaration of ‘CPU_ALLOC’
+builtin-test.c:977: warning: assignment makes pointer from integer without a cast
+builtin-test.c:978: warning: implicit declaration of function ‘CPU_ALLOC_SIZE’
+builtin-test.c:978: warning: nested extern declaration of ‘CPU_ALLOC_SIZE’
+builtin-test.c:979: warning: implicit declaration of function ‘CPU_ZERO_S’
+builtin-test.c:979: warning: nested extern declaration of ‘CPU_ZERO_S’
+builtin-test.c:982: warning: implicit declaration of function ‘CPU_FREE’
+builtin-test.c:982: warning: nested extern declaration of ‘CPU_FREE’
+builtin-test.c:992: warning: implicit declaration of function ‘CPU_ISSET_S’
+builtin-test.c:992: warning: nested extern declaration of ‘CPU_ISSET_S’
+builtin-test.c:998: warning: implicit declaration of function ‘CPU_CLR_S’
+builtin-test.c:998: warning: nested extern declaration of ‘CPU_CLR_S’
+make: *** [builtin-test.o] Error 1
+
+This problem is introduced in 3e7c439a. CPU_ALLOC and related macros are
+missing in sched__get_first_possible_cpu function. In 54489c18, commiter
+mentioned that CPU_ALLOC has been removed. So CPU_ALLOC calls in this
+function are removed to let perf to be built.
+
+Signed-off-by: Vinson Lee <vlee@twitter.com>
+Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
+Cc: David Ahern <dsahern@gmail.com>
+Cc: Frederic Weisbecker <fweisbec@gmail.com>
+Cc: Mike Galbraith <efault@gmx.de>
+Cc: Paul Mackerras <paulus@samba.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Stephane Eranian <eranian@google.com>
+Cc: Vinson Lee <vlee@twitter.com>
+Cc: Zheng Liu <wenqing.lz@taobao.com>
+Link: http://lkml.kernel.org/r/1352422726-31114-1-git-send-email-vlee@twitter.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ tools/perf/builtin-test.c | 38 ++++++++++++--------------------------
+ 1 file changed, 12 insertions(+), 26 deletions(-)
+
+--- a/tools/perf/builtin-test.c
++++ b/tools/perf/builtin-test.c
+@@ -1154,19 +1154,13 @@ static int test__parse_events(void)
+ return ret;
+ }
+
+-static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t **maskp,
+- size_t *sizep)
++static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t *maskp)
+ {
+- cpu_set_t *mask;
+- size_t size;
+ int i, cpu = -1, nrcpus = 1024;
+ realloc:
+- mask = CPU_ALLOC(nrcpus);
+- size = CPU_ALLOC_SIZE(nrcpus);
+- CPU_ZERO_S(size, mask);
++ CPU_ZERO(maskp);
+
+- if (sched_getaffinity(pid, size, mask) == -1) {
+- CPU_FREE(mask);
++ if (sched_getaffinity(pid, sizeof(*maskp), maskp) == -1) {
+ if (errno == EINVAL && nrcpus < (1024 << 8)) {
+ nrcpus = nrcpus << 2;
+ goto realloc;
+@@ -1176,19 +1170,14 @@ realloc:
+ }
+
+ for (i = 0; i < nrcpus; i++) {
+- if (CPU_ISSET_S(i, size, mask)) {
+- if (cpu == -1) {
++ if (CPU_ISSET(i, maskp)) {
++ if (cpu == -1)
+ cpu = i;
+- *maskp = mask;
+- *sizep = size;
+- } else
+- CPU_CLR_S(i, size, mask);
++ else
++ CPU_CLR(i, maskp);
+ }
+ }
+
+- if (cpu == -1)
+- CPU_FREE(mask);
+-
+ return cpu;
+ }
+
+@@ -1199,8 +1188,8 @@ static int test__PERF_RECORD(void)
+ .freq = 10,
+ .mmap_pages = 256,
+ };
+- cpu_set_t *cpu_mask = NULL;
+- size_t cpu_mask_size = 0;
++ cpu_set_t cpu_mask;
++ size_t cpu_mask_size = sizeof(cpu_mask);
+ struct perf_evlist *evlist = perf_evlist__new(NULL, NULL);
+ struct perf_evsel *evsel;
+ struct perf_sample sample;
+@@ -1265,8 +1254,7 @@ static int test__PERF_RECORD(void)
+ evsel->attr.sample_type |= PERF_SAMPLE_TIME;
+ perf_evlist__config_attrs(evlist, &opts);
+
+- err = sched__get_first_possible_cpu(evlist->workload.pid, &cpu_mask,
+- &cpu_mask_size);
++ err = sched__get_first_possible_cpu(evlist->workload.pid, &cpu_mask);
+ if (err < 0) {
+ pr_debug("sched__get_first_possible_cpu: %s\n", strerror(errno));
+ goto out_delete_evlist;
+@@ -1277,9 +1265,9 @@ static int test__PERF_RECORD(void)
+ /*
+ * So that we can check perf_sample.cpu on all the samples.
+ */
+- if (sched_setaffinity(evlist->workload.pid, cpu_mask_size, cpu_mask) < 0) {
++ if (sched_setaffinity(evlist->workload.pid, cpu_mask_size, &cpu_mask) < 0) {
+ pr_debug("sched_setaffinity: %s\n", strerror(errno));
+- goto out_free_cpu_mask;
++ goto out_delete_evlist;
+ }
+
+ /*
+@@ -1472,8 +1460,6 @@ found_exit:
+ }
+ out_err:
+ perf_evlist__munmap(evlist);
+-out_free_cpu_mask:
+- CPU_FREE(cpu_mask);
+ out_delete_evlist:
+ perf_evlist__delete(evlist);
+ out:
--- /dev/null
+From 878d7439d0f45a95869e417576774673d1fa243f Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <edumazet@google.com>
+Date: Thu, 18 Oct 2012 04:55:36 -0700
+Subject: rcu: Fix batch-limit size problem
+
+From: Eric Dumazet <edumazet@google.com>
+
+commit 878d7439d0f45a95869e417576774673d1fa243f upstream.
+
+Commit 29c00b4a1d9e27 (rcu: Add event-tracing for RCU callback
+invocation) added a regression in rcu_do_batch()
+
+Under stress, RCU is supposed to allow to process all items in queue,
+instead of a batch of 10 items (blimit), but an integer overflow makes
+the effective limit being 1. So, unless there is frequent idle periods
+(during which RCU ignores batch limits), RCU can be forced into a
+state where it cannot keep up with the callback-generation rate,
+eventually resulting in OOM.
+
+This commit therefore converts a few variables in rcu_do_batch() from
+int to long to fix this problem, along with the module parameters
+controlling the batch limits.
+
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/rcutree.c | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+--- a/kernel/rcutree.c
++++ b/kernel/rcutree.c
+@@ -202,13 +202,13 @@ DEFINE_PER_CPU(struct rcu_dynticks, rcu_
+ .dynticks = ATOMIC_INIT(1),
+ };
+
+-static int blimit = 10; /* Maximum callbacks per rcu_do_batch. */
+-static int qhimark = 10000; /* If this many pending, ignore blimit. */
+-static int qlowmark = 100; /* Once only this many pending, use blimit. */
+-
+-module_param(blimit, int, 0);
+-module_param(qhimark, int, 0);
+-module_param(qlowmark, int, 0);
++static long blimit = 10; /* Maximum callbacks per rcu_do_batch. */
++static long qhimark = 10000; /* If this many pending, ignore blimit. */
++static long qlowmark = 100; /* Once only this many pending, use blimit. */
++
++module_param(blimit, long, 0);
++module_param(qhimark, long, 0);
++module_param(qlowmark, long, 0);
+
+ int rcu_cpu_stall_suppress __read_mostly; /* 1 = suppress stall warnings. */
+ int rcu_cpu_stall_timeout __read_mostly = CONFIG_RCU_CPU_STALL_TIMEOUT;
+@@ -1476,7 +1476,7 @@ static void rcu_do_batch(struct rcu_stat
+ {
+ unsigned long flags;
+ struct rcu_head *next, *list, **tail;
+- int bl, count, count_lazy;
++ long bl, count, count_lazy;
+
+ /* If no callbacks are ready, just return.*/
+ if (!cpu_has_callbacks_ready_to_invoke(rdp)) {
acpi-video-ignore-bios-initial-backlight-value-for-hp-folio-13-2000.patch
usb-ohci-workaround-for-hardware-bug-retired-tds-not-added-to-the-done-queue.patch
xhci-extend-fresco-logic-msi-quirk.patch
+ftrace-clear-bits-properly-in-reset_iter_read.patch
+cdc-acm-implement-tiocsserial-to-avoid-blocking-close-2.patch
+perf-test-fix-a-build-error-on-builtin-test.patch
+rcu-fix-batch-limit-size-problem.patch