Re: [PATCH v2] intel_idle: Fixed C6 state on Avoton/Rangeley processors

2013-11-26 Thread Bockholdt Arne

On Tue, 2013-11-26 at 13:43 -0500, Len Brown wrote: 
> > .desc = "MWAIT 0x51",
> > -   .flags = MWAIT2flg(0x58) | CPUIDLE_FLAG_TIME_VALID | 
> > CPUIDLE_FLAG_TLB_FLUSHED,
> > +   .flags = MWAIT2flg(0x51) | CPUIDLE_FLAG_TIME_VALID | 
> > CPUIDLE_FLAG_TLB_FLUSHED,
> > .exit_latency = 15,
> > .target_residency = 45,
> 
> Thanks for noticing that .desc and .flags are inconsistent.
> This is my fault -- apparently I e-mailed a version of this patch that
> is older than what I have in my git tree.
> 
> No big issue, though, as 0x51 and 0x58 do exactly the same thing in
> AVN hardware.
> Indeed, changing .desc to 0x58 would be fine also.


The Rangeley on my Supermicro A1SRi-2758F board won't enter C6 with
MWAIT flag set to 0x58 but will do that with 0x51. Maybe the missing
turbo mode of the Rangeley ?


Arne
N�r��yb�X��ǧv�^�)޺{.n�+{zX����ܨ}���Ơz�:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a���
0��h���i

Re: [PATCH] avr32: Kill CONFIG_MTD_PARTITIONS

2013-11-26 Thread Hans-Christian Egtvedt
Around Wed 27 Nov 2013 00:49:37 + or thereabout, Eunbong Song wrote:
> 
> This patch removes CONFIG_MTD_PARTITIONS in config files for avr32.
>  Because CONFIG_MTD_PARTITIONS was removed by commit 
> 6a8a98b22b10f1560d5f90aded4a54234b9b2724.

Thank you for cleaning. I'll add this to my for-linus branch.

> Signed-off-by: Eunbong Song 
>

Acked-by: Hans-Christian Egtvedt 

> ---
>  arch/avr32/configs/atngw100_defconfig  |1 -
>  arch/avr32/configs/atngw100_evklcd100_defconfig|1 -
>  arch/avr32/configs/atngw100_evklcd101_defconfig|1 -
>  arch/avr32/configs/atngw100_mrmt_defconfig |1 -
>  arch/avr32/configs/atngw100mkii_defconfig  |1 -
>  .../avr32/configs/atngw100mkii_evklcd100_defconfig |1 -
>  .../avr32/configs/atngw100mkii_evklcd101_defconfig |1 -
>  arch/avr32/configs/atstk1002_defconfig |1 -
>  arch/avr32/configs/atstk1003_defconfig |1 -
>  arch/avr32/configs/atstk1004_defconfig |1 -
>  arch/avr32/configs/atstk1006_defconfig |1 -
>  arch/avr32/configs/favr-32_defconfig   |1 -
>  arch/avr32/configs/hammerhead_defconfig|1 -
>  arch/avr32/configs/merisc_defconfig|1 -
>  arch/avr32/configs/mimc200_defconfig   |1 -
>  15 files changed, 0 insertions(+), 15 deletions(-)


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


[PATCH] pinctrl: sh-pfc: Initial r7s72100 support

2013-11-26 Thread Magnus Damm
From: Magnus Damm 

Add r7s72100 PINCTRL support via sh-pfc. At this point this code
provides enough support to allow use together with the gpio-rz
driver. Incremental per-device patches will in the future be
submitted on top of this base patch to allow PINCTRL enablement
for each individual device.

Signed-off-by: Magnus Damm 
---

 drivers/pinctrl/sh-pfc/Kconfig|5 
 drivers/pinctrl/sh-pfc/Makefile   |1 
 drivers/pinctrl/sh-pfc/core.c |9 +
 drivers/pinctrl/sh-pfc/core.h |1 
 drivers/pinctrl/sh-pfc/pfc-r7s72100.c |  166 +
 5 files changed, 182 insertions(+)

--- 0001/drivers/pinctrl/sh-pfc/Kconfig
+++ work/drivers/pinctrl/sh-pfc/Kconfig 2013-11-27 15:18:31.0 +0900
@@ -20,6 +20,11 @@ config GPIO_SH_PFC
  This enables support for GPIOs within the SoC's pin function
  controller.
 
+config PINCTRL_PFC_R7S72100
+   def_bool y
+   depends on ARCH_R7S72100
+   select PINCTRL_SH_PFC
+
 config PINCTRL_PFC_R8A73A4
def_bool y
depends on ARCH_R8A73A4
--- 0001/drivers/pinctrl/sh-pfc/Makefile
+++ work/drivers/pinctrl/sh-pfc/Makefile2013-11-27 15:18:31.0 
+0900
@@ -3,6 +3,7 @@ ifeq ($(CONFIG_GPIO_SH_PFC),y)
 sh-pfc-objs+= gpio.o
 endif
 obj-$(CONFIG_PINCTRL_SH_PFC)   += sh-pfc.o
+obj-$(CONFIG_PINCTRL_PFC_R7S72100) += pfc-r7s72100.o
 obj-$(CONFIG_PINCTRL_PFC_R8A73A4)  += pfc-r8a73a4.o
 obj-$(CONFIG_PINCTRL_PFC_R8A7740)  += pfc-r8a7740.o
 obj-$(CONFIG_PINCTRL_PFC_R8A7778)  += pfc-r8a7778.o
--- 0001/drivers/pinctrl/sh-pfc/core.c
+++ work/drivers/pinctrl/sh-pfc/core.c  2013-11-27 15:18:31.0 +0900
@@ -401,6 +401,12 @@ static int sh_pfc_init_ranges(struct sh_
 
 #ifdef CONFIG_OF
 static const struct of_device_id sh_pfc_of_table[] = {
+#ifdef CONFIG_PINCTRL_PFC_R7S72100
+   {
+   .compatible = "renesas,pfc-r7s72100",
+   .data = _pinmux_info,
+   },
+#endif
 #ifdef CONFIG_PINCTRL_PFC_R8A73A4
{
.compatible = "renesas,pfc-r8a73a4",
@@ -549,6 +555,9 @@ static int sh_pfc_remove(struct platform
 }
 
 static const struct platform_device_id sh_pfc_id_table[] = {
+#ifdef CONFIG_PINCTRL_PFC_R7S72100
+   { "pfc-r7s72100", (kernel_ulong_t)_pinmux_info },
+#endif
 #ifdef CONFIG_PINCTRL_PFC_R8A73A4
{ "pfc-r8a73a4", (kernel_ulong_t)_pinmux_info },
 #endif
--- 0001/drivers/pinctrl/sh-pfc/core.h
+++ work/drivers/pinctrl/sh-pfc/core.h  2013-11-27 15:18:31.0 +0900
@@ -64,6 +64,7 @@ void sh_pfc_write_raw_reg(void __iomem *
 int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin);
 int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type);
 
+extern const struct sh_pfc_soc_info r7s72100_pinmux_info;
 extern const struct sh_pfc_soc_info r8a73a4_pinmux_info;
 extern const struct sh_pfc_soc_info r8a7740_pinmux_info;
 extern const struct sh_pfc_soc_info r8a7778_pinmux_info;
--- /dev/null
+++ work/drivers/pinctrl/sh-pfc/pfc-r7s72100.c  2013-11-27 15:20:28.0 
+0900
@@ -0,0 +1,166 @@
+/*
+ * R7S72100 processor support
+ *
+ * Copyright (C) 2013  Renesas Electronics Corporation
+ * Copyright (C) 2013  Magnus Damm
+ * Copyright (C) 2012  Renesas Solutions Corp.
+ * Copyright (C) 2012  Kuninori Morimoto 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; version 2 of the
+ * License.
+ */
+
+#include 
+
+#include "core.h"
+#include "sh_pfc.h"
+
+#define RZ_PORT_PIN(bank, pin) (((bank) * 16) + (pin))
+
+#define PORT_P_1(bank, pin, fn, sfx) fn(bank, pin, P_##bank##_##pin, sfx)
+
+#define PORT_P_16(bank, fn, sfx)   \
+   PORT_P_1(bank, 0,  fn, sfx), PORT_P_1(bank, 1,  fn, sfx),   \
+   PORT_P_1(bank, 2,  fn, sfx), PORT_P_1(bank, 3,  fn, sfx),   \
+   PORT_P_1(bank, 4,  fn, sfx), PORT_P_1(bank, 5,  fn, sfx),   \
+   PORT_P_1(bank, 6,  fn, sfx), PORT_P_1(bank, 7,  fn, sfx),   \
+   PORT_P_1(bank, 8,  fn, sfx), PORT_P_1(bank, 9,  fn, sfx),   \
+   PORT_P_1(bank, 10, fn, sfx), PORT_P_1(bank, 11, fn, sfx),   \
+   PORT_P_1(bank, 12, fn, sfx), PORT_P_1(bank, 13, fn, sfx),   \
+   PORT_P_1(bank, 14, fn, sfx), PORT_P_1(bank, 15, fn, sfx)
+
+#define CPU_ALL_PORT(fn, sfx)  \
+   PORT_P_16(0, fn, sfx), PORT_P_16(1, fn, sfx),   \
+   PORT_P_16(2, fn, sfx), PORT_P_16(3, fn, sfx),   \
+   PORT_P_16(4, fn, sfx), PORT_P_16(5, fn, sfx),   \
+   PORT_P_16(6, fn, sfx), PORT_P_16(7, fn, sfx),   \
+   PORT_P_16(8, fn, sfx), PORT_P_16(9, fn, sfx),   \
+   PORT_P_16(10, fn, sfx), PORT_P_16(11, fn, sfx), \
+   PORT_P_16(12, fn, sfx)
+
+#define P_ALL(n) GP_ALL(n)
+
+enum {
+   PINMUX_RESERVED = 0,
+
+

Re: [PATCH V3 1/6] cpufreq: suspend governors on system suspend/hibernate

2013-11-26 Thread Viresh Kumar
On 27 November 2013 12:38, Lan Tianyu  wrote:
> Hi Viresh:

Hey Lan,

> First, I agree the new solution you are working on. :)

Thanks :)

> But actually I don't totally agree my origin patch have design issue.
> Because I think governor should have the ability to check whether it has
> been EXIT when doing INIT and it should return error code at that point.
> The design is to make governor code stronger to deal with the case that
> governor is reinitialized before EXIT. Just from my view.

> Sorry for noise.

Ahh, these are useful discussions. Everyone have their own thoughts and
its upto all of us to get meaningful stuff out of it..

I agree to whatever you wrote above but this isn't exactly what's being
done in your patch. I was more concerned about this stuff:

On 22 November 2013 13:08, Lan Tianyu  wrote:
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c

> +   if (has_target() && !frozen) {
> ret = __cpufreq_governor(policy,
> CPUFREQ_GOV_POLICY_EXIT);

> diff --git a/drivers/cpufreq/cpufreq_governor.c 
> b/drivers/cpufreq/cpufreq_governor.c
> @@ -204,9 +204,20 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy,
>
> switch (event) {
> case CPUFREQ_GOV_POLICY_INIT:
> +   /*
> +* In order to keep governor data across suspend/resume,
> +* Governor doesn't exit when suspend and will be
> +* reinitialized when resume. Here check policy governor
> +* data to determine whether the governor has been exited.
> +* If not, return EALREADY.
> +*/
> if (have_governor_per_policy()) {
> -   WARN_ON(dbs_data);
> +   if (dbs_data)
> +   return -EALREADY;
> } else if (dbs_data) {
> +   if (policy->governor_data == dbs_data)
> +   return -EALREADY;
> +
> dbs_data->usage_count++;
> policy->governor_data = dbs_data;
> return 0;

Here the cpufreq core has skipped the call to governor's EXIT,
and so it shouldn't pass on the following INIT call to them..

That's a bit wrong. These two calls work in pairs and are exactly
opposite to each other. And so if some decision has to be taken
then either that should be done completely at governor level
or core level. Doing stuff partly in governor and partly in core
is like giving invitation to new bugs/problems :)

Nothing personal otherwise. Recently there were patches sent
by people, you, Nishanth, etc, which I have just overridden with
my versions.. It wasn't about getting my count higher :) but
getting the solution at right places instead of solving them at
wrong locations..

I am already having tough time upstreaming patches for cpufreq
consolidation, as the number of patches is huge. It takes time
for people to absorb/test them. Though Rafael has taken almost all
of them in v3.13 finally, but I understand its difficult for him as
well and he did his job wonderfully :)

And so I don't really want to get any new stuff in which will surely
get consolidated later. Lets do it now, we had enough of it :)

Even, related to your patch, I was already thinking of getting
rid of "frozen" variable and parameter to functions, as we already
know status from a global variable now, cpufreq_suspended. And
so we don't actually need to pass any additional parameters
to many routines, which have something like 'frozen' currently.

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


RE: pull request: linux-firmware: update cxgb4 firmware

2013-11-26 Thread Hariprasad S
Hi Ben,

If you have not already pulled this, I will send out a new pull request which 
has update for both T4 and T5 firmware.

Thanks,
Hariprasad

From: Hariprasad S
Sent: Thursday, November 14, 2013 2:30 PM
To: b...@decadent.org.uk; dw...@infradead.org
Cc: linux-kernel@vger.kernel.org; Felix Marti; Divy Le Ray
Subject: pull request: linux-firmware: update cxgb4 firmware


Hi,

Can you please pull from the following URL?
git://git.chelsio.net/pub/git/linux-firmware.git for-upstream

The following changes since commit 7d0c7a8cfd78388d90cc784a185b19dcbdbce824:
  Ben Hutchings (1):
Merge branch 'wilink4' of 
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/linux-firmware

are available in the git repository at:

  git://git.chelsio.net/pub/git/linux-firmware.git for-upstream

Hariprasad Shenai (1):
  cxgb4: add t5fw-1.8.28.0.bin firmware

 cxgb4/t5fw-1.8.28.0.bin |  Bin 0 -> 462848 bytes
 cxgb4/t5fw.bin  |1 +
 2 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 cxgb4/t5fw-1.8.28.0.bin
 create mode 12 cxgb4/t5fw.bin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3 1/6] cpufreq: suspend governors on system suspend/hibernate

2013-11-26 Thread Lan Tianyu
On 2013年11月27日 11:07, Viresh Kumar wrote:
> On 27 November 2013 07:12, Rafael J. Wysocki  wrote:
>> Anyway, if you did what I asked you to do and put the cpufreq suspend/resume
>> into dpm_suspend/resume_noirq(), I'd probably take this for 3.13.  However,
>> since you've decided to put those things somewhere else thus making the
>> change much more intrusive, I can only queue it up for 3.14.
>>
>> This means I'm going to take the Tianyu's patch as a stop gap for 3.13.
> 

Hi Viresh:
First, I agree the new solution you are working on. :)
But actually I don't totally agree my origin patch have design issue.
Because I think governor should have the ability to check whether it has
been EXIT when doing INIT and it should return error code at that point.
The design is to make governor code stronger to deal with the case that
governor is reinitialized before EXIT. Just from my view.
Sorry for noise.

> There were design issues with that patch actually, as I pointed out earlier
> (handling EXIT part in core and INIT in governors).. And so in case we
> need to get something for v3.13, I will send a short version of this series
> with callbacks from suspend_noirq.


> 
> Get that one instead.
> 
> --
> viresh
> 


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


Re: [PATCH v3 1/6] watchdog: davinci: change driver to use WDT core

2013-11-26 Thread Guenter Roeck

On 11/26/2013 08:31 PM, Sekhar Nori wrote:

On Monday 25 November 2013 07:34 PM, Ivan Khoronzhuk wrote:

To reduce code duplicate and increase code readability use WDT core
code to handle WDT interface.

Remove io_lock as the WDT core uses mutex to lock each wdt device.
Remove wdt_state as the WDT core tracks state with its own variable.

The watchdog_init_timeout() can read timeout value from timeout-sec
property if the passed value is out of bounds. The heartbeat is
initialized in next way. If heartbeat is not set thought module
parameter, try to read it's value from WDT node timeout-sec property.
If node has no one, use default value.

The heartbeat is hold in wdd->timeout by WDT core, so use it in
order to set timeout period.

Signed-off-by: Ivan Khoronzhuk 
Acked-by: Santosh Shilimkar 
Reviewed-by: Guenter Roeck 


So this still causes a regression because the clk_get()
fails due to the changed device name. Please fold this
patch in (tested on DM365, compiled on rest).

Also, the change in device name (while needed) does not seem
to be related to usage of wdt core. Can you may be split
that change into a separate patch?



Given all the trouble with it, I think that would be a good idea.

Guenter

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


Re: bridge not getting ip since 3.11.5 and 3.4.66

2013-11-26 Thread Mark Trompell
On Tue, Nov 26, 2013 at 4:25 PM, Vlad Yasevich  wrote:
> On 11/26/2013 08:27 AM, Mark Trompell wrote:
>> Answering my own mail again and even top posting, sorry, but makes
>> more sense to me in that case).
>> I reverted bridge related patches from 3.11.5 and it boils down to
>> commit 0e308361d7ca0bf8b23fd472b90aae0fb10a1c32
>> Author: Herbert Xu 
>> Date:   Thu Sep 12 17:12:05 2013 +1000
>>
>> bridge: Clamp forward_delay when enabling STP
>>
>> [ Upstream commit be4f154d5ef0ca147ab6bcd38857a774133f5450 ]
>>
>> At some point limits were added to forward_delay.  However, the
>> limits are only enforced when STP is enabled.  This created a
>> scenario where you could have a value outside the allowed range
>> while STP is disabled, which then stuck around even after STP
>> is enabled.
>>
>> This patch fixes this by clamping the value when we enable STP.
>>
>> I had to move the locking around a bit to ensure that there is
>> no window where someone could insert a value outside the range
>> while we're in the middle of enabling STP.
>>
>> Causing the issue for me. Reverting that patch and br0 comes up again
>> and gets an ip.
>
> yes, that patch introduced a bug where we always used the
> max_forward delay value.
>
> you have 2 options:
>  1) disable STP.  Since you are just running VMs and you have a single
> physical connection on the bridge, you can safely disable STP since
> your system is a leaf node.

disabling stp indeed helps here, but ...

>  2) Get the latest stable kernel.  The bug has been fixed there.

3.12.1 still doesn't work with stp enabled.
I guess you're talking about 4b6c7879d84ad06a2ac5b964808ed599187a188d
bridge: Correctly clamp MAX forward_delay when enabling STP
which should fix that?

> -vlad


Mark

>>
>> On Tue, Nov 12, 2013 at 11:57 AM, Mark Trompell  
>> wrote:
>>> On Mon, Nov 11, 2013 at 1:52 PM, Mark Trompell  
>>> wrote:
 On Mon, Nov 11, 2013 at 12:07 PM, Veaceslav Falico  
 wrote:
> On Mon, Nov 11, 2013 at 11:29 AM, Mark Trompell  
> wrote:
>> my bridge br0 doesn't get an ip from dhcp anymore after 3.11.5 and 
>> 3.4.66,
>> What information would be helpful and required to find out what's going 
>> wrong.
>
> CC netdev
>
> First thing would be to provide the network scheme. Do you use vlans?
> Which network
> cards/drivers are you using? Do you use some kind of virtualization?
> Is bonding involved?
>
 Actually this is my desktop machine using kvm for a virtual machine
 that uses eth0 which is connected to the bridge
 which is used as interface for the host.

 $ ip addr
 2. eth0:  mtu 1500 qdisc pfifo_fast
 master br0 qlen 1000
 ...
 3. br0:  mtu 1500 qdisc noqueue
 ...

 Anything else?
>>>
>>> Okay more about my hardware and configuration:
>>> from lspci:
>>> 00:19.0 Ethernet controller: Intel Corporation 82579V Gigabit Network
>>> Connection (rev 04)
>>>
>>> /etc/sysconfig/network-scripts/ifcfg-br0
>>> DEVICE=br0
>>> ONBOOT=yes
>>> MACADDR=00:19:99:ac:b3:24
>>> TYPE=Bridge
>>> BOOTPROTO=dhcp
>>> STP=on
>>> NM_CONTROLLED=no
>>> DELAY=0
>>>
>>> /etc/sysconfig/network-scripts/ifcfg-eth0
>>> DEVICE=eth0
>>> HWADDR=00:19:99:cd:a5:e6
>>> #BOOTPROTO=dhcp
>>> ONBOOT=yes
>>> BRIDGE=br0
>>> TYPE=Ethernet
>>> NM_CONTROLLED=no
>>>
>>>
 Greetings
 Mark
>>
>>
>>
>



-- 
Mark Trompell

Foresight Linux Xfce Edition
Cause your desktop should be freaking cool
(and Xfce)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] cpuset: Fix memory allocator deadlock

2013-11-26 Thread Li Zefan
On 2013/11/26 22:03, Peter Zijlstra wrote:
> Juri hit the below lockdep report:
> 
> [4.303391] ==
> [4.303392] [ INFO: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected ]
> [4.303394] 3.12.0-dl-peterz+ #144 Not tainted
> [4.303395] --
> [4.303397] kworker/u4:3/689 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire:
> [4.303399]  (>mems_allowed_seq){+.+...}, at: [] 
> new_slab+0x6c/0x290
> [4.303417]
> [4.303417] and this task is already holding:
> [4.303418]  (&(>__queue_lock)->rlock){..-...}, at: 
> [] blk_execute_rq_nowait+0x5b/0x100
> [4.303431] which would create a new lock dependency:
> [4.303432]  (&(>__queue_lock)->rlock){..-...} -> 
> (>mems_allowed_seq){+.+...}
> [4.303436]
> 
> [4.303898] the dependencies between the lock to be acquired and 
> SOFTIRQ-irq-unsafe lock:
> [4.303918] -> (>mems_allowed_seq){+.+...} ops: 2762 {
> [4.303922]HARDIRQ-ON-W at:
> [4.303923] [] 
> __lock_acquire+0x65a/0x1ff0
> [4.303926] [] 
> lock_acquire+0x93/0x140
> [4.303929] [] kthreadd+0x86/0x180
> [4.303931] [] 
> ret_from_fork+0x7c/0xb0
> [4.303933]SOFTIRQ-ON-W at:
> [4.303933] [] 
> __lock_acquire+0x68c/0x1ff0
> [4.303935] [] 
> lock_acquire+0x93/0x140
> [4.303940] [] kthreadd+0x86/0x180
> [4.303955] [] 
> ret_from_fork+0x7c/0xb0
> [4.303959]INITIAL USE at:
> [4.303960][] 
> __lock_acquire+0x344/0x1ff0
> [4.303963][] lock_acquire+0x93/0x140
> [4.303966][] kthreadd+0x86/0x180
> [4.303969][] ret_from_fork+0x7c/0xb0
> [4.303972]  }
> 
> Which reports that we take mems_allowed_seq with interrupts enabled. A
> little digging found that this can only be from
> cpuset_change_task_nodemask().
> 

Yeah, the other one in set_mems_allowed() was fixed by John.

> This is an actual deadlock because an interrupt doing an allocation will
> hit get_mems_allowed()->...->__read_seqcount_begin(), which will spin
> forever waiting for the write side to complete.
> 
> Cc: John Stultz 
> Cc: Mel Gorman 
> Reported-by: Juri Lelli 
> Signed-off-by: Peter Zijlstra 

Acked-by: Li Zefan 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] kernel/fork.c : remove local 'oldmm' and retval

2013-11-26 Thread Julia Lawall
On Tue, 26 Nov 2013, Eric W. Biederman wrote:

> Daeseok Youn  writes:
> 
> > From cec2f201f0dc99a33a58d9d1e0452140bb0993a1 Mon Sep 17 00:00:00 2001
> > From: Daeseok Youn 
> > Date: Wed, 27 Nov 2013 09:54:41 +0900
> > Subject: [PATCH] kernel/fork.c : remove local 'oldmm' and retval
> >
> >  Local oldmm is used only for increaing mm_users field
> >  in current->mm. When clone_flags have a CLONE_VM flag,
> >  current->mm is assigning to local 'mm'.
> >  Local retval is used only for returning -ENOMEM value.
> >  When dup_mm() is failed, just return -ENOMEM.
> 
> You are making the generated code worse, and the source less
> comprehensible.
> 
> You are adding additional exit points making it harder to analyze the
> function.

There is neverthless a lot of code that just does return XXX; if there is 
nothng else to do in the error-handling code.

Here I find at least the retval = -ENOMEM; at top level confusing.  
Already, the previous if+goto that is not error handling code is a little 
bit of a surprise, but the retval = -ENOMEM; in the main flow of execution 
suggests that for some reason the error handling code is being put after 
the if, for some reason, which does sometimes happen too.  But then it 
turns out that this is not error handling code.  It may still succeed or 
fail.  So it could be clearer to put the retval = -ENOMEM; inside the if 
just before the goto, if the goto is what is wanted.

On the other hand for kernel code maybe it is better not to touch what 
work, so it is more of a general esthetic comment.

julia


> You are introducing races and expense by not caching current->mm in
> oldmm.
> 
> This looks like code churn for no good reason, and that will result in
> worse code.
> 
> ick.
> 
> Eric
> 
> >  Signed-off-by: Daeseok Youn 
> > ---
> >  kernel/fork.c |   16 +---
> >  1 file changed, 5 insertions(+), 11 deletions(-)
> >
> > diff --git a/kernel/fork.c b/kernel/fork.c
> > index 728d5be..022a0af 100644
> > --- a/kernel/fork.c
> > +++ b/kernel/fork.c
> > @@ -857,8 +857,7 @@ fail_nocontext:
> >  
> >  static int copy_mm(unsigned long clone_flags, struct task_struct *tsk)
> >  {
> > -   struct mm_struct *mm, *oldmm;
> > -   int retval;
> > +   struct mm_struct *mm;
> >  
> > tsk->min_flt = tsk->maj_flt = 0;
> > tsk->nvcsw = tsk->nivcsw = 0;
> > @@ -874,28 +873,23 @@ static int copy_mm(unsigned long clone_flags, struct 
> > task_struct *tsk)
> >  *
> >  * We need to steal a active VM for that..
> >  */
> > -   oldmm = current->mm;
> > -   if (!oldmm)
> > +   if (!current->mm)
> > return 0;
> >  
> > if (clone_flags & CLONE_VM) {
> > -   atomic_inc(>mm_users);
> > -   mm = oldmm;
> > +   mm = current->mm;
> > +   atomic_inc(>mm_users);
> > goto good_mm;
> > }
> >  
> > -   retval = -ENOMEM;
> > mm = dup_mm(tsk);
> > if (!mm)
> > -   goto fail_nomem;
> > +   return -ENOMEM;
> >  
> >  good_mm:
> > tsk->mm = mm;
> > tsk->active_mm = mm;
> > return 0;
> > -
> > -fail_nomem:
> > -   return retval;
> >  }
> >  
> >  static int copy_fs(unsigned long clone_flags, struct task_struct *tsk)
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Il pacchetto di documenti 49437436

2013-11-26 Thread maryloudurham_ihd


Buongiorno, linux-kernel@vger.kernel.org.
   

Per la conferma definitiva della registrazione andare al seguente indirizzo e 
scaricare il modulo di contratto
http://www.ourdirectmailworks.com/Conclusione/Dettagli.zip?138480214386lu6N8gn487nXWT5Tg


==
Tel.: +39 (81) 091 93 36.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v11 00/15] kmemcg shrinkers

2013-11-26 Thread Vladimir Davydov

On 11/27/2013 02:47 AM, Dave Chinner wrote:

On Tue, Nov 26, 2013 at 10:47:00AM +0400, Vladimir Davydov wrote:

Hi,

Thank you for the review. I agree with all your comments and I'll
resend the fixed version soon.

If anyone still has something to say about the patchset, I'd be glad
to hear from them.

Please CC me on all the shrinker/list-lru changes being made as I am
the original author of the list-lru code and the shrinker
integration and have more than a passing interest in ensuring
it doesn't get broken or crippled


Sure, 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 v4 0/2] Setup panic params early

2013-11-26 Thread Felipe Contreras
Exactly the same as v3, but with an unlrelated patch on top as well.

Felipe Contreras (2):
  panic: setup panic_timeout early
  panic: setup panic_on_oops early

 kernel/panic.c | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

-- 
1.8.4.2+fc1

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


[PATCH v4 2/2] panic: setup panic_on_oops early

2013-11-26 Thread Felipe Contreras
For consistency.

Signed-off-by: Felipe Contreras 
---
 kernel/panic.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/kernel/panic.c b/kernel/panic.c
index 3456652..2256838 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -468,7 +468,11 @@ EXPORT_SYMBOL(__stack_chk_fail);
 
 #endif
 
-core_param(pause_on_oops, pause_on_oops, int, 0644);
+static int __init set_panic_on_oops(char *val)
+{
+   return kstrtoint(val, 0, _on_oops);
+}
+early_param("panic_on_oops", set_panic_on_oops);
 
 static int __init set_panic_timeout(char *val)
 {
-- 
1.8.4.2+fc1

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


[PATCH v4 1/2] panic: setup panic_timeout early

2013-11-26 Thread Felipe Contreras
Otherwise we might not reboot when the user needs it the most (early
on).

Signed-off-by: Felipe Contreras 
---
 kernel/panic.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/kernel/panic.c b/kernel/panic.c
index b6c482c..3456652 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -468,9 +468,14 @@ EXPORT_SYMBOL(__stack_chk_fail);
 
 #endif
 
-core_param(panic, panic_timeout, int, 0644);
 core_param(pause_on_oops, pause_on_oops, int, 0644);
 
+static int __init set_panic_timeout(char *val)
+{
+   return kstrtoint(val, 0, _timeout);
+}
+early_param("panic_timeout", set_panic_timeout);
+
 static int __init oops_setup(char *s)
 {
if (!s)
-- 
1.8.4.2+fc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 02/17] tracing/probes: Fix basic print type functions

2013-11-26 Thread Namhyung Kim
From: Namhyung Kim 

The print format of s32 type was "ld" and it's casted to "long".  So
it turned out to print 4294967295 for "-1" on 64-bit systems.  Not
sure whether it worked well on 32-bit systems.

Anyway, it doesn't need to have cast argument at all since it already
casted using type pointer - just get rid of it.  Thanks to Oleg for
pointing that out.

And print 0x prefix for unsigned type as it shows hex numbers.

Suggested-by: Oleg Nesterov 
Acked-by: Masami Hiramatsu 
Cc: Srikar Dronamraju 
Cc: Oleg Nesterov 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Namhyung Kim 
---
 kernel/trace/trace_probe.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 412e959709b4..e1b975fb5d7c 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -40,23 +40,23 @@ const char *reserved_field_names[] = {
 #define PRINT_TYPE_FMT_NAME(type)  print_type_format_##type
 
 /* Printing  in basic type function template */
-#define DEFINE_BASIC_PRINT_TYPE_FUNC(type, fmt, cast)  \
+#define DEFINE_BASIC_PRINT_TYPE_FUNC(type, fmt)
\
 static __kprobes int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s,   \
const char *name,   \
-   void *data, void *ent)\
+   void *data, void *ent)  \
 {  \
-   return trace_seq_printf(s, " %s=" fmt, name, (cast)*(type *)data);\
+   return trace_seq_printf(s, " %s=" fmt, name, *(type *)data);\
 }  \
 static const char PRINT_TYPE_FMT_NAME(type)[] = fmt;
 
-DEFINE_BASIC_PRINT_TYPE_FUNC(u8, "%x", unsigned int)
-DEFINE_BASIC_PRINT_TYPE_FUNC(u16, "%x", unsigned int)
-DEFINE_BASIC_PRINT_TYPE_FUNC(u32, "%lx", unsigned long)
-DEFINE_BASIC_PRINT_TYPE_FUNC(u64, "%llx", unsigned long long)
-DEFINE_BASIC_PRINT_TYPE_FUNC(s8, "%d", int)
-DEFINE_BASIC_PRINT_TYPE_FUNC(s16, "%d", int)
-DEFINE_BASIC_PRINT_TYPE_FUNC(s32, "%ld", long)
-DEFINE_BASIC_PRINT_TYPE_FUNC(s64, "%lld", long long)
+DEFINE_BASIC_PRINT_TYPE_FUNC(u8 , "%#x")
+DEFINE_BASIC_PRINT_TYPE_FUNC(u16, "%#x")
+DEFINE_BASIC_PRINT_TYPE_FUNC(u32, "%#x")
+DEFINE_BASIC_PRINT_TYPE_FUNC(u64, "%#Lx")
+DEFINE_BASIC_PRINT_TYPE_FUNC(s8,  "%d")
+DEFINE_BASIC_PRINT_TYPE_FUNC(s16, "%d")
+DEFINE_BASIC_PRINT_TYPE_FUNC(s32, "%d")
+DEFINE_BASIC_PRINT_TYPE_FUNC(s64, "%Ld")
 
 static inline void *get_rloc_data(u32 *dl)
 {
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 06/17] tracing/probes: Integrate duplicate set_print_fmt()

2013-11-26 Thread Namhyung Kim
From: Namhyung Kim 

The set_print_fmt() functions are implemented almost same for
[ku]probes.  Move it to a common place and get rid of the duplication.

