[PATCH v7 1/6] mm: mlock: Refactor mlock, munlock, and munlockall code

2015-08-08 Thread Eric B Munson
Extending the mlock system call is very difficult because it currently
does not take a flags argument.  A later patch in this set will extend
mlock to support a middle ground between pages that are locked and
faulted in immediately and unlocked pages.  To pave the way for the new
system call, the code needs some reorganization so that all the actual
entry point handles is checking input and translating to VMA flags.

Signed-off-by: Eric B Munson 
Acked-by: Kirill A. Shutemov 
Acked-by: Vlastimil Babka 
Cc: Michal Hocko 
Cc: Vlastimil Babka 
Cc: "Kirill A. Shutemov" 
Cc: linux...@kvack.org
Cc: linux-kernel@vger.kernel.org
---
 mm/mlock.c | 30 +-
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/mm/mlock.c b/mm/mlock.c
index 6fd2cf1..5692ee5 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -553,7 +553,8 @@ out:
return ret;
 }
 
-static int do_mlock(unsigned long start, size_t len, int on)
+static int apply_vma_lock_flags(unsigned long start, size_t len,
+   vm_flags_t flags)
 {
unsigned long nstart, end, tmp;
struct vm_area_struct * vma, * prev;
@@ -575,14 +576,11 @@ static int do_mlock(unsigned long start, size_t len, int 
on)
prev = vma;
 
for (nstart = start ; ; ) {
-   vm_flags_t newflags;
-
-   /* Here we know that  vma->vm_start <= nstart < vma->vm_end. */
+   vm_flags_t newflags = vma->vm_flags & ~VM_LOCKED;
 
-   newflags = vma->vm_flags & ~VM_LOCKED;
-   if (on)
-   newflags |= VM_LOCKED;
+   newflags |= flags;
 
+   /* Here we know that  vma->vm_start <= nstart < vma->vm_end. */
tmp = vma->vm_end;
if (tmp > end)
tmp = end;
@@ -604,7 +602,7 @@ static int do_mlock(unsigned long start, size_t len, int on)
return error;
 }
 
-SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len)
+static int do_mlock(unsigned long start, size_t len, vm_flags_t flags)
 {
unsigned long locked;
unsigned long lock_limit;
@@ -628,7 +626,7 @@ SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len)
 
/* check against resource limits */
if ((locked <= lock_limit) || capable(CAP_IPC_LOCK))
-   error = do_mlock(start, len, 1);
+   error = apply_vma_lock_flags(start, len, flags);
 
up_write(>mm->mmap_sem);
if (error)
@@ -640,6 +638,11 @@ SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len)
return 0;
 }
 
+SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len)
+{
+   return do_mlock(start, len, VM_LOCKED);
+}
+
 SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, len)
 {
int ret;
@@ -648,13 +651,13 @@ SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, 
len)
start &= PAGE_MASK;
 
down_write(>mm->mmap_sem);
-   ret = do_mlock(start, len, 0);
+   ret = apply_vma_lock_flags(start, len, 0);
up_write(>mm->mmap_sem);
 
return ret;
 }
 
-static int do_mlockall(int flags)
+static int apply_mlockall_flags(int flags)
 {
struct vm_area_struct * vma, * prev = NULL;
 
@@ -662,6 +665,7 @@ static int do_mlockall(int flags)
current->mm->def_flags |= VM_LOCKED;
else
current->mm->def_flags &= ~VM_LOCKED;
+
if (flags == MCL_FUTURE)
goto out;
 
@@ -703,7 +707,7 @@ SYSCALL_DEFINE1(mlockall, int, flags)
 
if (!(flags & MCL_CURRENT) || (current->mm->total_vm <= lock_limit) ||
capable(CAP_IPC_LOCK))
-   ret = do_mlockall(flags);
+   ret = apply_mlockall_flags(flags);
up_write(>mm->mmap_sem);
if (!ret && (flags & MCL_CURRENT))
mm_populate(0, TASK_SIZE);
@@ -716,7 +720,7 @@ SYSCALL_DEFINE0(munlockall)
int ret;
 
down_write(>mm->mmap_sem);
-   ret = do_mlockall(0);
+   ret = apply_mlockall_flags(0);
up_write(>mm->mmap_sem);
return ret;
 }
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v7 4/6] mm: mlock: Add mlock flags to enable VM_LOCKONFAULT usage

2015-08-08 Thread Eric B Munson
The previous patch introduced a flag that specified pages in a VMA
should be placed on the unevictable LRU, but they should not be made
present when the area is created.  This patch adds the ability to set
this state via the new mlock system calls.

We add MLOCK_ONFAULT for mlock2 and MCL_ONFAULT for mlockall.
MLOCK_ONFAULT will set the VM_LOCKONFAULT modifier for VM_LOCKED.
MCL_ONFAULT should be used as a modifier to the two other mlockall
flags.  When used with MCL_CURRENT, all current mappings will be marked
with VM_LOCKED | VM_LOCKONFAULT.  When used with MCL_FUTURE, the
mm->def_flags will be marked with VM_LOCKED | VM_LOCKONFAULT.  When used
with both MCL_CURRENT and MCL_FUTURE, all current mappings and
mm->def_flags will be marked with VM_LOCKED | VM_LOCKONFAULT.

Prior to this patch, mlockall() will unconditionally clear the
mm->def_flags any time it is called without MCL_FUTURE.  This behavior
is maintained after adding MCL_ONFAULT.  If a call to
mlockall(MCL_FUTURE) is followed by mlockall(MCL_CURRENT), the
mm->def_flags will be cleared and new VMAs will be unlocked.  This
remains true with or without MCL_ONFAULT in either mlockall()
invocation.

munlock() will unconditionally clear both vma flags.  munlockall()
unconditionally clears for VMA flags on all VMAs and in the
mm->def_flags field.

Signed-off-by: Eric B Munson 
Acked-by: Vlastimil Babka 
Cc: Michal Hocko 
Cc: Vlastimil Babka 
Cc: Jonathan Corbet 
Cc: "Kirill A. Shutemov" 
Cc: linux-al...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-m...@linux-mips.org
Cc: linux-par...@vger.kernel.org
Cc: linuxppc-...@lists.ozlabs.org
Cc: sparcli...@vger.kernel.org
Cc: linux-xte...@linux-xtensa.org
Cc: linux-a...@vger.kernel.org
Cc: linux-...@vger.kernel.org
Cc: linux...@kvack.org
---
 arch/alpha/include/uapi/asm/mman.h |  3 ++
 arch/mips/include/uapi/asm/mman.h  |  6 
 arch/parisc/include/uapi/asm/mman.h|  3 ++
 arch/powerpc/include/uapi/asm/mman.h   |  1 +
 arch/sparc/include/uapi/asm/mman.h |  1 +
 arch/tile/include/uapi/asm/mman.h  |  1 +
 arch/xtensa/include/uapi/asm/mman.h|  6 
 include/uapi/asm-generic/mman-common.h |  5 
 include/uapi/asm-generic/mman.h|  1 +
 mm/mlock.c | 53 +-
 10 files changed, 67 insertions(+), 13 deletions(-)

diff --git a/arch/alpha/include/uapi/asm/mman.h 
b/arch/alpha/include/uapi/asm/mman.h
index 0086b47..f2f9496 100644
--- a/arch/alpha/include/uapi/asm/mman.h
+++ b/arch/alpha/include/uapi/asm/mman.h
@@ -37,6 +37,9 @@
 
 #define MCL_CURRENT 8192   /* lock all currently mapped pages */
 #define MCL_FUTURE 16384   /* lock all additions to address space 
*/
+#define MCL_ONFAULT32768   /* lock all pages that are faulted in */
+
+#define MLOCK_ONFAULT  0x01/* Lock pages in range after they are 
faulted in, do not prefault */
 
 #define MADV_NORMAL0   /* no further special treatment */
 #define MADV_RANDOM1   /* expect random page references */
diff --git a/arch/mips/include/uapi/asm/mman.h 
b/arch/mips/include/uapi/asm/mman.h
index cfcb876..97c03f4 100644
--- a/arch/mips/include/uapi/asm/mman.h
+++ b/arch/mips/include/uapi/asm/mman.h
@@ -61,6 +61,12 @@
  */
 #define MCL_CURRENT1   /* lock all current mappings */
 #define MCL_FUTURE 2   /* lock all future mappings */
+#define MCL_ONFAULT4   /* lock all pages that are faulted in */
+
+/*
+ * Flags for mlock
+ */
+#define MLOCK_ONFAULT  0x01/* Lock pages in range after they are 
faulted in, do not prefault */
 
 #define MADV_NORMAL0   /* no further special treatment */
 #define MADV_RANDOM1   /* expect random page references */
diff --git a/arch/parisc/include/uapi/asm/mman.h 
b/arch/parisc/include/uapi/asm/mman.h
index 294d251..ecc3ae1 100644
--- a/arch/parisc/include/uapi/asm/mman.h
+++ b/arch/parisc/include/uapi/asm/mman.h
@@ -31,6 +31,9 @@
 
 #define MCL_CURRENT1   /* lock all current mappings */
 #define MCL_FUTURE 2   /* lock all future mappings */
+#define MCL_ONFAULT4   /* lock all pages that are faulted in */
+
+#define MLOCK_ONFAULT  0x01/* Lock pages in range after they are 
faulted in, do not prefault */
 
 #define MADV_NORMAL 0   /* no further special treatment */
 #define MADV_RANDOM 1   /* expect random page references */
diff --git a/arch/powerpc/include/uapi/asm/mman.h 
b/arch/powerpc/include/uapi/asm/mman.h
index 6ea26df..03c06ba 100644
--- a/arch/powerpc/include/uapi/asm/mman.h
+++ b/arch/powerpc/include/uapi/asm/mman.h
@@ -22,6 +22,7 @@
 
 #define MCL_CURRENT 0x2000  /* lock all currently mapped pages */
 #define MCL_FUTURE  0x4000  /* lock all additions to address space 
*/
+#define MCL_ONFAULT0x8000  /* lock all pages that are faulted in */
 
 

[PATCH] perf hists browser: Support horizontal scrolling with '<' and '>' key

2015-08-08 Thread Namhyung Kim
Currently perf TUI report browser doesn't support horizontal scrolling.
So if terminal width is smaller than the actual contents, there's no way
to see them.  This patch adds support horizontal movement by '<' and '>'
keys.

Signed-off-by: Namhyung Kim 
---
 tools/perf/ui/browsers/hists.c | 64 +-
 1 file changed, 51 insertions(+), 13 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index fa67613976a8..b7dc6eef668e 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -20,6 +20,8 @@
 #include "map.h"
 #include "annotate.h"
 
