Re: [PATCH] sched: sync with the cfs_rq when changing sched class

2015-08-13 Thread Byungchul Park
On Thu, Aug 13, 2015 at 09:46:00AM +0200, Peter Zijlstra wrote:
> On Thu, Aug 13, 2015 at 02:55:55PM +0900, byungchul.p...@lge.com wrote:
> > @@ -8023,16 +8036,7 @@ static void task_move_group_fair(struct task_struct 
> > *p, int queued)
> >  
> >  #ifdef CONFIG_SMP
> > /* synchronize task with its prev cfs_rq */
> > -   if (!queued)
> > -   __update_load_avg(cfs_rq->avg.last_update_time, 
> > cpu_of(rq_of(cfs_rq)),
> > -   &se->avg, se->on_rq * 
> > scale_load_down(se->load.weight),
> > -   cfs_rq->curr == se, NULL);
> > -
> > -   /* remove our load when we leave */
> > -   cfs_rq->avg.load_avg = max_t(long, cfs_rq->avg.load_avg - 
> > se->avg.load_avg, 0);
> > -   cfs_rq->avg.load_sum = max_t(s64, cfs_rq->avg.load_sum - 
> > se->avg.load_sum, 0);
> > -   cfs_rq->avg.util_avg = max_t(long, cfs_rq->avg.util_avg - 
> > se->avg.util_avg, 0);
> > -   cfs_rq->avg.util_sum = max_t(s32, cfs_rq->avg.util_sum - 
> > se->avg.util_sum, 0);
> > +   detach_entity_load_avg(cfs_rq, se);
> >  #endif
> > set_task_rq(p, task_cpu(p));
> > se->depth = se->parent ? se->parent->depth + 1 : 0;
> > @@ -8042,11 +8046,7 @@ static void task_move_group_fair(struct task_struct 
> > *p, int queued)
> >  
> >  #ifdef CONFIG_SMP
> > /* Virtually synchronize task with its new cfs_rq */
> > -   p->se.avg.last_update_time = cfs_rq->avg.last_update_time;
> > -   cfs_rq->avg.load_avg += p->se.avg.load_avg;
> > -   cfs_rq->avg.load_sum += p->se.avg.load_sum;
> > -   cfs_rq->avg.util_avg += p->se.avg.util_avg;
> > -   cfs_rq->avg.util_sum += p->se.avg.util_sum;
> > +   attach_entity_load_avg(cfs_rq, se);
> >  #endif
> >  }
> 
> Can't we go one further and do:
> 
> static void task_move_group_fair(struct task_struct *p)
> {
>   struct rq *rq = task_rq(p);
> 
>   switched_from_fair(rq, p);
>   set_task_rq(p, task_cpu(p);
>   switched_to_fair(rq, p);
> }

yeah, i think this is very nice idea which make code simple.
i will try it.

thanks,
byungchul

> 
> switched_from already does the vruntime and load_avg thing,
> switched_to should do the reverse, although it currently doesn't appear
> to put the load_avg back.
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] clk: Convert __clk_get_name(hw->clk) to clk_hw_get_name(hw)

2015-08-13 Thread Geert Uytterhoeven
On Thu, Aug 13, 2015 at 1:12 AM, Stephen Boyd  wrote:
> Use the provider based method to get a clock's name so that we
> can get rid of the clk member in struct clk_hw one day. Mostly
> converted with the following coccinelle script.
>
> @@
> struct clk_hw *E;
> @@
>
> -__clk_get_name(E->clk)
> +clk_hw_get_name(E)
>
> Cc: Heiko Stuebner 
> Cc: Sylwester Nawrocki 
> Cc: Tomasz Figa 
> Cc: Peter De Schrijver 
> Cc: Prashant Gaikwad 
> Cc: Stephen Warren 
> Cc: Thierry Reding 
> Cc: Alexandre Courbot 
> Cc: Tero Kristo 
> Cc: Ulf Hansson 
> Cc: Sebastian Hesselbarth 
> Cc: Andrew Bresticker 
> Cc: Ezequiel Garcia 
> Cc: Ralf Baechle 
> Cc: Kevin Cernekee 
> Cc: Geert Uytterhoeven 
> Cc: Ulrich Hecht 
> Cc: linux-arm-ker...@lists.infradead.org
> Cc: linux-rockc...@lists.infradead.org
> Cc: linux-samsung-...@vger.kernel.org
> Cc: linux-te...@vger.kernel.org
> Cc: linux-o...@vger.kernel.org
> Signed-off-by: Stephen Boyd 

>  drivers/clk/shmobile/clk-div6.c  |  2 +-

For the shmobile part:

Acked-by: Geert Uytterhoeven 

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] extcon: palmas: Fix build break due to devm_gpiod_get_optional API change

2015-08-13 Thread Uwe Kleine-König
On Thu, Aug 13, 2015 at 05:17:05PM +0900, Chanwoo Choi wrote:
> "With commit b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get 
> functions")
s/"//

> it becomes necessary to pass the flags argument. And this patch add the gpio
s/add/adds/

> header file to fix the build break when use random configuration file.
s/break/breakage/; s/use/build testing with/; s/file/files/

(That's at least what my German mind tells ...)

> Reported-by: Stephen Rothwell 
> Signed-off-by: Chanwoo Choi 
> ---
>  drivers/extcon/extcon-palmas.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c
> index 662e91778cb0..93c30a885740 100644
> --- a/drivers/extcon/extcon-palmas.c
> +++ b/drivers/extcon/extcon-palmas.c
> @@ -29,6 +29,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  
>  #define USB_GPIO_DEBOUNCE_MS 20  /* ms */
> @@ -208,7 +209,8 @@ static int palmas_usb_probe(struct platform_device *pdev)
>   palmas_usb->wakeup = pdata->wakeup;
>   }
>  
> - palmas_usb->id_gpiod = devm_gpiod_get_optional(&pdev->dev, "id");
> + palmas_usb->id_gpiod = devm_gpiod_get_optional(&pdev->dev, "id",
> + GPIOD_IN);
This isn't aligned with the opening parenthesis in the line above. But
IIRC this isn't a hard requirement, so *shrug*.

Acked-by: Uwe Kleine-König 

Best regards
Uwe

-- 
Pengutronix e.K.   | Uwe Kleine-König|
Industrial Linux Solutions | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu

2015-08-13 Thread Ingo Molnar

* Andy Lutomirski  wrote:

> > OK.
> > I'll try to test the patch tomorrow, but I think the sigreturn()'s
> > capability detection is still needed to easily replace the iret trampoline
> > in userspace (without generating a signal and testing by hands).
> > Can of course be done with a run-time kernel version check...
> 
> That feature is so specialized that I think you should just probe it.
> 
> void foo(...) {
>   sigcontext->ss = 7;
> }
> 
> modify_ldt(initialize descriptor 0);
> sigaction(SIGUSR1, foo, SA_SIGINFO);
> if (ss == 7)
>   yay;
> 
> Fortunately, all kernels that restore ss also have espfix64, so you
> don't need to worry about esp[31:16] corruption on those kernels
> either.
> 
> I suppose we could add a new uc_flag to indicate that ss is saved and 
> restored, 
> though.  Ingo, hpa: any thoughts on that?  There will always be some kernel 
> versions that save and restore ss but don't set the flag, though.

So this new flag would essentially be a 'the ss save/restore bug is fixed for 
sure' flag, not covering old kernels that happen to have the correct behavior, 
right?

Could you please map out the range of kernel versions involved - which ones:

- 'never do the right thing'
- 'do the right thing sometimes'
- 'do the right thing always, but by accident'
- 'do the right thing always and intentionally'

?

I'd hate to complicate a legacy ABI any more. My gut feeling is to let apps 
either 
assume that the kernel works right, or probe the actual behavior. Adding the 
flag 
just makes it easy to screw certain kernel versions that would still work fine 
if 
the app used actual probing. So I don't see the flag as an improvement.

If your patch fixes the regression that would be a good first step.

Please also send the fix in email instead of just pointing to a Git tree, so 
that 
people can comment on it.

Thanks,

Ingo

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


Re: [PATCH v1] usb: dwc2: reset AHB hclk domain before init

2015-08-13 Thread John Youn
On 8/12/2015 12:33 PM, Felipe Balbi wrote:
> On Wed, Aug 12, 2015 at 07:06:09PM +0800, Yunzhi Li wrote:
>> Hi ,
>> 在 2015/8/11 22:12, Felipe Balbi 写道:
>>> Hi,
>>>
>>> On Tue, Aug 11, 2015 at 10:27:42AM +0800, Yunzhi Li wrote:
 We initiate dwc2 usb controller in BIOS, when kernel driver
 start-up we should reset AHB hclk domain to reset all AHB
 interface registers to default. Without this the FIFO value
 setting might be incorrect because calculating FIFO size need the
 power-on value of GRXFSIZ/GNPTXFSIZ/HPTXFSIZ registers.

 This patch could avoid warnning massage like in rk3288 platform:
 [2.074764] dwc2 ff58.usb: 256 invalid for
 host_perio_tx_fifo_size. Check HW configuration.

 Signed-off-by: Yunzhi Li 

 ---

  drivers/usb/dwc2/platform.c | 12 
  1 file changed, 12 insertions(+)

 diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
 index 9093530..3da21ab 100644
 --- a/drivers/usb/dwc2/platform.c
 +++ b/drivers/usb/dwc2/platform.c
 @@ -42,6 +42,7 @@
  #include 
  #include 
  #include 
 +#include 
  #include 
 @@ -165,6 +166,7 @@ static int dwc2_driver_probe(struct platform_device 
 *dev)
struct resource *res;
struct phy *phy;
struct usb_phy *uphy;
 +  struct reset_control *rst;
int retval;
int irq;
 @@ -189,6 +191,16 @@ static int dwc2_driver_probe(struct platform_device 
 *dev)
hsotg->dev = &dev->dev;
 +  /* AHB hclk domain reset, set all AHB interface registers to default */
 +  rst = devm_reset_control_get_optional(&dev->dev, "ahb_reset");
>>> why isn't this done in core so PCI systems can also make use of it ?
>>>
>> I have no ides about how to reset a PCI interface dwc2 controller, John
>> could you please give some infomation about it ?
>> Is it also needed for PCI interface dwc2 IP ?
> 
> even on platform only, how do you know all users provide a ahb_reset
> reset controller ?
> 

Also where do you provide the ahb_reset? I don't see it as a
property for dwc2.

With regards to PCI, I'm also not sure how you'd accomplish
something like this. But the platform I use at least doesn't need
this.

Regards,
John





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


Re: [PATCH v2 00/22] memory: omap-gpmc: mtd: nand: Support GPMC NAND on non-OMAP platforms

2015-08-13 Thread Tony Lindgren
* Roger Quadros  [150813 00:17]:
> On 11/08/15 15:48, Tony Lindgren wrote:
> > 
> > OK. Yeah let's make sure no regressions are caused by this.. We also
> > still have the omap3 legacy booting around, have you checked that it
> > keeps on working?
> 
> I don't have any omap3 board with legacy support with me. I have omap3-beagle
> but looks like legacy boot is dropped for it already.
> 
> I'll try to revert the patch that drops beagle support and test it on that 
> one.

OK yeah that should work just fine.

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


Re: [PATCH v2 1/5] clocksource: mediatek: do not enable GPT_CLK_EVT when setup

2015-08-13 Thread Daniel Lezcano

On 07/22/2015 10:14 AM, Yingjoe Chen wrote:

Spurious mtk timer interrupt is noticed at boot and cause kernel
crash. It seems if GPT is enabled, it will latch irq status even
when its IRQ is disabled. When irq is enabled afterward, we see
spurious interrupt.
Change init flow to only enable GPT_CLK_SRC at mtk_timer_init.

Acked-by: Matthias Brugger 
Reviewed-by: Daniel Kurtz 
Signed-off-by: Yingjoe Chen 
---

Update to my patch [1], added __init as Daniel suggest. This is the
only patch that need to change in that series, so I only sent this one.

http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001545.html

  drivers/clocksource/mtk_timer.c | 16 ++--
  1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index 68ab423..2ba5b66 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -156,9 +156,11 @@ static void mtk_timer_global_reset(struct 
mtk_clock_event_device *evt)
writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
  }

-static void
-mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
+static void __init mtk_timer_setup(struct mtk_clock_event_device *evt,
+  u8 timer, u8 option, bool enable)
  {
+   u32 val;
+
writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
evt->gpt_base + TIMER_CTRL_REG(timer));

@@ -167,8 +169,10 @@ mtk_timer_setup(struct mtk_clock_event_device *evt, u8 
timer, u8 option)

writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));

-   writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
-   evt->gpt_base + TIMER_CTRL_REG(timer));
+   val = TIMER_CTRL_OP(option);
+   if (enable)
+   val |= TIMER_CTRL_ENABLE;
+   writel(val, evt->gpt_base + TIMER_CTRL_REG(timer));


Instead of the 'enable' new option, I prefer a test with 'timer' with a 
comment:


/*
 * the timer hw is broken in that way ... bla bla, so we only
 * enable the clocksource ...
 */
if (timer == GPT_CLK_SRC)
val |= TIMER_CTRL_ENABLE;

That said, can you have a look at commit 1096be08 ?
"clockevents: sun5i: Fix setup_irq init sequence"

first and check if moving the interrupt request after the 
clockevents_config_and_register could fix your issue.



  }

  static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
@@ -235,12 +239,12 @@ static void __init mtk_timer_init(struct device_node 
*node)
evt->ticks_per_jiffy = DIV_ROUND_UP(rate, HZ);

/* Configure clock source */
-   mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN);
+   mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN, true);
clocksource_mmio_init(evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC),
node->name, rate, 300, 32, clocksource_mmio_readl_up);

/* Configure clock event */
-   mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT);
+   mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT, false);
clockevents_config_and_register(&evt->dev, rate, 0x3,
0x);





--
  Linaro.org │ Open source software for ARM SoCs

Follow Linaro:   Facebook |
 Twitter |
 Blog

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


Re: [PATCH v2 0/2] net: thunder: Add ACPI support.

2015-08-13 Thread Hanjun Guo

On 08/12/2015 11:36 PM, David Daney wrote:

On 08/12/2015 08:23 AM, Catalin Marinas wrote:

On Tue, Aug 11, 2015 at 01:04:55PM -0700, David Daney wrote:

On 08/11/2015 11:49 AM, David Miller wrote:

From: David Daney 
Date: Mon, 10 Aug 2015 17:58:35 -0700


Change from v1:  Drop PHY binding part, use fwnode_property* APIs.

The first patch (1/2) rearranges the existing code a little with no
functional change to get ready for the second.  The second (2/2) does
the actual work of adding support to extract the needed information

>from the ACPI tables.

Series applied.


Thank you very much.


In the future it might be better structured to try and get the OF
node, and if that fails then try and use the ACPI method to obtain
these values.


Our current approach, as you can see in the patch, is the opposite.
If ACPI
is being used, prefer that over the OF device tree.

You seem to be recommending precedence for OF.  It should be consistent
across all drivers/sub-systems, so do you really think that OF before
ACPI
is the way to go?


On arm64 (unless you use a vendor kernel), DT takes precedence over ACPI
if both arm provided to the kernel (and it's a fair assumption given
that ACPI on ARM is still in the early days). You could also force ACPI
with acpi=force on the kernel cmd line and the arch code will not
unflatten the DT even if it is provided, therefore is_of_node(fwnode)
returning false.


Yes. on the other hand, if no DT is provided, will try ACPI even
if no acpi=force on the kernel cmd line.



I haven't looked at your driver in detail but something like AMD's
xgbe_probe() uses a single function for both DT and ACPI with
device_property_read_*() functions getting the information from the
correct place in either case. The ACPI vs DT precedence is handled by
the arch boot code, we never mix the two and confuse the drivers.



My long term plan is to create something like
firmware_get_mac_address(), that would encapsulate  of_get_mac_address()
and the ACPI equivalent.

Same for firmware_phy_find_device().


I'm very keen on seeing that happens :)

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


[PATCH v2 1/4] irqchip: GICv3: Convert to EOImode == 1

2015-08-13 Thread Marc Zyngier
So far, GICv3 has been used in with EOImode == 0. The effect of this
mode is to perform the priority drop and the deactivation of the
interrupt at the same time.

While this works perfectly for Linux (we only have a single priority),
it causes issues when an interrupt is forwarded to a guest, and when
we want the guest to perform the EOI itself.

For this case, the GIC architecture provides EOImode == 1, where:
- A write to ICC_EOIR1_EL1 drops the priority of the interrupt and leaves
it active. Other interrupts at the same priority level can now be taken,
but the active interrupt cannot be taken again
- A write to ICC_DIR_EL1 marks the interrupt as inactive, meaning it can
now be taken again.

This patch converts the driver to be able to use this new mode, depending
on whether or not the kernel can behave as a hypervisor. No feature change.

Signed-off-by: Marc Zyngier 
---
 drivers/irqchip/irq-gic-v3.c   | 37 +
 include/linux/irqchip/arm-gic-v3.h |  9 +
 2 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index c52f7ba..61190fb 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "irq-gic-common.h"
 #include "irqchip.h"
@@ -50,6 +51,7 @@ struct gic_chip_data {
 };
 
 static struct gic_chip_data gic_data __read_mostly;
+static struct static_key supports_deactivate = STATIC_KEY_INIT_TRUE;
 
 #define gic_data_rdist()   (this_cpu_ptr(gic_data.rdists.rdist))
 #define gic_data_rdist_rd_base()   (gic_data_rdist()->rd_base)