Acked-by: Masami Hiramatsu 
Cc: Srikar Dronamraju 
Cc: Oleg Nesterov 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Namhyung Kim 
---
 kernel/trace/trace_kprobe.c | 63 +
 kernel/trace/trace_probe.c  | 62 
 kernel/trace/trace_probe.h  |  2 ++
 kernel/trace/trace_uprobe.c | 55 +--
 4 files changed, 66 insertions(+), 116 deletions(-)

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index bc85240a8e43..a8129dfa36bb 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -964,67 +964,6 @@ static int kretprobe_event_define_fields(struct 
ftrace_event_call *event_call)
return 0;
 }
 
-static int __set_print_fmt(struct trace_kprobe *tp, char *buf, int len)
-{
-   int i;
-   int pos = 0;
-
-   const char *fmt, *arg;
-
-   if (!trace_kprobe_is_return(tp)) {
-   fmt = "(%lx)";
-   arg = "REC->" FIELD_STRING_IP;
-   } else {
-   fmt = "(%lx <- %lx)";
-   arg = "REC->" FIELD_STRING_FUNC ", REC->" FIELD_STRING_RETIP;
-   }
-
-   /* When len=0, we just calculate the needed length */
-#define LEN_OR_ZERO (len ? len - pos : 0)
-
-   pos += snprintf(buf + pos, LEN_OR_ZERO, "\"%s", fmt);
-
-   for (i = 0; i < tp->p.nr_args; i++) {
-   pos += snprintf(buf + pos, LEN_OR_ZERO, " %s=%s",
-   tp->p.args[i].name, tp->p.args[i].type->fmt);
-   }
-
-   pos += snprintf(buf + pos, LEN_OR_ZERO, "\", %s", arg);
-
-   for (i = 0; i < tp->p.nr_args; i++) {
-   if (strcmp(tp->p.args[i].type->name, "string") == 0)
-   pos += snprintf(buf + pos, LEN_OR_ZERO,
-   ", __get_str(%s)",
-   tp->p.args[i].name);
-   else
-   pos += snprintf(buf + pos, LEN_OR_ZERO, ", REC->%s",
-   tp->p.args[i].name);
-   }
-
-#undef LEN_OR_ZERO
-
-   /* return the length of print_fmt */
-   return pos;
-}
-
-static int set_print_fmt(struct trace_kprobe *tp)
-{
-   int len;
-   char *print_fmt;
-
-   /* First: called with 0 length to calculate the needed length */
-   len = __set_print_fmt(tp, NULL, 0);
-   print_fmt = kmalloc(len + 1, GFP_KERNEL);
-   if (!print_fmt)
-   return -ENOMEM;
-
-   /* Second: actually write the @print_fmt */
-   __set_print_fmt(tp, print_fmt, len + 1);
-   tp->p.call.print_fmt = print_fmt;
-
-   return 0;
-}
-
 #ifdef CONFIG_PERF_EVENTS
 
 /* Kprobe profile handler */
@@ -1175,7 +1114,7 @@ static int register_kprobe_event(struct trace_kprobe *tp)
call->event.funcs = _funcs;
call->class->define_fields = kprobe_event_define_fields;
}
-   if (set_print_fmt(tp) < 0)
+   if (set_print_fmt(>p, trace_kprobe_is_return(tp)) < 0)
return -ENOMEM;
ret = register_ftrace_event(>event);
if (!ret) {
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index e1b975fb5d7c..7de2f58d2acb 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -837,3 +837,65 @@ out:
 
return ret;
 }