+#define SKIP_COLS_STEP  10
+
 struct hist_browser {
struct ui_browser   b;
struct hists*hists;
@@ -29,6 +31,7 @@ struct hist_browser {
struct pstack   *pstack;
struct perf_session_env *env;
int  print_seq;
+   int  skip_cols;
bool show_dso;
bool show_headers;
floatmin_pcnt;
@@ -491,6 +494,15 @@ static int hist_browser__run(struct hist_browser *browser, 
const char *help)
browser->show_headers = !browser->show_headers;
hist_browser__update_rows(browser);
break;
+   case '>':
+   browser->skip_cols += SKIP_COLS_STEP;
+   break;
+   case '<':
+   if (browser->skip_cols > SKIP_COLS_STEP)
+   browser->skip_cols -= SKIP_COLS_STEP;
+   else
+   browser->skip_cols = 0;
+   break;
case K_ENTER:
if (hist_browser__toggle_fold(browser))
break;
@@ -663,8 +675,27 @@ struct hpp_arg {
struct ui_browser *b;
char folded_sign;
bool current_entry;
+   int skip_cols;
 };
 
+/* returns actual printed length (not skipped) */
+static int hpp_print_skip(struct perf_hpp *hpp, char *buf, size_t size)
+{
+   struct hpp_arg *arg = hpp->ptr;
+   int ret = size;
+
+   if (ret > arg->skip_cols) {
+   slsmg_printf("%s", buf + arg->skip_cols);
+   ret -= arg->skip_cols;
+   arg->skip_cols = 0;
+   } else {
+   arg->skip_cols -= ret;
+   ret = 0;
+   }
+
+   return ret;
+}
+
 static int __hpp__slsmg_color_printf(struct perf_hpp *hpp, const char *fmt, 
...)
 {
struct hpp_arg *arg = hpp->ptr;
@@ -680,7 +711,7 @@ static int __hpp__slsmg_color_printf(struct perf_hpp *hpp, 
const char *fmt, ...)
ui_browser__set_percent_color(arg->b, percent, arg->current_entry);
 
ret = scnprintf(hpp->buf, hpp->size, fmt, len, percent);
-   slsmg_printf("%s", hpp->buf);
+   ret = hpp_print_skip(hpp, hpp->buf, ret);
 
advance_hpp(hpp, ret);
return ret;
@@ -716,9 +747,8 @@ hist_browser__hpp_color_##_type(struct perf_hpp_fmt *fmt,   
\
int len = fmt->user_len ?: fmt->len;\
int ret = scnprintf(hpp->buf, hpp->size,\
"%*s", len, "N/A"); \
-   slsmg_printf("%s", hpp->buf);   \
\
-   return ret; \
+   return hpp_print_skip(hpp, hpp->buf, ret);  \
}   \
return hpp__fmt(fmt, hpp, he, __hpp_get_acc_##_field,   \
" %*.2f%%", __hpp__slsmg_color_printf, true);   \
@@ -778,6 +808,7 @@ static int hist_browser__show_entry(struct hist_browser 
*browser,
.b  = >b,
.folded_sign= folded_sign,
.current_entry  = current_entry,
+   .skip_cols  = browser->skip_cols,
};
struct perf_hpp hpp = {
.buf= s,
@@ -801,20 +832,20 @@ static int hist_browser__show_entry(struct hist_browser 
*browser,
 
if (first) {
if (symbol_conf.use_callchain) {
-   slsmg_printf("%c ", folded_sign);
-   width -= 2;
+   snprintf(s, sizeof(s), "%c ", 
folded_sign);
+   width -= hpp_print_skip(, s, 2);
}
first = false;
} else {
-   slsmg_printf("  ");
-   width -= 2;
+   strcpy(s, "  ");
+

[PATCH v7 0/6] Allow user to request memory to be locked on page fault

2015-08-08 Thread Eric B Munson
mlock() allows a user to control page out of program memory, but this
comes at the cost of faulting in the entire mapping when it is
allocated.  For large mappings where the entire area is not necessary
this is not ideal.  Instead of forcing all locked pages to be present
when they are allocated, this set creates a middle ground.  Pages are
marked to be placed on the unevictable LRU (locked) when they are first
used, but they are not faulted in by the mlock call.

This series introduces a new mlock() system call that takes a flags
argument along with the start address and size.  This flags argument
gives the caller the ability to request memory be locked in the
traditional way, or to be locked after the page is faulted in.  A new
MCL flag is added to mirror the lock on fault behavior from mlock() in
mlockall().

There are two main use cases that this set covers.  The first is the
security focussed mlock case.  A buffer is needed that cannot be written
to swap.  The maximum size is known, but on average the memory used is
significantly less than this maximum.  With lock on fault, the buffer
is guaranteed to never be paged out without consuming the maximum size
every time such a buffer is created.

The second use case is focussed on performance.  Portions of a large
file are needed and we want to keep the used portions in memory once
accessed.  This is the case for large graphical models where the path
through the graph is not known until run time.  The entire graph is
unlikely to be used in a given invocation, but once a node has been
used it needs to stay resident for further processing.  Given these
constraints we have a number of options.  We can potentially waste a
large amount of memory by mlocking the entire region (this can also
cause a significant stall at startup as the entire file is read in).
We can mlock every page as we access them without tracking if the page
is already resident but this introduces large overhead for each access.
The third option is mapping the entire region with PROT_NONE and using
a signal handler for SIGSEGV to mprotect(PROT_READ) and mlock() the
needed page.  Doing this page at a time adds a significant performance
penalty.  Batching can be used to mitigate this overhead, but in order
to safely avoid trying to mprotect pages outside of the mapping, the
boundaries of each mapping to be used in this way must be tracked and
available to the signal handler.  This is precisely what the mm system
in the kernel should already be doing.

For mlock(MLOCK_ONFAULT) the user is charged against RLIMIT_MEMLOCK as
if mlock(MLOCK_LOCKED) or mmap(MAP_LOCKED) was used, so when the VMA is
created not when the pages are faulted in.  For mlockall(MCL_ONFAULT)
the user is charged as if MCL_FUTURE was used.  This decision was made
to keep the accounting checks out of the page fault path.

To illustrate the benefit of this set I wrote a test program that mmaps
a 5 GB file filled with random data and then makes 15,000,000 accesses
to random addresses in that mapping.  The test program was run 20 times
for each setup.  Results are reported for two program portions, setup
and execution.  The setup phase is calling mmap and optionally mlock on
the entire region.  For most experiments this is trivial, but it
highlights the cost of faulting in the entire region.  Results are
averages across the 20 runs in milliseconds.

mmap with mlock(MLOCK_LOCKED) on entire range:
Setup avg:  8228.666
Processing avg: 8274.257

mmap with mlock(MLOCK_LOCKED) before each access:
Setup avg:  0.113
Processing avg: 90993.552

mmap with PROT_NONE and signal handler and batch size of 1 page:
With the default value in max_map_count, this gets ENOMEM as I attempt
to change the permissions, after upping the sysctl significantly I get:
Setup avg:  0.058
Processing avg: 69488.073
mmap with PROT_NONE and signal handler and batch size of 8 pages:
Setup avg:  0.068
Processing avg: 38204.116

mmap with PROT_NONE and signal handler and batch size of 16 pages:
Setup avg:  0.044
Processing avg: 29671.180

mmap with mlock(MLOCK_ONFAULT) on entire range:
Setup avg:  0.189
Processing avg: 17904.899

The signal handler in the batch cases faulted in memory in two steps to
avoid having to know the start and end of the faulting mapping.  The
first step covers the page that caused the fault as we know that it will
be possible to lock.  The second step speculatively tries to mlock and
mprotect the batch size - 1 pages that follow.  There may be a clever
way to avoid this without having the program track each mapping to be
covered by this handeler in a globally accessible structure, but I could
not find it.  It should be noted that with a large enough batch size
this two step fault handler can still cause the program to crash if it
reaches far beyond the end of the mapping.

These results show that if the developer knows that a majority of the
mapping will be used, it is better to try and fault it in at once,
otherwise 

[PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT

2015-08-08 Thread Eric B Munson
The cost of faulting in all memory to be locked can be very high when
working with large mappings.  If only portions of the mapping will be
used this can incur a high penalty for locking.

For the example of a large file, this is the usage pattern for a large
statical language model (probably applies to other statical or graphical
models as well).  For the security example, any application transacting
in data that cannot be swapped out (credit card data, medical records,
etc).

This patch introduces the ability to request that pages are not
pre-faulted, but are placed on the unevictable LRU when they are finally
faulted in.  The VM_LOCKONFAULT flag will be used together with
VM_LOCKED and has no effect when set without VM_LOCKED.  Setting the
VM_LOCKONFAULT flag for a VMA will cause pages faulted into that VMA to
be added to the unevictable LRU when they are faulted or if they are
already present, but will not cause any missing pages to be faulted in.

Exposing this new lock state means that we cannot overload the meaning
of the FOLL_POPULATE flag any longer.  Prior to this patch it was used
to mean that the VMA for a fault was locked.  This means we need the
new FOLL_MLOCK flag to communicate the locked state of a VMA.
FOLL_POPULATE will now only control if the VMA should be populated and
in the case of VM_LOCKONFAULT, it will not be set.

Signed-off-by: Eric B Munson 
Acked-by: Kirill A. Shutemov 
Cc: Michal Hocko 
Cc: Vlastimil Babka 
Cc: Jonathan Corbet 
Cc: "Kirill A. Shutemov" 
Cc: linux-kernel@vger.kernel.org
Cc: dri-de...@lists.freedesktop.org
Cc: linux...@kvack.org
Cc: linux-...@vger.kernel.org
---
 Documentation/filesystems/proc.txt |  1 +
 drivers/gpu/drm/drm_vm.c   |  8 +++-
 fs/proc/task_mmu.c |  1 +
 include/linux/mm.h |  2 ++
 kernel/fork.c  |  2 +-
 mm/debug.c |  1 +
 mm/gup.c   | 10 --
 mm/huge_memory.c   |  2 +-
 mm/hugetlb.c   |  4 ++--
 mm/mlock.c |  2 +-
 mm/mmap.c  |  2 +-
 mm/rmap.c  |  6 --
 12 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/Documentation/filesystems/proc.txt 
b/Documentation/filesystems/proc.txt
index 6f7fafd..ed21989 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -463,6 +463,7 @@ manner. The codes are the following:
 rr  - random read advise provided
 dc  - do not copy area on fork
 de  - do not expand area on remapping
+lf  - mark area to lock pages when faulted in, do not pre-populate
 ac  - area is accountable
 nr  - swap space is not reserved for the area
 ht  - area uses huge tlb pages
diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
index aab49ee..103a5f6 100644
--- a/drivers/gpu/drm/drm_vm.c
+++ b/drivers/gpu/drm/drm_vm.c
@@ -699,9 +699,15 @@ int drm_vma_info(struct seq_file *m, void *data)
   (void *)(unsigned long)virt_to_phys(high_memory));
 
list_for_each_entry(pt, >vmalist, head) {
+   char lock_flag = '-';
+
vma = pt->vma;
if (!vma)
continue;
+   if (vma->vm_flags & VM_LOCKONFAULT)
+   lock_flag = 'f';
+   else if (vma->vm_flags & VM_LOCKED)
+   lock_flag = 'l';
seq_printf(m,
   "\n%5d 0x%pK-0x%pK %c%c%c%c%c%c 0x%08lx000",
   pt->pid,
@@ -710,7 +716,7 @@ int drm_vma_info(struct seq_file *m, void *data)
   vma->vm_flags & VM_WRITE ? 'w' : '-',
   vma->vm_flags & VM_EXEC ? 'x' : '-',
   vma->vm_flags & VM_MAYSHARE ? 's' : 'p',
-  vma->vm_flags & VM_LOCKED ? 'l' : '-',
+  lock_flag,
   vma->vm_flags & VM_IO ? 'i' : '-',
   vma->vm_pgoff);
 
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index ca1e091..8dcc297 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -585,6 +585,7 @@ static void show_smap_vma_flags(struct seq_file *m, struct 
vm_area_struct *vma)
[ilog2(VM_RAND_READ)]   = "rr",
[ilog2(VM_DONTCOPY)]= "dc",
[ilog2(VM_DONTEXPAND)]  = "de",
+   [ilog2(VM_LOCKONFAULT)] = "lf",
[ilog2(VM_ACCOUNT)] = "ac",
[ilog2(VM_NORESERVE)]   = "nr",
[ilog2(VM_HUGETLB)] = "ht",
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 2e872f9..d6e1637 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -136,6 +136,7 @@ extern unsigned int kobjsize(const void *objp);
 
 #define VM_DONTCOPY0x0002  /* Do not copy this vma on fork */
 #define VM_DONTEXPAND  0x0004  /* Cannot expand with mremap() 

[PATCH v7 5/6] selftests: vm: Add tests for lock on fault

2015-08-08 Thread Eric B Munson
Test the mmap() flag, and the mlockall() flag.  These tests ensure that
pages are not faulted in until they are accessed, that the pages are
unevictable once faulted in, and that VMA splitting and merging works
with the new VM flag.  The second test ensures that mlock limits are
respected.  Note that the limit test needs to be run a normal user.

Also add tests to use the new mlock2 family of system calls.

Signed-off-by: Eric B Munson 
Cc: Shuah Khan 
Cc: Michal Hocko 
Cc: Vlastimil Babka 
Cc: Jonathan Corbet 
Cc: linux...@kvack.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 tools/testing/selftests/vm/Makefile |   2 +
 tools/testing/selftests/vm/mlock2-tests.c   | 661 
 tools/testing/selftests/vm/on-fault-limit.c |  47 ++
 tools/testing/selftests/vm/run_vmtests  |  22 +
 4 files changed, 732 insertions(+)
 create mode 100644 tools/testing/selftests/vm/mlock2-tests.c
 create mode 100644 tools/testing/selftests/vm/on-fault-limit.c

diff --git a/tools/testing/selftests/vm/Makefile 
b/tools/testing/selftests/vm/Makefile
index 231b9a0..71a4e9f 100644
--- a/tools/testing/selftests/vm/Makefile
+++ b/tools/testing/selftests/vm/Makefile
@@ -6,6 +6,8 @@ BINARIES += hugepage-mmap
 BINARIES += hugepage-shm
 BINARIES += hugetlbfstest
 BINARIES += map_hugetlb
+BINARIES += mlock2-tests
+BINARIES += on-fault-limit
 BINARIES += thuge-gen
 BINARIES += transhuge-stress
 
diff --git a/tools/testing/selftests/vm/mlock2-tests.c 
b/tools/testing/selftests/vm/mlock2-tests.c
new file mode 100644
index 000..c49122b
--- /dev/null
+++ b/tools/testing/selftests/vm/mlock2-tests.c
@@ -0,0 +1,661 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifndef MLOCK_ONFAULT
+#define MLOCK_ONFAULT 1
+#endif
+
+#ifndef MCL_ONFAULT
+#define MCL_ONFAULT (MCL_FUTURE << 1)
+#endif
+
+static int mlock2_(void *start, size_t len, int flags)
+{
+#ifdef __NR_mlock2
+   return syscall(__NR_mlock2, start, len, flags);
+#else
+   errno = ENOSYS;
+   return -1;
+#endif
+}
+
+struct vm_boundaries {
+   unsigned long start;
+   unsigned long end;
+};
+
+static int get_vm_area(unsigned long addr, struct vm_boundaries *area)
+{
+   FILE *file;
+   int ret = 1;
+   char line[1024] = {0};
+   char *end_addr;
+   char *stop;
+   unsigned long start;
+   unsigned long end;
+
+   if (!area)
+   return ret;
+
+   file = fopen("/proc/self/maps", "r");
+   if (!file) {
+   perror("fopen");
+   return ret;
+   }
+
+   memset(area, 0, sizeof(struct vm_boundaries));
+
+   while(fgets(line, 1024, file)) {
+   end_addr = strchr(line, '-');
+   if (!end_addr) {
+   printf("cannot parse /proc/self/maps\n");
+   goto out;
+   }
+   *end_addr = '\0';
+   end_addr++;
+   stop = strchr(end_addr, ' ');
+   if (!stop) {
+   printf("cannot parse /proc/self/maps\n");
+   goto out;
+   }
+   stop = '\0';
+
+   sscanf(line, "%lx", );
+   sscanf(end_addr, "%lx", );
+
+   if (start <= addr && end > addr) {
+   area->start = start;
+   area->end = end;
+   ret = 0;
+   goto out;
+   }
+   }
+out:
+   fclose(file);
+   return ret;
+}
+
+static unsigned long get_pageflags(unsigned long addr)
+{
+   FILE *file;
+   unsigned long pfn;
+   unsigned long offset;
+
+   file = fopen("/proc/self/pagemap", "r");
+   if (!file) {
+   perror("fopen pagemap");
+   _exit(1);
+   }
+
+   offset = addr / getpagesize() * sizeof(unsigned long);
+   if (fseek(file, offset, SEEK_SET)) {
+   perror("fseek pagemap");
+   _exit(1);
+   }
+
+   if (fread(, sizeof(unsigned long), 1, file) != 1) {
+   perror("fread pagemap");
+   _exit(1);
+   }
+
+   fclose(file);
+   return pfn;
+}
+
+static unsigned long get_kpageflags(unsigned long pfn)
+{
+   unsigned long flags;
+   FILE *file;
+
+   file = fopen("/proc/kpageflags", "r");
+   if (!file) {
+   perror("fopen kpageflags");
+   _exit(1);
+   }
+
+   if (fseek(file, pfn * sizeof(unsigned long), SEEK_SET)) {
+   perror("fseek kpageflags");
+   _exit(1);
+   }
+
+   if (fread(, sizeof(unsigned long), 1, file) != 1) {
+   perror("fread kpageflags");
+   _exit(1);
+   }
+
+   fclose(file);
+   return flags;
+}
+
+#define VMFLAGS "VmFlags:"
+
+static bool find_flag(FILE *file, const char *vmflag)
+{
+   char *line = NULL;
+   char *flags;
+   size_t size = 0;
+   bool 

[PATCH v7 6/6] mips: Add entry for new mlock2 syscall

2015-08-08 Thread Eric B Munson
A previous commit introduced the new mlock2 syscall, add entries for the
MIPS architecture.

Signed-off-by: Eric B Munson 
Acked-by: Ralf Baechle 
Cc: Ralf Baechle 
Cc: linux-m...@linux-mips.org
Cc: linux-...@vger.kernel.org
Cc: linux-a...@vger.kernel.org
Cc: linux...@kvack.org
Cc: linux-kernel@vger.kernel.org
---
 arch/mips/include/uapi/asm/unistd.h | 15 +--
 arch/mips/kernel/scall32-o32.S  |  1 +
 arch/mips/kernel/scall64-64.S   |  1 +
 arch/mips/kernel/scall64-n32.S  |  1 +
 arch/mips/kernel/scall64-o32.S  |  1 +
 5 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/arch/mips/include/uapi/asm/unistd.h 
b/arch/mips/include/uapi/asm/unistd.h
index c03088f..d0bdfaa 100644
--- a/arch/mips/include/uapi/asm/unistd.h
+++ b/arch/mips/include/uapi/asm/unistd.h
@@ -377,16 +377,17 @@
 #define __NR_memfd_create  (__NR_Linux + 354)
 #define __NR_bpf   (__NR_Linux + 355)
 #define __NR_execveat  (__NR_Linux + 356)
+#define __NR_mlock2(__NR_Linux + 357)
 
 /*
  * Offset of the last Linux o32 flavoured syscall
  */
-#define __NR_Linux_syscalls356
+#define __NR_Linux_syscalls357
 
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
 
 #define __NR_O32_Linux 4000
-#define __NR_O32_Linux_syscalls356
+#define __NR_O32_Linux_syscalls357
 
 #if _MIPS_SIM == _MIPS_SIM_ABI64
 
@@ -711,16 +712,17 @@
 #define __NR_memfd_create  (__NR_Linux + 314)
 #define __NR_bpf   (__NR_Linux + 315)
 #define __NR_execveat  (__NR_Linux + 316)
+#define __NR_mlock2(__NR_Linux + 317)
 
 /*
  * Offset of the last Linux 64-bit flavoured syscall
  */
-#define __NR_Linux_syscalls316
+#define __NR_Linux_syscalls317
 
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
 
 #define __NR_64_Linux  5000
-#define __NR_64_Linux_syscalls 316
+#define __NR_64_Linux_syscalls 317
 
 #if _MIPS_SIM == _MIPS_SIM_NABI32
 
@@ -1049,15 +1051,16 @@
 #define __NR_memfd_create  (__NR_Linux + 318)
 #define __NR_bpf   (__NR_Linux + 319)
 #define __NR_execveat  (__NR_Linux + 320)
+#define __NR_mlock2(__NR_Linux + 321)
 
 /*
  * Offset of the last N32 flavoured syscall
  */
-#define __NR_Linux_syscalls320
+#define __NR_Linux_syscalls321
 
 #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
 
 #define __NR_N32_Linux 6000
-#define __NR_N32_Linux_syscalls320
+#define __NR_N32_Linux_syscalls321
 
 #endif /* _UAPI_ASM_UNISTD_H */
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index 4cc1350..b0b377a 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -599,3 +599,4 @@ EXPORT(sys_call_table)
PTR sys_memfd_create
PTR sys_bpf /* 4355 */
PTR sys_execveat
+   PTR sys_mlock2
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index ad4d4463..97aaf51 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -436,4 +436,5 @@ EXPORT(sys_call_table)
PTR sys_memfd_create
PTR sys_bpf /* 5315 */
PTR sys_execveat
+   PTR sys_mlock2
.size   sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 446cc65..e36f21e 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -429,4 +429,5 @@ EXPORT(sysn32_call_table)
PTR sys_memfd_create
PTR sys_bpf
PTR compat_sys_execveat /* 6320 */
+   PTR sys_mlock2
.size   sysn32_call_table,.-sysn32_call_table
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index f543ff4..7a8b2df 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -584,4 +584,5 @@ EXPORT(sys32_call_table)
PTR sys_memfd_create
PTR sys_bpf /* 4355 */
PTR compat_sys_execveat
+   PTR sys_mlock2
.size   sys32_call_table,.-sys32_call_table
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v7 2/6] mm: mlock: Add new mlock system call

2015-08-08 Thread Eric B Munson
With the refactored mlock code, introduce a new system call for mlock.
The new call will allow the user to specify what lock states are being
added.  mlock2 is trivial at the moment, but a follow on patch will add
a new mlock state making it useful.

Signed-off-by: Eric B Munson 
Acked-by: Vlastimil Babka 
Cc: Michal Hocko 
Cc: Vlastimil Babka 
Cc: Heiko Carstens 
Cc: Geert Uytterhoeven 
Cc: Catalin Marinas 
Cc: Stephen Rothwell 
Cc: Guenter Roeck 
Cc: Andrea Arcangeli 
Cc: linux-al...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: adi-buildroot-de...@lists.sourceforge.net
Cc: linux-cris-ker...@axis.com
Cc: linux-i...@vger.kernel.org
Cc: linux-m...@lists.linux-m68k.org
Cc: linux-am33-l...@redhat.com
Cc: linux-par...@vger.kernel.org
Cc: linuxppc-...@lists.ozlabs.org
Cc: linux-s...@vger.kernel.org
Cc: linux...@vger.kernel.org
Cc: sparcli...@vger.kernel.org
Cc: linux-xte...@linux-xtensa.org
Cc: linux-...@vger.kernel.org
Cc: linux-a...@vger.kernel.org
Cc: linux...@kvack.org
---
 arch/x86/entry/syscalls/syscall_32.tbl | 1 +
 arch/x86/entry/syscalls/syscall_64.tbl | 1 +
 include/linux/syscalls.h   | 2 ++
 include/uapi/asm-generic/unistd.h  | 4 +++-
 kernel/sys_ni.c| 1 +
 mm/mlock.c | 8 
 6 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/arch/x86/entry/syscalls/syscall_32.tbl 
b/arch/x86/entry/syscalls/syscall_32.tbl
index ef8187f..8e06da6 100644
--- a/arch/x86/entry/syscalls/syscall_32.tbl
+++ b/arch/x86/entry/syscalls/syscall_32.tbl
@@ -365,3 +365,4 @@
 356i386memfd_createsys_memfd_create
 357i386bpf sys_bpf
 358i386execveatsys_execveat
stub32_execveat
+360i386mlock2  sys_mlock2
diff --git a/arch/x86/entry/syscalls/syscall_64.tbl 
b/arch/x86/entry/syscalls/syscall_64.tbl
index 9ef32d5..67601e7 100644
--- a/arch/x86/entry/syscalls/syscall_64.tbl
+++ b/arch/x86/entry/syscalls/syscall_64.tbl
@@ -329,6 +329,7 @@
 320common  kexec_file_load sys_kexec_file_load
 321common  bpf sys_bpf
 32264  execveatstub_execveat
+324common  mlock2  sys_mlock2
 
 #
 # x32-specific system call numbers start at 512 to avoid cache impact
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index b45c45b..56a3d59 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -884,4 +884,6 @@ asmlinkage long sys_execveat(int dfd, const char __user 
*filename,
const char __user *const __user *argv,
const char __user *const __user *envp, int flags);
 
+asmlinkage long sys_mlock2(unsigned long start, size_t len, int flags);
+
 #endif
diff --git a/include/uapi/asm-generic/unistd.h 
b/include/uapi/asm-generic/unistd.h
index e016bd9..14a6013 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -709,9 +709,11 @@ __SYSCALL(__NR_memfd_create, sys_memfd_create)
 __SYSCALL(__NR_bpf, sys_bpf)
 #define __NR_execveat 281
 __SC_COMP(__NR_execveat, sys_execveat, compat_sys_execveat)
+#define __NR_mlock2 282
+__SYSCALL(__NR_mlock2, sys_mlock2)
 
 #undef __NR_syscalls
-#define __NR_syscalls 282
+#define __NR_syscalls 283
 
 /*
  * All syscalls below here should go away really,
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 7995ef5..4818b71 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -193,6 +193,7 @@ cond_syscall(sys_mlock);
 cond_syscall(sys_munlock);
 cond_syscall(sys_mlockall);
 cond_syscall(sys_munlockall);
+cond_syscall(sys_mlock2);
 cond_syscall(sys_mincore);
 cond_syscall(sys_madvise);
 cond_syscall(sys_mremap);
diff --git a/mm/mlock.c b/mm/mlock.c
index 5692ee5..3094f27 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -643,6 +643,14 @@ SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len)
return do_mlock(start, len, VM_LOCKED);
 }
 
+SYSCALL_DEFINE3(mlock2, unsigned long, start, size_t, len, int, flags)
+{
+   if (flags)
+   return -EINVAL;
+
+   return do_mlock(start, len, VM_LOCKED);
+}
+
 SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, len)
 {
int ret;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] perf, tools, report: Add support for srcfile sort key

2015-08-08 Thread Namhyung Kim
Hi Andi,

On Sat, Aug 08, 2015 at 04:27:35AM +0200, Andi Kleen wrote:
> On Fri, Aug 07, 2015 at 09:02:15PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Fri, Aug 07, 2015 at 08:51:45PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > Em Fri, Aug 07, 2015 at 03:54:24PM -0700, Andi Kleen escreveu:
> > > > From: Andi Kleen 
> > > > 
> > > > In some cases it's useful to characterize samples by file. This is 
> > > > useful
> > > > to get a higher level categorization, for example to map cost to
> > > > subsystems.
> > > > 
> > > > Add a srcfile sort key to perf report. It builds on top of the existing
> > > > srcline support.
> > > 
> > > Applied
> > 
> > Humm, holding this up a bit, further testing showed some oddities,
> > fedora21, the width of the column is being limited to the lenght of the
> > header
> 
> Yes I've seen that, I just use -w normally. It also happens with --sort
> srcline. The column sizing code could probably be somewhat smarter and
> always allow the last column to become as wide as needed. But that's
> something that should be done separately; I don't think it belongs
> into this patch.

Maybe something like this?



>From c052d17ae45ac08a381192191473ed3c4308c0c5 Mon Sep 17 00:00:00 2001
From: Namhyung Kim 
Date: Sun, 9 Aug 2015 12:28:01 +0900
Subject: [PATCH] perf tools: Update srcline column length

It didn't calculate the column length so the default of header length
used only.  Update the length when we get the srcline actually.

Cc: Andi Kleen 
Signed-off-by: Namhyung Kim 
---
 tools/perf/util/sort.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 5177088a71d3..85e7e3e75d39 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -291,6 +291,8 @@ sort__srcline_cmp(struct hist_entry *left, struct 
hist_entry *right)
left->srcline = get_srcline(map->dso,
   map__rip_2objdump(map, left->ip),
left->ms.sym, true);
+   hists__new_col_len(left->hists, HISTC_SRCLINE,
+  strlen(left->srcline));
}
}
if (!right->srcline) {
@@ -301,6 +303,8 @@ sort__srcline_cmp(struct hist_entry *left, struct 
hist_entry *right)
right->srcline = get_srcline(map->dso,
 map__rip_2objdump(map, right->ip),
 right->ms.sym, true);
+   hists__new_col_len(right->hists, HISTC_SRCLINE,
+  strlen(right->srcline));
}
}
return strcmp(right->srcline, left->srcline);
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4.1 000/123] 4.1.5-stable review

2015-08-08 Thread Guenter Roeck

On 08/08/2015 03:07 PM, Greg Kroah-Hartman wrote:

This is the start of the stable review cycle for the 4.1.5 release.
There are 123 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 Mon Aug 10 22:06:48 UTC 2015.
Anything received after that time might be too late.



Build results:
total: 145 pass: 145 fail: 0
Qemu test results:
total: 61 pass: 60 fail: 1
Failed tests:
mips:fuloong2e_defconfig

The qemu test failure is not new, but was discovered with a newly
introduced test. A patch to fix the problem has been submitted [1].

Details are available at http://server.roeck-us.net:8010/builders.

Guenter

---
[1] http://patchwork.linux-mips.org/patch/10896/

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3.14 00/29] 3.14.50-stable review

2015-08-08 Thread Guenter Roeck

On 08/08/2015 03:07 PM, Greg Kroah-Hartman wrote:

This is the start of the stable review cycle for the 3.14.50 release.
There are 29 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 Mon Aug 10 22:06:58 UTC 2015.
Anything received after that time might be too late.


Build results:
total: 135 pass: 135 fail: 0
Qemu test results:
total: 58 pass: 56 fail: 2
Failed tests:
arm:realview-eb-mpcore:arm_realview_eb_defconfig
arm:realview-eb:arm_realview_eb_defconfig

As with 3.10, the failed qemu tests are not new problems, but found due to
newly introduced tests. Request to include the fix in -stable is here [1].

Details are available at http://server.roeck-us.net:8010/builders.

Guenter

---
[1] http://permalink.gmane.org/gmane.linux.kernel.stable/145285

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3.10 00/26] 3.10.86-stable review

2015-08-08 Thread Guenter Roeck

On 08/08/2015 03:07 PM, Greg Kroah-Hartman wrote:

This is the start of the stable review cycle for the 3.10.86 release.
There are 26 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 Mon Aug 10 22:07:03 UTC 2015.
Anything received after that time might be too late.



Build results:
total: 129 pass: 129 fail: 0
Qemu test results:
total: 53 pass: 51 fail: 2
Failed tests:
arm:realview-eb-mpcore:arm_realview_eb_defconfig
arm:realview-eb:arm_realview_eb_defconfig

The failed qemu tests are not new problems, but found due to newly
introduced tests. Request to include the fix in -stable is here [1].

Details are available at http://server.roeck-us.net:8010/builders.

Guenter

---
[1] http://permalink.gmane.org/gmane.linux.kernel.stable/145285

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] tools lib traceevent: add checks for returned EVENT_ERROR type

2015-08-08 Thread Namhyung Kim
On Fri, Aug 07, 2015 at 12:59:10PM +0200, Jiri Olsa wrote:
> On Mon, Aug 03, 2015 at 01:08:05PM -0400, Dean Nelson wrote:
> > The second warning message and SIGSEGV stem from the issue expressed in the
> > first warning message, and are the result of ignoring the EVENT_ERROR type
> > returned back through the call chain.
> > 
> > Dealing with the first warning message is beyond the scope of this patch. 
> > But
> > the second warning is addressed by this patch's first hunk. And the SIGSEGV 
> > is
> > eliminated by its second hunk.
> > 
> > Signed-off-by: Dean Nelson 
> > ---
> >  tools/lib/traceevent/event-parse.c | 5 -
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/lib/traceevent/event-parse.c 
> > b/tools/lib/traceevent/event-parse.c
> > index cc25f05..72e2933 100644
> > --- a/tools/lib/traceevent/event-parse.c
> > +++ b/tools/lib/traceevent/event-parse.c
> > @@ -1680,6 +1680,9 @@ process_cond(struct event_format *event, struct 
> > print_arg *top, char **tok)
> > type = process_arg(event, left, );
> >  
> >   again:
> > +   if (type == EVENT_ERROR)
> > +   goto out_free;
> > +
> > /* Handle other operations in the arguments */
> > if (type == EVENT_OP && strcmp(token, ":") != 0) {
> > type = process_op(event, left, );
> > @@ -1940,7 +1943,7 @@ process_op(struct event_format *event, struct 
> > print_arg *arg, char **tok)
> >  
> > type = process_arg_token(event, right, tok, type);
> >  
> > -   if (right->type == PRINT_OP &&
> > +   if (type != EVENT_ERROR && right->type == PRINT_OP &&

I think you'd better put the error check on separate lines.  Other
than that look good to me.

Thanks,
Namhyung


> > get_op_prio(arg->op.op) < get_op_prio(right->op.op)) {
> > struct print_arg tmp;
> >  
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 4/5] perf config: Add a option 'list-all' to perf-config

2015-08-08 Thread Namhyung Kim
On Sat, Aug 08, 2015 at 06:50:59PM +0900, Taewoong Song wrote:
> >>>   OPT_GROUP("Action"),
> >>>   OPT_BIT('l', "list", ,
> >>>   "show current config variables", ACTION_LIST),
> >>> + OPT_BIT('a', "list-all", ,
> >>> + "show current and all possible config variables with default 
> >>> values", ACTION_LIST_ALL),
> >> Why did you use OPT_BIT?  Do you want to support multiple 'actions' at
> >> the same time?  I'd rather support just one action, but I won't insist
> >> it strongly..  Anyway, setting bits will confuse the switch statement
> >> in the cmd_config().
> >> 
> >> Thanks,
> >> Namhyung
> >> 
> > I don't understand why setting bits will confuse the switch statement.
> > Is the reason about readability of source code ?
> > 
> > But I searched for other parse-option which can be replaced.
> > Is it better to use OPT_SET_INT instead of OPT_BIT ?
> > 
> 
> I modified source code to use OPT_SET_UINT
> but the problem is happened. I declared "enum actions” to use OPT_SET_UINT 
> like this.
> 
> enum actions {
> ACTION_LIST,
> ACTION_LIST_ALL,
> ACTION_REMOVE
> } actions;
> 
> But default value of actions” variable is 0 and ACTION_LIST is also 0
> so when ‘get’ or ’set’ feature is used, ‘default:' of the switch statement in 
> cmd_config() can’t reached
> because of default value of ‘actions’ variable is 0.

I don't know what's the problem.  You could either set default value
to -1 or make ACTION_LIST start from 1.

Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 4/5] perf config: Add a option 'list-all' to perf-config

2015-08-08 Thread Namhyung Kim
On Fri, Aug 07, 2015 at 10:12:02AM +0900, taeung wrote:
> Hi, Namhyung
> 
> On 07/27/2015 05:48 PM, Namhyung Kim wrote:
> >On Mon, Jul 27, 2015 at 12:58:30AM +0900, Taeung Song wrote:
> >>A option 'list-all' is to display both current config variables and
> >>all possible config variables with default values.
> >>The syntax examples are like below
> >>
> >> perf config [options]
> >>
> >> display all perf config with default values.
> >> # perf config -a | --list-all
> >>
> >>Signed-off-by: Taeung Song 
> >>---
> >>  tools/perf/Documentation/perf-config.txt |  6 
> >>  tools/perf/builtin-config.c  | 48 
> >> 
> >>  2 files changed, 54 insertions(+)
> >>
> >>diff --git a/tools/perf/Documentation/perf-config.txt 
> >>b/tools/perf/Documentation/perf-config.txt
> >>index cd4b1a6..d8b3acc 100644
> >>--- a/tools/perf/Documentation/perf-config.txt
> >>+++ b/tools/perf/Documentation/perf-config.txt
> >>@@ -11,6 +11,8 @@ SYNOPSIS
> >>  'perf config' [] [section.name[=value] ...]
> >>  or
> >>  'perf config' [] -l | --list
> >>+or
> >>+'perf config' [] -a | --list-all
> >>  DESCRIPTION
> >>  ---
> >>@@ -31,6 +33,10 @@ OPTIONS
> >>For writing and reading options: write to system-wide
> >>'$(sysconfdir)/perfconfig' or read it.
> >>+-a::
> >>+--list-all::
> >>+   Show current and all possible config variables with default values.
> >>+
> >>  CONFIGURATION FILE
> >>  --
> >>diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c
> >>index 6d9f28c..f4a1569 100644
> >>--- a/tools/perf/builtin-config.c
> >>+++ b/tools/perf/builtin-config.c
> >>@@ -23,6 +23,7 @@ static const char * const config_usage[] = {
> >>  };
> >>  #define ACTION_LIST (1<<0)
> >>+#define ACTION_LIST_ALL (1<<1)
> >>  static const struct option config_options[] = {
> >>OPT_GROUP("Config file location"),
> >>@@ -31,6 +32,8 @@ static const struct option config_options[] = {
> >>OPT_GROUP("Action"),
> >>OPT_BIT('l', "list", ,
> >>"show current config variables", ACTION_LIST),
> >>+   OPT_BIT('a', "list-all", ,
> >>+   "show current and all possible config variables with default 
> >>values", ACTION_LIST_ALL),
> >Why did you use OPT_BIT?  Do you want to support multiple 'actions' at
> >the same time?  I'd rather support just one action, but I won't insist
> >it strongly..  Anyway, setting bits will confuse the switch statement
> >in the cmd_config().
> >
> >Thanks,
> >Namhyung
> >
> I don't understand why setting bits will confuse the switch statement.
> Is the reason about readability of source code ?

Supposed you set ADD as 1 and DEL as 2.  If you want do both action,
it'll have value of 3.  But switch statement only have case 1 or 2
(unless you give all possible combinations - but I don't think we want
it).


> 
> But I searched for other parse-option which can be replaced.
> Is it better to use OPT_SET_INT instead of OPT_BIT ?

Please just use OPT_INTEGER.

Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] tools lib traceevent: add checks for returned EVENT_ERROR type

2015-08-08 Thread Namhyung Kim
Hi Dean,

On Fri, Aug 07, 2015 at 08:02:25AM -0500, Dean Nelson wrote:
> On 08/07/2015 07:16 AM, Namhyung Kim wrote:
> >Hi,
> >
> >On Fri, Aug 7, 2015 at 7:59 PM, Jiri Olsa  wrote:
> >>On Mon, Aug 03, 2015 at 01:08:05PM -0400, Dean Nelson wrote:
> >>>Running the following perf-stat command on an arm64 system produces the
> >>>following result...
> >>>
> >>>   [root@aarch64 ~]# perf stat -e kmem:mm_page_alloc -a sleep 1
> >>> Warning: [kmem:mm_page_alloc] function sizeof not defined
> >>> Warning: Error: expected type 4 but read 0
> >>>   Segmentation fault
> >
> >Oops,
> >
> >
> >>>   [root@aarch64 ~]#
> >>
> >>hum, what kernel are you running on? I dont see that warning
> >>on my system:
> >>
> >>[jolsa@krava perf]$ sudo ./perf stat -e kmem:mm_page_alloc -a sleep 1
> >>
> >>  Performance counter stats for 'system wide':
> >>
> >>227  kmem:mm_page_alloc
> >>
> >>1.000762466 seconds time elapsed
> >>
> >>Cc-ing Namhyung
> >
> >Yeah, it seems his kernel has sizeof() somewhere in the event format.
> >Anyway, it's not good to see a segfault.
> >
> >Dean, could you share your event format file?
> >
> >   $ sudo cat /sys/kernel/debug/tracing/events/kmem/mm_page_alloc/format
> 
> Sure, I've attached it. See my other email in reply to jirka's question
> about what kernel I was running on, for some details about where the
> sizeof operator comes from.

Thanks for the explanation.  It seems there's a problem in processing
'?' operator.  I'll take a look at it.

Thanks,
Namhyung


> name: mm_page_alloc
> ID: 360
> format:
>   field:unsigned short common_type;   offset:0;   size:2; 
> signed:0;
>   field:unsigned char common_flags;   offset:2;   size:1; 
> signed:0;
>   field:unsigned char common_preempt_count;   offset:3;   size:1; 
> signed:0;
>   field:int common_pid;   offset:4;   size:4; signed:1;
> 
>   field:unsigned long pfn;offset:8;   size:8; signed:0;
>   field:unsigned int order;   offset:16;  size:4; signed:0;
>   field:gfp_t gfp_flags;  offset:20;  size:4; signed:0;
>   field:int migratetype;  offset:24;  size:4; signed:1;
> 
> print fmt: "page=%p pfn=%lu order=%d migratetype=%d gfp_flags=%s", REC->pfn 
> != -1UL ? (((struct page *)0xUL) << ((42) - 1)) - (1UL << 
> ((16 - 3) * 2 + 3)) - (1UL << ((42) - 16)) * sizeof(struct page))) + 
> ((typeof(((1UL << ((42) - 16)) * sizeof(struct page(((1UL << ((16 - 3) * 
> 2 + 3 - 1)) & ~((typeof(((1UL << ((42) - 16)) * sizeof(struct 
> page(((1UL << ((16 - 3) * 2 + 3 - 1)) - 0x0001) + 0x0001)) + 
> (REC->pfn)) : ((void *)0), REC->pfn != -1UL ? REC->pfn : 0, REC->order, 
> REC->migratetype, (REC->gfp_flags) ? __print_flags(REC->gfp_flags, "|", 
> {(unsigned long)(( gfp_t)0x10u) | (( gfp_t)0x40u) | (( gfp_t)0x80u) | (( 
> gfp_t)0x2u)) | (( gfp_t)0x02u)) | (( gfp_t)0x08u)) | (( gfp_t)0x4000u) | 
> (( gfp_t)0x1u) | (( gfp_t)0x1000u) | (( gfp_t)0x200u) | (( 
> gfp_t)0x40u)), "GFP_TRANSHUGE"}, {(unsigned long)( gfp_t)0x10u) | (( 
> gfp_t)0x40u) | (( gfp_t)0x80u) | (( gfp_t)0x2u)) | (( gfp_t)0x02u)) | (( 
> gfp_t)0x08u)), "GFP_HIGHUSER_MOVABLE"}, {(unsigned long) gfp_t)0x10u) | 
> (( gfp_t)0x40u) | (( gfp_t)0x80u) | (( gfp_t)0x2u)) | (( gfp_t)0x02u)), 
> "GFP_HIGHUSER"}, {(unsigned long)((( gfp_t)0x10u) | (( gfp_t)0x40u) | (( 
> gfp_t)0x80u) | (( gfp_t)0x2u)), "GFP_USER"}, {(unsigned long)((( 
> gfp_t)0x10u) | (( gfp_t)0x40u) | (( gfp_t)0x80u) | (( gfp_t)0x8u)), 
> "GFP_TEMPORARY"}, {(unsigned long)((( gfp_t)0x10u) | (( gfp_t)0x40u) | (( 
> gfp_t)0x80u)), "GFP_KERNEL"}, {(unsigned long)((( gfp_t)0x10u) | (( 
> gfp_t)0x40u)), "GFP_NOFS"}, {(unsigned long)((( gfp_t)0x20u)), "GFP_ATOMIC"}, 
> {(unsigned long)((( gfp_t)0x10u)), "GFP_NOIO"}, {(unsigned long)(( 
> gfp_t)0x20u), "GFP_HIGH"}, {(unsigned long)(( gfp_t)0x10u), "GFP_WAIT"}, 
> {(unsigned long)(( gfp_t)0x40u), "GFP_IO"}, {(unsigned long)(( gfp_t)0x100u), 
> "GFP_COLD"}, {(unsigned long)(( gfp_t)0x200u), "GFP_NOWARN"}, {(unsigned 
> long)(( gfp_t)0x400u), "GFP_REPEAT"}, {(unsigned long)(( gfp_t)0x800u), 
> "GFP_NOFAIL"}, {(unsigned long)(( gfp_t)0x1000u), "GFP_NORETRY"}, {(unsigned 
> long)(( gfp_t)0x4000u), "GFP_COMP"}, {(unsigned long)(( gfp_t)0x8000u), 
> "GFP_ZERO"}, {(unsigned long)(( gfp_t)0x1u), "GFP_NOMEMALLOC"}, 
> {(unsigned long)(( gfp_t)0x2000u), "GFP_MEMALLOC"}, {(unsigned long)(( 
> gfp_t)0x2u), "GFP_HARDWALL"}, {(unsigned long)(( gfp_t)0x4u), 
> "GFP_THISNODE"}, {(unsigned long)(( gfp_t)0x8u), "GFP_RECLAIMABLE"}, 
> {(unsigned long)(( gfp_t)0x08u), "GFP_MOVABLE"}, {(unsigned long)(( 
> gfp_t)0x20u), "GFP_NOTRACK"}, {(unsigned long)(( gfp_t)0x40u), 
> "GFP_NO_KSWAPD"}, {(unsigned long)(( gfp_t)0x80u), "GFP_OTHER_NODE"} ) : 
> "GFP_NOWAIT"

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org

Re: powerpc: Add an inline function to update HID0

2015-08-08 Thread Benjamin Herrenschmidt
On Tue, 2015-08-04 at 20:08 +1000, Michael Ellerman wrote:
> On Tue, 2015-04-08 at 08:30:58 UTC, "Gautham R. Shenoy" wrote:
> > Section 3.7 of Version 1.2 of the Power8 Processor User's Manual
> > prescribes that updates to HID0 be preceded by a SYNC instruction and
> > followed by an ISYNC instruction (Page 91).
> > 
> > Create a function name update_hid0() which follows this recipe and
> > invoke it from the static split core path.
> > 
> > Signed-off-by: Gautham R. Shenoy 
> > ---
> >  arch/powerpc/include/asm/kvm_ppc.h   | 11 +++
> 
> Why is it in there? It's not KVM related per se.
> 
> Where should it go? I think reg.h would be best, ideally near the definition
> for HID0, though that's probably not possible because of ASSEMBLY 
> requirements.
> So at the bottom of reg.h ?
> 
> > diff --git a/arch/powerpc/include/asm/kvm_ppc.h 
> > b/arch/powerpc/include/asm/kvm_ppc.h
> > index c6ef05b..325f1d6 100644
> > --- a/arch/powerpc/include/asm/kvm_ppc.h
> > +++ b/arch/powerpc/include/asm/kvm_ppc.h
> > @@ -685,4 +685,15 @@ static inline ulong kvmppc_get_ea_indexed(struct 
> > kvm_vcpu *vcpu, int ra, int rb)
> >  
> >  extern void xics_wake_cpu(int cpu);
> >  
> > +static inline void update_hid0(unsigned long hid0)
> > +{
> > +   /*
> > +*  The HID0 update should at the very least be preceded by a
> > +*  a SYNC instruction followed by an ISYNC instruction
> > +*/
> > +   mb();
> > +   mtspr(SPRN_HID0, hid0);
> > +   isync();
> 
> That's going to turn into three separate inline asm blocks, which is maybe a
> bit unfortunate. Have you checked the generated code is what we want, ie. just
> sync, mtspr, isync ?

It depends on the processor, I'd rather we make this out of line in
misc.S or similar and use the appropriate CPU table bits and pieces.

Some older CPUs require whacking it N times for example.

Cheers,
Ben.

> cheers
> ___
> Linuxppc-dev mailing list
> linuxppc-...@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/5] drivers/tty: make serial/mpsc.c driver explicitly non-modular

2015-08-08 Thread Paul Gortmaker
The Kconfig for this driver is currently:

config SERIAL_MPSC
bool "Marvell MPSC serial port support"

...meaning that it currently is not being built as a module by anyone.
Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.

We leave some tags like MODULE_AUTHOR for documentation purposes.

Cc: Greg Kroah-Hartman 
Cc: Jiri Slaby 
Cc: linux-ser...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/tty/serial/mpsc.c | 36 +++-
 1 file changed, 3 insertions(+), 33 deletions(-)

diff --git a/drivers/tty/serial/mpsc.c b/drivers/tty/serial/mpsc.c
index 82bb6d1fe23b..edb32e3f1e84 100644
--- a/drivers/tty/serial/mpsc.c
+++ b/drivers/tty/serial/mpsc.c
@@ -55,8 +55,6 @@
 #define SUPPORT_SYSRQ
 #endif
 
-#include 
-#include 
 #include 
 #include 
 #include 
@@ -2108,24 +2106,8 @@ static int mpsc_drv_probe(struct platform_device *dev)
return rc;
 }
 
-static int mpsc_drv_remove(struct platform_device *dev)
-{
-   pr_debug("mpsc_drv_exit: Removing MPSC %d\n", dev->id);
-
-   if (dev->id < MPSC_NUM_CTLRS) {
-   uart_remove_one_port(_reg, _ports[dev->id].port);
-   mpsc_release_port((struct uart_port *)
-   _ports[dev->id].port);
-   mpsc_drv_unmap_regs(_ports[dev->id]);
-   return 0;
-   } else {
-   return -ENODEV;
-   }
-}
-
 static struct platform_driver mpsc_driver = {
.probe  = mpsc_drv_probe,
-   .remove = mpsc_drv_remove,
.driver = {
.name   = MPSC_CTLR_NAME,
},
@@ -2156,22 +2138,10 @@ static int __init mpsc_drv_init(void)
 
return rc;
 }
+device_initcall(mpsc_drv_init);
 
-static void __exit mpsc_drv_exit(void)
-{
-   platform_driver_unregister(_driver);
-   platform_driver_unregister(_shared_driver);
-   uart_unregister_driver(_reg);
-   memset(mpsc_ports, 0, sizeof(mpsc_ports));
-   memset(_shared_regs, 0, sizeof(mpsc_shared_regs));
-}
-
-module_init(mpsc_drv_init);
-module_exit(mpsc_drv_exit);
-
+/*
 MODULE_AUTHOR("Mark A. Greer ");
 MODULE_DESCRIPTION("Generic Marvell MPSC serial/UART driver");
-MODULE_VERSION(MPSC_VERSION);
 MODULE_LICENSE("GPL");
-MODULE_ALIAS_CHARDEV_MAJOR(MPSC_MAJOR);
-MODULE_ALIAS("platform:" MPSC_CTLR_NAME);
+*/
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/5] drivers/tty: make more bool drivers explicitly non-modular

2015-08-08 Thread Paul Gortmaker
This second set of patches to drivers/tty steps outside of the serial
dir, and an improved auditing finds two more serial drivers pretending
to be modular that really are not.

The reasoning for doing this is the same as the first set[1] of patches
and is largely copied below:

  In the previous merge window, we made changes to allow better
  delineation between modular and non-modular code in commit
  0fd972a7d91d6e15393c449492a04d94c0b89351 ("module: relocate module_init
  from init.h to module.h").  This allows us to now ensure module code
  looks modular and non-modular code does not accidentally look modular
  without suffering build breakage.
  
  Here we target code that is, by nature of their Kconfig settings, only
  available to be built-in, but implicitly presenting itself as being
  possibly modular by way of using modular headers, macros, and functions.
  
  The goal here is to remove that illusion of modularity from these
  drivers, but in a way that leaves the actual runtime unchanged.
  In doing so, we remove code that has never been tested and adds
  no value to the tree.  And we begin the process of expecting a
  level of consistency between the Kconfig of a driver and the code
  that the driver uses.
  
Build tested for allyesconfig on x86_64, and ARM for lpc81xx, and powerpc
for hvc_console and mpsc, layered onto tty/tty-next as a baseline.

Paul.

[1] 
https://lkml.kernel.org/r/1437530538-5078-1-git-send-email-paul.gortma...@windriver.com
--

Cc: Greg Kroah-Hartman 
Cc: Jiri Slaby 
Cc: Joachim Eastwood 
Cc: linux-arm-ker...@lists.infradead.org
Cc: linuxppc-...@lists.ozlabs.org
Cc: linux-ser...@vger.kernel.org

Paul Gortmaker (5):
  drivers/tty: make pty.c slightly more explicitly non-modular
  drivers/tty: make sysrq.c slightly more explicitly non-modular
  drivers/tty: make hvc_console.c explicitly non-modular
  drivers/tty: make serial/mpsc.c driver explicitly non-modular
  drivers/tty: make serial 8250_lpc18xx.c explicitly non-modular

 drivers/tty/hvc/hvc_console.c  | 18 +
 drivers/tty/pty.c  |  7 +--
 drivers/tty/serial/8250/8250_lpc18xx.c | 19 --
 drivers/tty/serial/mpsc.c  | 36 +++---
 drivers/tty/sysrq.c|  6 +-
 5 files changed, 18 insertions(+), 68 deletions(-)

-- 
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/5] drivers/tty: make sysrq.c slightly more explicitly non-modular

2015-08-08 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

config.debug:config MAGIC_SYSRQ
  bool "Magic SysRq key"

...meaning that it currently is not being built as a module by anyone.

Lets remove the traces of modularity we can so that when reading the
driver there is less doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.

We don't delete the module.h include since other parts of the file are
using content from there.

Cc: Greg Kroah-Hartman 
Cc: Jiri Slaby 
Signed-off-by: Paul Gortmaker 
---
 drivers/tty/sysrq.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index b5b427888b24..dd2c435e223e 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -996,6 +996,10 @@ static const struct kernel_param_ops 
param_ops_sysrq_reset_seq = {
 #define param_check_sysrq_reset_seq(name, p)   \
__param_check(name, p, unsigned short)
 
+/*
+ * not really modular, but the easiest way to keep compat with existing
+ * bootargs behaviour is to continue using module_param here.
+ */
 module_param_array_named(reset_seq, sysrq_reset_seq, sysrq_reset_seq,
 _reset_seq_len, 0644);
 
@@ -1112,4 +1116,4 @@ static int __init sysrq_init(void)
 
return 0;
 }
-module_init(sysrq_init);
+device_initcall(sysrq_init);
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/5] drivers/tty: make hvc_console.c explicitly non-modular

2015-08-08 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/tty/hvc/Kconfig:config HVC_DRIVER
drivers/tty/hvc/Kconfig:bool

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only, even
though someone bothered to comment that the code was not used.

Unlike other changes, this driver binds in w/o using module_init,
so we dont have init ordering concerns with this commit.

Cc: Greg Kroah-Hartman 
Cc: Jiri Slaby 
Cc: linuxppc-...@lists.ozlabs.org
Signed-off-by: Paul Gortmaker 
---
 drivers/tty/hvc/hvc_console.c | 18 +-
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
index 4e9c4cc9e1b5..9c30f67c802a 100644
--- a/drivers/tty/hvc/hvc_console.c
+++ b/drivers/tty/hvc/hvc_console.c
@@ -29,7 +29,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -1005,19 +1005,3 @@ put_tty:
 out:
return err;
 }
-
-/* This isn't particularly necessary due to this being a console driver
- * but it is nice to be thorough.
- */
-static void __exit hvc_exit(void)
-{
-   if (hvc_driver) {
-   kthread_stop(hvc_task);
-
-   tty_unregister_driver(hvc_driver);
-   /* return tty_struct instances allocated in hvc_init(). */
-   put_tty_driver(hvc_driver);
-   unregister_console(_console);
-   }
-}
-module_exit(hvc_exit);
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/5] drivers/tty: make serial 8250_lpc18xx.c explicitly non-modular

2015-08-08 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

8250/Kconfig:config SERIAL_8250_LPC18XX
8250/Kconfig:bool "NXP LPC18xx/43xx serial port support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We leave some tags like MODULE_AUTHOR for documentation purposes.

Cc: Greg Kroah-Hartman 
Cc: Jiri Slaby 
Cc: Joachim Eastwood 
Cc: linux-ser...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Signed-off-by: Paul Gortmaker 
---
 drivers/tty/serial/8250/8250_lpc18xx.c | 19 ---
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_lpc18xx.c 
b/drivers/tty/serial/8250/8250_lpc18xx.c
index 99cd478851ff..f5112bee1ab6 100644
--- a/drivers/tty/serial/8250/8250_lpc18xx.c
+++ b/drivers/tty/serial/8250/8250_lpc18xx.c
@@ -15,7 +15,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -198,33 +198,22 @@ dis_clk_reg:
return ret;
 }
 