@@ -293,7 +295,14 @@ static int gic_irq_get_irqchip_state(struct irq_data *d,
 
 static void gic_eoi_irq(struct irq_data *d)
 {
-   gic_write_eoir(gic_irq(d));
+   if (static_key_true(&supports_deactivate)) {
+   /* No need to deactivate an LPI */
+   if (gic_irq(d) >= 8192)
+   return;
+   gic_write_dir(gic_irq(d));
+   } else {
+   gic_write_eoir(gic_irq(d));
+   }
 }
 
 static int gic_set_type(struct irq_data *d, unsigned int type)
@@ -343,15 +352,24 @@ static asmlinkage void __exception_irq_entry 
gic_handle_irq(struct pt_regs *regs
 
if (likely(irqnr > 15 && irqnr < 1020) || irqnr >= 8192) {
int err;
+
+   if (static_key_true(&supports_deactivate))
+   gic_write_eoir(irqnr);
+
err = handle_domain_irq(gic_data.domain, irqnr, regs);
if (err) {
WARN_ONCE(true, "Unexpected interrupt 
received!\n");
-   gic_write_eoir(irqnr);
+   if (static_key_true(&supports_deactivate))
+   gic_write_dir(irqnr);
+   else
+   gic_write_eoir(irqnr);
}
continue;
}
if (irqnr < 16) {
gic_write_eoir(irqnr);
+   if (static_key_true(&supports_deactivate))
+   gic_write_dir(irqnr);
 #ifdef CONFIG_SMP
handle_IPI(irqnr, regs);
 #else
@@ -451,8 +469,13 @@ static void gic_cpu_sys_reg_init(void)
/* Set priority mask register */
gic_write_pmr(DEFAULT_PMR_VALUE);
 
-   /* EOI deactivates interrupt too (mode 0) */
-   gic_write_ctlr(ICC_CTLR_EL1_EOImode_drop_dir);
+   if (static_key_true(&supports_deactivate)) {
+   /* EOI drops priority only (mode 1) */
+   gic_write_ctlr(ICC_CTLR_EL1_EOImode_drop);
+   } else {
+   /* EOI deactivates interrupt too (mode 0) */
+   gic_write_ctlr(ICC_CTLR_EL1_EOImode_drop_dir);
+   }
 
/* ... and let's hit the road... */
gic_write_grpen1(1);
@@ -820,6 +843,12 @@ static int __init gic_of_init(struct device_node *node, 
struct device_node *pare
if (of_property_read_u64(node, "redistributor-stride", &redist_stride))
redist_stride = 0;
 
+   if (!is_hyp_mode_available())
+   static_key_slow_dec(&supports_deactivate);
+
+   if (static_key_true(&supports_deactivate))
+   pr_info("GIC: Using split EOI/Deactivate mode\n");
+
gic_data.dist_base = dist_base;
gic_data.redist_regions = rdist_regs;
gic_data.nr_redist_regions = nr_redist_regions;
diff --git a/include/linux/irqchip/arm-gic-v3.h 
b/include/linux/irqchip/arm-gic-v3.h
index ffbc034..bc98832 100644
--- a/include/linux/irqchip/arm-gic-v3.h
+++ b/include/linux/irqchip/arm-gic-v3.h
@@ -104,6 +104,8 @@
 #define GICR_SYNCR 0x00C0
 #define GICR_MOVLPIR   0x0100
 #define GICR_MOVALLR   0x0110
+#define GICR_ISACTIVER 

[PATCH v2 0/4] irqchip: GICv2/v3: Add support for irq_vcpu_affinity

2015-08-13 Thread Marc Zyngier
The GICv2 and GICv3 architectures allow an active physical interrupt
to be forwarded to a guest, and the guest to indirectly perform the
deactivation of the interrupt by performing an EOI on the virtual
interrupt (see for example the GICv2 spec, 3.2.1).

This allows some substantial performance improvement for level
triggered interrupts that otherwise have to be masked/unmasked in
VFIO, not to mention the required trap back to KVM when the guest
performs an EOI.

To enable this, the GICs need to be switched to a different EOImode,
where a taken interrupt can be left "active" (which prevents the same
interrupt from being taken again), while other interrupts are still
being processed normally.

We also use the new irq_set_vcpu_affinity hook that was introduced for
Intel's "Posted Interrupts" to determine whether or not to perform the
deactivation at EOI-time.

As all of this only makes sense when the kernel can behave as a
hypervisor, we only enable this mode on detecting that the kernel was
actually booted in HYP mode, and that the GIC supports this feature.

This series is a complete rework of a RFC I sent over a year ago:

http://lists.infradead.org/pipermail/linux-arm-kernel/2014-June/266328.html

Since then, a lot has been either merged (the irqchip_state) or reworked
(my active-timer series: http://www.spinics.net/lists/kvm/msg118768.html),
and this implements the last few bits for Eric Auger's series to
finally make it into the kernel:

https://lkml.org/lkml/2015/7/2/268
https://lkml.org/lkml/2015/7/6/291

With all these patches combined, physical interrupt routing from the
kernel into a VM becomes possible.

This has been tested on Juno (GICv2) and FastModel (GICv3). A branch
is available at:

git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git 
irq/gic-irq-vcpu-affinity-v2

* From v1:
  - Fixes after review from Eric
  - Got rid of the cascaded GICv2 hack (it was broken anyway)
  - Folded the LPI deactivation patch (it makes more sense as part of
the main one.
  - Some clarifying comments about the "deactivate on mask"
  - I haven't retained Eric's Reviewed/Tested-by, as the code as
significantly changed on GICv2

Marc Zyngier (4):
  irqchip: GICv3: Convert to EOImode == 1
  irqchip: GICv3: Don't deactivate interrupts forwarded to a guest
  irqchip: GIC: Convert to EOImode == 1
  irqchip: GIC: Don't deactivate interrupts forwarded to a guest

 drivers/irqchip/irq-gic-v3.c   |  68 +--
 drivers/irqchip/irq-gic.c  | 109 -
 include/linux/irqchip/arm-gic-v3.h |   9 +++
 include/linux/irqchip/arm-gic.h|   4 ++
 4 files changed, 184 insertions(+), 6 deletions(-)

-- 
2.1.4

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


[Regression v4.2 ?] 32-bit seccomp-BPF returned errno values wrong in VM?

2015-08-13 Thread David Drysdale
Hi folks,

I've got an odd regression with the v4.2 rc kernel, and I wondered if anyone
else could reproduce it.

The problem occurs with a seccomp-bpf filter program that's set up to return
an errno value -- an errno of 1 is always returned instead of what's in the
filter, plus other oddities (selftest output below).

The problem seems to need a combination of circumstances to occur:

 - The seccomp-bpf userspace program needs to be 32-bit, running against a
   64-bit kernel -- I'm testing with seccomp_bpf from
   tools/testing/selftests/seccomp/, built via 'CFLAGS=-m32 make'.

 - The kernel needs to be running as a VM guest -- it occurs inside my
   VMware Fusion host, but not if I run on bare metal.  Kees tells me he
   cannot repro with a kvm guest though.

Bisecting indicates that the commit that induces the problem is
3f5159a9221f19b0, "x86/asm/entry/32: Update -ENOSYS handling to match the
64-bit logic", included in all the v4.2-rc* candidates.

Apologies if I've just got something odd with my local setup, but the
bisection was unequivocal enough that I thought it worth reporting...

Thanks,
David


seccomp_bpf failure outputs:

seccomp_bpf.c:533:global.ERRNO_valid:Expected 7 (7) ==
(*__errno_location ()) (1)
seccomp_bpf.c:560:global.ERRNO_zero:Expected 0 (0) == read(0, ((void
*)0), 0) (4294967295)
seccomp_bpf.c:587:global.ERRNO_capped:Expected 4095 (4095) ==
(*__errno_location ()) (1)
seccomp_bpf.c:905:precedence.errno_is_third:Expected 0 (0) ==
syscall(20) (4294967295)
seccomp_bpf.c:925:precedence.errno_is_third_in_any_order:Expected 0
(0) == syscall(20) (4294967295)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 3/4] irqchip: GIC: Convert to EOImode == 1

2015-08-13 Thread Marc Zyngier
So far, GICv2 has been used in with EOImode == 0. The effect of this
mode is to perform the priority drop and the deactivation of the
interrupt at the same time.

While this works perfectly for Linux (we only have a single priority),
it causes issues when an interrupt is forwarded to a guest, and when
we want the guest to perform the EOI itself.

For this case, the GIC architecture provides EOImode == 1, where:
- A write to the EOI register drops the priority of the interrupt and leaves
it active. Other interrupts at the same priority level can now be taken,
but the active interrupt cannot be taken again
- A write to the DIR marks the interrupt as inactive, meaning it can
now be taken again.

We only enable this feature when booted in HYP mode and that
the device-tree reporte a suitable CPU interface. Observable behaviour
should remain unchanged.

Signed-off-by: Marc Zyngier 
---
 drivers/irqchip/irq-gic.c   | 51 +++--
 include/linux/irqchip/arm-gic.h |  4 
 2 files changed, 53 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index 4dd8826..b020c3a 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -46,6 +46,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "irq-gic-common.h"
 #include "irqchip.h"
@@ -82,6 +83,8 @@ static DEFINE_RAW_SPINLOCK(irq_controller_lock);
 #define NR_GIC_CPU_IF 8
 static u8 gic_cpu_map[NR_GIC_CPU_IF] __read_mostly;
 
+static struct static_key supports_deactivate = STATIC_KEY_INIT_TRUE;
+
 #ifndef MAX_GIC_NR
 #define MAX_GIC_NR 1
 #endif
@@ -137,6 +140,14 @@ static inline unsigned int gic_irq(struct irq_data *d)
return d->hwirq;
 }
 
+static inline bool primary_gic_irq(struct irq_data *d)
+{
+   if (MAX_GIC_NR > 1)
+   return irq_data_get_irq_chip_data(d) == &gic_data[0];
+
+   return true;
+}
+
 /*
  * Routines to acknowledge, disable and enable interrupts
  */
@@ -164,7 +175,14 @@ static void gic_unmask_irq(struct irq_data *d)
 
 static void gic_eoi_irq(struct irq_data *d)
 {
-   writel_relaxed(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI);
+   u32 deact_offset = GIC_CPU_EOI;
+
+   if (static_key_true(&supports_deactivate)) {
+   if (primary_gic_irq(d))
+   deact_offset = GIC_CPU_DEACTIVATE;
+   }
+
+   writel_relaxed(gic_irq(d), gic_cpu_base(d) + deact_offset);
 }
 
 static int gic_irq_set_irqchip_state(struct irq_data *d,
@@ -272,11 +290,15 @@ static void __exception_irq_entry gic_handle_irq(struct 
pt_regs *regs)
irqnr = irqstat & GICC_IAR_INT_ID_MASK;
 
if (likely(irqnr > 15 && irqnr < 1021)) {
+   if (static_key_true(&supports_deactivate))
+   writel_relaxed(irqstat, cpu_base + GIC_CPU_EOI);
handle_domain_irq(gic->domain, irqnr, regs);
continue;
}
if (irqnr < 16) {
writel_relaxed(irqstat, cpu_base + GIC_CPU_EOI);
+   if (static_key_true(&supports_deactivate))
+   writel_relaxed(irqstat, cpu_base + 
GIC_CPU_DEACTIVATE);
 #ifdef CONFIG_SMP
handle_IPI(irqnr, regs);
 #endif
@@ -359,6 +381,10 @@ static void gic_cpu_if_up(void)
 {
void __iomem *cpu_base = gic_data_cpu_base(&gic_data[0]);
u32 bypass = 0;
+   u32 mode = 0;
+
+   if (static_key_true(&supports_deactivate))
+   mode = GIC_CPU_CTRL_EOImodeNS;
 
/*
* Preserve bypass disable bits to be written back later
@@ -366,7 +392,7 @@ static void gic_cpu_if_up(void)
bypass = readl(cpu_base + GIC_CPU_CTRL);
bypass &= GICC_DIS_BYPASS_MASK;
 
-   writel_relaxed(bypass | GICC_ENABLE, cpu_base + GIC_CPU_CTRL);
+   writel_relaxed(bypass | mode | GICC_ENABLE, cpu_base + GIC_CPU_CTRL);
 }
 
 
@@ -986,6 +1012,8 @@ void __init gic_init_bases(unsigned int gic_nr, int 
irq_start,
register_cpu_notifier(&gic_cpu_notifier);
 #endif
set_handle_irq(gic_handle_irq);
+   if (static_key_true(&supports_deactivate))
+   pr_info ("GIC: Using split EOI/Deactivate mode\n");
}
 
gic_dist_init(gic);
@@ -1001,6 +1029,7 @@ gic_of_init(struct device_node *node, struct device_node 
*parent)
 {
void __iomem *cpu_base;
void __iomem *dist_base;
+   struct resource cpu_res;
u32 percpu_offset;
int irq;
 
@@ -1013,6 +1042,16 @@ gic_of_init(struct device_node *node, struct device_node 
*parent)
cpu_base = of_iomap(node, 1);
WARN(!cpu_base, "unable to map gic cpu registers\n");
 
+   of_address_to_resource(node, 1, &cpu_res);
+
+   /*
+* Disable split EOI/Deactivate if either HYP is not available
+* or the CPU interface is too small.
+*/
+   if (gic_cnt == 0 && (!is_hyp_mode_av

[PATCH v2 2/4] irqchip: GICv3: Don't deactivate interrupts forwarded to a guest

2015-08-13 Thread Marc Zyngier
Commit 0a4377de3056 ("genirq: Introduce irq_set_vcpu_affinity() to
target an interrupt to a VCPU") added just what we needed at the
lowest level to allow an interrupt to be deactivated by a guest.

When such a request reaches the GIC, it knows it doesn't need to
perform the deactivation anymore, and can safely leave the guest
do its magic. This of course requires additional support in both
VFIO and KVM.

Signed-off-by: Marc Zyngier 
---
 drivers/irqchip/irq-gic-v3.c | 35 +--
 1 file changed, 33 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index 61190fb..01c6329 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -70,6 +70,11 @@ static inline int gic_irq_in_rdist(struct irq_data *d)
return gic_irq(d) < 32;
 }
 
+static inline bool forwarded_irq(struct irq_data *d)
+{
+   return d->handler_data != NULL;
+}
+
 static inline void __iomem *gic_dist_base(struct irq_data *d)
 {
if (gic_irq_in_rdist(d))/* SGI+PPI -> SGI_base for this CPU */
@@ -231,6 +236,18 @@ static void gic_poke_irq(struct irq_data *d, u32 offset)
 static void gic_mask_irq(struct irq_data *d)
 {
gic_poke_irq(d, GICD_ICENABLER);
+   /*
+* When masking a forwarded interrupt, make sure it is
+* deactivated as well.
+*
+* This ensures that an interrupt that is getting
+* disabled/masked will not get "stuck", because there is
+* noone to deactivate it (guest is being terminated).
+*/
+   if (static_key_true(&supports_deactivate)) {
+   if (forwarded_irq(d))
+   gic_poke_irq(d, GICD_ICACTIVER);
+   }
 }
 
 static void gic_unmask_irq(struct irq_data *d)
@@ -296,8 +313,11 @@ static int gic_irq_get_irqchip_state(struct irq_data *d,
 static void gic_eoi_irq(struct irq_data *d)
 {
if (static_key_true(&supports_deactivate)) {
-   /* No need to deactivate an LPI */
-   if (gic_irq(d) >= 8192)
+   /*
+* No need to deactivate an LPI, or an interrupt that
+* is is getting forwarded to a vcpu.
+*/
+   if (gic_irq(d) >= 8192 || forwarded_irq(d))
return;
gic_write_dir(gic_irq(d));
} else {
@@ -331,6 +351,16 @@ static int gic_set_type(struct irq_data *d, unsigned int 
type)
return gic_configure_irq(irq, type, base, rwp_wait);
 }
 
+static int gic_irq_set_vcpu_affinity(struct irq_data *d, void *vcpu)
+{
+   if (static_key_true(&supports_deactivate)) {
+   d->handler_data = vcpu;
+   return 0;
+   }
+
+   return -EINVAL;
+}
+
 static u64 gic_mpidr_to_affinity(u64 mpidr)
 {
u64 aff;
@@ -681,6 +711,7 @@ static struct irq_chip gic_chip = {
.irq_set_affinity   = gic_set_affinity,
.irq_get_irqchip_state  = gic_irq_get_irqchip_state,
.irq_set_irqchip_state  = gic_irq_set_irqchip_state,
+   .irq_set_vcpu_affinity  = gic_irq_set_vcpu_affinity,
.flags  = IRQCHIP_SET_TYPE_MASKED,
 };
 
-- 
2.1.4

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


[PATCH v2 4/4] irqchip: GIC: Don't deactivate interrupts forwarded to a guest

2015-08-13 Thread Marc Zyngier
Commit 0a4377de3056 ("genirq: Introduce irq_set_vcpu_affinity() to
target an interrupt to a VCPU") added just what we needed at the
lowest level to allow an interrupt to be deactivated by a guest.

When such a request reaches the GIC, it knows it doesn't need to
perform the deactivation anymore, and can safely leave the guest
do its magic. This of course requires additional support in both
VFIO and KVM.

Signed-off-by: Marc Zyngier 
---
 drivers/irqchip/irq-gic.c | 58 +++
 1 file changed, 58 insertions(+)

diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index b020c3a..ea691be 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -148,6 +148,34 @@ static inline bool primary_gic_irq(struct irq_data *d)
return true;
 }
 
+static inline bool cascading_gic_irq(struct irq_data *d)
+{
+   /*
+* If handler_data pointing to one of the secondary GICs, then
+* this is the cascading interrupt, and it cannot possibly be
+* forwarded.
+*/
+   if (d->handler_data >= (void *)(gic_data + 1) &&
+   d->handler_data <  (void *)(gic_data + MAX_GIC_NR))
+   return true;
+
+   return false;
+}
+
+static inline bool forwarded_irq(struct irq_data *d)
+{
+   /*
+* A forwarded interrupt:
+* - is on the primary GIC
+* - has its handler_data set to a value
+* - that isn't a secondary GIC
+*/
+   if (primary_gic_irq(d) && d->handler_data && !cascading_gic_irq(d))
+   return true;
+
+   return false;
+}
+
 /*
  * Routines to acknowledge, disable and enable interrupts
  */
@@ -166,6 +194,18 @@ static int gic_peek_irq(struct irq_data *d, u32 offset)
 static void gic_mask_irq(struct irq_data *d)
 {
gic_poke_irq(d, GIC_DIST_ENABLE_CLEAR);
+   /*
+* When masking a forwarded interrupt, make sure it is
+* deactivated as well.
+*
+* This ensures that an interrupt that is getting
+* disabled/masked will not get "stuck", because there is
+* noone to deactivate it (guest is being terminated).
+*/
+   if (static_key_true(&supports_deactivate)) {
+   if (forwarded_irq(d))
+   gic_poke_irq(d, GIC_DIST_ACTIVE_CLEAR);
+   }
 }
 
 static void gic_unmask_irq(struct irq_data *d)
@@ -178,6 +218,10 @@ static void gic_eoi_irq(struct irq_data *d)
u32 deact_offset = GIC_CPU_EOI;
 
if (static_key_true(&supports_deactivate)) {
+   /* Do not deactivate an IRQ forwarded to a vcpu. */
+   if (forwarded_irq(d))
+   return;
+
if (primary_gic_irq(d))
deact_offset = GIC_CPU_DEACTIVATE;
}
@@ -251,6 +295,19 @@ static int gic_set_type(struct irq_data *d, unsigned int 
type)
return gic_configure_irq(gicirq, type, base, NULL);
 }
 
+static int gic_irq_set_vcpu_affinity(struct irq_data *d, void *vcpu)
+{
+   /* Only interrupts on the primary GIC can be forwarded to a vcpu. */
+   if (static_key_true(&supports_deactivate)) {
+   if (primary_gic_irq(d) && !cascading_gic_irq(d)) {
+   d->handler_data = vcpu;
+   return 0;
+   }
+   }
+
+   return -EINVAL;
+}
+
 #ifdef CONFIG_SMP
 static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
bool force)
@@ -346,6 +403,7 @@ static struct irq_chip gic_chip = {
 #endif
.irq_get_irqchip_state  = gic_irq_get_irqchip_state,
.irq_set_irqchip_state  = gic_irq_set_irqchip_state,
+   .irq_set_vcpu_affinity  = gic_irq_set_vcpu_affinity,
.flags  = IRQCHIP_SET_TYPE_MASKED,
 };
 
-- 
2.1.4

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


[PATCH] pinctrl: mediatek: Implement wake handler and suspend resume

2015-08-13 Thread maoguang.meng
From: Maoguang Meng 

This patch implement irq_set_wake to get who is wakeup source and
setup on suspend resume.

Signed-off-by: Maoguang Meng 

---
changes since v2:
-modify irq_wake to handle irq wakeup source.
-allocate two buffers separately.
-fix some codestyle.

Changes since v1:
-implement irq_wake handler.
---
 drivers/pinctrl/mediatek/pinctrl-mt8173.c |  1 +
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 94 ++-
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h |  4 ++
 3 files changed, 97 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8173.c 
b/drivers/pinctrl/mediatek/pinctrl-mt8173.c
index d0c811d..ad27184 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt8173.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt8173.c
@@ -385,6 +385,7 @@ static struct platform_driver mtk_pinctrl_driver = {
.driver = {
.name = "mediatek-mt8173-pinctrl",
.of_match_table = mt8173_pctrl_match,
+   .pm = &mtk_eint_pm_ops,
},
 };
 
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index ad1ea16..7d4ba926 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "../core.h"
@@ -1062,11 +1063,82 @@ static int mtk_eint_set_type(struct irq_data *d,
return 0;
 }
 
+static int mtk_eint_irq_set_wake(struct irq_data *d, unsigned int on)
+{
+   struct mtk_pinctrl *pctl = irq_data_get_irq_chip_data(d);
+   int shift = d->hwirq & 0x1f;
+   int reg = d->hwirq >> 5;
+
+   if (on)
+   pctl->wake_mask[reg] |= BIT(shift);
+   else
+   pctl->wake_mask[reg] &= ~BIT(shift);
+
+   return 0;
+}
+
+static void mtk_eint_chip_write_mask(const struct mtk_eint_offsets *chip,
+   void __iomem *eint_reg_base, u32 *buf)
+{
+   int port;
+   void __iomem *reg;
+
+   for (port = 0; port < chip->ports; port++) {
+   reg = eint_reg_base + (port << 2);
+   writel_relaxed(~buf[port], reg + chip->mask_set);
+   writel_relaxed(buf[port], reg + chip->mask_clr);
+   }
+}
+
+static void mtk_eint_chip_read_mask(const struct mtk_eint_offsets *chip,
+   void __iomem *eint_reg_base, u32 *buf)
+{
+   int port;
+   void __iomem *reg;
+
+   for (port = 0; port < chip->ports; port++) {
+   reg = eint_reg_base + chip->mask + (port << 2);
+   buf[port] = ~readl_relaxed(reg);
+   }
+}
+
+static int mtk_eint_suspend(struct device *device)
+{
+   void __iomem *reg;
+   struct mtk_pinctrl *pctl = dev_get_drvdata(device);
+   const struct mtk_eint_offsets *eint_offsets =
+   &pctl->devdata->eint_offsets;
+
+   reg = pctl->eint_reg_base;
+   mtk_eint_chip_read_mask(eint_offsets, reg, pctl->cur_mask);
+   mtk_eint_chip_write_mask(eint_offsets, reg, pctl->wake_mask);
+
+   return 0;
+}
+
+static int mtk_eint_resume(struct device *device)
+{
+   struct platform_device *pdev = to_platform_device(device);
+   struct mtk_pinctrl *pctl = platform_get_drvdata(pdev);
+   const struct mtk_eint_offsets *eint_offsets =
+   &pctl->devdata->eint_offsets;
+
+   mtk_eint_chip_write_mask(eint_offsets,
+   pctl->eint_reg_base, pctl->cur_mask);
+
+   return 0;
+}
+
+const struct dev_pm_ops mtk_eint_pm_ops = {
+   .suspend = mtk_eint_suspend,
+   .resume = mtk_eint_resume,
+};
+
 static void mtk_eint_ack(struct irq_data *d)
 {
struct mtk_pinctrl *pctl = irq_data_get_irq_chip_data(d);
const struct mtk_eint_offsets *eint_offsets =
-   &pctl->devdata->eint_offsets;
+   &pctl->devdata->eint_offsets;
u32 mask = BIT(d->hwirq & 0x1f);
void __iomem *reg = mtk_eint_get_offset(pctl, d->hwirq,
eint_offsets->ack);
@@ -1076,10 +1148,12 @@ static void mtk_eint_ack(struct irq_data *d)
 
 static struct irq_chip mtk_pinctrl_irq_chip = {
.name = "mt-eint",
+   .irq_disable = mtk_eint_mask,
.irq_mask = mtk_eint_mask,
.irq_unmask = mtk_eint_unmask,
.irq_ack = mtk_eint_ack,
.irq_set_type = mtk_eint_set_type,
+   .irq_set_wake = mtk_eint_irq_set_wake,
.irq_request_resources = mtk_pinctrl_irq_request_resources,
.irq_release_resources = mtk_pinctrl_irq_release_resources,
 };
@@ -1217,7 +1291,7 @@ int mtk_pctrl_init(struct platform_device *pdev,
struct device_node *np = pdev->dev.of_node, *node;
struct property *prop;
struct resource *res;
-   int i, ret, irq;
+   int i, ret, irq, ports_buf;
 
pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL);
if (!pctl)
@@ -1319,6 +1393,22 @@ int mtk_pctrl_init(struct platform_device *pdev,
  

Re: [PATCH] sched: sync with the cfs_rq when changing sched class

2015-08-13 Thread Byungchul Park
On Thu, Aug 13, 2015 at 09:46:00AM +0200, Peter Zijlstra wrote:
> On Thu, Aug 13, 2015 at 02:55:55PM +0900, byungchul.p...@lge.com wrote:
> > @@ -8023,16 +8036,7 @@ static void task_move_group_fair(struct task_struct 
> > *p, int queued)
> >  
> >  #ifdef CONFIG_SMP
> > /* synchronize task with its prev cfs_rq */
> > -   if (!queued)
> > -   __update_load_avg(cfs_rq->avg.last_update_time, 
> > cpu_of(rq_of(cfs_rq)),
> > -   &se->avg, se->on_rq * 
> > scale_load_down(se->load.weight),
> > -   cfs_rq->curr == se, NULL);
> > -
> > -   /* remove our load when we leave */
> > -   cfs_rq->avg.load_avg = max_t(long, cfs_rq->avg.load_avg - 
> > se->avg.load_avg, 0);
> > -   cfs_rq->avg.load_sum = max_t(s64, cfs_rq->avg.load_sum - 
> > se->avg.load_sum, 0);
> > -   cfs_rq->avg.util_avg = max_t(long, cfs_rq->avg.util_avg - 
> > se->avg.util_avg, 0);
> > -   cfs_rq->avg.util_sum = max_t(s32, cfs_rq->avg.util_sum - 
> > se->avg.util_sum, 0);
> > +   detach_entity_load_avg(cfs_rq, se);
> >  #endif
> > set_task_rq(p, task_cpu(p));
> > se->depth = se->parent ? se->parent->depth + 1 : 0;
> > @@ -8042,11 +8046,7 @@ static void task_move_group_fair(struct task_struct 
> > *p, int queued)
> >  
> >  #ifdef CONFIG_SMP
> > /* Virtually synchronize task with its new cfs_rq */
> > -   p->se.avg.last_update_time = cfs_rq->avg.last_update_time;
> > -   cfs_rq->avg.load_avg += p->se.avg.load_avg;
> > -   cfs_rq->avg.load_sum += p->se.avg.load_sum;
> > -   cfs_rq->avg.util_avg += p->se.avg.util_avg;
> > -   cfs_rq->avg.util_sum += p->se.avg.util_sum;
> > +   attach_entity_load_avg(cfs_rq, se);
> >  #endif
> >  }
> 
> Can't we go one further and do:
> 
> static void task_move_group_fair(struct task_struct *p)
> {
>   struct rq *rq = task_rq(p);
> 
>   switched_from_fair(rq, p);
>   set_task_rq(p, task_cpu(p);
>   switched_to_fair(rq, p);
> }

it looks nice, but i will think more..

> 
> switched_from already does the vruntime and load_avg thing,
> switched_to should do the reverse, although it currently doesn't appear
> to put the load_avg back.

yuyang said that switched_to don't need to consider task's load because it
can have meaningless value. but i think considering task's load is better
than leaving it unattended at all. and we can also use switched_to if we 
consider task's load in switched_to.

thanks,
byungchul

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


Re: [PATCH 1/2] arm64: apei: implement arch_apei_get_mem_attributes()

2015-08-13 Thread Ingo Molnar

* Matt Fleming  wrote:

> From: "Jonathan (Zhixiong) Zhang" 
> 
> Table 8 of UEFI 2.5 section 2.3.6.1 defines mappings from EFI
> memory types to MAIR attribute encodings for arm64.
> 
> If the physical address has memory attributes defined by EFI
> memmap as EFI_MEMORY_[UC|WC|WT], return approprate page protection
> type according to the UEFI spec. Otherwise, return PAGE_KERNEL.
> 
> Reviewed-by: Catalin Marinas 
> Acked-by: Hanjun Guo 
> Reviewed-by: Ard Biesheuvel 
> Signed-off-by: Jonathan (Zhixiong) Zhang 
> Signed-off-by: Matt Fleming 
> ---
>  arch/arm64/include/asm/acpi.h | 30 ++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
> index 406485ed110a..1cbad43e561d 100644
> --- a/arch/arm64/include/asm/acpi.h
> +++ b/arch/arm64/include/asm/acpi.h
> @@ -19,6 +19,11 @@
>  #include 
>  #include 
>  
> +#ifdef CONFIG_ACPI_APEI
> +#include 
> +#include 
> +#endif
> +
>  /* Macros for consistency checks of the GICC subtable of MADT */
>  #define ACPI_MADT_GICC_LENGTH\
>   (acpi_gbl_FADT.header.revision < 6 ? 76 : 80)
> @@ -92,4 +97,29 @@ static inline const char *acpi_get_enable_method(int cpu)
>  {
>   return acpi_psci_present() ? "psci" : NULL;
>  }
> +
> +#ifdef   CONFIG_ACPI_APEI
> +static inline pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr)
> +{
> + /*
> +  * According to "Table 8 Map: EFI memory types to AArch64 memory types"
> +  * of UEFI 2.5 section 2.3.6.1, each EFI memory type is mapped to
> +  * corresponding MAIR attribute encoding.

s/mapped to corresponding/
  mapped to a corresponding

> +  * The EFI memory attribute advises all possible capabilities of a
> +  * memory region. We use the most efficient capability.
> +  */
> +
> + u64 attr;
> +
> + attr = efi_mem_attributes(addr);
> + if (attr & EFI_MEMORY_WB)
> + return PAGE_KERNEL;
> + if (attr & EFI_MEMORY_WT)
> + return __pgprot(PROT_NORMAL_WT);
> + if (attr & EFI_MEMORY_WC)
> + return __pgprot(PROT_NORMAL_NC);
> + return __pgprot(PROT_DEVICE_nGnRnE);
> +}
> +#endif

Also, this doesn't look like a small function - why is it inlined?

Moving it to .c would also slightly improve compilation times for every .c file 
that includes asm/acpi.h.

Thanks,

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


Re: [PATCH 2/2] acpi, apei: use appropriate pgprot_t to map GHES memory

2015-08-13 Thread Ingo Molnar

* Matt Fleming  wrote:

> From: "Jonathan (Zhixiong) Zhang" 
> 
> With ACPI APEI firmware first handling, generic hardware error
> record is updated by firmware in GHES memory region. On an arm64
> platform, firmware updates GHES memory region with uncached
> access attribute, and then Linux reads stale data from cache.

So this paragraph does not parse for me ...

If it tries to explain a bug it falls very short of doing a proper job of that.

Thanks,

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


[PATCH v2] extcon: palmas: Fix build break due to devm_gpiod_get_optional API change

2015-08-13 Thread Chanwoo Choi
"With commit b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions")
it becomes necessary to pass the flags argument. And this patch add the gpio
header file to fix the build break when use random configuration file.

Reported-by: Stephen Rothwell 
Signed-off-by: Chanwoo Choi 
---
 drivers/extcon/extcon-palmas.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c
index 662e91778cb0..93c30a885740 100644
--- a/drivers/extcon/extcon-palmas.c
+++ b/drivers/extcon/extcon-palmas.c
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #define USB_GPIO_DEBOUNCE_MS   20  /* ms */
@@ -208,7 +209,8 @@ static int palmas_usb_probe(struct platform_device *pdev)
palmas_usb->wakeup = pdata->wakeup;
}
 
-   palmas_usb->id_gpiod = devm_gpiod_get_optional(&pdev->dev, "id");
+   palmas_usb->id_gpiod = devm_gpiod_get_optional(&pdev->dev, "id",
+   GPIOD_IN);
if (IS_ERR(palmas_usb->id_gpiod)) {
dev_err(&pdev->dev, "failed to get id gpio\n");
return PTR_ERR(palmas_usb->id_gpiod);
-- 
1.8.5.5

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


Re: [PATCH 0/2] x86/KASAN updates for 4.3

2015-08-13 Thread Ingo Molnar

* Ingo Molnar  wrote:

> 
> * Andrey Ryabinin  wrote:
> 
> > These 2 patches taken from v5 'KASAN for arm64' series.
> > The only change is updated changelog in second patch.
> > 
> > I hope this is not too late to queue these for 4.3,
> > as this allow us to merge arm64/KASAN patches in v4.4
> > through arm64 tree.
> > 
> > Andrey Ryabinin (2):
> >   x86/kasan: define KASAN_SHADOW_OFFSET per architecture
> >   x86/kasan, mm: introduce generic kasan_populate_zero_shadow()
> > 
> >  arch/x86/include/asm/kasan.h |   3 +
> >  arch/x86/mm/kasan_init_64.c  | 123 ++
> >  include/linux/kasan.h|  10 ++-
> >  mm/kasan/Makefile|   2 +-
> >  mm/kasan/kasan_init.c| 152 
> > +++
> >  5 files changed, 170 insertions(+), 120 deletions(-)
> >  create mode 100644 mm/kasan/kasan_init.c
> 
> It's absolutely too late in the -rc cycle for v4.3!

Stupid me, I have read 'v4.2' ...

So yes, it's still good for v4.3, the development window is still open.

The rest still stands:

> I can create a stable topic tree for it, tip:mm/kasan or so, which arm64 
> could 
> pull and base its own ARM specific work on, if that's OK with everyone.

Thanks,

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


Re: [PATCH] extcon: palmas: Fix build break due to devm_gpiod_get_optional API change

2015-08-13 Thread Chanwoo Choi
On 08/13/2015 04:14 PM, Uwe Kleine-König wrote:
> Hello,
> 
> On Thu, Aug 13, 2015 at 09:29:04AM +0900, Chanwoo Choi wrote:
>> Commit b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions")
>> changes the prototype of devm_gpiod_get_optional() API which should include
>> the falgs mandatory.
> I'd write: "With commit b17d1bf16cc7 ("...") it becomes necessary to
> pass the flags argument." After all it is possible (and recommended)
> already now to use it. Your wording sounds as if b17d1bf16cc7 changed
> the API in an incompatible way.

OK, I'll modify the patch description by using your recommened sentence.

Thanks,
Chanwoo Choi

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


[tip:perf/core] perf tests: Add tests to callgraph and time parse

2015-08-13 Thread tip-bot for Kan Liang
Commit-ID:  71ef150ee06df29c5b427307dc0bacfe06a8baea
Gitweb: http://git.kernel.org/tip/71ef150ee06df29c5b427307dc0bacfe06a8baea
Author: Kan Liang 
AuthorDate: Tue, 11 Aug 2015 06:30:50 -0400
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 12 Aug 2015 13:20:29 -0300

perf tests: Add tests to callgraph and time parse

Add tests in tests/parse-events.c to check call-graph and time option.

Signed-off-by: Kan Liang 
Cc: Andi Kleen 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Link: 
http://lkml.kernel.org/r/1439289050-40510-4-git-send-email-kan.li...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/tests/parse-events.c | 38 ++
 1 file changed, 38 insertions(+)

diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index f65bb89..9b6b2b63 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -479,6 +479,39 @@ static int test__checkevent_pmu_name(struct perf_evlist 
*evlist)
return 0;
 }
 
+static int test__checkevent_pmu_partial_time_callgraph(struct perf_evlist 
*evlist)
+{
+   struct perf_evsel *evsel = perf_evlist__first(evlist);
+
+   /* cpu/config=1,call-graph=fp,time,period=10/ */
+   TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
+   TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type);
+   TEST_ASSERT_VAL("wrong config",  1 == evsel->attr.config);
+   /*
+* The period, time and callgraph value gets configured
+* within perf_evlist__config,
+* while this test executes only parse events method.
+*/
+   TEST_ASSERT_VAL("wrong period", 0 == evsel->attr.sample_period);
+   TEST_ASSERT_VAL("wrong callgraph",  !(PERF_SAMPLE_CALLCHAIN & 
evsel->attr.sample_type));
+   TEST_ASSERT_VAL("wrong time",  !(PERF_SAMPLE_TIME & 
evsel->attr.sample_type));
+
+   /* cpu/config=2,call-graph=no,time=0,period=2000/ */
+   evsel = perf_evsel__next(evsel);
+   TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type);
+   TEST_ASSERT_VAL("wrong config",  2 == evsel->attr.config);
+   /*
+* The period, time and callgraph value gets configured
+* within perf_evlist__config,
+* while this test executes only parse events method.
+*/
+   TEST_ASSERT_VAL("wrong period", 0 == evsel->attr.sample_period);
+   TEST_ASSERT_VAL("wrong callgraph",  !(PERF_SAMPLE_CALLCHAIN & 
evsel->attr.sample_type));
+   TEST_ASSERT_VAL("wrong time",  !(PERF_SAMPLE_TIME & 
evsel->attr.sample_type));
+
+   return 0;
+}
+
 static int test__checkevent_pmu_events(struct perf_evlist *evlist)
 {
struct perf_evsel *evsel = perf_evlist__first(evlist);
@@ -1555,6 +1588,11 @@ static struct evlist_test test__events_pmu[] = {
.check = test__checkevent_pmu_name,
.id= 1,
},
+   {
+   .name  = 
"cpu/config=1,call-graph=fp,time,period=10/,cpu/config=2,call-graph=no,time=0,period=2000/",
+   .check = test__checkevent_pmu_partial_time_callgraph,
+   .id= 2,
+   },
 };
 
 struct terms_test {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf report: Show call graph from reference events

2015-08-13 Thread tip-bot for Kan Liang
Commit-ID:  9e207ddfa20781e56465ce9a537f0a377c9d34fb
Gitweb: http://git.kernel.org/tip/9e207ddfa20781e56465ce9a537f0a377c9d34fb
Author: Kan Liang 
AuthorDate: Tue, 11 Aug 2015 06:30:49 -0400
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 12 Aug 2015 13:20:28 -0300

perf report: Show call graph from reference events

Introduce --show-ref-call-graph for perf report to print reference
callgraph for no callgraph event.

Here is an example.

 perf report --show-ref-call-graph --stdio

 # To display the perf.data header info, please use
 --header/--header-only options.
 #
 #
 # Total Lost Samples: 0
 #
 # Samples: 5  of event 'cpu/cpu-cycles,call-graph=fp/'
 # Event count (approx.): 144985
 #
 # Children  Self  Command  Shared Object Symbol
 #     ...    

 #
72.30% 0.00%  sleep[kernel.vmlinux]  [k] entry_SYSCALL_64_fastpath
  |
  ---entry_SYSCALL_64_fastpath
 |
 |--22.62%-- __GI___libc_nanosleep
  --77.38%-- [...]

..

 # Samples: 6  of event 'cpu/instructions,call-graph=no/', show reference 
callgraph
 # Event count (approx.): 172780
 #
 # Children  Self  Command  Shared Object Symbol
 #     ...    

 #
73.16% 0.00%  sleep[kernel.vmlinux]  [k] entry_SYSCALL_64_fastpath
  |
  ---entry_SYSCALL_64_fastpath
 |
 |--31.44%-- __GI___libc_nanosleep
  --68.56%-- [...]

Signed-off-by: Kan Liang 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Andi Kleen 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Link: 
http://lkml.kernel.org/r/1439289050-40510-3-git-send-email-kan.li...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/Documentation/perf-report.txt | 11 +++
 tools/perf/builtin-report.c  |  7 +++
 tools/perf/ui/browsers/hists.c   |  9 +++--
 tools/perf/util/hist.c   |  7 ++-
 tools/perf/util/symbol.h |  3 ++-
 5 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/tools/perf/Documentation/perf-report.txt 
b/tools/perf/Documentation/perf-report.txt
index 7b07d19..a18ba75 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -359,6 +359,17 @@ OPTIONS
 --full-source-path::
Show the full path for source files for srcline output.
 
+--show-ref-call-graph::
+   When multiple events are sampled, it may not be needed to collect
+   callgraphs for all of them. The sample sites are usually nearby,
+   and it's enough to collect the callgraphs on a reference event.
+   So user can use "call-graph=no" event modifier to disable callgraph
+   for other events to reduce the overhead.
+   However, perf report cannot show callgraphs for the event which
+   disable the callgraph.
+   This option extends the perf report to show reference callgraphs,
+   which collected by reference event, in no callgraph event.
+
 include::callchain-overhead-calculation.txt[]
 
 SEE ALSO
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index f301e86..62b285e 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -316,6 +316,11 @@ static size_t hists__fprintf_nr_sample_events(struct hists 
*hists, struct report
if (evname != NULL)
ret += fprintf(fp, " of event '%s'", evname);
 
+   if (symbol_conf.show_ref_callgraph &&
+   strstr(evname, "call-graph=no")) {
+   ret += fprintf(fp, ", show reference callgraph");
+   }
+
if (rep->mem_mode) {
ret += fprintf(fp, "\n# Total weight : %" PRIu64, nr_events);
ret += fprintf(fp, "\n# Sort order   : %s", sort_order ? : 
default_mem_sort_order);
@@ -740,6 +745,8 @@ int cmd_report(int argc, const char **argv, const char 
*prefix __maybe_unused)
itrace_parse_synth_opts),
OPT_BOOLEAN(0, "full-source-path", &srcline_full_filename,
"Show full source file name path for source lines"),
+   OPT_BOOLEAN(0, "show-ref-call-graph", &symbol_conf.show_ref_callgraph,
+   "Show callgraph from reference event"),
OPT_END()
};
struct perf_data_file file = {
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index f296b73..10c7ec0 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1267,6 +1267,8 @@ static int hists__browser_title(struct hists *hists,
const char *ev_name = perf_evsel__name(evsel);
char buf[512];
size_t buflen = sizeof(buf);
+   char ref[30] = " show reference callgraph, ";
+   bool enable_ref = false;
 
if (symbol_conf.filter_relative) {
nr_samples = h

[tip:perf/core] perf probe: Fix to show lines of sys_ functions correctly

2015-08-13 Thread tip-bot for Masami Hiramatsu
Commit-ID:  75186a9b09e47072f442f43e292cd47180b67b5c
Gitweb: http://git.kernel.org/tip/75186a9b09e47072f442f43e292cd47180b67b5c
Author: Masami Hiramatsu 
AuthorDate: Wed, 12 Aug 2015 10:24:07 +0900
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 12 Aug 2015 13:20:27 -0300

perf probe: Fix to show lines of sys_ functions correctly

"perf probe --lines sys_poll" shows only the first line of sys_poll,
because the SYSCALL_DEFINE macro:

  
  SYSCALL_DEFINE*(foo,...)
  {
body;
  }
  

  is expanded as below (on debuginfo)

  

  static inline int SYSC_foo(...)
  {
body;
  }
  int SyS_foo(...) <- is an alias of sys_foo.
  {
return SYSC_foo(...);
  }
  

So, "perf probe --lines sys_foo" decodes SyS_foo function and it also skips
inlined functions(SYSC_foo) inside the target function because those functions
are usually defined somewhere else.

To fix this issue, this fix checks whether the inlined function is defined at
the same point of the target function, and if so, it doesn't skip the inline
function.

Reported-by: Arnaldo Carvalho de Melo 
Signed-off-by: Masami Hiramatsu 
Tested-by: Arnaldo Carvalho de Melo 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Link: 
http://lkml.kernel.org/r/20150812012406.11811.94691.stgit@localhost.localdomain
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/dwarf-aux.c | 18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c
index 57f3ef4..445f455 100644
--- a/tools/perf/util/dwarf-aux.c
+++ b/tools/perf/util/dwarf-aux.c
@@ -734,15 +734,18 @@ int die_walk_lines(Dwarf_Die *rt_die, 
line_walk_callback_t callback, void *data)
Dwarf_Lines *lines;
Dwarf_Line *line;
Dwarf_Addr addr;
-   const char *fname;
+   const char *fname, *decf = NULL;
int lineno, ret = 0;
+   int decl = 0, inl;
Dwarf_Die die_mem, *cu_die;
size_t nlines, i;
 
/* Get the CU die */
-   if (dwarf_tag(rt_die) != DW_TAG_compile_unit)
+   if (dwarf_tag(rt_die) != DW_TAG_compile_unit) {
cu_die = dwarf_diecu(rt_die, &die_mem, NULL, NULL);
-   else
+   dwarf_decl_line(rt_die, &decl);
+   decf = dwarf_decl_file(rt_die);
+   } else
cu_die = rt_die;
if (!cu_die) {
pr_debug2("Failed to get CU from given DIE.\n");
@@ -773,9 +776,14 @@ int die_walk_lines(Dwarf_Die *rt_die, line_walk_callback_t 
callback, void *data)
 * The line is included in given function, and
 * no inline block includes it.
 */
-   if (!dwarf_haspc(rt_die, addr) ||
-   die_find_inlinefunc(rt_die, addr, &die_mem))
+   if (!dwarf_haspc(rt_die, addr))
continue;
+   if (die_find_inlinefunc(rt_die, addr, &die_mem)) {
+   dwarf_decl_line(&die_mem, &inl);
+   if (inl != decl ||
+   decf != dwarf_decl_file(&die_mem))
+   continue;
+   }
/* Get source line */
fname = dwarf_linesrc(line, NULL, NULL);
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf callchain: Per-event type selection support

2015-08-13 Thread tip-bot for Kan Liang
Commit-ID:  d457c96392bb418bd998f3ccf93e0e4c958fcd0f
Gitweb: http://git.kernel.org/tip/d457c96392bb418bd998f3ccf93e0e4c958fcd0f
Author: Kan Liang 
AuthorDate: Tue, 11 Aug 2015 06:30:47 -0400
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 12 Aug 2015 13:20:27 -0300

perf callchain: Per-event type selection support

This patchkit adds the ability to set callgraph mode (fp, dwarf, lbr) per
event. This in term can reduce sampling overhead and the size of the
perf.data.

Here is an example.

  perf record -e 
'cpu/cpu-cycles,period=1000,call-graph=fp,time=1/,cpu/instructions,call-graph=lbr/'
 sleep 1

 perf evlist -v
 cpu/cpu-cycles,period=1000,call-graph=fp,time=1/: type: 4, size: 112,
 config: 0x3c, { sample_period, sample_freq }: 1000, sample_type:
 IP|TID|TIME|CALLCHAIN|PERIOD|IDENTIFIER, read_format: ID, disabled: 1,
 inherit: 1, mmap: 1, comm: 1, enable_on_exec: 1, task: 1, sample_id_all:
 1, exclude_guest: 1, mmap2: 1, comm_exec: 1
 cpu/instructions,call-graph=lbr/: type: 4, size: 112, config: 0xc0, {
 sample_period, sample_freq }: 4000, sample_type:
 IP|TID|TIME|CALLCHAIN|PERIOD|BRANCH_STACK|IDENTIFIER, read_format: ID,
 disabled: 1, inherit: 1, freq: 1, enable_on_exec: 1, sample_id_all: 1,
 exclude_guest: 1

Signed-off-by: Kan Liang 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Andi Kleen 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Link: 
http://lkml.kernel.org/r/1439289050-40510-1-git-send-email-kan.li...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/Documentation/perf-record.txt |  3 ++
 tools/perf/util/evsel.c  | 62 ++--
 tools/perf/util/evsel.h  |  4 +++
 tools/perf/util/parse-events.c   | 12 +++
 tools/perf/util/parse-events.h   |  2 ++
 tools/perf/util/parse-events.l   |  2 ++
 tools/perf/util/pmu.c|  4 ++-
 7 files changed, 86 insertions(+), 3 deletions(-)

diff --git a/tools/perf/Documentation/perf-record.txt 
b/tools/perf/Documentation/perf-record.txt
index afbe45e..7f82dec 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -53,6 +53,9 @@ OPTIONS
  - 'time': Disable/enable time stamping. Acceptable values are 1 for
enabling time stamping. 0 for disabling time stamping.
The default is 1.
+ - 'call-graph': Disable/enable callgraph. Acceptable str are "fp" for
+FP mode, "dwarf" for DWARF mode, "lbr" for LBR mode.
+ - 'stack-size': user stack size for dwarf mode
  Note: If user explicitly sets options which conflict with the params,
  the value set by the params will be overridden.
 
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 04f..6647925 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -588,11 +588,36 @@ perf_evsel__config_callgraph(struct perf_evsel *evsel,
}
 }
 
-static void apply_config_terms(struct perf_evsel *evsel)
+static void
+perf_evsel__reset_callgraph(struct perf_evsel *evsel,
+   struct callchain_param *param)
+{
+   struct perf_event_attr *attr = &evsel->attr;
+
+   perf_evsel__reset_sample_bit(evsel, CALLCHAIN);
+   if (param->record_mode == CALLCHAIN_LBR) {
+   perf_evsel__reset_sample_bit(evsel, BRANCH_STACK);
+   attr->branch_sample_type &= ~(PERF_SAMPLE_BRANCH_USER |
+ PERF_SAMPLE_BRANCH_CALL_STACK);
+   }
+   if (param->record_mode == CALLCHAIN_DWARF) {
+   perf_evsel__reset_sample_bit(evsel, REGS_USER);
+   perf_evsel__reset_sample_bit(evsel, STACK_USER);
+   }
+}
+
+static void apply_config_terms(struct perf_evsel *evsel,
+  struct record_opts *opts)
 {
struct perf_evsel_config_term *term;
struct list_head *config_terms = &evsel->config_terms;
struct perf_event_attr *attr = &evsel->attr;
+   struct callchain_param param;
+   u32 dump_size = 0;
+   char *callgraph_buf = NULL;
+
+   /* callgraph default */
+   param.record_mode = callchain_param.record_mode;
 
list_for_each_entry(term, config_terms, list) {
switch (term->type) {
@@ -610,10 +635,43 @@ static void apply_config_terms(struct perf_evsel *evsel)
else
perf_evsel__reset_sample_bit(evsel, TIME);
break;
+   case PERF_EVSEL__CONFIG_TERM_CALLGRAPH:
+   callgraph_buf = term->val.callgraph;
+   break;
+   case PERF_EVSEL__CONFIG_TERM_STACK_USER:
+   dump_size = term->val.stack_user;
+   break;
default:
break;
}
}
+
+   /* User explicitly set per-event callgraph, clear the old setting and 
reset. */
+ 

[tip:perf/core] perf callchain: Allow disabling call graphs per event

2015-08-13 Thread tip-bot for Kan Liang
Commit-ID:  f9db0d0f1b2cf030083c83d3ed3a4bbae6bdc8b7
Gitweb: http://git.kernel.org/tip/f9db0d0f1b2cf030083c83d3ed3a4bbae6bdc8b7
Author: Kan Liang 
AuthorDate: Tue, 11 Aug 2015 06:30:48 -0400
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 12 Aug 2015 13:20:28 -0300

perf callchain: Allow disabling call graphs per event

This patch introduce "call-graph=no" to disable per-event callgraph.

Here is an example.

  perf record -e 
'cpu/cpu-cycles,call-graph=fp/,cpu/instructions,call-graph=no/' sleep 1

  perf report --stdio

  # To display the perf.data header info, please use
  --header/--header-only options.
  #
  #
  # Total Lost Samples: 0
  #
  # Samples: 6  of event 'cpu/cpu-cycles,call-graph=fp/'
  # Event count (approx.): 774218
  #
  # Children  Self  Command  Shared Object Symbol
  #     ...    

  #
61.94% 0.00%  sleep[kernel.vmlinux]  [k] entry_SYSCALL_64_fastpath
  |
  ---entry_SYSCALL_64_fastpath
 |
 |--97.30%-- __brk
 |
  --2.70%-- mmap64
_dl_check_map_versions
_dl_check_all_versions

61.94% 0.00%  sleep[kernel.vmlinux]  [k] perf_event_mmap
  |
  ---perf_event_mmap
 |
 |--97.30%-- do_brk
 |  sys_brk
 |  entry_SYSCALL_64_fastpath
 |  __brk
 |
  --2.70%-- mmap_region
do_mmap_pgoff
vm_mmap_pgoff
sys_mmap_pgoff
sys_mmap
entry_SYSCALL_64_fastpath
mmap64
_dl_check_map_versions
_dl_check_all_versions
  ..

  # Samples: 6  of event 'cpu/instructions,call-graph=no/'
  # Event count (approx.): 359692
  #
  # Children  Self  Command  Shared Object Symbol
  #     ...    
.
  #
 89.03% 0.00%  sleep[unknown] [.] 0x65986598
 89.03% 0.00%  sleepld-2.17.so[.] _dl_resolve_conflicts
 89.03% 0.00%  sleep[kernel.vmlinux]  [k] page_fault

Signed-off-by: Kan Liang 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Andi Kleen 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Link: 
http://lkml.kernel.org/r/1439289050-40510-2-git-send-email-kan.li...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/Documentation/perf-record.txt |  3 ++-
 tools/perf/builtin-annotate.c|  2 ++
 tools/perf/builtin-diff.c|  3 +++
 tools/perf/tests/hists_cumulate.c|  4 
 tools/perf/util/evsel.c  | 17 +++--
 tools/perf/util/hist.c   |  9 ++---
 6 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/tools/perf/Documentation/perf-record.txt 
b/tools/perf/Documentation/perf-record.txt
index 7f82dec..347a273 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -54,7 +54,8 @@ OPTIONS
enabling time stamping. 0 for disabling time stamping.
The default is 1.
  - 'call-graph': Disable/enable callgraph. Acceptable str are "fp" for
-FP mode, "dwarf" for DWARF mode, "lbr" for LBR mode.
+FP mode, "dwarf" for DWARF mode, "lbr" for LBR mode and
+"no" for disable callgraph.
  - 'stack-size': user stack size for dwarf mode
  Note: If user explicitly sets options which conflict with the params,
  the value set by the params will be overridden.
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 467a23b..a32a64e 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -239,6 +239,8 @@ static int __cmd_annotate(struct perf_annotate *ann)
if (nr_samples > 0) {
total_nr_samples += nr_samples;
hists__collapse_resort(hists, NULL);
+   /* Don't sort callchain */
+   perf_evsel__reset_sample_bit(pos, CALLCHAIN);
hists__output_resort(hists, NULL);
 
if (symbol_conf.event_group &&
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index daaa7dc..0b180a8 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -722,6 +722,9 @@ static void data_process(void)
if (verbose || data__files_cnt > 2)
data__fprintf();
 
+   /* Don't sort callchain for perf diff */
+   perf_evsel__reset_sample_bit(evsel_base, CALLCHAIN);
+
 

[tip:perf/core] perf ui browser: Introduce ui_browser__printf()

2015-08-13 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  517dfdb315fa2da9b144f6fa494b4f54b490de7e
Gitweb: http://git.kernel.org/tip/517dfdb315fa2da9b144f6fa494b4f54b490de7e
Author: Arnaldo Carvalho de Melo 
AuthorDate: Tue, 11 Aug 2015 12:50:55 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 12 Aug 2015 10:27:05 -0300

perf ui browser: Introduce ui_browser__printf()

To remove direct access to libslang functions, with the immediate goal
of implementing horizontal scrolling at the ui_browser level, but also
because we may at some point want to implement ui_browser with other UIs
in addition to the current libslang implementation.

Cc: Adrian Hunter 
Cc: Borislav Petkov 
Cc: David Ahern 
Cc: Frederic Weisbecker 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Stephane Eranian 
Link: http://lkml.kernel.org/n/tip-w0niblabqrkecs4o0eogf...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/ui/browser.c   |  9 +
 tools/perf/ui/browser.h   |  1 +
 tools/perf/ui/browsers/annotate.c | 19 ++-
 tools/perf/ui/browsers/hists.c| 16 
 tools/perf/ui/browsers/map.c  |  9 -
 tools/perf/ui/libslang.h  |  3 +++
 6 files changed, 35 insertions(+), 22 deletions(-)

diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c
index 5c730ab..c6c7e51 100644
--- a/tools/perf/ui/browser.c
+++ b/tools/perf/ui/browser.c
@@ -52,6 +52,15 @@ void ui_browser__write_nstring(struct ui_browser *browser 
__maybe_unused, const
slsmg_write_nstring(msg, width);
 }
 
+void ui_browser__printf(struct ui_browser *browser __maybe_unused, const char 
*fmt, ...)
+{
+   va_list args;
+
+   va_start(args, fmt);
+   slsmg_vprintf(fmt, args);
+   va_end(args);
+}
+
 static struct list_head *
 ui_browser__list_head_filter_entries(struct ui_browser *browser,
 struct list_head *pos)
diff --git a/tools/perf/ui/browser.h b/tools/perf/ui/browser.h
index ba276c7..52be871 100644
--- a/tools/perf/ui/browser.h
+++ b/tools/perf/ui/browser.h
@@ -39,6 +39,7 @@ void ui_browser__reset_index(struct ui_browser *browser);
 void ui_browser__gotorc(struct ui_browser *browser, int y, int x);
 void ui_browser__write_nstring(struct ui_browser *browser, const char *msg,
   unsigned int width);
+void ui_browser__printf(struct ui_browser *browser, const char *fmt, ...);
 void ui_browser__write_graph(struct ui_browser *browser, int graph);
 void __ui_browser__line_arrow(struct ui_browser *browser, unsigned int column,
  u64 start, u64 end);
diff --git a/tools/perf/ui/browsers/annotate.c 
b/tools/perf/ui/browsers/annotate.c
index c14f8f9..29739b3 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -1,7 +1,6 @@
 #include "../../util/util.h"
 #include "../browser.h"
 #include "../helpline.h"
-#include "../libslang.h"
 #include "../ui.h"
 #include "../util.h"
 #include "../../util/annotate.h"
@@ -134,11 +133,13 @@ static void annotate_browser__write(struct ui_browser 
*browser, void *entry, int
ui_browser__set_percent_color(browser,
bdl->samples[i].percent,
current_entry);
-   if (annotate_browser__opts.show_total_period)
-   slsmg_printf("%6" PRIu64 " ",
-bdl->samples[i].nr);
-   else
-   slsmg_printf("%6.2f ", 
bdl->samples[i].percent);
+   if (annotate_browser__opts.show_total_period) {
+   ui_browser__printf(browser, "%6" PRIu64 
" ",
+  bdl->samples[i].nr);
+   } else {
+   ui_browser__printf(browser, "%6.2f ",
+  
bdl->samples[i].percent);
+   }
}
} else {
ui_browser__write_nstring(browser, " ", 7 * 
ab->nr_events);
@@ -149,12 +150,12 @@ static void annotate_browser__write(struct ui_browser 
*browser, void *entry, int
}
if (ab->have_cycles) {
if (dl->ipc)
-   slsmg_printf("%*.2f ", IPC_WIDTH - 1, dl->ipc);
+   ui_browser__printf(browser, "%*.2f ", IPC_WIDTH - 1, 
dl->ipc);
else
ui_browser__write_nstring(browser, " ", IPC_WIDTH);
if (dl->cycles)
-   slsmg_printf("%*" PRIu64 " ",
-CYCLES_WIDTH - 1, dl->cycles);
+   ui_browser__printf(browser, "%*" PRIu64 " ",
+  CYCLES_WIDTH - 1, dl-

[tip:perf/core] perf hists browser: Make ESC unzoom as well

2015-08-13 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  63ab1749f39aeec27b0dcf71cd7996d862c5ad63
Gitweb: http://git.kernel.org/tip/63ab1749f39aeec27b0dcf71cd7996d862c5ad63
Author: Arnaldo Carvalho de Melo 
AuthorDate: Wed, 12 Aug 2015 12:42:58 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 12 Aug 2015 12:46:55 -0300

perf hists browser: Make ESC unzoom as well

In addition to <-, that may be repurposed for horizontal scrolling.

Cc: Adrian Hunter 
Cc: Borislav Petkov 
Cc: David Ahern 
Cc: Frederic Weisbecker 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Stephane Eranian 
Link: http://lkml.kernel.org/n/tip-w3rctelxr4yxrjufx7z3f...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/ui/browsers/hists.c | 19 ---
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 2de53d6..f296b73 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1868,6 +1868,7 @@ static int perf_evsel__hists_browse(struct perf_evsel 
*evsel, int nr_events,
case K_RIGHT:
/* menu */
break;
+   case K_ESC:
case K_LEFT: {
const void *top;
 
@@ -1877,6 +1878,12 @@ static int perf_evsel__hists_browse(struct perf_evsel 
*evsel, int nr_events,
 */
if (left_exits)
goto out_free_stack;
+
+   if (key == K_ESC &&
+   ui_browser__dialog_yesno(&browser->b,
+"Do you really 
want to exit?"))
+   goto out_free_stack;
+
continue;
}
top = pstack__peek(browser->pstack);
@@ -1892,12 +1899,6 @@ static int perf_evsel__hists_browse(struct perf_evsel 
*evsel, int nr_events,
do_zoom_thread(browser, actions);
continue;
}
-   case K_ESC:
-   if (!left_exits &&
-   !ui_browser__dialog_yesno(&browser->b,
-  "Do you really want to exit?"))
-   continue;
-   /* Fall thru */
case 'q':
case CTRL('c'):
goto out_free_stack;
@@ -2120,15 +2121,11 @@ browse_hists:
else
pos = perf_evsel__prev(pos);
goto browse_hists;
-   case K_ESC:
-   if (!ui_browser__dialog_yesno(&menu->b,
-   "Do you really want to exit?"))
-   continue;
-   /* Fall thru */
case K_SWITCH_INPUT_DATA:
case 'q':
case CTRL('c'):
goto out;
+   case K_ESC:
default:
continue;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf ui browser: Introduce ui_browser__write_nstring()

2015-08-13 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  26270a008251ec36431623bd992252934bbe529a
Gitweb: http://git.kernel.org/tip/26270a008251ec36431623bd992252934bbe529a
Author: Arnaldo Carvalho de Melo 
AuthorDate: Tue, 11 Aug 2015 12:24:27 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 12 Aug 2015 10:27:04 -0300

perf ui browser: Introduce ui_browser__write_nstring()

To remove direct access to libslang functions, with the immediate goal
of implementing horizontal scrolling at the ui_browser level, but also
because we may at some point want to implement ui_browser with other UIs
in addition to the current libslang implementation.

Cc: Adrian Hunter 
Cc: Borislav Petkov 
Cc: David Ahern 
Cc: Frederic Weisbecker 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Stephane Eranian 
Link: http://lkml.kernel.org/n/tip-437ineavoejzou727mr9b...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/ui/browser.c   |  8 +++-
 tools/perf/ui/browser.h   |  2 ++
 tools/perf/ui/browsers/annotate.c | 24 
 tools/perf/ui/browsers/header.c   |  2 +-
 tools/perf/ui/browsers/hists.c| 10 +-
 tools/perf/ui/browsers/map.c  |  2 +-
 tools/perf/ui/browsers/scripts.c  |  2 +-
 tools/perf/ui/tui/util.c  |  2 +-
 8 files changed, 30 insertions(+), 22 deletions(-)

diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c
index 6680fa5..5c730ab 100644
--- a/tools/perf/ui/browser.c
+++ b/tools/perf/ui/browser.c
@@ -46,6 +46,12 @@ void ui_browser__gotorc(struct ui_browser *browser, int y, 
int x)
SLsmg_gotorc(browser->y + y, browser->x + x);
 }
 
+void ui_browser__write_nstring(struct ui_browser *browser __maybe_unused, 
const char *msg,
+  unsigned int width)
+{
+   slsmg_write_nstring(msg, width);
+}
+
 static struct list_head *
 ui_browser__list_head_filter_entries(struct ui_browser *browser,
 struct list_head *pos)
@@ -234,7 +240,7 @@ void __ui_browser__show_title(struct ui_browser *browser, 
const char *title)
 {
SLsmg_gotorc(0, 0);
ui_browser__set_color(browser, HE_COLORSET_ROOT);
-   slsmg_write_nstring(title, browser->width + 1);
+   ui_browser__write_nstring(browser, title, browser->width + 1);
 }
 
 void ui_browser__show_title(struct ui_browser *browser, const char *title)
diff --git a/tools/perf/ui/browser.h b/tools/perf/ui/browser.h
index 92ae721..ba276c7 100644
--- a/tools/perf/ui/browser.h
+++ b/tools/perf/ui/browser.h
@@ -37,6 +37,8 @@ void ui_browser__refresh_dimensions(struct ui_browser 
*browser);
 void ui_browser__reset_index(struct ui_browser *browser);
 
 void ui_browser__gotorc(struct ui_browser *browser, int y, int x);
+void ui_browser__write_nstring(struct ui_browser *browser, const char *msg,
+  unsigned int width);
 void ui_browser__write_graph(struct ui_browser *browser, int graph);
 void __ui_browser__line_arrow(struct ui_browser *browser, unsigned int column,
  u64 start, u64 end);
diff --git a/tools/perf/ui/browsers/annotate.c 
b/tools/perf/ui/browsers/annotate.c
index b5fc847..c14f8f9 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -141,22 +141,22 @@ static void annotate_browser__write(struct ui_browser 
*browser, void *entry, int
slsmg_printf("%6.2f ", 
bdl->samples[i].percent);
}
} else {
-   slsmg_write_nstring(" ", 7 * ab->nr_events);
+   ui_browser__write_nstring(browser, " ", 7 * 
ab->nr_events);
}
} else {
ui_browser__set_percent_color(browser, 0, current_entry);
-   slsmg_write_nstring(" ", 7 * ab->nr_events);
+   ui_browser__write_nstring(browser, " ", 7 * ab->nr_events);
}
if (ab->have_cycles) {
if (dl->ipc)
slsmg_printf("%*.2f ", IPC_WIDTH - 1, dl->ipc);
else
-   slsmg_write_nstring(" ", IPC_WIDTH);
+   ui_browser__write_nstring(browser, " ", IPC_WIDTH);
if (dl->cycles)
slsmg_printf("%*" PRIu64 " ",
 CYCLES_WIDTH - 1, dl->cycles);
else
-   slsmg_write_nstring(" ", CYCLES_WIDTH);
+   ui_browser__write_nstring(browser, " ", CYCLES_WIDTH);
}
 
SLsmg_write_char(' ');
@@ -166,7 +166,7 @@ static void annotate_browser__write(struct ui_browser 
*browser, void *entry, int
width += 1;
 
if (!*dl->line)
-   slsmg_write_nstring(" ", width - pcnt_width);
+   ui_browser__write_nstring(browser, " ", width - pcnt_width);
else if (dl->offset == -1) {
if (dl->line_nr && annotate_browser__opts.show_linenr)
printed = scnprintf(bf, si

[tip:perf/core] perf trace: Beautify keyctl's option arg

2015-08-13 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  b62bee1bdea6d78e444183b04c81ce982a371571
Gitweb: http://git.kernel.org/tip/b62bee1bdea6d78e444183b04c81ce982a371571
Author: Arnaldo Carvalho de Melo 
AuthorDate: Tue, 11 Aug 2015 11:05:36 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 12 Aug 2015 10:27:03 -0300

perf trace: Beautify keyctl's option arg

 8.697 (0.103 ms): pool/2343 keyctl(option: GET_PERSISTENT, arg2: 1000, arg3: 
4294967294, arg4: 140703061514067, arg5: 140703692383680) = 1023192809
 8.763 (0.049 ms): pool/2343 keyctl(option: SEARCH, arg2: 1023192809, arg3: 
140703745767772, arg4: 140703745767832, arg5: 4294967294) = 140224497
 8.789 (0.016 ms): pool/2343 keyctl(option: SEARCH, arg2: 140224497, arg3: 
140703745767814, arg4: 140703745767900) = 512300257
 8.807 (0.011 ms): pool/2343 keyctl(option: READ, arg2: 512300257   
   ) = 13
 8.822 (0.008 ms): pool/2343 keyctl(option: READ, arg2: 512300257, arg3: 
140703061514000, arg4: 13 ) = 13
 8.837 (0.007 ms): pool/2343 keyctl(option: READ, arg2: 140224497   
   ) = 4
 8.852 (0.009 ms): pool/2343 keyctl(option: READ, arg2: 140224497, arg3: 
140703061514000, arg4: 4  ) = 4
 8.869 (0.010 ms): pool/2343 keyctl(option: SEARCH, arg2: 140224497, arg3: 
140703745767772, arg4: 140703061514032) = -1 ENOKEY Required key not available
 8.892 (0.017 ms): pool/2343 keyctl(option: DESCRIBE, arg2: 512300257   
   ) = 43
 8.910 (0.012 ms): pool/2343 keyctl(option: DESCRIBE, arg2: 512300257, arg3: 
140703061544384, arg4: 43) = 43

Cc: Adrian Hunter 
Cc: Borislav Petkov 
Cc: David Ahern 
Cc: Frederic Weisbecker 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Stephane Eranian 
Link: http://lkml.kernel.org/n/tip-013ab219irsxngyumrf5g...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-trace.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 12fc6df..489cc11 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -569,6 +569,15 @@ static DEFINE_STRARRAY_OFFSET(epoll_ctl_ops, 1);
 static const char *itimers[] = { "REAL", "VIRTUAL", "PROF", };
 static DEFINE_STRARRAY(itimers);
 
+static const char *keyctl_options[] = {
+   "GET_KEYRING_ID", "JOIN_SESSION_KEYRING", "UPDATE", "REVOKE", "CHOWN",
+   "SETPERM", "DESCRIBE", "CLEAR", "LINK", "UNLINK", "SEARCH", "READ",
+   "INSTANTIATE", "NEGATE", "SET_REQKEY_KEYRING", "SET_TIMEOUT",
+   "ASSUME_AUTHORITY", "GET_SECURITY", "SESSION_TO_PARENT", "REJECT",
+   "INSTANTIATE_IOV", "INVALIDATE", "GET_PERSISTENT",
+};
+static DEFINE_STRARRAY(keyctl_options);
+
 static const char *whences[] = { "SET", "CUR", "END",
 #ifdef SEEK_DATA
 "DATA",
@@ -1071,6 +1080,7 @@ static struct syscall_fmt {
 #else
 [2] = SCA_HEX, /* arg */ }, },
 #endif
+   { .name = "keyctl", .errmsg = true, STRARRAY(0, option, 
keyctl_options), },
{ .name = "kill",   .errmsg = true,
  .arg_scnprintf = { [1] = SCA_SIGNUM, /* sig */ }, },
{ .name = "lchown",.errmsg = true,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf trace: Use the FD beautifier for socket syscall fds

2015-08-13 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  8d8c66a248dfb9a7e517822b5ef87e357b1605bf
Gitweb: http://git.kernel.org/tip/8d8c66a248dfb9a7e517822b5ef87e357b1605bf
Author: Arnaldo Carvalho de Melo 
AuthorDate: Tue, 11 Aug 2015 10:57:02 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 12 Aug 2015 10:27:03 -0300

perf trace: Use the FD beautifier for socket syscall fds

But we really should have something like 'strace -yy' here...

Cc: Adrian Hunter 
Cc: Borislav Petkov 
Cc: David Ahern 
Cc: Frederic Weisbecker 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Stephane Eranian 
Link: http://lkml.kernel.org/n/tip-eyrt1ypfq68u4ljagyk2n...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-trace.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 5c494a8..12fc6df 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1173,11 +1173,14 @@ static struct syscall_fmt {
{ .name = "readv",  .errmsg = true,
  .arg_scnprintf = { [0] = SCA_FD, /* fd */ }, },
{ .name = "recvfrom",   .errmsg = true,
- .arg_scnprintf = { [3] = SCA_MSG_FLAGS, /* flags */ }, },
+ .arg_scnprintf = { [0] = SCA_FD, /* fd */
+[3] = SCA_MSG_FLAGS, /* flags */ }, },
{ .name = "recvmmsg",   .errmsg = true,
- .arg_scnprintf = { [3] = SCA_MSG_FLAGS, /* flags */ }, },
+ .arg_scnprintf = { [0] = SCA_FD, /* fd */
+[3] = SCA_MSG_FLAGS, /* flags */ }, },
{ .name = "recvmsg",.errmsg = true,
- .arg_scnprintf = { [2] = SCA_MSG_FLAGS, /* flags */ }, },
+ .arg_scnprintf = { [0] = SCA_FD, /* fd */
+[2] = SCA_MSG_FLAGS, /* flags */ }, },
{ .name = "removexattr", .errmsg = true,
  .arg_scnprintf = { [0] = SCA_FILENAME, /* pathname */ }, },
{ .name = "renameat",   .errmsg = true,
@@ -1193,11 +1196,14 @@ static struct syscall_fmt {
  .arg_scnprintf = { [2] = SCA_SIGNUM, /* sig */ }, },
{ .name = "select", .errmsg = true, .timeout = true, },
{ .name = "sendmmsg",.errmsg = true,
- .arg_scnprintf = { [3] = SCA_MSG_FLAGS, /* flags */ }, },
+ .arg_scnprintf = { [0] = SCA_FD, /* fd */
+[3] = SCA_MSG_FLAGS, /* flags */ }, },
{ .name = "sendmsg",.errmsg = true,
- .arg_scnprintf = { [2] = SCA_MSG_FLAGS, /* flags */ }, },
+ .arg_scnprintf = { [0] = SCA_FD, /* fd */
+[2] = SCA_MSG_FLAGS, /* flags */ }, },
{ .name = "sendto", .errmsg = true,
- .arg_scnprintf = { [3] = SCA_MSG_FLAGS, /* flags */ }, },
+ .arg_scnprintf = { [0] = SCA_FD, /* fd */
+[3] = SCA_MSG_FLAGS, /* flags */ }, },
{ .name = "setitimer",  .errmsg = true, STRARRAY(0, which, 
itimers), },
{ .name = "setrlimit",  .errmsg = true, STRARRAY(0, resource, 
rlimit_resources), },
{ .name = "setxattr",   .errmsg = true,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf trace: Add missing clockid entries

2015-08-13 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  28ebb87c73f9c17266d4f7570d65a1e695df7d9d
Gitweb: http://git.kernel.org/tip/28ebb87c73f9c17266d4f7570d65a1e695df7d9d
Author: Arnaldo Carvalho de Melo 
AuthorDate: Tue, 11 Aug 2015 10:38:38 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 12 Aug 2015 10:27:02 -0300

perf trace: Add missing clockid entries

We were missing:

  CLOCK_BOOTTIME, CLOCK_REALTIME_ALARM, CLOCK_BOOTTIME_ALARM,
  CLOCK_SGI_CYCLE and CLOCK_TAI.

Add them.

Cc: Adrian Hunter 
Cc: Borislav Petkov 
Cc: David Ahern 
Cc: Frederic Weisbecker 
Cc: Jiri Olsa 
Cc: Milian Wolff 
Cc: Namhyung Kim 
Cc: Stephane Eranian 
Link: http://lkml.kernel.org/n/tip-d67rwqtwm9jyenwes98kr...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-trace.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 7cdcbee..5c494a8 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -599,7 +599,8 @@ static DEFINE_STRARRAY(sighow);
 
 static const char *clockid[] = {
"REALTIME", "MONOTONIC", "PROCESS_CPUTIME_ID", "THREAD_CPUTIME_ID",
-   "MONOTONIC_RAW", "REALTIME_COARSE", "MONOTONIC_COARSE",
+   "MONOTONIC_RAW", "REALTIME_COARSE", "MONOTONIC_COARSE", "BOOTTIME",
+   "REALTIME_ALARM", "BOOTTIME_ALARM", "SGI_CYCLE", "TAI"
 };
 static DEFINE_STRARRAY(clockid);
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf sort: Check for SRCLINE_UNKNOWN case in " srcfile" processing

2015-08-13 Thread tip-bot for Andi Kleen
Commit-ID:  76b10655818c939e257377f83992975a5f55ffb3
Gitweb: http://git.kernel.org/tip/76b10655818c939e257377f83992975a5f55ffb3
Author: Andi Kleen 
AuthorDate: Tue, 11 Aug 2015 06:36:55 -0700
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 12 Aug 2015 10:27:02 -0300

perf sort: Check for SRCLINE_UNKNOWN case in "srcfile" processing

Handle the SRCLINE_UNKNOWN case correctly when processing "srcfile".

Commiter note:

We can't just free it, as it was't allocated via malloc, its a guard
variable.

Reported-by: Namhyung Kim 
Signed-off-by: Andi Kleen 
Cc: Jiri Olsa 
Link: http://lkml.kernel.org/r/20150811133655.gc4...@tassilo.jf.intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/sort.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index c0c32b0..7e38716 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -330,6 +330,8 @@ static char *get_srcfile(struct hist_entry *e)
 
sf = get_srcline(map->dso, map__rip_2objdump(map, e->ip),
 e->ms.sym, true);
+   if (!strcmp(sf, SRCLINE_UNKNOWN))
+   return no_srcfile;
p = strchr(sf, ':');
if (p && *sf) {
*p = 0;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf trace: Associate some more syscall args with the getname beautifier

2015-08-13 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  090389b6d95c046cc6caca2e7e00adc27829acf2
Gitweb: http://git.kernel.org/tip/090389b6d95c046cc6caca2e7e00adc27829acf2
Author: Arnaldo Carvalho de Melo 
AuthorDate: Mon, 10 Aug 2015 19:20:52 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 12 Aug 2015 10:26:53 -0300

perf trace: Associate some more syscall args with the getname beautifier

This time using 'trinity' to test these:

  fchmodat, futimesat, llistxattr, lremovexattr, lstat, mknodat,
  mq_unlink, stat and vmsplice.

Cc: Adrian Hunter 
Cc: Borislav Petkov 
Cc: David Ahern 
Cc: Frederic Weisbecker 
Cc: Jiri Olsa 
Cc: Milian Wolff 
Cc: Namhyung Kim 
Cc: Stephane Eranian 
Link: http://lkml.kernel.org/n/tip-a1uqu249nwwh0ixrhm80k...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-trace.c | 23 ++-
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index a25048c..7cdcbee 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1014,7 +1014,8 @@ static struct syscall_fmt {
{ .name = "fchmod", .errmsg = true,
  .arg_scnprintf = { [0] = SCA_FD, /* fd */ }, },
{ .name = "fchmodat",   .errmsg = true,
- .arg_scnprintf = { [0] = SCA_FDAT, /* fd */ }, },
+ .arg_scnprintf = { [0] = SCA_FDAT, /* fd */
+[1] = SCA_FILENAME, /* filename */ }, },
{ .name = "fchown", .errmsg = true,
  .arg_scnprintf = { [0] = SCA_FD, /* fd */ }, },
{ .name = "fchownat",   .errmsg = true,
@@ -1045,7 +1046,8 @@ static struct syscall_fmt {
{ .name = "futex",  .errmsg = true,
  .arg_scnprintf = { [1] = SCA_FUTEX_OP, /* op */ }, },
{ .name = "futimesat", .errmsg = true,
- .arg_scnprintf = { [0] = SCA_FDAT, /* fd */ }, },
+ .arg_scnprintf = { [0] = SCA_FDAT, /* fd */
+[1] = SCA_FILENAME, /* filename */ }, },
{ .name = "getdents",   .errmsg = true,
  .arg_scnprintf = { [0] = SCA_FD, /* fd */ }, },
{ .name = "getdents64", .errmsg = true,
@@ -1078,13 +1080,18 @@ static struct syscall_fmt {
  .arg_scnprintf = { [0] = SCA_FDAT, /* fd */ }, },
{ .name = "listxattr",  .errmsg = true,
  .arg_scnprintf = { [0] = SCA_FILENAME, /* pathname */ }, },
+   { .name = "llistxattr", .errmsg = true,
+ .arg_scnprintf = { [0] = SCA_FILENAME, /* pathname */ }, },
+   { .name = "lremovexattr",  .errmsg = true,
+ .arg_scnprintf = { [0] = SCA_FILENAME, /* pathname */ }, },
{ .name = "lseek",  .errmsg = true,
  .arg_scnprintf = { [0] = SCA_FD, /* fd */
 [2] = SCA_STRARRAY, /* whence */ },
  .arg_parm  = { [2] = &strarray__whences, /* whence */ }, },
{ .name = "lsetxattr",  .errmsg = true,
  .arg_scnprintf = { [0] = SCA_FILENAME, /* pathname */ }, },
-   { .name = "lstat",  .errmsg = true, .alias = "newlstat", },
+   { .name = "lstat",  .errmsg = true, .alias = "newlstat",
+ .arg_scnprintf = { [0] = SCA_FILENAME, /* filename */ }, },
{ .name = "lsxattr",.errmsg = true,
  .arg_scnprintf = { [0] = SCA_FILENAME, /* pathname */ }, },
{ .name = "madvise",.errmsg = true,
@@ -1098,7 +1105,8 @@ static struct syscall_fmt {
{ .name = "mknod",  .errmsg = true,
  .arg_scnprintf = { [0] = SCA_FILENAME, /* filename */ }, },
{ .name = "mknodat",.errmsg = true,
- .arg_scnprintf = { [0] = SCA_FDAT, /* fd */ }, },
+ .arg_scnprintf = { [0] = SCA_FDAT, /* fd */
+[1] = SCA_FILENAME, /* filename */ }, },
{ .name = "mlock",  .errmsg = true,
  .arg_scnprintf = { [0] = SCA_HEX, /* addr */ }, },
{ .name = "mlockall",   .errmsg = true,
@@ -,6 +1119,8 @@ static struct syscall_fmt {
{ .name = "mprotect",   .errmsg = true,
  .arg_scnprintf = { [0] = SCA_HEX, /* start */
 [2] = SCA_MMAP_PROT, /* prot */ }, },
+   { .name = "mq_unlink", .errmsg = true,
+ .arg_scnprintf = { [0] = SCA_FILENAME, /* u_name */ }, },
{ .name = "mremap", .hexret = true,
  .arg_scnprintf = { [0] = SCA_HEX, /* addr */
 [3] = SCA_MREMAP_FLAGS, /* flags */
@@ -1201,7 +1211,8 @@ static struct syscall_fmt {
  .arg_scnprintf = { [0] = SCA_STRARRAY, /* family */
 [1] = SCA_SK_TYPE, /* type */ },
  .arg_parm  = { [0] = &strarray__socket_families, /* family */ }, 
},
-   { .name = "stat",   .errmsg = true, .alias = "newstat", },
+   { .name = "stat",   .errmsg = true, .alias = "newstat",
+ .arg_scnprintf = { [0] = SCA_FILENAME, /* pathname */ }, },
{ .name  

Re: [REPOST PATCH] kexec: Remove the unnecessary conditional judgement to simplify the code logic

2015-08-13 Thread Simon Horman
On Thu, Aug 13, 2015 at 01:53:45PM +0800, Baoquan He wrote:
> On 08/13/15 at 09:55am, Simon Horman wrote:
> > On Tue, Jul 28, 2015 at 12:46:42PM +0800, Minfei Huang wrote:
> > > Transforming PFN(Page Frame Number) to struct page is never failure, so
> > > we can simplify the code logic to do the image->control_page assignment
> > > directly in the loop, and remove the unnecessary conditional judgement.
> > > 
> > > Signed-off-by: Minfei Huang 
> > > Acked-by: Dave Young 
> > > Acked-by: Vivek Goyal 
> > 
> > Andrew, could you consider picking this up.
> > It seems to have been sufficiently reviewed, acked, etc...
> 
> I saw this has been in linux-next tree.

Excellent, sorry for the noise.

> commit b90b6ef0f152ef42fe66ce5c9ccf2783ea84fa69
> Author: Minfei Huang 
> Date:   Thu Jul 30 09:56:18 2015 +1000
> 
> kexec: remove unnecessary test in kimage_alloc_crash_control_pages()
> 
> Thanks
> Baoquan
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] clk: Convert __clk_get_name(hw->clk) to clk_hw_get_name(hw)

2015-08-13 Thread Heiko Stübner
Am Mittwoch, 12. August 2015, 16:12:41 schrieb Stephen Boyd:
> Use the provider based method to get a clock's name so that we
> can get rid of the clk member in struct clk_hw one day. Mostly
> converted with the following coccinelle script.
> 
> @@
> struct clk_hw *E;
> @@
> 
> -__clk_get_name(E->clk)
> +clk_hw_get_name(E)
> 

For the Rockchip part
Reviewed-by: Heiko Stuebner 


Heiko

> diff --git a/drivers/clk/rockchip/clk-inverter.c
> b/drivers/clk/rockchip/clk-inverter.c index 8054fdb5effb..7cbf43beb3c6
> 100644
> --- a/drivers/clk/rockchip/clk-inverter.c
> +++ b/drivers/clk/rockchip/clk-inverter.c
> @@ -50,7 +50,7 @@ static int rockchip_inv_set_phase(struct clk_hw *hw, int
> degrees) val = !!degrees;
>   } else {
>   pr_err("%s: unsupported phase %d for %s\n",
> -__func__, degrees, __clk_get_name(hw->clk));
> +__func__, degrees, clk_hw_get_name(hw));
>   return -EINVAL;
>   }
> 
> diff --git a/drivers/clk/rockchip/clk-mmc-phase.c
> b/drivers/clk/rockchip/clk-mmc-phase.c index 77e19097bdc7..9b613426e968
> 100644
> --- a/drivers/clk/rockchip/clk-mmc-phase.c
> +++ b/drivers/clk/rockchip/clk-mmc-phase.c
> @@ -108,7 +108,7 @@ static int rockchip_mmc_set_phase(struct clk_hw *hw, int
> degrees) writel(HIWORD_UPDATE(raw_value, 0x07ff, mmc_clock->shift),
> mmc_clock->reg);
> 
>   pr_debug("%s->set_phase(%d) delay_nums=%u reg[0x%p]=0x%03x
> actual_degrees=%d\n", -   __clk_get_name(hw->clk), degrees, 
> delay_num,
> + clk_hw_get_name(hw), degrees, delay_num,
>   mmc_clock->reg, raw_value>>(mmc_clock->shift),
>   rockchip_mmc_get_phase(hw)
>   );

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


Re: [PATCH 3/7] drm/vc4: Add KMS support for Raspberry Pi.

2015-08-13 Thread Daniel Vetter
On Wed, Aug 12, 2015 at 05:56:16PM -0700, Eric Anholt wrote:
> This is the start of a full VC4 driver.  Right now this just supports
> configuring the display using a pre-existing video mode (because
> changing the pixel clock isn't available yet, and doesn't work when it
> is).  However, this is enough for fbcon and bringing up X using
> xf86-video-modesetting.
> 
> Signed-off-by: Eric Anholt 
> ---
>  drivers/gpu/drm/Kconfig   |   2 +
>  drivers/gpu/drm/Makefile  |   1 +
>  drivers/gpu/drm/vc4/Kconfig   |  14 +
>  drivers/gpu/drm/vc4/Makefile  |  18 ++
>  drivers/gpu/drm/vc4/vc4_bo.c  |  54 
>  drivers/gpu/drm/vc4/vc4_crtc.c| 583 ++
>  drivers/gpu/drm/vc4/vc4_debugfs.c |  38 +++
>  drivers/gpu/drm/vc4/vc4_drv.c | 249 +++
>  drivers/gpu/drm/vc4/vc4_drv.h | 123 +++
>  drivers/gpu/drm/vc4/vc4_hdmi.c| 651 
> ++
>  drivers/gpu/drm/vc4/vc4_hvs.c | 172 ++
>  drivers/gpu/drm/vc4/vc4_kms.c |  84 +
>  drivers/gpu/drm/vc4/vc4_plane.c   | 320 +++
>  drivers/gpu/drm/vc4/vc4_regs.h| 562 
>  14 files changed, 2871 insertions(+)
>  create mode 100644 drivers/gpu/drm/vc4/Kconfig
>  create mode 100644 drivers/gpu/drm/vc4/Makefile
>  create mode 100644 drivers/gpu/drm/vc4/vc4_bo.c
>  create mode 100644 drivers/gpu/drm/vc4/vc4_crtc.c
>  create mode 100644 drivers/gpu/drm/vc4/vc4_debugfs.c
>  create mode 100644 drivers/gpu/drm/vc4/vc4_drv.c
>  create mode 100644 drivers/gpu/drm/vc4/vc4_drv.h
>  create mode 100644 drivers/gpu/drm/vc4/vc4_hdmi.c
>  create mode 100644 drivers/gpu/drm/vc4/vc4_hvs.c
>  create mode 100644 drivers/gpu/drm/vc4/vc4_kms.c
>  create mode 100644 drivers/gpu/drm/vc4/vc4_plane.c
>  create mode 100644 drivers/gpu/drm/vc4/vc4_regs.h

Made a quick pass and found a few things to update to latest drm
developments. Of course didn't look at the hardware details since no clue,
but looks really nice overall.
-Daniel

> 
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index c46ca31..1730a76 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -240,3 +240,5 @@ source "drivers/gpu/drm/sti/Kconfig"
>  source "drivers/gpu/drm/amd/amdkfd/Kconfig"
>  
>  source "drivers/gpu/drm/imx/Kconfig"
> +
> +source "drivers/gpu/drm/vc4/Kconfig"
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index 5713d05..b991ac5 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -42,6 +42,7 @@ obj-$(CONFIG_DRM_MGA)   += mga/
>  obj-$(CONFIG_DRM_I810)   += i810/
>  obj-$(CONFIG_DRM_I915)  += i915/
>  obj-$(CONFIG_DRM_MGAG200) += mgag200/
> +obj-$(CONFIG_DRM_VC4)  += vc4/
>  obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus/
>  obj-$(CONFIG_DRM_SIS)   += sis/
>  obj-$(CONFIG_DRM_SAVAGE)+= savage/
> diff --git a/drivers/gpu/drm/vc4/Kconfig b/drivers/gpu/drm/vc4/Kconfig
> new file mode 100644
> index 000..130cc94
> --- /dev/null
> +++ b/drivers/gpu/drm/vc4/Kconfig
> @@ -0,0 +1,14 @@
> +config DRM_VC4
> + tristate "Broadcom VC4 Graphics"
> + depends on ARCH_BCM2835
> + depends on DRM
> + select DRM_KMS_HELPER
> + select DRM_KMS_FB_HELPER
> + select DRM_KMS_CMA_HELPER

drm-misc/linux-next already has Archit's patches to enable/disable fbdev
in the core code, so you don't need to bother about these selects here any
more, it'll no-op out if drm fbdev emulation isn't enabled. Since you're
reusing cma fbdev helpers I don't think there's any need for other changes
because of this.

> + help
> +   Choose this option if you have a system that has a Broadcom
> +   VC4 GPU, such as the Raspberry Pi or other BCM2708/BCM2835.
> +
> +   This driver requires that "avoid_warnings=2" be present in
> +   the config.txt for the firmware, to keep it from smashing
> +   our display setup.
> diff --git a/drivers/gpu/drm/vc4/Makefile b/drivers/gpu/drm/vc4/Makefile
> new file mode 100644
> index 000..4aa07ca
> --- /dev/null
> +++ b/drivers/gpu/drm/vc4/Makefile
> @@ -0,0 +1,18 @@
> +ccflags-y := -Iinclude/drm
> +
> +# Please keep these build lists sorted!
> +
> +# core driver code
> +vc4-y := \
> + vc4_bo.o \
> + vc4_crtc.o \
> + vc4_drv.o \
> + vc4_kms.o \
> + vc4_hdmi.o \
> + vc4_hvs.o \
> + vc4_plane.o \
> + $()
> +
> +vc4-$(CONFIG_DEBUG_FS) += vc4_debugfs.o
> +
> +obj-$(CONFIG_DRM_VC4)  += vc4.o
> diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c
> new file mode 100644
> index 000..fee8cac
> --- /dev/null
> +++ b/drivers/gpu/drm/vc4/vc4_bo.c
> @@ -0,0 +1,54 @@
> +/*
> + *  Copyright © 2015 Broadcom
> + *
> + * 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.
> + */
> +
> +/* DOC: VC4 GEM BO management support.
> + *
> + * The VC4 GPU

Re: [PATCH v2 07/13] memory: kill off set_irq_flags usage

2015-08-13 Thread Tony Lindgren
* Rob Herring  [150712 07:29]:
> set_irq_flags is ARM specific with custom flags which have genirq
> equivalents. Convert drivers to use the genirq interfaces directly, so we
> can kill off set_irq_flags. The translation of flags is as follows:
> 
> IRQF_VALID -> !IRQ_NOREQUEST
> IRQF_PROBE -> !IRQ_NOPROBE
> IRQF_NOAUTOEN -> IRQ_NOAUTOEN
> 
> For IRQs managed by an irqdomain, the irqdomain core code handles clearing
> and setting IRQ_NOREQUEST already, so there is no need to do this in
> .map() functions and we can simply remove the set_irq_flags calls. Some
> users also set IRQ_NOPROBE and this has been maintained although it is not
> clear that is really needed. There appears to be a great deal of blind
> copy and paste of this code.

Applying this one into omap-for-v4.3/soc thanks.

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


Re: [PATCH 1/3] drivers/gpio: Port gpio driver to ls1021a-qds platform

2015-08-13 Thread Alexander Stein
On Monday 03 August 2015 10:07:06, Linus Walleij wrote:
> Alexander Stein and Uwe Kleine-König are working on this
> driver for this kernel cycle so requesting their help in
> reviewing these three patches.
> 
> Alexander/Uwe: can you see the patches, or will Shaveta
> need to resend them?

Yep, I received them on linux-gpio. You can add for this series

Tested-By: Alexander Stein 

Best regards,
Alexander
-- 
Dipl.-Inf. Alexander Stein
SYS TEC electronic GmbH
alexander.st...@systec-electronic.com

Legal and Commercial Address:
Am Windrad 2
08468 Heinsdorfergrund
Germany

Office: +49 (0) 3765 38600-0
Fax:+49 (0) 3765 38600-4100
 
Managing Directors:
Director Technology/CEO: Dipl.-Phys. Siegmar Schmidt;
Director Commercial Affairs/COO: Dipl. Ing. (FH) Armin von Collrepp
Commercial Registry:
Amtsgericht Chemnitz, HRB 28082; USt.-Id Nr. DE150534010

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


Re: [PATCH] sched: sync with the cfs_rq when changing sched class

2015-08-13 Thread Peter Zijlstra
On Thu, Aug 13, 2015 at 02:55:55PM +0900, byungchul.p...@lge.com wrote:
> @@ -8023,16 +8036,7 @@ static void task_move_group_fair(struct task_struct 
> *p, int queued)
>  
>  #ifdef CONFIG_SMP
>   /* synchronize task with its prev cfs_rq */
> - if (!queued)
> - __update_load_avg(cfs_rq->avg.last_update_time, 
> cpu_of(rq_of(cfs_rq)),
> - &se->avg, se->on_rq * 
> scale_load_down(se->load.weight),
> - cfs_rq->curr == se, NULL);
> -
> - /* remove our load when we leave */
> - cfs_rq->avg.load_avg = max_t(long, cfs_rq->avg.load_avg - 
> se->avg.load_avg, 0);
> - cfs_rq->avg.load_sum = max_t(s64, cfs_rq->avg.load_sum - 
> se->avg.load_sum, 0);
> - cfs_rq->avg.util_avg = max_t(long, cfs_rq->avg.util_avg - 
> se->avg.util_avg, 0);
> - cfs_rq->avg.util_sum = max_t(s32, cfs_rq->avg.util_sum - 
> se->avg.util_sum, 0);
> + detach_entity_load_avg(cfs_rq, se);
>  #endif
>   set_task_rq(p, task_cpu(p));
>   se->depth = se->parent ? se->parent->depth + 1 : 0;
> @@ -8042,11 +8046,7 @@ static void task_move_group_fair(struct task_struct 
> *p, int queued)
>  
>  #ifdef CONFIG_SMP
>   /* Virtually synchronize task with its new cfs_rq */
> - p->se.avg.last_update_time = cfs_rq->avg.last_update_time;
> - cfs_rq->avg.load_avg += p->se.avg.load_avg;
> - cfs_rq->avg.load_sum += p->se.avg.load_sum;
> - cfs_rq->avg.util_avg += p->se.avg.util_avg;
> - cfs_rq->avg.util_sum += p->se.avg.util_sum;
> + attach_entity_load_avg(cfs_rq, se);
>  #endif
>  }

Can't we go one further and do:

static void task_move_group_fair(struct task_struct *p)
{
struct rq *rq = task_rq(p);

switched_from_fair(rq, p);
set_task_rq(p, task_cpu(p);
switched_to_fair(rq, p);
}

switched_from already does the vruntime and load_avg thing,
switched_to should do the reverse, although it currently doesn't appear
to put the load_avg back.

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


Re: get_vmalloc_info() and /proc/meminfo insanely expensive

2015-08-13 Thread Rasmus Villemoes
On Thu, Aug 13 2015, Linus Torvalds  wrote:

> On Wed, Aug 12, 2015 at 9:00 PM, Andrew Morton
>  wrote:
>>
>> Do your /proc/meminfo vmalloc numbers actually change during that build?
>> Mine don't.  Perhaps we can cache the most recent vmalloc_info and
>> invalidate that cache whenever someone does a vmalloc/vfree/etc.
>
> Sure, that works too.
>
> Looking at that mm/vmalloc.c file, the locking is pretty odd. It looks
> pretty strange in setup_vmalloc_vm(), for example. If that newly
> allocated "va" that we haven't even exposed to anybody yet has its
> address or size changed, we're screwed in so many ways.
>
> I get the feeling this file should be rewritten. But that's not going
> to happen. The "let's just cache the last value for one jiffy" seemed
> to be the minimal fixup to it.
>

I think it's simpler and better to fix glibc. Looking at the history,
the code for get_[av]phys_pages was added in 1996 (in the git repo
commit 845dcb57), with comments such as

 /* Return the number of pages of physical memory in the system.  There
is currently (as of version 2.0.21) no system call to determine the
number.  It is planned for the 2.1.x series to add this, though.

and

/* XXX Here will come a test for the new system call.  */


And that syscall seems to be sysinfo(). So even though sysinfo() also
returns much more than required, it is still more than an order of
magnitude faster than reading and parsing /proc/meminfo (in the quick
microbench I threw together):

#include 
#include 
#include 

void do_get_phys_pages(void)
{
get_phys_pages();
}
void do_get_avphys_pages(void)
{
get_avphys_pages();
}


void do_sysinfo(void)
{
struct sysinfo info;

sysinfo(&info);
}

void time_this(const char *name, void (*f)(void), int rep)
{
int i;
unsigned long start, stop;

start = rdtsc();
for (i = 0; i < rep; ++i)
f();
stop = rdtsc();

printf("%-20s\t%d\t%lu\t%.1f\n", name, rep, stop-start, 
(double)(stop-start)/rep);
}

#define time_this(f, rep) time_this(#f, do_ ## f, rep)

int main(void)
{
time_this(sysinfo, 1);
time_this(get_phys_pages, 1);
time_this(get_avphys_pages, 1);

time_this(sysinfo, 1);
time_this(get_phys_pages, 1);
time_this(get_avphys_pages, 1);

time_this(sysinfo, 10);
time_this(get_phys_pages, 10);
time_this(get_avphys_pages, 10);

return 0;
}

$ ./sysinfo 
sysinfo 1   60566056.0
get_phys_pages  1   226744  226744.0
get_avphys_pages1   84480   84480.0
sysinfo 1   22882288.0
get_phys_pages  1   73216   73216.0
get_avphys_pages1   76692   76692.0
sysinfo 10  6856685.6
get_phys_pages  10  626936  62693.6
get_avphys_pages10  604440  60444.0

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


Re: [PATCH 1/2] crypto: export crypto_alg_list and rwsem

2015-08-13 Thread Joonsoo Kim
On Thu, Aug 13, 2015 at 03:29:18PM +0800, Herbert Xu wrote:
> On Thu, Aug 13, 2015 at 04:30:31PM +0900, Joonsoo Kim wrote:
> >
> > How about introducing new functions to search supported algorithm in
> > kernel-side? As crypto API is used in more places, this interface
> > would be requested more. Defined list weaken the advantage of strong
> > point of generic crypto API.
> 
> You're only getting the list so you can immediately reexport
> it to user-space, with no added value whatsoever.  As I said
> we already have an interface for that so you should use it.
> 
> If more genuine uses come up then I will reconsider.

Okay. I will think this issue more and come back with better
solution.

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


Re: [PATCH 2/2] zram: use crypto API to compress the page

2015-08-13 Thread Joonsoo Kim
On Thu, Aug 13, 2015 at 03:32:33PM +0800, Herbert Xu wrote:
> On Thu, Aug 13, 2015 at 04:19:41PM +0900, Joonsoo Kim wrote:
> > 
> > If that optimization is really needed for the case that doesn't need
> > tfm except fetching function pointer, we can implement sharable tfm
> > in crypto subsystem.
> 
> I'm happy to consider changes to the crypto compression interface
> as long as it continues to support the existing algorithms and users.

Happy to hear that.
I will think how it can be improved.

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


[PATCH] mm/hwpoison: fix race between soft_offline_page and unpoison_memory

2015-08-13 Thread Wanpeng Li
[   61.572584] BUG: Bad page state in process bash  pfn:97000
[   61.578106] page:ea00025c count:0 mapcount:1 mapping:  
(null) index:0x7f4fdbe00
[   61.586803] flags: 0x1f80080048(uptodate|active|swapbacked)
[   61.592809] page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set
[   61.599250] bad because of flags:
[   61.602567] flags: 0x40(active)
[   61.605746] Modules linked in: snd_hda_codec_hdmi i915 rpcsec_gss_krb5 nfsv4 
dns_resolver bnep rfcomm nfsd bluetooth auth_rpcgss nfs_acl nfs rfkill lockd 
grace sunrpc i2c_algo_bit drm_kms_helper snd_hda_codec_realtek 
snd_hda_codec_generic drm snd_hda_intel fscache snd_hda_codec 
x86_pkg_temp_thermal coretemp kvm_intel snd_hda_core snd_hwdep kvm snd_pcm 
snd_seq_dummy snd_seq_oss crct10dif_pclmul snd_seq_midi crc32_pclmul 
snd_seq_midi_event ghash_clmulni_intel snd_rawmidi aesni_intel lrw gf128mul 
snd_seq glue_helper ablk_helper snd_seq_device cryptd fuse snd_timer dcdbas 
serio_raw mei_me parport_pc snd mei ppdev i2c_core video lp soundcore parport 
lpc_ich shpchp mfd_core ext4 mbcache jbd2 sd_mod e1000e ahci ptp libahci 
crc32c_intel libata pps_core
[   61.605827] CPU: 3 PID: 2211 Comm: bash Not tainted 4.2.0-rc5-mm1+ #45
[   61.605829] Hardware name: Dell Inc. OptiPlex 7020/0F5C5X, BIOS A03 
01/08/2015
[   61.605832]  818b3be8 8800da373ad8 8165ceb4 
01313ce1
[   61.605837]  ea00025c 8800da373b08 8117bdd6 
88021edd4b00
[   61.605842]  0001 001f80080048  
8800da373b88
[   61.605847] Call Trace:
[   61.605858]  [] dump_stack+0x48/0x5c
[   61.605865]  [] bad_page+0xe6/0x140
[   61.605870]  [] free_pages_prepare+0x2f9/0x320
[   61.605876]  [] ? uncharge_list+0xdd/0x100
[   61.605882]  [] free_hot_cold_page+0x40/0x170
[   61.605888]  [] __put_single_page+0x20/0x30
[   61.605892]  [] put_page+0x25/0x40
[   61.605897]  [] unmap_and_move+0x1a6/0x1f0
[   61.605908]  [] migrate_pages+0x100/0x1d0
[   61.605914]  [] ? kill_procs+0x100/0x100
[   61.605918]  [] ? unlock_page+0x6f/0x90
[   61.605923]  [] __soft_offline_page+0x127/0x2a0
[   61.605928]  [] soft_offline_page+0xa6/0x200

There is a race window between soft_offline_page() and unpoison_memory():

CPU0CPU1

soft_offline_page
__soft_offline_page
TestSetPageHWPoison   
unpoison_memory
PageHWPoison check (true)
TestClearPageHWPoison
put_page-> release refcount held by 
get_hwpoison_page in unpoison_memory
put_page-> release refcount held by 
isolate_lru_page in __soft_offline_page
migrate_pages

The second put_page() releases refcount held by isolate_lru_page() which 
will lead to unmap_and_move() releases the last refcount of page and w/ 
mapcount still 1 since try_to_unmap() is not called if there is only 
one user map the page. Anyway, the page refcount and mapcount will 
still mess if the page is mapped by multiple users. Commit (4491f712606: 
mm/memory-failure: set PageHWPoison before migrate_pages()) is introduced 
to avoid to reuse just successful migrated page, however, it also incurs 
this race window.

Fix it by continue to use migratetype to guarantee the source page which 
is successful migration does not reused before PG_hwpoison is set.

Signed-off-by: Wanpeng Li 
---
 include/linux/page-isolation.h |5 +
 mm/memory-failure.c|   16 
 mm/migrate.c   |3 +--
 mm/page_isolation.c|4 ++--
 4 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h
index 047d647..ff5751e 100644
--- a/include/linux/page-isolation.h
+++ b/include/linux/page-isolation.h
@@ -65,6 +65,11 @@ undo_isolate_page_range(unsigned long start_pfn, unsigned 
long end_pfn,
 int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn,
bool skip_hwpoisoned_pages);
 
+/*
+ *  Internal functions. Changes pageblock's migrate type.
+ */
+int set_migratetype_isolate(struct page *page, bool skip_hwpoisoned_pages);
+void unset_migratetype_isolate(struct page *page, unsigned migratetype);
 struct page *alloc_migrate_target(struct page *page, unsigned long private,
int **resultp);
 
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index eca613e..0ed3814 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1647,8 +1647,6 @@ static int __soft_offline_page(struct page *page, int 
flags)
inc_zone_page_state(page, NR_ISOLATED_ANON +
page_is_file_cache(page));
list_add(&page->lru, &pagelist);
-   if (!TestSetPageHWPoison(page))
-   atomic_long_inc(&num_poisoned_pages);

Re: [PATCH 2/2] zram: use crypto API to compress the page

2015-08-13 Thread Herbert Xu
On Thu, Aug 13, 2015 at 04:19:41PM +0900, Joonsoo Kim wrote:
> 
> If that optimization is really needed for the case that doesn't need
> tfm except fetching function pointer, we can implement sharable tfm
> in crypto subsystem.

I'm happy to consider changes to the crypto compression interface
as long as it continues to support the existing algorithms and users.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] KVM: x86: set TMR when the interrupt is accepted

2015-08-13 Thread Paolo Bonzini


On 13/08/2015 08:35, Zhang, Yang Z wrote:
>> You may be right. It is safe if no future hardware plans to use
>> it. Let me check with our hardware team to see whether it will be
>> used or not in future.
> 
> After checking with Jun, there is no guarantee that the guest running
> on another CPU will operate properly if hypervisor modify the vTMR
> from another CPU. So the hypervisor should not to do it.

I guess I can cause a vmexit on level-triggered interrupts, it's not a
big deal, but no weasel words, please.

What's going to break, and where is it documented?

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


Re: [PATCH 1/2] crypto: export crypto_alg_list and rwsem

2015-08-13 Thread Herbert Xu
On Thu, Aug 13, 2015 at 04:30:31PM +0900, Joonsoo Kim wrote:
>
> How about introducing new functions to search supported algorithm in
> kernel-side? As crypto API is used in more places, this interface
> would be requested more. Defined list weaken the advantage of strong
> point of generic crypto API.

You're only getting the list so you can immediately reexport
it to user-space, with no added value whatsoever.  As I said
we already have an interface for that so you should use it.

If more genuine uses come up then I will reconsider.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ASoC: tegra: Convert to managed resources

2015-08-13 Thread Vaishali Thakkar
Use managed resource functions devm_clk_put and
devm_snd_soc_register_component to simplify error handling.

To be compatible with the change various gotos are replaced
with direct returns, and unneeded labels are dropped.

Signed-off-by: Vaishali Thakkar 
---
 sound/soc/tegra/tegra20_spdif.c | 37 +
 1 file changed, 13 insertions(+), 24 deletions(-)

diff --git a/sound/soc/tegra/tegra20_spdif.c b/sound/soc/tegra/tegra20_spdif.c
index 9141477..f69b2e4 100644
--- a/sound/soc/tegra/tegra20_spdif.c
+++ b/sound/soc/tegra/tegra20_spdif.c
@@ -273,45 +273,40 @@ static int tegra20_spdif_platform_probe(struct 
platform_device *pdev)
 GFP_KERNEL);
if (!spdif) {
dev_err(&pdev->dev, "Can't allocate tegra20_spdif\n");
-   ret = -ENOMEM;
-   goto err;
+   return -ENOMEM;
}
dev_set_drvdata(&pdev->dev, spdif);
 
-   spdif->clk_spdif_out = clk_get(&pdev->dev, "spdif_out");
+   spdif->clk_spdif_out = devm_clk_get(&pdev->dev, "spdif_out");
if (IS_ERR(spdif->clk_spdif_out)) {
pr_err("Can't retrieve spdif clock\n");
ret = PTR_ERR(spdif->clk_spdif_out);
-   goto err;
+   return ret;
}
 
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!mem) {
dev_err(&pdev->dev, "No memory resource\n");
-   ret = -ENODEV;
-   goto err_clk_put;
+   return -ENODEV;
}
 
dmareq = platform_get_resource(pdev, IORESOURCE_DMA, 0);
if (!dmareq) {
dev_err(&pdev->dev, "No DMA resource\n");
-   ret = -ENODEV;
-   goto err_clk_put;
+   return -ENODEV;
}
 
memregion = devm_request_mem_region(&pdev->dev, mem->start,
resource_size(mem), DRV_NAME);
if (!memregion) {
dev_err(&pdev->dev, "Memory region already claimed\n");
-   ret = -EBUSY;
-   goto err_clk_put;
+   return -EBUSY;
}
 
regs = devm_ioremap(&pdev->dev, mem->start, resource_size(mem));
if (!regs) {
dev_err(&pdev->dev, "ioremap failed\n");
-   ret = -ENOMEM;
-   goto err_clk_put;
+   return -ENOMEM;
}
 
spdif->regmap = devm_regmap_init_mmio(&pdev->dev, regs,
@@ -319,7 +314,7 @@ static int tegra20_spdif_platform_probe(struct 
platform_device *pdev)
if (IS_ERR(spdif->regmap)) {
dev_err(&pdev->dev, "regmap init failed\n");
ret = PTR_ERR(spdif->regmap);
-   goto err_clk_put;
+   return ret;
}
 
spdif->playback_dma_data.addr = mem->start + TEGRA20_SPDIF_DATA_OUT;
@@ -334,8 +329,9 @@ static int tegra20_spdif_platform_probe(struct 
platform_device *pdev)
goto err_pm_disable;
}
 
-   ret = snd_soc_register_component(&pdev->dev, &tegra20_spdif_component,
-  &tegra20_spdif_dai, 1);
+   ret = devm_snd_soc_register_component(&pdev->dev,
+ &tegra20_spdif_component,
+ &tegra20_spdif_dai, 1);
if (ret) {
dev_err(&pdev->dev, "Could not register DAI: %d\n", ret);
ret = -ENOMEM;
@@ -345,21 +341,17 @@ static int tegra20_spdif_platform_probe(struct 
platform_device *pdev)
ret = tegra_pcm_platform_register(&pdev->dev);
if (ret) {
dev_err(&pdev->dev, "Could not register PCM: %d\n", ret);
-   goto err_unregister_component;
+   return ret;
}
 
return 0;
 
-err_unregister_component:
-   snd_soc_unregister_component(&pdev->dev);
 err_suspend:
if (!pm_runtime_status_suspended(&pdev->dev))
tegra20_spdif_runtime_suspend(&pdev->dev);
 err_pm_disable:
pm_runtime_disable(&pdev->dev);
-err_clk_put:
-   clk_put(spdif->clk_spdif_out);
-err:
+
return ret;
 }
 
@@ -372,9 +364,6 @@ static int tegra20_spdif_platform_remove(struct 
platform_device *pdev)
tegra20_spdif_runtime_suspend(&pdev->dev);
 
tegra_pcm_platform_unregister(&pdev->dev);
-   snd_soc_unregister_component(&pdev->dev);
-
-   clk_put(spdif->clk_spdif_out);
 
return 0;
 }
-- 
1.9.1

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


[PATCH] lib/decompressors: Use real out buf size for gunzip with kernel

2015-08-13 Thread Yinghai Lu
When loading x86 64bit kernel above 4GiB with patched grub2, got kernel
gunzip error.

| early console in decompress_kernel
| decompress_kernel:
|   input: [0x807f2143b4-0x807ff61aee]
|  output: [0x807cc0-0x807f3ea29b] 0x027ea29c: output_len
| boot via startup_64
| KASLR using RDTSC...
|  new output: [0x46fe00-0x470138cfff] 0x0338d000: output_run_size
|  decompress: [0x46fe00-0x47007ea29b] <=== [0x807f2143b4-0x807ff61aee]
|
| Decompressing Linux... gz...
|
| uncompression error
|
| -- System halted

the new buffer is at 0x46fe00ULL, decompressor_gzip is using
0xffb901ff as out_len. gunzip in lib/zlib_inflate/inflate.c
cap that len to 0x01ff and decompress fails later.

We could hit this problem with crashkernel booting that uses kexec
loading kernel above 4GiB.

We have decompress_* support:
1. inbuf[]/outbuf[] for kernel preboot.
2. inbuf[]/flush() for initramfs
3. fill()/flush() for initrd.
This bug only affect kernel preboot path that use outbuf[].

Add __decompress and take real out_buf_len for gunzip instead of guessing
wrong buf size.

Signed-off-by: Yinghai Lu 
Fixes: 1431574a1c4 (lib/decompressors: fix "no limit" output buffer length)
Cc: Alexandre Courbot 
Cc: Jon Medhurst 
Cc: Stephen Warren 
Cc: "H. Peter Anvin" 
Cc: Thomas Gleixner 
Cc: Ingo Molnar 
Cc: stable 

---
 arch/x86/boot/compressed/misc.c |3 ++-
 lib/decompress_bunzip2.c|9 +
 lib/decompress_inflate.c|   40 +++-
 lib/decompress_unlz4.c  |   10 ++
 lib/decompress_unlzma.c |   10 ++
 lib/decompress_unlzo.c  |   22 +-
 lib/decompress_unxz.c   |   21 -
 7 files changed, 107 insertions(+), 8 deletions(-)

Index: linux-2.6/arch/x86/boot/compressed/misc.c
===
--- linux-2.6.orig/arch/x86/boot/compressed/misc.c
+++ linux-2.6/arch/x86/boot/compressed/misc.c
@@ -448,7 +448,8 @@ asmlinkage __visible void *decompress_ke
 #endif
 
debug_putstr("\nDecompressing Linux... ");
-   decompress(input_data, input_len, NULL, NULL, output, NULL, error);
+   __decompress(input_data, input_len, NULL, NULL, output, output_len,
+   NULL, error);
parse_elf(output);
/*
 * 32-bit always performs relocations. 64-bit relocations are only
Index: linux-2.6/lib/decompress_bunzip2.c
===
--- linux-2.6.orig/lib/decompress_bunzip2.c
+++ linux-2.6/lib/decompress_bunzip2.c
@@ -752,4 +752,13 @@ STATIC int INIT decompress(unsigned char
 {
return bunzip2(buf, len - 4, fill, flush, outbuf, pos, error);
 }
+STATIC int INIT __decompress(unsigned char *buf, long len,
+   long (*fill)(void*, unsigned long),
+   long (*flush)(void*, unsigned long),
+   unsigned char *outbuf, long olen,
+   long *pos,
+   void (*error)(char *x))
+{
+   return bunzip2(buf, len - 4, fill, flush, outbuf, pos, error);
+}
 #endif
Index: linux-2.6/lib/decompress_inflate.c
===
--- linux-2.6.orig/lib/decompress_inflate.c
+++ linux-2.6/lib/decompress_inflate.c
@@ -1,4 +1,5 @@
 #ifdef STATIC
+#define PREBOOT
 /* Pre-boot environment: included */
 
 /* prevent inclusion of _LINUX_KERNEL_H in pre-boot environment: lots
@@ -33,23 +34,23 @@ static long INIT nofill(void *buffer, un
 }
 
 /* Included from initramfs et al code */
-STATIC int INIT gunzip(unsigned char *buf, long len,
+STATIC int INIT __gunzip(unsigned char *buf, long len,
   long (*fill)(void*, unsigned long),
   long (*flush)(void*, unsigned long),
-  unsigned char *out_buf,
+  unsigned char *out_buf, long out_len,
   long *pos,
   void(*error)(char *x)) {
u8 *zbuf;
struct z_stream_s *strm;
int rc;
-   size_t out_len;
 
rc = -1;
if (flush) {
out_len = 0x8000; /* 32 K */
out_buf = malloc(out_len);
} else {
-   out_len = ((size_t)~0) - (size_t)out_buf; /* no limit */
+   if (!out_len)
+   out_len = ((size_t)~0) - (size_t)out_buf; /* no limit */
}
if (!out_buf) {
error("Out of memory while allocating output buffer");
@@ -181,4 +182,33 @@ gunzip_nomem1:
return rc; /* returns Z_OK (0) if successful */
 }
 
-#define decompress gunzip
+STATIC int INIT gunzip(unsigned char *buf, long len,
+  long (*fill)(void*, unsigned long),
+  long (*flush)(void*, unsigned long),
+  unsigned char *out_buf,
+  long *pos,
+  void (*error)(

Re: [PATCH] extcon: palmas: Fix build break due to devm_gpiod_get_optional API change

2015-08-13 Thread Roger Quadros
On 13/08/15 10:24, Chanwoo Choi wrote:
> 
> On 08/13/2015 04:06 PM, Roger Quadros wrote:
>> Hi Chanwoo,
>>
>> On 13/08/15 03:29, Chanwoo Choi wrote:
>>> Commit b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions")
>>> changes the prototype of devm_gpiod_get_optional() API which should include
>>> the falgs mandatory.
>>
>> s/falgs/flags
>>
>>>
>>> Reported-by: Stephen Rothwell 
>>> Signed-off-by: Chanwoo Choi 
>>> ---
>>>  drivers/extcon/extcon-palmas.c | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c
>>> index 662e91778cb0..308928d44ead 100644
>>> --- a/drivers/extcon/extcon-palmas.c
>>> +++ b/drivers/extcon/extcon-palmas.c
>>> @@ -208,7 +208,8 @@ static int palmas_usb_probe(struct platform_device 
>>> *pdev)
>>> palmas_usb->wakeup = pdata->wakeup;
>>> }
>>>  
>>> -   palmas_usb->id_gpiod = devm_gpiod_get_optional(&pdev->dev, "id");
>>> +   palmas_usb->id_gpiod = devm_gpiod_get_optional(&pdev->dev, "id",
>>> +   GPIOD_IN);
>>> if (IS_ERR(palmas_usb->id_gpiod)) {
>>> dev_err(&pdev->dev, "failed to get id gpio\n");
>>> return PTR_ERR(palmas_usb->id_gpiod);
>>>
>>
>> Can you please include the following headers in this patch?
>>
>> #include 
>> #include 
> 
> I think that extcon-palmas need only "#include "
> because of of_gpio.h file already include the gpio.h.

OK with me.

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


Re: [GIT PULL 00/13] perf/core improvements and fixes

2015-08-13 Thread Ingo Molnar

* Arnaldo Carvalho de Melo  wrote:

> Hi Ingo,
> 
>   Please consider applying,
> 
> - Arnaldo
> 
> The following changes since commit 5f1230c9b80b89f404938ff88dfa64a963f74f2c:
> 
>   Merge tag 'perf-core-for-mingo' of 
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core 
> (2015-08-12 12:16:11 +0200)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git 
> tags/perf-core-for-mingo
> 
> for you to fetch changes up to 71ef150ee06df29c5b427307dc0bacfe06a8baea:
> 
>   perf tests: Add tests to callgraph and time parse (2015-08-12 13:20:29 
> -0300)
> 
> 
> perf/core improvements and fixes:
> 
> User visible:
> 
> - Allow selecting the type of callchains per event, including disabling
>   callchains in all but one entry in an event list, to save space, and also
>   to ask for the callchains collected in one event to be used in other
>   events (Kan Liang)
> 
> - Beautify more syscall arguments in 'perf trace': (Arnaldo Carvalho de Melo)
>   - A bunch more translate file/pathnames from pointers to strings
>   - Convert numbers to strings for the 'keyctl' syscall 'option' arg.
>   - Add missing 'clockid' entries
> 
> - Fix 'perf probe -L sys_*' as it was not showing all the source code for
>   syscall functions in the kernel (Masami Hiramatsu)
> 
> - Make ESC unzoom as well in the hists browser, i.e. in 'report' and 'top',
>   as we're considering repurposing the right and left arrow keys to use in
>   horizontal scrolling, i.e. leave just ESC to be used for what <- works
>   now, and ENTER for what -> does (they are already aliases for ages)
>   (Arnaldo Carvalho de Melo)
> 
> Infrastructure fixes:
> 
> - Check for SRCLINE_UNKNOWN case in "srcfile" processing (Andi Kleen)
> 
> - Wrap the slsmg_{printf,write_nstring} slang functions behing ui_browser, so
>   that we can make the ui_browser based browsers (annotate, menus, hists, 
> etc) UI
>   library agnostic and usable with multiple backends (slang now, GTK+ and 
> others
>   in the future, maybe) (Arnaldo Carvalho de Melo)
> 
> Signed-off-by: Arnaldo Carvalho de Melo 
> 
> 
> Andi Kleen (1):
>   perf sort: Check for SRCLINE_UNKNOWN case in "srcfile" processing
> 
> Arnaldo Carvalho de Melo (7):
>   perf trace: Associate some more syscall args with the getname beautifier
>   perf trace: Add missing clockid entries
>   perf trace: Use the FD beautifier for socket syscall fds
>   perf trace: Beautify keyctl's option arg
>   perf ui browser: Introduce ui_browser__write_nstring()
>   perf ui browser: Introduce ui_browser__printf()
>   perf hists browser: Make ESC unzoom as well
> 
> Kan Liang (4):
>   perf callchain: Per-event type selection support
>   perf callchain: Allow disabling call graphs per event
>   perf report: Show call graph from reference events
>   perf tests: Add tests to callgraph and time parse
> 
> Masami Hiramatsu (1):
>   perf probe: Fix to show lines of sys_ functions correctly
> 
>  tools/perf/Documentation/perf-record.txt |  4 ++
>  tools/perf/Documentation/perf-report.txt | 11 ++
>  tools/perf/builtin-annotate.c|  2 +
>  tools/perf/builtin-diff.c|  3 ++
>  tools/perf/builtin-report.c  |  7 
>  tools/perf/builtin-trace.c   | 54 +++--
>  tools/perf/tests/hists_cumulate.c|  4 ++
>  tools/perf/tests/parse-events.c  | 38 ++
>  tools/perf/ui/browser.c  | 17 +++-
>  tools/perf/ui/browser.h  |  3 ++
>  tools/perf/ui/browsers/annotate.c| 43 ++--
>  tools/perf/ui/browsers/header.c  |  2 +-
>  tools/perf/ui/browsers/hists.c   | 54 -
>  tools/perf/ui/browsers/map.c | 11 +++---
>  tools/perf/ui/browsers/scripts.c |  2 +-
>  tools/perf/ui/libslang.h |  3 ++
>  tools/perf/ui/tui/util.c |  2 +-
>  tools/perf/util/dwarf-aux.c  | 18 ++---
>  tools/perf/util/evsel.c  | 67 
> +++-
>  tools/perf/util/evsel.h  |  4 ++
>  tools/perf/util/hist.c   | 14 +--
>  tools/perf/util/parse-events.c   | 12 ++
>  tools/perf/util/parse-events.h   |  2 +
>  tools/perf/util/parse-events.l   |  2 +
>  tools/perf/util/pmu.c|  4 +-
>  tools/perf/util/sort.c   |  2 +
>  tools/perf/util/symbol.h |  3 +-
>  27 files changed, 307 insertions(+), 81 deletions(-)

Pulled, thanks a lot Arnaldo!

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

Re: [PATCH 1/2] crypto: export crypto_alg_list and rwsem

2015-08-13 Thread Joonsoo Kim
On Thu, Aug 13, 2015 at 02:38:23PM +0800, Herbert Xu wrote:
> On Thu, Aug 13, 2015 at 03:37:55PM +0900, Joonsoo Kim wrote:
> >
> > Is there any way to access netlink interface and get the output from
> > kernel-side? I'd like to show information through
> > "/sys/block/zramX/comp_algorithm", because some user program can be
> > broken if we change output of userspace exposed interface.
> 
> You could simply deprecate that interface but keep it for existing
> algorithms.  Any new algorithms can then be queried through the
> crypto_user interface.
> 
> The other option is to have a defined list of algorithms which is
> independent of the crypto API.  For example, have a look at what
> IPsec does in net/xfrm/xfrm_algo.c.  IPsec needs its own list
> because they come with annotations.

Hmm... they looks suboptimal.

How about introducing new functions to search supported algorithm in
kernel-side? As crypto API is used in more places, this interface
would be requested more. Defined list weaken the advantage of strong
point of generic crypto API.

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


Re: [PATCH] extcon: palmas: Fix build break due to devm_gpiod_get_optional API change

2015-08-13 Thread Chanwoo Choi

On 08/13/2015 04:06 PM, Roger Quadros wrote:
> Hi Chanwoo,
> 
> On 13/08/15 03:29, Chanwoo Choi wrote:
>> Commit b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions")
>> changes the prototype of devm_gpiod_get_optional() API which should include
>> the falgs mandatory.
> 
> s/falgs/flags
> 
>>
>> Reported-by: Stephen Rothwell 
>> Signed-off-by: Chanwoo Choi 
>> ---
>>  drivers/extcon/extcon-palmas.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c
>> index 662e91778cb0..308928d44ead 100644
>> --- a/drivers/extcon/extcon-palmas.c
>> +++ b/drivers/extcon/extcon-palmas.c
>> @@ -208,7 +208,8 @@ static int palmas_usb_probe(struct platform_device *pdev)
>>  palmas_usb->wakeup = pdata->wakeup;
>>  }
>>  
>> -palmas_usb->id_gpiod = devm_gpiod_get_optional(&pdev->dev, "id");
>> +palmas_usb->id_gpiod = devm_gpiod_get_optional(&pdev->dev, "id",
>> +GPIOD_IN);
>>  if (IS_ERR(palmas_usb->id_gpiod)) {
>>  dev_err(&pdev->dev, "failed to get id gpio\n");
>>  return PTR_ERR(palmas_usb->id_gpiod);
>>
> 
> Can you please include the following headers in this patch?
> 
> #include 
> #include 

I think that extcon-palmas need only "#include "
because of of_gpio.h file already include the gpio.h.

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


Re: [GIT PULL] extcon next for 4.3

2015-08-13 Thread Chanwoo Choi
Dear Greg,

Please ignore this pull request, The extcon-next tree has one merge conflict
on linux-next tree because of b17d1bf16cc7 ("gpio: make flags mandatory for 
gpiod_get functions").

I'll resend pull request after fixing this issue.

Best Regards,
Chanwoo Choi

On 08/11/2015 01:15 PM, Chanwoo Choi wrote:
> Dear Greg,
> 
> This is extcon-next full request for v4.3. I add detailed description of this
> pull request on below. Please pull extcon with following updates.
> 
> Best Regards,
> Chanwoo Choi
> 
> The following changes since commit f7644cbfcdf03528f0f450f3940c4985b2291f49:
> 
>   Linux 4.2-rc6 (2015-08-09 15:54:30 -0400)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git 
> tags/extcon-next-for-4.3
>   
> for you to fetch changes up to 92b7cb5dc885b38b21093eefed8028b615952965:
> 
>   extcon: palmas: Support GPIO based USB ID detection (2015-08-10 21:26:25 
> +0900)
> 
> 
> Update extcon for v4.3
> 
> This patchset include the function update of extcon drivers without critical 
> update
> and fix minor issue of extcon drivers.
> 
> Detailed description for patchset:
> 1. Update the extcon drivers:
> - Update the logic of microphone detection for extcon-arizona driver
> - Support GPIO based USB ID detection of extcon-palmas driver
> 
> 2. Fix minor issues:
> - Clean code and remove the opitonal print_state() function pointer from 
> extcon core driver
> - Clear interrupt bit state before requesting irq on extcon-max778433 driver
> - Fix signedness bugs of extcon core driver
> 
> 
> Chanwoo Choi (4):
>   extcon: Remove duplicate header file in extcon.h
>   extcon: Remove optional print_state() function pointer of struct 
> extcon_dev
>   extcon: palmas: Remove the mutually_exclusive array
>   extcon: Add exception handling to prevent the NULL pointer access
> 
> Charles Keepax (6):
>   extcon: arizona: Update to use the new device properties API
>   extcon: arizona: Add basic microphone detection DT/ACPI bindings
>   extcon: arizona: Use gpiod inteface to handle micd_pol_gpio gpio
>   extcon: arizona: Ensure variables are set for headphone detection
>   extcon: arizona: Declare 3-pole jack if we detect open circuit on mic
>   extcon: arizona: Simplify pdata symantics for micd_dbtime
> 
> Dan Carpenter (1):
>   extcon: Fix signedness bugs about break error handling
> 
> Jaewon Kim (1):
>   extcon: max77843: Clear IRQ bits state before request IRQ
> 
> Krzysztof Kozlowski (1):
>   extcon: Drop owner assignment from i2c_driver
> 
> Roger Quadros (1):
>   extcon: palmas: Support GPIO based USB ID detection
> 
>  .../devicetree/bindings/extcon/extcon-palmas.txt   |   5 +-
>  drivers/extcon/extcon-arizona.c| 101 +---
>  drivers/extcon/extcon-gpio.c   |  18 ---
>  drivers/extcon/extcon-max77843.c   |   9 ++
>  drivers/extcon/extcon-palmas.c | 132 
> ++---
>  drivers/extcon/extcon-rt8973a.c|   1 -
>  drivers/extcon/extcon-sm5502.c |   1 -
>  drivers/extcon/extcon-usb-gpio.c   |   1 +
>  drivers/extcon/extcon.c|  48 ++--
>  include/linux/extcon.h |   7 --
>  include/linux/mfd/palmas.h |   7 ++
>  11 files changed, 253 insertions(+), 77 deletions(-)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

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


Re: [PATCH v2 06/22] mtd: nand: omap2: Switch to using GPMC-NAND ops for writebuffer empty check

2015-08-13 Thread Roger Quadros


On 07/08/15 12:12, Roger Quadros wrote:
> Instead of accessing the gpmc_status register directly start
> using the gpmc_nand_ops->nand_writebuffer_empty() helper
> to check write buffer empty status.
> 
> Signed-off-by: Roger Quadros 
> ---
>  drivers/mtd/nand/omap2.c | 12 ++--
>  1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
> index f214fe2..5c2f6df 100644
> --- a/drivers/mtd/nand/omap2.c
> +++ b/drivers/mtd/nand/omap2.c
> @@ -289,15 +289,11 @@ static void omap_write_buf8(struct mtd_info *mtd, const 
> u_char *buf, int len)
>   struct omap_nand_info *info = container_of(mtd,
>   struct omap_nand_info, mtd);
>   u_char *p = (u_char *)buf;
> - u32 status = 0;
>  
>   while (len--) {
>   iowrite8(*p++, info->nand.IO_ADDR_W);
>   /* wait until buffer is available for write */
> - do {
> - status = readl(info->reg.gpmc_status) &
> - STATUS_BUFF_EMPTY;
> - } while (!status);
> + while (info->ops->nand_writebuffer_empty());

This should be
while (!info->ops->nand_writebuffer_empty());

>   }
>  }
>  
> @@ -325,17 +321,13 @@ static void omap_write_buf16(struct mtd_info *mtd, 
> const u_char * buf, int len)
>   struct omap_nand_info *info = container_of(mtd,
>   struct omap_nand_info, mtd);
>   u16 *p = (u16 *) buf;
> - u32 status = 0;
>   /* FIXME try bursts of writesw() or DMA ... */
>   len >>= 1;
>  
>   while (len--) {
>   iowrite16(*p++, info->nand.IO_ADDR_W);
>   /* wait until buffer is available for write */
> - do {
> - status = readl(info->reg.gpmc_status) &
> - STATUS_BUFF_EMPTY;
> - } while (!status);
> + while (info->ops->nand_writebuffer_empty());

here as well.

>   }
>  }
>  
> 

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


Re: [PATCH] sched: sync with the cfs_rq when changing sched class

2015-08-13 Thread Byungchul Park
On Thu, Aug 13, 2015 at 06:41:45AM +0800, Yuyang Du wrote:
> On Thu, Aug 13, 2015 at 02:55:55PM +0900, byungchul.p...@lge.com wrote:
> > 
> > currently, a task load is synced with its cfs_rq, only when it
> > leaves from fair class. we also need to sync it with cfs_rq when
> > it returns back to fair class, too.
>  
> Syncing it at the time it is switched to fair is not necessary, because
> since last_update_time if it has ever been updated, the load has become
> random, IOW, useless. So we simply leave it unattended, and let itself
> merge in the system.

hello,

i agree with you almost. it would have a meaningless value over time,
while it has a meaningful value as soon as it leaved that cfs_rq.

however, IMHO, nobody know when a task is switched between sched classes.
i think it would be better that we consider that load rather than leave
it unattended, even though, of course, in both of cases __update_load_avg()
will dacay and fix it over time.

shouldn't we consider it?

1. case returning back to fair class very soon:
original code cannot reflect the task load to cfs_rq, while
patched code can reflect the task load to cfs_rq.

2. case returning back to fair class after long:
original code adds 0 to cfs_rq and let __update_load_avg() fix it, while
patched code adds a meaningless value to cfs_rq and let
__update_load_avg() fix it, afterall these become same.

> 
> >  
> >  #ifdef CONFIG_SMP
> > /* synchronize task with its prev cfs_rq */
> > -   if (!queued)
> > -   __update_load_avg(cfs_rq->avg.last_update_time, 
> > cpu_of(rq_of(cfs_rq)),
> > -   &se->avg, se->on_rq * 
> > scale_load_down(se->load.weight),
> > -   cfs_rq->curr == se, NULL);
> > -
> > -   /* remove our load when we leave */
> > -   cfs_rq->avg.load_avg = max_t(long, cfs_rq->avg.load_avg - 
> > se->avg.load_avg, 0);
> > -   cfs_rq->avg.load_sum = max_t(s64, cfs_rq->avg.load_sum - 
> > se->avg.load_sum, 0);
> > -   cfs_rq->avg.util_avg = max_t(long, cfs_rq->avg.util_avg - 
> > se->avg.util_avg, 0);
> > -   cfs_rq->avg.util_sum = max_t(s32, cfs_rq->avg.util_sum - 
> > se->avg.util_sum, 0);
> > +   detach_entity_load_avg(cfs_rq, se);
> >  #endif
> 
> You changed the logic.

yes, i changed it. but i think that calling __update_load_avg() is not
a problem even in case of "queued == 1". so i didn't think that change
seriously.

wrong? :(

thanks,
byungchul

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


Re: [PATCH] dmaengine: xgene-dma: Add ACPI support for X-Gene DMA engine driver

2015-08-13 Thread Rameshwar Sahu
Hi Vinod,

On Tue, Jul 21, 2015 at 6:44 PM, Rameshwar Prasad Sahu  wrote:
> This patch adds ACPI support for the APM X-Gene DMA engine driver.
>
> Signed-off-by: Rameshwar Prasad Sahu 
> ---
>  drivers/dma/xgene-dma.c | 28 +---
>  1 file changed, 21 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/dma/xgene-dma.c b/drivers/dma/xgene-dma.c
> index dff22ab..d0a148d 100644
> --- a/drivers/dma/xgene-dma.c
> +++ b/drivers/dma/xgene-dma.c
> @@ -21,6 +21,7 @@
>   * NOTE: PM support is currently not available.
>   */
>
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -1944,16 +1945,18 @@ static int xgene_dma_probe(struct platform_device 
> *pdev)
> return ret;
>
> pdma->clk = devm_clk_get(&pdev->dev, NULL);
> -   if (IS_ERR(pdma->clk)) {
> +   if (IS_ERR(pdma->clk) && !ACPI_COMPANION(&pdev->dev)) {
> dev_err(&pdev->dev, "Failed to get clk\n");
> return PTR_ERR(pdma->clk);
> }
>
> /* Enable clk before accessing registers */
> -   ret = clk_prepare_enable(pdma->clk);
> -   if (ret) {
> -   dev_err(&pdev->dev, "Failed to enable clk %d\n", ret);
> -   return ret;
> +   if (!IS_ERR(pdma->clk)) {
> +   ret = clk_prepare_enable(pdma->clk);
> +   if (ret) {
> +   dev_err(&pdev->dev, "Failed to enable clk %d\n", ret);
> +   return ret;
> +   }
> }
>
> /* Remove DMA RAM out of shutdown */
> @@ -1998,7 +2001,8 @@ err_request_irq:
>
>  err_dma_mask:
>  err_clk_enable:
> -   clk_disable_unprepare(pdma->clk);
> +   if (!IS_ERR(pdma->clk))
> +   clk_disable_unprepare(pdma->clk);
>
> return ret;
>  }
> @@ -2022,11 +2026,20 @@ static int xgene_dma_remove(struct platform_device 
> *pdev)
> xgene_dma_delete_chan_rings(chan);
> }
>
> -   clk_disable_unprepare(pdma->clk);
> +   if (!IS_ERR(pdma->clk))
> +   clk_disable_unprepare(pdma->clk);
>
> return 0;
>  }
>
> +#ifdef CONFIG_ACPI
> +static const struct acpi_device_id xgene_dma_acpi_match_ptr[] = {
> +   {"APMC0D43", 0},
> +   {},
> +};
> +MODULE_DEVICE_TABLE(acpi, xgene_dma_acpi_match_ptr);
> +#endif
> +
>  static const struct of_device_id xgene_dma_of_match_ptr[] = {
> {.compatible = "apm,xgene-storm-dma",},
> {},
> @@ -2039,6 +2052,7 @@ static struct platform_driver xgene_dma_driver = {
> .driver = {
> .name = "X-Gene-DMA",
> .of_match_table = xgene_dma_of_match_ptr,
> +   .acpi_match_table = ACPI_PTR(xgene_dma_acpi_match_ptr),
> },
>  };
>
> --
> 1.8.2.1


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


Re: [PATCH] crypto: fix simple_return.cocci warnings

2015-08-13 Thread Herbert Xu
On Wed, Aug 12, 2015 at 12:50:17PM +0800, kbuild test robot wrote:
> drivers/crypto/qat/qat_common/adf_sriov.c:258:1-4: WARNING: end returns can 
> be simpified and declaration on line 212 can be dropped
> 
>  Simplify a trivial if-return sequence.  Possibly combine with a
>  preceding function call.
> Generated by: scripts/coccinelle/misc/simple_return.cocci
> 
> CC: Tadeusz Struk 
> Signed-off-by: Fengguang Wu 

Applied.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] perf script: Initialize callchain_param.record_mode

2015-08-13 Thread Jiri Olsa
On Wed, Jul 22, 2015 at 08:48:40PM +0200, Milian Wolff wrote:
> Hey all,
> 
> I recorded a perf data file using
> 
> perf record --call-graph dwarf kwrite 
> 
> when I report it I see backtraces pointing to the user space code:
> 
> perf report --stdio -g graph --no-children
> 16.36%  kwrite   libKF5TextEditor.so.5.13.0 [.] 
> QArrayData::data  
>  
>  |
>  ---QArrayData::data
> |  
> |--15.46%-- QTypedArrayData::data
> 
> but when I run perf script, I do not see _any_ backtraces into user space. 
> 
> perf script -F comm,tid,time,event,ip,sym,trace,period
> :4898  4898 17486.943365:  1 cycles: 
>   25f83a native_write_msr_safe
>   234f8a __intel_pmu_enable_all
>   235010 intel_pmu_enable_all
>   22e1ec x86_pmu_enable
>   356fb7 perf_pmu_enable.part.53
>   35824d perf_event_context_sched_in.isra.64
>   358e0b perf_event_exec
>   3e8c93 setup_new_exec
>   439a9f load_elf_binary
>   3e7f48 search_binary_handler
>   3e89cf do_execveat_common.isra.15
>   3e8e4a sys_execve
>   78b895 return_from_execve
> 
> kwrite  4898 17486.943893:  1 cycles: 
> kwrite  4898 17486.944211:  1 cycles: 
> ...
> kwrite  4898 17486.953664: 461703 cycles: 
> kwrite  4898 17486.953838: 490150 cycles: 
>   78d4c0 page_fault
> kwrite  4898 17486.954009: 516694 cycles: 
> ...
> kwrite  4898 17510.765568: 766937 cycles: 
>   78979b down_write
>   39bd82 unlink_file_vma
>   3944d0 free_pgtables
>   39eef6 exit_mmap
>   275d45 mmput
>   27b514 do_exit
>   27bdfb do_group_exit
>   27be84 [unknown]
>   78b56e system_call
> 
> So it looks to me as if only kernel-space call stacks are unwound in perf 
> script. Is there a magic switch that I'm missing to get user-space stacks 
> unwound? Note I'm using perf 4.1.0 on a Linux 4.1.2 system.

hi,
right you are.. does attached patch help?

thanks,
jirka


---
Milian Wolff reported non functional DWARF unwind under perf
script. The reason is that perf script does not properly configure
callchain_param.record_mode, which is needed by unwind code.

Stealing the code from report and leaving the place for
more initialization code in a hope we could merge it with
report__setup_sample_type one day.

Reported-by: Milian Wolff 
Link: http://lkml.kernel.org/n/tip-vtgxy0tv3gogvomyhc2c5...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/perf/builtin-script.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 7b376d215e94..105332e950a9 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1561,6 +1561,22 @@ static int have_cmd(int argc, const char **argv)
return 0;
 }
 
+static void script__setup_sample_type(struct perf_script *script)
+{
+   struct perf_session *session = script->session;
+   u64 sample_type = perf_evlist__combined_sample_type(session->evlist);
+
+   if (symbol_conf.use_callchain || symbol_conf.cumulate_callchain) {
+   if ((sample_type & PERF_SAMPLE_REGS_USER) &&
+   (sample_type & PERF_SAMPLE_STACK_USER))
+   callchain_param.record_mode = CALLCHAIN_DWARF;
+   else if (sample_type & PERF_SAMPLE_BRANCH_STACK)
+   callchain_param.record_mode = CALLCHAIN_LBR;
+   else
+   callchain_param.record_mode = CALLCHAIN_FP;
+   }
+}
+
 int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
 {
bool show_full_info = false;
@@ -1849,6 +1865,7 @@ int cmd_script(int argc, const char **argv, const char 
*prefix __maybe_unused)
goto out_delete;
 
script.session = session;
+   script__setup_sample_type(&script);
 
session->itrace_synth_opts = &itrace_synth_opts;
 
-- 
2.4.3

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


[PATCH V9 03/25] perf tools: Add Intel PT instruction decoder

2015-08-13 Thread Adrian Hunter
Add support for decoding instructions for Intel Processor Trace.  The
kernel x86 instruction decoder is copied for this.

This essentially provides intel_pt_get_insn() which takes a binary
buffer, uses the kernel's x86 instruction decoder to get details of the
instruction and then categorizes it for consumption by an Intel PT
decoder.

Signed-off-by: Adrian Hunter 
---


Changes in V9:

insn.c is in the tools/perf sources and so should
be included as "insn.c" not .

inat_types.h is in the kernel headers so is not needed
in the tools/perf sources.


 tools/build/Makefile.build |   2 +
 tools/perf/.gitignore  |   1 +
 tools/perf/Makefile.perf   |  12 +-
 tools/perf/util/intel-pt-decoder/Build |  12 +-
 .../util/intel-pt-decoder/gen-insn-attr-x86.awk| 386 
 tools/perf/util/intel-pt-decoder/inat.c|  96 ++
 tools/perf/util/intel-pt-decoder/inat.h| 221 +
 tools/perf/util/intel-pt-decoder/insn.c| 594 +
 tools/perf/util/intel-pt-decoder/insn.h| 201 +
 .../util/intel-pt-decoder/intel-pt-insn-decoder.c  | 246 ++
 .../util/intel-pt-decoder/intel-pt-insn-decoder.h  |  65 ++
 .../perf/util/intel-pt-decoder/x86-opcode-map.txt  | 970 +
 12 files changed, 2803 insertions(+), 3 deletions(-)
 create mode 100644 tools/perf/util/intel-pt-decoder/gen-insn-attr-x86.awk
 create mode 100644 tools/perf/util/intel-pt-decoder/inat.c
 create mode 100644 tools/perf/util/intel-pt-decoder/inat.h
 create mode 100644 tools/perf/util/intel-pt-decoder/insn.c
 create mode 100644 tools/perf/util/intel-pt-decoder/insn.h
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.h
 create mode 100644 tools/perf/util/intel-pt-decoder/x86-opcode-map.txt

diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build
index faca2bf6a430..8120af9c0341 100644
--- a/tools/build/Makefile.build
+++ b/tools/build/Makefile.build
@@ -57,6 +57,8 @@ quiet_cmd_cc_i_c = CPP  $@
 quiet_cmd_cc_s_c = AS   $@
   cmd_cc_s_c = $(CC) $(c_flags) -S -o $@ $<
 
+quiet_cmd_gen = GEN  $@
+
 # Link agregate command
 # If there's nothing to link, create empty $@ object.
 quiet_cmd_ld_multi = LD   $@
diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore
index 09db62ba5786..3d1bb802dbf4 100644
--- a/tools/perf/.gitignore
+++ b/tools/perf/.gitignore
@@ -29,3 +29,4 @@ config.mak.autogen
 *.pyc
 *.pyo
 .config-detected
+util/intel-pt-decoder/inat-tables.c
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 4b58daeff881..d9863cb96f59 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -76,6 +76,12 @@ include config/utilities.mak
 #
 # Define NO_AUXTRACE if you do not want AUX area tracing support
 
+# As per kernel Makefile, avoid funny character set dependencies
+unexport LC_ALL
+LC_COLLATE=C
+LC_NUMERIC=C
+export LC_COLLATE LC_NUMERIC
+
 ifeq ($(srctree),)
 srctree := $(patsubst %/,%,$(dir $(shell pwd)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
@@ -135,6 +141,7 @@ INSTALL = install
 FLEX= flex
 BISON   = bison
 STRIP   = strip
+AWK = awk
 
 LIB_DIR  = $(srctree)/tools/lib/api/
 TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/
@@ -289,7 +296,7 @@ strip: $(PROGRAMS) $(OUTPUT)perf
 
 PERF_IN := $(OUTPUT)perf-in.o
 
-export srctree OUTPUT RM CC LD AR CFLAGS V BISON FLEX
+export srctree OUTPUT RM CC LD AR CFLAGS V BISON FLEX AWK
 build := -f $(srctree)/tools/build/Makefile.build dir=. obj
 
 $(PERF_IN): $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h FORCE
@@ -565,7 +572,8 @@ clean: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean config-clean
$(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name 
'\.*.d' -delete
$(Q)$(RM) $(OUTPUT).config-detected
$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf 
perf-read-vdso32 perf-read-vdsox32
-   $(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc 
*/*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE 
$(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
+   $(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc 
*/*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE 
$(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* \
+   $(OUTPUT)util/intel-pt-decoder/inat-tables.c
$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
$(python-clean)
 
diff --git a/tools/perf/util/intel-pt-decoder/Build 
b/tools/perf/util/intel-pt-decoder/Build
index 9d67381a9bd3..5a46ce13c1f8 100644
--- a/tools/perf/util/intel-pt-decoder/Build
+++ b/tools/perf/util/intel-pt-decoder/Build
@@ -1 +1,11 @@
-libperf-$(CONFIG_AUXTRACE) += intel-pt-pkt-decoder.o
+libperf-$(CONFIG_AUXTRACE) += intel-pt-pkt-de

Re: [PATCH 0/3] ARM: sun6i: Support Security System crypto engine

2015-08-13 Thread Herbert Xu
On Tue, Aug 11, 2015 at 01:32:54PM +0800, Chen-Yu Tsai wrote:
> Hi everyone,
> 
> This series enables support for the crypto engine found in sun6i, or
> Allwinner A31/A31s SoCs. The crypto engine is the same hardware as on
> earlier sun4i/sun7i (A10/A20), with the only difference being the reset
> control is separated out of the clock gate control.
> 
> The same hardware is also available on the A33, but not the A23. Support
> for this requires additions to the clock driver, and will be submitted
> separately once things are clear on how to proceed. I already have a
> proof of concept working.
> 
> 
> Patch 1 adds an optional reset control property to the sunxi-ss binding.
> 
> Patch 2 adds optional reset control support to the sunxi-ss driver.
> 
> Patch 3 enables the crypto engine on sun6i, by adding the module clock and
> device node.

All applied.  Thanks.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] extcon: palmas: Fix build break due to devm_gpiod_get_optional API change

2015-08-13 Thread Uwe Kleine-König
Hello,

On Thu, Aug 13, 2015 at 09:29:04AM +0900, Chanwoo Choi wrote:
> Commit b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions")
> changes the prototype of devm_gpiod_get_optional() API which should include
> the falgs mandatory.
I'd write: "With commit b17d1bf16cc7 ("...") it becomes necessary to
pass the flags argument." After all it is possible (and recommended)
already now to use it. Your wording sounds as if b17d1bf16cc7 changed
the API in an incompatible way.

Best regards
Uwe

-- 
Pengutronix e.K.   | Uwe Kleine-König|
Industrial Linux Solutions | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 00/22] memory: omap-gpmc: mtd: nand: Support GPMC NAND on non-OMAP platforms

2015-08-13 Thread Roger Quadros

On 11/08/15 15:48, Tony Lindgren wrote:
> * Roger Quadros  [150807 02:15]:
>> Hi,
>>
>> We do a couple of things in this series which result in
>> cleaner device tree implementation, faster perfomance and
>> multi-platform support. As an added bonus we get new GPI/Interrupt pins
>> for use in the system.
>>
>> - Establish a custom interface between NAND and GPMC driver. This is
>> needed because all of the NAND registers sit in the GPMC register space.
>> Some bits like NAND IRQ are even shared with GPMC.
>>
>> - Remove NAND IRQ handling from omap-gpmc driver, share the GPMC IRQ
>> with the omap2-nand driver and handle NAND IRQ events in the NAND driver.
>> This causes performance increase when using prefetch-irq mode.
>> 30% increase in read, 17% increase in write in prefetch-irq mode.
>>
>> - Clean up device tree support so that omap-gpmc IP and the omap2 NAND
>> driver can be used on non-OMAP platforms. e.g. Keystone.
>>
>> - Implement GPIOCHIP + IRQCHIP for the GPMC WAITPINS. SoCs can contain
>> 2 to 4 of these and most of them would be unused otherwise. It also
>> allows a cleaner implementation of NAND Ready pin status for the NAND driver.
>>
>> - Implement GPIOlib based NAND ready pin checking for OMAP NAND driver.
> 
> Nice job :) Using GPIOCHIP + IRQCHIP allows us to make the GPMC
> using drivers pretty much generic eventually.

Thanks :)
>  
>> NOTE: I've only adapted dra7.dtsi and dra7x-evms for this series.
>> I will adapt all other boards when the series is in a shape to be accepted.
> 
> OK. Yeah let's make sure no regressions are caused by this.. We also
> still have the omap3 legacy booting around, have you checked that it
> keeps on working?

I don't have any omap3 board with legacy support with me. I have omap3-beagle
but looks like legacy boot is dropped for it already.

I'll try to revert the patch that drops beagle support and test it on that one.

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


linux-next: Tree for Aug 13

2015-08-13 Thread Stephen Rothwell
Hi all,

Changes since 20150812:

The v4l-dvb tree still had its build failure so I used the version from
next-20150810.

The bluetooth tree lost its build failure.

The staging tree gained a conflict against the tip tree.

The clk tree lost its build failure but gained a conflict against the
drm-msm tree.

The akpm tree lost 3 patches that turned up elsewhere.

Non-merge commits (relative to Linus' tree): 7160
 6468 files changed, 323020 insertions(+), 153451 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 for x86_64,
a multi_v7_defconfig for arm and a native build of tools/perf. After
the final fixups (if any), it is also built with powerpc allnoconfig
(32 and 64 bit), ppc44x_defconfig and allyesconfig (this fails its final
link) and i386, sparc, sparc64 and arm defconfig.

Below is a summary of the state of the merge.

I am currently merging 224 trees (counting Linus' and 32 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 Rothwells...@canb.auug.org.au

$ git checkout master
$ git reset --hard stable
Merging origin/master (30065bfda900 Merge tag 'arm64-fixes' of 
git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux)
Merging fixes/master (c7e9ad7da219 Merge branch 'perf-urgent-for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip)
Merging kbuild-current/rc-fixes (3d1450d54a4f Makefile: Force gzip and xz on 
module install)
Merging arc-current/for-curr (e4140819dadc ARC: signal handling robustify)
Merging arm-current/fixes (09edea4f8fde ARM: 8410/1: VDSO: fix coarse clock 
monotonicity regression)
Merging m68k-current/for-linus (1214c525484c m68k: Use for_each_sg())
Merging metag-fixes/fixes (0164a711c97b metag: Fix ioremap_wc/ioremap_cached 
build errors)
Merging mips-fixes/mips-fixes (1795cd9b3a91 Linux 3.16-rc5)
Merging powerpc-fixes/fixes (f7644cbfcdf0 Linux 4.2-rc6)
Merging powerpc-merge-mpe/fixes (bc0195aad0da Linux 4.2-rc2)
Merging sparc/master (73958c651fbf sparc64: use ENTRY/ENDPROC in VISsave)
Merging net/master (e941ba865033 Merge branch 'gianfar-fixes')
Merging ipsec/master (158cd4af8ded packet: missing dev_put() in 
packet_do_bind())
Merging sound-current/for-linus (6ac7ada210a8 Merge tag 'asoc-fix-v4.2-rc5' of 
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus)
Merging pci-current/for-linus (c9ddbac9c891 PCI: Restore PCI_MSIX_FLAGS_BIRMASK 
definition)
Merging wireless-drivers/master (741e3b9902d1 rtlwifi: rtl8723be: Add module 
parameter for MSI interrupts)
Merging driver-core.current/driver-core-linus (cbfe8fa6cd67 Linux 4.2-rc4)
Merging tty.current/tty-linus (cbfe8fa6cd67 Linux 4.2-rc4)
Merging usb.current/usb-linus (f7644cbfcdf0 Linux 4.2-rc6)
Merging usb-gadget-fixes/fixes (c93e64e91248 usb: udc: core: add device_del() 
call to error pathway)
Merging usb-serial-fixes/usb-linus (74472233233f USB: sierra: add 1199:68AB 
device ID)
Merging staging.current/staging-linus (f7644cbfcdf0 Linux 4.2-rc6)
Merging char-misc.current/char-misc-linus (f7644cbfcdf0 Linux 4.2-rc6)
Merging input-current/for-linus (6b30c73e9f37 Input: elantech - add special 
check for fw_version 0x470f01 touchpad)
Merging crypto-current/master (d3392f41f6d3 crypto: nx - respect sg limit 
bounds when building sg lists for SHA)
Merging ide/master (d681f1166919 ide: remove deprecated use of pci api)
Merging devicetree-current/devicetree/merge (f76502aa9140 of/dynamic: Fix test 
for PPC_PSERIES)
Merging rr-fixes/fixes (fe0d34d242fa module: weaken locking assertion for oops 
path.)
Merging vfio-fixes/for-linus (4bc94d5dc95d vfio: Fix lockdep issue)
Merging kselftest-fixes/fixes (fee50f3c8427 selftests/futex: Fix 
futex_cmp_requeue_pi() error handling)
Merging backlight-fixes/for-backlight-fixes (68feaca0b13e backlight: pwm: 
Handle EPROBE_DEFER while requesting the PWM)
Merging ftrace-fixes/for-next-urgent (6224beb12e19 tracing: Have branch tracer 
use r

Re: [PATCH 2/2] zram: use crypto API to compress the page

2015-08-13 Thread Joonsoo Kim
On Thu, Aug 13, 2015 at 12:51:13PM +0900, Sergey Senozhatsky wrote:
> On (08/13/15 11:24), Joonsoo Kim wrote:
> > Until now, zram uses compression algorithm through direct call
> > to core algorithm function, but, it has drawback that we need to add
> > compression algorithm manually to zram if needed. Without this work,
> > we cannot utilize various compression algorithms in the system.
> > Moreover, to add new compression algorithm, we need to know how to use it
> > and this is somewhat time-consuming.
> > 
> 
> I don't like this change, sorry.
> 
> Here is why. One of the main reasons why I haven't implemented it using
> crypto API (and it was an option and I thought about it) was and still
> is the fact that crypto API requires tfm for both compress and decompress
> operations. And this is a show stopper. No matter how you implement it,
> it is slower than what we have by definition.

I don't think it is show stopper. Current implementation that uses zstrm
only for compression seems over-optimized thing to me. Some of other
compression algorithms need scratch-buffer to decompress the contents.
As you know, zlib is one of them. I tested some of other decompression
algorithm such as quicklz, wkdm and they also need scratch-buffer.

And, we cannot support crypto algorithm *module* in current
implementation.

If that optimization is really needed for the case that doesn't need
tfm except fetching function pointer, we can implement sharable tfm
in crypto subsystem.

> 
> Now zram_bvec_read() operations depends on:
> 
> a) other read operations
>because read() path now use limited in size idle stream list
> 
> b) write operations
>because write() path uses same idle streams list
> 
> 
> 
> Literally, you change zram_bvec_read() from a fast
> 
>   zram_decompress_page(zram, uncmem, index);
> 
> to a slow
> 
>   zstrm = zcomp_strm_find(zram->comp);
>   zram_decompress_page(zram, zstrm, uncmem, index);
>   zcomp_strm_release(zram->comp, zstrm);
> 
> 
> you either slow down both write() and read() if you use a single idle
> stream list for both read and write, or double the amount of memory
> used by idle streams if you decide to use separate read and write
> idle stream lists. I see no real reason to do either of those. I like
> that the existing read() is as fast as probably possible.

Yes, there can be some performace regression. But, by allocating some
more streams, we can easily eliminate regression. Memory overhead
would be really small. I think that gaining flexibility and reducing
management overhead can compensate this small memory overhead.

Thanks.

> 
> > When I tested new algorithms such as zlib, these problems make me hard
> > to test them. To prevent these problem in the future, I think that
> > using crypto API to compress the page is better approach and this patch
> > implements it.
> > 
> > The reason we need to support vairous compression algorithms is that
> > zram's performance is highly depend on workload and compression algorithm
> > and architecture. Every compression algorithm has it's own strong point.
> > For example, zlib is the best for compression ratio, but, it's
> > (de)compression speed is rather slow. Against my expectation, in my kernel
> > build test with zram swap, in low-memory condition on x86, zlib shows best
> > performance than others. In this case, I guess that compression ratio is
> > the most important factor. Unlike this situation, on ARM, maybe fast
> > (de)compression speed is the most important because it's computation speed
> > is slower than x86.
> > 
> > We can't expect what algorithm is the best fit for one's system, because
> > it needs too complex calculation. We need to test it in case by case and
> > easy to use new compression algorithm by this patch will help
> > that situation.
> > 
> > Signed-off-by: Joonsoo Kim 
> > ---
> >  drivers/block/zram/Kconfig | 13 +--
> >  drivers/block/zram/Makefile|  4 +-
> >  drivers/block/zram/zcomp.c | 87 
> > ++
> >  drivers/block/zram/zcomp.h | 34 +
> >  drivers/block/zram/zcomp_lz4.c | 47 ---
> >  drivers/block/zram/zcomp_lz4.h | 17 -
> >  drivers/block/zram/zcomp_lzo.c | 47 ---
> >  drivers/block/zram/zcomp_lzo.h | 17 -
> >  drivers/block/zram/zram_drv.c  | 28 +-
> >  9 files changed, 66 insertions(+), 228 deletions(-)
> >  delete mode 100644 drivers/block/zram/zcomp_lz4.c
> >  delete mode 100644 drivers/block/zram/zcomp_lz4.h
> >  delete mode 100644 drivers/block/zram/zcomp_lzo.c
> >  delete mode 100644 drivers/block/zram/zcomp_lzo.h
> > 
> > diff --git a/drivers/block/zram/Kconfig b/drivers/block/zram/Kconfig
> > index 386ba3d..36ec96f 100644
> > --- a/drivers/block/zram/Kconfig
> > +++ b/drivers/block/zram/Kconfig
> > @@ -1,8 +1,7 @@
> >  config ZRAM
> > tristate "Compressed RAM block device support"
> > depends on BLOCK && SYSFS && ZSMALLOC
> > -   select 

Re: randconfig build error with next-20150812, in drivers/extcon/extcon-palmas.c

2015-08-13 Thread Roger Quadros
Hi,

On 12/08/15 17:46, Jim Davis wrote:
> Building with the attached random configuration file,
> 
> warning: (INTEL_SOC_DTS_IOSF_CORE && PUNIT_ATOM_DEBUG) selects
> IOSF_MBI which has unmet direct dependencies (PCI)
> 
> drivers/extcon/extcon-palmas.c: In function ‘palmas_gpio_id_detect’:
> drivers/extcon/extcon-palmas.c:136:2: error: implicit declaration of
> function ‘gpiod_get_value_cansleep’
> [-Werror=implicit-function-declaration]
>   id = gpiod_get_value_cansleep(palmas_usb->id_gpiod);
>   ^
> drivers/extcon/extcon-palmas.c: In function ‘palmas_usb_probe’:
> drivers/extcon/extcon-palmas.c:211:2: error: implicit declaration of
> function ‘devm_gpiod_get_optional’
> [-Werror=implicit-function-declaration]
>   palmas_usb->id_gpiod = devm_gpiod_get_optional(&pdev->dev, "id", 
> GPIOD_ASIS);
>   ^
> drivers/extcon/extcon-palmas.c:211:67: error: ‘GPIOD_ASIS’ undeclared
> (first use in this function)
>   palmas_usb->id_gpiod = devm_gpiod_get_optional(&pdev->dev, "id", 
> GPIOD_ASIS);
>^
> drivers/extcon/extcon-palmas.c:211:67: note: each undeclared
> identifier is reported only once for each function it appears in
> drivers/extcon/extcon-palmas.c:228:3: error: implicit declaration of
> function ‘gpiod_set_debounce’ [-Werror=implicit-function-declaration]
>status = gpiod_set_debounce(palmas_usb->id_gpiod,
>^
> drivers/extcon/extcon-palmas.c:275:3: error: implicit declaration of
> function ‘gpiod_to_irq’ [-Werror=implicit-function-declaration]
>palmas_usb->gpio_id_irq = gpiod_to_irq(palmas_usb->id_gpiod);
>^
> 
> 

Thanks for the catch.

This is because extcon-palmas.c doesn't include the header
include/linux/gpio/consumer.h

It will be addressed in the following thread
http://thread.gmane.org/gmane.linux.kernel/2019235

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


Re: [PATCH] extcon: palmas: Fix build break due to devm_gpiod_get_optional API change

2015-08-13 Thread Roger Quadros
Hi Chanwoo,

On 13/08/15 03:29, Chanwoo Choi wrote:
> Commit b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions")
> changes the prototype of devm_gpiod_get_optional() API which should include
> the falgs mandatory.

s/falgs/flags

> 
> Reported-by: Stephen Rothwell 
> Signed-off-by: Chanwoo Choi 
> ---
>  drivers/extcon/extcon-palmas.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c
> index 662e91778cb0..308928d44ead 100644
> --- a/drivers/extcon/extcon-palmas.c
> +++ b/drivers/extcon/extcon-palmas.c
> @@ -208,7 +208,8 @@ static int palmas_usb_probe(struct platform_device *pdev)
>   palmas_usb->wakeup = pdata->wakeup;
>   }
>  
> - palmas_usb->id_gpiod = devm_gpiod_get_optional(&pdev->dev, "id");
> + palmas_usb->id_gpiod = devm_gpiod_get_optional(&pdev->dev, "id",
> + GPIOD_IN);
>   if (IS_ERR(palmas_usb->id_gpiod)) {
>   dev_err(&pdev->dev, "failed to get id gpio\n");
>   return PTR_ERR(palmas_usb->id_gpiod);
> 

Can you please include the following headers in this patch?

#include 
#include 

This should fix the randconfig build errors reported by Jim Davis at
http://article.gmane.org/gmane.linux.kernel/2018960

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


Re: [PATCH 02/20] powerpc/8xx: Map linear kernel RAM with 8M pages

2015-08-13 Thread Segher Boessenkool
On Wed, Aug 12, 2015 at 03:40:56PM +0200, Christophe Leroy wrote:
>   /* Insert level 1 index */
>   rlwimi  r11, r10, 32 - ((PAGE_SHIFT - 2) << 1), (PAGE_SHIFT - 2) << 1, 
> 29
>   lwz r11, (swapper_pg_dir-PAGE_OFFSET)@l(r11)/* Get the 
> level 1 entry */
> + mtcrr11

Maybe mtcrf is faster?  You only want one field, anyhow.

> + bgt-cr7,5f  /* CR7.GT = bit 29 = Large page (8M or 512K) */

You can write this as   bt- 29,5f   which should be easier to read.

>   /* Insert level 1 index */
>  3:   rlwimi  r11, r10, 32 - ((PAGE_SHIFT - 2) << 1), (PAGE_SHIFT - 2) << 1, 
> 29
>   lwz r11, (swapper_pg_dir-PAGE_OFFSET)@l(r11)/* Get the 
> level 1 entry */
> + mtcrr11
> + bgt cr7,200f

Same here...  Probably good to comment it, too.


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


<    4   5   6   7   8   9