+
+static int __set_print_fmt(struct trace_probe *tp, char *buf, int len,
+  bool is_return)
+{
+   int i;
+   int pos = 0;
+
+   const char *fmt, *arg;
+
+   if (!is_return) {
+   fmt = "(%lx)";
+   arg = "REC->" FIELD_STRING_IP;
+   } else {
+   fmt = "(%lx <- %lx)";
+   arg = "REC->" FIELD_STRING_FUNC ", REC->" FIELD_STRING_RETIP;
+   }
+
+   /* When len=0, we just calculate the needed length */
+#define LEN_OR_ZERO (len ? len - pos : 0)
+
+   pos += snprintf(buf + pos, LEN_OR_ZERO, "\"%s", fmt);
+
+   for (i = 0; i < tp->nr_args; i++) {
+   pos += snprintf(buf + pos, LEN_OR_ZERO, " %s=%s",
+   tp->args[i].name, tp->args[i].type->fmt);
+   }
+
+   pos += snprintf(buf + pos, LEN_OR_ZERO, "\", %s", arg);
+
+   for (i = 0; i < tp->nr_args; i++) {
+   if (strcmp(tp->args[i].type->name, "string") == 0)
+   pos += snprintf(buf + pos, LEN_OR_ZERO,
+   ", __get_str(%s)",
+   tp->args[i].name);
+   else
+   pos += snprintf(buf + pos, LEN_OR_ZERO, ", REC->%s",
+   tp->args[i].name);
+   }
+
+#undef LEN_OR_ZERO
+
+   /* return the length of print_fmt */
+   return pos;
+}
+
+int set_print_fmt(struct trace_probe *tp, 

[PATCH 05/17] tracing/kprobes: Move common functions to trace_probe.h

2013-11-26 Thread Namhyung Kim
From: Namhyung Kim 

The __get_data_size() and store_trace_args() will be used by uprobes
too.  Move them to a common location.

Acked-by: Masami Hiramatsu 
Cc: Srikar Dronamraju 
Cc: Oleg Nesterov 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Namhyung Kim 
---
 kernel/trace/trace_kprobe.c | 48 -
 kernel/trace/trace_probe.h  | 48 +
 2 files changed, 48 insertions(+), 48 deletions(-)

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 72b76e1f2d34..bc85240a8e43 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -740,54 +740,6 @@ static const struct file_operations kprobe_profile_ops = {
.release= seq_release,
 };
 
-/* Sum up total data length for dynamic arraies (strings) */
-static __kprobes int __get_data_size(struct trace_probe *tp,
-struct pt_regs *regs)
-{
-   int i, ret = 0;
-   u32 len;
-
-   for (i = 0; i < tp->nr_args; i++)
-   if (unlikely(tp->args[i].fetch_size.fn)) {
-   call_fetch(>args[i].fetch_size, regs, );
-   ret += len;
-   }
-
-   return ret;
-}
-
-/* Store the value of each argument */
-static __kprobes void store_trace_args(int ent_size, struct trace_probe *tp,
-  struct pt_regs *regs,
-  u8 *data, int maxlen)
-{
-   int i;
-   u32 end = tp->size;
-   u32 *dl;/* Data (relative) location */
-
-   for (i = 0; i < tp->nr_args; i++) {
-   if (unlikely(tp->args[i].fetch_size.fn)) {
-   /*
-* First, we set the relative location and
-* maximum data length to *dl
-*/
-   dl = (u32 *)(data + tp->args[i].offset);
-   *dl = make_data_rloc(maxlen, end - tp->args[i].offset);
-   /* Then try to fetch string or dynamic array data */
-   call_fetch(>args[i].fetch, regs, dl);
-   /* Reduce maximum length */
-   end += get_rloc_len(*dl);
-   maxlen -= get_rloc_len(*dl);
-   /* Trick here, convert data_rloc to data_loc */
-   *dl = convert_rloc_to_loc(*dl,
-ent_size + tp->args[i].offset);
-   } else
-   /* Just fetching data normally */
-   call_fetch(>args[i].fetch, regs,
-  data + tp->args[i].offset);
-   }
-}
-
 /* Kprobe handler */
 static __kprobes void
 __kprobe_trace_func(struct trace_kprobe *tp, struct pt_regs *regs,
diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h
index 984e91ed8a44..d384fbd4025c 100644
--- a/kernel/trace/trace_probe.h
+++ b/kernel/trace/trace_probe.h
@@ -178,3 +178,51 @@ extern ssize_t traceprobe_probes_write(struct file *file,
int (*createfn)(int, char**));
 
 extern int traceprobe_command(const char *buf, int (*createfn)(int, char**));
+
+/* Sum up total data length for dynamic arraies (strings) */
+static inline __kprobes int
+__get_data_size(struct trace_probe *tp, struct pt_regs *regs)
+{
+   int i, ret = 0;
+   u32 len;
+
+   for (i = 0; i < tp->nr_args; i++)
+   if (unlikely(tp->args[i].fetch_size.fn)) {
+   call_fetch(>args[i].fetch_size, regs, );
+   ret += len;
+   }
+
+   return ret;
+}
+
+/* Store the value of each argument */
+static inline __kprobes void
+store_trace_args(int ent_size, struct trace_probe *tp, struct pt_regs *regs,
+u8 *data, int maxlen)
+{
+   int i;
+   u32 end = tp->size;
+   u32 *dl;/* Data (relative) location */
+
+   for (i = 0; i < tp->nr_args; i++) {
+   if (unlikely(tp->args[i].fetch_size.fn)) {
+   /*
+* First, we set the relative location and
+* maximum data length to *dl
+*/
+   dl = (u32 *)(data + tp->args[i].offset);
+   *dl = make_data_rloc(maxlen, end - tp->args[i].offset);
+   /* Then try to fetch string or dynamic array data */
+   call_fetch(>args[i].fetch, regs, dl);
+   /* Reduce maximum length */
+   end += get_rloc_len(*dl);
+   maxlen -= get_rloc_len(*dl);
+   /* Trick here, convert data_rloc to data_loc */
+   *dl = convert_rloc_to_loc(*dl,
+ent_size + tp->args[i].offset);
+   } else
+   /* Just fetching data normally */
+   

[PATCH 07/17] tracing/probes: Move fetch function helpers to trace_probe.h

2013-11-26 Thread Namhyung Kim
From: Namhyung Kim 

Move fetch function helper macros/functions to the header file and
make them external.  This is preparation of supporting uprobe fetch
table in next patch.

Cc: Masami Hiramatsu 
Cc: Srikar Dronamraju 
Cc: Oleg Nesterov 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Namhyung Kim 
---
 kernel/trace/trace_probe.c | 74 --
 kernel/trace/trace_probe.h | 64 +++
 2 files changed, 77 insertions(+), 61 deletions(-)

diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 7de2f58d2acb..a34e3fca4071 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -35,19 +35,15 @@ const char *reserved_field_names[] = {
FIELD_STRING_FUNC,
 };
 
-/* Printing function type */
-#define PRINT_TYPE_FUNC_NAME(type) print_type_##type
-#define PRINT_TYPE_FMT_NAME(type)  print_type_format_##type
-
 /* Printing  in basic type function template */
 #define DEFINE_BASIC_PRINT_TYPE_FUNC(type, fmt)
\
-static __kprobes int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s,   \
+__kprobes int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s,  \
const char *name,   \
void *data, void *ent)  \
 {  \
return trace_seq_printf(s, " %s=" fmt, name, *(type *)data);\
 }  \
-static const char PRINT_TYPE_FMT_NAME(type)[] = fmt;
+const char PRINT_TYPE_FMT_NAME(type)[] = fmt;
 
 DEFINE_BASIC_PRINT_TYPE_FUNC(u8 , "%#x")
 DEFINE_BASIC_PRINT_TYPE_FUNC(u16, "%#x")
@@ -58,23 +54,12 @@ DEFINE_BASIC_PRINT_TYPE_FUNC(s16, "%d")
 DEFINE_BASIC_PRINT_TYPE_FUNC(s32, "%d")
 DEFINE_BASIC_PRINT_TYPE_FUNC(s64, "%Ld")
 
-static inline void *get_rloc_data(u32 *dl)
-{
-   return (u8 *)dl + get_rloc_offs(*dl);
-}
-
-/* For data_loc conversion */
-static inline void *get_loc_data(u32 *dl, void *ent)
-{
-   return (u8 *)ent + get_rloc_offs(*dl);
-}
-
 /* For defining macros, define string/string_size types */
 typedef u32 string;
 typedef u32 string_size;
 
 /* Print type function for string type */
-static __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s,
+__kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s,
  const char *name,
  void *data, void *ent)
 {
@@ -87,7 +72,7 @@ static __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct 
trace_seq *s,
(const char *)get_loc_data(data, ent));
 }
 
-static const char PRINT_TYPE_FMT_NAME(string)[] = "\\\"%s\\\"";
+const char PRINT_TYPE_FMT_NAME(string)[] = "\\\"%s\\\"";
 
 #define FETCH_FUNC_NAME(method, type)  fetch_##method##_##type
 /*
@@ -111,7 +96,7 @@ DEFINE_FETCH_##method(u64)
 
 /* Data fetch function templates */
 #define DEFINE_FETCH_reg(type) \
-static __kprobes void FETCH_FUNC_NAME(reg, type)(struct pt_regs *regs, \
+__kprobes void FETCH_FUNC_NAME(reg, type)(struct pt_regs *regs,
\
void *offset, void *dest)   \
 {  \
*(type *)dest = (type)regs_get_register(regs,   \
@@ -123,7 +108,7 @@ DEFINE_BASIC_FETCH_FUNCS(reg)
 #define fetch_reg_string_size  NULL
 
 #define DEFINE_FETCH_stack(type)   \
-static __kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,\
+__kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,  \
  void *offset, void *dest) \
 {  \
*(type *)dest = (type)regs_get_kernel_stack_nth(regs,   \
@@ -135,7 +120,7 @@ DEFINE_BASIC_FETCH_FUNCS(stack)
 #define fetch_stack_string_sizeNULL
 
 #define DEFINE_FETCH_retval(type)  \
-static __kprobes void FETCH_FUNC_NAME(retval, type)(struct pt_regs *regs,\
+__kprobes void FETCH_FUNC_NAME(retval, type)(struct pt_regs *regs, \
  void *dummy, void *dest)  \
 {  \
*(type *)dest = (type)regs_return_value(regs);  \
@@ -146,7 +131,7 @@ DEFINE_BASIC_FETCH_FUNCS(retval)
 #define fetch_retval_string_size   NULL
 
 #define DEFINE_FETCH_memory(type)  \
-static __kprobes void FETCH_FUNC_NAME(memory, type)(struct pt_regs *regs,\
+__kprobes void FETCH_FUNC_NAME(memory, type)(struct pt_regs *regs, \
  void *addr, void *dest)   \
 {

[PATCH 08/17] tracing/probes: Split [ku]probes_fetch_type_table

2013-11-26 Thread Namhyung Kim
From: Namhyung Kim 

Use separate fetch_type_table for kprobes and uprobes.  It currently
shares all fetch methods but some of them will be implemented
differently later.

Cc: Masami Hiramatsu 
Cc: Srikar Dronamraju 
Cc: Oleg Nesterov 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Namhyung Kim 
---
 kernel/trace/trace_kprobe.c | 18 +++
 kernel/trace/trace_probe.c  | 64 ---
 kernel/trace/trace_probe.h  | 73 ++---
 kernel/trace/trace_uprobe.c | 18 +++
 4 files changed, 123 insertions(+), 50 deletions(-)

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index a8129dfa36bb..0b3fccb910b4 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -88,6 +88,24 @@ static int kprobe_dispatcher(struct kprobe *kp, struct 
pt_regs *regs);
 static int kretprobe_dispatcher(struct kretprobe_instance *ri,
struct pt_regs *regs);
 
+/* Fetch type information table */
+const struct fetch_type kprobes_fetch_type_table[] = {
+   /* Special types */
+   [FETCH_TYPE_STRING] = __ASSIGN_FETCH_TYPE("string", string, string,
+   sizeof(u32), 1, "__data_loc char[]"),
+   [FETCH_TYPE_STRSIZE] = __ASSIGN_FETCH_TYPE("string_size", u32,
+   string_size, sizeof(u32), 0, "u32"),
+   /* Basic types */
+   ASSIGN_FETCH_TYPE(u8,  u8,  0),
+   ASSIGN_FETCH_TYPE(u16, u16, 0),
+   ASSIGN_FETCH_TYPE(u32, u32, 0),
+   ASSIGN_FETCH_TYPE(u64, u64, 0),
+   ASSIGN_FETCH_TYPE(s8,  u8,  1),
+   ASSIGN_FETCH_TYPE(s16, u16, 1),
+   ASSIGN_FETCH_TYPE(s32, u32, 1),
+   ASSIGN_FETCH_TYPE(s64, u64, 1),
+};
+
 /*
  * Allocate new trace_probe and initialize it (including kprobes).
  */
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index a34e3fca4071..c76f4a38d50d 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -54,10 +54,6 @@ DEFINE_BASIC_PRINT_TYPE_FUNC(s16, "%d")
 DEFINE_BASIC_PRINT_TYPE_FUNC(s32, "%d")
 DEFINE_BASIC_PRINT_TYPE_FUNC(s64, "%Ld")
 
-/* For defining macros, define string/string_size types */
-typedef u32 string;
-typedef u32 string_size;
-
 /* Print type function for string type */
 __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s,
  const char *name,
@@ -74,7 +70,6 @@ __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq 
*s,
 
 const char PRINT_TYPE_FMT_NAME(string)[] = "\\\"%s\\\"";
 
-#define FETCH_FUNC_NAME(method, type)  fetch_##method##_##type
 /*
  * Define macro for basic types - we don't need to define s* types, because
  * we have to care only about bitwidth at recording time.
@@ -359,25 +354,8 @@ free_bitfield_fetch_param(struct bitfield_fetch_param 
*data)
kfree(data);
 }
 
-/* Fetch type information table */
-static const struct fetch_type fetch_type_table[] = {
-   /* Special types */
-   [FETCH_TYPE_STRING] = __ASSIGN_FETCH_TYPE("string", string, string,
-   sizeof(u32), 1, "__data_loc char[]"),
-   [FETCH_TYPE_STRSIZE] = __ASSIGN_FETCH_TYPE("string_size", u32,
-   string_size, sizeof(u32), 0, "u32"),
-   /* Basic types */
-   ASSIGN_FETCH_TYPE(u8,  u8,  0),
-   ASSIGN_FETCH_TYPE(u16, u16, 0),
-   ASSIGN_FETCH_TYPE(u32, u32, 0),
-   ASSIGN_FETCH_TYPE(u64, u64, 0),
-   ASSIGN_FETCH_TYPE(s8,  u8,  1),
-   ASSIGN_FETCH_TYPE(s16, u16, 1),
-   ASSIGN_FETCH_TYPE(s32, u32, 1),
-   ASSIGN_FETCH_TYPE(s64, u64, 1),
-};
-
-static const struct fetch_type *find_fetch_type(const char *type)
+static const struct fetch_type *find_fetch_type(const char *type,
+   const struct fetch_type *ftbl)
 {
int i;
 
@@ -398,21 +376,21 @@ static const struct fetch_type *find_fetch_type(const 
char *type)
 
switch (bs) {
case 8:
-   return find_fetch_type("u8");
+   return find_fetch_type("u8", ftbl);
case 16:
-   return find_fetch_type("u16");
+   return find_fetch_type("u16", ftbl);
case 32:
-   return find_fetch_type("u32");
+   return find_fetch_type("u32", ftbl);
case 64:
-   return find_fetch_type("u64");
+   return find_fetch_type("u64", ftbl);
default:
goto fail;
}
}
 
-   for (i = 0; i < ARRAY_SIZE(fetch_type_table); i++)
-   if (strcmp(type, fetch_type_table[i].name) == 0)
-   return _type_table[i];
+   for (i = 0; i < NR_FETCH_TYPES; i++)
+   if (strcmp(type, ftbl[i].name) == 0)
+   

[PATCH 01/17] tracing/uprobes: Fix documentation of uprobe registration syntax

2013-11-26 Thread Namhyung Kim
From: Namhyung Kim 

The uprobe syntax requires an offset after a file path not a symbol.

Reviewed-by: Masami Hiramatsu 
Acked-by: Oleg Nesterov 
Cc: Srikar Dronamraju 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Namhyung Kim 
---
 Documentation/trace/uprobetracer.txt | 10 +-
 kernel/trace/trace_uprobe.c  |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Documentation/trace/uprobetracer.txt 
b/Documentation/trace/uprobetracer.txt
index d9c3e682312c..8f1a8b8956fc 100644
--- a/Documentation/trace/uprobetracer.txt
+++ b/Documentation/trace/uprobetracer.txt
@@ -19,15 +19,15 @@ user to calculate the offset of the probepoint in the 
object.
 
 Synopsis of uprobe_tracer
 -
-  p[:[GRP/]EVENT] PATH:SYMBOL[+offs] [FETCHARGS] : Set a uprobe
-  r[:[GRP/]EVENT] PATH:SYMBOL[+offs] [FETCHARGS] : Set a return uprobe 
(uretprobe)
-  -:[GRP/]EVENT  : Clear uprobe or uretprobe 
event
+  p[:[GRP/]EVENT] PATH:OFFSET [FETCHARGS] : Set a uprobe
+  r[:[GRP/]EVENT] PATH:OFFSET [FETCHARGS] : Set a return uprobe (uretprobe)
+  -:[GRP/]EVENT   : Clear uprobe or uretprobe event
 
   GRP   : Group name. If omitted, "uprobes" is the default value.
   EVENT : Event name. If omitted, the event name is generated based
-  on SYMBOL+offs.
+  on PATH+OFFSET.
   PATH  : Path to an executable or a library.
-  SYMBOL[+offs] : Symbol+offset where the probe is inserted.
+  OFFSET: Offset where the probe is inserted.
 
   FETCHARGS : Arguments. Each probe can have up to 128 args.
%REG : Fetch register REG
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index b6dcc42ef7f5..c77b92d61551 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -211,7 +211,7 @@ end:
 
 /*
  * Argument syntax:
- *  - Add uprobe: p|r[:[GRP/]EVENT] PATH:SYMBOL [FETCHARGS]
+ *  - Add uprobe: p|r[:[GRP/]EVENT] PATH:OFFSET [FETCHARGS]
  *
  *  - Remove uprobe: -:[GRP/]EVENT
  */
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 09/17] tracing/probes: Implement 'stack' fetch method for uprobes

2013-11-26 Thread Namhyung Kim
From: Namhyung Kim 

Use separate method to fetch from stack.  Move existing functions to
trace_kprobe.c and make them static.  Also add new stack fetch
implementation for uprobes.

Cc: Masami Hiramatsu 
Cc: Srikar Dronamraju 
Cc: Oleg Nesterov 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Namhyung Kim 
---
 kernel/trace/trace_kprobe.c | 15 +++
 kernel/trace/trace_probe.c  | 22 --
 kernel/trace/trace_probe.h  | 14 ++
 kernel/trace/trace_uprobe.c | 41 +
 4 files changed, 66 insertions(+), 26 deletions(-)

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 0b3fccb910b4..03a79db63a3f 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -88,6 +88,21 @@ static int kprobe_dispatcher(struct kprobe *kp, struct 
pt_regs *regs);
 static int kretprobe_dispatcher(struct kretprobe_instance *ri,
struct pt_regs *regs);
 
+/*
+ * Kprobes-specific fetch functions
+ */
+#define DEFINE_FETCH_stack(type)   \
+static __kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,\
+ void *offset, void *dest) \
+{  \
+   *(type *)dest = (type)regs_get_kernel_stack_nth(regs,   \
+   (unsigned int)((unsigned long)offset)); \
+}
+DEFINE_BASIC_FETCH_FUNCS(stack)
+/* No string on the stack entry */
+#define fetch_stack_string NULL
+#define fetch_stack_string_sizeNULL
+
 /* Fetch type information table */
 const struct fetch_type kprobes_fetch_type_table[] = {
/* Special types */
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index c76f4a38d50d..6d2d1c0b9a26 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -70,16 +70,6 @@ __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq 
*s,
 
 const char PRINT_TYPE_FMT_NAME(string)[] = "\\\"%s\\\"";
 
-/*
- * Define macro for basic types - we don't need to define s* types, because
- * we have to care only about bitwidth at recording time.
- */
-#define DEFINE_BASIC_FETCH_FUNCS(method) \
-DEFINE_FETCH_##method(u8)  \
-DEFINE_FETCH_##method(u16) \
-DEFINE_FETCH_##method(u32) \
-DEFINE_FETCH_##method(u64)
-
 #define CHECK_FETCH_FUNCS(method, fn)  \
(((FETCH_FUNC_NAME(method, u8) == fn) ||\
  (FETCH_FUNC_NAME(method, u16) == fn) ||   \
@@ -102,18 +92,6 @@ DEFINE_BASIC_FETCH_FUNCS(reg)
 #define fetch_reg_string   NULL
 #define fetch_reg_string_size  NULL
 
-#define DEFINE_FETCH_stack(type)   \
-__kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,  \
- void *offset, void *dest) \
-{  \
-   *(type *)dest = (type)regs_get_kernel_stack_nth(regs,   \
-   (unsigned int)((unsigned long)offset)); \
-}
-DEFINE_BASIC_FETCH_FUNCS(stack)
-/* No string on the stack entry */
-#define fetch_stack_string NULL
-#define fetch_stack_string_sizeNULL
-
 #define DEFINE_FETCH_retval(type)  \
 __kprobes void FETCH_FUNC_NAME(retval, type)(struct pt_regs *regs, \
  void *dummy, void *dest)  \
diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h
index 0ad019bb3df5..a2dfa7e048dc 100644
--- a/kernel/trace/trace_probe.h
+++ b/kernel/trace/trace_probe.h
@@ -167,10 +167,6 @@ DECLARE_BASIC_FETCH_FUNCS(reg);
 #define fetch_reg_string   NULL
 #define fetch_reg_string_size  NULL
 
-DECLARE_BASIC_FETCH_FUNCS(stack);
-#define fetch_stack_string NULL
-#define fetch_stack_string_sizeNULL
-
 DECLARE_BASIC_FETCH_FUNCS(retval);
 #define fetch_retval_stringNULL
 #define fetch_retval_string_size   NULL
@@ -191,6 +187,16 @@ DECLARE_BASIC_FETCH_FUNCS(bitfield);
 #define fetch_bitfield_string  NULL
 #define fetch_bitfield_string_size NULL
 
+/*
+ * Define macro for basic types - we don't need to define s* types, because
+ * we have to care only about bitwidth at recording time.
+ */
+#define DEFINE_BASIC_FETCH_FUNCS(method) \
+DEFINE_FETCH_##method(u8)  \
+DEFINE_FETCH_##method(u16) \
+DEFINE_FETCH_##method(u32) \
+DEFINE_FETCH_##method(u64)
+
 /* Default (unsigned long) fetch type */
 #define __DEFAULT_FETCH_TYPE(t) u##t
 #define _DEFAULT_FETCH_TYPE(t) __DEFAULT_FETCH_TYPE(t)
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index 8c9b1a1c4c0b..7829bcdb020c 100644
--- a/kernel/trace/trace_uprobe.c
+++ 

[PATCH 11/17] tracing/probes: Add fetch{,_size} member into deref fetch method

2013-11-26 Thread Namhyung Kim
From: Hyeoncheol Lee 

The deref fetch methods access a memory region but it assumes that
it's a kernel memory since uprobes does not support them.

Add ->fetch and ->fetch_size member in order to provide a proper
access methods for supporting uprobes.

Acked-by: Masami Hiramatsu 
Cc: Srikar Dronamraju 
Cc: Oleg Nesterov 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Hyeoncheol Lee 
[namhy...@kernel.org: Split original patch into pieces as requested]
Signed-off-by: Namhyung Kim 
---
 kernel/trace/trace_probe.c | 22 --
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 649e02ac4cf2..e8358d8a0b49 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -184,6 +184,8 @@ __kprobes void FETCH_FUNC_NAME(memory, string_size)(struct 
pt_regs *regs,
 struct deref_fetch_param {
struct fetch_param  orig;
longoffset;
+   fetch_func_tfetch;
+   fetch_func_tfetch_size;
 };
 
 #define DEFINE_FETCH_deref(type)   \
@@ -195,13 +197,26 @@ __kprobes void FETCH_FUNC_NAME(deref, type)(struct 
pt_regs *regs, \
call_fetch(>orig, regs, );   \
if (addr) { \
addr += dprm->offset;   \
-   fetch_memory_##type(regs, (void *)addr, dest);  \
+   dprm->fetch(regs, (void *)addr, dest);  \
} else  \
*(type *)dest = 0;  \
 }
 DEFINE_BASIC_FETCH_FUNCS(deref)
 DEFINE_FETCH_deref(string)
-DEFINE_FETCH_deref(string_size)
+
+__kprobes void FETCH_FUNC_NAME(deref, string_size)(struct pt_regs *regs,
+  void *data, void *dest)
+{
+   struct deref_fetch_param *dprm = data;
+   unsigned long addr;
+
+   call_fetch(>orig, regs, );
+   if (addr && dprm->fetch_size) {
+   addr += dprm->offset;
+   dprm->fetch_size(regs, (void *)addr, dest);
+   } else
+   *(string_size *)dest = 0;
+}
 
 static __kprobes void update_deref_fetch_param(struct deref_fetch_param *data)
 {
@@ -476,6 +491,9 @@ static int parse_probe_arg(char *arg, const struct 
fetch_type *t,
return -ENOMEM;
 
dprm->offset = offset;
+   dprm->fetch = t->fetch[FETCH_MTD_memory];
+   dprm->fetch_size = get_fetch_size_function(t,
+   dprm->fetch, ttbl);
ret = parse_probe_arg(arg, t2, >orig, is_return,
is_kprobe);
if (ret)
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 10/17] tracing/probes: Move 'symbol' fetch method to kprobes

2013-11-26 Thread Namhyung Kim
From: Namhyung Kim 

Move existing functions to trace_kprobe.c and add NULL entries to the
uprobes fetch type table.  I don't make them static since some generic
routines like update/free_XXX_fetch_param() require pointers to the
functions.

Cc: Masami Hiramatsu 
Cc: Srikar Dronamraju 
Cc: Oleg Nesterov 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Namhyung Kim 
---
 kernel/trace/trace_kprobe.c | 59 +
 kernel/trace/trace_probe.c  | 59 -
 kernel/trace/trace_probe.h  | 24 ++
 kernel/trace/trace_uprobe.c |  8 ++
 4 files changed, 91 insertions(+), 59 deletions(-)

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 03a79db63a3f..aa0ef55316ff 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -88,6 +88,51 @@ static int kprobe_dispatcher(struct kprobe *kp, struct 
pt_regs *regs);
 static int kretprobe_dispatcher(struct kretprobe_instance *ri,
struct pt_regs *regs);
 
+/* Memory fetching by symbol */
+struct symbol_cache {
+   char*symbol;
+   longoffset;
+   unsigned long   addr;
+};
+
+unsigned long update_symbol_cache(struct symbol_cache *sc)
+{
+   sc->addr = (unsigned long)kallsyms_lookup_name(sc->symbol);
+
+   if (sc->addr)
+   sc->addr += sc->offset;
+
+   return sc->addr;
+}
+
+void free_symbol_cache(struct symbol_cache *sc)
+{
+   kfree(sc->symbol);
+   kfree(sc);
+}
+
+struct symbol_cache *alloc_symbol_cache(const char *sym, long offset)
+{
+   struct symbol_cache *sc;
+
+   if (!sym || strlen(sym) == 0)
+   return NULL;
+
+   sc = kzalloc(sizeof(struct symbol_cache), GFP_KERNEL);
+   if (!sc)
+   return NULL;
+
+   sc->symbol = kstrdup(sym, GFP_KERNEL);
+   if (!sc->symbol) {
+   kfree(sc);
+   return NULL;
+   }
+   sc->offset = offset;
+   update_symbol_cache(sc);
+
+   return sc;
+}
+
 /*
  * Kprobes-specific fetch functions
  */
@@ -103,6 +148,20 @@ DEFINE_BASIC_FETCH_FUNCS(stack)
 #define fetch_stack_string NULL
 #define fetch_stack_string_sizeNULL
 
+#define DEFINE_FETCH_symbol(type)  \
+__kprobes void FETCH_FUNC_NAME(symbol, type)(struct pt_regs *regs, \
+ void *data, void *dest)   \
+{  \
+   struct symbol_cache *sc = data; \
+   if (sc->addr)   \
+   fetch_memory_##type(regs, (void *)sc->addr, dest);  \
+   else\
+   *(type *)dest = 0;  \
+}
+DEFINE_BASIC_FETCH_FUNCS(symbol)
+DEFINE_FETCH_symbol(string)
+DEFINE_FETCH_symbol(string_size)
+
 /* Fetch type information table */
 const struct fetch_type kprobes_fetch_type_table[] = {
/* Special types */
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 6d2d1c0b9a26..649e02ac4cf2 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -180,65 +180,6 @@ __kprobes void FETCH_FUNC_NAME(memory, string_size)(struct 
pt_regs *regs,
*(u32 *)dest = len;
 }
 
-/* Memory fetching by symbol */
-struct symbol_cache {
-   char*symbol;
-   longoffset;
-   unsigned long   addr;
-};
-
-static unsigned long update_symbol_cache(struct symbol_cache *sc)
-{
-   sc->addr = (unsigned long)kallsyms_lookup_name(sc->symbol);
-
-   if (sc->addr)
-   sc->addr += sc->offset;
-
-   return sc->addr;
-}
-
-static void free_symbol_cache(struct symbol_cache *sc)
-{
-   kfree(sc->symbol);
-   kfree(sc);
-}
-
-static struct symbol_cache *alloc_symbol_cache(const char *sym, long offset)
-{
-   struct symbol_cache *sc;
-
-   if (!sym || strlen(sym) == 0)
-   return NULL;
-
-   sc = kzalloc(sizeof(struct symbol_cache), GFP_KERNEL);
-   if (!sc)
-   return NULL;
-
-   sc->symbol = kstrdup(sym, GFP_KERNEL);
-   if (!sc->symbol) {
-   kfree(sc);
-   return NULL;
-   }
-   sc->offset = offset;
-   update_symbol_cache(sc);
-
-   return sc;
-}
-
-#define DEFINE_FETCH_symbol(type)  \
-__kprobes void FETCH_FUNC_NAME(symbol, type)(struct pt_regs *regs, \
- void *data, void *dest)   \
-{  \
-   struct symbol_cache *sc = data; \
-   if (sc->addr)   \
-   fetch_memory_##type(regs, (void 

[PATCH 13/17] tracing/uprobes: Pass 'is_return' to traceprobe_parse_probe_arg()

2013-11-26 Thread Namhyung Kim
From: Namhyung Kim 

Currently uprobes don't pass is_return to the argument parser so that
it cannot make use of "$retval" fetch method since it only works for
return probes.

Cc: Masami Hiramatsu 
Cc: Srikar Dronamraju 
Cc: Oleg Nesterov 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Namhyung Kim 
---
 kernel/trace/trace_uprobe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index 7ca5301c119f..5a6eb5686617 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -512,7 +512,7 @@ static int create_trace_uprobe(int argc, char **argv)
 
/* Parse fetch argument */
ret = traceprobe_parse_probe_arg(arg, >p.size, parg,
-false, false);
+is_return, false);
if (ret) {
pr_info("Parse error at argument[%d]. (%d)\n", i, ret);
goto error;
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/RFC 17/17] tracing/uprobes: Add @+file_offset fetch method

2013-11-26 Thread Namhyung Kim
From: Namhyung Kim 

Enable to fetch data from a file offset.  Currently it only supports
fetching from same binary uprobe set.  It'll translate the file offset
to a proper virtual address in the process.

The syntax is "@+OFFSET" as it does similar to normal memory fetching
(@ADDR) which does no address translation.

To do it, change fifth argument to receive 'void *priv' and make it
set only for uprobes so that we can determine the arg is for kprobes
or uprobes easily.

Suggested-by: Oleg Nesterov 
Cc: Masami Hiramatsu 
Cc: Srikar Dronamraju 
Cc: Oleg Nesterov 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Namhyung Kim 
---
 Documentation/trace/uprobetracer.txt |  1 +
 kernel/trace/trace_kprobe.c  | 10 +-
 kernel/trace/trace_probe.c   | 32 +++-
 kernel/trace/trace_probe.h   |  9 -
 kernel/trace/trace_uprobe.c  | 36 +++-
 5 files changed, 80 insertions(+), 8 deletions(-)

diff --git a/Documentation/trace/uprobetracer.txt 
b/Documentation/trace/uprobetracer.txt
index 6e5cff263e2b..f1cf9a34ad9d 100644
--- a/Documentation/trace/uprobetracer.txt
+++ b/Documentation/trace/uprobetracer.txt
@@ -32,6 +32,7 @@ Synopsis of uprobe_tracer
   FETCHARGS : Arguments. Each probe can have up to 128 args.
%REG : Fetch register REG
@ADDR   : Fetch memory at ADDR (ADDR should be in userspace)
+   @+OFFSET: Fetch memory at OFFSET (OFFSET from same file as PATH)
$stackN : Fetch Nth entry of stack (N >= 0)
$stack  : Fetch stack address.
$retval : Fetch return value.(*)
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 5c4f72d45b97..300fd0f8b2a9 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -239,6 +239,14 @@ DEFINE_BASIC_FETCH_FUNCS(symbol)
 DEFINE_FETCH_symbol(string)
 DEFINE_FETCH_symbol(string_size)
 
+/* kprobes don't support file_offset fetch methods */
+#define fetch_file_offset_u8   NULL
+#define fetch_file_offset_u16  NULL
+#define fetch_file_offset_u32  NULL
+#define fetch_file_offset_u64  NULL
+#define fetch_file_offset_string   NULL
+#define fetch_file_offset_string_size  NULL
+
 /* Fetch type information table */
 const struct fetch_type kprobes_fetch_type_table[] = {
/* Special types */
@@ -758,7 +766,7 @@ static int create_trace_kprobe(int argc, char **argv)
 
/* Parse fetch argument */
ret = traceprobe_parse_probe_arg(arg, >p.size, parg,
-   is_return, true);
+   is_return, NULL);
if (ret) {
pr_info("Parse error at argument[%d]. (%d)\n", i, ret);
goto error;
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 1be603d45811..bd16aed615b2 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -348,13 +348,14 @@ static int parse_probe_vars(char *arg, const struct 
fetch_type *t,
 
 /* Recursive argument parser */
 static int parse_probe_arg(char *arg, const struct fetch_type *t,
-struct fetch_param *f, bool is_return, bool is_kprobe)
+struct fetch_param *f, bool is_return, void *priv)
 {
const struct fetch_type *ftbl;
unsigned long param;
long offset;
char *tmp;
int ret = 0;
+   bool is_kprobe = (priv == NULL);
 
ftbl = is_kprobe ? kprobes_fetch_type_table : uprobes_fetch_type_table;
BUG_ON(ftbl == NULL);
@@ -373,7 +374,7 @@ static int parse_probe_arg(char *arg, const struct 
fetch_type *t,
}
break;
 
-   case '@':   /* memory or symbol */
+   case '@':   /* memory, file-offset or symbol */
if (isdigit(arg[1])) {
ret = kstrtoul(arg + 1, 0, );
if (ret)
@@ -381,6 +382,26 @@ static int parse_probe_arg(char *arg, const struct 
fetch_type *t,
 
f->fn = t->fetch[FETCH_MTD_memory];
f->data = (void *)param;
+   } else if (arg[1] == '+') {
+   struct file_offset_fetch_param *foprm;
+
+   /* kprobes don't support file offsets */
+   if (is_kprobe)
+   return -EINVAL;
+
+   ret = kstrtol(arg + 2, 0, );
+   if (ret)
+   break;
+
+   foprm = kzalloc(sizeof(*foprm), GFP_KERNEL);
+   if (!foprm)
+   return -ENOMEM;
+
+   foprm->tu = priv;
+   foprm->offset = offset;
+
+   f->fn = t->fetch[FETCH_MTD_file_offset];
+   f->data = foprm;
} else {
  

[PATCH 12/17] tracing/probes: Implement 'memory' fetch method for uprobes

2013-11-26 Thread Namhyung Kim
From: Namhyung Kim 

Use separate method to fetch from memory.  Move existing functions to
trace_kprobe.c and make them static.  Also add new memory fetch
implementation for uprobes.

Cc: Masami Hiramatsu 
Cc: Srikar Dronamraju 
Cc: Oleg Nesterov 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Namhyung Kim 
---
 kernel/trace/trace_kprobe.c | 77 +++
 kernel/trace/trace_probe.c  | 79 +
 kernel/trace/trace_probe.h  |  4 ---
 kernel/trace/trace_uprobe.c | 52 +
 4 files changed, 130 insertions(+), 82 deletions(-)

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index aa0ef55316ff..5c4f72d45b97 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -148,6 +148,83 @@ DEFINE_BASIC_FETCH_FUNCS(stack)
 #define fetch_stack_string NULL
 #define fetch_stack_string_sizeNULL
 
+#define DEFINE_FETCH_memory(type)  \
+static __kprobes void FETCH_FUNC_NAME(memory, type)(struct pt_regs *regs,\
+ void *addr, void *dest)   \
+{  \
+   type retval;\
+   if (probe_kernel_address(addr, retval)) \
+   *(type *)dest = 0;  \
+   else\
+   *(type *)dest = retval; \
+}
+DEFINE_BASIC_FETCH_FUNCS(memory)
+/*
+ * Fetch a null-terminated string. Caller MUST set *(u32 *)dest with max
+ * length and relative data location.
+ */
+static __kprobes void FETCH_FUNC_NAME(memory, string)(struct pt_regs *regs,
+ void *addr, void *dest)
+{
+   long ret;
+   int maxlen = get_rloc_len(*(u32 *)dest);
+   u8 *dst = get_rloc_data(dest);
+   u8 *src = addr;
+   mm_segment_t old_fs = get_fs();
+
+   if (!maxlen)
+   return;
+
+   /*
+* Try to get string again, since the string can be changed while
+* probing.
+*/
+   set_fs(KERNEL_DS);
+   pagefault_disable();
+
+   do
+   ret = __copy_from_user_inatomic(dst++, src++, 1);
+   while (dst[-1] && ret == 0 && src - (u8 *)addr < maxlen);
+
+   dst[-1] = '\0';
+   pagefault_enable();
+   set_fs(old_fs);
+
+   if (ret < 0) {  /* Failed to fetch string */
+   ((u8 *)get_rloc_data(dest))[0] = '\0';
+   *(u32 *)dest = make_data_rloc(0, get_rloc_offs(*(u32 *)dest));
+   } else {
+   *(u32 *)dest = make_data_rloc(src - (u8 *)addr,
+ get_rloc_offs(*(u32 *)dest));
+   }
+}
+
+/* Return the length of string -- including null terminal byte */
+static __kprobes void FETCH_FUNC_NAME(memory, string_size)(struct pt_regs 
*regs,
+   void *addr, void *dest)
+{
+   mm_segment_t old_fs;
+   int ret, len = 0;
+   u8 c;
+
+   old_fs = get_fs();
+   set_fs(KERNEL_DS);
+   pagefault_disable();
+
+   do {
+   ret = __copy_from_user_inatomic(, (u8 *)addr + len, 1);
+   len++;
+   } while (c && ret == 0 && len < MAX_STRING_SIZE);
+
+   pagefault_enable();
+   set_fs(old_fs);
+
+   if (ret < 0)/* Failed to check the length */
+   *(u32 *)dest = 0;
+   else
+   *(u32 *)dest = len;
+}
+
 #define DEFINE_FETCH_symbol(type)  \
 __kprobes void FETCH_FUNC_NAME(symbol, type)(struct pt_regs *regs, \
  void *data, void *dest)   \
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index e8358d8a0b49..01cbc035dcba 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -103,83 +103,6 @@ DEFINE_BASIC_FETCH_FUNCS(retval)
 #define fetch_retval_stringNULL
 #define fetch_retval_string_size   NULL
 
-#define DEFINE_FETCH_memory(type)  \
-__kprobes void FETCH_FUNC_NAME(memory, type)(struct pt_regs *regs, \
- void *addr, void *dest)   \
-{  \
-   type retval;\
-   if (probe_kernel_address(addr, retval)) \
-   *(type *)dest = 0;  \
-   else\
-   *(type *)dest = retval; \
-}
-DEFINE_BASIC_FETCH_FUNCS(memory)
-/*
- * Fetch a null-terminated string. Caller MUST set *(u32 *)dest with 

[PATCH 14/17] tracing/uprobes: Fetch args before reserving a ring buffer

2013-11-26 Thread Namhyung Kim
From: Namhyung Kim 

Fetching from user space should be done in a non-atomic context.  So
use a per-cpu buffer and copy its content to the ring buffer
atomically.  Note that we can migrate during accessing user memory
thus use a per-cpu mutex to protect concurrent accesses.

This is needed since we'll be able to fetch args from an user memory
which can be swapped out.  Before that uprobes could fetch args from
registers only which saved in a kernel space.

While at it, use __get_data_size() and store_trace_args() to reduce
code duplication.  And add struct uprobe_cpu_buffer and its helpers as
suggested by Oleg.

Reviewed-by: Masami Hiramatsu 
Cc: Srikar Dronamraju 
Cc: Oleg Nesterov 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Namhyung Kim 
---
 kernel/trace/trace_uprobe.c | 146 +++-
 1 file changed, 132 insertions(+), 14 deletions(-)

diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index 5a6eb5686617..c037477d1c1a 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -650,21 +650,117 @@ static const struct file_operations uprobe_profile_ops = 
{
.release= seq_release,
 };
 
+struct uprobe_cpu_buffer {
+   struct mutex mutex;
+   void *buf;
+};
+static struct uprobe_cpu_buffer __percpu *uprobe_cpu_buffer;
+static int uprobe_buffer_refcnt;
+
+static int uprobe_buffer_init(void)
+{
+   int cpu, err_cpu;
+
+   uprobe_cpu_buffer = alloc_percpu(struct uprobe_cpu_buffer);
+   if (uprobe_cpu_buffer == NULL)
+   return -ENOMEM;
+
+   for_each_possible_cpu(cpu) {
+   struct page *p = alloc_pages_node(cpu_to_node(cpu),
+ GFP_KERNEL, 0);
+   if (p == NULL) {
+   err_cpu = cpu;
+   goto err;
+   }
+   per_cpu_ptr(uprobe_cpu_buffer, cpu)->buf = page_address(p);
+   mutex_init(_cpu_ptr(uprobe_cpu_buffer, cpu)->mutex);
+   }
+
+   return 0;
+
+err:
+   for_each_possible_cpu(cpu) {
+   if (cpu == err_cpu)
+   break;
+   free_page((unsigned long)per_cpu_ptr(uprobe_cpu_buffer, 
cpu)->buf);
+   }
+
+   free_percpu(uprobe_cpu_buffer);
+   return -ENOMEM;
+}
+
+static int uprobe_buffer_enable(void)
+{
+   int ret = 0;
+
+   BUG_ON(!mutex_is_locked(_mutex));
+
+   if (uprobe_buffer_refcnt++ == 0) {
+   ret = uprobe_buffer_init();
+   if (ret < 0)
+   uprobe_buffer_refcnt--;
+   }
+
+   return ret;
+}
+
+static void uprobe_buffer_disable(void)
+{
+   BUG_ON(!mutex_is_locked(_mutex));
+
+   if (--uprobe_buffer_refcnt == 0) {
+   free_percpu(uprobe_cpu_buffer);
+   uprobe_cpu_buffer = NULL;
+   }
+}
+
+static struct uprobe_cpu_buffer *uprobe_buffer_get(void)
+{
+   struct uprobe_cpu_buffer *ucb;
+   int cpu;
+
+   cpu = raw_smp_processor_id();
+   ucb = per_cpu_ptr(uprobe_cpu_buffer, cpu);
+
+   /*
+* Use per-cpu buffers for fastest access, but we might migrate
+* so the mutex makes sure we have sole access to it.
+*/
+   mutex_lock(>mutex);
+
+   return ucb;
+}
+
+static void uprobe_buffer_put(struct uprobe_cpu_buffer *ucb)
+{
+   mutex_unlock(>mutex);
+}
+
 static void uprobe_trace_print(struct trace_uprobe *tu,
unsigned long func, struct pt_regs *regs)
 {
struct uprobe_trace_entry_head *entry;
struct ring_buffer_event *event;
struct ring_buffer *buffer;
+   struct uprobe_cpu_buffer *ucb;
void *data;
-   int size, i;
+   int size, dsize, esize;
struct ftrace_event_call *call = >p.call;
 
-   size = SIZEOF_TRACE_ENTRY(is_ret_probe(tu));
+   dsize = __get_data_size(>p, regs);
+   esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu));
+
+   if (WARN_ON_ONCE(!uprobe_cpu_buffer || tu->p.size + dsize > PAGE_SIZE))
+   return;
+
+   ucb = uprobe_buffer_get();
+   store_trace_args(esize, >p, regs, ucb->buf, dsize);
+
+   size = esize + tu->p.size + dsize;
event = trace_current_buffer_lock_reserve(, call->event.type,
- size + tu->p.size, 0, 0);
+ size, 0, 0);
if (!event)
-   return;
+   goto out;
 
entry = ring_buffer_event_data(event);
if (is_ret_probe(tu)) {
@@ -676,13 +772,13 @@ static void uprobe_trace_print(struct trace_uprobe *tu,
data = DATAOF_TRACE_ENTRY(entry, false);
}
 
-   for (i = 0; i < tu->p.nr_args; i++) {
-   call_fetch(>p.args[i].fetch, regs,
-  data + tu->p.args[i].offset);
-   }
+   memcpy(data, ucb->buf, tu->p.size + dsize);
 
if 

[PATCH 04/17] tracing/uprobes: Convert to struct trace_probe

2013-11-26 Thread Namhyung Kim
From: Namhyung Kim 

Convert struct trace_uprobe to make use of the common trace_probe
structure.

Reviewed-by: Masami Hiramatsu 
Cc: Srikar Dronamraju 
Cc: Oleg Nesterov 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Namhyung Kim 
---
 kernel/trace/trace_uprobe.c | 151 ++--
 1 file changed, 75 insertions(+), 76 deletions(-)

diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index c77b92d61551..3b2885ef47c9 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -51,22 +51,17 @@ struct trace_uprobe_filter {
  */
 struct trace_uprobe {
struct list_headlist;
-   struct ftrace_event_class   class;
-   struct ftrace_event_callcall;
struct trace_uprobe_filter  filter;
struct uprobe_consumer  consumer;
struct inode*inode;
char*filename;
unsigned long   offset;
unsigned long   nhit;
-   unsigned intflags;  /* For TP_FLAG_* */
-   ssize_t size;   /* trace entry size */
-   unsigned intnr_args;
-   struct probe_argargs[];
+   struct trace_probe  p;
 };
 
-#define SIZEOF_TRACE_UPROBE(n) \
-   (offsetof(struct trace_uprobe, args) +  \
+#define SIZEOF_TRACE_UPROBE(n) \
+   (offsetof(struct trace_uprobe, p.args) +\
(sizeof(struct probe_arg) * (n)))
 
 static int register_uprobe_event(struct trace_uprobe *tu);
@@ -114,13 +109,13 @@ alloc_trace_uprobe(const char *group, const char *event, 
int nargs, bool is_ret)
if (!tu)
return ERR_PTR(-ENOMEM);
 
-   tu->call.class = >class;
-   tu->call.name = kstrdup(event, GFP_KERNEL);
-   if (!tu->call.name)
+   tu->p.call.class = >p.class;
+   tu->p.call.name = kstrdup(event, GFP_KERNEL);
+   if (!tu->p.call.name)
goto error;
 
-   tu->class.system = kstrdup(group, GFP_KERNEL);
-   if (!tu->class.system)
+   tu->p.class.system = kstrdup(group, GFP_KERNEL);
+   if (!tu->p.class.system)
goto error;
 
INIT_LIST_HEAD(>list);
@@ -132,7 +127,7 @@ alloc_trace_uprobe(const char *group, const char *event, 
int nargs, bool is_ret)
return tu;
 
 error:
-   kfree(tu->call.name);
+   kfree(tu->p.call.name);
kfree(tu);
 
return ERR_PTR(-ENOMEM);
@@ -142,12 +137,12 @@ static void free_trace_uprobe(struct trace_uprobe *tu)
 {
int i;
 
-   for (i = 0; i < tu->nr_args; i++)
-   traceprobe_free_probe_arg(>args[i]);
+   for (i = 0; i < tu->p.nr_args; i++)
+   traceprobe_free_probe_arg(>p.args[i]);
 
iput(tu->inode);
-   kfree(tu->call.class->system);
-   kfree(tu->call.name);
+   kfree(tu->p.call.class->system);
+   kfree(tu->p.call.name);
kfree(tu->filename);
kfree(tu);
 }
@@ -157,8 +152,8 @@ static struct trace_uprobe *find_probe_event(const char 
*event, const char *grou
struct trace_uprobe *tu;
 
list_for_each_entry(tu, _list, list)
-   if (strcmp(tu->call.name, event) == 0 &&
-   strcmp(tu->call.class->system, group) == 0)
+   if (strcmp(tu->p.call.name, event) == 0 &&
+   strcmp(tu->p.call.class->system, group) == 0)
return tu;
 
return NULL;
@@ -187,7 +182,7 @@ static int register_trace_uprobe(struct trace_uprobe *tu)
mutex_lock(_lock);
 
/* register as an event */
-   old_tp = find_probe_event(tu->call.name, tu->call.class->system);
+   old_tp = find_probe_event(tu->p.call.name, tu->p.call.class->system);
if (old_tp) {
/* delete old event */
ret = unregister_trace_uprobe(old_tp);
@@ -360,34 +355,36 @@ static int create_trace_uprobe(int argc, char **argv)
/* parse arguments */
ret = 0;
for (i = 0; i < argc && i < MAX_TRACE_ARGS; i++) {
+   struct probe_arg *parg = >p.args[i];
+
/* Increment count for freeing args in error case */
-   tu->nr_args++;
+   tu->p.nr_args++;
 
/* Parse argument name */
arg = strchr(argv[i], '=');
if (arg) {
*arg++ = '\0';
-   tu->args[i].name = kstrdup(argv[i], GFP_KERNEL);
+   parg->name = kstrdup(argv[i], GFP_KERNEL);
} else {
arg = argv[i];
/* If argument name is omitted, set "argN" */
snprintf(buf, MAX_EVENT_NAME_LEN, "arg%d", i + 1);
-   tu->args[i].name = kstrdup(buf, GFP_KERNEL);
+   parg->name = kstrdup(buf, 

[PATCHSET 00/17] tracing/uprobes: Add support for more fetch methods (v7)

2013-11-26 Thread Namhyung Kim
Hello,

This patchset implements memory (address), stack[N], deference,
bitfield, retval (it needs uretprobe tho) and file_offset fetch
methods for uprobes.  It's based on the previous work [1] done by
Hyeoncheol Lee.

Now kprobes and uprobes have their own fetch_type_tables and, in turn,
memory and stack access methods.  The symbol and file_offset fetch
methods are only available to kprobes and uprobes, respectively.
Other fetch methods are shared.

For the file_offset method, it translates the offset argument to a
virtual address in a process.  To do that, it calculates base mapping
address using probe address (utask->vaddr) and probe offset
(tu->offset) and then adds the argument offset.  Those info are
carried via utask and a new fetch parameter.

The syntax is '@+offset' where offset are relative address to the base
address.  For shared libraries, it'd be simply the st_value of symbol
in ELF format.  But for executable, it needs to subtract base load
address (e.g. 0x4 for x86_64) from the symbol value.  Please see
previous discussion for an example [2] - Note that the syntax changed
to '@+' from plain '@'.  The plain '@addr' syntax is used for
accessing absolute memory address if you already know the exact address.

Many thanks to Oleg who provides valuable feedbacks and suggestions.

The patch 1-2 are bug fixes and can be applied independently.
The patch 16 is a preparation for patch 17 which implements the
file_offset fetch method.


 * v7 changes:
  - restructure patches not to break build with !CONFIG_[KU]PROBE_EVENT
  - print 0x prefix for unsigned types
  - add @+file_offset fetch method (Oleg)
  - get rid of uprobe_buffer_mutex (Oleg)
  - pass 'is_return' to uprobes argument parser


[1] https://lkml.org/lkml/2012/11/14/84
[2] https://lkml.org/lkml/2013/11/5/25

A simple example:

  # cat foo.c
  int glob = -1;
  char str[] = "hello uprobe.";

  struct foo {
unsigned int unused: 2;
unsigned int foo: 20;
unsigned int bar: 10;
  } foo = {
.foo = 5,
  };

  int main(int argc, char *argv[])
  {
long local = 0x1234;

return 127;
  }

  # gcc -o foo -g foo.c

  # objdump -d foo | grep -A9 -F ''
  004004b0 :
4004b0: 55  push   %rbp
4004b1: 48 89 e5mov%rsp,%rbp
4004b4: 89 7d ecmov%edi,-0x14(%rbp)
4004b7: 48 89 75 e0 mov%rsi,-0x20(%rbp)
4004bb: 48 c7 45 f8 34 12 00movq   $0x1234,-0x8(%rbp)
4004c2: 00 
4004c3: b8 7f 00 00 00  mov$0x7f,%eax
4004c8: 5d  pop%rbp
4004c9: c3  retq   

  # nm foo | grep -e glob$ -e str -e foo
  006008bc D foo
  006008a8 D glob
  006008ac D str

  # perf probe -x /home/namhyung/tmp/foo -a 'foo=main+0x13 glob=@0x6008a8:s32 \
  > str=@+0x2008ac:string bit=@+0x2008bc:b10@2/32 argc=%di:s32 local=-0x8(%bp)'
  Added new event:
probe_foo:foo  (on 0x4c3 with glob=@0x6008a8:s32 str=@+0x2008ac:string 
   bit=@+0x2008bc:b10@2/32 argc=%di:s32 local=-0x8(%bp))

  You can now use it in all perf tools, such as:

  perf record -e probe_foo:foo -aR sleep 1

  # perf record -e probe_foo:foo ./foo
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.001 MB perf.data (~33 samples) ]

  # perf script | grep -v ^#
   foo  2008 [002  2199.867154: probe_foo:foo (4004c3)
   glob=-1 str="hello uprobe." bit=0x5 argc=1 local=0x1234


This patchset is based on the current for-next branch of the Steven
Rostedt's linux-trace tree.  I also put this on my 'uprobe/fetch-v7'
branch in my tree:

  git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git


Any comments are welcome, thanks.
Namhyung


Cc: Masami Hiramatsu 
Cc: Srikar Dronamraju 
Cc: Oleg Nesterov 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Cc: Hemant Kumar 


Hyeoncheol Lee (1):
  tracing/probes: Add fetch{,_size} member into deref fetch method

Namhyung Kim (15):
  tracing/uprobes: Fix documentation of uprobe registration syntax
  tracing/probes: Fix basic print type functions
  tracing/kprobes: Factor out struct trace_probe
  tracing/uprobes: Convert to struct trace_probe
  tracing/kprobes: Move common functions to trace_probe.h
  tracing/probes: Integrate duplicate set_print_fmt()
  tracing/probes: Move fetch function helpers to trace_probe.h
  tracing/probes: Split [ku]probes_fetch_type_table
  tracing/probes: Implement 'stack' fetch method for uprobes
  tracing/probes: Move 'symbol' fetch method to kprobes
  tracing/probes: Implement 'memory' fetch method for uprobes
  tracing/uprobes: Pass 'is_return' to traceprobe_parse_probe_arg()
  tracing/uprobes: Fetch args before reserving a ring buffer
  tracing/uprobes: Add support for full argument access methods
  tracing/uprobes: Add @+file_offset fetch method

Oleg Nesterov (1):
  uprobes: Allocate ->utask before 

[PATCH 16/17] uprobes: Allocate ->utask before handler_chain() for tracing handlers

2013-11-26 Thread Namhyung Kim
From: Oleg Nesterov 

uprobe_trace_print() and uprobe_perf_print() need to pass the additional
info to call_fetch() methods, currently there is no simple way to do this.

current->utask looks like a natural place to hold this info, but we need
to allocate it before handler_chain().

This is a bit unfortunate, perhaps we will find a better solution later,
but this is simnple and should work right now.

Signed-off-by: Oleg Nesterov 
Cc: Srikar Dronamraju 
Cc: Masami Hiramatsu 
Signed-off-by: Namhyung Kim 
---
 kernel/events/uprobes.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index ad8e1bdca70e..a1aa4aed029c 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -1744,6 +1744,10 @@ static void handle_swbp(struct pt_regs *regs)
if (unlikely(!test_bit(UPROBE_COPY_INSN, >flags)))
goto out;
 
+   /* Tracing handlers use ->utask to communicate with fetch methods */
+   if (!get_utask())
+   goto out;
+
handler_chain(uprobe, regs);
if (can_skip_sstep(uprobe, regs))
goto out;
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 15/17] tracing/uprobes: Add support for full argument access methods

2013-11-26 Thread Namhyung Kim
From: Namhyung Kim 

Enable to fetch other types of argument for the uprobes.  IOW, we can
access stack, memory, deref, bitfield and retval from uprobes now.

The format for the argument types are same as kprobes (but @SYMBOL
type is not supported for uprobes), i.e:

  @ADDR   : Fetch memory at ADDR
  $stackN : Fetch Nth entry of stack (N >= 0)
  $stack  : Fetch stack address
  $retval : Fetch return value
  +|-offs(FETCHARG) : Fetch memory at FETCHARG +|- offs address

Note that the retval only can be used with uretprobes.

Original-patch-by: Hyeoncheol Lee 
Acked-by: Masami Hiramatsu 
Cc: Srikar Dronamraju 
Cc: Oleg Nesterov 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Namhyung Kim 
---
 Documentation/trace/uprobetracer.txt | 25 +
 kernel/trace/trace_probe.c   | 34 ++
 2 files changed, 47 insertions(+), 12 deletions(-)

diff --git a/Documentation/trace/uprobetracer.txt 
b/Documentation/trace/uprobetracer.txt
index 8f1a8b8956fc..6e5cff263e2b 100644
--- a/Documentation/trace/uprobetracer.txt
+++ b/Documentation/trace/uprobetracer.txt
@@ -31,6 +31,31 @@ Synopsis of uprobe_tracer
 
   FETCHARGS : Arguments. Each probe can have up to 128 args.
%REG : Fetch register REG
+   @ADDR   : Fetch memory at ADDR (ADDR should be in userspace)
+   $stackN : Fetch Nth entry of stack (N >= 0)
+   $stack  : Fetch stack address.
+   $retval : Fetch return value.(*)
+   +|-offs(FETCHARG) : Fetch memory at FETCHARG +|- offs address.(**)
+   NAME=FETCHARG : Set NAME as the argument name of FETCHARG.
+   FETCHARG:TYPE : Set TYPE as the type of FETCHARG. Currently, basic types
+  (u8/u16/u32/u64/s8/s16/s32/s64), "string" and bitfield
+  are supported.
+
+  (*) only for return probe.
+  (**) this is useful for fetching a field of data structures.
+
+Types
+-
+Several types are supported for fetch-args. Uprobe tracer will access memory
+by given type. Prefix 's' and 'u' means those types are signed and unsigned
+respectively. Traced arguments are shown in decimal (signed) or hex (unsigned).
+String type is a special type, which fetches a "null-terminated" string from
+user space.
+Bitfield is another special type, which takes 3 parameters, bit-width, bit-
+offset, and container-size (usually 32). The syntax is;
+
+ b@/
+
 
 Event Profiling
 ---
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 01cbc035dcba..1be603d45811 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -254,12 +254,18 @@ fail:
 }
 
 /* Special function : only accept unsigned long */
-static __kprobes void fetch_stack_address(struct pt_regs *regs,
-   void *dummy, void *dest)
+static __kprobes void fetch_kernel_stack_address(struct pt_regs *regs,
+void *dummy, void *dest)
 {
*(unsigned long *)dest = kernel_stack_pointer(regs);
 }
 
+static __kprobes void fetch_user_stack_address(struct pt_regs *regs,
+  void *dummy, void *dest)
+{
+   *(unsigned long *)dest = user_stack_pointer(regs);
+}
+
 static fetch_func_t get_fetch_size_function(const struct fetch_type *type,
fetch_func_t orig_fn,
const struct fetch_type *ftbl)
@@ -304,7 +310,8 @@ int traceprobe_split_symbol_offset(char *symbol, unsigned 
long *offset)
 #define PARAM_MAX_STACK (THREAD_SIZE / sizeof(unsigned long))
 
 static int parse_probe_vars(char *arg, const struct fetch_type *t,
-   struct fetch_param *f, bool is_return)
+   struct fetch_param *f, bool is_return,
+   bool is_kprobe)
 {
int ret = 0;
unsigned long param;
@@ -316,13 +323,16 @@ static int parse_probe_vars(char *arg, const struct 
fetch_type *t,
ret = -EINVAL;
} else if (strncmp(arg, "stack", 5) == 0) {
if (arg[5] == '\0') {
-   if (strcmp(t->name, DEFAULT_FETCH_TYPE_STR) == 0)
-   f->fn = fetch_stack_address;
+   if (strcmp(t->name, DEFAULT_FETCH_TYPE_STR))
+   return -EINVAL;
+
+   if (is_kprobe)
+   f->fn = fetch_kernel_stack_address;
else
-   ret = -EINVAL;
+   f->fn = fetch_user_stack_address;
} else if (isdigit(arg[5])) {
ret = kstrtoul(arg + 5, 10, );
-   if (ret || param > PARAM_MAX_STACK)
+   if (ret || (is_kprobe && param > PARAM_MAX_STACK))
ret = -EINVAL;
else {

[PATCH 03/17] tracing/kprobes: Factor out struct trace_probe

2013-11-26 Thread Namhyung Kim
From: Namhyung Kim 

There are functions that can be shared to both of kprobes and uprobes.
Separate common data structure to struct trace_probe and use it from
the shared functions.

Acked-by: Masami Hiramatsu 
Cc: Srikar Dronamraju 
Cc: Oleg Nesterov 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Namhyung Kim 
---
 kernel/trace/trace_kprobe.c | 396 +---
 kernel/trace/trace_probe.h  |  20 +++
 2 files changed, 213 insertions(+), 203 deletions(-)

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index dae9541ada9e..72b76e1f2d34 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -27,18 +27,12 @@
 /**
  * Kprobe event core functions
  */
-struct trace_probe {
+struct trace_kprobe {
struct list_headlist;
struct kretproberp; /* Use rp.kp for kprobe use */
unsigned long   nhit;
-   unsigned intflags;  /* For TP_FLAG_* */
const char  *symbol;/* symbol name */
-   struct ftrace_event_class   class;
-   struct ftrace_event_callcall;
-   struct list_headfiles;
-   ssize_t size;   /* trace entry size */
-   unsigned intnr_args;
-   struct probe_argargs[];
+   struct trace_probe  p;
 };
 
 struct event_file_link {
@@ -46,56 +40,46 @@ struct event_file_link {
struct list_headlist;
 };
 
-#define SIZEOF_TRACE_PROBE(n)  \
-   (offsetof(struct trace_probe, args) +   \
+#define SIZEOF_TRACE_PROBE(n)  \
+   (offsetof(struct trace_kprobe, p.args) +\
(sizeof(struct probe_arg) * (n)))
 
 
-static __kprobes bool trace_probe_is_return(struct trace_probe *tp)
+static __kprobes bool trace_kprobe_is_return(struct trace_kprobe *tk)
 {
-   return tp->rp.handler != NULL;
+   return tk->rp.handler != NULL;
 }
 
-static __kprobes const char *trace_probe_symbol(struct trace_probe *tp)
+static __kprobes const char *trace_kprobe_symbol(struct trace_kprobe *tk)
 {
-   return tp->symbol ? tp->symbol : "unknown";
+   return tk->symbol ? tk->symbol : "unknown";
 }
 
-static __kprobes unsigned long trace_probe_offset(struct trace_probe *tp)
+static __kprobes unsigned long trace_kprobe_offset(struct trace_kprobe *tk)
 {
-   return tp->rp.kp.offset;
+   return tk->rp.kp.offset;
 }
 
-static __kprobes bool trace_probe_is_enabled(struct trace_probe *tp)
+static __kprobes bool trace_kprobe_has_gone(struct trace_kprobe *tk)
 {
-   return !!(tp->flags & (TP_FLAG_TRACE | TP_FLAG_PROFILE));
+   return !!(kprobe_gone(>rp.kp));
 }
 
-static __kprobes bool trace_probe_is_registered(struct trace_probe *tp)
-{
-   return !!(tp->flags & TP_FLAG_REGISTERED);
-}
-
-static __kprobes bool trace_probe_has_gone(struct trace_probe *tp)
-{
-   return !!(kprobe_gone(>rp.kp));
-}
-
-static __kprobes bool trace_probe_within_module(struct trace_probe *tp,
-   struct module *mod)
+static __kprobes bool trace_kprobe_within_module(struct trace_kprobe *tk,
+struct module *mod)
 {
int len = strlen(mod->name);
-   const char *name = trace_probe_symbol(tp);
+   const char *name = trace_kprobe_symbol(tk);
return strncmp(mod->name, name, len) == 0 && name[len] == ':';
 }
 
-static __kprobes bool trace_probe_is_on_module(struct trace_probe *tp)
+static __kprobes bool trace_kprobe_is_on_module(struct trace_kprobe *tk)
 {
-   return !!strchr(trace_probe_symbol(tp), ':');
+   return !!strchr(trace_kprobe_symbol(tk), ':');
 }
 
-static int register_probe_event(struct trace_probe *tp);
-static int unregister_probe_event(struct trace_probe *tp);
+static int register_kprobe_event(struct trace_kprobe *tk);
+static int unregister_kprobe_event(struct trace_kprobe *tk);
 
 static DEFINE_MUTEX(probe_lock);
 static LIST_HEAD(probe_list);
@@ -107,14 +91,14 @@ static int kretprobe_dispatcher(struct kretprobe_instance 
*ri,
 /*
  * Allocate new trace_probe and initialize it (including kprobes).
  */
-static struct trace_probe *alloc_trace_probe(const char *group,
+static struct trace_kprobe *alloc_trace_kprobe(const char *group,
 const char *event,
 void *addr,
 const char *symbol,
 unsigned long offs,
 int nargs, bool is_return)
 {
-   struct trace_probe *tp;
+   struct trace_kprobe *tp;
int ret = -ENOMEM;
 
tp = kzalloc(SIZEOF_TRACE_PROBE(nargs), GFP_KERNEL);
@@ -140,9 +124,9 @@ static struct trace_probe *alloc_trace_probe(const char 
*group,
goto error;
}
 
-   tp->call.class = 

Re: [PATCH v2] panic: Make panic_timeout configurable

2013-11-26 Thread Felipe Contreras
On Tue, Nov 19, 2013 at 1:15 AM, Ingo Molnar  wrote:
>
> * Andrew Morton  wrote:
>
>> On Mon, 18 Nov 2013 21:04:36 + (GMT) Jason Baron  
>> wrote:
>>
>> > The panic_timeout value can be set via the command line option 'panic=x', 
>> > or via
>> > /proc/sys/kernel/panic, however that is not sufficient when the panic 
>> > occurs
>> > before we are able to set up these values. Thus, add a CONFIG_PANIC_TIMEOUT
>> > so that we can set the desired value from the .config.
>> >
>> > The default panic_timeout value continues to be 0 - wait forever, except 
>> > for
>> > powerpc and mips, which have been defaulted to 180 and 5 respectively. This
>> > is in keeping with the fact that these arches already set panic_timeout in
>> > their arch init code. However, I found three exceptions- two in mips and 
>> > one in
>> > powerpc where the settings didn't match these default values. In those 
>> > cases, I
>> > left the arch code so it continues to override, in case the user has not 
>> > changed
>> > from the default. It would nice if these arches had one default value, or 
>> > if we
>> > could determine the correct setting at compile-time.
>>
>> Felipe is proposing a simpler patch ("panic: setup panic_timeout
>> early") which switches to early_param().  Is that sufficient for the
>> (undescribed!) failure which you are presumably observing?
>
> Also note that that patch is still incomplete: if panic_timeout is
> switched to early_param() then closely related functionality such as
> pause_on_oops should be moved early as well...

If that was the case, then whomever made the "oops" param generic sent
an incomplete patch because it's also early_param, and it's
interesting why you didn't have that problem with that patch, but you
do with this one.

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/3 v3] build in panic_timeout value

2013-11-26 Thread Felipe Contreras
On Tue, Nov 26, 2013 at 5:17 AM, Ingo Molnar  wrote:
> * Jason Baron  wrote:

>> I've now separated out the arch bits into separate patches.
>> Hopefully, it makes review easier. I also didn't address moving the
>> 'panic_timeout' command-line parameter up as an 'early_param()'. I
>> think it might make sense to move it up, especially for distro
>> kernels, but its not a need here, so I didn't want to just shove it
>> in. If needed, I think it can come in separately, as it shoudn't
>> affect this series.
>
> The series looks good to me, I've applied the patches to
> tip:core/debug.
>
> If Felipe Contreras's fix patch looks good to you then it would also
> be nice if you could send me that as well, on top of your patches.

Why? Because for ad hominem reasons you wouldn't take the patch itself
even though it's obviously good?

> That fix patch had only one remaining bug/problem, last I checked: if
> panic_timeout is turned into an early_param() then pause_on_oops
> should obviously also be turned into an early param.

That is not a "problem" with the patch itself, and it's the first time
this "problem" has been mentioned at all.

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [f2fs-dev] [PATCH] f2fs: readahead contiguous pages for restore_node_summary

2013-11-26 Thread Jaegeuk Kim
Hi Chao,

It seems that we already have a readahed function for node pages,
ra_node_page().
So, we don't make a page list for this, but can use the node_inode's
page cache.

So how about writing ra_node_pages() which use the node_inode's page
cache?

Thanks,

2013-11-22 (금), 15:48 +0800, Chao Yu:
> If cp has no CP_UMOUNT_FLAG, we will read all pages in whole node segment 
> one by one, it makes low performance. So let's merge contiguous pages and 
> readahead for better performance.
> 
> Signed-off-by: Chao Yu 
> ---
>  fs/f2fs/node.c |   89 
> +++-
>  1 file changed, 63 insertions(+), 26 deletions(-)
> 
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index 4ac4150..81e704a 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -1572,47 +1572,84 @@ int recover_inode_page(struct f2fs_sb_info *sbi, 
> struct page *page)
>   return 0;
>  }
>  
> +/*
> + * ra_sum_pages() merge contiguous pages into one bio and submit.
> + * these pre-readed pages are linked in pages list.
> + */
> +static int ra_sum_pages(struct f2fs_sb_info *sbi, struct list_head *pages,
> + int start, int nrpages)
> +{
> + struct page *page;
> + int page_idx = start;
> +
> + for (; page_idx < start + nrpages; page_idx++) {
> + /* alloc temporal page for read node summary info*/
> + page = alloc_page(GFP_NOFS | __GFP_ZERO);
> + if (!page) {
> + struct page *tmp;
> + list_for_each_entry_safe(page, tmp, pages, lru) {
> + list_del(>lru);
> + unlock_page(page);
> + __free_pages(page, 0);
> + }
> + return -ENOMEM;
> + }
> +
> + lock_page(page);
> + page->index = page_idx;
> + list_add_tail(>lru, pages);
> + }
> +
> + list_for_each_entry(page, pages, lru)
> + submit_read_page(sbi, page, page->index, READ_SYNC);
> +
> + f2fs_submit_read_bio(sbi, READ_SYNC);
> + return 0;
> +}
> +
>  int restore_node_summary(struct f2fs_sb_info *sbi,
>   unsigned int segno, struct f2fs_summary_block *sum)
>  {
>   struct f2fs_node *rn;
>   struct f2fs_summary *sum_entry;
> - struct page *page;
> + struct page *page, *tmp;
>   block_t addr;
> - int i, last_offset;
> -
> - /* alloc temporal page for read node */
> - page = alloc_page(GFP_NOFS | __GFP_ZERO);
> - if (!page)
> - return -ENOMEM;
> - lock_page(page);
> + int bio_blocks = MAX_BIO_BLOCKS(max_hw_blocks(sbi));
> + int i, last_offset, nrpages, err = 0;
> + LIST_HEAD(page_list);
>  
>   /* scan the node segment */
>   last_offset = sbi->blocks_per_seg;
>   addr = START_BLOCK(sbi, segno);
>   sum_entry = >entries[0];
>  
> - for (i = 0; i < last_offset; i++, sum_entry++) {
> - /*
> -  * In order to read next node page,
> -  * we must clear PageUptodate flag.
> -  */
> - ClearPageUptodate(page);
> + for (i = 0; i < last_offset; i += nrpages, addr += nrpages) {
>  
> - if (f2fs_readpage(sbi, page, addr, READ_SYNC))
> - goto out;
> + nrpages = min(last_offset - i, bio_blocks);
> + /* read ahead node pages */
> + err = ra_sum_pages(sbi, _list, addr, nrpages);
> + if (err)
> + return err;
>  
> - lock_page(page);
> - rn = F2FS_NODE(page);
> - sum_entry->nid = rn->footer.nid;
> - sum_entry->version = 0;
> - sum_entry->ofs_in_node = 0;
> - addr++;
> + list_for_each_entry_safe(page, tmp, _list, lru) {
> +
> + lock_page(page);
> + if(PageUptodate(page)) {
> + rn = F2FS_NODE(page);
> + sum_entry->nid = rn->footer.nid;
> + sum_entry->version = 0;
> + sum_entry->ofs_in_node = 0;
> + sum_entry++;
> + } else {
> + err = -EIO;
> + }
> +
> + list_del(>lru);
> + unlock_page(page);
> + __free_pages(page, 0);
> + }
>   }
> - unlock_page(page);
> -out:
> - __free_pages(page, 0);
> - return 0;
> + return err;
>  }
>  
>  static bool flush_nats_in_journal(struct f2fs_sb_info *sbi)

-- 
Jaegeuk Kim
Samsung

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] kernel/fork.c : remove local 'oldmm' and retval

2013-11-26 Thread DaeSeok Youn
Sorry.
my e-mail was rejected by vger.kernel.org server.
resend my e-mail.

2013/11/27 DaeSeok Youn 
>
> Thank you for reviewing my patch.
>
> I am a newbie who want to know kernel source deeply. :)
>
> I agree your comments but I want to explain my patch why it is sent.
>
> I think "ENOMEM" is enough to explain to fail by dup_mm().
> So I replace the goto line to "return -ENOMEM" in if(!mm).
>
> And I think oldmm doesn't use any meaning control in copy_mm(),
> so re-use local 'mm' variable. If the source has less comprehensible,
> how about adding a comment like 'parent and child share address space'
> above "mm = current->mm" in my patch.
>
> just my opinion, let me know if i am wrong.
> Actually I need to learn about kernel source code.
>
> Thanks.
> Daeseok Youn.
>
>
>
> 2013/11/27 Eric W. Biederman 
>
>> Daeseok Youn  writes:
>>
>> > From cec2f201f0dc99a33a58d9d1e0452140bb0993a1 Mon Sep 17 00:00:00 2001
>> > From: Daeseok Youn 
>> > Date: Wed, 27 Nov 2013 09:54:41 +0900
>> > Subject: [PATCH] kernel/fork.c : remove local 'oldmm' and retval
>> >
>> >  Local oldmm is used only for increaing mm_users field
>> >  in current->mm. When clone_flags have a CLONE_VM flag,
>> >  current->mm is assigning to local 'mm'.
>> >  Local retval is used only for returning -ENOMEM value.
>> >  When dup_mm() is failed, just return -ENOMEM.
>>
>> You are making the generated code worse, and the source less
>> comprehensible.
>>
>> You are adding additional exit points making it harder to analyze the
>> function.
>>
>> You are introducing races and expense by not caching current->mm in
>> oldmm.
>>
>> This looks like code churn for no good reason, and that will result in
>> worse code.
>>
>> ick.
>>
>> Eric
>>
>> >  Signed-off-by: Daeseok Youn 
>> > ---
>> >  kernel/fork.c |   16 +---
>> >  1 file changed, 5 insertions(+), 11 deletions(-)
>> >
>> > diff --git a/kernel/fork.c b/kernel/fork.c
>> > index 728d5be..022a0af 100644
>> > --- a/kernel/fork.c
>> > +++ b/kernel/fork.c
>> > @@ -857,8 +857,7 @@ fail_nocontext:
>> >
>> >  static int copy_mm(unsigned long clone_flags, struct task_struct *tsk)
>> >  {
>> > - struct mm_struct *mm, *oldmm;
>> > - int retval;
>> > + struct mm_struct *mm;
>> >
>> >   tsk->min_flt = tsk->maj_flt = 0;
>> >   tsk->nvcsw = tsk->nivcsw = 0;
>> > @@ -874,28 +873,23 @@ static int copy_mm(unsigned long clone_flags, struct 
>> > task_struct *tsk)
>> >*
>> >* We need to steal a active VM for that..
>> >*/
>> > - oldmm = current->mm;
>> > - if (!oldmm)
>> > + if (!current->mm)
>> >   return 0;
>> >
>> >   if (clone_flags & CLONE_VM) {
>> > - atomic_inc(>mm_users);
>> > - mm = oldmm;
>> > + mm = current->mm;
>> > + atomic_inc(>mm_users);
>> >   goto good_mm;
>> >   }
>> >
>> > - retval = -ENOMEM;
>> >   mm = dup_mm(tsk);
>> >   if (!mm)
>> > - goto fail_nomem;
>> > + return -ENOMEM;
>> >
>> >  good_mm:
>> >   tsk->mm = mm;
>> >   tsk->active_mm = mm;
>> >   return 0;
>> > -
>> > -fail_nomem:
>> > - return retval;
>> >  }
>> >
>> >  static int copy_fs(unsigned long clone_flags, struct task_struct *tsk)
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/2] mmc: arasan: Add driver for Arasan SDHCI

2013-11-26 Thread Michal Simek
Hi Chris,

On 11/27/2013 12:39 AM, Sören Brinkmann wrote:
> Hi Chris,
> 
> On Tue, Nov 26, 2013 at 06:22:46PM -0500, Chris Ball wrote:
>> Hi Soren, sorry for the late review, just trivial changes:
> No problem. Thanks for looking at it.
> 
>>
>> On Wed, Oct 30 2013, Soren Brinkmann wrote:
>>> diff --git a/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt 
>>> b/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt
>>> new file mode 100644
>>> index ..ef4c5ac753e8
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt
>>> @@ -0,0 +1,27 @@
>>> +Device Tree Bindings for the Arasan SDCHI Controller
>>
>> SDHCI
> Oops. Will be fixed.
> 
>>
>>> +
>>> +  The bindings follow the mmc[1], clock[2] and interrupt[3] bindings. Only
>>> +  deviations are documented here.
>>> +
>>> +  [1] Documentation/devicetree/bindings/mmc/mmc.txt
>>> +  [2] Documentation/devicetree/bindings/clock/clock-bindings.txt
>>> +  [3] Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
>>> +
>>> +Required Properties:
>>> +  - compatible: Compatibility string. Must be 'arasan,sdhci-8.9a'
>>> +  - reg: From mmc bindings: Register location and length.
>>
>> Actually, reg/interrupts are from the OF core.  There's no need to
>> mention them here.
> Tomasz complained when I left those parts out so I added them in v2.
> Since it's there now, I don't mind either way. Let's just agree on one
> way or the other.
> 

Binding was Acked-by Rob and that's why I believe this should be fine.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform




signature.asc
Description: OpenPGP digital signature


RE: [f2fs-dev] [PATCH] f2fs: remove unneeded code in punch_hole

2013-11-26 Thread Chao Yu
Hi,

> -Original Message-
> From: Jaegeuk Kim [mailto:jaegeuk@samsung.com]
> Sent: Wednesday, November 27, 2013 1:14 PM
> To: Chao Yu
> Cc: linux-fsde...@vger.kernel.org; linux-kernel@vger.kernel.org; 
> linux-f2fs-de...@lists.sourceforge.net; 谭姝; fanofcode...@samsung.com
> Subject: Re: [f2fs-dev] [PATCH] f2fs: remove unneeded code in punch_hole
> 
> Got it.
> 
> But, with this patch, we can also remove the parameter, int mode, in
> punch_hole().
> If no objection, I'll fix that in your patch.
> Thanks,

Right, we should remove it.
Thanks!

> 
> 2013-11-22 (금), 16:52 +0800, Chao Yu:
> > Because FALLOC_FL_PUNCH_HOLE flag must be ORed with FALLOC_FL_KEEP_SIZE
> > in fallocate, so we could remove the useless 'keep size' branch code which
> > will never be excuted in punch_hole.
> >
> > Signed-off-by: Chao Yu 
> > Signed-off-by: Fan Li 
> > ---
> >  fs/f2fs/file.c |6 --
> >  1 file changed, 6 deletions(-)
> >
> > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> > index 7d714f4..0087d2a 100644
> > --- a/fs/f2fs/file.c
> > +++ b/fs/f2fs/file.c
> > @@ -499,12 +499,6 @@ static int punch_hole(struct inode *inode, loff_t 
> > offset, loff_t len, int mode)
> > }
> > }
> >
> > -   if (!(mode & FALLOC_FL_KEEP_SIZE) &&
> > -   i_size_read(inode) <= (offset + len)) {
> > -   i_size_write(inode, offset);
> > -   mark_inode_dirty(inode);
> > -   }
> > -
> > return ret;
> >  }
> >
> 
> --
> Jaegeuk Kim
> Samsung

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


[PATCH] arch: hexagon: include: uapi: asm: setup.h add swith macro __KERNEL__

2013-11-26 Thread Chen Gang
Define dummy '__init' instead of include "linux/init.h" if !__KERNEL__,
or can not pass checking. The related error (with allmodconfig under
hexagon):

CHECK   include/asm (34 files)
  usr/include/asm/setup.h:22: included file 'linux/init.h' is not exported


Signed-off-by: Chen Gang 
---
 arch/hexagon/include/uapi/asm/setup.h |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/hexagon/include/uapi/asm/setup.h 
b/arch/hexagon/include/uapi/asm/setup.h
index e48285e4a..7e3952d 100644
--- a/arch/hexagon/include/uapi/asm/setup.h
+++ b/arch/hexagon/include/uapi/asm/setup.h
@@ -19,7 +19,12 @@
 #ifndef _ASM_SETUP_H
 #define _ASM_SETUP_H
 
+#ifdef __KERNEL__
 #include 
+#else
+#define __init
+#endif
+
 #include 
 
 extern char external_cmdline_buffer;
-- 
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: Does Itanium permit speculative stores?

2013-11-26 Thread Jon Masters
On 11/11/2013 12:13 PM, Paul E. McKenney wrote:
> Hello, Tony,
> 
> Does Itanium permit speculative stores?  For example, on Itanium what are
> the permitted outcomes of the following litmus test, where both x and y
> are initially zero?
> 
>   CPU 0   CPU 1
> 
>   r1 = ACCESS_ONCE(x);r2 = ACCESS_ONCE(y);
>   if (r1) if (r2)
>   ACCESS_ONCE(y) = 1; ACCESS_ONCE(x) = 1;
> 
> In particular, is the outcome (r1 == 1 && r2 == 1) possible on Itanium
> given this litmus test?
> 
>   Thanx, Paul
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

Btw, I was reading through some UEFI docs and noticed a reference to "A
Formal Specification of Intel Itanium Processor Family Memory Ordering",
then remembered this thread. In case it's of use:

http://www.intel.com/design/itanium/downloads/251429.htm

Jon.

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


[PATCH 1/2] f2fs: remove unnecessary return value

2013-11-26 Thread Jaegeuk Kim
Let's remove the unnecessary return value.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/f2fs.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 95d2aba..132bb3f 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -773,13 +773,12 @@ static inline void inc_valid_inode_count(struct 
f2fs_sb_info *sbi)
spin_unlock(>stat_lock);
 }
 
-static inline int dec_valid_inode_count(struct f2fs_sb_info *sbi)
+static inline void dec_valid_inode_count(struct f2fs_sb_info *sbi)
 {
spin_lock(>stat_lock);
f2fs_bug_on(!sbi->total_valid_inode_count);
sbi->total_valid_inode_count--;
spin_unlock(>stat_lock);
-   return 0;
 }
 
 static inline unsigned int valid_inode_count(struct f2fs_sb_info *sbi)
-- 
1.8.4.474.g128a96c

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [f2fs-dev] [PATCH] f2fs: remove unneeded code in punch_hole

2013-11-26 Thread Jaegeuk Kim
Got it.

But, with this patch, we can also remove the parameter, int mode, in
punch_hole().
If no objection, I'll fix that in your patch.
Thanks,

2013-11-22 (금), 16:52 +0800, Chao Yu:
> Because FALLOC_FL_PUNCH_HOLE flag must be ORed with FALLOC_FL_KEEP_SIZE 
> in fallocate, so we could remove the useless 'keep size' branch code which 
> will never be excuted in punch_hole.
> 
> Signed-off-by: Chao Yu 
> Signed-off-by: Fan Li 
> ---
>  fs/f2fs/file.c |6 --
>  1 file changed, 6 deletions(-)
> 
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 7d714f4..0087d2a 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -499,12 +499,6 @@ static int punch_hole(struct inode *inode, loff_t 
> offset, loff_t len, int mode)
>   }
>   }
>  
> - if (!(mode & FALLOC_FL_KEEP_SIZE) &&
> - i_size_read(inode) <= (offset + len)) {
> - i_size_write(inode, offset);
> - mark_inode_dirty(inode);
> - }
> -
>   return ret;
>  }
>  

-- 
Jaegeuk Kim
Samsung

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] dmaengine: pl08x: fix conversioin for generic unmap data

2013-11-26 Thread Olof Johansson
commit d38a8c622a1b ('dmaengine: prepare for generic 'unmap' data')
added a generic unmap call but used the wrong argument for it. Fix it.

Fixes: d38a8c622a1b ('dmaengine: prepare for generic 'unmap' data')
Signed-off-by: Olof Johansson 
---

I can't actually tell what the intent of d38a8cc622a1b and how mappings
are expected to be managed, but it's obviously passing the wrong thing
in here so it seems like the appropriate fix.

 drivers/dma/amba-pl08x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index 16a2aa28f856..ec4ee5c1fe9d 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -1169,7 +1169,7 @@ static void pl08x_desc_free(struct virt_dma_desc *vd)
struct pl08x_txd *txd = to_pl08x_txd(>tx);
struct pl08x_dma_chan *plchan = to_pl08x_chan(vd->tx.chan);
 
-   dma_descriptor_unmap(txd);
+   dma_descriptor_unmap(>tx);
if (!txd->done)
pl08x_release_mux(plchan);
 
-- 
1.8.4.1.601.g02b3b1d

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


Re: [PATCH v4 07/12] efi: passing kexec necessary efi data via setup_data

2013-11-26 Thread Dave Young
On 11/26/13 at 10:04pm, Matt Fleming wrote:
> On Tue, 26 Nov, at 01:57:52PM, Dave Young wrote:
> > Add a new setup_data type SETUP_EFI for kexec use.
> > Passing the saved fw_vendor, runtime, config tables and
> > efi runtime mappings.
> > 
> > When entering virtual mode, directly mapping the efi
> > runtime ragions which we passed in previously. And skip
> > the step to call SetVirtualAddressMap.
> > 
> > Specially for HP z420 workstation it need another variable
> > saving, it's the smbios physical address, the HP bios
> > also update the SMBIOS address after entering virtual mode
> > besides of the standard fw_vendor,runtime and config table.
> > 
> > Tested on ovmf+qemu, lenovo thinkpad, a dell laptop and an
> > HP z420 workstation.
> > 
> > v2: refresh based on previous patch changes, code cleanup.
> > v3: use ioremap instead of phys_to_virt for esdata
> > 
> > Signed-off-by: Dave Young 
> > ---
> >  arch/x86/include/asm/efi.h|  12 +++
> >  arch/x86/include/uapi/asm/bootparam.h |   1 +
> >  arch/x86/kernel/setup.c   |   3 +
> >  arch/x86/platform/efi/efi.c   | 161 
> > ++
> >  4 files changed, 160 insertions(+), 17 deletions(-)
> 
> [...]
> 
> > +void __init parse_efi_setup(u64 phys_addr, u32 data_len)
> > +{
> > +   int size;
> > +   struct setup_data *sdata;
> > +   u64 esdata_phys;
> > +
> > +   if (!efi_enabled(EFI_64BIT)) {
> > +   pr_warn("skipping setup_data on EFI 32BIT!");
> > +   return;
> > +   }
> 
> Hmm... this warning could be more informative. Perhaps something along
> the lines of,
> 
>   "SETUP_EFI not supported on 32-bit\n"

Will do

> 
> because the reason we skip is because it isn't supported.
> 
> > +
> > +   sdata = early_memremap(phys_addr, data_len);
> > +   if (!sdata)
> > +   return;
> > +
> > +   size = data_len - sizeof(struct setup_data);
> > +
> > +   esdata_phys = phys_addr + sizeof(struct setup_data);
> > +
> > +   nr_efi_runtime_map = (size - sizeof(struct efi_setup_data)) /
> > +   sizeof(efi_memory_desc_t);
> > +   early_iounmap(sdata, data_len);
> > +
> > +   /* iounmap esdata in function efi_enter_virtual_mode */
> > +   esdata = early_memremap(esdata_phys, size);
> > +}
> >  
> >  static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
> >  {
> > @@ -504,8 +531,12 @@ static int __init efi_systab_init(void *phys)
> > }
> >  
> > efi_systab.hdr = systab64->hdr;
> > -   efi_systab.fw_vendor = systab64->fw_vendor;
> > -   tmp |= systab64->fw_vendor;
> > +
> > +   if (esdata)
> 
> Could we name this something more explicit? 'efi_setup' perhaps?

Sure, just efi_setup_data is a bit long, will use efi_setup in next version.

> 
> > @@ -631,6 +670,41 @@ static int __init efi_memmap_init(void)
> > return 0;
> >  }
> >  
> > +static int __init efi_reuse_config(u64 tables, int nr_tables)
> > +{
> > +   void *p, *tablep;
> > +   int i, sz;
> > +
> > +   if (!efi_enabled(EFI_64BIT))
> > +   return 0;
> > +
> > +   sz = sizeof(efi_config_table_64_t);
> > +
> > +   p = tablep = early_memremap(tables, nr_tables * sz);
> > +   if (!p) {
> > +   pr_err("Could not map Configuration table!\n");
> > +   return -ENOMEM;
> > +   }
> > +
> > +   for (i = 0; i < efi.systab->nr_tables; i++) {
> > +   efi_guid_t guid;
> > +
> > +   guid = ((efi_config_table_64_t *)p)->guid;
> > +
> > +   /*
> > +   HP z420 workstation smbios will be convert to
> > +   virtual address after enter virtual mode.
> > +   Thus in case kexec/kdump the physical address
> > +   will be passed in setup_data.
> > +   */
> 
> This isn't the correct multi-line comment format,

Will update

> 
>   /*
>* This is the preferred way to to write a multi-line
>* comment.
>*/
> 
> > +   if (!efi_guidcmp(guid, SMBIOS_TABLE_GUID))
> > +   ((efi_config_table_64_t *)p)->table = esdata->smbios;
> > +   p += sz;
> > +   }
> > +   early_iounmap(tablep, nr_tables * sz);
> > +   return 0;
> > +}
> > +
> >  void __init efi_init(void)
> >  {
> > efi_char16_t *c16;
> > @@ -676,6 +750,9 @@ void __init efi_init(void)
> > efi.systab->hdr.revision >> 16,
> > efi.systab->hdr.revision & 0x, vendor);
> >  
> > +   if (esdata && esdata->smbios)
> > +   efi_reuse_config(efi.systab->tables, efi.systab->nr_tables);
> > +
> 
> Would it make sense to move the ->smbios check inside efi_reuse_config()
> in case we need to extend the number of tables in the future?

Good suggestion, will do.

> 
> > if (efi_config_init(arch_tables))
> > return;
> >  
> > @@ -886,6 +963,43 @@ ret:
> >  }
> >  
> >  /*
> > + * map efi regions which was passed via setup_data
> > + * the virt_addr is a fixed addr which was used in
> > + * 1st kernel of kexec boot.
> > 

[PATCH] net: mac80211: tx.c: be sure of 'sdata->vif.type' must be NL80211_IFTYPE_AP when be in NL80211_IFTYPE_AP case

2013-11-26 Thread Chen Gang
In next-20131122 tree, if "sdata->vif.type != NL80211_IFTYPE_AP",
'chanctx_conf' will be not initialized, so need check it. Related
warning (with allmodconfig under hexagon):

CC [M]  net/mac80211/tx.o
  net/mac80211/tx.c: In function 'ieee80211_subif_start_xmit':
  net/mac80211/tx.c:1827:27: warning: 'chanctx_conf' may be used uninitialized 
in this function [-Wuninitialized]


Signed-off-by: Chen Gang 
---
 net/mac80211/tx.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index c558b24..f3245d6 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1814,8 +1814,9 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff 
*skb,
break;
/* fall through */
case NL80211_IFTYPE_AP:
-   if (sdata->vif.type == NL80211_IFTYPE_AP)
-   chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
+   if (sdata->vif.type != NL80211_IFTYPE_AP)
+   goto fail_rcu;
+   chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
if (!chanctx_conf)
goto fail_rcu;
fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS);
-- 
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] ATA: Fix port removal ordering

2013-11-26 Thread Jingoo Han
On Monday, November 25, 2013 9:19 PM, Rafael J. Wysocki wrote:
> 
> From: Rafael J. Wysocki 
> 
> After commit bcdde7e221a8 (sysfs: make __sysfs_remove_dir() recursive)
> Mika Westerberg sees traces analogous to the one below in Thunderbolt
> hot-remove testing:
> 
>  WARNING: CPU: 0 PID: 4 at fs/sysfs/group.c:214 sysfs_remove_group+0xc6/0xd0()
>  sysfs group 81c6f1e0 not found for kobject 'host7'
>  Modules linked in:
>  CPU: 0 PID: 4 Comm: kworker/0:0 Not tainted 3.12.0+ #13
>  Hardware name:  /D33217CK, BIOS 
> GKPPT10H.86A.0042.2013.0422.1439 04/22/2013
>  Workqueue: kacpi_hotplug acpi_hotplug_work_fn
>   0009 8801002459b0 817daab1 8801002459f8
>   8801002459e8 810436b8  81c6f1e0
>   88006d440358 88006d440188 88006e8b4c28 880100245a48
>  Call Trace:
>   [] dump_stack+0x45/0x56
>   [] warn_slowpath_common+0x78/0xa0
>   [] warn_slowpath_fmt+0x47/0x50
>   [] ? sysfs_get_dirent_ns+0x49/0x70
>   [] sysfs_remove_group+0xc6/0xd0
>   [] dpm_sysfs_remove+0x3e/0x50
>   [] device_del+0x40/0x1b0
>   [] device_unregister+0xd/0x20
>   [] scsi_remove_host+0xba/0x110
>   [] ata_host_detach+0xc6/0x100
>   [] ata_pci_remove_one+0x18/0x20
>   [] pci_device_remove+0x28/0x60
>   [] __device_release_driver+0x64/0xd0
>   [] device_release_driver+0x1e/0x30
>   [] bus_remove_device+0xf7/0x140
>   [] device_del+0x121/0x1b0
>   [] pci_stop_bus_device+0x94/0xa0
>   [] pci_stop_bus_device+0x3b/0xa0
>   [] pci_stop_bus_device+0x3b/0xa0
>   [] pci_stop_and_remove_bus_device+0xd/0x20
>   [] trim_stale_devices+0x73/0xe0
>   [] trim_stale_devices+0xbb/0xe0
>   [] trim_stale_devices+0xbb/0xe0
>   [] acpiphp_check_bridge+0x7e/0xd0
>   [] hotplug_event+0xcd/0x160
>   [] hotplug_event_work+0x25/0x60
>   [] acpi_hotplug_work_fn+0x17/0x22
>   [] process_one_work+0x17a/0x430
>   [] worker_thread+0x119/0x390
>   [] ? manage_workers.isra.25+0x2a0/0x2a0
>   [] kthread+0xcd/0xf0
>   [] ? kthread_create_on_node+0x180/0x180
>   [] ret_from_fork+0x7c/0xb0
>   [] ? kthread_create_on_node+0x180/0x180
> 
> The source of this problem is that SCSI hosts are removed from
> ATA ports after calling ata_tport_delete() which removes the
> port's sysfs directory, among other things.  Now, after commit
> bcdde7e221a8, the sysfs directory is removed along with all of
> its subdirectories that include the SCSI host's sysfs directory
> and its subdirectories at this point.  Consequently, when
> device_del() is finally called for any child device of the SCSI
> host and tries to remove its "power" group (which is already
> gone then), it triggers the above warning.
> 
> To make the warnings go away, change the removal ordering in
> ata_port_detach() so that the SCSI host is removed from the
> port before ata_tport_delete() is called.
> 
> References: https://bugzilla.kernel.org/show_bug.cgi?id=65281
> Reported-and-tested-by: Mika Westerberg 
> Signed-off-by: Rafael J. Wysocki 

Tested-by: Jingoo Han 

I tested this patch on Exynos platform with PCI-SATA card.
I checked that the kernel panic is resolved.
Thank you.

Best regards,
Jingoo Han

> ---
> 
> Hi,
> 
> This along with https://patchwork.kernel.org/patch/3226081/ makes
> all of the warnings observed by Mika go away without the patch at
> https://patchwork.kernel.org/patch/3201841/ applied.
> 
> Thanks,
> Rafael
> 
> ---
>  drivers/ata/libata-core.c |3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> Index: linux-pm/drivers/ata/libata-core.c
> ===
> --- linux-pm.orig/drivers/ata/libata-core.c
> +++ linux-pm/drivers/ata/libata-core.c
> @@ -6304,10 +6304,9 @@ static void ata_port_detach(struct ata_p
>   for (i = 0; i < SATA_PMP_MAX_PORTS; i++)
>   ata_tlink_delete(>pmp_link[i]);
>   }
> - ata_tport_delete(ap);
> -
>   /* remove the associated SCSI host */
>   scsi_remove_host(ap->scsi_host);
> + ata_tport_delete(ap);
>  }
> 
>  /**
> 
> --

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


Re: [PATCH v3 1/6] watchdog: davinci: change driver to use WDT core

2013-11-26 Thread Sekhar Nori
On Monday 25 November 2013 07:34 PM, Ivan Khoronzhuk wrote:
> To reduce code duplicate and increase code readability use WDT core
> code to handle WDT interface.
> 
> Remove io_lock as the WDT core uses mutex to lock each wdt device.
> Remove wdt_state as the WDT core tracks state with its own variable.
> 
> The watchdog_init_timeout() can read timeout value from timeout-sec
> property if the passed value is out of bounds. The heartbeat is
> initialized in next way. If heartbeat is not set thought module
> parameter, try to read it's value from WDT node timeout-sec property.
> If node has no one, use default value.
> 
> The heartbeat is hold in wdd->timeout by WDT core, so use it in
> order to set timeout period.
> 
> Signed-off-by: Ivan Khoronzhuk 
> Acked-by: Santosh Shilimkar 
> Reviewed-by: Guenter Roeck 

So this still causes a regression because the clk_get()
fails due to the changed device name. Please fold this
patch in (tested on DM365, compiled on rest).

Also, the change in device name (while needed) does not seem
to be related to usage of wdt core. Can you may be split
that change into a separate patch?

Thanks,
Sekhar

---8<---
diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
index 0813b51..82c6013 100644
--- a/arch/arm/mach-davinci/da830.c
+++ b/arch/arm/mach-davinci/da830.c
@@ -385,7 +385,7 @@ static struct clk_lookup da830_clks[] = {
CLK(NULL,   "pll0_sysclk7", _sysclk7),
CLK("i2c_davinci.1",NULL,   _clk),
CLK(NULL,   "timer0",   _0_clk),
-   CLK("watchdog", NULL,   _1_clk),
+   CLK("davinci-wdt",  NULL,   _1_clk),
CLK(NULL,   "arm_rom",  _rom_clk),
CLK(NULL,   "scr0_ss",  _ss_clk),
CLK(NULL,   "scr1_ss",  _ss_clk),
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 352984e..ccb2f58 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -443,7 +443,7 @@ static struct clk_lookup da850_clks[] = {
CLK(NULL,   "pll1_sysclk3", _sysclk3),
CLK("i2c_davinci.1",NULL,   _clk),
CLK(NULL,   "timer0",   _0_clk),
-   CLK("watchdog", NULL,   _1_clk),
+   CLK("davinci-wdt",  NULL,   _1_clk),
CLK(NULL,   "arm_rom",  _rom_clk),
CLK(NULL,   "tpcc0",_clk),
CLK(NULL,   "tptc0",_clk),
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index ef9ff1f..4bb8132 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -375,7 +375,7 @@ static struct clk_lookup dm355_clks[] = {
CLK(NULL, "pwm3", _clk),
CLK(NULL, "timer0", _clk),
CLK(NULL, "timer1", _clk),
-   CLK("watchdog", NULL, _clk),
+   CLK("davinci-wdt", NULL, _clk),
CLK(NULL, "timer3", _clk),
CLK(NULL, "rto", _clk),
CLK(NULL, "usb", _clk),
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index 1511a06..b0e8df3 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -473,7 +473,7 @@ static struct clk_lookup dm365_clks[] = {
CLK(NULL, "pwm3", _clk),
CLK(NULL, "timer0", _clk),
CLK(NULL, "timer1", _clk),
-   CLK("watchdog", NULL, _clk),
+   CLK("davinci-wdt", NULL, _clk),
CLK(NULL, "timer3", _clk),
CLK(NULL, "usb", _clk),
CLK("davinci_emac.1", NULL, _clk),
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index 143a321..aeaad95 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -322,7 +322,7 @@ static struct clk_lookup dm644x_clks[] = {
CLK(NULL, "pwm2", _clk),
CLK(NULL, "timer0", _clk),
CLK(NULL, "timer1", _clk),
-   CLK("watchdog", NULL, _clk),
+   CLK("davinci-wdt", NULL, _clk),
CLK(NULL, NULL, NULL),
 };
 
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index 2a73f29..a56779b 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -356,7 +356,7 @@ static struct clk_lookup dm646x_clks[] = {
CLK(NULL, "pwm1", _clk),
CLK(NULL, "timer0", _clk),
CLK(NULL, "timer1", _clk),
-   CLK("watchdog", NULL, _clk),
+   CLK("davinci-wdt", NULL, _clk),
CLK("palm_bk3710", NULL, _clk),
CLK(NULL, "vpif0", _clk),
CLK(NULL, "vpif1", _clk),

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


Re: [PATCH -next] platform/chrome: unregister platform driver/device when module exit

2013-11-26 Thread Olof Johansson
On Wed, Nov 27, 2013 at 11:34:58AM +0800, Wei Yongjun wrote:
> From: Wei Yongjun 
> 
> We have registered platform driver and device when module
> init, and need unregister them when module exit.
> 
> Signed-off-by: Wei Yongjun 
> ---

Applied, thanks. I suppose it might make sense to move the i2c deregistration
to a remove function for the platform driver at some point, but this will do.


-Olof
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] drivers: staging: media: go7007: go7007-usb.c use pr_*() instead of dev_*() before 'go' initialized in go7007_usb_probe()

2013-11-26 Thread Chen Gang
On 11/27/2013 12:03 PM, Greg KH wrote:
> On Wed, Nov 27, 2013 at 11:48:08AM +0800, Chen Gang wrote:
>> dev_*() assumes 'go' is already initialized, so need use pr_*() instead
>> of before 'go' initialized. Related warning (with allmodconfig under
>> hexagon):
>>
>> CC [M]  drivers/staging/media/go7007/go7007-usb.o
>>   drivers/staging/media/go7007/go7007-usb.c: In function 'go7007_usb_probe':
>>   drivers/staging/media/go7007/go7007-usb.c:1060:2: warning: 'go' may be 
>> used uninitialized in this function [-Wuninitialized]
>>
>> Also remove useless code after 'return' statement.
> 
> This should all be fixed in my staging-linus branch already, right?  No
> need for this anymore from what I can tell, sorry.
> 

That's all right (in fact don't need sorry).  :-)

And excuse me, I am not quite familiar upstream kernel version merging
and branches. Is it still better/suitable/possible to sync some bug fix
patches from staging brach to next brach?


Thanks.
-- 
Chen Gang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [PATCHv1] ASoC: SGTL5000: Fix kernel failed while getting regulator consumers

2013-11-26 Thread Li Xiubo

> > else {
> > ret = sgtl5000_replace_vddd_with_ldo(codec);
> >
> You could fix the coding style issue (braces on both branches of the if
> clause) here too.
> 
> 
Yes, I will.

Thanks.


N�r��yb�X��ǧv�^�)޺{.n�+{zX����ܨ}���Ơz�:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a���
0��h���i

Re: [PATCH 3.4 00/39] 3.4.71-stable review

2013-11-26 Thread Guenter Roeck

On 11/26/2013 04:56 PM, Greg Kroah-Hartman wrote:

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

Responses should be made by Fri Nov 29 00:56:06 UTC 2013.
Anything received after that time might be too late.


Build results:
total: 103 pass: 89 skipped: 10 fail: 4

qemu tests all passed.

Results match the results seen previously and are as expected.

Guenter



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


Re: [PATCH 3.11 00/36] 3.11.10-stable review

2013-11-26 Thread Guenter Roeck

On 11/26/2013 10:12 AM, Greg Kroah-Hartman wrote:

-
NOTE:
   This is the LAST 3.11.x kernel I will be releasing.  Everyone should
   be moving to the 3.12.x series at this point in time.  After this
   kernel is released, 3.11 will be end-of-life.
-

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

Responses should be made by Thu Nov 28 18:08:16 UTC 2013.
Anything received after that time might be too late.



Build results:
total: 110 pass: 108 skipped: 2 fail: 0

qemu tests all passed.

Perfect results.

Guenter

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


Re: [PATCH 3.12 000/116] 3.12.2-stable review

2013-11-26 Thread Guenter Roeck

On 11/26/2013 04:56 PM, Greg Kroah-Hartman wrote:

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

Responses should be made by Fri Nov 29 00:57:18 UTC 2013.
Anything received after that time might be too late.



Build results:
total: 110 pass: 107 skipped: 3 fail: 0

qemu tests all passed.

Perfect results.

Thanks,
Guenter

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


Re: [PATCH 07/12] memory: davinci-aemif: introduce AEMIF driver

2013-11-26 Thread Sekhar Nori
On Tuesday 26 November 2013 11:14 PM, ivan.khoronzhuk wrote:

>>> +static int davinci_aemif_probe(struct platform_device *pdev)
>>> +{
>>> +   int ret  = -ENODEV, i;
>>> +   struct resource *res;
>>> +   struct device *dev = >dev;
>>> +   struct device_node *np = dev->of_node;
>>> +
>>> +   if (np == NULL)
>>> +   return 0;
>>> +
>>> +   if (aemif) {
>>> +   dev_err(dev, "davinci_aemif driver is in use currently\n");
>>> +   return -EBUSY;
>>> +   }
>>
>> Why expressly prevent multiple AEMIF devices? Its entirely conceivable
>> to have two memories like NAND and NOR flash connect to two different
>> AEMIF interfaces.
>>
> 
> It can be, but I'm not sure if it is needed. Currently I've not seen case 
> where
> more than 2 cses were used, I mean we have 2 cs free, why do we need the 
> second AEMIF
> controller?

One usual reason is pinmux constraints. Its probably not a concern on
the device you are working with right now but as devices get smaller,
functionality on pins is multiplexed to handle multiple different use cases.

Thanks,
Sekhar
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 00/23] mtd: st_spi_fsm: Add new device

2013-11-26 Thread Brian Norris
+ Huang, Mark, SPI list

There seem to be multiple efforts going on that are vaguely related. I'd
like to see more of the same people appearing on the CC list, to keep
better coordinated.

On that topic, is the SPI dev list relevant, or would anybody working on
the intersection of SPI and MTD be on the MTD list?

On Fri, Nov 22, 2013 at 04:22:37PM +, Lee Jones wrote:
> The first bunch of these patches have been on the MLs before, but 
> didn't receive a great deal of attention for the most part. We are
> a little more featureful this time however. We can now successfully
> setup and configure the N25Q256. We still can't read/write/erase
> it though. I'll start work on that next week and will provide it in
> the next instalment.

What happened to integrating a SPI NOR framework? I see you copied some
of the m25p80 commands, but you don't share them with m25p80. I also
understand your argument (from the first version of this patch series)
that much of the actual controller operation is not shared with m25p80,
but you'd be surprised how this might evolve. There are several others
with QSPI hardware that are trying to get patches merged, some of whom
(Huang, at least) are actively submitting patches to help with this
abstraction.

Now, I haven't had a lot of time yet to look at both yours and Huang's
work and see what, if anything, can be shared (will do soon). But I
think you need to be aware.

BTW, can you include version markers (i.e., [PATCH v2 X/Y]) in the
subject from now on?

Brian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] drivers: staging: media: go7007: go7007-usb.c use pr_*() instead of dev_*() before 'go' initialized in go7007_usb_probe()

2013-11-26 Thread Greg KH
On Wed, Nov 27, 2013 at 11:48:08AM +0800, Chen Gang wrote:
> dev_*() assumes 'go' is already initialized, so need use pr_*() instead
> of before 'go' initialized. Related warning (with allmodconfig under
> hexagon):
> 
> CC [M]  drivers/staging/media/go7007/go7007-usb.o
>   drivers/staging/media/go7007/go7007-usb.c: In function 'go7007_usb_probe':
>   drivers/staging/media/go7007/go7007-usb.c:1060:2: warning: 'go' may be used 
> uninitialized in this function [-Wuninitialized]
> 
> Also remove useless code after 'return' statement.

This should all be fixed in my staging-linus branch already, right?  No
need for this anymore from what I can tell, sorry.

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


Re: [PATCH v6 4/6] gpio: davinci: add OF support

2013-11-26 Thread Sekhar Nori
On Wednesday 27 November 2013 01:11 AM, Grygorii Strashko wrote:
> On 11/26/2013 07:12 PM, Sekhar Nori wrote:
>> On Tuesday 26 November 2013 06:03 PM, Grygorii Strashko wrote:
>>> On 11/25/2013 01:00 PM, Sekhar Nori wrote:
 On Thursday 21 November 2013 11:45 PM, Prabhakar Lad wrote:
> From: KV Sujith 
>
> This patch adds OF parser support for davinci gpio
> driver and also appropriate documentation in gpio-davinci.txt
> located at Documentation/devicetree/bindings/gpio/.
>
> Acked-by: Linus Walleij 
> Acked-by: Rob Herring 
> Signed-off-by: KV Sujith 
> Signed-off-by: Philip Avinash 
> [prabhakar.cse...@gmail.com: simplified the OF code, removed
> unnecessary DT property and also simplified
> the commit message]
> Signed-off-by: Lad, Prabhakar 
> ---
>.../devicetree/bindings/gpio/gpio-davinci.txt  |   41
> ++
>drivers/gpio/gpio-davinci.c|   57
> ++--
>2 files changed, 95 insertions(+), 3 deletions(-)
>create mode 100644
> Documentation/devicetree/bindings/gpio/gpio-davinci.txt
>
> diff --git
> a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt
> b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt
> new file mode 100644
> index 000..a2e839d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt
> @@ -0,0 +1,41 @@
> +Davinci GPIO controller bindings
> +
> +Required Properties:
> +- compatible: should be "ti,dm6441-gpio"
> +
> +- reg: Physical base address of the controller and the size of
> memory mapped
> +   registers.
> +
> +- gpio-controller : Marks the device node as a gpio controller.
> +
> +- interrupt-parent: phandle of the parent interrupt controller.
> +
> +- interrupts: Array of GPIO interrupt number. Only banked or
> unbanked IRQs are
> +  supported at a time.

 If this is true..

> +
> +- ti,ngpio: The number of GPIO pins supported.
> +
> +- ti,davinci-gpio-unbanked: The number of GPIOs that have an
> individual interrupt
> + line to processor.

 .. then why do you need to maintain this separately? Number of elements
 in interrupts property should give you this answer, no?

 There can certainly be devices (past and future) which use a mixture of
 banked and unbanked IRQs. So a binding which does not take care of this
 is likely to change in future and that is a problem since it brings in
 backward compatibility of the binding into picture.

 The right thing would be to define the DT node per-bank similar to what
 is done on OMAP rather than for all banks together. That way there can
 be a separate property which determines whether that bank supports
 direct-mapped or banked IRQs (or that could be inferred if the
 number of
 tuples in the interrupts property is more than one).
>>>
>>> Number of IRQ can't be simply used to determine type of IRQ - need to
>>> handle IRQ names,
>>> because each bank(32 gpios) may have up to 2 banked IRQs (one per 16
>>> GPIO).
>>
>> Okay. That's why I inserted that comment in parenthesis :)
>>
>>>
>>> Few things here:
>>> - The mixed banked/unbanked functionality has never been supported
>>> before.
>>
>> True. I actually misread the driver before.
>>
>>> - The Davinci GPIO IP is different from OMAP and has common
>>>control registers for all banks.
>>
>> Well the only common register I can see is BINTEN - bank interrupt
>> enable. This register can simply be initialized to enable interrupts
>> from all banks possible as until the rising and falling edge triggers
>> are programmed, there wont be any actual interrupts generated.
>>
>>> - The proposed approach is more less easy to implement for DT case,
>>> but for not-DT
>>>case - the platform data will need to be changed significantly (.
>>>So, from this point of view, that would be a big change (actually
>>> the total driver rewriting).
>>
>> Well, I certainly don't think its a complete driver re-write. It will
>> take a bit of effort agreed, but I think the driver will also come out a
>> lot cleaner.
>>
>> Honestly, I am not so much worried about the kernel code here. Its the
>> bindings I am worried about. Once the bindings go in assuming there will
>> never be banked and unbanked GPIO IRQs on the same SoC, changing them to
>> do something else will be very painful with the need to keep backward
>> compatibility and support for both semantics.
>>
>> That said, because there is no present hardware which needs both banked
>> and unbanked at the same time, I wont press for this to be done
>> endlessly.
>>
>>> Do you have any thoughts about how it can be done in a simpler way?
>>
>> I don't know if there is a "simpler" way, but I don't think there is too
>> much 

[PATCH v2] drivers: staging: media: go7007: go7007-usb.c use pr_*() instead of dev_*() before 'go' initialized in go7007_usb_probe()

2013-11-26 Thread Chen Gang
dev_*() assumes 'go' is already initialized, so need use pr_*() instead
of before 'go' initialized. Related warning (with allmodconfig under
hexagon):

CC [M]  drivers/staging/media/go7007/go7007-usb.o
  drivers/staging/media/go7007/go7007-usb.c: In function 'go7007_usb_probe':
  drivers/staging/media/go7007/go7007-usb.c:1060:2: warning: 'go' may be used 
uninitialized in this function [-Wuninitialized]

Also remove useless code after 'return' statement.


Signed-off-by: Chen Gang 
---
 drivers/staging/media/go7007/go7007-usb.c |   11 ---
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/media/go7007/go7007-usb.c 
b/drivers/staging/media/go7007/go7007-usb.c
index 58684da..2423643 100644
--- a/drivers/staging/media/go7007/go7007-usb.c
+++ b/drivers/staging/media/go7007/go7007-usb.c
@@ -1057,7 +1057,7 @@ static int go7007_usb_probe(struct usb_interface *intf,
char *name;
int video_pipe, i, v_urb_len;
 
-   dev_dbg(go->dev, "probing new GO7007 USB board\n");
+   pr_debug("probing new GO7007 USB board\n");
 
switch (id->driver_info) {
case GO7007_BOARDID_MATRIX_II:
@@ -1097,13 +1097,10 @@ static int go7007_usb_probe(struct usb_interface *intf,
board = _px_tv402u;
break;
case GO7007_BOARDID_LIFEVIEW_LR192:
-   dev_err(go->dev, "The Lifeview TV Walker Ultra is not 
supported. Sorry!\n");
+   pr_err("The Lifeview TV Walker Ultra is not supported. 
Sorry!\n");
return -ENODEV;
-   name = "Lifeview TV Walker Ultra";
-   board = _lifeview_lr192;
-   break;
case GO7007_BOARDID_SENSORAY_2250:
-   dev_info(go->dev, "Sensoray 2250 found\n");
+   pr_info("Sensoray 2250 found\n");
name = "Sensoray 2250/2251";
board = _sensoray_2250;
break;
@@ -1112,7 +1109,7 @@ static int go7007_usb_probe(struct usb_interface *intf,
board = _ads_usbav_709;
break;
default:
-   dev_err(go->dev, "unknown board ID %d!\n",
+   pr_err("unknown board ID %d!\n",
(unsigned int)id->driver_info);
return -ENODEV;
}
-- 
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V4] cpufreq: suspend governors on system suspend/hibernate

2013-11-26 Thread Viresh Kumar
This patch adds cpufreq callbacks to dpm_{suspend|resume}_noirq() for handling
suspend/resume of cpufreq governors.

There are multiple problems that are fixed by this patch:
- Nishanth Menon (TI) found an interesting problem on his platform, OMAP. His 
board
  wasn't working well with suspend/resume as calls for removing non-boot CPUs
  was turning out into a call to drivers ->target() which then tries to play
  with regulators. But regulators and their I2C bus were already suspended and
  this resulted in a failure. Many platforms have such problems, samsung, tegra,
  etc.. They solved it with driver specific PM notifiers where they used to
  disable their driver's ->target() routine.
- Lan Tianyu (Intel) & Jinhyuk Choi (Broadcom) found another issue where
  tunables configuration for clusters/sockets with non-boot CPUs was getting
  lost after suspend/resume, as we were notifying governors with
  CPUFREQ_GOV_POLICY_EXIT on removal of the last cpu for that policy and so
  deallocating memory for tunables. This is also fixed with this patch as we
  don't allow any operation on Governors during suspend/resume now.

Reported-and-tested-by: Lan Tianyu 
Reported-and-tested-by: Nishanth Menon 
Reported-by: Jinhyuk Choi 
Signed-off-by: Viresh Kumar 
---

This is almost same as 1/6 of V3 version of this patchset:

https://lkml.org/lkml/2013/11/25/838

This is done to get some initial fixes for 3.13. These are already tested by
both the reporters of initial problems. Tegra/exynos/s5p will keep running their
PM notifiers until v3.14, as they are currently able to work with them..

 drivers/base/power/main.c |  3 +++
 drivers/cpufreq/cpufreq.c | 50 +++
 include/linux/cpufreq.h   |  8 
 3 files changed, 61 insertions(+)

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 1b41fca..e3219df 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -540,6 +541,7 @@ static void dpm_resume_noirq(pm_message_t state)
dpm_show_time(starttime, state, "noirq");
resume_device_irqs();
cpuidle_resume();
+   cpufreq_resume();
 }
 
 /**
@@ -955,6 +957,7 @@ static int dpm_suspend_noirq(pm_message_t state)
ktime_t starttime = ktime_get();
int error = 0;
 
+   cpufreq_suspend();
cpuidle_pause();
suspend_device_irqs();
mutex_lock(_list_mtx);
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 02d534d..b6c7821 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -47,6 +48,9 @@ static LIST_HEAD(cpufreq_policy_list);
 static DEFINE_PER_CPU(char[CPUFREQ_NAME_LEN], cpufreq_cpu_governor);
 #endif
 
+/* Flag to suspend/resume CPUFreq governors */
+static bool cpufreq_suspended;
+
 static inline bool has_target(void)
 {
return cpufreq_driver->target_index || cpufreq_driver->target;
@@ -1462,6 +1466,48 @@ static struct subsys_interface cpufreq_interface = {
.remove_dev = cpufreq_remove_dev,
 };
 
+/*
+ * Callbacks for suspending/resuming governors as some platforms can't change
+ * frequency after this point in suspend cycle. Because some of the devices
+ * (like: i2c, regulators, etc) they use for changing frequency are suspended
+ * quickly after this point.
+ */
+void cpufreq_suspend(void)
+{
+   struct cpufreq_policy *policy;
+
+   if (!has_target())
+   return;
+
+   pr_debug("%s: Suspending Governors\n", __func__);
+
+   list_for_each_entry(policy, _policy_list, policy_list)
+   if (__cpufreq_governor(policy, CPUFREQ_GOV_STOP))
+   pr_err("%s: Failed to stop governor for policy: %p\n",
+   __func__, policy);
+
+   cpufreq_suspended = true;
+}
+
+void cpufreq_resume(void)
+{
+   struct cpufreq_policy *policy;
+
+   if (!has_target())
+   return;
+
+   pr_debug("%s: Resuming Governors\n", __func__);
+
+   cpufreq_suspended = false;
+
+   list_for_each_entry(policy, _policy_list, policy_list)
+   if (__cpufreq_governor(policy, CPUFREQ_GOV_START) ||
+   __cpufreq_governor(policy,
+   CPUFREQ_GOV_LIMITS))
+   pr_err("%s: Failed to start governor for policy: %p\n",
+   __func__, policy);
+}
+
 /**
  * cpufreq_bp_suspend - Prepare the boot CPU for system suspend.
  *
@@ -1764,6 +1810,10 @@ static int __cpufreq_governor(struct cpufreq_policy 
*policy,
struct cpufreq_governor *gov = NULL;
 #endif
 
+   /* Don't start any governor operations if we are entering suspend */
+   if (cpufreq_suspended)
+   return 0;
+
if 

[PATCH] drivers: staging: ft1000: ft1000-usb: ft1000_debug.c: check return value of get_user() in ft1000_ioctl()

2013-11-26 Thread Chen Gang
get_user() may fail and cause 'msgsz' uninitialized, so need give a
check. The related warning (with allmodconfig under hexagon):

CC [M]  drivers/staging/ft1000/ft1000-usb/ft1000_debug.o
  drivers/staging/ft1000/ft1000-usb/ft1000_debug.c: In function 'ft1000_ioctl':
  include/uapi/linux/swab.h:53:9: warning: 'msgsz' may be used uninitialized in 
this function [-Wuninitialized]
  drivers/staging/ft1000/ft1000-usb/ft1000_debug.c:533:17: note: 'msgsz' was 
declared here
 

Signed-off-by: Chen Gang 
---
 drivers/staging/ft1000/ft1000-usb/ft1000_debug.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c 
b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
index 68a55ce..ffdc7f5 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
@@ -560,6 +560,8 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
 
 /* Get the length field to see how many bytes to copy */
 result = get_user(msgsz, (__u16 __user *)argp);
+   if (result)
+   break;
 msgsz = ntohs(msgsz);
 /* DEBUG("FT1000:ft1000_ioctl: length of message = %d\n", 
msgsz); */
 
-- 
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] drivers: staging: media: go7007: go7007-usb.c use pr_*() instead of dev_*() before 'go' initialized in go7007_usb_probe()

2013-11-26 Thread Chen Gang
On 11/27/2013 11:21 AM, Joe Perches wrote:
> On Wed, 2013-11-27 at 11:17 +0800, Chen Gang wrote:
>> dev_*() assumes 'go' is already initialized, so need use pr_*() instead
>> of before 'go' initialized.
> []
>> diff --git a/drivers/staging/media/go7007/go7007-usb.c 
>> b/drivers/staging/media/go7007/go7007-usb.c
> []
>> @@ -1057,7 +1057,7 @@ static int go7007_usb_probe(struct usb_interface *intf,
>>  char *name;
>>  int video_pipe, i, v_urb_len;
>>  
>> -dev_dbg(go->dev, "probing new GO7007 USB board\n");
>> +pr_devel("probing new GO7007 USB board\n");
> 
> pr_devel is commonly compiled out completely unless DEBUG is #defined.
> You probably want to use pr_debug here.
>  
> 

Oh, yes, it is my fault, I will send patch v2.  :-)


Thanks.
-- 
Chen Gang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] MIPS: Alchemy: add missing platform_set_drvdata() in au1550nd_probe()

2013-11-26 Thread Brian Norris
Hi Jingoo,

On Wed, Nov 27, 2013 at 09:14:18AM +0900, Jingoo Han wrote:
> On Wednesday, November 27, 2013 8:50 AM, Brian Norris wrote:
> > On Mon, Nov 11, 2013 at 02:18:29PM +0800, Wei Yongjun wrote:
> > > From: Wei Yongjun 
> > >
> > > Add missing platform_set_drvdata() in au1550nd_probe(), otherwise
> > > calling platform_get_drvdata() in remove returns NULL.
> > 
> > An alternative solution: just allocate ctx with devm_kzalloc().Then you
> > don't have to kfree() it at all.
> 
> Even if devm_kzalloc() is used, missing platform_set_drvdata() will
> be still necessary.
> 
> static int au1550nd_remove(struct platform_device *pdev)
> {
>   struct au1550nd_ctx *ctx = platform_get_drvdata(pdev);
>   .
> 
>   nand_release(>info);
> 
> 'ctx' is still used. Also, in order to use 'ctx',
> platform_get_drvdata(pdev) should be called.

Ah, I overlooked that. Thanks. In that case, you still have to do
something like this patch, and devm_kzalloc() can be left for another
day (or not done at all).

> > 
> > I don't mind one solution over the other too much. Let me know which
> > you'd prefer.
> > 
> > > Signed-off-by: Wei Yongjun 
> > > ---
> > >  drivers/mtd/nand/au1550nd.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > diff --git a/drivers/mtd/nand/au1550nd.c b/drivers/mtd/nand/au1550nd.c
> > > index ae8dd7c..909b673 100644
> > > --- a/drivers/mtd/nand/au1550nd.c
> > > +++ b/drivers/mtd/nand/au1550nd.c
> > > @@ -480,6 +480,8 @@ static int au1550nd_probe(struct platform_device 
> > > *pdev)
> > >
> > >   mtd_device_register(>info, pd->parts, pd->num_parts);
> > >
> > > + platform_set_drvdata(pdev, ctx);
> > > +
> > 
> > Personally, I'd choose to call platform_set_drvdata() earlier in the
> > probe routine (e.g., immediately after its allocation), in case we end
> > up calling platform_get_drvdata() from some sub-routine in the future.
> 
> Do you mean the following?
> But, most drivers calls platform_set_drvdata() later in the probe routine.

I wouldn't say "most." An unscientific survey seemed to show some
variation, with no clear pattern.

> static int au1550nd_probe(struct platform_device *pdev)
> {
> struct au1550nd_platdata *pd;
> struct au1550nd_ctx *ctx;
> struct nand_chip *this;
> struct resource *r;
> int ret, cs;
> 
> pd = dev_get_platdata(>dev);
> if (!pd) {
> dev_err(>dev, "missing platform data\n");
> return -ENODEV;
> }
> 
> ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
> if (!ctx) {
> dev_err(>dev, "no memory for NAND context\n");
> return -ENOMEM;
> }
> 
> + platform_set_drvdata(pdev, ctx);
> +

Yes, that looks better to me.

Brian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 -next] platform/chrome: unregister platform driver/device when module exit

2013-11-26 Thread Wei Yongjun
From: Wei Yongjun 

We have registered platform driver and device when module
init, and need unregister them when module exit.

Signed-off-by: Wei Yongjun 
---
 drivers/platform/chrome/chromeos_laptop.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/platform/chrome/chromeos_laptop.c 
b/drivers/platform/chrome/chromeos_laptop.c
index 446ef0f..7f3aad0 100644
--- a/drivers/platform/chrome/chromeos_laptop.c
+++ b/drivers/platform/chrome/chromeos_laptop.c
@@ -511,6 +511,9 @@ static void __exit chromeos_laptop_exit(void)
i2c_unregister_device(tp);
if (ts)
i2c_unregister_device(ts);
+
+   platform_device_unregister(cros_platform_device);
+   platform_driver_unregister(_platform_driver);
 }
 
 module_init(chromeos_laptop_init);

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


Re: [patch] mm: memcg: do not declare OOM from __GFP_NOFAIL allocations

2013-11-26 Thread David Rientjes
On Tue, 26 Nov 2013, David Rientjes wrote:

> On Fri, 22 Nov 2013, Johannes Weiner wrote:
> 
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index 13b9d0f..cc4f9cb 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -2677,6 +2677,9 @@ static int __mem_cgroup_try_charge(struct mm_struct 
> > *mm,
> > if (unlikely(task_in_memcg_oom(current)))
> > goto bypass;
> >  
> > +   if (gfp_mask & __GFP_NOFAIL)
> > +   oom = false;
> > +
> > /*
> >  * We always charge the cgroup the mm_struct belongs to.
> >  * The mm_struct's mem_cgroup changes on task migration if the
> 
> Sorry, I don't understand this.  What happens in the following scenario:
> 
>  - memory.usage_in_bytes == memory.limit_in_bytes,
> 
>  - memcg reclaim fails to reclaim memory, and
> 
>  - all processes (perhaps only one) attached to the memcg are doing one of
>the over dozen __GFP_NOFAIL allocations in the kernel?
> 
> How do we make forward progress if you cannot oom kill something?
> 

Ah, this is because of 3168ecbe1c04 ("mm: memcg: use proper memcg in limit 
bypass") which just bypasses all of these allocations and charges the root 
memcg.  So if allocations want to bypass memcg isolation they just have to 
be __GFP_NOFAIL?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] kernel/fork.c : remove local 'oldmm' and retval

2013-11-26 Thread Eric W. Biederman
Daeseok Youn  writes:

> From cec2f201f0dc99a33a58d9d1e0452140bb0993a1 Mon Sep 17 00:00:00 2001
> From: Daeseok Youn 
> Date: Wed, 27 Nov 2013 09:54:41 +0900
> Subject: [PATCH] kernel/fork.c : remove local 'oldmm' and retval
>
>  Local oldmm is used only for increaing mm_users field
>  in current->mm. When clone_flags have a CLONE_VM flag,
>  current->mm is assigning to local 'mm'.
>  Local retval is used only for returning -ENOMEM value.
>  When dup_mm() is failed, just return -ENOMEM.

You are making the generated code worse, and the source less
comprehensible.

You are adding additional exit points making it harder to analyze the
function.

You are introducing races and expense by not caching current->mm in
oldmm.

This looks like code churn for no good reason, and that will result in
worse code.

ick.

Eric

>  Signed-off-by: Daeseok Youn 
> ---
>  kernel/fork.c |   16 +---
>  1 file changed, 5 insertions(+), 11 deletions(-)
>
> diff --git a/kernel/fork.c b/kernel/fork.c
> index 728d5be..022a0af 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -857,8 +857,7 @@ fail_nocontext:
>  
>  static int copy_mm(unsigned long clone_flags, struct task_struct *tsk)
>  {
> - struct mm_struct *mm, *oldmm;
> - int retval;
> + struct mm_struct *mm;
>  
>   tsk->min_flt = tsk->maj_flt = 0;
>   tsk->nvcsw = tsk->nivcsw = 0;
> @@ -874,28 +873,23 @@ static int copy_mm(unsigned long clone_flags, struct 
> task_struct *tsk)
>*
>* We need to steal a active VM for that..
>*/
> - oldmm = current->mm;
> - if (!oldmm)
> + if (!current->mm)
>   return 0;
>  
>   if (clone_flags & CLONE_VM) {
> - atomic_inc(>mm_users);
> - mm = oldmm;
> + mm = current->mm;
> + atomic_inc(>mm_users);
>   goto good_mm;
>   }
>  
> - retval = -ENOMEM;
>   mm = dup_mm(tsk);
>   if (!mm)
> - goto fail_nomem;
> + return -ENOMEM;
>  
>  good_mm:
>   tsk->mm = mm;
>   tsk->active_mm = mm;
>   return 0;
> -
> -fail_nomem:
> - return retval;
>  }
>  
>  static int copy_fs(unsigned long clone_flags, struct task_struct *tsk)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 Nov 27

2013-11-26 Thread Stephen Rothwell
Hi all,

Changes since 20131126:

My fixes tree contains:

Revert "powerpc: Add CONFIG_CPU_LITTLE_ENDIAN kernel config option."

The staging tree gained conflicts against the staging.current tree.

Non-merge commits (relative to Linus' tree): 1374
 1681 files changed, 66133 insertions(+), 76823 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" as mentioned in the FAQ on the wiki
(see below).

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 and a
multi_v7_defconfig for arm. After the final fixups (if any), it is also
built with powerpc allnoconfig (32 and 64 bit), ppc44x_defconfig and
allyesconfig (minus CONFIG_PROFILE_ALL_BRANCHES - this fails its final
link) and i386, sparc, sparc64 and arm defconfig. These builds also have
CONFIG_ENABLE_WARN_DEPRECATED, CONFIG_ENABLE_MUST_CHECK and
CONFIG_DEBUG_INFO disabled when necessary.

Below is a summary of the state of the merge.

I am currently merging 210 trees (counting Linus' and 29 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.

There is a wiki covering stuff to do with linux-next at
http://linux.f-seidel.de/linux-next/pmwiki/ .  Thanks to Frank Seidel.

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

$ git checkout master
$ git reset --hard stable
Merging origin/master (0e4b0743bbe5 Merge tag 'fixes-for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc)
Merging fixes/master (f5331539eb90 Revert "powerpc: Add 
CONFIG_CPU_LITTLE_ENDIAN kernel config option.")
Merging kbuild-current/rc-fixes (19514fc665ff arm, kbuild: make "make install" 
not depend on vmlinux)
Merging arc-current/for-curr (97bc386fc12d ARC: Add guard macro to 
uapi/asm/unistd.h)
Merging arm-current/fixes (476d1c03d202 ARM: dma-mapping: check DMA mask 
against available memory)
Merging m68k-current/for-linus (77a42796786c m68k: Remove deprecated 
IRQF_DISABLED)
Merging metag-fixes/fixes (3b2f64d00c46 Linux 3.11-rc2)
Merging powerpc-merge/merge (c13f20ac4832 powerpc/signals: Mark VSX not saved 
with small contexts)
Merging sparc/master (b4789b8e6be3 aacraid: prevent invalid pointer dereference)
Merging net/master (2c7a9dc16416 be2net: Avoid programming permenant MAC by 
BE3-R VFs)
Merging ipsec/master (be408cd3e1fe Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net)
Merging sound-current/for-linus (049da9e8f8fe Merge branch 'fix/firewire' into 
for-linus)
Merging pci-current/for-linus (4bff6749905d PCI: Move device_del() from 
pci_stop_dev() to pci_destroy_dev())
Merging wireless/master (d5aedd7e1b2f Merge branch 'for-john' of 
git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211)
Merging driver-core.current/driver-core-linus (027a485d12e0 sysfs: use a 
separate locking class for open files depending on mmap)
Merging tty.current/tty-linus (c42b4e6501cd Revert "n_gsm: race between ld 
close and gsmtty open")
Merging usb.current/usb-linus (043e3f834530 USB: serial: fix write 
memory-allocation flag)
Merging staging.current/staging-linus (cb45065428b7 staging: delete tidspbridge 
driver)
Merging char-misc.current/char-misc-linus (6ce4eac1f600 Linux 3.13-rc1)
Merging input-current/for-linus (e4cfb034e89a Input: keyboard - "keycode & 
KEY_MAX" changes some keycode values)
Merging md-current/for-linus (d47648fcf061 raid5: avoid finding "discard" 
stripe)
Merging crypto-current/master (6c5dc7f8afbd crypto: caam - Add missing Job Ring 
include)
Merging ide/master (c2f7d1e103ef ide: pmac: remove unnecessary 
pci_set_drvdata())
Merging dwmw2/master (5950f0803ca9 pcmcia: remove RPX board stuff)
Merging sh-current/sh-fixes-for-linus (44033109e99c SH: Convert out[bwl] macros 
to inline functions)
Merging devicetree-current/devicetree/merge (1931ee143b0a Revert "drivers: of: 
add initialization code for dma reserved memory")
Merging rr-fixes/fixes (f6537f2f0eba scripts/kallsyms: filter symbols not in 
kernel address space)
Merging mfd

Re: [PATCH] MAINTAINERS: add HSI subsystem

2013-11-26 Thread Greg Kroah-Hartman
On Wed, Nov 27, 2013 at 02:26:02AM +0100, Sebastian Reichel wrote:
> On Tue, Nov 26, 2013 at 04:19:09PM -0800, Greg Kroah-Hartman wrote:
> > On Wed, Nov 27, 2013 at 01:12:42AM +0100, Sebastian Reichel wrote:
> > > On Wed, Nov 27, 2013 at 12:30:48AM +0100, Linus Walleij wrote:
> > > > > +M: Sebastian Reichel 
> > > > > +S: Maintained
> > > > > +F: Documentation/hsi/
> > > > > +F: drivers/hsi/
> > > > > +F: include/linux/hsi/
> > > > > +F: include/uapi/linux/hsi/
> > > > 
> > > > Don't add directories that do not exist (yet).
> > > 
> > > Sorry, that was not my intention. The documentation path was
> > > supposed to be "Documentation/ABI/testing/sysfs-bus-hsi". The
> > > other directories should exist. I will send an updated patch.
> > > 
> > > Am I right, that this should go through Greg?
> > 
> > Why me?
> 
> As far as i know the change is supposed to go through the
> subsystem's git tree by default, but drivers/hsi is currently
> orphaned.
> 
> You were suggested by scripts/get_maintainer.pl, because you
> did some commits in drivers/hsi. You also maintain drivers/core
> and drivers/misc, so I thought you would be a good entry point.

Ok, if you have no other conduit, I'll be glad to do that for you, I do
it for lots of other "misc" driver subsystems like this.

So, feel free to resend this, with the correct include line, and I'll be
glad to queue it up.

thanks,

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


Re: [PATCH] drivers: staging: media: go7007: go7007-usb.c use pr_*() instead of dev_*() before 'go' initialized in go7007_usb_probe()

2013-11-26 Thread Joe Perches
On Wed, 2013-11-27 at 11:17 +0800, Chen Gang wrote:
> dev_*() assumes 'go' is already initialized, so need use pr_*() instead
> of before 'go' initialized.
[]
> diff --git a/drivers/staging/media/go7007/go7007-usb.c 
> b/drivers/staging/media/go7007/go7007-usb.c
[]
> @@ -1057,7 +1057,7 @@ static int go7007_usb_probe(struct usb_interface *intf,
>   char *name;
>   int video_pipe, i, v_urb_len;
>  
> - dev_dbg(go->dev, "probing new GO7007 USB board\n");
> + pr_devel("probing new GO7007 USB board\n");

pr_devel is commonly compiled out completely unless DEBUG is #defined.
You probably want to use pr_debug here.
 

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


Re: linux-next: manual merge of the staging tree with the staging.current tree

2013-11-26 Thread Greg KH
On Wed, Nov 27, 2013 at 01:01:44PM +1100, Stephen Rothwell wrote:
> Hi Greg,
> 
> Today's linux-next merge of the staging tree got conflicts in
> drivers/staging/tidspbridge/pmgr/cmm.c,
> drivers/staging/tidspbridge/pmgr/dbll.c,
> drivers/staging/tidspbridge/pmgr/dev.c,
> drivers/staging/tidspbridge/pmgr/dmm.c and
> drivers/staging/tidspbridge/pmgr/dspapi.c between commit cb45065428b7
> ("staging: delete tidspbridge driver") from the staging.current tree and
> various commits from the staging tree.
> 
> I just removed the files and can carry the fix as necessary (no action
> is required).

Thanks, that is the correct thing.

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


[PATCH] drivers: staging: media: go7007: go7007-usb.c use pr_*() instead of dev_*() before 'go' initialized in go7007_usb_probe()

2013-11-26 Thread Chen Gang
dev_*() assumes 'go' is already initialized, so need use pr_*() instead
of before 'go' initialized. Related warning (with allmodconfig under
hexagon):

CC [M]  drivers/staging/media/go7007/go7007-usb.o
  drivers/staging/media/go7007/go7007-usb.c: In function 'go7007_usb_probe':
  drivers/staging/media/go7007/go7007-usb.c:1060:2: warning: 'go' may be used 
uninitialized in this function [-Wuninitialized]

Also remove useless code after 'return' statement.


Signed-off-by: Chen Gang 
---
 drivers/staging/media/go7007/go7007-usb.c |   11 ---
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/media/go7007/go7007-usb.c 
b/drivers/staging/media/go7007/go7007-usb.c
index 58684da..30310e9 100644
--- a/drivers/staging/media/go7007/go7007-usb.c
+++ b/drivers/staging/media/go7007/go7007-usb.c
@@ -1057,7 +1057,7 @@ static int go7007_usb_probe(struct usb_interface *intf,
char *name;
int video_pipe, i, v_urb_len;
 
-   dev_dbg(go->dev, "probing new GO7007 USB board\n");
+   pr_devel("probing new GO7007 USB board\n");
 
switch (id->driver_info) {
case GO7007_BOARDID_MATRIX_II:
@@ -1097,13 +1097,10 @@ static int go7007_usb_probe(struct usb_interface *intf,
board = _px_tv402u;
break;
case GO7007_BOARDID_LIFEVIEW_LR192:
-   dev_err(go->dev, "The Lifeview TV Walker Ultra is not 
supported. Sorry!\n");
+   pr_err("The Lifeview TV Walker Ultra is not supported. 
Sorry!\n");
return -ENODEV;
-   name = "Lifeview TV Walker Ultra";
-   board = _lifeview_lr192;
-   break;
case GO7007_BOARDID_SENSORAY_2250:
-   dev_info(go->dev, "Sensoray 2250 found\n");
+   pr_info("Sensoray 2250 found\n");
name = "Sensoray 2250/2251";
board = _sensoray_2250;
break;
@@ -1112,7 +1109,7 @@ static int go7007_usb_probe(struct usb_interface *intf,
board = _ads_usbav_709;
break;
default:
-   dev_err(go->dev, "unknown board ID %d!\n",
+   pr_err("unknown board ID %d!\n",
(unsigned int)id->driver_info);
return -ENODEV;
}
-- 
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3 1/6] cpufreq: suspend governors on system suspend/hibernate

2013-11-26 Thread Viresh Kumar
On 27 November 2013 01:53, Rafael J. Wysocki  wrote:
> On Tuesday, November 26, 2013 07:56:19 AM Viresh Kumar wrote:
>> On 26 November 2013 04:59, Rafael J. Wysocki  wrote:

>> > This appears to be racy.  Is it really racy, or just seemingly?
>>
>> Why does it look racy to you? Userspace should be frozen by now,
>> policy_list should be stable as well as nobody would touch it.
>
> You're stopping governors while they may be in use in principle.  Do we have
> suitable synchronization in place for that?

At what point exactly in suspend cycle do we suspend timers and workqueues.
I thought userspace would be frozen by now and so would be the governors..
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] kernel/fork.c : remove local 'oldmm' and retval

2013-11-26 Thread Daeseok Youn
>From cec2f201f0dc99a33a58d9d1e0452140bb0993a1 Mon Sep 17 00:00:00 2001
From: Daeseok Youn 
Date: Wed, 27 Nov 2013 09:54:41 +0900
Subject: [PATCH] kernel/fork.c : remove local 'oldmm' and retval

 Local oldmm is used only for increaing mm_users field
 in current->mm. When clone_flags have a CLONE_VM flag,
 current->mm is assigning to local 'mm'.
 Local retval is used only for returning -ENOMEM value.
 When dup_mm() is failed, just return -ENOMEM.

 Signed-off-by: Daeseok Youn 
---
 kernel/fork.c |   16 +---
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index 728d5be..022a0af 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -857,8 +857,7 @@ fail_nocontext:
 
 static int copy_mm(unsigned long clone_flags, struct task_struct *tsk)
 {
-   struct mm_struct *mm, *oldmm;
-   int retval;
+   struct mm_struct *mm;
 
tsk->min_flt = tsk->maj_flt = 0;
tsk->nvcsw = tsk->nivcsw = 0;
@@ -874,28 +873,23 @@ static int copy_mm(unsigned long clone_flags, struct 
task_struct *tsk)
 *
 * We need to steal a active VM for that..
 */
-   oldmm = current->mm;
-   if (!oldmm)
+   if (!current->mm)
return 0;
 
if (clone_flags & CLONE_VM) {
-   atomic_inc(>mm_users);
-   mm = oldmm;
+   mm = current->mm;
+   atomic_inc(>mm_users);
goto good_mm;
}
 
-   retval = -ENOMEM;
mm = dup_mm(tsk);
if (!mm)
-   goto fail_nomem;
+   return -ENOMEM;
 
 good_mm:
tsk->mm = mm;
tsk->active_mm = mm;
return 0;
-
-fail_nomem:
-   return retval;
 }
 
 static int copy_fs(unsigned long clone_flags, struct task_struct *tsk)
-- 
1.7.9.5

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


Re: [PATCH V3 1/6] cpufreq: suspend governors on system suspend/hibernate

2013-11-26 Thread Viresh Kumar
On 27 November 2013 07:12, Rafael J. Wysocki  wrote:
> Anyway, if you did what I asked you to do and put the cpufreq suspend/resume
> into dpm_suspend/resume_noirq(), I'd probably take this for 3.13.  However,
> since you've decided to put those things somewhere else thus making the
> change much more intrusive, I can only queue it up for 3.14.
>
> This means I'm going to take the Tianyu's patch as a stop gap for 3.13.

There were design issues with that patch actually, as I pointed out earlier
(handling EXIT part in core and INIT in governors).. And so in case we
need to get something for v3.13, I will send a short version of this series
with callbacks from suspend_noirq.

Get that one instead.

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


Re: [PATCH v4 06/12] efi: export efi runtime memory mapping to sysfs

2013-11-26 Thread Dave Young
On 11/26/13 at 07:30pm, Matt Fleming wrote:
> On Tue, 26 Nov, at 01:57:51PM, Dave Young wrote:
> > kexec kernel will need exactly same mapping for
> > efi runtime memory ranges. Thus here export the
> > runtime ranges mapping to sysfs, kexec-tools
> > will assemble them and pass to 2nd kernel via
> > setup_data.
> > 
> > Introducing a new directly /sys/firmware/efi/runtime-map
> 
> I'm not sure why the word "directly" is used here?

should be directory, will fix.

> 
> > Just like /sys/firmware/memmap. Containing below attribute
> > in each file of that directory:
> > attribute  num_pages  phys_addr  type  virt_addr
> > 
> > It will not work for efi 32bit. Only x86_64 currently.
>  
> Actually, exporting the tables does work for 32-bit, right? It's just
> that kexec doesn't work for 32-bit EFI?

It does not make sense to export them for 32-bit because we do not
support kexec efi on 32-bit. Will change the description to below:

"kexec efi boot on 32-bit is not supported so I only export the tables
for 64-bit efi system."

> 
> > Matt: s/efi-runtime-map.c/runtime-map.c
> >   change dir name to runtime-map
> > update to use desc_size in efi_runtime_map
> > cleaup the code, add function efi_save_runtime_map
> > improve err handling
> > 
> > Signed-off-by: Dave Young 
> > ---
> >  .../ABI/testing/sysfs-firmware-efi-runtime-map |  45 +
> >  arch/x86/platform/efi/efi.c|  26 +++
> >  drivers/firmware/efi/Kconfig   |  10 ++
> >  drivers/firmware/efi/Makefile  |   1 +
> >  drivers/firmware/efi/efi.c |   3 +-
> >  drivers/firmware/efi/runtime-map.c | 199 
> > +
> >  include/linux/efi.h|   6 +
> >  7 files changed, 289 insertions(+), 1 deletion(-)
> >  create mode 100644 Documentation/ABI/testing/sysfs-firmware-efi-runtime-map
> >  create mode 100644 drivers/firmware/efi/runtime-map.c
> > 
> > diff --git a/Documentation/ABI/testing/sysfs-firmware-efi-runtime-map 
> > b/Documentation/ABI/testing/sysfs-firmware-efi-runtime-map
> > new file mode 100644
> > index 000..dab8d41
> > --- /dev/null
> > +++ b/Documentation/ABI/testing/sysfs-firmware-efi-runtime-map
> > @@ -0,0 +1,45 @@
> > +What:  /sys/firmware/efi/runtime-map/
> > +Date:  Oct 2013
> > +Contact:   Dave Young 
> > +Description:
> > +   Switching efi runtime services to virtual mode requires
> > +   that all efi memory ranges which has the runtime attribute
> > +   bit set to be mapped to virtual addresses.
> > +
> > +   In kexec kernel kernel can not entering virtual mode again
> > +   because there's a limitation that SetVirtualAddressMap can
> > +   only be called once for entering virtual mode. But kexec
> > +   kernel still need maintain same physical address to virtual
> > +   address mapping as the 1st kernel. The mappings are exported
> > +   to sysfs so userspace tools can reassemble them and pass them
> > +   into kexec kernel.
> 
> How about,
> 
>   "The efi runtime services can only be switched to virtual
>mode once without rebooting. The kexec kernel must maintain
>the same physical to virtual address mappings as the first
>kernel. The mappings are exported to sysfs so userspace tools
>can reassemble them and pass them into the kexec kernel."
> 
> ?

Excellent, will above.

> 
> > +   /sys/firmware/efi/runtim-map/ is what kernel export for
> 
>   ^^ runtime-map/

Will fix the typo.

Thanks for review
Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] cpufreq: Make sure CPU is running on a freq from freq-table

2013-11-26 Thread Viresh Kumar
On 27 November 2013 01:51, Rafael J. Wysocki  wrote:
> I was talking about the case when your
>
> __cpufreq_driver_target(policy, policy->cur - 1, CPUFREQ_RELATION_L);
>
> fails.  The other case is not really interesting.

Okay.. I actually thought the context of this chat is about "not fixing the
frequency silently". That's what Dirk pointed out, if I am not wrong.

And hence I also support the new pr_warn I have added in those cases.
But yes a WARN_ON() can be printed out in case
__cpufreq_driver_target() fails.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] drivers: staging: ft1000: ft1000-usb: initialize 'status' with STATUS_SUCCESS in request_code_segment()

2013-11-26 Thread Chen Gang
If "!bool_case", it returns unexpected value instead of STATUS_SUCCESS,
so need fix it, the related warning (with allmodconfig under hexagon):

CC [M]  drivers/staging/ft1000/ft1000-usb/ft1000_download.o
  drivers/staging/ft1000/ft1000-usb/ft1000_download.c: In function 
'request_code_segment':
  drivers/staging/ft1000/ft1000-usb/ft1000_download.c:581:6: warning: 'status' 
may be used uninitialized in this function [-Wuninitialized]


Signed-off-by: Chen Gang 
---
 .../staging/ft1000/ft1000-usb/ft1000_download.c|2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c 
b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
index 68ded17..15f3062 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
@@ -578,7 +578,7 @@ static int request_code_segment(struct ft1000_usb 
*ft1000dev, u16 **s_file,
 u8 **c_file, const u8 *endpoint, bool boot_case)
 {
long word_length;
-   int status;
+   int status = STATUS_SUCCESS;
 
/*DEBUG("FT1000:REQUEST_CODE_SEGMENT\n");i*/
word_length = get_request_value(ft1000dev);
-- 
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 RESEND] regulator: lp3971: Convert to devm_regulator_register

2013-11-26 Thread Axel Lin
Both num_regulators and **rdev are no longer required after this conversion,
thus remove them from struct lp3971.

Signed-off-by: Axel Lin 
---
Hi Mark,
This patch was sent on https://lkml.org/lkml/2013/11/13/34 .
Although you replied applied, it still not in your tree.
So here is a resend.

Axel
 drivers/regulator/lp3971.c | 43 ++-
 1 file changed, 6 insertions(+), 37 deletions(-)

diff --git a/drivers/regulator/lp3971.c b/drivers/regulator/lp3971.c
index 947c05f..3b1102b 100644
--- a/drivers/regulator/lp3971.c
+++ b/drivers/regulator/lp3971.c
@@ -25,8 +25,6 @@ struct lp3971 {
struct device *dev;
struct mutex io_lock;
struct i2c_client *i2c;
-   int num_regulators;
-   struct regulator_dev **rdev;
 };
 
 static u8 lp3971_reg_read(struct lp3971 *lp3971, u8 reg);
@@ -383,42 +381,27 @@ static int setup_regulators(struct lp3971 *lp3971,
 {
int i, err;
 
-   lp3971->num_regulators = pdata->num_regulators;
-   lp3971->rdev = kcalloc(pdata->num_regulators,
-   sizeof(struct regulator_dev *), GFP_KERNEL);
-   if (!lp3971->rdev) {
-   err = -ENOMEM;
-   goto err_nomem;
-   }
-
/* Instantiate the regulators */
for (i = 0; i < pdata->num_regulators; i++) {
struct regulator_config config = { };
struct lp3971_regulator_subdev *reg = >regulators[i];
+   struct regulator_dev *rdev;
 
config.dev = lp3971->dev;
config.init_data = reg->initdata;
config.driver_data = lp3971;
 
-   lp3971->rdev[i] = regulator_register([reg->id],
-);
-   if (IS_ERR(lp3971->rdev[i])) {
-   err = PTR_ERR(lp3971->rdev[i]);
+   rdev = devm_regulator_register(lp3971->dev,
+  [reg->id], );
+   if (IS_ERR(rdev)) {
+   err = PTR_ERR(rdev);
dev_err(lp3971->dev, "regulator init failed: %d\n",
err);
-   goto error;
+   return err;
}
}
 
return 0;
-
-error:
-   while (--i >= 0)
-   regulator_unregister(lp3971->rdev[i]);
-   kfree(lp3971->rdev);
-   lp3971->rdev = NULL;
-err_nomem:
-   return err;
 }
 
 static int lp3971_i2c_probe(struct i2c_client *i2c,
@@ -460,19 +443,6 @@ static int lp3971_i2c_probe(struct i2c_client *i2c,
return 0;
 }
 
-static int lp3971_i2c_remove(struct i2c_client *i2c)
-{
-   struct lp3971 *lp3971 = i2c_get_clientdata(i2c);
-   int i;
-
-   for (i = 0; i < lp3971->num_regulators; i++)
-   regulator_unregister(lp3971->rdev[i]);
-
-   kfree(lp3971->rdev);
-
-   return 0;
-}
-
 static const struct i2c_device_id lp3971_i2c_id[] = {
{ "lp3971", 0 },
{ }
@@ -485,7 +455,6 @@ static struct i2c_driver lp3971_i2c_driver = {
.owner = THIS_MODULE,
},
.probe= lp3971_i2c_probe,
-   .remove   = lp3971_i2c_remove,
.id_table = lp3971_i2c_id,
 };
 
-- 
1.8.1.2



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


[PATCH v3 09/15] ARM: Make the kprobes condition_check symbol names more generic

2013-11-26 Thread David Long
From: "David A. Long" 

In preparation for sharing the ARM kprobes instruction interpreting
code with uprobes, make the symbols names less kprobes-specific.

Signed-off-by: David A. Long 
---
 arch/arm/include/asm/probes.h   | 4 ++--
 arch/arm/kernel/kprobes-thumb.c | 4 ++--
 arch/arm/kernel/probes-arm.c| 2 +-
 arch/arm/kernel/probes-thumb.c  | 2 +-
 arch/arm/kernel/probes.c| 2 +-
 arch/arm/kernel/probes.h| 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/arm/include/asm/probes.h b/arch/arm/include/asm/probes.h
index 8032591..81b05b0 100644
--- a/arch/arm/include/asm/probes.h
+++ b/arch/arm/include/asm/probes.h
@@ -8,7 +8,7 @@ struct arch_specific_insn;
 typedef void (kprobe_insn_handler_t)(probes_opcode_t,
 struct arch_specific_insn *,
 struct pt_regs *);
-typedef unsigned long (kprobe_check_cc)(unsigned long);
+typedef unsigned long (probes_check_cc)(unsigned long);
 typedef void (kprobe_insn_singlestep_t)(probes_opcode_t,
struct arch_specific_insn *,
struct pt_regs *);
@@ -18,7 +18,7 @@ typedef void (kprobe_insn_fn_t)(void);
 struct arch_specific_insn {
probes_opcode_t *insn;
kprobe_insn_handler_t   *insn_handler;
-   kprobe_check_cc *insn_check_cc;
+   probes_check_cc *insn_check_cc;
kprobe_insn_singlestep_t*insn_singlestep;
kprobe_insn_fn_t*insn_fn;
 };
diff --git a/arch/arm/kernel/kprobes-thumb.c b/arch/arm/kernel/kprobes-thumb.c
index bb45870..4f30217 100644
--- a/arch/arm/kernel/kprobes-thumb.c
+++ b/arch/arm/kernel/kprobes-thumb.c
@@ -70,7 +70,7 @@ t32_decode_cond_branch(probes_opcode_t insn, struct 
arch_specific_insn *asi,
struct decode_header *d)
 {
int cc = (insn >> 22) & 0xf;
-   asi->insn_check_cc = kprobe_condition_checks[cc];
+   asi->insn_check_cc = probes_condition_checks[cc];
asi->insn_handler = t32_simulate_cond_branch;
return INSN_GOOD_NO_SLOT;
 }
@@ -424,7 +424,7 @@ t16_decode_cond_branch(probes_opcode_t insn, struct 
arch_specific_insn *asi,
struct decode_header *d)
 {
int cc = (insn >> 8) & 0xf;
-   asi->insn_check_cc = kprobe_condition_checks[cc];
+   asi->insn_check_cc = probes_condition_checks[cc];
asi->insn_handler = t16_simulate_cond_branch;
return INSN_GOOD_NO_SLOT;
 }
diff --git a/arch/arm/kernel/probes-arm.c b/arch/arm/kernel/probes-arm.c
index e50fb03..95ef3e3 100644
--- a/arch/arm/kernel/probes-arm.c
+++ b/arch/arm/kernel/probes-arm.c
@@ -726,7 +726,7 @@ arm_kprobe_decode_insn(probes_opcode_t insn, struct 
arch_specific_insn *asi,
   struct decode_header *actions)
 {
asi->insn_singlestep = arm_singlestep;
-   asi->insn_check_cc = kprobe_condition_checks[insn>>28];
+   asi->insn_check_cc = probes_condition_checks[insn>>28];
return kprobe_decode_insn(insn, asi, kprobe_decode_arm_table, false,
  (const union decode_item *) actions);
 }
diff --git a/arch/arm/kernel/probes-thumb.c b/arch/arm/kernel/probes-thumb.c
index e6dbbc3..055faf0 100644
--- a/arch/arm/kernel/probes-thumb.c
+++ b/arch/arm/kernel/probes-thumb.c
@@ -837,7 +837,7 @@ EXPORT_SYMBOL_GPL(kprobe_decode_thumb16_table);
 static unsigned long __kprobes thumb_check_cc(unsigned long cpsr)
 {
if (unlikely(in_it_block(cpsr)))
-   return kprobe_condition_checks[current_cond(cpsr)](cpsr);
+   return probes_condition_checks[current_cond(cpsr)](cpsr);
return true;
 }
 
diff --git a/arch/arm/kernel/probes.c b/arch/arm/kernel/probes.c
index 7354448..36fafd2 100644
--- a/arch/arm/kernel/probes.c
+++ b/arch/arm/kernel/probes.c
@@ -163,7 +163,7 @@ static unsigned long __kprobes __check_al(unsigned long 
cpsr)
return true;
 }
 
-kprobe_check_cc * const kprobe_condition_checks[16] = {
+probes_check_cc * const probes_condition_checks[16] = {
&__check_eq, &__check_ne, &__check_cs, &__check_cc,
&__check_mi, &__check_pl, &__check_vs, &__check_vc,
&__check_hi, &__check_ls, &__check_ge, &__check_lt,
diff --git a/arch/arm/kernel/probes.h b/arch/arm/kernel/probes.h
index c0536b1..e7c7a92 100644
--- a/arch/arm/kernel/probes.h
+++ b/arch/arm/kernel/probes.h
@@ -394,7 +394,7 @@ extern const union decode_item kprobe_decode_arm_table[];
 extern const union decode_item kprobes_arm_actions[];
 #endif
 
-extern kprobe_check_cc * const kprobe_condition_checks[16];
+extern probes_check_cc * const probes_condition_checks[16];
 
 
 int kprobe_decode_insn(probes_opcode_t insn, struct arch_specific_insn *asi,
-- 
1.8.1.2

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

[PATCH v3 02/15] ARM: move shared uprobe/kprobe definitions into new include file

2013-11-26 Thread David Long
From: "David A. Long" 

Separate the kprobe-only definitions from the definitions needed by
both kprobes and uprobes.

Signed-off-by: David A. Long 
---
 arch/arm/include/asm/kprobes.h | 15 +--
 arch/arm/include/asm/probes.h  | 18 ++
 2 files changed, 19 insertions(+), 14 deletions(-)
 create mode 100644 arch/arm/include/asm/probes.h

diff --git a/arch/arm/include/asm/kprobes.h b/arch/arm/include/asm/kprobes.h
index f82ec22..30fc11b 100644
--- a/arch/arm/include/asm/kprobes.h
+++ b/arch/arm/include/asm/kprobes.h
@@ -28,21 +28,8 @@
 #define kretprobe_blacklist_size   0
 
 typedef u32 kprobe_opcode_t;
-
 struct kprobe;
-typedef void (kprobe_insn_handler_t)(struct kprobe *, struct pt_regs *);
-typedef unsigned long (kprobe_check_cc)(unsigned long);
-typedef void (kprobe_insn_singlestep_t)(struct kprobe *, struct pt_regs *);
-typedef void (kprobe_insn_fn_t)(void);
-
-/* Architecture specific copy of original instruction. */
-struct arch_specific_insn {
-   kprobe_opcode_t *insn;
-   kprobe_insn_handler_t   *insn_handler;
-   kprobe_check_cc *insn_check_cc;
-   kprobe_insn_singlestep_t*insn_singlestep;
-   kprobe_insn_fn_t*insn_fn;
-};
+#include 
 
 struct prev_kprobe {
struct kprobe *kp;
diff --git a/arch/arm/include/asm/probes.h b/arch/arm/include/asm/probes.h
new file mode 100644
index 000..21da148
--- /dev/null
+++ b/arch/arm/include/asm/probes.h
@@ -0,0 +1,18 @@
+#ifndef _ASM_PROBES_H
+#define _ASM_PROBES_H
+
+typedef void (kprobe_insn_handler_t)(struct kprobe *, struct pt_regs *);
+typedef unsigned long (kprobe_check_cc)(unsigned long);
+typedef void (kprobe_insn_singlestep_t)(struct kprobe *, struct pt_regs *);
+typedef void (kprobe_insn_fn_t)(void);
+
+/* Architecture specific copy of original instruction. */
+struct arch_specific_insn {
+   kprobe_opcode_t *insn;
+   kprobe_insn_handler_t   *insn_handler;
+   kprobe_check_cc *insn_check_cc;
+   kprobe_insn_singlestep_t*insn_singlestep;
+   kprobe_insn_fn_t*insn_fn;
+};
+
+#endif
-- 
1.8.1.2

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


[PATCH v3 07/15] ARM: Remove use of struct kprobe from generic probes code

2013-11-26 Thread David Long
From: "David A. Long" 

Change the generic ARM probes code to pass in the opcode and 
architecture-specific
structure separately instead of using struct kprobe, so we do not pollute
code being used only for uprobes or other non-kprobes instruction
interpretation.

Signed-off-by: David A. Long 
---
 arch/arm/include/asm/probes.h|   9 +-
 arch/arm/kernel/kprobes-arm.c|  77 ++---
 arch/arm/kernel/kprobes-common.c |  42 ---
 arch/arm/kernel/kprobes-thumb.c  | 239 +++
 arch/arm/kernel/kprobes.c|   2 +-
 arch/arm/kernel/kprobes.h|   2 +-
 arch/arm/kernel/probes-arm.c |  33 +++---
 arch/arm/kernel/probes-arm.h |  29 ++---
 arch/arm/kernel/probes-thumb.c   |  18 ++-
 arch/arm/kernel/probes-thumb.h   |  51 -
 arch/arm/kernel/probes.c |  14 ++-
 arch/arm/kernel/probes.h |   8 +-
 12 files changed, 246 insertions(+), 278 deletions(-)

diff --git a/arch/arm/include/asm/probes.h b/arch/arm/include/asm/probes.h
index edf5abe..a7b0a79 100644
--- a/arch/arm/include/asm/probes.h
+++ b/arch/arm/include/asm/probes.h
@@ -3,9 +3,14 @@
 
 struct kprobe;
 
-typedef void (kprobe_insn_handler_t)(struct kprobe *, struct pt_regs *);
+struct arch_specific_insn;
+typedef void (kprobe_insn_handler_t)(kprobe_opcode_t,
+struct arch_specific_insn *,
+struct pt_regs *);
 typedef unsigned long (kprobe_check_cc)(unsigned long);
-typedef void (kprobe_insn_singlestep_t)(struct kprobe *, struct pt_regs *);
+typedef void (kprobe_insn_singlestep_t)(kprobe_opcode_t,
+   struct arch_specific_insn *,
+   struct pt_regs *);
 typedef void (kprobe_insn_fn_t)(void);
 
 /* Architecture specific copy of original instruction. */
diff --git a/arch/arm/kernel/kprobes-arm.c b/arch/arm/kernel/kprobes-arm.c
index ee329ff..394b611 100644
--- a/arch/arm/kernel/kprobes-arm.c
+++ b/arch/arm/kernel/kprobes-arm.c
@@ -72,12 +72,11 @@
"movpc, "reg"   \n\t"
 #endif
 
-
-void __kprobes
-emulate_ldrdstrd(struct kprobe *p, struct pt_regs *regs)
+static void __kprobes
+emulate_ldrdstrd(kprobe_opcode_t insn,
+   struct arch_specific_insn *asi, struct pt_regs *regs)
 {
-   kprobe_opcode_t insn = p->opcode;
-   unsigned long pc = (unsigned long)p->addr + 8;
+   unsigned long pc = regs->ARM_pc + 4;
int rt = (insn >> 12) & 0xf;
int rn = (insn >> 16) & 0xf;
int rm = insn & 0xf;
@@ -92,7 +91,7 @@ emulate_ldrdstrd(struct kprobe *p, struct pt_regs *regs)
BLX("%[fn]")
: "=r" (rtv), "=r" (rt2v), "=r" (rnv)
: "0" (rtv), "1" (rt2v), "2" (rnv), "r" (rmv),
- [fn] "r" (p->ainsn.insn_fn)
+ [fn] "r" (asi->insn_fn)
: "lr", "memory", "cc"
);
 
@@ -102,11 +101,11 @@ emulate_ldrdstrd(struct kprobe *p, struct pt_regs *regs)
regs->uregs[rn] = rnv;
 }
 
-void __kprobes
-emulate_ldr(struct kprobe *p, struct pt_regs *regs)
+static void __kprobes
+emulate_ldr(kprobe_opcode_t insn,
+   struct arch_specific_insn *asi, struct pt_regs *regs)
 {
-   kprobe_opcode_t insn = p->opcode;
-   unsigned long pc = (unsigned long)p->addr + 8;
+   unsigned long pc = regs->ARM_pc + 4;
int rt = (insn >> 12) & 0xf;
int rn = (insn >> 16) & 0xf;
int rm = insn & 0xf;
@@ -119,7 +118,7 @@ emulate_ldr(struct kprobe *p, struct pt_regs *regs)
__asm__ __volatile__ (
BLX("%[fn]")
: "=r" (rtv), "=r" (rnv)
-   : "1" (rnv), "r" (rmv), [fn] "r" (p->ainsn.insn_fn)
+   : "1" (rnv), "r" (rmv), [fn] "r" (asi->insn_fn)
: "lr", "memory", "cc"
);
 
@@ -132,12 +131,12 @@ emulate_ldr(struct kprobe *p, struct pt_regs *regs)
regs->uregs[rn] = rnv;
 }
 
-void __kprobes
-emulate_str(struct kprobe *p, struct pt_regs *regs)
+static void __kprobes
+emulate_str(kprobe_opcode_t insn,
+   struct arch_specific_insn *asi, struct pt_regs *regs)
 {
-   kprobe_opcode_t insn = p->opcode;
-   unsigned long rtpc = (unsigned long)p->addr + str_pc_offset;
-   unsigned long rnpc = (unsigned long)p->addr + 8;
+   unsigned long rtpc = regs->ARM_pc - 4 + str_pc_offset;
+   unsigned long rnpc = regs->ARM_pc + 4;
int rt = (insn >> 12) & 0xf;
int rn = (insn >> 16) & 0xf;
int rm = insn & 0xf;
@@ -151,7 +150,7 @@ emulate_str(struct kprobe *p, struct pt_regs *regs)
__asm__ __volatile__ (
BLX("%[fn]")
: "=r" (rnv)
-   : "r" (rtv), "0" (rnv), "r" (rmv), [fn] "r" (p->ainsn.insn_fn)
+   : "r" (rtv), "0" (rnv), "r" (rmv), [fn] "r" (asi->insn_fn)
: "lr", "memory", "cc"
);
 
@@ -159,11 +158,11 @@ emulate_str(struct kprobe *p, struct pt_regs *regs)

staging: comedi: Fix boolean/logical and mix-up.

2013-11-26 Thread Dave Jones
Introduced in commit b3ff824a81e8.

Signed-off-by: Dave Jones 

diff --git a/drivers/staging/comedi/drivers/pcl730.c 
b/drivers/staging/comedi/drivers/pcl730.c
index d041b714db29..2baaf1db6fbf 100644
--- a/drivers/staging/comedi/drivers/pcl730.c
+++ b/drivers/staging/comedi/drivers/pcl730.c
@@ -173,11 +173,11 @@ static int pcl730_do_insn_bits(struct comedi_device *dev,
if (mask) {
if (mask & 0x00ff)
outb(s->state & 0xff, dev->iobase + reg);
-   if ((mask & 0xff00) & (s->n_chan > 8))
+   if ((mask & 0xff00) && (s->n_chan > 8))
outb((s->state >> 8) & 0xff, dev->iobase + reg + 1);
-   if ((mask & 0xff) & (s->n_chan > 16))
+   if ((mask & 0xff) && (s->n_chan > 16))
outb((s->state >> 16) & 0xff, dev->iobase + reg + 2);
-   if ((mask & 0xff00) & (s->n_chan > 24))
+   if ((mask & 0xff00) && (s->n_chan > 24))
outb((s->state >> 24) & 0xff, dev->iobase + reg + 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 v3 10/15] ARM: Change more ARM kprobes symbol names to something more

2013-11-26 Thread David Long
From: "David A. Long" 

Change kprobe_emulate_none, kprobe_simulate_nop, and arm_kprobe_decode_init
function names to something more appropriate for code being shared
outside of the kprobes subsystem. Also, move the new arm_probes_decode_init
declaration out of the kprobes.h include file and into the probes.h include 
file.

Signed-off-by: David A. Long 
---
 arch/arm/kernel/kprobes-arm.c   | 12 ++--
 arch/arm/kernel/kprobes-thumb.c | 10 +-
 arch/arm/kernel/kprobes.c   |  2 +-
 arch/arm/kernel/kprobes.h   |  2 --
 arch/arm/kernel/probes.c|  6 +++---
 arch/arm/kernel/probes.h|  6 --
 6 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/arch/arm/kernel/kprobes-arm.c b/arch/arm/kernel/kprobes-arm.c
index 1fe3a44..ccb10bc 100644
--- a/arch/arm/kernel/kprobes-arm.c
+++ b/arch/arm/kernel/kprobes-arm.c
@@ -302,10 +302,10 @@ emulate_rdlo12rdhi16rn0rm8_rwflags_nopc(probes_opcode_t 
insn,
 }
 
 const union decode_item kprobes_arm_actions[] = {
-   [PROBES_EMULATE_NONE] = {.handler = kprobe_emulate_none},
-   [PROBES_SIMULATE_NOP] = {.handler = kprobe_simulate_nop},
-   [PROBES_PRELOAD_IMM] = {.handler = kprobe_simulate_nop},
-   [PROBES_PRELOAD_REG] = {.handler = kprobe_simulate_nop},
+   [PROBES_EMULATE_NONE] = {.handler = probes_emulate_none},
+   [PROBES_SIMULATE_NOP] = {.handler = probes_simulate_nop},
+   [PROBES_PRELOAD_IMM] = {.handler = probes_simulate_nop},
+   [PROBES_PRELOAD_REG] = {.handler = probes_simulate_nop},
[PROBES_BRANCH_IMM] = {.handler = simulate_blx1},
[PROBES_MRS] = {.handler = simulate_mrs},
[PROBES_BRANCH_REG] = {.handler = simulate_blx2bx},
@@ -326,8 +326,8 @@ const union decode_item kprobes_arm_actions[] = {
[PROBES_DATA_PROCESSING_IMM] = {
.handler = emulate_rd12rn16rm0rs8_rwflags},
[PROBES_MOV_HALFWORD] = {.handler = emulate_rd12rm0_noflags_nopc},
-   [PROBES_SEV] = {.handler = kprobe_emulate_none},
-   [PROBES_WFE] = {.handler = kprobe_simulate_nop},
+   [PROBES_SEV] = {.handler = probes_emulate_none},
+   [PROBES_WFE] = {.handler = probes_simulate_nop},
[PROBES_SATURATE] = {.handler = emulate_rd12rn16rm0_rwflags_nopc},
[PROBES_REV] = {.handler = emulate_rd12rm0_noflags_nopc},
[PROBES_MMI] = {.handler = emulate_rd12rn16rm0_rwflags_nopc},
diff --git a/arch/arm/kernel/kprobes-thumb.c b/arch/arm/kernel/kprobes-thumb.c
index 4f30217..84b7152 100644
--- a/arch/arm/kernel/kprobes-thumb.c
+++ b/arch/arm/kernel/kprobes-thumb.c
@@ -612,8 +612,8 @@ const union decode_item kprobes_t16_actions[] = {
[PROBES_T16_SIGN_EXTEND] = {.handler = t16_emulate_loregs_rwflags},
[PROBES_T16_PUSH] = {.decoder = t16_decode_push},
[PROBES_T16_POP] = {.decoder = t16_decode_pop},
-   [PROBES_T16_SEV] = {.handler = kprobe_emulate_none},
-   [PROBES_T16_WFE] = {.handler = kprobe_simulate_nop},
+   [PROBES_T16_SEV] = {.handler = probes_emulate_none},
+   [PROBES_T16_WFE] = {.handler = probes_simulate_nop},
[PROBES_T16_IT] = {.decoder = t16_decode_it},
[PROBES_T16_CMP] = {.handler = t16_emulate_loregs_rwflags},
[PROBES_T16_ADDSUB] = {.handler = t16_emulate_loregs_noitrwflags},
@@ -643,12 +643,12 @@ const union decode_item kprobes_t32_actions[] = {
[PROBES_T32_MOVW] = {.handler = t32_emulate_rd8rn16_noflags},
[PROBES_T32_SAT] = {.handler = t32_emulate_rd8rn16rm0_rwflags},
[PROBES_T32_BITFIELD] = {.handler = t32_emulate_rd8rn16_noflags},
-   [PROBES_T32_SEV] = {.handler = kprobe_emulate_none},
-   [PROBES_T32_WFE] = {.handler = kprobe_simulate_nop},
+   [PROBES_T32_SEV] = {.handler = probes_emulate_none},
+   [PROBES_T32_WFE] = {.handler = probes_simulate_nop},
[PROBES_T32_MRS] = {.handler = t32_simulate_mrs},
[PROBES_T32_BRANCH_COND] = {.decoder = t32_decode_cond_branch},
[PROBES_T32_BRANCH] = {.handler = t32_simulate_branch},
-   [PROBES_T32_PLDI] = {.handler = kprobe_simulate_nop},
+   [PROBES_T32_PLDI] = {.handler = probes_simulate_nop},
[PROBES_T32_LDR_LIT] = {.handler = t32_simulate_ldr_literal},
[PROBES_T32_LDRSTR] = {.handler = t32_emulate_ldrstr},
[PROBES_T32_SIGN_EXTEND] = {.handler = t32_emulate_rd8rn16rm0_rwflags},
diff --git a/arch/arm/kernel/kprobes.c b/arch/arm/kernel/kprobes.c
index 19c55aa..31bc9b7 100644
--- a/arch/arm/kernel/kprobes.c
+++ b/arch/arm/kernel/kprobes.c
@@ -613,7 +613,7 @@ static struct undef_hook kprobes_arm_break_hook = {
 
 int __init arch_init_kprobes()
 {
-   arm_kprobe_decode_init();
+   arm_probes_decode_init();
 #ifdef CONFIG_THUMB2_KERNEL
register_undef_hook(_thumb16_break_hook);
register_undef_hook(_thumb32_break_hook);
diff --git a/arch/arm/kernel/kprobes.h b/arch/arm/kernel/kprobes.h
index c8a8413..eba5a2f 100644
--- a/arch/arm/kernel/kprobes.h
+++ b/arch/arm/kernel/kprobes.h
@@ -56,8 +56,6 @@ enum kprobe_insn 

[PATCH v3 08/15] ARM: Use new opcode type in ARM kprobes/uprobes code

2013-11-26 Thread David Long
From: "David A. Long" 

For any ARM kprobes/uprobes code interfacing to the generic ARM probes code
use a new probes_opcode_t type to avoid a dependency on kprobes definitions.

Signed-off-by: David A. Long 
---
 arch/arm/include/asm/probes.h|  7 ++--
 arch/arm/kernel/kprobes-arm.c| 16 -
 arch/arm/kernel/kprobes-common.c | 14 
 arch/arm/kernel/kprobes-thumb.c  | 72 
 arch/arm/kernel/kprobes.h|  8 ++---
 arch/arm/kernel/probes-arm.c | 14 
 arch/arm/kernel/probes-arm.h | 10 +++---
 arch/arm/kernel/probes-thumb.c   |  8 ++---
 arch/arm/kernel/probes.c | 20 +--
 arch/arm/kernel/probes.h |  8 ++---
 10 files changed, 89 insertions(+), 88 deletions(-)

diff --git a/arch/arm/include/asm/probes.h b/arch/arm/include/asm/probes.h
index a7b0a79..8032591 100644
--- a/arch/arm/include/asm/probes.h
+++ b/arch/arm/include/asm/probes.h
@@ -2,20 +2,21 @@
 #define _ASM_PROBES_H
 
 struct kprobe;
+typedef u32 probes_opcode_t;
 
 struct arch_specific_insn;
-typedef void (kprobe_insn_handler_t)(kprobe_opcode_t,
+typedef void (kprobe_insn_handler_t)(probes_opcode_t,
 struct arch_specific_insn *,
 struct pt_regs *);
 typedef unsigned long (kprobe_check_cc)(unsigned long);
-typedef void (kprobe_insn_singlestep_t)(kprobe_opcode_t,
+typedef void (kprobe_insn_singlestep_t)(probes_opcode_t,
struct arch_specific_insn *,
struct pt_regs *);
 typedef void (kprobe_insn_fn_t)(void);
 
 /* Architecture specific copy of original instruction. */
 struct arch_specific_insn {
-   kprobe_opcode_t *insn;
+   probes_opcode_t *insn;
kprobe_insn_handler_t   *insn_handler;
kprobe_check_cc *insn_check_cc;
kprobe_insn_singlestep_t*insn_singlestep;
diff --git a/arch/arm/kernel/kprobes-arm.c b/arch/arm/kernel/kprobes-arm.c
index 394b611..1fe3a44 100644
--- a/arch/arm/kernel/kprobes-arm.c
+++ b/arch/arm/kernel/kprobes-arm.c
@@ -73,7 +73,7 @@
 #endif
 
 static void __kprobes
-emulate_ldrdstrd(kprobe_opcode_t insn,
+emulate_ldrdstrd(probes_opcode_t insn,
struct arch_specific_insn *asi, struct pt_regs *regs)
 {
unsigned long pc = regs->ARM_pc + 4;
@@ -102,7 +102,7 @@ emulate_ldrdstrd(kprobe_opcode_t insn,
 }
 
 static void __kprobes
-emulate_ldr(kprobe_opcode_t insn,
+emulate_ldr(probes_opcode_t insn,
struct arch_specific_insn *asi, struct pt_regs *regs)
 {
unsigned long pc = regs->ARM_pc + 4;
@@ -132,7 +132,7 @@ emulate_ldr(kprobe_opcode_t insn,
 }
 
 static void __kprobes
-emulate_str(kprobe_opcode_t insn,
+emulate_str(probes_opcode_t insn,
struct arch_specific_insn *asi, struct pt_regs *regs)
 {
unsigned long rtpc = regs->ARM_pc - 4 + str_pc_offset;
@@ -159,7 +159,7 @@ emulate_str(kprobe_opcode_t insn,
 }
 
 static void __kprobes
-emulate_rd12rn16rm0rs8_rwflags(kprobe_opcode_t insn,
+emulate_rd12rn16rm0rs8_rwflags(probes_opcode_t insn,
struct arch_specific_insn *asi, struct pt_regs *regs)
 {
unsigned long pc = regs->ARM_pc + 4;
@@ -194,7 +194,7 @@ emulate_rd12rn16rm0rs8_rwflags(kprobe_opcode_t insn,
 }
 
 static void __kprobes
-emulate_rd12rn16rm0_rwflags_nopc(kprobe_opcode_t insn,
+emulate_rd12rn16rm0_rwflags_nopc(probes_opcode_t insn,
struct arch_specific_insn *asi, struct pt_regs *regs)
 {
int rd = (insn >> 12) & 0xf;
@@ -221,7 +221,7 @@ emulate_rd12rn16rm0_rwflags_nopc(kprobe_opcode_t insn,
 }
 
 static void __kprobes
-emulate_rd16rn12rm0rs8_rwflags_nopc(kprobe_opcode_t insn,
+emulate_rd16rn12rm0rs8_rwflags_nopc(probes_opcode_t insn,
struct arch_specific_insn *asi,
struct pt_regs *regs)
 {
@@ -251,7 +251,7 @@ emulate_rd16rn12rm0rs8_rwflags_nopc(kprobe_opcode_t insn,
 }
 
 static void __kprobes
-emulate_rd12rm0_noflags_nopc(kprobe_opcode_t insn,
+emulate_rd12rm0_noflags_nopc(probes_opcode_t insn,
struct arch_specific_insn *asi, struct pt_regs *regs)
 {
int rd = (insn >> 12) & 0xf;
@@ -271,7 +271,7 @@ emulate_rd12rm0_noflags_nopc(kprobe_opcode_t insn,
 }
 
 static void __kprobes
-emulate_rdlo12rdhi16rn0rm8_rwflags_nopc(kprobe_opcode_t insn,
+emulate_rdlo12rdhi16rn0rm8_rwflags_nopc(probes_opcode_t insn,
struct arch_specific_insn *asi,
struct pt_regs *regs)
 {
diff --git a/arch/arm/kernel/kprobes-common.c b/arch/arm/kernel/kprobes-common.c
index 45590a4..bd3d8c5 100644
--- a/arch/arm/kernel/kprobes-common.c
+++ b/arch/arm/kernel/kprobes-common.c
@@ -18,7 +18,7 @@
 #include "kprobes.h"
 
 
-static void __kprobes simulate_ldm1stm1(kprobe_opcode_t insn,
+static void __kprobes simulate_ldm1stm1(probes_opcode_t insn,
struct arch_specific_insn *asi,
struct pt_regs *regs)
 {
@@ -60,7 +60,7 @@ static void __kprobes simulate_ldm1stm1(kprobe_opcode_t 

[PATCH v3 11/15] ARM: Rename the shared kprobes/uprobe return value enum

2013-11-26 Thread David Long
From: "David A. Long" 

Change the name of kprobes_insn to probes_insn so it can be shared between
kprobes and uprobes without confusion.

Signed-off-by: David A. Long 
---
 arch/arm/kernel/kprobes-common.c |  2 +-
 arch/arm/kernel/kprobes-thumb.c  | 16 
 arch/arm/kernel/kprobes.h| 14 --
 arch/arm/kernel/probes-arm.c |  2 +-
 arch/arm/kernel/probes-thumb.c   |  4 ++--
 arch/arm/kernel/probes.h |  7 ++-
 6 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/arch/arm/kernel/kprobes-common.c b/arch/arm/kernel/kprobes-common.c
index bd3d8c5..f8a1589 100644
--- a/arch/arm/kernel/kprobes-common.c
+++ b/arch/arm/kernel/kprobes-common.c
@@ -124,7 +124,7 @@ emulate_ldm_r3_15(probes_opcode_t insn,
load_write_pc(regs->ARM_pc, regs);
 }
 
-enum kprobe_insn __kprobes
+enum probes_insn __kprobes
 kprobe_decode_ldmstm(probes_opcode_t insn, struct arch_specific_insn *asi,
struct decode_header *h)
 {
diff --git a/arch/arm/kernel/kprobes-thumb.c b/arch/arm/kernel/kprobes-thumb.c
index 84b7152..a806a55 100644
--- a/arch/arm/kernel/kprobes-thumb.c
+++ b/arch/arm/kernel/kprobes-thumb.c
@@ -65,7 +65,7 @@ t32_simulate_cond_branch(probes_opcode_t insn,
regs->ARM_pc = pc + (offset * 2);
 }
 
-static enum kprobe_insn __kprobes
+static enum probes_insn __kprobes
 t32_decode_cond_branch(probes_opcode_t insn, struct arch_specific_insn *asi,
struct decode_header *d)
 {
@@ -141,11 +141,11 @@ t32_simulate_ldr_literal(probes_opcode_t insn,
regs->uregs[rt] = rtv;
 }
 
-enum kprobe_insn __kprobes
+enum probes_insn __kprobes
 t32_decode_ldmstm(probes_opcode_t insn, struct arch_specific_insn *asi,
struct decode_header *d)
 {
-   enum kprobe_insn ret = kprobe_decode_ldmstm(insn, asi, d);
+   enum probes_insn ret = kprobe_decode_ldmstm(insn, asi, d);
 
/* Fixup modified instruction to have halfwords in correct order...*/
insn = asi->insn[0];
@@ -401,7 +401,7 @@ t16_singlestep_it(probes_opcode_t insn,
t16_simulate_it(insn, asi, regs);
 }
 
-static enum kprobe_insn __kprobes
+static enum probes_insn __kprobes
 t16_decode_it(probes_opcode_t insn, struct arch_specific_insn *asi,
struct decode_header *d)
 {
@@ -419,7 +419,7 @@ t16_simulate_cond_branch(probes_opcode_t insn,
regs->ARM_pc = pc + (offset * 2);
 }
 
-static enum kprobe_insn __kprobes
+static enum probes_insn __kprobes
 t16_decode_cond_branch(probes_opcode_t insn, struct arch_specific_insn *asi,
struct decode_header *d)
 {
@@ -509,7 +509,7 @@ t16_emulate_hiregs(probes_opcode_t insn,
regs->ARM_cpsr = (regs->ARM_cpsr & ~APSR_MASK) | (cpsr & APSR_MASK);
 }
 
-static enum kprobe_insn __kprobes
+static enum probes_insn __kprobes
 t16_decode_hiregs(probes_opcode_t insn, struct arch_specific_insn *asi,
struct decode_header *d)
 {
@@ -537,7 +537,7 @@ t16_emulate_push(probes_opcode_t insn,
);
 }
 
-static enum kprobe_insn __kprobes
+static enum probes_insn __kprobes
 t16_decode_push(probes_opcode_t insn, struct arch_specific_insn *asi,
struct decode_header *d)
 {
@@ -590,7 +590,7 @@ t16_emulate_pop_pc(probes_opcode_t insn,
bx_write_pc(pc, regs);
 }
 
-enum kprobe_insn __kprobes
+enum probes_insn __kprobes
 t16_decode_pop(probes_opcode_t insn, struct arch_specific_insn *asi,
struct decode_header *d)
 {
diff --git a/arch/arm/kernel/kprobes.h b/arch/arm/kernel/kprobes.h
index eba5a2f..2c8a888 100644
--- a/arch/arm/kernel/kprobes.h
+++ b/arch/arm/kernel/kprobes.h
@@ -29,28 +29,22 @@
 
 struct decode_header;
 
-enum kprobe_insn {
-   INSN_REJECTED,
-   INSN_GOOD,
-   INSN_GOOD_NO_SLOT
-};
-
-typedef enum kprobe_insn (kprobe_decode_insn_t)(probes_opcode_t,
+typedef enum probes_insn (kprobe_decode_insn_t)(probes_opcode_t,
struct arch_specific_insn *,
struct decode_header *);
 
 #ifdef CONFIG_THUMB2_KERNEL
 
-enum kprobe_insn thumb16_kprobe_decode_insn(probes_opcode_t,
+enum probes_insn thumb16_kprobe_decode_insn(probes_opcode_t,
struct arch_specific_insn *,
struct decode_header *);
-enum kprobe_insn thumb32_kprobe_decode_insn(probes_opcode_t,
+enum probes_insn thumb32_kprobe_decode_insn(probes_opcode_t,
struct arch_specific_insn *,
struct decode_header *);
 
 #else /* !CONFIG_THUMB2_KERNEL */
 
-enum kprobe_insn arm_kprobe_decode_insn(probes_opcode_t,
+enum probes_insn arm_kprobe_decode_insn(probes_opcode_t,
struct arch_specific_insn *,
struct decode_header *);
 
diff --git a/arch/arm/kernel/probes-arm.c b/arch/arm/kernel/probes-arm.c
index 95ef3e3..3bec735 100644
--- a/arch/arm/kernel/probes-arm.c
+++ 

Re: [PATCH v4 05/12] efi: export more efi table variable to sysfs

2013-11-26 Thread Dave Young
On 11/26/13 at 03:57pm, Matt Fleming wrote:
> On Tue, 26 Nov, at 01:57:50PM, Dave Young wrote:
> > Export fw_vendor, runtime and config tables physical
> > addresses to /sys/firmware/efi/systab becaue kexec
> > kernel will need them.
>  
> This commit log needs updating.

Will update

> 
> > From EFI spec these 3 variables will be updated to
> > virtual address after entering virtual mode. But
> > kernel startup code will need the physical address.
> > 
> > changelog:
> > Greg: add standalone sysfs files instead of add lines to systab
> > Document them as testing ABI
> > Greg: use group attrs and is_visible
> > Boris: align comments lines
> > 
> > Signed-off-by: Dave Young 
> > ---
> >  Documentation/ABI/testing/sysfs-firmware-efi | 26 
> >  arch/x86/platform/efi/efi.c  |  4 +++
> >  drivers/firmware/efi/efi.c   | 44 
> > 
> >  include/linux/efi.h  |  3 ++
> >  4 files changed, 77 insertions(+)
> >  create mode 100644 Documentation/ABI/testing/sysfs-firmware-efi
> > 
> > diff --git a/Documentation/ABI/testing/sysfs-firmware-efi 
> > b/Documentation/ABI/testing/sysfs-firmware-efi
> > new file mode 100644
> > index 000..9252a24
> > --- /dev/null
> > +++ b/Documentation/ABI/testing/sysfs-firmware-efi
> > @@ -0,0 +1,26 @@
> > +What:  /sys/firmware/efi/fw_vendor
> > +Date:  Nov 2013
> > +Contact:   Dave Young 
> 
> redhat.org eh? Typo or legit?

It's typo, will fix

> 
> > +Description:
> > +   Shows the physical address of firmware vendor in the EFI
> > +   system table.
> 
> It shows the physical address of the firmware vendor "entry" or "field"
> in the EFI system table.

Will update

> 
> > +Users:
> > +   Kexec Mailing List 
> 
> The "Kexec mailing list" isn't a user, kexec is.

Ok, will change to "Kexec"

Thanks for review
Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v3 14/15] ARM: add uprobes support

2013-11-26 Thread David Long
From: "David A. Long" 

Using Rabin Vincent's ARM uprobes patches as a base, enable uprobes
support on ARM.

Caveats:

 - Thumb is not supported
 - XOL abort/trap handling is not implemented

Signed-off-by: David A. Long 
---
 arch/arm/Kconfig   |   4 +
 arch/arm/include/asm/ptrace.h  |   6 +
 arch/arm/include/asm/thread_info.h |   5 +-
 arch/arm/include/asm/uprobes.h |  34 ++
 arch/arm/kernel/Makefile   |   1 +
 arch/arm/kernel/signal.c   |   4 +
 arch/arm/kernel/uprobes-arm.c  | 223 +
 arch/arm/kernel/uprobes.c  | 198 
 arch/arm/kernel/uprobes.h  |  27 +
 9 files changed, 501 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/include/asm/uprobes.h
 create mode 100644 arch/arm/kernel/uprobes-arm.c
 create mode 100644 arch/arm/kernel/uprobes.c
 create mode 100644 arch/arm/kernel/uprobes.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c1f1a7e..fec5a6b 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -203,6 +203,10 @@ config ZONE_DMA
 config NEED_DMA_MAP_STATE
def_bool y
 
+config ARCH_SUPPORTS_UPROBES
+   depends on KPROBES
+   def_bool y
+
 config ARCH_HAS_DMA_SET_COHERENT_MASK
bool
 
diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h
index 04c99f3..ee688b0a 100644
--- a/arch/arm/include/asm/ptrace.h
+++ b/arch/arm/include/asm/ptrace.h
@@ -80,6 +80,12 @@ static inline long regs_return_value(struct pt_regs *regs)
 
 #define instruction_pointer(regs)  (regs)->ARM_pc
 
+static inline void instruction_pointer_set(struct pt_regs *regs,
+  unsigned long val)
+{
+   instruction_pointer(regs) = val;
+}
+
 #ifdef CONFIG_SMP
 extern unsigned long profile_pc(struct pt_regs *regs);
 #else
diff --git a/arch/arm/include/asm/thread_info.h 
b/arch/arm/include/asm/thread_info.h
index 71a06b2..f989d7c 100644
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
@@ -153,6 +153,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user 
*,
 #define TIF_SIGPENDING 0
 #define TIF_NEED_RESCHED   1
 #define TIF_NOTIFY_RESUME  2   /* callback before returning to user */
+#define TIF_UPROBE 7
 #define TIF_SYSCALL_TRACE  8
 #define TIF_SYSCALL_AUDIT  9
 #define TIF_SYSCALL_TRACEPOINT 10
@@ -165,6 +166,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user 
*,
 #define _TIF_SIGPENDING(1 << TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED  (1 << TIF_NEED_RESCHED)
 #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
+#define _TIF_UPROBE(1 << TIF_UPROBE)
 #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
 #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
 #define _TIF_SYSCALL_TRACEPOINT(1 << TIF_SYSCALL_TRACEPOINT)
@@ -178,7 +180,8 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user 
*,
 /*
  * Change these and you break ASM code in entry-common.S
  */
-#define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | 
_TIF_NOTIFY_RESUME)
+#define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \
+_TIF_NOTIFY_RESUME | _TIF_UPROBE)
 
 #endif /* __KERNEL__ */
 #endif /* __ASM_ARM_THREAD_INFO_H */
diff --git a/arch/arm/include/asm/uprobes.h b/arch/arm/include/asm/uprobes.h
new file mode 100644
index 000..e5acaa3
--- /dev/null
+++ b/arch/arm/include/asm/uprobes.h
@@ -0,0 +1,34 @@
+#ifndef _ASM_UPROBES_H
+#define _ASM_UPROBES_H
+
+#include 
+
+typedef u32 uprobe_opcode_t;
+
+#define MAX_UINSN_BYTES4
+#define UPROBE_XOL_SLOT_BYTES  64
+
+#define UPROBE_SWBP_INSN   0xe7f001f9
+#define UPROBE_SS_INSN 0xe7f001fa
+#define UPROBE_SWBP_INSN_SIZE  4
+
+struct arch_uprobe_task {
+   u32 backup;
+};
+
+struct arch_uprobe {
+   u8 insn[MAX_UINSN_BYTES];
+   unsigned long ixol[2];
+   uprobe_opcode_t bpinsn;
+   bool simulate;
+   u32 pcreg;
+   void (*prehandler)(struct arch_uprobe *auprobe,
+  struct arch_uprobe_task *autask,
+  struct pt_regs *regs);
+   void (*posthandler)(struct arch_uprobe *auprobe,
+   struct arch_uprobe_task *autask,
+   struct pt_regs *regs);
+   struct arch_specific_insn asi;
+};
+
+#endif
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index bb739f2..a766bcb 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_DYNAMIC_FTRACE)  += ftrace.o insn.o
 obj-$(CONFIG_FUNCTION_GRAPH_TRACER)+= ftrace.o insn.o
 obj-$(CONFIG_JUMP_LABEL)   += jump_label.o insn.o patch.o
 obj-$(CONFIG_KEXEC)+= machine_kexec.o relocate_kernel.o
+obj-$(CONFIG_UPROBES)  += probes.o probes-arm.o uprobes.o uprobes-arm.o
 obj-$(CONFIG_KPROBES)  += probes.o 

Re: [PATCH V2 1/2] cpufreq: suspend governors on system suspend/hibernate

2013-11-26 Thread Viresh Kumar
On 27 November 2013 01:48, Rafael J. Wysocki  wrote:
> On Tuesday, November 26, 2013 08:39:02 PM Pavel Machek wrote:
>> So... we freeze frequencies in whatever state they are, yes?

Better go through the V3 of this patchset:

https://lkml.org/lkml/2013/11/25/838

We are giving drivers and opportunity to set core to whatever frequency they
want before suspending.

> Yes.  The idea was to do that after suspending devices in which case it 
> wouldn't
> matter so much.  But Viresh always has to complicate things.

:)

Its complicated by the kind of designs we have for our hardware. We tried the
noirq callbacks and it worked atleast for Nishanth, who reported the problem
initially. But the problem started when drivers wanted to change their
frequencies before suspending and that can't happen in noirq place..

I had another idea but then left it thinking that it might be even more
complicated :)

What about both dpm_suspend_noirq and dpm_suspend callbacks. Drivers
will change freq in dpm_suspend_noirq and dpm_suspend will stop governors?

But the question is can governors try another frequency at that time?
i.e. override whatever is configured by drivers?

>> Should we go to some specific frequency?
>
> If that is done where it is done, yes, we should.

You meant dpm_suspend() here, right?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v3 12/15] ARM: Change the remaining shared kprobes/uprobes symbols to something generic

2013-11-26 Thread David Long
From: "David A. Long" 

Any more ARM kprobes/uprobes symbols which have "kprobe" in the name must be
changed to the more generic "probes" or other non-kprobes specific symbol.

Signed-off-by: David A. Long 
---
 arch/arm/include/asm/probes.h| 13 ++--
 arch/arm/kernel/kprobes-common.c |  2 +-
 arch/arm/kernel/kprobes-test.c   |  8 ---
 arch/arm/kernel/kprobes.c| 13 ++--
 arch/arm/kernel/kprobes.h| 25 ++
 arch/arm/kernel/probes-arm.c | 12 +--
 arch/arm/kernel/probes-arm.h |  6 ++
 arch/arm/kernel/probes-thumb.c   | 26 +++
 arch/arm/kernel/probes-thumb.h   | 10 +
 arch/arm/kernel/probes.c |  4 ++--
 arch/arm/kernel/probes.h | 46 +---
 11 files changed, 82 insertions(+), 83 deletions(-)

diff --git a/arch/arm/include/asm/probes.h b/arch/arm/include/asm/probes.h
index 81b05b0..614977b 100644
--- a/arch/arm/include/asm/probes.h
+++ b/arch/arm/include/asm/probes.h
@@ -1,26 +1,25 @@
 #ifndef _ASM_PROBES_H
 #define _ASM_PROBES_H
 
-struct kprobe;
 typedef u32 probes_opcode_t;
 
 struct arch_specific_insn;
-typedef void (kprobe_insn_handler_t)(probes_opcode_t,
+typedef void (probes_insn_handler_t)(probes_opcode_t,
 struct arch_specific_insn *,
 struct pt_regs *);
 typedef unsigned long (probes_check_cc)(unsigned long);
-typedef void (kprobe_insn_singlestep_t)(probes_opcode_t,
+typedef void (probes_insn_singlestep_t)(probes_opcode_t,
struct arch_specific_insn *,
struct pt_regs *);
-typedef void (kprobe_insn_fn_t)(void);
+typedef void (probes_insn_fn_t)(void);
 
 /* Architecture specific copy of original instruction. */
 struct arch_specific_insn {
probes_opcode_t *insn;
-   kprobe_insn_handler_t   *insn_handler;
+   probes_insn_handler_t   *insn_handler;
probes_check_cc *insn_check_cc;
-   kprobe_insn_singlestep_t*insn_singlestep;
-   kprobe_insn_fn_t*insn_fn;
+   probes_insn_singlestep_t*insn_singlestep;
+   probes_insn_fn_t*insn_fn;
 };
 
 #endif
diff --git a/arch/arm/kernel/kprobes-common.c b/arch/arm/kernel/kprobes-common.c
index f8a1589..0c485ca 100644
--- a/arch/arm/kernel/kprobes-common.c
+++ b/arch/arm/kernel/kprobes-common.c
@@ -128,7 +128,7 @@ enum probes_insn __kprobes
 kprobe_decode_ldmstm(probes_opcode_t insn, struct arch_specific_insn *asi,
struct decode_header *h)
 {
-   kprobe_insn_handler_t *handler = 0;
+   probes_insn_handler_t *handler = 0;
unsigned reglist = insn & 0x;
int is_ldm = insn & 0x10;
int rn = (insn >> 16) & 0xf;
diff --git a/arch/arm/kernel/kprobes-test.c b/arch/arm/kernel/kprobes-test.c
index 65230b2..a1f155c 100644
--- a/arch/arm/kernel/kprobes-test.c
+++ b/arch/arm/kernel/kprobes-test.c
@@ -205,6 +205,8 @@
 #include 
 
 #include "kprobes.h"
+#include "probes-arm.h"
+#include "probes-thumb.h"
 #include "kprobes-test.h"
 
 
@@ -1616,7 +1618,7 @@ static int __init run_all_tests(void)
goto out;
 
pr_info("ARM instruction simulation\n");
-   ret = run_test_cases(kprobe_arm_test_cases, kprobe_decode_arm_table);
+   ret = run_test_cases(kprobe_arm_test_cases, probes_decode_arm_table);
if (ret)
goto out;
 
@@ -1639,13 +1641,13 @@ static int __init run_all_tests(void)
 
pr_info("16-bit Thumb instruction simulation\n");
ret = run_test_cases(kprobe_thumb16_test_cases,
-   kprobe_decode_thumb16_table);
+   probes_decode_thumb16_table);
if (ret)
goto out;
 
pr_info("32-bit Thumb instruction simulation\n");
ret = run_test_cases(kprobe_thumb32_test_cases,
-   kprobe_decode_thumb32_table);
+   probes_decode_thumb32_table);
if (ret)
goto out;
 #endif
diff --git a/arch/arm/kernel/kprobes.c b/arch/arm/kernel/kprobes.c
index 31bc9b7..0d9d49b 100644
--- a/arch/arm/kernel/kprobes.c
+++ b/arch/arm/kernel/kprobes.c
@@ -29,6 +29,8 @@
 #include 
 
 #include "kprobes.h"
+#include "probes-arm.h"
+#include "probes-thumb.h"
 #include "patch.h"
 
 #define MIN_STACK_SIZE(addr)   \
@@ -67,10 +69,10 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
if (is_wide_instruction(insn)) {
insn <<= 16;
insn |= ((u16 *)addr)[1];
-   decode_insn = thumb32_kprobe_decode_insn;
+   decode_insn = thumb32_probes_decode_insn;
actions = kprobes_t32_actions;
} else {
-   decode_insn = thumb16_kprobe_decode_insn;
+   decode_insn = thumb16_probes_decode_insn;
 

[PATCH v3 13/15] ARM: Add an emulate flag to the kprobes/uprobes instruction decode functions

2013-11-26 Thread David Long
From: "David A. Long" 

Add an emulate flag into the instruction interpreter, primarily for uprobes
support.

Signed-off-by: David A. Long 
---
 arch/arm/kernel/kprobes.c  |  3 ++-
 arch/arm/kernel/kprobes.h  |  1 +
 arch/arm/kernel/probes-arm.c   |  4 ++--
 arch/arm/kernel/probes-arm.h   |  2 +-
 arch/arm/kernel/probes-thumb.c |  8 
 arch/arm/kernel/probes-thumb.h |  4 ++--
 arch/arm/kernel/probes.c   | 32 +++-
 arch/arm/kernel/probes.h   |  2 +-
 8 files changed, 36 insertions(+), 20 deletions(-)

diff --git a/arch/arm/kernel/kprobes.c b/arch/arm/kernel/kprobes.c
index 0d9d49b..04690f9 100644
--- a/arch/arm/kernel/kprobes.c
+++ b/arch/arm/kernel/kprobes.c
@@ -87,7 +87,8 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
p->opcode = insn;
p->ainsn.insn = tmp_insn;
 
-   switch ((*decode_insn)(insn, >ainsn, actions)) {
+   switch ((*decode_insn)(insn, >ainsn,
+  true, actions)) {
case INSN_REJECTED: /* not supported */
return -EINVAL;
 
diff --git a/arch/arm/kernel/kprobes.h b/arch/arm/kernel/kprobes.h
index e1305a8..580d82c 100644
--- a/arch/arm/kernel/kprobes.h
+++ b/arch/arm/kernel/kprobes.h
@@ -35,6 +35,7 @@ kprobe_decode_ldmstm(kprobe_opcode_t insn, struct 
arch_specific_insn *asi,
 
 typedef enum probes_insn (kprobe_decode_insn_t)(kprobe_opcode_t,
struct arch_specific_insn *,
+   bool,
const union decode_item *);
 
 #ifdef CONFIG_THUMB2_KERNEL
diff --git a/arch/arm/kernel/probes-arm.c b/arch/arm/kernel/probes-arm.c
index a44c3ad..01e99f7 100644
--- a/arch/arm/kernel/probes-arm.c
+++ b/arch/arm/kernel/probes-arm.c
@@ -723,10 +723,10 @@ static void __kprobes arm_singlestep(probes_opcode_t insn,
  */
 enum probes_insn __kprobes
 arm_probes_decode_insn(probes_opcode_t insn, struct arch_specific_insn *asi,
-   const union decode_item *actions)
+   bool emulate, const union decode_item *actions)
 {
asi->insn_singlestep = arm_singlestep;
asi->insn_check_cc = probes_condition_checks[insn>>28];
return probes_decode_insn(insn, asi, probes_decode_arm_table, false,
-   actions);
+   emulate, actions);
 }
diff --git a/arch/arm/kernel/probes-arm.h b/arch/arm/kernel/probes-arm.h
index 7f81199..904033c 100644
--- a/arch/arm/kernel/probes-arm.h
+++ b/arch/arm/kernel/probes-arm.h
@@ -66,7 +66,7 @@ void __kprobes simulate_mov_ipsp(probes_opcode_t opcode,
 extern const union decode_item probes_decode_arm_table[];
 
 enum probes_insn arm_probes_decode_insn(probes_opcode_t,
-   struct arch_specific_insn *,
+   struct arch_specific_insn *, bool emulate,
const union decode_item *actions);
 
 #endif
diff --git a/arch/arm/kernel/probes-thumb.c b/arch/arm/kernel/probes-thumb.c
index 3f250e9..2ad0880 100644
--- a/arch/arm/kernel/probes-thumb.c
+++ b/arch/arm/kernel/probes-thumb.c
@@ -861,20 +861,20 @@ static void __kprobes thumb32_singlestep(probes_opcode_t 
opcode,
 
 enum probes_insn __kprobes
 thumb16_probes_decode_insn(probes_opcode_t insn, struct arch_specific_insn 
*asi,
-  const union decode_item *actions)
+  bool emulate, const union decode_item *actions)
 {
asi->insn_singlestep = thumb16_singlestep;
asi->insn_check_cc = thumb_check_cc;
return probes_decode_insn(insn, asi, probes_decode_thumb16_table, true,
- actions);
+ emulate, actions);
 }
 
 enum probes_insn __kprobes
 thumb32_probes_decode_insn(probes_opcode_t insn, struct arch_specific_insn 
*asi,
-  const union decode_item *actions)
+  bool emulate, const union decode_item *actions)
 {
asi->insn_singlestep = thumb32_singlestep;
asi->insn_check_cc = thumb_check_cc;
return probes_decode_insn(insn, asi, probes_decode_thumb32_table, true,
- actions);
+ emulate, actions);
 }
diff --git a/arch/arm/kernel/probes-thumb.h b/arch/arm/kernel/probes-thumb.h
index 556f067..78be667 100644
--- a/arch/arm/kernel/probes-thumb.h
+++ b/arch/arm/kernel/probes-thumb.h
@@ -87,9 +87,9 @@ extern const union decode_item probes_decode_thumb16_table[];
 
 enum probes_insn __kprobes
 thumb16_probes_decode_insn(probes_opcode_t insn, struct arch_specific_insn 
*asi,
-   const union decode_item *actions);
+   bool emulate, const union decode_item *actions);
 enum probes_insn __kprobes
 thumb32_probes_decode_insn(probes_opcode_t insn, struct arch_specific_insn 
*asi,
-   const union decode_item *actions);
+   bool emulate, const union decode_item *actions);
 
 #endif
diff --git a/arch/arm/kernel/probes.c b/arch/arm/kernel/probes.c
index a0a4220..e691e12 

[PATCH v3 06/15] ARM: Disable jprobes test when built into thumb-mode kernel

2013-11-26 Thread David Long
From: "Jon Medhurst (Tixy)" 

For now the jprobes tests fail on ARM for when built into a kernel compiled
in thumb mode. They work fine for ARM kernels, and when built as a loadable
module.

Signed-off-by: David A. Long 
---
 arch/arm/kernel/kprobes-test.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/kernel/kprobes-test.c b/arch/arm/kernel/kprobes-test.c
index 0cd63d0..65230b2 100644
--- a/arch/arm/kernel/kprobes-test.c
+++ b/arch/arm/kernel/kprobes-test.c
@@ -221,6 +221,7 @@ static int pre_handler_called;
 static int post_handler_called;
 static int jprobe_func_called;
 static int kretprobe_handler_called;
+static int tests_failed;
 
 #define FUNC_ARG1 0x12345678
 #define FUNC_ARG2 0xabcdef
@@ -457,6 +458,13 @@ static int run_api_tests(long (*func)(long, long))
 
pr_info("jprobe\n");
ret = test_jprobe(func);
+#if defined(CONFIG_THUMB2_KERNEL) && !defined(MODULE)
+   if (ret == -EINVAL) {
+   pr_err("FAIL: Known longtime bug with jprobe on Thumb kernels");
+   tests_failed = ret;
+   ret = 0;
+   }
+#endif
if (ret < 0)
return ret;
 
@@ -1667,6 +1675,8 @@ static int __init run_all_tests(void)
 
 out:
if (ret == 0)
+   ret = tests_failed;
+   if (ret == 0)
pr_info("Finished kprobe tests OK\n");
else
pr_err("kprobe tests failed\n");
-- 
1.8.1.2

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


[PATCH v3 15/15] ARM: Remove uprobes dependency on kprobes

2013-11-26 Thread David Long
From: "David A. Long" 

Now that arm uprobes support has been made separate from the arm kprobes code
the Kconfig can be changed to reflect that.

Signed-off-by: David A. Long 
---
 arch/arm/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index fec5a6b..9ddc4ae 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -204,7 +204,6 @@ config NEED_DMA_MAP_STATE
def_bool y
 
 config ARCH_SUPPORTS_UPROBES
-   depends on KPROBES
def_bool y
 
 config ARCH_HAS_DMA_SET_COHERENT_MASK
-- 
1.8.1.2

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


[PATCH v3 01/15] uprobes: allow ignoring of probe hits

2013-11-26 Thread David Long
From: "David A. Long" 

Allow arches to decided to ignore a probe hit.  ARM will use this to
only call handlers if the conditions to execute a conditionally executed
instruction are satisfied.

Upleveled for v3.12-rc5.

Signed-off-by: David A. Long 
---
 include/linux/uprobes.h | 1 +
 kernel/events/uprobes.c | 9 +
 2 files changed, 10 insertions(+)

diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index 319eae7..197a36e 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -134,6 +134,7 @@ extern bool arch_uprobe_xol_was_trapped(struct task_struct 
*tsk);
 extern int  arch_uprobe_exception_notify(struct notifier_block *self, unsigned 
long val, void *data);
 extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs 
*regs);
 extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long 
trampoline_vaddr, struct pt_regs *regs);
+extern bool __weak arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs 
*regs);
 #else /* !CONFIG_UPROBES */
 struct uprobes_state {
 };
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 24b7d6c..4eec7ce 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -1778,6 +1778,11 @@ static bool handle_trampoline(struct pt_regs *regs)
return true;
 }
 
+bool __weak arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs)
+{
+   return false;
+}
+
 /*
  * Run handler and ask thread to singlestep.
  * Ensure all non-fatal signals cannot interrupt thread while it singlesteps.
@@ -1828,7 +1833,11 @@ static void handle_swbp(struct pt_regs *regs)
if (unlikely(!test_bit(UPROBE_COPY_INSN, >flags)))
goto out;
 
+   if (arch_uprobe_ignore(>arch, regs))
+   goto out;
+
handler_chain(uprobe, regs);
+
if (can_skip_sstep(uprobe, regs))
goto out;
 
-- 
1.8.1.2

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


[PATCH v3 00/15] uprobes: Add uprobes support for ARM

2013-11-26 Thread David Long
From: "David A. Long" 

This patch series adds basic uprobes support to ARM. It is based on patches
developed earlier by Rabin Vincent. That approach of adding hooks into
the kprobes instruction parsing code was not well received. This approach
separates the ARM instruction parsing code in kprobes out into a separate set
of functions which can be used by both kprobes and uprobes. Both kprobes and
uprobes then provide their own semantic action tables to process the results of
the parsing.

The following are noteworthy changes made for v3:

1) The ARM uprobes functionality no longer depends on kprobes. As
a side effect of this there are no longer any changes to the common
kprobes include file (or any other common kprobes files).
2) A couple large patches have been broken down into more smaller
patches.
3) A problem with uretprobes has been fixed.
4) The kprobes-test module has been made more useable for thumb tests.
5) The argument list to the "action" functions has been shrunk.
6) Alignment with a few recent patches that were made to common
uprobes code specifically to support this patchset.

This patchset is based on v3.13-rc1


David A. Long (14):
  uprobes: allow ignoring of probe hits
  ARM: move shared uprobe/kprobe definitions into new include file
  ARM: Move generic arm instruction parsing code to new files for
sharing between features
  ARM: move generic thumb instruction parsing code to new files for use
by other feature
  ARM: use a function table for determining instruction interpreter
actions
  ARM: Remove use of struct kprobe from generic probes code
  ARM: Use new opcode type in ARM kprobes/uprobes code
  ARM: Make the kprobes condition_check symbol names more generic
  ARM: Change more ARM kprobes symbol names to something more
  ARM: Rename the shared kprobes/uprobe return value enum
  ARM: Change the remaining shared kprobes/uprobes symbols to something
generic
  ARM: Add an emulate flag to the kprobes/uprobes instruction decode
functions
  ARM: add uprobes support
  ARM: Remove uprobes dependency on kprobes

Jon Medhurst (Tixy) (1):
  ARM: Disable jprobes test when built into thumb-mode kernel

 arch/arm/Kconfig   |3 +
 arch/arm/include/asm/kprobes.h |   15 +-
 arch/arm/include/asm/probes.h  |   25 +
 arch/arm/include/asm/ptrace.h  |6 +
 arch/arm/include/asm/thread_info.h |5 +-
 arch/arm/include/asm/uprobes.h |   34 +
 arch/arm/kernel/Makefile   |7 +-
 arch/arm/kernel/kprobes-arm.c  |  804 ++
 arch/arm/kernel/kprobes-common.c   |  468 +---
 arch/arm/kernel/kprobes-test.c |   18 +-
 arch/arm/kernel/kprobes-thumb.c| 1141 +++-
 arch/arm/kernel/kprobes.c  |   24 +-
 arch/arm/kernel/kprobes.h  |  399 +--
 arch/arm/kernel/{kprobes-arm.c => probes-arm.c}|  441 ++--
 arch/arm/kernel/probes-arm.h   |   72 ++
 .../arm/kernel/{kprobes-thumb.c => probes-thumb.c} |  771 ++---
 arch/arm/kernel/probes-thumb.h |   95 ++
 arch/arm/kernel/{kprobes-common.c => probes.c} |  215 +---
 arch/arm/kernel/{kprobes.h => probes.h}|   91 +-
 arch/arm/kernel/signal.c   |4 +
 arch/arm/kernel/uprobes-arm.c  |  223 
 arch/arm/kernel/uprobes.c  |  198 
 arch/arm/kernel/uprobes.h  |   27 +
 include/linux/uprobes.h|1 +
 kernel/events/uprobes.c|9 +
 25 files changed, 1267 insertions(+), 3829 deletions(-)
 create mode 100644 arch/arm/include/asm/probes.h
 create mode 100644 arch/arm/include/asm/uprobes.h
 copy arch/arm/kernel/{kprobes-arm.c => probes-arm.c} (64%)
 create mode 100644 arch/arm/kernel/probes-arm.h
 copy arch/arm/kernel/{kprobes-thumb.c => probes-thumb.c} (56%)
 create mode 100644 arch/arm/kernel/probes-thumb.h
 copy arch/arm/kernel/{kprobes-common.c => probes.c} (67%)
 copy arch/arm/kernel/{kprobes.h => probes.h} (85%)
 create mode 100644 arch/arm/kernel/uprobes-arm.c
 create mode 100644 arch/arm/kernel/uprobes.c
 create mode 100644 arch/arm/kernel/uprobes.h

-- 
1.8.1.2

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


Re: [RFC PATCH 0/4] sched: remove cpu_load decay.

2013-11-26 Thread Alex Shi
On 11/22/2013 02:37 PM, Alex Shi wrote:
>   latest kernel 527d1511310a89+ this patchset
> hackbench -T -g 10 -f 40
>   23.25"  21.7"
>   23.16"  19.99"
>   24.24"  21.53"
> hackbench -p -g 10 -f 40
>   26.52"  22.48"
>   23.89"  24.00"
>   25.65"  23.06"
> hackbench -P -g 10 -f 40
>   20.14"  19.37"
>   19.96"  19.76"
>   21.76"  21.54"
> 
> The git tree for this patchset at:
>  g...@github.com:alexshi/power-scheduling.git no-load-idx 

Fengguang,

Did your kernel testing find sth unusual on this 3 patches?

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


Re: Re: scsi-mq + open-iscsi support patches..?

2013-11-26 Thread kedacomkernel
Hi all,
I used target-pending/scsi-mq to test intel ahci,but it can't work.I 
modify some places, now it can work.But still met hung task or oops.
Who can receive my patch for that?

Thanks!
Jianpeng Ma
>On Sat, 2013-11-02 at 16:10 +, Jayamohan Kallickal wrote:
>
>
>
>> >> On a related note, some iscsi vendor has been hitting a crash with 
>> >> your tree.
>> 
>> >I got an email from Jayamohan recently, but the OOPs did not appear to be 
>> >scsi-mq related..
>> 
>> I do see the crash on my Ubuntu VM running on VirtualBox  but don't see the 
>> crash on a Standalone system. 
>> Attaching the screenshot
>> 
>
>Hi Jayamohan,
>
>Care to enable the virtual serial port for this VM in order to grab the
>full dmesg output..?
>
>Also, an idea of what SATA emulation is being used here would be helpful
>as well.  (eg: lspci -vvv for the ATA device on the running system)
>
>--nab
>
>--
>To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
>the body of a message to majord...@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

[PATCH] WIFI: handle a neglected case in nl80211_new_interface()

2013-11-26 Thread Chao Bi
In nl80211_new_interface(), it calls rdev_add_virtual_intf() to create
a new interface, however, it only checks whether returned value is err
code, but doesn't check if returned value is NULL. The returned value
could be NULL, for example, memory allocation failed when creating a
new interface.

when get a NULL returned value,  nl80211_new_interface() is expected to
return but it actually runs down to access the NULL pointer, this could
lead to a panic.

Signed-off-by: Chao Bi 
---
 net/wireless/nl80211.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index a1eb210..27feeaf 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2512,7 +2512,7 @@ static int nl80211_new_interface(struct sk_buff *skb, 
struct genl_info *info)
wdev = rdev_add_virtual_intf(rdev,
nla_data(info->attrs[NL80211_ATTR_IFNAME]),
type, err ? NULL : , );
-   if (IS_ERR(wdev)) {
+   if (!wdev || IS_ERR(wdev)) {
nlmsg_free(msg);
return PTR_ERR(wdev);
}
-- 
1.7.9.5



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


Re: [PATCH v3 2/6] net: rfkill: gpio: convert to descriptor-based GPIO interface

2013-11-26 Thread Alex Courbot

On 11/26/2013 07:05 PM, Mika Westerberg wrote:

From: Heikki Krogerus 

Convert to the safer gpiod_* family of API functions.


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


[git pull] Please pull powerpc.git merge branch

2013-11-26 Thread Benjamin Herrenschmidt
Hi Linus !

Here are a few powerpc bug fixes post -rc1. The main thing that caused
problem was that CONFIG_CPU_LITTLE_ENDIAN got turned on with allyesconfig
and such, which is not a very good idea especially since it requires a
newer toolchain than what most people have. So we turned it into a
choice instead that defaults to big endian.

Cheers,
Ben.

The following changes since commit 6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae:

  Linux 3.13-rc1 (2013-11-22 11:30:55 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git merge

for you to fetch changes up to 721cb59e9d95eb7f47ec73711ed35ef85e1ea1ca:

  powerpc/windfarm: Fix XServe G5 fan control Makefile issue (2013-11-27 
11:35:47 +1100)


Adam Borowski (1):
  powerpc/85xx: typo in dts: "interupt" (four devices)

Anton Blanchard (1):
  powerpc: allyesconfig should not select CONFIG_CPU_LITTLE_ENDIAN

Benjamin Herrenschmidt (2):
  Merge remote-tracking branch 'scott/master' into merge
  powerpc/windfarm: Fix XServe G5 fan control Makefile issue

Chen Gang (1):
  arch/powerpc/kernel: Use %12.12s instead of %12s to avoid memory overflow

Hari Bathini (1):
  powerpc/kdump: Adding symbols in vmcoreinfo to facilitate dump filtering

LEROY Christophe (1):
  powerpc/8xx: mfspr SPRN_TBRx in lieu of mftb/mftbu is not supported

Michael Neuling (2):
  powerpc: Fix error when cross building TAGS & cscope
  powerpc/signals: Improved mark VSX not saved with small contexts fix

Scott Wood (1):
  powerpc/booke: Only check for hugetlb in flush if vma != NULL

Tiejun Chen (1):
  powerpc/corenet64: compile with CONFIG_E{5,6}500_CPU well

 arch/powerpc/Makefile |  7 +++
 arch/powerpc/boot/dts/xcalibur1501.dts|  4 ++--
 arch/powerpc/boot/dts/xpedite5301.dts |  4 ++--
 arch/powerpc/boot/dts/xpedite5330.dts |  4 ++--
 arch/powerpc/boot/dts/xpedite5370.dts |  4 ++--
 arch/powerpc/boot/util.S  | 14 ++
 arch/powerpc/include/asm/pgalloc-64.h |  1 +
 arch/powerpc/include/asm/ppc_asm.h|  2 ++
 arch/powerpc/include/asm/reg.h|  7 +++
 arch/powerpc/include/asm/timex.h  |  8 
 arch/powerpc/kernel/machine_kexec.c   | 12 
 arch/powerpc/kernel/nvram_64.c|  2 +-
 arch/powerpc/kernel/signal_32.c   | 16 +++-
 arch/powerpc/kernel/signal_64.c   |  6 ++
 arch/powerpc/kernel/vdso32/gettimeofday.S |  6 ++
 arch/powerpc/mm/hugetlbpage-book3e.c  |  3 +--
 arch/powerpc/mm/tlb_nohash.c  |  2 +-
 arch/powerpc/platforms/Kconfig.cputype| 20 +---
 drivers/macintosh/Makefile|  1 +
 19 files changed, 99 insertions(+), 24 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/


Re: nouveau/ NV11: 3.12 freezes if X.org is started headless

2013-11-26 Thread Dave Airlie
On Wed, Nov 27, 2013 at 12:15 PM, Ilia Mirkin  wrote:
> On Tue, Nov 26, 2013 at 8:35 PM, Stefan Lippers-Hollmann  wrote:
>> Hi
>>
>> On Wednesday 27 November 2013, Ilia Mirkin wrote:
>>> On Tue, Nov 26, 2013 at 7:18 PM, Stefan Lippers-Hollmann  
>>> wrote:
>>> > Hi
>>> >
>>> > On Tuesday 26 November 2013, Ilia Mirkin wrote:
>>> >> On Tue, Nov 26, 2013 at 6:03 PM, Stefan Lippers-Hollmann  
>>> >> wrote:
>>> >> > v3.11 is fine, with and without monitor attached.
>>> >> > v3.12 is fine as long as X.org isn't started (but may fail to reboot
>>> >> >   cleanly). If a monitor is connected I don't observe any problems,
>>> >> >   it freezes without a monitor connected.
>>> >> > v3.13-rc1-95-gb975dc3 appears not to freeze without a monitor anymore
>>> >> >   (I didn't confirm that it's fine with a monitor attached), but I
>>> >> >   end up with the following Oops (this is before X.org is started).
>>>
>>> One more idea -- try it with nouveau.runpm=0 -- I've had some odd
>>> results with it on my older cards (but I don't remember hangs, but I
>>> also didn't spend a lot of time on it, just plopped the option in and
>>> moved on). This is a feature that got in in 3.12, and is really the
>>> only major nouveau-affecting change in that kernel for your card
>>> revision.
>>
>> You're spot on, that does the trick.
>
> Great to hear!
>
>>
>> # cat /sys/module/nouveau/parameters/agpmode
>> -1
>> # cat /sys/module/nouveau/parameters/runpm
>> 0
>>
>>   v3.13-rc1-95-gb975dc3
>> + 
>> http://cgit.freedesktop.org/~darktama/nouveau/commit/?id=0397009092427dc60aea8b3c21c00526d8ba
>> + nouveau.runpm=0
>> is now stable, with and without a monitor attached; as is
>>
>>   3.12.1 || v3.12.1-62-g4615252 (stable-queue.git)
>> + nouveau.runpm=0
>>
>
> Dave, looking at the code, it seems like runtime pm should only be
> getting activated by default for optimus systems. Stefan's is clearly
> not one of those, neither is mine. Unfortunately I have no clue how
> the runtime pm subsystem works, but it seems like runtime_suspend()
> may be getting called directly, e.g. if there are no monitors attached
> to nouveau, perhaps as a result of nouveau_crtc_set_config in
> dispnv04/crtc.c. Does the same if (runpm == -1 && !optimus) return
> -EBUSY check belong in the runtime_suspend callback?

Either that or it needs to be calling some of the other runtime
interfaces instead of runtime_autosuspend

maybe that last pm_runtime_put_autosuspend should be just
pm_runtime_put, but that might need testing on an optimus system.

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


  1   2   3   4   5   6   7   8   9   10   >