RE: [PATCH] sd: remove redundant check for BLK_DEF_MAX_SECTORS

2016-06-07 Thread Long Li
Hi Martin,

Thanks for looking into this. The problem I'm trying to solve is that, I want 
to have lower layer driver to setup max_sectors bigger than 
BLK_DEF_MAX_SECTORS. In Hyper-v, we use 2MB max transfer I/O size, in future 
version the max transfer I/O size will increase to 8MB.
 
The implementation of sd.c limits the maximum value of max_sectors  to 
BLK_DEF_MAX_SECTORS.  Because sd_revalidate_disk is called late in the SCSI 
disk initialization process, there is no way for a lower layer driver to set 
this value to its "bigger" optimal size. 

The reason why I think it may not be necessary for sd.c to setup max_sectors, 
it's because this value may have already been setup twice before reaching the 
code in sd.c:
1. When this disk device is first scanned, or re-scanned (in scsi_scan.c), 
where it eventually calls __scsi_init_queue(), and use the max_sectors in the 
scsi_host_template.
2. in slave_configure of scsi_host_template, when the lower layer driver 
implements this function in its template and it can change this value there.

Long

> -Original Message-
> From: Martin K. Petersen [mailto:martin.peter...@oracle.com]
> Sent: Monday, June 6, 2016 8:42 PM
> To: Long Li 
> Cc: Tom Yan ; James E.J. Bottomley
> ; Martin K. Petersen
> ; linux-s...@vger.kernel.org; linux-
> ker...@vger.kernel.org
> Subject: Re: [PATCH] sd: remove redundant check for
> BLK_DEF_MAX_SECTORS
> 
> > "Long" == Long Li  writes:
> 
> Long,
> 
> Long> The reason is that, max_sectors already has value at this point,
> Long> the default value is SCSI_DEFAULT_MAX_SECTORS
> Long> (include/scsi/scsi_host.h). The lower layer host driver can change
> Long> this value in its template.
> 
> The LLD sets max_hw_sectors which indicates the capabilities of the
> controller DMA hardware. Whereas the max_sectors limit is set by sd to
> either follow advise by the device or--if not provided--use the block layer
> default. max_sectors governs the size of READ/WRITE requests and do not
> reflect the capabilities of the DMA hardware.
> 
> Long> I think the drivers care about this value have already set it. So
> Long> it's better not to change it again. If they want max_sectors to be
> Long> set by sd, they can use BLOCK LIMITS VPD to tell it to do so.
> 
> Most drivers don't have the luxury of being able to generate VPDs for their
> attached target devices :)
> 
> --
> Martin K. PetersenOracle Linux Engineering


[PATCH net] Driver: Vmxnet3: segCnt can be 1 for LRO packets

2016-06-07 Thread Shrikrishna Khare
The device emulation may send segCnt of 1 for LRO packets.

Signed-off-by: Shrikrishna Khare 
Signed-off-by: Jin Heo 
---
 drivers/net/vmxnet3/vmxnet3_drv.c | 2 +-
 drivers/net/vmxnet3/vmxnet3_int.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c 
b/drivers/net/vmxnet3/vmxnet3_drv.c
index db8022a..6f399b2 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -1369,7 +1369,7 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
rcdlro = (struct Vmxnet3_RxCompDescExt *)rcd;
 
segCnt = rcdlro->segCnt;
-   BUG_ON(segCnt <= 1);
+   BUG_ON(segCnt == 0);
mss = rcdlro->mss;
if (unlikely(segCnt <= 1))
segCnt = 0;
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h 
b/drivers/net/vmxnet3/vmxnet3_int.h
index c482539..3d2b64e 100644
--- a/drivers/net/vmxnet3/vmxnet3_int.h
+++ b/drivers/net/vmxnet3/vmxnet3_int.h
@@ -69,10 +69,10 @@
 /*
  * Version numbers
  */
-#define VMXNET3_DRIVER_VERSION_STRING   "1.4.7.0-k"
+#define VMXNET3_DRIVER_VERSION_STRING   "1.4.8.0-k"
 
 /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */
-#define VMXNET3_DRIVER_VERSION_NUM  0x01040700
+#define VMXNET3_DRIVER_VERSION_NUM  0x01040800
 
 #if defined(CONFIG_PCI_MSI)
/* RSS only makes sense if MSI-X is supported. */
-- 
2.8.2



Re: [PATCH v13 10/10] kprobes: Add arm64 case in kprobe example module

2016-06-07 Thread Huang Shijie
On Thu, Jun 02, 2016 at 11:26:24PM -0400, David Long wrote:
> From: Sandeepa Prabhu 
> 
> Add info prints in sample kprobe handlers for ARM64
> 
> Signed-off-by: Sandeepa Prabhu 
> ---
>  samples/kprobes/kprobe_example.c | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/samples/kprobes/kprobe_example.c 
> b/samples/kprobes/kprobe_example.c
> index ed0ca0c..aad8e6f 100644
> --- a/samples/kprobes/kprobe_example.c
> +++ b/samples/kprobes/kprobe_example.c
> @@ -46,6 +46,10 @@ static int handler_pre(struct kprobe *p, struct pt_regs 
> *regs)
>   " ex1 = 0x%lx\n",
>   p->symbol_name, p->addr, regs->pc, regs->ex1);
>  #endif
> +#ifdef CONFIG_ARM64
> + pr_info("pre_handler: p->addr = 0x%p, pc = 0x%lx\n",
> + p->addr, (long)regs->pc);
Please add the "p->symbol_name" for the log, just as the above line.

> +#endif
>  
>   /* A dump_stack() here will give a stack backtrace */
>   return 0;
> @@ -71,6 +75,10 @@ static void handler_post(struct kprobe *p, struct pt_regs 
> *regs,
>   printk(KERN_INFO "<%s> post_handler: p->addr = 0x%p, ex1 = 0x%lx\n",
>   p->symbol_name, p->addr, regs->ex1);
>  #endif
> +#ifdef CONFIG_ARM64
> + pr_info("post_handler: p->addr = 0x%p, pc = 0x%lx\n",
> + p->addr, (long)regs->pc);
> +#endif
>  }
Ditto.

thanks
Huang Shijie



Re: [PATCH 0/2] Proper ro_after_init implementation on s390

2016-06-07 Thread Heiko Carstens
On Tue, Jun 07, 2016 at 11:11:17AM -0700, Kees Cook wrote:
> On Tue, Jun 7, 2016 at 11:07 AM, Heiko Carstens
>  wrote:
> > On Tue, Jun 07, 2016 at 08:49:14AM -0700, Kees Cook wrote:
> >> > Heiko Carstens (2):
> >> >   vmlinux.lds.h: allow arch specific handling of ro_after_init data 
> >> > section
> >> >   s390/mm: add proper __ro_after_init support
> >> >
> >> >  arch/s390/include/asm/cache.h |  3 ---
> >> >  arch/s390/include/asm/sections.h  |  1 +
> >> >  arch/s390/kernel/vmlinux.lds.S| 12 +++-
> >> >  arch/s390/mm/init.c   |  7 ---
> >> >  arch/s390/mm/vmem.c   |  7 +++
> >> >  include/asm-generic/vmlinux.lds.h | 10 +-
> >> >  6 files changed, 28 insertions(+), 12 deletions(-)
> >>
> >> Awesome! This looks great to me! Have you had a chance to look through
> >> any of the arch/s390/ __init code for variables that should be marked
> >> __ro_after_init?
> >
> > Not yet, and actually this I'm a bit reluctant to do that, since any wrong
> > annotation will lead to kernel crashes sooner or later ;)
> > However I'll look into this as well.
> 
> Yup, though the good news is it's usually discovered very quickly. :)

Eventually it might make sense to add something like
DEBUG_SECTION_MISMATCH, which would only report on _write_ accesses from
non-init sections.

Not sure if this can be done easily and without the need of a new compiler
feature. The new problem class I'm afraid of is more or less the same that
we had when non-init code referenced (already freed) initdata objects.



Re: [PATCH v8 2/3] CMDQ: Mediatek CMDQ driver

2016-06-07 Thread Horng-Shyang Liao
Hi Matthias,

