Proposal: I2C device power (Was: hwmon: (lm90) Add power control)

2013-08-08 Thread Alexander Shiyan
Hi all.

Instead of adding the support of regulators in each device, let's think about
whether it is possible to create a global regulator for any device on the I2C 
bus.

I see it like this:
We add an extra field in the i2c_board_info structure "power_name" and handle
it in the i2c_device_{probe/remove} functions.

The question remains how to maintain such regulator in the PM functions,
but we can discuss it.

Changes like this, will remove existing regulators from drivers and allows to
use power regulator for any I2C device.
If such idea is good, such changes could be made to other devices (SPI, w1, 
etc.).
Thanks.

---


[PATCH] hwrng: pixocel - Staticize 'rng_dev'

2013-08-08 Thread Jingoo Han
'rng_dev' is used only in this file.
Fix the following sparse warning:

drivers/char/hw_random/picoxcell-rng.c:36:15: warning: symbol 'rng_dev' was not 
declared. Should it be static?

Signed-off-by: Jingoo Han 
---
 drivers/char/hw_random/picoxcell-rng.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/picoxcell-rng.c 
b/drivers/char/hw_random/picoxcell-rng.c
index 973b951..3d4c229 100644
--- a/drivers/char/hw_random/picoxcell-rng.c
+++ b/drivers/char/hw_random/picoxcell-rng.c
@@ -33,7 +33,7 @@
 
 static void __iomem *rng_base;
 static struct clk *rng_clk;
-struct device *rng_dev;
+static struct device *rng_dev;
 
 static inline u32 picoxcell_trng_read_csr(void)
 {
-- 
1.7.10.4


--
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] ACPI, cpu hotplug: move try_offline_node() after acpi_unmap_lsapic()

2013-08-08 Thread Yasuaki Ishimatsu
(2013/08/09 11:43), Gu Zheng wrote:
> Hi Ishimatsu-san,
> On 08/06/2013 06:11 PM, Yasuaki Ishimatsu wrote:
> 
>> try_offline_node() checks that all cpus related with removed node have been
>> removed by using cpu_present_bits. If all cpus related with removed node have
>> been removed, try_offline_node() clears the node information.
>>
>> But try_offline_node() called from acpi_processor_remove() never clears
>> the node information. For disabling cpu_present_bits, acpi_unmap_lsapic()
>> need be called. But acpi_unmap_lsapic() is called after try_offline_node()
>> runs. So when try_offline_node() runs, the cpu's cpu_present_bits is always
>> set.
>>
>> This patch moves try_offline_node() after acpi_unmap_lsapic().
> 
> It works well.
> 
>>
>> Signed-off-by: Yasuaki Ishimatsu 
> 
> 
> Tested-by: Gu Zheng 

Thank you for testing.

Thanks,
Yasuaki Ishimatsu

> 
> Thanks,
> Gu
> 
>> ---
>>   drivers/acpi/acpi_processor.c |3 ++-
>>   1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
>> index fd6c51c..5a74a9c 100644
>> --- a/drivers/acpi/acpi_processor.c
>> +++ b/drivers/acpi/acpi_processor.c
>> @@ -451,7 +451,6 @@ static void acpi_processor_remove(struct acpi_device 
>> *device)
>>  /* Clean up. */
>>  per_cpu(processor_device_array, pr->id) = NULL;
>>  per_cpu(processors, pr->id) = NULL;
>> -try_offline_node(cpu_to_node(pr->id));
>>
>>  /* Remove the CPU. */
>>  get_online_cpus();
>> @@ -459,6 +458,8 @@ static void acpi_processor_remove(struct acpi_device 
>> *device)
>>  acpi_unmap_lsapic(pr->id);
>>  put_online_cpus();
>>
>> +try_offline_node(cpu_to_node(pr->id));
>> +
>>out:
>>  free_cpumask_var(pr->throttling.shared_cpu_map);
>>  kfree(pr);
>>
>> --
>> 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/
>>
> 
> 


--
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] mm/hotplug: Verify hotplug memory range

2013-08-08 Thread Tang Chen

On 08/09/2013 12:47 AM, Toshi Kani wrote:

add_memory() and remove_memory() can only handle a memory range aligned
with section.  There are problems when an unaligned range is added and
then deleted as follows:

  - add_memory() with an unaligned range succeeds, but __add_pages()
called from add_memory() adds a whole section of pages even though
a given memory range is less than the section size.
  - remove_memory() to the added unaligned range hits BUG_ON() in
__remove_pages().

This patch changes add_memory() and remove_memory() to check if a given
memory range is aligned with section at the beginning.  As the result,
add_memory() fails with -EINVAL when a given range is unaligned, and
does not add such memory range.  This prevents remove_memory() to be
called with an unaligned range as well.  Note that remove_memory() has
to use BUG_ON() since this function cannot fail.

Signed-off-by: Toshi Kani
---
  mm/memory_hotplug.c |   22 ++
  1 file changed, 22 insertions(+)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index ca1dd3a..ac182de 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1069,6 +1069,22 @@ out:
return ret;
  }

+static int check_hotplug_memory_range(u64 start, u64 size)
+{
+   u64 start_pfn = start>>  PAGE_SHIFT;
+   u64 nr_pages = size>>  PAGE_SHIFT;
+
+   /* Memory range must be aligned with section */
+   if ((start_pfn&  ~PAGE_SECTION_MASK) ||
+   (nr_pages % PAGES_PER_SECTION) || (!nr_pages)) {
+   pr_err("Unsupported hotplug range: start 0x%llx, size 0x%llx\n",
+   start, size);


I think the message here should tell users that only support range aligned
to section. Others seems OK to me.

Reviewed-by: Tang Chen 

Thanks.


+   return -EINVAL;
+   }
+
+   return 0;
+}
+
  /* we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG */
  int __ref add_memory(int nid, u64 start, u64 size)
  {
@@ -1078,6 +1094,10 @@ int __ref add_memory(int nid, u64 start, u64 size)
struct resource *res;
int ret;

+   ret = check_hotplug_memory_range(start, size);
+   if (ret)
+   return ret;
+
lock_memory_hotplug();

res = register_memory_resource(start, size);
@@ -1786,6 +1806,8 @@ void __ref remove_memory(int nid, u64 start, u64 size)
  {
int ret;

+   BUG_ON(check_hotplug_memory_range(start, size));
+
lock_memory_hotplug();

/*


--
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 01/17] perf util: Save pid-cmdline mapping into tracing header

2013-08-08 Thread Namhyung Kim
Hi David,

On Wed, 07 Aug 2013 09:44:24 -0400, David Ahern wrote:
> On 8/5/13 3:17 AM, Namhyung Kim wrote:
>>> I don't think this is a problem, its in line with Ingo's suggestion of a
>>> new perf ioctl to ask the kernel to generate PERF_RECORD_MMAP events for
>>> existing threads.
>>
>> Hmm.. could you please give me a link of the thread?
>
> I believe this is the thread being referred to:
> https://lkml.org/lkml/2013/6/25/180

Thank you!
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 v1 04/14] clk: Add set_rate_and_parent() op

2013-08-08 Thread Mike Turquette
Quoting Stephen Boyd (2013-07-25 09:45:42)
> On 07/25, Tomasz Figa wrote:
> > On Wednesday 24 of July 2013 17:43:32 Stephen Boyd wrote:
> > > Some of Qualcomm's clocks can change their parent and rate at the
> > > same time with a single register write. Add support for this
> > > hardware to the common clock framework by adding a new
> > > set_rate_and_parent() op. When the clock framework determines
> > > that both the parent and the rate are going to change during
> > > clk_set_rate() it will call the .set_rate_and_parent() op if
> > > available and fall back to calling .set_parent() followed by
> > > .set_rate() otherwise.
> > 
> > This is strange. Does you hardware support switching parent and rate 
> > separately or you always need to set both and so all the fuss here?
> 
> It supports setting the parent or setting the rate, or setting
> both at the same time.

I think that setting parent and rate at the same time is a common enough
case to merit handling it in the clock core. Probably this design will
become more common in time.

Regards,
Mike

> 
> > 
> > If the latter is the case, then maybe you can simply keep parent index and 
> > rate cached inside driver data of your clock driver and use them on any 
> > .set_rate() or .set_parent() calls?
> 
> This will not work. In fact, doing that would cause us to
> overclock hardware for a short time between switching the parent
> and the rate.
> 
> -- 
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> hosted by The Linux Foundation
--
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/9] mbind: add hugepage migration code to mbind()

2013-08-08 Thread Naoya Horiguchi
This patch extends do_mbind() to handle vma with VM_HUGETLB set.
We will be able to migrate hugepage with mbind(2) after
applying the enablement patch which comes later in this series.

ChangeLog v3:
 - revert introducing migrate_movable_pages
 - added alloc_huge_page_noerr free from ERR_VALUE

ChangeLog v2:
 - updated description and renamed patch title

Signed-off-by: Naoya Horiguchi 
Acked-by: Andi Kleen 
Reviewed-by: Wanpeng Li 
Acked-by: Hillf Danton 
---
 include/linux/hugetlb.h |  3 +++
 mm/hugetlb.c| 14 ++
 mm/mempolicy.c  |  4 +++-
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git v3.11-rc3.orig/include/linux/hugetlb.h 
v3.11-rc3/include/linux/hugetlb.h
index bc8d837..d1db007 100644
--- v3.11-rc3.orig/include/linux/hugetlb.h
+++ v3.11-rc3/include/linux/hugetlb.h
@@ -265,6 +265,8 @@ struct huge_bootmem_page {
 };
 
 struct page *alloc_huge_page_node(struct hstate *h, int nid);
+struct page *alloc_huge_page_noerr(struct vm_area_struct *vma,
+   unsigned long addr, int avoid_reserve);
 
 /* arch callback */
 int __init alloc_bootmem_huge_page(struct hstate *h);
@@ -378,6 +380,7 @@ static inline pgoff_t basepage_index(struct page *page)
 #else  /* CONFIG_HUGETLB_PAGE */
 struct hstate {};
 #define alloc_huge_page_node(h, nid) NULL
+#define alloc_huge_page_noerr(v, a, r) NULL
 #define alloc_bootmem_huge_page(h) NULL
 #define hstate_file(f) NULL
 #define hstate_sizelog(s) NULL
diff --git v3.11-rc3.orig/mm/hugetlb.c v3.11-rc3/mm/hugetlb.c
index 649771c..ee764b0 100644
--- v3.11-rc3.orig/mm/hugetlb.c
+++ v3.11-rc3/mm/hugetlb.c
@@ -1195,6 +1195,20 @@ static struct page *alloc_huge_page(struct 
vm_area_struct *vma,
return page;
 }
 
+/*
+ * alloc_huge_page()'s wrapper which simply returns the page if allocation
+ * succeeds, otherwise NULL. This function is called from new_vma_page(),
+ * where no ERR_VALUE is expected to be returned.
+ */
+struct page *alloc_huge_page_noerr(struct vm_area_struct *vma,
+   unsigned long addr, int avoid_reserve)
+{
+   struct page *page = alloc_huge_page(vma, addr, avoid_reserve);
+   if (IS_ERR(page))
+   page = NULL;
+   return page;
+}
+
 int __weak alloc_bootmem_huge_page(struct hstate *h)
 {
struct huge_bootmem_page *m;
diff --git v3.11-rc3.orig/mm/mempolicy.c v3.11-rc3/mm/mempolicy.c
index d96afc1..4a03c14 100644
--- v3.11-rc3.orig/mm/mempolicy.c
+++ v3.11-rc3/mm/mempolicy.c
@@ -1183,6 +1183,8 @@ static struct page *new_vma_page(struct page *page, 
unsigned long private, int *
vma = vma->vm_next;
}
 
+   if (PageHuge(page))
+   return alloc_huge_page_noerr(vma, address, 1);
/*
 * if !vma, alloc_page_vma() will use task or system default policy
 */
@@ -1293,7 +1295,7 @@ static long do_mbind(unsigned long start, unsigned long 
len,
(unsigned long)vma,
MIGRATE_SYNC, MR_MEMPOLICY_MBIND);
if (nr_failed)
-   putback_lru_pages();
+   putback_movable_pages();
}
 
if (nr_failed && (flags & MPOL_MF_STRICT))
-- 
1.8.3.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 8/9] migrate: check movability of hugepage in unmap_and_move_huge_page()

2013-08-08 Thread Naoya Horiguchi
Currently hugepage migration works well only for pmd-based hugepages
(mainly due to lack of testing,) so we had better not enable migration
of other levels of hugepages until we are ready for it.

Some users of hugepage migration (mbind, move_pages, and migrate_pages)
do page table walk and check pud/pmd_huge() there, so they are safe.
But the other users (softoffline and memory hotremove) don't do this,
so without this patch they can try to migrate unexpected types of hugepages.

To prevent this, we introduce hugepage_migration_support() as an architecture
dependent check of whether hugepage are implemented on a pmd basis or not.
And on some architecture multiple sizes of hugepages are available, so
hugepage_migration_support() also checks hugepage size.

Signed-off-by: Naoya Horiguchi 
---
 arch/arm/mm/hugetlbpage.c |  5 +
 arch/arm64/mm/hugetlbpage.c   |  5 +
 arch/ia64/mm/hugetlbpage.c|  5 +
 arch/metag/mm/hugetlbpage.c   |  5 +
 arch/mips/mm/hugetlbpage.c|  5 +
 arch/powerpc/mm/hugetlbpage.c | 10 ++
 arch/s390/mm/hugetlbpage.c|  5 +
 arch/sh/mm/hugetlbpage.c  |  5 +
 arch/sparc/mm/hugetlbpage.c   |  5 +
 arch/tile/mm/hugetlbpage.c|  5 +
 arch/x86/mm/hugetlbpage.c |  8 
 include/linux/hugetlb.h   | 12 
 mm/migrate.c  | 10 ++
 13 files changed, 85 insertions(+)

diff --git v3.11-rc3.orig/arch/arm/mm/hugetlbpage.c 
v3.11-rc3/arch/arm/mm/hugetlbpage.c
index 3d1e4a2..3f3b6a7 100644
--- v3.11-rc3.orig/arch/arm/mm/hugetlbpage.c
+++ v3.11-rc3/arch/arm/mm/hugetlbpage.c
@@ -99,3 +99,8 @@ int pmd_huge(pmd_t pmd)
 {
return pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT);
 }
+
+int pmd_huge_support(void)
+{
+   return 1;
+}
diff --git v3.11-rc3.orig/arch/arm64/mm/hugetlbpage.c 
v3.11-rc3/arch/arm64/mm/hugetlbpage.c
index 2fc8258..5e9aec3 100644
--- v3.11-rc3.orig/arch/arm64/mm/hugetlbpage.c
+++ v3.11-rc3/arch/arm64/mm/hugetlbpage.c
@@ -54,6 +54,11 @@ int pud_huge(pud_t pud)
return !(pud_val(pud) & PUD_TABLE_BIT);
 }
 
+int pmd_huge_support(void)
+{
+   return 1;
+}
+
 static __init int setup_hugepagesz(char *opt)
 {
unsigned long ps = memparse(opt, );
diff --git v3.11-rc3.orig/arch/ia64/mm/hugetlbpage.c 
v3.11-rc3/arch/ia64/mm/hugetlbpage.c
index 76069c1..68232db 100644
--- v3.11-rc3.orig/arch/ia64/mm/hugetlbpage.c
+++ v3.11-rc3/arch/ia64/mm/hugetlbpage.c
@@ -114,6 +114,11 @@ int pud_huge(pud_t pud)
return 0;
 }
 
+int pmd_huge_support(void)
+{
+   return 0;
+}
+
 struct page *
 follow_huge_pmd(struct mm_struct *mm, unsigned long address, pmd_t *pmd, int 
write)
 {
diff --git v3.11-rc3.orig/arch/metag/mm/hugetlbpage.c 
v3.11-rc3/arch/metag/mm/hugetlbpage.c
index 3c52fa6..0424315 100644
--- v3.11-rc3.orig/arch/metag/mm/hugetlbpage.c
+++ v3.11-rc3/arch/metag/mm/hugetlbpage.c
@@ -110,6 +110,11 @@ int pud_huge(pud_t pud)
return 0;
 }
 
+int pmd_huge_support(void)
+{
+   return 1;
+}
+
 struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
 pmd_t *pmd, int write)
 {
diff --git v3.11-rc3.orig/arch/mips/mm/hugetlbpage.c 
v3.11-rc3/arch/mips/mm/hugetlbpage.c
index a7fee0d..01fda44 100644
--- v3.11-rc3.orig/arch/mips/mm/hugetlbpage.c
+++ v3.11-rc3/arch/mips/mm/hugetlbpage.c
@@ -85,6 +85,11 @@ int pud_huge(pud_t pud)
return (pud_val(pud) & _PAGE_HUGE) != 0;
 }
 
+int pmd_huge_support(void)
+{
+   return 1;
+}
+
 struct page *
 follow_huge_pmd(struct mm_struct *mm, unsigned long address,
pmd_t *pmd, int write)
diff --git v3.11-rc3.orig/arch/powerpc/mm/hugetlbpage.c 
v3.11-rc3/arch/powerpc/mm/hugetlbpage.c
index 834ca8e..d67db4b 100644
--- v3.11-rc3.orig/arch/powerpc/mm/hugetlbpage.c
+++ v3.11-rc3/arch/powerpc/mm/hugetlbpage.c
@@ -86,6 +86,11 @@ int pgd_huge(pgd_t pgd)
 */
return ((pgd_val(pgd) & 0x3) != 0x0);
 }
+
+int pmd_huge_support(void)
+{
+   return 1;
+}
 #else
 int pmd_huge(pmd_t pmd)
 {
@@ -101,6 +106,11 @@ int pgd_huge(pgd_t pgd)
 {
return 0;
 }
+
+int pmd_huge_support(void)
+{
+   return 0;
+}
 #endif
 
 pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
diff --git v3.11-rc3.orig/arch/s390/mm/hugetlbpage.c 
v3.11-rc3/arch/s390/mm/hugetlbpage.c
index 121089d..951ee25 100644
--- v3.11-rc3.orig/arch/s390/mm/hugetlbpage.c
+++ v3.11-rc3/arch/s390/mm/hugetlbpage.c
@@ -117,6 +117,11 @@ int pud_huge(pud_t pud)
return 0;
 }
 
+int pmd_huge_support(void)
+{
+   return 1;
+}
+
 struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
 pmd_t *pmdp, int write)
 {
diff --git v3.11-rc3.orig/arch/sh/mm/hugetlbpage.c 
v3.11-rc3/arch/sh/mm/hugetlbpage.c
index d776234..0d676a4 100644
--- v3.11-rc3.orig/arch/sh/mm/hugetlbpage.c
+++ v3.11-rc3/arch/sh/mm/hugetlbpage.c
@@ -83,6 +83,11 @@ int pud_huge(pud_t pud)
return 0;
 }
 
+int pmd_huge_support(void)
+{
+   return 0;
+}
+
 

[PATCH 3/9] migrate: add hugepage migration code to migrate_pages()

2013-08-08 Thread Naoya Horiguchi
This patch extends check_range() to handle vma with VM_HUGETLB set.
We will be able to migrate hugepage with migrate_pages(2) after
applying the enablement patch which comes later in this series.

Note that for larger hugepages (covered by pud entries, 1GB for
x86_64 for example), we simply skip it now.

Note that using pmd_huge/pud_huge assumes that hugepages are pointed to
by pmd/pud. This is not true in some architectures implementing hugepage
with other mechanisms like ia64, but it's OK because pmd_huge/pud_huge
simply return 0 in such arch and page walker simply ignores such hugepages.

ChangeLog v4:
 - refactored check_hugetlb_pmd_range for better readability

ChangeLog v3:
 - revert introducing migrate_movable_pages
 - use isolate_huge_page

ChangeLog v2:
 - remove unnecessary extern
 - fix page table lock in check_hugetlb_pmd_range
 - updated description and renamed patch title

Signed-off-by: Naoya Horiguchi 
Acked-by: Andi Kleen 
Reviewed-by: Wanpeng Li 
Acked-by: Hillf Danton 
---
 mm/mempolicy.c | 42 +-
 1 file changed, 37 insertions(+), 5 deletions(-)

diff --git v3.11-rc3.orig/mm/mempolicy.c v3.11-rc3/mm/mempolicy.c
index 7431001..d96afc1 100644
--- v3.11-rc3.orig/mm/mempolicy.c
+++ v3.11-rc3/mm/mempolicy.c
@@ -512,6 +512,30 @@ static int check_pte_range(struct vm_area_struct *vma, 
pmd_t *pmd,
return addr != end;
 }
 
