Re: [PATCH v2] sunrpc: fix waitqueue_active without memory barrier in sunrpc

2015-10-08 Thread Neil Brown
Kosuke Tatsukawa  writes:

> There are several places in net/sunrpc/svcsock.c which calls
> waitqueue_active() without calling a memory barrier.  Add a memory
> barrier just as in wq_has_sleeper().
>
> I found this issue when I was looking through the linux source code
> for places calling waitqueue_active() before wake_up*(), but without
> preceding memory barriers, after sending a patch to fix a similar
> issue in drivers/tty/n_tty.c  (Details about the original issue can be
> found here: https://lkml.org/lkml/2015/9/28/849).

hi,
this feels like the wrong approach to the problem.  It requires extra
'smb_mb's to be spread around which are hard to understand as easy to
forget.

A quick look seems to suggest that (nearly) every waitqueue_active()
will need an smb_mb.  Could we just put the smb_mb() inside
waitqueue_active()??

Thanks,
NeilBrown


>
> Signed-off-by: Kosuke Tatsukawa 
> ---
> v2:
>   - Fixed compiler warnings caused by type mismatch
> v1:
>   - https://lkml.org/lkml/2015/10/8/993
> ---
>  net/sunrpc/svcsock.c |6 ++
>  1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
> index 0c81202..ec19444 100644
> --- a/net/sunrpc/svcsock.c
> +++ b/net/sunrpc/svcsock.c
> @@ -414,6 +414,7 @@ static void svc_udp_data_ready(struct sock *sk)
>   set_bit(XPT_DATA, >sk_xprt.xpt_flags);
>   svc_xprt_enqueue(>sk_xprt);
>   }
> + smp_mb();
>   if (wq && waitqueue_active(wq))
>   wake_up_interruptible(wq);
>  }


signature.asc
Description: PGP signature


[PATCH][RFC] mm: Introduce kernelcore=reliable option

2015-10-08 Thread Taku Izumi
Xeon E7 v3 based systems supports Address Range Mirroring
and UEFI BIOS complied with UEFI spec 2.5 can notify which
ranges are reliable (mirrored) via EFI memory map.
Now Linux kernel utilize its information and allocates
boot time memory from reliable region.

My requirement is:
  - allocate kernel memory from reliable region
  - allocate user memory from non-reliable region

In order to meet my requirement, ZONE_MOVABLE is useful.
By arranging non-reliable range into ZONE_MOVABLE,
reliable memory is only used for kernel allocations.

This patch extends existing "kernelcore" option and
introduces kernelcore=reliable option. By specifying
"reliable" instead of specifying the amount of memory,
non-reliable region will be arranged into ZONE_MOVABLE.

Signed-off-by: Taku Izumi 
---
 Documentation/kernel-parameters.txt |  9 -
 mm/page_alloc.c | 26 ++
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/Documentation/kernel-parameters.txt 
b/Documentation/kernel-parameters.txt
index 50fc09b..6791cbb 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1669,7 +1669,8 @@ bytes respectively. Such letter suffixes can also be 
entirely omitted.
 
keepinitrd  [HW,ARM]
 
-   kernelcore=nn[KMG]  [KNL,X86,IA-64,PPC] This parameter
+   kernelcore= Format: nn[KMG] | "reliable"
+   [KNL,X86,IA-64,PPC] This parameter
specifies the amount of memory usable by the kernel
for non-movable allocations.  The requested amount is
spread evenly throughout all nodes in the system. The
@@ -1685,6 +1686,12 @@ bytes respectively. Such letter suffixes can also be 
entirely omitted.
use the HighMem zone if it exists, and the Normal
zone if it does not.
 
+   Instead of specifying the amount of memory (nn[KMS]),
+   you can specify "reliable" option. In case "reliable"
+   option is specified, reliable memory is used for
+   non-movable allocations and remaining memory is used
+   for Movable pages.
+
kgdbdbgp=   [KGDB,HW] kgdb over EHCI usb debug port.
Format: [,poll interval]
The controller # is the number of the ehci usb debug
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 48aaf7b..91d7556 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -242,6 +242,7 @@ static unsigned long __meminitdata 
arch_zone_highest_possible_pfn[MAX_NR_ZONES];
 static unsigned long __initdata required_kernelcore;
 static unsigned long __initdata required_movablecore;
 static unsigned long __meminitdata zone_movable_pfn[MAX_NUMNODES];
+static bool reliable_kernelcore __initdata;
 
 /* movable_zone is the "real" zone pages in ZONE_MOVABLE are taken from */
 int movable_zone;
@@ -5652,6 +5653,25 @@ static void __init find_zone_movable_pfns_for_nodes(void)
}
 
/*
+* If kernelcore=reliable is specified, ignore movablecore option
+*/
+   if (reliable_kernelcore) {
+   for_each_memblock(memory, r) {
+   if (memblock_is_mirror(r))
+   continue;
+
+   nid = r->nid;
+
+   usable_startpfn = PFN_DOWN(r->base);
+   zone_movable_pfn[nid] = zone_movable_pfn[nid] ?
+   min(usable_startpfn, zone_movable_pfn[nid]) :
+   usable_startpfn;
+   }
+
+   goto out2;
+   }
+
+   /*
 * If movablecore=nn[KMG] was specified, calculate what size of
 * kernelcore that corresponds so that memory usable for
 * any allocation type is evenly spread. If both kernelcore
@@ -5907,6 +5927,12 @@ static int __init cmdline_parse_core(char *p, unsigned 
long *core)
  */
 static int __init cmdline_parse_kernelcore(char *p)
 {
+   /* parse kernelcore=reliable */
+   if (parse_option_str(p, "reliable")) {
+   reliable_kernelcore = true;
+   return 0;
+   }
+
return cmdline_parse_core(p, _kernelcore);
 }
 
-- 
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/


Re: [Intel-wired-lan] [Patch V3 5/9] i40e: Use numa_mem_id() to better support memoryless node

2015-10-08 Thread Jiang Liu
On 2015/10/9 4:20, Andrew Morton wrote:
> On Wed, 19 Aug 2015 17:18:15 -0700 (PDT) David Rientjes  
> wrote:
> 
>> On Wed, 19 Aug 2015, Patil, Kiran wrote:
>>
>>> Acked-by: Kiran Patil 
>>
>> Where's the call to preempt_disable() to prevent kernels with preemption 
>> from making numa_node_id() invalid during this iteration?
> 
> David asked this question twice, received no answer and now the patch
> is in the maintainer tree, destined for mainline.
> 
> If I was asked this question I would respond
> 
>   The use of numa_mem_id() is racy and best-effort.  If the unlikely
>   race occurs, the memory allocation will occur on the wrong node, the
>   overall result being very slightly suboptimal performance.  The
>   existing use of numa_node_id() suffers from the same issue.
> 
> But I'm not the person proposing the patch.  Please don't just ignore
> reviewer comments!
Hi Andrew,
Apologize for the slow response due to personal reasons!
And thanks for answering the question from David. To be honest,
I didn't know how to answer this question before. Actually this
question has puzzled me for a long time when dealing with memory
hot-removal. For normal cases, it only causes sub-optimal memory
allocation if schedule event happens between querying NUMA node id
and calling alloc_pages_node(). But what happens if system run into
following execution sequence?
1) node = numa_mem_id();
2) memory hot-removal event triggers
2.1) remove affected memory
2.2) reset pgdat to zero if node becomes empty after memory removal
3) alloc_pages_node(), which may access zero-ed pgdat structure.

I haven't found a mechanism to protect system from above sequence yet,
so puzzled for a long time already:(. Does stop_machine() protect
system from such a execution sequence?
Thanks!
Gerry

> 
> --
> 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] UBI: rename free variable

2015-10-08 Thread Al Viro
On Fri, Oct 09, 2015 at 06:39:52AM +0200, Heiko Schocher wrote:
> Hello Al,
> Sorry, I should have added this info immediately into the patch ...
> 
> We have in U-Boot a compat.h file, in which we collect all things
> we need to make linux code running under U-Boot, and there we map
> kfree() to free(), see:
> 
> http://git.denx.de/?p=u-boot.git;a=blob;f=include/linux/compat.h;h=fbebf910addd994d265d21c4fbaa0a2f48f4ccb1;hb=996ec1dcc58a34b53891acde0ec5df9141b5fcc2#l58
> 
> So, if we use a var name "free", this will conflict ... and I get
> for example when compiling the UBI code:
> 
>   CC  drivers/mtd/ubi/fastmap.o
> drivers/mtd/ubi/fastmap.c: In function 'scan_pool':
> drivers/mtd/ubi/fastmap.c:475:3: error: called object 'free' is not a function
> 
> So with this patch, we have less differences to kernel files ...

Umm... wouldn't it be easier to replace that mix of #define and static inline
with uniform use of static inline, rather than playing whack-a-mole like
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: linux-next: build warning after merge of the driver-core tree

2015-10-08 Thread Stephen Rothwell
Hi Rafael,

On Thu, 08 Oct 2015 22:30:45 +0200 "Rafael J. Wysocki"  
wrote:
>
> On Thursday, October 08, 2015 12:39:54 PM Viresh Kumar wrote:
> > 1840995c52d4 PM / OPP: reuse of_parse_phandle()
> > f0489a5ef4d0 PM / OPP: Rename opp init/free table routines
> > 8f8d37b2537a PM / OPP: Prefix exported opp routines with dev_pm_opp_
> > 33692dc381f9 PM / OPP: Move opp core to its own directory
> > f59d3ee8480d PM / OPP: Move cpu specific code to opp/cpu.c
> > 5cb5fdbf3877 PM / OPP: Add debugfs support
> > 
> > I though you just dropped the last commit, but no.
> 
> My bad, I rebased the pm-opp branch, but then have forgotten to merge it.
> 
> Sorry about that, should be fixed now.

And the warnings are back :-)

Can someone (Viresh) just send me a patch on top of today's linux-next
(when I release it) and I will us it as a merge fix patch from Monday
and then hopefully it will be passed on to Linus at the right time.
-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au
--
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: [BUG] RCU stall in cursor_timer_handler

2015-10-08 Thread Alistair Popple
Hi Scot,

On Sat, 3 Oct 2015 05:12:15 Scot Doyle wrote:
> On Sat, 3 Oct 2015, Alistair Popple wrote:
> > Hi,
> > 
> > We have been intermittently seeing the below RCU stall at boot on a 
> > PPC64LE 4.2.1 kernel which has been preventing the system from booting.
> > Further investigation indicates that ops->cur_blink_jiffies is 
> > potentially being used uninitialised in cursor_timer_handler():
> > 
> > static void cursor_timer_handler(unsigned long dev_addr)
> > {
> > struct fb_info *info = (struct fb_info *) dev_addr;
> > struct fbcon_ops *ops = info->fbcon_par;
> > 
> > queue_work(system_power_efficient_wq, >queue);
> > mod_timer(>cursor_timer, jiffies + ops->cur_blink_jiffies);
> > }
> ...
> 
> 
> Hi Alistair, thanks so much for the detailed report. Does this patch 
> correct the stalls?

Sorry for the delay getting back to you. I have tested this patch and have not 
observed the stall again after 71 boots of the system (usually the issue would 
occur every couple of boots), so it seems to have solved the problem as far as 
I can tell.

Thanks!

Regards,

Alistair

> diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
> index 1aaf893..92f3949 100644
> --- a/drivers/video/console/fbcon.c
> +++ b/drivers/video/console/fbcon.c
> @@ -1093,6 +1093,7 @@ static void fbcon_init(struct vc_data *vc, int init)
>   con_copy_unimap(vc, svc);
>  
>   ops = info->fbcon_par;
> + ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms);
>   p->con_rotate = initial_rotation;
>   set_blitting_type(vc, info);
>  

--
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 v3] PCI: Xilinx-NWL-PCIe: Added support for Xilinx NWL PCIe Host Controller

2015-10-08 Thread Bharat Kumar Gogada
> >> +struct nwl_msi {  /* struct nwl_msi - MSI information
> */
> >> +  struct msi_controller chip; /* chip: MSI controller */
> >
> >> We're moving away from msi_controller altogether, as the kernel now
> >> has all the necessary infrastructure to do this properly.
> >
> > Our current GIC version does not have separate msi controller (we are
> > not using GICv2m or GICv3), so is it necessary to have separate msi
> > controller node ? Please give me clarity on this.
>
> This has nothing to do with the version of the GIC you are using (XGene
> doesn't have GICv2m or v3 either). This is about reducing code duplication
> and having something that we can maintain. See also
> https://lkml.org/lkml/2015/9/20/193 for yet another example.
>
> I still plan to kill msi_controller, and I'd like to avoid more dependencies 
> with
> it. MSI domains are the way to do it.
>
Sorry previously I haven't configured my email client properly so resending.

Since we don't have separate MSI controller, and our PCIe controller is 
handling MSI, is it necessary to create a separate MSI controller node because 
we don't have any 'reg' space.
Please let me know whether we require a separate msi file as suggested in your 
previous comments to separate MSI controller and PCIE controller in two files, 
if we don't have separate node.
If we do not need a separate node do we need to embed MSI controller child node 
 in PCIe controller node itself, and what properties does this child node will 
require other than 'interrupts'.

Bharat
> Thanks,
>
>   M.
> --
> Jazz is not dead. It just smells funny...


This email and any attachments are intended for the sole use of the named 
recipient(s) and contain(s) confidential information that may be proprietary, 
privileged or copyrighted under applicable law. If you are not the intended 
recipient, do not read, copy, or forward this email message or any attachments. 
Delete this email message and any attachments immediately.

--
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] IB/ipath: use TASK_COMM_LEN in ipath_portdata

2015-10-08 Thread Geliang Tang
Use comm[TASK_COMM_LEN] instead of comm[16]. Add linux/sched.h
header in ipath_kernel.h, and remove linux/sched.h header from
ipath_*.c which have included ipath_kernel.h.

Signed-off-by: Geliang Tang 
---
 drivers/staging/rdma/ipath/ipath_driver.c  | 1 -
 drivers/staging/rdma/ipath/ipath_intr.c| 1 -
 drivers/staging/rdma/ipath/ipath_kernel.h  | 3 ++-
 drivers/staging/rdma/ipath/ipath_qp.c  | 1 -
 drivers/staging/rdma/ipath/ipath_ruc.c | 1 -
 drivers/staging/rdma/ipath/ipath_ud.c  | 1 -
 drivers/staging/rdma/ipath/ipath_user_pages.c  | 1 -
 drivers/staging/rdma/ipath/ipath_user_sdma.c   | 1 -
 drivers/staging/rdma/ipath/ipath_verbs_mcast.c | 1 -
 9 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rdma/ipath/ipath_driver.c 
b/drivers/staging/rdma/ipath/ipath_driver.c
index 46d9898..dfcfaa5 100644
--- a/drivers/staging/rdma/ipath/ipath_driver.c
+++ b/drivers/staging/rdma/ipath/ipath_driver.c
@@ -33,7 +33,6 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/staging/rdma/ipath/ipath_intr.c 
b/drivers/staging/rdma/ipath/ipath_intr.c
index e568971..0403fa2 100644
--- a/drivers/staging/rdma/ipath/ipath_intr.c
+++ b/drivers/staging/rdma/ipath/ipath_intr.c
@@ -33,7 +33,6 @@
 
 #include 
 #include 
-#include 
 
 #include "ipath_kernel.h"
 #include "ipath_verbs.h"
diff --git a/drivers/staging/rdma/ipath/ipath_kernel.h 
b/drivers/staging/rdma/ipath/ipath_kernel.h
index f0f9471..66c934a 100644
--- a/drivers/staging/rdma/ipath/ipath_kernel.h
+++ b/drivers/staging/rdma/ipath/ipath_kernel.h
@@ -44,6 +44,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -162,7 +163,7 @@ struct ipath_portdata {
struct pid *port_pid;
struct pid *port_subpid[INFINIPATH_MAX_SUBPORT];
/* same size as task_struct .comm[] */
-   char port_comm[16];
+   char port_comm[TASK_COMM_LEN];
/* pkeys set by this use of this port */
u16 port_pkeys[4];
/* so file ops can get at unit */
diff --git a/drivers/staging/rdma/ipath/ipath_qp.c 
b/drivers/staging/rdma/ipath/ipath_qp.c
index face876..0344327 100644
--- a/drivers/staging/rdma/ipath/ipath_qp.c
+++ b/drivers/staging/rdma/ipath/ipath_qp.c
@@ -32,7 +32,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 
diff --git a/drivers/staging/rdma/ipath/ipath_ruc.c 
b/drivers/staging/rdma/ipath/ipath_ruc.c
index 1f95bba..2296832 100644
--- a/drivers/staging/rdma/ipath/ipath_ruc.c
+++ b/drivers/staging/rdma/ipath/ipath_ruc.c
@@ -31,7 +31,6 @@
  * SOFTWARE.
  */
 
-#include 
 #include 
 
 #include "ipath_verbs.h"
diff --git a/drivers/staging/rdma/ipath/ipath_ud.c 
b/drivers/staging/rdma/ipath/ipath_ud.c
index e8a2a91..33fcfe2 100644
--- a/drivers/staging/rdma/ipath/ipath_ud.c
+++ b/drivers/staging/rdma/ipath/ipath_ud.c
@@ -31,7 +31,6 @@
  * SOFTWARE.
  */
 
-#include 
 #include 
 
 #include "ipath_verbs.h"
diff --git a/drivers/staging/rdma/ipath/ipath_user_pages.c 
b/drivers/staging/rdma/ipath/ipath_user_pages.c
index 1da1252..d29b4da 100644
--- a/drivers/staging/rdma/ipath/ipath_user_pages.c
+++ b/drivers/staging/rdma/ipath/ipath_user_pages.c
@@ -34,7 +34,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "ipath_kernel.h"
 
diff --git a/drivers/staging/rdma/ipath/ipath_user_sdma.c 
b/drivers/staging/rdma/ipath/ipath_user_sdma.c
index e82b3ee..8c12e3c 100644
--- a/drivers/staging/rdma/ipath/ipath_user_sdma.c
+++ b/drivers/staging/rdma/ipath/ipath_user_sdma.c
@@ -33,7 +33,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/staging/rdma/ipath/ipath_verbs_mcast.c 
b/drivers/staging/rdma/ipath/ipath_verbs_mcast.c
index 6216ea9..72d476f 100644
--- a/drivers/staging/rdma/ipath/ipath_verbs_mcast.c
+++ b/drivers/staging/rdma/ipath/ipath_verbs_mcast.c
@@ -32,7 +32,6 @@
  */
 
 #include 
-#include 
 #include 
 
 #include "ipath_verbs.h"
-- 
1.9.1


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


[PATCH] IB/hfi1: use TASK_COMM_LEN in hfi1_ctxtdata

2015-10-08 Thread Geliang Tang
Use comm[TASK_COMM_LEN] instead of comm[16].

Signed-off-by: Geliang Tang 
---
 drivers/staging/rdma/hfi1/hfi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rdma/hfi1/hfi.h b/drivers/staging/rdma/hfi1/hfi.h
index 8ca171b..a35213e 100644
--- a/drivers/staging/rdma/hfi1/hfi.h
+++ b/drivers/staging/rdma/hfi1/hfi.h
@@ -262,7 +262,7 @@ struct hfi1_ctxtdata {
pid_t pid;
pid_t subpid[HFI1_MAX_SHARED_CTXTS];
/* same size as task_struct .comm[], command that opened context */
-   char comm[16];
+   char comm[TASK_COMM_LEN];
/* so file ops can get at unit */
struct hfi1_devdata *dd;
/* so functions that need physical port can get it easily */
-- 
1.9.1


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


Re: [Patch V3 3/9] sgi-xp: Replace cpu_to_node() with cpu_to_mem() to support memoryless node

2015-10-08 Thread Jiang Liu
On 2015/8/20 14:36, Jiang Liu wrote:
> On 2015/8/20 8:02, David Rientjes wrote:
>> On Wed, 19 Aug 2015, Jiang Liu wrote:
>>
 Why not simply fix build_zonelists_node() so that the __GFP_THISNODE 
 zonelists are set up to reference the zones of cpu_to_mem() for memoryless 
 nodes?

 It seems much better than checking and maintaining every __GFP_THISNODE 
 user to determine if they are using a memoryless node or not.  I don't 
 feel that this solution is maintainable in the longterm.
>>> Hi David,
>>> There are some usage cases, such as memory migration,
>>> expect the page allocator rejecting memory allocation requests
>>> if there is no memory on local node. So we have:
>>> 1) alloc_pages_node(cpu_to_node(), __GFP_THISNODE) to only allocate
>>> memory from local node.
>>> 2) alloc_pages_node(cpu_to_mem(), __GFP_THISNODE) to allocate memory
>>> from local node or from nearest node if local node is memoryless.
>>>
>>
>> Right, so do you think it would be better to make the default zonelists be 
>> setup so that cpu_to_node()->zonelists == cpu_to_mem()->zonelists and then 
>> individual callers that want to fail for memoryless nodes check 
>> populated_zone() themselves?
> Hi David,
>   Great idea:) I think that means we are going to kill the
> concept of memoryless node, and we only need to specially handle
> a few callers who really care about whether there is memory on
> local node.
>   Then I need some time to audit all usages of __GFP_THISNODE
> and update you whether it's doable.
Hi David,
It seems that I'm too optimistic:(. After auditing all usages
of __GFP_THISNODE and reading Documentation/vm/numa again, I feel it
would be better to keep cpu_to_mem()/numa_mem_id(). It makes things
more clear if we follow rules:
1) cpu_to_node()/numa_node_id() for schedule domain
2) cpu_to_mem()/numa_mem_id() for memory management domain
3) alloc_pages_node(cpu_to_node(cpu), __GFP_THIS_NODE) for special
   usage cases.
   And it would be easier for maintenance than open-coded checking of
populated_zone() by using alloc_pages_node(cpu_to_node(cpu),
__GFP_THIS_NODE).
Thanks!
Gerry
--
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] btrfs: fix waitqueue_active without memory barrier in btrfs

2015-10-08 Thread Kosuke Tatsukawa
Josef Bacik wrote:
> On 10/08/2015 05:35 PM, Kosuke Tatsukawa wrote:
>> btrfs_bio_counter_sub() seems to be missing a memory barrier which might
>> cause the waker to not notice the waiter and miss sending a wake_up as
>> in the following figure.
>> 
>>  btrfs_bio_counter_sub   btrfs_rm_dev_replace_blocked
>> 
>> if (waitqueue_active(_info->replace_wait))
>> /* The CPU might reorder the test for
>> the waitqueue up here, before
>> prior writes complete */
>>  /* wait_event */
>>   /* __wait_event */
>>/* ___wait_event */
>>long __int = 
>> prepare_to_wait_event(,
>>  &__wait, state);
>>if 
>> (!percpu_counter_sum(_info->bio_counter))
>> percpu_counter_sub(_info->bio_counter,
>>amount);
>>schedule()
>
> percpu_counter_sub can't be reordered, in its most basic form it does
> preempt_disable/enable which in its most basic form does barrier().  Thanks,

It's not the compiler, but the CPU that is doing the reordering.

The CPU can delay the write of the counter, so that the following read
of _info->replace_wait is completed first.  Hence a memory barrier is
required, and not just a barrier.
---
Kosuke TATSUKAWA  | 3rd IT Platform Department
  | IT Platform Division, NEC Corporation
  | ta...@ab.jp.nec.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/4] arm64: dts: enable idle states for Hi6220

2015-10-08 Thread Leo Yan
Add cpu and cluster level's low power state for Hi6220.

Signed-off-by: Leo Yan 
---
 arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi 
b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
index 7edbe42..e83802a 100644
--- a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
@@ -52,11 +52,35 @@
};
};
 
+   idle-states {
+   entry-method = "arm,psci";
+
+   CPU_SLEEP: cpu-sleep {
+   compatible = "arm,idle-state";
+   local-timer-stop;
+   arm,psci-suspend-param = <0x001>;
+   entry-latency-us = <700>;
+   exit-latency-us = <250>;
+   min-residency-us = <1000>;
+   };
+
+   CLUSTER_SLEEP: cluster-sleep {
+   compatible = "arm,idle-state";
+   local-timer-stop;
+   arm,psci-suspend-param = <0x101>;
+   entry-latency-us = <1000>;
+   exit-latency-us = <700>;
+   min-residency-us = <2700>;
+   wakeup-latency-us = <1500>;
+   };
+   };
+
cpu0: cpu@0 {
compatible = "arm,cortex-a53", "arm,armv8";
device_type = "cpu";
reg = <0x0 0x0>;
enable-method = "psci";
+   cpu-idle-states = <_SLEEP _SLEEP>;
};
 
cpu1: cpu@1 {
@@ -64,6 +88,7 @@
device_type = "cpu";
reg = <0x0 0x1>;
enable-method = "psci";
+   cpu-idle-states = <_SLEEP _SLEEP>;
};
 
cpu2: cpu@2 {
@@ -71,6 +96,7 @@
device_type = "cpu";
reg = <0x0 0x2>;
enable-method = "psci";
+   cpu-idle-states = <_SLEEP _SLEEP>;
};
 
cpu3: cpu@3 {
@@ -78,6 +104,7 @@
device_type = "cpu";
reg = <0x0 0x3>;
enable-method = "psci";
+   cpu-idle-states = <_SLEEP _SLEEP>;
};
 
cpu4: cpu@100 {
@@ -85,6 +112,7 @@
device_type = "cpu";
reg = <0x0 0x100>;
enable-method = "psci";
+   cpu-idle-states = <_SLEEP _SLEEP>;
};
 
cpu5: cpu@101 {
@@ -92,6 +120,7 @@
device_type = "cpu";
reg = <0x0 0x101>;
enable-method = "psci";
+   cpu-idle-states = <_SLEEP _SLEEP>;
};
 
cpu6: cpu@102 {
@@ -99,6 +128,7 @@
device_type = "cpu";
reg = <0x0 0x102>;
enable-method = "psci";
+   cpu-idle-states = <_SLEEP _SLEEP>;
};
 
cpu7: cpu@103 {
@@ -106,6 +136,7 @@
device_type = "cpu";
reg = <0x0 0x103>;
enable-method = "psci";
+   cpu-idle-states = <_SLEEP _SLEEP>;
};
};
 
-- 
1.9.1

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


Re: [PATCH] UBI: rename free variable

2015-10-08 Thread Heiko Schocher

Hello Al,

Am 09.10.2015 um 06:13 schrieb Al Viro:

On Fri, Oct 09, 2015 at 05:29:21AM +0200, Heiko Schocher wrote:

rename free variable into not "free", as "free" prevents
ubi sources compiling under U-Boot. So rename "free"
into "pfree" where it is a pointer, and into "freel",
where it is a free list.


Huh?  If U-Boot has free defined as an object-like macro, it's an outright bug
in U-Boot and it should be fixed there.  If it's something else, it looks like
a toolchain bug.   Details, please...


Sorry, I should have added this info immediately into the patch ...

We have in U-Boot a compat.h file, in which we collect all things
we need to make linux code running under U-Boot, and there we map
kfree() to free(), see:

http://git.denx.de/?p=u-boot.git;a=blob;f=include/linux/compat.h;h=fbebf910addd994d265d21c4fbaa0a2f48f4ccb1;hb=996ec1dcc58a34b53891acde0ec5df9141b5fcc2#l58

So, if we use a var name "free", this will conflict ... and I get
for example when compiling the UBI code:

  CC  drivers/mtd/ubi/fastmap.o
drivers/mtd/ubi/fastmap.c: In function 'scan_pool':
drivers/mtd/ubi/fastmap.c:475:3: error: called object 'free' is not a function

So with this patch, we have less differences to kernel files ...

bye,
Heiko
--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
--
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/4] arm64: dts: Reserve memory regions for hi6220

2015-10-08 Thread Leo Yan
On Hi6220, below memory regions in DDR have specific purpose:

  0x05e0, - 0x05ef,: For MCU firmware using at runtime;
  0x06df,f000 - 0x06df,: For mailbox message data;
  0x0740,f000 - 0x0740,: For MCU firmware's section;
  0x3e00, - 0x3fff,: For OP-TEE.

This patch reserves these memory regions in DT.

Signed-off-by: Leo Yan 
---
 arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts 
b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts
index e36a539..e3f4cb3 100644
--- a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts
+++ b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts
@@ -7,9 +7,6 @@
 
 /dts-v1/;
 
-/*Reserved 1MB memory for MCU*/
-/memreserve/ 0x05e0 0x0010;
-
 #include "hi6220.dtsi"
 
 / {
@@ -24,8 +21,19 @@
stdout-path = "serial0:115200n8";
};
 
+   /*
+* Reserve below regions from memory node:
+*
+*  - 0x05e0, - 0x05ef,: MCU firmware runtime using
+*  - 0x06df,f000 - 0x06df,: Mailbox message data
+*  - 0x0740,f000 - 0x0740,: MCU firmware section
+*  - 0x3e00, - 0x3fff,: OP-TEE
+*/
memory@0 {
device_type = "memory";
-   reg = <0x0 0x0 0x0 0x4000>;
+   reg = <0x 0x 0x 0x05e0>,
+ <0x 0x05f0 0x 0x00eff000>,
+ <0x 0x06e0 0x 0x0060f000>,
+ <0x 0x0741 0x 0x36bf>;
};
 };
-- 
1.9.1

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


[PATCH 3/4] arm64: dts: add sp804 timer node for Hi6220

2015-10-08 Thread Leo Yan
Add sp804 timer for hi6220, so it can be used as broadcast timer.

Signed-off-by: Leo Yan 
---
 arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi 
b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
index 3f03380..7edbe42 100644
--- a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
@@ -167,5 +167,14 @@
clocks = <_ctrl 36>, <_ctrl 36>;
clock-names = "uartclk", "apb_pclk";
};
+
+   dual_timer0: dual_timer@f8008000 {
+   compatible = "arm,sp804", "arm,primecell";
+   reg = <0x0 0xf8008000 0x0 0x1000>;
+   interrupts = ,
+;
+   clocks = <_ctrl 27>, <_ctrl 27>;
+   clock-names = "apb_pclk", "apb_pclk";
+   };
};
 };
-- 
1.9.1

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


[PATCH 2/4] arm64: Kconfig: select sp804 timer for ARCH_HISI

2015-10-08 Thread Leo Yan
Select sp804 timer for ARCH_HISI, which is used as broadcast timer.

Signed-off-by: Leo Yan 
---
 arch/arm64/Kconfig.platforms | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms
index 23800a1..6d730fb 100644
--- a/arch/arm64/Kconfig.platforms
+++ b/arch/arm64/Kconfig.platforms
@@ -35,6 +35,7 @@ config ARCH_FSL_LS2085A
 
 config ARCH_HISI
bool "Hisilicon SoC Family"
+   select ARM_TIMER_SP804
help
  This enables support for Hisilicon ARMv8 SoC family
 
-- 
1.9.1

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


[PATCH 0/4] arm64: Hi6220: enable CPU idle states

2015-10-08 Thread Leo Yan
This patch series is to enable CPU idle states for Hi6220.

Hi6220 uses PSCIv0.2 compliance interface, so directly use ARM's generic
CPUIdle driver. Patch 1 is to reserve memory regions so make sure MCU can
work well to handle power controlling; Patch 2/3 enable sp804 timer as
broadcast timer during idle states; Patch 4 registers CPU power down state
and cluster power down state.


Leo Yan (4):
  arm64: dts: Reserve memory regions for hi6220
  arm64: Kconfig: select sp804 timer for ARCH_HISI
  arm64: dts: add sp804 timer node for Hi6220
  arm64: dts: enable idle states for Hi6220

 arch/arm64/Kconfig.platforms   |  1 +
 arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts | 16 ---
 arch/arm64/boot/dts/hisilicon/hi6220.dtsi  | 40 ++
 3 files changed, 53 insertions(+), 4 deletions(-)