-static int lpc18xx_serial_remove(struct platform_device *pdev)
-{
-   struct lpc18xx_uart_data *data = platform_get_drvdata(pdev);
-
-   serial8250_unregister_port(data->line);
-   clk_disable_unprepare(data->clk_uart);
-   clk_disable_unprepare(data->clk_reg);
-
-   return 0;
-}
-
 static const struct of_device_id lpc18xx_serial_match[] = {
{ .compatible = "nxp,lpc1850-uart" },
{ },
 };
-MODULE_DEVICE_TABLE(of, lpc18xx_serial_match);
 
 static struct platform_driver lpc18xx_serial_driver = {
.probe  = lpc18xx_serial_probe,
-   .remove = lpc18xx_serial_remove,
.driver = {
.name = "lpc18xx-uart",
.of_match_table = lpc18xx_serial_match,
},
 };
-module_platform_driver(lpc18xx_serial_driver);
+builtin_platform_driver(lpc18xx_serial_driver);
 
+/*
 MODULE_AUTHOR("Joachim Eastwood ");
 MODULE_DESCRIPTION("Serial port driver NXP LPC18xx/43xx devices");
 MODULE_LICENSE("GPL v2");
+*/
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/5] drivers/tty: make pty.c slightly more explicitly non-modular

2015-08-08 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/tty/Kconfig:config LEGACY_PTYS
drivers/tty/Kconfig:bool "Legacy (BSD) PTY support"

...and:

drivers/tty/Kconfig:config UNIX98_PTYS
drivers/tty/Kconfig:bool "Unix98 PTY support" if EXPERT

combined with this:

obj-$(CONFIG_LEGACY_PTYS)   += pty.o
obj-$(CONFIG_UNIX98_PTYS)   += pty.o

...meaning that it currently is not being built as a module by anyone.

Lets remove the traces of modularity we can so that when reading the
driver there is less doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.

We don't delete the module.h include since other parts of the file are
using content from there.

Cc: Greg Kroah-Hartman 
Cc: Jiri Slaby 
Signed-off-by: Paul Gortmaker 
---
 drivers/tty/pty.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index 4d5937c185c1..a45660f62db5 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -7,7 +7,6 @@
  */
 
 #include 
-
 #include 
 #include 
 #include 
@@ -501,6 +500,10 @@ static int pty_bsd_ioctl(struct tty_struct *tty,
 }
 
 static int legacy_count = CONFIG_LEGACY_PTY_COUNT;
+/*
+ * not really modular, but the easiest way to keep compat with existing
+ * bootargs behaviour is to continue using module_param here.
+ */
 module_param(legacy_count, int, 0);
 
 /*
@@ -877,4 +880,4 @@ static int __init pty_init(void)
unix98_pty_init();
return 0;
 }
-module_init(pty_init);
+device_initcall(pty_init);
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging/lustre/llite: get rid of unused ll_super_blocks list

2015-08-08 Thread green
From: Oleg Drokin 

ll_super_blocks became unused quite a while ago with switch
to the new CLIO code.
So this patch removes the list, ll_sb_lock spinlock that guards it
and superblock info ll_list linkage.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/llite_internal.h |  1 -
 drivers/staging/lustre/lustre/llite/llite_lib.c  | 14 +-
 2 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h 
b/drivers/staging/lustre/lustre/llite/llite_internal.h
index f097d4d..ec27974 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -456,7 +456,6 @@ struct eacl_table {
 };
 
 struct ll_sb_info {
-   struct list_head  ll_list;
/* this protects pglist and ra_info.  It isn't safe to
 * grab from interrupt contexts */
spinlock_tll_lock;
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 55e2dc6..b4ed6c8 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -60,9 +60,6 @@ struct kmem_cache *ll_file_data_slab;
 struct dentry *llite_root;
 struct kset *llite_kset;
 
-static LIST_HEAD(ll_super_blocks);
-static DEFINE_SPINLOCK(ll_sb_lock);
-
 #ifndef log2
 #define log2(n) ffz(~(n))
 #endif
@@ -112,10 +109,6 @@ static struct ll_sb_info *ll_init_sbi(struct super_block 
*sb)
class_uuid_unparse(uuid, >ll_sb_uuid);
CDEBUG(D_CONFIG, "generated uuid: %s\n", sbi->ll_sb_uuid.uuid);
 
-   spin_lock(_sb_lock);
-   list_add_tail(>ll_list, _super_blocks);
-   spin_unlock(_sb_lock);
-
sbi->ll_flags |= LL_SBI_VERBOSE;
sbi->ll_flags |= LL_SBI_CHECKSUM;
 
@@ -144,12 +137,7 @@ static void ll_free_sbi(struct super_block *sb)
 {
struct ll_sb_info *sbi = ll_s2sbi(sb);
 
-   if (sbi != NULL) {
-   spin_lock(_sb_lock);
-   list_del(>ll_list);
-   spin_unlock(_sb_lock);
-   kfree(sbi);
-   }
+   kfree(sbi);
 }
 
 static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RT 0/6] Linux 3.14.48-rt49-rc1

2015-08-08 Thread Paul Gortmaker
[Re: [PATCH RT 0/6] Linux 3.14.48-rt49-rc1] On 08/08/2015 (Sat 19:23) Steven 
Rostedt wrote:

> On Sat, 8 Aug 2015 19:10:17 -0400
> Paul Gortmaker  wrote:
> 
> 
> > So we took 20 IRQs in 5s, or 4/s ; not quite the 1/s minimum, but 
> > definitely not
> > the HZ/s we'd get w/o NOHZ_FULL.  Re-running it got consistently 18-20 IRQ 
> > / 5s.
> 
> OK, so NO_HZ_FULL still isn't great on -rt, but this shows that it
> keeps disturbances much lower than without it.

Here is several runs on vanilla ("make oldconfig" of the -rt .config)
and all else (bootargs, isolation, rcu offload) the same:

--
root@testbox:/home/paul# ./t 
 LOC:  86341740724708694679
663649633619545526512
494481463448434420404   Local 
timer interrupts
 LOC:  91349742727708694679
663649633619545526512
496483465450436423406   Local 
timer interrupts
 LOC:  96353742727710697709
665651635622547528514
496483465450436423406   Local 
timer interrupts
root@testbox:/home/paul# ./t 
 LOC: 106188744729712699711
667653638624549530514
498485467452438425408   Local 
timer interrupts
 LOC: 94746729712699711
667653638624549530516
500487469454440427410   Local 
timer interrupts
 LOC: 116199746731714701729
669655640626551532516
500487469454440427410   Local 
timer interrupts
root@testbox:/home/paul# ./t 
 LOC: 122860748733716703731
669655640626551532518
502489471456442429412   Local 
timer interrupts
 LOC: 127866748733716703731
671657642628553534520
504492473456442429412   Local 
timer interrupts
 LOC: 132872750735718706748
671657642628553534520
504492473458444431415   Local 
timer interrupts
root@testbox:/home/paul# cat /proc/version 
Linux version 3.14.48 (paul@yow-dellw-pg2) (gcc version 4.8.2 (Ubuntu 
4.8.2-19ubuntu1) ) #2 SMP PREEMPT Sat Aug 8 19:52:12 EDT 2015
root@testbox:/home/paul# 
--

So 30, 18, and 17 per 5s interval.  I'd say that is statisitcally close
enough to -rt on this simple test to call -rt on par with vanilla.

Things might show a difference with more complicated tests, more cores
doing real work etc etc. -- this really is just a simple sanity test
though...  but at least it is a test that we now can pass!

Paul.
--

> 
> Thanks for the report!
> 
> -- Steve
> 
> > 
> > I specifically did NOT unplug and replug cores to "clean" them of tasks; the
> > hotplug code just seems to unstable for that from what I've seen in the 
> > past,
> > and by the looks of the irq counts above, there was no need to either.
> > 
> > The rootfs was basically a ubu 14.10 server install (no X11/gfx) -- not that
> > it should matter - so long as other tasks weren't running on the nohz cores.
> > 
> > Paul.
> > --
> > 
> > >
> > > Enjoy,
> > >
> > > -- Steve
> > >
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Purchasing/Infrared lamp therapy products/Aukewel Co., ltd

2015-08-08 Thread Woody Wu
Dear Client,

Have a good day!
Glad to learn you're on the market of Infrared Lamp products

We are the manufacture at family use electronic health devices since 2000.
We keep good quality and reliable cooperation for global valued customers. 

Main products include infrared lamp.

If any product meet your demand, please contact us. 
Any of your question will be replied prompt.


Best regards.

Woody 
WooN�Р骒r��yb�X�肚�v�^�)藓{.n�+�伐�{��赙zXФ�≤�}��财�z�:+v�����赙zZ+��+zf"�h���~i���z��wア�?�ㄨ��&�)撷f��^j谦y�m��@A�a囤�
0鹅h���i

Re: [PATCH RT 0/6] Linux 3.14.48-rt49-rc1

2015-08-08 Thread Steven Rostedt
On Sat, 8 Aug 2015 19:10:17 -0400
Paul Gortmaker  wrote:


> So we took 20 IRQs in 5s, or 4/s ; not quite the 1/s minimum, but definitely 
> not
> the HZ/s we'd get w/o NOHZ_FULL.  Re-running it got consistently 18-20 IRQ / 
> 5s.

OK, so NO_HZ_FULL still isn't great on -rt, but this shows that it
keeps disturbances much lower than without it.

Thanks for the report!

-- Steve

> 
> I specifically did NOT unplug and replug cores to "clean" them of tasks; the
> hotplug code just seems to unstable for that from what I've seen in the past,
> and by the looks of the irq counts above, there was no need to either.
> 
> The rootfs was basically a ubu 14.10 server install (no X11/gfx) -- not that
> it should matter - so long as other tasks weren't running on the nohz cores.
> 
> Paul.
> --
> 
> >
> > Enjoy,
> >
> > -- Steve
> >

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RT 0/6] Linux 3.14.48-rt49-rc1

2015-08-08 Thread Paul Gortmaker
[[PATCH RT 0/6] Linux 3.14.48-rt49-rc1] On 06/08/2015 (Thu 18:17) Steven 
Rostedt wrote:

>
> Dear RT Folks,
>
> This is the RT stable review cycle of patch 3.14.48-rt49-rc1.
>
> Please scream at me if I messed something up. Please test the patches too.
>
> The -rc release will be uploaded to kernel.org and will be deleted when
> the final release is out. This is just a review release (or release 
> candidate).
>
> The pre-releases will not be pushed to the git repository, only the
> final release is.
>
> If all goes well, this patch will be converted to the next main release
> on 8/10/2015.
>
> Note, these changes appear to make NO_HZ_FULL work as well as 3.18-rt does.

Appears to pass a simple sanity test here as well.  Built basically a
defconfig + RT_FULL + NOHZ_FULL + FHANDLE + DEVTMPFS and ran this simple
test "t" -- meant to test 1st NOHZ and then NOHZ_FULL (loaded core).

Bootargs (below) and irqaffine and rcu-affine scripts (also below) are
meant to dump all housekeeping crap onto core zero.

---
root@testbox:/home/paul# cat t
cat /proc/interrupts |grep LOC
sleep 5
cat /proc/interrupts |grep LOC

taskset -c 5 ./eatme &
sleep 5
cat /proc/interrupts |grep LOC
kill %
root@testbox:/home/paul# ./t
 LOC: 220787   1635   1614   1597   1579   1563   
1543   1529   1512   1492   1414   1392   1375   
1360   1342   1327   1307   1290   1277   1260   Local 
timer interrupts
 LOC: 225795   1637   1616   1597   1579   1563   
1543   1529   1512   1492   1414   1392   1375   
1362   1345   1329   1310   1293   1279   1262   Local 
timer interrupts
 LOC: 230800   1637   1616   1599   1582   1583   
1545   1532   1514   1494   1416   1394   1377   
1362   1345   1329   1310   1293   1279   1262   Local 
timer interrupts
root@testbox:/home/paul# jobs
root@testbox:/home/paul# cat /proc/version
Linux version 3.14.48-rt49-rc1-00071-g3fdc6bccf1b7 (paul@yow-dellw-pg2) (gcc 
version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #1 SMP PREEMPT RT Sat Aug 8 15:08:25 
EDT 2015
root@testbox:/home/paul# cat /proc/cmdline
root=/dev/sda2 ro console=ttyS0,115200 isolcpus=1-20 rcu_nocbs=1-20 
rcu_nocb_poll nohz_full=1-20 irqaffinity=0 idle=poll tsc=perfect
root@testbox:/home/paul# cat no-rcu
for i in `pgrep rcuo` ; do taskset -c -p 0 $i ; done
root@testbox:/home/paul# cat clear-core
#!/bin/bash
# for all interrupting devices; move them to core zero; assumes that

for i in `cat /proc/interrupts | grep '^ *[0-9]*[0-9]:' |awk {'print $1}'|sed 
's/:$//' `; do
# Timer
if [ "$i" = "0" ]; then
continue
fi
# cascade
if [ "$i" = "2" ]; then
continue
fi
echo setting $i to affine for core zero
echo 1 > /proc/irq/$i/smp_affinity
done
root@testbox:/home/paul#
---

So we took 20 IRQs in 5s, or 4/s ; not quite the 1/s minimum, but definitely not
the HZ/s we'd get w/o NOHZ_FULL.  Re-running it got consistently 18-20 IRQ / 5s.

I specifically did NOT unplug and replug cores to "clean" them of tasks; the
hotplug code just seems to unstable for that from what I've seen in the past,
and by the looks of the irq counts above, there was no need to either.

The rootfs was basically a ubu 14.10 server install (no X11/gfx) -- not that
it should matter - so long as other tasks weren't running on the nohz cores.

Paul.
--

>
> Enjoy,
>
> -- Steve
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH 0/4] Shared vhost design

2015-08-08 Thread Bandan Das
Hi Michael,

"Michael S. Tsirkin"  writes:

> On Mon, Jul 13, 2015 at 12:07:31AM -0400, Bandan Das wrote:
>> Hello,
>> 
>> There have been discussions on improving the current vhost design. The first
>> attempt, to my knowledge was Shirley Ma's patch to create a dedicated vhost
>> worker per cgroup.
>> 
>> http://comments.gmane.org/gmane.linux.network/224730
>> 
>> Later, I posted a cmwq based approach for performance comparisions
>> http://comments.gmane.org/gmane.linux.network/286858
>> 
>> More recently was the Elvis work that was presented in KVM Forum 2013
>> http://www.linux-kvm.org/images/a/a3/Kvm-forum-2013-elvis.pdf
>> 
>> The Elvis patches rely on common vhost thread design for scalability
>> along with polling for performance. Since there are two major changes
>> being proposed, we decided to split up the work. The first (this RFC),
>> proposing a re-design of the vhost threading model and the second part
>> (not posted yet) to focus more on improving performance. 
>> 
>> I am posting this with the hope that we can have a meaningful discussion
>> on the proposed new architecture. We have run some tests to show that the new
>> design is scalable and in terms of performance, is comparable to the current
>> stable design. 
>> 
>> Test Setup:
>> The testing is based on the setup described in the Elvis proposal.
>> The initial tests are just an aggregate of Netperf STREAM and MAERTS but
>> as we progress, I am happy to run more tests. The hosts are two identical
>> 16 core Haswell systems with point to point network links. For the first 10 
>> runs,
>> with n=1 upto n=10 guests running in parallel, I booted the target system 
>> with nr_cpus=8
>> and mem=12G. The purpose was to do a comparision of resource utilization
>> and how it affects performance. Finally, with the number of guests set at 14,
>> I didn't limit the number of CPUs booted on the host or limit memory seen by
>> the kernel but boot the kernel with isolcpus=14,15 that will be used to run
>> the vhost threads. The guests are pinned to cpus 0-13 and based on which
>> cpu the guest is running on, the corresponding I/O thread is either pinned
>> to cpu 14 or 15.
>> Results
>> # X axis is number of guests
>> # Y axis is netperf number
>> # nr_cpus=8 and mem=12G
>> #Number of Guests#Baseline#ELVIS
>> 11119.3.0
>> 2 1135.6   1130.2
>> 3 1135.5   1131.6
>> 4 1136.0   1127.1
>> 5 1118.6   1129.3
>> 6 1123.4   1129.8
>> 7 1128.7   1135.4
>> 8 1129.9   1137.5
>> 9 1130.6   1135.1
>> 101129.3   1138.9
>> 14*   1173.8   1216.9
>
> I'm a bit too busy now, with 2.4 and related stuff, will review once we
> finish 2.4.  But I'd like to ask two things:
> - did you actually test a config where cgroups were used?