+static void check_hugetlb_pmd_range(struct vm_area_struct *vma, pmd_t *pmd,
+   const nodemask_t *nodes, unsigned long flags,
+   void *private)
+{
+#ifdef CONFIG_HUGETLB_PAGE
+   int nid;
+   struct page *page;
+
+   spin_lock(>vm_mm->page_table_lock);
+   page = pte_page(huge_ptep_get((pte_t *)pmd));
+   nid = page_to_nid(page);
+   if (node_isset(nid, *nodes) == !!(flags & MPOL_MF_INVERT))
+   goto unlock;
+   /* With MPOL_MF_MOVE, we migrate only unshared hugepage. */
+   if (flags & (MPOL_MF_MOVE_ALL) ||
+   (flags & MPOL_MF_MOVE && page_mapcount(page) == 1))
+   isolate_huge_page(page, private);
+unlock:
+   spin_unlock(>vm_mm->page_table_lock);
+#else
+   BUG();
+#endif
+}
+
 static inline int check_pmd_range(struct vm_area_struct *vma, pud_t *pud,
unsigned long addr, unsigned long end,
const nodemask_t *nodes, unsigned long flags,
@@ -523,6 +547,11 @@ static inline int check_pmd_range(struct vm_area_struct 
*vma, pud_t *pud,
pmd = pmd_offset(pud, addr);
do {
next = pmd_addr_end(addr, end);
+   if (pmd_huge(*pmd) && is_vm_hugetlb_page(vma)) {
+   check_hugetlb_pmd_range(vma, pmd, nodes,
+   flags, private);
+   continue;
+   }
split_huge_page_pmd(vma, addr, pmd);
if (pmd_none_or_trans_huge_or_clear_bad(pmd))
continue;
@@ -544,6 +573,8 @@ static inline int check_pud_range(struct vm_area_struct 
*vma, pgd_t *pgd,
pud = pud_offset(pgd, addr);
do {
next = pud_addr_end(addr, end);
+   if (pud_huge(*pud) && is_vm_hugetlb_page(vma))
+   continue;
if (pud_none_or_clear_bad(pud))
continue;
if (check_pmd_range(vma, pud, addr, next, nodes,
@@ -635,9 +666,6 @@ check_range(struct mm_struct *mm, unsigned long start, 
unsigned long end,
return ERR_PTR(-EFAULT);
}
 
-   if (is_vm_hugetlb_page(vma))
-   goto next;
-
if (flags & MPOL_MF_LAZY) {
change_prot_numa(vma, start, endvma);
goto next;
@@ -986,7 +1014,11 @@ static void migrate_page_add(struct page *page, struct 
list_head *pagelist,
 
 static struct page *new_node_page(struct page *page, unsigned long node, int 
**x)
 {
-   return alloc_pages_exact_node(node, GFP_HIGHUSER_MOVABLE, 0);
+   if (PageHuge(page))
+   return alloc_huge_page_node(page_hstate(compound_head(page)),
+   node);
+   else
+   return alloc_pages_exact_node(node, GFP_HIGHUSER_MOVABLE, 0);
 }
 
 /*
@@ -1016,7 +1048,7 @@ static int migrate_to_node(struct mm_struct *mm, int 
source, int dest,
err = migrate_pages(, new_node_page, dest,
MIGRATE_SYNC, MR_SYSCALL);
if (err)
-   putback_lru_pages();
+   putback_movable_pages();
}
 
return err;
-- 
1.8.3.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 6/9] migrate: remove VM_HUGETLB from vma flag check in vma_migratable()

2013-08-08 Thread Naoya Horiguchi
This patch enables hugepage migration from migrate_pages(2),
move_pages(2), and mbind(2).

Signed-off-by: Naoya Horiguchi 
Acked-by: Hillf Danton 
Acked-by: Andi Kleen 
Reviewed-by: Wanpeng Li 
---
 include/linux/mempolicy.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git v3.11-rc3.orig/include/linux/mempolicy.h 
v3.11-rc3/include/linux/mempolicy.h
index 0d7df39..2e475b5 100644
--- v3.11-rc3.orig/include/linux/mempolicy.h
+++ v3.11-rc3/include/linux/mempolicy.h
@@ -173,7 +173,7 @@ extern int mpol_to_str(char *buffer, int maxlen, struct 
mempolicy *pol);
 /* Check if a vma is migratable */
 static inline int vma_migratable(struct vm_area_struct *vma)
 {
-   if (vma->vm_flags & (VM_IO | VM_HUGETLB | VM_PFNMAP))
+   if (vma->vm_flags & (VM_IO | VM_PFNMAP))
return 0;
/*
 * Migration allocates pages in the highest zone. If we cannot
-- 
1.8.3.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 2/9] soft-offline: use migrate_pages() instead of migrate_huge_page()

2013-08-08 Thread Naoya Horiguchi
Currently migrate_huge_page() takes a pointer to a hugepage to be
migrated as an argument, instead of taking a pointer to the list of
hugepages to be migrated. This behavior was introduced in commit
189ebff28 ("hugetlb: simplify migrate_huge_page()"), and was OK
because until now hugepage migration is enabled only for soft-offlining
which migrates only one hugepage in a single call.

But the situation will change in the later patches in this series
which enable other users of page migration to support hugepage migration.
They can kick migration for both of normal pages and hugepages
in a single call, so we need to go back to original implementation
which uses linked lists to collect the hugepages to be migrated.

With this patch, soft_offline_huge_page() switches to use migrate_pages(),
and migrate_huge_page() is not used any more. So let's remove it.

ChangeLog v3:
 - Merged with another cleanup patch (4/10 in previous version)

Signed-off-by: Naoya Horiguchi 
Acked-by: Andi Kleen 
Reviewed-by: Wanpeng Li 
Acked-by: Hillf Danton 
---
 include/linux/migrate.h |  5 -
 mm/memory-failure.c | 15 ---
 mm/migrate.c| 28 ++--
 3 files changed, 14 insertions(+), 34 deletions(-)

diff --git v3.11-rc3.orig/include/linux/migrate.h 
v3.11-rc3/include/linux/migrate.h
index a405d3dc..6fe5214 100644
--- v3.11-rc3.orig/include/linux/migrate.h
+++ v3.11-rc3/include/linux/migrate.h
@@ -41,8 +41,6 @@ extern int migrate_page(struct address_space *,
struct page *, struct page *, enum migrate_mode);
 extern int migrate_pages(struct list_head *l, new_page_t x,
unsigned long private, enum migrate_mode mode, int reason);
-extern int migrate_huge_page(struct page *, new_page_t x,
-   unsigned long private, enum migrate_mode mode);
 
 extern int fail_migrate_page(struct address_space *,
struct page *, struct page *);
@@ -62,9 +60,6 @@ static inline void putback_movable_pages(struct list_head *l) 
{}
 static inline int migrate_pages(struct list_head *l, new_page_t x,
unsigned long private, enum migrate_mode mode, int reason)
{ return -ENOSYS; }
-static inline int migrate_huge_page(struct page *page, new_page_t x,
-   unsigned long private, enum migrate_mode mode)
-   { return -ENOSYS; }
 
 static inline int migrate_prep(void) { return -ENOSYS; }
 static inline int migrate_prep_local(void) { return -ENOSYS; }
diff --git v3.11-rc3.orig/mm/memory-failure.c v3.11-rc3/mm/memory-failure.c
index 2c13aa7..af6f61c 100644
--- v3.11-rc3.orig/mm/memory-failure.c
+++ v3.11-rc3/mm/memory-failure.c
@@ -1467,6 +1467,7 @@ static int soft_offline_huge_page(struct page *page, int 
flags)
int ret;
unsigned long pfn = page_to_pfn(page);
struct page *hpage = compound_head(page);
+   LIST_HEAD(pagelist);
 
/*
 * This double-check of PageHWPoison is to avoid the race with
@@ -1482,12 +1483,20 @@ static int soft_offline_huge_page(struct page *page, 
int flags)
unlock_page(hpage);
 
/* Keep page count to indicate a given hugepage is isolated. */
-   ret = migrate_huge_page(hpage, new_page, MPOL_MF_MOVE_ALL,
-   MIGRATE_SYNC);
-   put_page(hpage);
+   list_move(>lru, );
+   ret = migrate_pages(, new_page, MPOL_MF_MOVE_ALL,
+   MIGRATE_SYNC, MR_MEMORY_FAILURE);
if (ret) {
pr_info("soft offline: %#lx: migration failed %d, type %lx\n",
pfn, ret, page->flags);
+   /*
+* We know that soft_offline_huge_page() tries to migrate
+* only one hugepage pointed to by hpage, so we need not
+* run through the pagelist here.
+*/
+   putback_active_hugepage(hpage);
+   if (ret > 0)
+   ret = -EIO;
} else {
set_page_hwpoison_huge_page(hpage);
dequeue_hwpoisoned_huge_page(hpage);
diff --git v3.11-rc3.orig/mm/migrate.c v3.11-rc3/mm/migrate.c
index b44a067..3ec47d3 100644
--- v3.11-rc3.orig/mm/migrate.c
+++ v3.11-rc3/mm/migrate.c
@@ -979,6 +979,8 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
 
unlock_page(hpage);
 out:
+   if (rc != -EAGAIN)
+   putback_active_hugepage(hpage);
put_page(new_hpage);
if (result) {
if (rc)
@@ -1066,32 +1068,6 @@ int migrate_pages(struct list_head *from, new_page_t 
get_new_page,
return rc;
 }
 
-int migrate_huge_page(struct page *hpage, new_page_t get_new_page,
- unsigned long private, enum migrate_mode mode)
-{
-   int pass, rc;
-
-   for (pass = 0; pass < 10; pass++) {
-   rc = unmap_and_move_huge_page(get_new_page, private,
-   hpage, pass > 2, mode);
-   switch (rc) {
-  

[PATCH 7/9] memory-hotplug: enable memory hotplug to handle hugepage

2013-08-08 Thread Naoya Horiguchi
Until now we can't offline memory blocks which contain hugepages because
a hugepage is considered as an unmovable page. But now with this patch
series, a hugepage has become movable, so by using hugepage migration we
can offline such memory blocks.

What's different from other users of hugepage migration is that we need
to decompose all the hugepages inside the target memory block into free
buddy pages after hugepage migration, because otherwise free hugepages
remaining in the memory block intervene the memory offlining.
For this reason we introduce new functions dissolve_free_huge_page() and
dissolve_free_huge_pages().

Other than that, what this patch does is straightforwardly to add hugepage
migration code, that is, adding hugepage code to the functions which scan
over pfn and collect hugepages to be migrated, and adding a hugepage
allocation function to alloc_migrate_target().

As for larger hugepages (1GB for x86_64), it's not easy to do hotremove
over them because it's larger than memory block. So we now simply leave
it to fail as it is.

ChangeLog v4:
 - add comment on dequeue_huge_page_node
 - alloc_migrate_target allocates destination hugepage from the next node
   of source node

ChangeLog v3:
 - revert introducing migrate_movable_pages (the function was opened)
 - add migratetype check in dequeue_huge_page_node to close the race
   between scan and allocation
 - make is_hugepage_movable use refcount to find active hugepages
   instead of running through hugepage_activelist
 - rename is_hugepage_movable to is_hugepage_active
 - add alignment check in dissolve_free_huge_pages
 - use round_up in calculating next scanning pfn
 - use isolate_huge_page

ChangeLog v2:
 - changed return value type of is_hugepage_movable() to bool
 - is_hugepage_movable() uses list_for_each_entry() instead of *_safe()
 - moved if(PageHuge) block before get_page_unless_zero() in do_migrate_range()
 - do_migrate_range() returns -EBUSY for hugepages larger than memory block
 - dissolve_free_huge_pages() calculates scan step and sets it to minimum
   hugepage size

Signed-off-by: Naoya Horiguchi 
Acked-by: Andi Kleen 
---
 include/linux/hugetlb.h |  6 +
 mm/hugetlb.c| 71 +++--
 mm/memory_hotplug.c | 42 -
 mm/page_alloc.c | 12 +
 mm/page_isolation.c | 14 ++
 5 files changed, 136 insertions(+), 9 deletions(-)

diff --git v3.11-rc3.orig/include/linux/hugetlb.h 
v3.11-rc3/include/linux/hugetlb.h
index d1db007..2e02c4e 100644
--- v3.11-rc3.orig/include/linux/hugetlb.h
+++ v3.11-rc3/include/linux/hugetlb.h
@@ -68,6 +68,7 @@ void hugetlb_unreserve_pages(struct inode *inode, long 
offset, long freed);
 int dequeue_hwpoisoned_huge_page(struct page *page);
 bool isolate_huge_page(struct page *page, struct list_head *list);
 void putback_active_hugepage(struct page *page);
+bool is_hugepage_active(struct page *page);
 void copy_huge_page(struct page *dst, struct page *src);
 
 #ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE
@@ -138,6 +139,7 @@ static inline int dequeue_hwpoisoned_huge_page(struct page 
*page)
 
 #define isolate_huge_page(p, l) false
 #define putback_active_hugepage(p) do {} while (0)
+#define is_hugepage_active(x)  false
 static inline void copy_huge_page(struct page *dst, struct page *src)
 {
 }
@@ -377,6 +379,9 @@ static inline pgoff_t basepage_index(struct page *page)
return __basepage_index(page);
 }
 
+extern void dissolve_free_huge_pages(unsigned long start_pfn,
+unsigned long end_pfn);
+
 #else  /* CONFIG_HUGETLB_PAGE */
 struct hstate {};
 #define alloc_huge_page_node(h, nid) NULL
@@ -403,6 +408,7 @@ static inline pgoff_t basepage_index(struct page *page)
 {
return page->index;
 }
+#define dissolve_free_huge_pages(s, e) do {} while (0)
 #endif /* CONFIG_HUGETLB_PAGE */
 
 #endif /* _LINUX_HUGETLB_H */
diff --git v3.11-rc3.orig/mm/hugetlb.c v3.11-rc3/mm/hugetlb.c
index ee764b0..3121915 100644
--- v3.11-rc3.orig/mm/hugetlb.c
+++ v3.11-rc3/mm/hugetlb.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -518,9 +519,15 @@ static struct page *dequeue_huge_page_node(struct hstate 
*h, int nid)
 {
struct page *page;
 
-   if (list_empty(>hugepage_freelists[nid]))
+   list_for_each_entry(page, >hugepage_freelists[nid], lru)
+   if (!is_migrate_isolate_page(page))
+   break;
+   /*
+* if 'non-isolated free hugepage' not found on the list,
+* the allocation fails.
+*/
+   if (>hugepage_freelists[nid] == >lru)
return NULL;
-   page = list_entry(h->hugepage_freelists[nid].next, struct page, lru);
list_move(>lru, >hugepage_activelist);
set_page_refcounted(page);
h->free_huge_pages--;
@@ -861,6 +868,44 @@ static int free_pool_huge_page(struct hstate *h, 
nodemask_t *nodes_allowed,
return ret;
 

[PATCH 4/9] migrate: add hugepage migration code to move_pages()

2013-08-08 Thread Naoya Horiguchi
This patch extends move_pages() to handle vma with VM_HUGETLB set.
We will be able to migrate hugepage with move_pages(2) after
applying the enablement patch which comes later in this series.

We avoid getting refcount on tail pages of hugepage, because unlike thp,
hugepage is not split and we need not care about races with splitting.

And migration of larger (1GB for x86_64) hugepage are not enabled.

ChangeLog v4:
 - use get_page instead of get_page_foll
 - add comment in follow_page_mask

ChangeLog v3:
 - revert introducing migrate_movable_pages
 - follow_page_mask(FOLL_GET) returns NULL for tail pages
 - use isolate_huge_page

ChangeLog v2:
 - updated description and renamed patch title

Signed-off-by: Naoya Horiguchi 
Acked-by: Andi Kleen 
Reviewed-by: Wanpeng Li 
---
 mm/memory.c  | 17 +++--
 mm/migrate.c | 13 +++--
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git v3.11-rc3.orig/mm/memory.c v3.11-rc3/mm/memory.c
index 1ce2e2a..7ec1252 100644
--- v3.11-rc3.orig/mm/memory.c
+++ v3.11-rc3/mm/memory.c
@@ -1496,7 +1496,8 @@ struct page *follow_page_mask(struct vm_area_struct *vma,
if (pud_none(*pud))
goto no_page_table;
if (pud_huge(*pud) && vma->vm_flags & VM_HUGETLB) {
-   BUG_ON(flags & FOLL_GET);
+   if (flags & FOLL_GET)
+   goto out;
page = follow_huge_pud(mm, address, pud, flags & FOLL_WRITE);
goto out;
}
@@ -1507,8 +1508,20 @@ struct page *follow_page_mask(struct vm_area_struct *vma,
if (pmd_none(*pmd))
goto no_page_table;
if (pmd_huge(*pmd) && vma->vm_flags & VM_HUGETLB) {
-   BUG_ON(flags & FOLL_GET);
page = follow_huge_pmd(mm, address, pmd, flags & FOLL_WRITE);
+   if (flags & FOLL_GET) {
+   /*
+* Refcount on tail pages are not well-defined and
+* shouldn't be taken. The caller should handle a NULL
+* return when trying to follow tail pages.
+*/
+   if (PageHead(page))
+   get_page(page);
+   else {
+   page = NULL;
+   goto out;
+   }
+   }
goto out;
}
if ((flags & FOLL_NUMA) && pmd_numa(*pmd))
diff --git v3.11-rc3.orig/mm/migrate.c v3.11-rc3/mm/migrate.c
index 3ec47d3..d313737 100644
--- v3.11-rc3.orig/mm/migrate.c
+++ v3.11-rc3/mm/migrate.c
@@ -1092,7 +1092,11 @@ static struct page *new_page_node(struct page *p, 
unsigned long private,
 
*result = >status;
 
-   return alloc_pages_exact_node(pm->node,
+   if (PageHuge(p))
+   return alloc_huge_page_node(page_hstate(compound_head(p)),
+   pm->node);
+   else
+   return alloc_pages_exact_node(pm->node,
GFP_HIGHUSER_MOVABLE | GFP_THISNODE, 0);
 }
 
@@ -1152,6 +1156,11 @@ static int do_move_page_to_node_array(struct mm_struct 
*mm,
!migrate_all)
goto put_and_set;
 
+   if (PageHuge(page)) {
+   isolate_huge_page(page, );
+   goto put_and_set;
+   }
+
err = isolate_lru_page(page);
if (!err) {
list_add_tail(>lru, );
@@ -1174,7 +1183,7 @@ static int do_move_page_to_node_array(struct mm_struct 
*mm,
err = migrate_pages(, new_page_node,
(unsigned long)pm, MIGRATE_SYNC, MR_SYSCALL);
if (err)
-   putback_lru_pages();
+   putback_movable_pages();
}
 
up_read(>mmap_sem);
-- 
1.8.3.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 1/9] migrate: make core migration code aware of hugepage

2013-08-08 Thread Naoya Horiguchi
Before enabling each user of page migration to support hugepage,
this patch enables the list of pages for migration to link not only
LRU pages, but also hugepages. As a result, putback_movable_pages()
and migrate_pages() can handle both of LRU pages and hugepages.

ChangeLog v5:
 - remove putback_active_hugepages

ChangeLog v4:
 - make some macros return 'do {} while(0)'
 - use more readable variable name

ChangeLog v3:
 - revert introducing migrate_movable_pages
 - add isolate_huge_page

ChangeLog v2:
 - move code removing VM_HUGETLB from vma_migratable check into a
   separate patch
 - hold hugetlb_lock in putback_active_hugepage
 - update comment near the definition of hugetlb_lock

Signed-off-by: Naoya Horiguchi 
Acked-by: Andi Kleen 
Reviewed-by: Wanpeng Li 
Acked-by: Hillf Danton 
---
 include/linux/hugetlb.h |  4 
 mm/hugetlb.c| 23 ++-
 mm/migrate.c| 10 +-
 3 files changed, 35 insertions(+), 2 deletions(-)

diff --git v3.11-rc3.orig/include/linux/hugetlb.h 
v3.11-rc3/include/linux/hugetlb.h
index c2b1801..bc8d837 100644
--- v3.11-rc3.orig/include/linux/hugetlb.h
+++ v3.11-rc3/include/linux/hugetlb.h
@@ -66,6 +66,8 @@ int hugetlb_reserve_pages(struct inode *inode, long from, 
long to,
vm_flags_t vm_flags);
 void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed);
 int dequeue_hwpoisoned_huge_page(struct page *page);
+bool isolate_huge_page(struct page *page, struct list_head *list);
+void putback_active_hugepage(struct page *page);
 void copy_huge_page(struct page *dst, struct page *src);
 
 #ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE
@@ -134,6 +136,8 @@ static inline int dequeue_hwpoisoned_huge_page(struct page 
*page)
return 0;
 }
 
+#define isolate_huge_page(p, l) false
+#define putback_active_hugepage(p) do {} while (0)
 static inline void copy_huge_page(struct page *dst, struct page *src)
 {
 }
diff --git v3.11-rc3.orig/mm/hugetlb.c v3.11-rc3/mm/hugetlb.c
index 83aff0a..649771c 100644
--- v3.11-rc3.orig/mm/hugetlb.c
+++ v3.11-rc3/mm/hugetlb.c
@@ -48,7 +48,8 @@ static unsigned long __initdata default_hstate_max_huge_pages;
 static unsigned long __initdata default_hstate_size;
 
 /*
- * Protects updates to hugepage_freelists, nr_huge_pages, and free_huge_pages
+ * Protects updates to hugepage_freelists, hugepage_activelist, nr_huge_pages,
+ * free_huge_pages, and surplus_huge_pages.
  */
 DEFINE_SPINLOCK(hugetlb_lock);
 
@@ -3431,3 +3432,23 @@ int dequeue_hwpoisoned_huge_page(struct page *hpage)
return ret;
 }
 #endif
+
+bool isolate_huge_page(struct page *page, struct list_head *list)
+{
+   VM_BUG_ON(!PageHead(page));
+   if (!get_page_unless_zero(page))
+   return false;
+   spin_lock(_lock);
+   list_move_tail(>lru, list);
+   spin_unlock(_lock);
+   return true;
+}
+
+void putback_active_hugepage(struct page *page)
+{
+   VM_BUG_ON(!PageHead(page));
+   spin_lock(_lock);
+   list_move_tail(>lru, &(page_hstate(page))->hugepage_activelist);
+   spin_unlock(_lock);
+   put_page(page);
+}
diff --git v3.11-rc3.orig/mm/migrate.c v3.11-rc3/mm/migrate.c
index 6f0c244..b44a067 100644
--- v3.11-rc3.orig/mm/migrate.c
+++ v3.11-rc3/mm/migrate.c
@@ -100,6 +100,10 @@ void putback_movable_pages(struct list_head *l)
struct page *page2;
 
list_for_each_entry_safe(page, page2, l, lru) {
+   if (unlikely(PageHuge(page))) {
+   putback_active_hugepage(page);
+   continue;
+   }
list_del(>lru);
dec_zone_page_state(page, NR_ISOLATED_ANON +
page_is_file_cache(page));
@@ -1025,7 +1029,11 @@ int migrate_pages(struct list_head *from, new_page_t 
get_new_page,
list_for_each_entry_safe(page, page2, from, lru) {
cond_resched();
 
-   rc = unmap_and_move(get_new_page, private,
+   if (PageHuge(page))
+   rc = unmap_and_move_huge_page(get_new_page,
+   private, page, pass > 2, mode);
+   else
+   rc = unmap_and_move(get_new_page, private,
page, pass > 2, mode);
 
switch(rc) {
-- 
1.8.3.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 9/9] prepare to remove /proc/sys/vm/hugepages_treat_as_movable

2013-08-08 Thread Naoya Horiguchi
Now we have extended hugepage migration and it's opened to many users
of page migration, which is a good reason to consider hugepage as movable.
So we can go to the direction to remove this parameter. In order to
allow userspace to prepare for the removal, let's leave this sysctl handler
as noop for a while.

Note that hugepage migration is available only for the architectures
which implement hugepage on a pmd basis. On the other architectures,
allocating hugepages from MOVABLE is not a good idea because it can
break memory hotremove (which expects that all pages of ZONE_MOVABLE are
movable.) So we choose GFP flags in accordance with mobility of hugepage.

ChangeLog v5:
 - choose GFP flags in accordance with mobility of hugepage

ChangeLog v3:
 - use WARN_ON_ONCE

ChangeLog v2:
 - shift to noop function instead of completely removing the parameter
 - rename patch title

Signed-off-by: Naoya Horiguchi 
Acked-by: Andi Kleen 
Reviewed-by: Wanpeng Li 
---
 Documentation/sysctl/vm.txt | 13 ++---
 mm/hugetlb.c| 26 +++---
 2 files changed, 17 insertions(+), 22 deletions(-)

diff --git v3.11-rc3.orig/Documentation/sysctl/vm.txt 
v3.11-rc3/Documentation/sysctl/vm.txt
index 36ecc26..6e211a1 100644
--- v3.11-rc3.orig/Documentation/sysctl/vm.txt
+++ v3.11-rc3/Documentation/sysctl/vm.txt
@@ -200,17 +200,8 @@ fragmentation index is <= extfrag_threshold. The default 
value is 500.
 
 hugepages_treat_as_movable
 
-This parameter is only useful when kernelcore= is specified at boot time to
-create ZONE_MOVABLE for pages that may be reclaimed or migrated. Huge pages
-are not movable so are not normally allocated from ZONE_MOVABLE. A non-zero
-value written to hugepages_treat_as_movable allows huge pages to be allocated
-from ZONE_MOVABLE.
-
-Once enabled, the ZONE_MOVABLE is treated as an area of memory the huge
-pages pool can easily grow or shrink within. Assuming that applications are
-not running that mlock() a lot of memory, it is likely the huge pages pool
-can grow to the size of ZONE_MOVABLE by repeatedly entering the desired value
-into nr_hugepages and triggering page reclaim.
+This parameter is obsolete and planned to be removed. The value has no effect
+on kernel's behavior.
 
 ==
 
diff --git v3.11-rc3.orig/mm/hugetlb.c v3.11-rc3/mm/hugetlb.c
index 3121915..b73 100644
--- v3.11-rc3.orig/mm/hugetlb.c
+++ v3.11-rc3/mm/hugetlb.c
@@ -34,7 +34,6 @@
 #include "internal.h"
 
 const unsigned long hugetlb_zero = 0, hugetlb_infinity = ~0UL;
-static gfp_t htlb_alloc_mask = GFP_HIGHUSER;
 unsigned long hugepages_treat_as_movable;
 
 int hugetlb_max_hstate __read_mostly;
@@ -535,6 +534,15 @@ static struct page *dequeue_huge_page_node(struct hstate 
*h, int nid)
return page;
 }
 
+/* Movability of hugepages depends on migration support. */
+static inline int htlb_alloc_mask(struct hstate *h)
+{
+   if (hugepage_migration_support(h))
+   return GFP_HIGHUSER_MOVABLE;
+   else
+   return GFP_HIGHUSER;
+}
+
 static struct page *dequeue_huge_page_vma(struct hstate *h,
struct vm_area_struct *vma,
unsigned long address, int avoid_reserve)
@@ -550,7 +558,7 @@ static struct page *dequeue_huge_page_vma(struct hstate *h,
 retry_cpuset:
cpuset_mems_cookie = get_mems_allowed();
zonelist = huge_zonelist(vma, address,
-   htlb_alloc_mask, , );
+   htlb_alloc_mask(h), , );
/*
 * A child process with MAP_PRIVATE mappings created by their parent
 * have no page reserves. This check ensures that reservations are
@@ -566,7 +574,7 @@ static struct page *dequeue_huge_page_vma(struct hstate *h,
 
for_each_zone_zonelist_nodemask(zone, z, zonelist,
MAX_NR_ZONES - 1, nodemask) {
-   if (cpuset_zone_allowed_softwall(zone, htlb_alloc_mask)) {
+   if (cpuset_zone_allowed_softwall(zone, htlb_alloc_mask(h))) {
page = dequeue_huge_page_node(h, zone_to_nid(zone));
if (page) {
if (!avoid_reserve)
@@ -723,7 +731,7 @@ static struct page *alloc_fresh_huge_page_node(struct 
hstate *h, int nid)
return NULL;
 
page = alloc_pages_exact_node(nid,
-   htlb_alloc_mask|__GFP_COMP|__GFP_THISNODE|
+   htlb_alloc_mask(h)|__GFP_COMP|__GFP_THISNODE|
__GFP_REPEAT|__GFP_NOWARN,
huge_page_order(h));
if (page) {
@@ -948,12 +956,12 @@ static struct page *alloc_buddy_huge_page(struct hstate 
*h, int nid)
spin_unlock(_lock);
 
if (nid == NUMA_NO_NODE)
-   page = alloc_pages(htlb_alloc_mask|__GFP_COMP|
+   page = 

[PATCH v5 0/9] extend hugepage migration

2013-08-08 Thread Naoya Horiguchi
Here is the 5th version of hugepage migration patchset.
Changes in this version are as follows:
 - removed putback_active_hugepages() as a cleanup (1/9)
 - added code to check movability of a given hugepage (8/9)
 - set GFP MOVABLE flag depending on the movability of hugepage (9/9).

I feel that 8/9 and 9/9 contain some new things, so need reviews on them.

TODOs: (likely to be done after this work)
 - split page table lock for pmd/pud based hugepage (maybe applicable to thp)
 - improve alloc_migrate_target (especially in node choice)
 - using page walker in check_range

Thanks,
Naoya Horiguchi
---
GitHub:
  git://github.com/Naoya-Horiguchi/linux.git extend_hugepage_migration.v5

Test code:
  git://github.com/Naoya-Horiguchi/test_hugepage_migration_extension.git

Naoya Horiguchi (9):
  migrate: make core migration code aware of hugepage
  soft-offline: use migrate_pages() instead of migrate_huge_page()
  migrate: add hugepage migration code to migrate_pages()
  migrate: add hugepage migration code to move_pages()
  mbind: add hugepage migration code to mbind()
  migrate: remove VM_HUGETLB from vma flag check in vma_migratable()
  memory-hotplug: enable memory hotplug to handle hugepage
  migrate: check movability of hugepage in unmap_and_move_huge_page()
  prepare to remove /proc/sys/vm/hugepages_treat_as_movable

 Documentation/sysctl/vm.txt   |  13 +---
 arch/arm/mm/hugetlbpage.c |   5 ++
 arch/arm64/mm/hugetlbpage.c   |   5 ++
 arch/ia64/mm/hugetlbpage.c|   5 ++
 arch/metag/mm/hugetlbpage.c   |   5 ++
 arch/mips/mm/hugetlbpage.c|   5 ++
 arch/powerpc/mm/hugetlbpage.c |  10 
 arch/s390/mm/hugetlbpage.c|   5 ++
 arch/sh/mm/hugetlbpage.c  |   5 ++
 arch/sparc/mm/hugetlbpage.c   |   5 ++
 arch/tile/mm/hugetlbpage.c|   5 ++
 arch/x86/mm/hugetlbpage.c |   8 +++
 include/linux/hugetlb.h   |  25 
 include/linux/mempolicy.h |   2 +-
 include/linux/migrate.h   |   5 --
 mm/hugetlb.c  | 134 +-
 mm/memory-failure.c   |  15 -
 mm/memory.c   |  17 +-
 mm/memory_hotplug.c   |  42 ++---
 mm/mempolicy.c|  46 +--
 mm/migrate.c  |  61 ++-
 mm/page_alloc.c   |  12 
 mm/page_isolation.c   |  14 +
 23 files changed, 371 insertions(+), 78 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 1/1] pagemap: fix buffer overflow in add_page_map()

2013-08-08 Thread yonghua zheng
Hi,

Recently we met quite a lot of random kernel panic issues after enable
CONFIG_PROC_PAGE_MONITOR in kernel, after debuggint sometime we found
this has something to do with following bug in pagemap:

In struc pagemapread:

struct pagemapread {
int pos, len;
pagemap_entry_t *buffer;
bool v2;
};

pos is number of PM_ENTRY_BYTES in buffer, but len is the size of buffer,
it is a mistake to compare pos and len in add_page_map() for checking
buffer is full or not, and this can lead to buffer overflow and random
kernel panic issue.

Correct len to be total number of PM_ENTRY_BYTES in buffer.

Signed-off-by: Yonghua Zheng 
---
 fs/proc/task_mmu.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index dbf61f6..cb98853 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -1116,8 +1116,8 @@ static ssize_t pagemap_read(struct file *file,
char __user *buf,
 goto out_task;

 pm.v2 = soft_dirty_cleared;
-pm.len = PM_ENTRY_BYTES * (PAGEMAP_WALK_SIZE >> PAGE_SHIFT);
-pm.buffer = kmalloc(pm.len, GFP_TEMPORARY);
+pm.len = (PAGEMAP_WALK_SIZE >> PAGE_SHIFT);
+pm.buffer = kmalloc(pm.len * PM_ENTRY_BYTES, GFP_TEMPORARY);
 ret = -ENOMEM;
 if (!pm.buffer)
 goto out_task;

-- 
1.7.9.5
--
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/


[git pull] drm fixes

2013-08-08 Thread Dave Airlie

Hi Linus

mostly radeon, more fixes for dynamic power management which is is off by 
default for this release anyways, but there are a large number of testers, 
so I'd like to keep merging the fixes,

otherwise, radeon UVD fixes affecting suspend/resume regressions, i915 
regression fixes, one for your mac mini, ast,mgag200,cirrus ttm fix and 
one regression fix in the core.

Dave.

The following changes since commit c095ba7224d8edc71dcef0d655911399a8bd4a3f:

  Linux 3.11-rc4 (2013-08-04 13:46:46 -0700)

are available in the git repository at:

  git://people.freedesktop.org/~airlied/linux drm-fixes

for you to fetch changes up to e42f5814212079aecd5826dba10588a896ac0862:

  Merge tag 'drm-intel-fixes-2013-08-08' of 
git://people.freedesktop.org/~danvet/drm-intel into drm-fixes (2013-08-09 
09:09:37 +1000)



Aaron Lu (1):
  drm/i915: avoid brightness overflow when doing scale

Alex Deucher (11):
  drm/radeon: properly handle pm on gpu reset
  drm/radeon: select audio dto based on encoder id for DCE3
  drm/radeon/dpm: adjust thermal protection requirements
  drm/radeon/dpm: fix spread spectrum setup (v2)
  drm/radeon/dpm: adjust power state properly for UVD on SI
  drm/radeon/dpm: disable sclk ss on rv6xx
  drm/radeon: fix audio dto calculation on DCE3+ (v3)
  drm/radeon: always program the MC on startup
  drm/radeon/cik: use a mutex to properly lock srbm instanced registers
  drm/radeon/dpm: require rlc for dpm
  drm/radeon: make missing smc ucode non-fatal

Christian König (5):
  drm/radeon: fix halting UVD
  drm/radeon: only save UVD bo when we have open handles
  drm/radeon: stop sending invalid UVD destroy msg
  drm/radeon: add more UVD CS checking
  drm/radeon: remove unnecessary unpin

Daniel Vetter (1):
  drm/i915: fix gen4 digital port hotplug definitions

Dave Airlie (3):
  drm/ast: invalidate page tables when pinning a BO
  Merge branch 'drm-fixes-3.11' of git://people.freedesktop.org/~agd5f/linux
  Merge tag 'drm-intel-fixes-2013-08-08' of 
git://people.freedesktop.org/~danvet/drm-intel into drm-fixes

Egbert Eich (1):
  drm/mgag200: Invalidate page tables when pinning a BO

Jani Nikula (1):
  drm/i915: do not disable backlight on vgaswitcheroo switch off

Michal Srb (1):
  drm/cirrus: Invalidate page tables when pinning a BO

Michel Dänzer (1):
  drm: Don't pass negative delta to ktime_sub_ns()

Paulo Zanoni (1):
  drm/i915: update last_vblank when disabling the power well

Ville Syrjälä (1):
  drm/i915: Don't call encoder's get_config unless encoder is active

 drivers/gpu/drm/ast/ast_ttm.c   |  1 +
 drivers/gpu/drm/cirrus/cirrus_ttm.c |  1 +
 drivers/gpu/drm/drm_irq.c   |  5 +-
 drivers/gpu/drm/i915/i915_reg.h | 12 +++--
 drivers/gpu/drm/i915/intel_display.c|  4 +-
 drivers/gpu/drm/i915/intel_panel.c  | 18 ++-
 drivers/gpu/drm/i915/intel_pm.c | 18 +++
 drivers/gpu/drm/mgag200/mgag200_ttm.c   |  1 +
 drivers/gpu/drm/radeon/btc_dpm.c| 17 +-
 drivers/gpu/drm/radeon/cik.c| 18 +--
 drivers/gpu/drm/radeon/cypress_dpm.c| 17 +-
 drivers/gpu/drm/radeon/evergreen.c  |  6 ++-
 drivers/gpu/drm/radeon/evergreen_hdmi.c | 26 -
 drivers/gpu/drm/radeon/evergreend.h |  3 ++
 drivers/gpu/drm/radeon/ni.c | 16 --
 drivers/gpu/drm/radeon/ni_dpm.c | 17 +-
 drivers/gpu/drm/radeon/r600.c   | 41 +++
 drivers/gpu/drm/radeon/r600_hdmi.c  | 37 +++--
 drivers/gpu/drm/radeon/r600d.h  |  3 ++
 drivers/gpu/drm/radeon/radeon.h |  4 +-
 drivers/gpu/drm/radeon/radeon_asic.h|  2 +-
 drivers/gpu/drm/radeon/radeon_device.c  |  3 ++
 drivers/gpu/drm/radeon/radeon_fence.c   |  2 +-
 drivers/gpu/drm/radeon/radeon_gart.c|  1 -
 drivers/gpu/drm/radeon/radeon_pm.c  |  9 +++-
 drivers/gpu/drm/radeon/radeon_uvd.c | 93 +
 drivers/gpu/drm/radeon/rv6xx_dpm.c  | 22 
 drivers/gpu/drm/radeon/rv770.c  |  7 ++-
 drivers/gpu/drm/radeon/rv770_dpm.c  | 33 ++--
 drivers/gpu/drm/radeon/rv770_dpm.h  |  1 +
 drivers/gpu/drm/radeon/si.c | 19 ---
 drivers/gpu/drm/radeon/si_dpm.c | 61 +++--
 32 files changed, 353 insertions(+), 165 deletions(-)

Re: [PATCH v6 0/5] clk: implement remuxing during set_rate

2013-08-08 Thread Mike Turquette
Quoting James Hogan (2013-07-29 04:24:57)
> This patchset adds support for automatic selection of the best parent
> for a clock mux, i.e. the one which can provide the closest clock rate
> to that requested. It can be disabled by a new CLK_SET_RATE_NO_REPARENT
> flag (which is set for all uses of clk_register_mux().
> 
> This works by way of adding a new op, determine_rate, similar to
> round_rate but with an extra parameter to allow the clock driver to
> optionally select a different parent clock. This is used in
> clk_calc_new_rates to decide whether to initiate a set_parent operation.

Hi James,

I'm performing some testing on this series now. If I don't spot any
regressions than I'll take it into clk-next. Thanks a lot for the rework
you've done.

I think that work on re-muxing is not yet complete. There are still
unresolved issues about picking "best parents", and likely some other
loose ends. We can fix those up later.

Regards,
Mike

> 
> Changes in v6:
> 
> * Rebased on v3.11-rc1.
> * Added changes to samsung/clk-exynos-audss.c, zynq/clkc.c.
> 
> Changes in v5:
> 
> * Rebased on latest clk-next ("clk: tegra: Use common of_clk_init
>   function")
> * Updated clock hardware characteristics table in documentation.
> 
> Changes in v4:
> 
> * rebased on clk-next ("clk: sun5i: Add compatibles for Allwinner A13").
> * replace __clk_set_parent_no_recalc with __clk_set_parent.
> * never pass NULL to determine_rate's best_parent_clk parameter, and
>   slight refactor of __clk_round_rate to use local copy of clk->parent.
> * a few new comments around use of clk::new_child.
> * new patch (patch 2) split out of patch 3 to avoid having to declare
>   static __clk_set_parent() at the top of clk.c, and to ease readability
>   of patch 3.
> 
> Changes in v3:
> 
> * rebased on v3.10-rc1.
> * remove double underscore prefix from clk_get_parent_by_index()
> * store new_parent_index in struct clk too (calculated from
>   clk_fetch_parent_index, and passed through __clk_set_parent_no_recalc
>   to __clk_set_parent).
> * allow determine_rate to satisfy recalc_rate check in __clk_init.
> * rename/invert CLK_SET_RATE_REMUX to CLK_SET_RATE_NO_REPARENT and move
>   to patch 3.
> * patch 3: add CLK_SET_RATE_NO_REPARENT flag to all callers of
>   clk_register_mux. If you don't mind your clocks being reparented in
>   response to set_rate please let me know and I'll drop the relevant
>   portion of the patch.
> 
> Changes in v2:
> 
> I've moved the mux determine_rate implementation into a core helper, but
> I haven't pushed it fully into the core, as I think it just wouldn't
> work correctly for more complex clocks, e.g. if you (theoretically) had
> a combined mux and divide, you'd want to intercept the determine_rate
> and ask for a larger rate from the parent clocks, then return the
> divided rate. This should be possible by wrapping the mux determine_rate
> helper.
> 
> Patch 1 still exports the __clk_get_parent_by_index as it seems like it
> might be a useful thing for clock implementations to have access to if
> they ever wanted to do something more fancy with changing clock parents.
> 
> I haven't made any attempt to implement the atomic set_parent+set_rate
> as I don't have hardware that could take proper advantage of it, but it
> shouldn't be too difficult for others to implement if they wanted since
> they're fairly close to one another (in clk_change_rate()).
> 
> * switched to using new determine_rate op rather than adding an argument
>   to round_rate.
> * moved mux implementation into a single helper which should be usable
>   from more complex clocks which can mux.
> * rewrite main implementation so that no changes are made until after
>   the PRE notifications have been sent, and in a way that should ensure
>   correct notifications without duplicates, and I think should be safe
>   in the event of a notification failing.
> * various tidy ups and fixes.
> 
> James Hogan (5):
>   clk: abstract parent cache
>   clk: move some parent related functions upwards
>   clk: add support for clock reparent on set_rate
>   clk: add CLK_SET_RATE_NO_REPARENT flag
>   clk: clk-mux: implement remuxing on set_rate
> 
>  Documentation/clk.txt  |  46 ++--
>  arch/arm/mach-imx/clk.h|   5 +-
>  drivers/clk/clk-mux.c  |   1 +
>  drivers/clk/clk.c  | 420 
> +
>  drivers/clk/mmp/clk-mmp2.c |  39 ++-
>  drivers/clk/mmp/clk-pxa168.c   |  40 ++--
>  drivers/clk/mmp/clk-pxa910.c   |  31 ++-
>  drivers/clk/mxs/clk.h  |   4 +-
>  drivers/clk/samsung/clk-exynos-audss.c |   6 +-
>  drivers/clk/samsung/clk.h  |   2 +-
>  drivers/clk/spear/spear1310_clock.c| 179 +++---
>  drivers/clk/spear/spear1340_clock.c|  97 
>  drivers/clk/spear/spear3xx_clock.c |  57 +++--
>  drivers/clk/spear/spear6xx_clock.c |  35 +--
>  drivers/clk/sunxi/clk-sunxi.c  |   3 +-
> 

Re: [RFC PATCH 00/12] KVM: MMU: locklessly wirte-protect

2013-08-08 Thread Xiao Guangrong
On 08/09/2013 01:38 AM, Paolo Bonzini wrote:
> Il 06/08/2013 15:16, Xiao Guangrong ha scritto:
>> Hi Gleb, Paolo, Marcelo, Takuya,
>>
>> Any comments or further comments? :)
> 
> It's not the easiest patch to review.  I've looked at it (beyond the
> small comments I have already posted), but it will take some time to
> digest it...

Thanks for your time, Paolo!

> 
> By the way, both I and Gleb will be on vacation next week.  I will read
> email, but I will not be able to apply patches or do pull requests.

Enjoy your vacation. :)

--
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: [ 008/102] ARM: make vectors page inaccessible from userspace

2013-08-08 Thread Greg Kroah-Hartman
On Fri, Aug 09, 2013 at 06:29:17AM +0200, Stefan Lippers-Hollmann wrote:
> On Friday 09 August 2013, Greg Kroah-Hartman wrote:
> > 3.10-stable review patch.  If anyone has any objections, please let me know.
> > 
> > --
> > 
> > From: Russell King 
> > 
> > commit a5463cd3435475386cbbe7b06e01292ac169d36f upstream.
> > 
> > If kuser helpers are not provided by the kernel, disable user access to
> > the vectors page.  With the kuser helpers gone, there is no reason for
> > this page to be visible to userspace.
> > 
> > Signed-off-by: Russell King 
> > Signed-off-by: Greg Kroah-Hartman 
> 
> 
> If I read Russell King's response in 
> 
>   http://www.spinics.net/lists/stable/msg16792.html
>   Message-ID: <20130804105241.gg23...@n2100.arm.linux.org.uk>
> 
> correctly, this patch might not be wanted for -stable; this only 
> affects queue-3.10 at the moment.

Yes, I know there's a build warning/error here, but it only affects no
mmu systems, right?  I'll pick up the fix that hits Linus's tree for
this when it gets there.

thanks,

greg k-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/


Re: [ 00/25] 3.4.57-stable review

2013-08-08 Thread Guenter Roeck

On 08/08/2013 06:41 PM, Greg Kroah-Hartman wrote:

This is the start of the stable review cycle for the 3.4.57 release.
There are 25 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 Sun Aug 11 01:33:13 UTC 2013.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.4.57-rc1.gz
and the diffstat can be found below.


Cross build results:
Total builds: 62 Total build errors: 10

Details:

http://server.roeck-us.net:8010/builders/stable-queue-3.4/builds/21/steps/shell/logs/stdio/text

Same results as with previous release; reported differences are due to 
different build targets.

If anyone is interested in per-build logs, please let me know.

Thanks,
Guenter

--
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: [ 008/102] ARM: make vectors page inaccessible from userspace

2013-08-08 Thread Stefan Lippers-Hollmann
On Friday 09 August 2013, Greg Kroah-Hartman wrote:
> 3.10-stable review patch.  If anyone has any objections, please let me know.
> 
> --
> 
> From: Russell King 
> 
> commit a5463cd3435475386cbbe7b06e01292ac169d36f upstream.
> 
> If kuser helpers are not provided by the kernel, disable user access to
> the vectors page.  With the kuser helpers gone, there is no reason for
> this page to be visible to userspace.
> 
> Signed-off-by: Russell King 
> Signed-off-by: Greg Kroah-Hartman 


If I read Russell King's response in 

http://www.spinics.net/lists/stable/msg16792.html
Message-ID: <20130804105241.gg23...@n2100.arm.linux.org.uk>

correctly, this patch might not be wanted for -stable; this only 
affects queue-3.10 at the moment.

Regards
Stefan Lippers-Hollmann
--
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: [ 000/102] 3.10.6-stable review

2013-08-08 Thread Greg Kroah-Hartman
On Fri, Aug 09, 2013 at 06:13:02AM +0200, Stefan Lippers-Hollmann wrote:
> Hi
> 
> On Friday 09 August 2013, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 3.10.6 release.
> […]
> > The whole patch series can be found in one patch at:
> > kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.6-rc1.gz
> […]
> 
> There appears to be a problem with the mirroring (not pushed?):
> 
> $ LANG= wget 
> kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.6-rc1.gz
> --2013-08-09 06:05:02--  
> http://kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.6-rc1.gz
> Resolving kernel.org (kernel.org)... 149.20.4.69, 198.145.20.140
> Connecting to kernel.org (kernel.org)|149.20.4.69|:80... connected.
> HTTP request sent, awaiting response... 301 Moved Permanently
> Location: 
> https://www.kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.6-rc1.gz
>  [following]
> --2013-08-09 06:05:02--  
> https://www.kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.6-rc1.gz
> Resolving www.kernel.org (www.kernel.org)... 198.145.20.140, 149.20.4.69
> Connecting to www.kernel.org (www.kernel.org)|198.145.20.140|:443... 
> connected.
> HTTP request sent, awaiting response... 404 Not Found
> 2013-08-09 06:05:06 ERROR 404: Not Found.
> 
> The other -stable patches of this round
>   kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.4.57-rc1.gz
> and
>   kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.0.90-rc1.gz
> appear to be missing as well.

Yes, something up with the kernel.org backend, I have a support ticket
already opened up on this.  Due to different timezones, it might take 12
hours or so before people wake up, so please be patient.

> Using the current queue-3.10/series from 
>   git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git
> builds and works fine on x86_64 and i386.

That's good to hear, thanks for testing and letting me know.

greg k-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/


Re: [PATCH V12 0/14] Paravirtualized ticket spinlocks

2013-08-08 Thread Raghavendra K T

On 08/09/2013 06:34 AM, H. Peter Anvin wrote:

The kbuild test bot is reporting some pretty serious errors for this
patchset.  I think these are serious enough that the patchset will need
to be respun.



I  am working on that.



--
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 v9 03/16] iommu/exynos: fix page table maintenance

2013-08-08 Thread Cho KyongHo
On Thu, 08 Aug 2013 15:54:50 +0200, Tomasz Figa wrote:
> On Thursday 08 of August 2013 18:37:43 Cho KyongHo wrote:
> > This prevents allocating lv2 page table for the lv1 page table entry
>   ^ What this is this this about? :)
> 
As you might indicate, 'this' means this patch :)

> > that already has 1MB page mapping. In addition, changed to BUG_ON
> > instead of returning -EADDRINUSE.
> 
> The change mentioned in last sentence should be a separate patch.
> 
Ok :)

> > Signed-off-by: Cho KyongHo 
> > ---
> >  drivers/iommu/exynos-iommu.c |   68
> > - 1 files changed, 40
> > insertions(+), 28 deletions(-)
> > 
> > diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> > index d545a25..d90e6fa 100644
> > --- a/drivers/iommu/exynos-iommu.c
> > +++ b/drivers/iommu/exynos-iommu.c
> > @@ -52,11 +52,11 @@
> >  #define lv2ent_large(pent) ((*(pent) & 3) == 1)
> > 
> >  #define section_phys(sent) (*(sent) & SECT_MASK)
> > -#define section_offs(iova) ((iova) & 0xF)
> > +#define section_offs(iova) ((iova) & ~SECT_MASK)
> >  #define lpage_phys(pent) (*(pent) & LPAGE_MASK)
> > -#define lpage_offs(iova) ((iova) & 0x)
> > +#define lpage_offs(iova) ((iova) & ~LPAGE_MASK)
> >  #define spage_phys(pent) (*(pent) & SPAGE_MASK)
> > -#define spage_offs(iova) ((iova) & 0xFFF)
> > +#define spage_offs(iova) ((iova) & ~SPAGE_MASK)
> > 
> >  #define lv1ent_offset(iova) ((iova) >> SECT_ORDER)
> >  #define lv2ent_offset(iova) (((iova) & 0xFF000) >> SPAGE_ORDER)
> > @@ -856,13 +856,15 @@ finish:
> >  static unsigned long *alloc_lv2entry(unsigned long *sent, unsigned long
> > iova, short *pgcounter)
> >  {
> > +   BUG_ON(lv1ent_section(sent));
> 
> Is this condition really a critical one, to the point that the system 
> should not continue execution?
> 
Discussed with Grant. He thought that creating mapping on a valid mapping
is just a BUG and I finally agreed with him. Is there a case that the condition
in BUG_ON is true intentionally?

> > +
> > if (lv1ent_fault(sent)) {
> > unsigned long *pent;
> > 
> > pent = kzalloc(LV2TABLE_SIZE, GFP_ATOMIC);
> > BUG_ON((unsigned long)pent & (LV2TABLE_SIZE - 1));
> > if (!pent)
> > -   return NULL;
> > +   return ERR_PTR(-ENOMEM);
> > 
> > *sent = mk_lv1ent_page(__pa(pent));
> > *pgcounter = NUM_LV2ENTRIES;
> > @@ -875,15 +877,11 @@ static unsigned long *alloc_lv2entry(unsigned long
> > *sent, unsigned long iova,
> > 
> >  static int lv1set_section(unsigned long *sent, phys_addr_t paddr, short
> > *pgcnt) {
> > -   if (lv1ent_section(sent))
> > -   return -EADDRINUSE;
> > +   BUG_ON(lv1ent_section(sent));
> 
> Ditto.
> 
> > if (lv1ent_page(sent)) {
> > -   if (*pgcnt != NUM_LV2ENTRIES)
> > -   return -EADDRINUSE;
> > -
> > +   BUG_ON(*pgcnt != NUM_LV2ENTRIES);
> 
> Ditto.
> 
> > kfree(page_entry(sent, 0));
> > -
> > *pgcnt = 0;
> > }
> > 
> > @@ -894,24 +892,24 @@ static int lv1set_section(unsigned long *sent,
> > phys_addr_t paddr, short *pgcnt) return 0;
> >  }
> > 
> > +static void clear_page_table(unsigned long *ent, int n)
> > +{
> > +   if (n > 0)
> > +   memset(ent, 0, sizeof(*ent) * n);
> > +}
> 
> I don't see the point of creating this function. It seems to be used only 
> once, in addition with a constant as n, so the check for n > 0 is 
> unnecessary.
> 
> And even if there is a need for this change, it should be done in separate 
> patch, as this one is not about stylistic changes, but fixing page table 
> maintenance (at least based on your commit message).
> 

I know what you are concerning about.
It was introduced in v8 patches to recover previous fault entries before
returning -EADDRINUSE. It is still remained though "return -EADDRINUSE"
is changed into BUG_ON().
I also think that it needs to be removed.

> >  static int lv2set_page(unsigned long *pent, phys_addr_t paddr, size_t
> > size, short *pgcnt)
> >  {
> > if (size == SPAGE_SIZE) {
> > -   if (!lv2ent_fault(pent))
> > -   return -EADDRINUSE;
> > -
> > +   BUG_ON(!lv2ent_fault(pent));
> 
> Ditto.
> 
> > *pent = mk_lv2ent_spage(paddr);
> > pgtable_flush(pent, pent + 1);
> > *pgcnt -= 1;
> > } else { /* size == LPAGE_SIZE */
> > int i;
> > for (i = 0; i < SPAGES_PER_LPAGE; i++, pent++) {
> > -   if (!lv2ent_fault(pent)) {
> > -   memset(pent, 0, sizeof(*pent) * i);
> > -   return -EADDRINUSE;
> > -   }
> > -
> > +   BUG_ON(!lv2ent_fault(pent));
> 
> Ditto.
> 
> > *pent = mk_lv2ent_lpage(paddr);
> > }
> > pgtable_flush(pent - SPAGES_PER_LPAGE, pent);
> > @@ -944,17 +942,16 @@ static int exynos_iommu_map(struct iommu_domain
> > *domain, 

Re: [ 000/102] 3.10.6-stable review

2013-08-08 Thread Stefan Lippers-Hollmann
Hi

On Friday 09 August 2013, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 3.10.6 release.
[…]
> The whole patch series can be found in one patch at:
>   kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.6-rc1.gz
[…]

There appears to be a problem with the mirroring (not pushed?):

$ LANG= wget kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.6-rc1.gz
--2013-08-09 06:05:02--  
http://kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.6-rc1.gz
Resolving kernel.org (kernel.org)... 149.20.4.69, 198.145.20.140
Connecting to kernel.org (kernel.org)|149.20.4.69|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: 
https://www.kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.6-rc1.gz 
[following]
--2013-08-09 06:05:02--  
https://www.kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.6-rc1.gz
Resolving www.kernel.org (www.kernel.org)... 198.145.20.140, 149.20.4.69
Connecting to www.kernel.org (www.kernel.org)|198.145.20.140|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2013-08-09 06:05:06 ERROR 404: Not Found.

The other -stable patches of this round
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.4.57-rc1.gz
and
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.0.90-rc1.gz
appear to be missing as well.

Using the current queue-3.10/series from 
git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git
builds and works fine on x86_64 and i386.

Regards
Stefan Lippers-Hollmann
--
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/3] block: brd: Staticize 'rd_size'

2013-08-08 Thread Jingoo Han
'rd_size' is used only in this file.
Fix the following sparse warning:

drivers/block/brd.c:432:5: warning: symbol 'rd_size' was not declared. Should 
it be static?

Signed-off-by: Jingoo Han 
---
 drivers/block/brd.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 9bf4371..650530ab 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -429,7 +429,7 @@ static const struct block_device_operations brd_fops = {
  * And now the modules code and kernel interface.
  */
 static int rd_nr;
-int rd_size = CONFIG_BLK_DEV_RAM_SIZE;
+static int rd_size = CONFIG_BLK_DEV_RAM_SIZE;
 static int max_part;
 static int part_shift;
 module_param(rd_nr, int, S_IRUGO);
-- 
1.7.10.4


--
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 35/35] cpufreq: tegra: use cpufreq_table_validate_and_show()

2013-08-08 Thread Viresh Kumar
On 8 August 2013 21:37, Viresh Kumar  wrote:
> Its useless and the correct routine isn't called at all :) .. I will add that
> additional patch and send it to you and will get this change out of this
> commit.

The two commits look like this now attached too in case you want
to test:

commit 9abdc9127b9f7f1e00c75694d15345843a60ff99
Author: Viresh Kumar 
Date:   Thu Aug 8 16:40:32 2013 +0530

cpufreq: tegra: use cpufreq_table_validate_and_show()

Lets use cpufreq_table_validate_and_show() instead of calling
cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().

Cc: Stephen Warren 
Signed-off-by: Viresh Kumar 
---
 drivers/cpufreq/tegra-cpufreq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/cpufreq/tegra-cpufreq.c b/drivers/cpufreq/tegra-cpufreq.c
index cd66b85..51752b3 100644
--- a/drivers/cpufreq/tegra-cpufreq.c
+++ b/drivers/cpufreq/tegra-cpufreq.c
@@ -215,8 +215,7 @@ static int tegra_cpu_init(struct cpufreq_policy *policy)
clk_prepare_enable(emc_clk);
clk_prepare_enable(cpu_clk);

-   cpufreq_frequency_table_cpuinfo(policy, freq_table);
-   cpufreq_frequency_table_get_attr(freq_table, policy->cpu);
+   cpufreq_table_validate_and_show(policy, freq_table);
policy->cur = tegra_getspeed(policy->cpu);
target_cpu_speed[policy->cpu] = policy->cur;


commit f1bb1cab6130501251eee616280b88c0b49d96d7
Author: Viresh Kumar 
Date:   Fri Aug 9 09:29:19 2013 +0530

cpufreq: tegra: fix implementation of ->exit()

->exit() of drivers should call cpufreq_frequency_table_put_attr()
if they have
called cpufreq_frequency_table_get_attr() earlier in init() and they aren't
required to validate their cpufreq table in exit by calling
cpufreq_frequency_table_cpuinfo(). Tegra's driver wasn't calling
cpufreq_frequency_table_put_attr() and was calling
cpufreq_frequency_table_cpuinfo() in exit.

Fix both these issues in it.

Signed-off-by: Viresh Kumar 
---
 drivers/cpufreq/tegra-cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/tegra-cpufreq.c b/drivers/cpufreq/tegra-cpufreq.c
index 51752b3..faf1ce5 100644
--- a/drivers/cpufreq/tegra-cpufreq.c
+++ b/drivers/cpufreq/tegra-cpufreq.c
@@ -232,7 +232,7 @@ static int tegra_cpu_init(struct cpufreq_policy *policy)

 static int tegra_cpu_exit(struct cpufreq_policy *policy)
 {
-   cpufreq_frequency_table_cpuinfo(policy, freq_table);
+   cpufreq_frequency_table_put_attr(policy->cpu);
clk_disable_unprepare(emc_clk);
return 0;
 }


0001-cpufreq-Add-new-helper-cpufreq_table_validate_and_sh.patch
Description: Binary data


0035-cpufreq-tegra-use-cpufreq_table_validate_and_show.patch
Description: Binary data


0036-cpufreq-tegra-fix-implementation-of-exit.patch
Description: Binary data


[PATCH 2/3] block: mg_disk: Staticize mg_times_out()

2013-08-08 Thread Jingoo Han
mg_times_out() is used only in this file.
Fix the following sparse warning:

drivers/block/mg_disk.c:639:6: warning: symbol 'mg_times_out' was not declared. 
Should it be static?

Signed-off-by: Jingoo Han 
---
 drivers/block/mg_disk.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
index a56cfcd..77a60be 100644
--- a/drivers/block/mg_disk.c
+++ b/drivers/block/mg_disk.c
@@ -636,7 +636,7 @@ ok_to_write:
mg_request(host->breq);
 }
 
-void mg_times_out(unsigned long data)
+static void mg_times_out(unsigned long data)
 {
struct mg_host *host = (struct mg_host *)data;
char *name;
-- 
1.7.10.4


--
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/3] block: rbd: use NULL instead of 0

2013-08-08 Thread Jingoo Han
The local variables such as 'bio_list', and 'pages' are pointers;
thus, use NULL instead of 0 to fix the following sparse warnings.

drivers/block/rbd.c:2166:32: warning: Using plain integer as NULL pointer
drivers/block/rbd.c:2168:31: warning: Using plain integer as NULL pointer

Signed-off-by: Jingoo Han 
---
 drivers/block/rbd.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 9e00010..fa198de 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2163,9 +2163,9 @@ static int rbd_img_request_fill(struct rbd_img_request 
*img_request,
struct rbd_obj_request *obj_request = NULL;
struct rbd_obj_request *next_obj_request;
bool write_request = img_request_write_test(img_request);
-   struct bio *bio_list = 0;
+   struct bio *bio_list = NULL;
unsigned int bio_offset = 0;
-   struct page **pages = 0;
+   struct page **pages = NULL;
u64 img_offset;
u64 resid;
u16 opcode;
-- 
1.7.10.4


--
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 v9 01/16] iommu/exynos: do not include removed header

2013-08-08 Thread Cho KyongHo
On Thu, 08 Aug 2013 15:42:24 +0200, Tomasz Figa wrote:
> Hi KyongHo,
> 
> On Thursday 08 of August 2013 18:37:25 Cho KyongHo wrote:
> > This commit remove  which is removed.
> 
> I would prefer a more meaningful commit message, something among following 
> lines:
> 
> 8<---
> Commit 25e9d28d92 (ARM: EXYNOS: remove system mmu initialization from 
> exynos tree) removed arch/arm/mach-exynos/mach/sysmmu.h header without 
> removing remaining use of it from exynos-iommu driver, thus causing a 
> compilation error.
> 
> This patch fixes the error by removing respective include line from exynos-
> iommu.c.
> --->8
> 

Ok.

> Also a sentence explaining why linux/kernel.h header must be included would 
> be nice.
> 
> > Signed-off-by: Cho KyongHo 
> 
> Please note that as far as I'm aware of, tags should be made using western 
> name writing convention, i.e. starting with first name.
> 

Oh, I didn't think that the order of family/given names are the matter.
I don't care about changing the order.

Thanks.

KyongHo.

> Best regards,
> Tomasz
> 
> > ---
> >  drivers/iommu/exynos-iommu.c |3 +--
> >  1 files changed, 1 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> > index 3f32d64..233f382 100644
> > --- a/drivers/iommu/exynos-iommu.c
> > +++ b/drivers/iommu/exynos-iommu.c
> > @@ -12,6 +12,7 @@
> >  #define DEBUG
> >  #endif
> > 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -29,8 +30,6 @@
> >  #include 
> >  #include 
> > 
> > -#include 
> > -
> >  /* We does not consider super section mapping (16MB) */
> >  #define SECT_ORDER 20
> >  #define LPAGE_ORDER 16
--
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 v9 02/16] iommu/exynos: add missing cache flush for removed page table entries

2013-08-08 Thread Cho KyongHo
On Thu, 08 Aug 2013 15:44:09 +0200, Tomasz Figa wrote:
> On Thursday 08 of August 2013 18:37:34 Cho KyongHo wrote:
> > This commit adds cache flush for removed small and large page entries
> > in exynos_iommu_unmap(). Missing cache flush of removed page table
> > entries can cause missing page fault interrupt when a master IP
> > accesses an unmapped area.
> > 
> > Tested-by: Grant Grundler 
> > Signed-off-by: Cho KyongHo 
> > ---
> >  drivers/iommu/exynos-iommu.c |2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> > index 233f382..d545a25 100644
> > --- a/drivers/iommu/exynos-iommu.c
> > +++ b/drivers/iommu/exynos-iommu.c
> > @@ -1002,6 +1002,7 @@ static size_t exynos_iommu_unmap(struct
> > iommu_domain *domain, if (lv2ent_small(ent)) {
> > *ent = 0;
> > size = SPAGE_SIZE;
> > +   pgtable_flush(ent, ent + 1);
> > priv->lv2entcnt[lv1ent_offset(iova)] += 1;
> > goto done;
> > }
> > @@ -1010,6 +1011,7 @@ static size_t exynos_iommu_unmap(struct
> > iommu_domain *domain, BUG_ON(size < LPAGE_SIZE);
> > 
> > memset(ent, 0, sizeof(*ent) * SPAGES_PER_LPAGE);
> > +   pgtable_flush(ent, ent + SPAGES_PER_LPAGE);
> > 
> > size = LPAGE_SIZE;
> > priv->lv2entcnt[lv1ent_offset(iova)] += SPAGES_PER_LPAGE;
> 
> Looks reasonable.
> 
> Reviewed-by: Tomasz Figa 
> 

Thanks.

KyongHo.
> Best regards,
> Tomasz
> 
--
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: [ 00/22] 3.0.90-stable review

2013-08-08 Thread Greg Kroah-Hartman
On Thu, Aug 08, 2013 at 08:42:12PM -0700, Guenter Roeck wrote:
> On 08/08/2013 06:41 PM, Greg Kroah-Hartman wrote:
> >This is the start of the stable review cycle for the 3.0.90 release.
> >There are 22 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 Sun Aug 11 01:37:07 UTC 2013.
> >Anything received after that time might be too late.
> >
> >The whole patch series can be found in one patch at:
> > kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.0.90-rc1.gz
> >and the diffstat can be found below.
> >
> 
> Cross build results:
>   Total builds: 58 Total build errors: 14
> 
> Same result as with previous release, except I got the m68k builds to work on 
> 3.0,
> added some new builds, and removed others which were failing on all branches.

Thanks for testing and letting me know.

greg k-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/


Re: [PATCH v6 00/10] mtd: add datasheet's ECC information to nand_chip{}

2013-08-08 Thread Artem Bityutskiy
On Thu, 2013-08-08 at 16:06 -0700, Brian Norris wrote:
> On Thu, Aug 08, 2013 at 04:33:35PM +0800, Huang Shijie wrote:
> > Hi Artem & Brian:
> > >Hi Huang and others,
> > >
> > >On Thu, May 16, 2013 at 8:17 PM, Huang Shijie  wrote:
> > >>1.) Why add the ECC information to the nand_chip{} ?
> ...
> > >Reviewed-by: Brian Norris
> > >Tested-by: Brian Norris
> > >
> > >Thanks for the work Huang.
> > >
> > Could you please merge this patch set?
> 
> Thanks for the reminder. I haven't sorted through all the piles of
> backed up stuff yet!
> 
> I made a few minor changes (for checkpatch.pl, regarding
> __attribute__((packed)), and to make the style a little more
> easily-read) and tested the generic stuff on my platform. I've pushed
> the series to l2-mtd.git. Thanks for the patience!

I guess you can try aiaiai, I run it for all the patches I take to
l2-mtd.git. It uses also coccinelle/smatch/sparse and other tools to
verify the patches, not only checkpatch. And this git tree contains
scripts and various defconfigs for various MTD drivers - the scripts run
aiaiai.

For example, to check Huang's patches, I run something like:

aiaiai-concat-mboxes ~/tmp/huang*.mbox | ./verify ../l2-mtd/ gpmi-nand

where "huang*.mbox" is Huang's patch set.

There are aliases for verious drivers. There is a 'gen' alias which I
use for general changes like changes in nand_base.c.

Read about the tool here:
http://git.infradead.org/users/dedekind/aiaiai.git/blob/HEAD:/doc/README.announcement
http://git.infradead.org/users/dedekind/aiaiai.git/blob/HEAD:/doc/README

The mtd maintenance helpers:
http://git.infradead.org/users/dedekind/maintaining.git

There are few minor issues in aiaiai, which I can fix if you hit them
and complain. Also, I did not invest much time in making the user
interface and experience very nice. But this can also be improved.

-- 
Best Regards,
Artem Bityutskiy

--
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: [ 00/22] 3.0.90-stable review

2013-08-08 Thread Guenter Roeck

On 08/08/2013 06:41 PM, Greg Kroah-Hartman wrote:

This is the start of the stable review cycle for the 3.0.90 release.
There are 22 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 Sun Aug 11 01:37:07 UTC 2013.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.0.90-rc1.gz
and the diffstat can be found below.



Cross build results:
Total builds: 58 Total build errors: 14

Same result as with previous release, except I got the m68k builds to work on 
3.0,
added some new builds, and removed others which were failing on all branches.

Details:

http://server.roeck-us.net:8010/builders/stable-queue-3.0/builds/29/steps/shell/logs/stdio/text

If anyone is interested in detailed per-build logs, please let me know.

Guenter

--
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]arch:avr32:kernel:time.c: Removed IRQF_DISABLED

2013-08-08 Thread Joe Perches
On Fri, 2013-08-09 at 08:49 +0530, Kumar Gaurav wrote:
> Please ignore the below patch. I'll be resending this with 0 instead of 
> IRQF_TRIGGER_NONE

Hey again Kumar.

This is one of those patches that should just have
IRQF_DISABLED completely elided.

> On Friday 09 August 2013 08:47 AM, Kumar Gaurav wrote:
[]
> > diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c
[]
> > @@ -59,7 +59,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
[]
> > -   .flags  = IRQF_TIMER | IRQF_DISABLED | IRQF_SHARED,
> > +   .flags  = IRQF_TIMER | IRQF_TRIGGER_NONE | IRQF_SHARED,

.flags  = IRQF_TIMER | IRQF_SHARED,


--
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 1/6] clk: Tegra: Add CPU0 clock driver

2013-08-08 Thread Viresh Kumar
On 9 August 2013 00:20, Stephen Warren  wrote:
> I don't think so. I think it's reasonable to have a per-SoC cpufreq
> driver whose primary content is the parameterization data and/or custom
> hooks for a unified core cpufreq driver. The duplicate parts of each
> cpufreq driver can be moved into the core cpufreq driver, but the
> non-duplicate parts remain. That's how many other subsystems work (MMC,
> USB, ASoC spring to mind).

Guys in the --to list:

Please shout before its too late...

I can understand why Stephen is asking not to implement a virtual clock
driver for cpu as there is no clock corresponding to that.. We are just playing
with existing clocks there..

But I thought these clock APIs can be considered as hooks that we were
looking for and so shouldn't be a problem..

But yes, different people see things differently..

So, if I take Stephen's suggestions then I need to implement hooks into
cpufreq-cpu0 driver for taking freq-table/ setting clk rates, etc...

Let me know if anybody has a issue with that before we actually implement
that..

--
viresh
--
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]arch:avr32:kernel:time.c: Removed IRQF_DISABLED

2013-08-08 Thread Kumar Gaurav
Please ignore the below patch. I'll be resending this with 0 instead of 
IRQF_TRIGGER_NONE

On Friday 09 August 2013 08:47 AM, Kumar Gaurav wrote:

Removed IRQF_DISABLED as it's no-op and should be removed

Signed-off-by: Kumar Gaurav 
---
  arch/avr32/kernel/time.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c
index 869a1c6..0566c81 100644
--- a/arch/avr32/kernel/time.c
+++ b/arch/avr32/kernel/time.c
@@ -59,7 +59,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
  static struct irqaction timer_irqaction = {
.handler= timer_interrupt,
/* Oprofile uses the same irq as the timer, so allow it to be shared */
-   .flags  = IRQF_TIMER | IRQF_DISABLED | IRQF_SHARED,
+   .flags  = IRQF_TIMER | IRQF_TRIGGER_NONE | IRQF_SHARED,
.name   = "avr32_comparator",
  };
  


--
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]arch:avr32:kernel:time.c: Removed IRQF_DISABLED

2013-08-08 Thread Kumar Gaurav
Removed IRQF_DISABLED as it's no-op and should be removed

Signed-off-by: Kumar Gaurav 
---
 arch/avr32/kernel/time.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c
index 869a1c6..0566c81 100644
--- a/arch/avr32/kernel/time.c
+++ b/arch/avr32/kernel/time.c
@@ -59,7 +59,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
 static struct irqaction timer_irqaction = {
.handler= timer_interrupt,
/* Oprofile uses the same irq as the timer, so allow it to be shared */
-   .flags  = IRQF_TIMER | IRQF_DISABLED | IRQF_SHARED,
+   .flags  = IRQF_TIMER | IRQF_TRIGGER_NONE | IRQF_SHARED,
.name   = "avr32_comparator",
 };
 
-- 
1.7.9.5

--
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: dw_mmc: Does anyone use multiple slots?

2013-08-08 Thread Seungwon Jeon
On Fri, August 09, 2013, Chris Ball wrote:
> On Fri, Aug 09 2013, Olof Johansson wrote:
> > On Thu, Aug 8, 2013 at 5:16 PM, Doug Anderson  wrote:
> >
> >> I guess my overall question is: if there are no actual implementations
> >> of multislot, shouldn't we kill it and simplify the code a whole lot?
> >> If someone out there has a real multislot device they can step back in
> >> and do it more correctly?
> >>
> >> Of course we need to find someone to actually go through and do the
> >> killing of multislot, but finding that person might be easier if there
> >> was some agreement that it was good to do.
> >
> > There clearly seems to be no in-tree users of multislot. If someone
> > new comes in, we have the code in the history and can revert the
> > removal (or at least use it as reference for re-introduction).
> >
> > I vote for removing it. It adds really annoying complexity for
> > something that nobody uses.
> 
> I agree with Olof, for what it's worth.  (The maintainers of the
> driver are Jaehoon and Seungwon, though.)

I feel like there is no actual use case for that though origin Synopsys IP 
supports.
Multi-slot  might be not useful in terms of performance because shared bus 
should be allowed.
(At least this is the way I see it, though)
As Exynos's host does so, other hosts which are introduced in Linux seems use 
one card per host.
If it's really not found now, I could agree on this topic.

Thanks,
Seungwon Jeon

--
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 tests: Fix compile failure on do_sort_something

2013-08-08 Thread David Ahern

On 8/8/13 1:58 AM, Adrian Hunter wrote:

On 08/08/13 00:59, David Ahern wrote:

Commit b55ae0a9 added code-reading.c which fails to compile on Fedora 16
with compiler version:
$ gcc --version
gcc (GCC) 4.6.3 20120306 (Red Hat 4.6.3-2)

Failure message is:

tests/code-reading.c: In function ‘do_sort_something’:
tests/code-reading.c:305:13: error: stack protector not protecting local 
variables: variable length buffer [-Werror=stack-protector]
cc1: all warnings being treated as errors
make: *** [/tmp/junk/tests/code-reading.o] Error 1
make: *** Waiting for unfinished jobs

Signed-off-by: David Ahern 
Cc: Adrian Hunter 
Cc: Jiri Olsa 
---
  tools/perf/tests/code-reading.c |   11 +--
  1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 8e0943b..4bde8be 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -304,15 +304,14 @@ static int comp(const void *a, const void *b)

  static void do_sort_something(void)
  {
-   size_t sz = 40960;
-   int buf[sz], i;
+   int buf[40960], i;

-   for (i = 0; i < (int)sz; i++)
-   buf[i] = sz - i - 1;
+   for (i = 0; i < (int)sizeof(buf); i++)



Should that be ARRAY_SIZE not sizeof


oops, yes it should.

David
--
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 2/2] ext4: improve mount/remount error handling

2013-08-08 Thread Theodore Ts'o
On Fri, Aug 02, 2013 at 02:03:47PM +0200, Piotr Sarna wrote:
> Commit 5688978 ("ext4: improve handling of conflicting mount options")
> introduced incorrect messages shown while choosing wrong mount options.
> 
> Firstly, both cases of incorrect mount options, "data=journal,delalloc"
> and "data=journal,dioread_nolock" result in the same error message.
> 
> Secondly, the problem above isn't solved for remount option: the mismatched
> parameter is simply ignored. Moreover, ext4_msg states that remount
> with options "data=journal,delalloc" succeeded, which is not true.
> 
> To fix it up, I added a simple check after parse_options() call to ensure
> that data=journal and delalloc/dioread_nolock parameters are not present
> at the same time.
> 
> Signed-off-by: Piotr Sarna 
> Acked-by: Bartlomiej Zolnierkiewicz 
> Signed-off-by: Kyungmin Park 

Applied, thanks.

- Ted
--
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 1/3 v5] usb: phy-samsung-usb: Simplify PMU register handling

2013-08-08 Thread Julius Werner
> Sorry, I don't understand what is not implemented. Without your patch, the
> PHY driver handles both PMU registers of Exynos4.

I don't have an Exynos4 to actually test this, so please let me know
if I'm missing something here... but in order to hit the right HOST
PHY register in the current upstream code, the Exynos4 code would need
to have a hostphy_reg_offset of 4 somewhere in its
samsung_usbphy_drvdata. In my latest checkout of Linus' tree (6c2580c)
it does not (only Exynos5 sets that attribute), so it would default to
0 (thereby actually hitting the DEVICE register).

If you want I can gladly provide another change on top of my patchset
to fix that in the future... but it looks to me like it had been
broken anyway for now.
--
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 08/19] perf symbol: Save vmlinux or kallsyms path loaded

2013-08-08 Thread David Ahern

On 8/8/13 11:08 AM, Arnaldo Carvalho de Melo wrote:

Em Wed, Aug 07, 2013 at 10:50:50PM -0400, David Ahern escreveu:

Save vmlinux or kallsyms path loaded using embedded default lookup (ie.,
not a user specified path). Upcoming perf sched timehist command requires
kernel symbols for properly computing idle times and prints a warning
if the kernel symbols are not loaded.


With this we will not know if the user passed something to set those
variables or if internally we did it, doesn't this break any existing
code assumption?


I believe this only affects code paths that go to default locations.

I am not aware of any code that looks at the path once the syms are 
loaded. AFAIK the timehist command is the first.


David
--
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 07/19] perf top: Use new idle_sym check

2013-08-08 Thread David Ahern

On 8/8/13 11:06 AM, Arnaldo Carvalho de Melo wrote:

Em Wed, Aug 07, 2013 at 10:50:49PM -0400, David Ahern escreveu:

Avoids strcmp processing each sample.


How so? This is done just when loading a DSO, when then each symbol is
checked against this list.


hmmm see that now, yes. The timehist command wants to know idle 
times, not just filter them out like perf-top does.


David



Tangentially, Frédéric, wasn't there a patchset from you that marks the
context of idle samples, in perf_event_header->misc, additiotally to
PERF_RECORD_MISC_KERNEL, etc? I think there were some for IRQ context as
well, right?

- Arnaldo


Signed-off-by: David Ahern 
Cc: Ingo Molnar 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Frederic Weisbecker 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
---
  tools/perf/builtin-top.c |   25 ++---
  1 file changed, 2 insertions(+), 23 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 440c3b3..8eb0e3a 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -634,26 +634,9 @@ repeat:
return NULL;
  }

-/* Tag samples to be skipped. */
-static const char *skip_symbols[] = {
-   "intel_idle",
-   "default_idle",
-   "native_safe_halt",
-   "cpu_idle",
-   "enter_idle",
-   "exit_idle",
-   "mwait_idle",
-   "mwait_idle_with_hints",
-   "poll_idle",
-   "ppc64_runlatch_off",
-   "pseries_dedicated_idle_sleep",
-   NULL
-};
-
  static int symbol_filter(struct map *map __maybe_unused, struct symbol *sym)
  {
const char *name = sym->name;
-   int i;

/*
 * ppc64 uses function descriptors and appends a '.' to the
@@ -671,12 +654,8 @@ static int symbol_filter(struct map *map __maybe_unused, 
struct symbol *sym)
strstr(name, "_text_end"))
return 1;

-   for (i = 0; skip_symbols[i]; i++) {
-   if (!strcmp(skip_symbols[i], name)) {
-   sym->ignore = true;
-   break;
-   }
-   }
+   if (symbol__is_idle(sym))
+   sym->ignore = true;

return 0;
  }
--
1.7.10.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] ACPI, cpu hotplug: move try_offline_node() after acpi_unmap_lsapic()

2013-08-08 Thread Gu Zheng
Hi Ishimatsu-san,
On 08/06/2013 06:11 PM, Yasuaki Ishimatsu wrote:

> try_offline_node() checks that all cpus related with removed node have been
> removed by using cpu_present_bits. If all cpus related with removed node have
> been removed, try_offline_node() clears the node information.
> 
> But try_offline_node() called from acpi_processor_remove() never clears
> the node information. For disabling cpu_present_bits, acpi_unmap_lsapic()
> need be called. But acpi_unmap_lsapic() is called after try_offline_node()
> runs. So when try_offline_node() runs, the cpu's cpu_present_bits is always
> set.
> 
> This patch moves try_offline_node() after acpi_unmap_lsapic().

It works well.

> 
> Signed-off-by: Yasuaki Ishimatsu 


Tested-by: Gu Zheng 

Thanks,
Gu

> ---
>  drivers/acpi/acpi_processor.c |3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
> index fd6c51c..5a74a9c 100644
> --- a/drivers/acpi/acpi_processor.c
> +++ b/drivers/acpi/acpi_processor.c
> @@ -451,7 +451,6 @@ static void acpi_processor_remove(struct acpi_device 
> *device)
>   /* Clean up. */
>   per_cpu(processor_device_array, pr->id) = NULL;
>   per_cpu(processors, pr->id) = NULL;
> - try_offline_node(cpu_to_node(pr->id));
> 
>   /* Remove the CPU. */
>   get_online_cpus();
> @@ -459,6 +458,8 @@ static void acpi_processor_remove(struct acpi_device 
> *device)
>   acpi_unmap_lsapic(pr->id);
>   put_online_cpus();
> 
> + try_offline_node(cpu_to_node(pr->id));
> +
>   out:
>   free_cpumask_var(pr->throttling.shared_cpu_map);
>   kfree(pr);
> 
> --
> 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/
> 


--
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 v2 3/7] dmaengine: enhance dmaengine to support DMA device hotplug

2013-08-08 Thread Wang, Rui Y
> -Original Message-
> From: Jon Mason [mailto:jdma...@kudzu.us]
> Sent: Friday, August 09, 2013 8:04 AM
> To: Wang, Rui Y
> Cc: liu...@gmail.com; Sosnowski, Maciej; Koul, Vinod;
> chenkep...@huawei.com; linux-kernel@vger.kernel.org;
> linux-...@vger.kernel.org; Luck, Tony; Guo, Chaohong; Dan Williams; Jiang,
> Dave
> Subject: Re: [RFC PATCH v2 3/7] dmaengine: enhance dmaengine to support
> DMA device hotplug
> 
> On Thu, Aug 8, 2013 at 3:59 AM, Wang, Rui Y  wrote:
> > (resend adding cc list)
> 
> The e-mail you are responding to is over a year old, but doesn't appear to 
> have
> been accepted.  I suppose late is better than never...
> 

Yes agreed. We eventually have to fix it.

I recently encountered the same problem (dma_async_device_unregister() hung my 
machine). I was looking for people who cared about it and found this thread.

Thanks
Rui

> Adding Dan Williams new e-mail address and Dave Jiang.
> 
> Thanks,
> Jon
> 
> >
> > Hi Jiang,
> > See my comments inline.
> >
> >> -Original Message-
> >> From: Jiang Liu 
> >> Date: Mon, 14 May 2012 21:47:05 +0800
> >> Subject: [RFC PATCH v2 3/7] dmaengine: enhance dmaengine to support
> >> DMA device hotplug
> >> To: Dan Williams , Maciej Sosnowski
> >> , Vinod Koul 
> >> Cc: Jiang Liu , Keping Chen
> >> , linux-kernel@vger.kernel.org,
> >> linux-...@vger.kernel.org
> >>
> >> From: Jiang Liu 
> >>
> >> From: Jiang Liu 
> >>
> >> To support DMA device hotplug, dmaengine must correctly manage
> >> reference count for DMA channels. On the other hand, DMA hot path is
> >> performance critical, reference count management code should avoid
> >> polluting global shared cachelines, otherwise it may cause heavy
> performance penalty.
> >>
> >> This patch introduces a lightweight DMA channel reference count
> >> management mechanism by using percpu counter. When DMA device
> hotplug
> >> is disabled, there's no performance penalty. When hotplug is enabled,
> >> a
> >> dma_find_channel()/dma_put_channel() pair adds two local memory
> >> accesses to the hot path.
> >>
> >> Signed-off-by: Jiang Liu 
> >> ---
> >>  drivers/dma/dmaengine.c   |  112
> >> +
> >>  include/linux/dmaengine.h |   29 +++-
> >>  2 files changed, 129 insertions(+), 12 deletions(-)
> >>
> >> diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index
> >> d3b1c48..eca45c0 100644
> >> --- a/drivers/dma/dmaengine.c
> >> +++ b/drivers/dma/dmaengine.c
> >> @@ -61,12 +61,20 @@
> >>  #include 
> >>  #include 
> >>  #include 
> >> +#include 
> >>
> >>  static DEFINE_MUTEX(dma_list_mutex);  static DEFINE_IDR(dma_idr);
> >> static LIST_HEAD(dma_device_list);  static long
> >> dmaengine_client_count;
> >>
> >> +#ifdef   CONFIG_DMA_ENGINE_HOTPLUG
> >> +static atomic_t dmaengine_dirty;
> >> +static struct static_key dmaengine_quiesce = STATIC_KEY_INIT_FALSE;
> >> +static DECLARE_WAIT_QUEUE_HEAD(dmaengine_wait_queue);
> >> +DEFINE_PER_CPU(long, dmaengine_chan_ref_count);
> >> +#endif   /* CONFIG_DMA_ENGINE_HOTPLUG */
> >> +
> >>  /* --- sysfs implementation --- */
> >>
> >>  /**
> >> @@ -305,10 +313,40 @@ arch_initcall(dma_channel_table_init);
> >>   */
> >>  struct dma_chan *dma_find_channel(enum dma_transaction_type
> tx_type)
> >> {
> >> - return this_cpu_read(channel_table[tx_type]->chan);
> >> + struct dma_chan *chan =
> >> + this_cpu_read(channel_table[tx_type]->chan);
> >> +
> >> +#ifdef   CONFIG_DMA_ENGINE_HOTPLUG
> >> + this_cpu_inc(dmaengine_chan_ref_count);
> >> + if (static_key_false(_quiesce))
> >> + chan = NULL;
> >> +#endif
> >> +
> >> + return chan;
> >>  }
> >>  EXPORT_SYMBOL(dma_find_channel);
> >>
> >> +#ifdef   CONFIG_DMA_ENGINE_HOTPLUG
> >> +struct dma_chan *dma_get_channel(struct dma_chan *chan) {
> >> + if (static_key_false(_quiesce))
> >> + atomic_inc(_dirty);
> >> + this_cpu_inc(dmaengine_chan_ref_count);
> >> +
> >> + return chan;
> >> +}
> >> +EXPORT_SYMBOL(dma_get_channel);
> >> +#endif
> >> +
> >> +/**
> >> + * dma_has_capability - check whether any channel supports tx_type
> >> + * @tx_type: transaction type
> >> + */
> >> +bool dma_has_capability(enum dma_transaction_type tx_type) {
> >> + return !!this_cpu_read(channel_table[tx_type]->chan);
> >> +}
> >> +EXPORT_SYMBOL(dma_has_capability);
> >> +
> >>  /*
> >>   * net_dma_find_channel - find a channel for net_dma
> >>   * net_dma has alignment requirements @@ -316,10 +354,15 @@
> >> EXPORT_SYMBOL(dma_find_channel);  struct dma_chan
> >> *net_dma_find_channel(void)  {
> >>   struct dma_chan *chan = dma_find_channel(DMA_MEMCPY);
> >> - if (chan && !is_dma_copy_aligned(chan->device, 1, 1, 1))
> >> - return NULL;
> >>
> >> - return chan;
> >> + if (chan && is_dma_copy_aligned(chan->device, 1, 1, 1))
> >> + return chan;
> >> +
> >> +#ifdef   CONFIG_DMA_ENGINE_HOTPLUG
> >> + this_cpu_dec(dmaengine_chan_ref_count);
> >> +#endif
> >> +
> >> 

Re: [PATCH v8 06/12] ARM: dts: Add description of System MMU of Exynos SoCs

2013-08-08 Thread Cho KyongHo
On Thu, 08 Aug 2013 22:43:43 +0100, Will Deacon wrote:
> On Thu, Aug 08, 2013 at 10:38:10PM +0100, Tomasz Figa wrote:
> > On Thursday 08 of August 2013 08:09:49 Rob Herring wrote:
> > > On Thu, Aug 1, 2013 at 8:05 AM, Cho KyongHo  
> > wrote:
> > > > Should this align with ARM System MMU bindings?
> > > > System MMU in Exynos SoC is different from ARM System MMU.
> > > > It does not follows the specifications of ARM System MMU.
> > > 
> > > I'm not saying the h/w is the same or even the same spec, but how you
> > > describe a master to iommu connection needs to be done in the same
> > > way. This should be done in the same way for ALL iommu's. And if what
> > > is defined does not work for you, then we need to understand that and
> > > fix the binding now.
> > 
> > +1
> > 
> > All IOMMUs should use a generic IOMMU Device Tree bindings (and in 
> > general, the same should be true for all Device Tree bindings).
> > 
> > This means that if we already have some bindings for IOMMU, then they 
> > should be reused if possible or extended if there is anything missing.
> > 
> > Of course there might be things that such generic bindings can't specify. 
> > In this case device-specific properties can be introduced, but this is 
> > last resort.
> 
> I'm also happy to discuss and/or review bindings in light of what we did for
> the ARM SMMU.
> 
> Will

Rob, I now understood what you are talking about.
Do you mean the binding description is lack of details about connection
betwen  System MMU and its master?

thanks.

KyongHo.
--
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/


[ 003/102] ARM: move vector stubs

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

--

From: Russell King 

commit 19accfd373847ac3d10623c5d20f948846299741 upstream.

Move the machine vector stubs into the page above the vector page,
which we can prevent from being visible to userspace.  Also move
the reset stub, and place the swi vector at a location that the
'ldr' can get to it.

This hides pointers into the kernel which could give valuable
information to attackers, and reduces the number of exploitable
instructions at a fixed address.

Acked-by: Nicolas Pitre 
Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/Kconfig |3 +-
 arch/arm/kernel/entry-armv.S |   50 ---
 arch/arm/kernel/traps.c  |4 +--
 arch/arm/mm/mmu.c|   10 +++-
 4 files changed, 37 insertions(+), 30 deletions(-)

--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -213,7 +213,8 @@ config VECTORS_BASE
default DRAM_BASE if REMAP_VECTORS_TO_RAM
default 0x
help
- The base address of exception vectors.
+ The base address of exception vectors.  This must be two pages
+ in size.
 
 config ARM_PATCH_PHYS_VIRT
bool "Patch physical to virtual translations at runtime" if EMBEDDED
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -943,9 +943,9 @@ __kuser_helper_end:
 /*
  * Vector stubs.
  *
- * This code is copied to 0x0200 so we can use branches in the
- * vectors, rather than ldr's.  Note that this code must not
- * exceed 0x300 bytes.
+ * This code is copied to 0x1000 so we can use branches in the
+ * vectors, rather than ldr's.  Note that this code must not exceed
+ * a page size.
  *
  * Common stub entry macro:
  *   Enter in IRQ mode, spsr = SVC/USR CPSR, lr = SVC/USR PC
@@ -994,6 +994,15 @@ ENDPROC(vector_\name)
 
.globl  __stubs_start
 __stubs_start:
+   @ This must be the first word
+   .word   vector_swi
+
+vector_rst:
+ ARM(  swi SYS_ERROR0  )
+ THUMB(svc #0  )
+ THUMB(nop )
+   b   vector_und
+
 /*
  * Interrupt dispatcher
  */
@@ -1088,6 +1097,16 @@ __stubs_start:
.align  5
 
 /*=
+ * Address exception handler
+ *-
+ * These aren't too critical.
+ * (they're not supposed to happen, and won't happen in 32-bit data mode).
+ */
+
+vector_addrexcptn:
+   b   vector_addrexcptn
+
+/*=
  * Undefined FIQs
  *-
  * Enter in FIQ mode, spsr = ANY CPSR, lr = ANY PC
@@ -1100,35 +1119,14 @@ __stubs_start:
 vector_fiq:
subspc, lr, #4
 
-/*=
- * Address exception handler
- *-
- * These aren't too critical.
- * (they're not supposed to happen, and won't happen in 32-bit data mode).
- */
-
-vector_addrexcptn:
-   b   vector_addrexcptn
-
-/*
- * We group all the following data together to optimise
- * for CPUs with separate I & D caches.
- */
-   .align  5
-
-.LCvswi:
-   .word   vector_swi
-
.globl  __stubs_end
 __stubs_end:
 
-   .equstubs_offset, __vectors_start + 0x200 - __stubs_start
+   .equstubs_offset, __vectors_start + 0x1000 - __stubs_start
 
.globl  __vectors_start
 __vectors_start:
- ARM(  swi SYS_ERROR0  )
- THUMB(svc #0  )
- THUMB(nop )
+   W(b)vector_rst + stubs_offset
W(b)vector_und + stubs_offset
W(ldr)  pc, .LCvswi + stubs_offset
W(b)vector_pabt + stubs_offset
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -836,7 +836,7 @@ void __init early_trap_init(void *vector
 * are visible to the instruction stream.
 */
memcpy((void *)vectors, __vectors_start, __vectors_end - 
__vectors_start);
-   memcpy((void *)vectors + 0x200, __stubs_start, __stubs_end - 
__stubs_start);
+   memcpy((void *)vectors + 0x1000, __stubs_start, __stubs_end - 
__stubs_start);
memcpy((void *)vectors + 0x1000 - kuser_sz, __kuser_helper_start, 
kuser_sz);
 
/*
@@ -851,6 +851,6 @@ void __init early_trap_init(void *vector
memcpy((void *)(vectors + KERN_SIGRETURN_CODE - CONFIG_VECTORS_BASE),
   sigreturn_codes, sizeof(sigreturn_codes));
 
-   flush_icache_range(vectors, vectors + PAGE_SIZE);
+   flush_icache_range(vectors, vectors + PAGE_SIZE * 2);
modify_domain(DOMAIN_USER, DOMAIN_CLIENT);
 }
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -1175,7 +1175,7 @@ 

[ 002/102] ARM: poison memory between kuser helpers

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

--

From: Russell King 

commit 5b43e7a383d69381ffe53423e46dd0fafae07da3 upstream.

Poison the memory between each kuser helper.  This ensures that any
branch between the kuser helpers will be appropriately trapped.

Acked-by: Nicolas Pitre 
Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/kernel/entry-armv.S |   25 -
 1 file changed, 16 insertions(+), 9 deletions(-)

--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -741,6 +741,17 @@ ENDPROC(__switch_to)
 #endif
.endm
 
+   .macro  kuser_pad, sym, size
+   .if (. - \sym) & 3
+   .rept   4 - (. - \sym) & 3
+   .byte   0
+   .endr
+   .endif
+   .rept   (\size - (. - \sym)) / 4
+   .word   0xe7fddef1
+   .endr
+   .endm
+
.align  5
.globl  __kuser_helper_start
 __kuser_helper_start:
@@ -831,18 +842,13 @@ kuser_cmpxchg64_fixup:
 #error "incoherent kernel configuration"
 #endif
 
-   /* pad to next slot */
-   .rept   (16 - (. - __kuser_cmpxchg64)/4)
-   .word   0
-   .endr
-
-   .align  5
+   kuser_pad __kuser_cmpxchg64, 64
 
 __kuser_memory_barrier:@ 0x0fa0
smp_dmb arm
usr_ret lr
 
-   .align  5
+   kuser_pad __kuser_memory_barrier, 32
 
 __kuser_cmpxchg:   @ 0x0fc0
 
@@ -915,13 +921,14 @@ kuser_cmpxchg32_fixup:
 
 #endif
 
-   .align  5
+   kuser_pad __kuser_cmpxchg, 32
 
 __kuser_get_tls:   @ 0x0fe0
ldr r0, [pc, #(16 - 8)] @ read TLS, set in kuser_get_tls_init
usr_ret lr
mrc p15, 0, r0, c13, c0, 3  @ 0x0fe8 hardware TLS code
-   .rep4
+   kuser_pad __kuser_get_tls, 16
+   .rep3
.word   0   @ 0x0ff0 software TLS value, then
.endr   @ pad up to __kuser_helper_version
 


--
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/


[ 000/102] 3.10.6-stable review

2013-08-08 Thread Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.6 release.
There are 102 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 Sun Aug 11 01:46:31 UTC 2013.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.6-rc1.gz
and the diffstat can be found below.

thanks,

greg k-h

-
Pseudo-Shortlog of commits:

Greg Kroah-Hartman 
Linux 3.10.6-rc1

Johannes Berg 
iwlwifi: dvm: don't send BT_CONFIG on devices w/o Bluetooth

David Spinadel 
iwlwifi: mvm: set SSID bits for passive channels

Jack Morgenstein 
net/mlx4_core: VFs must ignore the enable_64b_cqe_eqe module param

Or Gerlitz 
net/mlx4_core: Don't give VFs MAC addresses which are derived from the PF 
MAC

Neil Horman 
8139cp: Add dma_mapping_error checking

Joe Perches 
ndisc: Add missing inline to ndisc_addr_option_pad

Dan Carpenter 
net_sched: info leak in atm_tc_dump_class()

Eric Dumazet 
atl1c: use custom skb allocator

Dan Carpenter 
af_key: more info leaks in pfkey messages

David S. Miller 
net_sched: Fix stack info leak in cbq_dump_wrr().

Stanislaw Gruszka 
genetlink: release cb_lock before requesting additional module

Eric Dumazet 
usbnet: do not pretend to support SG/TSO

Hannes Frederic Sowa 
ipv6: take rtnl_lock and mark mrt6 table as freed on namespace cleanup

Ben Hutchings 
sfc: Enable RX scatter for flows steered by RFS

Michal Tesar 
sysctl net: Keep tcp_syn_retries inside the boundary

Dan Carpenter 
arcnet: cleanup sizeof parameter

Christian Eggers 
spi: spi-davinci: Fix direction in dma_map_single()

Neil Horman 
x86/iommu/vt-d: Expand interrupt remapping quirk to cover x58 chipset

Oleg Nesterov 
userns: unshare_userns() should not populate cred on failure

Shaohua Li 
workqueue: copy workqueue_attrs with all fields

Martin Schwidefsky 
s390/bitops: fix find_next_bit_left

Heiko Carstens 
s390: add support for IBM zBC12 machine

Daniel Vetter 
drm/i915: make SDVO TV-out work for multifunction devices

Liu Bo 
Btrfs: fix crash regarding to ulist_add_merge

H.J. Lu 
x86, fpu: correct the asm constraints for fxsave, unbreak mxcsr.daz

Christian König 
drm/radeon: never unpin UVD bo v3

Li Zefan 
cgroup: fix umount vs cgroup_cfts_commit() race

Dan Carpenter 
fanotify: info leak in copy_event_to_user()

Stéphane Marchesin 
drm/i915: Preserve the DDI_A_4_LANES bit from the bios

Roger Pau Monne 
xen-blkfront: use a different scatterlist for each request

Alex Deucher 
drm/radeon: Disable dma rings for bo moves on r6xx

Yinghai Lu 
PCI: Retry allocation of only the resource type that failed

Yinghai Lu 
PCI: pciehp: Fix null pointer deref when hot-removing SR-IOV device

Rafael J. Wysocki 
Revert "cpuidle: Quickly notice prediction failure for repeat mode"

Rafael J. Wysocki 
cpufreq: Fix cpufreq driver module refcount balance after suspend/resume

Rafael J. Wysocki 
Revert "cpuidle: Quickly notice prediction failure in general case"

Lan Tianyu 
ACPI / battery: Fix parsing _BIX return value

Jiang Liu 
zram: protect sysfs handler from invalid memory access

Jiang Liu 
zram: avoid access beyond the zram device

Jiang Liu 
zram: avoid double free in function zram_bvec_write()

Jiang Liu 
zram: destroy all devices on error recovery path in zram_init()

Jiang Liu 
zram: use zram->lock to protect zram_free_page() in swap free notify path

Jiang Liu 
zram: avoid invalid memory access in zram_exit()

Avinash Patil 
mwifiex: fix wrong data rates in P2P client

Avinash Patil 
mwifiex: check for bss_role instead of bss_mode for STA operations

Tomasz Moń 
mwifiex: Add missing endian conversion.

Stanislaw Gruszka 
rt2x00: fix stop queue

J. Bruce Fields 
svcrpc: fix kfree oops in gss-proxy code

J. Bruce Fields 
svcrpc: fix gss_rpc_upcall create error

J. Bruce Fields 
svcrpc: fix gss-proxy xdr decoding oops

Adam Lee 
Bluetooth: fix wrong use of PTR_ERR() in btusb

Cho, Yu-Chen 
Bluetooth: Add support for Mediatek Bluetooth device [0e8d:763f]

AceLan Kao 
Bluetooth: Add support for Atheros [0cf3:e003]

AceLan Kao 
Bluetooth: Add support for Atheros [0cf3:3121]

Sujith Manoharan 
Bluetooth: ath3k: Add support for ID 0x13d3/0x3402

Stanislaw Gruszka 
Bluetooth: ath3k: don't use stack memory for DMA

Thomas Loo 
Bluetooth: ath3k: Add support for Fujitsu Lifebook UH5x2 [04c5:1330]

Jaganath Kanakkassery 
Bluetooth: Fix invalid length check in l2cap_information_rsp()

Larry Finger 
ath: wil6210: Fix build error

Jacob Keller 
ixgbe: Fix Tx Hang issue with lldpad on 82598EB

Stanislaw Gruszka 
mac80211: fix monitor interface suspend crash regression


[ 011/102] powerpc/windfarm: Fix noisy slots-fan on Xserve (rm31)

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

--

From: Aaro Koskinen 

commit fe956a1d4081ce1a959f87df397a15e252201f10 upstream.

slots-fan on G5 Xserve is always running at full speed with windfarm_rm31
driver, resulting in a very high acoustic noise level. It seems the fan
parameters are incorrect, and have been copied from the Drive Bay fan
(RPM, not present on rm31) of the legacy therm_pm72 driver. This patch
changes the parameters to match the Slots fan (PWM) of therm_pm72. With
the patch, slots-fan speed drops from 99% to 19% during normal use,
and slots-temp settle to ~42'C.

Signed-off-by: Aaro Koskinen 
Signed-off-by: Benjamin Herrenschmidt 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/macintosh/windfarm_rm31.c |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

--- a/drivers/macintosh/windfarm_rm31.c
+++ b/drivers/macintosh/windfarm_rm31.c
@@ -439,15 +439,15 @@ static void backside_setup_pid(void)
 
 /* Slots fan */
 static const struct wf_pid_param slots_param = {
-   .interval   = 5,
-   .history_len= 2,
-   .gd = 30 << 20,
-   .gp = 5 << 20,
-   .gr = 0,
-   .itarget= 40 << 16,
-   .additive   = 1,
-   .min= 300,
-   .max= 4000,
+   .interval   = 1,
+   .history_len= 20,
+   .gd = 0,
+   .gp = 0,
+   .gr = 0x0010,
+   .itarget= 320,
+   .additive   = 0,
+   .min= 20,
+   .max= 100,
 };
 
 static void slots_fan_tick(void)


--
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/


[ 007/102] ARM: move signal handlers into a vdso-like page

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

--

From: Russell King 

commit 48be69a026b2c17350a5ef18a1959a919f60be7d upstream.

Move the signal handlers into a VDSO page rather than keeping them in
the vectors page.  This allows us to place them randomly within this
page, and also map the page at a random location within userspace
further protecting these code fragments from ROP attacks.  The new
VDSO page is also poisoned in the same way as the vector page.

Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/include/asm/elf.h |4 +++
 arch/arm/include/asm/mmu.h |1 
 arch/arm/kernel/process.c  |   40 +---
 arch/arm/kernel/signal.c   |   50 +++--
 arch/arm/kernel/signal.h   |   12 --
 arch/arm/kernel/traps.c|9 
 6 files changed, 86 insertions(+), 30 deletions(-)

--- a/arch/arm/include/asm/elf.h
+++ b/arch/arm/include/asm/elf.h
@@ -130,4 +130,8 @@ struct mm_struct;
 extern unsigned long arch_randomize_brk(struct mm_struct *mm);
 #define arch_randomize_brk arch_randomize_brk
 
+#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
+struct linux_binprm;
+int arch_setup_additional_pages(struct linux_binprm *, int);
+
 #endif
--- a/arch/arm/include/asm/mmu.h
+++ b/arch/arm/include/asm/mmu.h
@@ -8,6 +8,7 @@ typedef struct {
atomic64_t  id;
 #endif
unsigned intvmalloc_seq;
+   unsigned long   sigpage;
 } mm_context_t;
 
 #ifdef CONFIG_CPU_HAS_ASID
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -435,8 +435,8 @@ unsigned long arch_randomize_brk(struct
 #ifdef CONFIG_MMU
 /*
  * The vectors page is always readable from user space for the
- * atomic helpers and the signal restart code. Insert it into the
- * gate_vma so that it is visible through ptrace and /proc//mem.
+ * atomic helpers. Insert it into the gate_vma so that it is visible
+ * through ptrace and /proc//mem.
  */
 static struct vm_area_struct gate_vma = {
.vm_start   = 0x,
@@ -468,6 +468,40 @@ int in_gate_area_no_mm(unsigned long add
 
 const char *arch_vma_name(struct vm_area_struct *vma)
 {
-   return (vma == _vma) ? "[vectors]" : NULL;
+   return (vma == _vma) ? "[vectors]" :
+   (vma->vm_mm && vma->vm_start == vma->vm_mm->context.sigpage) ?
+"[sigpage]" : NULL;
+}
+
+extern struct page *get_signal_page(void);
+
+int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
+{
+   struct mm_struct *mm = current->mm;
+   struct page *page;
+   unsigned long addr;
+   int ret;
+
+   page = get_signal_page();
+   if (!page)
+   return -ENOMEM;
+
+   down_write(>mmap_sem);
+   addr = get_unmapped_area(NULL, 0, PAGE_SIZE, 0, 0);
+   if (IS_ERR_VALUE(addr)) {
+   ret = addr;
+   goto up_fail;
+   }
+
+   ret = install_special_mapping(mm, addr, PAGE_SIZE,
+   VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC,
+   );
+
+   if (ret == 0)
+   mm->context.sigpage = addr;
+
+ up_fail:
+   up_write(>mmap_sem);
+   return ret;
 }
 #endif
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -8,6 +8,7 @@
  * published by the Free Software Foundation.
  */
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -15,12 +16,11 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 
-#include "signal.h"
-
 /*
  * For ARM syscalls, we encode the syscall number into the instruction.
  */
@@ -40,11 +40,13 @@
 #define SWI_THUMB_SIGRETURN(0xdf00 << 16 | 0x2700 | (__NR_sigreturn - 
__NR_SYSCALL_BASE))
 #define SWI_THUMB_RT_SIGRETURN (0xdf00 << 16 | 0x2700 | (__NR_rt_sigreturn - 
__NR_SYSCALL_BASE))
 
-const unsigned long sigreturn_codes[7] = {
+static const unsigned long sigreturn_codes[7] = {
MOV_R7_NR_SIGRETURN,SWI_SYS_SIGRETURN,SWI_THUMB_SIGRETURN,
MOV_R7_NR_RT_SIGRETURN, SWI_SYS_RT_SIGRETURN, SWI_THUMB_RT_SIGRETURN,
 };
 
+static unsigned long signal_return_offset;
+
 #ifdef CONFIG_CRUNCH
 static int preserve_crunch_context(struct crunch_sigframe __user *frame)
 {
@@ -397,11 +399,14 @@ setup_return(struct pt_regs *regs, struc
return 1;
 
if (cpsr & MODE32_BIT) {
+   struct mm_struct *mm = current->mm;
/*
-* 32-bit code can use the new high-page
-* signal return code support.
+* 32-bit code can use the signal return page
+* except when the MPU has protected the vectors
+* page from PL0
 */
-   retcode = KERN_SIGRETURN_CODE + (idx << 2) + thumb;
+   retcode = mm->context.sigpage + signal_return_offset +
+ 

[ 004/102] ARM: use linker magic for vectors and vector stubs

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

--

From: Russell King 

commit b9b32bf70f2fb710b07c94e13afbc729afe221da upstream.

Use linker magic to create the vectors and vector stubs: we can tell the
linker to place them at an appropriate VMA, but keep the LMA within the
kernel.  This gets rid of some unnecessary symbol manipulation, and
have the linker calculate the relocations appropriately.

Acked-by: Nicolas Pitre 
Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/kernel/entry-armv.S  |   28 ++--
 arch/arm/kernel/vmlinux.lds.S |   17 +
 2 files changed, 27 insertions(+), 18 deletions(-)

--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -992,7 +992,7 @@ ENDPROC(vector_\name)
 1:
.endm
 
-   .globl  __stubs_start
+   .section .stubs, "ax", %progbits
 __stubs_start:
@ This must be the first word
.word   vector_swi
@@ -1119,24 +1119,16 @@ vector_addrexcptn:
 vector_fiq:
subspc, lr, #4
 
-   .globl  __stubs_end
-__stubs_end:
-
-   .equstubs_offset, __vectors_start + 0x1000 - __stubs_start
-
-   .globl  __vectors_start
+   .section .vectors, "ax", %progbits
 __vectors_start:
-   W(b)vector_rst + stubs_offset
-   W(b)vector_und + stubs_offset
-   W(ldr)  pc, .LCvswi + stubs_offset
-   W(b)vector_pabt + stubs_offset
-   W(b)vector_dabt + stubs_offset
-   W(b)vector_addrexcptn + stubs_offset
-   W(b)vector_irq + stubs_offset
-   W(b)vector_fiq + stubs_offset
-
-   .globl  __vectors_end
-__vectors_end:
+   W(b)vector_rst
+   W(b)vector_und
+   W(ldr)  pc, __vectors_start + 0x1000
+   W(b)vector_pabt
+   W(b)vector_dabt
+   W(b)vector_addrexcptn
+   W(b)vector_irq
+   W(b)vector_fiq
 
.data
 
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -152,6 +152,23 @@ SECTIONS
. = ALIGN(PAGE_SIZE);
__init_begin = .;
 #endif
+   /*
+* The vectors and stubs are relocatable code, and the
+* only thing that matters is their relative offsets
+*/
+   __vectors_start = .;
+   .vectors 0 : AT(__vectors_start) {
+   *(.vectors)
+   }
+   . = __vectors_start + SIZEOF(.vectors);
+   __vectors_end = .;
+
+   __stubs_start = .;
+   .stubs 0x1000 : AT(__stubs_start) {
+   *(.stubs)
+   }
+   . = __stubs_start + SIZEOF(.stubs);
+   __stubs_end = .;
 
INIT_TEXT_SECTION(8)
.exit.text : {


--
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/


[ 006/102] ARM: allow kuser helpers to be removed from the vector page

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

--

From: Russell King 

commit f6f91b0d9fd971c630cef908dde8fe8795aefbf8 upstream.

Provide a kernel configuration option to allow the kernel user helpers
to be removed from the vector page, thereby preventing their use with
ROP (return orientated programming) attacks.  This option is only
visible for CPU architectures which natively support all the operations
which kernel user helpers would normally provide, and must be enabled
with caution.

Acked-by: Nicolas Pitre 
Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/kernel/entry-armv.S |3 +++
 arch/arm/kernel/traps.c  |   23 ++-
 arch/arm/mm/Kconfig  |   34 ++
 3 files changed, 51 insertions(+), 9 deletions(-)

--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -752,6 +752,7 @@ ENDPROC(__switch_to)
.endr
.endm
 
+#ifdef CONFIG_KUSER_HELPERS
.align  5
.globl  __kuser_helper_start
 __kuser_helper_start:
@@ -938,6 +939,8 @@ __kuser_helper_version: @ 
0x0ffc
.globl  __kuser_helper_end
 __kuser_helper_end:
 
+#endif
+
  THUMB(.thumb  )
 
 /*
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -800,23 +800,32 @@ void __init trap_init(void)
return;
 }
 
-static void __init kuser_get_tls_init(unsigned long vectors)
+#ifdef CONFIG_KUSER_HELPERS
+static void __init kuser_init(void *vectors)
 {
+   extern char __kuser_helper_start[], __kuser_helper_end[];
+   int kuser_sz = __kuser_helper_end - __kuser_helper_start;
+
+   memcpy(vectors + 0x1000 - kuser_sz, __kuser_helper_start, kuser_sz);
+
/*
 * vectors + 0xfe0 = __kuser_get_tls
 * vectors + 0xfe8 = hardware TLS instruction at 0x0fe8
 */
if (tls_emu || has_tls_reg)
-   memcpy((void *)vectors + 0xfe0, (void *)vectors + 0xfe8, 4);
+   memcpy(vectors + 0xfe0, vectors + 0xfe8, 4);
+}
+#else
+static void __init kuser_init(void *vectors)
+{
 }
+#endif
 
 void __init early_trap_init(void *vectors_base)
 {
unsigned long vectors = (unsigned long)vectors_base;
extern char __stubs_start[], __stubs_end[];
extern char __vectors_start[], __vectors_end[];
-   extern char __kuser_helper_start[], __kuser_helper_end[];
-   int kuser_sz = __kuser_helper_end - __kuser_helper_start;
unsigned i;
 
vectors_page = vectors_base;
@@ -837,12 +846,8 @@ void __init early_trap_init(void *vector
 */
memcpy((void *)vectors, __vectors_start, __vectors_end - 
__vectors_start);
memcpy((void *)vectors + 0x1000, __stubs_start, __stubs_end - 
__stubs_start);
-   memcpy((void *)vectors + 0x1000 - kuser_sz, __kuser_helper_start, 
kuser_sz);
 
-   /*
-* Do processor specific fixups for the kuser helpers
-*/
-   kuser_get_tls_init(vectors);
+   kuser_init(vectors_base);
 
/*
 * Copy signal return handlers into the vector page, and
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -411,24 +411,28 @@ config CPU_32v3
select CPU_USE_DOMAINS if MMU
select NEEDS_SYSCALL_FOR_CMPXCHG if SMP
select TLS_REG_EMUL if SMP || !MMU
+   select NEED_KUSER_HELPERS
 
 config CPU_32v4
bool
select CPU_USE_DOMAINS if MMU
select NEEDS_SYSCALL_FOR_CMPXCHG if SMP
select TLS_REG_EMUL if SMP || !MMU
+   select NEED_KUSER_HELPERS
 
 config CPU_32v4T
bool
select CPU_USE_DOMAINS if MMU
select NEEDS_SYSCALL_FOR_CMPXCHG if SMP
select TLS_REG_EMUL if SMP || !MMU
+   select NEED_KUSER_HELPERS
 
 config CPU_32v5
bool
select CPU_USE_DOMAINS if MMU
select NEEDS_SYSCALL_FOR_CMPXCHG if SMP
select TLS_REG_EMUL if SMP || !MMU
+   select NEED_KUSER_HELPERS
 
 config CPU_32v6
bool
@@ -756,6 +760,7 @@ config CPU_BPREDICT_DISABLE
 
 config TLS_REG_EMUL
bool
+   select NEED_KUSER_HELPERS
help
  An SMP system using a pre-ARMv6 processor (there are apparently
  a few prototypes like that in existence) and therefore access to
@@ -763,11 +768,40 @@ config TLS_REG_EMUL
 
 config NEEDS_SYSCALL_FOR_CMPXCHG
bool
+   select NEED_KUSER_HELPERS
help
  SMP on a pre-ARMv6 processor?  Well OK then.
  Forget about fast user space cmpxchg support.
  It is just not possible.
 
+config NEED_KUSER_HELPERS
+   bool
+
+config KUSER_HELPERS
+   bool "Enable kuser helpers in vector page" if !NEED_KUSER_HELPERS
+   default y
+   help
+ Warning: disabling this option may break user programs.
+
+ Provide kuser helpers in the vector page.  The kernel provides
+ helper code to userspace in read only form at a fixed location
+ in the high vector page to 

[ 013/102] ARM: 7790/1: Fix deferred mm switch on VIVT processors

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

--

From: Catalin Marinas 

commit bdae73cd374e28db544fdd9b77de689a36e3c129 upstream.

As of commit b9d4d42ad9 (ARM: Remove __ARCH_WANT_INTERRUPTS_ON_CTXSW on
pre-ARMv6 CPUs), the mm switching on VIVT processors is done in the
finish_arch_post_lock_switch() function to avoid whole cache flushing
with interrupts disabled. The need for deferred mm switch is stored as a
thread flag (TIF_SWITCH_MM). However, with preemption enabled, we can
have another thread switch before finish_arch_post_lock_switch(). If the
new thread has the same mm as the previous 'next' thread, the scheduler
will not call switch_mm() and the TIF_SWITCH_MM flag won't be set for
the new thread.

This patch moves the switch pending flag to the mm_context_t structure
since this is specific to the mm rather than thread.

Signed-off-by: Catalin Marinas 
Reported-by: Marc Kleine-Budde 
Tested-by: Marc Kleine-Budde 
Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/include/asm/mmu.h |2 ++
 arch/arm/include/asm/mmu_context.h |   20 
 arch/arm/include/asm/thread_info.h |1 -
 3 files changed, 18 insertions(+), 5 deletions(-)

--- a/arch/arm/include/asm/mmu.h
+++ b/arch/arm/include/asm/mmu.h
@@ -6,6 +6,8 @@
 typedef struct {
 #ifdef CONFIG_CPU_HAS_ASID
atomic64_t  id;
+#else
+   int switch_pending;
 #endif
unsigned intvmalloc_seq;
unsigned long   sigpage;
--- a/arch/arm/include/asm/mmu_context.h
+++ b/arch/arm/include/asm/mmu_context.h
@@ -55,7 +55,7 @@ static inline void check_and_switch_cont
 * on non-ASID CPUs, the old mm will remain valid until the
 * finish_arch_post_lock_switch() call.
 */
-   set_ti_thread_flag(task_thread_info(tsk), TIF_SWITCH_MM);
+   mm->context.switch_pending = 1;
else
cpu_switch_mm(mm->pgd, mm);
 }
@@ -64,9 +64,21 @@ static inline void check_and_switch_cont
finish_arch_post_lock_switch
 static inline void finish_arch_post_lock_switch(void)
 {
-   if (test_and_clear_thread_flag(TIF_SWITCH_MM)) {
-   struct mm_struct *mm = current->mm;
-   cpu_switch_mm(mm->pgd, mm);
+   struct mm_struct *mm = current->mm;
+
+   if (mm && mm->context.switch_pending) {
+   /*
+* Preemption must be disabled during cpu_switch_mm() as we
+* have some stateful cache flush implementations. Check
+* switch_pending again in case we were preempted and the
+* switch to this mm was already done.
+*/
+   preempt_disable();
+   if (mm->context.switch_pending) {
+   mm->context.switch_pending = 0;
+   cpu_switch_mm(mm->pgd, mm);
+   }
+   preempt_enable_no_resched();
}
 }
 
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
@@ -156,7 +156,6 @@ extern int vfp_restore_user_hwstate(stru
 #define TIF_USING_IWMMXT   17
 #define TIF_MEMDIE 18  /* is terminating due to OOM killer */
 #define TIF_RESTORE_SIGMASK20
-#define TIF_SWITCH_MM  22  /* deferred switch_mm */
 
 #define _TIF_SIGPENDING(1 << TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED  (1 << TIF_NEED_RESCHED)


--
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/


[ 014/102] ARM: 7791/1: a.out: remove partial a.out support

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

--

From: Will Deacon 

commit acfdd4b1f7590d02e9bae3b73bdbbc4a31b05d38 upstream.

a.out support on ARM requires that argc, argv and envp are passed in
r0-r2 respectively, which requires hacking load_aout_binary to
prevent argc being clobbered by the return code. Whilst mainline kernels
do set the registers up in start_thread, the aout loader has never
carried the hack in mainline.

Initialising the registers in this way actually goes against the libc
expectations for ELF binaries, where argc, argv and envp are passed on
the stack, with r0 being used to hold a pointer to an exit function for
cleaning up after the dynamic linker if required. If the pointer is
NULL, then it is ignored. When execing an ELF binary, Linux currently
zeroes r0, then sets it to argc and then finally clobbers it with the
return value of the execve syscall, so we actually end up with:

r0 = 0
stack[0] = argc
r1 = stack[1] = argv
r2 = stack[2] = envp

libc treats r1 and r2 as undefined. The clobbering of r0 by sys_execve
works for user-spawned threads, but when executing an ELF binary from a
kernel thread (via call_usermodehelper), the execve is performed on the
ret_from_fork path, which restores r0 from the saved pt_regs, resulting
in argc being presented to the C library. This has horrible consequences
when the application exits, since we have an exit function registered
using argc, resulting in a jump to hyperspace.

This patch solves the problem by removing the partial a.out support from
arch/arm/ altogether.

Signed-off-by: Will Deacon 
Cc: Ashish Sangwan 
Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/Kconfig  |1 
 arch/arm/include/asm/a.out-core.h |   45 --
 arch/arm/include/asm/processor.h  |4 ---
 arch/arm/include/uapi/asm/Kbuild  |1 
 arch/arm/include/uapi/asm/a.out.h |   34 
 5 files changed, 85 deletions(-)

--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -19,7 +19,6 @@ config ARM
select GENERIC_STRNCPY_FROM_USER
select GENERIC_STRNLEN_USER
select HARDIRQS_SW_RESEND
-   select HAVE_AOUT
select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
select HAVE_ARCH_KGDB
select HAVE_ARCH_SECCOMP_FILTER
--- a/arch/arm/include/asm/a.out-core.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* a.out coredump register dumper
- *
- * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
- * Written by David Howells (dhowe...@redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public Licence
- * as published by the Free Software Foundation; either version
- * 2 of the Licence, or (at your option) any later version.
- */
-
-#ifndef _ASM_A_OUT_CORE_H
-#define _ASM_A_OUT_CORE_H
-
-#ifdef __KERNEL__
-
-#include 
-#include 
-
-/*
- * fill in the user structure for an a.out core dump
- */
-static inline void aout_dump_thread(struct pt_regs *regs, struct user *dump)
-{
-   struct task_struct *tsk = current;
-
-   dump->magic = CMAGIC;
-   dump->start_code = tsk->mm->start_code;
-   dump->start_stack = regs->ARM_sp & ~(PAGE_SIZE - 1);
-
-   dump->u_tsize = (tsk->mm->end_code - tsk->mm->start_code) >> PAGE_SHIFT;
-   dump->u_dsize = (tsk->mm->brk - tsk->mm->start_data + PAGE_SIZE - 1) >> 
PAGE_SHIFT;
-   dump->u_ssize = 0;
-
-   memset(dump->u_debugreg, 0, sizeof(dump->u_debugreg));
-
-   if (dump->start_stack < 0x0400)
-   dump->u_ssize = (0x0400 - dump->start_stack) >> PAGE_SHIFT;
-
-   dump->regs = *regs;
-   dump->u_fpvalid = dump_fpu (regs, >u_fp);
-}
-
-#endif /* __KERNEL__ */
-#endif /* _ASM_A_OUT_CORE_H */
--- a/arch/arm/include/asm/processor.h
+++ b/arch/arm/include/asm/processor.h
@@ -54,7 +54,6 @@ struct thread_struct {
 
 #define start_thread(regs,pc,sp)   \
 ({ \
-   unsigned long *stack = (unsigned long *)sp; \
memset(regs->uregs, 0, sizeof(regs->uregs));\
if (current->personality & ADDR_LIMIT_32BIT)\
regs->ARM_cpsr = USR_MODE;  \
@@ -65,9 +64,6 @@ struct thread_struct {
regs->ARM_cpsr |= PSR_ENDSTATE; \
regs->ARM_pc = pc & ~1; /* pc */\
regs->ARM_sp = sp;  /* sp */\
-   regs->ARM_r2 = stack[2];/* r2 (envp) */ \
-   regs->ARM_r1 = stack[1];/* r1 (argv) */ \
-   regs->ARM_r0 = stack[0];/* r0 (argc) */ \
nommu_start_thread(regs);   \
 })
 
--- 

[ 015/102] powerpc: VPHN topology change updates all siblings

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

--

From: Robert Jennings 

commit 3be7db6ab45b21345386d1a466da133b19cde5e4 upstream.

When an associativity level change is found for one thread, the
siblings threads need to be updated as well.  This is done today
for PRRN in stage_topology_update() but is missing for VPHN in
update_cpu_associativity_changes_mask().  This patch will correctly
update all thread siblings during a topology change.

Without this patch a topology update can result in a CPU in
init_sched_groups_power() getting stuck indefinitely in a loop.

This loop is built in build_sched_groups(). As a result of the thread
moving to a node separate from its siblings the struct sched_group will
have its next pointer set to point to itself rather than the sched_group
struct of the next thread.  This happens because we have a domain without
the SD_OVERLAP flag, which is correct, and a topology that doesn't conform
with reality (threads on the same core assigned to different numa nodes).
When this list is traversed by init_sched_groups_power() it will reach
the thread's sched_group structure and loop indefinitely; the cpu will
be stuck at this point.

The bug was exposed when VPHN was enabled in commit b7abef0 (v3.9).

Reported-by: Jan Stancek 
Signed-off-by: Robert Jennings 
Signed-off-by: Benjamin Herrenschmidt 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/powerpc/include/asm/smp.h |4 ++
 arch/powerpc/mm/numa.c |   59 ++---
 2 files changed, 48 insertions(+), 15 deletions(-)

--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -145,6 +145,10 @@ extern void __cpu_die(unsigned int cpu);
 #define smp_setup_cpu_maps()
 static inline void inhibit_secondary_onlining(void) {}
 static inline void uninhibit_secondary_onlining(void) {}
+static inline const struct cpumask *cpu_sibling_mask(int cpu)
+{
+   return cpumask_of(cpu);
+}
 
 #endif /* CONFIG_SMP */
 
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1319,7 +1320,8 @@ static int update_cpu_associativity_chan
}
}
if (changed) {
-   cpumask_set_cpu(cpu, changes);
+   cpumask_or(changes, changes, cpu_sibling_mask(cpu));
+   cpu = cpu_last_thread_sibling(cpu);
}
}
 
@@ -1427,7 +1429,7 @@ static int update_cpu_topology(void *dat
if (!data)
return -EINVAL;
 
-   cpu = get_cpu();
+   cpu = smp_processor_id();
 
for (update = data; update; update = update->next) {
if (cpu != update->cpu)
@@ -1447,12 +1449,12 @@ static int update_cpu_topology(void *dat
  */
 int arch_update_cpu_topology(void)
 {
-   unsigned int cpu, changed = 0;
+   unsigned int cpu, sibling, changed = 0;
struct topology_update_data *updates, *ud;
unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0};
cpumask_t updated_cpus;
struct device *dev;
-   int weight, i = 0;
+   int weight, new_nid, i = 0;
 
weight = cpumask_weight(_associativity_changes_mask);
if (!weight)
@@ -1465,19 +1467,46 @@ int arch_update_cpu_topology(void)
cpumask_clear(_cpus);
 
for_each_cpu(cpu, _associativity_changes_mask) {
-   ud = [i++];
-   ud->cpu = cpu;
-   vphn_get_associativity(cpu, associativity);
-   ud->new_nid = associativity_to_nid(associativity);
-
-   if (ud->new_nid < 0 || !node_online(ud->new_nid))
-   ud->new_nid = first_online_node;
+   /*
+* If siblings aren't flagged for changes, updates list
+* will be too short. Skip on this update and set for next
+* update.
+*/
+   if (!cpumask_subset(cpu_sibling_mask(cpu),
+   _associativity_changes_mask)) {
+   pr_info("Sibling bits not set for associativity "
+   "change, cpu%d\n", cpu);
+   cpumask_or(_associativity_changes_mask,
+   _associativity_changes_mask,
+   cpu_sibling_mask(cpu));
+   cpu = cpu_last_thread_sibling(cpu);
+   continue;
+   }
 
-   ud->old_nid = numa_cpu_lookup_table[cpu];
-   cpumask_set_cpu(cpu, _cpus);
+   /* Use associativity from first thread for all siblings */
+   vphn_get_associativity(cpu, associativity);
+   new_nid = associativity_to_nid(associativity);
+   if (new_nid < 0 || !node_online(new_nid))
+   new_nid = first_online_node;
+
+  

[ 016/102] parisc: agp/parisc-agp: allow binding of user memory to the AGP GART

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

--

From: Alex Ivanov 

commit 06f0cce43a32bd2357cea1d8733bba48693d556b upstream.

Allow binding of user memory to the AGP GART on systems with HP
Quicksilver AGP bus. This resolves 'bind memory failed' error seen in
dmesg:

 [29.365973] [TTM] AGP Bind memory failed.
 …
 [29.367030] [drm] Forcing AGP to PCI mode

The system doesn't more fail to bind the memory, and hence not falling
back to the PCI mode (if other failures aren't detected).

This is just a simple write down from the following patches:
agp/amd-k7: Allow binding user memory to the AGP GART
agp/hp-agp: Allow binding user memory to the AGP GART

Signed-off-by: Alex Ivanov 
Signed-off-by: Helge Deller 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/char/agp/parisc-agp.c |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/char/agp/parisc-agp.c
+++ b/drivers/char/agp/parisc-agp.c
@@ -129,7 +129,8 @@ parisc_agp_insert_memory(struct agp_memo
off_t j, io_pg_start;
int io_pg_count;
 
-   if (type != 0 || mem->type != 0) {
+   if (type != mem->type ||
+   agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type)) {
return -EINVAL;
}
 
@@ -175,7 +176,8 @@ parisc_agp_remove_memory(struct agp_memo
struct _parisc_agp_info *info = _agp_info;
int i, io_pg_start, io_pg_count;
 
-   if (type != 0 || mem->type != 0) {
+   if (type != mem->type ||
+   agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type)) {
return -EINVAL;
}
 


--
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/


[ 010/102] ARM: fix nommu builds with 48be69a02 (ARM: move signal handlers into a vdso-like page)

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

--

From: Russell King 

commit 8c0cc8a5d90bc7373a7a9e7f7a40eb41f51e03fc upstream.

Olof reports that noMMU builds error out with:

arch/arm/kernel/signal.c: In function 'setup_return':
arch/arm/kernel/signal.c:413:25: error: 'mm_context_t' has no member named 
'sigpage'

This shows one of the evilnesses of IS_ENABLED().  Get rid of it here
and replace it with #ifdef's - and as no noMMU platform can make use
of sigpage, depend on CONIFG_MMU not CONFIG_ARM_MPU.

Reported-by: Olof Johansson 
Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/include/asm/elf.h |2 ++
 arch/arm/kernel/signal.c   |5 -
 2 files changed, 6 insertions(+), 1 deletion(-)

--- a/arch/arm/include/asm/elf.h
+++ b/arch/arm/include/asm/elf.h
@@ -130,8 +130,10 @@ struct mm_struct;
 extern unsigned long arch_randomize_brk(struct mm_struct *mm);
 #define arch_randomize_brk arch_randomize_brk
 
+#ifdef CONFIG_MMU
 #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
 struct linux_binprm;
 int arch_setup_additional_pages(struct linux_binprm *, int);
+#endif
 
 #endif
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -398,6 +398,7 @@ setup_return(struct pt_regs *regs, struc
__put_user(sigreturn_codes[idx+1], rc+1))
return 1;
 
+#ifdef CONFIG_MMU
if (cpsr & MODE32_BIT) {
struct mm_struct *mm = current->mm;
/*
@@ -407,7 +408,9 @@ setup_return(struct pt_regs *regs, struc
 */
retcode = mm->context.sigpage + signal_return_offset +
  (idx << 2) + thumb;
-   } else {
+   } else
+#endif
+   {
/*
 * Ensure that the instruction cache sees
 * the return code written onto the stack.


--
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/


[ 018/102] parisc: Fix interrupt routing for C8000 serial ports

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

--

From: Thomas Bogendoerfer 

commit dd5e6d6a3db09b16b7c222943977865eead88cc3 upstream.

We can't use dev->mod_index for selecting the interrupt routing entry,
because it's not an index into interrupt routing table. It will be even
wrong on a machine with 2 CPUs (4 cores). But all needed information is
contained in the PAT entries for the serial ports. mod[0] contains the
iosapic address and mod_info has some indications for the interrupt
input (at least it looks like it). This patch implements the searching
for the right iosapic and uses this interrupt input information.

Signed-off-by: Thomas Bogendoerfer 
Signed-off-by: Helge Deller 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/parisc/include/asm/parisc-device.h |3 ++
 arch/parisc/kernel/inventory.c  |1 
 drivers/parisc/iosapic.c|   38 ++--
 drivers/tty/serial/8250/8250_gsc.c  |3 --
 4 files changed, 32 insertions(+), 13 deletions(-)

--- a/arch/parisc/include/asm/parisc-device.h
+++ b/arch/parisc/include/asm/parisc-device.h
@@ -23,6 +23,7 @@ struct parisc_device {
/* generic info returned from pdc_pat_cell_module() */
unsigned long   mod_info;   /* PAT specific - Misc Module info */
unsigned long   pmod_loc;   /* physical Module location */
+   unsigned long   mod0;
 #endif
u64 dma_mask;   /* DMA mask for I/O */
struct device   dev;
@@ -61,4 +62,6 @@ parisc_get_drvdata(struct parisc_device
 
 extern struct bus_type parisc_bus_type;
 
+int iosapic_serial_irq(struct parisc_device *dev);
+
 #endif /*_ASM_PARISC_PARISC_DEVICE_H_*/
--- a/arch/parisc/kernel/inventory.c
+++ b/arch/parisc/kernel/inventory.c
@@ -211,6 +211,7 @@ pat_query_module(ulong pcell_loc, ulong
/* REVISIT: who is the consumer of this? not sure yet... */
dev->mod_info = pa_pdc_cell->mod_info;  /* pass to PAT_GET_ENTITY() */
dev->pmod_loc = pa_pdc_cell->mod_location;
+   dev->mod0 = pa_pdc_cell->mod[0];
 
register_parisc_device(dev);/* advertise device */
 
--- a/drivers/parisc/iosapic.c
+++ b/drivers/parisc/iosapic.c
@@ -811,18 +811,28 @@ int iosapic_fixup_irq(void *isi_obj, str
return pcidev->irq;
 }
 
-static struct iosapic_info *first_isi = NULL;
+static struct iosapic_info *iosapic_list;
 
 #ifdef CONFIG_64BIT
-int iosapic_serial_irq(int num)
+int iosapic_serial_irq(struct parisc_device *dev)
 {
-   struct iosapic_info *isi = first_isi;
-   struct irt_entry *irte = NULL;  /* only used if PAT PDC */
+   struct iosapic_info *isi;
+   struct irt_entry *irte;
struct vector_info *vi;
-   int isi_line;   /* line used by device */
+   int cnt;
+   int intin;
+
+   intin = (dev->mod_info >> 24) & 15;
 
/* lookup IRT entry for isi/slot/pin set */
-   irte = _cell[num];
+   for (cnt = 0; cnt < irt_num_entry; cnt++) {
+   irte = _cell[cnt];
+   if (COMPARE_IRTE_ADDR(irte, dev->mod0) &&
+   irte->dest_iosapic_intin == intin)
+   break;
+   }
+   if (cnt >= irt_num_entry)
+   return 0; /* no irq found, force polling */
 
DBG_IRT("iosapic_serial_irq(): irte %p %x %x %x %x %x %x %x %x\n",
irte,
@@ -834,11 +844,17 @@ int iosapic_serial_irq(int num)
irte->src_seg_id,
irte->dest_iosapic_intin,
(u32) irte->dest_iosapic_addr);
-   isi_line = irte->dest_iosapic_intin;
+
+   /* search for iosapic */
+   for (isi = iosapic_list; isi; isi = isi->isi_next)
+   if (isi->isi_hpa == dev->mod0)
+   break;
+   if (!isi)
+   return 0; /* no iosapic found, force polling */
 
/* get vector info for this input line */
-   vi = isi->isi_vector + isi_line;
-   DBG_IRT("iosapic_serial_irq:  line %d vi 0x%p\n", isi_line, vi);
+   vi = isi->isi_vector + intin;
+   DBG_IRT("iosapic_serial_irq:  line %d vi 0x%p\n", iosapic_intin, vi);
 
/* If this IRQ line has already been setup, skip it */
if (vi->irte)
@@ -941,8 +957,8 @@ void *iosapic_register(unsigned long hpa
vip->irqline = (unsigned char) cnt;
vip->iosapic = isi;
}
-   if (!first_isi)
-   first_isi = isi;
+   isi->isi_next = iosapic_list;
+   iosapic_list = isi;
return isi;
 }
 
--- a/drivers/tty/serial/8250/8250_gsc.c
+++ b/drivers/tty/serial/8250/8250_gsc.c
@@ -31,9 +31,8 @@ static int __init serial_init_chip(struc
int err;
 
 #ifdef CONFIG_64BIT
-   extern int iosapic_serial_irq(int cellnum);
if (!dev->irq && (dev->id.sversion == 0xad))
-   dev->irq = iosapic_serial_irq(dev->mod_index-1);
+   dev->irq = iosapic_serial_irq(dev);
 #endif
 
if (!dev->irq) {


--
To 

[ 019/102] hwmon: (max6697) fix MAX6581 ideality

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

--

From: Vivien Didelot 

commit 5c52add19733eb36d8619713312f5604efef3502 upstream.

Without this patch, the values for ideality (register 0x4b) and ideality
selection mask (register 0x4c) are inverted.

Signed-off-by: Vivien Didelot 
Signed-off-by: Guenter Roeck 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/hwmon/max6697.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/hwmon/max6697.c
+++ b/drivers/hwmon/max6697.c
@@ -605,12 +605,12 @@ static int max6697_init_chip(struct i2c_
if (ret < 0)
return ret;
ret = i2c_smbus_write_byte_data(client, MAX6581_REG_IDEALITY,
-   pdata->ideality_mask >> 1);
+   pdata->ideality_value);
if (ret < 0)
return ret;
ret = i2c_smbus_write_byte_data(client,
MAX6581_REG_IDEALITY_SELECT,
-   pdata->ideality_value);
+   pdata->ideality_mask >> 1);
if (ret < 0)
return ret;
}


--
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/


[ 009/102] ARM: fix a cockup in 48be69a02 (ARM: move signal handlers into a vdso-like page)

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

--

From: Russell King 

commit e0d407564b532d978b03ceccebd224a05d02f111 upstream.

Unfortunately, I never committed the fix to a nasty oops which can
occur as a result of that commit:

[ cut here ]
kernel BUG at /home/olof/work/batch/include/linux/mm.h:414!
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 0 PID: 490 Comm: killall5 Not tainted 3.11.0-rc3-00288-gabe0308 #53
task: e90acac0 ti: e9be8000 task.ti: e9be8000
PC is at special_mapping_fault+0xa4/0xc4
LR is at __do_fault+0x68/0x48c

This doesn't show up unless you do quite a bit of testing; a simple
boot test does not do this, so all my nightly tests were passing fine.

The reason for this is that install_special_mapping() expects the
page array to stick around, and as this was only inserting one page
which was stored on the kernel stack, that's why this was blowing up.

Reported-by: Olof Johansson 
Tested-by: Olof Johansson 
Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/kernel/process.c |9 +
 arch/arm/kernel/signal.c  |   41 +++--
 2 files changed, 24 insertions(+), 26 deletions(-)

--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -478,17 +478,18 @@ const char *arch_vma_name(struct vm_area
 "[sigpage]" : NULL;
 }
 
+static struct page *signal_page;
 extern struct page *get_signal_page(void);
 
 int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 {
struct mm_struct *mm = current->mm;
-   struct page *page;
unsigned long addr;
int ret;
 
-   page = get_signal_page();
-   if (!page)
+   if (!signal_page)
+   signal_page = get_signal_page();
+   if (!signal_page)
return -ENOMEM;
 
down_write(>mmap_sem);
@@ -500,7 +501,7 @@ int arch_setup_additional_pages(struct l
 
ret = install_special_mapping(mm, addr, PAGE_SIZE,
VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC,
-   );
+   _page);
 
if (ret == 0)
mm->context.sigpage = addr;
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -609,35 +609,32 @@ do_work_pending(struct pt_regs *regs, un
return 0;
 }
 
-static struct page *signal_page;
-
 struct page *get_signal_page(void)
 {
-   if (!signal_page) {
-   unsigned long ptr;
-   unsigned offset;
-   void *addr;
+   unsigned long ptr;
+   unsigned offset;
+   struct page *page;
+   void *addr;
 
-   signal_page = alloc_pages(GFP_KERNEL, 0);
+   page = alloc_pages(GFP_KERNEL, 0);
 
-   if (!signal_page)
-   return NULL;
+   if (!page)
+   return NULL;
 
-   addr = page_address(signal_page);
+   addr = page_address(page);
 
-   /* Give the signal return code some randomness */
-   offset = 0x200 + (get_random_int() & 0x7fc);
-   signal_return_offset = offset;
+   /* Give the signal return code some randomness */
+   offset = 0x200 + (get_random_int() & 0x7fc);
+   signal_return_offset = offset;
 
-   /*
-* Copy signal return handlers into the vector page, and
-* set sigreturn to be a pointer to these.
-*/
-   memcpy(addr + offset, sigreturn_codes, sizeof(sigreturn_codes));
+   /*
+* Copy signal return handlers into the vector page, and
+* set sigreturn to be a pointer to these.
+*/
+   memcpy(addr + offset, sigreturn_codes, sizeof(sigreturn_codes));
 
-   ptr = (unsigned long)addr + offset;
-   flush_icache_range(ptr, ptr + sizeof(sigreturn_codes));
-   }
+   ptr = (unsigned long)addr + offset;
+   flush_icache_range(ptr, ptr + sizeof(sigreturn_codes));
 
-   return signal_page;
+   return page;
 }


--
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/


[ 023/102] serial: arc_uart: Fix module alias

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

--

From: Axel Lin 

commit d5a12ea7a9e58d9e5c19d25cb668aadb396423ec upstream.

Platform drivers use "platform:" prefix in module alias.
Also use DRIVER_NAME in MODULE_ALIAS to make module autoloading work.

Signed-off-by: Axel Lin 
Acked-by: Vineet Gupta 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/tty/serial/arc_uart.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/tty/serial/arc_uart.c
+++ b/drivers/tty/serial/arc_uart.c
@@ -773,6 +773,6 @@ module_init(arc_serial_init);
 module_exit(arc_serial_exit);
 
 MODULE_LICENSE("GPL");
-MODULE_ALIAS("plat-arcfpga/uart");
+MODULE_ALIAS("platform:" DRIVER_NAME);
 MODULE_AUTHOR("Vineet Gupta");
 MODULE_DESCRIPTION("ARC(Synopsys) On-Chip(fpga) serial driver");


--
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/


[ 012/102] ARM: 7784/1: mm: ensure SMP alternates assemble to exactly 4 bytes with Thumb-2

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

--

From: Will Deacon 

commit bf3f0f332f76a85ff3a0b393aaded5a8533769c0 upstream.

Commit ae8a8b9553bd ("ARM: 7691/1: mm: kill unused TLB_CAN_READ_FROM_L1_CACHE
and use ALT_SMP instead") added early function returns for page table
cache flushing operations on ARMv7 SMP CPUs.

Unfortunately, when targetting Thumb-2, these `mov pc, lr' sequences
assemble to 2 bytes which can lead to corruption of the instruction
stream after code patching.

This patch fixes the alternates to use wide (32-bit) instructions for
Thumb-2, therefore ensuring that the patching code works correctly.

Signed-off-by: Will Deacon 
Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/mm/proc-v7-2level.S |2 +-
 arch/arm/mm/proc-v7-3level.S |2 +-
 arch/arm/mm/proc-v7.S|   11 ++-
 3 files changed, 8 insertions(+), 7 deletions(-)

--- a/arch/arm/mm/proc-v7-2level.S
+++ b/arch/arm/mm/proc-v7-2level.S
@@ -110,7 +110,7 @@ ENTRY(cpu_v7_set_pte_ext)
  ARM(  str r3, [r0, #2048]! )
  THUMB(add r0, r0, #2048 )
  THUMB(str r3, [r0] )
-   ALT_SMP(mov pc,lr)
+   ALT_SMP(W(nop))
ALT_UP (mcr p15, 0, r0, c7, c10, 1) @ flush_pte
 #endif
mov pc, lr
--- a/arch/arm/mm/proc-v7-3level.S
+++ b/arch/arm/mm/proc-v7-3level.S
@@ -73,7 +73,7 @@ ENTRY(cpu_v7_set_pte_ext)
tst r3, #1 << (55 - 32) @ L_PTE_DIRTY
orreq   r2, #L_PTE_RDONLY
 1: strdr2, r3, [r0]
-   ALT_SMP(mov pc, lr)
+   ALT_SMP(W(nop))
ALT_UP (mcr p15, 0, r0, c7, c10, 1) @ flush_pte
 #endif
mov pc, lr
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -75,13 +75,14 @@ ENTRY(cpu_v7_do_idle)
 ENDPROC(cpu_v7_do_idle)
 
 ENTRY(cpu_v7_dcache_clean_area)
-   ALT_SMP(mov pc, lr) @ MP extensions imply L1 PTW
-   ALT_UP(W(nop))
-   dcache_line_size r2, r3
-1: mcr p15, 0, r0, c7, c10, 1  @ clean D entry
+   ALT_SMP(W(nop)) @ MP extensions imply L1 PTW
+   ALT_UP_B(1f)
+   mov pc, lr
+1: dcache_line_size r2, r3
+2: mcr p15, 0, r0, c7, c10, 1  @ clean D entry
add r0, r0, r2
subsr1, r1, r2
-   bhi 1b
+   bhi 2b
dsb
mov pc, lr
 ENDPROC(cpu_v7_dcache_clean_area)


--
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/


[ 021/102] ALSA: compress: fix the return value for SNDRV_COMPRESS_VERSION

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

--

From: Vinod Koul 

commit a8d30608eaed6cc759b8e2e8a842591f797f upstream.

the return value of SNDRV_COMPRESS_VERSION always return default -ENOTTY as the
return value was never updated for this call
assign return value from put_user()

Reported-by: Haynes 
Signed-off-by: Vinod Koul 
Signed-off-by: Takashi Iwai 
Signed-off-by: Greg Kroah-Hartman 

---
 sound/core/compress_offload.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -743,7 +743,7 @@ static long snd_compr_ioctl(struct file
mutex_lock(>device->lock);
switch (_IOC_NR(cmd)) {
case _IOC_NR(SNDRV_COMPRESS_IOCTL_VERSION):
-   put_user(SNDRV_COMPRESS_VERSION,
+   retval = put_user(SNDRV_COMPRESS_VERSION,
(int __user *)arg) ? -EFAULT : 0;
break;
case _IOC_NR(SNDRV_COMPRESS_GET_CAPS):


--
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/


[ 020/102] ALSA: hda - Fix missing fixup for Mac Mini with STAC9221

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

--

From: Takashi Iwai 

commit 697aebab78a88c6b164cfb74d19b86817d2ccd82 upstream.

A fixup for Apple Mac Mini was lost during the adaption to the generic
parser because the fallback for the generic ID 8384:7680 was dropped,
and it resulted in the silence output (and maybe other problems).

Unfortunately, just adding the missing subsystem ID wasn't enough, in
this case.  The subsystem ID of this machine is :0100 (what Apple
thought...?), and since snd_hda_pick_fixup() doesn't take the vendor
id zero into account, the driver ignored this entry.  Now it's fixed
to regard the vendor id zero as a valid value.

Reported-and-tested-by: Linus Torvalds 
Signed-off-by: Takashi Iwai 
Signed-off-by: Greg Kroah-Hartman 

---
 sound/pci/hda/hda_auto_parser.c |2 +-
 sound/pci/hda/patch_sigmatel.c  |1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

--- a/sound/pci/hda/hda_auto_parser.c
+++ b/sound/pci/hda/hda_auto_parser.c
@@ -860,7 +860,7 @@ void snd_hda_pick_fixup(struct hda_codec
}
}
if (id < 0 && quirk) {
-   for (q = quirk; q->subvendor; q++) {
+   for (q = quirk; q->subvendor || q->subdevice; q++) {
unsigned int vendorid =
q->subdevice | (q->subvendor << 16);
unsigned int mask = 0x | q->subdevice_mask;
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -2815,6 +2815,7 @@ static const struct hda_pintbl ecs202_pi
 
 /* codec SSIDs for Intel Mac sharing the same PCI SSID 8384:7680 */
 static const struct snd_pci_quirk stac922x_intel_mac_fixup_tbl[] = {
+   SND_PCI_QUIRK(0x, 0x0100, "Mac Mini", STAC_INTEL_MAC_V3),
SND_PCI_QUIRK(0x106b, 0x0800, "Mac", STAC_INTEL_MAC_V1),
SND_PCI_QUIRK(0x106b, 0x0600, "Mac", STAC_INTEL_MAC_V2),
SND_PCI_QUIRK(0x106b, 0x0700, "Mac", STAC_INTEL_MAC_V2),


--
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/


[ 017/102] parisc: Fix cache routines to ignore vmas with an invalid pfn

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

--

From: John David Anglin 

commit 50861f5a02dbf939c27d35a26c472885e2844188 upstream.

The parisc architecture does not have a pte special bit. As a result,
special mappings are handled with the VM_PFNMAP and VM_MIXEDMAP flags.
VM_MIXEDMAP mappings may or may not have a "struct page" backing. When
pfn_valid() is false, there is no "struct page" backing. Otherwise, they
are treated as normal pages.

The FireGL driver uses the VM_MIXEDMAP without a backing "struct page".
This treatment caused a panic due to a TLB data miss in
update_mmu_cache. This appeared to be in the code generated for
page_address(). We were in fact using a very circular bit of code to
determine the physical address of the PFN in various cache routines.
This wasn't valid when there was no "struct page" backing.  The needed
address can in fact be determined simply from the PFN itself without
using the "struct page".

The attached patch updates update_mmu_cache(), flush_cache_mm(),
flush_cache_range() and flush_cache_page() to check pfn_valid() and to
directly compute the PFN physical and virtual addresses.

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

---
 arch/parisc/kernel/cache.c |  133 +++--
 1 file changed, 70 insertions(+), 63 deletions(-)

--- a/arch/parisc/kernel/cache.c
+++ b/arch/parisc/kernel/cache.c
@@ -71,18 +71,27 @@ flush_cache_all_local(void)
 }
 EXPORT_SYMBOL(flush_cache_all_local);
 
+/* Virtual address of pfn.  */
+#define pfn_va(pfn)__va(PFN_PHYS(pfn))
+
 void
 update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t 
*ptep)
 {
-   struct page *page = pte_page(*ptep);
+   unsigned long pfn = pte_pfn(*ptep);
+   struct page *page;
 
-   if (pfn_valid(page_to_pfn(page)) && page_mapping(page) &&
-   test_bit(PG_dcache_dirty, >flags)) {
+   /* We don't have pte special.  As a result, we can be called with
+  an invalid pfn and we don't need to flush the kernel dcache page.
+  This occurs with FireGL card in C8000.  */
+   if (!pfn_valid(pfn))
+   return;
 
-   flush_kernel_dcache_page(page);
+   page = pfn_to_page(pfn);
+   if (page_mapping(page) && test_bit(PG_dcache_dirty, >flags)) {
+   flush_kernel_dcache_page_addr(pfn_va(pfn));
clear_bit(PG_dcache_dirty, >flags);
} else if (parisc_requires_coherency())
-   flush_kernel_dcache_page(page);
+   flush_kernel_dcache_page_addr(pfn_va(pfn));
 }
 
 void
@@ -495,44 +504,42 @@ static inline pte_t *get_ptep(pgd_t *pgd
 
 void flush_cache_mm(struct mm_struct *mm)
 {
+   struct vm_area_struct *vma;
+   pgd_t *pgd;
+
/* Flushing the whole cache on each cpu takes forever on
   rp3440, etc.  So, avoid it if the mm isn't too big.  */
-   if (mm_total_size(mm) < parisc_cache_flush_threshold) {
-   struct vm_area_struct *vma;
-
-   if (mm->context == mfsp(3)) {
-   for (vma = mm->mmap; vma; vma = vma->vm_next) {
-   flush_user_dcache_range_asm(vma->vm_start,
-   vma->vm_end);
-   if (vma->vm_flags & VM_EXEC)
-   flush_user_icache_range_asm(
- vma->vm_start, vma->vm_end);
-   }
-   } else {
-   pgd_t *pgd = mm->pgd;
-
-   for (vma = mm->mmap; vma; vma = vma->vm_next) {
-   unsigned long addr;
+   if (mm_total_size(mm) >= parisc_cache_flush_threshold) {
+   flush_cache_all();
+   return;
+   }
 
-   for (addr = vma->vm_start; addr < vma->vm_end;
-addr += PAGE_SIZE) {
-   pte_t *ptep = get_ptep(pgd, addr);
-   if (ptep != NULL) {
-   pte_t pte = *ptep;
-   __flush_cache_page(vma, addr,
- page_to_phys(pte_page(pte)));
-   }
-   }
-   }
+   if (mm->context == mfsp(3)) {
+   for (vma = mm->mmap; vma; vma = vma->vm_next) {
+   flush_user_dcache_range_asm(vma->vm_start, vma->vm_end);
+   if ((vma->vm_flags & VM_EXEC) == 0)
+   continue;
+   flush_user_icache_range_asm(vma->vm_start, vma->vm_end);
}
return;
}
 
-#ifdef CONFIG_SMP
-   flush_cache_all();
-#else
-   flush_cache_all_local();

[ 028/102] USB: mos7840: fix race in led handling

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

--

From: Johan Hovold 

commit 05cf0dec5ccc696a7636c84b265b477173498156 upstream.

Fix race in LED handling introduced by commit 0eafe4de ("USB: serial:
mos7840: add support for MCS7810 devices") which reused the port control
urb for manipulating the LED without making sure that the urb is not
already in use. This could lead to the control urb being manipulated
while in flight.

Fix by adding a dedicated LED urb and ctrlrequest along with a LED-busy
flag to handle concurrency.

Signed-off-by: Johan Hovold 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/usb/serial/mos7840.c |   59 ++-
 1 file changed, 37 insertions(+), 22 deletions(-)

--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -185,6 +185,7 @@
 
 enum mos7840_flag {
MOS7840_FLAG_CTRL_BUSY,
+   MOS7840_FLAG_LED_BUSY,
 };
 
 static const struct usb_device_id id_table[] = {
@@ -240,9 +241,10 @@ struct moschip_port {
 
/* For device(s) with LED indicator */
bool has_led;
-   bool led_flag;
struct timer_list led_timer1;   /* Timer for LED on */
struct timer_list led_timer2;   /* Timer for LED off */
+   struct urb *led_urb;
+   struct usb_ctrlrequest *led_dr;
 
unsigned long flags;
 };
@@ -542,7 +544,7 @@ static void mos7840_set_led_async(struct
__u16 reg)
 {
struct usb_device *dev = mcs->port->serial->dev;
-   struct usb_ctrlrequest *dr = mcs->dr;
+   struct usb_ctrlrequest *dr = mcs->led_dr;
 
dr->bRequestType = MCS_WR_RTYPE;
dr->bRequest = MCS_WRREQ;
@@ -550,10 +552,10 @@ static void mos7840_set_led_async(struct
dr->wIndex = cpu_to_le16(reg);
dr->wLength = cpu_to_le16(0);
 
-   usb_fill_control_urb(mcs->control_urb, dev, usb_sndctrlpipe(dev, 0),
+   usb_fill_control_urb(mcs->led_urb, dev, usb_sndctrlpipe(dev, 0),
(unsigned char *)dr, NULL, 0, mos7840_set_led_callback, NULL);
 
-   usb_submit_urb(mcs->control_urb, GFP_ATOMIC);
+   usb_submit_urb(mcs->led_urb, GFP_ATOMIC);
 }
 
 static void mos7840_set_led_sync(struct usb_serial_port *port, __u16 reg,
@@ -579,7 +581,19 @@ static void mos7840_led_flag_off(unsigne
 {
struct moschip_port *mcs = (struct moschip_port *) arg;
 
-   mcs->led_flag = false;
+   clear_bit_unlock(MOS7840_FLAG_LED_BUSY, >flags);
+}
+
+static void mos7840_led_activity(struct usb_serial_port *port)
+{
+   struct moschip_port *mos7840_port = usb_get_serial_port_data(port);
+
+   if (test_and_set_bit_lock(MOS7840_FLAG_LED_BUSY, _port->flags))
+   return;
+
+   mos7840_set_led_async(mos7840_port, 0x0301, MODEM_CONTROL_REGISTER);
+   mod_timer(_port->led_timer1,
+   jiffies + msecs_to_jiffies(LED_ON_MS));
 }
 
 /*
@@ -779,14 +793,8 @@ static void mos7840_bulk_in_callback(str
return;
}
 
-   /* Turn on LED */
-   if (mos7840_port->has_led && !mos7840_port->led_flag) {
-   mos7840_port->led_flag = true;
-   mos7840_set_led_async(mos7840_port, 0x0301,
-   MODEM_CONTROL_REGISTER);
-   mod_timer(_port->led_timer1,
-   jiffies + msecs_to_jiffies(LED_ON_MS));
-   }
+   if (mos7840_port->has_led)
+   mos7840_led_activity(port);
 
mos7840_port->read_urb_busy = true;
retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC);
@@ -1467,13 +1475,8 @@ static int mos7840_write(struct tty_stru
data1 = urb->transfer_buffer;
dev_dbg(>dev, "bulkout endpoint is %d\n", 
port->bulk_out_endpointAddress);
 
-   /* Turn on LED */
-   if (mos7840_port->has_led && !mos7840_port->led_flag) {
-   mos7840_port->led_flag = true;
-   mos7840_set_led_sync(port, MODEM_CONTROL_REGISTER, 0x0301);
-   mod_timer(_port->led_timer1,
-   jiffies + msecs_to_jiffies(LED_ON_MS));
-   }
+   if (mos7840_port->has_led)
+   mos7840_led_activity(port);
 
/* send it down the pipe */
status = usb_submit_urb(urb, GFP_ATOMIC);
@@ -2429,6 +2432,14 @@ static int mos7840_port_probe(struct usb
if (device_type == MOSCHIP_DEVICE_ID_7810) {
mos7840_port->has_led = true;
 
+   mos7840_port->led_urb = usb_alloc_urb(0, GFP_KERNEL);
+   mos7840_port->led_dr = kmalloc(sizeof(*mos7840_port->led_dr),
+   GFP_KERNEL);
+   if (!mos7840_port->led_urb || !mos7840_port->led_dr) {
+   status = -ENOMEM;
+   goto error;
+   }
+
init_timer(_port->led_timer1);
 

[ 027/102] USB: mos7840: fix device-type detection

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

--

From: Johan Hovold 

commit 40c24f2893ba0ba7df485871f6aac0c197ceef5b upstream.

Fix race in device-type detection introduced by commit 0eafe4de ("USB:
serial: mos7840: add support for MCS7810 devices") which used a static
variable to hold the device type.

Move type detection to probe and use serial data to store the device
type.

Signed-off-by: Johan Hovold 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/usb/serial/mos7840.c |   75 ---
 1 file changed, 35 insertions(+), 40 deletions(-)

--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -187,8 +187,6 @@ enum mos7840_flag {
MOS7840_FLAG_CTRL_BUSY,
 };
 
-static int device_type;
-
 static const struct usb_device_id id_table[] = {
{USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)},
{USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)},
@@ -839,18 +837,6 @@ static void mos7840_bulk_out_data_callba
 //
 /*   D R I V E R  T T Y  I N T E R F A C E  F U N C T I O N S   */
 //
-#ifdef MCSSerialProbe
-static int mos7840_serial_probe(struct usb_serial *serial,
-   const struct usb_device_id *id)
-{
-
-   /*need to implement the mode_reg reading and updating\
-  structures usb_serial_ device_type\
-  (i.e num_ports, num_bulkin,bulkout etc) */
-   /* Also we can update the changes  attach */
-   return 1;
-}
-#endif
 
 /*
  * mos7840_open
@@ -2216,38 +2202,48 @@ static int mos7810_check(struct usb_seri
return 0;
 }
 
-static int mos7840_calc_num_ports(struct usb_serial *serial)
+static int mos7840_probe(struct usb_serial *serial,
+   const struct usb_device_id *id)
 {
-   __u16 data = 0x00;
+   u16 product = serial->dev->descriptor.idProduct;
u8 *buf;
-   int mos7840_num_ports;
+   int device_type;
+
+   if (product == MOSCHIP_DEVICE_ID_7810 ||
+   product == MOSCHIP_DEVICE_ID_7820) {
+   device_type = product;
+   goto out;
+   }
 
buf = kzalloc(VENDOR_READ_LENGTH, GFP_KERNEL);
-   if (buf) {
-   usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
+   if (!buf)
+   return -ENOMEM;
+
+   usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, buf,
VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT);
-   data = *buf;
-   kfree(buf);
-   }
 
-   if (serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7810 ||
-   serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7820) {
-   device_type = serial->dev->descriptor.idProduct;
-   } else {
-   /* For a MCS7840 device GPIO0 must be set to 1 */
-   if ((data & 0x01) == 1)
-   device_type = MOSCHIP_DEVICE_ID_7840;
-   else if (mos7810_check(serial))
-   device_type = MOSCHIP_DEVICE_ID_7810;
-   else
-   device_type = MOSCHIP_DEVICE_ID_7820;
-   }
+   /* For a MCS7840 device GPIO0 must be set to 1 */
+   if (buf[0] & 0x01)
+   device_type = MOSCHIP_DEVICE_ID_7840;
+   else if (mos7810_check(serial))
+   device_type = MOSCHIP_DEVICE_ID_7810;
+   else
+   device_type = MOSCHIP_DEVICE_ID_7820;
+
+   kfree(buf);
+out:
+   usb_set_serial_data(serial, (void *)device_type);
+
+   return 0;
+}
+
+static int mos7840_calc_num_ports(struct usb_serial *serial)
+{
+   int device_type = (int)usb_get_serial_data(serial);
+   int mos7840_num_ports;
 
mos7840_num_ports = (device_type >> 4) & 0x000F;
-   serial->num_bulk_in = mos7840_num_ports;
-   serial->num_bulk_out = mos7840_num_ports;
-   serial->num_ports = mos7840_num_ports;
 
return mos7840_num_ports;
 }
@@ -2255,6 +2251,7 @@ static int mos7840_calc_num_ports(struct
 static int mos7840_port_probe(struct usb_serial_port *port)
 {
struct usb_serial *serial = port->serial;
+   int device_type = (int)usb_get_serial_data(serial);
struct moschip_port *mos7840_port;
int status;
int pnum;
@@ -2513,9 +2510,7 @@ static struct usb_serial_driver moschip7
.throttle = mos7840_throttle,
.unthrottle = mos7840_unthrottle,
.calc_num_ports = mos7840_calc_num_ports,
-#ifdef MCSSerialProbe
-   .probe = mos7840_serial_probe,
-#endif
+   .probe = mos7840_probe,
.ioctl = mos7840_ioctl,
.set_termios = mos7840_set_termios,
.break_ctl = 

[ 024/102] serial/mxs-auart: increase time to wait for transmitter to become idle

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

--

From: Uwe Kleine-König 

commit 079a036f4283e2b0e5c26080b8c5112bc0cc1831 upstream.

Without this patch the driver waits ~1 ms for the UART to become idle. At
115200n8 this time is (theoretically) enough to transfer 11.5 characters
(= 115200 bits/s / (10 Bits/char) * 1ms). As the mxs-auart has a fifo size
of 16 characters the clock is gated too early. The problem is worse for
lower baud rates.

This only happens to really shut down the transmitter in the middle of a
transfer if /dev/ttyAPPx isn't opened in userspace (e.g. by a getty) but
was at least once (because the bootloader doesn't disable the transmitter).

So increase the timeout to 20 ms which should be enough for 9600n8, too.
Moreover skip gating the clock if the timeout is elapsed.

Signed-off-by: Uwe Kleine-König 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/tty/serial/mxs-auart.c |   21 +
 1 file changed, 13 insertions(+), 8 deletions(-)

--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -851,7 +851,7 @@ auart_console_write(struct console *co,
struct mxs_auart_port *s;
struct uart_port *port;
unsigned int old_ctrl0, old_ctrl2;
-   unsigned int to = 1000;
+   unsigned int to = 2;
 
if (co->index >= MXS_AUART_PORTS || co->index < 0)
return;
@@ -872,18 +872,23 @@ auart_console_write(struct console *co,
 
uart_console_write(port, str, count, mxs_auart_console_putchar);
 
-   /*
-* Finally, wait for transmitter to become empty
-* and restore the TCR
-*/
+   /* Finally, wait for transmitter to become empty ... */
while (readl(port->membase + AUART_STAT) & AUART_STAT_BUSY) {
+   udelay(1);
if (!to--)
break;
-   udelay(1);
}
 
-   writel(old_ctrl0, port->membase + AUART_CTRL0);
-   writel(old_ctrl2, port->membase + AUART_CTRL2);
+   /*
+* ... and restore the TCR if we waited long enough for the transmitter
+* to be idle. This might keep the transmitter enabled although it is
+* unused, but that is better than to disable it while it is still
+* transmitting.
+*/
+   if (!(readl(port->membase + AUART_STAT) & AUART_STAT_BUSY)) {
+   writel(old_ctrl0, port->membase + AUART_CTRL0);
+   writel(old_ctrl2, port->membase + AUART_CTRL2);
+   }
 
clk_disable(s->clk);
 }


--
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/


[ 025/102] dma: pl330: Fix cyclic transfers

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

--

From: Lars-Peter Clausen 

commit fc51446021f42aca8906e701fc2292965aafcb15 upstream.

Allocate a descriptor for each period of a cyclic transfer, not just the first.
Also since the callback needs to be called for each finished period make sure to
initialize the callback and callback_param fields of each descriptor in a cyclic
transfer.

Signed-off-by: Lars-Peter Clausen 
Signed-off-by: Vinod Koul 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/dma/pl330.c |   93 +---
 1 file changed, 67 insertions(+), 26 deletions(-)

--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -2527,6 +2527,10 @@ static dma_cookie_t pl330_tx_submit(stru
/* Assign cookies to all nodes */
while (!list_empty(>node)) {
desc = list_entry(last->node.next, struct dma_pl330_desc, node);
+   if (pch->cyclic) {
+   desc->txd.callback = last->txd.callback;
+   desc->txd.callback_param = last->txd.callback_param;
+   }
 
dma_cookie_assign(>txd);
 
@@ -2710,45 +2714,82 @@ static struct dma_async_tx_descriptor *p
size_t period_len, enum dma_transfer_direction direction,
unsigned long flags, void *context)
 {
-   struct dma_pl330_desc *desc;
+   struct dma_pl330_desc *desc = NULL, *first = NULL;
struct dma_pl330_chan *pch = to_pchan(chan);
+   struct dma_pl330_dmac *pdmac = pch->dmac;
+   unsigned int i;
dma_addr_t dst;
dma_addr_t src;
 
-   desc = pl330_get_desc(pch);
-   if (!desc) {
-   dev_err(pch->dmac->pif.dev, "%s:%d Unable to fetch desc\n",
-   __func__, __LINE__);
+   if (len % period_len != 0)
return NULL;
-   }
 
-   switch (direction) {
-   case DMA_MEM_TO_DEV:
-   desc->rqcfg.src_inc = 1;
-   desc->rqcfg.dst_inc = 0;
-   desc->req.rqtype = MEMTODEV;
-   src = dma_addr;
-   dst = pch->fifo_addr;
-   break;
-   case DMA_DEV_TO_MEM:
-   desc->rqcfg.src_inc = 0;
-   desc->rqcfg.dst_inc = 1;
-   desc->req.rqtype = DEVTOMEM;
-   src = pch->fifo_addr;
-   dst = dma_addr;
-   break;
-   default:
+   if (!is_slave_direction(direction)) {
dev_err(pch->dmac->pif.dev, "%s:%d Invalid dma direction\n",
__func__, __LINE__);
return NULL;
}
 
-   desc->rqcfg.brst_size = pch->burst_sz;
-   desc->rqcfg.brst_len = 1;
+   for (i = 0; i < len / period_len; i++) {
+   desc = pl330_get_desc(pch);
+   if (!desc) {
+   dev_err(pch->dmac->pif.dev, "%s:%d Unable to fetch 
desc\n",
+   __func__, __LINE__);
 
-   pch->cyclic = true;
+   if (!first)
+   return NULL;
+
+   spin_lock_irqsave(>pool_lock, flags);
+
+   while (!list_empty(>node)) {
+   desc = list_entry(first->node.next,
+   struct dma_pl330_desc, node);
+   list_move_tail(>node, >desc_pool);
+   }
+
+   list_move_tail(>node, >desc_pool);
+
+   spin_unlock_irqrestore(>pool_lock, flags);
+
+   return NULL;
+   }
+
+   switch (direction) {
+   case DMA_MEM_TO_DEV:
+   desc->rqcfg.src_inc = 1;
+   desc->rqcfg.dst_inc = 0;
+   desc->req.rqtype = MEMTODEV;
+   src = dma_addr;
+   dst = pch->fifo_addr;
+   break;
+   case DMA_DEV_TO_MEM:
+   desc->rqcfg.src_inc = 0;
+   desc->rqcfg.dst_inc = 1;
+   desc->req.rqtype = DEVTOMEM;
+   src = pch->fifo_addr;
+   dst = dma_addr;
+   break;
+   default:
+   break;
+   }
 
-   fill_px(>px, dst, src, period_len);
+   desc->rqcfg.brst_size = pch->burst_sz;
+   desc->rqcfg.brst_len = 1;
+   fill_px(>px, dst, src, period_len);
+
+   if (!first)
+   first = desc;
+   else
+   list_add_tail(>node, >node);
+
+   dma_addr += period_len;
+   }
+
+   if (!desc)
+   return NULL;
+
+   pch->cyclic = true;
+   desc->txd.flags = flags;
 
return >txd;
 }


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a 

[ 032/102] iwlwifi: mvm: refuse connection to APs with BI < 16

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

--

From: Johannes Berg 

commit 48bc13072109ea58465542aa1ee31b4e1065468a upstream.

Due to a firmware bug, it crashes when the beacon interval
is smaller than 16. Avoid this by refusing the station state
change creating the AP station, causing mac80211 to abandon
the attempt to connect to the AP, and eventually wpa_s to
blacklist it.

Reviewed-by: Emmanuel Grumbach 
Signed-off-by: Johannes Berg 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/iwlwifi/mvm/mac80211.c |   16 
 1 file changed, 16 insertions(+)

--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -987,6 +987,21 @@ static int iwl_mvm_mac_sta_state(struct
mutex_lock(>mutex);
if (old_state == IEEE80211_STA_NOTEXIST &&
new_state == IEEE80211_STA_NONE) {
+   /*
+* Firmware bug - it'll crash if the beacon interval is less
+* than 16. We can't avoid connecting at all, so refuse the
+* station state change, this will cause mac80211 to abandon
+* attempts to connect to this AP, and eventually wpa_s will
+* blacklist the AP...
+*/
+   if (vif->type == NL80211_IFTYPE_STATION &&
+   vif->bss_conf.beacon_int < 16) {
+   IWL_ERR(mvm,
+   "AP %pM beacon interval is %d, refusing due to 
firmware bug!\n",
+   sta->addr, vif->bss_conf.beacon_int);
+   ret = -EINVAL;
+   goto out_unlock;
+   }
ret = iwl_mvm_add_sta(mvm, vif, sta);
} else if (old_state == IEEE80211_STA_NONE &&
   new_state == IEEE80211_STA_AUTH) {
@@ -1015,6 +1030,7 @@ static int iwl_mvm_mac_sta_state(struct
} else {
ret = -EIO;
}
+ out_unlock:
mutex_unlock(>mutex);
 
return ret;


--
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/


[ 033/102] iwlwifi: add DELL SKU for 5150 HMC

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

--

From: Emmanuel Grumbach 

commit a1923f1d4723e5757cefdd60f7c7ab30e472007a upstream.

This SKU was missing in the list of supported devices

https://bugzilla.kernel.org/show_bug.cgi?id=60577

Signed-off-by: Emmanuel Grumbach 
Signed-off-by: Johannes Berg 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/iwlwifi/pcie/drv.c |1 +
 1 file changed, 1 insertion(+)

--- a/drivers/net/wireless/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/iwlwifi/pcie/drv.c
@@ -129,6 +129,7 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_ca
{IWL_PCI_DEVICE(0x423C, 0x1306, iwl5150_abg_cfg)}, /* Half Mini Card */
{IWL_PCI_DEVICE(0x423C, 0x1221, iwl5150_agn_cfg)}, /* Mini Card */
{IWL_PCI_DEVICE(0x423C, 0x1321, iwl5150_agn_cfg)}, /* Half Mini Card */
+   {IWL_PCI_DEVICE(0x423C, 0x1326, iwl5150_abg_cfg)}, /* Half Mini Card */
 
{IWL_PCI_DEVICE(0x423D, 0x1211, iwl5150_agn_cfg)}, /* Mini Card */
{IWL_PCI_DEVICE(0x423D, 0x1311, iwl5150_agn_cfg)}, /* Half Mini Card */


--
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/


[ 026/102] USB: mos7840: fix race in register handling

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

--

From: Johan Hovold 

commit d8a083cc746664916d9d36ed9e4d08a29525f245 upstream.

Fix race in mos7840_get_reg which unconditionally manipulated the
control urb (which may already be in use) by adding a control-urb busy
flag.

Signed-off-by: Johan Hovold 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/usb/serial/mos7840.c |   18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -183,6 +183,10 @@
 #define LED_ON_MS  500
 #define LED_OFF_MS 500
 
+enum mos7840_flag {
+   MOS7840_FLAG_CTRL_BUSY,
+};
+
 static int device_type;
 
 static const struct usb_device_id id_table[] = {
@@ -241,6 +245,8 @@ struct moschip_port {
bool led_flag;
struct timer_list led_timer1;   /* Timer for LED on */
struct timer_list led_timer2;   /* Timer for LED off */
+
+   unsigned long flags;
 };
 
 /*
@@ -467,10 +473,10 @@ static void mos7840_control_callback(str
case -ESHUTDOWN:
/* this urb is terminated, clean up */
dev_dbg(dev, "%s - urb shutting down with status: %d\n", 
__func__, status);
-   return;
+   goto out;
default:
dev_dbg(dev, "%s - nonzero urb status received: %d\n", 
__func__, status);
-   return;
+   goto out;
}
 
dev_dbg(dev, "%s urb buffer size is %d\n", __func__, 
urb->actual_length);
@@ -483,6 +489,8 @@ static void mos7840_control_callback(str
mos7840_handle_new_msr(mos7840_port, regval);
else if (mos7840_port->MsrLsr == 1)
mos7840_handle_new_lsr(mos7840_port, regval);
+out:
+   clear_bit_unlock(MOS7840_FLAG_CTRL_BUSY, _port->flags);
 }
 
 static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg,
@@ -493,6 +501,9 @@ static int mos7840_get_reg(struct moschi
unsigned char *buffer = mcs->ctrl_buf;
int ret;
 
+   if (test_and_set_bit_lock(MOS7840_FLAG_CTRL_BUSY, >flags))
+   return -EBUSY;
+
dr->bRequestType = MCS_RD_RTYPE;
dr->bRequest = MCS_RDREQ;
dr->wValue = cpu_to_le16(Wval); /* 0 */
@@ -504,6 +515,9 @@ static int mos7840_get_reg(struct moschi
 mos7840_control_callback, mcs);
mcs->control_urb->transfer_buffer_length = 2;
ret = usb_submit_urb(mcs->control_urb, GFP_ATOMIC);
+   if (ret)
+   clear_bit_unlock(MOS7840_FLAG_CTRL_BUSY, >flags);
+
return ret;
 }
 


--
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/


[ 036/102] ath9k_htc: reboot firmware if it was loaded

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

--

From: Oleksij Rempel 

commit 4928bd2ef8ece262f4f31463021a91eaa440 upstream.

Currently ath9k_htc will reboot firmware only if interface was
ever started. Which lead to the problem in case where interface
was never started but module need to be reloaded.

This patch will partially fix bug "ath9k_htc: Target is unresponsive"
https://github.com/qca/open-ath9k-htc-firmware/issues/1

Reproduction case:
- plug adapter
- make sure nothing will touch it. Stop Networkmanager or blacklist mac address 
of this adapter.
- rmmod ath9k_htc; sleep 1; modprobe ath9k_htc

Signed-off-by: Oleksij Rempel 
Signed-off-by: John W. Linville 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/ath/ath9k/hif_usb.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -1289,7 +1289,9 @@ static void ath9k_hif_usb_disconnect(str
 
usb_set_intfdata(interface, NULL);
 
-   if (!unplugged && (hif_dev->flags & HIF_USB_START))
+   /* If firmware was loaded we should drop it
+* go back to first stage bootloader. */
+   if (!unplugged && (hif_dev->flags & HIF_USB_READY))
ath9k_hif_usb_reboot(udev);
 
kfree(hif_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/


[ 029/102] USB: mos7840: fix pointer casts

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

--

From: Johan Hovold 

commit 683a0e4d7971c3186dc4d429027debfe309129aa upstream.

Silence compiler warnings on 64-bit systems introduced by commit
05cf0dec ("USB: mos7840: fix race in led handling") which uses the
usb-serial data pointer to temporarily store the device type during
probe but failed to add the required casts.

[gregkh - change uintptr_t to unsigned long]

Signed-off-by: Johan Hovold 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/usb/serial/mos7840.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -2236,14 +2236,14 @@ static int mos7840_probe(struct usb_seri
 
kfree(buf);
 out:
-   usb_set_serial_data(serial, (void *)device_type);
+   usb_set_serial_data(serial, (void *)(unsigned long)device_type);
 
return 0;
 }
 
 static int mos7840_calc_num_ports(struct usb_serial *serial)
 {
-   int device_type = (int)usb_get_serial_data(serial);
+   int device_type = (unsigned long)usb_get_serial_data(serial);
int mos7840_num_ports;
 
mos7840_num_ports = (device_type >> 4) & 0x000F;
@@ -2254,7 +2254,7 @@ static int mos7840_calc_num_ports(struct
 static int mos7840_port_probe(struct usb_serial_port *port)
 {
struct usb_serial *serial = port->serial;
-   int device_type = (int)usb_get_serial_data(serial);
+   int device_type = (unsigned long)usb_get_serial_data(serial);
struct moschip_port *mos7840_port;
int status;
int pnum;


--
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/


[ 031/102] iwlwifi: mvm: fix bug in scan ssid

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

--

From: David Spinadel 

commit fe04e83706037802c502ea41c0d1799ec35fc0d7 upstream.

Increment index in each iteration. Without this increment we are
overriding the added SSIDs and we will send only the last SSId
and (n_ssids - 1) broadcast probes.

Signed-off-by: David Spinadel 
Signed-off-by: Johannes Berg 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/iwlwifi/mvm/scan.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/net/wireless/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/iwlwifi/mvm/scan.c
@@ -137,8 +137,8 @@ static void iwl_mvm_scan_fill_ssids(stru
 {
int fw_idx, req_idx;
 
-   fw_idx = 0;
-   for (req_idx = req->n_ssids - 1; req_idx > 0; req_idx--) {
+   for (req_idx = req->n_ssids - 1, fw_idx = 0; req_idx > 0;
+req_idx--, fw_idx++) {
cmd->direct_scan[fw_idx].id = WLAN_EID_SSID;
cmd->direct_scan[fw_idx].len = req->ssids[req_idx].ssid_len;
memcpy(cmd->direct_scan[fw_idx].ssid,


--
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/


[ 038/102] mac80211/minstrel: fix NULL pointer dereference issue

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

--

From: Felix Fietkau 

commit 5c9fc93bc9bc417418fc1b6366833ae6a07b804d upstream.

When priv_sta == NULL, mi->prev_sample is dereferenced too early. Move
the assignment further down, after the rate_control_send_low call.

Reported-by: Krzysztof Mazur 
Signed-off-by: Felix Fietkau 
Signed-off-by: Johannes Berg 
Signed-off-by: Greg Kroah-Hartman 

---
 net/mac80211/rc80211_minstrel.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -290,7 +290,7 @@ minstrel_get_rate(void *priv, struct iee
struct minstrel_rate *msr, *mr;
unsigned int ndx;
bool mrr_capable;
-   bool prev_sample = mi->prev_sample;
+   bool prev_sample;
int delta;
int sampling_ratio;
 
@@ -314,6 +314,7 @@ minstrel_get_rate(void *priv, struct iee
(mi->sample_count + mi->sample_deferred / 2);
 
/* delta < 0: no sampling required */
+   prev_sample = mi->prev_sample;
mi->prev_sample = false;
if (delta < 0 || (!mrr_capable && prev_sample))
return;


--
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/


[ 037/102] nl80211: fix mgmt tx status and testmode reporting for netns

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

--

From: Michal Kazior 

commit a0ec570f4f69c4cb700d743a915096c2c8f56a99 upstream.

These two events were sent to the default network
namespace.

This caused AP mode in a non-default netns to not
work correctly. Mgmt tx status was multicasted to
a different (default) netns instead of the one the
AP was in.

Signed-off-by: Michal Kazior 
Signed-off-by: Johannes Berg 
Signed-off-by: Greg Kroah-Hartman 

---
 net/wireless/nl80211.c |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6588,12 +6588,14 @@ EXPORT_SYMBOL(cfg80211_testmode_alloc_ev
 
 void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
 {
+   struct cfg80211_registered_device *rdev = ((void **)skb->cb)[0];
void *hdr = ((void **)skb->cb)[1];
struct nlattr *data = ((void **)skb->cb)[2];
 
nla_nest_end(skb, data);
genlmsg_end(skb, hdr);
-   genlmsg_multicast(skb, 0, nl80211_testmode_mcgrp.id, gfp);
+   genlmsg_multicast_netns(wiphy_net(>wiphy), skb, 0,
+   nl80211_testmode_mcgrp.id, gfp);
 }
 EXPORT_SYMBOL(cfg80211_testmode_event);
 #endif
@@ -10028,7 +10030,8 @@ void cfg80211_mgmt_tx_status(struct wire
 
genlmsg_end(msg, hdr);
 
-   genlmsg_multicast(msg, 0, nl80211_mlme_mcgrp.id, gfp);
+   genlmsg_multicast_netns(wiphy_net(>wiphy), msg, 0,
+   nl80211_mlme_mcgrp.id, gfp);
return;
 
  nla_put_failure:


--
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/


[ 035/102] ath9k_htc: do some initial hardware configuration

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

--

From: Oleksij Rempel 

commit dc2a87f519a4d8cb376ab54f22b6b98a943b51ce upstream.

Currently we configure harwdare and clock, only after
interface start. In this case, if we reload module or
reboot PC without configuring adapter, firmware will freeze.
There is no software way to reset adpter.

This patch add initial configuration and set it in
disabled state, to avoid this freeze. Behaviour of this patch
should be similar to: ifconfig wlan0 up; ifconfig wlan0 down.

Bug: https://github.com/qca/open-ath9k-htc-firmware/issues/1
Tested-by: Bo Shi 
Signed-off-by: Oleksij Rempel 
Signed-off-by: John W. Linville 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/ath/ath9k/htc_drv_init.c |1 +
 1 file changed, 1 insertion(+)

--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -846,6 +846,7 @@ static int ath9k_init_device(struct ath9
if (error != 0)
goto err_rx;
 
+   ath9k_hw_disable(priv->ah);
 #ifdef CONFIG_MAC80211_LEDS
/* must be initialized before ieee80211_register_hw */
priv->led_cdev.default_trigger = 
ieee80211_create_tpt_led_trigger(priv->hw,


--
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/


[ 043/102] ixgbe: Fix Tx Hang issue with lldpad on 82598EB

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

--

From: Jacob Keller 

commit 1eb9ac14c34a948bf1538bfb9034e8ab29099a64 upstream.

This patch fixes an issue with the 82598EB device, where lldpad is causing Tx
Hangs on the card as soon as it attempts to configure DCB for the device. The
adapter will continually Tx hang and reset in a loop.

Signed-off-by: Jacob Keller 
Tested-by: Phil Schmitt 
Tested-by: Jack Morgan 
Signed-off-by: Jeff Kirsher 
Signed-off-by: David S. Miller 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c
@@ -108,9 +108,8 @@ s32 ixgbe_dcb_config_tx_desc_arbiter_825
 
/* Enable arbiter */
reg &= ~IXGBE_DPMCS_ARBDIS;
-   /* Enable DFP and Recycle mode */
-   reg |= (IXGBE_DPMCS_TDPAC | IXGBE_DPMCS_TRM);
reg |= IXGBE_DPMCS_TSOEF;
+
/* Configure Max TSO packet size 34KB including payload and headers */
reg |= (0x4 << IXGBE_DPMCS_MTSOS_SHIFT);
 


--
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/


[ 040/102] mac80211: fix duplicate retransmission detection

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

--

From: Johannes Berg 

commit 6b0f32745dcfba01d7be33acd1b40306c7a914c6 upstream.

The duplicate retransmission detection code in mac80211
erroneously attempts to do the check for every frame,
even frames that don't have a sequence control field or
that don't use it (QoS-Null frames.)

This is problematic because it causes the code to access
data beyond the end of the SKB and depending on the data
there will drop packets erroneously.

Correct the code to not do duplicate detection for such
frames.

I found this error while testing AP powersave, it lead
to retransmitted PS-Poll frames being dropped entirely
as the data beyond the end of the SKB was always zero.

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

---
 net/mac80211/rx.c |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -932,8 +932,14 @@ ieee80211_rx_h_check(struct ieee80211_rx
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb);
 
-   /* Drop duplicate 802.11 retransmissions (IEEE 802.11 Chap. 9.2.9) */
-   if (rx->sta && !is_multicast_ether_addr(hdr->addr1)) {
+   /*
+* Drop duplicate 802.11 retransmissions
+* (IEEE 802.11-2012: 9.3.2.10 "Duplicate detection and recovery")
+*/
+   if (rx->skb->len >= 24 && rx->sta &&
+   !ieee80211_is_ctl(hdr->frame_control) &&
+   !ieee80211_is_qos_nullfunc(hdr->frame_control) &&
+   !is_multicast_ether_addr(hdr->addr1)) {
if (unlikely(ieee80211_has_retry(hdr->frame_control) &&
 rx->sta->last_seq_ctrl[rx->seqno_idx] ==
 hdr->seq_ctrl)) {


--
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/


[ 030/102] iwlwifi: mvm: fix L2P BA ressources leak

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

--

From: Emmanuel Grumbach 

commit 93a426673fbfeae7fa6b27008828e2ac4c08dbee upstream.

We didn't release the Rx AMPDU ressources properly.
This bug led to firmware assert after 16 BA sessions.

Signed-off-by: Emmanuel Grumbach 
Signed-off-by: Johannes Berg 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/iwlwifi/mvm/sta.c |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/drivers/net/wireless/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/iwlwifi/mvm/sta.c
@@ -621,8 +621,12 @@ int iwl_mvm_sta_rx_agg(struct iwl_mvm *m
cmd.mac_id_n_color = cpu_to_le32(mvm_sta->mac_id_n_color);
cmd.sta_id = mvm_sta->sta_id;
cmd.add_modify = STA_MODE_MODIFY;
-   cmd.add_immediate_ba_tid = (u8) tid;
-   cmd.add_immediate_ba_ssn = cpu_to_le16(ssn);
+   if (start) {
+   cmd.add_immediate_ba_tid = (u8) tid;
+   cmd.add_immediate_ba_ssn = cpu_to_le16(ssn);
+   } else {
+   cmd.remove_immediate_ba_tid = (u8) tid;
+   }
cmd.modify_mask = start ? STA_MODIFY_ADD_BA_TID :
  STA_MODIFY_REMOVE_BA_TID;
 


--
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/


[ 041/102] mac80211: fix ethtool stats for non-station interfaces

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

--

From: Johannes Berg 

commit e13bae4f807401729b3f27c7e882a96b8b292809 upstream.

As reported in https://bugzilla.kernel.org/show_bug.cgi?id=60514,
the station loop never initialises 'sinfo' and therefore adds up
a stack values, leaking stack information (the number of times it
adds values is easily obtained another way.)

Fix this by initialising the sinfo for each station to add.

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

---
 net/mac80211/cfg.c |2 ++
 1 file changed, 2 insertions(+)

--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -652,6 +652,8 @@ static void ieee80211_get_et_stats(struc
if (sta->sdata->dev != dev)
continue;
 
+   sinfo.filled = 0;
+   sta_set_sinfo(sta, );
i = 0;
ADD_STA_STATS(sta);
}


--
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/


[ 034/102] iwlwifi: mvm: fix flushing not started aggregation sessions

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

--

From: Johannes Berg 

commit b6658ff80c43bcf84be0bbe371c88af1452e7776 upstream.

When a not fully started aggregation session is destroyed
and flushed, we get a warning, e.g.

  WARNING: at drivers/net/wireless/iwlwifi/pcie/tx.c:1142 
iwl_trans_pcie_txq_disable+0x11c/0x160
  queue 16 not used
  Modules linked in: [...]
  Pid: 5135, comm: hostapd Tainted: GW  O 3.5.0 #10
  Call Trace:
  wlan0: driver sets block=0 for sta 00:03:7f:10:44:d3
   [] warn_slowpath_common+0x72/0xa0
   [] warn_slowpath_fmt+0x47/0x50
   [] iwl_trans_pcie_txq_disable+0x11c/0x160 [iwlwifi]
   [] iwl_mvm_sta_tx_agg_flush+0xe9/0x150 [iwlmvm]
   [] iwl_mvm_mac_ampdu_action+0xf3/0x1e0 [iwlmvm]
   [] ___ieee80211_stop_tx_ba_session+0x193/0x920 [mac80211]
   [] __ieee80211_stop_tx_ba_session+0x48/0x70 [mac80211]
   [] ieee80211_sta_tear_down_BA_sessions+0x4f/0x80 [mac80211]
   [] __sta_info_destroy+0x66/0x370 [mac80211]
   [] sta_info_destroy_addr_bss+0x44/0x70 [mac80211]
   [] ieee80211_del_station+0x26/0x50 [mac80211]
   [] nl80211_del_station+0x85/0x200 [cfg80211]

when a station deauthenticated from us without fully setting
up the aggregation session.

Fix this by checking the aggregation state before removing
the hardware queue.

Reviewed-by: Emmanuel Grumbach 
Signed-off-by: Johannes Berg 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/iwlwifi/mvm/sta.c |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

--- a/drivers/net/wireless/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/iwlwifi/mvm/sta.c
@@ -898,6 +898,7 @@ int iwl_mvm_sta_tx_agg_flush(struct iwl_
struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv;
struct iwl_mvm_tid_data *tid_data = >tid_data[tid];
u16 txq_id;
+   enum iwl_mvm_agg_state old_state;
 
/*
 * First set the agg state to OFF to avoid calling
@@ -907,13 +908,17 @@ int iwl_mvm_sta_tx_agg_flush(struct iwl_
txq_id = tid_data->txq_id;
IWL_DEBUG_TX_QUEUES(mvm, "Flush AGG: sta %d tid %d q %d state %d\n",
mvmsta->sta_id, tid, txq_id, tid_data->state);
+   old_state = tid_data->state;
tid_data->state = IWL_AGG_OFF;
spin_unlock_bh(>lock);
 
-   if (iwl_mvm_flush_tx_path(mvm, BIT(txq_id), true))
-   IWL_ERR(mvm, "Couldn't flush the AGG queue\n");
+   if (old_state >= IWL_AGG_ON) {
+   if (iwl_mvm_flush_tx_path(mvm, BIT(txq_id), true))
+   IWL_ERR(mvm, "Couldn't flush the AGG queue\n");
+
+   iwl_trans_txq_disable(mvm->trans, tid_data->txq_id);
+   }
 
-   iwl_trans_txq_disable(mvm->trans, tid_data->txq_id);
mvm->queue_to_mac80211[tid_data->txq_id] =
IWL_INVALID_MAC80211_QUEUE;
 


--
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/


[ 045/102] Bluetooth: Fix invalid length check in l2cap_information_rsp()

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

--

From: Jaganath Kanakkassery 

commit da9910ac4a816b4340944c78d94c02a35527db46 upstream.

The length check is invalid since the length varies with type of
info response.

This was introduced by the commit cb3b3152b2f5939d67005cff841a1ca748b19888

Because of this, l2cap info rsp is not handled and command reject is sent.

> ACL data: handle 11 flags 0x02 dlen 16
L2CAP(s): Info rsp: type 2 result 0
  Extended feature mask 0x00b8
Enhanced Retransmission mode
Streaming mode
FCS Option
Fixed Channels
< ACL data: handle 11 flags 0x00 dlen 10
L2CAP(s): Command rej: reason 0
  Command not understood

Signed-off-by: Jaganath Kanakkassery 
Signed-off-by: Chan-Yeol Park 
Acked-by: Johan Hedberg 
Signed-off-by: Gustavo Padovan 
Signed-off-by: Greg Kroah-Hartman 

---
 net/bluetooth/l2cap_core.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -4240,7 +4240,7 @@ static inline int l2cap_disconnect_rsp(s
u16 dcid, scid;
struct l2cap_chan *chan;
 
-   if (cmd_len != sizeof(*rsp))
+   if (cmd_len < sizeof(*rsp))
return -EPROTO;
 
scid = __le16_to_cpu(rsp->scid);


--
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/


[ 042/102] mac80211: fix monitor interface suspend crash regression

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

--

From: Stanislaw Gruszka 

commit cd34f647a78e7f2296fcb72392b9e5c832793e65 upstream.

My commit:

commit 12e7f517029dad819c45eca9ca01fdb9ba57616b
Author: Stanislaw Gruszka 
Date:   Thu Feb 28 10:55:26 2013 +0100

mac80211: cleanup generic suspend/resume procedures

removed check for deleting MONITOR and AP_VLAN when suspend. That can
cause a crash (i.e. in iwlagn_mac_remove_interface()) since we remove
interface in the driver that we did not add before.

Reference:
http://marc.info/?l=linux-kernel=137391815113860=2

Bisected-by: Ortwin Glück 
Reported-and-tested-by: Ortwin Glück 
Signed-off-by: Stanislaw Gruszka 
Signed-off-by: Johannes Berg 
Signed-off-by: Greg Kroah-Hartman 

---
 net/mac80211/pm.c |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/net/mac80211/pm.c
+++ b/net/mac80211/pm.c
@@ -99,10 +99,13 @@ int __ieee80211_suspend(struct ieee80211
}
mutex_unlock(>sta_mtx);
 
-   /* remove all interfaces */
+   /* remove all interfaces that were created in the driver */
list_for_each_entry(sdata, >interfaces, list) {
-   if (!ieee80211_sdata_running(sdata))
+   if (!ieee80211_sdata_running(sdata) ||
+   sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
+   sdata->vif.type == NL80211_IFTYPE_MONITOR)
continue;
+
drv_remove_interface(local, 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/


[ 046/102] Bluetooth: ath3k: Add support for Fujitsu Lifebook UH5x2 [04c5:1330]

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

--

From: Thomas Loo 

commit 84eb2ae1807dd1467bf6f500fc69ae61f1907b75 upstream.

The Fujitsu Lifebook UH552/UH572 ships with a Qualcomm AR9462/AR3012
WLAN/BT-Combo card.
Add device ID to the ath3k driver to enable the bluetooth side of things.
Patch against v3.10.

T:  Bus=03 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  3 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=04c5 ProdID=1330 Rev=00.02
C:  #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
I:  If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb

Signed-off-by: Thomas Loo 
Signed-off-by: Gustavo Padovan 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/bluetooth/ath3k.c |2 ++
 drivers/bluetooth/btusb.c |1 +
 2 files changed, 3 insertions(+)

--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -91,6 +91,7 @@ static struct usb_device_id ath3k_table[
{ USB_DEVICE(0x0489, 0xe04e) },
{ USB_DEVICE(0x0489, 0xe056) },
{ USB_DEVICE(0x0489, 0xe04d) },
+   { USB_DEVICE(0x04c5, 0x1330) },
 
/* Atheros AR5BBU12 with sflash firmware */
{ USB_DEVICE(0x0489, 0xE02C) },
@@ -128,6 +129,7 @@ static struct usb_device_id ath3k_blist_
{ USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 },
+   { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 },
 
/* Atheros AR5BBU22 with sflash firmware */
{ USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 },
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -151,6 +151,7 @@ static struct usb_device_id blacklist_ta
{ USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 },
+   { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 },
 
/* Atheros AR5BBU12 with sflash firmware */
{ USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE },


--
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/


[ 044/102] ath: wil6210: Fix build error

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

--

From: Larry Finger 

commit 5d21608a592a9afcac8d82c6478a564e911ce70b upstream.

Building driver wil6210 in 3.10 and 3.11 kernels yields the following errors:

  CC [M]  drivers/net/wireless/ath/wil6210/debugfs.o
drivers/net/wireless/ath/wil6210/debugfs.c: In function 'wil_print_ring':
drivers/net/wireless/ath/wil6210/debugfs.c:163:11: error: pointer targets in 
passing argument 5 of 'hex_dump_to_buffer' differ in signedness 
[-Werror=pointer-sign]
   false);
   ^
In file included from include/linux/kernel.h:13:0,
 from include/linux/cache.h:4,
 from include/linux/time.h:4,
 from include/linux/stat.h:18,
 from include/linux/module.h:10,
 from drivers/net/wireless/ath/wil6210/debugfs.c:17:
include/linux/printk.h:361:13: note: expected 'char *' but argument is of type 
'unsigned char *'
 extern void hex_dump_to_buffer(const void *buf, size_t len,
 ^
drivers/net/wireless/ath/wil6210/debugfs.c: In function 
'wil_txdesc_debugfs_show':
drivers/net/wireless/ath/wil6210/debugfs.c:429:10: error: pointer targets in 
passing argument 5 of 'hex_dump_to_buffer' differ in signedness 
[-Werror=pointer-sign]
  sizeof(printbuf), false);
  ^
In file included from include/linux/kernel.h:13:0,
 from include/linux/cache.h:4,
 from include/linux/time.h:4,
 from include/linux/stat.h:18,
 from include/linux/module.h:10,
 from drivers/net/wireless/ath/wil6210/debugfs.c:17:
include/linux/printk.h:361:13: note: expected 'char *' but argument is of type 
'unsigned char *'
 extern void hex_dump_to_buffer(const void *buf, size_t len,
 ^
cc1: all warnings being treated as errors
make[5]: *** [drivers/net/wireless/ath/wil6210/debugfs.o] Error 1
make[4]: *** [drivers/net/wireless/ath/wil6210] Error 2
make[3]: *** [drivers/net/wireless/ath] Error 2
make[2]: *** [drivers/net/wireless] Error 2
make[1]: *** [drivers/net] Error 2
make: *** [drivers] Error 2

These errors are fixed by changing the type of the buffer from "unsigned char 
*" to "char *".

Reported-by: Thomas Fjellstrom 
Tested-by: Thomas Fjellstrom 
Signed-off-by: Larry Finger 
Cc: Thomas Fjellstrom 
Signed-off-by: Vladimir Kondratiev 
Signed-off-by: John W. Linville 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/ath/wil6210/debugfs.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -145,7 +145,7 @@ static void wil_print_ring(struct seq_fi
   le16_to_cpu(hdr.type), hdr.flags);
if (len <= MAX_MBOXITEM_SIZE) {
int n = 0;
-   unsigned char printbuf[16 * 3 + 2];
+   char printbuf[16 * 3 + 2];
unsigned char databuf[MAX_MBOXITEM_SIZE];
void __iomem *src = wmi_buffer(wil, d.addr) +
sizeof(struct wil6210_mbox_hdr);
@@ -416,7 +416,7 @@ static int wil_txdesc_debugfs_show(struc
seq_printf(s, "  SKB = %p\n", skb);
 
if (skb) {
-   unsigned char printbuf[16 * 3 + 2];
+   char printbuf[16 * 3 + 2];
int i = 0;
int len = skb_headlen(skb);
void *p = skb->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/


[ 051/102] Bluetooth: Add support for Mediatek Bluetooth device [0e8d:763f]

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

--

From: "Cho, Yu-Chen" 

commit 178c059e7640aa8e50213400c6f3dde00189d979 upstream.

This patch adds support for Mediatek Bluetooth device

T:  Bus=02 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#=  2 Spd=480  MxCh= 0
D:  Ver= 2.01 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=0e8d ProdID=763f Rev= 1.00
S:  Manufacturer=MediaTek
S:  Product=BT
S:  SerialNumber=1.0
C:* #Ifs= 2 Cfg#= 1 Atr=a0 MxPwr=450mA
A:  FirstIf#= 0 IfCount= 2 Cls=ff(vend.) Sub=ff Prot=ff
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=125us
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=125us
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
I:  If#= 1 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
I:  If#= 1 Alt= 2 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
I:  If#= 1 Alt= 3 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
I:  If#= 1 Alt= 4 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
I:  If#= 1 Alt= 5 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
I:  If#= 1 Alt= 6 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=03(O) Atr=01(Isoc) MxPS=  63 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  63 Ivl=1ms

Signed-off-by: Cho, Yu-Chen 
Signed-off-by: Gustavo Padovan 
Signed-off-by: John W. Linville 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/bluetooth/btusb.c |3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -57,6 +57,9 @@ static struct usb_device_id btusb_table[
/* Apple-specific (Broadcom) devices */
{ USB_VENDOR_AND_INTERFACE_INFO(0x05ac, 0xff, 0x01, 0x01) },
 
+   /* MediaTek MT76x0E */
+   { USB_DEVICE(0x0e8d, 0x763f) },
+
/* Broadcom SoftSailing reporting vendor specific */
{ USB_DEVICE(0x0a5c, 0x21e1) },
 


--
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/


[ 055/102] svcrpc: fix kfree oops in gss-proxy code

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

--

From: "J. Bruce Fields" 

commit 743e217129f69aab074abe520a464fd0c6b1cca1 upstream.

mech_oid.data is an array, not kmalloc()'d memory.

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

---
 net/sunrpc/auth_gss/gss_rpc_upcall.c |1 -
 1 file changed, 1 deletion(-)

--- a/net/sunrpc/auth_gss/gss_rpc_upcall.c
+++ b/net/sunrpc/auth_gss/gss_rpc_upcall.c
@@ -328,7 +328,6 @@ void gssp_free_upcall_data(struct gssp_u
kfree(data->in_handle.data);
kfree(data->out_handle.data);
kfree(data->out_token.data);
-   kfree(data->mech_oid.data);
free_svc_cred(>creds);
 }
 


--
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/


[ 056/102] rt2x00: fix stop queue

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

--

From: Stanislaw Gruszka 

commit e2288b66fe7ff0288382b2af671b4da558b44472 upstream.

Since we clear QUEUE_STARTED in rt2x00queue_stop_queue(), following
call to rt2x00queue_pause_queue() reduce to noop, i.e we do not
stop queue in mac80211.

To fix that introduce rt2x00queue_pause_queue_nocheck() function,
which will stop queue in mac80211 directly.

Note that rt2x00_start_queue() explicitly set QUEUE_PAUSED bit.

Note also that reordering operations i.e. first call to
rt2x00queue_pause_queue() and then clear QUEUE_STARTED bit, will race
with rt2x00queue_unpause_queue(), so calling ieee80211_stop_queue()
directly is the only available solution to fix the problem without
major rework.

Signed-off-by: Stanislaw Gruszka 
Signed-off-by: John W. Linville 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/rt2x00/rt2x00queue.c |   18 +++---
 1 file changed, 11 insertions(+), 7 deletions(-)

--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -936,13 +936,8 @@ void rt2x00queue_index_inc(struct queue_
spin_unlock_irqrestore(>index_lock, irqflags);
 }
 
-void rt2x00queue_pause_queue(struct data_queue *queue)
+void rt2x00queue_pause_queue_nocheck(struct data_queue *queue)
 {
-   if (!test_bit(DEVICE_STATE_PRESENT, >rt2x00dev->flags) ||
-   !test_bit(QUEUE_STARTED, >flags) ||
-   test_and_set_bit(QUEUE_PAUSED, >flags))
-   return;
-
switch (queue->qid) {
case QID_AC_VO:
case QID_AC_VI:
@@ -958,6 +953,15 @@ void rt2x00queue_pause_queue(struct data
break;
}
 }
+void rt2x00queue_pause_queue(struct data_queue *queue)
+{
+   if (!test_bit(DEVICE_STATE_PRESENT, >rt2x00dev->flags) ||
+   !test_bit(QUEUE_STARTED, >flags) ||
+   test_and_set_bit(QUEUE_PAUSED, >flags))
+   return;
+
+   rt2x00queue_pause_queue_nocheck(queue);
+}
 EXPORT_SYMBOL_GPL(rt2x00queue_pause_queue);
 
 void rt2x00queue_unpause_queue(struct data_queue *queue)
@@ -1019,7 +1023,7 @@ void rt2x00queue_stop_queue(struct data_
return;
}
 
-   rt2x00queue_pause_queue(queue);
+   rt2x00queue_pause_queue_nocheck(queue);
 
queue->rt2x00dev->ops->lib->stop_queue(queue);
 


--
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/


[ 052/102] Bluetooth: fix wrong use of PTR_ERR() in btusb

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

--

From: Adam Lee 

commit d9c78e9738ccd0017b10b8f44462aafb61904a4a upstream.

PTR_ERR() returns a signed long type value which is limited by IS_ERR(),
it must be a negative number whose range is [-MAX_ERRNO, 0).

The bug here returns negative numbers as error codes, then check it by
"if (ret < 0)", but -PTR_ERR() is actually positive. The wrong use here
leads to failure as below, even panic.

[   12.958920] Bluetooth: hci0 command 0xfc8e tx timeout
[   14.961765] Bluetooth: hci0 command 0xfc8e tx timeout
[   16.964688] Bluetooth: hci0 command 0xfc8e tx timeout
[   20.954501] Bluetooth: hci0 sending Intel patch command (0xfc8e) failed 
(-110)
[   22.957358] Bluetooth: hci0 command 0xfc8e tx timeout
[   30.948922] Bluetooth: hci0 sending Intel patch command (0xfc8e) failed 
(-110)
[   32.951780] Bluetooth: hci0 command 0xfc8e tx timeout
[   40.943359] Bluetooth: hci0 sending Intel patch command (0xfc8e) failed 
(-110)
[   42.946219] Bluetooth: hci0 command 0xfc8e tx timeout
[   50.937812] Bluetooth: hci0 sending Intel patch command (0xfc8e) failed 
(-110)
[   52.940670] Bluetooth: hci0 command 0xfc8e tx timeout
[   60.932236] Bluetooth: hci0 sending Intel patch command (0xfc8e) failed 
(-110)
[   62.935092] Bluetooth: hci0 command 0xfc8e tx timeout
[   70.926688] Bluetooth: hci0 sending Intel patch command (0xfc8e) failed 
(-110)
[   72.929545] Bluetooth: hci0 command 0xfc8e tx timeout
[   80.92] Bluetooth: hci0 sending Intel patch command (0xfc8e) failed 
(-110)
[   82.923969] Bluetooth: hci0 command 0xfc2f tx timeout
[   90.915542] Bluetooth: hci0 sending Intel patch command (0xfc2f) failed 
(-110)
[   92.918406] Bluetooth: hci0 command 0xfc11 tx timeout
[  100.909955] Bluetooth: hci0 sending Intel patch command (0xfc11) failed 
(-110)
[  102.912858] Bluetooth: hci0 command 0xfc60 tx timeout
[  110.904394] Bluetooth: hci0 sending Intel patch command (0xfc60) failed 
(-110)
[  112.907293] Bluetooth: hci0 command 0xfc11 tx timeout
[  120.898831] Bluetooth: hci0 exiting Intel manufacturer mode failed (-110)
[  120.904757] bluetoothd[1030]: segfault at 4 ip 7f8b2eb55236 sp 
7fff53ff6920 error 4 in bluetoothd[7f8b2eaff000+cb000]

Signed-off-by: Adam Lee 
Signed-off-by: Gustavo Padovan 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/bluetooth/btusb.c |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -1099,7 +1099,7 @@ static int btusb_setup_intel_patching(st
if (IS_ERR(skb)) {
BT_ERR("%s sending Intel patch command (0x%4.4x) failed (%ld)",
   hdev->name, cmd->opcode, PTR_ERR(skb));
-   return -PTR_ERR(skb);
+   return PTR_ERR(skb);
}
 
/* It ensures that the returned event matches the event data read from
@@ -1151,7 +1151,7 @@ static int btusb_setup_intel(struct hci_
if (IS_ERR(skb)) {
BT_ERR("%s sending initial HCI reset command failed (%ld)",
   hdev->name, PTR_ERR(skb));
-   return -PTR_ERR(skb);
+   return PTR_ERR(skb);
}
kfree_skb(skb);
 
@@ -1165,7 +1165,7 @@ static int btusb_setup_intel(struct hci_
if (IS_ERR(skb)) {
BT_ERR("%s reading Intel fw version command failed (%ld)",
   hdev->name, PTR_ERR(skb));
-   return -PTR_ERR(skb);
+   return PTR_ERR(skb);
}
 
if (skb->len != sizeof(*ver)) {
@@ -1223,7 +1223,7 @@ static int btusb_setup_intel(struct hci_
BT_ERR("%s entering Intel manufacturer mode failed (%ld)",
   hdev->name, PTR_ERR(skb));
release_firmware(fw);
-   return -PTR_ERR(skb);
+   return PTR_ERR(skb);
}
 
if (skb->data[0]) {
@@ -1280,7 +1280,7 @@ static int btusb_setup_intel(struct hci_
if (IS_ERR(skb)) {
BT_ERR("%s exiting Intel manufacturer mode failed (%ld)",
   hdev->name, PTR_ERR(skb));
-   return -PTR_ERR(skb);
+   return PTR_ERR(skb);
}
kfree_skb(skb);
 
@@ -1296,7 +1296,7 @@ exit_mfg_disable:
if (IS_ERR(skb)) {
BT_ERR("%s exiting Intel manufacturer mode failed (%ld)",
   hdev->name, PTR_ERR(skb));
-   return -PTR_ERR(skb);
+   return PTR_ERR(skb);
}
kfree_skb(skb);
 
@@ -1314,7 +1314,7 @@ exit_mfg_deactivate:
if (IS_ERR(skb)) {
BT_ERR("%s exiting Intel manufacturer mode failed (%ld)",
   hdev->name, PTR_ERR(skb));
-   return -PTR_ERR(skb);
+   return PTR_ERR(skb);
}
kfree_skb(skb);
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to 

[ 054/102] svcrpc: fix gss_rpc_upcall create error

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

--

From: "J. Bruce Fields" 

commit 9f96392b0ae6aefc02a9b900c3f4889dfafc8402 upstream.

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

---
 net/sunrpc/auth_gss/gss_rpc_upcall.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/sunrpc/auth_gss/gss_rpc_upcall.c
+++ b/net/sunrpc/auth_gss/gss_rpc_upcall.c
@@ -120,7 +120,7 @@ static int gssp_rpc_create(struct net *n
if (IS_ERR(clnt)) {
dprintk("RPC:   failed to create AF_LOCAL gssproxy "
"client (errno %ld).\n", PTR_ERR(clnt));
-   result = -PTR_ERR(clnt);
+   result = PTR_ERR(clnt);
*_clnt = NULL;
goto out;
}


--
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/


[ 060/102] zram: avoid invalid memory access in zram_exit()

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

--

From: Jiang Liu 

commit 6030ea9b35971a4200062f010341ab832e878ac9 upstream.

Memory for zram->disk object may have already been freed after returning
from destroy_device(zram), then it's unsafe for zram_reset_device(zram)
to access zram->disk again.

We can't solve this bug by flipping the order of destroy_device(zram)
and zram_reset_device(zram), that will cause deadlock issues to the
zram sysfs handler.

So fix it by holding an extra reference to zram->disk before calling
destroy_device(zram).

Signed-off-by: Jiang Liu 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/staging/zram/zram_drv.c |2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -727,8 +727,10 @@ static void __exit zram_exit(void)
for (i = 0; i < num_devices; i++) {
zram = _devices[i];
 
+   get_disk(zram->disk);
destroy_device(zram);
zram_reset_device(zram);
+   put_disk(zram->disk);
}
 
unregister_blkdev(zram_major, "zram");


--
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/


[ 058/102] mwifiex: check for bss_role instead of bss_mode for STA operations

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

--

From: Avinash Patil 

commit 953b3539ef9301b8ef73f4b6e2fd824b86aae65a upstream.

This patch fixes an issue wherein association would fail on P2P
interfaces. This happened because we are checking priv->mode
against NL80211_IFTYPE_STATION. While this check is correct for
infrastructure stations, it would fail P2P clients for which mode
is NL80211_IFTYPE_P2P_CLIENT.

Better check would be bss_role which has only 2 values: STA/AP.

Signed-off-by: Avinash Patil 
Signed-off-by: Stone Piao 
Signed-off-by: Bing Zhao 
Signed-off-by: John W. Linville 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/mwifiex/cfg80211.c |4 ++--
 drivers/net/wireless/mwifiex/join.c |6 --
 2 files changed, 6 insertions(+), 4 deletions(-)

--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -1668,9 +1668,9 @@ mwifiex_cfg80211_connect(struct wiphy *w
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
int ret;
 
-   if (priv->bss_mode != NL80211_IFTYPE_STATION) {
+   if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_STA) {
wiphy_err(wiphy,
- "%s: reject infra assoc request in non-STA mode\n",
+ "%s: reject infra assoc request in non-STA role\n",
  dev->name);
return -EINVAL;
}
--- a/drivers/net/wireless/mwifiex/join.c
+++ b/drivers/net/wireless/mwifiex/join.c
@@ -1290,8 +1290,10 @@ int mwifiex_associate(struct mwifiex_pri
 {
u8 current_bssid[ETH_ALEN];
 
-   /* Return error if the adapter or table entry is not marked as infra */
-   if ((priv->bss_mode != NL80211_IFTYPE_STATION) ||
+   /* Return error if the adapter is not STA role or table entry
+* is not marked as infra.
+*/
+   if ((GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_STA) ||
(bss_desc->bss_mode != NL80211_IFTYPE_STATION))
return -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/


[ 049/102] Bluetooth: Add support for Atheros [0cf3:3121]

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

--

From: AceLan Kao 

commit 1ebd0b21ab14efb75950079840eac29afea2a26e upstream.

Add support for the AR3012 chip.

T:  Bus=03 Lev=01 Prnt=01 Port=06 Cnt=01 Dev#=  6 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=0cf3 ProdID=3121 Rev=00.02
C:  #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
I:  If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb

Signed-off-by: AceLan Kao 
Signed-off-by: Gustavo Padovan 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/bluetooth/ath3k.c |2 ++
 drivers/bluetooth/btusb.c |1 +
 2 files changed, 3 insertions(+)

--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -93,6 +93,7 @@ static struct usb_device_id ath3k_table[
{ USB_DEVICE(0x0489, 0xe04d) },
{ USB_DEVICE(0x04c5, 0x1330) },
{ USB_DEVICE(0x13d3, 0x3402) },
+   { USB_DEVICE(0x0cf3, 0x3121) },
 
/* Atheros AR5BBU12 with sflash firmware */
{ USB_DEVICE(0x0489, 0xE02C) },
@@ -132,6 +133,7 @@ static struct usb_device_id ath3k_blist_
{ USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 },
+   { USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 },
 
/* Atheros AR5BBU22 with sflash firmware */
{ USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 },
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -153,6 +153,7 @@ static struct usb_device_id blacklist_ta
{ USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 },
+   { USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 },
 
/* Atheros AR5BBU12 with sflash firmware */
{ USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE },


--
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/


[ 050/102] Bluetooth: Add support for Atheros [0cf3:e003]

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

--

From: AceLan Kao 

commit 1d5b569ef85d013a775560a90050dc630614c045 upstream.

Add support for the AR9462 chip

T:  Bus=02 Lev=02 Prnt=02 Port=04 Cnt=01 Dev#=  4 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=0cf3 ProdID=e003 Rev=00.02
C:  #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
I:  If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb

Signed-off-by: AceLan Kao 
Signed-off-by: Gustavo Padovan 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/bluetooth/ath3k.c |2 ++
 drivers/bluetooth/btusb.c |1 +
 2 files changed, 3 insertions(+)

--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -94,6 +94,7 @@ static struct usb_device_id ath3k_table[
{ USB_DEVICE(0x04c5, 0x1330) },
{ USB_DEVICE(0x13d3, 0x3402) },
{ USB_DEVICE(0x0cf3, 0x3121) },
+   { USB_DEVICE(0x0cf3, 0xe003) },
 
/* Atheros AR5BBU12 with sflash firmware */
{ USB_DEVICE(0x0489, 0xE02C) },
@@ -134,6 +135,7 @@ static struct usb_device_id ath3k_blist_
{ USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 },
+   { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 },
 
/* Atheros AR5BBU22 with sflash firmware */
{ USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 },
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -154,6 +154,7 @@ static struct usb_device_id blacklist_ta
{ USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 },
+   { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 },
 
/* Atheros AR5BBU12 with sflash firmware */
{ USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE },


--
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   10   >