-- 
1.9.1

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


Re: [PATCH] btrfs: fix waitqueue_active without memory barrier in btrfs

2015-10-08 Thread Josef Bacik
On 10/08/2015 05:35 PM, Kosuke Tatsukawa wrote:
> btrfs_bio_counter_sub() seems to be missing a memory barrier which might
> cause the waker to not notice the waiter and miss sending a wake_up as
> in the following figure.
> 
>   btrfs_bio_counter_sub   btrfs_rm_dev_replace_blocked
> 
> if (waitqueue_active(_info->replace_wait))
> /* The CPU might reorder the test for
> the waitqueue up here, before
> prior writes complete */
>   /* wait_event */
>/* __wait_event */
> /* ___wait_event */
> long __int = 
> prepare_to_wait_event(,
>   &__wait, state);
> if 
> (!percpu_counter_sum(_info->bio_counter))
> percpu_counter_sub(_info->bio_counter,
>amount);
> schedule()

percpu_counter_sub can't be reordered, in its most basic form it does
preempt_disable/enable which in its most basic form does barrier().  Thanks,

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


Re: [PATCH v4 3/3] net: unix: optimize wakeups in unix_dgram_recvmsg()

2015-10-08 Thread kbuild test robot
Hi Jason,

[auto build test ERROR on v4.3-rc3 -- if it's inappropriate base, please ignore]

config: x86_64-randconfig-i0-201540 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   net/unix/af_unix.c: In function 'unix_dgram_writable':
>> net/unix/af_unix.c:2465:3: error: 'other_full' undeclared (first use in this 
>> function)
 *other_full = false;
  ^
   net/unix/af_unix.c:2465:3: note: each undeclared identifier is reported only 
once for each function it appears in

vim +/other_full +2465 net/unix/af_unix.c

  2459  return mask;
  2460  }
  2461  
  2462  static bool unix_dgram_writable(struct sock *sk, struct sock *other,
  2463  bool *other_nospace)
  2464  {
> 2465  *other_full = false;
  2466  
  2467  if (other && unix_peer(other) != sk && unix_recvq_full(other)) {
  2468  *other_full = true;

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


[PATCH v4 3/3] net: unix: optimize wakeups in unix_dgram_recvmsg()

2015-10-08 Thread Jason Baron
Now that connect() permanently registers a callback routine, we can induce
extra overhead in unix_dgram_recvmsg(), which unconditionally wakes up
its peer_wait queue on every receive. This patch makes the wakeup there
conditional on there being waiters.

Tested using: http://www.spinics.net/lists/netdev/msg145533.html

Signed-off-by: Jason Baron 
---
 include/net/af_unix.h |  1 +
 net/unix/af_unix.c| 92 +--
 2 files changed, 69 insertions(+), 24 deletions(-)

diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 6a4a345..cf21ffd 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -61,6 +61,7 @@ struct unix_sock {
unsigned long   flags;
 #define UNIX_GC_CANDIDATE  0
 #define UNIX_GC_MAYBE_CYCLE1
+#define UNIX_NOSPACE   2
struct socket_wqpeer_wq;
wait_queue_twait;
 };
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index f789423..05fbd00 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -326,7 +326,7 @@ found:
return s;
 }
 
-static inline int unix_writable(struct sock *sk)
+static inline bool unix_writable(struct sock *sk)
 {
return (atomic_read(>sk_wmem_alloc) << 2) <= sk->sk_sndbuf;
 }
@@ -1079,6 +1079,12 @@ static long unix_wait_for_peer(struct sock *other, long 
timeo)
 
prepare_to_wait_exclusive(>peer_wait, , TASK_INTERRUPTIBLE);
 
+   set_bit(UNIX_NOSPACE, >flags);
+   /* Ensure that we either see space in the peer sk_receive_queue via the
+* unix_recvq_full() check below, or we receive a wakeup when it
+* empties. Pairs with the mb in unix_dgram_recvmsg().
+*/
+   smp_mb__after_atomic();
sched = !sock_flag(other, SOCK_DEAD) &&
!(other->sk_shutdown & RCV_SHUTDOWN) &&
unix_recvq_full(other);
@@ -1623,17 +1629,27 @@ restart:
 
if (unix_peer(other) != sk && unix_recvq_full(other)) {
if (!timeo) {
-   err = -EAGAIN;
-   goto out_unlock;
-   }
-
-   timeo = unix_wait_for_peer(other, timeo);
+   set_bit(UNIX_NOSPACE, _sk(other)->flags);
+   /* Ensure that we either see space in the peer
+* sk_receive_queue via the unix_recvq_full() check
+* below, or we receive a wakeup when it empties. This
+* makes sure that epoll ET triggers correctly. Pairs
+* with the mb in unix_dgram_recvmsg().
+*/
+   smp_mb__after_atomic();
+   if (unix_recvq_full(other)) {
+   err = -EAGAIN;
+   goto out_unlock;
+   }
+   } else {
+   timeo = unix_wait_for_peer(other, timeo);
 
-   err = sock_intr_errno(timeo);
-   if (signal_pending(current))
-   goto out_free;
+   err = sock_intr_errno(timeo);
+   if (signal_pending(current))
+   goto out_free;
 
-   goto restart;
+   goto restart;
+   }
}
 
if (sock_flag(other, SOCK_RCVTSTAMP))
@@ -1939,8 +1955,19 @@ static int unix_dgram_recvmsg(struct socket *sock, 
struct msghdr *msg,
goto out_unlock;
}
 
-   wake_up_interruptible_sync_poll(>peer_wait,
-   POLLOUT | POLLWRNORM | POLLWRBAND);
+   /* Ensure that waiters on our sk->sk_receive_queue draining that check
+* via unix_recvq_full() either see space in the queue or get a wakeup
+* below. sk->sk_receive_queue is reduece by the __skb_recv_datagram()
+* call above. Pairs with the mb in unix_dgram_sendmsg(),
+*unix_dgram_poll(), and unix_wait_for_peer().
+*/
+   smp_mb();
+   if (test_bit(UNIX_NOSPACE, >flags)) {
+   clear_bit(UNIX_NOSPACE, >flags);
+   wake_up_interruptible_sync_poll(>peer_wait,
+   POLLOUT | POLLWRNORM |
+   POLLWRBAND);
+   }
 
if (msg->msg_name)
unix_copy_addr(msg, skb->sk);
@@ -2432,11 +2459,25 @@ static unsigned int unix_poll(struct file *file, struct 
socket *sock, poll_table
return mask;
 }
 
+static bool unix_dgram_writable(struct sock *sk, struct sock *other,
+   bool *other_nospace)
+{
+   *other_full = false;
+
+   if (other && unix_peer(other) != sk && unix_recvq_full(other)) {
+   *other_full = true;
+   return false;
+   }
+
+   return unix_writable(sk);
+}
+
 static unsigned int unix_dgram_poll(struct file *file, struct socket *sock,

[PATCH v4 2/3] net: unix: Convert gc_flags to flags

2015-10-08 Thread Jason Baron
Convert gc_flags to flags in perparation for the subsequent patch, which will
make use of a flag bit for a non-gc purpose.

Signed-off-by: Jason Baron 
---
 include/net/af_unix.h |  2 +-
 net/unix/garbage.c| 12 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 9698aff..6a4a345 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -58,7 +58,7 @@ struct unix_sock {
atomic_long_t   inflight;
spinlock_t  lock;
unsigned char   recursion_level;
-   unsigned long   gc_flags;
+   unsigned long   flags;
 #define UNIX_GC_CANDIDATE  0
 #define UNIX_GC_MAYBE_CYCLE1
struct socket_wqpeer_wq;
diff --git a/net/unix/garbage.c b/net/unix/garbage.c
index a73a226..39794d9 100644
--- a/net/unix/garbage.c
+++ b/net/unix/garbage.c
@@ -179,7 +179,7 @@ static void scan_inflight(struct sock *x, void 
(*func)(struct unix_sock *),
 * have been added to the queues after
 * starting the garbage collection
 */
-   if (test_bit(UNIX_GC_CANDIDATE, 
>gc_flags)) {
+   if (test_bit(UNIX_GC_CANDIDATE, 
>flags)) {
hit = true;
 
func(u);
@@ -246,7 +246,7 @@ static void inc_inflight_move_tail(struct unix_sock *u)
 * of the list, so that it's checked even if it was already
 * passed over
 */
-   if (test_bit(UNIX_GC_MAYBE_CYCLE, >gc_flags))
+   if (test_bit(UNIX_GC_MAYBE_CYCLE, >flags))
list_move_tail(>link, _candidates);
 }
 
@@ -305,8 +305,8 @@ void unix_gc(void)
BUG_ON(total_refs < inflight_refs);
if (total_refs == inflight_refs) {
list_move_tail(>link, _candidates);
-   __set_bit(UNIX_GC_CANDIDATE, >gc_flags);
-   __set_bit(UNIX_GC_MAYBE_CYCLE, >gc_flags);
+   __set_bit(UNIX_GC_CANDIDATE, >flags);
+   __set_bit(UNIX_GC_MAYBE_CYCLE, >flags);
}
}
 
@@ -332,7 +332,7 @@ void unix_gc(void)
 
if (atomic_long_read(>inflight) > 0) {
list_move_tail(>link, _cycle_list);
-   __clear_bit(UNIX_GC_MAYBE_CYCLE, >gc_flags);
+   __clear_bit(UNIX_GC_MAYBE_CYCLE, >flags);
scan_children(>sk, inc_inflight_move_tail, NULL);
}
}
@@ -343,7 +343,7 @@ void unix_gc(void)
 */
while (!list_empty(_cycle_list)) {
u = list_entry(not_cycle_list.next, struct unix_sock, link);
-   __clear_bit(UNIX_GC_CANDIDATE, >gc_flags);
+   __clear_bit(UNIX_GC_CANDIDATE, >flags);
list_move_tail(>link, _inflight_list);
}
 
-- 
2.6.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 v4 0/3] net: unix: fix use-after-free

2015-10-08 Thread Jason Baron
Hi,

These patches are against mainline, I can re-base to net-next, please
let me know.

They have been tested against: https://lkml.org/lkml/2015/9/13/195,
which causes the use-after-free quite quickly and here:
https://lkml.org/lkml/2015/10/2/693.

Thanks,

-Jason

v4:
-set UNIX_NOSPACE only if the peer socket has receive space

v3:
-beef up memory barrier comments in 3/3 (Peter Zijlstra)
-clean up unix_dgram_writable() function in 3/3 (Joe Perches)

Jason Baron (3):
  net: unix: fix use-after-free in unix_dgram_poll()
  net: unix: Convert gc_flags to flags
  net: unix: optimize wakeups in unix_dgram_recvmsg()

 include/net/af_unix.h |   4 +-
 net/unix/af_unix.c| 124 --
 net/unix/garbage.c|  12 ++---
 3 files changed, 108 insertions(+), 32 deletions(-)

-- 
2.6.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 v4 1/3] net: unix: fix use-after-free in unix_dgram_poll()

2015-10-08 Thread Jason Baron
The unix_dgram_poll() routine calls sock_poll_wait() not only for the wait
queue associated with the socket s that we are poll'ing against, but also calls
sock_poll_wait() for a remote peer socket p, if it is connected. Thus,
if we call poll()/select()/epoll() for the socket s, there are then
a couple of code paths in which the remote peer socket p and its associated
peer_wait queue can be freed before poll()/select()/epoll() have a chance
to remove themselves from the remote peer socket.

The way that remote peer socket can be freed are:

1. If s calls connect() to a connect to a new socket other than p, it will
drop its reference on p, and thus a close() on p will free it.

2. If we call close on p(), then a subsequent sendmsg() from s, will drop
the final reference to p, allowing it to be freed.

Address this issue, by reverting unix_dgram_poll() to only register with
the wait queue associated with s and register a callback with the remote peer
socket on connect() that will wake up the wait queue associated with s. If
scenarios 1 or 2 occur above we then simply remove the callback from the
remote peer. This then presents the expected semantics to poll()/select()/
epoll().

I've implemented this for sock-type, SOCK_RAW, SOCK_DGRAM, and SOCK_SEQPACKET
but not for SOCK_STREAM, since SOCK_STREAM does not use unix_dgram_poll().