Here are some numbers with a simple cgroup setup.

Three cgroups with cpusets cpu=0,2,4 for cgroup1, cpu=1,3,5 for cgroup2 and 
cpu=6,7
for cgroup3 (even though 6,7 have different numa nodes)

I run netperf for 1 to 9 guests starting with assigning the first guest
to cgroup1, second to cgroup2, third to cgroup3 and repeat this sequence
upto 9 guests.

The numbers  - (TCP_STREAM + TCP_MAERTS)/2

 #Number of Guests #ELVIS (Mbps)
 11056.9
 21122.5
 31122.8
 41123.2
 51122.6
 61110.3
 71116.3
 81121.8
 91118.5

Maybe, my cgroup setup was too simple but these numbers are comparable
to the no cgroups results above. I wrote some tracing code to trace
cgroup_match_groups() and find cgroup search overhead but it seemed
unnecessary for this particular test.


> - does the design address the issue of VM 1 being blocked
>   (e.g. because it hits swap) and blocking VM 2?
Good question. I haven't thought of this yet. But IIUC,
the worker thread will complete VM1's job and then move on to
executing VM2's scheduled work. It doesn't matter if VM1 is
blocked currently. I think it would be a problem though if/when
polling is introduced.

>> 
>> #* Last run with the vCPU and I/O thread(s) pinned, no CPU/memory limit 
>> imposed.
>> #  I/O thread runs on CPU 14 or 15 depending on which guest it's serving
>> 
>> There's a simple graph at
>> http://people.redhat.com/~bdas/elvis/data/results.png
>> that shows how task affinity results in a jump and even without it,
>> as the number of guests increase, the shared vhost design performs
>> slightly better.
>> 
>> Observations:
>> 1. In terms of "stock" performance, the results are 

[PATCH 3.10 15/26] Input: usbtouchscreen - avoid unresponsive TSC-30 touch screen

2015-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Bernhard Bender 

commit 968491709e5b1aaf429428814fff3d932fa90b60 upstream.

This patch fixes a problem in the usbtouchscreen driver for DMC TSC-30
touch screen.  Due to a missing delay between the RESET and SET_RATE
commands, the touch screen may become unresponsive during system startup or
driver loading.

According to the DMC documentation, a delay is needed after the RESET
command to allow the chip to complete its internal initialization. As this
delay is not guaranteed, we had a system where the touch screen
occasionally did not send any touch data. There was no other indication of
the problem.

The patch fixes the problem by adding a 150ms delay between the RESET and
SET_RATE commands.

Suggested-by: Jakob Mustafa 
Signed-off-by: Bernhard Bender 
Signed-off-by: Dmitry Torokhov 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/input/touchscreen/usbtouchscreen.c |3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -626,6 +626,9 @@ static int dmc_tsc10_init(struct usbtouc
goto err_out;
}
 
+   /* TSC-25 data sheet specifies a delay after the RESET command */
+   msleep(150);
+
/* set coordinate output rate */
buf[0] = buf[1] = 0xFF;
ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0),


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 16/26] blkcg: fix gendisk reference leak in blkg_conf_prep()

2015-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Tejun Heo 

commit 5f6c2d2b7dbb541c1e922538c49fa04c494ae3d7 upstream.

When a blkcg configuration is targeted to a partition rather than a
whole device, blkg_conf_prep fails with -EINVAL; unfortunately, it
forgets to put the gendisk ref in that case.  Fix it.

Signed-off-by: Tejun Heo 
Signed-off-by: Jens Axboe 
Signed-off-by: Greg Kroah-Hartman 

---
 block/blk-cgroup.c |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -720,8 +720,12 @@ int blkg_conf_prep(struct blkcg *blkcg,
return -EINVAL;
 
disk = get_gendisk(MKDEV(major, minor), );
-   if (!disk || part)
+   if (!disk)
return -EINVAL;
+   if (part) {
+   put_disk(disk);
+   return -EINVAL;
+   }
 
rcu_read_lock();
spin_lock_irq(disk->queue->queue_lock);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 01/26] mm: avoid setting up anonymous pages into file mapping

2015-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: "Kirill A. Shutemov" 

commit 6b7339f4c31ad69c8e9c0b2859276e22cf72176d upstream.

Reading page fault handler code I've noticed that under right
circumstances kernel would map anonymous pages into file mappings: if
the VMA doesn't have vm_ops->fault() and the VMA wasn't fully populated
on ->mmap(), kernel would handle page fault to not populated pte with
do_anonymous_page().

Let's change page fault handler to use do_anonymous_page() only on
anonymous VMA (->vm_ops == NULL) and make sure that the VMA is not
shared.

For file mappings without vm_ops->fault() or shred VMA without vm_ops,
page fault on pte_none() entry would lead to SIGBUS.

Signed-off-by: Kirill A. Shutemov 
Acked-by: Oleg Nesterov 
Cc: Andrew Morton 
Cc: Willy Tarreau 
Cc: sta...@vger.kernel.org
Signed-off-by: Linus Torvalds 
Signed-off-by: Greg Kroah-Hartman 


---
 mm/memory.c |   13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3230,6 +3230,10 @@ static int do_anonymous_page(struct mm_s
 
pte_unmap(page_table);
 
+   /* File mapping without ->vm_ops ? */
+   if (vma->vm_flags & VM_SHARED)
+   return VM_FAULT_SIGBUS;
+
/* Check if we need to add a guard page to the stack */
if (check_stack_guard_page(vma, address) < 0)
return VM_FAULT_SIGSEGV;
@@ -3495,6 +3499,9 @@ static int do_linear_fault(struct mm_str
- vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
 
pte_unmap(page_table);
+   /* The VMA was not fully populated on mmap() or missing VM_DONTEXPAND */
+   if (!vma->vm_ops->fault)
+   return VM_FAULT_SIGBUS;
return __do_fault(mm, vma, address, pmd, pgoff, flags, orig_pte);
 }
 
@@ -3706,11 +3713,9 @@ int handle_pte_fault(struct mm_struct *m
entry = *pte;
if (!pte_present(entry)) {
if (pte_none(entry)) {
-   if (vma->vm_ops) {
-   if (likely(vma->vm_ops->fault))
-   return do_linear_fault(mm, vma, address,
+   if (vma->vm_ops)
+   return do_linear_fault(mm, vma, address,
pte, pmd, flags, entry);
-   }
return do_anonymous_page(mm, vma, address,
 pte, pmd, flags);
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 17/26] ata: pmp: add quirk for Marvell 4140 SATA PMP

2015-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Lior Amsalem 

commit 945b47441d83d2392ac9f984e0267ad521f24268 upstream.

This commit adds the necessary quirk to make the Marvell 4140 SATA PMP
work properly. This PMP doesn't like SRST on port number 4 (the host
port) so this commit marks this port as not supporting SRST.

Signed-off-by: Lior Amsalem 
Reviewed-by: Nadav Haklai 
Signed-off-by: Thomas Petazzoni 
Signed-off-by: Tejun Heo 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/ata/libata-pmp.c |7 +++
 1 file changed, 7 insertions(+)

--- a/drivers/ata/libata-pmp.c
+++ b/drivers/ata/libata-pmp.c
@@ -460,6 +460,13 @@ static void sata_pmp_quirks(struct ata_p
   ATA_LFLAG_NO_SRST |
   ATA_LFLAG_ASSUME_ATA;
}
+   } else if (vendor == 0x11ab && devid == 0x4140) {
+   /* Marvell 4140 quirks */
+   ata_for_each_link(link, ap, EDGE) {
+   /* port 4 is for SEMB device and it doesn't like SRST */
+   if (link->pmp == 4)
+   link->flags |= ATA_LFLAG_DISABLED;
+   }
}
 }
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 04/26] ARC: make sure instruction_pointer() returns unsigned value

2015-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Alexey Brodkin 

commit f51e2f1911122879eefefa4c592dea8bf794b39c upstream.

Currently instruction_pointer() returns pt_regs->ret and so return value
is of type "long", which implicitly stands for "signed long".

While that's perfectly fine when dealing with 32-bit values if return
value of instruction_pointer() gets assigned to 64-bit variable sign
extension may happen.

And at least in one real use-case it happens already.
In perf_prepare_sample() return value of perf_instruction_pointer()
(which is an alias to instruction_pointer() in case of ARC) is assigned
to (struct perf_sample_data)->ip (which type is "u64").

And what we see if instuction pointer points to user-space application
that in case of ARC lays below 0x8000_ "ip" gets set properly with
leading 32 zeros. But if instruction pointer points to kernel address
space that starts from 0x8000_ then "ip" is set with 32 leadig
"f"-s. I.e. id instruction_pointer() returns 0x8100_, "ip" will be
assigned with 0x___8100_. Which is obviously wrong.

In particular that issuse broke output of perf, because perf was unable
to associate addresses like 0x___8100_ with anything from
/proc/kallsyms.

That's what we used to see:
 --->8--
  6.27%  ls   [unknown][k] 0x8046c5cc
  2.96%  ls   libuClibc-0.9.34-git.so  [.] memcpy
  2.25%  ls   libuClibc-0.9.34-git.so  [.] memset
  1.66%  ls   [unknown][k] 0x80666536
  1.54%  ls   libuClibc-0.9.34-git.so  [.] 0x000224d6
  1.18%  ls   libuClibc-0.9.34-git.so  [.] 0x00022472
 --->8--

With that change perf output looks much better now:
 --->8--
  8.21%  ls   [kernel.kallsyms][k] memset
  3.52%  ls   libuClibc-0.9.34-git.so  [.] memcpy
  2.11%  ls   libuClibc-0.9.34-git.so  [.] malloc
  1.88%  ls   libuClibc-0.9.34-git.so  [.] memset
  1.64%  ls   [kernel.kallsyms][k] _raw_spin_unlock_irqrestore
  1.41%  ls   [kernel.kallsyms][k] __d_lookup_rcu
 --->8--

Signed-off-by: Alexey Brodkin 
Cc: arc-linux-...@synopsys.com
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Vineet Gupta 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arc/include/asm/ptrace.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/arc/include/asm/ptrace.h
+++ b/arch/arc/include/asm/ptrace.h
@@ -83,7 +83,7 @@ struct callee_regs {
long r13;
 };
 
-#define instruction_pointer(regs)  ((regs)->ret)
+#define instruction_pointer(regs)  (unsigned long)((regs)->ret)
 #define profile_pc(regs)   instruction_pointer(regs)
 
 /* return 1 if user mode or 0 if kernel mode */


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 21/26] xhci: prevent bus_suspend if SS port resuming in phase 1

2015-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Zhuang Jin Can 

commit fac4271d1126c45ceaceb7f4a336317b771eb121 upstream.

When the link is just waken, it's in Resume state, and driver sets PLS to
U0. This refers to Phase 1. Phase 2 refers to when the link has completed
the transition from Resume state to U0.

With the fix of xhci: report U3 when link is in resume state, it also
exposes an issue that usb3 roothub and controller can suspend right
after phase 1, and this causes a hard hang in controller.

To fix the issue, we need to prevent usb3 bus suspend if any port is
resuming in phase 1.

[merge separate USB2 and USB3 port resume checking to one -Mathias]
Signed-off-by: Zhuang Jin Can 
Signed-off-by: Mathias Nyman 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/usb/host/xhci-hub.c  |6 +++---
 drivers/usb/host/xhci-ring.c |3 +++
 drivers/usb/host/xhci.h  |1 +
 3 files changed, 7 insertions(+), 3 deletions(-)

--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -1048,10 +1048,10 @@ int xhci_bus_suspend(struct usb_hcd *hcd
spin_lock_irqsave(>lock, flags);
 
if (hcd->self.root_hub->do_remote_wakeup) {
-   if (bus_state->resuming_ports) {
+   if (bus_state->resuming_ports ||/* USB2 */
+   bus_state->port_remote_wakeup) {/* USB3 */
spin_unlock_irqrestore(>lock, flags);
-   xhci_dbg(xhci, "suspend failed because "
-   "a port is resuming\n");
+   xhci_dbg(xhci, "suspend failed because a port is 
resuming\n");
return -EBUSY;
}
}
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1669,6 +1669,9 @@ static void handle_port_status(struct xh
usb_hcd_resume_root_hub(hcd);
}
 
+   if (hcd->speed == HCD_USB3 && (temp & PORT_PLS_MASK) == XDEV_INACTIVE)
+   bus_state->port_remote_wakeup &= ~(1 << faked_port_index);
+
if ((temp & PORT_PLC) && (temp & PORT_PLS_MASK) == XDEV_RESUME) {
xhci_dbg(xhci, "port resume event for port %d\n", port_id);
 
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -280,6 +280,7 @@ struct xhci_op_regs {
 #define XDEV_U0(0x0 << 5)
 #define XDEV_U2(0x2 << 5)
 #define XDEV_U3(0x3 << 5)
+#define XDEV_INACTIVE  (0x6 << 5)
 #define XDEV_RESUME(0xf << 5)
 /* true: port has power (see HCC_PPC) */
 #define PORT_POWER (1 << 9)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 19/26] xhci: Calculate old endpoints correctly on device reset

2015-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Brian Campbell 

commit 326124a027abc9a7f43f72dc94f6f0f7a55b02b3 upstream.

When resetting a device the number of active TTs may need to be
corrected by xhci_update_tt_active_eps, but the number of old active
endpoints supplied to it was always zero, so the number of TTs and the
bandwidth reserved for them was not updated, and could rise
unnecessarily.

This affected systems using Intel's Patherpoint chipset, which rely on
software bandwidth checking.  For example, a Lenovo X230 would lose the
ability to use ports on the docking station after enough suspend/resume
cycles because the bandwidth calculated would rise with every cycle when
a suitable device is attached.

The correct number of active endpoints is calculated in the same way as
in xhci_reserve_bandwidth.

Signed-off-by: Brian Campbell 
Signed-off-by: Mathias Nyman 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/usb/host/xhci.c |3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -3356,6 +3356,9 @@ int xhci_discover_or_reset_device(struct
return -EINVAL;
}
 
+   if (virt_dev->tt_info)
+   old_active_eps = virt_dev->tt_info->active_eps;
+
if (virt_dev->udev != udev) {
/* If the virt_dev and the udev does not match, this virt_dev
 * may belong to another udev.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 08/26] ALSA: hda - Fix MacBook Pro 5,2 quirk

2015-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Takashi Iwai 

commit 649ccd08534ee26deb2e5b08509800d0e95167f5 upstream.

MacBook Pro 5,2 with ALC889 codec had already a fixup entry, but this
seems not working correctly, a fix for pin NID 0x15 is needed in
addition.  It's equivalent with the fixup for MacBook Air 1,1, so use
this instead.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=102131
Reported-and-tested-by: Jeffery Miller 
Signed-off-by: Takashi Iwai 
Signed-off-by: Greg Kroah-Hartman 

---
 sound/pci/hda/patch_realtek.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2204,7 +2204,7 @@ static const struct snd_pci_quirk alc882
SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", 
ALC889_FIXUP_IMAC91_VREF),
SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", 
ALC889_FIXUP_IMAC91_VREF),
-   SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF),
+   SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
 
SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 13/26] md/raid1: fix test for was read error from last working device.

2015-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: NeilBrown 

commit 34cab6f42003cb06f48f86a86652984dec338ae9 upstream.

When we get a read error from the last working device, we don't
try to repair it, and don't fail the device.  We simple report a
read error to the caller.

However the current test for 'is this the last working device' is
wrong.
When there is only one fully working device, it assumes that a
non-faulty device is that device.  However a spare which is rebuilding
would be non-faulty but so not the only working device.

So change the test from "!Faulty" to "In_sync".  If ->degraded says
there is only one fully working device and this device is in_sync,
this must be the one.

This bug has existed since we allowed read_balance to read from
a recovering spare in v3.0

Reported-and-tested-by: Alexander Lyakas 
Fixes: 76073054c95b ("md/raid1: clean up read_balance.")
Signed-off-by: NeilBrown 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/md/raid1.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -327,7 +327,7 @@ static void raid1_end_read_request(struc
spin_lock_irqsave(>device_lock, flags);
if (r1_bio->mddev->degraded == conf->raid_disks ||
(r1_bio->mddev->degraded == conf->raid_disks-1 &&
-!test_bit(Faulty, >mirrors[mirror].rdev->flags)))
+test_bit(In_sync, >mirrors[mirror].rdev->flags)))
uptodate = 1;
spin_unlock_irqrestore(>device_lock, flags);
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 03/26] s390/sclp: clear upper register halves in _sclp_print_early

2015-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Martin Schwidefsky 

commit f9c87a6f46d508eae0d9ae640be98d50f237f827 upstream.

If the kernel is compiled with gcc 5.1 and the XZ compression option
the decompress_kernel function calls _sclp_print_early in 64-bit mode
while the content of the upper register half of %r6 is non-zero.
This causes a specification exception on the servc instruction in
_sclp_servc.

The _sclp_print_early function saves and restores the upper registers
halves but it fails to clear them for the 31-bit code of the mini sclp
driver.

Signed-off-by: Martin Schwidefsky 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/s390/kernel/sclp.S |4 
 1 file changed, 4 insertions(+)

--- a/arch/s390/kernel/sclp.S
+++ b/arch/s390/kernel/sclp.S
@@ -276,6 +276,8 @@ ENTRY(_sclp_print_early)
jno .Lesa2
ahi %r15,-80
stmh%r6,%r15,96(%r15)   # store upper register halves
+   basr%r13,0
+   lmh %r0,%r15,.Lzeroes-.(%r13)   # clear upper register halves
 .Lesa2:
 #endif
lr  %r10,%r2# save string pointer
@@ -299,6 +301,8 @@ ENTRY(_sclp_print_early)
 #endif
lm  %r6,%r15,120(%r15)  # restore registers
br  %r14
+.Lzeroes:
+   .fill   64,4,0
 
 .LwritedataS4:
.long   0x00760005  # SCLP command for write data


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 18/26] usb-storage: ignore ZTE MF 823 card reader in mode 0x1225

2015-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Oliver Neukum 

commit 5fb2c782f451a4fb9c19c076e2c442839faf0f76 upstream.

This device automatically switches itself to another mode (0x1405)
unless the specific access pattern of Windows is followed in its
initial mode. That makes a dirty unmount of the internal storage
devices inevitable if they are mounted. So the card reader of
such a device should be ignored, lest an unclean removal become
inevitable.

This replaces an earlier patch that ignored all LUNs of this device.
That patch was overly broad.

Signed-off-by: Oliver Neukum 
Reviewed-by: Lars Melin 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/usb/storage/unusual_devs.h |   12 
 1 file changed, 12 insertions(+)

--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -2032,6 +2032,18 @@ UNUSUAL_DEV( 0x1908, 0x3335, 0x0200, 0x0
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
US_FL_NO_READ_DISC_INFO ),
 
+/* Reported by Oliver Neukum 
+ * This device morphes spontaneously into another device if the access
+ * pattern of Windows isn't followed. Thus writable media would be dirty
+ * if the initial instance is used. So the device is limited to its
+ * virtual CD.
+ * And yes, the concept that BCD goes up to 9 is not heeded */
+UNUSUAL_DEV( 0x19d2, 0x1225, 0x, 0x,
+   "ZTE,Incorporated",
+   "ZTE WCDMA Technologies MSM",
+   USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+   US_FL_SINGLE_LUN ),
+
 /* Reported by Sven Geggus 
  * This encrypted pen drive returns bogus data for the initial READ(10).
  */


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 02/26] freeing unlinked file indefinitely delayed

2015-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Al Viro 

commit 75a6f82a0d10ef8f13cd8fe7212911a0252ab99e upstream.

Normally opening a file, unlinking it and then closing will have
the inode freed upon close() (provided that it's not otherwise busy and
has no remaining links, of course).  However, there's one case where that
does *not* happen.  Namely, if you open it by fhandle with cold dcache,
then unlink() and close().

In normal case you get d_delete() in unlink(2) notice that dentry
is busy and unhash it; on the final dput() it will be forcibly evicted from
dcache, triggering iput() and inode removal.  In this case, though, we end
up with *two* dentries - disconnected (created by open-by-fhandle) and
regular one (used by unlink()).  The latter will have its reference to inode
dropped just fine, but the former will not - it's considered hashed (it
is on the ->s_anon list), so it will stay around until the memory pressure
will finally do it in.  As the result, we have the final iput() delayed
indefinitely.  It's trivial to reproduce -

void flush_dcache(void)
{
system("mount -o remount,rw /");
}

static char buf[20 * 1024 * 1024];

main()
{
int fd;
union {
struct file_handle f;
char buf[MAX_HANDLE_SZ];
} x;
int m;

x.f.handle_bytes = sizeof(x);
chdir("/root");
mkdir("foo", 0700);
fd = open("foo/bar", O_CREAT | O_RDWR, 0600);
close(fd);
name_to_handle_at(AT_FDCWD, "foo/bar", , , 0);
flush_dcache();
fd = open_by_handle_at(AT_FDCWD, , O_RDWR);
unlink("foo/bar");
write(fd, buf, sizeof(buf));
system("df ."); /* 20Mb eaten */
close(fd);
system("df ."); /* should've freed those 20Mb */
flush_dcache();
system("df ."); /* should be the same as #2 */
}

will spit out something like
Filesystem 1K-blocks   Used Available Use% Mounted on
/dev/root 322023 303843  1131 100% /
Filesystem 1K-blocks   Used Available Use% Mounted on
/dev/root 322023 303843  1131 100% /
Filesystem 1K-blocks   Used Available Use% Mounted on
/dev/root 322023 283282 21692  93% /
- inode gets freed only when dentry is finally evicted (here we trigger
than by remount; normally it would've happened in response to memory
pressure hell knows when).

Acked-by: J. Bruce Fields 
Signed-off-by: Al Viro 
Signed-off-by: Greg Kroah-Hartman 

---
 fs/dcache.c |3 +++
 1 file changed, 3 insertions(+)

--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -520,6 +520,9 @@ repeat:
return;
}
 
+   if (unlikely(dentry->d_flags & DCACHE_DISCONNECTED))
+   goto kill_it;
+
if (dentry->d_flags & DCACHE_OP_DELETE) {
if (dentry->d_op->d_delete(dentry))
goto kill_it;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 10/26] mac80211: clear subdir_stations when removing debugfs

2015-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Tom Hughes 

commit 4479004e6409087d1b4986881dc98c6c15dffb28 upstream.

If we don't do this, and we then fail to recreate the debugfs
directory during a mode change, then we will fail later trying
to add stations to this now bogus directory:

BUG: unable to handle kernel NULL pointer dereference at 006c
IP: [] mutex_lock+0x12/0x30
Call Trace:
[] start_creating+0x44/0xc0
[] debugfs_create_dir+0x13/0xf0
[] ieee80211_sta_debugfs_add+0x6e/0x490 [mac80211]

Signed-off-by: Tom Hughes 
Signed-off-by: Johannes Berg 
Signed-off-by: Greg Kroah-Hartman 

---
 net/mac80211/debugfs_netdev.c |1 +
 1 file changed, 1 insertion(+)

--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -697,6 +697,7 @@ void ieee80211_debugfs_remove_netdev(str
 
debugfs_remove_recursive(sdata->vif.debugfs_dir);
sdata->vif.debugfs_dir = NULL;
+   sdata->debugfs.subdir_stations = NULL;
 }
 
 void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 07/26] ALSA: usb-audio: add dB range mapping for some devices

2015-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Yao-Wen Mao 

commit 2d1cb7f658fb9c3ba8f9dab8aca297d4dfdec835 upstream.

Add the correct dB ranges of Bose Companion 5 and Drangonfly DAC 1.2.

Signed-off-by: Yao-Wen Mao 
Signed-off-by: Takashi Iwai 
Signed-off-by: Greg Kroah-Hartman 

---
 sound/usb/mixer_maps.c |   24 
 1 file changed, 24 insertions(+)

--- a/sound/usb/mixer_maps.c
+++ b/sound/usb/mixer_maps.c
@@ -330,6 +330,20 @@ static const struct usbmix_name_map scms
{ 0 }
 };
 
+/* Bose companion 5, the dB conversion factor is 16 instead of 256 */
+static struct usbmix_dB_map bose_companion5_dB = {-5006, -6};
+static struct usbmix_name_map bose_companion5_map[] = {
+   { 3, NULL, .dB = _companion5_dB },
+   { 0 }   /* terminator */
+};
+
+/* Dragonfly DAC 1.2, the dB conversion factor is 1 instead of 256 */
+static struct usbmix_dB_map dragonfly_1_2_dB = {0, 5000};
+static struct usbmix_name_map dragonfly_1_2_map[] = {
+   { 7, NULL, .dB = _1_2_dB },
+   { 0 }   /* terminator */
+};
+
 /*
  * Control map entries
  */
@@ -432,6 +446,16 @@ static struct usbmix_ctl_map usbmix_ctl_
.id = USB_ID(0x25c4, 0x0003),
.map = scms_usb3318_map,
},
+   {
+   /* Bose Companion 5 */
+   .id = USB_ID(0x05a7, 0x1020),
+   .map = bose_companion5_map,
+   },
+   {
+   /* Dragonfly DAC 1.2 */
+   .id = USB_ID(0x21b4, 0x0081),
+   .map = dragonfly_1_2_map,
+   },
{ 0 } /* terminator */
 };
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 00/29] 3.14.50-stable review

2015-08-08 Thread Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.50 release.
There are 29 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 Mon Aug 10 22:06:58 UTC 2015.
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.x/stable-review/patch-3.14.50-rc1.gz
and the diffstat can be found below.

thanks,

greg k-h

-
Pseudo-Shortlog of commits:

Greg Kroah-Hartman 
Linux 3.14.50-rc1

Fupan Li 
efi: fix 32bit kernel boot failed problem using efi

Nicholas Bellinger 
iscsi-target: Fix iser explicit logout TX kthread leak

Nicholas Bellinger 
iscsi-target: Fix use-after-free during TPG session shutdown

Andy Shevchenko 
avr32: handle NULL as a valid clock object

Marc-André Lureau 
vhost: actually track log eventfd file

Wengang Wang 
rds: rds_ib_device.refcount overflow

Dmitry Skorodumov 
x86/efi: Use all 64 bit of efi_memmap in setup_e820()

Zhuang Jin Can 
xhci: do not report PLC when link is in internal resume state

Zhuang Jin Can 
xhci: prevent bus_suspend if SS port resuming in phase 1

Zhuang Jin Can 
xhci: report U3 when link is in resume state

Brian Campbell 
xhci: Calculate old endpoints correctly on device reset

Oliver Neukum 
usb-storage: ignore ZTE MF 823 card reader in mode 0x1225