On Tue, 2016-06-07 at 18:59 +0200, Matthias Brugger wrote:
> 
> On 03/06/16 15:11, Matthias Brugger wrote:
> >
> >
> [...]
> 
> >> +
> >> +smp_mb(); /* modify jump before enable thread */
> >> +}
> >> +
> >> +cmdq_thread_writel(thread, task->pa_base +
> >> task->command_size,
> >> +   CMDQ_THR_END_ADDR);
> >> +cmdq_thread_resume(thread);
> >> +}
> >> +list_move_tail(>list_entry, >task_busy_list);
> >> +spin_unlock_irqrestore(>exec_lock, flags);
> >> +}
> >> +
> >> +static void cmdq_handle_error_done(struct cmdq *cmdq,
> >> +   struct cmdq_thread *thread, u32 irq_flag)
> >> +{
> >> +struct cmdq_task *task, *tmp, *curr_task = NULL;
> >> +u32 curr_pa;
> >> +struct cmdq_cb_data cmdq_cb_data;
> >> +bool err;
> >> +
> >> +if (irq_flag & CMDQ_THR_IRQ_ERROR)
> >> +err = true;
> >> +else if (irq_flag & CMDQ_THR_IRQ_DONE)
> >> +err = false;
> >> +else
> >> +return;
> >> +
> >> +curr_pa = cmdq_thread_readl(thread, CMDQ_THR_CURR_ADDR);
> >> +
> >> +list_for_each_entry_safe(task, tmp, >task_busy_list,
> >> + list_entry) {
> >> +if (curr_pa >= task->pa_base &&
> >> +curr_pa < (task->pa_base + task->command_size))
> >
> > What are you checking here? It seems as if you make some implcit
> > assumptions about pa_base and the order of execution of
> > commands in the
> > thread. Is it save to do so? Does dma_alloc_coherent give any
> > guarantees
> > about dma_handle?
> 
>  1. Check what is the current running task in this GCE thread.
>  2. Yes.
>  3. Yes, CMDQ doesn't use iommu, so physical address is continuous.
> 
> >>>
> >>> Yes, physical addresses might be continous, but AFAIK there is no
> >>> guarantee that the dma_handle address is steadily growing, when
> >>> calling
> >>> dma_alloc_coherent. And if I understand the code correctly, you
> >>> use this
> >>> assumption to decide if the task picked from task_busy_list is
> >>> currently
> >>> executing. So I think this mecanism is not working.
> >>
> >> I don't use dma_handle address, and just use physical addresses.
> >>From CPU's point of view, tasks are linked by the busy list.
> >>From GCE's point of view, tasks are linked by the JUMP command.
> >>
> >>> In which cases does the HW thread raise an interrupt.
> >>> In case of error. When does CMDQ_THR_IRQ_DONE get raised?
> >>
> >> GCE will raise interrupt if any task is done or error.
> >> However, GCE is fast, so CPU may get multiple done tasks
> >> when it is running ISR.
> >>
> >> In case of error, that GCE thread will pause and raise interrupt.
> >> So, CPU may get multiple done tasks and one error task.
> >>
> >
> > I think we should reimplement the ISR mechanism. Can't we just read
> > CURR_IRQ_STATUS and THR_IRQ_STATUS in the handler and leave
> > cmdq_handle_error_done to the thread_fn? You will need to pass
> > information from the handler to thread_fn, but that shouldn't be an
> > issue. AFAIK interrupts are disabled in the handler, so we should stay
> > there as short as possible. Traversing task_busy_list is expensive, so
> > we need to do it in a thread context.
> 
>  Actually, our initial implementation is similar to your suggestion,
>  but display needs CMDQ to return callback function very precisely,
>  else display will drop frame.
>  For display, CMDQ interrupt will be raised every 16 ~ 17 ms,
>  and CMDQ needs to call callback function in ISR.
>  If we defer callback to workqueue, the time interval may be larger than
>  32 ms.sometimes.
> 
> >>>
> >>> I think the problem is, that you implemented the workqueue as a ordered
> >>> workqueue, so there is no parallel processing. I'm still not sure why
> >>> you need the workqueue to be ordered. Can you please explain.
> >>
> >> The order should be kept.
> >> Let me use mouse cursor as an example.
> >> If task 1 means move mouse cursor to point A, task 2 means point B,
> >> and task 3 means point C, our expected result is A -> B -> C.
> >> If the order is not kept, the result could become A -> C -> B.
> >>
> >
> > Got it, thanks for the clarification.
> >
> 
> I think a way to get rid of the workqueue is to use a timer, which gets 
> programmed to the time a timeout in the first task in the busy list 
> would happen. Everytime we update the busy list (e.g. because of task 
> got finished by the thread), we update the timer. When the 

Re: [LKP] [lkp] [mm] 795ae7a0de: pixz.throughput -9.1% regression

2016-06-07 Thread Ye Xiaolong
On Tue, Jun 07, 2016 at 05:56:27PM -0400, Johannes Weiner wrote:
>On Tue, Jun 07, 2016 at 12:48:17PM +0800, Ye Xiaolong wrote:
>> FYI, below is the comparison info between 3ed3a4f, 795ae7ay, v4.7-rc2 and the
>> revert commit (eaa7f0d).
>
>Thanks for running this.
>
>Alas, I still can not make heads or tails of this, or reproduce it
>locally for that matter.
>
>With this test run, there seems to be a significant increase in system time:
>
>>  92.03 ±  0%  +5.6%  97.23 ± 11% +30.5% 120.08 ±  1% 
>> +30.0% 119.61 ±  0%  pixz.time.system_time
>
>Would it be possible to profile the testruns using perf? Maybe we can
>find out where the kernel is spending the extra time.
>
>But just to make sure I'm looking at the right code, can you first try
>the following patch on top of Linus's current tree and see if that
>gets performance back to normal? It's a partial revert of the
>watermarks that singles out the fair zone allocator:

Seems that this patch doesn't help to gets performance back.
I've attached the comparison result among 3ed3a4f, 795ae7ay, v4.7-rc2 and
1fe49ba5 ("mm: revert fairness batching to before the watermarks were")
with perf profile information.  You can find it via searching 'perf-profile'.

Thanks,
Xiaolong

>
>From 2015eaad688486d65fcf86185e213fff8506b3fe Mon Sep 17 00:00:00 2001
>From: Johannes Weiner 
>Date: Tue, 7 Jun 2016 17:45:03 -0400
>Subject: [PATCH] mm: revert fairness batching to before the watermarks were
> boosted
>
>Signed-off-by: Johannes Weiner 
>---
> include/linux/mmzone.h | 2 ++
> mm/page_alloc.c| 6 --
> 2 files changed, 6 insertions(+), 2 deletions(-)
>
>diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
>index 02069c2..4565b92 100644
>--- a/include/linux/mmzone.h
>+++ b/include/linux/mmzone.h
>@@ -327,6 +327,8 @@ struct zone {
>   /* zone watermarks, access with *_wmark_pages(zone) macros */
>   unsigned long watermark[NR_WMARK];
> 
>+  unsigned long fairbatch;
>+
>   unsigned long nr_reserved_highatomic;
> 
>   /*
>diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>index 6903b69..33387ab 100644
>--- a/mm/page_alloc.c
>+++ b/mm/page_alloc.c
>@@ -2889,7 +2889,7 @@ static void reset_alloc_batches(struct zone 
>*preferred_zone)
> 
>   do {
>   mod_zone_page_state(zone, NR_ALLOC_BATCH,
>-  high_wmark_pages(zone) - low_wmark_pages(zone) -
>+  zone->fairbatch -
>   atomic_long_read(>vm_stat[NR_ALLOC_BATCH]));
>   clear_bit(ZONE_FAIR_DEPLETED, >flags);
>   } while (zone++ != preferred_zone);
>@@ -6842,6 +6842,8 @@ static void __setup_per_zone_wmarks(void)
>   zone->watermark[WMARK_MIN] = tmp;
>   }
> 
>+  zone->fairbatch = tmp >> 2;
>+
>   /*
>* Set the kswapd watermarks distance according to the
>* scale factor in proportion to available memory, but
>@@ -6855,7 +6857,7 @@ static void __setup_per_zone_wmarks(void)
>   zone->watermark[WMARK_HIGH] = min_wmark_pages(zone) + tmp * 2;
> 
>   __mod_zone_page_state(zone, NR_ALLOC_BATCH,
>-  high_wmark_pages(zone) - low_wmark_pages(zone) -
>+  zone->fairbatch -
>   atomic_long_read(>vm_stat[NR_ALLOC_BATCH]));
> 
>   spin_unlock_irqrestore(>lock, flags);
>-- 
>2.8.2
=
compiler/cpufreq_governor/kconfig/nr_threads/rootfs/tbox_group/testcase:
  gcc-4.9/performance/x86_64-rhel/100%/debian-x86_64-2015-02-07.cgz/ivb43/pixz

commit: 
  3ed3a4f0ddffece942bb2661924d87be4ce63cb7
  795ae7a0de6b834a0cc202aa55c190ef81496665
  v4.7-rc2
  1fe49ba5002a50aefd5b6c4913e61eff86ac7253

3ed3a4f0ddffece9 795ae7a0de6b834a0cc202aa55   v4.7-rc2 
1fe49ba5002a50aefd5b6c4913
 -- -- 
--
   fail:runs  %reproductionfail:runs  %reproductionfail:runs  
%reproductionfail:runs
   | | | | |
 | |
   :40%:70%:4   
50%   2:4 kmsg.DHCP/BOOTP:Reply_not_for_us,op[#]xid[#]
   :4   50%   2:70%:4   
 0%:4 kmsg.Spurious_LAPIC_timer_interrupt_on_cpu
   :40%:7   14%   1:4   
25%   1:4 kmsg.igb#:#:#:exceed_max#second
 %stddev %change %stddev %change %stddev 
%change %stddev
 \  |\  |\  
|\
  78505362 ±  0%  -9.2%   71298182 ±  0% -11.8%   69280014 ±  0%  
-9.1%   71350485 ±  0%  

[PATCH 5/5] Staging: comedi: dmm32at: Prefer using the BIT macro

2016-06-07 Thread Ravishankar Karkala Mallikarjunayya
This fixes all occurences of (1<
---
 drivers/staging/comedi/drivers/dmm32at.c | 86 
 1 file changed, 43 insertions(+), 43 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dmm32at.c 
b/drivers/staging/comedi/drivers/dmm32at.c
index 958c0d4..4ca6104 100644
--- a/drivers/staging/comedi/drivers/dmm32at.c
+++ b/drivers/staging/comedi/drivers/dmm32at.c
@@ -46,73 +46,73 @@
 #define DMM32AT_AI_START_CONV_REG  0x00
 #define DMM32AT_AI_LSB_REG 0x00
 #define DMM32AT_AUX_DOUT_REG   0x01
-#define DMM32AT_AUX_DOUT2  (1 << 2)  /* J3.42 - OUT2 (OUT2EN) */
-#define DMM32AT_AUX_DOUT1  (1 << 1)  /* J3.43 */
-#define DMM32AT_AUX_DOUT0  (1 << 0)  /* J3.44 - OUT0 (OUT0EN) */
+#define DMM32AT_AUX_DOUT2  BIT(2)  /* J3.42 - OUT2 (OUT2EN) */
+#define DMM32AT_AUX_DOUT1  BIT(1)  /* J3.43 */
+#define DMM32AT_AUX_DOUT0  BIT(0)  /* J3.44 - OUT0 (OUT0EN) */
 #define DMM32AT_AI_MSB_REG 0x01
 #define DMM32AT_AI_LO_CHAN_REG 0x02
 #define DMM32AT_AI_HI_CHAN_REG 0x03
 #define DMM32AT_AUX_DI_REG 0x04
-#define DMM32AT_AUX_DI_DACBUSY (1 << 7)
-#define DMM32AT_AUX_DI_CALBUSY (1 << 6)
-#define DMM32AT_AUX_DI3(1 << 3)  /* J3.45 - ADCLK 
(CLKSEL) */
-#define DMM32AT_AUX_DI2(1 << 2)  /* J3.46 - GATE12 
(GT12EN) */
-#define DMM32AT_AUX_DI1(1 << 1)  /* J3.47 - GATE0 
(GT0EN) */
-#define DMM32AT_AUX_DI0(1 << 0)  /* J3.48 - CLK0 
(SRC0) */
+#define DMM32AT_AUX_DI_DACBUSY BIT(7)
+#define DMM32AT_AUX_DI_CALBUSY BIT(6)
+#define DMM32AT_AUX_DI3BIT(3)  /* J3.45 - ADCLK 
(CLKSEL) */
+#define DMM32AT_AUX_DI2BIT(2)  /* J3.46 - GATE12 
(GT12EN) */
+#define DMM32AT_AUX_DI1BIT(1)  /* J3.47 - GATE0 
(GT0EN) */
+#define DMM32AT_AUX_DI0BIT(0)  /* J3.48 - CLK0 (SRC0) 
*/
 #define DMM32AT_AO_LSB_REG 0x04
 #define DMM32AT_AO_MSB_REG 0x05
 #define DMM32AT_AO_MSB_DACH(x) ((x) << 6)
 #define DMM32AT_FIFO_DEPTH_REG 0x06
 #define DMM32AT_FIFO_CTRL_REG  0x07
-#define DMM32AT_FIFO_CTRL_FIFOEN   (1 << 3)
-#define DMM32AT_FIFO_CTRL_SCANEN   (1 << 2)
-#define DMM32AT_FIFO_CTRL_FIFORST  (1 << 1)
+#define DMM32AT_FIFO_CTRL_FIFOEN   BIT(3)
+#define DMM32AT_FIFO_CTRL_SCANEN   BIT(2)
+#define DMM32AT_FIFO_CTRL_FIFORST  BIT(1)
 #define DMM32AT_FIFO_STATUS_REG0x07
-#define DMM32AT_FIFO_STATUS_EF (1 << 7)
-#define DMM32AT_FIFO_STATUS_HF (1 << 6)
-#define DMM32AT_FIFO_STATUS_FF (1 << 5)
-#define DMM32AT_FIFO_STATUS_OVF(1 << 4)
-#define DMM32AT_FIFO_STATUS_FIFOEN (1 << 3)
-#define DMM32AT_FIFO_STATUS_SCANEN (1 << 2)
+#define DMM32AT_FIFO_STATUS_EF BIT(7)
+#define DMM32AT_FIFO_STATUS_HF BIT(6)
+#define DMM32AT_FIFO_STATUS_FF BIT(5)
+#define DMM32AT_FIFO_STATUS_OVFBIT(4)
+#define DMM32AT_FIFO_STATUS_FIFOEN BIT(3)
+#define DMM32AT_FIFO_STATUS_SCANEN BIT(2)
 #define DMM32AT_FIFO_STATUS_PAGE_MASK  (3 << 0)
 #define DMM32AT_CTRL_REG   0x08
-#define DMM32AT_CTRL_RESETA(1 << 5)
-#define DMM32AT_CTRL_RESETD(1 << 4)
-#define DMM32AT_CTRL_INTRST(1 << 3)
+#define DMM32AT_CTRL_RESETABIT(5)
+#define DMM32AT_CTRL_RESETDBIT(4)
+#define DMM32AT_CTRL_INTRSTBIT(3)
 #define DMM32AT_CTRL_PAGE_8254 (0 << 0)
-#define DMM32AT_CTRL_PAGE_8255 (1 << 0)
+#define DMM32AT_CTRL_PAGE_8255 BIT(0)
 #define DMM32AT_CTRL_PAGE_CALIB(3 << 0)
 #define DMM32AT_AI_STATUS_REG  0x08
-#define DMM32AT_AI_STATUS_STS  (1 << 7)
-#define DMM32AT_AI_STATUS_SD1  (1 << 6)
-#define DMM32AT_AI_STATUS_SD0  (1 << 5)
+#define DMM32AT_AI_STATUS_STS  BIT(7)
+#define DMM32AT_AI_STATUS_SD1  BIT(6)
+#define DMM32AT_AI_STATUS_SD0  BIT(5)
 #define DMM32AT_AI_STATUS_ADCH_MASK(0x1f << 0)
 #define DMM32AT_INTCLK_REG 0x09
-#define DMM32AT_INTCLK_ADINT   (1 << 7)
-#define DMM32AT_INTCLK_DINT(1 << 6)
-#define DMM32AT_INTCLK_TINT(1 << 5)
-#define DMM32AT_INTCLK_CLKEN   (1 << 1)  /* 1=see below  0=software */
-#define DMM32AT_INTCLK_CLKSEL  (1 << 0)  /* 1=OUT2  0=EXTCLK */
+#define DMM32AT_INTCLK_ADINT   BIT(7)
+#define DMM32AT_INTCLK_DINTBIT(6)
+#define DMM32AT_INTCLK_TINTBIT(5)
+#define DMM32AT_INTCLK_CLKEN   BIT(1)  /* 1=see below  0=software */
+#define DMM32AT_INTCLK_CLKSEL  BIT(0)  /* 1=OUT2  0=EXTCLK */
 #define 

Re: [PATCH] KVM: s390: fix build failure

2016-06-07 Thread Heiko Carstens
On Wed, Jun 08, 2016 at 07:17:35AM +0200, Christian Borntraeger wrote:
> On 06/07/2016 11:49 PM, Sudip Mukherjee wrote:
> > etr_ptff definitions are moved and renamed but we missed updating them
> > here and as a result s390 defconfig and allmodconfig was failing with
> > the error:
> > arch/s390/kvm/kvm-s390.c:230:45: error: 'ETR_PTFF_QAF' undeclared
> > 
> > Fixes: cc8f94656487 ("s390/time: move PTFF definitions")
> > Signed-off-by: Sudip Mukherjee 
> 
> Thank you for the report and patch.
> 
> This is linux-next only. Its a conflict between my kvms390 queue and 
> Martins s390 queue. We cannot apply this directly as it would break
> the build of my tree when not merged in next. (and it does not apply
> on Martins tree).
> 
> I will have a look how to fix that up.

We could ask Stephen Rothwell to apply the patch only to linux-next? ;)

> > ---
> > 
> > s390 defconfig build log is at:
> > https://travis-ci.org/sudipm-mukherjee/parport/jobs/135776067
> > 
> >  arch/s390/kvm/kvm-s390.c | 6 --
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
> > index fa51aef..3039eaf 100644
> > --- a/arch/s390/kvm/kvm-s390.c
> > +++ b/arch/s390/kvm/kvm-s390.c
> > @@ -29,7 +29,7 @@
> >  #include 
> >  #include 
> >  #include 
> > -#include 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -227,7 +227,9 @@ static void kvm_s390_cpu_feat_init(void)
> > }
> > 
> > if (test_facility(28)) /* TOD-clock steering */
> > -   etr_ptff(kvm_s390_available_subfunc.ptff, ETR_PTFF_QAF);
> > +   ptff(kvm_s390_available_subfunc.ptff,
> > +sizeof(kvm_s390_available_subfunc.ptff),
> > +PTFF_QAF);
> > 
> > if (test_facility(17)) { /* MSA */
> > __cpacf_query(CPACF_KMAC, kvm_s390_available_subfunc.kmac);
> > 
> 



Re: [PATCH v6 3/6] crypto: AF_ALG -- add asymmetric cipher interface

2016-06-07 Thread Stephan Mueller
Am Dienstag, 7. Juni 2016, 17:28:07 schrieb Mat Martineau:

Hi Mat,

> > +   used = ctx->used;
> > +
> > +   /* convert iovecs of output buffers into scatterlists */
> > +   while (iov_iter_count(>msg_iter)) {
> > +   /* make one iovec available as scatterlist */
> > +   err = af_alg_make_sg(>rsgl[cnt], >msg_iter,
> > +iov_iter_count(>msg_iter));
> > +   if (err < 0)
> > +   goto unlock;
> > +   usedpages += err;
> > +   /* chain the new scatterlist with previous one */
> > +   if (cnt)
> > +   af_alg_link_sg(>rsgl[cnt - 1], >rsgl[cnt]);
> > +
> > +   iov_iter_advance(>msg_iter, err);
> > +   cnt++;
> > +   }
> > +
> > +   /* ensure output buffer is sufficiently large */
> > +   if (usedpages < akcipher_calcsize(ctx)) {
> > +   err = -EMSGSIZE;
> > +   goto unlock;
> > +   }
> 
> Why is the size of the output buffer enforced here instead of depending on
> the algorithm implementation?

akcipher_calcsize calls crypto_akcipher_maxsize to get the maximum size the 
algorithm generates as output during its operation.

The code ensures that the caller provided at least that amount of memory for 
the kernel to store its data in. This check therefore is present to ensure the 
kernel does not overstep memory boundaries in user space.

What is your concern?

Thanks

Ciao
Stephan


[PATCH 3/5] Staging: comedi: das800: fix comment issue

2016-06-07 Thread Ravishankar Karkala Mallikarjunayya
This fixes up a WARNING: 'Block comments use a trailing */ on a
separate line'found by the checkpatch.pl tool

Signed-off-by: Ravishankar Karkala Mallikarjunayya 
---
 drivers/staging/comedi/drivers/das800.c | 102 
 1 file changed, 51 insertions(+), 51 deletions(-)

diff --git a/drivers/staging/comedi/drivers/das800.c 
b/drivers/staging/comedi/drivers/das800.c
index b02f122..0680d87 100644
--- a/drivers/staging/comedi/drivers/das800.c
+++ b/drivers/staging/comedi/drivers/das800.c
@@ -1,56 +1,56 @@
 /*
-comedi/drivers/das800.c
-Driver for Keitley das800 series boards and compatibles
-Copyright (C) 2000 Frank Mori Hess 
-
-COMEDI - Linux Control and Measurement Device Interface
-Copyright (C) 2000 David A. Schleef 
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-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.
-*/
+ * comedi/drivers/das800.c
+ * Driver for Keitley das800 series boards and compatibles
+ * Copyright (C) 2000 Frank Mori Hess 
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 2000 David A. Schleef 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ */
 /*
-Driver: das800
-Description: Keithley Metrabyte DAS800 (& compatibles)
-Author: Frank Mori Hess 
-Devices: [Keithley Metrabyte] DAS-800 (das-800), DAS-801 (das-801),
-  DAS-802 (das-802),
-  [Measurement Computing] CIO-DAS800 (cio-das800),
-  CIO-DAS801 (cio-das801), CIO-DAS802 (cio-das802),
-  CIO-DAS802/16 (cio-das802/16)
-Status: works, cio-das802/16 untested - email me if you have tested it
-
-Configuration options:
-  [0] - I/O port base address
-  [1] - IRQ (optional, required for timed or externally triggered conversions)
-
-Notes:
-   IRQ can be omitted, although the cmd interface will not work without it.
-
-   All entries in the channel/gain list must use the same gain and be
-   consecutive channels counting upwards in channel number (these are
-   hardware limitations.)
-
-   I've never tested the gain setting stuff since I only have a
-   DAS-800 board with fixed gain.
-
-   The cio-das802/16 does not have a fifo-empty status bit!  Therefore
-   only fifo-half-full transfers are possible with this card.
-
-cmd triggers supported:
-   start_src:  TRIG_NOW | TRIG_EXT
-   scan_begin_src: TRIG_FOLLOW
-   scan_end_src:   TRIG_COUNT
-   convert_src:TRIG_TIMER | TRIG_EXT
-   stop_src:   TRIG_NONE | TRIG_COUNT
-*/
+ * Driver: das800
+ * Description: Keithley Metrabyte DAS800 (& compatibles)
+ * Author: Frank Mori Hess 
+ * Devices: [Keithley Metrabyte] DAS-800 (das-800), DAS-801 (das-801),
+ * DAS-802 (das-802),
+ * [Measurement Computing] CIO-DAS800 (cio-das800),
+ * CIO-DAS801 (cio-das801), CIO-DAS802 (cio-das802),
+ * CIO-DAS802/16 (cio-das802/16)
+ * Status: works, cio-das802/16 untested - email me if you have tested it
+ *
+ * Configuration options:
+ * [0] - I/O port base address
+ *  [1] - IRQ (optional, required for timed or externally triggered 
conversions)
+ *
+ * Notes:
+ * IRQ can be omitted, although the cmd interface will not work without it.
+ *
+ * All entries in the channel/gain list must use the same gain and be
+ * consecutive channels counting upwards in channel number (these are
+ * hardware limitations.)
+ *
+ * I've never tested the gain setting stuff since I only have a
+ * DAS-800 board with fixed gain.
+ *
+ * The cio-das802/16 does not have a fifo-empty status bit!  Therefore
+ * only fifo-half-full transfers are possible with this card.
+ *
+ * cmd triggers supported:
+ * start_src:  TRIG_NOW | TRIG_EXT
+ * scan_begin_src: TRIG_FOLLOW
+ * scan_end_src:   TRIG_COUNT
+ * convert_src:TRIG_TIMER | TRIG_EXT
+ * stop_src:   TRIG_NONE | TRIG_COUNT
+ */
 
 #include 
 #include 
-- 
1.9.1



[PATCH 1/5] Staging: comedi: das16: fix blank line

2016-06-07 Thread Ravishankar Karkala Mallikarjunayya
This fixes up a blank line after function/struct/union/enum check found
by the checkpatch.pl tool

Signed-off-by: Ravishankar Karkala Mallikarjunayya 
---
 drivers/staging/comedi/drivers/das16.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/comedi/drivers/das16.c 
b/drivers/staging/comedi/drivers/das16.c
index fd8e0b7..4d6e581 100644
--- a/drivers/staging/comedi/drivers/das16.c
+++ b/drivers/staging/comedi/drivers/das16.c
@@ -198,6 +198,7 @@ enum {
das16_pg_1601,
das16_pg_1602,
 };
+
 static const int *const das16_gainlists[] = {
NULL,
das16jr_gainlist,
-- 
1.9.1



[PATCH 2/5] Staging: comedi: das16: fix Block comment

2016-06-07 Thread Ravishankar Karkala Mallikarjunayya
This fixes up a WARNING: 'Block comments use a trailing */ on a
separate line'found by the checkpatch.pl tool.

Signed-off-by: Ravishankar Karkala Mallikarjunayya 
---
 drivers/staging/comedi/drivers/das16.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/das16.c 
b/drivers/staging/comedi/drivers/das16.c
index 4d6e581..ef345dc 100644
--- a/drivers/staging/comedi/drivers/das16.c
+++ b/drivers/staging/comedi/drivers/das16.c
@@ -429,8 +429,10 @@ static const struct das16_board das16_boards[] = {
},
 };
 
-/* Period for timer interrupt in jiffies.  It's a function
- * to deal with possibility of dynamic HZ patches  */
+/*
+ * Period for timer interrupt in jiffies.  It's a function
+ * to deal with possibility of dynamic HZ patches
+ */
 static inline int timer_period(void)
 {
return HZ / 20;
-- 
1.9.1



[PATCH 4/5] Staging: comedi: das800: Prefer unsigned int instead of unsigned

2016-06-07 Thread Ravishankar Karkala Mallikarjunayya
This fixes up a WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
found by the checkpatch.pl tool.

Signed-off-by: Ravishankar Karkala Mallikarjunayya 
---
 drivers/staging/comedi/drivers/das800.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/das800.c 
b/drivers/staging/comedi/drivers/das800.c
index 0680d87..ef48c48 100644
--- a/drivers/staging/comedi/drivers/das800.c
+++ b/drivers/staging/comedi/drivers/das800.c
@@ -218,7 +218,7 @@ struct das800_private {
 };
 
 static void das800_ind_write(struct comedi_device *dev,
-unsigned val, unsigned reg)
+unsigned int val, unsigned int reg)
 {
/*
 * Select dev->iobase + 2 to be desired register
@@ -228,7 +228,7 @@ static void das800_ind_write(struct comedi_device *dev,
outb(val, dev->iobase + 2);
 }
 
-static unsigned das800_ind_read(struct comedi_device *dev, unsigned reg)
+static unsigned int das800_ind_read(struct comedi_device *dev, unsigned int 
reg)
 {
/*
 * Select dev->iobase + 7 to be desired register
-- 
1.9.1



Re: [PATCH 1/3] usb: pci: Remove unnecessary pci_set_drvdata().

2016-06-07 Thread Greg KH
On Wed, May 11, 2016 at 06:08:15PM +0530, Sandhya Bankar wrote:
> Unnecessary [platform|pci]_set_drvdata() have been removed since the driver 
> core clears the driver data to NULLafter device release or on probe failure. 
> There is no need to manually clear the
> device driver data to NULL.

Please fix your changelog text to be wrapped at 72 columns like it is
supposed to be.

thanks,

greg k-h


Re: NVMe over Fabrics target implementation

2016-06-07 Thread Nicholas A. Bellinger
On Tue, 2016-06-07 at 12:55 +0200, Christoph Hellwig wrote:
> There is absolutely no point in dragging in an overcomplicated configfs 
> structure for a very simple protocol which also is very different from
> SCSI in it's nitty gritty details.

Please be more specific wrt the two individual points that have been
raised.

>  Keeping the nvme target self contains
> allows it to be both much simpler and much easier to understand, as well
> as much better testable - see the amount of test coverage we could easily
> add for example.

I disagree.

> 
> Or to put it the other way around - if there was any major synergy in
> reusing the SCSI target code that just shows we're missing functionality
> in the block layer or configfs.
> 

To reiterate the points again.

*) Extensible to multiple types of backend drivers.

nvme-target needs a way to absorb new backend drivers, that
does not effect existing configfs group layout or attributes.

Looking at the nvmet/configfs layout as-is, there are no multiple
backend types defined, nor a way to control backend feature bits
exposed to nvme namespaces at runtime.

What is being proposed is a way to share target-core backends via
existing configfs symlinks across SCSI and NVMe targets.

Which means:

   - All I/O state + memory submission is done at RCU protected
 se_device level via sbc_ops
   - percpu reference counting is done outside of target-core
   - Absorb all nvmet/io-cmd optimizations into target_core_iblock.c
   - Base starting point for features in SCSI + NVMe that span
 across multiple endpoints and instances (reservations + APTPL, 
 multipath, copy-offload across fabric types)

Using target-core backends means we get features like T10-PI and
sbc_ops->write_same for free that don't exist in nvmet, and can
utilize a common set of backend drivers for SCSI and NVMe via an
existing configfs ABI and python userspace community.

And to the second, and more important point for defining a configfs ABI
that works for both today's requirements, as well into the 2020s
without breaking user-space compatibility.

As-is, the initial design using top level nvmet configfs symlinks of
subsystem groups into individual port + host groups does not scale.

That is, it currently does:

  - Sequential list lookup under global rw_mutex of top-level nvmet_port
and nvmet_host symlink ->allow_link() and ->drop_link() configfs
callbacks.
  - nvmet_fabrics_ops->add_port() callback invoked under same global
rw mutex.

This is very bad for several reasons.

As-is, this blocks all other configfs port + host operations from
occurring even during normal operation, which makes it quite useless for
any type of multi-tenant target environment where the individual target
endpoints *must* be able to operate independently.

Seriously, there is never a good reason why configfs group or item
callbacks should be performing list lookup under a global lock at
this level.

Why does it ever make sense for $SUBSYSTEM_NQN_0 with $PORT_DRIVER_FOO
to block operation of $SUBSYSTEM_NQN_1 with $PORT_DRIVER_BAR..?

A simple example where this design breaks down quickly is a NVMf
ops->add_port() call that requires a HW reset, or say reloading of
firmware that can take multiple seconds. (qla2xxx comes to mind).

There is a simple test to highlight this limitation.  Take any
nvme-target driver that is capable of multiple ports, and introduce
a sleep(5) into each ops->add_port() call.

Now create 256 different subsystem NQNs with 256 different ports
across four different user-space processes.

What happens to other subsystems, ports and host groups configfs
symlinks when this occurs..?

What happens to the other user-space processes..?



Re: [PATCH 1/8] blk-mq: add blk_mq_alloc_request_hctx

2016-06-07 Thread Ming Lin
On Tue, 2016-06-07 at 22:49 -0600, Jens Axboe wrote:
> On 06/06/2016 03:21 PM, Christoph Hellwig wrote:
> > From: Ming Lin 
> > 
> > For some protocols like NVMe over Fabrics we need to be able to
> > send
> > initialization commands to a specific queue.
> > 
> > Based on an earlier patch from Christoph Hellwig .
> > 
> > Signed-off-by: Ming Lin 
> > Signed-off-by: Christoph Hellwig 
> > ---
> >   block/blk-mq.c | 33 +
> >   include/linux/blk-mq.h |  2 ++
> >   2 files changed, 35 insertions(+)
> > 
> > diff --git a/block/blk-mq.c b/block/blk-mq.c
> > index 29cbc1b..7bb45ed 100644
> > --- a/block/blk-mq.c
> > +++ b/block/blk-mq.c
> > @@ -266,6 +266,39 @@ struct request *blk_mq_alloc_request(struct
> > request_queue *q, int rw,
> >   }
> >   EXPORT_SYMBOL(blk_mq_alloc_request);
> > 
> > +struct request *blk_mq_alloc_request_hctx(struct request_queue *q,
> > int rw,
> > +   unsigned int flags, unsigned int hctx_idx)
> > +{
> > +   struct blk_mq_hw_ctx *hctx;
> > +   struct blk_mq_ctx *ctx;
> > +   struct request *rq;
> > +   struct blk_mq_alloc_data alloc_data;
> > +   int ret;
> > +
> > +   ret = blk_queue_enter(q, flags & BLK_MQ_REQ_NOWAIT);
> > +   if (ret)
> > +   return ERR_PTR(ret);
> > +
> > +   hctx = q->queue_hw_ctx[hctx_idx];
> > +   ctx = __blk_mq_get_ctx(q, cpumask_first(hctx->cpumask));
> > +
> > +   blk_mq_set_alloc_data(_data, q, flags, ctx, hctx);
> > +
> > +   rq = __blk_mq_alloc_request(_data, rw);
> > +   if (!rq && !(flags & BLK_MQ_REQ_NOWAIT)) {
> > +   __blk_mq_run_hw_queue(hctx);
> > +
> > +   rq =  __blk_mq_alloc_request(_data, rw);
> > +   }
> 
> Why are we duplicating this code here? If NOWAIT isn't set, then
> we'll
> always return a request. bt_get() will run the queue for us, if it
> needs
> to. blk_mq_alloc_request() does this too, and I'm guessing that code
> was
> just copied. I'll fix that up. Looks like this should just be:
> 
>   rq = __blk_mq_alloc_request(_data, rw);
>   if (rq)
>   return rq;
> 
>   blk_queue_exit(q);
>   return ERR_PTR(-EWOULDBLOCK);
> 
> for this case.

Yes,

But the bt_get() reminds me that this patch actually has a problem.

blk_mq_alloc_request_hctx() ->
  __blk_mq_alloc_request() ->
    blk_mq_get_tag() -> 
      __blk_mq_get_tag() ->
        bt_get() ->
          blk_mq_put_ctx(data->ctx);

Here are blk_mq_get_ctx() and blk_mq_put_ctx().

static inline struct blk_mq_ctx *blk_mq_get_ctx(struct request_queue *q)
{   
return __blk_mq_get_ctx(q, get_cpu());
} 

static inline void blk_mq_put_ctx(struct blk_mq_ctx *ctx)
{
put_cpu();
}

blk_mq_alloc_request_hctx() calls __blk_mq_get_ctx() instead
of blk_mq_get_ctx(). Then reason is the "hctx" could belong to other
cpu. So blk_mq_get_ctx() doesn't work.

But then above put_cpu() in blk_mq_put_ctx() will trigger a WARNING
because we didn't do get_cpu() in blk_mq_alloc_request_hctx()


Re: [PATCH 3.10 000/143] 3.10.102-stable review

2016-06-07 Thread Willy Tarreau
On Tue, Jun 07, 2016 at 05:52:52PM -0700, Guenter Roeck wrote:
> Here we are;
> 
> Build results:
>   total: 123 pass: 123 fail: 0
> Qemu test results:
>   total: 75 pass: 75 fail: 0
> 
> Details are available at http://kerneltests.org/builders.

Excellent, thank you Guenter!

Willy


Re: [PATCH] KVM: s390: fix build failure

2016-06-07 Thread Christian Borntraeger
On 06/07/2016 11:49 PM, Sudip Mukherjee wrote:
> etr_ptff definitions are moved and renamed but we missed updating them
> here and as a result s390 defconfig and allmodconfig was failing with
> the error:
> arch/s390/kvm/kvm-s390.c:230:45: error: 'ETR_PTFF_QAF' undeclared
> 
> Fixes: cc8f94656487 ("s390/time: move PTFF definitions")
> Signed-off-by: Sudip Mukherjee 

Thank you for the report and patch.

This is linux-next only. Its a conflict between my kvms390 queue and 
Martins s390 queue. We cannot apply this directly as it would break
the build of my tree when not merged in next. (and it does not apply
on Martins tree).

I will have a look how to fix that up.


> ---
> 
> s390 defconfig build log is at:
> https://travis-ci.org/sudipm-mukherjee/parport/jobs/135776067
> 
>  arch/s390/kvm/kvm-s390.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
> index fa51aef..3039eaf 100644
> --- a/arch/s390/kvm/kvm-s390.c
> +++ b/arch/s390/kvm/kvm-s390.c
> @@ -29,7 +29,7 @@
>  #include 
>  #include 
>  #include 
> -#include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -227,7 +227,9 @@ static void kvm_s390_cpu_feat_init(void)
>   }
> 
>   if (test_facility(28)) /* TOD-clock steering */
> - etr_ptff(kvm_s390_available_subfunc.ptff, ETR_PTFF_QAF);
> + ptff(kvm_s390_available_subfunc.ptff,
> +  sizeof(kvm_s390_available_subfunc.ptff),
> +  PTFF_QAF);
> 
>   if (test_facility(17)) { /* MSA */
>   __cpacf_query(CPACF_KMAC, kvm_s390_available_subfunc.kmac);
> 



Re: [PATCH] mm/zsmalloc: add trace events for zs_compact

2016-06-07 Thread Minchan Kim
On Wed, Jun 08, 2016 at 09:48:30AM +0800, Ganesh Mahendran wrote:
> Hi, Minchan:
> 
> 2016-06-08 8:16 GMT+08:00 Minchan Kim :
> > Hello Ganesh,
> >
> > On Tue, Jun 07, 2016 at 04:56:44PM +0800, Ganesh Mahendran wrote:
> >> Currently zsmalloc is widely used in android device.
> >> Sometimes, we want to see how frequently zs_compact is
> >> triggered or how may pages freed by zs_compact(), or which
> >> zsmalloc pool is compacted.
> >>
> >> Most of the time, user can get the brief information from
> >> trace_mm_shrink_slab_[start | end], but in some senario,
> >> they do not use zsmalloc shrinker, but trigger compaction manually.
> >> So add some trace events in zs_compact is convenient. Also we
> >> can add some zsmalloc specific information(pool name, total compact
> >> pages, etc) in zsmalloc trace.
> >
> > Sorry, I cannot understand what's the problem now and what you want to
> > solve. Could you elaborate it a bit?
> >
> > Thanks.
> 
> We have backported the zs_compact() to our product(kernel 3.18).
> It is usefull for a longtime running device.
> But there is not a convenient way to get the detailed information
> of zs_comapct() which is usefull for  performance optimization.
> Information about how much time zs_compact used, which pool is
> compacted, how many page freed, etc.

You can know how many pages are freed by object compaction via mm_stat
each /sys/block/zram-id/mm_stat. And you can use function_graph to know
how much time zs_compact used.


> With these information, we will know what is going on in zs_comapct.
> And draw the relation between free mem and zs_comapct.
> 
> >
> >>
> >> This patch add two trace events for zs_compact(), below the trace log:
> >> -
> >> root@land:/ # cat /d/tracing/trace
> >>  kswapd0-125   [007] ...1   174.176979: zsmalloc_compact_start: 
> >> pool zram0
> >>  kswapd0-125   [007] ...1   174.181967: zsmalloc_compact_end: pool 
> >> zram0: 608 pages compacted(total 1794)
> >>  kswapd0-125   [000] ...1   184.134475: zsmalloc_compact_start: 
> >> pool zram0
> >>  kswapd0-125   [000] ...1   184.135010: zsmalloc_compact_end: pool 
> >> zram0: 62 pages compacted(total 1856)
> >>  kswapd0-125   [003] ...1   226.927221: zsmalloc_compact_start: 
> >> pool zram0
> >>  kswapd0-125   [003] ...1   226.928575: zsmalloc_compact_end: pool 
> >> zram0: 250 pages compacted(total 2106)
> >> -
> >>
> >> Signed-off-by: Ganesh Mahendran 
> >> ---
> >>  include/trace/events/zsmalloc.h | 56 
> >> +
> >>  mm/zsmalloc.c   | 10 
> >>  2 files changed, 66 insertions(+)
> >>  create mode 100644 include/trace/events/zsmalloc.h
> >>
> >> diff --git a/include/trace/events/zsmalloc.h 
> >> b/include/trace/events/zsmalloc.h
> >> new file mode 100644
> >> index 000..3b6f14e
> >> --- /dev/null
> >> +++ b/include/trace/events/zsmalloc.h
> >> @@ -0,0 +1,56 @@
> >> +#undef TRACE_SYSTEM
> >> +#define TRACE_SYSTEM zsmalloc
> >> +
> >> +#if !defined(_TRACE_ZSMALLOC_H) || defined(TRACE_HEADER_MULTI_READ)
> >> +#define _TRACE_ZSMALLOC_H
> >> +
> >> +#include 
> >> +#include 
> >> +
> >> +TRACE_EVENT(zsmalloc_compact_start,
> >> +
> >> + TP_PROTO(const char *pool_name),
> >> +
> >> + TP_ARGS(pool_name),
> >> +
> >> + TP_STRUCT__entry(
> >> + __field(const char *, pool_name)
> >> + ),
> >> +
> >> + TP_fast_assign(
> >> + __entry->pool_name = pool_name;
> >> + ),
> >> +
> >> + TP_printk("pool %s",
> >> +   __entry->pool_name)
> >> +);
> >> +
> >> +TRACE_EVENT(zsmalloc_compact_end,
> >> +
> >> + TP_PROTO(const char *pool_name, unsigned long pages_compacted,
> >> + unsigned long pages_total_compacted),
> >> +
> >> + TP_ARGS(pool_name, pages_compacted, pages_total_compacted),
> >> +
> >> + TP_STRUCT__entry(
> >> + __field(const char *, pool_name)
> >> + __field(unsigned long, pages_compacted)
> >> + __field(unsigned long, pages_total_compacted)
> >> + ),
> >> +
> >> + TP_fast_assign(
> >> + __entry->pool_name = pool_name;
> >> + __entry->pages_compacted = pages_compacted;
> >> + __entry->pages_total_compacted = pages_total_compacted;
> >> + ),
> >> +
> >> + TP_printk("pool %s: %ld pages compacted(total %ld)",
> >> +   __entry->pool_name,
> >> +   __entry->pages_compacted,
> >> +   __entry->pages_total_compacted)
> >> +);
> >> +
> >> +#endif /* _TRACE_ZSMALLOC_H */
> >> +
> >> +/* This part must be outside protection */
> >> +#include 
> >> diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> >> index 213d0e1..441b9f7 100644
> >> --- a/mm/zsmalloc.c
> >> +++ b/mm/zsmalloc.c
> >> @@ -30,6 +30,8 @@
> >>
> >>  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> >>
> >> +#define CREATE_TRACE_POINTS

Re: [PATCH 09/10] x86, asm: Use CC_SET()/CC_OUT() and static_cpu_has() in archrandom.h

2016-06-07 Thread Andy Lutomirski
On Tue, Jun 7, 2016 at 4:31 PM, H. Peter Anvin  wrote:
> Use CC_SET()/CC_OUT() and static_cpu_has().  This produces code good
> enough to eliminate ad hoc use of alternatives in ,
> greatly simplifying the code.

Looks reasonable.


RE: [PATCH 2/2] aer: add support aer interrupt with none MSI/MSI-X/INTx mode

2016-06-07 Thread Po Liu
Hi Bjorn,

Thanks for the kindly reply. All these are helpful.

>  From: Bjorn Helgaas [mailto:helg...@kernel.org]
>  On Wed, June 08, 2016 6:47 AM
>  
>  On Tue, Jun 07, 2016 at 10:07:40AM +, Po Liu wrote:
>  > Hi Bjorn,
>  >
>  > >  -Original Message-
>  > >
>  > >  On Mon, Jun 06, 2016 at 10:01:44AM -0400, Murali Karicheri wrote:
>  > >  > On 06/06/2016 03:32 AM, Po Liu wrote:
>  > >  > > Hi Bjorn,
>  > >  > > I confirm we met same problem with KeyStone base on DesignWare
>  > > design.
>  > >  > >
>  > >  > >
>  > >  > > Best regards,
>  > >  > > Liu Po
>  > >  > >
>  > >  > >>  -Original Message-
>  > >  > >>  From: Bjorn Helgaas [mailto:helg...@kernel.org]  > >>  Sent:
>  > > Saturday, June 04, 2016 11:49 AM  > >>  To: Murali Karicheri  > >>
>  > > Cc: Po Liu; linux-...@vger.kernel.org; linux-arm-  > >>
>  > > ker...@lists.infradead.org; linux-kernel@vger.kernel.org;  > >>
>  > > devicet...@vger.kernel.org; Arnd Bergmann; Roy Zang; Marc Zyngier;
>  > > > >> Stuart Yoder; Yang-Leo Li; Minghuan Lian; Bjorn Helgaas; Shawn
>  > > Guo;  > >> Mingkai Hu; Rob Herring  > >>  Subject: Re: [PATCH 2/2]
>  > > aer: add support aer interrupt with none  > >> MSI/MSI-X/INTx mode
>  > > > >>  > >>  On Fri, Jun 03, 2016 at 01:31:11PM -0400, Murali
>  > > Karicheri wrote:
>  > >  > >>  > Po,
>  > >  > >>  >
>  > >  > >>  > Sorry to hijack your discussion, but the problem seems to
>  > > be  > >> same for  > Keystone PCI controller which is also
>  > > designware (old
>  > >  version) based.
>  > >  > >>  >
>  > >  > >>  > On 06/03/2016 12:09 AM, Bjorn Helgaas wrote:
>  > >  > >>  > > On Thu, Jun 02, 2016 at 11:37:28AM -0400, Murali
>  > > Karicheri
>  > >  wrote:
>  > >  > >>  > >> On 06/02/2016 09:55 AM, Bjorn Helgaas wrote:
>  > >  > >>  > >>> On Thu, Jun 02, 2016 at 05:01:19AM +, Po Liu wrote:
>  > >  > >>  > >  -Original Message-  > >  From: Bjorn
>  > > Helgaas  > >> [mailto:helg...@kernel.org]  > >  Sent: Thursday,
>  > > June 02, 2016  > >> 11:48 AM  > >  To: Po Liu  > >  Cc:
>  > >  > >> linux-...@vger.kernel.org;  > >  > >>
>  > > linux-arm-ker...@lists.infradead.org;
>  > >  > >>  > >  linux-kernel@vger.kernel.org;
>  > > devicet...@vger.kernel.org;  > >> Arnd  > > Bergmann;  Roy Zang;
>  > > Marc Zyngier; Stuart Yoder;  > >> Yang-Leo Li;  > > Minghuan
>  > > Lian; Bjorn  Helgaas; Shawn Guo;  > >> Mingkai Hu; Rob  > >
>  > > Herring  > >  Subject: Re: [PATCH 2/2]  > >> aer: add support
>  > > aer interrupt with  > > none  MSI/MSI-X/INTx  > >> mode  > >
>  > > > >  [+cc Rob]  > >  > >  Hi Po,  >  > >> >  > >
>  > > On Thu, May 26, 2016 at 02:00:06PM +0800, Po Liu  > >> wrote:
>  > >  > >>  > >  > On some platforms, root port doesn't support  > >>
>  > > MSI/MSI-X/INTx  in RC mode.
>  > >  > >>  > >  > When chip support the aer interrupt with none  >
>  > > >> MSI/MSI-X/INTx  > > mode,  > maybe there is interrupt line
>  > > for  > >> aer pme etc. Search  > > the interrupt  > number in
>  > > the fdt  file.
>  > >  > >>  > >
>  > >  > >>  > >  My understanding is that AER interrupt signaling can
>  > > be  > >> done  > > via INTx,  MSI, or MSI-X (PCIe spec r3.0, sec
>  > > 6.2.4.1.2).
>  > >  > >>  > > Apparently your device  doesn't support MSI or MSI-X.
>  > > Are  > >> you  > > saying it doesn't support INTx  either?  How
>  > > is the  > >> interrupt  you're requesting here different from INTx?
>  > >  > >>  > 
>  > >  > >>  >  Layerscape use none of MSI or MSI-X or INTx to
>  > > indicate the  > >> >  devices or root error in RC mode. But use
>  > > an independent SPI  > >> >  interrupt(arm interrupt controller)
>  line.
>  > >  > >>  > >>>
>  > >  > >>  > >>> The Root Port is a PCI device and should follow the
>  > > normal  > >> PCI  > >>> rules for interrupts.  As far as I
>  > > understand, that  > >> means it  > >>> should use MSI, MSI-X, or
>  > > INTx.  If your Root Port  > >> doesn't use MSI  > >>> or MSI-X, it
>  > > should use INTx, the  > >> PCI_INTERRUPT_PIN register  > >>> should
>  > > tell us which (INTA/  > >> INTB/etc.), and  PCI_COMMAND_INTX_DISABLE
>  should work to disable it.
>  > >  > >>  > >>> That's all from the PCI point of view, of course.
>  > >  > >>  > >>
>  > >  > >>  > >> I am faced with the same issue on Keystone PCI hardware
>  > > and  > >> it has  > >> been on my TODO list  for quite some time.
>  > > Keystone  > >> PCI hardware  > >> also doesn't use MSI or MSI-X or
>  > > INTx for  > >> reporting errors received  > >> at the root port, but
>  > > use a  > >> platform interrupt instead (not  > >> complaint to PCI
>  > > standard as  > >> per PCI base spec). So I would need  > >> similar
>  > > change to have  > >> the error interrupt passed to the aer  > >>
>  > > driver. So there are  > >> hardware out there like Keystone which
>  > > requires to support this  through platform IRQ.
>  > >  > >>  > >
>  > >  > >>  > 

Re: [PATCH v8 2/3] CMDQ: Mediatek CMDQ driver

2016-06-07 Thread Horng-Shyang Liao
Hi Matthias,

On Tue, 2016-06-07 at 19:04 +0200, Matthias Brugger wrote:
> 
> On 30/05/16 05:19, HS Liao wrote:
> > This patch is first version of Mediatek Command Queue(CMDQ) driver. The
> > CMDQ is used to help read/write registers with critical time limitation,
> > such as updating display configuration during the vblank. It controls
> > Global Command Engine (GCE) hardware to achieve this requirement.
> > Currently, CMDQ only supports display related hardwares, but we expect
> > it can be extended to other hardwares for future requirements.
> >
> > Signed-off-by: HS Liao 
> > Signed-off-by: CK Hu 
> > ---
> 
> [...]
> 
> > +static void cmdq_handle_error_done(struct cmdq *cmdq,
> > +  struct cmdq_thread *thread, u32 irq_flag)
> > +{
> > +   struct cmdq_task *task, *tmp, *curr_task = NULL;
> > +   u32 curr_pa;
> > +   struct cmdq_cb_data cmdq_cb_data;
> > +   bool err;
> > +
> > +   if (irq_flag & CMDQ_THR_IRQ_ERROR)
> > +   err = true;
> > +   else if (irq_flag & CMDQ_THR_IRQ_DONE)
> > +   err = false;
> > +   else
> > +   return;
> > +
> > +   curr_pa = cmdq_thread_readl(thread, CMDQ_THR_CURR_ADDR);
> > +
> > +   list_for_each_entry_safe(task, tmp, >task_busy_list,
> > +list_entry) {
> > +   if (curr_pa >= task->pa_base &&
> > +   curr_pa < (task->pa_base + task->command_size))
> > +   curr_task = task;
> > +   if (task->cb.cb) {
> > +   cmdq_cb_data.err = curr_task ? err : false;
> > +   cmdq_cb_data.data = task->cb.data;
> > +   task->cb.cb(cmdq_cb_data);
> > +   }
> 
> I think this is not right. If we got an IRQ_DONE, then the current task 
> is in execution, we should not call the callback until it has finished.

Thanks for your finding. This is a bug from CMDQ v6.
I will fix it in next version (CMDQ v9).

> 
> Regards,
> Matthias

Thanks,
HS



Re: [PATCH 04/10] x86, asm: define CC_SET() and CC_OUT() macros

2016-06-07 Thread Andy Lutomirski
On Tue, Jun 7, 2016 at 4:31 PM, H. Peter Anvin  wrote:
> From: "H. Peter Anvin" 
>
> The CC_SET() and CC_OUT() macros can be used together to take
> advantage of the new __GCC_ASM_FLAG_OUTPUTS__ feature in gcc 6+ while
> remaining backwards compatible.  CC_SET() generates a SET instruction
> on older compilers; CC_OUT() makes sure the output is received in the
> correct variable.

Nice.

Reviewed-by: Andy Lutomirski 


Re: [PATCH v2 1/6] power: Introduce Broadcom kona reset driver

2016-06-07 Thread Sebastian Reichel
Hi,

On Tue, Jun 07, 2016 at 12:40:41PM -0700, Chris Brand wrote:
> On Mon, Jun 6, 2016 at 6:50 PM, Sebastian Reichel  wrote:
> > Hi,
> >
> > On Mon, Jun 06, 2016 at 09:42:03AM -0700, Chris Brand wrote:
> >> On Thu, Jun 2, 2016 at 7:38 PM, Sebastian Reichel  wrote:
> >> > Feel free to queue it via arm-soc with
> >> >
> >> > Acked-By: Sebastian Reichel 
> >> >
> >> > If I didn't overlook it, it's missing DT documentation, though.
> >>
> >> Thanks, Sebastian. Because this is effectively a move of code from
> >> arch/arm rather than new code, there's already dt documentation in
> >> Documentation/devicetree/bindings/reset/brcm,bcm21664-resetmgr.txt
> >
> > Ok. That directory is usually used for periphal reset controller.
> > Board/System reset controllers are usually documented in
> > .../bindings/power/reset (following kernel strucuture
> > [drivers/reset and drivers/power/reset]).
> >
> > -- Sebastian
> 
> Would you like me to send a separate patch to move that file ?

That would nice, thanks!

-- Sebastian


signature.asc
Description: PGP signature


linux-next: Tree for Jun 8

2016-06-07 Thread Stephen Rothwell
Hi all,

News: there will be no linux-next releases on Friday or Monday, so the
release following tomorrow's will be next-20160614.

Changes since 20160607:

Removed tree: drm-vc4 (merged into the bcm2835 tree)

Dropped tree: amlogic (build failure)

My fixes tree contains:

  of: silence warnings due to max() usage

The amlogic tree still had its build failure so I dropped it for today.

The net-next tree gained a conflict against the net tree.

The clockevents tree still had its build failure so I used the version
from next-20160606.

I applied a supplied merge fix for a semantic conlict between the s390
and kvms390 trees.

Non-merge commits (relative to Linus' tree): 1881
 1809 files changed, 74075 insertions(+), 32709 deletions(-)



I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
(patches at http://www.kernel.org/pub/linux/kernel/next/ ).  If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one.  You should use "git fetch" and checkout or reset to the new
master.

You can see which trees have been included by looking in the Next/Trees
file in the source.  There are also quilt-import.log and merge.log
files in the Next directory.  Between each merge, the tree was built
with a ppc64_defconfig for powerpc and an allmodconfig (with
CONFIG_BUILD_DOCSRC=n) for x86_64, a multi_v7_defconfig for arm and a
native build of tools/perf. After the final fixups (if any), I do an
x86_64 modules_install followed by builds for x86_64 allnoconfig,
powerpc allnoconfig (32 and 64 bit), ppc44x_defconfig, allyesconfig
(this fails its final link) and pseries_le_defconfig and i386, sparc
and sparc64 defconfig.

Below is a summary of the state of the merge.

I am currently merging 232 trees (counting Linus' and 34 trees of patches
pending for Linus' tree).

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next .  If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Randy Dunlap for doing many randconfig builds.  And to Paul
Gortmaker for triage and bug fixes.

-- 
Cheers,
Stephen Rothwell

$ git checkout master
$ git reset --hard stable
Merging origin/master (43c082e72745 Merge branch 'for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace)
Merging fixes/master (b31033aacbd0 of: silence warnings due to max() usage)
Merging kbuild-current/rc-fixes (b36fad65d61f kbuild: Initialize exported 
variables)
Merging arc-current/for-curr (ed6aefed726a Revert "ARCv2: 
spinlock/rwlock/atomics: Delayed retry of failed SCOND with exponential 
backoff")
Merging arm-current/fixes (e2dfb4b88014 ARM: fix PTRACE_SETVFPREGS on SMP 
systems)
Merging m68k-current/for-linus (9a6462763b17 m68k/mvme16x: Include generic 
)
Merging metag-fixes/fixes (0164a711c97b metag: Fix ioremap_wc/ioremap_cached 
build errors)
Merging powerpc-fixes/fixes (8a934efe9434 powerpc/pseries: Fix PCI config 
address for DDW)
Merging powerpc-merge-mpe/fixes (bc0195aad0da Linux 4.2-rc2)
Merging sparc/master (6b15d6650c53 Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net)
Merging net/master (a03e6fe56971 act_police: fix a crash during removal)
Merging ipsec/master (d6af1a31cc72 vti: Add pmtu handling to vti_xmit.)
Merging ipvs/master (3ec10d3a2ba5 ipvs: update real-server binding of outgoing 
connections in SIP-pe)
Merging wireless-drivers/master (182fd9eecb28 MAINTAINERS: Add file patterns 
for wireless device tree bindings)
Merging mac80211/master (6fe04128f158 mac80211: fix fast_tx header alignment)
Merging sound-current/for-linus (f90d83b30170 ALSA: hda - Fix headset mic 
detection problem for Dell machine)
Merging pci-current/for-linus (1a695a905c18 Linux 4.7-rc1)
Merging driver-core.current/driver-core-linus (1a695a905c18 Linux 4.7-rc1)
Merging tty.current/tty-linus (1a695a905c18 Linux 4.7-rc1)
Merging usb.current/usb-linus (7b2c17f82954 usb: musb: Stop bulk endpoint while 
queue is rotated)
Merging usb-gadget-fixes/fixes (50c763f8c1ba usb: dwc3: Set the ClearPendIN bit 
on Clear Stall EP command)
Merging usb-serial-fixes/usb-linus (74d2a91aec97 USB: serial: option: add even 
more ZTE device ids)
Merging usb-chipidea-fixes/ci-for-usb-stable (d144dfea8af7 usb: chipidea: otg: 
change workqueue ci_otg as freezable)
Merging staging.current/staging-linus (1a695a905c18 Linux 4.7-rc1)
Merging char-misc.current/char-misc-linus (1a695a905c18 Linux 4.7-rc1)
Merging input-current/for-linus (540c26087bfb Input: xpad - fix rumble on Xbox 
One controllers with 2015 firmware)
Merging crypto-current/master (ab6a11a7c8ef crypto: ccp - Fix AES XTS error for 
request sizes 

Re: [PATCH 1/8] blk-mq: add blk_mq_alloc_request_hctx

2016-06-07 Thread Jens Axboe

On 06/06/2016 03:21 PM, Christoph Hellwig wrote:

From: Ming Lin 

For some protocols like NVMe over Fabrics we need to be able to send
initialization commands to a specific queue.

Based on an earlier patch from Christoph Hellwig .

Signed-off-by: Ming Lin 
Signed-off-by: Christoph Hellwig 
---
  block/blk-mq.c | 33 +
  include/linux/blk-mq.h |  2 ++
  2 files changed, 35 insertions(+)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 29cbc1b..7bb45ed 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -266,6 +266,39 @@ struct request *blk_mq_alloc_request(struct request_queue 
*q, int rw,
  }
  EXPORT_SYMBOL(blk_mq_alloc_request);

+struct request *blk_mq_alloc_request_hctx(struct request_queue *q, int rw,
+   unsigned int flags, unsigned int hctx_idx)
+{
+   struct blk_mq_hw_ctx *hctx;
+   struct blk_mq_ctx *ctx;
+   struct request *rq;
+   struct blk_mq_alloc_data alloc_data;
+   int ret;
+
+   ret = blk_queue_enter(q, flags & BLK_MQ_REQ_NOWAIT);
+   if (ret)
+   return ERR_PTR(ret);
+
+   hctx = q->queue_hw_ctx[hctx_idx];
+   ctx = __blk_mq_get_ctx(q, cpumask_first(hctx->cpumask));
+
+   blk_mq_set_alloc_data(_data, q, flags, ctx, hctx);
+
+   rq = __blk_mq_alloc_request(_data, rw);
+   if (!rq && !(flags & BLK_MQ_REQ_NOWAIT)) {
+   __blk_mq_run_hw_queue(hctx);
+
+   rq =  __blk_mq_alloc_request(_data, rw);
+   }


Why are we duplicating this code here? If NOWAIT isn't set, then we'll
always return a request. bt_get() will run the queue for us, if it needs
to. blk_mq_alloc_request() does this too, and I'm guessing that code was
just copied. I'll fix that up. Looks like this should just be:

rq = __blk_mq_alloc_request(_data, rw);
if (rq)
return rq;

blk_queue_exit(q);
return ERR_PTR(-EWOULDBLOCK);

for this case.

--
Jens Axboe



Re: [PATCH v10 6/7] usb: pci-quirks: add Intel USB drcfg mux device

2016-06-07 Thread Greg Kroah-Hartman
On Thu, Jun 02, 2016 at 09:37:28AM +0800, Lu Baolu wrote:
> In some Intel platforms, a single usb port is shared between USB host
> and device controllers. The shared port is under control of a switch
> which is defined in the Intel vendor defined extended capability for
> xHCI.
> 
> This patch adds the support to detect and create the platform device
> for the port mux switch.

Why do you need a platform device for this?  You do nothing with this
device, why create it at all?

And why is it a platform device, isn't is really a PCI device?  Why
would you ever find a "platform" device below a PCI device?  Don't abuse
platform devices for things that aren't.  It makes me want to delete
that whole interface more and more...

greg k-h


Re: [PATCH v4 11/14] arm64/numa: support HAVE_MEMORYLESS_NODES

2016-06-07 Thread Ganapatrao Kulkarni
On Wed, Jun 8, 2016 at 7:46 AM, Leizhen (ThunderTown)
 wrote:
>
>
> On 2016/6/7 22:01, Ganapatrao Kulkarni wrote:
>> On Tue, Jun 7, 2016 at 6:27 PM, Leizhen (ThunderTown)
>>  wrote:
>>>
>>>
>>> On 2016/6/7 16:31, Ganapatrao Kulkarni wrote:
 On Tue, Jun 7, 2016 at 1:38 PM, Zhen Lei  
 wrote:
> Some numa nodes may have no memory. For example:
> 1. cpu0 on node0
> 2. cpu1 on node1
> 3. device0 access the momory from node0 and node1 take the same time.

 i am wondering, if access to both nodes is same, then why you need numa.
 the example you are quoting is against the basic principle of "numa"
 what is device0 here? cpu?
>>> The device0 can also be a cpu. I drew a simple diagram:
>>>
>>>   cpu0 cpu1cpu2/device0
>>> ||  |
>>> ||  |
>>>DDR0 DDR1No DIMM slots or no DIMM plugged
>>>  (node0)  (node1) (node2)
>>>
>>
>> thanks for the clarification. your example is for 3 node system, where
>> third node is memory less node.
>> do you see any issue in supporting this topology with existing code?
> If opened HAVE_MEMORYLESS_NODES, it will pick the nearest node for the cpus on
> memoryless node.

i see couple of arch enabled HAVE_MEMORYLESS_NODES, but i don't see
any code in arch specific numa code for this.
is that means the core code will take care of this?

>
> For example, in include/linux/topology.h
> #ifdef CONFIG_HAVE_MEMORYLESS_NODES
> ...
> static inline int cpu_to_mem(int cpu)
> {
> return per_cpu(_numa_mem_, cpu);
> }
> ...
> #else
> ...
> static inline int cpu_to_mem(int cpu)
> {
> return cpu_to_node(cpu);
> }
> ...
> #endif
>
>> I think, this use case should be supported with present code.
>>
>
> So, we can not simply classify device0 to node0 or node1, but we can
> define a node2 which distances to node0 and node1 are the same.
>
> Signed-off-by: Zhen Lei 
> ---
>  arch/arm64/Kconfig  |  4 
>  arch/arm64/kernel/smp.c |  1 +
>  arch/arm64/mm/numa.c| 43 +--
>  3 files changed, 46 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 05c1bf1..5904a62 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -581,6 +581,10 @@ config NEED_PER_CPU_EMBED_FIRST_CHUNK
> def_bool y
> depends on NUMA
>
> +config HAVE_MEMORYLESS_NODES
> +   def_bool y
> +   depends on NUMA
> +
>  source kernel/Kconfig.preempt
>  source kernel/Kconfig.hz
>
> diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
> index d099306..9e15297 100644
> --- a/arch/arm64/kernel/smp.c
> +++ b/arch/arm64/kernel/smp.c
> @@ -620,6 +620,7 @@ static void __init of_parse_and_init_cpus(void)
> }
>
> bootcpu_valid = true;
> +   early_map_cpu_to_node(0, of_node_to_nid(dn));
>
> /*
>  * cpu_logical_map has already been
> diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c
> index df5c842..d73b0a0 100644
> --- a/arch/arm64/mm/numa.c
> +++ b/arch/arm64/mm/numa.c
> @@ -128,6 +128,14 @@ void __init early_map_cpu_to_node(unsigned int cpu, 
> int nid)
> nid = 0;
>
> cpu_to_node_map[cpu] = nid;
> +
> +   /*
> +* We should set the numa node of cpu0 as soon as possible, 
> because it
> +* has already been set up online before. cpu_to_node(0) will 
> soon be
> +* called.
> +*/
> +   if (!cpu)
> +   set_cpu_numa_node(cpu, nid);
>  }
>
>  #ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA
> @@ -215,6 +223,35 @@ int __init numa_add_memblk(int nid, u64 start, u64 
> end)
> return ret;
>  }
>
> +static u64 __init alloc_node_data_from_nearest_node(int nid, const 
> size_t size)
> +{
> +   int i, best_nid, distance;
> +   u64 pa;
> +   DECLARE_BITMAP(nodes_map, MAX_NUMNODES);
> +
> +   bitmap_zero(nodes_map, MAX_NUMNODES);
> +   bitmap_set(nodes_map, nid, 1);
> +
> +find_nearest_node:
> +   best_nid = NUMA_NO_NODE;
> +   distance = INT_MAX;
> +
> +   for_each_clear_bit(i, nodes_map, MAX_NUMNODES)
> +   if (numa_distance[nid][i] < distance) {
> +   best_nid = i;
> +   distance = numa_distance[nid][i];
> +   }
> +
> +   pa = memblock_alloc_nid(size, SMP_CACHE_BYTES, best_nid);
> +   if (!pa) {
> +   BUG_ON(best_nid == NUMA_NO_NODE);
> +   

Re: [PATCH v10 1/7] regulator: fixed: add support for ACPI interface

2016-06-07 Thread Greg Kroah-Hartman
On Thu, Jun 02, 2016 at 09:37:23AM +0800, Lu Baolu wrote:
> Add support to retrieve fixed voltage configure information through
> ACPI interface. This is needed for Intel Bay Trail devices, where a
> GPIO is used to control the USB vbus.
> 
> Signed-off-by: Lu Baolu 
> ---
>  drivers/regulator/fixed.c | 46 ++
>  1 file changed, 46 insertions(+)

Can't do anything with this until I get an ack from the "owners" of this
file.

And what happened to the acks from other Intel developers for this whole
patch series, I don't see that here :(

greg k-h


[PATCH v3 2/2] ARM: at91/dt: sama5d2: Use new compatible for ohci node

2016-06-07 Thread Wenyou Yang
Use compatible "atmel,sama5d2-ohci" to be capable of suspending
ports while sleep to save the power consumption.

Signed-off-by: Wenyou Yang 
---

Changes in v3: None
Changes in v2:
 - Use the new compatible for ohci-node.

 arch/arm/boot/dts/sama5d2.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
index 78996bd..03d6724 100644
--- a/arch/arm/boot/dts/sama5d2.dtsi
+++ b/arch/arm/boot/dts/sama5d2.dtsi
@@ -232,7 +232,7 @@
};
 
usb1: ohci@0040 {
-   compatible = "atmel,at91rm9200-ohci", "usb-ohci";
+   compatible = "atmel,sama5d2-ohci", "usb-ohci";
reg = <0x0040 0x10>;
interrupts = <41 IRQ_TYPE_LEVEL_HIGH 2>;
clocks = <_clk>, <_clk>, <>;
-- 
2.7.4



[PATCH v3 1/2] usb: ohci-at91: Forcibly suspend ports while USB suspend

2016-06-07 Thread Wenyou Yang
In order to the save power consumption, as a workaround, suspend
forcibly the USB PORTA/B/C via set the SUSPEND_A/B/C bits of OHCI
Interrupt Configuration Register in the SFRs while OHCI USB suspend.

This suspend operation must be done before the USB clock is disabled,
resume after the USB clock is enabled.

Signed-off-by: Wenyou Yang 
---

Changes in v3:
 - Change the compatible description for more precise.

Changes in v2:
 - Add compatible to support forcibly suspend the ports.
 - Add soc/at91/at91_sfr.h to accommodate the defines.
 - Add error checking for .sfr_regmap.
 - Remove unnecessary regmap_read() statement.

 .../devicetree/bindings/usb/atmel-usb.txt  |  6 +-
 drivers/usb/host/ohci-at91.c   | 80 +-
 include/soc/at91/at91_sfr.h| 29 
 3 files changed, 112 insertions(+), 3 deletions(-)
 create mode 100644 include/soc/at91/at91_sfr.h

diff --git a/Documentation/devicetree/bindings/usb/atmel-usb.txt 
b/Documentation/devicetree/bindings/usb/atmel-usb.txt
index 5883b73..888deaa 100644
--- a/Documentation/devicetree/bindings/usb/atmel-usb.txt
+++ b/Documentation/devicetree/bindings/usb/atmel-usb.txt
@@ -3,8 +3,10 @@ Atmel SOC USB controllers
 OHCI
 
 Required properties:
- - compatible: Should be "atmel,at91rm9200-ohci" for USB controllers
-   used in host mode.
+ - compatible: Should be one of the following
+  "atmel,at91rm9200-ohci" for USB controllers used in host mode.
+  "atmel,sama5d2-ohci" for USB controllers used in host mode
+  on SAMA5D2 which can force to suspend.
  - reg: Address and length of the register set for the device
  - interrupts: Should contain ehci interrupt
  - clocks: Should reference the peripheral, host and system clocks
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index d177372..54e8feb 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -21,8 +21,11 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
+#include 
 
 #include "ohci.h"
 
@@ -45,12 +48,18 @@ struct at91_usbh_data {
u8 overcurrent_changed[AT91_MAX_USBH_PORTS];
 };
 
+struct ohci_at91_caps {
+   bool suspend_ctrl;
+};
+
 struct ohci_at91_priv {
struct clk *iclk;
struct clk *fclk;
struct clk *hclk;
bool clocked;
bool wakeup;/* Saved wake-up state for resume */
+   const struct ohci_at91_caps *caps;
+   struct regmap *sfr_regmap;
 };
 /* interface and function clocks; sometimes also an AHB clock */
 
@@ -132,6 +141,17 @@ static void at91_stop_hc(struct platform_device *pdev)
 
 /*-*/
 
+struct regmap *at91_dt_syscon_sfr(void)
+{
+   struct regmap *regmap;
+
+   regmap = syscon_regmap_lookup_by_compatible("atmel,sama5d2-sfr");
+   if (IS_ERR(regmap))
+   regmap = NULL;
+
+   return regmap;
+}
+
 static void usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *);
 
 /* configure so an HC device and id are always provided */
@@ -197,6 +217,17 @@ static int usb_hcd_at91_probe(const struct hc_driver 
*driver,
goto err;
}
 
+   ohci_at91->caps = (const struct ohci_at91_caps *)
+ of_device_get_match_data(>dev);
+   if (!ohci_at91->caps)
+   return -ENODEV;
+
+   if (ohci_at91->caps->suspend_ctrl) {
+   ohci_at91->sfr_regmap = at91_dt_syscon_sfr();
+   if (!ohci_at91->sfr_regmap)
+   dev_warn(dev, "failed to find sfr node\n");
+   }
+
board = hcd->self.controller->platform_data;
ohci = hcd_to_ohci(hcd);
ohci->num_ports = board->ports;
@@ -440,8 +471,17 @@ static irqreturn_t ohci_hcd_at91_overcurrent_irq(int irq, 
void *data)
return IRQ_HANDLED;
 }
 
+static const struct ohci_at91_caps at91rm9200_caps = {
+   .suspend_ctrl = false,
+};
+
+static const struct ohci_at91_caps sama5d2_caps = {
+   .suspend_ctrl = true,
+};
+
 static const struct of_device_id at91_ohci_dt_ids[] = {
-   { .compatible = "atmel,at91rm9200-ohci" },
+   { .compatible = "atmel,at91rm9200-ohci", .data = _caps },
+   { .compatible = "atmel,sama5d2-ohci", .data = _caps },
{ /* sentinel */ }
 };
 
@@ -581,6 +621,38 @@ static int ohci_hcd_at91_drv_remove(struct platform_device 
*pdev)
return 0;
 }
 
+static int ohci_at91_port_ctrl(struct regmap *regmap, bool enable)
+{
+   u32 regval;
+   int ret;
+
+   if (!regmap)
+   return -EINVAL;
+
+   ret = regmap_read(regmap, SFR_OHCIICR, );
+   if (ret)
+   return ret;
+
+   if (enable)
+   regval &= ~SFR_OHCIICR_USB_SUSPEND;
+   else
+   regval |= SFR_OHCIICR_USB_SUSPEND;
+
+   regmap_write(regmap, SFR_OHCIICR, regval);
+
+   return 0;
+}
+

[PATCH v3 0/2] ARM: ohci-at91: Add support to forcibly suspend ports while sleep

2016-06-07 Thread Wenyou Yang
To save the power consumption, add a new compatible to support forcibly
suspend the USB PORTA/B/C via OHCI Interrupt Configuration SFR Register.

Changes in v3:
 - Change the compatible description for more precise.

Changes in v2:
 - Add compatible to support forcibly suspend the ports.
 - Add soc/at91/at91_sfr.h to accommodate the defines.
 - Add error checking for .sfr_regmap.
 - Remove unnecessary regmap_read() statement.
 - Use the new compatible for ohci-node.

Wenyou Yang (2):
  usb: ohci-at91: Forcibly suspend ports while USB suspend
  ARM: at91/dt: sama5d2: Use new compatible for ohci node

 .../devicetree/bindings/usb/atmel-usb.txt  |  6 +-
 arch/arm/boot/dts/sama5d2.dtsi |  2 +-
 drivers/usb/host/ohci-at91.c   | 80 +-
 include/soc/at91/at91_sfr.h| 29 
 4 files changed, 113 insertions(+), 4 deletions(-)
 create mode 100644 include/soc/at91/at91_sfr.h

-- 
2.7.4



[PATCH] mmc: dw_mmc: remove UBSAN warning in dw_mci_setup_bus()

2016-06-07 Thread Seung-Woo Kim
This patch removes following UBSAN warnings in dw_mci_setup_bus().
The warnings are caused because of shift with more than 31 on 32
bit variable, so this patch fixes to shift only for less than 32.

  UBSAN: Undefined behaviour in drivers/mmc/host/dw_mmc.c:1102:14
  shift exponent 250 is too large for 32-bit type 'unsigned int'
  Call trace:
  [] dump_backtrace+0x0/0x380
  [] show_stack+0x14/0x20
  [] dump_stack+0xe0/0x120
  [] ubsan_epilogue+0x18/0x68
  [] __ubsan_handle_shift_out_of_bounds+0x18c/0x1bc
  [] dw_mci_setup_bus+0x3a0/0x438
  [...]

  UBSAN: Undefined behaviour in drivers/mmc/host/dw_mmc.c:1132:27
  shift exponent 250 is too large for 32-bit type 'unsigned int'
  Call trace:
  [] dump_backtrace+0x0/0x380
  [] show_stack+0x14/0x20
  [] dump_stack+0xe0/0x120
  [] ubsan_epilogue+0x18/0x68
  [] __ubsan_handle_shift_out_of_bounds+0x18c/0x1bc
  [] dw_mci_setup_bus+0x384/0x438
  [] dw_mci_set_ios+0x184/0x798
  [] mmc_power_up+0x11c/0x260
  [] mmc_start_host+0x88/0x100
  [] mmc_add_host+0x6c/0x128
  [] dw_mci_probe+0x1088/0x1750
  [] dw_mci_pltfm_register+0x108/0x178
  [] dw_mci_exynos_probe+0x4c/0x88
  [] platform_drv_probe+0x78/0x180
  [] driver_probe_device+0x144/0x460
  [] __driver_attach+0xf4/0x140
  [] bus_for_each_dev+0xf0/0x160
  [] driver_attach+0x34/0x58
  [] bus_add_driver+0x2c0/0x398
  [] driver_register+0xbc/0x1e0
  [] __platform_driver_register+0x84/0xa8
  [] dw_mci_exynos_pltfm_driver_init+0x18/0x20
  [] do_one_initcall+0xa0/0x2c8
  [] kernel_init_freeable+0x52c/0x5dc
  [] kernel_init+0x1c/0xf8
  [] ret_from_fork+0x10/0x40

Signed-off-by: Seung-Woo Kim 
---
 drivers/mmc/host/dw_mmc.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 2cc6123..dff045e 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1099,7 +1099,8 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot, 
bool force_clkinit)
 
div = (host->bus_hz != clock) ? DIV_ROUND_UP(div, 2) : 0;
 
-   if ((clock << div) != slot->__clk_old || force_clkinit)
+   if (((div < 32) ? (clock << div) : 0) != slot->__clk_old ||
+   force_clkinit)
dev_info(>mmc->class_dev,
 "Bus speed (slot %d) = %dHz (slot req %dHz, 
actual %dHZ div = %d)\n",
 slot->id, host->bus_hz, clock,
@@ -1129,7 +1130,7 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot, 
bool force_clkinit)
mci_send_cmd(slot, sdmmc_cmd_bits, 0);
 
/* keep the clock with reflecting clock dividor */
-   slot->__clk_old = clock << div;
+   slot->__clk_old = (div < 32) ? (clock << div) : 0;
}
 
host->current_speed = clock;
-- 
1.7.4.1



[PATCH 1/1] perf/x86/intel: Add extended event constraints for Knights Landing

2016-06-07 Thread Lukasz Odzioba
For Knights Landing processor we need to filter OFFCORE_RESPONSE
events by config1 parameter to make sure that it will end up in
an appropriate PMC to meet specification.

On Knights Landing:
MSR_OFFCORE_RSP_1 bits 8, 11, 14 can be used only on PMC1
MSR_OFFCORE_RSP_0 bit 38 can be used only on PMC0

This patch introduces INTEL_EEVENT_CONSTRAINT where third parameter
specifies extended config bits allowed only on given PMCs.

Patch depends on "Change offcore response masks for Knights Landing"

Reported-by: Andi Kleen 
Acked-by: Andi Kleen 
Signed-off-by: Lukasz Odzioba 
---
 arch/x86/events/core.c |  3 ++-
 arch/x86/events/intel/core.c   | 17 ++---
 arch/x86/events/intel/uncore.c |  2 +-
 arch/x86/events/perf_event.h   | 41 -
 4 files changed, 41 insertions(+), 22 deletions(-)

diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index 33787ee..a4be71c 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -122,6 +122,7 @@ static int x86_pmu_extra_regs(u64 config, struct perf_event 
*event)
continue;
if (event->attr.config1 & ~er->valid_mask)
return -EINVAL;
+
/* Check if the extra msrs can be safely accessed*/
if (!er->extra_msr_access)
return -ENXIO;
@@ -1736,7 +1737,7 @@ static int __init init_hw_perf_events(void)
 
unconstrained = (struct event_constraint)
__EVENT_CONSTRAINT(0, (1ULL << x86_pmu.num_counters) - 1,
-  0, x86_pmu.num_counters, 0, 0);
+  0, x86_pmu.num_counters, 0, 0, 0);
 
x86_pmu_format_group.attrs = x86_pmu.format_attrs;
 
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index 7c66695..794f5c8 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -177,6 +177,17 @@ static struct event_constraint 
intel_slm_event_constraints[] __read_mostly =
EVENT_CONSTRAINT_END
 };
 
+static struct event_constraint intel_knl_event_constraints[] __read_mostly = {
+   FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */
+   FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */
+   FIXED_EVENT_CONSTRAINT(0x0300, 2), /* pseudo CPU_CLK_UNHALTED.REF */
+   /* MSR_OFFCORE_RSP_1 bits 8, 11, 14 can be used only on PMC1 */
+   INTEL_EEVENT_CONSTRAINT(0x02b7, 2, 0x4900),
+   /* MSR_OFFCORE_RSP_0 bit 38 can be used only on PMC0 */
+   INTEL_EEVENT_CONSTRAINT(0x01b7, 1, 1ull<<38),
+   EVENT_CONSTRAINT_END
+};
+
 struct event_constraint intel_skl_event_constraints[] = {
FIXED_EVENT_CONSTRAINT(0x00c0, 0),  /* INST_RETIRED.ANY */
FIXED_EVENT_CONSTRAINT(0x003c, 1),  /* CPU_CLK_UNHALTED.CORE */
@@ -2284,16 +2295,16 @@ x86_get_event_constraints(struct cpu_hw_events *cpuc, 
int idx,
  struct perf_event *event)
 {
struct event_constraint *c;
-
if (x86_pmu.event_constraints) {
for_each_event_constraint(c, x86_pmu.event_constraints) {
if ((event->hw.config & c->cmask) == c->code) {
+   if (c->emask && !(c->emask & 
event->attr.config1))
+   continue;
event->hw.flags |= c->flags;
return c;
}
}
}
-
return 
 }
 
@@ -3784,7 +3795,7 @@ __init int intel_pmu_init(void)
   knl_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
intel_pmu_lbr_init_knl();
 
-   x86_pmu.event_constraints = intel_slm_event_constraints;
+   x86_pmu.event_constraints = intel_knl_event_constraints;
x86_pmu.pebs_constraints = intel_slm_pebs_event_constraints;
x86_pmu.extra_regs = intel_knl_extra_regs;
 
diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
index fce7406..fc5b866 100644
--- a/arch/x86/events/intel/uncore.c
+++ b/arch/x86/events/intel/uncore.c
@@ -839,7 +839,7 @@ static int __init uncore_type_init(struct intel_uncore_type 
*type, bool setid)
type->pmus = pmus;
type->unconstrainted = (struct event_constraint)
__EVENT_CONSTRAINT(0, (1ULL << type->num_counters) - 1,
-   0, type->num_counters, 0, 0);
+   0, type->num_counters, 0, 0, 0);
 
if (type->event_descs) {
for (i = 0; type->event_descs[i].attr.attr.name; i++);
diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h
index 8bd764d..47241ed5 100644
--- a/arch/x86/events/perf_event.h
+++ b/arch/x86/events/perf_event.h
@@ -52,6 +52,7 @@ struct event_constraint {
int weight;
int overlap;
  

Re: [PATCH 06/10] drm/amdgpu: use drm_crtc_vblank_{on,off}()

2016-06-07 Thread Michel Dänzer
On 07.06.2016 23:07, Gustavo Padovan wrote:
> From: Gustavo Padovan 
> 
> Replace the legacy drm_vblank_{on,off}() with the new helper functions.
> 
> Signed-off-by: Gustavo Padovan 

Patches 6 & 8-10 are

Reviewed-by: Michel Dänzer 


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer


Re: Files leak from nfsd in 4.7.1-rc1 (and more?)

2016-06-07 Thread Oleg Drokin

On Jun 7, 2016, at 10:22 PM, Oleg Drokin wrote:

> 
> On Jun 7, 2016, at 8:03 PM, Jeff Layton wrote:
> 
 That said, this code is quite subtle. I'd need to look over it in more
 detail before I offer up any fixes. I'd also appreciate it if anyone
 else wants to sanity check my analysis there.
 
>> Yeah, I think you're right. It's fine since r/w opens have a distinct
>> slot, even though the refcounting just tracks the number of read and
>> write references. So yeah, the leak probably is in an error path
>> someplace, or maybe a race someplace.
> 
> So I noticed that set_access is always called locked, but clear_access is not,
> this does not sound right.
> 
> So I placed this strategic WARN_ON:
> @@ -3991,6 +4030,7 @@ static __be32 nfs4_get_vfs_file(struct svc_rqst *rqstp, 
> struct nfs4_file *fp,
>goto out_put_access;
>spin_lock(>fi_lock);
>if (!fp->fi_fds[oflag]) {
> +WARN_ON(!test_access(open->op_share_access, stp));
>fp->fi_fds[oflag] = filp;
>filp = NULL;
> 
> This is right in the place where nfsd set the access flag already, discovered
> that the file is not opened and went on to open it, yet some parallel thread
> came in and cleared the flag by the time we got the file opened.
> It did trigger (but there are 30 minutes left till test finish, so I don't
> know yet if this will correspond to the problem at hand yet, so below is 
> speculation).

Duh, I looked for a warning, but did not cross reference, and it was not this 
one that
hit yet.

Though apparently I am hitting some of the "impossible" warnings, so you might 
want to
look into that anyway.

status = nfsd4_process_open2(rqstp, resfh, open);
WARN(status && open->op_created,
 "nfsd4_process_open2 failed to open newly-created file! 
status=%u\n",
 be32_to_cpu(status));

and

filp = find_readable_file(fp);
if (!filp) {
/* We should always have a readable file here */
WARN_ON_ONCE(1);
locks_free_lock(fl);
return -EBADF;
}



Re: [PATCH V3 8/9] cpufreq: Keep policy->freq_table sorted in ascending order

2016-06-07 Thread Viresh Kumar
On 08-06-16, 02:38, Rafael J. Wysocki wrote:
> On Tuesday, June 07, 2016 09:58:07 AM Viresh Kumar wrote:
> > On 06-06-16, 23:56, Rafael J. Wysocki wrote:
> > > Since you are adding new code, you can write it so it doesn't do
> > > unnecessary checks from the start.
> > 
> > Hmm, I will do all that in this series only now.
> > 
> > > While at it, the "if ((freq < policy->min) || (freq > policy->max))"
> > > checks in cpufreq_find_index_l() and cpufreq_find_index_h() don't look
> > > good to me, because they very well may cause those function to return
> > > -EINVAL even when there's a valid table and that may cause
> > > acpi_cpufreq_fast_switch() to do bad things.
> > 
> > Hmm. So, the checks are for sure required here, otherwise we may end up
> > returning a frequency which we aren't allowed to. Also note that 'freq' here
> > isn't the target-freq, but the entry in the freq-table.
> > 
> > This routine should be returning a valid freq within the ranges specified by
> > policy->min/max.
> 
> Which in principle may not be possible if the range doesn't include any
> frequency in the table, eg. min == max and between the table entries.

By within ranges I meant, policy->min <= freq <= policy->max, and that's how all
our checks are. So even if the table will have a single valid frequency, we will
return that only.

> However, the CPU has to run at *some* frequency, even if there's none in the
> min/max range.

I completely agree. But the error will be fired only if there is no frequency
within ranges we can switch to. And that's a bug somewhere else then.

> And if we are sure that there is at least one valid frequency between min
> and max, please note that target_freq has already been clamped between them,

Yeah, its already clamped by the freq-change helpers in cpufreq core, but others
may not be doing it properly.

> > Also note that these routines shall *never* return -EINVAL, otherwise it is
> > mostly a bug we are hitting.
> 
> So make them explicitly return a valid frequency every time.

I thought about return Index 0 on such errors, will that be fine ? Anyway the
new patches have added a WARN() for such cases.

> > We have enough checks in place to make sure that there is at least one valid
> > entry in the freq-table which is >= policy->min and <= policy->max.
> 
> That assuming that the driver will always do the right thing in its ->verify
> callback.

Yeah.

-- 
viresh


[PATCH v2] udp reuseport: fix packet of same flow hashed to different socket

2016-06-07 Thread Su Xuemin
From: "Su, Xuemin" 

There is a corner case in which udp packets belonging to a same
flow are hashed to different socket when hslot->count changes from 10
to 11:

1) When hslot->count <= 10, __udp_lib_lookup() searches udp_table->hash,
and always passes 'daddr' to udp_ehashfn().

2) When hslot->count > 10, __udp_lib_lookup() searches udp_table->hash2,
but may pass 'INADDR_ANY' to udp_ehashfn() if the sockets are bound to
INADDR_ANY instead of some specific addr.

That means when hslot->count changes from 10 to 11, the hash calculated by
udp_ehashfn() is also changed, and the udp packets belonging to a same
flow will be hashed to different socket.

This is easily reproduced:
1) Create 10 udp sockets and bind all of them to 0.0.0.0:4.
2) From the same host send udp packets to 127.0.0.1:4, record the
socket index which receives the packets.
3) Create 1 more udp socket and bind it to 0.0.0.0:44096. The number 44096
is 4 + UDP_HASH_SIZE(4096), this makes the new socket put into the
same hslot as the aformentioned 10 sockets, and makes the hslot->count
change from 10 to 11.
4) From the same host send udp packets to 127.0.0.1:4, and the socket
index which receives the packets will be different from the one received
in step 2.
This should not happen as the socket bound to 0.0.0.0:44096 should not
change the behavior of the sockets bound to 0.0.0.0:4.

The fix here is that when searching udp_table->hash, if the socket
supports reuseport, pass inet_sk(sk)->inet_rcv_saddr to udp_ehashfn()
instead of daddr. When the sockets are bound to some specific addr,
inet_sk(sk)->inet_rcv_saddr should equal to daddr, and when the sockets
are bould to INADDR_ANY, this will pass INADDR_ANY to udp_ehashfn() as
what is done when searching udp_table->hash2.

It's the same case for IPv6, and this patch also fixes that.

Signed-off-by: Su, Xuemin 
---
The patch v1 does not fix the code in IPv6. Thank Eric Dumazet for
pointing that.
And I use this tree to generate this patch, hope it's correct:
  git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

 net/ipv4/udp.c | 4 +++-
 net/ipv6/udp.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index d56c055..57c38f6 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -577,7 +577,9 @@ begin:
if (score > badness) {
reuseport = sk->sk_reuseport;
if (reuseport) {
-   hash = udp_ehashfn(net, daddr, hnum,
+   hash = udp_ehashfn(net,
+  inet_sk(sk)->inet_rcv_saddr,
+  hnum,
   saddr, sport);
result = reuseport_select_sock(sk, hash, skb,
sizeof(struct udphdr));
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 2da1896..41ca493 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -290,7 +290,9 @@ begin:
if (score > badness) {
reuseport = sk->sk_reuseport;
if (reuseport) {
-   hash = udp6_ehashfn(net, daddr, hnum,
+   hash = udp6_ehashfn(net,
+   >sk_v6_rcv_saddr,
+   hnum,
saddr, sport);
result = reuseport_select_sock(sk, hash, skb,
sizeof(struct udphdr));
-- 
1.8.3.1




Re: [alsa-devel] [PATCH v2 6/9] ASoC: mediatek: add mt2701 platform driver implementation.

2016-06-07 Thread Garlic Tseng
On Tue, 2016-06-07 at 17:31 +0100, Mark Brown wrote:
> On Fri, Jun 03, 2016 at 12:56:21PM +0800, Garlic Tseng wrote:
> 
> > +   if (val < 0 || val > MT2701_I2S_NUM) {
> > +   dev_err(afe->dev, "%s, num not available, num %d, val %d\n",
> > +   __func__, num, val);
> > +   return -1;
> 
> Real error codes please.

OK I'll fix it.

> 
> > +static const struct snd_kcontrol_new mt2701_afe_multi_ch_out_asrc3[] = {
> > +   SOC_DAPM_SINGLE_AUTODISABLE("Multi ch asrc out3", PWR2_TOP_CON, 7, 1,
> > +   1),
> > +};
> 
> On/off controls should end in Switch.

Do you means that the name should end in Switch? Something like "Multi
ch asrc out3 Switch" (or maybe a shorter one)

I'll fix it (if I don't misunderstand the comment)

Thanks!

> ___
> Alsa-devel mailing list
> alsa-de...@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel




Re: [PATCH] dmaengine: xilinx_vdma: Use dma_pool_zalloc

2016-06-07 Thread Vinod Koul
On Wed, Jun 08, 2016 at 12:48:38AM +0530, Amitoj Kaur Chawla wrote:
> Dma_pool_zalloc combines dma_pool_alloc and memset 0.
> 
> The Coccinelle semantic patch used to make this change is as follows:
> @@
> type T;
> T *d;
> expression e;
> statement S;
> @@
> 
> d =
> -dma_pool_alloc
> +dma_pool_zalloc
>  (...);
> if (!d) S
> -   memset(d, 0, sizeof(T));

Thanks for your patch, but I have already applied a similar patch fixing
this.

-- 
~Vinod


[PATCH 3/5] cputime: allow irq time accounting to be selected as an option

2016-06-07 Thread riel
From: Rik van Riel 

Allow CONFIG_IRQ_TIME_ACCOUNTING to be selected as an option, on top
of CONFIG_VIRT_CPU_ACCOUNTING_GEN (and potentially others?).

This allows for the irq time accounting code to be used with nohz_idle
CPUs, which is how several distributions ship their kernels. Using the
same code for several timer modes also allows us to drop duplicate code.

Signed-off-by: Rik van Riel 
---
 init/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/init/Kconfig b/init/Kconfig
index 0dfd09d54c65..4c7ee4f136cf 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -375,9 +375,11 @@ config VIRT_CPU_ACCOUNTING_GEN
 
  If unsure, say N.
 
+endchoice
+
 config IRQ_TIME_ACCOUNTING
bool "Fine granularity task level IRQ time accounting"
-   depends on HAVE_IRQ_TIME_ACCOUNTING && !NO_HZ_FULL
+   depends on HAVE_IRQ_TIME_ACCOUNTING && !VIRT_CPU_ACCOUNTING_NATIVE
help
  Select this option to enable fine granularity task irq time
  accounting. This is done by reading a timestamp on each
@@ -386,8 +388,6 @@ config IRQ_TIME_ACCOUNTING
 
  If in doubt, say N here.
 
-endchoice
-
 config BSD_PROCESS_ACCT
bool "BSD Process Accounting"
depends on MULTIUSER
-- 
2.5.5



[PATCH 5/5] irqtime: drop local_irq_save/restore from irqtime_account_irq

2016-06-07 Thread riel
From: Rik van Riel 

Drop local_irq_save/restore from irqtime_account_irq.
Instead, have softirq and hardirq track their time spent
independently, with the softirq code subtracting hardirq
time that happened during the duration of the softirq run.

The softirq code can be interrupted by hardirq code at
any point in time, but it can check whether it got a
consistent snapshot of the timekeeping variables it wants,
and loop around in the unlikely case that it did not.

Signed-off-by: Rik van Riel 
---
 kernel/sched/cputime.c | 54 --
 1 file changed, 43 insertions(+), 11 deletions(-)

diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index e009077aeab6..466aff107f73 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -26,7 +26,9 @@
 DEFINE_PER_CPU(u64, cpu_hardirq_time);
 DEFINE_PER_CPU(u64, cpu_softirq_time);
 
-static DEFINE_PER_CPU(u64, irq_start_time);
+static DEFINE_PER_CPU(u64, hardirq_start_time);
+static DEFINE_PER_CPU(u64, softirq_start_time);
+static DEFINE_PER_CPU(u64, prev_hardirq_time);
 static int sched_clock_irqtime;
 
 void enable_sched_clock_irqtime(void)
@@ -53,36 +55,66 @@ DEFINE_PER_CPU(seqcount_t, irq_time_seq);
  * softirq -> hardirq, hardirq -> softirq
  *
  * When exiting hardirq or softirq time, account the elapsed time.
+ *
+ * When exiting softirq time, subtract the amount of hardirq time that
+ * interrupted this softirq run, to avoid double accounting of that time.
  */
 void irqtime_account_irq(struct task_struct *curr, int irqtype)
 {
-   unsigned long flags;
-   s64 delta;
+   u64 prev_softirq_start;
+   u64 prev_hardirq;
+   u64 hardirq_time;
+   s64 delta = 0;
int cpu;
 
if (!sched_clock_irqtime)
return;
 
-   local_irq_save(flags);
-
cpu = smp_processor_id();
-   delta = sched_clock_cpu(cpu) - __this_cpu_read(irq_start_time);
-   __this_cpu_add(irq_start_time, delta);
+   prev_hardirq = __this_cpu_read(prev_hardirq_time);
+   prev_softirq_start = __this_cpu_read(softirq_start_time);
+   /*
+* Softirq context may get interrupted by hardirq context,
+* on the same CPU. At softirq 
+*/
+   if (irqtype == HARDIRQ_OFFSET) {
+   delta = sched_clock_cpu(cpu) - 
__this_cpu_read(hardirq_start_time);
+   __this_cpu_add(hardirq_start_time, delta);
+   } else do {
+   hardirq_time = READ_ONCE(per_cpu(cpu_hardirq_time, cpu));
+   u64 now = sched_clock_cpu(cpu);
+
+   delta = now - prev_softirq_start;
+   if (in_serving_softirq()) {
+   /*
+* Leaving softirq context. Avoid double counting by
+* subtracting hardirq time from this interval.
+*/
+   delta -= hardirq_time - prev_hardirq;
+   } else {
+   /* Entering softirq context. Note start times. */
+   __this_cpu_write(softirq_start_time, now);
+   __this_cpu_write(prev_hardirq_time, hardirq_time);
+   }
+   /*
+* If a hardirq happened during this calculation, it may not
+* have gotten a consistent snapshot. Try again.
+*/
+   } while (hardirq_time != READ_ONCE(per_cpu(cpu_hardirq_time, cpu)));
 
-   irq_time_write_begin();
/*
 * We do not account for softirq time from ksoftirqd here.
 * We want to continue accounting softirq time to ksoftirqd thread
 * in that case, so as not to confuse scheduler with a special task
 * that do not consume any time, but still wants to run.
 */
-   if (hardirq_count())
+   if (irqtype == HARDIRQ_OFFSET && hardirq_count())
__this_cpu_add(cpu_hardirq_time, delta);
-   else if (in_serving_softirq() && curr != this_cpu_ksoftirqd())
+   else if (irqtype == SOFTIRQ_OFFSET && in_serving_softirq() &&
+   curr != this_cpu_ksoftirqd())
__this_cpu_add(cpu_softirq_time, delta);
 
irq_time_write_end();
-   local_irq_restore(flags);
 }
 EXPORT_SYMBOL_GPL(irqtime_account_irq);
 
-- 
2.5.5



[PATCH 4/5] irqtime: add irq type parameter to irqtime_account_irq

2016-06-07 Thread riel
From: Rik van Riel 

Add an irq type parameter and documentation to irqtime_account_irq,
this can be used to distinguish between transitioning from process
context to hardirq time, and from process context to softirq time.

This is necessary to be able to remove the local_irq_disable from
irqtime_account_irq.

Signed-off-by: Rik van Riel 
---
 include/linux/hardirq.h | 20 ++--
 include/linux/vtime.h   | 12 ++--
 kernel/sched/cputime.c  |  9 -
 kernel/softirq.c|  6 +++---
 4 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index dfd59d6bc6f0..1ebb31f56285 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -32,11 +32,11 @@ extern void rcu_nmi_exit(void);
  * always balanced, so the interrupted value of ->hardirq_context
  * will always be restored.
  */
-#define __irq_enter()  \
-   do {\
-   account_irq_enter_time(current);\
-   preempt_count_add(HARDIRQ_OFFSET);  \
-   trace_hardirq_enter();  \
+#define __irq_enter()  \
+   do {\
+   account_irq_enter_time(current, HARDIRQ_OFFSET);\
+   preempt_count_add(HARDIRQ_OFFSET);  \
+   trace_hardirq_enter();  \
} while (0)
 
 /*
@@ -47,11 +47,11 @@ extern void irq_enter(void);
 /*
  * Exit irq context without processing softirqs:
  */
-#define __irq_exit()   \
-   do {\
-   trace_hardirq_exit();   \
-   account_irq_exit_time(current); \
-   preempt_count_sub(HARDIRQ_OFFSET);  \
+#define __irq_exit()   \
+   do {\
+   trace_hardirq_exit();   \
+   account_irq_exit_time(current, HARDIRQ_OFFSET); \
+   preempt_count_sub(HARDIRQ_OFFSET);  \
} while (0)
 
 /*
diff --git a/include/linux/vtime.h b/include/linux/vtime.h
index 3b384bf5ce1a..58f036f3ebea 100644
--- a/include/linux/vtime.h
+++ b/include/linux/vtime.h
@@ -112,21 +112,21 @@ static inline void vtime_account_irq_enter(struct 
task_struct *tsk)
 #endif
 
 #ifdef CONFIG_IRQ_TIME_ACCOUNTING
-extern void irqtime_account_irq(struct task_struct *tsk);
+extern void irqtime_account_irq(struct task_struct *tsk, int irqtype);
 #else
-static inline void irqtime_account_irq(struct task_struct *tsk) { }
+static inline void irqtime_account_irq(struct task_struct *tsk, int irqtype) { 
}
 #endif
 
-static inline void account_irq_enter_time(struct task_struct *tsk)
+static inline void account_irq_enter_time(struct task_struct *tsk, int irqtype)
 {
vtime_account_irq_enter(tsk);
-   irqtime_account_irq(tsk);
+   irqtime_account_irq(tsk, irqtype);
 }
 
-static inline void account_irq_exit_time(struct task_struct *tsk)
+static inline void account_irq_exit_time(struct task_struct *tsk, int irqtype)
 {
vtime_account_irq_exit(tsk);
-   irqtime_account_irq(tsk);
+   irqtime_account_irq(tsk, irqtype);
 }
 
 #endif /* _LINUX_KERNEL_VTIME_H */
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index 2f862dfdb520..e009077aeab6 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -46,8 +46,15 @@ DEFINE_PER_CPU(seqcount_t, irq_time_seq);
 /*
  * Called before incrementing preempt_count on {soft,}irq_enter
  * and before decrementing preempt_count on {soft,}irq_exit.
+ *
+ * There are six possible transitions:
+ * process -> softirq, softirq -> process
+ * process -> hardirq, hardirq -> process
+ * softirq -> hardirq, hardirq -> softirq
+ *
+ * When exiting hardirq or softirq time, account the elapsed time.
  */
-void irqtime_account_irq(struct task_struct *curr)
+void irqtime_account_irq(struct task_struct *curr, int irqtype)
 {
unsigned long flags;
s64 delta;
diff --git a/kernel/softirq.c b/kernel/softirq.c
index 17caf4b63342..a311c9622c86 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -245,7 +245,7 @@ asmlinkage __visible void __softirq_entry __do_softirq(void)
current->flags &= ~PF_MEMALLOC;
 
pending = local_softirq_pending();
-   account_irq_enter_time(current);
+   account_irq_enter_time(current, SOFTIRQ_OFFSET);
 
__local_bh_disable_ip(_RET_IP_, SOFTIRQ_OFFSET);
in_hardirq = lockdep_softirq_start();
@@ -295,7 +295,7 @@ asmlinkage __visible void __softirq_entry __do_softirq(void)
}
 
lockdep_softirq_end(in_hardirq);
-   

Re: [PATCH] dmaengine: edma: Use early completion for intermediate paRAM set in slave_sg

2016-06-07 Thread Vinod Koul
On Tue, Jun 07, 2016 at 11:19:44AM +0300, Peter Ujfalusi wrote:
> The driver limits the physical number of paRAM slots to be used by channels.
> If the transfer needs more slots (more SGs) then the transfer is broken up
> to smaller chunks. When the chunk is finished the driver will rewrite the
> physical slots and continues the transfer. This set up time can take some
> time and we might miss DMA events. If the intermediate set completion is
> using early completion (the interrupt will happen when the last slot is
> issued to the TPTC and not when the transfer is finished by the TPTC) we
> will have a bit more time to update the paRAM slots and less likely to have
> missed events.

Applied, thanks

-- 
~Vinod


Re: [PATCH 4.6 000/121] 4.6.2-stable review

2016-06-07 Thread Guenter Roeck

On 06/07/2016 06:09 PM, Greg Kroah-Hartman wrote:

On Tue, Jun 07, 2016 at 06:40:54AM -0700, Guenter Roeck wrote:

On 06/05/2016 02:42 PM, Greg Kroah-Hartman wrote:

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

Responses should be made by Tue Jun  7 21:43:16 UTC 2016.
Anything received after that time might be too late.



Build results:
total: 148 pass: 132 fail: 16
Failed builds:
mips:defconfig (binutils 2.22)
mips:allnoconfig
mips:defconfig (binutils 2.24)
mips:allmodconfig
mips:allnoconfig
mips:bcm47xx_defconfig (binutils 2.25)
mips:bcm63xx_defconfig
mips:nlm_xlp_defconfig
mips:ath79_defconfig
mips:ar7_defconfig
mips:e55_defconfig
mips:cavium_octeon_defconfig
mips:malta_defconfig
mips:defconfig
unicore32:defconfig
unicore32:allnoconfig

Qemu test results:
total: 107 pass: 98 fail: 9
Failed tests:
mips:malta_defconfig:nosmp
mips:malta_defconfig:smp
mips64:malta_defconfig:nosmp
mips64:malta_defconfig:smp
mipsel:malta_defconfig:nosmp
mipsel:malta_defconfig:smp
mips64el:malta_defconfig:nosmp
mips64el:malta_defconfig:smp
mips64el:fuloong2e_defconfig:fulong2e

Details are available at http://kerneltests.org/builders.


Thanks for these, I think I've fixed them all now.



I did a quick test; looks like your fix for mips is working
for 4.4, 4.5, and 4.6. I'll let you know if the complete build
shows a problem.

Guenter



[PATCH v5 2/3] sched/cputime: Fix prev steal time accouting during cpu hotplug

2016-06-07 Thread Wanpeng Li
From: Wanpeng Li 

Commit e9532e69b8d1 ("sched/cputime: Fix steal time accounting vs. CPU 
hotplug") 
set rq->prev_* to 0 after a cpu hotplug comes back in order to fix the scenario:

| steal is smaller than rq->prev_steal_time we end up with an insane large
| value which then gets added to rq->prev_steal_time, resulting in a permanent
| wreckage of the accounting.

However, it is still buggy.

rq->prev_steal_time = 0:

As Rik pointed out:

| setting rq->prev_irq_time to 0 in the guest, and then getting a giant value 
from 
| the host, could result in a very large of steal_jiffies.

rq->prev_steal_time_rq = 0:

| steal = paravirt_steal_clock(cpu_of(rq));
| steal -= rq->prev_steal_time_rq;
|
| if (unlikely(steal > delta))
|steal = delta;
|
| rq->prev_steal_time_rq += steal;
| delta -= steal;
|
| rq->clock_task += delta;

steal is a giant value and rq->prev_steal_time_rq is 0, rq->prev_steal_time_rq 
grows in delta granularity, rq->clock_task can't ramp up until 
rq->prev_steal_time_rq 
catches up steal clock since delta value will be 0 after reducing steal time 
from 
normal execution time. That's why I obersved that cpuhg/1-12 continue running 
until rq->prev_steal_time_rq catches up steal clock timestamp.

I believe rq->prev_irq_time has similar issue. So this patch fix it by 
reverting  
commit e9532e69b8d1.

Fixes: 'commit e9532e69b8d1 ("sched/cputime: Fix steal time accounting vs. CPU 
hotplug")'
Acked-by: Rik van Riel 
Cc: Ingo Molnar 
Cc: Peter Zijlstra (Intel) 
Cc: Rik van Riel 
Cc: Thomas Gleixner 
Cc: Frederic Weisbecker 
Cc: Paolo Bonzini 
Cc: Radim Krčmář 
Signed-off-by: Wanpeng Li 
---
v4 -> v5:
 * revert commit e9532e69b8d1 

 kernel/sched/core.c  |  1 -
 kernel/sched/sched.h | 13 -
 2 files changed, 14 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 7f2cae4..7d45bb3 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7213,7 +7213,6 @@ static void sched_rq_cpu_starting(unsigned int cpu)
struct rq *rq = cpu_rq(cpu);
 
rq->calc_load_update = calc_load_update;
-   account_reset_rq(rq);
update_max_interval();
 }
 
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 72f1f30..de607e4 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1809,16 +1809,3 @@ static inline void cpufreq_trigger_update(u64 time) {}
 #else /* arch_scale_freq_capacity */
 #define arch_scale_freq_invariant()(false)
 #endif
-
-static inline void account_reset_rq(struct rq *rq)
-{
-#ifdef CONFIG_IRQ_TIME_ACCOUNTING
-   rq->prev_irq_time = 0;
-#endif
-#ifdef CONFIG_PARAVIRT
-   rq->prev_steal_time = 0;
-#endif
-#ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING
-   rq->prev_steal_time_rq = 0;
-#endif
-}
-- 
1.9.1



[PATCH v5 1/3] KVM: fix steal clock warp during guest cpu hotplug

2016-06-07 Thread Wanpeng Li
From: Wanpeng Li 

Sometimes, after CPU hotplug you can observe a spike in stolen time
(100%) followed by the CPU being marked as 100% idle when it's actually
busy with a CPU hog task.  The trace looks like the following:

cpuhp/1-12[001] d.h1   167.461657: account_process_tick: steal = 
1291385514, prev_steal_time = 0
cpuhp/1-12[001] d.h1   167.461659: account_process_tick: steal_jiffies = 
1291
-0 [001] d.h1   167.462663: account_process_tick: steal = 18732255, 
prev_steal_time = 129100
-0 [001] d.h1   167.462664: account_process_tick: steal_jiffies = 
18446744072437

The sudden decrease of "steal" causes steal_jiffies to underflow.
The root cause is kvm_steal_time being reset to 0 after hot-plugging
back in a CPU.  Instead, the preexisting value can be used, which is
what the core scheduler code expects.

John Stultz also reported a similar issue after guest S3.

Suggested-by: Paolo Bonzini 
Cc: Paolo Bonzini 
Cc: Radim Krčmář 
Cc: Ingo Molnar 
Cc: Peter Zijlstra (Intel) 
Cc: Rik van Riel 
Cc: Thomas Gleixner 
Cc: Frederic Weisbecker 
Cc: John Stultz 
Signed-off-by: Wanpeng Li 
---
v4 -> v5:
 * improve commit message
v2 -> v3:
 * fix the root cause
v1 -> v2:
 * update patch subject, description and comments
 * deal with the case where steal time suddenly increases by a ludicrous amount

 arch/x86/kernel/kvm.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index eea2a6f..1ef5e48 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -301,8 +301,6 @@ static void kvm_register_steal_time(void)
if (!has_steal_clock)
return;
 
-   memset(st, 0, sizeof(*st));
-
wrmsrl(MSR_KVM_STEAL_TIME, (slow_virt_to_phys(st) | KVM_MSR_ENABLED));
pr_info("kvm-stealtime: cpu %d, msr %llx\n",
cpu, (unsigned long long) slow_virt_to_phys(st));
-- 
1.9.1



[PATCH v5 3/3] sched/cputime: Add steal time support to full dynticks CPU time accounting

2016-06-07 Thread Wanpeng Li
From: Wanpeng Li 

This patch adds guest steal-time support to full dynticks CPU
time accounting. After the following commit:

ff9a9b4c4334 ("sched, time: Switch VIRT_CPU_ACCOUNTING_GEN to jiffy 
granularity")

... time sampling became jiffy based, even if it's still listened
to ring boundaries, so steal_account_process_tick() is reused
to account how many 'ticks' are stolen-time, after the last accumulation.

Suggested-by: Rik van Riel 
Cc: Ingo Molnar 
Cc: Peter Zijlstra (Intel) 
Cc: Rik van Riel 
Cc: Thomas Gleixner 
Cc: Frederic Weisbecker 
Cc: Paolo Bonzini 
Cc: Radim Krčmář 
Signed-off-by: Wanpeng Li 
---
v4 -> v5:
 * apply same logic to account_idle_time, so change get_vtime_delta instead
v3 -> v4:
 * fix grammar errors, thanks Ingo
 * cleanup fragile codes, thanks Ingo
v2 -> v3:
 * convert steal time jiffies to cputime
v1 -> v2:
 * fix divide zero bug, thanks Rik

 kernel/sched/cputime.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index 75f98c5..b62f9f8 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -257,7 +257,7 @@ void account_idle_time(cputime_t cputime)
cpustat[CPUTIME_IDLE] += (__force u64) cputime;
 }
 
-static __always_inline bool steal_account_process_tick(void)
+static __always_inline unsigned long steal_account_process_tick(void)
 {
 #ifdef CONFIG_PARAVIRT
if (static_key_false(_steal_enabled)) {
@@ -279,7 +279,7 @@ static __always_inline bool steal_account_process_tick(void)
return steal_jiffies;
}
 #endif
-   return false;
+   return 0;
 }
 
 /*
@@ -681,12 +681,17 @@ static cputime_t vtime_delta(struct task_struct *tsk)
 static cputime_t get_vtime_delta(struct task_struct *tsk)
 {
unsigned long now = READ_ONCE(jiffies);
-   unsigned long delta = now - tsk->vtime_snap;
+   cputime_t delta_time, steal_time;
 
+   steal_time = jiffies_to_cputime(steal_account_process_tick());
+   delta_time = jiffies_to_cputime(now - tsk->vtime_snap);
WARN_ON_ONCE(tsk->vtime_snap_whence == VTIME_INACTIVE);
tsk->vtime_snap = now;
 
-   return jiffies_to_cputime(delta);
+   if (steal_time < delta_time)
+   delta_time -= steal_time;
+
+   return delta_time;
 }
 
 static void __vtime_account_system(struct task_struct *tsk)
-- 
1.9.1



RE: [PATCH v10 2/7] usb: mux: add generic code for dual role port mux

2016-06-07 Thread Jun Li
Hi,
> -Original Message-
> From: Felipe Balbi [mailto:felipe.ba...@linux.intel.com]
> Sent: Tuesday, June 07, 2016 11:05 PM
> To: Roger Quadros ; Lu Baolu ;
> Jun Li ; Peter Chen 
> Cc: Mathias Nyman ; Greg Kroah-Hartman
> ; Lee Jones ; Heikki
> Krogerus ; Liam Girdwood
> ; Mark Brown ; linux-
> u...@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v10 2/7] usb: mux: add generic code for dual role port
> mux
> 
> 
> Hi,
> 
> Roger Quadros  writes:
> >> I might be able to find some time to implement a proof of concept
> >> which would allow your platforms to get dual-role with code we
> >> already have, but I need DWC3's OTG support which, I'm assuming, you
> >> already have :-)
> >>
> >> If you wanna try something offline, just ping me ;-) I'll be happy to
> >> help.
> >
> > What you are proposing is a dwc3 only solution. With the otg/dual-role
> > series we are trying to be generic as much as possible.
> 
> Well, if there is a need for that, sure. Take MUSB for instance. It makes
> use of nothing of the sorts, because it doesn't have to.
> 
> > Whether controller drivers want to use it or not is upto the driver
> > maintainers but we should at least ensure that user space ABI if any,
> > is consistent across different implementations.
> 
> Role decisions should not be exposed to userspace unless as debug feature
> (using e.g. DebugFS). That should be done either by the HW or within the
> kernel.

In many cases the role decision is made by usersapce, this also should be
covered.
This patchset also expose it to userspace but I think it isn't for debug:
/sys/bus/platform/devices/.../portmux.N/state

Li Jun
> 
> If we're discussing userspace ABI here, there's something very wrong with
> OTG/DRD layer design.
> 
> >>> How are you switching the port mux between host and peripheral? Only
> >>> by sysfs or do you have a GPIO for ID pin as well?
> >>
> >> depends. Some SoCs have GPIO-controller muxes while some just have
> >> mux's select signals (one for ID, one for VBUS) mapped on xHCI's
> >> address space.
> >>
> >>> What happens to the gadget controller when the port is muxed to the
> >>> host controller?  Is it stopped or it continues to run?
> >>
> >> it continues running, but that's pretty irrelevant for Intel's
> >> dual-role
> >
> > Isn't that unnecessary waste of power? Or you have firmware assisted
> > low power mode?
> 
> that's an implementation detail which brings nothing to this discussion,
> right? :-)
> 
> We can, certainly, put the other side to D3.
> 
> >> setup. We have an actual physical (inside the die, though) mux which
> >> muxes USB signals to XHCI (not DWC3's XHCI) or to a peripheral-only
> >> DWC3.
> >>
> >
> > Probably irrelevant for Intel's dual-role but many platforms that
> > share the port can't have device controller running when port is in
> > host mode and vice versa.
> 
> but that doesn't mean we need an entire new layer added to the kernel
> ;-)
> 
> DWC3 already gives us all the information necessary to make a decision on
> which role we should assume. Just consider your options. Here's how things
> would look like without any OTG/DRD layer:
> 
> -> DWC3 OTG IRQ
>  -> readl(OSTS);
>   -> if (OSTS & BIT(4))
>-> dwc3_host_exit(); __dwc3_gadget_start();
>   -> else
>-> __dwc3_gadget_stop(); dwc3_host_init();
> 
> Can you draw something similar for your proposed OTG/DRD layer?
> 
> I remember there were at least two schedule_work(). IIRC it looked
> something like below:
> 
> -> DWC3 OTG IRQ
>  -> readl(OSTS);
>   -> if (OSTS & BIT(4))
>-> otg_set_mode(PERIPHERAL);
> -> schedule_work();
>  -> otg_ops->stop_host();
>   -> usb_del_hcd();
>  -> otg_ops->start_peripheral();
>   -> usb_gadget_add_udc();
>   -> else
>-> otg_set_mode(HOST);
> -> schedule_work();
>  -> otg_ops->stop_peripheral();
>   -> usb_gadget_del_udc();
>  -> otg_ops->start_host();
>   -> usb_add_hcd();
> 
> I'm probably missing some steps there.
> 
> > So there has to be a central point of control where the respective
> > controllers are started/stopped.
> 
> some implementations might need this, yes. DWC3 and MUSB don't seem to be
> this type of system.
> 
> > That is the other point we are trying to address with the common
> > otg/dual-role code.
> >
> > Even in the TI dwc3 implementation we use dwc3's XHCI so I guess we
> > need to stop the host controller for device mode, right?
> 
> yes, see above. We already have that code.
> 
> > If so then who will deal with start/stop of the controllers then?
> 
> dwc3 itself.
> 
> --
> balbi


[PATCH RFC 0/5] sched,time: make irq time accounting work for nohz_idle

2016-06-07 Thread riel
This patch series seems to make irq time accounting work with
nohz_idle, by having it re-use the same strategy used for steal
time accounting in Wanpeng Li's patch.

It applies on top of an earlier version of Wanpeng Li's patch.

It gets rid of some code duplication, but needs a little bit more
work. Specifically, selecting CONFIG_IRQ_TIME_ACCOUNTING at the
same time as CONFIG_TICK_BASED_ACCOUNTING probably breaks :)

I am posting this because it works, and because I would like to
know what other changes I need to make at the same time.



[PATCH 2/5] nohz,cputime: remove VTIME_GEN vtime irq time code

2016-06-07 Thread riel
From: Rik van Riel 

The CONFIG_VIRT_CPU_ACCOUNTING_GEN irq time tracking code does not
appear to currently work right.

On CPUs that are nohz_full, people typically do not assign IRQs.
On the housekeeping CPU (when a system is booted up with nohz_full),
sampling should work ok to determine irq and softirq time use, but
that only covers the housekeeping CPU itself, not the other
non-nohz_full CPUs.

On CPUs that are nohz_idle (the typical way a distro kernel is
booted), irq time is not accounted at all while the CPU is idle,
due to the lack of timer ticks.

Remove the VTIME_GEN vtime irq time code. The next patch will
allow NO_HZ_FULL kernels to use the IRQ_TIME_ACCOUNTING code.

Signed-off-by: Rik van Riel 
---
 include/linux/vtime.h  | 32 +
 kernel/sched/cputime.c | 55 --
 2 files changed, 45 insertions(+), 42 deletions(-)

diff --git a/include/linux/vtime.h b/include/linux/vtime.h
index fa2196990f84..3b384bf5ce1a 100644
--- a/include/linux/vtime.h
+++ b/include/linux/vtime.h
@@ -64,17 +64,6 @@ extern void vtime_account_system(struct task_struct *tsk);
 extern void vtime_account_idle(struct task_struct *tsk);
 extern void vtime_account_user(struct task_struct *tsk);
 
-#ifdef __ARCH_HAS_VTIME_ACCOUNT
-extern void vtime_account_irq_enter(struct task_struct *tsk);
-#else
-extern void vtime_common_account_irq_enter(struct task_struct *tsk);
-static inline void vtime_account_irq_enter(struct task_struct *tsk)
-{
-   if (vtime_accounting_cpu_enabled())
-   vtime_common_account_irq_enter(tsk);
-}
-#endif /* __ARCH_HAS_VTIME_ACCOUNT */
-
 #else /* !CONFIG_VIRT_CPU_ACCOUNTING */
 
 static inline void vtime_task_switch(struct task_struct *prev) { }
@@ -85,13 +74,8 @@ static inline void vtime_account_irq_enter(struct 
task_struct *tsk) { }
 
 #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
 extern void arch_vtime_task_switch(struct task_struct *tsk);
-extern void vtime_gen_account_irq_exit(struct task_struct *tsk);
-
-static inline void vtime_account_irq_exit(struct task_struct *tsk)
-{
-   if (vtime_accounting_cpu_enabled())
-   vtime_gen_account_irq_exit(tsk);
-}
+static inline void vtime_account_irq_enter(struct task_struct *tsk) { }
+static inline void vtime_account_irq_exit(struct task_struct *tsk) { }
 
 extern void vtime_user_enter(struct task_struct *tsk);
 
@@ -113,6 +97,18 @@ static inline void vtime_user_exit(struct task_struct *tsk) 
{ }
 static inline void vtime_guest_enter(struct task_struct *tsk) { }
 static inline void vtime_guest_exit(struct task_struct *tsk) { }
 static inline void vtime_init_idle(struct task_struct *tsk, int cpu) { }
+
+#ifdef __ARCH_HAS_VTIME_ACCOUNT
+extern void vtime_account_irq_enter(struct task_struct *tsk);
+#else
+extern void vtime_common_account_irq_enter(struct task_struct *tsk);
+static inline void vtime_account_irq_enter(struct task_struct *tsk)
+{
+   if (vtime_accounting_cpu_enabled())
+   vtime_common_account_irq_enter(tsk);
+}
+#endif /* __ARCH_HAS_VTIME_ACCOUNT */
+
 #endif
 
 #ifdef CONFIG_IRQ_TIME_ACCOUNTING
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index 4bd6d1b774ab..2f862dfdb520 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -103,10 +103,10 @@ static unsigned long irqtime_account_si_update(void)
u64 softirq;
 
local_irq_save(flags);
-   delta = this_cpu_read(cpu_softirq_time) - cpustat[CPUTIME_SOFTIRQ];
-   si_jiffies = cputime_to_jiffies(delta);
+   softirq = this_cpu_read(cpu_softirq_time) - cpustat[CPUTIME_SOFTIRQ];
+   si_jiffies = cputime_to_jiffies(softirq);
if (si_jiffies)
-   cpustat[CPUSTIME_SOFTIRQ] += jiffies_to_cputime(si_jiffies);
+   cpustat[CPUTIME_SOFTIRQ] += jiffies_to_cputime(si_jiffies);
local_irq_restore(flags);
return si_jiffies;
 }
@@ -115,6 +115,16 @@ static unsigned long irqtime_account_si_update(void)
 
 #define sched_clock_irqtime(0)
 
+static unsigned long irqtime_account_hi_update(void)
+{
+   return 0;
+}
+
+static unsigned long irqtime_account_si_update(void)
+{
+   return 0;
+}
+
 #endif /* !CONFIG_IRQ_TIME_ACCOUNTING */
 
 static inline void task_group_account_field(struct task_struct *p, int index,
@@ -346,7 +356,6 @@ static void irqtime_account_process_tick(struct task_struct 
*p, int user_tick,
 {
cputime_t scaled = cputime_to_scaled(cputime_one_jiffy);
u64 cputime = (__force u64) cputime_one_jiffy;
-   u64 *cpustat = kcpustat_this_cpu->cpustat;
unsigned long other;
 
/*
@@ -703,16 +712,26 @@ static cputime_t get_vtime_delta(struct task_struct *tsk)
return jiffies_to_cputime(delta);
 }
 
+/* Account per-cpu irq, softirq, and steal time. Not accounted to a task. */
+static cputime_t __vtime_account_other(void)
+{
+   unsigned long ticks;
+
+   ticks = steal_account_process_tick();
+   ticks += 

[PATCH 1/5] sched,time: count actually elapsed irq & softirq time

2016-06-07 Thread riel
From: Rik van Riel 

Currently, if there was any irq or softirq time during 'ticks'
jiffies, the entire period will be accounted as irq or softirq
time.

This is inaccurate if only a subset of 'ticks' jiffies was
actually spent handling irqs, and could conceivably mis-count
all of the ticks during a period as irq time, when there was
some irq and some softirq time.

Fix this by changing irqtime_account_hi_update and
irqtime_account_si_update to round elapsed irq and softirq
time to jiffies, and return the number of jiffies spent in
each mode, similar to how steal time is handled.

Additionally, have irqtime_account_process_tick take into
account how much time was spent in each of steal, irq,
and softirq time.

The latter could help improve the accuracy of timekeeping
when returning from idle on a NO_HZ_IDLE CPU.

Properly accounting how much time was spent in hardirq and
softirq time will also allow the NO_HZ_FULL code to re-use
these same functions for hardirq and softirq accounting.

Signed-off-by: Rik van Riel 
---
 kernel/sched/cputime.c | 54 +++---
 1 file changed, 34 insertions(+), 20 deletions(-)

diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index f51c98c740b5..4bd6d1b774ab 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -79,34 +79,36 @@ void irqtime_account_irq(struct task_struct *curr)
 }
 EXPORT_SYMBOL_GPL(irqtime_account_irq);
 
-static int irqtime_account_hi_update(void)
+static unsigned long irqtime_account_hi_update(void)
 {
u64 *cpustat = kcpustat_this_cpu->cpustat;
+   unsigned long irq_jiffies;
unsigned long flags;
-   u64 latest_ns;
-   int ret = 0;
+   u64 irq;
 
local_irq_save(flags);
-   latest_ns = this_cpu_read(cpu_hardirq_time);
-   if (nsecs_to_cputime64(latest_ns) > cpustat[CPUTIME_IRQ])
-   ret = 1;
+   irq = this_cpu_read(cpu_hardirq_time) - cpustat[CPUTIME_IRQ];
+   irq_jiffies = cputime_to_jiffies(irq);
+   if (irq_jiffies)
+   cpustat[CPUTIME_IRQ] += jiffies_to_cputime(irq_jiffies);
local_irq_restore(flags);
-   return ret;
+   return irq_jiffies;
 }
 
-static int irqtime_account_si_update(void)
+static unsigned long irqtime_account_si_update(void)
 {
u64 *cpustat = kcpustat_this_cpu->cpustat;
+   unsigned long si_jiffies;
unsigned long flags;
-   u64 latest_ns;
-   int ret = 0;
+   u64 softirq;
 
local_irq_save(flags);
-   latest_ns = this_cpu_read(cpu_softirq_time);
-   if (nsecs_to_cputime64(latest_ns) > cpustat[CPUTIME_SOFTIRQ])
-   ret = 1;
+   delta = this_cpu_read(cpu_softirq_time) - cpustat[CPUTIME_SOFTIRQ];
+   si_jiffies = cputime_to_jiffies(delta);
+   if (si_jiffies)
+   cpustat[CPUSTIME_SOFTIRQ] += jiffies_to_cputime(si_jiffies);
local_irq_restore(flags);
-   return ret;
+   return si_jiffies;
 }
 
 #else /* CONFIG_IRQ_TIME_ACCOUNTING */
@@ -345,18 +347,30 @@ static void irqtime_account_process_tick(struct 
task_struct *p, int user_tick,
cputime_t scaled = cputime_to_scaled(cputime_one_jiffy);
u64 cputime = (__force u64) cputime_one_jiffy;
u64 *cpustat = kcpustat_this_cpu->cpustat;
+   unsigned long other;
 
-   if (steal_account_process_tick())
+   /*
+* Subtract steal, irq & softirq time (if any) from ticks.
+* These are counted in nanoseconds and not aligned with jiffies.
+* Multiple of these could "break a jiffy" simultaneously due to
+* rounding; be careful to not account too much of this time at once.
+*/
+   other = steal_account_process_tick();
+   if (other >= ticks)
+   return;
+
+   other += irqtime_account_hi_update();
+   if (other >= ticks)
+   return;
+
+   other += irqtime_account_si_update();
+   if (other >= ticks)
return;
 
cputime *= ticks;
scaled *= ticks;
 
-   if (irqtime_account_hi_update()) {
-   cpustat[CPUTIME_IRQ] += cputime;
-   } else if (irqtime_account_si_update()) {
-   cpustat[CPUTIME_SOFTIRQ] += cputime;
-   } else if (this_cpu_ksoftirqd() == p) {
+   if (this_cpu_ksoftirqd() == p) {
/*
 * ksoftirqd time do not get accounted in cpu_softirq_time.
 * So, we have to handle it separately here.
-- 
2.5.5



[PATCH 1/3] ARM: dts: imx7d: create i.MX 7Solo base device tree

2016-06-07 Thread Stefan Agner
The i.MX 7 series currently consists of two SoCs: i.MX 7Solo and
7Dual. The i.MX 7Solo implements a subset of features available on
i.MX 7Dual, hence create imx7s.dtsi as the base device tree. The
i.MX 7Dual's additional features over i.MX 7Solo are:
- Second Cortex-A7 core
- Second Gigabit Ethernet controller
- EPD (Electronc Paper Display, not yet part of the device tree)
- PCIe (not yet part of the device tree)
- Additional USB2.0 OTG controller

Signed-off-by: Stefan Agner 
---
 arch/arm/boot/dts/imx7d.dtsi | 923 +++
 arch/arm/boot/dts/imx7s.dtsi | 880 +
 2 files changed, 928 insertions(+), 875 deletions(-)
 create mode 100644 arch/arm/boot/dts/imx7s.dtsi

diff --git a/arch/arm/boot/dts/imx7d.dtsi b/arch/arm/boot/dts/imx7d.dtsi
index 6b3faa2..51c13cb 100644
--- a/arch/arm/boot/dts/imx7d.dtsi
+++ b/arch/arm/boot/dts/imx7d.dtsi
@@ -1,5 +1,6 @@
 /*
  * Copyright 2015 Freescale Semiconductor, Inc.
+ * Copyright 2016 Toradex AG
  *
  * This file is dual-licensed: you can use it either under the terms
  * of the GPL or the X11 license, at your option. Note that this dual
@@ -40,54 +41,10 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#include 
-#include 
-#include 
-#include "imx7d-pinfunc.h"
-#include "skeleton.dtsi"
+#include "imx7s.dtsi"
 
 / {
-   aliases {
-   gpio0 = 
-   gpio1 = 
-   gpio2 = 
-   gpio3 = 
-   gpio4 = 
-   gpio5 = 
-   gpio6 = 
-   i2c0 = 
-   i2c1 = 
-   i2c2 = 
-   i2c3 = 
-   mmc0 = 
-   mmc1 = 
-   mmc2 = 
-   serial0 = 
-   serial1 = 
-   serial2 = 
-   serial3 = 
-   serial4 = 
-   serial5 = 
-   serial6 = 
-   };
-
cpus {
-   #address-cells = <1>;
-   #size-cells = <0>;
-
-   cpu0: cpu@0 {
-   compatible = "arm,cortex-a7";
-   device_type = "cpu";
-   reg = <0>;
-   operating-points = <
-   /* KHz  uV */
-   996000  1075000
-   792000  975000
-   >;
-   clock-latency = <61036>; /* two CLK32 periods */
-   clocks = < IMX7D_CLK_ARM>;
-   };
-
cpu1: cpu@1 {
compatible = "arm,cortex-a7";
device_type = "cpu";
@@ -95,221 +52,6 @@
};
};
 
-   intc: interrupt-controller@31001000 {
-   compatible = "arm,cortex-a7-gic";
-   #interrupt-cells = <3>;
-   interrupt-controller;
-   reg = <0x31001000 0x1000>,
- <0x31002000 0x1000>,
- <0x31004000 0x2000>,
- <0x31006000 0x2000>;
-   };
-
-   ckil: clock-cki {
-   compatible = "fixed-clock";
-   #clock-cells = <0>;
-   clock-frequency = <32768>;
-   clock-output-names = "ckil";
-   };
-
-   osc: clock-osc {
-   compatible = "fixed-clock";
-   #clock-cells = <0>;
-   clock-frequency = <2400>;
-   clock-output-names = "osc";
-   };
-
-   timer {
-   compatible = "arm,armv7-timer";
-   interrupts = ,
-,
-,
-;
-   interrupt-parent = <>;
-   };
-
-   etr@30086000 {
-   compatible = "arm,coresight-tmc", "arm,primecell";
-   reg = <0x30086000 0x1000>;
-   clocks = < IMX7D_MAIN_AXI_ROOT_CLK>;
-   clock-names = "apb_pclk";
-
-   port {
-   etr_in_port: endpoint {
-   slave-mode;
-   remote-endpoint = <_out_port1>;
-   };
-   };
-   };
-
-   tpiu@30087000 {
-   compatible = "arm,coresight-tpiu", "arm,primecell";
-   reg = <0x30087000 0x1000>;
-   clocks = < IMX7D_MAIN_AXI_ROOT_CLK>;
-   clock-names = "apb_pclk";
-
-   port {
-   tpiu_in_port: endpoint {
-   slave-mode;
-   remote-endpoint = <_out_port1>;
-   };
-   };
-   };
-
-   replicator {
-   /*
-* non-configurable replicators don't show up on the
-* AMBA bus.  As such no need to add "arm,primecell"
-*/
-   compatible = "arm,coresight-replicator";
-
-   ports {
-   #address-cells = 

[PATCH 3/3] ARM: dts: imx7: add Toradex Colibri iMX7S/iMX7D support

2016-06-07 Thread Stefan Agner
Add support for the Computer on Module Colibri iMX7S/iMX7D along
with the development/evaluation carrier board device trees. Follow
the usual hierarchic include model, maintaining shared configuration
in imx7-colibri.dtsi and imx7-colibri-eval-v3.dtsi respectively.

Signed-off-by: Stefan Agner 
---
 arch/arm/boot/dts/Makefile  |   4 +-
 arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi | 149 
 arch/arm/boot/dts/imx7-colibri.dtsi | 568 
 arch/arm/boot/dts/imx7d-colibri-eval-v3.dts |  66 
 arch/arm/boot/dts/imx7d-colibri.dtsi|  54 +++
 arch/arm/boot/dts/imx7s-colibri-eval-v3.dts |  51 +++
 arch/arm/boot/dts/imx7s-colibri.dtsi|  50 +++
 7 files changed, 941 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
 create mode 100644 arch/arm/boot/dts/imx7-colibri.dtsi
 create mode 100644 arch/arm/boot/dts/imx7d-colibri-eval-v3.dts
 create mode 100644 arch/arm/boot/dts/imx7d-colibri.dtsi
 create mode 100644 arch/arm/boot/dts/imx7s-colibri-eval-v3.dts
 create mode 100644 arch/arm/boot/dts/imx7s-colibri.dtsi

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 06b6c2d..3bb6c14 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -399,9 +399,11 @@ dtb-$(CONFIG_SOC_IMX6UL) += \
imx6ul-tx6ul-mainboard.dtb
 dtb-$(CONFIG_SOC_IMX7D) += \
imx7d-cl-som-imx7.dtb \
+   imx7d-colibri-eval-v3.dtb \
imx7d-nitrogen7.dtb \
imx7d-sbc-imx7.dtb \
-   imx7d-sdb.dtb
+   imx7d-sdb.dtb \
+   imx7s-colibri-eval-v3.dtb
 dtb-$(CONFIG_SOC_LS1021A) += \
ls1021a-qds.dtb \
ls1021a-twr.dtb
diff --git a/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi 
b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
new file mode 100644
index 000..29744c3
--- /dev/null
+++ b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2016 Toradex AG
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file 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.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/ {
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+};
+
+ {
+   brightness-levels = <0 4 8 16 32 64 128 255>;
+   default-brightness-level = <6>;
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+
+   /* M41T0M6 real time clock on carrier board */
+   rtc: m41t0m6@68 {
+   compatible = "st,m41t00";
+   reg = <0x68>;
+   };
+};
+
+ {
+   status = "okay";
+   display = <>;
+
+   display0: lcd-display {
+   bits-per-pixel = <16>;
+   bus-width = <18>;
+
+   display-timings {
+   native-mode = <_vga>;
+
+   /* Standard VGA timing */
+   timing_vga: 640x480 {
+   clock-frequency = <25175000>;
+   hactive = <640>;
+   vactive = <480>;
+  

[PATCH 2/3] ARM: dts: imx7d: move input header into base device tree

2016-06-07 Thread Stefan Agner
The base device tree uses KEY_POWER in the snvs-powerkey node,
hence include the input.h header file in the base device tree.

Signed-off-by: Stefan Agner 
---
 arch/arm/boot/dts/imx7d-cl-som-imx7.dts | 1 -
 arch/arm/boot/dts/imx7d-nitrogen7.dts   | 1 -
 arch/arm/boot/dts/imx7d-sdb.dts | 1 -
 arch/arm/boot/dts/imx7s.dtsi| 1 +
 4 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/imx7d-cl-som-imx7.dts 
b/arch/arm/boot/dts/imx7d-cl-som-imx7.dts
index 4863451..58b09bf 100644
--- a/arch/arm/boot/dts/imx7d-cl-som-imx7.dts
+++ b/arch/arm/boot/dts/imx7d-cl-som-imx7.dts
@@ -12,7 +12,6 @@
 
 /dts-v1/;
 
-#include 
 #include "imx7d.dtsi"
 
 / {
diff --git a/arch/arm/boot/dts/imx7d-nitrogen7.dts 
b/arch/arm/boot/dts/imx7d-nitrogen7.dts
index 1ce9780..230a00b 100644
--- a/arch/arm/boot/dts/imx7d-nitrogen7.dts
+++ b/arch/arm/boot/dts/imx7d-nitrogen7.dts
@@ -42,7 +42,6 @@
 
 /dts-v1/;
 
-#include 
 #include "imx7d.dtsi"
 
 / {
diff --git a/arch/arm/boot/dts/imx7d-sdb.dts b/arch/arm/boot/dts/imx7d-sdb.dts
index b267f79..a5022b3 100644
--- a/arch/arm/boot/dts/imx7d-sdb.dts
+++ b/arch/arm/boot/dts/imx7d-sdb.dts
@@ -42,7 +42,6 @@
 
 /dts-v1/;
 
-#include 
 #include "imx7d.dtsi"
 
 / {
diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
index a5fd2d7..5a99e00 100644
--- a/arch/arm/boot/dts/imx7s.dtsi
+++ b/arch/arm/boot/dts/imx7s.dtsi
@@ -43,6 +43,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include "imx7d-pinfunc.h"
 #include "skeleton.dtsi"
-- 
2.8.3



[PATCH 0/3] ARM: dts: imx7d: add i.MX 7Solo and Colibri iMX7S/D dts

2016-06-07 Thread Stefan Agner
The two SoC's i.MX 7Solo and i.MX 7Dual are very similar, but there
are some differences worth dividing the current i.MX 7Dual base device
tree. This patchset adds new base device tree imx7s.dtsi which is meant
to be used for i.MX 7Solo boards. Note that the SoC _family_ is called
imx7d/IMX7D throughout the kernel.

The third patch uses the new PMIC device tree binding (merge pending):
http://thread.gmane.org/gmane.linux.kernel/2238118

Stefan Agner (3):
  ARM: dts: imx7d: create i.MX 7Solo base device tree
  ARM: dts: imx7d: move input header into base device tree
  ARM: dts: imx7: add Toradex Colibri iMX7S/iMX7D support

 arch/arm/boot/dts/Makefile  |   4 +-
 arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi | 149 +
 arch/arm/boot/dts/imx7-colibri.dtsi | 568 +
 arch/arm/boot/dts/imx7d-cl-som-imx7.dts |   1 -
 arch/arm/boot/dts/imx7d-colibri-eval-v3.dts |  66 ++
 arch/arm/boot/dts/imx7d-colibri.dtsi|  54 ++
 arch/arm/boot/dts/imx7d-nitrogen7.dts   |   1 -
 arch/arm/boot/dts/imx7d-sdb.dts |   1 -
 arch/arm/boot/dts/imx7d.dtsi| 923 ++--
 arch/arm/boot/dts/imx7s-colibri-eval-v3.dts |  51 ++
 arch/arm/boot/dts/imx7s-colibri.dtsi|  50 ++
 arch/arm/boot/dts/imx7s.dtsi| 881 ++
 12 files changed, 1870 insertions(+), 879 deletions(-)
 create mode 100644 arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
 create mode 100644 arch/arm/boot/dts/imx7-colibri.dtsi
 create mode 100644 arch/arm/boot/dts/imx7d-colibri-eval-v3.dts
 create mode 100644 arch/arm/boot/dts/imx7d-colibri.dtsi
 create mode 100644 arch/arm/boot/dts/imx7s-colibri-eval-v3.dts
 create mode 100644 arch/arm/boot/dts/imx7s-colibri.dtsi
 create mode 100644 arch/arm/boot/dts/imx7s.dtsi

-- 
2.8.3



Re: [PATCH v4 11/14] arm64/numa: support HAVE_MEMORYLESS_NODES

2016-06-07 Thread Leizhen (ThunderTown)


On 2016/6/7 22:01, Ganapatrao Kulkarni wrote:
> On Tue, Jun 7, 2016 at 6:27 PM, Leizhen (ThunderTown)
>  wrote:
>>
>>
>> On 2016/6/7 16:31, Ganapatrao Kulkarni wrote:
>>> On Tue, Jun 7, 2016 at 1:38 PM, Zhen Lei  wrote:
 Some numa nodes may have no memory. For example:
 1. cpu0 on node0
 2. cpu1 on node1
 3. device0 access the momory from node0 and node1 take the same time.
>>>
>>> i am wondering, if access to both nodes is same, then why you need numa.
>>> the example you are quoting is against the basic principle of "numa"
>>> what is device0 here? cpu?
>> The device0 can also be a cpu. I drew a simple diagram:
>>
>>   cpu0 cpu1cpu2/device0
>> ||  |
>> ||  |
>>DDR0 DDR1No DIMM slots or no DIMM plugged
>>  (node0)  (node1) (node2)
>>
> 
> thanks for the clarification. your example is for 3 node system, where
> third node is memory less node.
> do you see any issue in supporting this topology with existing code?
If opened HAVE_MEMORYLESS_NODES, it will pick the nearest node for the cpus on
memoryless node.

For example, in include/linux/topology.h
#ifdef CONFIG_HAVE_MEMORYLESS_NODES
...
static inline int cpu_to_mem(int cpu)
{
return per_cpu(_numa_mem_, cpu);
}
...
#else
...
static inline int cpu_to_mem(int cpu)
{
return cpu_to_node(cpu);
}
...
#endif

> I think, this use case should be supported with present code.
> 

 So, we can not simply classify device0 to node0 or node1, but we can
 define a node2 which distances to node0 and node1 are the same.

 Signed-off-by: Zhen Lei 
 ---
  arch/arm64/Kconfig  |  4 
  arch/arm64/kernel/smp.c |  1 +
  arch/arm64/mm/numa.c| 43 +--
  3 files changed, 46 insertions(+), 2 deletions(-)

 diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
 index 05c1bf1..5904a62 100644
 --- a/arch/arm64/Kconfig
 +++ b/arch/arm64/Kconfig
 @@ -581,6 +581,10 @@ config NEED_PER_CPU_EMBED_FIRST_CHUNK
 def_bool y
 depends on NUMA

 +config HAVE_MEMORYLESS_NODES
 +   def_bool y
 +   depends on NUMA
 +
  source kernel/Kconfig.preempt
  source kernel/Kconfig.hz

 diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
 index d099306..9e15297 100644
 --- a/arch/arm64/kernel/smp.c
 +++ b/arch/arm64/kernel/smp.c
 @@ -620,6 +620,7 @@ static void __init of_parse_and_init_cpus(void)
 }

 bootcpu_valid = true;
 +   early_map_cpu_to_node(0, of_node_to_nid(dn));

 /*
  * cpu_logical_map has already been
 diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c
 index df5c842..d73b0a0 100644
 --- a/arch/arm64/mm/numa.c
 +++ b/arch/arm64/mm/numa.c
 @@ -128,6 +128,14 @@ void __init early_map_cpu_to_node(unsigned int cpu, 
 int nid)
 nid = 0;

 cpu_to_node_map[cpu] = nid;
 +
 +   /*
 +* We should set the numa node of cpu0 as soon as possible, 
 because it
 +* has already been set up online before. cpu_to_node(0) will soon 
 be
 +* called.
 +*/
 +   if (!cpu)
 +   set_cpu_numa_node(cpu, nid);
  }

  #ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA
 @@ -215,6 +223,35 @@ int __init numa_add_memblk(int nid, u64 start, u64 
 end)
 return ret;
  }

 +static u64 __init alloc_node_data_from_nearest_node(int nid, const size_t 
 size)
 +{
 +   int i, best_nid, distance;
 +   u64 pa;
 +   DECLARE_BITMAP(nodes_map, MAX_NUMNODES);
 +
 +   bitmap_zero(nodes_map, MAX_NUMNODES);
 +   bitmap_set(nodes_map, nid, 1);
 +
 +find_nearest_node:
 +   best_nid = NUMA_NO_NODE;
 +   distance = INT_MAX;
 +
 +   for_each_clear_bit(i, nodes_map, MAX_NUMNODES)
 +   if (numa_distance[nid][i] < distance) {
 +   best_nid = i;
 +   distance = numa_distance[nid][i];
 +   }
 +
 +   pa = memblock_alloc_nid(size, SMP_CACHE_BYTES, best_nid);
 +   if (!pa) {
 +   BUG_ON(best_nid == NUMA_NO_NODE);
 +   bitmap_set(nodes_map, best_nid, 1);
 +   goto find_nearest_node;
 +   }
 +
 +   return pa;
 +}
 +
> 
> why do we need this function in arch specific code.
I also considered put these code(include HAVE_SETUP_PER_CPU_AREA) into 
drivers/of/of_numa.c,
but if I do that, it will make acpi numa dependent on of numa.

> dont you think common code will take care of this? when 

Re: Files leak from nfsd in 4.7.1-rc1 (and more?)

2016-06-07 Thread Oleg Drokin

On Jun 7, 2016, at 8:03 PM, Jeff Layton wrote:

>>> That said, this code is quite subtle. I'd need to look over it in more
>>> detail before I offer up any fixes. I'd also appreciate it if anyone
>>> else wants to sanity check my analysis there.
>>> 
> Yeah, I think you're right. It's fine since r/w opens have a distinct
> slot, even though the refcounting just tracks the number of read and
> write references. So yeah, the leak probably is in an error path
> someplace, or maybe a race someplace.

So I noticed that set_access is always called locked, but clear_access is not,
this does not sound right.

So I placed this strategic WARN_ON:
@@ -3991,6 +4030,7 @@ static __be32 nfs4_get_vfs_file(struct svc_rqst *rqstp, 
struct nfs4_file *fp,
goto out_put_access;
spin_lock(>fi_lock);
if (!fp->fi_fds[oflag]) {
+WARN_ON(!test_access(open->op_share_access, stp));
fp->fi_fds[oflag] = filp;
filp = NULL;
   
This is right in the place where nfsd set the access flag already, discovered
that the file is not opened and went on to open it, yet some parallel thread
came in and cleared the flag by the time we got the file opened.
It did trigger (but there are 30 minutes left till test finish, so I don't
know yet if this will correspond to the problem at hand yet, so below is 
speculation).

Now, at the exit from this function, the state will not have access for this 
file
set and the file would be leaked, since the matching call, probably in
release_all_access() does:
if (test_access(i, stp))
nfs4_file_put_access(stp->st_stid.sc_file, i);
clear_access(i, stp);

Meaning that the refcount is not dropped due to no access flag set.

I imagine we can just set the flag back right after setting fp->fi_fds[oflag]
and that particular race would be gone?

Would that be ok, or is it just wrong that somebody can come and drop
(delegation downgrade seems to be the most likely suspect) access bits like this
while they are in the middle of being acquired?



RE: [PATCH v3 04/30] staging: unisys: visorbus: remove unused module parameters

2016-06-07 Thread Binder, David Anthony
> -Original Message-
> From: Neil Horman [mailto:nhor...@redhat.com]
> Sent: Tuesday, June 07, 2016 9:23 AM
> To: Kershner, David A 
> Cc: cor...@lwn.net; t...@linutronix.de; mi...@redhat.com;
> h...@zytor.com; gre...@linuxfoundation.org; Arfvidson, Erik
> ; Sell, Timothy C ;
> hof...@osadl.org; dzic...@redhat.com; jes.soren...@redhat.com; Curtin,
> Alexander Paul ;
> janani.rvchn...@gmail.com; sudipm.mukher...@gmail.com;
> pra...@redhat.com; Binder, David Anthony ;
> dan.j.willi...@intel.com; linux-kernel@vger.kernel.org; linux-
> d...@vger.kernel.org; driverdev-de...@linuxdriverproject.org; *S-Par-
> Maintainer 
> Subject: Re: [PATCH v3 04/30] staging: unisys: visorbus: remove unused
> module parameters
> 
> On Sat, Jun 04, 2016 at 01:27:04PM -0400, David Kershner wrote:
> > From: David Binder 
> >
> > Removes unused module parameters from visorbus_main.c, in response to
> > findings by SonarQube.
> >
> > Signed-off-by: David Binder 
> > Signed-off-by: David Kershner 
> > Reviewed-by: Tim Sell 
> > ---
> >  drivers/staging/unisys/visorbus/visorbus_main.c | 9 +
> >  1 file changed, 1 insertion(+), 8 deletions(-)
> >
> > diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c
> b/drivers/staging/unisys/visorbus/visorbus_main.c
> > index 2ed9628..71bff07 100644
> > --- a/drivers/staging/unisys/visorbus/visorbus_main.c
> > +++ b/drivers/staging/unisys/visorbus/visorbus_main.c
> > @@ -27,10 +27,9 @@
> >  #define MYDRVNAME "visorbus"
> >
> >  /* module parameters */
> > -static int visorbus_debug;
> >  static int visorbus_forcematch;
> >  static int visorbus_forcenomatch;
> > -static int visorbus_debugref;
> > +
> >  #define SERIALLOOPBACKCHANADDR (100 * 1024 * 1024)
> >
> >  /* Display string that is guaranteed to be no longer the 99 characters*/
> > @@ -1332,9 +1331,6 @@ visorbus_exit(void)
> > remove_bus_type();
> >  }
> >
> > -module_param_named(debug, visorbus_debug, int, S_IRUGO);
> > -MODULE_PARM_DESC(visorbus_debug, "1 to debug");
> > -
> >  module_param_named(forcematch, visorbus_forcematch, int, S_IRUGO);
> >  MODULE_PARM_DESC(visorbus_forcematch,
> >  "1 to force a successful dev <--> drv match");
> > @@ -1342,6 +1338,3 @@ MODULE_PARM_DESC(visorbus_forcematch,
> >  module_param_named(forcenomatch, visorbus_forcenomatch, int,
> S_IRUGO);
> >  MODULE_PARM_DESC(visorbus_forcenomatch,
> >  "1 to force an UNsuccessful dev <--> drv match");
> > -
> > -module_param_named(debugref, visorbus_debugref, int, S_IRUGO);
> > -MODULE_PARM_DESC(visorbus_debugref, "1 to debug reference
> counting");
> 
> visorbus_forcematch and visorbus_forcenomatch appear to be referenced in
> visorbus_match (at least in the HEAD of linus' tree).  If you're going to
> remove
> the module parameters, why not also remove those references and the
> force[no]match variables themselves?
> 
> Neil

We presently use visorbus_forcematch and visorbus_forcenomatch for
debugging purposes, and therefore decided to keep the variables in
the driver.

David Binder


Re: [RFC PATCH] sys_read: add a compat_sys_read for 64bit system

2016-06-07 Thread Zhangjian (Bamvor)

Hi,

On 2016/6/8 9:33, Weidong Wang wrote:

Test 32 progress and 64 progress on the 64bit system with
this progress:

int main(int argc, char **argv)
{
 int fd = 0;
 int i, ret = 0;
 char buf[512];
 unsigned long count = -1;

 fd = open("/tmp", O_RDONLY);
 if (fd < -1) {
 printf("Pls check the directory is exist?\n");
 return -1;
 }
 errno = 0;
 ret = read(fd, NULL, count);
 printf("Ret is %d errno %d\n", ret, errno);
 close(fd);

 return 0;
}

we get the different errno. The 64 progress we get errno is -14 while
the 32 progress is -21.

The reason is that, the user progress would use a 32bit count, while
the sys_read size_t in kernel is 64bit.  When the uesrspace count is
-1(0x), it goes to the sys_read, it would be change to a positive
number.

So I think we should add a compat_sys_read for the read syscall. I test it
on x86 or arm64 platform. The patch works well.

As weidong said, we tested on x86, x86_64, aarch64 ilp32, aarch64 lp64.
We do not familiar with other architecture, cc linux-api, hope could get more
input.

Regards

Bamvor


As well this patch may do work for the 'tile' 64 system.
I think it may enter the same result on mips/parisc/powerpc/sparc.
The s390 do the compat_sys_s390_read for the compat sys_read.

Signed-off-by: Weidong Wang 
---
  arch/x86/entry/syscalls/syscall_32.tbl | 2 +-
  fs/read_write.c| 8 
  include/linux/compat.h | 2 ++
  include/uapi/asm-generic/unistd.h  | 2 +-
  4 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/x86/entry/syscalls/syscall_32.tbl 
b/arch/x86/entry/syscalls/syscall_32.tbl
index 4cddd17..ebc24e3 100644
--- a/arch/x86/entry/syscalls/syscall_32.tbl
+++ b/arch/x86/entry/syscalls/syscall_32.tbl
@@ -9,7 +9,7 @@
  0 i386restart_syscall sys_restart_syscall
  1 i386exitsys_exit
  2 i386forksys_forksys_fork
-3  i386readsys_read
+3  i386readsys_read
compat_sys_read
  4 i386write   sys_write
  5 i386opensys_open
compat_sys_open
  6 i386close   sys_close
diff --git a/fs/read_write.c b/fs/read_write.c
index 933b53a..d244848 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -613,6 +613,14 @@ SYSCALL_DEFINE3(write, unsigned int, fd, const char __user 
*, buf,
return ret;
  }

+#ifdef CONFIG_COMPAT
+COMPAT_SYSCALL_DEFINE3(read, unsigned int, fd, char __user *, buf,
+   compat_size_t, count)
+{
+return sys_read(fd, buf, (compat_ssize_t)count);
+}
+#endif
+
  SYSCALL_DEFINE4(pread64, unsigned int, fd, char __user *, buf,
size_t, count, loff_t, pos)
  {
diff --git a/include/linux/compat.h b/include/linux/compat.h
index f964ef7..d88ccad 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -332,6 +332,8 @@ asmlinkage long compat_sys_keyctl(u32 option,
  u32 arg2, u32 arg3, u32 arg4, u32 arg5);
  asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user 
*u32);

+asmlinkage ssize_t compat_sys_read(unsigned int fd,
+   char __user * buf, compat_size_t count);
  asmlinkage ssize_t compat_sys_readv(compat_ulong_t fd,
const struct compat_iovec __user *vec, compat_ulong_t vlen);
  asmlinkage ssize_t compat_sys_writev(compat_ulong_t fd,
diff --git a/include/uapi/asm-generic/unistd.h 
b/include/uapi/asm-generic/unistd.h
index a26415b..745818a 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -201,7 +201,7 @@ __SC_COMP(__NR_getdents64, sys_getdents64, 
compat_sys_getdents64)
  #define __NR3264_lseek 62
  __SC_3264(__NR3264_lseek, sys_llseek, sys_lseek)
  #define __NR_read 63
-__SYSCALL(__NR_read, sys_read)
+__SC_COMP(__NR_read, sys_read, compat_sys_read)
  #define __NR_write 64
  __SYSCALL(__NR_write, sys_write)
  #define __NR_readv 65





Re: [PATCH V8 9/9] pci, acpi: ARM64 support for ACPI based generic PCI host controller

2016-06-07 Thread Bjorn Helgaas
On Mon, May 30, 2016 at 05:14:22PM +0200, Tomasz Nowicki wrote:
> This patch implements pci_acpi_scan_root call so that ARM64 can start
> using ACPI to setup and enumerate PCI buses.
> 
> The implementation of pci_acpi_scan_root() looks up config space regions
> through MCFG interface. Then ECAM library is doing a new mapping
> and attach generic ECAM ops which are used for accessing config space.
> 
> On ARM64, ACPI and DT can be enabled together, and in that case
> we need to use generic domains. In order to do that we implement
> ARM64 specific way of retrieving domain number from pci_config_window
> structure.
> 
> Since we enable PCI for ACPI we need to implement raw_pci_{read|write}
> at the same time. ARM64 provides RAW accessors as long as there is
> correlated valid pci_bus structure, but not before.

I think this is important and needs to be spelled out a little more
explicitly using the terms from the ACPI spec so it will make sense to
people like BIOS writers who might be bitten by this.

"raw_pci_read()" is a Linux term that won't mean anything to them.
But they might expect that AML can access PCI config space before the
Linux driver claims the host bridge, and I think you're saying that
will not work.

> Signed-off-by: Tomasz Nowicki 
> Signed-off-by: Jayachandran C 
> ---
>  arch/arm64/Kconfig  |   2 +
>  arch/arm64/kernel/pci.c | 120 
> ++--
>  include/linux/pci.h |   5 ++
>  3 files changed, 122 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 76747d9..87c48ad 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -3,6 +3,7 @@ config ARM64
>   select ACPI_CCA_REQUIRED if ACPI
>   select ACPI_GENERIC_GSI if ACPI
>   select ACPI_REDUCED_HARDWARE_ONLY if ACPI
> + select ACPI_MCFG if ACPI
>   select ARCH_HAS_DEVMEM_IS_ALLOWED
>   select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
>   select ARCH_HAS_ELF_RANDOMIZE
> @@ -96,6 +97,7 @@ config ARM64
>   select OF_EARLY_FLATTREE
>   select OF_NUMA if NUMA && OF
>   select OF_RESERVED_MEM
> + select PCI_ECAM if ACPI
>   select PERF_USE_VMALLOC
>   select POWER_RESET
>   select POWER_SUPPLY
> diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
> index 3663be1..39f2a40 100644
> --- a/arch/arm64/kernel/pci.c
> +++ b/arch/arm64/kernel/pci.c
> @@ -17,7 +17,9 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
> +#include 
>  #include 
>  
>  /*
> @@ -71,13 +73,21 @@ int pcibios_alloc_irq(struct pci_dev *dev)
>  int raw_pci_read(unsigned int domain, unsigned int bus,
> unsigned int devfn, int reg, int len, u32 *val)
>  {
> - return -ENXIO;
> + struct pci_bus *b = pci_find_bus(domain, bus);
> +
> + if (!b)
> + return PCIBIOS_DEVICE_NOT_FOUND;
> + return b->ops->read(b, devfn, reg, len, val);
>  }
>  
>  int raw_pci_write(unsigned int domain, unsigned int bus,
>   unsigned int devfn, int reg, int len, u32 val)
>  {
> - return -ENXIO;
> + struct pci_bus *b = pci_find_bus(domain, bus);
> +
> + if (!b)
> + return PCIBIOS_DEVICE_NOT_FOUND;
> + return b->ops->write(b, devfn, reg, len, val);
>  }

I think these functions could be under #ifdef ACPI, couldn't they?
I see x86 and ia64 don't do that, and they do call them from non-ACPI
places.  So maybe there'd be no point in doing it differently here.

You could split this out into a separate patch, though, which would be
a nice way to highlight the issue of AML access before pci_root.c
claims the bridge.

>  #ifdef CONFIG_NUMA
> @@ -91,11 +101,111 @@ EXPORT_SYMBOL(pcibus_to_node);
>  #endif
>  
>  #ifdef CONFIG_ACPI
> -/* Root bridge scanning */
> +
> +struct acpi_pci_generic_root_info {
> + struct acpi_pci_root_info   common;
> + struct pci_config_window*cfg;   /* config space mapping */
> +};
> +
> +int acpi_pci_bus_domain_nr(struct pci_bus *bus)
> +{
> + struct pci_config_window *cfg = bus->sysdata;
> + struct acpi_device *adev = to_acpi_device(cfg->parent);
> + struct acpi_pci_root *root = acpi_driver_data(adev);
> +
> + return root->segment;
> +}
> +
> +int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
> +{
> + if (!acpi_disabled) {
> + struct pci_config_window *cfg = bridge->bus->sysdata;
> + struct acpi_device *adev = to_acpi_device(cfg->parent);
> + ACPI_COMPANION_SET(>dev, adev);
> + }
> +
> + return 0;
> +}
> +
> +/*
> + * Lookup the bus range for the domain in MCFG, and set up config space
> + * mapping.
> + */
> +static int pci_acpi_setup_ecam_mapping(struct acpi_pci_root *root,
> +struct acpi_pci_generic_root_info *ri)

Maybe return the "struct pci_config_window *" and do the assignment in
the caller?  Then I don't think you'd have to pass in "ri".

> +{
> + 

Re: [PATCH v4 2/5] sched/fair: Fix attaching task sched avgs twice when switching to fair or changing task group

2016-06-07 Thread Yuyang Du
On Tue, Jun 07, 2016 at 10:09:14AM +0200, Vincent Guittot wrote:
> >> A much more simple solution would be
> >> to prevent last_update_time to be initialized with this special value.
> >> We can initialize the last_update_time of a sched_entity to 1 as an
> >> example which is easier than these changes.
> >
> > Then at least, we must differentiate CONFIG_FAIR_GROUP_SCHED and
> > !CONFIG_FAIR_GROUP_SCHED. And I am not sure whether this is a simpler
> 
> Why do you want to differentiate ? we already have
> sa->last_update_time = 0; in init_entity_runnable_average. We just
> have to change it by sa->last_update_time = 1;

If !CONFIG_FAIR_GROUP_SCHED, we don't have task_move_group_fair().
If last_update_time != 0, we won't attach it for new task. Correct?


[git pull] vfs fixes

2016-06-07 Thread Al Viro
Fixes for crap of assorted ages: EOPENSTALE one is 4.2+, autofs
one is 4.6, d_walk - 3.2+, atomic_open() and coredump ones are this window
regressions.

The following changes since commit 1a695a905c18548062509178b98bc91e67510864:

  Linux 4.7-rc1 (2016-05-29 09:29:24 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git for-linus

for you to fetch changes up to 1607f09c226d1378439c411b020042750338:

  coredump: fix dumping through pipes (2016-06-07 22:07:09 -0400)


Al Viro (4):
  fix EOPENSTALE bug in do_last()
  autofs braino fix for do_last()
  fix d_walk()/non-delayed __d_free() race
  fix a regression in atomic_open()

Mateusz Guzik (1):
  coredump: fix dumping through pipes

 arch/powerpc/platforms/cell/spufs/coredump.c |  2 +-
 fs/binfmt_elf.c  |  2 +-
 fs/binfmt_elf_fdpic.c|  2 +-
 fs/coredump.c|  4 +-
 fs/dcache.c  |  4 +-
 fs/namei.c   | 61 +++-
 include/linux/binfmts.h  |  1 +
 7 files changed, 24 insertions(+), 52 deletions(-)


Re: [alsa-devel] [PATCH v2 2/9] ASoC: mediatek: implement mediatek common structure

2016-06-07 Thread Garlic Tseng
Hi Mark, thank for comment.

On Tue, 2016-06-07 at 16:54 +0100, Mark Brown wrote:
> On Fri, Jun 03, 2016 at 12:56:17PM +0800, Garlic Tseng wrote:
> 
> > +   /*enable agent*/
> 
> Lots of comments with missing spaces in them, there's quite a few
> examples of that in here.

I'll check all the code and fix them. 

> 
> > +EXPORT_SYMBOL(mtk_afe_fe_startup);
> 
> All the ASoC and regmap APIs are _GPL(), you really shouldn't export new
> interfaces based on them without it - the point with the _GPL() is that
> non-GPL code shouldn't be able to use the APIs.

Thanks for comment, I'll fix them.


> 
> > +EXPORT_SYMBOL(mtk_afe_fe_hw_params);
> 
> Do you need to export the individual ops rather than just the ops
> structure?
> 

Yes, in 2701 driver we modify some ops.


+/* FE DAIs */
+static const struct snd_soc_dai_ops mt2701_single_memif_dai_ops = {
+   .startup= mt2701_simple_fe_startup,
+   .shutdown   = mtk_afe_fe_shutdown,
+   .hw_params  = mt2701_simple_fe_hw_params,
+   .hw_free= mtk_afe_fe_hw_free,
+   .prepare= mtk_afe_fe_prepare,
+   .trigger= mtk_afe_fe_trigger,
+
+};

And here is one of them. Here MT2701 need one more reg control.

+static int mt2701_simple_fe_hw_params(struct snd_pcm_substream
*substream,
+ struct snd_pcm_hw_params *params,
+ struct snd_soc_dai *dai)
+{
+   struct snd_soc_pcm_runtime *rtd = substream->private_data;
+   struct mtk_base_afe *afe =
snd_soc_platform_get_drvdata(rtd->platform);
+   int stream_dir = substream->stream;
+
+   /*single DL use PAIR_INTERLEAVE*/
+   if (stream_dir == SNDRV_PCM_STREAM_PLAYBACK) {
+   regmap_update_bits(afe->regmap,
+  AFE_MEMIF_PBUF_SIZE,
+  AFE_MEMIF_PBUF_SIZE_DLM_MASK,
+  AFE_MEMIF_PBUF_SIZE_PAIR_INTERLEAVE);
+   }
+   return mtk_afe_fe_hw_params(substream, params, dai);
+}

MT2701 need some specific reg controls. If the control is
platform-specific I tend not to put them in the common ops structure.


> > +int mtk_afe_fe_trigger(struct snd_pcm_substream *substream, int cmd,
> > +  struct snd_soc_dai *dai)
> > +{
> > +   struct snd_soc_pcm_runtime *rtd = substream->private_data;
> > +   struct snd_pcm_runtime * const runtime = substream->runtime;
> > +   struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
> > +   struct mtk_base_afe_memif *memif = >memif[rtd->cpu_dai->id];
> > +   struct mtk_base_afe_irq *irqs = >irqs[memif->irq_usage];
> > +   const struct mtk_base_irq_data *irq_data = irqs->irq_data;
> > +   unsigned int counter = runtime->period_size;
> > +   int fs;
> > +
> > +   dev_info(afe->dev, "%s %s cmd=%d\n", __func__, memif->data->name, cmd);
> 
> That's way too noisy, dev_dbg() at most.

OK. I'll fix it.

> > +static DEFINE_MUTEX(irqs_lock);
> > +int mtk_dynamic_irq_acquire(struct mtk_base_afe *afe)
> > +{
> > +   int i;
> > +
> > +   mutex_lock(_lock);
> > +   for (i = 0; i < afe->irqs_size; ++i) {
> 
> Why is the lock global and not part of the AFE struct?

I'll put it in AFE struct. Thanks.

> 
> > +void mtk_simple_isr(struct mtk_base_afe *afe, struct mtk_base_afe_memif 
> > *memif)
> > +{
> > +   snd_pcm_period_elapsed(memif->substream);
> > +}
> > +EXPORT_SYMBOL(mtk_simple_isr);
> 
> Is this really worth it over just calling _period_elapsed() directly?

I'll remove the function and just calling period_elapsed() directly.





Re: [PATCH V2] Use MACRO UINT_MAX instead of actual value

2016-06-07 Thread Minfei Huang
Ping. Any comment is appreciate.

Thanks
Minfei

On 05/17/16 at 03:58P, Minfei Huang wrote:
> It's more elegant to use MACRO UINT_MAX to represent the max value of
> type unsigned int. So replace the actual value by using this MACRO.
> 
> Signed-off-by: Minfei Huang 
> ---
> v1:
> - fix typo
> ---
>  drivers/nvme/host/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 643f457..2c0bb13 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -597,7 +597,7 @@ static void nvme_config_discard(struct nvme_ns *ns)
>  
>   ns->queue->limits.discard_alignment = logical_block_size;
>   ns->queue->limits.discard_granularity = logical_block_size;
> - blk_queue_max_discard_sectors(ns->queue, 0x);
> + blk_queue_max_discard_sectors(ns->queue, UINT_MAX);
>   queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, ns->queue);
>  }
>  
> -- 
> 2.6.3
> 


Re: [RFC v4 2/4] crypto: Introduce CRYPTO_ALG_BULK flag

2016-06-07 Thread Baolin Wang
Hi Herbert,

On 7 June 2016 at 22:16, Herbert Xu  wrote:
> On Tue, Jun 07, 2016 at 08:17:05PM +0800, Baolin Wang wrote:
>> Now some cipher hardware engines prefer to handle bulk block rather than one
>> sector (512 bytes) created by dm-crypt, cause these cipher engines can handle
>> the intermediate values (IV) by themselves in one bulk block. This means we
>> can increase the size of the request by merging request rather than always 
>> 512
>> bytes and thus increase the hardware engine processing speed.
>>
>> So introduce 'CRYPTO_ALG_BULK' flag to indicate this cipher can support bulk
>> mode.
>>
>> Signed-off-by: Baolin Wang 
>
> Nack.  As I said before, please do it using explicit IV generators
> like we do for IPsec.

OK. I would like to try your suggestion. Thanks.

> --
> Email: Herbert Xu 
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
Baolin.wang
Best Regards


Re: [PATCH] watchdog: f71808e_wdt: Add F81866 support

2016-06-07 Thread Guenter Roeck

On 06/07/2016 06:40 PM, Ji-Ze Hong (Peter Hong) wrote:

Hi Guenter,

Guenter Roeck 於 2016/6/7 下午 10:06 寫道:

On 06/05/2016 11:58 PM, Ji-Ze Hong (Peter Hong) wrote:

+#define SIO_REG_PORT_SEL0x27/* F81866 Multi-Function Register */
+#define SIO_REG_GPIO10x2c/*
+ * GPIO1 Control Register when 27h
+ * BIT3:2 = 01 & BIT0 = 0
+ *
+ * The PIN 70(GPIO15/WDTRST) is
+ * controlled by 2Ch:
+ * BIT5: 0 -> WDTRST#
+ *   1 -> GPIO15
+ */
+

Please keep register defines in order, and move the explanation
to where the register values are set.


OK. BTW, should I rename SIO_REG_PORT_SEL & SIO_REG_GPIO1 to
SIO_F81866_REG_PORT_SEL & SIO_F81866_REG_GPIO1? It's only used by
F81866.



Might be a good idea.

Thanks,
Guenter


+case f81866:
+/* Set pin 70 to WDTRST# */
+superio_clear_bit(watchdog.sioaddr, SIO_REG_PORT_SEL, 9);
+superio_set_bit(watchdog.sioaddr, SIO_REG_PORT_SEL, 4);
+superio_clear_bit(watchdog.sioaddr, SIO_REG_GPIO1, 0x20);


Using BIT() here would be a bit nicer. Yes, I know, it isn't done
everywhere
in this driver, but that doesn't mean we should not do it in added code.


I'll use BIT() to re-write it.

Thanks




Re: [PATCH V8 7/9] acpi: Add generic MCFG table handling

2016-06-07 Thread Bjorn Helgaas
On Mon, May 30, 2016 at 05:14:20PM +0200, Tomasz Nowicki wrote:
> In order to handle PCI config space regions properly in ACPI, new MCFG
> interface is defined which does sanity checks on MCFG table and keeps its
> root pointer. The user is able to lookup MCFG regions based on
> host bridge root structure and domain:bus_start:bus_end touple.
> Use pci_mmcfg_late_init old prototype to avoid another function name.
> 
> Signed-off-by: Tomasz Nowicki 
> Signed-off-by: Jayachandran C 
> ---
>  drivers/acpi/Kconfig |  3 ++
>  drivers/acpi/Makefile|  1 +
>  drivers/acpi/pci_mcfg.c  | 94 
> 
>  include/linux/pci-acpi.h |  2 ++
>  include/linux/pci.h  |  2 +-
>  5 files changed, 101 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/acpi/pci_mcfg.c
> 
> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> index b7e2e77..f98c328 100644
> --- a/drivers/acpi/Kconfig
> +++ b/drivers/acpi/Kconfig
> @@ -217,6 +217,9 @@ config ACPI_PROCESSOR_IDLE
>   bool
>   select CPU_IDLE
>  
> +config ACPI_MCFG
> + bool
> +
>  config ACPI_CPPC_LIB
>   bool
>   depends on ACPI_PROCESSOR
> diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
> index 251ce85..632e81f 100644
> --- a/drivers/acpi/Makefile
> +++ b/drivers/acpi/Makefile
> @@ -40,6 +40,7 @@ acpi-$(CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC) += processor_pdc.o
>  acpi-y   += ec.o
>  acpi-$(CONFIG_ACPI_DOCK) += dock.o
>  acpi-y   += pci_root.o pci_link.o pci_irq.o
> +obj-$(CONFIG_ACPI_MCFG)  += pci_mcfg.o
>  acpi-y   += acpi_lpss.o acpi_apd.o
>  acpi-y   += acpi_platform.o
>  acpi-y   += acpi_pnp.o
> diff --git a/drivers/acpi/pci_mcfg.c b/drivers/acpi/pci_mcfg.c
> new file mode 100644
> index 000..1847f74
> --- /dev/null
> +++ b/drivers/acpi/pci_mcfg.c
> @@ -0,0 +1,94 @@
> +/*
> + * Copyright (C) 2016 Broadcom
> + *   Author: Jayachandran C 
> + * Copyright (C) 2016 Semihalf
> + *   Author: Tomasz Nowicki 
> + *
> + * 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 (the "GPL").
> + *
> + * 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 version 2 (GPLv2) for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * version 2 (GPLv2) along with this source code.
> + */
> +
> +#define pr_fmt(fmt) "ACPI: " fmt
> +
> +#include 
> +#include 
> +#include 
> +
> +/* Root pointer to the mapped MCFG table */
> +static struct acpi_table_mcfg *mcfg_table;
> +static int mcfg_entries;
> +
> +int pci_mcfg_lookup(struct acpi_pci_root *root)

I think this would be better if we passed in the domain and a pointer
to the bus range resource and returned the ECAM base address.  I don't
think we need to be connected to struct acpi_pci_root.

> +{
> + struct acpi_mcfg_allocation *mptr, *entry = NULL;
> + struct resource *bus_res = >secondary;
> + int i;
> +
> + if (mcfg_table) {
> + mptr = (struct acpi_mcfg_allocation *) _table[1];
> + for (i = 0; i < mcfg_entries && !entry; i++, mptr++)
> + if (mptr->pci_segment == root->segment &&
> + mptr->start_bus_number == bus_res->start)
> + entry = mptr;
> + }
> +
> + /* not found, use _CBA if available, else error */
> + if (!entry) {
> + if (root->mcfg_addr)
> + return root->mcfg_addr;
> + pr_err("%04x:%pR MCFG lookup failed\n", root->segment, bus_res);
> + return -ENOENT;
> + } else if (root->mcfg_addr && entry->address != root->mcfg_addr) {
> + pr_warn("%04x:%pR CBA %pa != MCFG %lx, using CBA\n",
> + root->segment, bus_res, >mcfg_addr,
> + (unsigned long)entry->address);
> + return 0;
> + }

I keep looking at this code, trying to find where we "use _CBA", but I
can't find it.  Oh, I see, acpi_pci_root_add() calls
acpi_pci_root_get_mcfg_addr() (which evaluates _CBA), and sets
root->mcfg_addr to the result.

"root->mcfg_addr" is sort of an unfortunate name because "MCFG" is the
ACPI table name, we've used "ECAM" for the memory-mapped config space,
and this address can come from either the MCFG table or the _CBA
method.

In the case where we have both _CBA and an MCFG entry, I think we
should prefer _CBA, and I'm not sure it's even worth warning about it.
So I think you could simplify this function if you made

Re: [PATCH] mm/zsmalloc: add trace events for zs_compact

2016-06-07 Thread Ganesh Mahendran
Hi, Minchan:

2016-06-08 8:16 GMT+08:00 Minchan Kim :
> Hello Ganesh,
>
> On Tue, Jun 07, 2016 at 04:56:44PM +0800, Ganesh Mahendran wrote:
>> Currently zsmalloc is widely used in android device.
>> Sometimes, we want to see how frequently zs_compact is
>> triggered or how may pages freed by zs_compact(), or which
>> zsmalloc pool is compacted.
>>
>> Most of the time, user can get the brief information from
>> trace_mm_shrink_slab_[start | end], but in some senario,
>> they do not use zsmalloc shrinker, but trigger compaction manually.
>> So add some trace events in zs_compact is convenient. Also we
>> can add some zsmalloc specific information(pool name, total compact
>> pages, etc) in zsmalloc trace.
>
> Sorry, I cannot understand what's the problem now and what you want to
> solve. Could you elaborate it a bit?
>
> Thanks.

We have backported the zs_compact() to our product(kernel 3.18).
It is usefull for a longtime running device.
But there is not a convenient way to get the detailed information
of zs_comapct() which is usefull for  performance optimization.
Information about how much time zs_compact used, which pool is
compacted, how many page freed, etc.
With these information, we will know what is going on in zs_comapct.
And draw the relation between free mem and zs_comapct.

>
>>
>> This patch add two trace events for zs_compact(), below the trace log:
>> -
>> root@land:/ # cat /d/tracing/trace
>>  kswapd0-125   [007] ...1   174.176979: zsmalloc_compact_start: pool 
>> zram0
>>  kswapd0-125   [007] ...1   174.181967: zsmalloc_compact_end: pool 
>> zram0: 608 pages compacted(total 1794)
>>  kswapd0-125   [000] ...1   184.134475: zsmalloc_compact_start: pool 
>> zram0
>>  kswapd0-125   [000] ...1   184.135010: zsmalloc_compact_end: pool 
>> zram0: 62 pages compacted(total 1856)
>>  kswapd0-125   [003] ...1   226.927221: zsmalloc_compact_start: pool 
>> zram0
>>  kswapd0-125   [003] ...1   226.928575: zsmalloc_compact_end: pool 
>> zram0: 250 pages compacted(total 2106)
>> -
>>
>> Signed-off-by: Ganesh Mahendran 
>> ---
>>  include/trace/events/zsmalloc.h | 56 
>> +
>>  mm/zsmalloc.c   | 10 
>>  2 files changed, 66 insertions(+)
>>  create mode 100644 include/trace/events/zsmalloc.h
>>
>> diff --git a/include/trace/events/zsmalloc.h 
>> b/include/trace/events/zsmalloc.h
>> new file mode 100644
>> index 000..3b6f14e
>> --- /dev/null
>> +++ b/include/trace/events/zsmalloc.h
>> @@ -0,0 +1,56 @@
>> +#undef TRACE_SYSTEM
>> +#define TRACE_SYSTEM zsmalloc
>> +
>> +#if !defined(_TRACE_ZSMALLOC_H) || defined(TRACE_HEADER_MULTI_READ)
>> +#define _TRACE_ZSMALLOC_H
>> +
>> +#include 
>> +#include 
>> +
>> +TRACE_EVENT(zsmalloc_compact_start,
>> +
>> + TP_PROTO(const char *pool_name),
>> +
>> + TP_ARGS(pool_name),
>> +
>> + TP_STRUCT__entry(
>> + __field(const char *, pool_name)
>> + ),
>> +
>> + TP_fast_assign(
>> + __entry->pool_name = pool_name;
>> + ),
>> +
>> + TP_printk("pool %s",
>> +   __entry->pool_name)
>> +);
>> +
>> +TRACE_EVENT(zsmalloc_compact_end,
>> +
>> + TP_PROTO(const char *pool_name, unsigned long pages_compacted,
>> + unsigned long pages_total_compacted),
>> +
>> + TP_ARGS(pool_name, pages_compacted, pages_total_compacted),
>> +
>> + TP_STRUCT__entry(
>> + __field(const char *, pool_name)
>> + __field(unsigned long, pages_compacted)
>> + __field(unsigned long, pages_total_compacted)
>> + ),
>> +
>> + TP_fast_assign(
>> + __entry->pool_name = pool_name;
>> + __entry->pages_compacted = pages_compacted;
>> + __entry->pages_total_compacted = pages_total_compacted;
>> + ),
>> +
>> + TP_printk("pool %s: %ld pages compacted(total %ld)",
>> +   __entry->pool_name,
>> +   __entry->pages_compacted,
>> +   __entry->pages_total_compacted)
>> +);
>> +
>> +#endif /* _TRACE_ZSMALLOC_H */
>> +
>> +/* This part must be outside protection */
>> +#include 
>> diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
>> index 213d0e1..441b9f7 100644
>> --- a/mm/zsmalloc.c
>> +++ b/mm/zsmalloc.c
>> @@ -30,6 +30,8 @@
>>
>>  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>>
>> +#define CREATE_TRACE_POINTS
>> +
>>  #include 
>>  #include 
>>  #include 
>> @@ -52,6 +54,7 @@
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>>
>>  #define ZSPAGE_MAGIC 0x58
>>
>> @@ -2330,6 +2333,9 @@ unsigned long zs_compact(struct zs_pool *pool)
>>  {
>>   int i;
>>   struct size_class *class;
>> + unsigned long pages_compacted_before = pool->stats.pages_compacted;
>> +
>> + trace_zsmalloc_compact_start(pool->name);
>>
>>   for (i = zs_size_classes - 1; i >= 0; i--) {
>>   class = 

Linux 3.14.72

2016-06-07 Thread Greg KH
I'm announcing the release of the 3.14.72 kernel.

All users of the 3.14 kernel series must upgrade.

The updated 3.14.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-3.14.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile  |2 +-
 arch/mips/ath79/early_printk.c|6 --
 arch/mips/include/uapi/asm/siginfo.h  |   18 +-
 arch/mips/math-emu/cp1emu.c   |8 +---
 arch/powerpc/kernel/exceptions-64s.S  |   16 +++-
 drivers/cpuidle/cpuidle.c |2 ++
 drivers/gpu/drm/drm_fb_helper.c   |5 ++---
 drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c |2 +-
 drivers/input/misc/uinput.c   |6 ++
 drivers/net/wireless/ath/ath5k/led.c  |2 +-
 drivers/net/wireless/rtlwifi/base.c   |4 ++--
 drivers/pci/probe.c   |6 +++---
 drivers/scsi/aacraid/commsup.c|   12 
 drivers/xen/events/events_base.c  |6 --
 fs/ext4/ialloc.c  |   10 ++
 fs/ext4/mballoc.c |   10 +++---
 fs/pipe.c |5 -
 fs/xfs/xfs_inode.c|   26 ++
 lib/dma-debug.c   |2 +-
 net/sunrpc/auth_gss/svcauth_gss.c |4 ++--
 20 files changed, 97 insertions(+), 55 deletions(-)

Ben Hutchings (1):
  pipe: Fix buffer offset after partially failed read

Dave Chinner (3):
  xfs: xfs_iflush_cluster fails to abort on error
  xfs: fix inode validity check in xfs_iflush_cluster
  xfs: skip stale inodes in xfs_iflush_cluster

Dave Gerlach (1):
  cpuidle: Indicate when a device has been unregistered

Greg Kroah-Hartman (1):
  Linux 3.14.72

Hari Bathini (1):
  powerpc/book3s64: Fix branching to OOL handlers in relocatable kernel

Itai Handler (1):
  drm/gma500: Fix possible out of bounds read

James Hogan (1):
  MIPS: Fix siginfo.h to use strict posix types

Joseph Salisbury (1):
  ath5k: Change led pin configuration for compaq c700 laptop

Lyude (1):
  drm/fb_helper: Fix references to dev->mode_config.num_connector

Matthias Schiffer (1):
  MIPS: ath79: make bootconsole wait for both THRE and TEMT

Nicolai Stange (2):
  ext4: address UBSAN warning in mb_find_order_for_block()
  ext4: silence UBSAN in ext4_mb_init()

Paul Burton (1):
  MIPS: math-emu: Fix jalr emulation when rd == $0

Prarit Bhargava (1):
  PCI: Disable all BAR sizing for devices with non-compliant BARs

Raghava Aditya Renukunta (2):
  aacraid: Relinquish CPU during timeout wait
  aacraid: Fix for aac_command_thread hang

Ricky Liang (1):
  Input: uinput - handle compat ioctl for UI_SET_PHYS

Ross Lagerwall (1):
  xen/events: Don't move disabled irqs

Theodore Ts'o (1):
  ext4: fix hang when processing corrupted orphaned inode list

Tomáš Trnka (1):
  sunrpc: fix stripping of padded MIC tokens

Ville Syrjälä (1):
  dma-debug: avoid spinlock recursion when disabling dma-debug

wang yanqing (1):
  rtlwifi: Fix logic error in enter/exit power-save mode



signature.asc
Description: PGP signature


Re: Linux 3.14.72

2016-06-07 Thread Greg KH
diff --git a/Makefile b/Makefile
index 98282e65bb46..6155aaf6342a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 3
 PATCHLEVEL = 14
-SUBLEVEL = 71
+SUBLEVEL = 72
 EXTRAVERSION =
 NAME = Remembering Coco
 
diff --git a/arch/mips/ath79/early_printk.c b/arch/mips/ath79/early_printk.c
index b955fafc58ba..d1adc59af5bf 100644
--- a/arch/mips/ath79/early_printk.c
+++ b/arch/mips/ath79/early_printk.c
@@ -31,13 +31,15 @@ static inline void prom_putchar_wait(void __iomem *reg, u32 
mask, u32 val)
} while (1);
 }
 
+#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
+
 static void prom_putchar_ar71xx(unsigned char ch)
 {
void __iomem *base = (void __iomem *)(KSEG1ADDR(AR71XX_UART_BASE));
 
-   prom_putchar_wait(base + UART_LSR * 4, UART_LSR_THRE, UART_LSR_THRE);
+   prom_putchar_wait(base + UART_LSR * 4, BOTH_EMPTY, BOTH_EMPTY);
__raw_writel(ch, base + UART_TX * 4);
-   prom_putchar_wait(base + UART_LSR * 4, UART_LSR_THRE, UART_LSR_THRE);
+   prom_putchar_wait(base + UART_LSR * 4, BOTH_EMPTY, BOTH_EMPTY);
 }
 
 static void prom_putchar_ar933x(unsigned char ch)
diff --git a/arch/mips/include/uapi/asm/siginfo.h 
b/arch/mips/include/uapi/asm/siginfo.h
index e81174432bab..6e1218ae916c 100644
--- a/arch/mips/include/uapi/asm/siginfo.h
+++ b/arch/mips/include/uapi/asm/siginfo.h
@@ -48,13 +48,13 @@ typedef struct siginfo {
 
/* kill() */
struct {
-   pid_t _pid; /* sender's pid */
+   __kernel_pid_t _pid;/* sender's pid */
__ARCH_SI_UID_T _uid;   /* sender's uid */
} _kill;
 
/* POSIX.1b timers */
struct {
-   timer_t _tid;   /* timer id */
+   __kernel_timer_t _tid;  /* timer id */
int _overrun;   /* overrun count */
char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
sigval_t _sigval;   /* same as below */
@@ -63,26 +63,26 @@ typedef struct siginfo {
 
/* POSIX.1b signals */
struct {
-   pid_t _pid; /* sender's pid */
+   __kernel_pid_t _pid;/* sender's pid */
__ARCH_SI_UID_T _uid;   /* sender's uid */
sigval_t _sigval;
} _rt;
 
/* SIGCHLD */
struct {
-   pid_t _pid; /* which child */
+   __kernel_pid_t _pid;/* which child */
__ARCH_SI_UID_T _uid;   /* sender's uid */
int _status;/* exit code */
-   clock_t _utime;
-   clock_t _stime;
+   __kernel_clock_t _utime;
+   __kernel_clock_t _stime;
} _sigchld;
 
/* IRIX SIGCHLD */
struct {
-   pid_t _pid; /* which child */
-   clock_t _utime;
+   __kernel_pid_t _pid;/* which child */
+   __kernel_clock_t _utime;
int _status;/* exit code */
-   clock_t _stime;
+   __kernel_clock_t _stime;
} _irix_sigchld;
 
/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index 0b4e2e38294b..68af633cba76 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -676,9 +676,11 @@ static int isBranchInstr(struct pt_regs *regs, struct 
mm_decoded_insn dec_insn,
case spec_op:
switch (insn.r_format.func) {
case jalr_op:
-   regs->regs[insn.r_format.rd] =
-   regs->cp0_epc + dec_insn.pc_inc +
-   dec_insn.next_pc_inc;
+   if (insn.r_format.rd != 0) {
+   regs->regs[insn.r_format.rd] =
+   regs->cp0_epc + dec_insn.pc_inc +
+   dec_insn.next_pc_inc;
+   }
/* Fall through */
case jr_op:
*contpc = regs->regs[insn.r_format.rs];
diff --git a/arch/powerpc/kernel/exceptions-64s.S 
b/arch/powerpc/kernel/exceptions-64s.S
index 5193116eadc0..2c35b11a14c0 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -946,11 +946,6 @@ hv_facility_unavailable_relon_trampoline:
 #endif
STD_RELON_EXCEPTION_PSERIES(0x5700, 0x1700, altivec_assist)
 
-   /* Other future vectors */
-   .align  7
-   .globl  __end_interrupts
-__end_interrupts:
-
.align  7
 system_call_entry_direct:
 #if 

Re: [alsa-devel] [PATCH v2 5/9] ASoC: mediatek: add structure define and clock control for 2701

2016-06-07 Thread Garlic Tseng
On Tue, 2016-06-07 at 17:15 +0100, Mark Brown wrote:
> On Fri, Jun 03, 2016 at 12:56:20PM +0800, Garlic Tseng wrote:
> 
> > +void mt2701_init_clock(struct mtk_base_afe *afe)
> > +{
> > +   struct mt2701_afe_private *afe_priv = afe->platform_priv;
> > +   int i = 0;
> > +
> > +   for (i = 0; i < MT2701_CLOCK_NUM; i++) {
> > +   afe_priv->clocks[i] = devm_clk_get(afe->dev, aud_clks[i]);
> > +   if (IS_ERR(aud_clks[i]))
> > +   dev_warn(afe->dev, "%s devm_clk_get %s fail\n",
> > +__func__, aud_clks[i]);
> > +   }
> > +}
> 
> This looks like we just ignore the error but I'm not seeing anything
> that stops us trying to use the clocks or handle deferred probe?

The probe for platform_driver should fail if the clock error occur.
I'll fix it. Thanks.



Linux 4.4.13

2016-06-07 Thread Greg KH
I'm announcing the release of the 4.4.13 kernel.

All users of the 4.4 kernel series must upgrade.

The updated 4.4.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.4.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/devicetree/bindings/clock/imx35-clock.txt  |1 
 Documentation/sysctl/fs.txt  |   23 ++
 Makefile |4 
 arch/arm/boot/dts/armada-385-linksys.dtsi|6 
 arch/arm/boot/dts/armada-xp-linksys-mamba.dts|4 
 arch/arm/boot/dts/exynos4210-trats.dts   |2 
 arch/arm/boot/dts/sama5d2-pinfunc.h  |4 
 arch/mips/ath79/early_printk.c   |6 
 arch/mips/include/asm/asmmacro.h |   40 +--
 arch/mips/include/asm/cacheflush.h   |6 
 arch/mips/include/asm/msa.h  |   13 +
 arch/mips/include/asm/pgtable.h  |   26 ++
 arch/mips/include/asm/switch_to.h|2 
 arch/mips/include/asm/watch.h|   10 
 arch/mips/include/uapi/asm/siginfo.h |   22 --
 arch/mips/kernel/mips-r2-to-r6-emul.c|  105 
+-
 arch/mips/kernel/pm.c|2 
 arch/mips/kernel/process.c   |6 
 arch/mips/kernel/ptrace.c|   27 +-
 arch/mips/kernel/r4k_fpu.S   |   10 
 arch/mips/kernel/setup.c |3 
 arch/mips/kernel/signal.c|   15 -
 arch/mips/kernel/traps.c |8 
 arch/mips/kernel/watch.c |5 
 arch/mips/lib/ashldi3.c  |2 
 arch/mips/lib/ashrdi3.c  |2 
 arch/mips/lib/bswapdi.c  |2 
 arch/mips/lib/bswapsi.c  |2 
 arch/mips/lib/cmpdi2.c   |2 
 arch/mips/lib/lshrdi3.c  |2 
 arch/mips/lib/ucmpdi2.c  |2 
 arch/mips/loongson64/loongson-3/numa.c   |6 
 arch/mips/math-emu/cp1emu.c  |8 
 arch/mips/mm/cache.c |   41 ++-
 arch/mips/vdso/Makefile  |4 
 arch/powerpc/kernel/eeh.c|2 
 arch/powerpc/kernel/eeh_driver.c |   26 ++
 arch/powerpc/kernel/exceptions-64s.S |   16 +
 arch/x86/xen/setup.c |   65 ++
 drivers/base/power/main.c|5 
 drivers/base/power/runtime.c |9 
 drivers/char/hw_random/exynos-rng.c  |   10 
 drivers/clk/at91/clk-h32mx.c |2 
 drivers/clk/bcm/clk-bcm2835.c|   19 +
 drivers/clk/imx/clk-imx35.c  |4 
 drivers/cpuidle/cpuidle.c|4 
 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c   |   10 
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c  |2 
 drivers/gpu/drm/drm_atomic.c |2 
 drivers/gpu/drm/drm_fb_helper.c  |5 
 drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c|2 
 drivers/gpu/drm/i915/intel_fbdev.c   |6 
 drivers/gpu/drm/i915/intel_pm.c  |2 
 drivers/gpu/drm/imx/imx-drm-core.c   |8 
 drivers/gpu/drm/imx/ipuv3-crtc.c |2 
 drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c  |   10 
 drivers/gpu/drm/vmwgfx/vmwgfx_fb.c   |6 
 drivers/gpu/ipu-v3/ipu-common.c  |5 
 drivers/hwmon/ads7828.c  |   10 
 drivers/input/misc/uinput.c  |6 
 drivers/media/v4l2-core/v4l2-compat-ioctl32.c|3 
 drivers/mfd/intel-lpss.c

Re: Linux 4.4.13

2016-06-07 Thread Greg KH
diff --git a/Documentation/devicetree/bindings/clock/imx35-clock.txt 
b/Documentation/devicetree/bindings/clock/imx35-clock.txt
index a70356452a82..f49783213c56 100644
--- a/Documentation/devicetree/bindings/clock/imx35-clock.txt
+++ b/Documentation/devicetree/bindings/clock/imx35-clock.txt
@@ -94,6 +94,7 @@ clocks and IDs.
csi_sel 79
iim_gate80
gpu2d_gate  81
+   ckli_gate   82
 
 Examples:
 
diff --git a/Documentation/sysctl/fs.txt b/Documentation/sysctl/fs.txt
index 88152f214f48..302b5ed616a6 100644
--- a/Documentation/sysctl/fs.txt
+++ b/Documentation/sysctl/fs.txt
@@ -32,6 +32,8 @@ Currently, these files are in /proc/sys/fs:
 - nr_open
 - overflowuid
 - overflowgid
+- pipe-user-pages-hard
+- pipe-user-pages-soft
 - protected_hardlinks
 - protected_symlinks
 - suid_dumpable
@@ -159,6 +161,27 @@ The default is 65534.
 
 ==
 
+pipe-user-pages-hard:
+
+Maximum total number of pages a non-privileged user may allocate for pipes.
+Once this limit is reached, no new pipes may be allocated until usage goes
+below the limit again. When set to 0, no limit is applied, which is the default
+setting.
+
+==
+
+pipe-user-pages-soft:
+
+Maximum total number of pages a non-privileged user may allocate for pipes
+before the pipe size gets limited to a single page. Once this limit is reached,
+new pipes will be limited to a single page in size for this user in order to
+limit total memory usage, and trying to increase them using fcntl() will be
+denied until usage goes below the limit again. The default value allows to
+allocate up to 1024 pipes at their default size. When set to 0, no limit is
+applied.
+
+==
+
 protected_hardlinks:
 
 A long-standing class of security issues is the hardlink-based
diff --git a/Makefile b/Makefile
index a1fbd691a36e..f4b33cdf991a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 4
-SUBLEVEL = 12
+SUBLEVEL = 13
 EXTRAVERSION =
 NAME = Blurry Fish Butt
 
@@ -364,7 +364,7 @@ AFLAGS_MODULE   =
 LDFLAGS_MODULE  =
 CFLAGS_KERNEL  =
 AFLAGS_KERNEL  =
-CFLAGS_GCOV= -fprofile-arcs -ftest-coverage
+CFLAGS_GCOV= -fprofile-arcs -ftest-coverage -fno-tree-loop-im
 
 
 # Use USERINCLUDE when you must reference the UAPI directories only.
diff --git a/arch/arm/boot/dts/armada-385-linksys.dtsi 
b/arch/arm/boot/dts/armada-385-linksys.dtsi
index 85d2c377c332..8450944b28e6 100644
--- a/arch/arm/boot/dts/armada-385-linksys.dtsi
+++ b/arch/arm/boot/dts/armada-385-linksys.dtsi
@@ -245,7 +245,7 @@
button@2 {
label = "Factory Reset Button";
linux,code = ;
-   gpios = < 15 GPIO_ACTIVE_LOW>;
+   gpios = < 29 GPIO_ACTIVE_LOW>;
};
};
 
@@ -260,7 +260,7 @@
};
 
sata {
-   gpios = < 22 GPIO_ACTIVE_HIGH>;
+   gpios = < 22 GPIO_ACTIVE_LOW>;
default-state = "off";
};
};
@@ -313,7 +313,7 @@
 
  {
keys_pin: keys-pin {
-   marvell,pins = "mpp24", "mpp47";
+   marvell,pins = "mpp24", "mpp29";
marvell,function = "gpio";
};
 
diff --git a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts 
b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
index b89e6cf1271a..7a461541ce50 100644
--- a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
+++ b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
@@ -304,13 +304,13 @@
button@1 {
label = "WPS";
linux,code = ;
-   gpios = < 0 GPIO_ACTIVE_HIGH>;
+   gpios = < 0 GPIO_ACTIVE_LOW>;
};
 
button@2 {
label = "Factory Reset Button";
linux,code = ;
-   gpios = < 1 GPIO_ACTIVE_HIGH>;
+   gpios = < 1 GPIO_ACTIVE_LOW>;
};
};
 
diff --git a/arch/arm/boot/dts/exynos4210-trats.dts 
b/arch/arm/boot/dts/exynos4210-trats.dts
index a50be640f1b0..59411e447fa0 100644
--- a/arch/arm/boot/dts/exynos4210-trats.dts
+++ b/arch/arm/boot/dts/exynos4210-trats.dts
@@ -298,6 +298,8 @@
compatible = "maxim,max8997-pmic";
 
reg = <0x66>;
+   interrupt-parent = <>;
+   interrupts = <7 0>;
 
max8997,pmic-buck1-uses-gpio-dvs;
max8997,pmic-buck2-uses-gpio-dvs;
diff --git a/arch/arm/boot/dts/sama5d2-pinfunc.h 
b/arch/arm/boot/dts/sama5d2-pinfunc.h
index b0c912feaa2f..8a394f336003 100644
--- a/arch/arm/boot/dts/sama5d2-pinfunc.h
+++ b/arch/arm/boot/dts/sama5d2-pinfunc.h
@@ -837,8 +837,8 @@
 #define PIN_PD23__ISC_FIELD 

Re: Linux 4.5.7

2016-06-07 Thread Greg KH
diff --git a/Documentation/devicetree/bindings/clock/imx35-clock.txt 
b/Documentation/devicetree/bindings/clock/imx35-clock.txt
index a70356452a82..f49783213c56 100644
--- a/Documentation/devicetree/bindings/clock/imx35-clock.txt
+++ b/Documentation/devicetree/bindings/clock/imx35-clock.txt
@@ -94,6 +94,7 @@ clocks and IDs.
csi_sel 79
iim_gate80
gpu2d_gate  81
+   ckli_gate   82
 
 Examples:
 
diff --git a/Makefile b/Makefile
index 07a1786f695a..90e4bd904d36 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 5
-SUBLEVEL = 6
+SUBLEVEL = 7
 EXTRAVERSION =
 NAME = Blurry Fish Butt
 
@@ -364,7 +364,7 @@ AFLAGS_MODULE   =
 LDFLAGS_MODULE  =
 CFLAGS_KERNEL  =
 AFLAGS_KERNEL  =
-CFLAGS_GCOV= -fprofile-arcs -ftest-coverage
+CFLAGS_GCOV= -fprofile-arcs -ftest-coverage -fno-tree-loop-im
 
 
 # Use USERINCLUDE when you must reference the UAPI directories only.
diff --git a/arch/arm/boot/dts/armada-385-linksys.dtsi 
b/arch/arm/boot/dts/armada-385-linksys.dtsi
index 85d2c377c332..8450944b28e6 100644
--- a/arch/arm/boot/dts/armada-385-linksys.dtsi
+++ b/arch/arm/boot/dts/armada-385-linksys.dtsi
@@ -245,7 +245,7 @@
button@2 {
label = "Factory Reset Button";
linux,code = ;
-   gpios = < 15 GPIO_ACTIVE_LOW>;
+   gpios = < 29 GPIO_ACTIVE_LOW>;
};
};
 
@@ -260,7 +260,7 @@
};
 
sata {
-   gpios = < 22 GPIO_ACTIVE_HIGH>;
+   gpios = < 22 GPIO_ACTIVE_LOW>;
default-state = "off";
};
};
@@ -313,7 +313,7 @@
 
  {
keys_pin: keys-pin {
-   marvell,pins = "mpp24", "mpp47";
+   marvell,pins = "mpp24", "mpp29";
marvell,function = "gpio";
};
 
diff --git a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts 
b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
index b89e6cf1271a..7a461541ce50 100644
--- a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
+++ b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
@@ -304,13 +304,13 @@
button@1 {
label = "WPS";
linux,code = ;
-   gpios = < 0 GPIO_ACTIVE_HIGH>;
+   gpios = < 0 GPIO_ACTIVE_LOW>;
};
 
button@2 {
label = "Factory Reset Button";
linux,code = ;
-   gpios = < 1 GPIO_ACTIVE_HIGH>;
+   gpios = < 1 GPIO_ACTIVE_LOW>;
};
};
 
diff --git a/arch/arm/boot/dts/exynos4210-trats.dts 
b/arch/arm/boot/dts/exynos4210-trats.dts
index a50be640f1b0..59411e447fa0 100644
--- a/arch/arm/boot/dts/exynos4210-trats.dts
+++ b/arch/arm/boot/dts/exynos4210-trats.dts
@@ -298,6 +298,8 @@
compatible = "maxim,max8997-pmic";
 
reg = <0x66>;
+   interrupt-parent = <>;
+   interrupts = <7 0>;
 
max8997,pmic-buck1-uses-gpio-dvs;
max8997,pmic-buck2-uses-gpio-dvs;
diff --git a/arch/arm/boot/dts/sama5d2-pinfunc.h 
b/arch/arm/boot/dts/sama5d2-pinfunc.h
index b0c912feaa2f..8a394f336003 100644
--- a/arch/arm/boot/dts/sama5d2-pinfunc.h
+++ b/arch/arm/boot/dts/sama5d2-pinfunc.h
@@ -837,8 +837,8 @@
 #define PIN_PD23__ISC_FIELDPINMUX_PIN(PIN_PD23, 6, 4)
 #define PIN_PD24   120
 #define PIN_PD24__GPIO PINMUX_PIN(PIN_PD24, 0, 0)
-#define PIN_PD24__UTXD2PINMUX_PIN(PIN_PD23, 1, 2)
-#define PIN_PD24__FLEXCOM4_IO3 PINMUX_PIN(PIN_PD23, 3, 3)
+#define PIN_PD24__UTXD2PINMUX_PIN(PIN_PD24, 1, 2)
+#define PIN_PD24__FLEXCOM4_IO3 PINMUX_PIN(PIN_PD24, 3, 3)
 #define PIN_PD25   121
 #define PIN_PD25__GPIO PINMUX_PIN(PIN_PD25, 0, 0)
 #define PIN_PD25__SPI1_SPCKPINMUX_PIN(PIN_PD25, 1, 3)
diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index 2c8f5e6ad905..bf70d0ae93ce 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -96,7 +96,7 @@
allwinner,pipeline = "de_fe0-de_be0-lcd0-tve0";
clocks = < 1>, <_gates 34>, <_gates 36>,
 <_gates 44>, <_gates 46>,
-<_gates 25>, <_gates 26>;
+<_gates 5>, <_gates 25>, 
<_gates 26>;
status = "disabled";
};
};
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 0940a788f824..ee4e8e7d3e30 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -85,8 +85,9 @@
compatible = 

Linux 4.5.7

2016-06-07 Thread Greg KH

NOTE: This is the LAST 4.5.y stable kernel release.  It is now
end-of-life, please move to the 4.6.y kernel tree now as this tree will
not be getting any more updates.


I'm announcing the release of the 4.5.7 kernel.

All users of the 4.5 kernel series must upgrade.

The updated 4.5.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.5.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/devicetree/bindings/clock/imx35-clock.txt  |1 
 Makefile |4 
 arch/arm/boot/dts/armada-385-linksys.dtsi|6 
 arch/arm/boot/dts/armada-xp-linksys-mamba.dts|4 
 arch/arm/boot/dts/exynos4210-trats.dts   |2 
 arch/arm/boot/dts/sama5d2-pinfunc.h  |4 
 arch/arm/boot/dts/sun4i-a10.dtsi |2 
 arch/arm/boot/dts/sun7i-a20.dtsi |5 
 arch/mips/ath79/early_printk.c   |6 
 arch/mips/include/asm/asmmacro.h |   40 +--
 arch/mips/include/asm/cacheflush.h   |6 
 arch/mips/include/asm/msa.h  |   13 +
 arch/mips/include/asm/pgtable.h  |   26 ++
 arch/mips/include/asm/switch_to.h|2 
 arch/mips/include/asm/watch.h|   10 
 arch/mips/include/uapi/asm/siginfo.h |   22 --
 arch/mips/kernel/mips-r2-to-r6-emul.c|  105 
+-
 arch/mips/kernel/pm.c|2 
 arch/mips/kernel/process.c   |6 
 arch/mips/kernel/ptrace.c|   27 +-
 arch/mips/kernel/r4k_fpu.S   |   10 
 arch/mips/kernel/setup.c |3 
 arch/mips/kernel/signal.c|   15 -
 arch/mips/kernel/traps.c |8 
 arch/mips/kernel/watch.c |5 
 arch/mips/lib/ashldi3.c  |2 
 arch/mips/lib/ashrdi3.c  |2 
 arch/mips/lib/bswapdi.c  |2 
 arch/mips/lib/bswapsi.c  |2 
 arch/mips/lib/cmpdi2.c   |2 
 arch/mips/lib/lshrdi3.c  |2 
 arch/mips/lib/ucmpdi2.c  |2 
 arch/mips/loongson64/Platform|2 
 arch/mips/loongson64/loongson-3/numa.c   |6 
 arch/mips/math-emu/cp1emu.c  |8 
 arch/mips/mm/cache.c |   41 ++-
 arch/mips/vdso/Makefile  |4 
 arch/powerpc/kernel/eeh.c|2 
 arch/powerpc/kernel/eeh_driver.c |   26 ++
 arch/powerpc/kernel/exceptions-64s.S |   16 +
 arch/x86/xen/setup.c |   65 ++
 drivers/base/power/main.c|5 
 drivers/base/power/runtime.c |9 
 drivers/char/hw_random/exynos-rng.c  |   10 
 drivers/clk/at91/clk-h32mx.c |2 
 drivers/clk/bcm/clk-bcm2835.c|   58 -
 drivers/clk/imx/clk-imx35.c  |4 
 drivers/cpuidle/cpuidle.c|4 
 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c   |   10 
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c  |2 
 drivers/gpu/drm/drm_atomic.c |2 
 drivers/gpu/drm/drm_fb_helper.c  |5 
 drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c|2 
 drivers/gpu/drm/i915/intel_atomic.c  |3 
 drivers/gpu/drm/i915/intel_display.c |   21 +-
 drivers/gpu/drm/i915/intel_drv.h |2 
 drivers/gpu/drm/i915/intel_fbdev.c   |6 
 drivers/gpu/drm/i915/intel_pm.c  |2 
 drivers/gpu/drm/i915/intel_psr.c

Linux 4.6.2

2016-06-07 Thread Greg KH
I'm announcing the release of the 4.6.2 kernel.

All users of the 4.6 kernel series must upgrade.

The updated 4.6.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.6.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/DocBook/gpu.tmpl   |6 
 Documentation/devicetree/bindings/clock/imx35-clock.txt  |1 
 Makefile |4 
 arch/arm/boot/dts/armada-385-linksys.dtsi|6 
 arch/arm/boot/dts/armada-xp-linksys-mamba.dts|4 
 arch/arm/boot/dts/exynos4210-trats.dts   |2 
 arch/arm/boot/dts/sama5d2-pinfunc.h  |4 
 arch/arm/boot/dts/sun4i-a10.dtsi |2 
 arch/arm/boot/dts/sun7i-a20.dtsi |5 
 arch/mips/ath79/early_printk.c   |6 
 arch/mips/include/asm/asmmacro.h |   40 -
 arch/mips/include/asm/cacheflush.h   |6 
 arch/mips/include/asm/msa.h  |   13 
 arch/mips/include/asm/pgtable.h  |   26 
 arch/mips/include/asm/switch_to.h|2 
 arch/mips/include/asm/watch.h|   10 
 arch/mips/include/uapi/asm/siginfo.h |   22 
 arch/mips/kernel/mips-r2-to-r6-emul.c|  105 +-
 arch/mips/kernel/pm.c|2 
 arch/mips/kernel/process.c   |   46 -
 arch/mips/kernel/ptrace.c|   27 
 arch/mips/kernel/r4k_fpu.S   |   10 
 arch/mips/kernel/setup.c |3 
 arch/mips/kernel/signal.c|   15 
 arch/mips/kernel/traps.c |8 
 arch/mips/kernel/watch.c |5 
 arch/mips/lib/ashldi3.c  |2 
 arch/mips/lib/ashrdi3.c  |2 
 arch/mips/lib/bswapdi.c  |2 
 arch/mips/lib/bswapsi.c  |2 
 arch/mips/lib/cmpdi2.c   |2 
 arch/mips/lib/lshrdi3.c  |2 
 arch/mips/lib/ucmpdi2.c  |2 
 arch/mips/loongson64/Platform|2 
 arch/mips/loongson64/loongson-3/numa.c   |6 
 arch/mips/math-emu/cp1emu.c  |8 
 arch/mips/mm/cache.c |   41 -
 arch/mips/vdso/Makefile  |4 
 arch/powerpc/kernel/eeh.c|2 
 arch/powerpc/kernel/eeh_driver.c |   26 
 arch/powerpc/kernel/exceptions-64s.S |   16 
 arch/x86/xen/setup.c |   65 -
 crypto/asymmetric_keys/pkcs7_parser.c|1 
 drivers/base/power/main.c|5 
 drivers/base/power/runtime.c |9 
 drivers/char/hw_random/exynos-rng.c  |   10 
 drivers/clk/at91/clk-h32mx.c |2 
 drivers/clk/bcm/clk-bcm2835.c|   58 +
 drivers/clk/imx/clk-imx35.c  |4 
 drivers/cpuidle/cpuidle.c|4 
 drivers/gpu/drm/Makefile |2 
 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c   |   10 
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c  |2 
 drivers/gpu/drm/drm_atomic.c |2 
 drivers/gpu/drm/drm_dp_dual_mode_helper.c|  366 
++
 drivers/gpu/drm/drm_fb_helper.c  |5 
 drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c|2 
 drivers/gpu/drm/i915/intel_atomic.c  |3 
 drivers/gpu/drm/i915/intel_atomic_plane.c|4 
 drivers/gpu/drm/i915/intel_ddi.c |   12 
 drivers/gpu/drm/i915/intel_display.c |   37 -
 drivers/gpu/drm/i915/intel_drv.h   

Re: [PATCH] watchdog: f71808e_wdt: Add F81866 support

2016-06-07 Thread Ji-Ze Hong (Peter Hong)

Hi Guenter,

Guenter Roeck 於 2016/6/7 下午 10:06 寫道:

On 06/05/2016 11:58 PM, Ji-Ze Hong (Peter Hong) wrote:

+#define SIO_REG_PORT_SEL0x27/* F81866 Multi-Function Register */
+#define SIO_REG_GPIO10x2c/*
+ * GPIO1 Control Register when 27h
+ * BIT3:2 = 01 & BIT0 = 0
+ *
+ * The PIN 70(GPIO15/WDTRST) is
+ * controlled by 2Ch:
+ * BIT5: 0 -> WDTRST#
+ *   1 -> GPIO15
+ */
+

Please keep register defines in order, and move the explanation
to where the register values are set.


OK. BTW, should I rename SIO_REG_PORT_SEL & SIO_REG_GPIO1 to
SIO_F81866_REG_PORT_SEL & SIO_F81866_REG_GPIO1? It's only used by
F81866.


+case f81866:
+/* Set pin 70 to WDTRST# */
+superio_clear_bit(watchdog.sioaddr, SIO_REG_PORT_SEL, 9);
+superio_set_bit(watchdog.sioaddr, SIO_REG_PORT_SEL, 4);
+superio_clear_bit(watchdog.sioaddr, SIO_REG_GPIO1, 0x20);


Using BIT() here would be a bit nicer. Yes, I know, it isn't done
everywhere
in this driver, but that doesn't mean we should not do it in added code.


I'll use BIT() to re-write it.

Thanks
--
With Best Regards,
Peter Hung


Re: [v1 PATCH 1/4] Documentation: bindings: add dt doc for Rockchip USB Type-C PHY

2016-06-07 Thread Chris Zhong

Hi Rob

On 06/07/2016 09:46 PM, Rob Herring wrote:

On Mon, Jun 6, 2016 at 7:33 PM, Chris Zhong  wrote:

Hi Rob


On 06/06/2016 10:27 PM, Rob Herring wrote:

On Fri, Jun 03, 2016 at 11:15:08PM +0800, Chris Zhong wrote:

This patch adds a binding that describes the Rockchip USB Type-C PHY
for rk3399

Signed-off-by: Chris Zhong 

---

Changes in v1:
- add extcon node description
- move the registers in phy driver
- remove the suffix of reset

   .../devicetree/bindings/phy/phy-rockchip-typec.txt | 46
++
   1 file changed, 46 insertions(+)
   create mode 100644
Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt

diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
b/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
new file mode 100644
index 000..964e0f7
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
@@ -0,0 +1,46 @@
+* ROCKCHIP type-c PHY
+-
+
+Required properties:
+ - compatible: should be "rockchip,rk3399-typec-phy0" or
+"rockchip,rk3399-typec-phy1"

What's the difference between 0 and 1? If it is to handle the register
offsets you have in the previous version and the phy blocks are
identical, then the compatible strings should be the same.

yes, the registers are different between 0 and 1, and there is a grf
register(0x6268) for switch the phy 0 and phy 1

But GRF is in a separate block and not part of the phy, right?

Rob
The GRF is not a single function block, it contain many registers to 
control other block.
For Type-c phy, the type-c orientation, phy select, and some phy status 
registers are embedded in GRF
So the GRF is registered for a syscon driver, the phy driver call regmap 
to access the registers.











Re: [PATCH v2 01/15] dt-bindings: sunxi: Add CCU binding documentation

2016-06-07 Thread Chen-Yu Tsai
On Wed, Jun 8, 2016 at 4:41 AM, Maxime Ripard
 wrote:
> Introduce a new binding with its documentation for the brand new clock
> sub-framework.
>
> Signed-off-by: Maxime Ripard 
> ---
>  Documentation/devicetree/bindings/clock/sunxi-ccu.txt | 17 +
>  1 file changed, 17 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/clock/sunxi-ccu.txt
>
> diff --git a/Documentation/devicetree/bindings/clock/sunxi-ccu.txt 
> b/Documentation/devicetree/bindings/clock/sunxi-ccu.txt
> new file mode 100644
> index ..2c66046a1342
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/clock/sunxi-ccu.txt
> @@ -0,0 +1,17 @@
> +Allwinner Clock Control Unit Binding
> +
> +
> +Required properties :
> +- compatible: must contain one of the following compatible:
> +   - "allwinner,sun8i-h3-ccu"
> +
> +- reg: Must contain the registers base address and length
> +- clocks: phandle to the oscillators feeding the SPI controller. Two are

SPI? copy paste error?

> +  needed:
> +  - "hosc": the high frequency oscillator (usually at 24MHz)
> +  - "losc": the low frequency oscillator (usually at 32kHz)
> +- clock-names: Must contain the clock names described just above
> +- #clock-cells : must contain 1
> +- #reset-cells : must contain 1
> +
> +Example:

No example? Maybe just remove this section then.

ChenYu

> --
> 2.8.3
>


Re: [PATCH 17/23] arm64: ptrace: handle ptrace_request differently for aarch32 and ilp32

2016-06-07 Thread zhouchengming

On 2016/5/24 8:04, Yury Norov wrote:

Here new aarch32 ptrace syscall handler is introsuced to avoid run-time
detection of the task type.

Signed-off-by: Yury Norov
---
  arch/arm64/include/asm/unistd32.h |  2 +-
  arch/arm64/kernel/ptrace.c| 50 ++-
  arch/arm64/kernel/sys32.c |  1 +
  include/linux/ptrace.h|  6 +
  kernel/ptrace.c   | 10 
  5 files changed, 62 insertions(+), 7 deletions(-)

diff --git a/arch/arm64/include/asm/unistd32.h 
b/arch/arm64/include/asm/unistd32.h
index 5b925b7..f57bbe3 100644
--- a/arch/arm64/include/asm/unistd32.h
+++ b/arch/arm64/include/asm/unistd32.h
@@ -74,7 +74,7 @@ __SYSCALL(__NR_getuid, sys_getuid16)
/* 25 was sys_stime */
  __SYSCALL(25, sys_ni_syscall)
  #define __NR_ptrace 26
-__SYSCALL(__NR_ptrace, compat_sys_ptrace)
+__SYSCALL(__NR_ptrace, compat_sys_aarch32_ptrace)
/* 27 was sys_alarm */
  __SYSCALL(27, sys_ni_syscall)
/* 28 was sys_fstat */
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index 38a09338..a861105 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -29,6 +29,7 @@
  #include
  #include
  #include
+#include
  #include
  #include
  #include
@@ -1114,7 +1115,7 @@ static int compat_ptrace_sethbpregs(struct task_struct 
*tsk, compat_long_t num,
  }
  #endif/* CONFIG_HAVE_HW_BREAKPOINT */

-long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
+static long compat_a32_ptrace(struct task_struct *child, compat_long_t request,
compat_ulong_t caddr, compat_ulong_t cdata)
  {
unsigned long addr = caddr;
@@ -1191,8 +1192,55 @@ long compat_arch_ptrace(struct task_struct *child, 
compat_long_t request,

return ret;
  }
+
+COMPAT_SYSCALL_DEFINE4(aarch32_ptrace, compat_long_t, request, compat_long_t, 
pid,
+  compat_long_t, addr, compat_long_t, data)
+{
+   struct task_struct *child;
+   long ret;
+
+   if (request == PTRACE_TRACEME) {
+   ret = ptrace_traceme();
+   goto out;
+   }
+
+   child = ptrace_get_task_struct(pid);
+   if (IS_ERR(child)) {
+   ret = PTR_ERR(child);
+   goto out;
+   }
+
+   if (request == PTRACE_ATTACH || request == PTRACE_SEIZE) {
+   ret = ptrace_attach(child, request, addr, data);
+   goto out_put_task_struct;
+   }
+
+   ret = ptrace_check_attach(child, request == PTRACE_KILL ||
+ request == PTRACE_INTERRUPT);
+   if (!ret) {
+   ret = compat_a32_ptrace(child, request, addr, data);
+   if (ret || request != PTRACE_DETACH)
+   ptrace_unfreeze_traced(child);
+   }
+
+ out_put_task_struct:
+   put_task_struct(child);
+ out:
+   return ret;
+}
+
  #endif /* CONFIG_AARCH32_EL0 */

+#ifdef CONFIG_COMPAT
+
+long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
+   compat_ulong_t caddr, compat_ulong_t cdata)
+{
+   return compat_ptrace_request(child, request, caddr, cdata);
+}
+
+#endif /* CONFIG_COMPAT */
+
  const struct user_regset_view *task_user_regset_view(struct task_struct *task)
  {
  #ifdef CONFIG_AARCH32_EL0
diff --git a/arch/arm64/kernel/sys32.c b/arch/arm64/kernel/sys32.c
index a40b134..3752443 100644
--- a/arch/arm64/kernel/sys32.c
+++ b/arch/arm64/kernel/sys32.c
@@ -38,6 +38,7 @@ asmlinkage long compat_sys_fadvise64_64_wrapper(void);
  asmlinkage long compat_sys_sync_file_range2_wrapper(void);
  asmlinkage long compat_sys_fallocate_wrapper(void);
  asmlinkage long compat_sys_mmap2_wrapper(void);
+asmlinkage long compat_sys_aarch32_ptrace(void);

  #undef __SYSCALL
  #define __SYSCALL(nr, sym)[nr] = sym,
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 504c98a..75887a0 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -97,6 +97,12 @@ int generic_ptrace_peekdata(struct task_struct *tsk, 
unsigned long addr,
unsigned long data);
  int generic_ptrace_pokedata(struct task_struct *tsk, unsigned long addr,
unsigned long data);
+int ptrace_traceme(void);
+struct task_struct *ptrace_get_task_struct(pid_t pid);
+int ptrace_attach(struct task_struct *task, long request,
+unsigned long addr, unsigned long flags);
+int ptrace_check_attach(struct task_struct *child, bool ignore_state);
+void ptrace_unfreeze_traced(struct task_struct *task);

  /**
   * ptrace_parent - return the task that is tracing the given task
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index d49bfa1..cadf24c 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -136,7 +136,7 @@ static bool ptrace_freeze_traced(struct task_struct *task)
return ret;
  }

-static void 

[RFC PATCH] sys_read: add a compat_sys_read for 64bit system

2016-06-07 Thread Weidong Wang
Test 32 progress and 64 progress on the 64bit system with
this progress:

int main(int argc, char **argv)
{
int fd = 0;
int i, ret = 0;
char buf[512];
unsigned long count = -1;

fd = open("/tmp", O_RDONLY);
if (fd < -1) {
printf("Pls check the directory is exist?\n");
return -1;
}
errno = 0;
ret = read(fd, NULL, count);
printf("Ret is %d errno %d\n", ret, errno);
close(fd);

return 0;
}

we get the different errno. The 64 progress we get errno is -14 while
the 32 progress is -21.

The reason is that, the user progress would use a 32bit count, while
the sys_read size_t in kernel is 64bit.  When the uesrspace count is
-1(0x), it goes to the sys_read, it would be change to a positive
number.

So I think we should add a compat_sys_read for the read syscall. I test it
on x86 or arm64 platform. The patch works well.

As well this patch may do work for the 'tile' 64 system.
I think it may enter the same result on mips/parisc/powerpc/sparc.
The s390 do the compat_sys_s390_read for the compat sys_read.

Signed-off-by: Weidong Wang 
---
 arch/x86/entry/syscalls/syscall_32.tbl | 2 +-
 fs/read_write.c| 8 
 include/linux/compat.h | 2 ++
 include/uapi/asm-generic/unistd.h  | 2 +-
 4 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/x86/entry/syscalls/syscall_32.tbl 
b/arch/x86/entry/syscalls/syscall_32.tbl
index 4cddd17..ebc24e3 100644
--- a/arch/x86/entry/syscalls/syscall_32.tbl
+++ b/arch/x86/entry/syscalls/syscall_32.tbl
@@ -9,7 +9,7 @@
 0  i386restart_syscall sys_restart_syscall
 1  i386exitsys_exit
 2  i386forksys_forksys_fork
-3  i386readsys_read
+3  i386readsys_read
compat_sys_read
 4  i386write   sys_write
 5  i386opensys_open
compat_sys_open
 6  i386close   sys_close
diff --git a/fs/read_write.c b/fs/read_write.c
index 933b53a..d244848 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -613,6 +613,14 @@ SYSCALL_DEFINE3(write, unsigned int, fd, const char __user 
*, buf,
return ret;
 }

+#ifdef CONFIG_COMPAT
+COMPAT_SYSCALL_DEFINE3(read, unsigned int, fd, char __user *, buf,
+   compat_size_t, count)
+{
+return sys_read(fd, buf, (compat_ssize_t)count);
+}
+#endif
+
 SYSCALL_DEFINE4(pread64, unsigned int, fd, char __user *, buf,
size_t, count, loff_t, pos)
 {
diff --git a/include/linux/compat.h b/include/linux/compat.h
index f964ef7..d88ccad 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -332,6 +332,8 @@ asmlinkage long compat_sys_keyctl(u32 option,
  u32 arg2, u32 arg3, u32 arg4, u32 arg5);
 asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user 
*u32);

+asmlinkage ssize_t compat_sys_read(unsigned int fd,
+   char __user * buf, compat_size_t count);
 asmlinkage ssize_t compat_sys_readv(compat_ulong_t fd,
const struct compat_iovec __user *vec, compat_ulong_t vlen);
 asmlinkage ssize_t compat_sys_writev(compat_ulong_t fd,
diff --git a/include/uapi/asm-generic/unistd.h 
b/include/uapi/asm-generic/unistd.h
index a26415b..745818a 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -201,7 +201,7 @@ __SC_COMP(__NR_getdents64, sys_getdents64, 
compat_sys_getdents64)
 #define __NR3264_lseek 62
 __SC_3264(__NR3264_lseek, sys_llseek, sys_lseek)
 #define __NR_read 63
-__SYSCALL(__NR_read, sys_read)
+__SC_COMP(__NR_read, sys_read, compat_sys_read)
 #define __NR_write 64
 __SYSCALL(__NR_write, sys_write)
 #define __NR_readv 65
-- 
2.7.0




Re: [PATCH v14.1 01/17] drm: bridge: analogix/dp: split exynos dp driver to bridge directory

2016-06-07 Thread Yakir Yang

Hi Javier,

On 06/08/2016 01:06 AM, Javier Martinez Canillas wrote:

Hello Yakir,

On 03/17/2016 05:47 PM, Heiko Stübner wrote:

Split the dp core driver from exynos directory to bridge directory,
and rename the core driver to analogix_dp_*, rename the platform
code to exynos_dp.

Beside the new analogix_dp driver would export six hooks.
"analogix_dp_bind()" and "analogix_dp_unbind()"
"analogix_dp_suspned()" and "analogix_dp_resume()"
"analogix_dp_detect()" and "analogix_dp_get_modes()"

The bind/unbind symbols is used for analogix platform driver to connect
with analogix_dp core driver. And the detect/get_modes is used for analogix
platform driver to init the connector.

They reason why connector need register in helper driver is rockchip drm
haven't implement the atomic API, but Exynos drm have implement it, so
there would need two different connector helper functions, that's why we
leave the connector register in helper driver.

Signed-off-by: Yakir Yang 
---

Marc reported that his Exynos5250 Snow Chromebook fails to boot with v4.7-rc.

I've done a git bisect and tracked down to this commit. The problem is a NULL
pointer dereference to connector->dev in drm_mode_create(connector->dev) when
called from exynos_dp_get_modes(). The error log is at [1].

I'm trying to figure out the issue but wanted to mention in case you have any
hints about what could be the cause. AFAICT the problem is related to the fact
that drm_connector_init() is called in analogix_dp_bridge_attach() and the
connector passed as argument is the one in struct analogix_dp_device *dp, but
later exynos_dp_get_modes() calls drm_mode_create() passing the connector in
struct exynos_dp_device *dp, which has not been previously initialized.


Agree, this should be the problem, exynos_dp->connector haven't been
initialized, driver should make exynos_dp->dp to a connector point, and
record the passing connector in exynos_dp_bridge_attach(), that should
fix this problem.


Thanks,
- Yakir


diff --git a/drivers/gpu/drm/exynos/exynos_dp.c 
b/drivers/gpu/drm/exynos/exynos_dp.c

index 468498e..4c1fb3f 100644
--- a/drivers/gpu/drm/exynos/exynos_dp.c
+++ b/drivers/gpu/drm/exynos/exynos_dp.c
@@ -34,7 +34,7 @@

 struct exynos_dp_device {
struct drm_encoder encoder;
-   struct drm_connector   connector;
+   struct drm_connector   *connector;
struct drm_bridge  *ptn_bridge;
struct drm_device  *drm_dev;
struct device  *dev;
@@ -70,7 +70,7 @@ static int exynos_dp_poweroff(struct 
analogix_dp_plat_data *plat_data)

 static int exynos_dp_get_modes(struct analogix_dp_plat_data *plat_data)
 {
struct exynos_dp_device *dp = to_dp(plat_data);
-   struct drm_connector *connector = >connector;
+   struct drm_connector *connector = dp->connector;
struct drm_display_mode *mode;
int num_modes = 0;

@@ -103,6 +103,7 @@ static int exynos_dp_bridge_attach(struct 
analogix_dp_plat_data *plat_data,

int ret;

drm_connector_register(connector);
+   dp->connector = connector;

/* Pre-empt DP connector creation if there's a bridge */
if (dp->ptn_bridge) {



[1]
[4.175676] Unable to handle kernel NULL pointer dereference at virtual 
address 0210
[4.182793] pgd = c0004000
[4.185171] [0210] *pgd=
[4.188657] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
[4.194164] Modules linked in:
[4.196964] CPU: 1 PID: 68 Comm: kworker/1:1 Not tainted 
4.7.0-rc2-next-20160606-6-g876c3150327a #97
[4.206565] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[4.212582] Workqueue: events hdmi_hotplug_work_func
[4.217383] task: ed758000 ti: ed75c000 task.ti: ed75c000
[4.222887] PC is at __mutex_lock_slowpath+0x6c/0x404
[4.227913] LR is at preempt_count_add+0xa4/0x140
[4.232592] pc : []lr : []psr: 6093
[4.232592] sp : ed75dd80  ip :   fp : ee8c1180
[4.244193] r10: 0300  r9 : ed758000  r8 : 0001
[4.249262] r7 : 6013  r6 : c0b473a8  r5 : 0210  r4 : 020c
[4.261955] r3 :   r2 : 0001  r1 : ee8c2808  r0 : 
[4.273270] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment 
none
[4.285336] Control: 10c5387d  Table: 4000406a  DAC: 0051
[4.295885] Process kworker/1:1 (pid: 68, stack limit = 0xed75c210)
[4.306979] Stack: (0xed75dd80 to 0xed75e000)
[4.316102] dd80: ee8c1180 c03dd21c ee8f0820 0001 020c 020c 
 
[4.329201] dda0: 0001 dededede 0300 c06d2578 ee8c2808 c03d00f4 
ee801d80 c0b0261c
[4.342362] ddc0: 0041 ee8c2800  0001 ee8f0810 ee8f0b65 
c074d2b4 c03d35b0
[4.353140] dde0:  0300 ee8c1180 c03d81d0 c387cf74 ee8f0820 
0001 c03eaffc
[4.361811] de00:  ee8f0820 0001 c03f28bc ee8f0b65 c06d400c 
ee8c1180 006d40a4
[4.370483] de20:  01820a11 81010300 0100 

linux-next: manual merge of the net-next tree with the net tree

2016-06-07 Thread Stephen Rothwell
Hi all,

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

  net/sched/act_police.c

between commit:

  53eb440f4ada ("net sched actions: introduce timestamp for firsttime use")

from the net tree and commit:

  a03e6fe56971 ("act_police: fix a crash during removal")

from the net-next tree.

I fixed it up (I think that the firstuse zero initialisation has become
redundant, so I just removed it) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell


Re: [PATCH v13 02/10] arm64: Add more test functions to insn.c

2016-06-07 Thread Masami Hiramatsu
On Thu,  2 Jun 2016 23:26:16 -0400
David Long  wrote:
> @@ -367,6 +402,7 @@ bool aarch32_insn_is_wide(u32 insn);
>  #define A32_RT_OFFSET12
>  #define A32_RT2_OFFSET0
>  
> +u32 aarch64_extract_system_register(u32 insn);

This exported symbol is incorrect (see below)

>  u32 aarch32_insn_extract_reg_num(u32 insn, int offset);
>  u32 aarch32_insn_mcr_extract_opc2(u32 insn);
>  u32 aarch32_insn_mcr_extract_crm(u32 insn);
> diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c
> index 368c082..28c6110f 100644
> --- a/arch/arm64/kernel/insn.c
> +++ b/arch/arm64/kernel/insn.c
[..]
> @@ -1175,6 +1201,14 @@ u32 aarch64_set_branch_offset(u32 insn, s32 offset)
>   BUG();
>  }
>  
> +/*
> + * Extract the Op/CR data from a msr/mrs instruction.
> + */
> +u32 aarch64_insn_extract_system_reg(u32 insn)
> +{
> + return (insn & 0x1FFFE0) >> 5;
> +}
> +

aarch64_insn_extract_system_reg() is the right name :)

Thank you,


>  bool aarch32_insn_is_wide(u32 insn)
>  {
>   return insn >= 0xe800;
> -- 
> 2.5.0
> 


-- 
Masami Hiramatsu 


Re: [PATCH 4.6 000/121] 4.6.2-stable review

2016-06-07 Thread Greg Kroah-Hartman
On Tue, Jun 07, 2016 at 06:40:54AM -0700, Guenter Roeck wrote:
> On 06/05/2016 02:42 PM, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.6.2 release.
> > There are 121 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> > 
> > Responses should be made by Tue Jun  7 21:43:16 UTC 2016.
> > Anything received after that time might be too late.
> > 
> 
> Build results:
>   total: 148 pass: 132 fail: 16
> Failed builds:
>   mips:defconfig (binutils 2.22)
>   mips:allnoconfig
>   mips:defconfig (binutils 2.24)
>   mips:allmodconfig
>   mips:allnoconfig
>   mips:bcm47xx_defconfig (binutils 2.25)
>   mips:bcm63xx_defconfig
>   mips:nlm_xlp_defconfig
>   mips:ath79_defconfig
>   mips:ar7_defconfig
>   mips:e55_defconfig
>   mips:cavium_octeon_defconfig
>   mips:malta_defconfig
>   mips:defconfig
>   unicore32:defconfig
>   unicore32:allnoconfig
> 
> Qemu test results:
>   total: 107 pass: 98 fail: 9
> Failed tests:
>   mips:malta_defconfig:nosmp
>   mips:malta_defconfig:smp
>   mips64:malta_defconfig:nosmp
>   mips64:malta_defconfig:smp
>   mipsel:malta_defconfig:nosmp
>   mipsel:malta_defconfig:smp
>   mips64el:malta_defconfig:nosmp
>   mips64el:malta_defconfig:smp
>   mips64el:fuloong2e_defconfig:fulong2e
> 
> Details are available at http://kerneltests.org/builders.

Thanks for these, I think I've fixed them all now.

greg k-h


Re: [PATCH v13 05/10] arm64: Kprobes with single stepping support

2016-06-07 Thread Masami Hiramatsu
On Thu,  2 Jun 2016 23:26:19 -0400
David Long  wrote:

> From: Sandeepa Prabhu 
> 
> Add support for basic kernel probes(kprobes) and jump probes
> (jprobes) for ARM64.
> 
> Kprobes utilizes software breakpoint and single step debug
> exceptions supported on ARM v8.
> 
> A software breakpoint is placed at the probe address to trap the
> kernel execution into the kprobe handler.
> 
> ARM v8 supports enabling single stepping before the break exception
> return (ERET), with next PC in exception return address (ELR_EL1). The
> kprobe handler prepares an executable memory slot for out-of-line
> execution with a copy of the original instruction being probed, and
> enables single stepping. The PC is set to the out-of-line slot address
> before the ERET. With this scheme, the instruction is executed with the
> exact same register context except for the PC (and DAIF) registers.
> 
> Debug mask (PSTATE.D) is enabled only when single stepping a recursive
> kprobe, e.g.: during kprobes reenter so that probed instruction can be
> single stepped within the kprobe handler -exception- context.
> The recursion depth of kprobe is always 2, i.e. upon probe re-entry,
> any further re-entry is prevented by not calling handlers and the case
> counted as a missed kprobe).
> 
> Single stepping from the x-o-l slot has a drawback for PC-relative accesses
> like branching and symbolic literals access as the offset from the new PC
> (slot address) may not be ensured to fit in the immediate value of
> the opcode. Such instructions need simulation, so reject
> probing them.
> 
> Instructions generating exceptions or cpu mode change are rejected
> for probing.
> 
> Exclusive load/store instructions are rejected too.  Additionally, the
> code is checked to see if it is inside an exclusive load/store sequence
> (code from Pratyush).
> 
> System instructions are mostly enabled for stepping, except MSR/MRS
> accesses to "DAIF" flags in PSTATE, which are not safe for
> probing.
> 
> Thanks to Steve Capper and Pratyush Anand for several suggested
> Changes.

Basically looks good to me.
I have some trivial comments.

> 
> Signed-off-by: Sandeepa Prabhu 
> Signed-off-by: David A. Long 
> Signed-off-by: Pratyush Anand 
> ---
>  arch/arm64/Kconfig  |   1 +
>  arch/arm64/include/asm/debug-monitors.h |   5 +
>  arch/arm64/include/asm/insn.h   |   4 +-
>  arch/arm64/include/asm/kprobes.h|  60 
>  arch/arm64/include/asm/probes.h |  44 +++
>  arch/arm64/kernel/Makefile  |   1 +
>  arch/arm64/kernel/debug-monitors.c  |  18 +-
>  arch/arm64/kernel/kprobes-arm64.c   | 144 +
>  arch/arm64/kernel/kprobes-arm64.h   |  35 +++
>  arch/arm64/kernel/kprobes.c | 526 
> 

Not sure why kprobes.c and kprobes-arm64.c are splitted.


>  arch/arm64/kernel/vmlinux.lds.S |   1 +
>  arch/arm64/mm/fault.c   |  27 +-
>  12 files changed, 861 insertions(+), 5 deletions(-)
>  create mode 100644 arch/arm64/include/asm/kprobes.h
>  create mode 100644 arch/arm64/include/asm/probes.h
>  create mode 100644 arch/arm64/kernel/kprobes-arm64.c
>  create mode 100644 arch/arm64/kernel/kprobes-arm64.h
>  create mode 100644 arch/arm64/kernel/kprobes.c
> 
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 0f7a624..5496b75 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -88,6 +88,7 @@ config ARM64
>   select HAVE_REGS_AND_STACK_ACCESS_API
>   select HAVE_RCU_TABLE_FREE
>   select HAVE_SYSCALL_TRACEPOINTS
> + select HAVE_KPROBES
>   select IOMMU_DMA if IOMMU_SUPPORT
>   select IRQ_DOMAIN
>   select IRQ_FORCED_THREADING
> diff --git a/arch/arm64/include/asm/debug-monitors.h 
> b/arch/arm64/include/asm/debug-monitors.h
> index 2fcb9b7..4b6b3f7 100644
> --- a/arch/arm64/include/asm/debug-monitors.h
> +++ b/arch/arm64/include/asm/debug-monitors.h
> @@ -66,6 +66,11 @@
>  
>  #define CACHE_FLUSH_IS_SAFE  1
>  
> +/* kprobes BRK opcodes with ESR encoding  */
> +#define BRK64_ESR_MASK   0x
> +#define BRK64_ESR_KPROBES0x0004
> +#define BRK64_OPCODE_KPROBES (AARCH64_BREAK_MON | (BRK64_ESR_KPROBES << 5))
> +
>  /* AArch32 */
>  #define DBG_ESR_EVT_BKPT 0x4
>  #define DBG_ESR_EVT_VECC 0x5
> diff --git a/arch/arm64/include/asm/insn.h b/arch/arm64/include/asm/insn.h
> index 98e4edd..be2d2b9 100644
> --- a/arch/arm64/include/asm/insn.h
> +++ b/arch/arm64/include/asm/insn.h
> @@ -253,6 +253,8 @@ __AARCH64_INSN_FUNCS(ldr_reg, 0x3FE0EC00, 0x38606800)
>  __AARCH64_INSN_FUNCS(ldr_lit,0xBF00, 0x1800)
>  __AARCH64_INSN_FUNCS(ldrsw_lit,  0xFF00, 0x9800)
>  __AARCH64_INSN_FUNCS(exclusive,  0x3F80, 0x0800)
> +__AARCH64_INSN_FUNCS(load_ex,0x3F40, 0x0840)
> +__AARCH64_INSN_FUNCS(store_ex,   

Re: [PATCH 4.4 00/99] 4.4.13-stable review

2016-06-07 Thread Greg Kroah-Hartman
On Mon, Jun 06, 2016 at 09:07:10PM -0700, Guenter Roeck wrote:
> mips failures (affecting 4.4, 4.5, 4,6):
> 
> arch/mips/mm/cache.c: In function '__update_cache':
> arch/mips/mm/cache.c:134:4: error: implicit declaration of function 
> 'kmap_atomic' [-Werror=implicit-function-declaration]
> arch/mips/mm/cache.c:142:4: error: implicit declaration of function 
> '__kunmap_atomic'
> 
> Seems to be casued by 'MIPS: Handle highmem pages in __update_cache', which 
> can not
> be easily reverted. The same problem was seen in 4.1; Sasha had solved it, 
> but I
> don't know how. Sasha, can you help out ?

Looks like he included commit 234859e49a15 ("MIPS: Flush highmem pages
in __flush_dcache_page") so I've queued that up now for these trees.

Hopefully that fixes the issues...

thanks,

greg k-h


[PATCH v2 5/5] mfd: rn5t618: register restart handler

2016-06-07 Thread Stefan Agner
Use the PMIC's repower capability for reboots. Register a restart
handler with use a default priority of 128.

Reviewed-by: Marcel Ziswiler 
Signed-off-by: Stefan Agner 
---
 drivers/mfd/rn5t618.c | 40 ++--
 1 file changed, 34 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/rn5t618.c b/drivers/mfd/rn5t618.c
index d9b4d40..6bc0863 100644
--- a/drivers/mfd/rn5t618.c
+++ b/drivers/mfd/rn5t618.c
@@ -12,11 +12,13 @@
  * along with this program. If not, see .
  */
 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 static const struct mfd_cell rn5t618_cells[] = {
@@ -50,17 +52,34 @@ static const struct regmap_config rn5t618_regmap_config = {
 };
 
 static struct rn5t618 *rn5t618_pm_power_off;
+static struct notifier_block rn5t618_restart_handler;
 
-static void rn5t618_power_off(void)
+static void rn5t618_trigger_poweroff_sequence(bool repower)
 {
/* disable automatic repower-on */
regmap_update_bits(rn5t618_pm_power_off->regmap, RN5T618_REPCNT,
-  RN5T618_REPCNT_REPWRON, 0);
+  RN5T618_REPCNT_REPWRON, repower);
/* start power-off sequence */
regmap_update_bits(rn5t618_pm_power_off->regmap, RN5T618_SLPCNT,
   RN5T618_SLPCNT_SWPWROFF, RN5T618_SLPCNT_SWPWROFF);
 }
 
+static void rn5t618_power_off(void)
+{
+   rn5t618_trigger_poweroff_sequence(false);
+}
+
+static int rn5t618_restart(struct notifier_block *this,
+   unsigned long mode, void *cmd)
+{
+   rn5t618_trigger_poweroff_sequence(true);
+
+   mdelay(10);
+
+   return NOTIFY_DONE;
+}
+
+
 static const struct of_device_id rn5t618_of_match[] = {
{ .compatible = "ricoh,rn5t567", .data = (void *)RN5T567 },
{ .compatible = "ricoh,rn5t618", .data = (void *)RN5T618 },
@@ -103,13 +122,22 @@ static int rn5t618_i2c_probe(struct i2c_client *i2c,
return ret;
}
 
+   rn5t618_pm_power_off = priv;
if (of_device_is_system_power_controller(i2c->dev.of_node)) {
-   if (!pm_power_off) {
-   rn5t618_pm_power_off = priv;
+   if (!pm_power_off)
pm_power_off = rn5t618_power_off;
-   } else {
+   else
dev_err(>dev, "Failed to set poweroff capability, 
already defined\n");
-   }
+   }
+
+   rn5t618_restart_handler.notifier_call = rn5t618_restart;
+   rn5t618_restart_handler.priority = 128;
+
+   ret = register_restart_handler(_restart_handler);
+   if (ret) {
+   dev_err(>dev, "%s: cannot register restart handler, %d\n",
+   __func__, ret);
+   return ret;
}
 
return 0;
-- 
2.8.3



[PATCH v2 4/5] mfd: rn5t618: register power off callback optionally

2016-06-07 Thread Stefan Agner
Only register power off if the PMIC is defined as system power
controller (see Documentation/devicetree/bindings/power/
power-controller.txt).

Reviewed-by: Marcel Ziswiler 
Signed-off-by: Stefan Agner 
---
 drivers/mfd/rn5t618.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/rn5t618.c b/drivers/mfd/rn5t618.c
index 7607ced..d9b4d40 100644
--- a/drivers/mfd/rn5t618.c
+++ b/drivers/mfd/rn5t618.c
@@ -103,9 +103,13 @@ static int rn5t618_i2c_probe(struct i2c_client *i2c,
return ret;
}
 
-   if (!pm_power_off) {
-   rn5t618_pm_power_off = priv;
-   pm_power_off = rn5t618_power_off;
+   if (of_device_is_system_power_controller(i2c->dev.of_node)) {
+   if (!pm_power_off) {
+   rn5t618_pm_power_off = priv;
+   pm_power_off = rn5t618_power_off;
+   } else {
+   dev_err(>dev, "Failed to set poweroff capability, 
already defined\n");
+   }
}
 
return 0;
-- 
2.8.3



[PATCH v2 1/5] ARM: dts: meson: minix-neo-x8: define PMIC as power controller

2016-06-07 Thread Stefan Agner
The PMIC driver used to register itself as poweroff controller by
default, hence assuming that this device is using the PMIC as
system power controller.

Reviewed-by: Marcel Ziswiler 
Signed-off-by: Stefan Agner 
---
 arch/arm/boot/dts/meson8-minix-neo-x8.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/meson8-minix-neo-x8.dts 
b/arch/arm/boot/dts/meson8-minix-neo-x8.dts
index 4f536bb..8bceb8d 100644
--- a/arch/arm/boot/dts/meson8-minix-neo-x8.dts
+++ b/arch/arm/boot/dts/meson8-minix-neo-x8.dts
@@ -80,6 +80,7 @@
pmic@32 {
compatible = "ricoh,rn5t618";
reg = <0x32>;
+   system-power-controller;
 
regulators {
};
-- 
2.8.3



[PATCH v2 3/5] regulator: rn5t618: add RN5T567 PMIC support

2016-06-07 Thread Stefan Agner
Extend the driver to support Ricoh RN5T567. Support the additional
DCDC and slightly different voltage range of LDORTC1.

Reviewed-by: Marcel Ziswiler 
Acked-by: Mark Brown 
Signed-off-by: Stefan Agner 
---
 drivers/regulator/Kconfig |  5 +++--
 drivers/regulator/rn5t618-regulator.c | 40 +++
 include/linux/mfd/rn5t618.h   |  1 +
 3 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 144cbf5..5472694 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -636,10 +636,11 @@ config REGULATOR_RK808
  outputs which can be controlled by i2c communication.
 
 config REGULATOR_RN5T618
-   tristate "Ricoh RN5T618 voltage regulators"
+   tristate "Ricoh RN5T567/618 voltage regulators"
depends on MFD_RN5T618
help
- Say y here to support the regulators found on Ricoh RN5T618 PMIC.
+ Say y here to support the regulators found on Ricoh RN5T567 or
+ RN5T618 PMIC.
 
 config REGULATOR_RT5033
tristate "Richtek RT5033 Regulators"
diff --git a/drivers/regulator/rn5t618-regulator.c 
b/drivers/regulator/rn5t618-regulator.c
index b85ceb8..9c930eb 100644
--- a/drivers/regulator/rn5t618-regulator.c
+++ b/drivers/regulator/rn5t618-regulator.c
@@ -46,6 +46,23 @@ static struct regulator_ops rn5t618_reg_ops = {
.vsel_mask  = (vmask),  \
}
 
+static struct regulator_desc rn5t567_regulators[] = {
+   /* DCDC */
+   REG(DCDC1, DC1CTL, BIT(0), DC1DAC, 0xff, 60, 350, 12500),
+   REG(DCDC2, DC2CTL, BIT(0), DC2DAC, 0xff, 60, 350, 12500),
+   REG(DCDC3, DC3CTL, BIT(0), DC3DAC, 0xff, 60, 350, 12500),
+   REG(DCDC4, DC4CTL, BIT(0), DC4DAC, 0xff, 60, 350, 12500),
+   /* LDO */
+   REG(LDO1, LDOEN1, BIT(0), LDO1DAC, 0x7f, 90, 350, 25000),
+   REG(LDO2, LDOEN1, BIT(1), LDO2DAC, 0x7f, 90, 350, 25000),
+   REG(LDO3, LDOEN1, BIT(2), LDO3DAC, 0x7f, 60, 350, 25000),
+   REG(LDO4, LDOEN1, BIT(3), LDO4DAC, 0x7f, 90, 350, 25000),
+   REG(LDO5, LDOEN1, BIT(4), LDO5DAC, 0x7f, 90, 350, 25000),
+   /* LDO RTC */
+   REG(LDORTC1, LDOEN2, BIT(4), LDORTCDAC, 0x7f, 120, 350, 25000),
+   REG(LDORTC2, LDOEN2, BIT(5), LDORTC2DAC, 0x7f, 90, 350, 25000),
+};
+
 static struct regulator_desc rn5t618_regulators[] = {
/* DCDC */
REG(DCDC1, DC1CTL, BIT(0), DC1DAC, 0xff, 60, 350, 12500),
@@ -67,18 +84,33 @@ static int rn5t618_regulator_probe(struct platform_device 
*pdev)
struct rn5t618 *rn5t618 = dev_get_drvdata(pdev->dev.parent);
struct regulator_config config = { };
struct regulator_dev *rdev;
+   struct regulator_desc *regulators;
int i;
 
+   switch (rn5t618->variant) {
+   case RN5T567:
+   regulators = rn5t567_regulators;
+   break;
+   case RN5T618:
+   regulators = rn5t618_regulators;
+   break;
+   default:
+   return -EINVAL;
+   }
+
+   config.dev = pdev->dev.parent;
+   config.regmap = rn5t618->regmap;
+
for (i = 0; i < RN5T618_REG_NUM; i++) {
-   config.dev = pdev->dev.parent;
-   config.regmap = rn5t618->regmap;
+   if (!regulators[i].name)
+   continue;
 
rdev = devm_regulator_register(>dev,
-  _regulators[i],
+  [i],
   );
if (IS_ERR(rdev)) {
dev_err(>dev, "failed to register %s regulator\n",
-   rn5t618_regulators[i].name);
+   regulators[i].name);
return PTR_ERR(rdev);
}
}
diff --git a/include/linux/mfd/rn5t618.h b/include/linux/mfd/rn5t618.h
index 54179c2..cadc654 100644
--- a/include/linux/mfd/rn5t618.h
+++ b/include/linux/mfd/rn5t618.h
@@ -217,6 +217,7 @@ enum {
RN5T618_DCDC1,
RN5T618_DCDC2,
RN5T618_DCDC3,
+   RN5T618_DCDC4,
RN5T618_LDO1,
RN5T618_LDO2,
RN5T618_LDO3,
-- 
2.8.3



[PATCH v2 0/5] regulator: add Ricoh RN5T567 PMIC support

2016-06-07 Thread Stefan Agner
This patchset adds RN5T567 PMIC support which is used on the 
Toradex Colibri iMX7S/iMX7D modules. The existing RN5T618 is from
the same family, hence this patchset uses the same driver and adds
variant support.

The Colibris currently do not use the PMIC's power off capabilities,
hence this patchset also makes the use of system-power-controller
property mandatory if the power off capabilties are required.

Changes since v1:
- Removed obsolete include 

Stefan Agner (5):
  ARM: dts: meson: minix-neo-x8: define PMIC as power controller
  mfd: add Ricoh RN5T567 PMIC support
  regulator: rn5t618: add RN5T567 PMIC support
  mfd: rn5t618: register power off callback optionally
  mfd: rn5t618: register restart handler

 Documentation/devicetree/bindings/mfd/rn5t618.txt | 19 ---
 arch/arm/boot/dts/meson8-minix-neo-x8.dts |  1 +
 drivers/mfd/Kconfig   |  7 ++-
 drivers/mfd/rn5t618.c | 68 +++
 drivers/regulator/Kconfig |  5 +-
 drivers/regulator/rn5t618-regulator.c | 40 +++--
 include/linux/mfd/rn5t618.h   | 13 +
 7 files changed, 124 insertions(+), 29 deletions(-)

-- 
2.8.3



[PATCH v2 2/5] mfd: add Ricoh RN5T567 PMIC support

2016-06-07 Thread Stefan Agner
The Ricoh RN5T567 is from the same family as the Ricoh RN5T618 is,
the differences are:

+ DCDC4
+ Slightly different output voltage/currents
+ 32kHz Output
- ADC/Charger capabilities

Reviewed-by: Marcel Ziswiler 
Signed-off-by: Stefan Agner 
---
 Documentation/devicetree/bindings/mfd/rn5t618.txt | 19 ++---
 drivers/mfd/Kconfig   |  7 +++---
 drivers/mfd/rn5t618.c | 26 +--
 include/linux/mfd/rn5t618.h   | 12 +++
 4 files changed, 46 insertions(+), 18 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/rn5t618.txt 
b/Documentation/devicetree/bindings/mfd/rn5t618.txt
index 937785a..5b493ed 100644
--- a/Documentation/devicetree/bindings/mfd/rn5t618.txt
+++ b/Documentation/devicetree/bindings/mfd/rn5t618.txt
@@ -1,18 +1,21 @@
-* Ricoh RN5T618 PMIC
+* Ricoh RN5T567/RN5T618 PMIC
 
-Ricoh RN5T618 is a power management IC which integrates 3 step-down
-DCDC converters, 7 low-dropout regulators, a Li-ion battery charger,
-fuel gauge, ADC, GPIOs and a watchdog timer. It can be controlled
-through a I2C interface.
+Ricoh RN5T567/RN5T618 is a power management IC family which integrates
+3 to 5 step-down DCDC converters, 7 low-dropout regulators, GPIOs and
+a watchdog timer. The RN5T618 provides additionally a Li-ion battery
+charger, fuel gauge and an ADC. It can be controlled through a I2C
+interface.
 
 Required properties:
- - compatible: should be "ricoh,rn5t618"
+ - compatible: must be one of
+   "ricoh,rn5t567"
+   "ricoh,rn5t618"
  - reg: the I2C slave address of the device
 
 Sub-nodes:
  - regulators: the node is required if the regulator functionality is
-   needed. The valid regulator names are: DCDC1, DCDC2, DCDC3, LDO1,
-   LDO2, LDO3, LDO4, LDO5, LDORTC1 and LDORTC2.
+   needed. The valid regulator names are: DCDC1, DCDC2, DCDC3, DCDC4
+   (RN5T567), LDO1, LDO2, LDO3, LDO4, LDO5, LDORTC1 and LDORTC2.
The common bindings for each individual regulator can be found in:
Documentation/devicetree/bindings/regulator/regulator.txt
 
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 1bcf601..ff031a7 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -852,13 +852,14 @@ config MFD_RK808
  including interrupts, RTC, LDO & DCDC regulators, and onkey.
 
 config MFD_RN5T618
-   tristate "Ricoh RN5T5618 PMIC"
+   tristate "Ricoh RN5T567/618 PMIC"
depends on I2C
+   depends on OF
select MFD_CORE
select REGMAP_I2C
help
- Say yes here to add support for the Ricoh RN5T618 PMIC. This
- driver provides common support for accessing the device,
+ Say yes here to add support for the Ricoh RN5T567 or R5T618 PMIC.
+ This driver provides common support for accessing the device,
  additional drivers must be enabled in order to use the
  functionality of the device.
 
diff --git a/drivers/mfd/rn5t618.c b/drivers/mfd/rn5t618.c
index 0ad51d7..7607ced 100644
--- a/drivers/mfd/rn5t618.c
+++ b/drivers/mfd/rn5t618.c
@@ -2,6 +2,7 @@
  * MFD core driver for Ricoh RN5T618 PMIC
  *
  * Copyright (C) 2014 Beniamino Galvani 
+ * Copyright (C) 2016 Toradex AG
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -15,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 static const struct mfd_cell rn5t618_cells[] = {
@@ -59,12 +61,26 @@ static void rn5t618_power_off(void)
   RN5T618_SLPCNT_SWPWROFF, RN5T618_SLPCNT_SWPWROFF);
 }
 
+static const struct of_device_id rn5t618_of_match[] = {
+   { .compatible = "ricoh,rn5t567", .data = (void *)RN5T567 },
+   { .compatible = "ricoh,rn5t618", .data = (void *)RN5T618 },
+   { }
+};
+MODULE_DEVICE_TABLE(of, rn5t618_of_match);
+
 static int rn5t618_i2c_probe(struct i2c_client *i2c,
 const struct i2c_device_id *id)
 {
+   const struct of_device_id *of_id =
+   of_match_device(rn5t618_of_match, >dev);
struct rn5t618 *priv;
int ret;
 
+   if (!of_id) {
+   dev_err(>dev, "Failed to find matching dt id\n");
+   return -EINVAL;
+   }
+
priv = devm_kzalloc(>dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
@@ -78,6 +94,8 @@ static int rn5t618_i2c_probe(struct i2c_client *i2c,
return ret;
}
 
+   priv->variant = (long)of_id->data;
+
ret = devm_mfd_add_devices(>dev, -1, rn5t618_cells,
   ARRAY_SIZE(rn5t618_cells), NULL, 0, NULL);
if (ret) {
@@ -105,12 +123,6 @@ static int rn5t618_i2c_remove(struct i2c_client *i2c)
return 0;
 }
 
-static const struct of_device_id rn5t618_of_match[] = {
-   { .compatible = "ricoh,rn5t618" },

Re: [PATCH 3/5] lkdtm: add function for testing .rodata section

2016-06-07 Thread Laura Abbott

On 06/07/2016 02:57 PM, Kees Cook wrote:

This adds a function that lives in the .rodata section. The section
flags are corrected using objcopy since there is no way with gcc to
declare section flags in an architecture-agnostic way.



Permit me to be the bearer of bad architecture news once again. With
arm64 cross compiler (both Fedora 6.1.1 and Linaro 5.1)

  CC  drivers/misc/lkdtm_rodata.o
  OBJCOPY drivers/misc/lkdtm_rodata_objcopy.o
  LD  drivers/misc/lkdtm.o
drivers/misc/lkdtm_rodata_objcopy.o: file not recognized: File format not 
recognized
scripts/Makefile.build:423: recipe for target 'drivers/misc/lkdtm.o' failed
make[2]: *** [drivers/misc/lkdtm.o] Error 1
scripts/Makefile.build:440: recipe for target 'drivers/misc' failed
make[1]: *** [drivers/misc] Error 2
Makefile:985: recipe for target 'drivers' failed
make: *** [drivers] Error 2


As far as I can tell this is because arm64 defines OBJCOPYFLAGS and they get
propagated to objcopy

aarch64-linux-gnu-objcopy -O binary -R .note -R .note.gnu.build-id -R .comment
-S --set-section-flags .text=alloc,readonly
--rename-section .text=.rodata drivers/misc/lkdtm_rodata.o 
drivers/misc/lkdtm_rodata_objcopy.o

vs x86

objcopy  --set-section-flags .text=alloc,readonly --rename-section .text=.rodata
drivers/misc/lkdtm_rodata.o drivers/misc/lkdtm_rodata_objcopy.o


specifically it's the -O binary that seems to break things, the same failure
happens on x86 as well with the the same commands. It works if I clear out
the OBJCOPYFLAGS variable first but I don't think that's the correct way to
fix this.

Thanks,
Laura


Signed-off-by: Kees Cook 
---
 drivers/misc/Makefile   |  7 +++
 drivers/misc/lkdtm.h|  6 ++
 drivers/misc/lkdtm_core.c   | 24 +---
 drivers/misc/lkdtm_rodata.c | 10 ++
 4 files changed, 40 insertions(+), 7 deletions(-)
 create mode 100644 drivers/misc/lkdtm.h
 create mode 100644 drivers/misc/lkdtm_rodata.c

diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index c3cb6ad8cc37..b2d3d68dfa22 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -59,3 +59,10 @@ obj-$(CONFIG_CXL_BASE)   += cxl/
 obj-$(CONFIG_PANEL) += panel.o

 lkdtm-$(CONFIG_LKDTM)  += lkdtm_core.o
+lkdtm-$(CONFIG_LKDTM)  += lkdtm_rodata_objcopy.o
+
+OBJCOPYFLAGS_lkdtm_rodata_objcopy.o := \
+   --set-section-flags .text=alloc,readonly \
+   --rename-section .text=.rodata
+$(obj)/lkdtm_rodata_objcopy.o: $(obj)/lkdtm_rodata.o
+   $(call if_changed,objcopy)
diff --git a/drivers/misc/lkdtm.h b/drivers/misc/lkdtm.h
new file mode 100644
index ..9531fa3be4c3
--- /dev/null
+++ b/drivers/misc/lkdtm.h
@@ -0,0 +1,6 @@
+#ifndef __LKDTM_H
+#define __LKDTM_H
+
+void lkdtm_rodata_do_nothing(void);
+
+#endif
diff --git a/drivers/misc/lkdtm_core.c b/drivers/misc/lkdtm_core.c
index 605050c60f10..187cd9b63e9a 100644
--- a/drivers/misc/lkdtm_core.c
+++ b/drivers/misc/lkdtm_core.c
@@ -52,6 +52,8 @@
 #include 
 #endif

+#include "lkdtm.h"
+
 /*
  * Make sure our attempts to over run the kernel stack doesn't trigger
  * a compiler warning when CONFIG_FRAME_WARN is set. Then make sure we
@@ -103,6 +105,7 @@ enum ctype {
CT_EXEC_STACK,
CT_EXEC_KMALLOC,
CT_EXEC_VMALLOC,
+   CT_EXEC_RODATA,
CT_EXEC_USERSPACE,
CT_ACCESS_USERSPACE,
CT_WRITE_RO,
@@ -145,6 +148,7 @@ static char* cp_type[] = {
"EXEC_STACK",
"EXEC_KMALLOC",
"EXEC_VMALLOC",
+   "EXEC_RODATA",
"EXEC_USERSPACE",
"ACCESS_USERSPACE",
"WRITE_RO",
@@ -346,15 +350,18 @@ static noinline void corrupt_stack(void)
memset((void *)data, 0, 64);
 }

-static void noinline execute_location(void *dst)
+static noinline void execute_location(void *dst, bool write)
 {
void (*func)(void) = dst;

pr_info("attempting ok execution at %p\n", do_nothing);
do_nothing();

-   memcpy(dst, do_nothing, EXEC_SIZE);
-   flush_icache_range((unsigned long)dst, (unsigned long)dst + EXEC_SIZE);
+   if (write) {
+   memcpy(dst, do_nothing, EXEC_SIZE);
+   flush_icache_range((unsigned long)dst,
+  (unsigned long)dst + EXEC_SIZE);
+   }
pr_info("attempting bad execution at %p\n", func);
func();
 }
@@ -551,25 +558,28 @@ static void lkdtm_do_action(enum ctype which)
schedule();
break;
case CT_EXEC_DATA:
-   execute_location(data_area);
+   execute_location(data_area, true);
break;
case CT_EXEC_STACK: {
u8 stack_area[EXEC_SIZE];
-   execute_location(stack_area);
+   execute_location(stack_area, true);
break;
}
case CT_EXEC_KMALLOC: {
u32 *kmalloc_area = kmalloc(EXEC_SIZE, GFP_KERNEL);

Re: [PATCH 4.4 00/99] 4.4.13-stable review

2016-06-07 Thread Greg Kroah-Hartman
On Mon, Jun 06, 2016 at 09:07:10PM -0700, Guenter Roeck wrote:
> 
> arm failures:
> drivers/gpio/gpio-davinci.c: In function 'davinci_gpio_probe':
> drivers/gpio/gpio-davinci.c:257:16: error: 'struct gpio_chip' has no member 
> named 'parent'
> 
> Culprit is 'gpio: davinci: fix missed parent conversion'; reverting it 
> appears to fix
> the problem. Ok, I must be missing something. Off to Greg and Linus Walleij 
> to sort out.

I've dropped this, it was a request to fix a build error, but that was
obviously wrong :(

thanks,

greg k-h


[PATCH] ARM: dts: stm32f429: Add missing USART3 pin config to STM32F469I-DISCO board

2016-06-07 Thread Bruno Herrera
This patch adds USART3 pin configuration on PB10/PA11 pins 
for STM32F469I-DISCO board.

Signed-off-by: Bruno Herrera 
---
 arch/arm/boot/dts/stm32f429.dtsi  | 13 +
 arch/arm/boot/dts/stm32f469-disco.dts |  2 ++
 2 files changed, 15 insertions(+)

diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
index 35df462..1d94eba 100644
--- a/arch/arm/boot/dts/stm32f429.dtsi
+++ b/arch/arm/boot/dts/stm32f429.dtsi
@@ -284,6 +284,19 @@
};
};
 
+   usart3_pins_a: usart3@0 {
+   pins1 {
+   pinmux = 
;
+   bias-disable;
+   drive-push-pull;
+   slew-rate = <0>;
+   };
+   pins2 {
+   pinmux = 
;
+   bias-disable;
+   };
+   };
+
usbotg_hs_pins_a: usbotg_hs@0 {
pins {
pinmux = 
,
diff --git a/arch/arm/boot/dts/stm32f469-disco.dts 
b/arch/arm/boot/dts/stm32f469-disco.dts
index e911af8..eb3e638 100644
--- a/arch/arm/boot/dts/stm32f469-disco.dts
+++ b/arch/arm/boot/dts/stm32f469-disco.dts
@@ -71,5 +71,7 @@
 };
 
  {
+   pinctrl-0 = <_pins_a>;
+   pinctrl-names = "default";
status = "okay";
 };
-- 
2.7.4 (Apple Git-66)



Re: [PATCH 4.6 000/121] 4.6.2-stable review

2016-06-07 Thread Greg Kroah-Hartman
On Mon, Jun 06, 2016 at 04:33:14PM -0700, Greg Kroah-Hartman wrote:
> On Mon, Jun 06, 2016 at 06:43:47PM -0400, Javier Martinez Canillas wrote:
> > Hello,
> > 
> > On 06/06/2016 06:32 PM, Tyler Baker wrote:
> > > On 6 June 2016 at 06:55, Kevin Hilman  wrote:
> > >> kernelci.org bot  writes:
> > >>
> > >>> stable-queue boot: 73 boots: 3 failed, 68 passed with 2 offline 
> > >>> (v4.6.1-121-g2276ff7d4bf9)
> > >>>
> > >>> Full Boot Summary: 
> > >>> https://kernelci.org/boot/all/job/stable-queue/kernel/v4.6.1-121-g2276ff7d4bf9/
> > >>> Full Build Summary: 
> > >>> https://kernelci.org/build/stable-queue/kernel/v4.6.1-121-g2276ff7d4bf9/
> > >>>
> > >>> Tree: stable-queue
> > >>> Branch: local/linux-4.6.y.queue
> > >>> Git Describe: v4.6.1-121-g2276ff7d4bf9
> > >>> Git Commit: 2276ff7d4bf9c438832f761ffd525cacf55362cd
> > >>> Git URL: git://server.roeck-us.net/git/linux-stable.git
> > >>> Tested: 28 unique boards, 9 SoC families, 16 builds out of 100
> > >>>
> > >>> Boot Failures Detected: 
> > >>> https://kernelci.org/boot/?v4.6.1-121-g2276ff7d4bf9
> > >>>
> > >>> arm64:
> > >>>
> > >>> defconfig:
> > >>> apq8016-sbc: 1 failed lab
> > >>>
> > >>> defconfig+CONFIG_RANDOMIZE_BASE=y:
> > >>> apq8016-sbc: 1 failed lab
> > >>
> > >> Theses two are real boot regressions, bisections forthcoming.
> > > 
> > > I have bisected[1] these two failures down to 5e3ca2b349b1
> > > ("regulator: Try to resolve regulators supplies on registration") and
> > > confirmed that reverting this patch on top of this stable queue fixes
> > > the boot issue.
> > > 
> > > Adding Mark B. and Javier C. to this thread for discussion.
> > >
> > 
> > I'm not familiar with the apq8016-sbc board or Qualcomm platforms in general
> > but this patch is known to cause deadlocks when looking up regulators that
> > were not registered via OF. This was an issue on at least some Nvidia 
> > boards.
> > 
> > So since this patch made it to stable, commit a21513742308 ("regulator: Fix
> > deadlock during regulator registration") [0] should also be included.
> 
> Ugh.  Why wasn't that patch also marked for stable inclusion?  This was
> a problem waiting to happen that could have been totally avoided :(
> 
> I'll queue it up this evening, thanks.

Ok, that patch does not apply to 4.5-stable, or 4.4-stable, so I'm going
to only apply it to 4.6-stable, and drop the original patch,
5e3ca2b349b1 ("regulator: Try to resolve regulators supplies on
registration") from the 4.4 and 4.5 queues.

thanks,

greg k-h


Re: [PATCH 3.10 000/143] 3.10.102-stable review

2016-06-07 Thread Guenter Roeck

On 06/07/2016 10:49 AM, Willy Tarreau wrote:

Hi Guenter,

On Tue, Jun 07, 2016 at 08:54:53AM +0200, Willy Tarreau wrote:

Jiri provides a branch for 3.12, exactly as you suggested. In his case it is
named stable-3.12-queue. Sasha does the same, with linux-3.18.y-queue and
linux-4.1.y-queue. Both force-push as needed. I don't see a problem with it.
Other testers such as kernelci.org pick it up from there (or from my repository
after I pull it in). In my repository, all branches are named 
linux-.y.queue;
for example, the 3.10 branch in my repository is named linux-3.10.y.queue.
Those branches are also force-pushed when updated.


OK then that's perfect, I'll do the same ASAP, probably today as time permits.


Now done. Please find it here :

   git://git.kernel.org/pub/scm/linux/kernel/git/wtarreau/linux-stable.git 
linux-3.10.y-queue

It's a fork of Greg's linux-stable. I cleaned it up from irrelevant
tags and branches. If you have any issue, please let me know.



Here we are;

Build results:
total: 123 pass: 123 fail: 0
Qemu test results:
total: 75 pass: 75 fail: 0

Details are available at http://kerneltests.org/builders.

Guenter



Re: small patch to avoid warning in gcc 6

2016-06-07 Thread Reinoud Koornstra
On Tue, Jun 7, 2016 at 6:47 PM, Joe Perches  wrote:
> On Tue, 2016-06-07 at 18:41 -0600, Reinoud Koornstra wrote:
>> Hello Everybody,
>>
>> A small patch that doesn't really do anything other than getting rid
>> of a warning in gcc 6.1.0.
>>
>> drivers/gpu/drm/i915/i915_debugfs.c: In function ‘i915_dump_lrc’:
>> drivers/gpu/drm/i915/i915_debugfs.c:2060:6: warning: suggest explicit
>> braces to avoid ambiguous ‘else’ [-Wparentheses]
>>if (ctx != dev_priv->kernel_context)
>>   ^
>
> Likely there should be 2 pairs of braces added:
>
> list_for_each_entry(ctx, _priv->context_list, link) {
> if (ctx != dev_priv->kernel_context) {
> for_each_ring(ring, dev_priv, i)
> i915_dump_lrc_obj(m, ctx, ring);
> }
> }
>

Added in version 2 of the patch.
The previous patch already got rid of the warning, but this one adds
braces to the loop as well.
Thanks,

Reinoud.
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index a0f1bd7..a48d228 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2056,10 +2056,12 @@ static int i915_dump_lrc(struct seq_file *m, void *unused)
 	if (ret)
 		return ret;
 
-	list_for_each_entry(ctx, _priv->context_list, link)
-		if (ctx != dev_priv->kernel_context)
+	list_for_each_entry(ctx, _priv->context_list, link) {
+		if (ctx != dev_priv->kernel_context) {
 			for_each_ring(ring, dev_priv, i)
 i915_dump_lrc_obj(m, ctx, ring);
+		}
+	}
 
 	mutex_unlock(>struct_mutex);
 


  1   2   3   4   5   6   7   8   9   10   >