Introduced in commit ec0d215f9420 ("af_unix: fix 'poll for write'/connected
DGRAM sockets").

Tested-by: Mathias Krause 
Signed-off-by: Jason Baron 
---
 include/net/af_unix.h |  1 +
 net/unix/af_unix.c| 32 +++-
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 4a167b3..9698aff 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -62,6 +62,7 @@ struct unix_sock {
 #define UNIX_GC_CANDIDATE  0
 #define UNIX_GC_MAYBE_CYCLE1
struct socket_wqpeer_wq;
+   wait_queue_twait;
 };
 #define unix_sk(__sk) ((struct unix_sock *)__sk)
 
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 03ee4d3..f789423 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -420,6 +420,9 @@ static void unix_release_sock(struct sock *sk, int embrion)
skpair = unix_peer(sk);
 
if (skpair != NULL) {
+   if (sk->sk_type != SOCK_STREAM)
+   remove_wait_queue(_sk(skpair)->peer_wait,
+ >wait);
if (sk->sk_type == SOCK_STREAM || sk->sk_type == 
SOCK_SEQPACKET) {
unix_state_lock(skpair);
/* No more writes */
@@ -636,6 +639,16 @@ static struct proto unix_proto = {
  */
 static struct lock_class_key af_unix_sk_receive_queue_lock_key;
 
+static int peer_wake(wait_queue_t *wait, unsigned mode, int sync, void *key)
+{
+   struct unix_sock *u;
+
+   u = container_of(wait, struct unix_sock, wait);
+   wake_up_interruptible_sync_poll(sk_sleep(>sk), key);
+
+   return 0;
+}
+
 static struct sock *unix_create1(struct net *net, struct socket *sock, int 
kern)
 {
struct sock *sk = NULL;
@@ -664,6 +677,7 @@ static struct sock *unix_create1(struct net *net, struct 
socket *sock, int kern)
INIT_LIST_HEAD(>link);
mutex_init(>readlock); /* single task reading lock */
init_waitqueue_head(>peer_wait);
+   init_waitqueue_func_entry(>wait, peer_wake);
unix_insert_socket(unix_sockets_unbound(sk), sk);
 out:
if (sk == NULL)
@@ -1030,7 +1044,11 @@ restart:
 */
if (unix_peer(sk)) {
struct sock *old_peer = unix_peer(sk);
+
+   remove_wait_queue(_sk(old_peer)->peer_wait,
+ _sk(sk)->wait);
unix_peer(sk) = other;
+   add_wait_queue(_sk(other)->peer_wait, _sk(sk)->wait);
unix_state_double_unlock(sk, other);
 
if (other != old_peer)
@@ -1038,8 +1056,12 @@ restart:
sock_put(old_peer);
} else {
unix_peer(sk) = other;
+   add_wait_queue(_sk(other)->peer_wait, _sk(sk)->wait);
unix_state_double_unlock(sk, other);
}
+   /* New remote may have created write space for us */
+   wake_up_interruptible_sync_poll(sk_sleep(sk),
+   POLLOUT | POLLWRNORM | POLLWRBAND);
return 0;
 
 out_unlock:
@@ -1194,6 +1216,8 @@ restart:
 
sock_hold(sk);
unix_peer(newsk)= sk;
+   if (sk->sk_type == SOCK_SEQPACKET)
+   add_wait_queue(_sk(sk)->peer_wait, _sk(newsk)->wait);
newsk->sk_state = TCP_ESTABLISHED;
newsk->sk_type  = sk->sk_type;
init_peercred(newsk);
@@ -1220,6 +1244,8 @@ restart:
 
smp_mb__after_atomic(); /* sock_hold() does an atomic_inc() */
unix_peer(sk)   = newsk;
+   if (sk->sk_type == SOCK_SEQPACKET)
+   

Re: [PATCH] UBI: rename free variable

2015-10-08 Thread Al Viro
On Fri, Oct 09, 2015 at 05:29:21AM +0200, Heiko Schocher wrote:
> rename free variable into not "free", as "free" prevents
> ubi sources compiling under U-Boot. So rename "free"
> into "pfree" where it is a pointer, and into "freel",
> where it is a free list.

Huh?  If U-Boot has free defined as an object-like macro, it's an outright bug
in U-Boot and it should be fixed there.  If it's something else, it looks like
a toolchain bug.   Details, please...
--
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] ext4: use private version of page_zero_new_buffers() for data=journal mode

2015-10-08 Thread Theodore Ts'o
If there is a error while copying data from userspace into the page
cache during a write(2) system call, in data=journal mode, in
ext4_journalled_write_end() were using page_zero_new_buffers() from
fs/buffer.c.  Unfortunately, this sets the buffer dirty flag, which is
no good if journalling is enabled.  This is a long-standing bug that
goes back for years and years in ext3, but a combination of (a)
data=journal not being very common, (b) in many case it only results
in a warning message. and (c) only very rarely causes the kernel hang,
means that we only really noticed this as a problem when commit
998ef75ddb caused this failure to happen frequently enough to cause
generic/208 to fail when run in data=journal mode.

The fix is to have our own version of this function that doesn't call
mark_dirty_buffer(), since we will end up calling
ext4_handle_dirty_metadata() on the buffer head(s) in questions very
shortly afterwards in ext4_journalled_write_end().

Thanks to Dave Hansen and Linus Torvalds for helping to identify the
root cause of the problem.

Signed-off-by: Theodore Ts'o 
---
 fs/ext4/inode.c | 34 +-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index ae52e32..0a589bb 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1181,6 +1181,38 @@ errout:
return ret ? ret : copied;
 }
 
+/*
+ * This is a private version of page_zero_new_buffers() which doesn't
+ * set the buffer to be dirty, since in data=journalled mode we need
+ * to call ext4_handle_dirty_metadata() instad.
+ */
+static void zero_new_buffers(struct page *page, unsigned from, unsigned to)
+{
+   unsigned int block_start = 0, block_end;
+   struct buffer_head *head, *bh;
+
+   bh = head = page_buffers(page);
+   do {
+   block_end = block_start + bh->b_size;
+   if (buffer_new(bh)) {
+   if (block_end > from && block_start < to) {
+   if (!PageUptodate(page)) {
+   unsigned start, size;
+
+   start = max(from, block_start);
+   size = min(to, block_end) - start;
+
+   zero_user(page, start, size);
+   set_buffer_uptodate(bh);
+   }
+   clear_buffer_new(bh);
+   }
+   }
+   block_start = block_end;
+   bh = bh->b_this_page;
+   } while (bh != head);
+}
+
 static int ext4_journalled_write_end(struct file *file,
 struct address_space *mapping,
 loff_t pos, unsigned len, unsigned copied,
@@ -1207,7 +1239,7 @@ static int ext4_journalled_write_end(struct file *file,
if (copied < len) {
if (!PageUptodate(page))
copied = 0;
-   page_zero_new_buffers(page, from+copied, to);
+   zero_new_buffers(page, from+copied, to);
}
 
ret = ext4_walk_page_buffers(handle, page_buffers(page), from,
-- 
2.5.0

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


Re: [PATCH 10/44] kdbus: Use conditional operator

2015-10-08 Thread Hillf Danton
> 
> Signed-off-by: Sergei Zviagintsev 
> ---
>  ipc/kdbus/names.c | 5 +
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/ipc/kdbus/names.c b/ipc/kdbus/names.c
> index bf44ca3f12b6..6b31b38ac2ad 100644
> --- a/ipc/kdbus/names.c
> +++ b/ipc/kdbus/names.c
> @@ -438,10 +438,7 @@ static void kdbus_name_release_unlocked(struct 
> kdbus_name_owner *owner)
>   name->activator = NULL;
> 
>   if (!primary || owner == primary) {
> - next = kdbus_name_entry_first(name);
> - if (!next)
> - next = name->activator;
> -
> + next = kdbus_name_entry_first(name) ?: name->activator;

Fix? Cleanup? What we gain, given no log message?
>   if (next) {
>   /* hand to next in queue */
>   next->flags &= ~KDBUS_NAME_IN_QUEUE;
> --
> 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 v2] UBIFS: rename free variable

2015-10-08 Thread Heiko Schocher
rename free variable into not "free", as "free" prevents
ubifs sources compiling under U-Boot. So rename "free"
into "ifree", where it is an int.

Signed-off-by: Heiko Schocher 
---

Changes in v2:
- fix compiler error:
  fs/ubifs/lprops.c:546:23: error: 'free' undeclared (first use in this 
function)
lprops->lnum, free, dirty, flags);

 fs/ubifs/lprops.c | 56 +++
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/fs/ubifs/lprops.c b/fs/ubifs/lprops.c
index a0011aa..694050c 100644
--- a/fs/ubifs/lprops.c
+++ b/fs/ubifs/lprops.c
@@ -533,7 +533,7 @@ static int is_lprops_dirty(struct ubifs_info *c, struct 
ubifs_lprops *lprops)
  */
 const struct ubifs_lprops *ubifs_change_lp(struct ubifs_info *c,
   const struct ubifs_lprops *lp,
-  int free, int dirty, int flags,
+  int ifree, int dirty, int flags,
   int idx_gc_cnt)
 {
/*
@@ -543,7 +543,7 @@ const struct ubifs_lprops *ubifs_change_lp(struct 
ubifs_info *c,
struct ubifs_lprops *lprops = (struct ubifs_lprops *)lp;
 
dbg_lp("LEB %d, free %d, dirty %d, flags %d",
-  lprops->lnum, free, dirty, flags);
+  lprops->lnum, ifree, dirty, flags);
 
ubifs_assert(mutex_is_locked(>lp_mutex));
ubifs_assert(c->lst.empty_lebs >= 0 &&
@@ -555,7 +555,7 @@ const struct ubifs_lprops *ubifs_change_lp(struct 
ubifs_info *c,
ubifs_assert(!(c->lst.total_free & 7) && !(c->lst.total_dirty & 7));
ubifs_assert(!(c->lst.total_dead & 7) && !(c->lst.total_dark & 7));
ubifs_assert(!(c->lst.total_used & 7));
-   ubifs_assert(free == LPROPS_NC || free >= 0);
+   ubifs_assert(ifree == LPROPS_NC || ifree >= 0);
ubifs_assert(dirty == LPROPS_NC || dirty >= 0);
 
if (!is_lprops_dirty(c, lprops)) {
@@ -583,17 +583,17 @@ const struct ubifs_lprops *ubifs_change_lp(struct 
ubifs_info *c,
c->lst.total_used -= c->leb_size - old_spc;
}
 
-   if (free != LPROPS_NC) {
-   free = ALIGN(free, 8);
-   c->lst.total_free += free - lprops->free;
+   if (ifree != LPROPS_NC) {
+   ifree = ALIGN(ifree, 8);
+   c->lst.total_free += ifree - lprops->free;
 
/* Increase or decrease empty LEBs counter if needed */
-   if (free == c->leb_size) {
+   if (ifree == c->leb_size) {
if (lprops->free != c->leb_size)
c->lst.empty_lebs += 1;
} else if (lprops->free == c->leb_size)
c->lst.empty_lebs -= 1;
-   lprops->free = free;
+   lprops->free = ifree;
}
 
if (dirty != LPROPS_NC) {
@@ -660,7 +660,7 @@ void ubifs_get_lp_stats(struct ubifs_info *c, struct 
ubifs_lp_stats *lst)
  * same as in case of 'ubifs_change_lp()'. Returns zero in case of success and
  * a negative error code in case of failure.
  */
-int ubifs_change_one_lp(struct ubifs_info *c, int lnum, int free, int dirty,
+int ubifs_change_one_lp(struct ubifs_info *c, int lnum, int ifree, int dirty,
int flags_set, int flags_clean, int idx_gc_cnt)
 {
int err = 0, flags;
@@ -675,7 +675,7 @@ int ubifs_change_one_lp(struct ubifs_info *c, int lnum, int 
free, int dirty,
}
 
flags = (lp->flags | flags_set) & ~flags_clean;
-   lp = ubifs_change_lp(c, lp, free, dirty, flags, idx_gc_cnt);
+   lp = ubifs_change_lp(c, lp, ifree, dirty, flags, idx_gc_cnt);
if (IS_ERR(lp))
err = PTR_ERR(lp);
 
@@ -699,7 +699,7 @@ out:
  * This function is the same as 'ubifs_change_one_lp()' but @dirty is added to
  * current dirty space, not substitutes it.
  */
-int ubifs_update_one_lp(struct ubifs_info *c, int lnum, int free, int dirty,
+int ubifs_update_one_lp(struct ubifs_info *c, int lnum, int ifree, int dirty,
int flags_set, int flags_clean)
 {
int err = 0, flags;
@@ -714,7 +714,7 @@ int ubifs_update_one_lp(struct ubifs_info *c, int lnum, int 
free, int dirty,
}
 
flags = (lp->flags | flags_set) & ~flags_clean;
-   lp = ubifs_change_lp(c, lp, free, lp->dirty + dirty, flags, 0);
+   lp = ubifs_change_lp(c, lp, ifree, lp->dirty + dirty, flags, 0);
if (IS_ERR(lp))
err = PTR_ERR(lp);
 
@@ -1032,7 +1032,7 @@ static int scan_check_cb(struct ubifs_info *c,
 {
struct ubifs_scan_leb *sleb;
struct ubifs_scan_node *snod;
-   int cat, lnum = lp->lnum, is_idx = 0, used = 0, free, dirty, ret;
+   int cat, lnum = lp->lnum, is_idx = 0, used = 0, ifree, dirty, ret;
void *buf = NULL;
 
cat = lp->flags & LPROPS_CAT_MASK;
@@ -1154,20 +1154,20 @@ static int scan_check_cb(struct ubifs_info *c,
}
}
 

Re: [PATCH tip/core/rcu 18/18] rcu: Better hotplug handling for synchronize_sched_expedited()

2015-10-08 Thread Paul E. McKenney
On Thu, Oct 08, 2015 at 05:48:13PM -0700, Josh Triplett wrote:
> On Thu, Oct 08, 2015 at 05:11:11PM -0700, Paul E. McKenney wrote:
> > On Thu, Oct 08, 2015 at 11:01:14AM -0700, Josh Triplett wrote:
> > > On Thu, Oct 08, 2015 at 08:19:03AM -0700, Paul E. McKenney wrote:
> > > > On Thu, Oct 08, 2015 at 05:12:42PM +0200, Peter Zijlstra wrote:
> > > > > On Thu, Oct 08, 2015 at 08:06:39AM -0700, Paul E. McKenney wrote:
> > > > > > Please see below for the fixed version.  Thoughts?
> > > > > 
> > > > > > +   __releases(rnp->lock) /* But leaves rrupts disabled. */
> > > > > > +   raw_spin_unlock(>lock); /* rrupts remain disabled. */
> > > > > > +   raw_spin_lock(>lock); /* rrupts already disabled. 
> > > > > > */
> > > > > 
> > > > > What them 'rrupts' about? ;-)
> > > > 
> > > > Interrupts when it won't fit.  I suppose I could use IRQs instead.  ;-)
> > > 
> > > In this particular case, "IRQs" works just as well; however, in general,
> > > this seems like an excellent example of when to ignore the 80-column
> > > guideline. :)
> > 
> > But but but...   You are talking to someone who used actual PUNCHED CARDS
> > in real life in a paying job!!!  ;-)
> 
> And I learned on a DOS system with 80x25 text mode.  Let us revel in
> wonderment at the capabilities of modern systems. :)

But of course!  On my new 2880x1620 screen, I can put four 80x24 xterms
on each row!

Too bad that I cannot actually read them without an external monitor,
and my current external monitors are only 1920x1600.  ;-)

Thanx, Paul

--
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] workqueue: Allocate the unbound pool using local node memory

2015-10-08 Thread Xunlei Pang
From: Xunlei Pang 

Currently, get_unbound_pool() uses kzalloc() to allocate the
worker pool. Actually, we can use the right node to do the
allocation, achieving local memory access.

This patch selects target node first, and uses kzalloc_node()
instead.

Signed-off-by: Xunlei Pang 
---
 kernel/workqueue.c | 26 ++
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index ca71582..96d3747 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3199,6 +3199,7 @@ static struct worker_pool *get_unbound_pool(const struct 
workqueue_attrs *attrs)
u32 hash = wqattrs_hash(attrs);
struct worker_pool *pool;
int node;
+   int target_node = NUMA_NO_NODE;
 
lockdep_assert_held(_pool_mutex);
 
@@ -3210,13 +3211,25 @@ static struct worker_pool *get_unbound_pool(const 
struct workqueue_attrs *attrs)
}
}
 
+   /* if cpumask is contained inside a NUMA node, we belong to that node */
+   if (wq_numa_enabled) {
+   for_each_node(node) {
+   if (cpumask_subset(attrs->cpumask,
+  wq_numa_possible_cpumask[node])) {
+   target_node = node;
+   break;
+   }
+   }
+   }
+
/* nope, create a new one */
-   pool = kzalloc(sizeof(*pool), GFP_KERNEL);
+   pool = kzalloc_node(sizeof(*pool), GFP_KERNEL, target_node);
if (!pool || init_worker_pool(pool) < 0)
goto fail;
 
lockdep_set_subclass(>lock, 1);   /* see put_pwq() */
copy_workqueue_attrs(pool->attrs, attrs);
+   pool->node = target_node;
 
/*
 * no_numa isn't a worker_pool attribute, always clear it.  See
@@ -3224,17 +3237,6 @@ static struct worker_pool *get_unbound_pool(const struct 
workqueue_attrs *attrs)
 */
pool->attrs->no_numa = false;
 
-   /* if cpumask is contained inside a NUMA node, we belong to that node */
-   if (wq_numa_enabled) {
-   for_each_node(node) {
-   if (cpumask_subset(pool->attrs->cpumask,
-  wq_numa_possible_cpumask[node])) {
-   pool->node = node;
-   break;
-   }
-   }
-   }
-
if (worker_pool_assign_id(pool) < 0)
goto fail;
 
-- 
1.9.1


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


Re: [PATCHv3 1/2] ARM: exynos_defconfig: Enable rtl8152 ethernet driver for Odroid-XU4

2015-10-08 Thread Anand Moon
Hi Arnd,

On 8 October 2015 at 20:11, Arnd Bergmann  wrote:
> On Thursday 08 October 2015 11:27:13 Sjoerd Simons wrote:
>> On Thu, 2015-10-08 at 10:37 +0200, Arnd Bergmann wrote:
>> > On Thursday 08 October 2015 16:46:27 Krzysztof Kozlowski wrote:
>> > > On 08.10.2015 16:41, Arnd Bergmann wrote:
>> > > > On Thursday 08 October 2015 03:48:36 Anand Moon wrote:
>> > > > > diff --git a/arch/arm/configs/exynos_defconfig
>> > > > > b/arch/arm/configs/exynos_defconfig
>> > > > > index 1ff2bfa..5d1937b 100644
>> > > > > --- a/arch/arm/configs/exynos_defconfig
>> > > > > +++ b/arch/arm/configs/exynos_defconfig
>> > > > > @@ -61,6 +61,7 @@ CONFIG_BLK_DEV_DM=y
>> > > > >  CONFIG_DM_CRYPT=m
>> > > > >  CONFIG_NETDEVICES=y
>> > > > >  CONFIG_SMSC911X=y
>> > > > > +CONFIG_USB_RTL8152=y
>> > > > >  CONFIG_USB_USBNET=y
>> > > > >  CONFIG_USB_NET_SMSC75XX=y
>> > > > >  CONFIG_USB_NET_SMSC95XX=y
>> > > >
>> > > > Can we make that a loadable module for multi_v7_defconfig?
>> > >
>> > > What about nfsroot boots? We were discussing this also here:
>> > > http://linux-arm-kernel.infradead.narkive.com/lG5g4hrB/patch-arm-mu
>> > > lti-v7-defconfig-enable-usb3503
>> > >
>> > > and actually I would be happy to see a confirmed policy about that.
>> > > Everything should be a module for multi_v7?
>> >
>> > We try to make as much as possible modular here, and NFS root is a
>> > corner
>> > case: it's possible to do NFS root with an initramfs, but it's easier
>> > not
>> > to. Is it something you do a lot on this hardware?
>>
>> It's a workflow thing though, not a hardware specific thing. I
>> personally tend to use NFS root quite often and so do various
>> colleagues irrespective of the hardware (and an XU4 is bound to appear
>> on my desk someday).
>>
>> Now I personally really don't mind whether NFS root requires a ramdisk
>> or not (though some consistency would be nice). However deciding it on
>> a per device basis just makes everything quite fuzzy (e.g. my recent
>> rockchip multi_v7 patchset first ended up in a similar discussion,
>> though v2 was merged without further comments when I indicated in the
>> cover letter that i used the NFS root use-case as one of the deciding
>> factors for y vs. m).
>>
>> It would be really good to see someone put their foot down on the
>> general policy (e.g. the arm-soc maintainers?), such that this
>> discussion doesn't need to happen every time
>
> Yes, agreed, that what I'm trying to do here ;-)
>
> I realize that building things as modules is a hassle, it is so for
> some things more than for others, so I keep asking the question
> to everyone to find out what a good balance is to make as much as
> possible modules without hurting too much.
>
> Once we have a firm policy in place, we should probably change all
> the existing symbols.
>
> Arnd

As long as we use correct exynos5422-odroidxu4.dtb is used in the
boot.scr/boot.ini ethernet come up,
build and tested using CONFIG_USB_RTL8152=m using multi_v7_defconfig.

Not sure what is the policy for NFS booting.

Do you want CONFIG_USB_RTL8152 to be build as module in
exynos/multi_v7_defconfig.

-Anand Moon
--
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/44] kdbus: Fix comment on translation of caps between namespaces

2015-10-08 Thread Hillf Danton
> @@ -730,15 +730,21 @@ static void kdbus_meta_export_caps(struct 
> kdbus_meta_caps *out,
> 
>   /*
>* This translates the effective capabilities of 'cred' into the given
> -  * user-namespace. If the given user-namespace is a child-namespace of
> -  * the user-namespace of 'cred', the mask can be copied verbatim. If
> -  * not, the mask is cleared.
> -  * There's one exception: If 'cred' is the owner of any user-namespace
> -  * in the path between the given user-namespace and the user-namespace
> -  * of 'cred', then it has all effective capabilities set. This means,
> -  * the user who created a user-namespace always has all effective
> -  * capabilities in any child namespaces. Note that this is based on the
> -  * uid of the namespace creator, not the task hierarchy.
> +  * user namespace according to the following rules:
> +  *
> +  * - If 'cred' is a member of the given user namespace or any of its
> +  *   parent user namespaces, the mask is copied verbatim. That is, if

Clearer/Better if "if not, the mask is cleared." is reserved.

> +  *   a process has a capability in a user namespace, then it has it in
> +  *   all child user namespaces too.
> +  *
> +  * - If the effective UID of 'cred' matches the owner of the given user
> +  *   namespace or any of its parent user namespaces and 'cred' itself
> +  *   resides in the parent of that user namespace which it owns, then
> +  *   it has all effective capabilities set. This means that the user
> +  *   who created a user namespace always has all effective capabilities
> +  *   in all child namespaces while staying in the parent of the user
> +  *   namespace which it owns. Note that this is based on the UID of the
> +  *   namespace creator, not the task hierarchy.
>*/
>   for (iter = user_ns; iter; iter = iter->parent) {
>   if (iter == cred->user_ns) {
> --
> 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/


Re: [PATCH] UBIFS: rename free variable

2015-10-08 Thread kbuild test robot
Hi Heiko,

[auto build test ERROR on v4.3-rc4 -- if it's inappropriate base, please ignore]

config: x86_64-randconfig-x002-201540 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/printk.h:277:0,
from include/linux/kernel.h:13,
from include/linux/list.h:8,
from include/linux/wait.h:6,
from include/linux/fs.h:5,
from fs/ubifs/ubifs.h:28,
from fs/ubifs/lprops.c:31:
   fs/ubifs/lprops.c: In function 'ubifs_change_lp':
>> fs/ubifs/lprops.c:546:23: error: 'free' undeclared (first use in this 
>> function)
lprops->lnum, free, dirty, flags);
  ^
   include/linux/dynamic_debug.h:79:10: note: in definition of macro 
'dynamic_pr_debug'
   ##__VA_ARGS__);  \
 ^
   fs/ubifs/debug.h:168:2: note: in expansion of macro 'pr_debug'
 pr_debug("UBIFS DBG " type " (pid %d): " fmt "\n", current->pid,   \
 ^
   fs/ubifs/debug.h:190:29: note: in expansion of macro 'ubifs_dbg_msg'
#define dbg_lp(fmt, ...)ubifs_dbg_msg("lp", fmt, ##__VA_ARGS__)
^
>> fs/ubifs/lprops.c:545:2: note: in expansion of macro 'dbg_lp'
 dbg_lp("LEB %d, free %d, dirty %d, flags %d",
 ^
   fs/ubifs/lprops.c:546:23: note: each undeclared identifier is reported only 
once for each function it appears in
lprops->lnum, free, dirty, flags);
  ^
   include/linux/dynamic_debug.h:79:10: note: in definition of macro 
'dynamic_pr_debug'
   ##__VA_ARGS__);  \
 ^
   fs/ubifs/debug.h:168:2: note: in expansion of macro 'pr_debug'
 pr_debug("UBIFS DBG " type " (pid %d): " fmt "\n", current->pid,   \
 ^
   fs/ubifs/debug.h:190:29: note: in expansion of macro 'ubifs_dbg_msg'
#define dbg_lp(fmt, ...)ubifs_dbg_msg("lp", fmt, ##__VA_ARGS__)
^
>> fs/ubifs/lprops.c:545:2: note: in expansion of macro 'dbg_lp'
 dbg_lp("LEB %d, free %d, dirty %d, flags %d",
 ^

vim +/free +546 fs/ubifs/lprops.c

1e51764a Artem Bityutskiy 2008-07-14  539   /*
1e51764a Artem Bityutskiy 2008-07-14  540* This is the only function 
that is allowed to change lprops, so we
055da1b7 Artem Bityutskiy 2009-09-15  541* discard the "const" 
qualifier.
1e51764a Artem Bityutskiy 2008-07-14  542*/
1e51764a Artem Bityutskiy 2008-07-14  543   struct ubifs_lprops *lprops = 
(struct ubifs_lprops *)lp;
1e51764a Artem Bityutskiy 2008-07-14  544  
1e51764a Artem Bityutskiy 2008-07-14 @545   dbg_lp("LEB %d, free %d, dirty 
%d, flags %d",
1e51764a Artem Bityutskiy 2008-07-14 @546  lprops->lnum, free, 
dirty, flags);
1e51764a Artem Bityutskiy 2008-07-14  547  
1e51764a Artem Bityutskiy 2008-07-14  548   
ubifs_assert(mutex_is_locked(>lp_mutex));
1e51764a Artem Bityutskiy 2008-07-14  549   ubifs_assert(c->lst.empty_lebs 
>= 0 &&

:: The code at line 546 was first introduced by commit
:: 1e51764a3c2ac05a23a22b2a95ddee4d9bffb16d UBIFS: add new flash file system

:: TO: Artem Bityutskiy 
:: CC: Artem Bityutskiy 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


[PATCH] UBIFS: rename free variable

2015-10-08 Thread Heiko Schocher
rename free variable into not "free", as "free" prevents
ubifs sources compiling under U-Boot. So rename "free"
into "ifree", where it is an int.

Signed-off-by: Heiko Schocher 
---

 fs/ubifs/lprops.c | 54 +++---
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/fs/ubifs/lprops.c b/fs/ubifs/lprops.c
index a0011aa..74b9499 100644
--- a/fs/ubifs/lprops.c
+++ b/fs/ubifs/lprops.c
@@ -533,7 +533,7 @@ static int is_lprops_dirty(struct ubifs_info *c, struct 
ubifs_lprops *lprops)
  */
 const struct ubifs_lprops *ubifs_change_lp(struct ubifs_info *c,
   const struct ubifs_lprops *lp,
-  int free, int dirty, int flags,
+  int ifree, int dirty, int flags,
   int idx_gc_cnt)
 {
/*
@@ -555,7 +555,7 @@ const struct ubifs_lprops *ubifs_change_lp(struct 
ubifs_info *c,
ubifs_assert(!(c->lst.total_free & 7) && !(c->lst.total_dirty & 7));
ubifs_assert(!(c->lst.total_dead & 7) && !(c->lst.total_dark & 7));
ubifs_assert(!(c->lst.total_used & 7));
-   ubifs_assert(free == LPROPS_NC || free >= 0);
+   ubifs_assert(ifree == LPROPS_NC || ifree >= 0);
ubifs_assert(dirty == LPROPS_NC || dirty >= 0);
 
if (!is_lprops_dirty(c, lprops)) {
@@ -583,17 +583,17 @@ const struct ubifs_lprops *ubifs_change_lp(struct 
ubifs_info *c,
c->lst.total_used -= c->leb_size - old_spc;
}
 
-   if (free != LPROPS_NC) {
-   free = ALIGN(free, 8);
-   c->lst.total_free += free - lprops->free;
+   if (ifree != LPROPS_NC) {
+   ifree = ALIGN(ifree, 8);
+   c->lst.total_free += ifree - lprops->free;
 
/* Increase or decrease empty LEBs counter if needed */
-   if (free == c->leb_size) {
+   if (ifree == c->leb_size) {
if (lprops->free != c->leb_size)
c->lst.empty_lebs += 1;
} else if (lprops->free == c->leb_size)
c->lst.empty_lebs -= 1;
-   lprops->free = free;
+   lprops->free = ifree;
}
 
if (dirty != LPROPS_NC) {
@@ -660,7 +660,7 @@ void ubifs_get_lp_stats(struct ubifs_info *c, struct 
ubifs_lp_stats *lst)
  * same as in case of 'ubifs_change_lp()'. Returns zero in case of success and
  * a negative error code in case of failure.
  */
-int ubifs_change_one_lp(struct ubifs_info *c, int lnum, int free, int dirty,
+int ubifs_change_one_lp(struct ubifs_info *c, int lnum, int ifree, int dirty,
int flags_set, int flags_clean, int idx_gc_cnt)
 {
int err = 0, flags;
@@ -675,7 +675,7 @@ int ubifs_change_one_lp(struct ubifs_info *c, int lnum, int 
free, int dirty,
}
 
flags = (lp->flags | flags_set) & ~flags_clean;
-   lp = ubifs_change_lp(c, lp, free, dirty, flags, idx_gc_cnt);
+   lp = ubifs_change_lp(c, lp, ifree, dirty, flags, idx_gc_cnt);
if (IS_ERR(lp))
err = PTR_ERR(lp);
 
@@ -699,7 +699,7 @@ out:
  * This function is the same as 'ubifs_change_one_lp()' but @dirty is added to
  * current dirty space, not substitutes it.
  */
-int ubifs_update_one_lp(struct ubifs_info *c, int lnum, int free, int dirty,
+int ubifs_update_one_lp(struct ubifs_info *c, int lnum, int ifree, int dirty,
int flags_set, int flags_clean)
 {
int err = 0, flags;
@@ -714,7 +714,7 @@ int ubifs_update_one_lp(struct ubifs_info *c, int lnum, int 
free, int dirty,
}
 
flags = (lp->flags | flags_set) & ~flags_clean;
-   lp = ubifs_change_lp(c, lp, free, lp->dirty + dirty, flags, 0);
+   lp = ubifs_change_lp(c, lp, ifree, lp->dirty + dirty, flags, 0);
if (IS_ERR(lp))
err = PTR_ERR(lp);
 
@@ -1032,7 +1032,7 @@ static int scan_check_cb(struct ubifs_info *c,
 {
struct ubifs_scan_leb *sleb;
struct ubifs_scan_node *snod;
-   int cat, lnum = lp->lnum, is_idx = 0, used = 0, free, dirty, ret;
+   int cat, lnum = lp->lnum, is_idx = 0, used = 0, ifree, dirty, ret;
void *buf = NULL;
 
cat = lp->flags & LPROPS_CAT_MASK;
@@ -1154,20 +1154,20 @@ static int scan_check_cb(struct ubifs_info *c,
}
}
 
-   free = c->leb_size - sleb->endpt;
+   ifree = c->leb_size - sleb->endpt;
dirty = sleb->endpt - used;
 
-   if (free > c->leb_size || free < 0 || dirty > c->leb_size ||
+   if (ifree > c->leb_size || ifree < 0 || dirty > c->leb_size ||
dirty < 0) {
ubifs_err(c, "bad calculated accounting for LEB %d: free %d, 
dirty %d",
- lnum, free, dirty);
+ lnum, ifree, dirty);
goto out_destroy;
}
 
if (lp->free + lp->dirty == c->leb_size &&
-

[PATCH] UBI: rename free variable

2015-10-08 Thread Heiko Schocher
rename free variable into not "free", as "free" prevents
ubi sources compiling under U-Boot. So rename "free"
into "pfree" where it is a pointer, and into "freel",
where it is a free list.

Signed-off-by: Heiko Schocher 
---

 drivers/mtd/ubi/fastmap.c | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index 4aa2fd8..80ac265 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -451,7 +451,7 @@ static void unmap_peb(struct ubi_attach_info *ai, int pnum)
  */
 static int scan_pool(struct ubi_device *ubi, struct ubi_attach_info *ai,
 int *pebs, int pool_size, unsigned long long *max_sqnum,
-struct list_head *free)
+struct list_head *pfree)
 {
struct ubi_vid_hdr *vh;
struct ubi_ec_hdr *ech;
@@ -514,9 +514,9 @@ static int scan_pool(struct ubi_device *ubi, struct 
ubi_attach_info *ai,
unmap_peb(ai, pnum);
dbg_bld("Adding PEB to free: %i", pnum);
if (err == UBI_IO_FF_BITFLIPS)
-   add_aeb(ai, free, pnum, ec, 1);
+   add_aeb(ai, pfree, pnum, ec, 1);
else
-   add_aeb(ai, free, pnum, ec, 0);
+   add_aeb(ai, pfree, pnum, ec, 0);
continue;
} else if (err == 0 || err == UBI_IO_BITFLIPS) {
dbg_bld("Found non empty PEB:%i in pool", pnum);
@@ -598,7 +598,7 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
  struct ubi_attach_info *ai,
  struct ubi_fastmap_layout *fm)
 {
-   struct list_head used, free;
+   struct list_head used, freel;
struct ubi_ainf_volume *av;
struct ubi_ainf_peb *aeb, *tmp_aeb, *_tmp_aeb;
struct ubi_fm_sb *fmsb;
@@ -613,7 +613,7 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
void *fm_raw = ubi->fm_buf;
 
INIT_LIST_HEAD();
-   INIT_LIST_HEAD();
+   INIT_LIST_HEAD();
ai->min_ec = UBI_MAX_ERASECOUNTER;
 
fmsb = (struct ubi_fm_sb *)(fm_raw);
@@ -803,24 +803,25 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
}
}
 
-   ret = scan_pool(ubi, ai, fmpl->pebs, pool_size, _sqnum, );
+   ret = scan_pool(ubi, ai, fmpl->pebs, pool_size, _sqnum, );
if (ret)
goto fail;
 
-   ret = scan_pool(ubi, ai, fmpl_wl->pebs, wl_pool_size, _sqnum, 
);
+   ret = scan_pool(ubi, ai, fmpl_wl->pebs, wl_pool_size, _sqnum,
+   );
if (ret)
goto fail;
 
if (max_sqnum > ai->max_sqnum)
ai->max_sqnum = max_sqnum;
 
-   list_for_each_entry_safe(tmp_aeb, _tmp_aeb, , u.list)
+   list_for_each_entry_safe(tmp_aeb, _tmp_aeb, , u.list)
list_move_tail(_aeb->u.list, >free);
 
list_for_each_entry_safe(tmp_aeb, _tmp_aeb, , u.list)
list_move_tail(_aeb->u.list, >erase);
 
-   ubi_assert(list_empty());
+   ubi_assert(list_empty());
 
/*
 * If fastmap is leaking PEBs (must not happen), raise a
@@ -841,7 +842,7 @@ fail:
list_del(_aeb->u.list);
kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
}
-   list_for_each_entry_safe(tmp_aeb, _tmp_aeb, , u.list) {
+   list_for_each_entry_safe(tmp_aeb, _tmp_aeb, , u.list) {
list_del(_aeb->u.list);
kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
}
-- 
2.1.0

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


[PATCH] md: workqueue: Remove WQ_CPU_INTENSIVE from unbound workqueue allocations

2015-10-08 Thread Xunlei Pang
From: Xunlei Pang 

WQ_CPU_INTENSIVE is meaningless for the unbound workqueue, so remove it.

Signed-off-by: Xunlei Pang 
---
 drivers/md/dm-crypt.c  | 4 ++--
 drivers/md/dm-verity.c | 3 ++-
 drivers/md/raid5.c | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 4b3b6f8..56b2560 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -1871,8 +1871,8 @@ static int crypt_ctr(struct dm_target *ti, unsigned int 
argc, char **argv)
if (test_bit(DM_CRYPT_SAME_CPU, >flags))
cc->crypt_queue = alloc_workqueue("kcryptd", WQ_CPU_INTENSIVE | 
WQ_MEM_RECLAIM, 1);
else
-   cc->crypt_queue = alloc_workqueue("kcryptd", WQ_CPU_INTENSIVE | 
WQ_MEM_RECLAIM | WQ_UNBOUND,
- num_online_cpus());
+   cc->crypt_queue = alloc_workqueue("kcryptd",
+   WQ_MEM_RECLAIM | WQ_UNBOUND, num_online_cpus());
if (!cc->crypt_queue) {
ti->error = "Couldn't create kcryptd queue";
goto bad;
diff --git a/drivers/md/dm-verity.c b/drivers/md/dm-verity.c
index edc624b..f2fc693 100644
--- a/drivers/md/dm-verity.c
+++ b/drivers/md/dm-verity.c
@@ -942,7 +942,8 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, 
char **argv)
ti->per_bio_data_size = roundup(sizeof(struct dm_verity_io) + 
v->shash_descsize + v->digest_size * 2, __alignof__(struct dm_verity_io));
 
/* WQ_UNBOUND greatly improves performance when running on ramdisk */
-   v->verify_wq = alloc_workqueue("kverityd", WQ_CPU_INTENSIVE | 
WQ_MEM_RECLAIM | WQ_UNBOUND, num_online_cpus());
+   v->verify_wq = alloc_workqueue("kverityd",
+   WQ_MEM_RECLAIM | WQ_UNBOUND, num_online_cpus());
if (!v->verify_wq) {
ti->error = "Cannot allocate workqueue";
r = -ENOMEM;
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 49bb8d3..2a25af8 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -7840,7 +7840,7 @@ static struct md_personality raid4_personality =
 static int __init raid5_init(void)
 {
raid5_wq = alloc_workqueue("raid5wq",
-   WQ_UNBOUND|WQ_MEM_RECLAIM|WQ_CPU_INTENSIVE|WQ_SYSFS, 0);
+   WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_SYSFS, 0);
if (!raid5_wq)
return -ENOMEM;
register_md_personality(_personality);
-- 
1.9.1


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


Re: [PATCH v4 00/26] ARM: pxa: magician: Rework HTC Magician support

2015-10-08 Thread Petr Cvek
Dne 6.10.2015 v 17:25 Pavel Machek napsal(a):
> Hi!

Ahoj :-),

> 
>> This patchset will clean, fix, optimize and add multiple devices,
>> which can be found on the HTC Magician machine.
>>
>> Platform data for the pasic3-leds driver has been removed, as this
>> driver do not exist in the vanilla. And it is expected to be recreated
>> in the future with an incompatible platform data structure.
>>
>> Default setting of the Samsung LCD pixel clock period has been
>> increased, so resulting frequency is 50Hz (original 117Hz). Period
>> can be possibly incresed even more. At this moment there is no video
>> player with IWMMXT support and software only versions cannot make it
>> to 30fps. Frequency decreasing has a good impact to memory troughtput
>> as LCD controller does not do as many memory bursts as at original
>> speed. This was verified with the lat_mem_rd from the lmbench3.
>>
>> The Omnivision OV9640 camera has a problem with running on 400kHz
>> of the I2C clock. It seems it freezes the bus until PXA I2C driver
>> reload. Datasheet says it OK on 400kHz though. There may be some
>> compatibility bug in the PXA I2C driver as Omnivision cameras often
>> uses special I2C protocol (SCCB).
>>
>> Using the CPU frequency scaling (with help of an MAX1587A regulator)
>> sometimes causes an SoC failure. It is probably related to the PXA27x
>> erratum E37, E36, E80 or E89. Infreqent changes mostly works.
> 
> Nice to see work done on a cellphone...
> 
> Seeing all the GPIO name changes... would it be possible / make sense
> to make to device tree one day?
Probably, but there are still some missing parts (camera, usb webcam gadget,
sound, leds, gsm GPIOs)

> 
> What userspace do you run on the phone? Can it do calls?

I have found it is faster and funny to create from scratch (and openmoko
image is too old), so I've built it by Buildroot:

Busybox, Xorg and Matchbox, but as GTK apps are not too good for 240x320 
resolution
I have made my own "GUI" (so I can control Magician even without any USB/IrDA 
connection).

Calls are planned but by now I'm receiving SMS by hand by writing AT commands 
:-D.

> 
> [I have N900 here, kernel is in pretty good state, and I have Mate desktop
> running with python application for calls, but...]

Magician is very limited by RAM (64MB + 64MB Flash), so I can only have C
applications (or shell :-D).

> 
> Thanks (a pozdrav :-),
> 
>   Pavel
>> STUART removal is a prepare for:
>>
>>  net: irda: pxaficp_ir: dmaengine conversion
>>
>> Function was tested on the board_id 0x3a version (specifically on
>> the T-Mobile MDA compact).
>>
>> Changes from v3:
>>  * Nontrivial rebase for indentation fixup (EGPIO and PXA UDC)
>>
>> Petr Cvek (26):
>>   ARM: pxa: magician: Fix indentation in machine files
>>   ARM: pxa: magician: Change comments to be more informative
>>   ARM: pxa: magician: Print more specific error message for global
>> GPIOs
>>   ARM: pxa: magician: Optimize debug messages for LCD power
>>   ARM: pxa: magician: Change description of LCD power GPIO
>>   ARM: pxa: magician: Add new discovered EGPIO pins
>>   ARM: pxa: magician: Fix HTC Magician pin mux definitions
>>   ARM: pxa: magician: Rename abstract LCD GPIOs
>>   ARM: pxa: magician: Optimize powerup delays for Samsung LCD
>>   ARM: pxa: magician: Optimize Samsung LCD refresh to 50Hz
>>   ARM: pxa: magician: Optimize EGPIO initial values
>>   ARM: pxa: magician: Rename charger cable detection EGPIOs
>>   ARM: pxa: magician: Fix and add charging detection functions
>>   ARM: pxa: magician: Fix platform data for both PXA27x I2C controllers
>>   ARM: pxa: magician: Fix redundant GPIO request for pxaficp_ir
>>   ARM: pxa: magician: Fix support for Intel Strata NOR Flash
>>   ARM: pxa: magician: Fix wrongly enabled USB host ports
>>   ARM: pxa: magician: Add support for ADS7846
>>   ARM: pxa: magician: Add support for Omnivision OV9640 camera
>>   ARM: pxa: magician: Add support for MAX1587A Vcore regulator
>>   ARM: pxa: magician: Add support for PXA27x UDC
>>   ARM: pxa: magician: Remove pdata for pasic3-leds
>>   ARM: pxa: magician: Remove definition of the STUART port
>>   ARM: pxa: magician: Add debug message for backlight brightness
>> function
>>   ARM: pxa: magician: Add missing regulator for PWM backlight
>>   ARM: pxa: magician: Move platform_add_devices() to the end of
>> magician_init()
>>
>>  arch/arm/mach-pxa/include/mach/magician.h |  70 ++-
>>  arch/arm/mach-pxa/magician.c  | 907 
>> +-
>>  2 files changed, 678 insertions(+), 299 deletions(-)
>>
>> -- 
>> 1.7.12.1
>>
>>
>> ___
>> linux-arm-kernel mailing list
>> linux-arm-ker...@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

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

Re: [PATCH 3/5] clk: imx7d: add ADC root clock

2015-10-08 Thread Shawn Guo
On Thu, Oct 08, 2015 at 11:35:56AM -0700, Stephen Boyd wrote:
> On 10/08, Haibo Chen wrote:
> > Add ADC root clock support in imx7d clock tree.
> > 
> > Signed-off-by: Haibo Chen 
> > ---
> 
> I see no cover letter indicating how you want this merged, so:
> 
> Acked-by: Stephen Boyd 

To clarify, I applied it on my imx/clk branch, which will be sent to you
and Mike later.

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


Re: [PATCH 3/5] clk: imx7d: add ADC root clock

2015-10-08 Thread Shawn Guo
On Thu, Oct 08, 2015 at 11:35:56AM -0700, Stephen Boyd wrote:
> On 10/08, Haibo Chen wrote:
> > Add ADC root clock support in imx7d clock tree.
> > 
> > Signed-off-by: Haibo Chen 
> > ---
> 
> I see no cover letter indicating how you want this merged, so:
> 
> Acked-by: Stephen Boyd 

Applied on IMX tree.

Shawn
--
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] powerpc: Quick fix upstream main line build error on PowerPC

2015-10-08 Thread Dongsheng Wang
From: Wang Dongsheng 

This issue caused on 'commit 990486c8af04 ("strscpy: zero any trailing
garbage bytes in the destination")'.

zero_bytemask is not implemented on PowerPC. So copy the zero_bytemask
of BIG_ENDIAN implementation from include/asm-generic/word-at-a-time.h
to arch/powerpc/include/asm/word-at-a-time.h.

Build message:
lib/string.c: In function 'strscpy':
lib/string.c:209:4: error: implicit declaration of function
'zero_bytemask' [-Werror=implicit-function-declaration]
*(unsigned long *)(dest+res) = c & zero_bytemask(data);
cc1: some warnings being treated as errors
make[1]: *** [lib/string.o] Error 1
make[1]: *** Waiting for unfinished jobs

Signed-off-by: Wang Dongsheng 

diff --git a/arch/powerpc/include/asm/word-at-a-time.h 
b/arch/powerpc/include/asm/word-at-a-time.h
index 5b3a903..d891456 100644
--- a/arch/powerpc/include/asm/word-at-a-time.h
+++ b/arch/powerpc/include/asm/word-at-a-time.h
@@ -40,6 +40,10 @@ static inline bool has_zero(unsigned long val, unsigned long 
*data, const struct
return (val + c->high_bits) & ~rhs;
 }
 
+#ifndef zero_bytemask
+#define zero_bytemask(mask) (~1ul << __fls(mask))
+#endif
+
 #else
 
 #ifdef CONFIG_64BIT
-- 
2.1.0.27.g96db324

--
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 v3] PCI: Xilinx-NWL-PCIe: Added support for Xilinx NWL PCIe Host Controller

2015-10-08 Thread Bharat Kumar Gogada
On 06/10/15 17:27, Bharat Kumar Gogada wrote:
> Subject: Re: [PATCH v3] PCI: Xilinx-NWL-PCIe: Added support for Xilinx 
> NWL PCIe Host Controller

[...]

>> +struct nwl_msi {/* struct nwl_msi - MSI information */
>> +struct msi_controller chip; /* chip: MSI controller */
> 
>> We're moving away from msi_controller altogether, as the kernel now 
>> has all the necessary infrastructure to do this properly.
> 
> Our current GIC version does not have separate msi controller (we are 
> not using GICv2m or GICv3), so is it necessary to have separate msi 
> controller node ? Please give me clarity on this.

This has nothing to do with the version of the GIC you are using (XGene doesn't 
have GICv2m or v3 either). This is about reducing code duplication and having 
something that we can maintain. See also
https://lkml.org/lkml/2015/9/20/193 for yet another example.

I still plan to kill msi_controller, and I'd like to avoid more dependencies 
with it. MSI domains are the way to do it.

Since we don't have separate MSI controller, and our PCIe controller is 
handling MSI, is it necessary to create a separate MSI controller node because 
we don't have any 'reg' space. 
Please let me know whether we require a separate msi file as suggested in your 
previous comments to separate MSI controller and PCIE controller in two files, 
if we don't have separate node. 
If we do not need a separate node do we need to embed MSI controller child node 
 in PCIe controller node itself, and what properties does this child node will 
require other than 'interrupts'.

Bharat

Thanks,

M.
--
Jazz is not dead. It just smells funny...
--
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: Re: Re: Re: Re: Re: [PATCH v3] arm: Adding support for atomic half word exchange

2015-10-08 Thread Sarbojit Ganguly
Thank you Will, I will make the required corrections and mail it to
patchesAtarm.linux.co.uk and mark [1] as "superseded".

Sarbojit

[1] http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=8442/1
--- Original Message ---
Sender : Will Deacon
Date : Oct 08, 2015 22:26 (GMT+05:30)
Title : Re: Re: Re: Re: Re: [PATCH v3] arm: Adding support for atomic half word 
exchange

On Wed, Oct 07, 2015 at 02:36:41PM +, Sarbojit Ganguly wrote:
> Please have a look at this patch, please let me know if any modification
> is required.
> I have also submitted the same in your patch system.

There are some problems with the version in the patch system[1]:

  (1) You still have the changelog in the commit message (I asked you to
  remove this last time).

  (2) The commit message isn't line-wrapper appropriately

  (3) Your Signed-off-by line is truncated

The patch system does actually support git, so you can add:

  KernelVersion: 4.3-rc4

or whatever kernel you based your patch on somewhere after your SoB but
before the diff and then mail it to patchesATarm.linux.org.uk. You
probably also want to move the current patch to "superseded" so Russell
doesn't end up with two copies.

Will

[1] http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=8442/1


?
???   ??   ?? ??
--+
The Tao lies beyond Yin and Yang. It is silent and still as a pool of water.
  |
It does not seek fame, therefore nobody knows its presence. 
  |
It does not seek fortune, for it is complete within itself. 
  |
It exists beyond space and time.
  |
--+N‹§²æìr¸›yúèšØb²X¬¶Ç§vØ^–)Þº{.nÇ+‰·¥Š{±‘êçzX§¶›¡Ü¨}©ž²Æ
 
zÚ:+v‰¨¾«‘êçzZ+€Ê+zf£¢·hšˆ§~†­†Ûiÿûàz¹®w¥¢¸?™¨è­Ú&¢)ߢf”ù^jÇ«y§m…á@A«a¶Úÿ
0¶ìh®å’i

Re: CFS scheduler unfairly prefers pinned tasks

2015-10-08 Thread Mike Galbraith
On Fri, 2015-10-09 at 08:55 +1100, paul.sz...@sydney.edu.au wrote:

> >> Good to see that you agree ...
> > Weeell, we've disagreed on pretty much everything ...
> 
> Sorry I disagree: we do agree on the essence. :-)

P.S.

To some extent.  If the essence is $subject, nope, we definitely
disagree.  If the essence is that _group_ scheduling is not strictly
fair, then we agree.  The must be fixed bit, I also disagree with.
Maybe wants fixing I can agree with ;-) 

-Mike

--
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/1] x86/io_apic: suppress compiler warning

2015-10-08 Thread Jiang Liu
On 2015/10/8 23:55, Andy Shevchenko wrote:
> We have to define internally used function as static, otherwise the following
> warning will be generated:
> 
> arch/x86/kernel/apic/io_apic.c:532:6: warning: no previous prototype for 
> ‘eoi_ioapic_pin’ [-Wmissing-prototypes]
Hi Andy,
Thanks for fixing this.
Reviewed-by: Jiang Liu 

> 
> Signed-off-by: Andy Shevchenko 
> ---
>  arch/x86/kernel/apic/io_apic.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
> index 5c60bb1..b5a0e3c 100644
> --- a/arch/x86/kernel/apic/io_apic.c
> +++ b/arch/x86/kernel/apic/io_apic.c
> @@ -529,7 +529,7 @@ static void __eoi_ioapic_pin(int apic, int pin, int 
> vector)
>   }
>  }
>  
> -void eoi_ioapic_pin(int vector, struct mp_chip_data *data)
> +static void eoi_ioapic_pin(int vector, struct mp_chip_data *data)
>  {
>   unsigned long flags;
>   struct irq_pin_list *entry;
> 
--
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 V3 2/9] kernel/profile.c: Replace cpu_to_mem() with cpu_to_node()

2015-10-08 Thread Jiang Liu
On 2015/8/20 8:00, David Rientjes wrote:
> On Wed, 19 Aug 2015, Jiang Liu wrote:
> 
>> On 2015/8/18 8:31, David Rientjes wrote:
>>> On Mon, 17 Aug 2015, Jiang Liu wrote:
>>>
 Function profile_cpu_callback() allocates memory without specifying
 __GFP_THISNODE flag, so replace cpu_to_mem() with cpu_to_node()
 because cpu_to_mem() may cause suboptimal memory allocation if
 there's no free memory on the node returned by cpu_to_mem().

>>>
>>> Why is cpu_to_node() better with regard to free memory and NUMA locality?
>> Hi David,
>>  Thanks for review. This is a special case pointed out by Tejun.
>> For the imagined topology, A<->B<->X<->C<->D, where A, B, C, D has
>> memory and X is memoryless.
>> Possible fallback lists are:
>> B: [ B, A, C, D]
>> X: [ B, C, A, D]
>> C: [ C, D, B, A]
>>
>> cpu_to_mem(X) will either return B or C. Let's assume it returns B.
>> Then we will use "B: [ B, A, C, D]" to allocate memory for X, which
>> is not the optimal fallback list for X. And cpu_to_node(X) returns
>> X, and "X: [ B, C, A, D]" is the optimal fallback list for X.
> 
> Ok, that makes sense, but I would prefer that this 
> alloc_pages_exact_node() change to alloc_pages_node() since, as you 
> mention in your commit message, __GFP_THISNODE is not set.
Hi David,
Sorry for slow response due to personal reasons!
Function alloc_pages_exact_node() has been renamed as
__alloc_pages_node() by commit 96db800f5d73, and __alloc_pages_node()
is a slightly optimized version of alloc_pages_node() which doesn't
fallback to current node for nid == NUMA_NO_NODE case. So it would
be better to keep using __alloc_pages_node() because cpu_to_node()
always returns valid node id.
Thanks!
Gerry

> 
> In the longterm, if we setup both zonelists correctly (no __GFP_THISNODE 
> and with __GFP_THISNODE), then I'm not sure there's any reason to ever use 
> cpu_to_mem() for alloc_pages().
> --
> 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/


systemtap 2.9 release

2015-10-08 Thread Frank Ch. Eigler
The SystemTap team announces release 2.9!

  More compiler optimizations, prologue-searching option, backtracing
  with kernel symbols without debuginfo, callee probe extensions,
  STAP_PRINTF embedded-C macro, improved debuginfo-related
  diagnostics, and more tapset functions, reduced translator memory
  usage.


= Where to get it

  https://sourceware.org/systemtap/ - our project page
  https://sourceware.org/systemtap/ftp/releases/systemtap-2.9.tar.gz
  https://koji.fedoraproject.org/koji/packageinfo?packageID=615
  git tag release-2.9 (commit 7009f2f782e5)

  There have been over 232.66 commits since the last release.
  There have been between 50 and 500 bugs fixed / features added
  since the last release.  Closer to 50.

= How to build it

  See the README and NEWS files at
  https://sourceware.org/git/?p=systemtap.git;a=tree

  Further information at https://sourceware.org/systemtap/wiki/


= SystemTap frontend (stap) changes

- New --prologue-searching[=WHEN] option has been added to stap with '-P' being
  its short counterpart.  Using --prologue-searching=never turns prologue
  searching deliberately off working around issue of int_arg() returning wrong
  value when a 32-bit userspace binary having debug info is being probed with
  active prologue searching.

- Callee probe points now support '.return' and '.call' suffix.
  For example,
process("proc").function("foo").callee("bar").return
  will fire upon returning from bar when called by foo.
process("proc").function("foo").callee("bar").call
  will only fire for non-inlined callees.

- SystemTap has reduced its memory consumption by using interned_strings (a
  wrapper for boost::string_ref) in place of std::string instances. The change
  is to reduce the number of duplicate strings created by replacing them with
  interned_strings which act like pointers to existing strings.


= SystemTap script language changes

- Embedded-C functions may now use the new STAP_PRINTF(fmt, ...)
  macro for output.

- Embedded-C functions with parameter arity-0 can now be marked with
  the /* stable */ /* pure */ pragmas, if (roughly speaking) the
  function is side-effect-free and idempotent.  The translator may
  execute these speculatively and have their results memoized.  This
  lets probes with multiple calls to such functions run faster. 
  
  Context variable ($foo) getter functions (in non-guru mode), and
  numerous tapset functions are now marked as /* stable */ /* pure */.
  Several example scripts have been modified to eschew explicit
  memoization.


= SystemTap runtime changes

- SystemTap now uses symbols from /proc/kallsyms when kernel debuginfo is not
  available.

- When using the procfs .maxsize() parameter, an error will be generated if the
  buffer is too small.


= SystemTap tapset changes
  
  logging.stp new assert() function
  many uses of error() in registers.stp 
  have been replaced in favor of assert()
  dentry.stp  new functions fullpath_struct_path() and
  fullpath_struct_nameidata() resolve full path
  names from internal kernel struct pointers,
  fullpath_struct_file gets the full path to root
  task.stpnew function task_fd_lookup gets the file struct
  for a task's fd 
  registers.stp   new functions arch_bytes() and uarch_bytes()
  to obtain address size of kernel and user space
  switchfile.stp  new function switch_file() allows control over
  rotation of output files

- The [nd_]syscall tapset got autodocumented. Related paragraph got added to PDF
  and HTML tapset reference. Also a new tapset::syscall 3stap man page got 
added.

- The following tapset variables and functions are deprecated in
  version 2.9:
  - The '__int32_compat' library macro got deprecated in favor of
new '__compat_long' library macro.
  - The 'uargs' convenience variable of the 'seccomp' syscall probe
got deprecated in favor of new 'uargs_uaddr' variable.
  - The powerpc variant of nd_syscall.compat_sysctl got deprecated on favor of
nd_syscall.sysctl32. This aligns the nd_syscall to its respective syscall 
and
to ia64/s390/x86_64 variants too.


= SystemTap sample scripts

- New samples:
  switchfile.stp  every second print a log message 
  and switch log files every 5 seconds.
  slowvfs.stp prints a line for every kernel vfs_open
  operation that takes longer than a
  configurable number of microseconds.


= Examples of tested kernel versions

  2.6.18 (RHEL 5 x86 and x86_64)
  2.6.32 (RHEL 6 x86 and x86_64)
  3.10.0 (RHEL 7 x86_64)
  4.1.6  (Fedora 22 x86_64)
  4.3.0-rc3 (Fedora rawhide x86_64)

= Known issues with this release

- Some kernel crashes continue to be reported when a script probes
  broad kernel function wildcards.  (PR2725)

- 32-on-64 bit userspace unwinding is truncated on older kernels, such
  as 2.6.32 (PR15757)

- 

Re: [PATCH v4 12/26] ARM: pxa: magician: Rename charger cable detection EGPIOs

2015-10-08 Thread Petr Cvek
Dne 3.10.2015 v 14:38 Philipp Zabel napsal(a):
> Am Montag, den 28.09.2015, 23:32 +0200 schrieb Petr Cvek:
>> This patch renames EGPIOs, which are used for the charging cable
>> presence
>> and type detection. Old names did not correspond with an observed
>> functionality (on board_id 0x3a). The behavior is not:
>>
>> - AC charger
>> - USB charger
>> - Cable detection
>>
>> , but:
>>
>> - AC/USB type
>> - Cable detection1
>> - Cable detection2
>>
>> This patch fixes a possible typo in the bit offset for the cable
>> detection
>> EGPIO declaration, too.
>>
>> Signed-off-by: Petr Cvek 
> 
> Just to be sure, please tell me what are the values of those three
> EGPIOs while
>   a) wall plug charger plugged in
>   b) usb cable connected to a host plugged in
>   c) no cable plugged in

usb charger none
=== 
0xC00xC00xC0
0xA00xA00xA0
0x610x610x61
0x000x000x00
0x020x030x00//first cable detection and charger type
0x3A0x3A0x3A//send me your board_id
0x090x090x01//second cable detection
0x040x040x04
0x000x000x00
0x000x000x00
0x000x000x00
0x000x000x00
0x000x000x00
0x000x000x00
0x000x000x00
0x000x000x00

I think the charger is original.

> 
> It could well be there are differences between our boards.

Well it is CPLD chip, so they can have different bitstreams (OT: I can think of 
many CPLD HDL enhancements :-D).

Cheers,
Petr
--
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 v5 6/6] dts: mt8173: Add iommu/smi nodes for mt8173

2015-10-08 Thread Yong Wu
This patch add the iommu/larbs nodes for mt8173

Signed-off-by: Yong Wu 
---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi | 81 
 1 file changed, 81 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi 
b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index 42540b2..524d305 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "mt8173-pinfunc.h"
@@ -265,6 +266,17 @@
reg = <0 0x10200620 0 0x20>;
};
 
+   iommu: iommu@10205000 {
+   compatible = "mediatek,mt8173-m4u";
+   reg = <0 0x10205000 0 0x1000>;
+   interrupts = ;
+   clocks = < CLK_INFRA_M4U>;
+   clock-names = "bclk";
+   mediatek,larb = <  
+  >;
+   #iommu-cells = <2>;
+   };
+
apmixedsys: clock-controller@10209000 {
compatible = "mediatek,mt8173-apmixedsys";
reg = <0 0x10209000 0 0x1000>;
@@ -514,29 +526,98 @@
#clock-cells = <1>;
};
 
+   larb0: larb@14021000 {
+   compatible = "mediatek,mt8173-smi-larb";
+   reg = <0 0x14021000 0 0x1000>;
+   mediatek,smi = <_common>;
+   power-domains = < MT8173_POWER_DOMAIN_MM>;
+   clocks = < CLK_MM_SMI_LARB0>,
+< CLK_MM_SMI_LARB0>;
+   clock-names = "apb", "smi";
+   };
+
+   smi_common: smi@14022000 {
+   compatible = "mediatek,mt8173-smi";
+   reg = <0 0x14022000 0 0x1000>;
+   power-domains = < MT8173_POWER_DOMAIN_MM>;
+   clocks = < CLK_MM_SMI_COMMON>,
+< CLK_MM_SMI_COMMON>;
+   clock-names = "apb", "smi";
+   };
+
+   larb4: larb@14027000 {
+   compatible = "mediatek,mt8173-smi-larb";
+   reg = <0 0x14027000 0 0x1000>;
+   mediatek,smi = <_common>;
+   power-domains = < MT8173_POWER_DOMAIN_MM>;
+   clocks = < CLK_MM_SMI_LARB4>,
+< CLK_MM_SMI_LARB4>;
+   clock-names = "apb", "smi";
+   };
+
imgsys: clock-controller@1500 {
compatible = "mediatek,mt8173-imgsys", "syscon";
reg = <0 0x1500 0 0x1000>;
#clock-cells = <1>;
};
 
+   larb2: larb@15001000 {
+   compatible = "mediatek,mt8173-smi-larb";
+   reg = <0 0x15001000 0 0x1000>;
+   mediatek,smi = <_common>;
+   power-domains = < MT8173_POWER_DOMAIN_ISP>;
+   clocks = < CLK_IMG_LARB2_SMI>,
+< CLK_IMG_LARB2_SMI>;
+   clock-names = "apb", "smi";
+   };
+
vdecsys: clock-controller@1600 {
compatible = "mediatek,mt8173-vdecsys", "syscon";
reg = <0 0x1600 0 0x1000>;
#clock-cells = <1>;
};
 
+   larb1: larb@1601 {
+   compatible = "mediatek,mt8173-smi-larb";
+   reg = <0 0x1601 0 0x1000>;
+   mediatek,smi = <_common>;
+   power-domains = < MT8173_POWER_DOMAIN_VDEC>;
+   clocks = < CLK_VDEC_CKEN>,
+< CLK_VDEC_LARB_CKEN>;
+   clock-names = "apb", "smi";
+   };
+
vencsys: clock-controller@1800 {
compatible = "mediatek,mt8173-vencsys", "syscon";
reg = <0 0x1800 0 0x1000>;
#clock-cells = <1>;
};
 
+   larb3: larb@18001000 {
+   compatible = "mediatek,mt8173-smi-larb";
+   reg = <0 0x18001000 0 0x1000>;
+   mediatek,smi = <_common>;
+   power-domains = < MT8173_POWER_DOMAIN_VENC>;
+   clocks = < CLK_VENC_CKE1>,
+< CLK_VENC_CKE0>;
+   clock-names = "apb", "smi";
+   };
+
vencltsys: clock-controller@1900 {
compatible = "mediatek,mt8173-vencltsys", "syscon";
reg = <0 0x1900 0 0x1000>;
#clock-cells = <1>;

[PATCH v5 3/6] iommu: add ARM short descriptor page table allocator

2015-10-08 Thread Yong Wu
This patch is for ARM Short Descriptor Format.

Signed-off-by: Yong Wu 
---
 drivers/iommu/Kconfig|  18 +
 drivers/iommu/Makefile   |   1 +
 drivers/iommu/io-pgtable-arm-short.c | 827 +++
 drivers/iommu/io-pgtable-arm.c   |   3 -
 drivers/iommu/io-pgtable.c   |   3 +
 drivers/iommu/io-pgtable.h   |  18 +-
 6 files changed, 866 insertions(+), 4 deletions(-)
 create mode 100644 drivers/iommu/io-pgtable-arm-short.c

diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index 4664c2a..a7920fb 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -40,6 +40,24 @@ config IOMMU_IO_PGTABLE_LPAE_SELFTEST
 
  If unsure, say N here.
 
+config IOMMU_IO_PGTABLE_SHORT
+   bool "ARMv7/v8 Short Descriptor Format"
+   select IOMMU_IO_PGTABLE
+   depends on HAS_DMA && (ARM || ARM64 || COMPILE_TEST)
+   help
+ Enable support for the ARM Short-descriptor pagetable format.
+ This allocator supports 2 levels of translation tables, which
+ enables a 32-bit memory map based on memory sections or pages.
+
+config IOMMU_IO_PGTABLE_SHORT_SELFTEST
+   bool "Short Descriptor selftests"
+   depends on IOMMU_IO_PGTABLE_SHORT
+   help
+ Enable self-tests for Short-descriptor page table allocator.
+ This performs a series of page-table consistency checks during boot.
+
+ If unsure, say N here.
+
 endmenu
 
 config IOMMU_IOVA
diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile
index c6dcc51..06df3e6 100644
--- a/drivers/iommu/Makefile
+++ b/drivers/iommu/Makefile
@@ -3,6 +3,7 @@ obj-$(CONFIG_IOMMU_API) += iommu-traces.o
 obj-$(CONFIG_IOMMU_API) += iommu-sysfs.o
 obj-$(CONFIG_IOMMU_IO_PGTABLE) += io-pgtable.o
 obj-$(CONFIG_IOMMU_IO_PGTABLE_LPAE) += io-pgtable-arm.o
+obj-$(CONFIG_IOMMU_IO_PGTABLE_SHORT) += io-pgtable-arm-short.o
 obj-$(CONFIG_IOMMU_IOVA) += iova.o
 obj-$(CONFIG_OF_IOMMU) += of_iommu.o
 obj-$(CONFIG_MSM_IOMMU) += msm_iommu.o msm_iommu_dev.o
diff --git a/drivers/iommu/io-pgtable-arm-short.c 
b/drivers/iommu/io-pgtable-arm-short.c
new file mode 100644
index 000..6337c61
--- /dev/null
+++ b/drivers/iommu/io-pgtable-arm-short.c
@@ -0,0 +1,827 @@
+/*
+ * Copyright (c) 2014-2015 MediaTek Inc.
+ * Author: Yong Wu 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#include 
+#include 
+#include 
+#include 
+#include "io-pgtable.h"
+
+typedef u32 arm_short_iopte;
+
+struct arm_short_io_pgtable {
+   struct io_pgtable   iop;
+   struct kmem_cache   *pgtable_cached;
+   size_t  pgd_size;
+   void*pgd;
+};
+
+#define io_pgtable_to_data(x)  \
+   container_of((x), struct arm_short_io_pgtable, iop)
+
+#define io_pgtable_ops_to_data(x)  \
+   io_pgtable_to_data(io_pgtable_ops_to_pgtable(x))
+
+#define io_pgtable_cfg_to_pgtable(x)   \
+   container_of((x), struct io_pgtable, cfg)
+
+#define io_pgtable_cfg_to_data(x)  \
+   io_pgtable_to_data(io_pgtable_cfg_to_pgtable(x))
+
+#define ARM_SHORT_PGDIR_SHIFT  20
+#define ARM_SHORT_PAGE_SHIFT   12
+#define ARM_SHORT_PTRS_PER_PTE \
+   (1 << (ARM_SHORT_PGDIR_SHIFT - ARM_SHORT_PAGE_SHIFT))
+#define ARM_SHORT_BYTES_PER_PTE\
+   (ARM_SHORT_PTRS_PER_PTE * sizeof(arm_short_iopte))
+
+/* level 1 pagetable */
+#define ARM_SHORT_PGD_TYPE_PGTABLE BIT(0)
+#define ARM_SHORT_PGD_TYPE_SECTION BIT(1)
+#define ARM_SHORT_PGD_BBIT(2)
+#define ARM_SHORT_PGD_CBIT(3)
+#define ARM_SHORT_PGD_PGTABLE_NS   BIT(3)
+#define ARM_SHORT_PGD_SECTION_XN   BIT(4)
+#define ARM_SHORT_PGD_IMPLEBIT(9)
+#define ARM_SHORT_PGD_RD_WR(3 << 10)
+#define ARM_SHORT_PGD_RDONLY   BIT(15)
+#define ARM_SHORT_PGD_SBIT(16)
+#define ARM_SHORT_PGD_nG   BIT(17)
+#define ARM_SHORT_PGD_SUPERSECTION BIT(18)
+#define ARM_SHORT_PGD_SECTION_NS   BIT(19)
+
+#define ARM_SHORT_PGD_TYPE_SUPERSECTION\
+   (ARM_SHORT_PGD_TYPE_SECTION | ARM_SHORT_PGD_SUPERSECTION)
+#define ARM_SHORT_PGD_SECTION_TYPE_MSK \
+   (ARM_SHORT_PGD_TYPE_SECTION | ARM_SHORT_PGD_SUPERSECTION)
+#define ARM_SHORT_PGD_PGTABLE_TYPE_MSK \
+   (ARM_SHORT_PGD_TYPE_SECTION | ARM_SHORT_PGD_TYPE_PGTABLE)
+#define 

[PATCH v5 5/6] iommu/mediatek: Add mt8173 IOMMU driver

2015-10-08 Thread Yong Wu
This patch adds support for mediatek m4u (MultiMedia Memory Management
Unit).

Signed-off-by: Yong Wu 
---
 drivers/iommu/Kconfig |  15 +
 drivers/iommu/Makefile|   1 +
 drivers/iommu/mtk_iommu.c | 767 ++
 3 files changed, 783 insertions(+)
 create mode 100644 drivers/iommu/mtk_iommu.c

diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index a7920fb..b964364 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -387,4 +387,19 @@ config ARM_SMMU_V3
  Say Y here if your system includes an IOMMU device implementing
  the ARM SMMUv3 architecture.
 
+config MTK_IOMMU
+   bool "MTK IOMMU Support"
+   depends on ARCH_MEDIATEK || COMPILE_TEST
+   select IOMMU_API
+   select IOMMU_DMA
+   select IOMMU_IO_PGTABLE_SHORT
+   select MEMORY
+   select MTK_SMI
+   help
+ Support for the M4U on certain Mediatek SOCs. M4U is MultiMedia
+ Memory Management Unit. This option enables remapping of DMA memory
+ accesses for the multimedia subsystem.
+
+ If unsure, say N here.
+
 endif # IOMMU_SUPPORT
diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile
index 06df3e6..f4f2f2c 100644
--- a/drivers/iommu/Makefile
+++ b/drivers/iommu/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_ROCKCHIP_IOMMU) += rockchip-iommu.o
 obj-$(CONFIG_TEGRA_IOMMU_GART) += tegra-gart.o
 obj-$(CONFIG_TEGRA_IOMMU_SMMU) += tegra-smmu.o
 obj-$(CONFIG_EXYNOS_IOMMU) += exynos-iommu.o
+obj-$(CONFIG_MTK_IOMMU) += mtk_iommu.o
 obj-$(CONFIG_SHMOBILE_IOMMU) += shmobile-iommu.o
 obj-$(CONFIG_SHMOBILE_IPMMU) += shmobile-ipmmu.o
 obj-$(CONFIG_FSL_PAMU) += fsl_pamu.o fsl_pamu_domain.o
diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
new file mode 100644
index 000..39839f7
--- /dev/null
+++ b/drivers/iommu/mtk_iommu.c
@@ -0,0 +1,767 @@
+/*
+ * Copyright (c) 2014-2015 MediaTek Inc.
+ * Author: Yong Wu 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "io-pgtable.h"
+
+#define REG_MMU_PT_BASE_ADDR   0x000
+
+#define REG_MMU_INVALIDATE 0x020
+#define F_ALL_INVLD0x2
+#define F_MMU_INV_RANGE0x1
+
+#define REG_MMU_INVLD_START_A  0x024
+#define REG_MMU_INVLD_END_A0x028
+
+#define REG_MMU_INV_SEL0x038
+#define F_INVLD_EN0BIT(0)
+#define F_INVLD_EN1BIT(1)
+
+#define REG_MMU_STANDARD_AXI_MODE  0x048
+#define REG_MMU_DCM_DIS0x050
+
+#define REG_MMU_CTRL_REG   0x110
+#define F_MMU_PREFETCH_RT_REPLACE_MOD  BIT(4)
+#define F_MMU_TF_PROTECT_SEL(prot) (((prot) & 0x3) << 5)
+#define F_COHERENCE_EN BIT(8)
+
+#define REG_MMU_IVRP_PADDR 0x114
+#define F_MMU_IVRP_PA_SET(pa)  ((pa) >> 1)
+
+#define REG_MMU_INT_CONTROL0   0x120
+#define F_L2_MULIT_HIT_EN  BIT(0)
+#define F_TABLE_WALK_FAULT_INT_EN  BIT(1)
+#define F_PREETCH_FIFO_OVERFLOW_INT_EN BIT(2)
+#define F_MISS_FIFO_OVERFLOW_INT_ENBIT(3)
+#define F_PREFETCH_FIFO_ERR_INT_EN BIT(5)
+#define F_MISS_FIFO_ERR_INT_EN BIT(6)
+#define F_INT_L2_CLR_BIT   BIT(12)
+
+#define REG_MMU_INT_MAIN_CONTROL   0x124
+#define F_INT_TRANSLATION_FAULTBIT(0)
+#define F_INT_MAIN_MULTI_HIT_FAULT BIT(1)
+#define F_INT_INVALID_PA_FAULT BIT(2)
+#define F_INT_ENTRY_REPLACEMENT_FAULT  BIT(3)
+#define F_INT_TLB_MISS_FAULT   BIT(4)
+#define F_INT_MISS_TRANSATION_FIFO_FAULT   BIT(5)
+#define F_INT_PRETETCH_TRANSATION_FIFO_FAULT   BIT(6)
+
+#define REG_MMU_CPE_DONE   0x12C
+
+#define REG_MMU_FAULT_ST1  0x134
+
+#define REG_MMU_FAULT_VA   0x13c
+#define F_MMU_FAULT_VA_MSK 0xf000
+#define F_MMU_FAULT_VA_WRITE_BIT   BIT(1)
+#define F_MMU_FAULT_VA_LAYER_BIT   BIT(0)
+
+#define REG_MMU_INVLD_PA   0x140
+#define REG_MMU_INT_ID 0x150
+#define F_MMU0_INT_ID_LARB_ID(a)   (((a) >> 7) & 0x7)
+#define F_MMU0_INT_ID_PORT_ID(a)

[PATCH v5 4/6] memory: mediatek: Add SMI driver

2015-10-08 Thread Yong Wu
This patch add SMI(Smart Multimedia Interface) driver. This driver
is responsible to enable/disable iommu and control the clocks of each
local arbiter

Signed-off-by: Yong Wu 
---
 drivers/memory/Kconfig |   8 ++
 drivers/memory/Makefile|   1 +
 drivers/memory/mtk-smi.c   | 274 +
 include/soc/mediatek/smi.h |  60 ++
 4 files changed, 343 insertions(+)
 create mode 100644 drivers/memory/mtk-smi.c
 create mode 100644 include/soc/mediatek/smi.h

diff --git a/drivers/memory/Kconfig b/drivers/memory/Kconfig
index c6a644b..6eab27c 100644
--- a/drivers/memory/Kconfig
+++ b/drivers/memory/Kconfig
@@ -108,6 +108,14 @@ config JZ4780_NEMC
  the Ingenic JZ4780. This controller is used to handle external
  memory devices such as NAND and SRAM.
 
+config MTK_SMI
+   bool
+   depends on ARCH_MEDIATEK || COMPILE_TEST
+   help
+ This driver is for the Memory Controller module in MediaTek SoCs,
+ mainly help enable/disable iommu and control the clock for each
+ local arbiter.
+
 source "drivers/memory/tegra/Kconfig"
 
 endif
diff --git a/drivers/memory/Makefile b/drivers/memory/Makefile
index 1c46af5..890bdf4 100644
--- a/drivers/memory/Makefile
+++ b/drivers/memory/Makefile
@@ -15,5 +15,6 @@ obj-$(CONFIG_FSL_IFC) += fsl_ifc.o
 obj-$(CONFIG_MVEBU_DEVBUS) += mvebu-devbus.o
 obj-$(CONFIG_TEGRA20_MC)   += tegra20-mc.o
 obj-$(CONFIG_JZ4780_NEMC)  += jz4780-nemc.o
+obj-$(CONFIG_MTK_SMI)  += mtk-smi.o
 
 obj-$(CONFIG_TEGRA_MC) += tegra/
diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
new file mode 100644
index 000..2d9d61b
--- /dev/null
+++ b/drivers/memory/mtk-smi.c
@@ -0,0 +1,274 @@
+/*
+ * Copyright (c) 2014-2015 MediaTek Inc.
+ * Author: Yong Wu 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define SMI_LARB_MMU_EN0xf00
+#define F_SMI_MMU_EN(port) BIT(port)
+
+struct mtk_smi_data {
+   struct clk  *clk_apb;
+   struct clk  *clk_smi;
+};
+
+struct mtk_larb_data { /* larb: local arbiter */
+   void __iomem*base;
+   struct clk  *clk_apb;
+   struct clk  *clk_smi;
+   struct device   *smidev;
+};
+
+struct mtk_larb_mmu {
+   u32 mmu;
+};
+
+static int __mtk_smi_get(struct device *dev, struct clk *apb, struct clk *smi)
+{
+   int ret;
+
+   ret = pm_runtime_get_sync(dev);
+   if (ret < 0)
+   return ret;
+
+   ret = clk_prepare_enable(apb);
+   if (ret) {
+   dev_err(dev, "Failed to enable the apb clock\n");
+   goto err_put_pm;
+   }
+   ret = clk_prepare_enable(smi);
+   if (ret) {
+   dev_err(dev, "Failed to enable the smi clock\n");
+   goto err_disable_apb;
+   }
+   return 0;
+
+err_disable_apb:
+   clk_disable_unprepare(apb);
+err_put_pm:
+   pm_runtime_put(dev);
+   return ret;
+}
+
+static void __mtk_smi_put(struct device *dev, struct clk *apb, struct clk *smi)
+{
+   clk_disable_unprepare(smi);
+   clk_disable_unprepare(apb);
+   pm_runtime_put(dev);
+}
+
+int mtk_smi_larb_get(struct device *larbdev)
+{
+   struct mtk_larb_data *larbdata = dev_get_drvdata(larbdev);
+   struct mtk_smi_data *smidata = dev_get_drvdata(larbdata->smidev);
+   struct mtk_larb_mmu *mmucfg = larbdev->platform_data;
+   int ret;
+
+   /* Enable smidev's power and clockes firstly, then enable the larb's. */
+   ret = __mtk_smi_get(larbdata->smidev, smidata->clk_apb,
+   smidata->clk_smi);
+   if (ret)
+   return ret;
+
+   ret = __mtk_smi_get(larbdev, larbdata->clk_apb, larbdata->clk_smi);
+   if (ret)
+   goto err_put_smi;
+
+   /* config iommu */
+   writel_relaxed(mmucfg->mmu, larbdata->base + SMI_LARB_MMU_EN);
+
+   return ret;
+
+err_put_smi:
+   __mtk_smi_put(larbdata->smidev, smidata->clk_apb, smidata->clk_smi);
+   return ret;
+}
+
+void mtk_smi_larb_put(struct device *larbdev)
+{
+   struct mtk_larb_data *larbdata = dev_get_drvdata(larbdev);
+   struct mtk_smi_data *smidata = dev_get_drvdata(larbdata->smidev);
+
+   __mtk_smi_put(larbdev, larbdata->clk_apb, larbdata->clk_smi);
+   __mtk_smi_put(larbdata->smidev, smidata->clk_apb, smidata->clk_smi);
+}
+
+int 

[PATCH v5 1/6] dt-bindings: iommu: Add binding for mediatek IOMMU

2015-10-08 Thread Yong Wu
This patch add mediatek iommu dts binding document.

Signed-off-by: Yong Wu 
---
 .../devicetree/bindings/iommu/mediatek,iommu.txt   |  61 
 include/dt-bindings/memory/mt8173-larb-port.h  | 105 +
 2 files changed, 166 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iommu/mediatek,iommu.txt
 create mode 100644 include/dt-bindings/memory/mt8173-larb-port.h

diff --git a/Documentation/devicetree/bindings/iommu/mediatek,iommu.txt 
b/Documentation/devicetree/bindings/iommu/mediatek,iommu.txt
new file mode 100644
index 000..d515e47
--- /dev/null
+++ b/Documentation/devicetree/bindings/iommu/mediatek,iommu.txt
@@ -0,0 +1,61 @@
+* Mediatek IOMMU Architecture Implementation
+
+  Mediatek Socs may contain a implementation of Multimedia Memory
+Management Unit(M4U),which use ARM Short-descriptor translation table
+to achieve address translation.
+
+  The IOMMU Hardware Block Diagram, please check below:
+
+  EMI (External Memory Interface)
+   |
+  m4u (Multimedia Memory Management Unit)
+   |
+  smi (Smart Multimedia Interface)
+   |
++---+---
+|   |
+|   |
+vdec larb   disp larb  ... SoCs have different local arbiter(larb).
+|   |
+|   |
+   ++++-+-+
+   |||| | |...
+   |||| | |...
+   |||| | |...
+  MC   PP   VLD  OVL0 RDMA0 WDMA0  ... There are different ports in each larb.
+
+  As above, The Multimedia HW will go through SMI and M4U while it
+access EMI. SMI is a brige between m4u and the Multimedia HW. It contain
+smi local arbiter and smi common. It will control whether the Multimedia
+HW should go though the m4u for translation or bypass it and talk
+directly with EMI. And also SMI help control the clocks for each
+local arbiter.
+  Normally we specify a local arbiter(larb) for each multimedia HW
+like display, video decode, and camera. And there are different ports
+in each larb. Take a example, There are some ports like MC, PP, VLD in the
+video decode local arbiter, all the ports are according to the video HW.
+
+Required properties:
+- compatible : must be "mediatek,mt8173-m4u".
+- reg : m4u register base and size.
+- interrupts : the interrupt of m4u.
+- clocks : must contain one entry for each clock-names.
+- clock-names : must be "bclk", It is the block clock of m4u.
+- mediatek,larb : List of phandle to the local arbiters in the current Socs.
+   Refer to bindings/memory-controllers/mediatek,smi-larb.txt. It must sort
+   according to the local arbiter index, like larb0, larb1, larb2...
+- iommu-cells : must be 2. There are 2 cells needed to enable/disable iommu.
+   The first one is local arbiter index(larbid), and the other is port
+   index(portid) within local arbiter. Specifies the larbid and portid as
+   defined in dt-binding/memory/mt8173-larb-port.h.
+
+Example:
+   iommu: iommu@10205000 {
+   compatible = "mediatek,mt8173-m4u";
+   reg = <0 0x10205000 0 0x1000>;
+   interrupts = ;
+   clocks = < CLK_INFRA_M4U>;
+   clock-names = "bclk";
+   mediatek,larb = < >;
+   #iommu-cells = <2>;
+   };
diff --git a/include/dt-bindings/memory/mt8173-larb-port.h 
b/include/dt-bindings/memory/mt8173-larb-port.h
new file mode 100644
index 000..8e5b716
--- /dev/null
+++ b/include/dt-bindings/memory/mt8173-larb-port.h
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2014-2015 MediaTek Inc.
+ * Author: Yong Wu 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#ifndef __DTS_IOMMU_PORT_MT8173_H
+#define __DTS_IOMMU_PORT_MT8173_H
+
+#define M4U_LARB0_ID   0
+#define M4U_LARB1_ID   1
+#define M4U_LARB2_ID   2
+#define M4U_LARB3_ID   3
+#define M4U_LARB4_ID   4
+#define M4U_LARB5_ID   5
+
+/* larb0 */
+#define M4U_PORT_DISP_OVL0 0
+#define M4U_PORT_DISP_RDMA01
+#define M4U_PORT_DISP_WDMA02
+#define M4U_PORT_DISP_OD_R 3
+#define M4U_PORT_DISP_OD_W 4
+#define M4U_PORT_MDP_RDMA0 5
+#define M4U_PORT_MDP_WDMA  6
+#define M4U_PORT_MDP_WROT0 7
+
+/* larb1 */
+#define M4U_PORT_HW_VDEC_MC_EXT0
+#define M4U_PORT_HW_VDEC_PP_EXT1
+#define M4U_PORT_HW_VDEC_UFO_EXT

[PATCH v5 2/6] dt-bindings: mediatek: Add smi dts binding

2015-10-08 Thread Yong Wu
This patch add smi binding document.

Signed-off-by: Yong Wu 
---
 .../memory-controllers/mediatek,smi-larb.txt   | 25 ++
 .../bindings/memory-controllers/mediatek,smi.txt   | 24 +
 2 files changed, 49 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.txt
 create mode 100644 
Documentation/devicetree/bindings/memory-controllers/mediatek,smi.txt

diff --git 
a/Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.txt 
b/Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.txt
new file mode 100644
index 000..55ff3b7
--- /dev/null
+++ b/Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.txt
@@ -0,0 +1,25 @@
+SMI (Smart Multimedia Interface) Local Arbiter
+
+The hardware block diagram please check bindings/iommu/mediatek,iommu.txt
+
+Required properties:
+- compatible : must be "mediatek,mt8173-smi-larb"
+- reg : the register and size of this local arbiter.
+- mediatek,smi : a phandle to the smi_common node.
+- power-domains : a phandle to the power domain of this local arbiter.
+- clocks : Must contain an entry for each entry in clock-names.
+- clock-names: must contain 2 entries, as follows:
+  - "apb" : Advanced Peripheral Bus clock, It's the clock for setting
+   the register.
+  - "smi" : It's the clock for transfer data and command.
+
+Example:
+   larb1: larb@1601 {
+   compatible = "mediatek,mt8173-smi-larb";
+   reg = <0 0x1601 0 0x1000>;
+   mediatek,smi = <_common>;
+   power-domains = < MT8173_POWER_DOMAIN_VDEC>;
+   clocks = < CLK_VDEC_CKEN>,
+< CLK_VDEC_LARB_CKEN>;
+   clock-names = "apb", "smi";
+   };
diff --git 
a/Documentation/devicetree/bindings/memory-controllers/mediatek,smi.txt 
b/Documentation/devicetree/bindings/memory-controllers/mediatek,smi.txt
new file mode 100644
index 000..f54e91c
--- /dev/null
+++ b/Documentation/devicetree/bindings/memory-controllers/mediatek,smi.txt
@@ -0,0 +1,24 @@
+SMI (Smart Multimedia Interface)
+
+The hardware block diagram please check bindings/iommu/mediatek,iommu.txt
+
+Required properties:
+- compatible : must be "mediatek,mt8173-smi"
+- reg : the register and size of the SMI block.
+- power-domains : a phandle to the power domain of this local arbiter.
+- clocks : Must contain an entry for each entry in clock-names.
+- clock-names : must contain 2 entries, as follows:
+  - "apb" : Advanced Peripheral Bus clock, It's the clock for setting
+   the register.
+  - "smi" : It's the clock for transfer data and command.
+  They may be the same if both source clock are the same.
+
+Example:
+   smi_common: smi@14022000 {
+   compatible = "mediatek,mt8173-smi";
+   reg = <0 0x14022000 0 0x1000>;
+   power-domains = < MT8173_POWER_DOMAIN_MM>;
+   clocks = < CLK_MM_SMI_COMMON>,
+< CLK_MM_SMI_COMMON>;
+   clock-names = "apb", "smi";
+   };
-- 
1.8.1.1.dirty

--
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] ethtool: add new emac_regs struct from driver, add new chip types.

2015-10-08 Thread Ben Hutchings
On Fri, 2015-09-25 at 08:15 +0400, Ivan Mikhaylov wrote:
> * add new version of emac_regs struct from driver structure perspective
>   and passing size from actual struct size, not from memory area variable
>   which set in dts file.
> * add three types of network chips for new struct : emac, emac4, emac4sync.
> * add emac4sync processing in print_emac_regs.
> * this commit fixing problem with output of MII sections for new driver 
> versions.
[...]

Applied, thanks.

Ben.

-- 
Ben Hutchings
If the facts do not conform to your theory, they must be disposed of.

signature.asc
Description: This is a digitally signed message part


[PATCH v5 0/6] MT8173 IOMMU SUPPORT

2015-10-08 Thread Yong Wu
  This patch set adds support for m4u(Multimedia Memory Management Unit),
Currently it only support the m4u with 2 levels of pagetable on mt8173.

  It's based on Robin Murphy's latest ARM64 DMA-v6[1]. The dsti is based
on MTK clock patch[2].
 
  Please check the hardware block diagram of Mediatek IOMMU.
 
  EMI (External Memory Interface)
   |
  m4u (Multimedia Memory Management Unit)
   |
  smi (Smart Multimedia Interface)
   |
+---+---
|   |
|   |
vdec larb   disp larb  ... SoCs have different local arbiter(larb).
|   |
|   |
   ++++-+-+
   |||| | |...
   |||| | |...
   |||| | |...
  MC   PP   VLD  OVL0 RDMA0 WDMA0  ... There are different ports in each larb.
  
  Normally we specify a local arbiter(larb) for each multimedia hardware like
display, video decode, video encode and camera. And there are different ports in
each larb. Take a example, there are some ports like MC, PP, UFO, VLD, AVC_MV,
PRED_RD in video larb, all the ports are according to the video hardware.
 
  From the diagram, all the multimedia module connect with m4u via smi.
SMI is responsible to enable/disable iommu and control the clocks for each local
arbiter. If we would like to enable the iommu of video decode, the video decode
HW ports have to be configed. And if the video hardware work whether
enable/disable iommu, it need enable the clock of its larb's clock. And smi also
help bandwidth control for each local. So we add a special driver for smi and
locate it drivers/memory.

v5:
-rebase onto v4.3-rc1.
-About MTK iommu: don't return the same domain while domain_alloc, change the
 domain's flow according to the M4U HW.
-About Short-descriptor: Improve many error-handles, NO_PERMS quirk, and 
 add TLBI_MAP quirk following Will's Suggestion; Add io-pgtable don't use 
 dma_to_phys; Add a loop in arm_short_unmap since iommu_unmap don't care the 
 physical address align.
-About SMI driver: Add a help funcion for some similar code. Add PROPRE_DEFER
 for power-domain as MTK SCPSYS is module_init currently.

v4: http://lists.linuxfoundation.org/pipermail/iommu/2015-August/013903.html
-use only one iommu domain here based on the Robin's DMA-v5:
 http://lists.linuxfoundation.org/pipermail/iommu/2015-July/013900.html
-remove flush_pgtable.
-change writel to writel_relaxed.
-about Short-descriptor: move dma_map_single into io-pgtable-arm-short.
 Improve the flow of free pgtable and add NO_XN+NO_PERMS quirk following
 Will's suggestion.
-Change two sytle issues in dtsi according to Daniel's suggestion.

v3: http://lists.linuxfoundation.org/pipermail/iommu/2015-July/013632.html
-rebased onto v4.2-rc1
-improve iommu flow based on the Robin's DMA v3:
 http://lists.linuxfoundation.org/pipermail/iommu/2015-July/013597.html
-change mtk iommu-cells from 1 to 2.
-about Short-descriptor: add split function; add self-test; add some other bits 
like nG,
 XN according to the spec; add SUPERSECTION and MTK quirk; move 
io_pgtable_ops_to_pgtable
 out from LPAE to the header file.
-about SMI: move from driver/soc/mediatek to driver/memory; change the clocks 
from
 clk[2] to clk_apb and clk_smi; add pm.
-add iommu suspend/resume to backup/restore register.

v2: http://lists.linuxfoundation.org/pipermail/iommu/2015-May/013028.html
-add arm short descriptor support.
-seperate smi common from smi and change the clock-names according
 to smi HW.
-delete the hardcode of the port-names in mt8173.
 replace this with larb-portes-nr in dtsi.
-fix some coding style issues.

v1: http://lists.infradead.org/pipermail/linux-mediatek/2015-March/58.html
-initial version.

[1]: http://lists.linuxfoundation.org/pipermail/iommu/2015-October/014504.html
[2]: http://lists.infradead.org/pipermail/linux-mediatek/2015-August/001962.html

Yong Wu (6):
  dt-bindings: iommu: Add binding for mediatek IOMMU
  dt-bindings: mediatek: Add smi dts binding
  iommu: add ARM short descriptor page table allocator
  memory: mediatek: Add SMI driver
  iommu/mediatek: Add mt8173 IOMMU driver
  dts: mt8173: Add iommu/smi nodes for mt8173

 .../devicetree/bindings/iommu/mediatek,iommu.txt   |  61 ++
 .../memory-controllers/mediatek,smi-larb.txt   |  25 +
 .../bindings/memory-controllers/mediatek,smi.txt   |  24 +
 arch/arm64/boot/dts/mediatek/mt8173.dtsi   |  81 ++
 drivers/iommu/Kconfig  |  33 +
 drivers/iommu/Makefile |   2 +
 drivers/iommu/io-pgtable-arm-short.c   | 827 +
 drivers/iommu/io-pgtable-arm.c |   3 -
 drivers/iommu/io-pgtable.c |   3 +
 drivers/iommu/io-pgtable.h |  18 +-
 drivers/iommu/mtk_iommu.c  | 767 

Re: linux-next: build failure after merge of the chrome-platform tree

2015-10-08 Thread Stephen Rothwell
Hi Olof,

On Thu, 8 Oct 2015 16:43:55 -0700 Olof Johansson  wrote:
>
> Yeah, sorry about that. I got notified by the 0-day builder but by the
> time I had sorted it out you must already have pulled the tree.
> 
> Should be fine today.

Yeah, I saw that, thanks.

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au
--
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: linux-next: manual merge of the tip tree with the crypto-current tree

2015-10-08 Thread Stephen Rothwell
Hi all,

On Fri, 9 Oct 2015 12:47:00 +1100 Stephen Rothwell  
wrote:
>
> diff --cc arch/x86/crypto/camellia_aesni_avx_glue.c
> index bacaa13acac5,12e729bfe71b..
> --- a/arch/x86/crypto/camellia_aesni_avx_glue.c
> +++ b/arch/x86/crypto/camellia_aesni_avx_glue.c
> @@@ -554,12 -554,8 +554,14 @@@ static int __init camellia_aesni_init(v
>   {
>   const char *feature_name;
>   
>  +if (!cpu_has_avx || !cpu_has_aes || !cpu_has_osxsave) {
>  +pr_info("AVX or AES-NI instructions are not detected.\n");
>  +return -ENODEV;
>  +}
>  +
>  +if (!cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, _name)) {

OOPS, I clearly meant to remove that line as well (which I have now done).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au
--
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 v7] clk: bcm2835: Add support for programming the audio domain clocks

2015-10-08 Thread Stephen Warren
On 10/08/2015 07:37 PM, Eric Anholt wrote:
> This adds support for enabling, disabling, and setting the rate of the
> audio domain clocks.  It will be necessary for setting the pixel clock
> for HDMI in the VC4 driver and let us write a cpufreq driver.  It will
> also improve compatibility with user changes to the firmware's
> config.txt, since our previous fixed clocks are unaware of it.
> 
> The firmware also has support for configuring the clocks through the
> mailbox channel, but the pixel clock setup by the firmware doesn't
> work, and it's Raspberry Pi specific anyway.  The only conflicts we
> should have with the firmware would be if we made firmware calls that
> result in clock management (like opening firmware V3D or ISP access,
> which we don't support in upstream), or on hardware over-thermal or
> under-voltage (when the firmware would rewrite PLLB to take the ARM
> out of overclock).  If that happens, our cached .recalc_rate() results
> would be incorrect, but that's no worse than our current state where
> we used fixed clocks.
> 
> The existing fixed clocks in the code are left in place to provide
> backwards compatibility with old device tree files.

Acked-by: Stephen Warren 

--
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: CFS scheduler unfairly prefers pinned tasks

2015-10-08 Thread Mike Galbraith
On Fri, 2015-10-09 at 08:55 +1100, paul.sz...@sydney.edu.au wrote:
> Dear Mike,
> 
> >>> I see a fairness issue ... but one opposite to your complaint.
> >> Why is that opposite? ...
> >
> > Well, not exactly opposite, only opposite in that the one pert task also
> > receives MORE than it's fair share when unpinned.  Two 100$ hogs sharing
> > one CPU should each get 50% of that CPU. ...
> 
> But you are using CGROUPs, grouping all oinks into one group, and the
> one pert into another: requesting each group to get same total CPU.
> Since pert has one process only, the most he can get is 100% (not 400%),
> and it is quite OK for the oinks together to get 700%.

Well, that of course depends on what you call fair.  I realize why and
where it happens.  I told weight adjustment to keep its grubby mitts off
of autogroups, and of course the "problem" went away.  Back to the
viewpoint thing, with two users, each having been _placed_ in a group, I
can well imagine a user who is trying to use all of his authorized
bandwidth raising an eyebrow when he sees one of his tasks getting 24
whole milliseconds per second with an allegedly fair scheduler.

I can see it both ways.  What's going to come out of this is probably
going to be "tough titty, yes, group scheduling has side effects, and
this is one".  I already know it does.  Question is only whether the
weight adjustment gears are spinning as intended or not.

> > IFF ... massively parallel and synchronized ...
> 
> You would be making the assumption that you had the machine to yourself:
> might be the wrong thing to assume.

Yup, it would be a doomed attempt to run a load which cannot thrive in a
shared environment in such an environment.  Are any of the compute loads
you're having trouble with.. in the math department..  perhaps doing oh,
say complex math goop that feeds the output of one parallel computation
into the next parallel computation? :)

-Mike

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


[RFD] pstore: pmsg: ramoops: add multiple pmsg instances

2015-10-08 Thread Hiraku Toyooka
Hello,

I'm trying to make the feature of multiple pmsg instances for ramoops.
I would like to discuss a possible way of getting the feature added to
mainline.

The reason to add the multiple pmsg is to preserve particular
messages over a long time, which are useful for failure analysis.

Currently, we can use /dev/pmsg0 to log userspace messages into pstore.
It is useful but we can use only one pstore buffer even if pstore
backend module (e.g. ramoops) can create multiple buffers. When one
messages happen to be generated repeatedly, old messages are
overwritten by them regardless of the importance of the messages.

Multiple pmsg will solves the problem. If we have two pmsg files:
/dev/pmsg{0,1}, we can write all messages into /dev/pmsg0, while
writing important ones into /dev/pmsg1. It can also be used for
preserving important kernel messages selected by an userspace daemon.

We have two types of files for pmsg. /dev/pmsg0 is for logging and
/sys/fs/pstore/pmsg-$backend-0 is for read. We can extend these files
like pmsg{0,1,2,...}, pmsg-$backend-{0,1,2,...}.

To realize this /dev/pmsgN interface, pstore backend modules which
manage multiple buffers for pmsg should tell the necessary numbers of
buffer to pstore_register_pmsg() via pstore_info. In addition, for
ramoops, I think the following works for ram.c are necessary at least.

* Parse multiple pmsg size in module parameter, for example,
  pmsg_size=0x2000,0x1000,...

* Change pmsg_size in ramoops_platform_data to a pointer of size
  array.

 struct ramoops_platform_data {
...
-   unsigned long   pmsg_size;
+   unsigned long   *pmsg_size;
...
 };

  When a ramoops's backend driver registers the platform_data and want
  pmsg buffers, it should allocate an array of size for pmsg_size.
  (Although there is no ramoops's backend which uses pmsg currently)

* Give an ID for each pmsg buffer, and modify some functions related to
  buffer allocation.

What do you think about this idea?

Best regards,
Hiraku Toyooka


--
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: linux-next: manual merge of the tip tree with the crypto-current tree

2015-10-08 Thread Ben Hutchings
On Fri, 2015-10-09 at 12:47 +1100, Stephen Rothwell wrote:
> Hi all,
> 
> Today's linux-next merge of the tip tree got a conflict in:
> 
>   arch/x86/crypto/camellia_aesni_avx_glue.c
> 
> between commit:
> 
>   92b279070dd6 ("crypto: camellia_aesni_avx - Fix CPU feature checks")
> 
> from the crypto-current tree and commit:
> 
>   d91cab78133d ("x86/fpu: Rename XSAVE macros")
> 
> from the tip tree.
> 
> I fixed it up (see below) and can carry the fix as necessary (no action
> is required).

> --- a/arch/x86/crypto/camellia_aesni_avx_glue.c
> +++ b/arch/x86/crypto/camellia_aesni_avx_glue.c
> @@@ -554,12 -554,8 +554,14 @@@ static int __init camellia_aesni_init(v
>   {
> const char *feature_name;
>   
>  +  if (!cpu_has_avx || !cpu_has_aes || !cpu_has_osxsave) {
>  +  pr_info("AVX or AES-NI instructions are not detected.\n");
>  +  return -ENODEV;
>  +  }
>  +
>  +  if (!cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, _name)) {
> +   if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM,
> +   _name)) {

Eh, that's not going to work.  You need to keep the second
if (!cpu_has_xfeatures()) condition and delete the first.

Ben.

> pr_info("CPU feature '%s' is not supported.\n", feature_name);
> return -ENODEV;
> }
-- 
Ben Hutchings
If the facts do not conform to your theory, they must be disposed of.

signature.asc
Description: This is a digitally signed message part


linux-next: manual merge of the tip tree with the crypto-current tree

2015-10-08 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the tip tree got a conflict in:

  arch/x86/crypto/camellia_aesni_avx_glue.c

between commit:

  92b279070dd6 ("crypto: camellia_aesni_avx - Fix CPU feature checks")

from the crypto-current tree and commit:

  d91cab78133d ("x86/fpu: Rename XSAVE macros")

from the tip tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc arch/x86/crypto/camellia_aesni_avx_glue.c
index bacaa13acac5,12e729bfe71b..
--- a/arch/x86/crypto/camellia_aesni_avx_glue.c
+++ b/arch/x86/crypto/camellia_aesni_avx_glue.c
@@@ -554,12 -554,8 +554,14 @@@ static int __init camellia_aesni_init(v
  {
const char *feature_name;
  
 +  if (!cpu_has_avx || !cpu_has_aes || !cpu_has_osxsave) {
 +  pr_info("AVX or AES-NI instructions are not detected.\n");
 +  return -ENODEV;
 +  }
 +
 +  if (!cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, _name)) {
+   if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM,
+   _name)) {
pr_info("CPU feature '%s' is not supported.\n", feature_name);
return -ENODEV;
}
--
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 v2] sunrpc: fix waitqueue_active without memory barrier in sunrpc

2015-10-08 Thread Kosuke Tatsukawa
There are several places in net/sunrpc/svcsock.c which calls
waitqueue_active() without calling a memory barrier.  Add a memory
barrier just as in wq_has_sleeper().

I found this issue when I was looking through the linux source code
for places calling waitqueue_active() before wake_up*(), but without
preceding memory barriers, after sending a patch to fix a similar
issue in drivers/tty/n_tty.c  (Details about the original issue can be
found here: https://lkml.org/lkml/2015/9/28/849).

Signed-off-by: Kosuke Tatsukawa 
---
v2:
  - Fixed compiler warnings caused by type mismatch
v1:
  - https://lkml.org/lkml/2015/10/8/993
---
 net/sunrpc/svcsock.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 0c81202..ec19444 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -414,6 +414,7 @@ static void svc_udp_data_ready(struct sock *sk)
set_bit(XPT_DATA, >sk_xprt.xpt_flags);
svc_xprt_enqueue(>sk_xprt);
}
+   smp_mb();
if (wq && waitqueue_active(wq))
wake_up_interruptible(wq);
 }
@@ -432,6 +433,7 @@ static void svc_write_space(struct sock *sk)
svc_xprt_enqueue(>sk_xprt);
}
 
+   smp_mb();
if (wq && waitqueue_active(wq)) {
dprintk("RPC svc_write_space: someone sleeping on %p\n",
   svsk);
@@ -787,6 +789,7 @@ static void svc_tcp_listen_data_ready(struct sock *sk)
}
 
wq = sk_sleep(sk);
+   smp_mb();
if (wq && waitqueue_active(wq))
wake_up_interruptible_all(wq);
 }
@@ -808,6 +811,7 @@ static void svc_tcp_state_change(struct sock *sk)
set_bit(XPT_CLOSE, >sk_xprt.xpt_flags);
svc_xprt_enqueue(>sk_xprt);
}
+   smp_mb();
if (wq && waitqueue_active(wq))
wake_up_interruptible_all(wq);
 }