Lior Amsalem 
ata: pmp: add quirk for Marvell 4140 SATA PMP

Tejun Heo 
blkcg: fix gendisk reference leak in blkg_conf_prep()

Bernhard Bender 
Input: usbtouchscreen - avoid unresponsive TSC-30 touch screen

Chris Metcalf 
tile: use free_bootmem_late() for initrd

NeilBrown 
md/raid1: fix test for 'was read error from last working device'.

Jingju Hou 
mmc: sdhci-pxav3: fix platform_data is not initialized

Joakim Tjernlund 
mmc: sdhci-esdhc: Make 8BIT bus work

Tom Hughes 
mac80211: clear subdir_stations when removing debugfs

Seymour, Shane M 
st: null pointer dereference panic caused by use after kref_put by st_open

Takashi Iwai 
ALSA: hda - Fix MacBook Pro 5,2 quirk

Yao-Wen Mao 
ALSA: usb-audio: add dB range mapping for some devices

Dominic Sacré 
ALSA: usb-audio: Add MIDI support for Steinberg MI2/MI4

Thomas Gleixner 
genirq: Prevent resend to interrupts marked IRQ_NESTED_THREAD

Alexey Brodkin 
ARC: make sure instruction_pointer() returns unsigned value

Martin Schwidefsky 
s390/sclp: clear upper register halves in _sclp_print_early

Al Viro 
freeing unlinked file indefinitely delayed

Kirill A. Shutemov 
mm: avoid setting up anonymous pages into file mapping


-

Diffstat:

 Makefile   |  4 +-
 arch/arc/include/asm/ptrace.h  |  2 +-
 arch/avr32/mach-at32ap/clock.c | 20 -
 arch/s390/kernel/sclp.S|  4 ++
 arch/tile/kernel/setup.c   |  2 +-
 arch/x86/boot/compressed/eboot.c   |  4 ++
 arch/x86/boot/compressed/head_32.S |  2 +-
 block/blk-cgroup.c |  6 ++-
 drivers/ata/libata-pmp.c   |  7 +++
 drivers/input/touchscreen/usbtouchscreen.c |  3 ++
 drivers/md/raid1.c |  2 +-
 drivers/mmc/host/sdhci-esdhc.h |  2 +-
 drivers/mmc/host/sdhci-pxav3.c |  1 +
 drivers/scsi/st.c  |  2 +-
 drivers/target/iscsi/iscsi_target.c| 30 ++---
 drivers/usb/host/xhci-hub.c| 22 +++---
 drivers/usb/host/xhci-ring.c   |  3 ++
 drivers/usb/host/xhci.c|  3 ++
 drivers/usb/host/xhci.h|  1 +
 drivers/usb/storage/unusual_devs.h | 12 ++
 drivers/vhost/vhost.c  |  1 +
 fs/dcache.c|  3 ++
 kernel/irq/resend.c| 18 +---
 mm/memory.c| 13 --
 net/mac80211/debugfs_netdev.c  |  1 +
 net/rds/ib_rdma.c  |  4 +-
 sound/pci/hda/patch_realtek.c  |  2 +-
 sound/usb/mixer_maps.c | 24 +++
 sound/usb/quirks-table.h   | 68 ++
 29 files changed, 233 insertions(+), 33 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 12/26] mmc: sdhci-pxav3: fix platform_data is not initialized

2015-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Jingju Hou 

commit 9cd76049f0d90ae241f5ad80e311489824527000 upstream.

pdev->dev.platform_data is not initialized if match is true in function
sdhci_pxav3_probe. Just local variable pdata is assigned the return value
from function pxav3_get_mmc_pdata().

static int sdhci_pxav3_probe(struct platform_device *pdev) {

struct sdhci_pxa_platdata *pdata = pdev->dev.platform_data;
...
if (match) {
ret = mmc_of_parse(host->mmc);
if (ret)
goto err_of_parse;
sdhci_get_of_property(pdev);
pdata = pxav3_get_mmc_pdata(dev);
 }
 ...
}

Signed-off-by: Jingju Hou 
Fixes: b650352dd3df("mmc: sdhci-pxa: Add device tree support")
Signed-off-by: Ulf Hansson 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/mmc/host/sdhci-pxav3.c |1 +
 1 file changed, 1 insertion(+)

--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -255,6 +255,7 @@ static int sdhci_pxav3_probe(struct plat
mmc_of_parse(host->mmc);
sdhci_get_of_property(pdev);
pdata = pxav3_get_mmc_pdata(dev);
+   pdev->dev.platform_data = pdata;
} else if (pdata) {
/* on-chip device */
if (pdata->flags & PXA_FLAG_CARD_PERMANENT)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 24/26] iscsi-target: Fix use-after-free during TPG session shutdown

2015-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Nicholas Bellinger 

commit 417c20a9bdd1e876384127cf096d8ae8b559066c upstream.

This patch fixes a use-after-free bug in iscsit_release_sessions_for_tpg()
where se_portal_group->session_lock was incorrectly released/re-acquired
while walking the active se_portal_group->tpg_sess_list.

The can result in a NULL pointer dereference when iscsit_close_session()
shutdown happens in the normal path asynchronously to this code, causing
a bogus dereference of an already freed list entry to occur.

To address this bug, walk the session list checking for the same state
as before, but move entries to a local list to avoid dropping the lock
while walking the active list.

As before, signal using iscsi_session->session_restatement=1 for those
list entries to be released locally by iscsit_free_session() code.

Reported-by: Sunilkumar Nadumuttlu 
Cc: Sunilkumar Nadumuttlu 
Signed-off-by: Nicholas Bellinger 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/target/iscsi/iscsi_target.c |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -4649,6 +4649,7 @@ int iscsit_release_sessions_for_tpg(stru
struct iscsi_session *sess;
struct se_portal_group *se_tpg = >tpg_se_tpg;
struct se_session *se_sess, *se_sess_tmp;
+   LIST_HEAD(free_list);
int session_count = 0;
 
spin_lock_bh(_tpg->session_lock);
@@ -4670,14 +4671,17 @@ int iscsit_release_sessions_for_tpg(stru
}
atomic_set(>session_reinstatement, 1);
spin_unlock(>conn_lock);
-   spin_unlock_bh(_tpg->session_lock);
 
-   iscsit_free_session(sess);
-   spin_lock_bh(_tpg->session_lock);
+   list_move_tail(_sess->sess_list, _list);
+   }
+   spin_unlock_bh(_tpg->session_lock);
 
+   list_for_each_entry_safe(se_sess, se_sess_tmp, _list, sess_list) {
+   sess = (struct iscsi_session *)se_sess->fabric_sess_ptr;
+
+   iscsit_free_session(sess);
session_count++;
}
-   spin_unlock_bh(_tpg->session_lock);
 
pr_debug("Released %d iSCSI Session(s) from Target Portal"
" Group: %hu\n", session_count, tpg->tpgt);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 26/26] efi: fix 32bit kernel boot failed problem using efi

2015-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Fupan Li 

Commit 35d5134b7d5a
("x86/efi: Correct EFI boot stub use of code32_start")
imported a bug, which will cause 32bit kernel boot failed
using efi method. It should use the label's address instead
of the value stored in the label to caculate the address of
code32_start.

Signed-off-by: Fupan Li 
Reviewed-by: Matt Fleming 
---
 arch/x86/boot/compressed/head_32.S |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/x86/boot/compressed/head_32.S
+++ b/arch/x86/boot/compressed/head_32.S
@@ -54,7 +54,7 @@ ENTRY(efi_pe_entry)
callreloc
 reloc:
popl%ecx
-   sublreloc, %ecx
+   subl$reloc, %ecx
movl%ecx, BP_code32_start(%eax)
 
sub $0x4, %esp


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 04/29] ARC: make sure instruction_pointer() returns unsigned value

2015-08-08 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Alexey Brodkin 

commit f51e2f1911122879eefefa4c592dea8bf794b39c upstream.

Currently instruction_pointer() returns pt_regs->ret and so return value
is of type "long", which implicitly stands for "signed long".

While that's perfectly fine when dealing with 32-bit values if return
value of instruction_pointer() gets assigned to 64-bit variable sign
extension may happen.

And at least in one real use-case it happens already.
In perf_prepare_sample() return value of perf_instruction_pointer()
(which is an alias to instruction_pointer() in case of ARC) is assigned
to (struct perf_sample_data)->ip (which type is "u64").

And what we see if instuction pointer points to user-space application
that in case of ARC lays below 0x8000_ "ip" gets set properly with
leading 32 zeros. But if instruction pointer points to kernel address
space that starts from 0x8000_ then "ip" is set with 32 leadig
"f"-s. I.e. id instruction_pointer() returns 0x8100_, "ip" will be
assigned with 0x___8100_. Which is obviously wrong.

In particular that issuse broke output of perf, because perf was unable
to associate addresses like 0x___8100_ with anything from
/proc/kallsyms.

That's what we used to see:
 --->8--
  6.27%  ls   [unknown][k] 0x8046c5cc
  2.96%  ls   libuClibc-0.9.34-git.so  [.] memcpy
  2.25%  ls   libuClibc-0.9.34-git.so  [.] memset
  1.66%  ls   [unknown][k] 0x80666536
  1.54%  ls   libuClibc-0.9.34-git.so  [.] 0x000224d6
  1.18%  ls   libuClibc-0.9.34-git.so  [.] 0x00022472
 --->8--

With that change perf output looks much better now:
 --->8--
  8.21%  ls   [kernel.kallsyms][k] memset
  3.52%  ls   libuClibc-0.9.34-git.so  [.] memcpy
  2.11%  ls   libuClibc-0.9.34-git.so  [.] malloc
  1.88%  ls   libuClibc-0.9.34-git.so  [.] memset
  1.64%  ls   [kernel.kallsyms][k] _raw_spin_unlock_irqrestore
  1.41%  ls   [kernel.kallsyms][k] __d_lookup_rcu
 --->8--

Signed-off-by: Alexey Brodkin 
Cc: arc-linux-...@synopsys.com
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Vineet Gupta 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arc/include/asm/ptrace.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/arc/include/asm/ptrace.h
+++ b/arch/arc/include/asm/ptrace.h
@@ -63,7 +63,7 @@ struct callee_regs {
long r25, r24, r23, r22, r21, r20, r19, r18, r17, r16, r15, r14, r13;
 };
 
-#define instruction_pointer(regs)  ((regs)->ret)
+#define instruction_pointer(regs)  (unsigned long)((regs)->ret)
 #define profile_pc(regs)   instruction_pointer(regs)
 
 /* return 1 if user mode or 0 if kernel mode */


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 01/29] mm: avoid setting up anonymous pages into file mapping

2015-08-08 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: "Kirill A. Shutemov" 

commit 6b7339f4c31ad69c8e9c0b2859276e22cf72176d upstream.

Reading page fault handler code I've noticed that under right
circumstances kernel would map anonymous pages into file mappings: if
the VMA doesn't have vm_ops->fault() and the VMA wasn't fully populated
on ->mmap(), kernel would handle page fault to not populated pte with
do_anonymous_page().

Let's change page fault handler to use do_anonymous_page() only on
anonymous VMA (->vm_ops == NULL) and make sure that the VMA is not
shared.

For file mappings without vm_ops->fault() or shred VMA without vm_ops,
page fault on pte_none() entry would lead to SIGBUS.

Signed-off-by: Kirill A. Shutemov 
Acked-by: Oleg Nesterov 
Cc: Andrew Morton 
Cc: Willy Tarreau 
Cc: sta...@vger.kernel.org
Signed-off-by: Linus Torvalds 
Signed-off-by: Greg Kroah-Hartman 


---
 mm/memory.c |   13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3234,6 +3234,10 @@ static int do_anonymous_page(struct mm_s
 
pte_unmap(page_table);
 
+   /* File mapping without ->vm_ops ? */
+   if (vma->vm_flags & VM_SHARED)
+   return VM_FAULT_SIGBUS;
+
/* Check if we need to add a guard page to the stack */
if (check_stack_guard_page(vma, address) < 0)
return VM_FAULT_SIGSEGV;
@@ -3502,6 +3506,9 @@ static int do_linear_fault(struct mm_str
- vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
 
pte_unmap(page_table);
+   /* The VMA was not fully populated on mmap() or missing VM_DONTEXPAND */
+   if (!vma->vm_ops->fault)
+   return VM_FAULT_SIGBUS;
return __do_fault(mm, vma, address, pmd, pgoff, flags, orig_pte);
 }
 
@@ -3650,11 +3657,9 @@ static int handle_pte_fault(struct mm_st
entry = ACCESS_ONCE(*pte);
if (!pte_present(entry)) {
if (pte_none(entry)) {
-   if (vma->vm_ops) {
-   if (likely(vma->vm_ops->fault))
-   return do_linear_fault(mm, vma, address,
+   if (vma->vm_ops)
+   return do_linear_fault(mm, vma, address,
pte, pmd, flags, entry);
-   }
return do_anonymous_page(mm, vma, address,
 pte, pmd, flags);
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 03/29] s390/sclp: clear upper register halves in _sclp_print_early

2015-08-08 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Martin Schwidefsky 

commit f9c87a6f46d508eae0d9ae640be98d50f237f827 upstream.

If the kernel is compiled with gcc 5.1 and the XZ compression option
the decompress_kernel function calls _sclp_print_early in 64-bit mode
while the content of the upper register half of %r6 is non-zero.
This causes a specification exception on the servc instruction in
_sclp_servc.

The _sclp_print_early function saves and restores the upper registers
halves but it fails to clear them for the 31-bit code of the mini sclp
driver.

Signed-off-by: Martin Schwidefsky 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/s390/kernel/sclp.S |4 
 1 file changed, 4 insertions(+)

--- a/arch/s390/kernel/sclp.S
+++ b/arch/s390/kernel/sclp.S
@@ -276,6 +276,8 @@ ENTRY(_sclp_print_early)
jno .Lesa2
ahi %r15,-80
stmh%r6,%r15,96(%r15)   # store upper register halves
+   basr%r13,0
+   lmh %r0,%r15,.Lzeroes-.(%r13)   # clear upper register halves
 .Lesa2:
 #endif
lr  %r10,%r2# save string pointer
@@ -299,6 +301,8 @@ ENTRY(_sclp_print_early)
 #endif
lm  %r6,%r15,120(%r15)  # restore registers
br  %r14
+.Lzeroes:
+   .fill   64,4,0
 
 .LwritedataS4:
.long   0x00760005  # SCLP command for write data


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 25/26] iscsi-target: Fix iser explicit logout TX kthread leak

2015-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Nicholas Bellinger 

commit 007d038bdf95ccfe2491d0078be54040d110fd06 upstream.

This patch fixes a regression introduced with the following commit
in v4.0-rc1 code, where an explicit iser-target logout would result
in ->tx_thread_active being incorrectly cleared by the logout post
handler, and subsequent TX kthread leak:

commit 88dcd2dab5c23b1c9cfc396246d8f476c872f0ca
Author: Nicholas Bellinger 
Date:   Thu Feb 26 22:19:15 2015 -0800

iscsi-target: Convert iscsi_thread_set usage to kthread.h

To address this bug, change iscsit_logout_post_handler_closesession()
and iscsit_logout_post_handler_samecid() to only cmpxchg() on
->tx_thread_active for traditional iscsi/tcp connections.

This is required because iscsi/tcp connections are invoking logout
post handler logic directly from TX kthread context, while iser
connections are invoking logout post handler logic from a seperate
workqueue context.

Cc: Sagi Grimberg 
Signed-off-by: Nicholas Bellinger 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/target/iscsi/iscsi_target.c |   18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -4416,7 +4416,18 @@ static void iscsit_logout_post_handler_c
struct iscsi_conn *conn)
 {
struct iscsi_session *sess = conn->sess;
-   int sleep = cmpxchg(>tx_thread_active, true, false);
+   int sleep = 1;
+   /*
+* Traditional iscsi/tcp will invoke this logic from TX thread
+* context during session logout, so clear tx_thread_active and
+* sleep if iscsit_close_connection() has not already occured.
+*
+* Since iser-target invokes this logic from it's own workqueue,
+* always sleep waiting for RX/TX thread shutdown to complete
+* within iscsit_close_connection().
+*/
+   if (conn->conn_transport->transport_type == ISCSI_TCP)
+   sleep = cmpxchg(>tx_thread_active, true, false);
 
atomic_set(>conn_logout_remove, 0);
complete(>conn_logout_comp);
@@ -4430,7 +4441,10 @@ static void iscsit_logout_post_handler_c
 static void iscsit_logout_post_handler_samecid(
struct iscsi_conn *conn)
 {
-   int sleep = cmpxchg(>tx_thread_active, true, false);
+   int sleep = 1;
+
+   if (conn->conn_transport->transport_type == ISCSI_TCP)
+   sleep = cmpxchg(>tx_thread_active, true, false);
 
atomic_set(>conn_logout_remove, 0);
complete(>conn_logout_comp);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 18/29] usb-storage: ignore ZTE MF 823 card reader in mode 0x1225

2015-08-08 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Oliver Neukum 

commit 5fb2c782f451a4fb9c19c076e2c442839faf0f76 upstream.

This device automatically switches itself to another mode (0x1405)
unless the specific access pattern of Windows is followed in its
initial mode. That makes a dirty unmount of the internal storage
devices inevitable if they are mounted. So the card reader of
such a device should be ignored, lest an unclean removal become
inevitable.

This replaces an earlier patch that ignored all LUNs of this device.
That patch was overly broad.

Signed-off-by: Oliver Neukum 
Reviewed-by: Lars Melin 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/usb/storage/unusual_devs.h |   12 
 1 file changed, 12 insertions(+)

--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -2032,6 +2032,18 @@ UNUSUAL_DEV( 0x1908, 0x3335, 0x0200, 0x0
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
US_FL_NO_READ_DISC_INFO ),
 
+/* Reported by Oliver Neukum 
+ * This device morphes spontaneously into another device if the access
+ * pattern of Windows isn't followed. Thus writable media would be dirty
+ * if the initial instance is used. So the device is limited to its
+ * virtual CD.
+ * And yes, the concept that BCD goes up to 9 is not heeded */
+UNUSUAL_DEV( 0x19d2, 0x1225, 0x, 0x,
+   "ZTE,Incorporated",
+   "ZTE WCDMA Technologies MSM",
+   USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+   US_FL_SINGLE_LUN ),
+
 /* Reported by Sven Geggus 
  * This encrypted pen drive returns bogus data for the initial READ(10).
  */


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 02/29] freeing unlinked file indefinitely delayed

2015-08-08 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Al Viro 

commit 75a6f82a0d10ef8f13cd8fe7212911a0252ab99e upstream.

Normally opening a file, unlinking it and then closing will have
the inode freed upon close() (provided that it's not otherwise busy and
has no remaining links, of course).  However, there's one case where that
does *not* happen.  Namely, if you open it by fhandle with cold dcache,
then unlink() and close().

In normal case you get d_delete() in unlink(2) notice that dentry
is busy and unhash it; on the final dput() it will be forcibly evicted from
dcache, triggering iput() and inode removal.  In this case, though, we end
up with *two* dentries - disconnected (created by open-by-fhandle) and
regular one (used by unlink()).  The latter will have its reference to inode
dropped just fine, but the former will not - it's considered hashed (it
is on the ->s_anon list), so it will stay around until the memory pressure
will finally do it in.  As the result, we have the final iput() delayed
indefinitely.  It's trivial to reproduce -

void flush_dcache(void)
{
system("mount -o remount,rw /");
}

static char buf[20 * 1024 * 1024];

main()
{
int fd;
union {
struct file_handle f;
char buf[MAX_HANDLE_SZ];
} x;
int m;

x.f.handle_bytes = sizeof(x);
chdir("/root");
mkdir("foo", 0700);
fd = open("foo/bar", O_CREAT | O_RDWR, 0600);
close(fd);
name_to_handle_at(AT_FDCWD, "foo/bar", , , 0);
flush_dcache();
fd = open_by_handle_at(AT_FDCWD, , O_RDWR);
unlink("foo/bar");
write(fd, buf, sizeof(buf));
system("df ."); /* 20Mb eaten */
close(fd);
system("df ."); /* should've freed those 20Mb */
flush_dcache();
system("df ."); /* should be the same as #2 */
}

will spit out something like
Filesystem 1K-blocks   Used Available Use% Mounted on
/dev/root 322023 303843  1131 100% /
Filesystem 1K-blocks   Used Available Use% Mounted on
/dev/root 322023 303843  1131 100% /
Filesystem 1K-blocks   Used Available Use% Mounted on
/dev/root 322023 283282 21692  93% /
- inode gets freed only when dentry is finally evicted (here we trigger
than by remount; normally it would've happened in response to memory
pressure hell knows when).

Acked-by: J. Bruce Fields 
Signed-off-by: Al Viro 
Signed-off-by: Greg Kroah-Hartman 

---
 fs/dcache.c |3 +++
 1 file changed, 3 insertions(+)

--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -587,6 +587,9 @@ repeat:
if (unlikely(d_unhashed(dentry)))
goto kill_it;
 
+   if (unlikely(dentry->d_flags & DCACHE_DISCONNECTED))
+   goto kill_it;
+
if (unlikely(dentry->d_flags & DCACHE_OP_DELETE)) {
if (dentry->d_op->d_delete(dentry))
goto kill_it;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 15/29] Input: usbtouchscreen - avoid unresponsive TSC-30 touch screen

2015-08-08 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Bernhard Bender 

commit 968491709e5b1aaf429428814fff3d932fa90b60 upstream.

This patch fixes a problem in the usbtouchscreen driver for DMC TSC-30
touch screen.  Due to a missing delay between the RESET and SET_RATE
commands, the touch screen may become unresponsive during system startup or
driver loading.

According to the DMC documentation, a delay is needed after the RESET
command to allow the chip to complete its internal initialization. As this
delay is not guaranteed, we had a system where the touch screen
occasionally did not send any touch data. There was no other indication of
the problem.

The patch fixes the problem by adding a 150ms delay between the RESET and
SET_RATE commands.

Suggested-by: Jakob Mustafa 
Signed-off-by: Bernhard Bender 
Signed-off-by: Dmitry Torokhov 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/input/touchscreen/usbtouchscreen.c |3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -625,6 +625,9 @@ static int dmc_tsc10_init(struct usbtouc
goto err_out;
}
 
+   /* TSC-25 data sheet specifies a delay after the RESET command */
+   msleep(150);
+
/* set coordinate output rate */
buf[0] = buf[1] = 0xFF;
ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0),


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 11/29] mmc: sdhci-esdhc: Make 8BIT bus work

2015-08-08 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Joakim Tjernlund 

commit 8e91125ff3f57f15c6568e2a6d32743b3f7815e4 upstream.

Support for 8BIT bus with was added some time ago to sdhci-esdhc but
then missed to remove the 8BIT from the reserved bit mask which made
8BIT non functional.

Fixes: 66b50a00992d ("mmc: esdhc: Add support for 8-bit bus width and..")
Signed-off-by: Joakim Tjernlund 
Signed-off-by: Ulf Hansson 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/mmc/host/sdhci-esdhc.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/mmc/host/sdhci-esdhc.h
+++ b/drivers/mmc/host/sdhci-esdhc.h
@@ -47,6 +47,6 @@
 #define ESDHC_DMA_SYSCTL   0x40c
 #define ESDHC_DMA_SNOOP0x0040
 
-#define ESDHC_HOST_CONTROL_RES 0x05
+#define ESDHC_HOST_CONTROL_RES 0x01
 
 #endif /* _DRIVERS_MMC_SDHCI_ESDHC_H */


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 19/29] xhci: Calculate old endpoints correctly on device reset

2015-08-08 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Brian Campbell 

commit 326124a027abc9a7f43f72dc94f6f0f7a55b02b3 upstream.

When resetting a device the number of active TTs may need to be
corrected by xhci_update_tt_active_eps, but the number of old active
endpoints supplied to it was always zero, so the number of TTs and the
bandwidth reserved for them was not updated, and could rise
unnecessarily.

This affected systems using Intel's Patherpoint chipset, which rely on
software bandwidth checking.  For example, a Lenovo X230 would lose the
ability to use ports on the docking station after enough suspend/resume
cycles because the bandwidth calculated would rise with every cycle when
a suitable device is attached.

The correct number of active endpoints is calculated in the same way as
in xhci_reserve_bandwidth.

Signed-off-by: Brian Campbell 
Signed-off-by: Mathias Nyman 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/usb/host/xhci.c |3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -3424,6 +3424,9 @@ int xhci_discover_or_reset_device(struct
return -EINVAL;
}
 