@@ -823,6 +827,7 @@ static void svc_tcp_data_ready(struct sock *sk)
set_bit(XPT_DATA, >sk_xprt.xpt_flags);
svc_xprt_enqueue(>sk_xprt);
}
+   smp_mb();
if (wq && waitqueue_active(wq))
wake_up_interruptible(wq);
 }
@@ -1594,6 +1599,7 @@ static void svc_sock_detach(struct svc_xprt *xprt)
sk->sk_write_space = svsk->sk_owspace;
 
wq = sk_sleep(sk);
+   smp_mb();
if (wq && waitqueue_active(wq))
wake_up_interruptible(wq);
 }
-- 
1.7.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/


slab.h debugging tags....

2015-10-08 Thread Valdis Kletnieks
Author: Rasmus Villemoes 
Date:   Wed Oct 7 15:09:20 2015 +1100

slab.h: sprinkle __assume_aligned attributes

causes *tons* of whinges if you do 'make C=2' with sparse 0.5.0:

  CHECK   drivers/media/usb/pwc/pwc-if.c
include/linux/slab.h:307:43: error: attribute '__assume_aligned__': unknown 
attribute
include/linux/slab.h:308:58: error: attribute '__assume_aligned__': unknown 
attribute
include/linux/slab.h:337:73: error: attribute '__assume_aligned__': unknown 
attribute
include/linux/slab.h:375:74: error: attribute '__assume_aligned__': unknown 
attribute
include/linux/slab.h:378:80: error: attribute '__assume_aligned__': unknown 
attribute