+   if (virt_dev->tt_info)
+   old_active_eps = virt_dev->tt_info->active_eps;
+
if (virt_dev->udev != udev) {
/* If the virt_dev and the udev does not match, this virt_dev
 * may belong to another udev.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 26/29] avr32: handle NULL as a valid clock object

2015-08-08 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Andy Shevchenko 

commit 5c02a4206538da12c040b51778d310df84c6bf6c upstream.

Since NULL is used as valid clock object on optional clocks we have to handle
this case in avr32 implementation as well.

Fixes: e1824dfe0d8e (net: macb: Adjust tx_clk when link speed changes)
Signed-off-by: Andy Shevchenko 
Acked-by: Hans-Christian Egtvedt 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/avr32/mach-at32ap/clock.c |   20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)

--- a/arch/avr32/mach-at32ap/clock.c
+++ b/arch/avr32/mach-at32ap/clock.c
@@ -80,6 +80,9 @@ int clk_enable(struct clk *clk)
 {
unsigned long flags;
 
+   if (!clk)
+   return 0;
+
spin_lock_irqsave(_lock, flags);
__clk_enable(clk);
spin_unlock_irqrestore(_lock, flags);
@@ -106,6 +109,9 @@ void clk_disable(struct clk *clk)
 {
unsigned long flags;
 
+   if (IS_ERR_OR_NULL(clk))
+   return;
+
spin_lock_irqsave(_lock, flags);
__clk_disable(clk);
spin_unlock_irqrestore(_lock, flags);
@@ -117,6 +123,9 @@ unsigned long clk_get_rate(struct clk *c
unsigned long flags;
unsigned long rate;
 
+   if (!clk)
+   return 0;
+
spin_lock_irqsave(_lock, flags);
rate = clk->get_rate(clk);
spin_unlock_irqrestore(_lock, flags);
@@ -129,6 +138,9 @@ long clk_round_rate(struct clk *clk, uns
 {
unsigned long flags, actual_rate;
 
+   if (!clk)
+   return 0;
+
if (!clk->set_rate)
return -ENOSYS;
 
@@ -145,6 +157,9 @@ int clk_set_rate(struct clk *clk, unsign
unsigned long flags;
long ret;
 
+   if (!clk)
+   return 0;
+
if (!clk->set_rate)
return -ENOSYS;
 
@@ -161,6 +176,9 @@ int clk_set_parent(struct clk *clk, stru
unsigned long flags;
int ret;
 
+   if (!clk)
+   return 0;
+
if (!clk->set_parent)
return -ENOSYS;
 
@@ -174,7 +192,7 @@ EXPORT_SYMBOL(clk_set_parent);
 
 struct clk *clk_get_parent(struct clk *clk)
 {
-   return clk->parent;
+   return !clk ? NULL : clk->parent;
 }
 EXPORT_SYMBOL(clk_get_parent);
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 14/26] tile: use free_bootmem_late() for initrd

2015-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Chris Metcalf 

commit 3f81d2447b37ac697b3c600039f2c6b628c06e21 upstream.

We were previously using free_bootmem() and just getting lucky
that nothing too bad happened.

Signed-off-by: Chris Metcalf 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/tile/kernel/setup.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/tile/kernel/setup.c
+++ b/arch/tile/kernel/setup.c
@@ -1064,7 +1064,7 @@ static void __init load_hv_initrd(void)
 
 void __init free_initrd_mem(unsigned long begin, unsigned long end)
 {
-   free_bootmem(__pa(begin), end - begin);
+   free_bootmem_late(__pa(begin), end - begin);
 }
 
 #else


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 20/29] xhci: report U3 when link is in resume state

2015-08-08 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Zhuang Jin Can 

commit 243292a2ad3dc365849b820a64868927168894ac upstream.

xhci_hub_report_usb3_link_state() returns pls as U0 when the link
is in resume state, and this causes usb core to think the link is in
U0 while actually it's in resume state. When usb core transfers
control request on the link, it fails with TRB error as the link
is not ready for transfer.

To fix the issue, report U3 when the link is in resume state, thus
usb core knows the link it's not ready for transfer.

Signed-off-by: Zhuang Jin Can 
Signed-off-by: Mathias Nyman 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/usb/host/xhci-hub.c |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -480,10 +480,13 @@ static void xhci_hub_report_usb3_link_st
u32 pls = status_reg & PORT_PLS_MASK;
 
/* resume state is a xHCI internal state.
-* Do not report it to usb core.
+* Do not report it to usb core, instead, pretend to be U3,
+* thus usb core knows it's not ready for transfer
 */
-   if (pls == XDEV_RESUME)
+   if (pls == XDEV_RESUME) {
+   *status |= USB_SS_PORT_LS_U3;
return;
+   }
 
/* When the CAS bit is set then warm reset
 * should be performed on port


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 11/26] mmc: sdhci-esdhc: Make 8BIT bus work

2015-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Joakim Tjernlund 

commit 8e91125ff3f57f15c6568e2a6d32743b3f7815e4 upstream.

Support for 8BIT bus with was added some time ago to sdhci-esdhc but
then missed to remove the 8BIT from the reserved bit mask which made
8BIT non functional.

Fixes: 66b50a00992d ("mmc: esdhc: Add support for 8-bit bus width and..")
Signed-off-by: Joakim Tjernlund 
Signed-off-by: Ulf Hansson 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/mmc/host/sdhci-esdhc.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/mmc/host/sdhci-esdhc.h
+++ b/drivers/mmc/host/sdhci-esdhc.h
@@ -40,7 +40,7 @@
 #define ESDHC_DMA_SYSCTL   0x40c
 #define ESDHC_DMA_SNOOP0x0040
 
-#define ESDHC_HOST_CONTROL_RES 0x05
+#define ESDHC_HOST_CONTROL_RES 0x01
 
 static inline void esdhc_set_clock(struct sdhci_host *host, unsigned int clock)
 {


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 002/123] cxl: Check if afu is not null in cxl_slbia

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Daniel Axtens 

commit 2c069a118fe1d80c47dca84e1561045fc7f3cc9e upstream.

The pointer to an AFU in the adapter's list of AFUs can be null
if we're in the process of removing AFUs. The afu_list_lock
doesn't guard against this.

Say we have 2 slices, and we're in the process of removing cxl.
 - We remove the AFUs in order (see cxl_remove). In cxl_remove_afu
   for AFU 0, we take the lock, set adapter->afu[0] = NULL, and
   release the lock.
 - Then we get an slbia. In cxl_slbia we take the lock, and set
   afu = adapter->afu[0], which is NULL.
 - Therefore our attempt to check afu->enabled will blow up.

Therefore, check if afu is a null pointer before dereferencing it.

Signed-off-by: Daniel Axtens 
Acked-by: Michael Neuling 
Acked-by: Ian Munsie 
Signed-off-by: Michael Ellerman 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/misc/cxl/main.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/misc/cxl/main.c
+++ b/drivers/misc/cxl/main.c
@@ -73,7 +73,7 @@ static inline void cxl_slbia_core(struct
spin_lock(>afu_list_lock);
for (slice = 0; slice < adapter->slices; slice++) {
afu = adapter->afu[slice];
-   if (!afu->enabled)
+   if (!afu || !afu->enabled)
continue;
rcu_read_lock();
idr_for_each_entry(>contexts_idr, ctx, id)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 07/29] ALSA: usb-audio: add dB range mapping for some devices

2015-08-08 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Yao-Wen Mao 

commit 2d1cb7f658fb9c3ba8f9dab8aca297d4dfdec835 upstream.

Add the correct dB ranges of Bose Companion 5 and Drangonfly DAC 1.2.

Signed-off-by: Yao-Wen Mao 
Signed-off-by: Takashi Iwai 
Signed-off-by: Greg Kroah-Hartman 

---
 sound/usb/mixer_maps.c |   24 
 1 file changed, 24 insertions(+)

--- a/sound/usb/mixer_maps.c
+++ b/sound/usb/mixer_maps.c
@@ -336,6 +336,20 @@ static const struct usbmix_name_map scms
{ 0 }
 };
 
+/* Bose companion 5, the dB conversion factor is 16 instead of 256 */
+static struct usbmix_dB_map bose_companion5_dB = {-5006, -6};
+static struct usbmix_name_map bose_companion5_map[] = {
+   { 3, NULL, .dB = _companion5_dB },
+   { 0 }   /* terminator */
+};
+
+/* Dragonfly DAC 1.2, the dB conversion factor is 1 instead of 256 */
+static struct usbmix_dB_map dragonfly_1_2_dB = {0, 5000};
+static struct usbmix_name_map dragonfly_1_2_map[] = {
+   { 7, NULL, .dB = _1_2_dB },
+   { 0 }   /* terminator */
+};
+
 /*
  * Control map entries
  */
@@ -442,6 +456,16 @@ static struct usbmix_ctl_map usbmix_ctl_
.id = USB_ID(0x25c4, 0x0003),
.map = scms_usb3318_map,
},
+   {
+   /* Bose Companion 5 */
+   .id = USB_ID(0x05a7, 0x1020),
+   .map = bose_companion5_map,
+   },
+   {
+   /* Dragonfly DAC 1.2 */
+   .id = USB_ID(0x21b4, 0x0081),
+   .map = dragonfly_1_2_map,
+   },
{ 0 } /* terminator */
 };
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 13/29] md/raid1: fix test for was read error from last working device.

2015-08-08 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: NeilBrown 

commit 34cab6f42003cb06f48f86a86652984dec338ae9 upstream.

When we get a read error from the last working device, we don't
try to repair it, and don't fail the device.  We simple report a
read error to the caller.

However the current test for 'is this the last working device' is
wrong.
When there is only one fully working device, it assumes that a
non-faulty device is that device.  However a spare which is rebuilding
would be non-faulty but so not the only working device.

So change the test from "!Faulty" to "In_sync".  If ->degraded says
there is only one fully working device and this device is in_sync,
this must be the one.

This bug has existed since we allowed read_balance to read from
a recovering spare in v3.0

Reported-and-tested-by: Alexander Lyakas 
Fixes: 76073054c95b ("md/raid1: clean up read_balance.")
Signed-off-by: NeilBrown 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/md/raid1.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -336,7 +336,7 @@ static void raid1_end_read_request(struc
spin_lock_irqsave(>device_lock, flags);
if (r1_bio->mddev->degraded == conf->raid_disks ||
(r1_bio->mddev->degraded == conf->raid_disks-1 &&
-!test_bit(Faulty, >mirrors[mirror].rdev->flags)))
+test_bit(In_sync, >mirrors[mirror].rdev->flags)))
uptodate = 1;
spin_unlock_irqrestore(>device_lock, flags);
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 000/123] 4.1.5-stable review

2015-08-08 Thread Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.1.5 release.
There are 123 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 Mon Aug 10 22:06:48 UTC 2015.
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/v4.x/stable-review/patch-4.1.5-rc1.gz
and the diffstat can be found below.

thanks,

greg k-h

-
Pseudo-Shortlog of commits:

Greg Kroah-Hartman 
Linux 4.1.5-rc1

Dave Chinner 
xfs: remote attributes need to be considered data

Dave Chinner 
xfs: remote attribute headers contain an invalid LSN

Kamil Dudka 
drm/nouveau/drm/nv04-nv40/instmem: protect access to priv->heap by mutex

Kamil Dudka 
drm/nouveau: hold mutex when calling nouveau_abi16_fini()

Ben Skeggs 
drm/nouveau/kms/nv50-: guard against enabling cursor on disabled heads

Ilia Mirkin 
drm/nouveau/fbcon/nv11-: correctly account for ring space usage

Roland Dreier 
qla2xxx: kill sessions/log out initiator on RSCN and port down events

Kanoj Sarcar 
qla2xxx: fix command initialization in target mode.

Himanshu Madhani 
qla2xxx: Remove msleep in qlt_send_term_exchange

Quinn Tran 
qla2xxx: release request queue reservation.

Saurav Kashyap 
qla2xxx: Fix hardware lock/unlock issue causing kernel panic.

Lukasz Anaczkowski 
intel_pstate: Add get_scaling cpu_defaults param to Knights Landing

Nicholas Bellinger 
iscsi-target: Fix iser explicit logout TX kthread leak

Nicholas Bellinger 
iscsi-target: Fix iscsit_start_kthreads failure OOPs

Nicholas Bellinger 
iscsi-target: Fix use-after-free during TPG session shutdown

Jason Gunthorpe 
IB/ipoib: Fix CONFIG_INFINIBAND_IPOIB_CM

Trond Myklebust 
NFS: Fix a memory leak in nfs_do_recoalesce

Trond Myklebust 
NFSv4: We must set NFS_OPEN_STATE flag in nfs_resync_open_stateid_locked

Andy Shevchenko 
avr32: handle NULL as a valid clock object

Trond Myklebust 
NFS: Don't revalidate the mapping if both size and change attr are up to 
date

Guenter Roeck 
hwmon: (nct7904) Rename pwm attributes to match hwmon ABI

Guenter Roeck 
hwmon: (nct7802) Fix integer overflow seen when writing voltage limits

Marc-André Lureau 
vhost: actually track log eventfd file

Matt Fleming 
perf/x86/intel/cqm: Return cached counter value from IRQ context

Arnaldo Carvalho de Melo 
perf hists browser: Take the --comm, --dsos, etc filters into account

Ming Lei 
blk-mq: set default timeout as 30 seconds

Peter Hurley 
n_tty: signal and flush atomically

Wengang Wang 
rds: rds_ib_device.refcount overflow

Vineet Gupta 
ARC: Make ARC bitops "safer" (add anti-optimization)

Vineet Gupta 
ARC: Reduce bitops lines of code using macros

Dmitry Skorodumov 
x86/efi: Use all 64 bit of efi_memmap in setup_e820()

Ricardo Neri 
efi: Check for NULL efi kernel parameters

Ard Biesheuvel 
arm64/efi: map the entire UEFI vendor string before reading it

Tony Luck 
efi: Handle memory error structures produced based on old versions of 
standard

Dave Hansen 
x86/mm: Add parenthesis for TLB tracepoint size calculation

Tomas Winkler 
mei: prevent unloading mei hw modules while the device is opened.

Zhuang Jin Can 
xhci: do not report PLC when link is in internal resume state

Zhuang Jin Can 
xhci: prevent bus_suspend if SS port resuming in phase 1

Zhuang Jin Can 
xhci: report U3 when link is in resume state

Brian Campbell 
xhci: Calculate old endpoints correctly on device reset

Peter Hurley 
serial: core: Fix crashes while echoing when closing

David Jander 
Revert "serial: imx: initialized DMA w/o HW flow enabled"

Oliver Neukum 
usb-storage: ignore ZTE MF 823 card reader in mode 0x1225

Lior Amsalem 
ata: pmp: add quirk for Marvell 4140 SATA PMP

Krzysztof Kozlowski 
regulator: s2mps11: Fix GPIO suspend enable shift wrapping bug

Tejun Heo 
blkcg: fix gendisk reference leak in blkg_conf_prep()

Bernhard Bender 
Input: usbtouchscreen - avoid unresponsive TSC-30 touch screen

Oleksij Rempel 
Input: zforce - don't overwrite the stack

Chris Metcalf 
tile: use free_bootmem_late() for initrd

Sascha Hauer 
spi: imx: Fix small DMA transfers

Sifan Naeem 
spi: img-spfi: fix support for speeds up to 1/4th input clock

NeilBrown 
md/raid1: fix test for 'was read error from last working device'.

Emmanuel Grumbach 
iwlwifi: pcie: prepare the device before accessing it

Liad Kaufman 
iwlwifi: nvm: remove mac address byte swapping in 8000 family

Emmanuel Grumbach 
iwlwifi: mvm: fix antenna selection when BT is active

Antonio Borneo 
HID: cp2112: fix to force single data-report reply

Jingju Hou 
mmc: sdhci-pxav3: fix platform_data is not initialized

Joakim Tjernlund 
mmc: sdhci-esdhc: Make 

[PATCH 3.14 23/29] x86/efi: Use all 64 bit of efi_memmap in setup_e820()

2015-08-08 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Dmitry Skorodumov 

commit 7cc03e48965453b5df1cce5062c826189b04b960 upstream.

The efi_info structure stores low 32 bits of memory map
in efi_memmap and high 32 bits in efi_memmap_hi.

While constructing pointer in the setup_e820(), need
to take into account all 64 bit of the pointer.

It is because on 64bit machine the function
efi_get_memory_map() may return full 64bit pointer and before
the patch that pointer was truncated.

The issue is triggered on Parallles virtual machine and
fixed with this patch.

Signed-off-by: Dmitry Skorodumov 
Cc: Denis V. Lunev 
Signed-off-by: Matt Fleming 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/x86/boot/compressed/eboot.c |4 
 1 file changed, 4 insertions(+)

--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -560,6 +560,10 @@ static efi_status_t setup_e820(struct bo
unsigned int e820_type = 0;
unsigned long m = efi->efi_memmap;
 
+#ifdef CONFIG_X86_64
+   m |= (u64)efi->efi_memmap_hi << 32;
+#endif
+
d = (efi_memory_desc_t *)(m + (i * efi->efi_memdesc_size));
switch (d->type) {
case EFI_RESERVED_TYPE:


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 27/29] iscsi-target: Fix use-after-free during TPG session shutdown

2015-08-08 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Nicholas Bellinger 

commit 417c20a9bdd1e876384127cf096d8ae8b559066c upstream.

This patch fixes a use-after-free bug in iscsit_release_sessions_for_tpg()
where se_portal_group->session_lock was incorrectly released/re-acquired
while walking the active se_portal_group->tpg_sess_list.

The can result in a NULL pointer dereference when iscsit_close_session()
shutdown happens in the normal path asynchronously to this code, causing
a bogus dereference of an already freed list entry to occur.

To address this bug, walk the session list checking for the same state
as before, but move entries to a local list to avoid dropping the lock
while walking the active list.

As before, signal using iscsi_session->session_restatement=1 for those
list entries to be released locally by iscsit_free_session() code.

Reported-by: Sunilkumar Nadumuttlu 
Cc: Sunilkumar Nadumuttlu 
Signed-off-by: Nicholas Bellinger 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/target/iscsi/iscsi_target.c |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -4709,6 +4709,7 @@ int iscsit_release_sessions_for_tpg(stru
struct iscsi_session *sess;
struct se_portal_group *se_tpg = >tpg_se_tpg;
struct se_session *se_sess, *se_sess_tmp;
+   LIST_HEAD(free_list);
int session_count = 0;
 
spin_lock_bh(_tpg->session_lock);
@@ -4730,14 +4731,17 @@ int iscsit_release_sessions_for_tpg(stru
}
atomic_set(>session_reinstatement, 1);
spin_unlock(>conn_lock);
-   spin_unlock_bh(_tpg->session_lock);
 
-   iscsit_free_session(sess);
-   spin_lock_bh(_tpg->session_lock);
+   list_move_tail(_sess->sess_list, _list);
+   }
+   spin_unlock_bh(_tpg->session_lock);
 
+   list_for_each_entry_safe(se_sess, se_sess_tmp, _list, sess_list) {
+   sess = (struct iscsi_session *)se_sess->fabric_sess_ptr;
+
+   iscsit_free_session(sess);
session_count++;
}
-   spin_unlock_bh(_tpg->session_lock);
 
pr_debug("Released %d iSCSI Session(s) from Target Portal"
" Group: %hu\n", session_count, tpg->tpgt);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 24/29] rds: rds_ib_device.refcount overflow

2015-08-08 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Wengang Wang 

commit 4fabb59449aa44a585b3603ffdadd4c5f4d0c033 upstream.

Fixes: 3e0249f9c05c ("RDS/IB: add refcount tracking to struct rds_ib_device")

There lacks a dropping on rds_ib_device.refcount in case rds_ib_alloc_fmr
failed(mr pool running out). this lead to the refcount overflow.

A complain in line 117(see following) is seen. From vmcore:
s_ib_rdma_mr_pool_depleted is 2147485544 and rds_ibdev->refcount is -2147475448.
That is the evidence the mr pool is used up. so rds_ib_alloc_fmr is very likely
to return ERR_PTR(-EAGAIN).

115 void rds_ib_dev_put(struct rds_ib_device *rds_ibdev)
116 {
117 BUG_ON(atomic_read(_ibdev->refcount) <= 0);
118 if (atomic_dec_and_test(_ibdev->refcount))
119 queue_work(rds_wq, _ibdev->free_work);
120 }

fix is to drop refcount when rds_ib_alloc_fmr failed.

Signed-off-by: Wengang Wang 
Reviewed-by: Haggai Eran 
Signed-off-by: Doug Ledford 
Signed-off-by: Greg Kroah-Hartman 

---
 net/rds/ib_rdma.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/net/rds/ib_rdma.c
+++ b/net/rds/ib_rdma.c
@@ -759,8 +759,10 @@ void *rds_ib_get_mr(struct scatterlist *
}
 
ibmr = rds_ib_alloc_fmr(rds_ibdev);
-   if (IS_ERR(ibmr))
+   if (IS_ERR(ibmr)) {
+   rds_ib_dev_put(rds_ibdev);
return ibmr;
+   }
 
ret = rds_ib_map_fmr(rds_ibdev, ibmr, sg, nents);
if (ret == 0)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 16/29] blkcg: fix gendisk reference leak in blkg_conf_prep()

2015-08-08 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Tejun Heo 

commit 5f6c2d2b7dbb541c1e922538c49fa04c494ae3d7 upstream.

When a blkcg configuration is targeted to a partition rather than a
whole device, blkg_conf_prep fails with -EINVAL; unfortunately, it
forgets to put the gendisk ref in that case.  Fix it.

Signed-off-by: Tejun Heo 
Signed-off-by: Jens Axboe 
Signed-off-by: Greg Kroah-Hartman 

---
 block/blk-cgroup.c |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -703,8 +703,12 @@ int blkg_conf_prep(struct blkcg *blkcg,
return -EINVAL;
 
disk = get_gendisk(MKDEV(major, minor), );
-   if (!disk || part)
+   if (!disk)
return -EINVAL;
+   if (part) {
+   put_disk(disk);
+   return -EINVAL;
+   }
 
rcu_read_lock();
spin_lock_irq(disk->queue->queue_lock);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 17/29] ata: pmp: add quirk for Marvell 4140 SATA PMP

2015-08-08 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Lior Amsalem 

commit 945b47441d83d2392ac9f984e0267ad521f24268 upstream.

This commit adds the necessary quirk to make the Marvell 4140 SATA PMP
work properly. This PMP doesn't like SRST on port number 4 (the host
port) so this commit marks this port as not supporting SRST.

Signed-off-by: Lior Amsalem 
Reviewed-by: Nadav Haklai 
Signed-off-by: Thomas Petazzoni 
Signed-off-by: Tejun Heo 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/ata/libata-pmp.c |7 +++
 1 file changed, 7 insertions(+)

--- a/drivers/ata/libata-pmp.c
+++ b/drivers/ata/libata-pmp.c
@@ -460,6 +460,13 @@ static void sata_pmp_quirks(struct ata_p
   ATA_LFLAG_NO_SRST |
   ATA_LFLAG_ASSUME_ATA;
}
+   } else if (vendor == 0x11ab && devid == 0x4140) {
+   /* Marvell 4140 quirks */
+   ata_for_each_link(link, ap, EDGE) {
+   /* port 4 is for SEMB device and it doesn't like SRST */
+   if (link->pmp == 4)
+   link->flags |= ATA_LFLAG_DISABLED;
+   }
}
 }
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 10/29] mac80211: clear subdir_stations when removing debugfs

2015-08-08 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Tom Hughes 

commit 4479004e6409087d1b4986881dc98c6c15dffb28 upstream.

If we don't do this, and we then fail to recreate the debugfs
directory during a mode change, then we will fail later trying
to add stations to this now bogus directory:

BUG: unable to handle kernel NULL pointer dereference at 006c
IP: [] mutex_lock+0x12/0x30
Call Trace:
[] start_creating+0x44/0xc0
[] debugfs_create_dir+0x13/0xf0
[] ieee80211_sta_debugfs_add+0x6e/0x490 [mac80211]

Signed-off-by: Tom Hughes 
Signed-off-by: Johannes Berg 
Signed-off-by: Greg Kroah-Hartman 

---
 net/mac80211/debugfs_netdev.c |1 +
 1 file changed, 1 insertion(+)

--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -712,6 +712,7 @@ void ieee80211_debugfs_remove_netdev(str
 
debugfs_remove_recursive(sdata->vif.debugfs_dir);
sdata->vif.debugfs_dir = NULL;
+   sdata->debugfs.subdir_stations = NULL;
 }
 
 void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 004/123] Revert "Input: synaptics - allocate 3 slots to keep stability in image sensors"

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Dmitry Torokhov 

commit dbf3c370862d73fcd2c74ca55e254bb02143238d upstream.

This reverts commit 63c4fda3c0bb841b1aad1298fc7fe94058fc79f8 as it
causes issues with detecting 3-finger taps.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=100481
Acked-by: Benjamin Tissoires 

---
 drivers/input/mouse/synaptics.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -1199,7 +1199,7 @@ static void set_input_params(struct psmo
ABS_MT_POSITION_Y);
/* Image sensors can report per-contact pressure */
input_set_abs_params(dev, ABS_MT_PRESSURE, 0, 255, 0, 0);
-   input_mt_init_slots(dev, 3, INPUT_MT_POINTER | INPUT_MT_TRACK);
+   input_mt_init_slots(dev, 2, INPUT_MT_POINTER | INPUT_MT_TRACK);
 
/* Image sensors can signal 4 and 5 finger clicks */
__set_bit(BTN_TOOL_QUADTAP, dev->keybit);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 005/123] parisc: Fix some PTE/TLB race conditions and optimize __flush_tlb_range based on timing results

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: John David Anglin 

commit 01ab60570427caa24b9debc369e452e86cd9beb4 upstream.

The increased use of pdtlb/pitlb instructions seemed to increase the
frequency of random segmentation faults building packages. Further, we
had a number of cases where TLB inserts would repeatedly fail and all
forward progress would stop. The Haskell ghc package caused a lot of
trouble in this area. The final indication of a race in pte handling was
this syslog entry on sibaris (C8000):

 swap_free: Unused swap offset entry 0004
 BUG: Bad page map in process mysqld  pte:0100 pmd:019bbec5
 addr:ec464000 vm_flags:00100073 anon_vma:000221023828 mapping: 
(null) index:ec464
 CPU: 1 PID: 9176 Comm: mysqld Not tainted 4.0.0-2-parisc64-smp #1 Debian 
4.0.5-1
 Backtrace:
  [<40173eb0>] show_stack+0x20/0x38
  [<4024>] dump_stack+0x9c/0x110
  [<402a0d38>] print_bad_pte+0x1a8/0x278
  [<402a28b8>] unmap_single_vma+0x3d8/0x770
  [<402a4090>] zap_page_range+0xf0/0x198
  [<402ba2a4>] SyS_madvise+0x404/0x8c0

Note that the pte value is 0 except for the accessed bit 0x100. This bit
shouldn't be set without the present bit.

It should be noted that the madvise system call is probably a trigger for many
of the random segmentation faults.

In looking at the kernel code, I found the following problems:

1) The pte_clear define didn't take TLB lock when clearing a pte.
2) We didn't test pte present bit inside lock in exception support.
3) The pte and tlb locks needed to merged in order to ensure consistency
between page table and TLB. This also has the effect of serializing TLB
broadcasts on SMP systems.

The attached change implements the above and a few other tweaks to try
to improve performance. Based on the timing code, TLB purges are very
slow (e.g., ~ 209 cycles per page on rp3440). Thus, I think it
beneficial to test the split_tlb variable to avoid duplicate purges.
Probably, all PA 2.0 machines have combined TLBs.

I dropped using __flush_tlb_range in flush_tlb_mm as I realized all
applications and most threads have a stack size that is too large to
make this useful. I added some comments to this effect.

Since implementing 1 through 3, I haven't had any random segmentation
faults on mx3210 (rp3440) in about one week of building code and running
as a Debian buildd.

Signed-off-by: John David Anglin 
Signed-off-by: Helge Deller 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/parisc/include/asm/pgtable.h  |   57 
 arch/parisc/include/asm/tlbflush.h |   53 ++--
 arch/parisc/kernel/cache.c |  105 +++
 arch/parisc/kernel/entry.S |  163 +
 arch/parisc/kernel/traps.c |4 
 5 files changed, 213 insertions(+), 169 deletions(-)

--- a/arch/parisc/include/asm/pgtable.h
+++ b/arch/parisc/include/asm/pgtable.h
@@ -16,7 +16,7 @@
 #include 
 #include 
 
-extern spinlock_t pa_dbit_lock;
+extern spinlock_t pa_tlb_lock;
 
 /*
  * kern_addr_valid(ADDR) tests if ADDR is pointing to valid kernel
@@ -33,6 +33,19 @@ extern spinlock_t pa_dbit_lock;
  */
 #define kern_addr_valid(addr)  (1)
 
+/* Purge data and instruction TLB entries.  Must be called holding
+ * the pa_tlb_lock.  The TLB purge instructions are slow on SMP
+ * machines since the purge must be broadcast to all CPUs.
+ */
+
+static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)
+{
+   mtsp(mm->context, 1);
+   pdtlb(addr);
+   if (unlikely(split_tlb))
+   pitlb(addr);
+}
+
 /* Certain architectures need to do special things when PTEs
  * within a page table are directly modified.  Thus, the following
  * hook is made available.
@@ -42,15 +55,20 @@ extern spinlock_t pa_dbit_lock;
 *(pteptr) = (pteval);   \
 } while(0)
 
-extern void purge_tlb_entries(struct mm_struct *, unsigned long);
-
-#define set_pte_at(mm, addr, ptep, pteval)  \
-   do {\
+#define pte_inserted(x)\
+   ((pte_val(x) & (_PAGE_PRESENT|_PAGE_ACCESSED))  \
+== (_PAGE_PRESENT|_PAGE_ACCESSED))
+
+#define set_pte_at(mm, addr, ptep, pteval) \
+   do {\
+   pte_t old_pte;  \
unsigned long flags;\
-   spin_lock_irqsave(_dbit_lock, flags);\
-   set_pte(ptep, pteval);  \
-   purge_tlb_entries(mm, addr);\
-   spin_unlock_irqrestore(_dbit_lock, flags);   \
+   spin_lock_irqsave(_tlb_lock, flags); \
+   old_pte = *ptep;

[PATCH 4.1 006/123] parisc: mm: Fix a memory leak related to pmd not attached to the pgd

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Christophe Jaillet 

commit 4c4ac9a48ac512c6b5a6cca06cfad2ad96e8caaa upstream.

Commit 0e0da48dee8d ("parisc: mm: don't count preallocated pmds")
introduced a memory leak.

After this commit, the 'return' statement in pmd_free is executed in all
cases. Even for pmd that are not attached to the pgd.  So 'free_pages'
can never be called anymore, leading to a memory leak.

Signed-off-by: Christophe JAILLET 
Acked-by: Kirill A. Shutemov 
Acked-by: Mikulas Patocka 
Acked-by: Helge Deller 
Signed-off-by: Helge Deller 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/parisc/include/asm/pgalloc.h |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/arch/parisc/include/asm/pgalloc.h
+++ b/arch/parisc/include/asm/pgalloc.h
@@ -72,7 +72,7 @@ static inline pmd_t *pmd_alloc_one(struc
 
 static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
 {
-   if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED)
+   if (pmd_flag(*pmd) & PxD_FLAG_ATTACHED) {
/*
 * This is the permanent pmd attached to the pgd;
 * cannot free it.
@@ -81,6 +81,7 @@ static inline void pmd_free(struct mm_st
 */