[/usr/src/linux-next] grep CHECK build.default | wc
   17793558   59132
[/usr/src/linux-next] grep slab.h build.default | wc
   7225   43350  621350

Canned it after about 1/3 of the build.

Where's a sparse that can handle this?


pgpc5fMlWhtgj.pgp
Description: PGP signature


[PATCH v7] clk: bcm2835: Add support for programming the audio domain clocks

2015-10-08 Thread Eric Anholt
This adds support for enabling, disabling, and setting the rate of the
audio domain clocks.  It will be necessary for setting the pixel clock
for HDMI in the VC4 driver and let us write a cpufreq driver.  It will
also improve compatibility with user changes to the firmware's
config.txt, since our previous fixed clocks are unaware of it.

The firmware also has support for configuring the clocks through the
mailbox channel, but the pixel clock setup by the firmware doesn't
work, and it's Raspberry Pi specific anyway.  The only conflicts we
should have with the firmware would be if we made firmware calls that
result in clock management (like opening firmware V3D or ISP access,
which we don't support in upstream), or on hardware over-thermal or
under-voltage (when the firmware would rewrite PLLB to take the ARM
out of overclock).  If that happens, our cached .recalc_rate() results
would be incorrect, but that's no worse than our current state where
we used fixed clocks.

The existing fixed clocks in the code are left in place to provide
backwards compatibility with old device tree files.

Signed-off-by: Eric Anholt 
Tested-by: Martin Sperl 
---

v2: Fix onecell->clks[] allocation size.
v3: '/*' on otherwise-empty line for multiline comments, fix top
comment, use more named initializers, do fewer separate
allocations on probe, unwind allocations on failure in probe (from
review by Stephen Warren).  Use new clk_hw_get_name().  Switch
fb_prediv_bit to be fb_prediv_mask to avoid typing BIT() so many
times.
v4: Incorporate feedback from Stephen Boyd, and use devm_kasprintf instead
of bare kasprintf in driver init.
v5: Fix nitpicks from Stefan Wahren, drop a debugging get_rate() call,
clean up 2 more checkpatch --strict complaints.
v6: More feedback from Stephen Boyd, make #defines for the ANA bits,
fix non-PLLH KA value.
v7: More nitpicks from Stephen Boyd.

 drivers/clk/bcm/clk-bcm2835.c | 1522 -
 1 file changed, 1521 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
index dd295e4..8502a4b 100644
--- a/drivers/clk/bcm/clk-bcm2835.c
+++ b/drivers/clk/bcm/clk-bcm2835.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Broadcom
+ * Copyright (C) 2010,2015 Broadcom
  * Copyright (C) 2012 Stephen Warren
  *
  * This program is free software; you can redistribute it and/or modify
@@ -17,10 +17,289 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+/**
+ * DOC: BCM2835 CPRMAN (clock manager for the "audio" domain)
+ *
+ * The clock tree on the 2835 has several levels.  There's a root
+ * oscillator running at 19.2Mhz.  After the oscillator there are 5
+ * PLLs, roughly divided as "camera", "ARM", "core", "DSI displays",
+ * and "HDMI displays".  Those 5 PLLs each can divide their output to
+ * produce up to 4 channels.  Finally, there is the level of clocks to
+ * be consumed by other hardware components (like "H264" or "HDMI
+ * state machine"), which divide off of some subset of the PLL
+ * channels.
+ *
+ * All of the clocks in the tree are exposed in the DT, because the DT
+ * may want to make assignments of the final layer of clocks to the
+ * PLL channels, and some components of the hardware will actually
+ * skip layers of the tree (for example, the pixel clock comes
+ * directly from the PLLH PIX channel without using a CM_*CTL clock
+ * generator).
+ */
+
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
+#include 
+#include 
+
+#define CM_PASSWORD0x5a00
+
+#define CM_GNRICCTL0x000
+#define CM_GNRICDIV0x004
+# define CM_DIV_FRAC_BITS  12
+
+#define CM_VPUCTL  0x008
+#define CM_VPUDIV  0x00c
+#define CM_SYSCTL  0x010
+#define CM_SYSDIV  0x014
+#define CM_PERIACTL0x018
+#define CM_PERIADIV0x01c
+#define CM_PERIICTL0x020
+#define CM_PERIIDIV0x024
+#define CM_H264CTL 0x028
+#define CM_H264DIV 0x02c
+#define CM_ISPCTL  0x030
+#define CM_ISPDIV  0x034
+#define CM_V3DCTL  0x038
+#define CM_V3DDIV  0x03c
+#define CM_CAM0CTL 0x040
+#define CM_CAM0DIV 0x044
+#define CM_CAM1CTL 0x048
+#define CM_CAM1DIV 0x04c
+#define CM_CCP2CTL 0x050
+#define CM_CCP2DIV 0x054
+#define CM_DSI0ECTL0x058
+#define CM_DSI0EDIV0x05c
+#define CM_DSI0PCTL0x060
+#define CM_DSI0PDIV0x064
+#define CM_DPICTL  0x068
+#define CM_DPIDIV  0x06c
+#define CM_GP0CTL  0x070
+#define CM_GP0DIV  0x074
+#define CM_GP1CTL  0x078
+#define CM_GP1DIV  0x07c
+#define CM_GP2CTL  0x080
+#define CM_GP2DIV  0x084
+#define CM_HSMCTL  0x088
+#define CM_HSMDIV   

Re: [PATCH v6] clk: bcm2835: Add support for programming the audio domain clocks.

2015-10-08 Thread Eric Anholt
Stephen Boyd  writes:

> Please drop the full-stop from your subject lines.
>
> On 10/08, Eric Anholt wrote:
>> This adds support for enabling, disabling, and setting the rate of the
>> audio domain clocks.  It will be necessary for setting the pixel clock
>> for HDMI in the VC4 driver and let us write a cpufreq driver.  It will
>> also improve compatibility with user changes to the firmware's
>> config.txt, since our previous fixed clocks are unaware of it.
>> 
>> The firmware also has support for configuring the clocks through the
>> mailbox channel, but the pixel clock setup by the firmware doesn't
>> work, and it's Raspberry Pi specific anyway.  The only conflicts we
>> should have with the firmware would be if we made firmware calls that
>> result in clock management (like opening firmware V3D or ISP access,
>> which we don't support in upstream), or on hardware over-thermal or
>> under-voltage (when the firmware would rewrite PLLB to take the ARM
>> out of overclock).  If that happens, our cached .recalc_rate() results
>> would be incorrect, but that's no worse than our current state where
>> we used fixed clocks.
>> 
>> The existing fixed clocks in the code are left in place to provide
>> backwards compatibility with old device tree files.
>> 
>> Signed-off-by: Eric Anholt 
>> Tested-by: Martin Sperl 
>> ---
>
> There's a variable length array in here, causing sparse to
> complain:
>
>   drivers/clk/bcm/clk-bcm2835.c:1408:41:
>   warning: Variable length array is used.
>
> This one looks easy enough to fix with another allocation.

We know the bounds of the allocation, which is up to 10 entries
populated in the 4-bit bitfield.  I've switched to using 1 <<
CM_SRC_BITS to shut up sparse.

> But then there's some weird casting warning coming from sparse
> that I honestly don't understand:
>
> drivers/clk/bcm/clk-bcm2835.c:370:36: warning: cast truncates bits
>from constant value (3f8000 becomes 8000)
>drivers/clk/bcm/clk-bcm2835.c:372:19: warning: cast truncates bits from
>constant value (380 becomes ff80)
>drivers/clk/bcm/clk-bcm2835.c:378:37: warning: cast truncates bits from
>constant value (f8 becomes fff8)
>drivers/clk/bcm/clk-bcm2835.c:380:42: warning: cast truncates bits from
>constant value (1f becomes )
>
> I guess I'll just ignore that for now. A couple nitpicks are
> left, but nothing major.

That's from GENMASK, which returns an unsigned long, unfortunately.
>
>> +/* Wait for the PLL to lock. */
>> +start = ktime_get();
>> +while (!(cprman_read(cprman, CM_LOCK) & data->lock_mask)) {
>> +ktime_t delta = ktime_sub(ktime_get(), start);
>> +
>> +if (ktime_to_ms(delta) > LOCK_TIMEOUT_MS) {
>
> Didn't notice this one before. Why not add the LOCK_TIMEOUT_MS to
> start, and then call ktime_get() in the loop and use
> ktime_after() to figure out if we're beyond the timeout?

I've switched to that, but I was just modeling off of samsung/clk-pll.c
(one of the few drivers that doesn't infinite loop).

I've fixed the other devm_clk_register() and the extra parens as well.


signature.asc
Description: PGP signature


Re: [PATCH 3.2 035/107] PCI: Add dev_flags bit to access VPD through function 0

2015-10-08 Thread Ben Hutchings
On Fri, 2015-10-09 at 00:26 +, Rustad, Mark D wrote:
> Ben Hutchings  wrote:
> 
> > --- a/include/linux/pci.h
> > +++ b/include/linux/pci.h
> > @@ -176,6 +176,8 @@ enum pci_dev_flags {
> > > > PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2,
> > > > /* Provide indication device is assigned by a Virtual Machine 
> > Manager */
> > > > PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) 4,
> > +> >> > /* Get VPD from function 0 VPD */
> > +> >> > PCI_DEV_FLAGS_VPD_REF_F0 = (__force pci_dev_flags_t) (1 << 
> > 8),
> > };
> > 
> > enum pci_irq_reroute_variant {
> 
> In this hunk I happened to notice the change in how these values are
> assigned. Should the new value remain (1 << 8) or should it fall in
> line with the older implementation and simply be 8? Or should it be
> 256? It depends on which kind of consistency you prefer for the
> backport.

They're bit masks, not bit numbers, both in 3.2 and upstream.  In
mainline, bits 3-7 have already been assigned to other flags.  I don't
see the need to renumber or write the value differently when
backporting.

Ben.

-- 
Ben Hutchings
If the facts do not conform to your theory, they must be disposed of.

signature.asc
Description: This is a digitally signed message part


Re: [PATCH 3.2 000/107] 3.2.72-rc1 review

2015-10-08 Thread Ben Hutchings
On Thu, 2015-10-08 at 17:56 -0700, Guenter Roeck wrote:
> On 10/08/2015 05:12 PM, Ben Hutchings wrote:
> > This is the start of the stable review cycle for the 3.2.72 release.
> > There are 107 patches in this series, which will be posted as responses
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> > 
> > Responses should be made by Tue Oct 13 00:00:00 UTC 2015.
> > Anything received after that time might be too late.
> > 
> 
> Build results:
>   > total: 92 pass: 92 fail: 0
> Qemu test results:
>   > total: 58 pass: 58 fail: 0
> 
> Details are available at http://server.roeck-us.net:8010/builders.

Thanks for checking.

Ben.

-- 
Ben Hutchings
If the facts do not conform to your theory, they must be disposed of.

signature.asc
Description: This is a digitally signed message part


Re: [PATCH 4/8] mmc: sdhci-pxav3: enable proper resuming on Armada 38x SoC

2015-10-08 Thread Jisheng Zhang
Hi Marcin,

On Tue, 6 Oct 2015 03:22:38 +0200
Marcin Wojtas  wrote:

> When resuming from suspend on Armada 38x SoC MBus windows have to be
> re-configured and for that purpose mv_conf_mbus_windows function needed
> rework. MBus windows register base address obtaining was moved to
> armada_38x_quirks function in order to be kept in pxa global structure,
> because it is used during a resume.
> 
> This commit fixes resuming from suspend by calling MBus windows
> configuration routine and therefore enabling proper DMA operation.
> 
> Signed-off-by: Marcin Wojtas 
> ---
>  drivers/mmc/host/sdhci-pxav3.c | 39 ---
>  1 file changed, 20 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
> index f5edf9d..3f71894 100644
> --- a/drivers/mmc/host/sdhci-pxav3.c
> +++ b/drivers/mmc/host/sdhci-pxav3.c
> @@ -63,6 +63,7 @@ struct sdhci_pxa {
>   struct clk *clk_io;
>   u8  power_mode;
>   void __iomem *sdio3_conf_reg;
> + void __iomem *mbus_win_regs;
>  };
>  
>  /*
> @@ -81,30 +82,16 @@ struct sdhci_pxa {
>  #define SDIO3_CONF_CLK_INV   BIT(0)
>  #define SDIO3_CONF_SD_FB_CLK BIT(2)
>  
> -static int mv_conf_mbus_windows(struct platform_device *pdev,
> +static int mv_conf_mbus_windows(struct device *dev, void __iomem *regs,
>   const struct mbus_dram_target_info *dram)
>  {
>   int i;
> - void __iomem *regs;
> - struct resource *res;
>  
>   if (!dram) {
> - dev_err(>dev, "no mbus dram info\n");
> - return -EINVAL;
> - }
> -
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> - if (!res) {
> - dev_err(>dev, "cannot get mbus registers\n");
> + dev_err(dev, "no mbus dram info\n");
>   return -EINVAL;
>   }
>  
> - regs = ioremap(res->start, resource_size(res));
> - if (!regs) {
> - dev_err(>dev, "cannot map mbus registers\n");
> - return -ENOMEM;
> - }
> -
>   for (i = 0; i < SDHCI_MAX_WIN_NUM; i++) {
>   writel(0, regs + SDHCI_WINDOW_CTRL(i));
>   writel(0, regs + SDHCI_WINDOW_BASE(i));
> @@ -122,8 +109,6 @@ static int mv_conf_mbus_windows(struct platform_device 
> *pdev,
>   writel(cs->base, regs + SDHCI_WINDOW_BASE(i));
>   }
>  
> - iounmap(regs);
> -
>   return 0;
>  }
>  
> @@ -135,6 +120,14 @@ static int armada_38x_quirks(struct platform_device 
> *pdev,
>   struct sdhci_pxa *pxa = pltfm_host->priv;
>   struct resource *res;
>  
> + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mbus");
> + pxa->mbus_win_regs = devm_ioremap_resource(>dev, res);
> + if (IS_ERR(pxa->mbus_win_regs)) {
> + dev_err(mmc_dev(host->mmc),
> + "failed to obtain MBus windows register base\n");

devm_ioremap_resource() has warned us if it fails, so is it better to remove
this dev_err() here?

> + return PTR_ERR(pxa->mbus_win_regs);
> + }
> +
>   host->quirks &= ~SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN;
>   host->quirks |= SDHCI_QUIRK_MISSING_CAPS;
>   res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> @@ -403,7 +396,8 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
>   ret = armada_38x_quirks(pdev, host);
>   if (ret < 0)
>   goto err_mbus_win;
> - ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info());
> + ret = mv_conf_mbus_windows(>dev, pxa->mbus_win_regs,
> +mv_mbus_dram_info());
>   if (ret < 0)
>   goto err_mbus_win;
>   }
> @@ -520,6 +514,13 @@ static int sdhci_pxav3_resume(struct device *dev)
>  {
>   int ret;
>   struct sdhci_host *host = dev_get_drvdata(dev);
> + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> + struct sdhci_pxa *pxa = pltfm_host->priv;
> + struct device_node *np = dev->of_node;
> +
> + if (of_device_is_compatible(np, "marvell,armada-380-sdhci"))

this would increase resume time especially those non armada-380-sdhci host
although it's trivial. Is it better to check "if (pxa->mbus_win_regs)"?

> + ret = mv_conf_mbus_windows(dev, pxa->mbus_win_regs,
> +mv_mbus_dram_info());
>  
>   pm_runtime_get_sync(dev);
>   ret = sdhci_resume_host(host);

--
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] sunrpc: fix waitqueue_active without memory barrier in sunrpc

2015-10-08 Thread kbuild test robot
Hi Kosuke,

[auto build test WARNING on v4.3-rc4 -- if it's inappropriate base, please 
ignore]

reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> net/sunrpc/svcsock.c:417:28: sparse: incorrect type in argument 1 (different 
>> base types)
   net/sunrpc/svcsock.c:417:28:expected struct socket_wq *wq
   net/sunrpc/svcsock.c:417:28:got struct __wait_queue_head [usertype] *wq
>> net/sunrpc/svcsock.c:1597:28: sparse: incorrect type in argument 1 
>> (different base types)
   net/sunrpc/svcsock.c:1597:28:expected struct socket_wq *wq
   net/sunrpc/svcsock.c:1597:28:got struct __wait_queue_head [usertype] 
*[assigned] wq
   net/sunrpc/svcsock.c:435:28: sparse: incorrect type in argument 1 (different 
base types)
   net/sunrpc/svcsock.c:435:28:expected struct socket_wq *wq
   net/sunrpc/svcsock.c:435:28:got struct __wait_queue_head [usertype] *wq
   net/sunrpc/svcsock.c:790:28: sparse: incorrect type in argument 1 (different 
base types)
   net/sunrpc/svcsock.c:790:28:expected struct socket_wq *wq
   net/sunrpc/svcsock.c:790:28:got struct __wait_queue_head [usertype] 
*[assigned] wq
   net/sunrpc/svcsock.c:811:28: sparse: incorrect type in argument 1 (different 
base types)
   net/sunrpc/svcsock.c:811:28:expected struct socket_wq *wq
   net/sunrpc/svcsock.c:811:28:got struct __wait_queue_head [usertype] *wq
   net/sunrpc/svcsock.c:826:28: sparse: incorrect type in argument 1 (different 
base types)
   net/sunrpc/svcsock.c:826:28:expected struct socket_wq *wq
   net/sunrpc/svcsock.c:826:28:got struct __wait_queue_head [usertype] *wq
   net/sunrpc/svcsock.c: In function 'svc_udp_data_ready':
   net/sunrpc/svcsock.c:417:21: warning: passing argument 1 of 'wq_has_sleeper' 
from incompatible pointer type [-Wincompatible-pointer-types]
 if (wq_has_sleeper(wq))
^
   In file included from include/net/inet_sock.h:27:0,
from include/linux/udp.h:20,
from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument 
is of type 'wait_queue_head_t * {aka struct __wait_queue_head *}'
static inline bool wq_has_sleeper(struct socket_wq *wq)
   ^
   net/sunrpc/svcsock.c: In function 'svc_write_space':
   net/sunrpc/svcsock.c:435:21: warning: passing argument 1 of 'wq_has_sleeper' 
from incompatible pointer type [-Wincompatible-pointer-types]
 if (wq_has_sleeper(wq)) {
^
   In file included from include/net/inet_sock.h:27:0,
from include/linux/udp.h:20,
from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument 
is of type 'wait_queue_head_t * {aka struct __wait_queue_head *}'
static inline bool wq_has_sleeper(struct socket_wq *wq)
   ^
   net/sunrpc/svcsock.c: In function 'svc_tcp_listen_data_ready':
   net/sunrpc/svcsock.c:790:21: warning: passing argument 1 of 'wq_has_sleeper' 
from incompatible pointer type [-Wincompatible-pointer-types]
 if (wq_has_sleeper(wq))
^
   In file included from include/net/inet_sock.h:27:0,
from include/linux/udp.h:20,
from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument 
is of type 'wait_queue_head_t * {aka struct __wait_queue_head *}'
static inline bool wq_has_sleeper(struct socket_wq *wq)
   ^
   net/sunrpc/svcsock.c: In function 'svc_tcp_state_change':
   net/sunrpc/svcsock.c:811:21: warning: passing argument 1 of 'wq_has_sleeper' 
from incompatible pointer type [-Wincompatible-pointer-types]
 if (wq_has_sleeper(wq))
^
   In file included from include/net/inet_sock.h:27:0,
from include/linux/udp.h:20,
from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument 
is of type 'wait_queue_head_t * {aka struct __wait_queue_head *}'
static inline bool wq_has_sleeper(struct socket_wq *wq)
   ^
   net/sunrpc/svcsock.c: In function 'svc_tcp_data_ready':
   net/sunrpc/svcsock.c:826:21: warning: passing argument 1 of 'wq_has_sleeper' 
from incompatible pointer type [-Wincompatible-pointer-types]
 if (wq_has_sleeper(wq))
^
   In file included from include/net/inet_sock.h:27:0,
from include/linux/udp.h:20,
from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument 
is of type 'wait_queue_head_t * {aka struct __wait_queue_head *}'
static inline bool wq_has_sleeper(struct socket_wq *wq)
   ^
   net/sunrpc/svcsock.c: In function 'svc_sock_detach':
 

Re: [PATCH v2] HID: multitouch: Fetch feature reports on demand for Win8 devices

2015-10-08 Thread Andrew Duggan

On 10/08/2015 02:40 AM, Mika Westerberg wrote:

On Wed, Oct 07, 2015 at 06:12:42PM -0700, Andrew Duggan wrote:

I can confirm that it is working on the Dell XPS 13 and the buttonpad
property is set correctly. However, I also tried it on an older non
production precision touchpad and it didn't work. It reports that it fails
to fetch feature 8 and then doesn't report any input. I'm concerned that
some of the early PTPs in some Dell and Acer systems might not work with
this change. I'll test this tomorrow on a few more systems to see if the
problem is isolated to just this one non production touchpad.

Thanks for testing.


[ 2969.222125] usb 1-1: New USB device found, idVendor=06cb, idProduct=2393
[ 2969.222128] usb 1-1: New USB device strings: Mfr=0, Product=2,
SerialNumber=0
[ 2969.222130] usb 1-1: Product: Synaptics T Pad V 01.31
[ 2974.223578] hid-multitouch 0003:06CB:2393.0008: failed to fetch feature 8
[ 2979.226037] hid-multitouch 0003:06CB:2393.0008: failed to fetch feature 8
[ 2979.226137] input: Synaptics T Pad V 01.31 UNKNOWN as 
/devices/pci:00/:00:14.0/usb1/1-1/1-1:1.0/0003:06CB:2393.0008/input/input34
[ 2979.226431] hid-multitouch 0003:06CB:2393.0008: input,hiddev0,hidraw2:
USB HID v1.11 Mouse [Synaptics T Pad V 01.31] on usb-:00:14.0-1/input0

Without the patch is it successfully retrieving feature 8?

It may be that it has HID_QUIRK_NO_INIT_REPORTS set via quirks in usbhid
which causes the driver to fetch the report in mt_feature_mapping() and
previously it did not do that.


No, this touchpad doesn't have HID_QUIRK_NO_INIT_REPORTS set and 
usbhid/hid-core.c is calling usbhid_init_reports() which is retrieving 
feature 8. But, I did some additional testing and I wasn't able to 
reproduce this issue on other systems. The failure occurs on a Dell XPS 
13 9343, but the exact same touchpad and the exact same kernel (I booted 
both systems off an external HD to ensure that the kernel and OS are 
identical) I didn't see a problem. I also tried a different USB PTP 
touchpad which didn't have an issue. Also, I tried returning in 
mt_get_feature() instead of reading the report when the report id is 8. 
When I did that everything worked.


So as of right now, it looks like a single non production USB PTP 
touchpad fails on one particular system. But, all other tests have been 
successful.


Let me know if you have any other suggestions for me to test. But, it 
seems like this failure might be fairly isolated.


Andrew
--
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] sunrpc: fix waitqueue_active without memory barrier in sunrpc

2015-10-08 Thread kbuild test robot
Hi Kosuke,

[auto build test WARNING on v4.3-rc4 -- if it's inappropriate base, please 
ignore]

config: x86_64-randconfig-x002-201540 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from include/linux/linkage.h:4:0,
from include/linux/kernel.h:6,
from net/sunrpc/svcsock.c:22:
   net/sunrpc/svcsock.c: In function 'svc_udp_data_ready':
   net/sunrpc/svcsock.c:417:21: warning: passing argument 1 of 'wq_has_sleeper' 
from incompatible pointer type [-Wincompatible-pointer-types]
 if (wq_has_sleeper(wq))
^
   include/linux/compiler.h:147:28: note: in definition of macro '__trace_if'
 if (__builtin_constant_p((cond)) ? !!(cond) :   \
   ^
>> net/sunrpc/svcsock.c:417:2: note: in expansion of macro 'if'
 if (wq_has_sleeper(wq))
 ^
   In file included from include/net/inet_sock.h:27:0,
from include/linux/udp.h:20,
from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument 
is of type 'wait_queue_head_t * {aka struct __wait_queue_head *}'
static inline bool wq_has_sleeper(struct socket_wq *wq)
   ^
   In file included from include/linux/linkage.h:4:0,
from include/linux/kernel.h:6,
from net/sunrpc/svcsock.c:22:
   net/sunrpc/svcsock.c:417:21: warning: passing argument 1 of 'wq_has_sleeper' 
from incompatible pointer type [-Wincompatible-pointer-types]
 if (wq_has_sleeper(wq))
^
   include/linux/compiler.h:147:40: note: in definition of macro '__trace_if'
 if (__builtin_constant_p((cond)) ? !!(cond) :   \
   ^
>> net/sunrpc/svcsock.c:417:2: note: in expansion of macro 'if'
 if (wq_has_sleeper(wq))
 ^
   In file included from include/net/inet_sock.h:27:0,
from include/linux/udp.h:20,
from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument 
is of type 'wait_queue_head_t * {aka struct __wait_queue_head *}'
static inline bool wq_has_sleeper(struct socket_wq *wq)
   ^
   In file included from include/linux/linkage.h:4:0,
from include/linux/kernel.h:6,
from net/sunrpc/svcsock.c:22:
   net/sunrpc/svcsock.c:417:21: warning: passing argument 1 of 'wq_has_sleeper' 
from incompatible pointer type [-Wincompatible-pointer-types]
 if (wq_has_sleeper(wq))
^
   include/linux/compiler.h:158:16: note: in definition of macro '__trace_if'
  __r = !!(cond); \
   ^
>> net/sunrpc/svcsock.c:417:2: note: in expansion of macro 'if'
 if (wq_has_sleeper(wq))
 ^
   In file included from include/net/inet_sock.h:27:0,
from include/linux/udp.h:20,
from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument 
is of type 'wait_queue_head_t * {aka struct __wait_queue_head *}'
static inline bool wq_has_sleeper(struct socket_wq *wq)
   ^
   In file included from include/linux/linkage.h:4:0,
from include/linux/kernel.h:6,
from net/sunrpc/svcsock.c:22:
   net/sunrpc/svcsock.c: In function 'svc_write_space':
   net/sunrpc/svcsock.c:435:21: warning: passing argument 1 of 'wq_has_sleeper' 
from incompatible pointer type [-Wincompatible-pointer-types]
 if (wq_has_sleeper(wq)) {
^
   include/linux/compiler.h:147:28: note: in definition of macro '__trace_if'
 if (__builtin_constant_p((cond)) ? !!(cond) :   \
   ^
   net/sunrpc/svcsock.c:435:2: note: in expansion of macro 'if'
 if (wq_has_sleeper(wq)) {
 ^
   In file included from include/net/inet_sock.h:27:0,
from include/linux/udp.h:20,
from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument 
is of type 'wait_queue_head_t * {aka struct __wait_queue_head *}'
static inline bool wq_has_sleeper(struct socket_wq *wq)
   ^
   In file included from include/linux/linkage.h:4:0,
from include/linux/kernel.h:6,
from net/sunrpc/svcsock.c:22:
   net/sunrpc/svcsock.c:435:21: warning: passing argument 1 of 'wq_has_sleeper' 
from incompatible pointer type [-Wincompatible-pointer-types]
 if (wq_has_sleeper(wq)) {
^
   include/linux/compiler.h:147:40: note: in definition of macro '__trace_if'
 if (__builtin_constant_p((cond)) ? !!(cond) :   \
   ^
   net/sunrpc/svcsock.c:435:2: note: in expansion of 

[PATCH v2 1/5] mmc: sdhci-pxav3: enable proper resuming on Armada 38x SoC

2015-10-08 Thread Marcin Wojtas
When resuming from suspend on Armada 38x SoC MBus windows have to be
re-configured and for that purpose mv_conf_mbus_windows function needed
rework. MBus windows register base address obtaining was moved to
armada_38x_quirks function in order to be kept in pxa global structure,
because it is used during a resume.

This commit fixes resuming from suspend by calling MBus windows
configuration routine and therefore enabling proper DMA operation.

Signed-off-by: Marcin Wojtas 
---
 drivers/mmc/host/sdhci-pxav3.c | 38 +++---
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index f5edf9d..76b9a70 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -63,6 +63,7 @@ struct sdhci_pxa {
struct clk *clk_io;
u8  power_mode;
void __iomem *sdio3_conf_reg;
+   void __iomem *mbus_win_regs;
 };
 
 /*
@@ -81,30 +82,16 @@ struct sdhci_pxa {
 #define SDIO3_CONF_CLK_INV BIT(0)
 #define SDIO3_CONF_SD_FB_CLK   BIT(2)
 
-static int mv_conf_mbus_windows(struct platform_device *pdev,
+static int mv_conf_mbus_windows(struct device *dev, void __iomem *regs,
const struct mbus_dram_target_info *dram)
 {
int i;
-   void __iomem *regs;
-   struct resource *res;
 
if (!dram) {
-   dev_err(>dev, "no mbus dram info\n");
-   return -EINVAL;
-   }
-
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-   if (!res) {
-   dev_err(>dev, "cannot get mbus registers\n");
+   dev_err(dev, "no mbus dram info\n");
return -EINVAL;
}
 
-   regs = ioremap(res->start, resource_size(res));
-   if (!regs) {
-   dev_err(>dev, "cannot map mbus registers\n");
-   return -ENOMEM;
-   }
-
for (i = 0; i < SDHCI_MAX_WIN_NUM; i++) {
writel(0, regs + SDHCI_WINDOW_CTRL(i));
writel(0, regs + SDHCI_WINDOW_BASE(i));
@@ -122,8 +109,6 @@ static int mv_conf_mbus_windows(struct platform_device 
*pdev,
writel(cs->base, regs + SDHCI_WINDOW_BASE(i));
}
 
-   iounmap(regs);
-
return 0;
 }
 
@@ -135,6 +120,14 @@ static int armada_38x_quirks(struct platform_device *pdev,
struct sdhci_pxa *pxa = pltfm_host->priv;
struct resource *res;
 
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mbus");
+   pxa->mbus_win_regs = devm_ioremap_resource(>dev, res);
+   if (IS_ERR(pxa->mbus_win_regs)) {
+   dev_err(mmc_dev(host->mmc),
+   "failed to obtain MBus windows register base\n");
+   return PTR_ERR(pxa->mbus_win_regs);
+   }
+
host->quirks &= ~SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN;
host->quirks |= SDHCI_QUIRK_MISSING_CAPS;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
@@ -403,7 +396,8 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
ret = armada_38x_quirks(pdev, host);
if (ret < 0)
goto err_mbus_win;
-   ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info());
+   ret = mv_conf_mbus_windows(>dev, pxa->mbus_win_regs,
+  mv_mbus_dram_info());
if (ret < 0)
goto err_mbus_win;
}
@@ -520,6 +514,12 @@ static int sdhci_pxav3_resume(struct device *dev)
 {
int ret;
struct sdhci_host *host = dev_get_drvdata(dev);
+   struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+   struct sdhci_pxa *pxa = pltfm_host->priv;
+
+   if (pxa->mbus_win_regs)
+   ret = mv_conf_mbus_windows(dev, pxa->mbus_win_regs,
+  mv_mbus_dram_info());
 
pm_runtime_get_sync(dev);
ret = sdhci_resume_host(host);
-- 
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/


Re: [PATCH 3.2 000/107] 3.2.72-rc1 review

2015-10-08 Thread Guenter Roeck

On 10/08/2015 05:12 PM, Ben Hutchings wrote:

This is the start of the stable review cycle for the 3.2.72 release.
There are 107 patches in this series, which will be posted as responses
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Tue Oct 13 00:00:00 UTC 2015.
Anything received after that time might be too late.



Build results:
total: 92 pass: 92 fail: 0
Qemu test results:
total: 58 pass: 58 fail: 0

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

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/


[PATCH v2 5/5] mmc: sdhci-pxav3: enable modifying MMC_CARD bit during card initialization

2015-10-08 Thread Marcin Wojtas
On Marvell Armada 38x SoC's the MMC_CARD bit in SD_CE_ATA_1 register must
be set to 0x1 when a MMC card is supposed to work in DDR mode, or when
commands CMD11, CMD14 and CMD20 are used.

This commit enables the above for all MMC cards by modifying the host
registers during card initialization. It is done by using init_card()
callback.

Signed-off-by: Marcin Wojtas 
---
 drivers/mmc/host/sdhci-pxav3.c | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index 352c5eb..9bdeeb1 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -57,6 +57,7 @@
 
 #define SD_SPI_MODE  0x108
 #define SD_CE_ATA_1  0x10C
+#define SDCE_MMC_CARD  BIT(28)
 
 #define SD_CE_ATA_2  0x10E
 #define SDCE_MISC_INT  (1<<2)
@@ -221,6 +222,22 @@ static void pxav3_reset(struct sdhci_host *host, u8 mask)
}
 }
 
+static void pxav3_init_card(struct sdhci_host *host, struct mmc_card *card)
+{
+   struct platform_device *pdev = to_platform_device(mmc_dev(host->mmc));
+   struct device_node *np = pdev->dev.of_node;
+   u32 reg_val;
+
+   if (of_device_is_compatible(np, "marvell,armada-380-sdhci")) {
+   reg_val = sdhci_readl(host, SD_CE_ATA_1);
+   if (mmc_card_mmc(card))
+   reg_val |= SDCE_MMC_CARD;
+   else
+   reg_val &= ~SDCE_MMC_CARD;
+   sdhci_writel(host, reg_val, SD_CE_ATA_1);
+   }
+}
+
 #define MAX_WAIT_COUNT 5
 static void pxav3_gen_init_74_clocks(struct sdhci_host *host, u8 power_mode)
 {
@@ -338,6 +355,7 @@ static const struct sdhci_ops pxav3_sdhci_ops = {
.set_bus_width = sdhci_set_bus_width,
.reset = pxav3_reset,
.set_uhs_signaling = pxav3_set_uhs_signaling,
+   .init_card = pxav3_init_card,
 };
 
 static struct sdhci_pltfm_data sdhci_pxav3_pdata = {
-- 
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 v2 2/5] mmc: sdhci-pxav3: enable usage of DAT3 pin as HW card detect

2015-10-08 Thread Marcin Wojtas
Marvell Armada 38x SDHCI controller enable using DAT3 pin as a hardware
card detection. According to the SD sdandard this signal can be used for
this purpose combined with a pull-up resistor, implying inverted (active
low) polarization of a card detect. MMC standard does not support this
feature and does not operate with such connectivity of DAT3.

When using DAT3-based detection Armada 38x SDIO IP expects its internal
clock to be always on, which had to be ensured twofold:
- Each time controller is reset by updating appropriate registers. On the
  occasion of adding new register @0x104, register @0x100 name is modified
  in order to the be aligned with Armada 38x documentation.
- Leaving the clock enabled despite power-down. For this purpose a new
  quirk had to be added to SDHCI subsystem - SDHCI_QUIRK2_KEEP_INT_CLK_ON.

In addition to the changes above this commit adds a new property to Armada
38x SDHCI node ('dat3-cd') with an according binding documentation update.

Signed-off-by: Marcin Wojtas 
---
 .../devicetree/bindings/mmc/sdhci-pxa.txt  |  5 +++
 drivers/mmc/host/sdhci-pxav3.c | 38 --
 drivers/mmc/host/sdhci.c   |  5 ++-
 drivers/mmc/host/sdhci.h   |  3 ++
 4 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/mmc/sdhci-pxa.txt 
b/Documentation/devicetree/bindings/mmc/sdhci-pxa.txt
index 3d1b449..ffd6b14 100644
--- a/Documentation/devicetree/bindings/mmc/sdhci-pxa.txt
+++ b/Documentation/devicetree/bindings/mmc/sdhci-pxa.txt
@@ -23,6 +23,11 @@ Required properties:
 
 Optional properties:
 - mrvl,clk-delay-cycles: Specify a number of cycles to delay for tuning.
+- dat3-cd: use DAT3 pin as hardware card detect - option available for
+  "marvell,armada-380-sdhci" only. The detection is supposed to work with
+  active high polarity, which implies usage of "cd-inverted" property.
+  Note that according to the specifications DAT3-based card detection can be
+  used with SD cards only. MMC standard doesn't support this feature.
 
 Example:
 
diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index 76b9a70..352c5eb 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -46,10 +46,14 @@
 #define SDCLK_DELAY_SHIFT  9
 #define SDCLK_DELAY_MASK   0x1f
 
-#define SD_CFG_FIFO_PARAM   0x100
+#define SD_EXTRA_PARAM_REG 0x100
 #define SDCFG_GEN_PAD_CLK_ON   (1<<6)
 #define SDCFG_GEN_PAD_CLK_CNT_MASK 0xFF
 #define SDCFG_GEN_PAD_CLK_CNT_SHIFT24
+#define SD_FIFO_PARAM_REG  0x104
+#define SD_USE_DAT3BIT(7)
+#define SD_OVRRD_CLK_OEN   BIT(11)
+#define SD_FORCE_CLK_ONBIT(12)
 
 #define SD_SPI_MODE  0x108
 #define SD_CE_ATA_1  0x10C
@@ -163,6 +167,15 @@ static int armada_38x_quirks(struct platform_device *pdev,
}
host->caps1 &= ~(SDHCI_SUPPORT_SDR104 | SDHCI_USE_SDR50_TUNING);
 
+   /*
+* The interface clock enable is also used as control
+* for the A38x SDIO IP, so it can't be powered down
+* when using HW-based card detection.
+*/
+   if (of_property_read_bool(np, "dat3-cd") &&
+   !of_property_read_bool(np, "broken-cd"))
+   host->quirks2 |= SDHCI_QUIRK2_KEEP_INT_CLK_ON;
+
return 0;
 }
 
@@ -170,6 +183,8 @@ static void pxav3_reset(struct sdhci_host *host, u8 mask)
 {
struct platform_device *pdev = to_platform_device(mmc_dev(host->mmc));
struct sdhci_pxa_platdata *pdata = pdev->dev.platform_data;
+   struct device_node *np = pdev->dev.of_node;
+   u32 reg_val;
 
sdhci_reset(host, mask);
 
@@ -187,6 +202,22 @@ static void pxav3_reset(struct sdhci_host *host, u8 mask)
tmp |= SDCLK_SEL;
writew(tmp, host->ioaddr + SD_CLOCK_BURST_SIZE_SETUP);
}
+
+   if (of_device_is_compatible(np, "marvell,armada-380-sdhci") &&
+   host->quirks2 & SDHCI_QUIRK2_KEEP_INT_CLK_ON) {
+   reg_val = sdhci_readl(host, SD_FIFO_PARAM_REG);
+   reg_val |= SD_USE_DAT3 | SD_OVRRD_CLK_OEN |
+  SD_FORCE_CLK_ON;
+   sdhci_writel(host, reg_val, SD_FIFO_PARAM_REG);
+
+   /*
+* For HW detection based on DAT3 pin keep internal
+* clk switched on after controller reset.
+*/
+   reg_val = sdhci_readl(host, SDHCI_CLOCK_CONTROL);
+   reg_val |= SDHCI_CLOCK_INT_EN;
+   sdhci_writel(host, reg_val, SDHCI_CLOCK_CONTROL);
+   }
}
 }
 
@@ -214,9 +245,9 @@ static void pxav3_gen_init_74_clocks(struct sdhci_host 
*host, u8 power_mode)
writew(tmp, host->ioaddr + SD_CE_ATA_2);
 
/* start sending the 74 clocks 

[PATCH v2 4/5] mmc: sdhci: add init_card callback to sdhci

2015-10-08 Thread Marcin Wojtas
Some sdhci hosts may require handling quirks during card initialization at
the time when its type is already known. Hence a new callback (init_card)
is added in sdhci_ops.

Signed-off-by: Marcin Wojtas 
---
 drivers/mmc/host/sdhci.c | 9 +
 drivers/mmc/host/sdhci.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index cfed695..a1c308d 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2200,6 +2200,14 @@ static void sdhci_card_event(struct mmc_host *mmc)
spin_unlock_irqrestore(>lock, flags);
 }
 
+static void sdhci_init_card(struct mmc_host *mmc, struct mmc_card *card)
+{
+   struct sdhci_host *host = mmc_priv(mmc);
+
+   if (host->ops->init_card)
+   host->ops->init_card(host, card);
+}
+
 static const struct mmc_host_ops sdhci_ops = {
.request= sdhci_request,
.post_req   = sdhci_post_req,
@@ -2215,6 +2223,7 @@ static const struct mmc_host_ops sdhci_ops = {
.select_drive_strength  = sdhci_select_drive_strength,
.card_event = sdhci_card_event,
.card_busy  = sdhci_card_busy,
+   .init_card  = sdhci_init_card,
 };
 
 /*\
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index c751b78..365c860 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -547,6 +547,7 @@ struct sdhci_ops {
 struct mmc_card *card,
 unsigned int max_dtr, int host_drv,
 int card_drv, int *drv_type);
+   void(*init_card)(struct sdhci_host *host, struct mmc_card *card);
 };
 
 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
-- 
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 v2 3/5] ARM: mvebu: set SW polling as SDHCI card detection on A388-GP

2015-10-08 Thread Marcin Wojtas
The newest revisions of A388-GP (v1.5 and higher) support only
DAT3-based card detection. Revisions < v1.5 based on GPIO detection
via I2C expander, but this solution is supposed to be deprecated on
new boards. In order to satisfy all type of hardware this commit
changes card detection to use software polling mechanism.

Signed-off-by: Marcin Wojtas 
---
 arch/arm/boot/dts/armada-388-gp.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/armada-388-gp.dts 
b/arch/arm/boot/dts/armada-388-gp.dts
index 391dea9..403a86b 100644
--- a/arch/arm/boot/dts/armada-388-gp.dts
+++ b/arch/arm/boot/dts/armada-388-gp.dts
@@ -213,8 +213,8 @@
sdhci@d8000 {
pinctrl-names = "default";
pinctrl-0 = <_pins>;
-   cd-gpios = < 5 GPIO_ACTIVE_LOW>;
no-1-8-v;
+   broken-cd;
wp-inverted;
bus-width = <8>;
status = "okay";
-- 
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 v2 0/5] Armada 38x SDHCI driver improvements

2015-10-08 Thread Marcin Wojtas
Hi,

I send a second round of remaining A38x SDHCI patches. After lots of
discussions I changed card detection mechanism to SW polling in order
to satisfy all A388-GP revisions. Any remarks will be welcome.

Best regards,
Marcin

Changes:
v1 -> v2
* enable SW polling as card detection
* in resume function change condition for mbus windows reconfiguration 

Marcin Wojtas (5):
  mmc: sdhci-pxav3: enable proper resuming on Armada 38x SoC
  mmc: sdhci-pxav3: enable usage of DAT3 pin as HW card detect
  ARM: mvebu: set SW polling as SDHCI card detection on A388-GP
  mmc: sdhci: add init_card callback to sdhci
  mmc: sdhci-pxav3: enable modifying MMC_CARD bit during card
initialization

 .../devicetree/bindings/mmc/sdhci-pxa.txt  |  5 ++
 arch/arm/boot/dts/armada-388-gp.dts|  2 +-
 drivers/mmc/host/sdhci-pxav3.c | 94 +-
 drivers/mmc/host/sdhci.c   | 14 +++-
 drivers/mmc/host/sdhci.h   |  4 +
 5 files changed, 95 insertions(+), 24 deletions(-)

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


Re: [PATCH] sunrpc: fix waitqueue_active without memory barrier in sunrpc

2015-10-08 Thread kbuild test robot
Hi Kosuke,

[auto build test WARNING on v4.3-rc4 -- if it's inappropriate base, please 
ignore]

config: xtensa-allyesconfig (attached as .config)
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa 

All warnings (new ones prefixed by >>):

   net/sunrpc/svcsock.c: In function 'svc_udp_data_ready':
>> net/sunrpc/svcsock.c:417:6: warning: passing argument 1 of 'wq_has_sleeper' 
>> from incompatible pointer type
 if (wq_has_sleeper(wq))
 ^
   In file included from include/net/inet_sock.h:27:0,
from include/linux/udp.h:20,
from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument 
is of type 'struct wait_queue_head_t *'
static inline bool wq_has_sleeper(struct socket_wq *wq)
   ^
   net/sunrpc/svcsock.c: In function 'svc_write_space':
   net/sunrpc/svcsock.c:435:6: warning: passing argument 1 of 'wq_has_sleeper' 
from incompatible pointer type
 if (wq_has_sleeper(wq)) {
 ^
   In file included from include/net/inet_sock.h:27:0,
from include/linux/udp.h:20,
from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument 
is of type 'struct wait_queue_head_t *'
static inline bool wq_has_sleeper(struct socket_wq *wq)
   ^
   net/sunrpc/svcsock.c: In function 'svc_tcp_listen_data_ready':
   net/sunrpc/svcsock.c:790:6: warning: passing argument 1 of 'wq_has_sleeper' 
from incompatible pointer type
 if (wq_has_sleeper(wq))
 ^
   In file included from include/net/inet_sock.h:27:0,
from include/linux/udp.h:20,
from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument 
is of type 'struct wait_queue_head_t *'
static inline bool wq_has_sleeper(struct socket_wq *wq)
   ^
   net/sunrpc/svcsock.c: In function 'svc_tcp_state_change':
   net/sunrpc/svcsock.c:811:6: warning: passing argument 1 of 'wq_has_sleeper' 
from incompatible pointer type
 if (wq_has_sleeper(wq))
 ^
   In file included from include/net/inet_sock.h:27:0,
from include/linux/udp.h:20,
from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument 
is of type 'struct wait_queue_head_t *'
static inline bool wq_has_sleeper(struct socket_wq *wq)
   ^
   net/sunrpc/svcsock.c: In function 'svc_tcp_data_ready':
   net/sunrpc/svcsock.c:826:6: warning: passing argument 1 of 'wq_has_sleeper' 
from incompatible pointer type
 if (wq_has_sleeper(wq))
 ^
   In file included from include/net/inet_sock.h:27:0,
from include/linux/udp.h:20,
from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument 
is of type 'struct wait_queue_head_t *'
static inline bool wq_has_sleeper(struct socket_wq *wq)
   ^
   net/sunrpc/svcsock.c: In function 'svc_sock_detach':
   net/sunrpc/svcsock.c:1597:6: warning: passing argument 1 of 'wq_has_sleeper' 
from incompatible pointer type
 if (wq_has_sleeper(wq))
 ^
   In file included from include/net/inet_sock.h:27:0,
from include/linux/udp.h:20,
from net/sunrpc/svcsock.c:30:
   include/net/sock.h:1879:20: note: expected 'struct socket_wq *' but argument 
is of type 'struct wait_queue_head_t *'
static inline bool wq_has_sleeper(struct socket_wq *wq)
   ^

vim +/wq_has_sleeper +417 net/sunrpc/svcsock.c

   401  
   402  /*
   403   * INET callback when data has been received on the socket.
   404   */
   405  static void svc_udp_data_ready(struct sock *sk)
   406  {
   407  struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data;
   408  wait_queue_head_t *wq = sk_sleep(sk);
   409  
   410  if (svsk) {
   411  dprintk("svc: socket %p(inet %p), busy=%d\n",
   412  svsk, sk,
   413  test_bit(XPT_BUSY, >sk_xprt.xpt_flags));
   414  set_bit(XPT_DATA, >sk_xprt.xpt_flags);
   415  svc_xprt_enqueue(>sk_xprt);
   416  }
 > 417  if (wq_has_sleeper(wq))
   418  wake_up_interruptible(wq);
   419  }
   420  
   421  /*
   422   * INET callback when space is newly available on the socket.
   423   */
   424  static void svc_write_space(struct sock *sk)
   425  {

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation

[PATCH 3.2 104/107] ipv6: update ip6_rt_last_gc every time GC is run

2015-10-08 Thread Ben Hutchings
3.2.72-rc1 review patch.  If anyone has any objections, please let me know.

--

From: Michal Kubeček 

commit 49a18d86f66d33a20144ecb5a34bba0d1856b260 upstream.

As pointed out by Eric Dumazet, net->ipv6.ip6_rt_last_gc should
hold the last time garbage collector was run so that we should
update it whenever fib6_run_gc() calls fib6_clean_all(), not only
if we got there from ip6_dst_gc().

Signed-off-by: Michal Kubecek 
Signed-off-by: David S. Miller 
Signed-off-by: Ben Hutchings 
Cc: Konstantin Khlebnikov 
---
 net/ipv6/ip6_fib.c | 6 +-
 net/ipv6/route.c   | 4 +---
 2 files changed, 6 insertions(+), 4 deletions(-)

--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -1475,6 +1475,8 @@ static DEFINE_SPINLOCK(fib6_gc_lock);
 
 void fib6_run_gc(unsigned long expires, struct net *net, bool force)
 {
+   unsigned long now;
+
if (force) {
spin_lock_bh(_gc_lock);
} else if (!spin_trylock_bh(_gc_lock)) {
@@ -1487,10 +1489,12 @@ void fib6_run_gc(unsigned long expires,
gc_args.more = icmp6_dst_gc();
 
fib6_clean_all(net, fib6_age, 0, NULL);
+   now = jiffies;
+   net->ipv6.ip6_rt_last_gc = now;
 
if (gc_args.more)
mod_timer(>ipv6.ip6_fib_timer,
- round_jiffies(jiffies
+ round_jiffies(now
+ net->ipv6.sysctl.ip6_rt_gc_interval));
else
del_timer(>ipv6.ip6_fib_timer);
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1159,7 +1159,6 @@ static void icmp6_clean_all(int (*func)(
 
 static int ip6_dst_gc(struct dst_ops *ops)
 {
-   unsigned long now = jiffies;
struct net *net = container_of(ops, struct net, ipv6.ip6_dst_ops);
int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval;
int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size;
@@ -1169,13 +1168,12 @@ static int ip6_dst_gc(struct dst_ops *op
int entries;
 
entries = dst_entries_get_fast(ops);
-   if (time_after(rt_last_gc + rt_min_interval, now) &&
+   if (time_after(rt_last_gc + rt_min_interval, jiffies) &&
entries <= rt_max_size)
goto out;
 
net->ipv6.ip6_rt_gc_expire++;
fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net, entries > rt_max_size);
-   net->ipv6.ip6_rt_last_gc = now;
entries = dst_entries_get_slow(ops);
if (entries < ops->gc_thresh)
net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>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 3.2 082/107] xhci: give command abortion one more chance before killing xhci

2015-10-08 Thread Ben Hutchings
3.2.72-rc1 review patch.  If anyone has any objections, please let me know.

--

From: Mathias Nyman 

commit a6809ffd1687b3a8c192960e69add559b9d32649 upstream.

We want to give the command abortion an additional try to stop
the command ring before we completely hose xhci.

Tested-by: Vincent Pelletier 
Signed-off-by: Mathias Nyman 
Signed-off-by: Greg Kroah-Hartman 
[bwh: Backported to 3.2: call handshake() rather than xhci_handshake()]
Signed-off-by: Ben Hutchings 
---
 drivers/usb/host/xhci-ring.c | 9 +
 1 file changed, 9 insertions(+)

--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -350,6 +350,15 @@ static int xhci_abort_cmd_ring(struct xh
ret = handshake(xhci, >op_regs->cmd_ring,
CMD_RING_RUNNING, 0, 5 * 1000 * 1000);
if (ret < 0) {
+   /* we are about to kill xhci, give it one more chance */
+   xhci_write_64(xhci, temp_64 | CMD_RING_ABORT,
+ >op_regs->cmd_ring);
+   udelay(1000);
+   ret = handshake(xhci, >op_regs->cmd_ring,
+   CMD_RING_RUNNING, 0, 3 * 1000 * 1000);
+   if (ret == 0)
+   return 0;
+
xhci_err(xhci, "Stopped the command ring failed, "
"maybe the host is dead\n");
xhci->xhc_state |= XHCI_STATE_DYING;

--
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.2 078/107] ASoC: fix broken pxa SoC support

2015-10-08 Thread Ben Hutchings
3.2.72-rc1 review patch.  If anyone has any objections, please let me know.

--

From: Robert Jarzmik 

commit 3c8f7710c1c44fb650bc29b6ef78ed8b60cfaa28 upstream.

The previous fix of pxa library support, which was introduced to fix the
library dependency, broke the previous SoC behavior, where a machine
code binding pxa2xx-ac97 with a coded relied on :
 - sound/soc/pxa/pxa2xx-ac97.c
 - sound/soc/codecs/XXX.c

For example, the mioa701_wm9713.c machine code is currently broken. The
"select ARM" statement wrongly selects the soc/arm/pxa2xx-ac97 for
compilation, as per an unfortunate fate SND_PXA2XX_AC97 is both declared
in sound/arm/Kconfig and sound/soc/pxa/Kconfig.

Fix this by ensuring that SND_PXA2XX_SOC correctly triggers the correct
pxa2xx-ac97 compilation.

Fixes: 846172dfe33c ("ASoC: fix SND_PXA2XX_LIB Kconfig warning")
Signed-off-by: Robert Jarzmik 
Signed-off-by: Mark Brown 
Signed-off-by: Ben Hutchings 
---
 sound/arm/Kconfig | 15 ---
 sound/soc/pxa/Kconfig |  2 --
 2 files changed, 8 insertions(+), 9 deletions(-)

--- a/sound/arm/Kconfig
+++ b/sound/arm/Kconfig
@@ -9,6 +9,14 @@ menuconfig SND_ARM
  Drivers that are implemented on ASoC can be found in
  "ALSA for SoC audio support" section.
 
+config SND_PXA2XX_LIB
+   tristate
+   select SND_AC97_CODEC if SND_PXA2XX_LIB_AC97
+   select SND_DMAENGINE_PCM
+
+config SND_PXA2XX_LIB_AC97
+   bool
+
 if SND_ARM
 
 config SND_ARMAACI
@@ -21,13 +29,6 @@ config SND_PXA2XX_PCM
tristate
select SND_PCM
 
-config SND_PXA2XX_LIB
-   tristate
-   select SND_AC97_CODEC if SND_PXA2XX_LIB_AC97
-
-config SND_PXA2XX_LIB_AC97
-   bool
-
 config SND_PXA2XX_AC97
tristate "AC97 driver for the Intel PXA2xx chip"
depends on ARCH_PXA
--- a/sound/soc/pxa/Kconfig
+++ b/sound/soc/pxa/Kconfig
@@ -1,7 +1,6 @@
 config SND_PXA2XX_SOC
tristate "SoC Audio for the Intel PXA2xx chip"
depends on ARCH_PXA
-   select SND_ARM
select SND_PXA2XX_LIB
help
  Say Y or M if you want to add support for codecs attached to
@@ -15,7 +14,6 @@ config SND_PXA2XX_AC97
 config SND_PXA2XX_SOC_AC97
tristate
select AC97_BUS
-   select SND_ARM
select SND_PXA2XX_LIB_AC97
select SND_SOC_AC97_BUS
 

--
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.2 087/107] ocfs2/dlm: fix deadlock when dispatch assert master

2015-10-08 Thread Ben Hutchings
3.2.72-rc1 review patch.  If anyone has any objections, please let me know.

--

From: Joseph Qi 

commit 012572d4fc2e4ddd5c8ec8614d51414ec6cae02a upstream.

The order of the following three spinlocks should be:
dlm_domain_lock < dlm_ctxt->spinlock < dlm_lock_resource->spinlock

But dlm_dispatch_assert_master() is called while holding
dlm_ctxt->spinlock and dlm_lock_resource->spinlock, and then it calls
dlm_grab() which will take dlm_domain_lock.

Once another thread (for example, dlm_query_join_handler) has already
taken dlm_domain_lock, and tries to take dlm_ctxt->spinlock deadlock
happens.

Signed-off-by: Joseph Qi 
Cc: Joel Becker 
Cc: Mark Fasheh 
Cc: "Junxiao Bi" 
Signed-off-by: Andrew Morton 
Signed-off-by: Linus Torvalds 
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings 
---
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -1411,6 +1411,7 @@ int dlm_master_request_handler(struct o2
int found, ret;
int set_maybe;
int dispatch_assert = 0;
+   int dispatched = 0;
 
if (!dlm_grab(dlm))
return DLM_MASTER_RESP_NO;
@@ -1617,13 +1618,16 @@ send_response:
mlog(ML_ERROR, "failed to dispatch assert master 
work\n");
response = DLM_MASTER_RESP_ERROR;
dlm_lockres_put(res);
+   } else {
+   dispatched = 1;
}
} else {
if (res)
dlm_lockres_put(res);
}
 
-   dlm_put(dlm);
+   if (!dispatched)
+   dlm_put(dlm);
return response;
 }
 
@@ -2041,7 +2045,6 @@ int dlm_dispatch_assert_master(struct dl
 
 
/* queue up work for dlm_assert_master_worker */
-   dlm_grab(dlm);  /* get an extra ref for the work item */
dlm_init_work_item(dlm, item, dlm_assert_master_worker, NULL);
item->u.am.lockres = res; /* already have a ref */
/* can optionally ignore node numbers higher than this node */
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -1689,6 +1689,7 @@ int dlm_master_requery_handler(struct o2
unsigned int hash;
int master = DLM_LOCK_RES_OWNER_UNKNOWN;
u32 flags = DLM_ASSERT_MASTER_REQUERY;
+   int dispatched = 0;
 
if (!dlm_grab(dlm)) {
/* since the domain has gone away on this
@@ -1710,6 +1711,8 @@ int dlm_master_requery_handler(struct o2
mlog_errno(-ENOMEM);
/* retry!? */
BUG();
+   } else {
+   dispatched = 1;
}
} else /* put.. incase we are not the master */
dlm_lockres_put(res);
@@ -1717,7 +1720,8 @@ int dlm_master_requery_handler(struct o2
}
spin_unlock(>spinlock);
 
-   dlm_put(dlm);
+   if (!dispatched)
+   dlm_put(dlm);
return master;
 }
 

--
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.2 077/107] x86/platform: Fix Geode LX timekeeping in the generic x86 build

2015-10-08 Thread Ben Hutchings
3.2.72-rc1 review patch.  If anyone has any objections, please let me know.

--

From: David Woodhouse 

commit 03da3ff1cfcd7774c8780d2547ba0d995f7dc03d upstream.

In 2007, commit 07190a08eef36 ("Mark TSC on GeodeLX reliable")
bypassed verification of the TSC on Geode LX. However, this code
(now in the check_system_tsc_reliable() function in
arch/x86/kernel/tsc.c) was only present if CONFIG_MGEODE_LX was
set.

OpenWRT has recently started building its generic Geode target
for Geode GX, not LX, to include support for additional
platforms. This broke the timekeeping on LX-based devices,
because the TSC wasn't marked as reliable:
https://dev.openwrt.org/ticket/20531

By adding a runtime check on is_geode_lx(), we can also include
the fix if CONFIG_MGEODEGX1 or CONFIG_X86_GENERIC are set, thus
fixing the problem.

Signed-off-by: David Woodhouse 
Cc: Andres Salomon 
Cc: Linus Torvalds 
Cc: Marcelo Tosatti 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Link: http://lkml.kernel.org/r/1442409003.131189.87.ca...@infradead.org
Signed-off-by: Ingo Molnar 
Signed-off-by: Ben Hutchings 
---
 arch/x86/kernel/tsc.c | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 
 unsigned int __read_mostly cpu_khz;/* TSC clocks / usec, not used here */
 EXPORT_SYMBOL(cpu_khz);
@@ -802,15 +803,17 @@ EXPORT_SYMBOL_GPL(mark_tsc_unstable);
 
 static void __init check_system_tsc_reliable(void)
 {
-#ifdef CONFIG_MGEODE_LX
-   /* RTSC counts during suspend */
+#if defined(CONFIG_MGEODEGX1) || defined(CONFIG_MGEODE_LX) || 
defined(CONFIG_X86_GENERIC)
+   if (is_geode_lx()) {
+   /* RTSC counts during suspend */
 #define RTSC_SUSP 0x100
-   unsigned long res_low, res_high;
+   unsigned long res_low, res_high;
 
-   rdmsr_safe(MSR_GEODE_BUSCONT_CONF0, _low, _high);
-   /* Geode_LX - the OLPC CPU has a very reliable TSC */
-   if (res_low & RTSC_SUSP)
-   tsc_clocksource_reliable = 1;
+   rdmsr_safe(MSR_GEODE_BUSCONT_CONF0, _low, _high);
+   /* Geode_LX - the OLPC CPU has a very reliable TSC */
+   if (res_low & RTSC_SUSP)
+   tsc_clocksource_reliable = 1;
+   }
 #endif
if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE))
tsc_clocksource_reliable = 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 3.2 071/107] perf header: Fixup reading of HEADER_NRCPUS feature

2015-10-08 Thread Ben Hutchings
3.2.72-rc1 review patch.  If anyone has any objections, please let me know.

--

From: Arnaldo Carvalho de Melo 

commit caa470475d9b59eeff093ae650800d34612c4379 upstream.

The original patch introducing this header wrote the number of CPUs available
and online in one order and then swapped those values when reading, fix it.

Before:

  # perf record usleep 1
  # perf report --header-only | grep 'nrcpus \(online\|avail\)'
  # nrcpus online : 4
  # nrcpus avail : 4
  # echo 0 > /sys/devices/system/cpu/cpu2/online
  # perf record usleep 1
  # perf report --header-only | grep 'nrcpus \(online\|avail\)'
  # nrcpus online : 4
  # nrcpus avail : 3
  # echo 0 > /sys/devices/system/cpu/cpu1/online
  # perf record usleep 1
  # perf report --header-only | grep 'nrcpus \(online\|avail\)'
  # nrcpus online : 4
  # nrcpus avail : 2

After the fix, bringing back the CPUs online:

  # perf report --header-only | grep 'nrcpus \(online\|avail\)'
  # nrcpus online : 2
  # nrcpus avail : 4
  # echo 1 > /sys/devices/system/cpu/cpu2/online
  # perf record usleep 1
  # perf report --header-only | grep 'nrcpus \(online\|avail\)'
  # nrcpus online : 3
  # nrcpus avail : 4
  # echo 1 > /sys/devices/system/cpu/cpu1/online
  # perf record usleep 1
  # perf report --header-only | grep 'nrcpus \(online\|avail\)'
  # nrcpus online : 4
  # nrcpus avail : 4

Acked-by: Namhyung Kim 
Cc: Adrian Hunter 
Cc: Borislav Petkov 
Cc: David Ahern 
Cc: Frederic Weisbecker 
Cc: Jiri Olsa 
Cc: Kan Liang 
Cc: Stephane Eranian 
Cc: Wang Nan 
Fixes: fbe96f29ce4b ("perf tools: Make perf.data more self-descriptive (v8)")
Link: http://lkml.kernel.org/r/20150911153323.gp23...@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
[bwh: Backported to 3.2: print_nrcpus() reads and prints these fields
 immediately, so read both of them into an array before printing them in
 reverse order.]
Signed-off-by: Ben Hutchings 
---
 tools/perf/util/header.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -796,25 +796,19 @@ static void print_cpudesc(struct perf_he
 static void print_nrcpus(struct perf_header *ph, int fd, FILE *fp)
 {
ssize_t ret;
-   u32 nr;
+   u32 nr[2];
 
ret = read(fd, , sizeof(nr));
if (ret != (ssize_t)sizeof(nr))
-   nr = -1; /* interpreted as error */
+   nr[0] = nr[1] = -1; /* interpreted as error */
 
-   if (ph->needs_swap)
-   nr = bswap_32(nr);
+   if (ph->needs_swap) {
+   nr[0] = bswap_32(nr[0]);
+   nr[1] = bswap_32(nr[1]);
+   }
 
-   fprintf(fp, "# nrcpus online : %u\n", nr);
-
-   ret = read(fd, , sizeof(nr));
-   if (ret != (ssize_t)sizeof(nr))
-   nr = -1; /* interpreted as error */
-
-   if (ph->needs_swap)
-   nr = bswap_32(nr);
-
-   fprintf(fp, "# nrcpus avail : %u\n", nr);
+   fprintf(fp, "# nrcpus online : %u\n", nr[1]);
+   fprintf(fp, "# nrcpus avail : %u\n", nr[0]);
 }
 
 static void print_version(struct perf_header *ph, int fd, FILE *fp)

--
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.2 084/107] xhci: change xhci 1.0 only restrictions to support xhci 1.1

2015-10-08 Thread Ben Hutchings
3.2.72-rc1 review patch.  If anyone has any objections, please let me know.

--

From: Mathias Nyman 

commit dca7794539eff04b786fb6907186989e5eaaa9c2 upstream.

Some changes between xhci 0.96 and xhci 1.0 specifications forced us to
check the hci version in code, some of these checks were implemented as
hci_version == 1.0, which will not work with new xhci 1.1 controllers.

xhci 1.1 behaves similar to xhci 1.0 in these cases, so change these
checks to hci_version >= 1.0

Signed-off-by: Mathias Nyman 
Signed-off-by: Greg Kroah-Hartman 
Signed-off-by: Ben Hutchings 
---
 drivers/usb/host/xhci-mem.c  | 6 +++---
 drivers/usb/host/xhci-ring.c | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1403,10 +1403,10 @@ int xhci_endpoint_init(struct xhci_hcd *
 * use Event Data TRBs, and we don't chain in a link TRB on short
 * transfers, we're basically dividing by 1.
 *
-* xHCI 1.0 specification indicates that the Average TRB Length should
-* be set to 8 for control endpoints.
+* xHCI 1.0 and 1.1 specification indicates that the Average TRB Length
+* should be set to 8 for control endpoints.
 */
-   if (usb_endpoint_xfer_control(>desc) && xhci->hci_version == 0x100)
+   if (usb_endpoint_xfer_control(>desc) && xhci->hci_version >= 0x100)
ep_ctx->tx_info |= cpu_to_le32(AVG_TRB_LENGTH_FOR_EP(8));
else
ep_ctx->tx_info |=
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -3432,8 +3432,8 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *
if (start_cycle == 0)
field |= 0x1;
 
-   /* xHCI 1.0 6.4.1.2.1: Transfer Type field */
-   if (xhci->hci_version == 0x100) {
+   /* xHCI 1.0/1.1 6.4.1.2.1: Transfer Type field */
+   if (xhci->hci_version >= 0x100) {
if (urb->transfer_buffer_length > 0) {
if (setup->bRequestType & USB_DIR_IN)
field |= TRB_TX_TYPE(TRB_DATA_IN);

--
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.2 063/107] Input: evdev - do not report errors form flush()

2015-10-08 Thread Ben Hutchings
3.2.72-rc1 review patch.  If anyone has any objections, please let me know.

--

From: Takashi Iwai 

commit eb38f3a4f6e86f8bb10a3217ebd85ecc5d763aae upstream.

We've got bug reports showing the old systemd-logind (at least
system-210) aborting unexpectedly, and this turned out to be because
of an invalid error code from close() call to evdev devices.  close()
is supposed to return only either EINTR or EBADFD, while the device
returned ENODEV.  logind was overreacting to it and decided to kill
itself when an unexpected error code was received.  What a tragedy.

The bad error code comes from flush fops, and actually evdev_flush()
returns ENODEV when device is disconnected or client's access to it is
revoked. But in these cases the fact that flush did not actually happen is
not an error, but rather normal behavior. For non-disconnected devices
result of flush is also not that interesting as there is no potential of
data loss and even if it fails application has no way of handling the
error. Because of that we are better off always returning success from
evdev_flush().

Also returning EINTR from flush()/close() is discouraged (as it is not
clear how application should handle this error), so let's stop taking
evdev->mutex interruptibly.

Bugzilla: http://bugzilla.suse.com/show_bug.cgi?id=939834
Signed-off-by: Takashi Iwai 
Signed-off-by: Dmitry Torokhov 
[bwh: Backported to 3.2: there's no revoked flag to test]
Signed-off-by: Ben Hutchings 
---
 drivers/input/evdev.c | 13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -126,19 +126,14 @@ static int evdev_flush(struct file *file
 {
struct evdev_client *client = file->private_data;
struct evdev *evdev = client->evdev;
-   int retval;
 
-   retval = mutex_lock_interruptible(>mutex);
-   if (retval)
-   return retval;
+   mutex_lock(>mutex);
 
-   if (!evdev->exist)
-   retval = -ENODEV;
-   else
-   retval = input_flush_device(>handle, file);
+   if (evdev->exist)
+   input_flush_device(>handle, file);
 
mutex_unlock(>mutex);
-   return retval;
+   return 0;
 }
 
 static void evdev_free(struct device *dev)

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


[PATCH 3.2 064/107] crypto: ghash-clmulni: specify context size for ghash async algorithm

2015-10-08 Thread Ben Hutchings
3.2.72-rc1 review patch.  If anyone has any objections, please let me know.

--

From: Andrey Ryabinin 

commit 71c6da846be478a61556717ef1ee1cea91f5d6a8 upstream.

Currently context size (cra_ctxsize) doesn't specified for
ghash_async_alg. Which means it's zero. Thus crypto_create_tfm()
doesn't allocate needed space for ghash_async_ctx, so any
read/write to ctx (e.g. in ghash_async_init_tfm()) is not valid.

Signed-off-by: Andrey Ryabinin 
Signed-off-by: Herbert Xu 
Signed-off-by: Ben Hutchings 
---
 arch/x86/crypto/ghash-clmulni-intel_glue.c | 1 +
 1 file changed, 1 insertion(+)

--- a/arch/x86/crypto/ghash-clmulni-intel_glue.c
+++ b/arch/x86/crypto/ghash-clmulni-intel_glue.c
@@ -291,6 +291,7 @@ static struct ahash_alg ghash_async_alg
.cra_name   = "ghash",
.cra_driver_name= "ghash-clmulni",
.cra_priority   = 400,
+   .cra_ctxsize= sizeof(struct 
ghash_async_ctx),
.cra_flags  = CRYPTO_ALG_TYPE_AHASH | 
CRYPTO_ALG_ASYNC,
.cra_blocksize  = GHASH_BLOCK_SIZE,
.cra_type   = _ahash_type,

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


[PATCH 3.2 055/107] IB/qib: Change lkey table allocation to support more MRs

2015-10-08 Thread Ben Hutchings
3.2.72-rc1 review patch.  If anyone has any objections, please let me know.

--

From: Mike Marciniszyn 

commit d6f1c17e162b2a11e708f28fa93f2f79c164b442 upstream.

The lkey table is allocated with with a get_user_pages() with an
order based on a number of index bits from a module parameter.

The underlying kernel code cannot allocate that many contiguous pages.

There is no reason the underlying memory needs to be physically
contiguous.

This patch:
- switches the allocation/deallocation to vmalloc/vfree
- caps the number of bits to 23 to insure at least 1 generation bit
  o this matches the module parameter description

Reviewed-by: Vinit Agnihotri 
Signed-off-by: Mike Marciniszyn 
Signed-off-by: Doug Ledford 
[bwh: Backported to 3.2:
 - Adjust context
 - Add definition of qib_dev_warn(), added upstream by commit ddb887658970
   ("IB/qib: Convert opcode counters to per-context")]
Signed-off-by: Ben Hutchings 
---
 drivers/infiniband/hw/qib/qib_keys.c  |  4 
 drivers/infiniband/hw/qib/qib_verbs.c | 14 ++
 drivers/infiniband/hw/qib/qib_verbs.h |  2 ++
 3 files changed, 16 insertions(+), 4 deletions(-)

--- a/drivers/infiniband/hw/qib/qib_keys.c
+++ b/drivers/infiniband/hw/qib/qib_keys.c
@@ -69,6 +69,10 @@ int qib_alloc_lkey(struct qib_lkey_table
 * unrestricted LKEY.
 */
rkt->gen++;
+   /*
+* bits are capped in qib_verbs.c to insure enough bits
+* for generation number
+*/
mr->lkey = (r << (32 - ib_qib_lkey_table_size)) |
1 << (24 - ib_qib_lkey_table_size)) - 1) & rkt->gen)
 << 8);
--- a/drivers/infiniband/hw/qib/qib_verbs.c
+++ b/drivers/infiniband/hw/qib/qib_verbs.c
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "qib.h"
 #include "qib_common.h"
@@ -2035,10 +2036,16 @@ int qib_register_ib_device(struct qib_de
 * the LKEY).  The remaining bits act as a generation number or tag.
 */
spin_lock_init(>lk_table.lock);
+   /* insure generation is at least 4 bits see keys.c */
+   if (ib_qib_lkey_table_size > MAX_LKEY_TABLE_BITS) {
+   qib_dev_warn(dd, "lkey bits %u too large, reduced to %u\n",
+   ib_qib_lkey_table_size, MAX_LKEY_TABLE_BITS);
+   ib_qib_lkey_table_size = MAX_LKEY_TABLE_BITS;
+   }
dev->lk_table.max = 1 << ib_qib_lkey_table_size;
lk_tab_size = dev->lk_table.max * sizeof(*dev->lk_table.table);
dev->lk_table.table = (struct qib_mregion **)
-   __get_free_pages(GFP_KERNEL, get_order(lk_tab_size));
+   vmalloc(lk_tab_size);
if (dev->lk_table.table == NULL) {
ret = -ENOMEM;
goto err_lk;
@@ -2208,7 +2215,7 @@ err_tx:
sizeof(struct qib_pio_header),
  dev->pio_hdrs, dev->pio_hdrs_phys);
 err_hdrs:
-   free_pages((unsigned long) dev->lk_table.table, get_order(lk_tab_size));
+   vfree(dev->lk_table.table);
 err_lk:
kfree(dev->qp_table);
 err_qpt:
@@ -2262,7 +2269,6 @@ void qib_unregister_ib_device(struct qib
sizeof(struct qib_pio_header),
  dev->pio_hdrs, dev->pio_hdrs_phys);
lk_tab_size = dev->lk_table.max * sizeof(*dev->lk_table.table);
-   free_pages((unsigned long) dev->lk_table.table,
-  get_order(lk_tab_size));
+   vfree(dev->lk_table.table);
kfree(dev->qp_table);
 }
--- a/drivers/infiniband/hw/qib/qib_verbs.h
+++ b/drivers/infiniband/hw/qib/qib_verbs.h
@@ -622,6 +622,8 @@ struct qib_qpn_table {
struct qpn_map map[QPNMAP_ENTRIES];
 };
 
+#define MAX_LKEY_TABLE_BITS 23
+
 struct qib_lkey_table {
spinlock_t lock; /* protect changes in this struct */
u32 next;   /* next unused index (speeds search) */
--- a/drivers/infiniband/hw/qib/qib.h
+++ b/drivers/infiniband/hw/qib/qib.h
@@ -1421,6 +1421,10 @@ extern struct mutex qib_mutex;
qib_get_unit_name((dd)->unit), ##__VA_ARGS__); \
} while (0)
 
+#define qib_dev_warn(dd, fmt, ...) \
+   dev_warn(&(dd)->pcidev->dev, "%s: " fmt, \
+   qib_get_unit_name((dd)->unit), ##__VA_ARGS__)
+
 #define qib_dev_porterr(dd, port, fmt, ...) \
do { \
dev_err(&(dd)->pcidev->dev, "%s: IB%u:%u " fmt, \

--
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.2 073/107] Btrfs: fix read corruption of compressed and shared extents

2015-10-08 Thread Ben Hutchings
3.2.72-rc1 review patch.  If anyone has any objections, please let me know.

--

From: Filipe Manana 

commit 005efedf2c7d0a270ffbe28d8997b03844f3e3e7 upstream.

If a file has a range pointing to a compressed extent, followed by
another range that points to the same compressed extent and a read
operation attempts to read both ranges (either completely or part of
them), the pages that correspond to the second range are incorrectly
filled with zeroes.

Consider the following example:

  File layout
  [0 - 8K]  [8K - 24K]
  | |
  | |
   points to extent X, points to extent X,
   offset 4K, length of 8K offset 0, length 16K

  [extent X, compressed length = 4K uncompressed length = 16K]

If a readpages() call spans the 2 ranges, a single bio to read the extent
is submitted - extent_io.c:submit_extent_page() would only create a new
bio to cover the second range pointing to the extent if the extent it
points to had a different logical address than the extent associated with
the first range. This has a consequence of the compressed read end io
handler (compression.c:end_compressed_bio_read()) finish once the extent
is decompressed into the pages covering the first range, leaving the
remaining pages (belonging to the second range) filled with zeroes (done
by compression.c:btrfs_clear_biovec_end()).

So fix this by submitting the current bio whenever we find a range
pointing to a compressed extent that was preceded by a range with a
different extent map. This is the simplest solution for this corner
case. Making the end io callback populate both ranges (or more, if we
have multiple pointing to the same extent) is a much more complex
solution since each bio is tightly coupled with a single extent map and
the extent maps associated to the ranges pointing to the shared extent
can have different offsets and lengths.

The following test case for fstests triggers the issue:

  seq=`basename $0`
  seqres=$RESULT_DIR/$seq
  echo "QA output created by $seq"
  tmp=/tmp/$$
  status=1  # failure is the default!
  trap "_cleanup; exit \$status" 0 1 2 3 15

  _cleanup()
  {
  rm -f $tmp.*
  }

  # get standard environment, filters and checks
  . ./common/rc
  . ./common/filter

  # real QA test starts here
  _need_to_be_root
  _supported_fs btrfs
  _supported_os Linux
  _require_scratch
  _require_cloner

  rm -f $seqres.full

  test_clone_and_read_compressed_extent()
  {
  local mount_opts=$1

  _scratch_mkfs >>$seqres.full 2>&1
  _scratch_mount $mount_opts

  # Create a test file with a single extent that is compressed (the
  # data we write into it is highly compressible no matter which
  # compression algorithm is used, zlib or lzo).
  $XFS_IO_PROG -f -c "pwrite -S 0xaa 0K 4K"\
  -c "pwrite -S 0xbb 4K 8K"\
  -c "pwrite -S 0xcc 12K 4K"   \
  $SCRATCH_MNT/foo | _filter_xfs_io

  # Now clone our extent into an adjacent offset.
  $CLONER_PROG -s $((4 * 1024)) -d $((16 * 1024)) -l $((8 * 1024)) \
  $SCRATCH_MNT/foo $SCRATCH_MNT/foo

  # Same as before but for this file we clone the extent into a lower
  # file offset.
  $XFS_IO_PROG -f -c "pwrite -S 0xaa 8K 4K" \
  -c "pwrite -S 0xbb 12K 8K"\
  -c "pwrite -S 0xcc 20K 4K"\
  $SCRATCH_MNT/bar | _filter_xfs_io

  $CLONER_PROG -s $((12 * 1024)) -d 0 -l $((8 * 1024)) \
  $SCRATCH_MNT/bar $SCRATCH_MNT/bar

  echo "File digests before unmounting filesystem:"
  md5sum $SCRATCH_MNT/foo | _filter_scratch
  md5sum $SCRATCH_MNT/bar | _filter_scratch

  # Evicting the inode or clearing the page cache before reading
  # again the file would also trigger the bug - reads were returning
  # all bytes in the range corresponding to the second reference to
  # the extent with a value of 0, but the correct data was persisted
  # (it was a bug exclusively in the read path). The issue happened
  # only if the same readpages() call targeted pages belonging to the
  # first and second ranges that point to the same compressed extent.
  _scratch_remount

  echo "File digests after mounting filesystem again:"
  # Must match the same digests we got before.
  md5sum $SCRATCH_MNT/foo | _filter_scratch
  md5sum $SCRATCH_MNT/bar | _filter_scratch
  }

  echo -e "\nTesting with zlib compression..."
  test_clone_and_read_compressed_extent "-o compress=zlib"

  _scratch_unmount

  echo -e "\nTesting with lzo compression..."
  test_clone_and_read_compressed_extent "-o compress=lzo"

  status=0
  exit

Signed-off-by: Filipe Manana 
Reviewed-by: Qu Wenruo
Reviewed-by: Liu Bo 
[bwh: Backported to 3.2:
 - Maintain prev_em_start in both functions calling __extent_read_full_page()
   in a loop
 - Adjust context and 

[PATCH 3.2 056/107] SUNRPC: xs_reset_transport must mark the connection as disconnected

2015-10-08 Thread Ben Hutchings
3.2.72-rc1 review patch.  If anyone has any objections, please let me know.

--

From: Trond Myklebust 

commit 0c78789e3a030615c6650fde89546cadf40ec2cc upstream.

In case the reconnection attempt fails.

Signed-off-by: Trond Myklebust 
[bwh: Backported to 3.2: add local variable xprt]
Signed-off-by: Ben Hutchings 
---
 net/sunrpc/xprtsock.c | 1 +
 1 file changed, 1 insertion(+)

--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -811,6 +811,7 @@ static void xs_reset_transport(struct so
 {
struct socket *sock = transport->sock;
struct sock *sk = transport->inet;
+   struct rpc_xprt *xprt = >xprt;
 
if (sk == NULL)
return;
@@ -824,6 +825,7 @@ static void xs_reset_transport(struct so
sk->sk_user_data = NULL;
 
xs_restore_old_callbacks(transport, sk);
+   xprt_clear_connected(xprt);
write_unlock_bh(>sk_callback_lock);
 
sk->sk_no_check = 0;

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


[PATCH 3.2 065/107] fs: create and use seq_show_option for escaping

2015-10-08 Thread Ben Hutchings
3.2.72-rc1 review patch.  If anyone has any objections, please let me know.

--

From: Kees Cook 

commit a068acf2ee77693e0bf39d6e07139ba704f461c3 upstream.

Many file systems that implement the show_options hook fail to correctly
escape their output which could lead to unescaped characters (e.g.  new
lines) leaking into /proc/mounts and /proc/[pid]/mountinfo files.  This
could lead to confusion, spoofed entries (resulting in things like
systemd issuing false d-bus "mount" notifications), and who knows what
else.  This looks like it would only be the root user stepping on
themselves, but it's possible weird things could happen in containers or
in other situations with delegated mount privileges.

Here's an example using overlay with setuid fusermount trusting the
contents of /proc/mounts (via the /etc/mtab symlink).  Imagine the use
of "sudo" is something more sneaky:

  $ BASE="ovl"
  $ MNT="$BASE/mnt"
  $ LOW="$BASE/lower"
  $ UP="$BASE/upper"
  $ WORK="$BASE/work/ 0 0
  none /proc fuse.pwn user_id=1000"
  $ mkdir -p "$LOW" "$UP" "$WORK"
  $ sudo mount -t overlay -o "lowerdir=$LOW,upperdir=$UP,workdir=$WORK" none 
/mnt
  $ cat /proc/mounts
  none /root/ovl/mnt overlay 
rw,relatime,lowerdir=ovl/lower,upperdir=ovl/upper,workdir=ovl/work/ 0 0
  none /proc fuse.pwn user_id=1000 0 0
  $ fusermount -u /proc
  $ cat /proc/mounts
  cat: /proc/mounts: No such file or directory

This fixes the problem by adding new seq_show_option and
seq_show_option_n helpers, and updating the vulnerable show_option
handlers to use them as needed.  Some, like SELinux, need to be open
coded due to unusual existing escape mechanisms.

[a...@linux-foundation.org: add lost chunk, per Kees]
[keesc...@chromium.org: seq_show_option should be using const parameters]
Signed-off-by: Kees Cook 
Acked-by: Serge Hallyn 
Acked-by: Jan Kara 
Acked-by: Paul Moore 
Cc: J. R. Okajima 
Signed-off-by: Kees Cook 
Signed-off-by: Andrew Morton 
Signed-off-by: Linus Torvalds 
[bwh: Backported to 3.2:
 - Drop changes to overlayfs, reiserfs
 - Drop vers option from cifs
 - ceph changes are all in one file
 - Adjust context]
Signed-off-by: Ben Hutchings 
---
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -361,8 +361,10 @@ static int ceph_show_options(struct seq_
if (opt->flags & CEPH_OPT_NOCRC)
seq_puts(m, ",nocrc");
 
-   if (opt->name)
-   seq_printf(m, ",name=%s", opt->name);
+   if (opt->name) {
+   seq_puts(m, ",name=");
+   seq_escape(m, opt->name, ", \t\n\\");
+   }
if (opt->key)
seq_puts(m, ",secret=");
 
@@ -405,7 +407,7 @@ static int ceph_show_options(struct seq_
if (fsopt->max_readdir_bytes != CEPH_MAX_READDIR_BYTES_DEFAULT)
seq_printf(m, ",readdir_max_bytes=%d", 
fsopt->max_readdir_bytes);
if (strcmp(fsopt->snapdir_name, CEPH_SNAPDIRNAME_DEFAULT))
-   seq_printf(m, ",snapdirname=%s", fsopt->snapdir_name);
+   seq_show_option(m, "snapdirname", fsopt->snapdir_name);
return 0;
 }
 
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -381,10 +381,10 @@ cifs_show_options(struct seq_file *s, st
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER)
seq_printf(s, ",multiuser");
else if (tcon->ses->user_name)
-   seq_printf(s, ",username=%s", tcon->ses->user_name);
+   seq_show_option(s, "username", tcon->ses->user_name);
 
if (tcon->ses->domainName)
-   seq_printf(s, ",domain=%s", tcon->ses->domainName);
+   seq_show_option(s, "domain", tcon->ses->domainName);
 
if (srcaddr->sa_family != AF_UNSPEC) {
struct sockaddr_in *saddr4;
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1018,10 +1018,10 @@ static inline void ext4_show_quota_optio
}
 
if (sbi->s_qf_names[USRQUOTA])
-   seq_printf(seq, ",usrjquota=%s", sbi->s_qf_names[USRQUOTA]);
+   seq_show_option(seq, "usrjquota", sbi->s_qf_names[USRQUOTA]);
 
if (sbi->s_qf_names[GRPQUOTA])
-   seq_printf(seq, ",grpjquota=%s", sbi->s_qf_names[GRPQUOTA]);
+   seq_show_option(seq, "grpjquota", sbi->s_qf_names[GRPQUOTA]);
 
if (test_opt(sb, USRQUOTA))
seq_puts(seq, ",usrquota");
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -1298,11 +1298,11 @@ static int gfs2_show_options(struct seq_
if (is_ancestor(mnt->mnt_root, sdp->sd_master_dir))
seq_printf(s, ",meta");
if (args->ar_lockproto[0])
-   seq_printf(s, ",lockproto=%s", args->ar_lockproto);
+   seq_show_option(s, "lockproto", args->ar_lockproto);
if (args->ar_locktable[0])
-   seq_printf(s, ",locktable=%s", args->ar_locktable);
+   seq_show_option(s, "locktable", args->ar_locktable);
if (args->ar_hostdata[0])
-   seq_printf(s, ",hostdata=%s", args->ar_hostdata);
+   

Re: [PATCH v3 2/2] drm: panel: simple: add QiaoDian qd43003c0-40

2015-10-08 Thread Rob Herring
On Thu, Oct 8, 2015 at 10:42 AM, Alexandre Belloni
 wrote:
> From: Josh Wu 
>
> The QiaoDian Xianshi QD43003C0-40 is a 4"3 TFT LCD panel.
>
> Timings from the OTA5180A document, ver 0.9, section
> 10.1.1:
>   http://www.orientdisplay.com/pdf/OTA5180A.pdf
>
> Signed-off-by: Josh Wu 
> Signed-off-by: Alexandre Belloni 
> ---
>  .../bindings/panel/qiaodian,qd43003c0-40.txt   |  7 ++

Acked-by: Rob Herring 

BTW, I'm moving bindings/panel/ to bindings/display/panel/ for 4.4.
It's fine to leave this, but if you do respin for some reason, can you
move this there.

Rob

>  drivers/gpu/drm/panel/panel-simple.c   | 27 
> ++
>  2 files changed, 34 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/panel/qiaodian,qd43003c0-40.txt
>
> diff --git 
> a/Documentation/devicetree/bindings/panel/qiaodian,qd43003c0-40.txt 
> b/Documentation/devicetree/bindings/panel/qiaodian,qd43003c0-40.txt
> new file mode 100644
> index ..0fbdab89ac3d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/panel/qiaodian,qd43003c0-40.txt
> @@ -0,0 +1,7 @@
> +QiaoDian XianShi Corporation 4"3 TFT LCD panel
> +
> +Required properties:
> +- compatible: should be "qiaodian,qd43003c0-40"
> +
> +This binding is compatible with the simple-panel binding, which is specified
> +in simple-panel.txt in this directory.
> diff --git a/drivers/gpu/drm/panel/panel-simple.c 
> b/drivers/gpu/drm/panel/panel-simple.c
> index f97b73ec4713..c93ffa615005 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -1027,6 +1027,30 @@ static const struct panel_desc ortustech_com43h4m85ulc 
> = {
> .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
>  };
>
> +static const struct drm_display_mode qd43003c0_40_mode = {
> +   .clock = 9000,
> +   .hdisplay = 480,
> +   .hsync_start = 480 + 8,
> +   .hsync_end = 480 + 8 + 4,
> +   .htotal = 480 + 8 + 4 + 39,
> +   .vdisplay = 272,
> +   .vsync_start = 272 + 4,
> +   .vsync_end = 272 + 4 + 10,
> +   .vtotal = 272 + 4 + 10 + 2,
> +   .vrefresh = 60,
> +};
> +
> +static const struct panel_desc qd43003c0_40 = {
> +   .modes = _40_mode,
> +   .num_modes = 1,
> +   .bpc = 8,
> +   .size = {
> +   .width = 95,
> +   .height = 53,
> +   },
> +   .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
> +};
> +
>  static const struct drm_display_mode samsung_ltn101nt05_mode = {
> .clock = 54030,
> .hdisplay = 1024,
> @@ -1182,6 +1206,9 @@ static const struct of_device_id platform_of_match[] = {
> .compatible = "ortustech,com43h4m85ulc",
> .data = _com43h4m85ulc,
> }, {
> +   .compatible = "qiaodian,qd43003c0-40",
> +   .data = _40,
> +   }, {
> .compatible = "samsung,ltn101nt05",
> .data = _ltn101nt05,
> }, {
> --
> 2.1.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 3/8] mmc: sdhci-pxav3: fix error handling of armada_38x_quirks

2015-10-08 Thread Marcin Wojtas
Thanks for grabbing the three patches!

Best regards,
Marcin

2015-10-08 19:35 GMT+02:00 Ulf Hansson :
> On 6 October 2015 at 03:22, Marcin Wojtas  wrote:
>> In case of armada_38x_quirks error, all clocks should be cleaned-up, same
>> as after mv_conf_mbus_windows failure.
>>
>> Signed-off-by: Marcin Wojtas 
>> Cc:  # v4.2
>
> Thanks, applied for fixes!
>
> Kind regards
> Uffe
>
>> ---
>>  drivers/mmc/host/sdhci-pxav3.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
>> index 89a9e49..f5edf9d 100644
>> --- a/drivers/mmc/host/sdhci-pxav3.c
>> +++ b/drivers/mmc/host/sdhci-pxav3.c
>> @@ -402,7 +402,7 @@ static int sdhci_pxav3_probe(struct platform_device 
>> *pdev)
>> if (of_device_is_compatible(np, "marvell,armada-380-sdhci")) {
>> ret = armada_38x_quirks(pdev, host);
>> if (ret < 0)
>> -   goto err_clk_get;
>> +   goto err_mbus_win;
>> ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info());
>> if (ret < 0)
>> goto err_mbus_win;
>> --
>> 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 3.2 066/107] ARM: 8429/1: disable GCC SRA optimization

2015-10-08 Thread Ben Hutchings
3.2.72-rc1 review patch.  If anyone has any objections, please let me know.

--

From: Ard Biesheuvel 

commit a077224fd35b2f7fbc93f14cf67074fc792fbac2 upstream.

While working on the 32-bit ARM port of UEFI, I noticed a strange
corruption in the kernel log. The following snprintf() statement
(in drivers/firmware/efi/efi.c:efi_md_typeattr_format())

snprintf(pos, size, "|%3s|%2s|%2s|%2s|%3s|%2s|%2s|%2s|%2s]",

was producing the following output in the log:

||   |   |   ||WB|WT|WC|UC]
||   |   |   ||WB|WT|WC|UC]
||   |   |   ||WB|WT|WC|UC]
|RUN|   |   |   ||WB|WT|WC|UC]*
|RUN|   |   |   ||WB|WT|WC|UC]*
||   |   |   ||WB|WT|WC|UC]
|RUN|   |   |   ||WB|WT|WC|UC]*
||   |   |   ||WB|WT|WC|UC]
|RUN|   |   |   ||   |   |   |UC]
|RUN|   |   |   ||   |   |   |UC]

As it turns out, this is caused by incorrect code being emitted for
the string() function in lib/vsprintf.c. The following code

if (!(spec.flags & LEFT)) {
while (len < spec.field_width--) {
if (buf < end)
*buf = ' ';
++buf;
}
}
for (i = 0; i < len; ++i) {
if (buf < end)
*buf = *s;
++buf; ++s;
}
while (len < spec.field_width--) {
if (buf < end)
*buf = ' ';
++buf;
}

when called with len == 0, triggers an issue in the GCC SRA optimization
pass (Scalar Replacement of Aggregates), which handles promotion of signed
struct members incorrectly. This is a known but as yet unresolved issue.
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65932). In this particular
case, it is causing the second while loop to be executed erroneously a
single time, causing the additional space characters to be printed.

So disable the optimization by passing -fno-ipa-sra.

Acked-by: Nicolas Pitre 
Signed-off-by: Ard Biesheuvel 
Signed-off-by: Russell King 
Signed-off-by: Ben Hutchings 
---
 arch/arm/Makefile | 8 
 1 file changed, 8 insertions(+)

--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -53,6 +53,14 @@ endif
 
 comma = ,
 
+#
+# The Scalar Replacement of Aggregates (SRA) optimization pass in GCC 4.9 and
+# later may result in code being generated that handles signed short and signed
+# char struct members incorrectly. So disable it.
+# (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65932)
+#
+KBUILD_CFLAGS  += $(call cc-option,-fno-ipa-sra)
+
 # This selects which instruction set is used.
 # Note that GCC does not numerically define an architecture version
 # macro, but instead defines a whole series of macros which makes

--
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.2 061/107] Add radeon suspend/resume quirk for HP Compaq dc5750.

2015-10-08 Thread Ben Hutchings
3.2.72-rc1 review patch.  If anyone has any objections, please let me know.

--

From: Jeffery Miller 

commit 09bfda10e6efd7b65bcc29237bee1765ed779657 upstream.

With the radeon driver loaded the HP Compaq dc5750
Small Form Factor machine fails to resume from suspend.
Adding a quirk similar to other devices avoids
the problem and the system resumes properly.

Signed-off-by: Jeffery Miller 
Signed-off-by: Alex Deucher 
Signed-off-by: Ben Hutchings 
---
 drivers/gpu/drm/radeon/radeon_combios.c | 8 
 1 file changed, 8 insertions(+)

--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -3399,6 +3399,14 @@ void radeon_combios_asic_init(struct drm
rdev->pdev->subsystem_device == 0x30ae)
return;
 
+   /* quirk for rs4xx HP Compaq dc5750 Small Form Factor to make it resume
+* - it hangs on resume inside the dynclk 1 table.
+*/
+   if (rdev->family == CHIP_RS480 &&
+   rdev->pdev->subsystem_vendor == 0x103c &&
+   rdev->pdev->subsystem_device == 0x280a)
+   return;
+
/* DYN CLK 1 */
table = combios_get_table_offset(dev, COMBIOS_DYN_CLK_1_TABLE);
if (table)

--
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.2 076/107] ARM: fix Thumb2 signal handling when ARMv6 is enabled

2015-10-08 Thread Ben Hutchings
3.2.72-rc1 review patch.  If anyone has any objections, please let me know.

--

From: Russell King 

commit 9b55613f42e8d40d5c9ccb8970bde6af4764b2ab upstream.

When a kernel is built covering ARMv6 to ARMv7, we omit to clear the
IT state when entering a signal handler.  This can cause the first
few instructions to be conditionally executed depending on the parent
context.

In any case, the original test for >= ARMv7 is broken - ARMv6 can have
Thumb-2 support as well, and an ARMv6T2 specific build would omit this
code too.

Relax the test back to ARMv6 or greater.  This results in us always
clearing the IT state bits in the PSR, even on CPUs where these bits
are reserved.  However, they're reserved for the IT state, so this
should cause no harm.

Fixes: d71e1352e240 ("Clear the IT state when invoking a Thumb-2 signal 
handler")
Acked-by: Tony Lindgren 
Tested-by: H. Nikolaus Schaller 
Tested-by: Grazvydas Ignotas 
Signed-off-by: Russell King 
Signed-off-by: Ben Hutchings 
---
 arch/arm/kernel/signal.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -486,12 +486,17 @@ setup_return(struct pt_regs *regs, struc
 */
thumb = handler & 1;
 
-#if __LINUX_ARM_ARCH__ >= 7
+#if __LINUX_ARM_ARCH__ >= 6
/*
-* Clear the If-Then Thumb-2 execution state
-* ARM spec requires this to be all 000s in ARM mode
-* Snapdragon S4/Krait misbehaves on a Thumb=>ARM
-* signal transition without this.
+* Clear the If-Then Thumb-2 execution state.  ARM spec
+* requires this to be all 000s in ARM mode.  Snapdragon
+* S4/Krait misbehaves on a Thumb=>ARM signal transition
+* without this.
+*
+* We must do this whenever we are running on a Thumb-2
+* capable CPU, which includes ARMv6T2.  However, we elect
+* to do this whenever we're on an ARMv6 or later CPU for
+* simplicity.
 */
cpsr &= ~PSR_IT_MASK;
 #endif

--
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 tip/core/rcu 18/18] rcu: Better hotplug handling for synchronize_sched_expedited()

2015-10-08 Thread Josh Triplett
On Thu, Oct 08, 2015 at 05:11:11PM -0700, Paul E. McKenney wrote:
> On Thu, Oct 08, 2015 at 11:01:14AM -0700, Josh Triplett wrote:
> > On Thu, Oct 08, 2015 at 08:19:03AM -0700, Paul E. McKenney wrote:
> > > On Thu, Oct 08, 2015 at 05:12:42PM +0200, Peter Zijlstra wrote:
> > > > On Thu, Oct 08, 2015 at 08:06:39AM -0700, Paul E. McKenney wrote:
> > > > > Please see below for the fixed version.  Thoughts?
> > > > 
> > > > > + __releases(rnp->lock) /* But leaves rrupts disabled. */
> > > > > + raw_spin_unlock(>lock); /* rrupts remain disabled. */
> > > > > + raw_spin_lock(>lock); /* rrupts already disabled. 
> > > > > */
> > > > 
> > > > What them 'rrupts' about? ;-)
> > > 
> > > Interrupts when it won't fit.  I suppose I could use IRQs instead.  ;-)
> > 
> > In this particular case, "IRQs" works just as well; however, in general,
> > this seems like an excellent example of when to ignore the 80-column
> > guideline. :)
> 
> But but but...   You are talking to someone who used actual PUNCHED CARDS
> in real life in a paying job!!!  ;-)

And I learned on a DOS system with 80x25 text mode.  Let us revel in
wonderment at the capabilities of modern systems. :)

- Josh Triplett
--
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.2 057/107] IB/mlx4: Use correct SL on AH query under RoCE

2015-10-08 Thread Ben Hutchings
3.2.72-rc1 review patch.  If anyone has any objections, please let me know.

--

From: Noa Osherovich 

commit 5e99b139f1b68acd65e36515ca347b03856dfb5a upstream.

The mlx4 IB driver implementation for ib_query_ah used a wrong offset
(28 instead of 29) when link type is Ethernet. Fixed to use the correct one.

Fixes: fa417f7b520e ('IB/mlx4: Add support for IBoE')
Signed-off-by: Shani Michaeli 
Signed-off-by: Noa Osherovich 
Signed-off-by: Or Gerlitz 
Signed-off-by: Doug Ledford 
Signed-off-by: Ben Hutchings 
---
 drivers/infiniband/hw/mlx4/ah.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/drivers/infiniband/hw/mlx4/ah.c
+++ b/drivers/infiniband/hw/mlx4/ah.c
@@ -169,9 +169,13 @@ int mlx4_ib_query_ah(struct ib_ah *ibah,
enum rdma_link_layer ll;
 
memset(ah_attr, 0, sizeof *ah_attr);
-   ah_attr->sl = be32_to_cpu(ah->av.ib.sl_tclass_flowlabel) >> 28;
ah_attr->port_num = be32_to_cpu(ah->av.ib.port_pd) >> 24;
ll = rdma_port_get_link_layer(ibah->device, ah_attr->port_num);
+   if (ll == IB_LINK_LAYER_ETHERNET)
+   ah_attr->sl = be32_to_cpu(ah->av.eth.sl_tclass_flowlabel) >> 29;
+   else
+   ah_attr->sl = be32_to_cpu(ah->av.ib.sl_tclass_flowlabel) >> 28;
+
ah_attr->dlid = ll == IB_LINK_LAYER_INFINIBAND ? 
be16_to_cpu(ah->av.ib.dlid) : 0;
if (ah->av.ib.stat_rate)
ah_attr->static_rate = ah->av.ib.stat_rate - 
MLX4_STAT_RATE_OFFSET;

--
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.2 052/107] of/address: Don't loop forever in of_find_matching_node_by_address().

2015-10-08 Thread Ben Hutchings
3.2.72-rc1 review patch.  If anyone has any objections, please let me know.

--

From: David Daney 

commit 3a496b00b6f90c41bd21a410871dfc97d4f3c7ab upstream.

If the internal call to of_address_to_resource() fails, we end up
looping forever in of_find_matching_node_by_address().  This can be
caused by a defective device tree, or calling with an incorrect
matches argument.

Fix by calling of_find_matching_node() unconditionally at the end of
the loop.

Signed-off-by: David Daney 
Signed-off-by: Rob Herring 
Signed-off-by: Ben Hutchings 
---
 drivers/of/address.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -604,10 +604,10 @@ struct device_node *of_find_matching_nod
struct resource res;
 
while (dn) {
-   if (of_address_to_resource(dn, 0, ))
-   continue;
-   if (res.start == base_address)
+   if (!of_address_to_resource(dn, 0, ) &&
+   res.start == base_address)
return dn;
+
dn = of_find_matching_node(dn, matches);
}
 

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