mm_inc_nr_pmds(mm);
return;
+   }
free_pages((unsigned long)pmd, PMD_ORDER);
 }
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 026/123] crypto: omap-des - Fix unmapping of dma channels

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: "Vutla, Lokesh" 

commit acb33cc541d7a5495b16a133702d4c401ea4e294 upstream.

dma_unmap_sg() is being called twice after completing the
task. Looks like this is a copy paste error when creating
des driver.
With this the following warn appears during boot:

[4.210457] [ cut here ]
[4.215114] WARNING: CPU: 0 PID: 0 at lib/dma-debug.c:1080 
check_unmap+0x710/0x9a0()
[4.222899] omap-des 480a5000.des: DMA-API: device driver tries to free DMA 
memory it has not allocated [device address=0xab2ce000] [size=8 bytes]
[4.236785] Modules linked in:
[4.239860] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 
3.14.39-02999-g1bc045a-dirty #182
[4.247918] [] (unwind_backtrace) from [] 
(show_stack+0x10/0x14)
[4.255710] [] (show_stack) from [] 
(dump_stack+0x84/0xb8)
[4.262977] [] (dump_stack) from [] 
(warn_slowpath_common+0x68/0x8c)
[4.271107] [] (warn_slowpath_common) from [] 
(warn_slowpath_fmt+0x30/0x40)
[4.279854] [] (warn_slowpath_fmt) from [] 
(check_unmap+0x710/0x9a0)
[4.287991] [] (check_unmap) from [] 
(debug_dma_unmap_sg+0x90/0x19c)
[4.296128] [] (debug_dma_unmap_sg) from [] 
(omap_des_done_task+0x1cc/0x3e4)
[4.304963] [] (omap_des_done_task) from [] 
(tasklet_action+0x84/0x124)
[4.313370] [] (tasklet_action) from [] 
(__do_softirq+0xf0/0x20c)
[4.321235] [] (__do_softirq) from [] 
(irq_exit+0x98/0xec)
[4.328500] [] (irq_exit) from [] (handle_IRQ+0x50/0xb0)
[4.335589] [] (handle_IRQ) from [] 
(gic_handle_irq+0x28/0x5c)

Removing the duplicate call to dma_unmap_sg().

Reported-by: Tomi Valkeinen 
Signed-off-by: Lokesh Vutla 
Signed-off-by: Herbert Xu 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/crypto/omap-des.c |3 ---
 1 file changed, 3 deletions(-)

--- a/drivers/crypto/omap-des.c
+++ b/drivers/crypto/omap-des.c
@@ -536,9 +536,6 @@ static int omap_des_crypt_dma_stop(struc
dmaengine_terminate_all(dd->dma_lch_in);
dmaengine_terminate_all(dd->dma_lch_out);
 
-   dma_unmap_sg(dd->dev, dd->in_sg, dd->in_sg_len, DMA_TO_DEVICE);
-   dma_unmap_sg(dd->dev, dd->out_sg, dd->out_sg_len, DMA_FROM_DEVICE);
-
return err;
 }
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 025/123] x86/kasan: Fix boot crash on AMD processors

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Andrey Ryabinin 

commit d4f86beacc21d538dc41e1fc75a22e084f547edf upstream.

While populating zero shadow wrong bits in upper level page
tables used. __PAGE_KERNEL_RO that was used for pgd/pud/pmd has
_PAGE_BIT_GLOBAL set. Global bit is present only in the lowest
level of the page translation hierarchy (ptes), and it should be
zero in upper levels.

This bug seems doesn't cause any troubles on Intel cpus, while
on AMDs it cause kernel crash on boot.

Use _KERNPG_TABLE bits for pgds/puds/pmds to fix this.

Reported-by: Borislav Petkov 
Signed-off-by: Andrey Ryabinin 
Cc: Alexander Popov 
Cc: Alexander Potapenko 
Cc: Andrey Konovalov 
Cc: Dmitry Vyukov 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Link: 
http://lkml.kernel.org/r/1435828178-10975-5-git-send-email-a.ryabi...@samsung.com
Signed-off-by: Ingo Molnar 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/x86/mm/kasan_init_64.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/arch/x86/mm/kasan_init_64.c
+++ b/arch/x86/mm/kasan_init_64.c
@@ -85,7 +85,7 @@ static int __init zero_pmd_populate(pud_
while (IS_ALIGNED(addr, PMD_SIZE) && addr + PMD_SIZE <= end) {
WARN_ON(!pmd_none(*pmd));
set_pmd(pmd, __pmd(__pa_nodebug(kasan_zero_pte)
-   | __PAGE_KERNEL_RO));
+   | _KERNPG_TABLE));
addr += PMD_SIZE;
pmd = pmd_offset(pud, addr);
}
@@ -111,7 +111,7 @@ static int __init zero_pud_populate(pgd_
while (IS_ALIGNED(addr, PUD_SIZE) && addr + PUD_SIZE <= end) {
WARN_ON(!pud_none(*pud));
set_pud(pud, __pud(__pa_nodebug(kasan_zero_pmd)
-   | __PAGE_KERNEL_RO));
+   | _KERNPG_TABLE));
addr += PUD_SIZE;
pud = pud_offset(pgd, addr);
}
@@ -136,7 +136,7 @@ static int __init zero_pgd_populate(unsi
while (IS_ALIGNED(addr, PGDIR_SIZE) && addr + PGDIR_SIZE <= end) {
WARN_ON(!pgd_none(*pgd));
set_pgd(pgd, __pgd(__pa_nodebug(kasan_zero_pud)
-   | __PAGE_KERNEL_RO));
+   | _KERNPG_TABLE));
addr += PGDIR_SIZE;
pgd = pgd_offset_k(addr);
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 007/123] ARM: pxa: fix dm9000 platform data regression

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Robert Jarzmik 

commit a927ef895e288e79f1bfed221f27d7bfa37e907f upstream.

Since dm9000 driver added support for a vcc regulator, platform data
based platforms have their ethernet broken, as the regulator claiming
returns -EPROBE_DEFER and prevents dm9000 loading.

This patch fixes this for all pxa boards using dm9000, by using the
specific regulator_has_full_constraints() function.

This was discovered and tested on the cm-x300 board.

Fixes: 7994fe55a4a2 ("dm9000: Add regulator and reset support to dm9000")
Signed-off-by: Robert Jarzmik 
Acked-by: Igor Grinberg 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/mach-pxa/capc7117.c   |3 +++
 arch/arm/mach-pxa/cm-x2xx.c|3 +++
 arch/arm/mach-pxa/cm-x300.c|2 ++
 arch/arm/mach-pxa/colibri-pxa270.c |3 +++
 arch/arm/mach-pxa/em-x270.c|2 ++
 arch/arm/mach-pxa/icontrol.c   |3 +++
 arch/arm/mach-pxa/trizeps4.c   |3 +++
 arch/arm/mach-pxa/vpac270.c|3 +++
 arch/arm/mach-pxa/zeus.c   |2 ++
 9 files changed, 24 insertions(+)

--- a/arch/arm/mach-pxa/capc7117.c
+++ b/arch/arm/mach-pxa/capc7117.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -144,6 +145,8 @@ static void __init capc7117_init(void)
 
capc7117_uarts_init();
capc7117_ide_init();
+
+   regulator_has_full_constraints();
 }
 
 MACHINE_START(CAPC7117,
--- a/arch/arm/mach-pxa/cm-x2xx.c
+++ b/arch/arm/mach-pxa/cm-x2xx.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -466,6 +467,8 @@ static void __init cmx2xx_init(void)
cmx2xx_init_ac97();
cmx2xx_init_touchscreen();
cmx2xx_init_leds();
+
+   regulator_has_full_constraints();
 }
 
 static void __init cmx2xx_init_irq(void)
--- a/arch/arm/mach-pxa/cm-x300.c
+++ b/arch/arm/mach-pxa/cm-x300.c
@@ -835,6 +835,8 @@ static void __init cm_x300_init(void)
cm_x300_init_ac97();
cm_x300_init_wi2wi();
cm_x300_init_bl();
+
+   regulator_has_full_constraints();
 }
 
 static void __init cm_x300_fixup(struct tag *tags, char **cmdline)
--- a/arch/arm/mach-pxa/colibri-pxa270.c
+++ b/arch/arm/mach-pxa/colibri-pxa270.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -294,6 +295,8 @@ static void __init colibri_pxa270_init(v
printk(KERN_ERR "Illegal colibri_pxa270_baseboard type %d\n",
colibri_pxa270_baseboard);
}
+
+   regulator_has_full_constraints();
 }
 
 /* The "Income s.r.o. SH-Dmaster PXA270 SBC" board can be booted either
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -1306,6 +1306,8 @@ static void __init em_x270_init(void)
em_x270_init_i2c();
em_x270_init_camera();
em_x270_userspace_consumers_init();
+
+   regulator_has_full_constraints();
 }
 
 MACHINE_START(EM_X270, "Compulab EM-X270")
--- a/arch/arm/mach-pxa/icontrol.c
+++ b/arch/arm/mach-pxa/icontrol.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "generic.h"
 
@@ -185,6 +186,8 @@ static void __init icontrol_init(void)
mxm_8x10_mmc_init();
 
icontrol_can_init();
+
+   regulator_has_full_constraints();
 }
 
 MACHINE_START(ICONTROL, "iControl/SafeTcam boards using Embedian MXM-8x10 CoM")
--- a/arch/arm/mach-pxa/trizeps4.c
+++ b/arch/arm/mach-pxa/trizeps4.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -534,6 +535,8 @@ static void __init trizeps4_init(void)
 
BCR_writew(trizeps_conxs_bcr);
board_backlight_power(1);
+
+   regulator_has_full_constraints();
 }
 
 static void __init trizeps4_map_io(void)
--- a/arch/arm/mach-pxa/vpac270.c
+++ b/arch/arm/mach-pxa/vpac270.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -711,6 +712,8 @@ static void __init vpac270_init(void)
vpac270_ts_init();
vpac270_rtc_init();
vpac270_ide_init();
+
+   regulator_has_full_constraints();
 }
 
 MACHINE_START(VPAC270, "Voipac PXA270")
--- a/arch/arm/mach-pxa/zeus.c
+++ b/arch/arm/mach-pxa/zeus.c
@@ -868,6 +868,8 @@ static void __init zeus_init(void)
i2c_register_board_info(0, ARRAY_AND_SIZE(zeus_i2c_devices));
pxa2xx_set_spi_info(3, _spi_ssp3_master_info);
spi_register_board_info(zeus_spi_board_info, 
ARRAY_SIZE(zeus_spi_board_info));
+
+   regulator_has_full_constraints();
 }
 
 static struct map_desc zeus_io_desc[] __initdata = {


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH 1/4] vhost: Introduce a universal thread to serve all users

2015-08-08 Thread Bandan Das
Eyal Moscovici  writes:

> Hi, 
>
> Do you know what is the overhead of switching the vhost thread from one 
> cgroup to another?

I misinterpreted this question earlier. I think what you are asking here is
that when the vm process is moved from one cgroup to another, what is the
overhead of moving the vhost thread to the new cgroup.

This design does not provide any hooks for the vhost thread to move to
a new cgroup. Rather, I think a better approach is to create a new vhost
thread and bind the process to it if the process is migrated to a new
cgroup. This is much less complicated, and there's a good chance that
it's impossible to migrate the vhost thread since it's serving other guests.
I will address this in v2.

> Eyal Moscovici
> HL-Cloud Infrastructure Solutions
> IBM Haifa Research Lab
>
>
>
> From:   Bandan Das 
> To: k...@vger.kernel.org
> Cc: net...@vger.kernel.org, linux-kernel@vger.kernel.org, 
> m...@redhat.com, Eyal Moscovici/Haifa/IBM@IBMIL, Razya 
> Ladelsky/Haifa/IBM@IBMIL, cgro...@vger.kernel.org, jasow...@redhat.com
> Date:   07/13/2015 07:08 AM
> Subject:[RFC PATCH 1/4] vhost: Introduce a universal thread to 
> serve all users
>
>
>
> vhost threads are per-device, but in most cases a single thread
> is enough. This change creates a single thread that is used to
> serve all guests.
>
> However, this complicates cgroups associations. The current policy
> is to attach the per-device thread to all cgroups of the parent process
> that the device is associated it. This is no longer possible if we
> have a single thread. So, we end up moving the thread around to
> cgroups of whichever device that needs servicing. This is a very
> inefficient protocol but seems to be the only way to integrate
> cgroups support.
>
> Signed-off-by: Razya Ladelsky 
> Signed-off-by: Bandan Das 
> ---
>  drivers/vhost/scsi.c  |  15 +++--
>  drivers/vhost/vhost.c | 150 
> --
>  drivers/vhost/vhost.h |  19 +--
>  3 files changed, 97 insertions(+), 87 deletions(-)
>
> diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
> index ea32b38..6c42936 100644
> --- a/drivers/vhost/scsi.c
> +++ b/drivers/vhost/scsi.c
> @@ -535,7 +535,7 @@ static void vhost_scsi_complete_cmd(struct 
> vhost_scsi_cmd *cmd)
>  
>  llist_add(>tvc_completion_list, 
> >vs_completion_list);
>  
> -vhost_work_queue(>dev, >vs_completion_work);
> +vhost_work_queue(vs->dev.worker, 
> >vs_completion_work);
>  }
>  
>  static int vhost_scsi_queue_data_in(struct se_cmd *se_cmd)
> @@ -1282,7 +1282,7 @@ vhost_scsi_send_evt(struct vhost_scsi *vs,
>  }
>  
>  llist_add(>list, >vs_event_list);
> -vhost_work_queue(>dev, >vs_event_work);
> +vhost_work_queue(vs->dev.worker, >vs_event_work);
>  }
>  
>  static void vhost_scsi_evt_handle_kick(struct vhost_work *work)
> @@ -1335,8 +1335,8 @@ static void vhost_scsi_flush(struct vhost_scsi *vs)
>  /* Flush both the vhost poll and vhost work */
>  for (i = 0; i < VHOST_SCSI_MAX_VQ; i++)
>  vhost_scsi_flush_vq(vs, i);
> -vhost_work_flush(>dev, >vs_completion_work);
> -vhost_work_flush(>dev, >vs_event_work);
> +vhost_work_flush(vs->dev.worker, 
> >vs_completion_work);
> +vhost_work_flush(vs->dev.worker, >vs_event_work);
>  
>  /* Wait for all reqs issued before the flush to be 
> finished */
>  for (i = 0; i < VHOST_SCSI_MAX_VQ; i++)
> @@ -1584,8 +1584,11 @@ static int vhost_scsi_open(struct inode *inode, 
> struct file *f)
>  if (!vqs)
>  goto err_vqs;
>  
> -vhost_work_init(>vs_completion_work, 
> vhost_scsi_complete_cmd_work);
> -vhost_work_init(>vs_event_work, vhost_scsi_evt_work);
> +vhost_work_init(>dev, >vs_completion_work,
> + vhost_scsi_complete_cmd_work);
> +
> +vhost_work_init(>dev, >vs_event_work,
> +vhost_scsi_evt_work);
>  
>  vs->vs_events_nr = 0;
>  vs->vs_events_missed = false;
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index 2ee2826..951c96b 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -11,6 +11,8 @@
>   * Generic code for virtio server in host kernel.
>   */
>  
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>  #include 
>  #include 
>  #include 
> @@ -28,6 +30,9 @@
>  
>  #include "vhost.h"
>  
> +/* Just one worker thread to service all devices */
> +static struct vhost_worker *worker;
> +
>  enum {
>  VHOST_MEMORY_MAX_NREGIONS = 64,
>  VHOST_MEMORY_F_LOG = 0x1,
> @@ -58,13 +63,15 @@ static int vhost_poll_wakeup(wait_queue_t *wait, 
> unsigned mode, int sync,
>  return 0;
>  }
>  

[PATCH 4.1 055/123] drivers: clk: st: Fix flexgen lock init

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Giuseppe Cavallaro 

commit 0f4f2afd4402883a51ad27a1d9e046643bb1e3cb upstream.

While proving lock, the following warning happens
and it is fixed after initializing lock in the setup
function

INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.10.27-02861-g39df285-dirty #33
[] (unwind_backtrace+0x0/0xf4) from [] 
(show_stack+0x10/0x14)
[] (show_stack+0x10/0x14) from [] 
(__lock_acquire+0x900/0xb14)
[] (__lock_acquire+0x900/0xb14) from [] 
(lock_acquire+0x68/0x7c)
[] (lock_acquire+0x68/0x7c) from [] 
(_raw_spin_lock_irqsave+0x48/0x5c)
[] (_raw_spin_lock_irqsave+0x48/0x5c) from [] 
(clk_gate_endisable+0x28/0x88)
[] (clk_gate_endisable+0x28/0x88) from [] 
(clk_gate_enable+0xc/0x14)
[] (clk_gate_enable+0xc/0x14) from [] 
(flexgen_enable+0x28/0x40)
[] (flexgen_enable+0x28/0x40) from [] 
(__clk_enable+0x5c/0x9c)
[] (__clk_enable+0x5c/0x9c) from [] (clk_enable+0x18/0x2c)
[] (clk_enable+0x18/0x2c) from [] 
(st_lpc_of_register+0xc0/0x248)
[] (st_lpc_of_register+0xc0/0x248) from [] 
(clocksource_of_init+0x34/0x58)
[] (clocksource_of_init+0x34/0x58) from [] 
(sti_timer_init+0x10/0x18)
[] (sti_timer_init+0x10/0x18) from [] (time_init+0x20/0x30)
[] (time_init+0x20/0x30) from [] (start_kernel+0x20c/0x2e8)
[] (start_kernel+0x20c/0x2e8) from [<40008074>] (0x40008074)

Signed-off-by: Giuseppe Cavallaro 
Signed-off-by: Gabriel Fernandez 
Fixes: b116517055b7 ("clk: st: STiH407: Support for Flexgen Clocks")
Signed-off-by: Stephen Boyd 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/clk/st/clk-flexgen.c |2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/clk/st/clk-flexgen.c
+++ b/drivers/clk/st/clk-flexgen.c
@@ -303,6 +303,8 @@ void __init st_of_flexgen_setup(struct d
if (!rlock)
goto err;
 
+   spin_lock_init(rlock);
+
for (i = 0; i < clk_data->clk_num; i++) {
struct clk *clk;
const char *clk_name;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 064/123] mmc: omap_hsmmc: Fix DTO and DCRC handling

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Kishon Vijay Abraham I 

commit 408806f740497c5d71f9c305b3d6aad260ff186d upstream.

DTO/DCRC errors were not being informed to the mmc core since
commit ae4bf788ee9b ("mmc: omap_hsmmc: consolidate error report handling of
HSMMC IRQ"). This commit made sure 'end_trans' is never set on DTO/DCRC
errors. This is because after this commit 'host->data' is checked after
it has been cleared to NULL by omap_hsmmc_dma_cleanup().

Because 'end_trans' is never set, omap_hsmmc_xfer_done() is never invoked
making core layer not to be aware of DTO/DCRC errors. Because of this
any command invoked after DTO/DCRC error leads to a hang.

Fix this by checking for 'host->data' before it is actually cleared.

Fixes: ae4bf788ee9b ("mmc: omap_hsmmc: consolidate error report handling of
HSMMC IRQ")

Signed-off-by: Kishon Vijay Abraham I 
Signed-off-by: Vignesh R 
Tested-by: Andreas Fenkart 
Signed-off-by: Ulf Hansson 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/mmc/host/omap_hsmmc.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1062,6 +1062,10 @@ static void omap_hsmmc_do_irq(struct oma
 
if (status & (CTO_EN | CCRC_EN))
end_cmd = 1;
+   if (host->data || host->response_busy) {
+   end_trans = !end_cmd;
+   host->response_busy = 0;
+   }
if (status & (CTO_EN | DTO_EN))
hsmmc_command_incomplete(host, -ETIMEDOUT, end_cmd);
else if (status & (CCRC_EN | DCRC_EN))
@@ -1081,10 +1085,6 @@ static void omap_hsmmc_do_irq(struct oma
}
dev_dbg(mmc_dev(host->mmc), "AC12 err: 0x%x\n", ac12);
}
-   if (host->data || host->response_busy) {
-   end_trans = !end_cmd;
-   host->response_busy = 0;
-   }
}
 
OMAP_HSMMC_WRITE(host->base, STAT, status);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 008/123] ARM: dts: dra7x-evm: Prevent glitch on DCAN1 pinmux

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Roger Quadros 

commit 2acb5c301edf39ab6d066687ce70da1166e4de9e upstream.

Driver core sets "default" pinmux on on probe and CAN driver
sets "sleep" pinmux during register. This causes a small window
where the CAN pins are in "default" state with the DCAN module
being disabled.

Change the "default" state to be like sleep so this glitch is
avoided. Add a new "active" state that is used by the driver
when CAN is actually active.

Signed-off-by: Roger Quadros 
Signed-off-by: Marc Kleine-Budde 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/boot/dts/dra7-evm.dts  |5 +++--
 arch/arm/boot/dts/dra72-evm.dts |5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

--- a/arch/arm/boot/dts/dra7-evm.dts
+++ b/arch/arm/boot/dts/dra7-evm.dts
@@ -686,7 +686,8 @@
 
  {
status = "ok";
-   pinctrl-names = "default", "sleep";
-   pinctrl-0 = <_pins_default>;
+   pinctrl-names = "default", "sleep", "active";
+   pinctrl-0 = <_pins_sleep>;
pinctrl-1 = <_pins_sleep>;
+   pinctrl-2 = <_pins_default>;
 };
--- a/arch/arm/boot/dts/dra72-evm.dts
+++ b/arch/arm/boot/dts/dra72-evm.dts
@@ -497,9 +497,10 @@
 
  {
status = "ok";
-   pinctrl-names = "default", "sleep";
-   pinctrl-0 = <_pins_default>;
+   pinctrl-names = "default", "sleep", "active";
+   pinctrl-0 = <_pins_sleep>;
pinctrl-1 = <_pins_sleep>;
+   pinctrl-2 = <_pins_default>;
 };
 
  {


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 009/123] ARM: dts: am57xx-beagle-x15: Provide supply for usb2_phy2

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Roger Quadros 

commit 9ab402aed38b95d9ce453108622be0fc6f167568 upstream.

Without this USB2 breaks if USB1 is disabled or USB1
initializes after USB2 e.g. due to deferred probing.

Fixes: 5a0f93c6576a ("ARM: dts: Add am57xx-beagle-x15")
Signed-off-by: Roger Quadros 
Signed-off-by: Tony Lindgren 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/boot/dts/am57xx-beagle-x15.dts |4 
 1 file changed, 4 insertions(+)

--- a/arch/arm/boot/dts/am57xx-beagle-x15.dts
+++ b/arch/arm/boot/dts/am57xx-beagle-x15.dts
@@ -544,6 +544,10 @@
phy-supply = <_reg>;
 };
 
+_phy2 {
+   phy-supply = <_reg>;
+};
+
  {
dr_mode = "host";
pinctrl-names = "default";


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4.1 076/123] Input: zforce - dont overwrite the stack

2015-08-08 Thread Dmitry Torokhov
Hi Greg,

On August 8, 2015 3:09:14 PM PDT, Greg Kroah-Hartman 
 wrote:
>4.1-stable review patch.  If anyone has any objections, please let me
>know.

This was a bad patch and its reverted n mainline, please drop.

>
>--
>
>From: Oleksij Rempel 
>
>commit 7d01cd261c76f95913c81554a751968a1d282d3a upstream.
>
>If we get a corrupted packet with PAYLOAD_LENGTH > FRAME_MAXSIZE, we
>will silently overwrite the stack.
>
>Signed-off-by: Oleksij Rempel 
>Signed-off-by: Dirk Behme 
>Signed-off-by: Dmitry Torokhov 
>Signed-off-by: Greg Kroah-Hartman 
>
>---
> drivers/input/touchscreen/zforce_ts.c |2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>--- a/drivers/input/touchscreen/zforce_ts.c
>+++ b/drivers/input/touchscreen/zforce_ts.c
>@@ -430,7 +430,7 @@ static int zforce_read_packet(struct zfo
>   goto unlock;
>   }
> 
>-  if (buf[PAYLOAD_LENGTH] == 0) {
>+  if (buf[PAYLOAD_LENGTH] == 0 || buf[PAYLOAD_LENGTH] > FRAME_MAXSIZE)
>{
>   dev_err(>dev, "invalid payload length: %d\n",
>   buf[PAYLOAD_LENGTH]);
>   ret = -EIO;


Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 056/123] drivers: clk: st: Fix mux bit-setting for Cortex A9 clocks

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Gabriel Fernandez 

commit 3be6d8ce639d92e60d144fb99dd74a53fe3799bb upstream.

This patch fixes the mux bit-setting for ClockgenA9.

Signed-off-by: Gabriel Fernandez 
Fixes: 13e6f2da1ddf ("clk: st: STiH407: Support for A9 MUX Clocks")
Signed-off-by: Stephen Boyd 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/clk/st/clkgen-mux.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/clk/st/clkgen-mux.c
+++ b/drivers/clk/st/clkgen-mux.c
@@ -582,7 +582,7 @@ static struct clkgen_mux_data stih416_a9
 };
 static struct clkgen_mux_data stih407_a9_mux_data = {
.offset = 0x1a4,
-   .shift = 1,
+   .shift = 0,
.width = 2,
 };
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 028/123] s390/sclp: clear upper register halves in _sclp_print_early

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Martin Schwidefsky 

commit f9c87a6f46d508eae0d9ae640be98d50f237f827 upstream.

If the kernel is compiled with gcc 5.1 and the XZ compression option
the decompress_kernel function calls _sclp_print_early in 64-bit mode
while the content of the upper register half of %r6 is non-zero.
This causes a specification exception on the servc instruction in
_sclp_servc.

The _sclp_print_early function saves and restores the upper registers
halves but it fails to clear them for the 31-bit code of the mini sclp
driver.

Signed-off-by: Martin Schwidefsky 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/s390/kernel/sclp.S |4 
 1 file changed, 4 insertions(+)

--- a/arch/s390/kernel/sclp.S
+++ b/arch/s390/kernel/sclp.S
@@ -270,6 +270,8 @@ ENTRY(_sclp_print_early)
jno .Lesa2
ahi %r15,-80
stmh%r6,%r15,96(%r15)   # store upper register halves
+   basr%r13,0
+   lmh %r0,%r15,.Lzeroes-.(%r13)   # clear upper register halves
 .Lesa2:
lr  %r10,%r2# save string pointer
lhi %r2,0
@@ -291,6 +293,8 @@ ENTRY(_sclp_print_early)
 .Lesa3:
lm  %r6,%r15,120(%r15)  # restore registers
br  %r14
+.Lzeroes:
+   .fill   64,4,0
 
 .LwritedataS4:
.long   0x00760005  # SCLP command for write data


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 066/123] mmc: sdhci-esdhc: Make 8BIT bus work

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Joakim Tjernlund 

commit 8e91125ff3f57f15c6568e2a6d32743b3f7815e4 upstream.

Support for 8BIT bus with was added some time ago to sdhci-esdhc but
then missed to remove the 8BIT from the reserved bit mask which made
8BIT non functional.

Fixes: 66b50a00992d ("mmc: esdhc: Add support for 8-bit bus width and..")
Signed-off-by: Joakim Tjernlund 
Signed-off-by: Ulf Hansson 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/mmc/host/sdhci-esdhc.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/mmc/host/sdhci-esdhc.h
+++ b/drivers/mmc/host/sdhci-esdhc.h
@@ -45,6 +45,6 @@
 #define ESDHC_DMA_SYSCTL   0x40c
 #define ESDHC_DMA_SNOOP0x0040
 
-#define ESDHC_HOST_CONTROL_RES 0x05
+#define ESDHC_HOST_CONTROL_RES 0x01
 
 #endif /* _DRIVERS_MMC_SDHCI_ESDHC_H */


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 057/123] drivers: clk: st: Incorrect register offset used for lock_status

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Pankaj Dev 

commit 56551da9255f20ffd3a9711728a1a3ad4b7100af upstream.

Incorrect register offset used for sthi407 clockgenC

Signed-off-by: Pankaj Dev 
Signed-off-by: Gabriel Fernandez 
Fixes: 51306d56ba81 ("clk: st: STiH407: Support for clockgenC0")
Signed-off-by: Stephen Boyd 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/clk/st/clkgen-fsyn.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/clk/st/clkgen-fsyn.c
+++ b/drivers/clk/st/clkgen-fsyn.c
@@ -340,7 +340,7 @@ static const struct clkgen_quadfs_data s
CLKGEN_FIELD(0x30c, 0xf, 20),
CLKGEN_FIELD(0x310, 0xf, 20) },
.lockstatus_present = true,
-   .lock_status = CLKGEN_FIELD(0x2A0, 0x1, 24),
+   .lock_status = CLKGEN_FIELD(0x2f0, 0x1, 24),
.powerup_polarity = 1,
.standby_polarity = 1,
.pll_ops= _quadfs_pll_c32_ops,


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 010/123] ARM: 8404/1: dma-mapping: fix off-by-one error in bitmap size check

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Marek Szyprowski 

commit 462859aa7bbe1ac83ec4377a0a06fe60778f3f27 upstream.

nr_bitmaps member of mapping structure stores the number of already
allocated bitmaps and it is interpreted as loop iterator (it starts from
0 not from 1), so a comparison against number of possible bitmap
extensions should include this fact. This patch fixes this by changing
the extension failure condition. This issue has been introduced by
commit 4d852ef8c2544ce21ae41414099a7504c61164a0 ("arm: dma-mapping: Add
support to extend DMA IOMMU mappings").

Reported-by: Hyungwon Hwang 
Signed-off-by: Marek Szyprowski 
Reviewed-by: Hyungwon Hwang 
Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/mm/dma-mapping.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1953,7 +1953,7 @@ static int extend_iommu_mapping(struct d
 {
int next_bitmap;
 
-   if (mapping->nr_bitmaps > mapping->extensions)
+   if (mapping->nr_bitmaps >= mapping->extensions)
return -EINVAL;
 
next_bitmap = mapping->nr_bitmaps;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 065/123] mmc: sdhci check parameters before call dma_free_coherent

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Peng Fan 

commit 7ac020366b0a436d726408841160b5dc32c19214 upstream.

We should not call dma_free_coherent if host->adma_table is NULL,
otherwise may trigger panic.

Fixes: d1e49f77d7c7 ("mmc: sdhci: convert ADMA descriptors to a...")
Signed-off-by: Peng Fan 
Acked-by: Adrian Hunter 
Signed-off-by: Ulf Hansson 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/mmc/host/sdhci.c |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -3037,8 +3037,11 @@ int sdhci_add_host(struct sdhci_host *ho
  GFP_KERNEL);
host->align_buffer = kmalloc(host->align_buffer_sz, GFP_KERNEL);
if (!host->adma_table || !host->align_buffer) {
-   dma_free_coherent(mmc_dev(mmc), host->adma_table_sz,
- host->adma_table, host->adma_addr);
+   if (host->adma_table)
+   dma_free_coherent(mmc_dev(mmc),
+ host->adma_table_sz,
+ host->adma_table,
+ host->adma_addr);
kfree(host->align_buffer);
pr_warn("%s: Unable to allocate ADMA buffers - falling 
back to standard DMA\n",
mmc_hostname(mmc));


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 062/123] ftrace: Fix breakage of set_ftrace_pid

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: "Steven Rostedt (Red Hat)" 

commit e3eea1404f5ff7a2ceb7b5e7ba412a6fd94f2935 upstream.

Commit 4104d326b670 ("ftrace: Remove global function list and call function
directly") simplified the ftrace code by removing the global_ops list with a
new design. But this cleanup also broke the filtering of PIDs that are added
to the set_ftrace_pid file.

Add back the proper hooks to have pid filtering working once again.

Reported-by: Matt Fleming 
Reported-by: Richard Weinberger 
Tested-by: Matt Fleming 
Signed-off-by: Steven Rostedt 
Signed-off-by: Greg Kroah-Hartman 

---
 include/linux/ftrace.h |3 ++
 kernel/trace/ftrace.c  |   52 -
 2 files changed, 37 insertions(+), 18 deletions(-)

--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -116,6 +116,7 @@ ftrace_func_t ftrace_ops_get_func(struct
  *SAVE_REGS. If another ops with this flag set is already 
registered
  *for any of the functions that this ops will be registered for, 
then
  *this ops will fail to register or set_filter_ip.
+ * PID - Is affected by set_ftrace_pid (allows filtering on those pids)
  */
 enum {
FTRACE_OPS_FL_ENABLED   = 1 << 0,
@@ -132,6 +133,7 @@ enum {
FTRACE_OPS_FL_MODIFYING = 1 << 11,
FTRACE_OPS_FL_ALLOC_TRAMP   = 1 << 12,
FTRACE_OPS_FL_IPMODIFY  = 1 << 13,
+   FTRACE_OPS_FL_PID   = 1 << 14,
 };
 
 #ifdef CONFIG_DYNAMIC_FTRACE
@@ -159,6 +161,7 @@ struct ftrace_ops {
struct ftrace_ops   *next;
unsigned long   flags;
void*private;
+   ftrace_func_t   saved_func;
int __percpu*disabled;
 #ifdef CONFIG_DYNAMIC_FTRACE
int nr_trampolines;
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -98,6 +98,13 @@ struct ftrace_pid {
struct pid *pid;
 };
 
+static bool ftrace_pids_enabled(void)
+{
+   return !list_empty(_pids);
+}
+
+static void ftrace_update_trampoline(struct ftrace_ops *ops);
+
 /*
  * ftrace_disabled is set when an anomaly is discovered.
  * ftrace_disabled is much stronger than ftrace_enabled.
@@ -109,7 +116,6 @@ static DEFINE_MUTEX(ftrace_lock);
 static struct ftrace_ops *ftrace_control_list __read_mostly = _list_end;
 static struct ftrace_ops *ftrace_ops_list __read_mostly = _list_end;
 ftrace_func_t ftrace_trace_function __read_mostly = ftrace_stub;
-ftrace_func_t ftrace_pid_function __read_mostly = ftrace_stub;
 static struct ftrace_ops global_ops;
 static struct ftrace_ops control_ops;
 
@@ -183,14 +189,7 @@ static void ftrace_pid_func(unsigned lon
if (!test_tsk_trace_trace(current))
return;
 
-   ftrace_pid_function(ip, parent_ip, op, regs);
-}
-
-static void set_ftrace_pid_function(ftrace_func_t func)
-{
-   /* do not set ftrace_pid_function to itself! */
-   if (func != ftrace_pid_func)
-   ftrace_pid_function = func;
+   op->saved_func(ip, parent_ip, op, regs);
 }
 
 /**
@@ -202,7 +201,6 @@ static void set_ftrace_pid_function(ftra
 void clear_ftrace_function(void)
 {
ftrace_trace_function = ftrace_stub;
-   ftrace_pid_function = ftrace_stub;
 }
 
 static void control_ops_disable_all(struct ftrace_ops *ops)
@@ -436,6 +434,12 @@ static int __register_ftrace_function(st
} else
add_ftrace_ops(_ops_list, ops);
 
+   /* Always save the function, and reset at unregistering */
+   ops->saved_func = ops->func;
+
+   if (ops->flags & FTRACE_OPS_FL_PID && ftrace_pids_enabled())
+   ops->func = ftrace_pid_func;
+
ftrace_update_trampoline(ops);
 
if (ftrace_enabled)
@@ -463,15 +467,28 @@ static int __unregister_ftrace_function(
if (ftrace_enabled)
update_ftrace_function();
 
+   ops->func = ops->saved_func;
+
return 0;
 }
 
 static void ftrace_update_pid_func(void)
 {
+   bool enabled = ftrace_pids_enabled();
+   struct ftrace_ops *op;
+
/* Only do something if we are tracing something */
if (ftrace_trace_function == ftrace_stub)
return;
 
+   do_for_each_ftrace_op(op, ftrace_ops_list) {
+   if (op->flags & FTRACE_OPS_FL_PID) {
+   op->func = enabled ? ftrace_pid_func :
+   op->saved_func;
+   ftrace_update_trampoline(op);
+   }
+   } while_for_each_ftrace_op(op);
+
update_ftrace_function();
 }
 
@@ -1133,7 +1150,8 @@ static struct ftrace_ops global_ops = {
.local_hash.filter_hash = EMPTY_HASH,
INIT_OPS_HASH(global_ops)
.flags  = FTRACE_OPS_FL_RECURSION_SAFE |
-  

[PATCH 4.1 063/123] iommu/vt-d: Fix VM domain ID leak

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Alex Williamson 

commit 46ebb7af7b93792de65e124e1ab8b89a108a41f2 upstream.

This continues the attempt to fix commit fb170fb4c548 ("iommu/vt-d:
Introduce helper functions to make code symmetric for readability").
The previous attempt in commit 71684406905f ("iommu/vt-d: Detach
domain *only* from attached iommus") overlooked the fact that
dmar_domain.iommu_bmp gets cleared for VM domains when devices are
detached:

intel_iommu_detach_device
  domain_remove_one_dev_info
domain_detach_iommu

The domain is detached from the iommu, but the iommu is still attached
to the domain, for whatever reason.  Thus when we get to domain_exit(),
we can't rely on iommu_bmp for VM domains to find the active iommus,
we must check them all.  Without that, the corresponding bit in
intel_iommu.domain_ids doesn't get cleared and repeated VM domain
creation and destruction will run out of domain IDs.  Meanwhile we
still can't call iommu_detach_domain() on arbitrary non-VM domains or
we risk clearing in-use domain IDs, as 71684406905f attempted to
address.

It's tempting to modify iommu_detach_domain() to test the domain
iommu_bmp, but the call ordering from domain_remove_one_dev_info()
prevents it being able to work as fb170fb4c548 seems to have intended.
Caching of unused VM domains on the iommu object seems to be the root
of the problem, but this code is far too fragile for that kind of
rework to be proposed for stable, so we simply revert this chunk to
its state prior to fb170fb4c548.

Fixes: fb170fb4c548 ("iommu/vt-d: Introduce helper functions to make
  code symmetric for readability")
Fixes: 71684406905f ("iommu/vt-d: Detach domain *only* from attached
  iommus")
Signed-off-by: Alex Williamson 
Cc: Jiang Liu 
Signed-off-by: Joerg Roedel 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/iommu/intel-iommu.c |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -1756,8 +1756,9 @@ static int domain_init(struct dmar_domai
 
 static void domain_exit(struct dmar_domain *domain)
 {
+   struct dmar_drhd_unit *drhd;
+   struct intel_iommu *iommu;
struct page *freelist = NULL;
-   int i;
 
/* Domain 0 is reserved, so dont process it */
if (!domain)
@@ -1777,8 +1778,10 @@ static void domain_exit(struct dmar_doma
 
/* clear attached or cached domains */
rcu_read_lock();
-   for_each_set_bit(i, domain->iommu_bmp, g_num_of_iommus)
-   iommu_detach_domain(domain, g_iommus[i]);
+   for_each_active_iommu(iommu, drhd)
+   if (domain_type_is_vm(domain) ||
+   test_bit(iommu->seq_id, domain->iommu_bmp))
+   iommu_detach_domain(domain, iommu);
rcu_read_unlock();
 
dma_free_pagelist(freelist);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 031/123] s390/cachinfo: add missing facility check to init_cache_level()

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Heiko Carstens 

commit 0b991f5cdcd6201e5401f83ca3a672343c3bfc49 upstream.

Stephen Powell reported the following crash on a z890 machine:

Kernel BUG at 001219d0 [verbose debug info unavailable]
illegal operation: 0001 ilc:3 [#1] SMP
Krnl PSW : 0704e0018000 001219d0 (init_cache_level+0x38/0xe0)
   R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:2 PM:0 EA:3
Krnl Code: 001219c2: a7840056   brc 8,121a6e
   001219c6: a719   lghi%r1,0
  #001219ca: eb10104c   ecag%r1,%r0,0(%r1)
  >001219d0: a739   lghi%r3,0
   001219d4: e310f0a00024   stg %r1,160(%r15)
   001219da: a708   lhi %r0,0
   001219de: a7b9f000   lghi%r11,-4096
   001219e2: c0a0002899d9   larl%r10,634d94
Call Trace:
 [<00478ee2>] detect_cache_attributes+0x2a/0x2b8
 [<0097c9b0>] cacheinfo_sysfs_init+0x60/0xc8
 [<001001c0>] do_one_initcall+0x98/0x1c8
 [<0094fdc2>] kernel_init_freeable+0x212/0x2d8
 [<0062352e>] kernel_init+0x26/0x118
 [<0062fd2e>] kernel_thread_starter+0x6/0xc

The illegal operation was executed because of a missing facility check,
which should have made sure that the ECAG execution would only be executed
on machines which have the general-instructions-extension facility
installed.

Reported-and-tested-by: Stephen Powell 
Signed-off-by: Heiko Carstens 
Signed-off-by: Martin Schwidefsky 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/s390/kernel/cache.c |2 ++
 1 file changed, 2 insertions(+)

--- a/arch/s390/kernel/cache.c
+++ b/arch/s390/kernel/cache.c
@@ -138,6 +138,8 @@ int init_cache_level(unsigned int cpu)
union cache_topology ct;
enum cache_type ctype;
 
+   if (!test_facility(34))
+   return -EOPNOTSUPP;
if (!this_cpu_ci)
return -EINVAL;
ct.raw = ecag(EXTRACT_TOPOLOGY, 0, 0);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 068/123] HID: cp2112: fix to force single data-report reply

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Antonio Borneo 

commit 6debce6f4e787a8eb4cec94e7afa85fb4f40db27 upstream.

Current implementation of cp2112_raw_event() only accepts one data report at a
time. If last received data report is not fully handled yet, a new incoming
data report will overwrite it. In such case we don't guaranteed to propagate
the correct incoming data.

The trivial fix implemented here forces a single report at a time by requesting
in cp2112_read() no more than 61 byte of data, which is the payload size of a
single data report.

Signed-off-by: Antonio Borneo 
Tested-by: Ellen Wang 
Signed-off-by: Jiri Kosina 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/hid/hid-cp2112.c |2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/hid/hid-cp2112.c
+++ b/drivers/hid/hid-cp2112.c
@@ -356,6 +356,8 @@ static int cp2112_read(struct cp2112_dev
struct cp2112_force_read_report report;
int ret;
 
+   if (size > sizeof(dev->read_data))
+   size = sizeof(dev->read_data);
report.report = CP2112_DATA_READ_FORCE_SEND;
report.length = cpu_to_be16(size);
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 067/123] mmc: sdhci-pxav3: fix platform_data is not initialized

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Jingju Hou 

commit 9cd76049f0d90ae241f5ad80e311489824527000 upstream.

pdev->dev.platform_data is not initialized if match is true in function
sdhci_pxav3_probe. Just local variable pdata is assigned the return value
from function pxav3_get_mmc_pdata().

static int sdhci_pxav3_probe(struct platform_device *pdev) {

struct sdhci_pxa_platdata *pdata = pdev->dev.platform_data;
...
if (match) {
ret = mmc_of_parse(host->mmc);
if (ret)
goto err_of_parse;
sdhci_get_of_property(pdev);
pdata = pxav3_get_mmc_pdata(dev);
 }
 ...
}

Signed-off-by: Jingju Hou 
Fixes: b650352dd3df("mmc: sdhci-pxa: Add device tree support")
Signed-off-by: Ulf Hansson 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/mmc/host/sdhci-pxav3.c |1 +
 1 file changed, 1 insertion(+)

--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -411,6 +411,7 @@ static int sdhci_pxav3_probe(struct plat
goto err_of_parse;
sdhci_get_of_property(pdev);
pdata = pxav3_get_mmc_pdata(dev);
+   pdev->dev.platform_data = pdata;
} else if (pdata) {
/* on-chip device */
if (pdata->flags & PXA_FLAG_CARD_PERMANENT)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 032/123] ARC: Override toplevel default -O2 with -O3

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Vineet Gupta 

commit 97709069214eb75312c14946803b9da4d3814203 upstream.

ARC kernels have historically been built with -O3, despite top level
Makefile defaulting to -O2. This was facilitated by implicitly ordering
of arch makefile include AFTER top level assigned -O2.

An upstream fix to top level a1c48bb160f ("Makefile: Fix unrecognized
cross-compiler command line options") changed the ordering, making ARC
-O3 defunct.

Fix that by NOT relying on any ordering whatsoever and use the proper
arch override facility now present in kbuild (ARCH_*FLAGS)

Depends-on: ("kbuild: Allow arch Makefiles to override {cpp,ld,c}flags")
Suggested-by: Michal Marek 
Cc: Geert Uytterhoeven 
Signed-off-by: Vineet Gupta 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arc/Makefile |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -43,7 +43,8 @@ endif
 
 ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE
 # Generic build system uses -O2, we want -O3
-cflags-y  += -O3
+# Note: No need to add to cflags-y as that happens anyways
+ARCH_CFLAGS += -O3
 endif
 
 # small data is default for elf32 tool-chain. If not usable, disable it


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 070/123] iwlwifi: nvm: remove mac address byte swapping in 8000 family

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Liad Kaufman 

commit be88a1ada9b97bb016196b7f4a1fc2fe2f798529 upstream.

This fixes the byte order copying in the MAO (Mac Override
Section) section from the PNVM, as the byte swapping is not
required anymore in the 8000 family. Due to the byte
swapping, the driver was reporting an incorrect MAC
adddress.

Signed-off-by: Liad Kaufman 
Signed-off-by: Emmanuel Grumbach 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/iwlwifi/iwl-nvm-parse.c |   12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

--- a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
+++ b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
@@ -540,13 +540,11 @@ static void iwl_set_hw_address_family_80
hw_addr = (const u8 *)(mac_override +
 MAC_ADDRESS_OVERRIDE_FAMILY_8000);
 
-   /* The byte order is little endian 16 bit, meaning 214365 */
-   data->hw_addr[0] = hw_addr[1];
-   data->hw_addr[1] = hw_addr[0];
-   data->hw_addr[2] = hw_addr[3];
-   data->hw_addr[3] = hw_addr[2];
-   data->hw_addr[4] = hw_addr[5];
-   data->hw_addr[5] = hw_addr[4];
+   /*
+* Store the MAC address from MAO section.
+* No byte swapping is required in MAO section
+*/
+   memcpy(data->hw_addr, hw_addr, ETH_ALEN);
 
/*
 * Force the use of the OTP MAC address in case of reserved MAC


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 030/123] s390/bpf: clear correct BPF accumulator register

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Michael Holzheu 

commit 30342fe65e511007672437741158d493472f427f upstream.

Currently we assumed the following BPF to eBPF register mapping:

 - BPF_REG_A -> BPF_REG_7
 - BPF_REG_X -> BPF_REG_8

Unfortunately this mapping is wrong. The correct mapping is:

 - BPF_REG_A -> BPF_REG_0
 - BPF_REG_X -> BPF_REG_7

So clear the correct registers and use the BPF_REG_A and BPF_REG_X
macros instead of BPF_REG_0/7.

Fixes: 054623105728 ("s390/bpf: Add s390x eBPF JIT compiler backend")
Signed-off-by: Michael Holzheu 
Signed-off-by: Martin Schwidefsky 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/s390/net/bpf_jit_comp.c |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

--- a/arch/s390/net/bpf_jit_comp.c
+++ b/arch/s390/net/bpf_jit_comp.c
@@ -415,13 +415,13 @@ static void bpf_jit_prologue(struct bpf_
EMIT6_DISP_LH(0xe300, 0x0004, REG_SKB_DATA, REG_0,
  BPF_REG_1, offsetof(struct sk_buff, data));
}
-   /* BPF compatibility: clear A (%b7) and X (%b8) registers */
-   if (REG_SEEN(BPF_REG_7))
-   /* lghi %b7,0 */
-   EMIT4_IMM(0xa709, BPF_REG_7, 0);
-   if (REG_SEEN(BPF_REG_8))
-   /* lghi %b8,0 */
-   EMIT4_IMM(0xa709, BPF_REG_8, 0);
+   /* BPF compatibility: clear A (%b0) and X (%b7) registers */
+   if (REG_SEEN(BPF_REG_A))
+   /* lghi %ba,0 */
+   EMIT4_IMM(0xa709, BPF_REG_A, 0);
+   if (REG_SEEN(BPF_REG_X))
+   /* lghi %bx,0 */
+   EMIT4_IMM(0xa709, BPF_REG_X, 0);
 }
 
 /*


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 071/123] iwlwifi: pcie: prepare the device before accessing it

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Emmanuel Grumbach 

commit f9e5554cd8ca1d1212ec922755b397a20f737923 upstream.

For 8000 series, we need to access the device to know what
firmware to load. Before we do so, we need to prepare the
device otherwise we might not be able to access the
hardware.

Fixes: c278754a21e6 ("iwlwifi: mvm: support family 8000 B2/C steps")
Signed-off-by: Emmanuel Grumbach 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/iwlwifi/pcie/trans.c |6 ++
 1 file changed, 6 insertions(+)

--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -2515,6 +2515,12 @@ struct iwl_trans *iwl_trans_pcie_alloc(s
trans->hw_rev = (trans->hw_rev & 0xfff0) |
(CSR_HW_REV_STEP(trans->hw_rev << 2) << 2);
 
+   ret = iwl_pcie_prepare_card_hw(trans);
+   if (ret) {
+   IWL_WARN(trans, "Exit HW not ready\n");
+   goto out_pci_disable_msi;
+   }
+
/*
 * in-order to recognize C step driver should read chip version
 * id located at the AUX bus MISC address space.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 069/123] iwlwifi: mvm: fix antenna selection when BT is active

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Emmanuel Grumbach 

commit 923a8c1d8069104726bde55c37cec66324ccc328 upstream.

When BT is active, we want to avoid the shared antenna for
management frame to make sure we don't disturb BT. There
was a bug in that code because it chose the antenna
BIT(ANT_A) where ANT_A is already a bitmap (0x1). This
means that the antenna chosen in the end was ANT_B.
While this is not optimal on devices with 2 antennas (it'd
disturb BT), it is critical on single antenna devices like
3160 which couldn't connect at all when BT was active.

This fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=97181

Fixes: 34c8b24ff284 ("iwlwifi: mvm: BT Coex - avoid the shared antenna for 
management frames")
Signed-off-by: Emmanuel Grumbach 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/iwlwifi/mvm/tx.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/wireless/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c
@@ -225,7 +225,7 @@ void iwl_mvm_set_tx_cmd_rate(struct iwl_
 
if (info->band == IEEE80211_BAND_2GHZ &&
!iwl_mvm_bt_coex_is_shared_ant_avail(mvm))
-   rate_flags = BIT(mvm->cfg->non_shared_ant) << RATE_MCS_ANT_POS;
+   rate_flags = mvm->cfg->non_shared_ant << RATE_MCS_ANT_POS;
else
rate_flags =
BIT(mvm->mgmt_last_antenna_idx) << RATE_MCS_ANT_POS;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 072/123] md/raid1: fix test for was read error from last working device.

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: NeilBrown 

commit 34cab6f42003cb06f48f86a86652984dec338ae9 upstream.

When we get a read error from the last working device, we don't
try to repair it, and don't fail the device.  We simple report a
read error to the caller.

However the current test for 'is this the last working device' is
wrong.
When there is only one fully working device, it assumes that a
non-faulty device is that device.  However a spare which is rebuilding
would be non-faulty but so not the only working device.

So change the test from "!Faulty" to "In_sync".  If ->degraded says
there is only one fully working device and this device is in_sync,
this must be the one.

This bug has existed since we allowed read_balance to read from
a recovering spare in v3.0

Reported-and-tested-by: Alexander Lyakas 
Fixes: 76073054c95b ("md/raid1: clean up read_balance.")
Signed-off-by: NeilBrown 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/md/raid1.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -336,7 +336,7 @@ static void raid1_end_read_request(struc
spin_lock_irqsave(>device_lock, flags);
if (r1_bio->mddev->degraded == conf->raid_disks ||
(r1_bio->mddev->degraded == conf->raid_disks-1 &&
-!test_bit(Faulty, >mirrors[mirror].rdev->flags)))
+test_bit(In_sync, >mirrors[mirror].rdev->flags)))
uptodate = 1;
spin_unlock_irqrestore(>device_lock, flags);
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.1 073/123] spi: img-spfi: fix support for speeds up to 1/4th input clock

2015-08-08 Thread Greg Kroah-Hartman
4.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Sifan Naeem 

commit 6a806a214af42ac951e2d85e64d1bf4463482e16 upstream.

Setting the Same Edge bit indicates to the spfi block to receive and
transmit data on the same edge of the spfi clock, which in turn
doubles the operating frequency of spfi.

The maximum supported frequency is limited to 1/4th of the spfi input
clock, but without this bit set the maximum would be 1/8th of the
input clock.

The current driver calculates the divisor with maximum speed at 1/4th
of the input clock, this would fail if the requested frequency is
higher than 1/8 of the input clock. Any requests for 1/8th of the
input clock would still pass.

Fixes: 8543d0e72d43 ("spi: img-spfi: Limit bit clock to 1/4th of input clock")
Signed-off-by: Sifan Naeem 
Signed-off-by: Mark Brown 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/spi/spi-img-spfi.c |2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/spi/spi-img-spfi.c
+++ b/drivers/spi/spi-img-spfi.c
@@ -40,6 +40,7 @@
 #define SPFI_CONTROL_SOFT_RESETBIT(11)
 #define SPFI_CONTROL_SEND_DMA  BIT(10)
 #define SPFI_CONTROL_GET_DMA   BIT(9)
+#define SPFI_CONTROL_SEBIT(8)
 #define SPFI_CONTROL_TMODE_SHIFT   5
 #define SPFI_CONTROL_TMODE_MASK0x7
 #define SPFI_CONTROL_TMODE_SINGLE  0
@@ -491,6 +492,7 @@ static void img_spfi_config(struct spi_m
else if (xfer->tx_nbits == SPI_NBITS_QUAD &&
 xfer->rx_nbits == SPI_NBITS_QUAD)
val |= SPFI_CONTROL_TMODE_QUAD << SPFI_CONTROL_TMODE_SHIFT;
+   val |= SPFI_CONTROL_SE;
spfi_writel(spfi, val, SPFI_CONTROL);
 }
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   3   4   5   6   7   8   9   >