Re: [PATCH 73/71] ncr5380: Use runtime register mapping

2015-12-06 Thread Geert Uytterhoeven
On Sun, Dec 6, 2015 at 4:39 AM, Finn Thain  wrote:
>> - while (NCR5380_read(C400_CONTROL_STATUS_REG) & 
>> CSR_HOST_BUF_NOT_RDY);
>> + while (NCR5380_read(hostdata->c400_ctl_status) & 
>> CSR_HOST_BUF_NOT_RDY);
>
> The semicolon should appear on the next line where it is more visible.

And adding a cpu_relax() to the empty loop body is another good visual cue.

Gr{oetje,eeting}s,

Geert

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

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


[PATCH] clk: sunxi: Extend the simple gates and handle the Allwinner H3

2015-12-06 Thread Jean-Francois Moine
The H3 has a clock gate definition similar to the other Allwinner SoCs,
but with a different parent clock for each single gate.

Adding the names of the parent clocks in both the source and output clocks
permits the use of the simple-gates driver to define the bus gates
of all known Allwinner SoCs.

Signed-off-by: Jean-Francois Moine 
---
This patch replaces a part of Jens Kuske's patch
[PATCH v5 1/4] clk: sunxi: Add H3 clocks support
---
 Documentation/devicetree/bindings/clock/sunxi.txt | 25 +++
 drivers/clk/sunxi/clk-simple-gates.c  | 14 -
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/clock/sunxi.txt 
b/Documentation/devicetree/bindings/clock/sunxi.txt
index 8a47b77..5736e6d 100644
--- a/Documentation/devicetree/bindings/clock/sunxi.txt
+++ b/Documentation/devicetree/bindings/clock/sunxi.txt
@@ -70,6 +70,7 @@ Required properties:
"allwinner,sun8i-a23-usb-clk" - for usb gates + resets on A23
"allwinner,sun9i-a80-usb-mod-clk" - for usb gates + resets on A80
"allwinner,sun9i-a80-usb-phy-clk" - for usb phy gates + resets on A80
+   "allwinner,sunxi-gates-clk" - simple gates
 
 Required properties for all clocks:
 - reg : shall be the control register address for the clock.
@@ -93,6 +94,12 @@ The "allwinner,sun9i-a80-mmc-config-clk" clock also requires:
 - #reset-cells : shall be set to 1
 - resets : shall be the reset control phandle for the mmc block.
 
+The "allwinner,sunxi-gates-clk" clock also requires:
+- clock-names : corresponding names of the parent clocks
+when the output clocks have different parents.
+These names must be 4 characters long and must appear as a prefix in
+the names of the output clocks. See example.
+
 For "allwinner,sun7i-a20-gmac-clk", the parent clocks shall be fixed rate
 dummy clocks at 25 MHz and 125 MHz, respectively. See example.
 
@@ -203,3 +210,21 @@ mmc_config_clk: clk@01c13000 {
clock-output-names = "mmc0_config", "mmc1_config",
 "mmc2_config", "mmc3_config";
 };
+
+bus_gates: clk@01c20060 {
+   compatible = "allwinner,sunxi-gates-clk";
+   reg = <0x01c20060 0x14>;
+   clocks = <&ahb1>, <&ahb2>;
+   clock-names = "ahb1", "ahb2";
+   clock-indices = <5>, <6>, <8>,
+   <17>, <18>,
+   <26>, <27>,
+   <28>, <29>,
+   <128>, <135>;
+   clock-output-names = "ahb1_ce", "ahb1_dma", "ahb1_mmc0",
+"ahb2_emac", "ahb1_ts",
+"ahb1_ehci2", "ahb1_ehci3",
+"ahb1_otg_ohci0", "ahb2_ohci1",
+"ahb1_ephy", "ahb1_dbg";
+   };
+};
diff --git a/drivers/clk/sunxi/clk-simple-gates.c 
b/drivers/clk/sunxi/clk-simple-gates.c
index 0214c65..81c4cb0 100644
--- a/drivers/clk/sunxi/clk-simple-gates.c
+++ b/drivers/clk/sunxi/clk-simple-gates.c
@@ -29,12 +29,14 @@ static void __init sunxi_simple_gates_setup(struct 
device_node *node,
 {
struct clk_onecell_data *clk_data;
const char *clk_parent, *clk_name;
+   char dyn_clk_parent[8];
struct property *prop;
struct resource res;
void __iomem *clk_reg;
void __iomem *reg;
const __be32 *p;
int number, i = 0, j;
+   bool parent_per_gate;
u8 clk_bit;
u32 index;
 
@@ -42,7 +44,13 @@ static void __init sunxi_simple_gates_setup(struct 
device_node *node,
if (IS_ERR(reg))
return;
 
-   clk_parent = of_clk_get_parent_name(node, 0);
+   parent_per_gate = of_clk_get_parent_count(node) != 1;
+   if (parent_per_gate) {
+   clk_parent = dyn_clk_parent;
+   dyn_clk_parent[4] = '\0';
+   } else {
+   clk_parent = of_clk_get_parent_name(node, 0);
+   }
 
clk_data = kmalloc(sizeof(struct clk_onecell_data), GFP_KERNEL);
if (!clk_data)
@@ -58,6 +66,8 @@ static void __init sunxi_simple_gates_setup(struct 
device_node *node,
of_property_for_each_u32(node, "clock-indices", prop, p, index) {
of_property_read_string_index(node, "clock-output-names",
  i, &clk_name);
+   if (parent_per_gate)
+   strncpy(dyn_clk_parent, clk_name, 4);
 
clk_reg = reg + 4 * (index / 32);
clk_bit = index % 32;
@@ -140,6 +150,8 @@ CLK_OF_DECLARE(sun9i_a80_apb0, 
"allwinner,sun9i-a80-apb0-gates-clk",
   sunxi_simple_gates_init);
 CLK_OF_DECLARE(sun9i_a80_apb1, "allwinner,sun9i-a80-apb1-gates-clk",
   sunxi_simple_gates_init);
+CLK_OF_DECLARE(sunxi_gates, "allwinner,sunxi-gates-clk",sunxi-gates
+  sunxi_simple_gates_init);
 
 static const int sun4i_a10_ahb_critical_clocks[] __initconst = {
14, /* ahb_sdram */

-- 
Ken ar c'hentañ | ** Breizh ha Linux atav! 

Re: deadlock during fuseblk shutdown

2015-12-06 Thread Dmitry Vyukov
On Fri, Nov 20, 2015 at 4:01 PM, Dmitry Vyukov  wrote:
> Hello,
>
> I've hit the following deadlock on
> 8005c49d9aea74d382f474ce11afbbc7d7130bec (Nov 15).
> I know that fuse docs warn about deadlocks and this can happen only
> under root because of the mount call, but maybe there is still
> something to fix. The first suspicious thing is that do_exit in daemon
> sends a fuse request to daemon, which it cannot answer obviously. The
> second thing is that the hanged processes are unkillable and
> /sys/fs/fuse/connections/ is empty, so I don't see any way to repair
> it.
>
> The program is:
>
> // autogenerated by syzkaller (http://github.com/google/syzkaller)
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
>
> #define CLONE_NEWNS 0x0002
>
> int unshare(int flags);
>
> struct msg {
> struct fuse_out_header hdr;
> struct fuse_poll_out data;
> };
>
> void work(const char *bklname)
> {
> unshare(CLONE_NEWNS);
> int fd = open("/dev/fuse", O_RDWR);
> if (fd == -1)
> exit(printf("open /dev/fuse failed: %d\n", errno));
> if (mknod(bklname, S_IFBLK, makedev(7, 199)))
> exit(printf("mknod failed: %d\n", errno));
> char buf[4<<10];
> sprintf(buf, "fd=%d,user_id=%d,group_id=%d,rootmode=0%o", fd,
> getuid(), getgid(), 0xc000);
> if (mount(bklname, bklname, "fuseblk", 0x180, buf))
> exit(printf("mount failed: %d\n", errno));
> read(fd, buf, sizeof(buf));
> struct msg m;
> memset(&m, 0, sizeof(m));
> m.hdr.len = sizeof(m);
> m.hdr.error = 0;
> m.hdr.unique = 1;
> m.data.revents = 7;
> write(fd, &m, sizeof(m));
> exit(1);
> }
>
> int main()
> {
> int pid1 = fork();
> if (pid1 == 0)
> work("./fuseblk1");
> sleep(1);
> kill(pid1, SIGKILL);
> int pid2 = fork();
> if (pid2 == 0)
> work("./fuseblk2");
> sleep(1);
> kill(pid2, SIGKILL);
> return 0;
> }
>
> It results in two hanged processes:
>
> root# cat /proc/2769/stack
> [] request_wait_answer+0x308/0x4c0 fs/fuse/dev.c:436
> [] __fuse_request_send+0xaa/0x100 fs/fuse/dev.c:496
> [] fuse_request_send+0x4b/0x50 fs/fuse/dev.c:509
> [< inline >] fuse_send_destroy fs/fuse/inode.c:367
> [] fuse_put_super+0xa9/0x180 fs/fuse/inode.c:382
> [] generic_shutdown_super+0xcb/0x1d0 fs/super.c:427
> [] kill_block_super+0x52/0xb0 fs/super.c:1047
> [] fuse_kill_sb_blk+0x6b/0x80 fs/fuse/inode.c:1214
> [] deactivate_locked_super+0x60/0xa0 fs/super.c:301
> [] deactivate_super+0x94/0xb0 fs/super.c:332
> [] cleanup_mnt+0x6b/0xd0 fs/namespace.c:1067
> [] __cleanup_mnt+0x16/0x20 fs/namespace.c:1074
> [] task_work_run+0xe1/0x110 kernel/task_work.c:115
> [< inline >] exit_task_work include/linux/task_work.h:21
> [] do_exit+0x55f/0x1690 kernel/exit.c:748
> [] do_group_exit+0xa7/0x190 kernel/exit.c:878
> [< inline >] SYSC_exit_group kernel/exit.c:889
> [] SyS_exit_group+0x1d/0x20 kernel/exit.c:887
> [] entry_SYSCALL_64_fastpath+0x31/0x9a
> arch/x86/entry/entry_64.S:187
>
> root# cat /proc/2772/stack
> [] call_rwsem_down_write_failed+0x13/0x20
> arch/x86/lib/rwsem.S:99
> [] grab_super+0x40/0xf0 fs/super.c:355
> [] sget+0x492/0x630 fs/super.c:468
> [] mount_bdev+0x15a/0x340 fs/super.c:991
> [] fuse_mount_blk+0x34/0x40 fs/fuse/inode.c:1201
> [] mount_fs+0x69/0x200 fs/super.c:1123
> [] vfs_kern_mount+0x7a/0x200 fs/namespace.c:948
> [< inline >] do_new_mount fs/namespace.c:2409
> [] do_mount+0x40b/0x1a80 fs/namespace.c:2725
> [< inline >] SYSC_mount fs/namespace.c:2915
> [] SyS_mount+0x10a/0x1a0 fs/namespace.c:2893
> [] entry_SYSCALL_64_fastpath+0x31/0x9a
> arch/x86/entry/entry_64.S:187
>
>
> The first process holds a superblock mutex, so the whole system
> becomes unstable. For example, sync invocations also hang in D state.
>
> Is this intentional? Or there is something to fix?

ping
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] time: verify time values in adjtimex ADJ_SETOFFSET to avoid overflow

2015-12-06 Thread Thomas Gleixner
On Sat, 5 Dec 2015, Sasha Levin wrote:
> On 12/05/2015 12:10 PM, Thomas Gleixner wrote:
> > On Thu, 3 Dec 2015, Sasha Levin wrote:
> > 
> >> Make sure the tv_usec makes sense. We might multiply them later which can
> >> cause an overflow and undefined behavior.
> >>
> >> Signed-off-by: Sasha Levin 
> >> ---
> >>  kernel/time/timekeeping.c |4 
> >>  1 file changed, 4 insertions(+)
> >>
> >> diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
> >> index d563c19..aa3c1c2 100644
> >> --- a/kernel/time/timekeeping.c
> >> +++ b/kernel/time/timekeeping.c
> >> @@ -1987,6 +1987,10 @@ int do_adjtimex(struct timex *txc)
> >>  
> >>if (txc->modes & ADJ_SETOFFSET) {
> >>struct timespec delta;
> >> +
> >> +  if (txc->time.tv_usec >= USEC_PER_SEC || txc->time.tv_usec <= 
> >> -USEC_PER_SEC)
> >> +  return -EINVAL;
> > 
> > That's not a canonical timeval. timeval_valid() is what you want to
> > check it. Or has adjtimex some magic exception here?
> 
> Nope, it looks like timeval_valid() is indeed what I've needed to use.
> 
> Is there a reason ntp_validate_timex() doesn't do timeval_valid() too
> for at least the ADJ_SETOFFSET case? If not, I'll add it in.

Not that I know, but John might have some opinion on that.

Thanks,

tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: could you respin the "add blkdev name format specifier" series?

2015-12-06 Thread Dmitry Monakhov
Al Viro  writes:

>   It had been posted back in April and got acked by Jan; I'm also
> fine with it and I'd like to apply at least generic + fs/* parts.  Could
> you rebase it to the current mainline and post it?
Ok, in progress.


signature.asc
Description: PGP signature


Re: [PATCH] arm: dts: berlin2q-marvell-dmp: add sdhci1 fully functionality

2015-12-06 Thread Sebastian Hesselbarth
On 30.11.2015 14:54, Jisheng Zhang wrote:
> The sdhci1 on Marvell BG2Q DMP board is used as sdcard interface, we
> have gpios for card detection, write-protect, vqmmc and vmmc.
> 
> This patch adds pinmux for this sdcard interface, then adds regulators
> for vmmc and vqmmc, lastly adds cd-gpios, wp-gpios properties.
> 
> Signed-off-by: Jisheng Zhang 

Applied to berlin/dt.

> ---
> since v1:

Please also increment the patch subject version next time.

Thanks!

Sebastian

>  - move sd1_pmux to soc dtsi
>  - remove cd-inverted and make cd-gpio GPIO_ACTIVE_LOW
> 
>  arch/arm/boot/dts/berlin2q-marvell-dmp.dts | 37 
> --
>  arch/arm/boot/dts/berlin2q.dtsi|  5 
>  2 files changed, 40 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/berlin2q-marvell-dmp.dts 
> b/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
> index cdcf89b..33b2875 100644
> --- a/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
> +++ b/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
> @@ -84,12 +84,45 @@
>   gpio = <&portb 12 GPIO_ACTIVE_HIGH>;
>   enable-active-high;
>   };
> +
> + reg_sdio1_vmmc: regulator@3 {
> + compatible = "regulator-fixed";
> + regulator-min-microvolt = <330>;
> + regulator-max-microvolt = <330>;
> + regulator-name = "sdio1_vmmc";
> + enable-active-high;
> + regulator-boot-on;
> + gpio = <&portb 21 GPIO_ACTIVE_HIGH>;
> + };
> +
> + reg_sdio1_vqmmc: regulator@4 {
> + compatible = "regulator-gpio";
> + regulator-min-microvolt = <180>;
> + regulator-max-microvolt = <330>;
> + regulator-name = "sdio1_vqmmc";
> + regulator-type = "voltage";
> + enable-active-high;
> + gpios = <&portb 16 GPIO_ACTIVE_HIGH>;
> + states = <330 0x1
> +   180 0x0>;
> + };
> + };
> +};
> +
> +&soc_pinctrl {
> + sd1gpio_pmux: sd1pwr-pmux {
> + groups = "G23", "G32";
> + function = "gpio";
>   };
>  };
>  
>  &sdhci1 {
> - broken-cd;
> - sdhci,wp-inverted;
> + vmmc-supply = <®_sdio1_vmmc>;
> + vqmmc-supply = <®_sdio1_vqmmc>;
> + cd-gpios = <&portc 30 GPIO_ACTIVE_LOW>;
> + wp-gpios = <&portd 0 GPIO_ACTIVE_HIGH>;
> + pinctrl-0 = <&sd1gpio_pmux>, <&sd1_pmux>;
> + pinctrl-names = "default";
>   status = "okay";
>  };
>  
> diff --git a/arch/arm/boot/dts/berlin2q.dtsi b/arch/arm/boot/dts/berlin2q.dtsi
> index 8ea177f..73a9362 100644
> --- a/arch/arm/boot/dts/berlin2q.dtsi
> +++ b/arch/arm/boot/dts/berlin2q.dtsi
> @@ -417,6 +417,11 @@
>   soc_pinctrl: pin-controller {
>   compatible = "marvell,berlin2q-soc-pinctrl";
>  
> + sd1_pmux: sd1-pmux {
> + groups = "G31";
> + function = "sd1";
> + };
> +
>   twsi0_pmux: twsi0-pmux {
>   groups = "G6";
>   function = "twsi0";
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] arm64: dts: berlin4ct: support cpuidle-dt

2015-12-06 Thread Sebastian Hesselbarth
On 30.11.2015 14:41, Jisheng Zhang wrote:
> This patch adds an idle-states node to describe the berlin4ct idle
> states and also adds references to the idle-states node in all CPU
> nodes. After this patch cpuidle is enabled.
> 
> Signed-off-by: Jisheng Zhang 

Applied to berlin64/dt with Lorenzo's Ack.

Thanks!

Sebastian

> ---
>  arch/arm64/boot/dts/marvell/berlin4ct.dtsi | 16 
>  1 file changed, 16 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/marvell/berlin4ct.dtsi 
> b/arch/arm64/boot/dts/marvell/berlin4ct.dtsi
> index 39d0676..3649cea 100644
> --- a/arch/arm64/boot/dts/marvell/berlin4ct.dtsi
> +++ b/arch/arm64/boot/dts/marvell/berlin4ct.dtsi
> @@ -69,6 +69,7 @@
>   device_type = "cpu";
>   reg = <0x0>;
>   enable-method = "psci";
> + cpu-idle-states = <&CPU_SLEEP_0>;
>   };
>  
>   cpu1: cpu@1 {
> @@ -76,6 +77,7 @@
>   device_type = "cpu";
>   reg = <0x1>;
>   enable-method = "psci";
> + cpu-idle-states = <&CPU_SLEEP_0>;
>   };
>  
>   cpu2: cpu@2 {
> @@ -83,6 +85,7 @@
>   device_type = "cpu";
>   reg = <0x2>;
>   enable-method = "psci";
> + cpu-idle-states = <&CPU_SLEEP_0>;
>   };
>  
>   cpu3: cpu@3 {
> @@ -90,6 +93,19 @@
>   device_type = "cpu";
>   reg = <0x3>;
>   enable-method = "psci";
> + cpu-idle-states = <&CPU_SLEEP_0>;
> + };
> +
> + idle-states {
> + entry-method = "psci";
> + CPU_SLEEP_0: cpu-sleep-0 {
> + compatible = "arm,idle-state";
> + local-timer-stop;
> + arm,psci-suspend-param = <0x001>;
> + entry-latency-us = <75>;
> + exit-latency-us = <155>;
> + min-residency-us = <1000>;
> + };
>   };
>   };
>  
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/5] Fix regression introduced by set_irq_flags() removal

2015-12-06 Thread Thomas Gleixner
Thomas,

On Sat, 5 Dec 2015, Thomas Gleixner wrote:
> On Fri, 4 Dec 2015, Thomas Petazzoni wrote:
> > Well, the problem is that IRQ_NOAUTOEN is a global flag, which is OK
> > for global interrupts, but not good for per-CPU interrupts, since you
> > don't have the information on a per-CPU basis of which interrupt was
> > enabled before suspend, and therefore should be re-enabled after resume.
> > 
> > Until now, we don't have the problem since the only per-CPU interrupt
> > we were using was the local timer interrupt, and the local timers on
> > secondary CPUs are switched off during suspend and re-enabled during
> > resume. So re-enabling the interrupt on the boot CPU on resume is
> > sufficient.
> > 
> > However, our network driver recently switched to using per-CPU
> > interrupts as well, and in this case, it is really important to be able
> > to re-enable the per-CPU interrupts and the appropriate CPUs at resume
> > time. Since our HW registers are made so that it is not possible to
> > read out at suspend time which interrupts are enabled, we have to ask
> > the Linux kernel at resume time which interrupts should be re-enabled
> > at the HW level. Which is what my more complicated series was doing.
> > 
> > Do you have other suggestions to allow us to know which per-CPU
> > interrupts should be re-enabled on the different CPUs at resume time ?
> 
> Ok. That makes sense. So I'm going to pick up the core change.

Second thoughts. That network driver example does not make sense.

You have a suspend/resume mechanism and a cpu hotplug machinery in
that driver, right? So that should be responsible for
disabling/enabling the per cpu interrupts. I don't think it's the
proper way to do that in the irq chip driver at some random point
during resume as you'd reenable interrupts on cpus which are not
online yet.

Thanks,

tglx




--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] drm: do not use device name as a format string

2015-12-06 Thread Daniel Vetter
On Sat, Dec 05, 2015 at 10:45:50AM +0100, Nicolas Iooss wrote:
> Hello,
> I sent the path below a few weeks ago and did not have any feedback.
> Is there any issue in it that I need to fix before submitting it again?

Sorry, must have missed this.

> 
> Thanks,
> Nicolas Iooss
> 
> On 11/18/2015 06:58 PM, Nicolas Iooss wrote:
> > drm_dev_set_unique() formats its parameter using kvasprintf() but many
> > of its callers directly pass dev_name(dev) as printf format string,
> > without any format parameter.  This can cause some issues when the
> > device name contains '%' characters.
> > 
> > To avoid any potential issue, always use "%s" when using
> > drm_dev_set_unique() with dev_name().

Not sure this is worth it really, normally people don't place % characters
into their device names, ever. And if they do it'll blow up. There's also
no security issue here since userspace can't set this name.

If the maintainers of the affected drivers don't want this I won't merge
this patch.

Thanks, Daniel

> > 
> > Signed-off-by: Nicolas Iooss 
> > ---
> >  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 2 +-
> >  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c| 2 +-
> >  drivers/gpu/drm/tegra/drm.c  | 2 +-
> >  drivers/gpu/drm/vc4/vc4_drv.c| 2 +-
> >  include/drm/drmP.h   | 1 +
> >  5 files changed, 5 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c 
> > b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> > index 244df0a440b7..0d720d3a7ee0 100644
> > --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> > +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> > @@ -733,7 +733,7 @@ static int atmel_hlcdc_dc_drm_probe(struct 
> > platform_device *pdev)
> > if (!ddev)
> > return -ENOMEM;
> >  
> > -   ret = drm_dev_set_unique(ddev, dev_name(ddev->dev));
> > +   ret = drm_dev_set_unique(ddev, "%s", dev_name(ddev->dev));
> > if (ret)
> > goto err_unref;
> >  
> > diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c 
> > b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> > index 1930234ba5f1..947d75f59881 100644
> > --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> > +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> > @@ -363,7 +363,7 @@ static int fsl_dcu_drm_probe(struct platform_device 
> > *pdev)
> > fsl_dev->np = dev->of_node;
> > drm->dev_private = fsl_dev;
> > dev_set_drvdata(dev, fsl_dev);
> > -   drm_dev_set_unique(drm, dev_name(dev));
> > +   drm_dev_set_unique(drm, "%s", dev_name(dev));
> >  
> > ret = drm_dev_register(drm, 0);
> > if (ret < 0)
> > diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
> > index 159ef515cab1..b278f60f4376 100644
> > --- a/drivers/gpu/drm/tegra/drm.c
> > +++ b/drivers/gpu/drm/tegra/drm.c
> > @@ -991,7 +991,7 @@ static int host1x_drm_probe(struct host1x_device *dev)
> > if (!drm)
> > return -ENOMEM;
> >  
> > -   drm_dev_set_unique(drm, dev_name(&dev->dev));
> > +   drm_dev_set_unique(drm, "%s", dev_name(&dev->dev));
> > dev_set_drvdata(&dev->dev, drm);
> >  
> > err = drm_dev_register(drm, 0);
> > diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
> > index 6e730605edcc..c90a451aaa79 100644
> > --- a/drivers/gpu/drm/vc4/vc4_drv.c
> > +++ b/drivers/gpu/drm/vc4/vc4_drv.c
> > @@ -168,7 +168,7 @@ static int vc4_drm_bind(struct device *dev)
> > vc4->dev = drm;
> > drm->dev_private = vc4;
> >  
> > -   drm_dev_set_unique(drm, dev_name(dev));
> > +   drm_dev_set_unique(drm, "%s", dev_name(dev));
> >  
> > drm_mode_config_init(drm);
> > if (ret)
> > diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> > index 0b921ae06cd8..995fb96cb740 100644
> > --- a/include/drm/drmP.h
> > +++ b/include/drm/drmP.h
> > @@ -1049,6 +1049,7 @@ void drm_dev_ref(struct drm_device *dev);
> >  void drm_dev_unref(struct drm_device *dev);
> >  int drm_dev_register(struct drm_device *dev, unsigned long flags);
> >  void drm_dev_unregister(struct drm_device *dev);
> > +__printf(2, 3)
> >  int drm_dev_set_unique(struct drm_device *dev, const char *fmt, ...);
> >  
> >  struct drm_minor *drm_minor_acquire(unsigned int minor_id);
> > 
> 
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/13] perf tools: Move perf subcommand framework into lib/tools

2015-12-06 Thread Ingo Molnar

* Josh Poimboeuf  wrote:

> Ingo suggested that I factor out the perf subcommand functionality
> (originally copied from git) into tools/lib so that it can be used by
> stacktool[*] and possibly others.
> 
> All the subcommand option handling files have been moved into libapi,
> including parse-options.c, run-command.c, exec_cmd.c, help.c, usage.c,
> and their dependencies.  Since several of the dependencies are more
> general-purpose "utilities" which aren't directly related to
> subcommands, I put everything in 'tools/lib/api/util'.  They're linked
> into perf as part of the libapi.a library.
> 
> Patches 1-10 do some cleanups and splitting up of the code in
> preparation for the move.
> 
> Patch 11 does the actual moving of the files into tools/lib/api/util.
> 
> [*] https://lkml.kernel.org/r/cover.1445443144.git.jpoim...@redhat.com
> 
> Josh Poimboeuf (13):
>   perf: Use -iquote for local include paths
>   perf: Split up util.h
>   perf: Move term functions out of util.c
>   perf: Remove unused pager_use_color variable
>   perf: Split up cache.h
>   perf: Remove cache.h
>   perf: Save cmdline arguments earlier
>   perf: Remove check for unused PERF_PAGER_IN_USE
>   perf: Move cmd_version() to builtin-version.c
>   perf: Move help_unknown_cmd() to its own file
>   perf tools: Move strlcpy() to tools/lib/string.c
>   perf tools: Move perf subcommand framework into a library
>   perf tools: Move subcommand framework and related utils to libapi

>  133 files changed, 852 insertions(+), 761 deletions(-)

So this split-out looks great to me!

A bit of a background: this series is a necessary precondition of me being able 
to 
merge 'stacktool' and the frame pointer handling enhancements Josh is working 
on - 
but it would be nice if this could all be done via Arnaldo's perf tree to 
minimize 
any impact on pending perf work.

I've Cc:-ed Namhyung and Jiri as well, who've done a lot of work in perf/util/.

Thanks,

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


[GIT pull] x86 fixes for 4.4

2015-12-06 Thread Thomas Gleixner
Linus,

please pull the latest x86-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
x86-urgent-for-linus

Another round of fixes for x86:

 - Move the initialization of the microcode driver to late_initcall to
   make sure everything that init function needs is available.

 - Make sure that lockdep knows about interrupts being off in the
   entry code before calling into c-code.

 - Undo the cpu hotplug init delay regression.

 - Use the proper conditionals in the  mpx instruction decoder.

 - Fixup restart_syscall for x32 tasks.

 - Fix the hugepage regression on PAE kernels which was introduced
   with the latest PAT changes.

Thanks,

tglx

-->
Andy Lutomirski (1):
  x86/entry/64: Fix irqflag tracing wrt context tracking

Borislav Petkov (1):
  x86/microcode: Initialize the driver late when facilities are up

Dave Hansen (1):
  x86/mpx: Fix instruction decoder condition

Dmitry V. Levin (1):
  x86/signal: Fix restart_syscall number for x32 tasks

Kirill A. Shutemov (1):
  x86/mm: Fix regression with huge pages on PAE

Len Brown (1):
  x86 smpboot: Re-enable init_udelay=0 by default on modern CPUs


 arch/x86/boot/boot.h |  1 -
 arch/x86/boot/video-mode.c   |  2 ++
 arch/x86/boot/video.c|  2 ++
 arch/x86/entry/entry_64.S| 19 ++-
 arch/x86/include/asm/page_types.h| 16 +---
 arch/x86/include/asm/pgtable_types.h | 14 --
 arch/x86/include/asm/x86_init.h  |  1 -
 arch/x86/kernel/cpu/microcode/core.c |  1 +
 arch/x86/kernel/setup.c  |  2 --
 arch/x86/kernel/signal.c | 17 ++---
 arch/x86/kernel/smpboot.c|  9 +
 arch/x86/mm/mpx.c|  6 +++---
 12 files changed, 54 insertions(+), 36 deletions(-)

diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h
index 0033e96c3f09..9011a88353de 100644
--- a/arch/x86/boot/boot.h
+++ b/arch/x86/boot/boot.h
@@ -23,7 +23,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include "bitops.h"
 #include "ctype.h"
diff --git a/arch/x86/boot/video-mode.c b/arch/x86/boot/video-mode.c
index aa8a96b052e3..95c7a818c0ed 100644
--- a/arch/x86/boot/video-mode.c
+++ b/arch/x86/boot/video-mode.c
@@ -19,6 +19,8 @@
 #include "video.h"
 #include "vesa.h"
 
+#include 
+
 /*
  * Common variables
  */
diff --git a/arch/x86/boot/video.c b/arch/x86/boot/video.c
index 05111bb8d018..77780e386e9b 100644
--- a/arch/x86/boot/video.c
+++ b/arch/x86/boot/video.c
@@ -13,6 +13,8 @@
  * Select video mode
  */
 
+#include 
+
 #include "boot.h"
 #include "video.h"
 #include "vesa.h"
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 53616ca03244..a55697d19824 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -509,6 +509,17 @@ END(irq_entries_start)
 * tracking that we're in kernel mode.
 */
SWAPGS
+
+   /*
+* We need to tell lockdep that IRQs are off.  We can't do this until
+* we fix gsbase, and we should do it before enter_from_user_mode
+* (which can take locks).  Since TRACE_IRQS_OFF idempotent,
+* the simplest way to handle it is to just call it twice if
+* we enter from user mode.  There's no reason to optimize this since
+* TRACE_IRQS_OFF is a no-op if lockdep is off.
+*/
+   TRACE_IRQS_OFF
+
 #ifdef CONFIG_CONTEXT_TRACKING
call enter_from_user_mode
 #endif
@@ -1049,12 +1060,18 @@ ENTRY(error_entry)
SWAPGS
 
 .Lerror_entry_from_usermode_after_swapgs:
+   /*
+* We need to tell lockdep that IRQs are off.  We can't do this until
+* we fix gsbase, and we should do it before enter_from_user_mode
+* (which can take locks).
+*/
+   TRACE_IRQS_OFF
 #ifdef CONFIG_CONTEXT_TRACKING
call enter_from_user_mode
 #endif
+   ret
 
 .Lerror_entry_done:
-
TRACE_IRQS_OFF
ret
 
diff --git a/arch/x86/include/asm/page_types.h 
b/arch/x86/include/asm/page_types.h
index c5b7fb2774d0..cc071c6f7d4d 100644
--- a/arch/x86/include/asm/page_types.h
+++ b/arch/x86/include/asm/page_types.h
@@ -9,19 +9,21 @@
 #define PAGE_SIZE  (_AC(1,UL) << PAGE_SHIFT)
 #define PAGE_MASK  (~(PAGE_SIZE-1))
 
+#define PMD_PAGE_SIZE  (_AC(1, UL) << PMD_SHIFT)
+#define PMD_PAGE_MASK  (~(PMD_PAGE_SIZE-1))
+
+#define PUD_PAGE_SIZE  (_AC(1, UL) << PUD_SHIFT)
+#define PUD_PAGE_MASK  (~(PUD_PAGE_SIZE-1))
+
 #define __PHYSICAL_MASK((phys_addr_t)((1ULL << 
__PHYSICAL_MASK_SHIFT) - 1))
 #define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1)
 
-/* Cast PAGE_MASK to a signed type so that it is sign-extended if
+/* Cast *PAGE_MASK to a signed type so that it is sign-extended if
virtual addresses are 32-bits but physical addresses are larger
(ie, 32-bit PAE). */
 #define PHYSICAL_PAGE_MASK (((signed lon

Re: Reorganize perf kernel side

2015-12-06 Thread Ingo Molnar

* Borislav Petkov  wrote:

> Hi guys,
> 
> so I've had my eyes on this for a long time now and it has managed to
> get on my nerves just enough to do something about it :-)
> 
> So how about moving perf stuff to arch/x86/perf/ and get rid of the
> prefixes in the filenames. This also flattens our folder structure which
> is a good thing and which we've been talking about in the past.
> 
> In order to diminish churn, I can do the whole thing in 4-5 patches'
> sets, after having run enough *config smoke tests and 0day bot too.
> Anyway, something like that.
> 
> perf_event__.c
> 
> can then move to arch/x86/perf//type.c
> 
> and have much saner structure.
> 
> Thoughts?

Yeah, it would be lovely if you could do that - but could we please name it 
'events' instead of 'perf', to follow the existing namespace pattern we are 
using 
for the core bits, where we have kernel/events/ for the core bits, not 
kernel/perf/?

Also, how about naming the core x86 bits like this:

  arch/x86/events/core.c

which would give us a clear path to split-out core functionality eventually, 
such 
as:

  arch/x86/events/sched.c
  arch/x86/events/constraints.c
  ...etc...
  ...

Just like we've already split out functionality from kernel/events/core.c into 
kernel/events/ring_buffer.c.

Btw., kernel/sched/ is using a similar approach, there's core.c, and various 
split-out sub-modules. We are slowly migrating from the original humunguous 
kernel/sched.c to a more finegrained kernel/sched/subsys.c structure.

... and as you suggested, the x86 vendor dependent bits would be in their own, 
but 
easily accessible directory close to the core, as you suggested:

  arch/x86/events/intel/
  arch/x86/events/amd/
  ...

as a lot of work is happening in that space, so promoting it up in the 
namespace 
helps.

So, as an example, we'd have renames like this:

 arch/x86/kernel/cpu/perf_event_intel_uncore_nhmex.c
  => arch/x86/events/intel/uncore_nhmex.c

which will be 30% easier to type! Once our muscle memory has re-trained that 
is. ;-)

Thanks,

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


[GIT pull] scheduler fixes for 4.4

2015-12-06 Thread Thomas Gleixner
Linus,

please pull the latest sched-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
sched-urgent-for-linus

This updates contains the following changes:

 - Fix a signal handling regression in the bit wait functions.

 - Avoid false positive warnings in the wakeup path.

 - Initialize the scheduler root domain properly.

 - Handle gtime calculations in proc/$PID/stat proper.

 - Add more documentation for the barriers in try_to_wake_up().

 - Fix a subtle race in try_to_wake_up() which might cause a task to
   be scheduled on two cpus

 - Compile static helper function only when it is used.


Thanks,

tglx

-->
Arnd Bergmann (1):
  sched/rt: Hide the push_irq_work_func() declaration

Hiroshi Shimamoto (1):
  sched/cputime: Fix invalid gtime in proc

Peter Zijlstra (3):
  sched/wait: Fix signal handling in bit wait helpers
  sched/core: Better document the try_to_wake_up() barriers
  sched/core: Fix an SMP ordering race in try_to_wake_up() vs. schedule()

Sasha Levin (1):
  sched/core: Remove false-positive warning from wake_up_process()

Xunlei Pang (1):
  sched/core: Clear the root_domain cpumasks in init_rootdomain()


 kernel/sched/core.c| 36 ++--
 kernel/sched/cputime.c |  3 +++
 kernel/sched/rt.c  |  2 +-
 kernel/sched/sched.h   |  3 +++
 kernel/sched/wait.c| 16 
 5 files changed, 45 insertions(+), 15 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 4d568ac9319e..7063c6a07440 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1947,13 +1947,38 @@ try_to_wake_up(struct task_struct *p, unsigned int 
state, int wake_flags)
 
 #ifdef CONFIG_SMP
/*
+* Ensure we load p->on_cpu _after_ p->on_rq, otherwise it would be
+* possible to, falsely, observe p->on_cpu == 0.
+*
+* One must be running (->on_cpu == 1) in order to remove oneself
+* from the runqueue.
+*
+*  [S] ->on_cpu = 1;   [L] ->on_rq
+*  UNLOCK rq->lock
+*  RMB
+*  LOCK   rq->lock
+*  [S] ->on_rq = 0;[L] ->on_cpu
+*
+* Pairs with the full barrier implied in the UNLOCK+LOCK on rq->lock
+* from the consecutive calls to schedule(); the first switching to our
+* task, the second putting it to sleep.
+*/
+   smp_rmb();
+
+   /*
 * If the owning (remote) cpu is still in the middle of schedule() with
 * this task as prev, wait until its done referencing the task.
 */
while (p->on_cpu)
cpu_relax();
/*
-* Pairs with the smp_wmb() in finish_lock_switch().
+* Combined with the control dependency above, we have an effective
+* smp_load_acquire() without the need for full barriers.
+*
+* Pairs with the smp_store_release() in finish_lock_switch().
+*
+* This ensures that tasks getting woken will be fully ordered against
+* their previous state and preserve Program Order.
 */
smp_rmb();
 
@@ -2039,7 +2064,6 @@ out:
  */
 int wake_up_process(struct task_struct *p)
 {
-   WARN_ON(task_is_stopped_or_traced(p));
return try_to_wake_up(p, TASK_NORMAL, 0);
 }
 EXPORT_SYMBOL(wake_up_process);
@@ -5847,13 +5871,13 @@ static int init_rootdomain(struct root_domain *rd)
 {
memset(rd, 0, sizeof(*rd));
 
-   if (!alloc_cpumask_var(&rd->span, GFP_KERNEL))
+   if (!zalloc_cpumask_var(&rd->span, GFP_KERNEL))
goto out;
-   if (!alloc_cpumask_var(&rd->online, GFP_KERNEL))
+   if (!zalloc_cpumask_var(&rd->online, GFP_KERNEL))
goto free_span;
-   if (!alloc_cpumask_var(&rd->dlo_mask, GFP_KERNEL))
+   if (!zalloc_cpumask_var(&rd->dlo_mask, GFP_KERNEL))
goto free_online;
-   if (!alloc_cpumask_var(&rd->rto_mask, GFP_KERNEL))
+   if (!zalloc_cpumask_var(&rd->rto_mask, GFP_KERNEL))
goto free_dlo_mask;
 
init_dl_bw(&rd->dl_bw);
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index 26a54461bf59..05de80b48586 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -788,6 +788,9 @@ cputime_t task_gtime(struct task_struct *t)
unsigned int seq;
cputime_t gtime;
 
+   if (!context_tracking_is_enabled())
+   return t->gtime;
+
do {
seq = read_seqbegin(&t->vtime_seqlock);
 
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index e3cc16312046..8ec86abe0ea1 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -64,7 +64,7 @@ static void start_rt_bandwidth(struct rt_bandwidth *rt_b)
raw_spin_unlock(&rt_b->rt_runtime_lock);
 }
 
-#ifdef CONFIG_SMP
+#if defined(CONFIG_SMP) && defined(HAVE_RT_PUSH_IPI)
 static void push_irq_work_func(struct irq_work *work);
 #endif
 
diff --git a/kernel/sch

[PATCH 01/10] sh: Replace "hweight_long(flags) != 1" with "!is_power_of_2(flags)"

2015-12-06 Thread Zhaoxiu Zeng
From: Zeng Zhaoxiu 

Signed-off-by: Zeng Zhaoxiu 
---
 arch/sh/kernel/io_trapped.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/sh/kernel/io_trapped.c b/arch/sh/kernel/io_trapped.c
index f8ce362..d8f32bf 100644
--- a/arch/sh/kernel/io_trapped.c
+++ b/arch/sh/kernel/io_trapped.c
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -62,7 +63,7 @@ int register_trapped_io(struct trapped_io *tiop)
}
 
/* support IORESOURCE_IO _or_ MEM, not both */
-   if (hweight_long(flags) != 1)
+   if (!is_power_of_2(flags))
goto bad;
 
n = len >> PAGE_SHIFT;
-- 
2.5.0

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


[GIT pull] perf fixes for 4.4

2015-12-06 Thread Thomas Gleixner
Linus,

please pull the latest perf-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
perf-urgent-for-linus

Some more perf fixes:

 - Properly read lock RCU in the cgroup perf context switch code.

 - Fix a LBR call stack regression.

 - Improve precice instruction sampling on modern Intel machines.

 - Fix a deadlock for PERF_EVENT_IOC_PERIOD events.

 - Fixup the Haswell constraints table.

 - Fixup a constraints macro in the x86/intel code.

 - Prevent task exit event from being generated twice.

 - E-mail address updates for Peter Zijlstra

Thanks,

tglx

-->
Andi Kleen (3):
  perf/x86: Fix LBR call stack save/restore
  perf/x86: Use INST_RETIRED.TOTAL_CYCLES_PS for cycles:pp for Skylake
  perf/x86: Use INST_RETIRED.PREC_DIST for cycles:ppp

Jiri Olsa (2):
  perf/x86/intel: Fix INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_NA macro
  perf: Do not send exit event twice

Peter Zijlstra (3):
  perf: Update email address in MAINTAINERS
  treewide: Remove old email address
  perf: Fix PERF_EVENT_IOC_PERIOD deadlock

Stephane Eranian (2):
  perf/core: Fix RCU problem with cgroup context switching code
  perf/core: Robustify the perf_cgroup_from_task() RCU checks

Yuanfang Chen (1):
  perf/x86/intel: Make L1D_PEND_MISS.FB_FULL not constrained on Haswell


 MAINTAINERS|  2 +-
 arch/blackfin/kernel/perf_event.c  |  2 +-
 arch/sh/kernel/perf_event.c|  2 +-
 arch/sparc/kernel/perf_event.c |  2 +-
 arch/tile/kernel/perf_event.c  |  2 +-
 arch/x86/kernel/cpu/perf_event.c   |  5 +-
 arch/x86/kernel/cpu/perf_event.h   |  8 +--
 arch/x86/kernel/cpu/perf_event_intel.c | 52 --
 arch/x86/kernel/cpu/perf_event_intel_cqm.c |  2 +-
 arch/x86/kernel/cpu/perf_event_intel_ds.c  | 11 ++--
 arch/x86/kernel/cpu/perf_event_intel_lbr.c |  4 +-
 arch/x86/kernel/irq_work.c |  2 +-
 include/asm-generic/tlb.h  |  2 +-
 include/linux/jump_label.h |  2 +-
 include/linux/lockdep.h|  2 +-
 include/linux/perf_event.h |  6 ++-
 include/linux/proportions.h|  2 +-
 include/linux/uprobes.h|  2 +-
 kernel/events/callchain.c  |  2 +-
 kernel/events/core.c   | 84 ++
 kernel/events/ring_buffer.c|  2 +-
 kernel/events/uprobes.c|  2 +-
 kernel/irq_work.c  |  2 +-
 kernel/jump_label.c|  2 +-
 kernel/locking/lockdep.c   |  2 +-
 kernel/locking/lockdep_proc.c  |  2 +-
 kernel/sched/clock.c   |  2 +-
 kernel/sched/fair.c|  2 +-
 kernel/trace/trace_event_perf.c|  2 +-
 lib/btree.c|  2 +-
 lib/proportions.c  |  2 +-
 mm/page-writeback.c|  2 +-
 32 files changed, 157 insertions(+), 63 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 050d0e77a2cf..a45fe3538d2f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8284,7 +8284,7 @@ F:include/linux/delayacct.h
 F: kernel/delayacct.c
 
 PERFORMANCE EVENTS SUBSYSTEM
-M: Peter Zijlstra 
+M: Peter Zijlstra 
 M: Ingo Molnar 
 M: Arnaldo Carvalho de Melo 
 L: linux-kernel@vger.kernel.org
diff --git a/arch/blackfin/kernel/perf_event.c 
b/arch/blackfin/kernel/perf_event.c
index 1e9c8b0bf486..170d786807c4 100644
--- a/arch/blackfin/kernel/perf_event.c
+++ b/arch/blackfin/kernel/perf_event.c
@@ -14,7 +14,7 @@
  *  Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar
  *  Copyright (C) 2009 Jaswinder Singh Rajput
  *  Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter
- *  Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra 
+ *  Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra
  *  Copyright (C) 2009 Intel Corporation, 
  *
  * ppc:
diff --git a/arch/sh/kernel/perf_event.c b/arch/sh/kernel/perf_event.c
index 7cfd7f153966..4dca18347ee9 100644
--- a/arch/sh/kernel/perf_event.c
+++ b/arch/sh/kernel/perf_event.c
@@ -10,7 +10,7 @@
  *  Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar
  *  Copyright (C) 2009 Jaswinder Singh Rajput
  *  Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter
- *  Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra 
+ *  Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra
  *  Copyright (C) 2009 Intel Corporation, 
  *
  * ppc:
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index b0da5aedb336..3091267c5cc3 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -9,7 +9,7 @@
  *  Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar
  *  Copyright (C) 2009 Jaswinder Singh Rajput
  *  Copyright (C) 2009 A

Re: [PATCH v2 PART-RESEND 0/2] berlin sdhci clock clean up

2015-12-06 Thread Sebastian Hesselbarth
On 19.11.2015 21:31, Sebastian Hesselbarth wrote:
> On 16.11.2015 11:56, Jisheng Zhang wrote:
>> Add or fix the optional clock property, then remove the CLK_IGNORE_UNUSED
>> flag for sdio clk(s).
>>
>> This is a partialy resend of 
>> http://lists.infradead.org/pipermail/linux-arm-kernel/2015-October/379457.html
>>
>> patch3, patch4 has been merged.
> 
> Great! Really!
> 
> As they have been taken without my Acked-by, ignoring my request to
> _not_ remove the CLK_IGNORE_UNUSED flags _before_ these two, the
> remaining patches now become fixes.
> 
> Please resend the patches with a proper description what and why they
> are fixes now.

Is this going to be resolved anytime soon?

If not, I am going to send a revert for the CLK_IGNORE_UNUSED patch
and we start this from the beginning.

Sebastian

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] Documentation: email-clients.txt

2015-12-06 Thread Sanidhya Solanki
Patch included below. As an aside, thank you for the excellent work on
the books and other documentation.


Documentation: email-clients.txt

The information for Claws Mail, Evolution and Thunderbird was out of
date. It has been updated with new instructions and warnings.

Signed-off-by: Sanidhya Solanki 
---
 Documentation/email-clients.txt | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/Documentation/email-clients.txt
b/Documentation/email-clients.txt index 2d485de..8819c90 100644
--- a/Documentation/email-clients.txt
+++ b/Documentation/email-clients.txt
@@ -79,17 +79,27 @@ to insert into the message.
 ~~
 Claws Mail (GUI)
 
-Works. Some people use this successfully for patches.
+Tested and Works as of December 2015. Some people use this successfully
+for patches.
 
 To insert a patch use Message->Insert File (CTRL+i) or an external
editor. 
 If the inserted patch has to be edited in the Claws composition window
 "Auto wrapping" in Configuration->Preferences->Compose->Wrapping
should be -disabled.
+disabled. Also, under the heading "View", sub-heading "Character
Encoding" +, choose "Unicode (UTF - 8)"
+
+Do remember that if you insert or type something in the main text area,
+and decide to delete it, you will need to reset the formatting by
opening +a new window for the change you want to make. Re-using the
window in which +you deleted the text will lead to the new message
being mangled. 
 ~~
 Evolution (GUI)
 
+As of December 2015, the composing & inserting  method described below
+does not work.
+
 Some people use this successfully for patches.
 
 When composing mail select: Preformat
@@ -244,8 +254,9 @@ Sylpheed (GUI)
 ~~
 Thunderbird (GUI)
 
-Thunderbird is an Outlook clone that likes to mangle text, but there
are ways -to coerce it into behaving.
+Thunderbird is an Outlook clone that likes to mangle text, but there
are +ways to coerce it into behaving. In December 2015, the internal
editor +options do not appear to work.
 
 - Allow use of an external editor:
   The easiest thing to do with Thunderbird and patches is to use an
-- 
2.5.0

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


[PATCH 02/10] brcmstb_gisb: Replace "hweight_long(mask) != 1" with "!is_power_of_2(mask)"

2015-12-06 Thread Zhaoxiu Zeng
From: Zeng Zhaoxiu 

Signed-off-by: Zeng Zhaoxiu 
---
 drivers/bus/brcmstb_gisb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/brcmstb_gisb.c b/drivers/bus/brcmstb_gisb.c
index f364fa4..2816a04 100644
--- a/drivers/bus/brcmstb_gisb.c
+++ b/drivers/bus/brcmstb_gisb.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #ifdef CONFIG_ARM
 #include 
@@ -171,7 +172,7 @@ brcmstb_gisb_master_to_str(struct brcmstb_gisb_arb_device 
*gdev,
 {
u32 mask = gdev->valid_mask & masters;
 
-   if (hweight_long(mask) != 1)
+   if (!is_power_of_2(mask))
return NULL;
 
return gdev->master_names[ffs(mask) - 1];
-- 
2.5.0

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


Re: [PATCH] drm: do not use device name as a format string

2015-12-06 Thread Nicolas Iooss
On 12/06/2015 10:35 AM, Daniel Vetter wrote:
>> On 11/18/2015 06:58 PM, Nicolas Iooss wrote:
>>> drm_dev_set_unique() formats its parameter using kvasprintf() but many
>>> of its callers directly pass dev_name(dev) as printf format string,
>>> without any format parameter.  This can cause some issues when the
>>> device name contains '%' characters.
>>>
>>> To avoid any potential issue, always use "%s" when using
>>> drm_dev_set_unique() with dev_name().
> 
> Not sure this is worth it really, normally people don't place % characters
> into their device names, ever. And if they do it'll blow up. There's also
> no security issue here since userspace can't set this name.
> 
> If the maintainers of the affected drivers don't want this I won't merge
> this patch.

Actually I had the same opinion before I began to add __printf
attributes and "%s" in several places in the kernel to make
-Wformat-security useful.  This led me to discover some funny issues
like the one fixed by commit 3958b79266b1 ("configfs: fix kernel
infoleak through user-controlled format string",
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=3958b79266b14729edd61daf9dfb84de45f4ec6d
).  The patch I sent is in fact a very small step towards making
-Wformat-security useful again to detect "real" issues.

Of course, if you do not feel it is worth it and believe that dev_name
is fully controlled by trusted sources which will never introduce any %
character, I understand your will of not merging my patch.

Regards,
Nicolas

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 21/72] ncr5380: Sleep when polling, if possible

2015-12-06 Thread Geert Uytterhoeven
Hi Finn,

On Sun, Dec 6, 2015 at 2:31 AM, Finn Thain  wrote:
> When in process context, sleep during polling if doing so won't add
> significant latency. In interrupt context or if the lock is held, poll
> briefly then give up. Keep both core drivers in sync.
>
> Calibrate busy-wait iterations to allow for variation in chip register
> access times between different 5380 hardware implementations.
>
> Signed-off-by: Finn Thain 
>
> ---
>
> Changed since v1:
> - Don't rely on loops_per_jiffy to estimate register access speed, measure
>   it instead.
>
> ---
>  drivers/scsi/NCR5380.c   |   77 
> +--
>  drivers/scsi/NCR5380.h   |1
>  drivers/scsi/atari_NCR5380.c |   59 
>  3 files changed, 84 insertions(+), 53 deletions(-)
>
> Index: linux/drivers/scsi/NCR5380.c
> ===
> --- linux.orig/drivers/scsi/NCR5380.c   2015-12-06 12:29:51.0 +1100
> +++ linux/drivers/scsi/NCR5380.c2015-12-06 12:29:54.0 +1100
> @@ -293,44 +293,48 @@ static inline void initialize_SCp(struct
>  }
>
>  /**
> - * NCR5380_poll_politely   -   wait for NCR5380 status bits
> - * @instance: controller to poll
> - * @reg: 5380 register to poll
> - * @bit: Bitmask to check
> - * @val: Value required to exit
> - *
> - * Polls the NCR5380 in a reasonably efficient manner waiting for
> - * an event to occur, after a short quick poll we begin giving the
> - * CPU back in non IRQ contexts
> + * NCR5380_poll_politely - wait for chip register value
> + * @instance: controller to poll
> + * @reg: 5380 register to poll
> + * @bit: Bitmask to check
> + * @val: Value required to exit
> + * @wait: Time-out in jiffies
> + *
> + * Polls the chip in a reasonably efficient manner waiting for an
> + * event to occur. After a short quick poll we begin to yield the CPU
> + * (if possible). In irq contexts the time-out is arbitrarily limited.
> + * Callers may hold locks as long as they are held in irq mode.
>   *
> - * Returns the value of the register or a negative error code.
> + * Returns 0 if event occurred otherwise -ETIMEDOUT.
>   */
> -
> -static int NCR5380_poll_politely(struct Scsi_Host *instance, int reg, int 
> bit, int val, int t)
> +
> +static int NCR5380_poll_politely(struct Scsi_Host *instance,
> + int reg, int bit, int val, int wait)
>  {
> -   int n = 500;/* At about 8uS a cycle for the cpu access */
> -   unsigned long end = jiffies + t;
> -   int r;
> -
> -   while( n-- > 0)
> -   {
> -   r = NCR5380_read(reg);
> -   if((r & bit) == val)
> +   struct NCR5380_hostdata *hostdata = shost_priv(instance);
> +   unsigned long deadline = jiffies + wait;
> +   unsigned long n;
> +
> +   /* Busy-wait for up to 10 ms */
> +   n = min(1U, jiffies_to_usecs(wait));
> +   n *= hostdata->accesses_per_ms;
> +   n /= 1000;
> +   do {
> +   if ((NCR5380_read(reg) & bit) == val)
> return 0;
> cpu_relax();
> -   }

> @@ -773,6 +777,7 @@ static int NCR5380_init(struct Scsi_Host
>  {
> int i;
> struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) 
> instance->hostdata;
> +   unsigned long deadline;
>
> if(in_interrupt())
> printk(KERN_ERR "NCR5380_init called with interrupts off!\n");
> @@ -812,6 +817,16 @@ static int NCR5380_init(struct Scsi_Host
> NCR5380_write(MODE_REG, MR_BASE);
> NCR5380_write(TARGET_COMMAND_REG, 0);
> NCR5380_write(SELECT_ENABLE_REG, 0);
> +
> +   /* Calibrate register polling loop */
> +   i = 0;
> +   deadline = jiffies + msecs_to_jiffies(100) + 1;
> +   do {
> +   NCR5380_read(STATUS_REG);
> +   ++i;
> +   } while (time_is_after_jiffies(deadline));
> +   hostdata->accesses_per_ms = i / 100;

As the caller of NCR5380_poll_politely() passes a timeout value in jiffies,
calculations may become simpler if you store the number of accesses per jiffy
instead of per ms.

Unlike the historical calibrating-delay-loop code, you don't wait for a jiffy
change before starting the calibration. At first I thought that was OK, but on
some platforms, HZ can be as low as 24, which means the result can vary by 33%
(based on 100 ms -> 3 jiffies).

The same change is made to atari_NCR5380.c.
I guess you plan to deduplicate this code when merging the drivers, i.e.
after this series?

Gr{oetje,eeting}s,

Geert

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

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the

[PATCH 9/9] lightnvm: do not compile in debugging by default

2015-12-06 Thread Matias Bjørling
The LightNVM module exposes a debug interface when CONFIG_NVM_DEBUG is
set. This interfaces takes a string to configure media managers and
targets. Make sure this interface is only exposed when chosen
deliberately.

Signed-off-by: Matias Bjørling 
---
 drivers/lightnvm/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/lightnvm/Kconfig b/drivers/lightnvm/Kconfig
index a16bf56..85a3390 100644
--- a/drivers/lightnvm/Kconfig
+++ b/drivers/lightnvm/Kconfig
@@ -18,6 +18,7 @@ if NVM
 
 config NVM_DEBUG
bool "Open-Channel SSD debugging support"
+   default n
---help---
Exposes a debug management interface to create/remove targets at:
 
-- 
2.1.4

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


[PATCH 5/9] lightnvm: comments on constants

2015-12-06 Thread Matias Bjørling
It is not obvious what NVM_IO_* and NVM_BLK_T_* are used for. Make sure
to comment them appropriately as the other constants.

Signed-off-by: Matias Bjørling 
---
 include/linux/lightnvm.h | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h
index c6916ae..935ef38 100644
--- a/include/linux/lightnvm.h
+++ b/include/linux/lightnvm.h
@@ -50,9 +50,16 @@ enum {
NVM_IO_DUAL_ACCESS  = 0x1,
NVM_IO_QUAD_ACCESS  = 0x2,
 
+   /* NAND Access Modes */
NVM_IO_SUSPEND  = 0x80,
NVM_IO_SLC_MODE = 0x100,
NVM_IO_SCRAMBLE_DISABLE = 0x200,
+
+   /* Block Types */
+   NVM_BLK_T_FREE  = 0x0,
+   NVM_BLK_T_BAD   = 0x1,
+   NVM_BLK_T_DEV   = 0x2,
+   NVM_BLK_T_HOST  = 0x4,
 };
 
 struct nvm_id_group {
-- 
2.1.4

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


[PATCH 4/9] lightnvm: check mm before use

2015-12-06 Thread Matias Bjørling
The core can may issue I/Os before a media manager is registered with
the lightnvm subsystem. Make sure that we don't call the media manager
->end_io prematurely with a null pointer.

Signed-off-by: Matias Bjørling 
---
 drivers/nvme/host/lightnvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index 06c3364..762c9a7 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -455,7 +455,7 @@ static void nvme_nvm_end_io(struct request *rq, int error)
struct nvm_rq *rqd = rq->end_io_data;
struct nvm_dev *dev = rqd->dev;
 
-   if (dev->mt->end_io(rqd, error))
+   if (dev->mt && dev->mt->end_io(rqd, error))
pr_err("nvme: err status: %x result: %lx\n",
rq->errors, (unsigned long)rq->special);
 
-- 
2.1.4

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


[PATCH 0/9] Fixes for LightNVM

2015-12-06 Thread Matias Bjørling
Hi Jens,

A couple more fixes for LightNVM.

The first three patches are fixed from Tao on rrpc and gennvm. The next
five patches are small fixes and refactoring to prepare for system
blocks. The last patch defaults debugging to not be compiled in and
thereby not expose the parameter configuration interface.

Thanks! Please pick up when convenient.

Matias Bjørling (6):
  lightnvm: check mm before use
  lightnvm: comments on constants
  lightnvm: replace req queue with nvmdev for lld
  lightnvm: fix media mgr registration
  lightnvm: prevent gennvm module unload on use
  lightnvm: do not compile in debugging by default

Wenwei Tao (3):
  lightnvm: use flags in rrpc_get_blk
  lightnvm: put blks when luns configure failed
  lightnvm: refactor spin_unlock in gennvm_get_blk

 drivers/block/null_blk.c |  9 ++---
 drivers/lightnvm/Kconfig |  1 +
 drivers/lightnvm/core.c  | 85 ++--
 drivers/lightnvm/gennvm.c| 20 ++-
 drivers/lightnvm/rrpc.c  | 25 ++---
 drivers/nvme/host/lightnvm.c | 26 +++---
 include/linux/lightnvm.h | 21 +++
 7 files changed, 108 insertions(+), 79 deletions(-)

-- 
2.1.4

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


[PATCH 7/9] lightnvm: fix media mgr registration

2015-12-06 Thread Matias Bjørling
This patch fixes two issues during media manager registration.

1. The ppa pool can be used at media manager registration. Allocate the
ppa pool before that.

2. If a media manager can't be found, this should not lead to the
device being unallocated. A media manager can be registered later, that
can manage the device. Only warn if a media manager fails
initialization.

Signed-off-by: Matias Bjørling 
---
 drivers/lightnvm/core.c | 78 -
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index 4a8d1fe..8f41b24 100644
--- a/drivers/lightnvm/core.c
+++ b/drivers/lightnvm/core.c
@@ -97,15 +97,47 @@ static struct nvmm_type *nvm_find_mgr_type(const char *name)
return NULL;
 }
 
+struct nvmm_type *nvm_init_mgr(struct nvm_dev *dev)
+{
+   struct nvmm_type *mt;
+   int ret;
+
+   lockdep_assert_held(&nvm_lock);
+
+   list_for_each_entry(mt, &nvm_mgrs, list) {
+   ret = mt->register_mgr(dev);
+   if (ret < 0) {
+   pr_err("nvm: media mgr failed to init (%d) on dev %s\n",
+   ret, dev->name);
+   return NULL; /* initialization failed */
+   } else if (ret > 0)
+   return mt;
+   }
+
+   return NULL;
+}
+
 int nvm_register_mgr(struct nvmm_type *mt)
 {
+   struct nvm_dev *dev;
int ret = 0;
 
down_write(&nvm_lock);
-   if (nvm_find_mgr_type(mt->name))
+   if (nvm_find_mgr_type(mt->name)) {
ret = -EEXIST;
-   else
+   goto finish;
+   } else {
list_add(&mt->list, &nvm_mgrs);
+   }
+
+   /* try to register media mgr if any device have none configured */
+   list_for_each_entry(dev, &nvm_devices, devices) {
+   if (dev->mt)
+   continue;
+
+   dev->mt = nvm_init_mgr(dev);
+   }
+finish:
up_write(&nvm_lock);
 
return ret;
@@ -123,26 +155,6 @@ void nvm_unregister_mgr(struct nvmm_type *mt)
 }
 EXPORT_SYMBOL(nvm_unregister_mgr);
 
-/* register with device with a supported manager */
-static int register_mgr(struct nvm_dev *dev)
-{
-   struct nvmm_type *mt;
-   int ret = 0;
-
-   list_for_each_entry(mt, &nvm_mgrs, list) {
-   ret = mt->register_mgr(dev);
-   if (ret > 0) {
-   dev->mt = mt;
-   break; /* successfully initialized */
-   }
-   }
-
-   if (!ret)
-   pr_info("nvm: no compatible nvm manager found.\n");
-
-   return ret;
-}
-
 static struct nvm_dev *nvm_find_nvm_dev(const char *name)
 {
struct nvm_dev *dev;
@@ -271,14 +283,6 @@ static int nvm_init(struct nvm_dev *dev)
goto err;
}
 
-   down_write(&nvm_lock);
-   ret = register_mgr(dev);
-   up_write(&nvm_lock);
-   if (ret < 0)
-   goto err;
-   if (!ret)
-   return 0;
-
pr_info("nvm: registered %s [%u/%u/%u/%u/%u/%u]\n",
dev->name, dev->sec_per_pg, dev->nr_planes,
dev->pgs_per_blk, dev->blks_per_lun, dev->nr_luns,
@@ -334,7 +338,9 @@ int nvm_register(struct request_queue *q, char *disk_name,
}
}
 
+   /* register device with a supported media manager */
down_write(&nvm_lock);
+   dev->mt = nvm_init_mgr(dev);
list_add(&dev->devices, &nvm_devices);
up_write(&nvm_lock);
 
@@ -379,19 +385,13 @@ static int nvm_create_target(struct nvm_dev *dev,
struct nvm_tgt_type *tt;
struct nvm_target *t;
void *targetdata;
-   int ret = 0;
 
-   down_write(&nvm_lock);
if (!dev->mt) {
-   ret = register_mgr(dev);
-   if (!ret)
-   ret = -ENODEV;
-   if (ret < 0) {
-   up_write(&nvm_lock);
-   return ret;
-   }
+   pr_info("nvm: device has no media manager registered.\n");
+   return -ENODEV;
}
 
+   down_write(&nvm_lock);
tt = nvm_find_target_type(create->tgttype);
if (!tt) {
pr_err("nvm: target type %s not found\n", create->tgttype);
-- 
2.1.4

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


[PATCH 3/9] lightnvm: refactor spin_unlock in gennvm_get_blk

2015-12-06 Thread Matias Bjørling
From: Wenwei Tao 

The spin_unlock is duplicated multiple times. Jump to a single unlock
to improve the code flow.

Signed-off-by: Wenwei Tao 
Signed-off-by: Matias Bjørling 
---
 drivers/lightnvm/gennvm.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/lightnvm/gennvm.c b/drivers/lightnvm/gennvm.c
index 35dde84..ce60254 100644
--- a/drivers/lightnvm/gennvm.c
+++ b/drivers/lightnvm/gennvm.c
@@ -262,14 +262,11 @@ static struct nvm_block *gennvm_get_blk(struct nvm_dev 
*dev,
if (list_empty(&lun->free_list)) {
pr_err_ratelimited("gennvm: lun %u have no free pages 
available",
lun->vlun.id);
-   spin_unlock(&vlun->lock);
goto out;
}
 
-   while (!is_gc && lun->vlun.nr_free_blocks < lun->reserved_blocks) {
-   spin_unlock(&vlun->lock);
+   if (!is_gc && lun->vlun.nr_free_blocks < lun->reserved_blocks)
goto out;
-   }
 
blk = list_first_entry(&lun->free_list, struct nvm_block, list);
list_move_tail(&blk->list, &lun->used_list);
@@ -278,8 +275,8 @@ static struct nvm_block *gennvm_get_blk(struct nvm_dev *dev,
lun->vlun.nr_free_blocks--;
lun->vlun.nr_inuse_blocks++;
 
-   spin_unlock(&vlun->lock);
 out:
+   spin_unlock(&vlun->lock);
return blk;
 }
 
-- 
2.1.4

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


[PATCH 8/9] lightnvm: prevent gennvm module unload on use

2015-12-06 Thread Matias Bjørling
After the gennvm module has been initialized. It might be attached to
one or several devices. In that case, the module is in use. Make sure
that it can not be unloaded.

Signed-off-by: Matias Bjørling 
---
 drivers/lightnvm/gennvm.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/lightnvm/gennvm.c b/drivers/lightnvm/gennvm.c
index 52b513a..f434e89 100644
--- a/drivers/lightnvm/gennvm.c
+++ b/drivers/lightnvm/gennvm.c
@@ -219,6 +219,9 @@ static int gennvm_register(struct nvm_dev *dev)
struct gen_nvm *gn;
int ret;
 
+   if (!try_module_get(THIS_MODULE))
+   return -ENODEV;
+
gn = kzalloc(sizeof(struct gen_nvm), GFP_KERNEL);
if (!gn)
return -ENOMEM;
@@ -242,12 +245,14 @@ static int gennvm_register(struct nvm_dev *dev)
return 1;
 err:
gennvm_free(dev);
+   module_put(THIS_MODULE);
return ret;
 }
 
 static void gennvm_unregister(struct nvm_dev *dev)
 {
gennvm_free(dev);
+   module_put(THIS_MODULE);
 }
 
 static struct nvm_block *gennvm_get_blk(struct nvm_dev *dev,
-- 
2.1.4

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


[PATCH 6/9] lightnvm: replace req queue with nvmdev for lld

2015-12-06 Thread Matias Bjørling
In the case where a request queue is passed to the low lever lightnvm
device drive integration, the device driver might pass its admin
commands through another queue. Instead pass nvm_dev, and let the
low level drive the appropriate queue.

Reported-by: Christoph Hellwig 
Signed-off-by: Matias Bjørling 
---
 drivers/block/null_blk.c |  9 +
 drivers/lightnvm/core.c  |  7 +++
 drivers/lightnvm/gennvm.c|  8 
 drivers/lightnvm/rrpc.c  |  2 +-
 drivers/nvme/host/lightnvm.c | 24 +---
 include/linux/lightnvm.h | 14 +++---
 6 files changed, 33 insertions(+), 31 deletions(-)

diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
index 0c3940e..7981b74 100644
--- a/drivers/block/null_blk.c
+++ b/drivers/block/null_blk.c
@@ -444,8 +444,9 @@ static void null_lnvm_end_io(struct request *rq, int error)
blk_put_request(rq);
 }
 
-static int null_lnvm_submit_io(struct request_queue *q, struct nvm_rq *rqd)
+static int null_lnvm_submit_io(struct nvm_dev *dev, struct nvm_rq *rqd)
 {
+   struct request_queue *q = dev->q;
struct request *rq;
struct bio *bio = rqd->bio;
 
@@ -470,7 +471,7 @@ static int null_lnvm_submit_io(struct request_queue *q, 
struct nvm_rq *rqd)
return 0;
 }
 
-static int null_lnvm_id(struct request_queue *q, struct nvm_id *id)
+static int null_lnvm_id(struct nvm_dev *dev, struct nvm_id *id)
 {
sector_t size = gb * 1024 * 1024 * 1024ULL;
sector_t blksize;
@@ -523,7 +524,7 @@ static int null_lnvm_id(struct request_queue *q, struct 
nvm_id *id)
return 0;
 }
 
-static void *null_lnvm_create_dma_pool(struct request_queue *q, char *name)
+static void *null_lnvm_create_dma_pool(struct nvm_dev *dev, char *name)
 {
mempool_t *virtmem_pool;
 
@@ -541,7 +542,7 @@ static void null_lnvm_destroy_dma_pool(void *pool)
mempool_destroy(pool);
 }
 
-static void *null_lnvm_dev_dma_alloc(struct request_queue *q, void *pool,
+static void *null_lnvm_dev_dma_alloc(struct nvm_dev *dev, void *pool,
gfp_t mem_flags, dma_addr_t *dma_handler)
 {
return mempool_alloc(pool, mem_flags);
diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index 86ce887..4a8d1fe 100644
--- a/drivers/lightnvm/core.c
+++ b/drivers/lightnvm/core.c
@@ -74,7 +74,7 @@ EXPORT_SYMBOL(nvm_unregister_target);
 void *nvm_dev_dma_alloc(struct nvm_dev *dev, gfp_t mem_flags,
dma_addr_t *dma_handler)
 {
-   return dev->ops->dev_dma_alloc(dev->q, dev->ppalist_pool, mem_flags,
+   return dev->ops->dev_dma_alloc(dev, dev->ppalist_pool, mem_flags,
dma_handler);
 }
 EXPORT_SYMBOL(nvm_dev_dma_alloc);
@@ -246,7 +246,7 @@ static int nvm_init(struct nvm_dev *dev)
if (!dev->q || !dev->ops)
return ret;
 
-   if (dev->ops->identity(dev->q, &dev->identity)) {
+   if (dev->ops->identity(dev, &dev->identity)) {
pr_err("nvm: device could not be identified\n");
goto err;
}
@@ -326,8 +326,7 @@ int nvm_register(struct request_queue *q, char *disk_name,
}
 
if (dev->ops->max_phys_sect > 1) {
-   dev->ppalist_pool = dev->ops->create_dma_pool(dev->q,
-   "ppalist");
+   dev->ppalist_pool = dev->ops->create_dma_pool(dev, "ppalist");
if (!dev->ppalist_pool) {
pr_err("nvm: could not create ppa pool\n");
ret = -ENOMEM;
diff --git a/drivers/lightnvm/gennvm.c b/drivers/lightnvm/gennvm.c
index ce60254..52b513a 100644
--- a/drivers/lightnvm/gennvm.c
+++ b/drivers/lightnvm/gennvm.c
@@ -195,7 +195,7 @@ static int gennvm_blocks_init(struct nvm_dev *dev, struct 
gen_nvm *gn)
}
 
if (dev->ops->get_l2p_tbl) {
-   ret = dev->ops->get_l2p_tbl(dev->q, 0, dev->total_pages,
+   ret = dev->ops->get_l2p_tbl(dev, 0, dev->total_pages,
gennvm_block_map, dev);
if (ret) {
pr_err("gennvm: could not read L2P table.\n");
@@ -346,7 +346,7 @@ static int gennvm_submit_io(struct nvm_dev *dev, struct 
nvm_rq *rqd)
gennvm_generic_to_addr_mode(dev, rqd);
 
rqd->dev = dev;
-   return dev->ops->submit_io(dev->q, rqd);
+   return dev->ops->submit_io(dev, rqd);
 }
 
 static void gennvm_blk_set_type(struct nvm_dev *dev, struct ppa_addr *ppa,
@@ -382,7 +382,7 @@ static void gennvm_mark_blk_bad(struct nvm_dev *dev, struct 
nvm_rq *rqd)
if (!dev->ops->set_bb_tbl)
return;
 
-   if (dev->ops->set_bb_tbl(dev->q, rqd, 1))
+   if (dev->ops->set_bb_tbl(dev, rqd, 1))
return;
 
gennvm_addr_to_generic_mode(dev, rqd);
@@ -450,7 +450,7 @@ static int gennvm_erase_blk(struct n

[PATCH 2/9] lightnvm: put blks when luns configure failed

2015-12-06 Thread Matias Bjørling
From: Wenwei Tao 

Put the allocated blocks back to the free list
when the luns configure failed, to make these
blocks useable to others.

Signed-off-by: Wenwei Tao 
Signed-off-by: Matias Bjørling 
---
 drivers/lightnvm/rrpc.c | 21 +++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c
index d606c7a..cf1a4a5 100644
--- a/drivers/lightnvm/rrpc.c
+++ b/drivers/lightnvm/rrpc.c
@@ -202,6 +202,20 @@ static void rrpc_put_blk(struct rrpc *rrpc, struct 
rrpc_block *rblk)
nvm_put_blk(rrpc->dev, rblk->parent);
 }
 
+static void rrpc_put_blks(struct rrpc *rrpc)
+{
+   struct rrpc_lun *rlun;
+   int i;
+
+   for (i = 0; i < rrpc->nr_luns; i++) {
+   rlun = &rrpc->luns[i];
+   if (rlun->cur)
+   rrpc_put_blk(rrpc, rlun->cur);
+   if (rlun->gc_cur)
+   rrpc_put_blk(rrpc, rlun->gc_cur);
+   }
+}
+
 static struct rrpc_lun *get_next_lun(struct rrpc *rrpc)
 {
int next = atomic_inc_return(&rrpc->next_lun);
@@ -1224,18 +1238,21 @@ static int rrpc_luns_configure(struct rrpc *rrpc)
 
rblk = rrpc_get_blk(rrpc, rlun, 0);
if (!rblk)
-   return -EINVAL;
+   goto err;
 
rrpc_set_lun_cur(rlun, rblk);
 
/* Emergency gc block */
rblk = rrpc_get_blk(rrpc, rlun, 1);
if (!rblk)
-   return -EINVAL;
+   goto err;
rlun->gc_cur = rblk;
}
 
return 0;
+err:
+   rrpc_put_blks(rrpc);
+   return -EINVAL;
 }
 
 static struct nvm_tgt_type tt_rrpc;
-- 
2.1.4

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


[PATCH 1/9] lightnvm: use flags in rrpc_get_blk

2015-12-06 Thread Matias Bjørling
From: Wenwei Tao 

rrpc_get_blk use constant 0 as the input parameter
of nvm_get_blk, this may result in getting gc block
failed unexpectedly.

Signed-off-by: Wenwei Tao 
Signed-off-by: Matias Bjørling 
---
 drivers/lightnvm/rrpc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c
index 75e59c3..d606c7a 100644
--- a/drivers/lightnvm/rrpc.c
+++ b/drivers/lightnvm/rrpc.c
@@ -182,7 +182,7 @@ static struct rrpc_block *rrpc_get_blk(struct rrpc *rrpc, 
struct rrpc_lun *rlun,
struct nvm_block *blk;
struct rrpc_block *rblk;
 
-   blk = nvm_get_blk(rrpc->dev, rlun->parent, 0);
+   blk = nvm_get_blk(rrpc->dev, rlun->parent, flags);
if (!blk)
return NULL;
 
-- 
2.1.4

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


[PATCH 03/10] i915: Replace "hweight8(dev_priv->info.subslice_7eu[i]) != 1" with "!is_power_of_2(dev_priv->info.subslice_7eu[i])"

2015-12-06 Thread Zhaoxiu Zeng
From: Zeng Zhaoxiu 

Signed-off-by: Zeng Zhaoxiu 
---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c 
b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 9461a23..16c8cf1 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -27,6 +27,7 @@
  *
  */
 
+#include 
 #include 
 #include "i915_drv.h"
 #include 
@@ -1000,7 +1001,7 @@ static int skl_tune_iz_hashing(struct intel_engine_cs 
*ring)
 * Only consider slices where one, and only one, subslice has 7
 * EUs
 */
-   if (hweight8(dev_priv->info.subslice_7eu[i]) != 1)
+   if (!is_power_of_2(dev_priv->info.subslice_7eu[i]))
continue;
 
/*
-- 
2.5.0

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


[PATCH 04/10] omap_hwspinlock: Replace "hweight_long(i & 0xf) != 1" with "!is_power_of_2(i & 0xf)"

2015-12-06 Thread Zhaoxiu Zeng
From: Zeng Zhaoxiu 

Signed-off-by: Zeng Zhaoxiu 
---
 drivers/hwspinlock/omap_hwspinlock.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/hwspinlock/omap_hwspinlock.c 
b/drivers/hwspinlock/omap_hwspinlock.c
index ad2f8ca..1848a4c 100644
--- a/drivers/hwspinlock/omap_hwspinlock.c
+++ b/drivers/hwspinlock/omap_hwspinlock.c
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "hwspinlock_internal.h"
 
@@ -125,7 +126,7 @@ static int omap_hwspinlock_probe(struct platform_device 
*pdev)
goto iounmap_base;
 
/* one of the four lsb's must be set, and nothing else */
-   if (hweight_long(i & 0xf) != 1 || i > 8) {
+   if (!is_power_of_2(i & 0xf) || i > 8) {
ret = -EINVAL;
goto iounmap_base;
}
-- 
2.5.0

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


[PATCH 05/10] exynos4-is: Replace "hweight32(mask) == 1" with "is_power_of_2(mask)"

2015-12-06 Thread Zhaoxiu Zeng
From: Zeng Zhaoxiu 

Signed-off-by: Zeng Zhaoxiu 
---
 drivers/media/platform/exynos4-is/fimc-is-regs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/exynos4-is/fimc-is-regs.c 
b/drivers/media/platform/exynos4-is/fimc-is-regs.c
index cfe4406..ec75a24 100644
--- a/drivers/media/platform/exynos4-is/fimc-is-regs.c
+++ b/drivers/media/platform/exynos4-is/fimc-is-regs.c
@@ -11,6 +11,7 @@
  * published by the Free Software Foundation.
  */
 #include 
+#include 
 
 #include "fimc-is.h"
 #include "fimc-is-command.h"
@@ -107,7 +108,7 @@ int fimc_is_hw_get_params(struct fimc_is *is, unsigned int 
num_args)
 
 void fimc_is_hw_set_isp_buf_mask(struct fimc_is *is, unsigned int mask)
 {
-   if (hweight32(mask) == 1) {
+   if (is_power_of_2(mask)) {
dev_err(&is->pdev->dev, "%s(): not enough buffers (mask %#x)\n",
__func__, mask);
return;
-- 
2.5.0

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


[PATCH v5] USB: serial: add Moxa UPORT 11x0 driver

2015-12-06 Thread Mathieu OTHACEHE
Add a driver which supports :

- UPort 1110  : 1 port RS-232 USB to Serial Hub.
- UPort 1130  : 1 port RS-422/485 USB to Serial Hub.
- UPort 1130I : 1 port RS-422/485 USB to Serial Hub with Isolation.
- UPort 1150  : 1 port RS-232/422/485 USB to Serial Hub.
- UPort 1150I : 1 port RS-232/422/485 USB to Serial Hub with Isolation.

This driver is based on GPL MOXA driver written by Hen Huang and available
on MOXA website. The original driver was based on io_ti serial driver.

Signed-off-by: Mathieu OTHACEHE 
---

Hi Johan,

Thanks for your patience, here is v5,

Mathieu

Changes in v2:
* Use generic implementation for read/write code
* Use TIOCSRS485/TIOCGRS485 instead of moxa specific ioctl
* Other problems pointed out by Johan review

Changes in v3:
* Drop unused defines
* Fix style problems
* Remove port identification code since this driver is for one-port devices only
* Fix debug messages
* Use a mutex to protect shadow_mc
* Use usb_serial_generic_open and close
* Other problems pointed out by Johan review

Changes in v4:
* mxu1_startup return -ENODEV on purpose if the firmware was downloaded.
It avoids port_probe to fail since the device is reset.

Changes in v5:
* Drop debug messages
* Drop useless fields from mxu1_port and mxu1_device structures
* Return supported bits to userspace in function mxu1_ioctl_set_rs485
* Other problems pointed out by Johan review

 drivers/usb/serial/Kconfig   |   16 +
 drivers/usb/serial/Makefile  |1 +
 drivers/usb/serial/mxu11x0.c | 1069 ++
 3 files changed, 1086 insertions(+)
 create mode 100644 drivers/usb/serial/mxu11x0.c

diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index 56ecb8b..f612dda 100644
--- a/drivers/usb/serial/Kconfig
+++ b/drivers/usb/serial/Kconfig
@@ -475,6 +475,22 @@ config USB_SERIAL_MOS7840
  To compile this driver as a module, choose M here: the
  module will be called mos7840.  If unsure, choose N.
 
+config USB_SERIAL_MXUPORT11
+   tristate "USB Moxa UPORT 11x0 Serial Driver"
+   ---help---
+ Say Y here if you want to use a MOXA UPort 11x0 Serial hub.
+
+ This driver supports:
+
+ - UPort 1110  : 1 port RS-232 USB to Serial Hub.
+ - UPort 1130  : 1 port RS-422/485 USB to Serial Hub.
+ - UPort 1130I : 1 port RS-422/485 USB to Serial Hub with Isolation.
+ - UPort 1150  : 1 port RS-232/422/485 USB to Serial Hub.
+ - UPort 1150I : 1 port RS-232/422/485 USB to Serial Hub with 
Isolation.
+
+ To compile this driver as a module, choose M here: the
+ module will be called mxu11x0.
+
 config USB_SERIAL_MXUPORT
tristate "USB Moxa UPORT Serial Driver"
---help---
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile
index 349d9df..f3fa5e5 100644
--- a/drivers/usb/serial/Makefile
+++ b/drivers/usb/serial/Makefile
@@ -38,6 +38,7 @@ obj-$(CONFIG_USB_SERIAL_METRO)+= 
metro-usb.o
 obj-$(CONFIG_USB_SERIAL_MOS7720)   += mos7720.o
 obj-$(CONFIG_USB_SERIAL_MOS7840)   += mos7840.o
 obj-$(CONFIG_USB_SERIAL_MXUPORT)   += mxuport.o
+obj-$(CONFIG_USB_SERIAL_MXUPORT11) += mxu11x0.o
 obj-$(CONFIG_USB_SERIAL_NAVMAN)+= navman.o
 obj-$(CONFIG_USB_SERIAL_OMNINET)   += omninet.o
 obj-$(CONFIG_USB_SERIAL_OPTICON)   += opticon.o
diff --git a/drivers/usb/serial/mxu11x0.c b/drivers/usb/serial/mxu11x0.c
new file mode 100644
index 000..db7ed1f
--- /dev/null
+++ b/drivers/usb/serial/mxu11x0.c
@@ -0,0 +1,1069 @@
+/*
+ *
+ * USB Moxa UPORT 11x0 Serial Driver
+ *
+ * Copyright (C) 2007 MOXA Technologies Co., Ltd.
+ * Copyright (C) 2015 Mathieu Othacehe 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ *
+ * Supports the following Moxa USB to serial converters:
+ *  UPort 1110,  1 port RS-232 USB to Serial Hub.
+ *  UPort 1130,  1 port RS-422/485 USB to Serial Hub.
+ *  UPort 1130I, 1 port RS-422/485 USB to Serial Hub with isolation
+ *protection.
+ *  UPort 1150,  1 port RS-232/422/485 USB to Serial Hub.
+ *  UPort 1150I, 1 port RS-232/422/485 USB to Serial Hub with isolation
+ *  protection.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Vendor and product ids */
+#define MXU1_VENDOR_ID 0x110a
+#define MXU1_1110_PRODUCT_ID   0x1110
+#define MXU1_1130_PRODUCT_ID   0x1130
+#define MXU1_1150_PRODUCT_ID   0x1150
+#define MXU1_1151_PRODUCT_ID   0x1151
+#define MXU1_1131_PRODUCT_ID   0x1131
+
+/* Commands */
+#define MXU1_GET_VERSION

Re: [GIT pull] perf fixes for 4.4

2015-12-06 Thread Ingo Molnar

* Thomas Gleixner  wrote:

> Linus,
> 
> please pull the latest perf-urgent-for-linus git tree from:
> 
>git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
> perf-urgent-for-linus
> 
> Some more perf fixes:
> 
>  - Properly read lock RCU in the cgroup perf context switch code.
> 
>  - Fix a LBR call stack regression.
> 
>  - Improve precice instruction sampling on modern Intel machines.

Linus, please hold up on pulling these bits - I just found out that this commit 
(4576ceaa56a8) regresses on older machines. I also don't know what I was 
thinking 
merging this into perf/urgent so late ...

I'll sort it out, but please don't pull it for the time being. Sorry about that!

Thanks,

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


Re: [PATCH v2 1/2] um: Set secure access mode for temporary file

2015-12-06 Thread Mickaël Salaün
On 06/12/2015 12:32, Mickaël Salaün wrote:
> On 04/12/2015 18:13, Tristan Schmelcher wrote:
>> File permissions are checked at time of open, so I think this fchmod
>> call has never had any effect.
> 
> Indeed, mmap doesn't require the file to be executable, only readable and 
> writable. The fchmod seems to be a guarantee for this permissions but I don't 
> see why a file newly created could not be writable.

The fchmod may be useful if the umask is 0777 :)

 Mickaël



signature.asc
Description: OpenPGP digital signature


Re: [PATCH v2 1/2] um: Set secure access mode for temporary file

2015-12-06 Thread Mickaël Salaün
On 04/12/2015 18:13, Tristan Schmelcher wrote:
> File permissions are checked at time of open, so I think this fchmod
> call has never had any effect.

Indeed, mmap doesn't require the file to be executable, only readable and 
writable. The fchmod seems to be a guarantee for this permissions but I don't 
see why a file newly created could not be writable.

> 
> If there is a concern that the mkstemp implementation may be insecure,
> why not set and restore the umask?
> 

I will add this safeguard.

 Mickaël



signature.asc
Description: OpenPGP digital signature


Re: Improve spinlock performance by moving work to one core

2015-12-06 Thread Ling Ma
Longman,

We further optimized the kernel spinlock in ali-spin-lock.patch
as attachment based on kernel 4.3.0-rc4.

Run thread.c in user space with kernel patch(ali-spin-lock.patch) on E5-2699v3,
compare with original spinlock:

The printed data indicates the performance in critical path is
improved by 1.91x (92715428576 cycles/ 48475891244 cycles),
perf top -d1 also tell us the spinlock cost time is reduced from 25% to 15%

All compared data is from the below operation in ali-spin-lock.patch:

+#if ORG_QUEUED_SPINLOCK
+   org_queued_spin_lock((struct qspinlock *)&pa.n->list_lock);
+   refill_fn(&pa);
+   org_queued_spin_unlock((struct qspinlock *)&pa.n->list_lock);
+#else
+   ali_spin_lock((struct alispinlock *)&pa.n->list_lock, refill_fn, &pa);
+#endif

and

+#if ORG_QUEUED_SPINLOCK
+   org_queued_spin_lock((struct qspinlock *)&pa.n->list_lock);
+   flusharray_fn(&pa);
+   org_queued_spin_unlock((struct qspinlock *)&pa.n->list_lock);
+#else
+   ali_spin_lock((struct alispinlock *)&pa.n->list_lock,
flusharray_fn, &pa);
+#endif

We will send the formal patch as a separate synchronization mechanism soon.

Appreciate your comments.

Thanks
Ling

2015-12-01 4:55 GMT+08:00 Waiman Long :
> On 11/30/2015 01:17 AM, Ling Ma wrote:
>>
>> Any comments, the patch is acceptable ?
>>
>> Thanks
>> Ling
>>
>>
> Ling,
>
> The core idea of your current patch hasn't changed from your previous
> patch.
>
> My comment is that you should not attempt to sell it as a replacement
> of the current spinlock mechanism. I just don't see that will happen
> given the change in API semantics. Also, I think there are probably
> cases that your patch cannot be applied. So treat it as a separate
> synchronization mechanism that can be useful in some scenarios.
>
> Cheers,
> Longman
>


lock_test.tar.bz2
Description: BZip2 compressed data


[RFC BUG] coccinelle: use_after_iter parse error

2015-12-06 Thread Geyslan G. Bem
Hi maintainers,

I'm having these error output using coccinelle.


-- 
Regards,

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


Re: [tip:perf/core] perf/x86: Use INST_RETIRED.PREC_DIST for cycles: ppp

2015-12-06 Thread Ingo Molnar

* tip-bot for Andi Kleen  wrote:

> Commit-ID:  4576ceaa56a86bd0c041c204d51c3f3ca582a49c
> Gitweb: http://git.kernel.org/tip/4576ceaa56a86bd0c041c204d51c3f3ca582a49c
> Author: Andi Kleen 
> AuthorDate: Mon, 30 Nov 2015 16:28:09 -0800
> Committer:  Ingo Molnar 
> CommitDate: Fri, 4 Dec 2015 10:08:04 +0100
> 
> perf/x86: Use INST_RETIRED.PREC_DIST for cycles:ppp
> 
> Add a new 'three-p' precise level, that uses INST_RETIRED.PREC_DIST as
> base. The basic mechanism of abusing the inverse cmask to get all
> cycles works the same as before.

So this commit regressed on the follwing Intel Nehalem box:

 processor   : 15
 vendor_id   : GenuineIntel
 cpu family  : 6
 model   : 26
 model name  : Intel(R) Xeon(R) CPU   X55600 @ 2.80GHz
 stepping: 5
 cpu MHz : 2793.000
 cache size  : 8192 KB
 it has this perf bootup signature:

0.272504] Performance Events: PEBS fmt1+, 16-deep LBR, Nehalem events, 
Intel PMU driver.
0.281356] perf_event_intel: CPU erratum AAJ80 worked around

the symptom is that latest 'perf top' and 'perf record' produces no samples.

So I've removed this commit and the related Skylake commit from -tip:

 4576ceaa56a8 perf/x86: Use INST_RETIRED.PREC_DIST for cycles:ppp
 ac1e1d30cf90 perf/x86: Use INST_RETIRED.TOTAL_CYCLES_PS for cycles:pp for 
Skylake

you need to do better testing next time around. Note: if you resubmit the 
patches, 
please also pick up the updates commit changelogs from the tip-bot emails, 
don't 
use your original changelogs.

Also, I'm not convinced we need a new 'ppp' qualifier for any of this, why not 
just replace 'pp' with this event - 'pp' is meant to be our most precise event.

Thanks,

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


Re: [RFC BUG] coccinelle: use_after_iter parse error

2015-12-06 Thread Geyslan G. Bem
2015-12-06 10:09 GMT-03:00 Geyslan G. Bem :
> Hi maintainers,
>
> I'm having these error output using coccinelle.

Sorry, gmail and its ctrl+enter shortcut. :/

geyslan@hb ~/Projects/linux $ make coccicheck V=2 M=drivers/usb/host/
-j4 > cocciout
Fatal error: exception Failure("minus: parse error: \n = File
\"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
column 0,  charpos = 3561\naround = '&', whole content =
&c->member\n")
Fatal error: exception Failure("minus: parse error: \n = File
\"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
column 0,  charpos = 3561\naround = '&', whole content =
&c->member\n")
Fatal error: exception Failure("minus: parse error: \n = File
\"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
column 0,  charpos = 3561\naround = '&', whole content =
&c->member\n")
Fatal error: exception Failure("minus: parse error: \n = File
\"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
column 0,  charpos = 3561\naround = '&', whole content =
&c->member\n")
Fatal error: exception Failure("minus: parse error: \n = File
\"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
column 0,  charpos = 3561\naround = '&', whole content =
&c->member\n")
Fatal error: exception Failure("minus: parse error: \n = File
\"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
column 0,  charpos = 3561\naround = '&', whole content =
&c->member\n")
Fatal error: exception Failure("minus: parse error: \n = File
\"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
column 0,  charpos = 3561\naround = '&', whole content =
&c->member\n")
Fatal error: exception Failure("minus: parse error: \n = File
\"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
column 0,  charpos = 3561\naround = '&', whole content =
&c->member\n")

sizeof(<+...c...+>)
|
&c->member  // Line 126
|
c = E

geyslan@hb ~/Projects/linux $ spatch --version
spatch version 1.0.4 with Python support and with PCRE support


>
>
> --
> Regards,
>
> Geyslan G. Bem
> hackingbits.com



-- 
Regards,

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


[tip:x86/mm] x86/mm/64: Enable SWIOTLB if system has SRAT memory regions above MAX_DMA32_PFN

2015-12-06 Thread tip-bot for Igor Mammedov
Commit-ID:  ec941c5ffede4d788b9fc008f9eeca75b9e964f5
Gitweb: http://git.kernel.org/tip/ec941c5ffede4d788b9fc008f9eeca75b9e964f5
Author: Igor Mammedov 
AuthorDate: Fri, 4 Dec 2015 14:07:06 +0100
Committer:  Ingo Molnar 
CommitDate: Sun, 6 Dec 2015 12:46:31 +0100

x86/mm/64: Enable SWIOTLB if system has SRAT memory regions above MAX_DMA32_PFN

when memory hotplug enabled system is booted with less
than 4GB of RAM and then later more RAM is hotplugged
32-bit devices stop functioning with following error:

 nommu_map_single: overflow 327b4f8c0+1522 of device mask 

the reason for this is that if x86_64 system were booted
with RAM less than 4GB, it doesn't enable SWIOTLB and
when memory is hotplugged beyond MAX_DMA32_PFN, devices
that expect 32-bit addresses can't handle 64-bit addresses.

Fix it by tracking max possible PFN when parsing
memory affinity structures from SRAT ACPI table and
enable SWIOTLB if there is hotpluggable memory
regions beyond MAX_DMA32_PFN.

It fixes KVM guests when they use emulated devices
(reproduces with ata_piix, e1000 and usb devices,
 RHBZ: 1275941, 1275977, 1271527)

It also fixes the HyperV, VMWare with emulated devices
which are affected by this issue as well.

Signed-off-by: Igor Mammedov 
Cc: Andrew Morton 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: akata...@vmware.com
Cc: fujita.tomon...@lab.ntt.co.jp
Cc: konrad.w...@oracle.com
Cc: pbonz...@redhat.com
Cc: rev...@redhat.com
Cc: r...@redhat.com
Link: 
http://lkml.kernel.org/r/1449234426-273049-3-git-send-email-imamm...@redhat.com
Signed-off-by: Ingo Molnar 
---
 arch/x86/kernel/pci-swiotlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/pci-swiotlb.c b/arch/x86/kernel/pci-swiotlb.c
index adf0392..7c577a1 100644
--- a/arch/x86/kernel/pci-swiotlb.c
+++ b/arch/x86/kernel/pci-swiotlb.c
@@ -88,7 +88,7 @@ int __init pci_swiotlb_detect_4gb(void)
 {
/* don't initialize swiotlb if iommu=off (no_iommu=1) */
 #ifdef CONFIG_X86_64
-   if (!no_iommu && max_pfn > MAX_DMA32_PFN)
+   if (!no_iommu && max_possible_pfn > MAX_DMA32_PFN)
swiotlb = 1;
 #endif
return swiotlb;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:x86/mm] x86/mm: Introduce max_possible_pfn

2015-12-06 Thread tip-bot for Igor Mammedov
Commit-ID:  8dd3303001976aa8583bf20f6b93590c74114308
Gitweb: http://git.kernel.org/tip/8dd3303001976aa8583bf20f6b93590c74114308
Author: Igor Mammedov 
AuthorDate: Fri, 4 Dec 2015 14:07:05 +0100
Committer:  Ingo Molnar 
CommitDate: Sun, 6 Dec 2015 12:46:31 +0100

x86/mm: Introduce max_possible_pfn

max_possible_pfn will be used for tracking max possible
PFN for memory that isn't present in E820 table and
could be hotplugged later.

By default max_possible_pfn is initialized with max_pfn,
but later it could be updated with highest PFN of
hotpluggable memory ranges declared in ACPI SRAT table
if any present.

Signed-off-by: Igor Mammedov 
Cc: Andrew Morton 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: akata...@vmware.com
Cc: fujita.tomon...@lab.ntt.co.jp
Cc: konrad.w...@oracle.com
Cc: pbonz...@redhat.com
Cc: rev...@redhat.com
Cc: r...@redhat.com
Link: 
http://lkml.kernel.org/r/1449234426-273049-2-git-send-email-imamm...@redhat.com
Signed-off-by: Ingo Molnar 
---
 arch/x86/kernel/setup.c | 2 ++
 arch/x86/mm/srat.c  | 2 ++
 include/linux/bootmem.h | 4 
 mm/bootmem.c| 1 +
 mm/nobootmem.c  | 1 +
 5 files changed, 10 insertions(+)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 29db25f..16a8465 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1048,6 +1048,8 @@ void __init setup_arch(char **cmdline_p)
if (mtrr_trim_uncached_memory(max_pfn))
max_pfn = e820_end_of_ram_pfn();
 
+   max_possible_pfn = max_pfn;
+
 #ifdef CONFIG_X86_32
/* max_low_pfn get updated here */
find_low_pfn_range();
diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c
index c2aea63..b5f8218 100644
--- a/arch/x86/mm/srat.c
+++ b/arch/x86/mm/srat.c
@@ -203,6 +203,8 @@ acpi_numa_memory_affinity_init(struct 
acpi_srat_mem_affinity *ma)
pr_warn("SRAT: Failed to mark hotplug range [mem 
%#010Lx-%#010Lx] in memblock\n",
(unsigned long long)start, (unsigned long long)end - 1);
 
+   max_possible_pfn = max(max_possible_pfn, PFN_UP(end - 1));
+
return 0;
 out_err_bad_srat:
bad_srat();
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index f589222..35b22f9 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -19,6 +19,10 @@ extern unsigned long min_low_pfn;
  * highest page
  */
 extern unsigned long max_pfn;
+/*
+ * highest possible page
+ */
+extern unsigned long long max_possible_pfn;
 
 #ifndef CONFIG_NO_BOOTMEM
 /*
diff --git a/mm/bootmem.c b/mm/bootmem.c
index 3b63807..91e32bc 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -33,6 +33,7 @@ EXPORT_SYMBOL(contig_page_data);
 unsigned long max_low_pfn;
 unsigned long min_low_pfn;
 unsigned long max_pfn;
+unsigned long long max_possible_pfn;
 
 bootmem_data_t bootmem_node_data[MAX_NUMNODES] __initdata;
 
diff --git a/mm/nobootmem.c b/mm/nobootmem.c
index e57cf24..99feb2b 100644
--- a/mm/nobootmem.c
+++ b/mm/nobootmem.c
@@ -31,6 +31,7 @@ EXPORT_SYMBOL(contig_page_data);
 unsigned long max_low_pfn;
 unsigned long min_low_pfn;
 unsigned long max_pfn;
+unsigned long long max_possible_pfn;
 
 static void * __init __alloc_memory_core_early(int nid, u64 size, u64 align,
u64 goal, u64 limit)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 BUG] coccinelle: use_after_iter parse error

2015-12-06 Thread Julia Lawall


On Sun, 6 Dec 2015, Geyslan G. Bem wrote:

> 2015-12-06 10:09 GMT-03:00 Geyslan G. Bem :
> > Hi maintainers,
> >
> > I'm having these error output using coccinelle.
>
> Sorry, gmail and its ctrl+enter shortcut. :/
>
> geyslan@hb ~/Projects/linux $ make coccicheck V=2 M=drivers/usb/host/
> -j4 > cocciout
> Fatal error: exception Failure("minus: parse error: \n = File
> \"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
> column 0,  charpos = 3561\naround = '&', whole content =
> &c->member\n")

Thanks ever so much for the report.  Since version 1.0.4, & cannot be in
column 0, so it would need a space in front of it.  I will submit a patch.

julia

> Fatal error: exception Failure("minus: parse error: \n = File
> \"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
> column 0,  charpos = 3561\naround = '&', whole content =
> &c->member\n")
> Fatal error: exception Failure("minus: parse error: \n = File
> \"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
> column 0,  charpos = 3561\naround = '&', whole content =
> &c->member\n")
> Fatal error: exception Failure("minus: parse error: \n = File
> \"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
> column 0,  charpos = 3561\naround = '&', whole content =
> &c->member\n")
> Fatal error: exception Failure("minus: parse error: \n = File
> \"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
> column 0,  charpos = 3561\naround = '&', whole content =
> &c->member\n")
> Fatal error: exception Failure("minus: parse error: \n = File
> \"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
> column 0,  charpos = 3561\naround = '&', whole content =
> &c->member\n")
> Fatal error: exception Failure("minus: parse error: \n = File
> \"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
> column 0,  charpos = 3561\naround = '&', whole content =
> &c->member\n")
> Fatal error: exception Failure("minus: parse error: \n = File
> \"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
> column 0,  charpos = 3561\naround = '&', whole content =
> &c->member\n")
>
> sizeof(<+...c...+>)
> |
> &c->member  // Line 126
> |
> c = E
>
> geyslan@hb ~/Projects/linux $ spatch --version
> spatch version 1.0.4 with Python support and with PCRE support
>
>
> >
> >
> > --
> > Regards,
> >
> > Geyslan G. Bem
> > hackingbits.com
>
>
>
> --
> Regards,
>
> Geyslan G. Bem
> hackingbits.com
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf/x86/intel: Make L1D_PEND_MISS.FB_FULL not constrained on Haswell

2015-12-06 Thread tip-bot for Yuanfang Chen
Commit-ID:  e0fbac1cd49c5ca6cb6a0aa918d0943ce95d906c
Gitweb: http://git.kernel.org/tip/e0fbac1cd49c5ca6cb6a0aa918d0943ce95d906c
Author: Yuanfang Chen 
AuthorDate: Tue, 24 Nov 2015 12:05:01 -0500
Committer:  Ingo Molnar 
CommitDate: Sun, 6 Dec 2015 12:54:48 +0100

perf/x86/intel: Make L1D_PEND_MISS.FB_FULL not constrained on Haswell

There was a mistake in the Haswell constraints table.

Signed-off-by: Yuanfang Chen 
Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Andi Kleen 
Cc: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
Cc: Thomas Gleixner 
Cc: Vince Weaver 
Link: http://lkml.kernel.org/r/1448384701-9110-1-git-send-email-ch...@udel.edu
Signed-off-by: Ingo Molnar 
---
 arch/x86/kernel/cpu/perf_event_intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel.c 
b/arch/x86/kernel/cpu/perf_event_intel.c
index f63360b..e2a4300 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -232,7 +232,7 @@ static struct event_constraint 
intel_hsw_event_constraints[] = {
FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */
FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */
FIXED_EVENT_CONSTRAINT(0x0300, 2), /* CPU_CLK_UNHALTED.REF */
-   INTEL_EVENT_CONSTRAINT(0x48, 0x4), /* L1D_PEND_MISS.* */
+   INTEL_UEVENT_CONSTRAINT(0x148, 0x4),/* L1D_PEND_MISS.PENDING */
INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PREC_DIST */
INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.LOAD_LATENCY */
/* CYCLE_ACTIVITY.CYCLES_L1D_PENDING */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf/x86/intel: Fix INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_NA macro

2015-12-06 Thread tip-bot for Jiri Olsa
Commit-ID:  169b932a15318e8e9f2f0f12eeb55dda09c8737f
Gitweb: http://git.kernel.org/tip/169b932a15318e8e9f2f0f12eeb55dda09c8737f
Author: Jiri Olsa 
AuthorDate: Mon, 9 Nov 2015 10:24:31 +0100
Committer:  Ingo Molnar 
CommitDate: Sun, 6 Dec 2015 12:54:48 +0100

perf/x86/intel: Fix INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_NA macro

We need to add rest of the flags to the constraint mask
instead of another INTEL_ARCH_EVENT_MASK, fixing a typo.

Signed-off-by: Jiri Olsa 
Signed-off-by: Peter Zijlstra (Intel) 
Cc: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Linus Torvalds 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
Cc: Thomas Gleixner 
Cc: Vince Weaver 
Link: 
http://lkml.kernel.org/r/1447061071-28085-1-git-send-email-jo...@kernel.org
Signed-off-by: Ingo Molnar 
---
 arch/x86/kernel/cpu/perf_event.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h
index ab18b8a..d0e35eb 100644
--- a/arch/x86/kernel/cpu/perf_event.h
+++ b/arch/x86/kernel/cpu/perf_event.h
@@ -387,7 +387,7 @@ struct cpu_hw_events {
 /* Check flags and event code/umask, and set the HSW N/A flag */
 #define INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_NA(code, n) \
__EVENT_CONSTRAINT(code, n, \
- INTEL_ARCH_EVENT_MASK|INTEL_ARCH_EVENT_MASK, \
+ INTEL_ARCH_EVENT_MASK|X86_ALL_EVENT_FLAGS, \
  HWEIGHT(n), 0, PERF_X86_EVENT_PEBS_NA_HSW)
 
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf: Do not send exit event twice

2015-12-06 Thread tip-bot for Jiri Olsa
Commit-ID:  4e93ad601a4308d4a67673c81556580817d56940
Gitweb: http://git.kernel.org/tip/4e93ad601a4308d4a67673c81556580817d56940
Author: Jiri Olsa 
AuthorDate: Wed, 4 Nov 2015 16:00:05 +0100
Committer:  Ingo Molnar 
CommitDate: Sun, 6 Dec 2015 12:54:49 +0100

perf: Do not send exit event twice

In case we monitor events system wide, we get EXIT event
(when configured) twice for each task that exited.

Note doubled lines with same pid/tid in following example:

  $ sudo ./perf record -a
  ^C[ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.480 MB perf.data (2518 samples) ]
  $ sudo ./perf report -D | grep EXIT

  0 60290687567581 0x59910 [0x38]: PERF_RECORD_EXIT(1250:1250):(1250:1250)
  0 60290687568354 0x59948 [0x38]: PERF_RECORD_EXIT(1250:1250):(1250:1250)
  0 60290687988744 0x59ad8 [0x38]: PERF_RECORD_EXIT(1250:1250):(1250:1250)
  0 60290687989198 0x59b10 [0x38]: PERF_RECORD_EXIT(1250:1250):(1250:1250)
  1 60290692567895 0x62af0 [0x38]: PERF_RECORD_EXIT(1253:1253):(1253:1253)
  1 60290692568322 0x62b28 [0x38]: PERF_RECORD_EXIT(1253:1253):(1253:1253)
  2 60290692739276 0x69a18 [0x38]: PERF_RECORD_EXIT(1252:1252):(1252:1252)
  2 60290692739910 0x69a50 [0x38]: PERF_RECORD_EXIT(1252:1252):(1252:1252)

The reason is that the cpu contexts are processes each time
we call perf_event_task. I'm changing the perf_event_aux logic
to serve task_ctx and cpu contexts separately, which ensure we
don't get EXIT event generated twice on same cpu context.

This does not affect other auxiliary events, as they don't
use task_ctx at all.

Signed-off-by: Jiri Olsa 
Signed-off-by: Peter Zijlstra (Intel) 
Cc: Arnaldo Carvalho de Melo 
Cc: Arnaldo Carvalho de Melo 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Linus Torvalds 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
Cc: Thomas Gleixner 
Cc: Vince Weaver 
Link: http://lkml.kernel.org/r/1446649205-5822-1-git-send-email-jo...@kernel.org
Signed-off-by: Ingo Molnar 
---
 kernel/events/core.c | 42 +++---
 1 file changed, 31 insertions(+), 11 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 49a5118..39cf4a4 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -5683,6 +5683,17 @@ perf_event_aux_ctx(struct perf_event_context *ctx,
 }
 
 static void
+perf_event_aux_task_ctx(perf_event_aux_output_cb output, void *data,
+   struct perf_event_context *task_ctx)
+{
+   rcu_read_lock();
+   preempt_disable();
+   perf_event_aux_ctx(task_ctx, output, data);
+   preempt_enable();
+   rcu_read_unlock();
+}
+
+static void
 perf_event_aux(perf_event_aux_output_cb output, void *data,
   struct perf_event_context *task_ctx)
 {
@@ -5691,14 +5702,23 @@ perf_event_aux(perf_event_aux_output_cb output, void 
*data,
struct pmu *pmu;
int ctxn;
 
+   /*
+* If we have task_ctx != NULL we only notify
+* the task context itself. The task_ctx is set
+* only for EXIT events before releasing task
+* context.
+*/
+   if (task_ctx) {
+   perf_event_aux_task_ctx(output, data, task_ctx);
+   return;
+   }
+
rcu_read_lock();
list_for_each_entry_rcu(pmu, &pmus, entry) {
cpuctx = get_cpu_ptr(pmu->pmu_cpu_context);
if (cpuctx->unique_pmu != pmu)
goto next;
perf_event_aux_ctx(&cpuctx->ctx, output, data);
-   if (task_ctx)
-   goto next;
ctxn = pmu->task_ctx_nr;
if (ctxn < 0)
goto next;
@@ -5708,12 +5728,6 @@ perf_event_aux(perf_event_aux_output_cb output, void 
*data,
 next:
put_cpu_ptr(pmu->pmu_cpu_context);
}
-
-   if (task_ctx) {
-   preempt_disable();
-   perf_event_aux_ctx(task_ctx, output, data);
-   preempt_enable();
-   }
rcu_read_unlock();
 }
 
@@ -8803,10 +8817,8 @@ static void perf_event_exit_task_context(struct 
task_struct *child, int ctxn)
struct perf_event_context *child_ctx, *clone_ctx = NULL;
unsigned long flags;
 
-   if (likely(!child->perf_event_ctxp[ctxn])) {
-   perf_event_task(child, NULL, 0);
+   if (likely(!child->perf_event_ctxp[ctxn]))
return;
-   }
 
local_irq_save(flags);
/*
@@ -8890,6 +8902,14 @@ void perf_event_exit_task(struct task_struct *child)
 
for_each_task_context_nr(ctxn)
perf_event_exit_task_context(child, ctxn);
+
+   /*
+* The perf_event_exit_task_context calls perf_event_task
+* with child's task_ctx, which generates EXIT events for
+* child contexts and sets child->perf_event_ctxp[] to NULL.
+* At this point we need to send EXIT events to cpu contexts.
+*/
+   perf_event_task(child, NULL, 0);
 }
 
 static void perf_free_event(

[tip:perf/core] perf/x86/intel: Fix __initconst declaration in the RAPL perf driver

2015-12-06 Thread tip-bot for Andi Kleen
Commit-ID:  da008ee72cabdee0ee98d3a3580ca5cfb8d2d1f1
Gitweb: http://git.kernel.org/tip/da008ee72cabdee0ee98d3a3580ca5cfb8d2d1f1
Author: Andi Kleen 
AuthorDate: Mon, 30 Nov 2015 09:48:42 -0800
Committer:  Ingo Molnar 
CommitDate: Sun, 6 Dec 2015 12:55:53 +0100

perf/x86/intel: Fix __initconst declaration in the RAPL perf driver

Fix a definition in the perf rapl driver. __initconst must
be applied to a const object, but to declare a const pointer
you need to use * const ..., not const ... *

This fixes a section attribute conflict with LTO builds.

Signed-off-by: Andi Kleen 
Signed-off-by: Peter Zijlstra (Intel) 
Cc: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Linus Torvalds 
Cc: Mike Galbraith 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
Cc: Thomas Gleixner 
Cc: Vince Weaver 
Link: 
http://lkml.kernel.org/r/1448905722-2767-1-git-send-email-a...@firstfloor.org
Signed-off-by: Ingo Molnar 
---
 arch/x86/kernel/cpu/perf_event_intel_rapl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_rapl.c 
b/arch/x86/kernel/cpu/perf_event_intel_rapl.c
index ed446bd..fb5843d 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_rapl.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_rapl.c
@@ -63,7 +63,7 @@
 #define INTEL_RAPL_PP1 0x4 /* pseudo-encoding */
 
 #define NR_RAPL_DOMAINS 0x4
-static const char *rapl_domain_names[NR_RAPL_DOMAINS] __initconst = {
+static const char *const rapl_domain_names[NR_RAPL_DOMAINS] __initconst = {
"pp0-core",
"package",
"dram",
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] x86/headers: Don't include asm/processor.h in asm /atomic.h

2015-12-06 Thread tip-bot for Andi Kleen
Commit-ID:  153a4334c439cfb62e1d31cee0c790ba4157813d
Gitweb: http://git.kernel.org/tip/153a4334c439cfb62e1d31cee0c790ba4157813d
Author: Andi Kleen 
AuthorDate: Tue, 1 Dec 2015 17:00:57 -0800
Committer:  Ingo Molnar 
CommitDate: Sun, 6 Dec 2015 12:56:03 +0100

x86/headers: Don't include asm/processor.h in asm/atomic.h

asm/atomic.h doesn't really need asm/processor.h anymore. Everything
it uses has moved to other header files. So remove that include.

processor.h is a nasty header that includes lots of
other headers and makes it prone to include loops. Removing the
include here makes asm/atomic.h a "leaf" header that can
be safely included in most other headers.

The only fallout is in the lib/atomic tester which relied on
this implicit include. Give it an explicit include.
(the include is in ifdef because the user is also in ifdef)

Signed-off-by: Andi Kleen 
Signed-off-by: Peter Zijlstra (Intel) 
Cc: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Linus Torvalds 
Cc: Mike Galbraith 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
Cc: Thomas Gleixner 
Cc: Vince Weaver 
Cc: rost...@goodmis.org
Link: 
http://lkml.kernel.org/r/1449018060-1742-1-git-send-email-a...@firstfloor.org
Signed-off-by: Ingo Molnar 
---
 arch/x86/include/asm/atomic.h  | 1 -
 arch/x86/include/asm/atomic64_32.h | 1 -
 lib/atomic64_test.c| 4 
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h
index ae5fb83..3e86742 100644
--- a/arch/x86/include/asm/atomic.h
+++ b/arch/x86/include/asm/atomic.h
@@ -3,7 +3,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/arch/x86/include/asm/atomic64_32.h 
b/arch/x86/include/asm/atomic64_32.h
index a11c30b..a984111 100644
--- a/arch/x86/include/asm/atomic64_32.h
+++ b/arch/x86/include/asm/atomic64_32.h
@@ -3,7 +3,6 @@
 
 #include 
 #include 
-#include 
 //#include 
 
 /* An 64bit atomic type */
diff --git a/lib/atomic64_test.c b/lib/atomic64_test.c
index 83c33a5b..d51e25a 100644
--- a/lib/atomic64_test.c
+++ b/lib/atomic64_test.c
@@ -16,6 +16,10 @@
 #include 
 #include 
 
+#ifdef CONFIG_X86
+#include  /* for boot_cpu_has below */
+#endif
+
 #define TEST(bit, op, c_op, val)   \
 do {   \
atomic##bit##_set(&v, v0);  \
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] tracepoints: Move struct tracepoint to new tracepoint-defs.h header

2015-12-06 Thread tip-bot for Andi Kleen
Commit-ID:  bd2a634d9e852b9b6100f9ae9c3c790b0ff91ce0
Gitweb: http://git.kernel.org/tip/bd2a634d9e852b9b6100f9ae9c3c790b0ff91ce0
Author: Andi Kleen 
AuthorDate: Tue, 1 Dec 2015 17:00:58 -0800
Committer:  Ingo Molnar 
CommitDate: Sun, 6 Dec 2015 12:56:06 +0100

tracepoints: Move struct tracepoint to new tracepoint-defs.h header

Steven recommended open coding access to tracepoint->key to add
trace points to headers. Unfortunately this is difficult for some
headers (such as x86 asm/msr.h) because including tracepoint.h
includes so many other headers that it causes include loops.
The main problem is the include of linux/rcupdate.h, which
pulls in a lot of other headers. The rcu header is only needed
when actually defining trace points.

Move the struct tracepoint into a separate tracepoint-defs.h
header that can be included without pulling in all of RCU.

Signed-off-by: Andi Kleen 
Signed-off-by: Peter Zijlstra (Intel) 
Acked-by: Steven Rostedt 
Cc: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Linus Torvalds 
Cc: Mike Galbraith 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
Cc: Thomas Gleixner 
Cc: Vince Weaver 
Link: 
http://lkml.kernel.org/r/1449018060-1742-2-git-send-email-a...@firstfloor.org
Signed-off-by: Ingo Molnar 
---
 include/linux/tracepoint-defs.h | 27 +++
 include/linux/tracepoint.h  | 16 +---
 2 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/include/linux/tracepoint-defs.h b/include/linux/tracepoint-defs.h
new file mode 100644
index 000..e1ee97c
--- /dev/null
+++ b/include/linux/tracepoint-defs.h
@@ -0,0 +1,27 @@
+#ifndef TRACEPOINT_DEFS_H
+#define TRACEPOINT_DEFS_H 1
+
+/*
+ * File can be included directly by headers who only want to access
+ * tracepoint->key to guard out of line trace calls. Otherwise
+ * linux/tracepoint.h should be used.
+ */
+
+#include 
+#include 
+
+struct tracepoint_func {
+   void *func;
+   void *data;
+   int prio;
+};
+
+struct tracepoint {
+   const char *name;   /* Tracepoint name */
+   struct static_key key;
+   void (*regfunc)(void);
+   void (*unregfunc)(void);
+   struct tracepoint_func __rcu *funcs;
+};
+
+#endif
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 696a339c..f7c732b 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -17,26 +17,12 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 struct module;
 struct tracepoint;
 struct notifier_block;
 
-struct tracepoint_func {
-   void *func;
-   void *data;
-   int prio;
-};
-
-struct tracepoint {
-   const char *name;   /* Tracepoint name */
-   struct static_key key;
-   void (*regfunc)(void);
-   void (*unregfunc)(void);
-   struct tracepoint_func __rcu *funcs;
-};
-
 struct trace_enum_map {
const char  *system;
const char  *enum_string;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf/x86: Remove old MSR perf tracing code

2015-12-06 Thread tip-bot for Andi Kleen
Commit-ID:  f1ad44884a4c421ceaa9a4a8242a6f686670
Gitweb: http://git.kernel.org/tip/f1ad44884a4c421ceaa9a4a8242a6f686670
Author: Andi Kleen 
AuthorDate: Tue, 1 Dec 2015 17:01:00 -0800
Committer:  Ingo Molnar 
CommitDate: Sun, 6 Dec 2015 12:56:14 +0100

perf/x86: Remove old MSR perf tracing code

Now that we have generic MSR trace points we can remove the old
hackish perf MSR read tracing code.

Signed-off-by: Andi Kleen 
Signed-off-by: Peter Zijlstra (Intel) 
Cc: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Linus Torvalds 
Cc: Mike Galbraith 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
Cc: Thomas Gleixner 
Cc: Vince Weaver 
Cc: rost...@goodmis.org
Link: 
http://lkml.kernel.org/r/1449018060-1742-4-git-send-email-a...@firstfloor.org
Signed-off-by: Ingo Molnar 
---
 arch/x86/kernel/cpu/perf_event.h | 12 +---
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h
index a7ab350..799e6bd 100644
--- a/arch/x86/kernel/cpu/perf_event.h
+++ b/arch/x86/kernel/cpu/perf_event.h
@@ -14,17 +14,7 @@
 
 #include 
 
-#if 0
-#undef wrmsrl
-#define wrmsrl(msr, val)   \
-do {   \
-   unsigned int _msr = (msr);  \
-   u64 _val = (val);   \
-   trace_printk("wrmsrl(%x, %Lx)\n", (unsigned int)(_msr), \
-   (unsigned long long)(_val));\
-   native_write_msr((_msr), (u32)(_val), (u32)(_val >> 32));   \
-} while (0)
-#endif
+/* To enable MSR tracing please use the generic trace points. */
 
 /*
  *  |   NHM/WSM|  SNB |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] x86, tracing, perf: Add trace point for MSR accesses

2015-12-06 Thread tip-bot for Andi Kleen
Commit-ID:  7f47d8cc039f8746e0038fe05f1ddcb15a2e27f0
Gitweb: http://git.kernel.org/tip/7f47d8cc039f8746e0038fe05f1ddcb15a2e27f0
Author: Andi Kleen 
AuthorDate: Tue, 1 Dec 2015 17:00:59 -0800
Committer:  Ingo Molnar 
CommitDate: Sun, 6 Dec 2015 12:56:10 +0100

x86, tracing, perf: Add trace point for MSR accesses

For debugging low level code interacting with the CPU it is often
useful to trace the MSR read/writes. This gives a concise summary of
PMU and other operations.

perf has an ad-hoc way to do this using trace_printk, but it's
somewhat limited (and also now spews ugly boot messages when enabled)

Instead define real trace points for all MSR accesses.

This adds three new trace points: read_msr and write_msr and rdpmc.

They also report if the access faulted (if *_safe is used)

This allows filtering and triggering on specific MSR values, which
allows various more advanced debugging techniques.

All the values are well defined in the CPU documentation.

The trace can be post processed with
Documentation/trace/postprocess/decode_msr.py to add symbolic MSR
names to the trace.

I only added it to native MSR accesses in C, not paravirtualized or in
entry*.S (which is not too interesting)

Originally the patch kit moved the MSRs out of line.  This uses an
alternative approach recommended by Steven Rostedt of only moving the
trace calls out of line, but open coding the access to the jump label.

Signed-off-by: Andi Kleen 
Signed-off-by: Peter Zijlstra (Intel) 
Acked-by: Steven Rostedt 
Cc: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Linus Torvalds 
Cc: Mike Galbraith 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
Cc: Thomas Gleixner 
Cc: Vince Weaver 
Link: 
http://lkml.kernel.org/r/1449018060-1742-3-git-send-email-a...@firstfloor.org
Signed-off-by: Ingo Molnar 
---
 Documentation/trace/events-msr.txt| 37 +
 Documentation/trace/postprocess/decode_msr.py | 37 +
 arch/x86/include/asm/msr-trace.h  | 57 +++
 arch/x86/include/asm/msr.h| 31 +++
 arch/x86/lib/msr.c| 26 
 5 files changed, 188 insertions(+)

diff --git a/Documentation/trace/events-msr.txt 
b/Documentation/trace/events-msr.txt
new file mode 100644
index 000..78c383b
--- /dev/null
+++ b/Documentation/trace/events-msr.txt
@@ -0,0 +1,37 @@
+
+The x86 kernel supports tracing most MSR (Model Specific Register) accesses.
+To see the definition of the MSRs on Intel systems please see the SDM
+at http://www.intel.com/sdm (Volume 3)
+
+Available trace points:
+
+/sys/kernel/debug/tracing/events/msr/
+
+Trace MSR reads
+
+read_msr
+
+msr: MSR number
+val: Value written
+failed: 1 if the access failed, otherwise 0
+
+
+Trace MSR writes
+
+write_msr
+
+msr: MSR number
+val: Value written
+failed: 1 if the access failed, otherwise 0
+
+
+Trace RDPMC in kernel
+
+rdpmc
+
+The trace data can be post processed with the postprocess/decode_msr.py script
+
+cat /sys/kernel/debug/tracing/trace | decode_msr.py 
/usr/src/linux/include/asm/msr-index.h
+
+to add symbolic MSR names.
+
diff --git a/Documentation/trace/postprocess/decode_msr.py 
b/Documentation/trace/postprocess/decode_msr.py
new file mode 100644
index 000..0ab40e0
--- /dev/null
+++ b/Documentation/trace/postprocess/decode_msr.py
@@ -0,0 +1,37 @@
+#!/usr/bin/python
+# add symbolic names to read_msr / write_msr in trace
+# decode_msr msr-index.h < trace
+import sys
+import re
+
+msrs = dict()
+
+with open(sys.argv[1] if len(sys.argv) > 1 else "msr-index.h", "r") as f:
+   for j in f:
+   m = re.match(r'#define (MSR_\w+)\s+(0x[0-9a-fA-F]+)', j)
+   if m:
+   msrs[int(m.group(2), 16)] = m.group(1)
+
+extra_ranges = (
+   ( "MSR_LASTBRANCH_%d_FROM_IP", 0x680, 0x69F ),
+   ( "MSR_LASTBRANCH_%d_TO_IP", 0x6C0, 0x6DF ),
+   ( "LBR_INFO_%d", 0xdc0, 0xddf ),
+)
+
+for j in sys.stdin:
+   m = re.search(r'(read|write)_msr:\s+([0-9a-f]+)', j)
+   if m:
+   r = None
+   num = int(m.group(2), 16)
+   if num in msrs:
+   r = msrs[num]
+   else:
+   for er in extra_ranges:
+   if er[1] <= num <= er[2]:
+   r = er[0] % (num - er[1],)
+   break
+   if r:
+   j = j.replace(" " + m.group(2), " " + r + "(" + 
m.group(2) + ")")
+   print j,
+
+
diff --git a/arch/x86/include/asm/msr-trace.h b/arch/x86/include/asm/msr-trace.h
new file mode 100644
index 000..7567225
--- /dev/null
+++ b/arch/x86/include/asm/msr-trace.h
@@ -0,0 +1,57 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM msr
+
+#undef TRACE_INCLUDE_FILE
+#define TRACE_INCLUDE_FILE msr-trace
+
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH asm/
+
+#if !defined(_TRACE_MSR_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _T

linux-kernel@vger.kernel.org

2015-12-06 Thread Julia Lawall
Since Coccinelle 1.0.4, & cannot be in column 0.

Reported-by: Geyslan G. Bem 
Signed-off-by: Julia Lawall 

---
 scripts/coccinelle/iterators/use_after_iter.cocci |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/coccinelle/iterators/use_after_iter.cocci 
b/scripts/coccinelle/iterators/use_after_iter.cocci
index f085f59..ce8cc9c 100644
--- a/scripts/coccinelle/iterators/use_after_iter.cocci
+++ b/scripts/coccinelle/iterators/use_after_iter.cocci
@@ -123,7 +123,7 @@ list_remove_head(x,c,...)
 |
 sizeof(<+...c...+>)
 |
-&c->member
+ &c->member
 |
 c = E
 |

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 BUG] coccinelle: use_after_iter parse error

2015-12-06 Thread Geyslan G. Bem
2015-12-06 10:17 GMT-03:00 Julia Lawall :
>
>
> On Sun, 6 Dec 2015, Geyslan G. Bem wrote:
>
>> 2015-12-06 10:09 GMT-03:00 Geyslan G. Bem :
>> > Hi maintainers,
>> >
>> > I'm having these error output using coccinelle.
>>
>> Sorry, gmail and its ctrl+enter shortcut. :/
>>
>> geyslan@hb ~/Projects/linux $ make coccicheck V=2 M=drivers/usb/host/
>> -j4 > cocciout
>> Fatal error: exception Failure("minus: parse error: \n = File
>> \"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
>> column 0,  charpos = 3561\naround = '&', whole content =
>> &c->member\n")
>
> Thanks ever so much for the report.  Since version 1.0.4, & cannot be in
> column 0, so it would need a space in front of it.  I will submit a patch.

You're welcome. :)

>
> julia
>
>> Fatal error: exception Failure("minus: parse error: \n = File
>> \"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
>> column 0,  charpos = 3561\naround = '&', whole content =
>> &c->member\n")
>> Fatal error: exception Failure("minus: parse error: \n = File
>> \"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
>> column 0,  charpos = 3561\naround = '&', whole content =
>> &c->member\n")
>> Fatal error: exception Failure("minus: parse error: \n = File
>> \"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
>> column 0,  charpos = 3561\naround = '&', whole content =
>> &c->member\n")
>> Fatal error: exception Failure("minus: parse error: \n = File
>> \"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
>> column 0,  charpos = 3561\naround = '&', whole content =
>> &c->member\n")
>> Fatal error: exception Failure("minus: parse error: \n = File
>> \"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
>> column 0,  charpos = 3561\naround = '&', whole content =
>> &c->member\n")
>> Fatal error: exception Failure("minus: parse error: \n = File
>> \"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
>> column 0,  charpos = 3561\naround = '&', whole content =
>> &c->member\n")
>> Fatal error: exception Failure("minus: parse error: \n = File
>> \"./scripts/coccinelle/iterators/use_after_iter.cocci\", line 126,
>> column 0,  charpos = 3561\naround = '&', whole content =
>> &c->member\n")
>>
>> sizeof(<+...c...+>)
>> |
>> &c->member  // Line 126
>> |
>> c = E
>>
>> geyslan@hb ~/Projects/linux $ spatch --version
>> spatch version 1.0.4 with Python support and with PCRE support
>>
>>
>> >
>> >
>> > --
>> > Regards,
>> >
>> > Geyslan G. Bem
>> > hackingbits.com
>>
>>
>>
>> --
>> Regards,
>>
>> Geyslan G. Bem
>> hackingbits.com
>>



-- 
Regards,

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


Re: gigaset: freeing an active object

2015-12-06 Thread Paul Bolle
On wo, 2015-12-02 at 18:48 -0500, Peter Hurley wrote:
> On 11/30/2015 01:01 PM, Paul Bolle wrote:
> > Should (something like) this go into stable too?
> 
> Definitely for stable since it has a userspace triggerable component.

Thanks, will do.

> > --- a/drivers/isdn/gigaset/ser-gigaset.c
> > +++ b/drivers/isdn/gigaset/ser-gigaset.c
> > @@ -42,8 +42,9 @@ MODULE_PARM_DESC(cidmode, "stay in CID mode when
> > idle");
> >  
> >  static struct gigaset_driver *driver;
> >  
> > +static struct platform_device pdev;
> > +
> >  struct ser_cardstate {
> > -   struct platform_device  dev;
> > struct tty_struct   *tty;
> > atomic_trefcnt;
> > struct completion   dead_cmp;
> > @@ -370,8 +371,8 @@ static void gigaset_freecshw(struct cardstate
> > *cs)
> > tasklet_kill(&cs->write_tasklet);
> > if (!cs->hw.ser)
> > return;
> > -   dev_set_drvdata(&cs->hw.ser->dev.dev, NULL);
> > -   platform_device_unregister(&cs->hw.ser->dev);
> > +   dev_set_drvdata(&pdev.dev, NULL);
> > +   platform_device_unregister(&pdev);
> > kfree(cs->hw.ser);
> 
> Tilman,
> 
> Is there a 1:1 correspondence and lifetime for the embedded platform
> device and it's containing memory?

(Haven't heard from Tilman, so I'll give this a try.)

That containing memory is a struct ser_cardstate. And currently
instances of struct _ser_cardstate are malloced and freed in routines
that also call platform_device_register() and
platform_device_unregister(). So yes, I think there's a 1:1
correspondence.

> I ask because the typical approach for device teardown is to put the
> kfree() in the release method;

(Side note: the (struct device) release method of this driver 
-gigaset_device_release() - is actually a nop. It only frees device
->platform_data and platform_device->resource, but neither are actually
used: they remain NULL through their entire life.)

>  naturally, that won't work if there
> is some other lifetime issue.

I'm not sure I follow what you mean here. Could you point me at a driver
that uses that approach, so that I can have a look at it?

Thanks,


Paul Bolle
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] usb: host: iounmap before return

2015-12-06 Thread Geyslan G. Bem
This patch fixes a 'quirk_usb_handoff_xhci()' branch return that was not 
unmapping correctly.

Coccinelle: scripts/coccinelle/free/iounmap.cocci

Signed-off-by: Geyslan G. Bem 
---
 drivers/usb/host/pci-quirks.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index f940056..64150dd 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -990,7 +990,7 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev)
/* We're reading garbage from the controller */
dev_warn(&pdev->dev,
 "xHCI controller failing to respond");
-   return;
+   goto out;
}
 
if (!ext_cap_offset)
@@ -1062,6 +1062,7 @@ hc_init:
 XHCI_MAX_HALT_USEC, val);
}
 
+out:
iounmap(base);
 }
 
-- 
2.6.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/


Re: [RFC] usb: coccinelle and checkpatch cleanup

2015-12-06 Thread Geyslan G. Bem
2015-12-04 18:55 GMT-03:00 Geyslan G. Bem :
> While applying the "scripts/coccinelle/misc/compare_const_fl.cocci" in
> usb/host/ tree I found files that deserve almost a full cleanup (very
> wrong coding style). Eg. drivers/usb/host/ohci-dbg.c
By wrong coding style I meant checkpatch warnings.

I asked since I'm concerned not to break the author log, that I know
it's important.

>
> Can I do a full cleaning or only coccinelle patches?
>
> --
> Regards,
>
> Geyslan G. Bem
> hackingbits.com



-- 
Regards,

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


[PATCH -v1.1 3/4] x86/cpufeature: Remove unused and seldomly used cpu_has_xx macros

2015-12-06 Thread Borislav Petkov
On Sat, Dec 05, 2015 at 07:50:11PM +0100, Thomas Gleixner wrote:
> On Tue, 1 Dec 2015, Borislav Petkov wrote:
> >  #if __GNUC__ >= 4
> >  extern void warn_pre_alternatives(void);
> > diff --git a/arch/x86/include/asm/xor_32.h b/arch/x86/include/asm/xor_32.h
> > index 5a08bc8bff33..ccca77dad474 100644
> > --- a/arch/x86/include/asm/xor_32.h
> > +++ b/arch/x86/include/asm/xor_32.h
> > @@ -553,7 +553,7 @@ do {
> > \
> > if (cpu_has_xmm) {  \
> > xor_speed(&xor_block_pIII_sse); \
> > xor_speed(&xor_block_sse_pf64); \
> > -   } else if (cpu_has_mmx) {   \
> > +   } else if (static_cpu_has_safe(X86_FEATURE_MMX)) { \
> 
> This one can be boot_cpu_has. It's only used in crypto init for
> testing the fastest xor algo.
> 
> > diff --git a/arch/x86/kernel/cpu/mtrr/generic.c 
> > b/arch/x86/kernel/cpu/mtrr/generic.c
> > index 3b533cf37c74..8f2ef910c7bf 100644
> > --- a/arch/x86/kernel/cpu/mtrr/generic.c
> > +++ b/arch/x86/kernel/cpu/mtrr/generic.c
> > @@ -349,7 +349,7 @@ static void get_fixed_ranges(mtrr_type *frs)
> >  
> >  void mtrr_save_fixed_ranges(void *info)
> >  {
> > -   if (cpu_has_mtrr)
> > +   if (static_cpu_has_safe(X86_FEATURE_MTRR))
> > get_fixed_ranges(mtrr_state.fixed_ranges);
> 
> This one is not really hotpath either. Its called from cpu_up and from
> hibernation code.

---
From: Borislav Petkov 
Date: Mon, 9 Nov 2015 10:38:45 +0100
Subject: [PATCH -v1.1 3/4] x86/cpufeature: Remove unused and seldomly used 
cpu_has_xx macros

Those are stupid and code should use static_cpu_has_safe() or
boot_cpu_has() instead. Kill the least used and unused ones.

The remaining ones need more careful inspection before a conversion can
happen. On the TODO.

Signed-off-by: Borislav Petkov 
Cc: David Sterba 
Cc: Herbert Xu 
Cc: Peter Zijlstra 
Cc: Matt Mackall 
Cc: Chris Mason 
Cc: Josef Bacik 
Signed-off-by: Borislav Petkov 
---
 arch/x86/crypto/chacha20_glue.c |  2 +-
 arch/x86/crypto/crc32c-intel_glue.c |  2 +-
 arch/x86/include/asm/cmpxchg_32.h   |  2 +-
 arch/x86/include/asm/cmpxchg_64.h   |  2 +-
 arch/x86/include/asm/cpufeature.h   | 37 -
 arch/x86/include/asm/xor_32.h   |  2 +-
 arch/x86/kernel/cpu/amd.c   |  4 ++--
 arch/x86/kernel/cpu/common.c|  4 +++-
 arch/x86/kernel/cpu/intel.c |  3 ++-
 arch/x86/kernel/cpu/intel_cacheinfo.c   |  6 ++---
 arch/x86/kernel/cpu/mtrr/generic.c  |  2 +-
 arch/x86/kernel/cpu/mtrr/main.c |  2 +-
 arch/x86/kernel/cpu/perf_event_amd.c|  4 ++--
 arch/x86/kernel/cpu/perf_event_amd_uncore.c | 11 +
 arch/x86/kernel/fpu/init.c  |  4 ++--
 arch/x86/kernel/hw_breakpoint.c |  6 +++--
 arch/x86/kernel/smpboot.c   |  2 +-
 arch/x86/kernel/vm86_32.c   |  4 +++-
 arch/x86/mm/setup_nx.c  |  4 ++--
 drivers/char/hw_random/via-rng.c|  5 ++--
 drivers/crypto/padlock-aes.c|  2 +-
 drivers/crypto/padlock-sha.c|  2 +-
 drivers/iommu/intel_irq_remapping.c |  2 +-
 fs/btrfs/disk-io.c  |  2 +-
 24 files changed, 48 insertions(+), 68 deletions(-)

diff --git a/arch/x86/crypto/chacha20_glue.c b/arch/x86/crypto/chacha20_glue.c
index 722bacea040e..8baaff5af0b5 100644
--- a/arch/x86/crypto/chacha20_glue.c
+++ b/arch/x86/crypto/chacha20_glue.c
@@ -125,7 +125,7 @@ static struct crypto_alg alg = {
 
 static int __init chacha20_simd_mod_init(void)
 {
-   if (!cpu_has_ssse3)
+   if (!boot_cpu_has(X86_FEATURE_SSSE3))
return -ENODEV;
 
 #ifdef CONFIG_AS_AVX2
diff --git a/arch/x86/crypto/crc32c-intel_glue.c 
b/arch/x86/crypto/crc32c-intel_glue.c
index 81a595d75cf5..0e9871693f24 100644
--- a/arch/x86/crypto/crc32c-intel_glue.c
+++ b/arch/x86/crypto/crc32c-intel_glue.c
@@ -257,7 +257,7 @@ static int __init crc32c_intel_mod_init(void)
if (!x86_match_cpu(crc32c_cpu_id))
return -ENODEV;
 #ifdef CONFIG_X86_64
-   if (cpu_has_pclmulqdq) {
+   if (boot_cpu_has(X86_FEATURE_PCLMULQDQ)) {
alg.update = crc32c_pcl_intel_update;
alg.finup = crc32c_pcl_intel_finup;
alg.digest = crc32c_pcl_intel_digest;
diff --git a/arch/x86/include/asm/cmpxchg_32.h 
b/arch/x86/include/asm/cmpxchg_32.h
index f7e142926481..e4959d023af8 100644
--- a/arch/x86/include/asm/cmpxchg_32.h
+++ b/arch/x86/include/asm/cmpxchg_32.h
@@ -109,6 +109,6 @@ static inline u64 __cmpxchg64_local(volatile u64 *ptr, u64 
old, u64 new)
 
 #endif
 
-#define system_has_cmpxchg_double() cpu_has_cx8
+#define system_has_cmpxchg_double() boot_cpu_has(X86_FEATURE_CX8)
 
 #endif /* _ASM_X86_CMPXCHG_32_H */
diff --git a/arch/x86/include/asm/cmpxchg_64.h 
b/arch/x86/include/asm/cmpxchg_64.h
index 1af94697

Re: [PATCH v2 1/2] um: Set secure access mode for temporary file

2015-12-06 Thread Mickaël Salaün
On 06/12/2015 12:32, Mickaël Salaün wrote:
> On 04/12/2015 18:13, Tristan Schmelcher wrote:
>> If there is a concern that the mkstemp implementation may be insecure,
>> why not set and restore the umask?
>>
> 
> I will add this safeguard.

Well, I'm concerned to use umask because it is not thread-safe and drivers may 
use create_mem_file() in a multi-theaded context. I prefer to stick to fchmod 
and handle the race-condition with O_TMPFILE unsell someone is sure that this 
will not create bugs :)

 Mickaël



signature.asc
Description: OpenPGP digital signature


From Office Of Mr. James Dimon CEO

2015-12-06 Thread Mr
>From Office Of Mr. James Dimon CEO
JP Morgan Chase Bank
Wa1-2213 5508N
Division St Spokane, WA 99208
Direct Tele: Number: (509) 592-9622
Fax 630-733-6138
My office e-mail: customerc...@jpchaseinfo.com 
chasebank43...@gmail.com
DATE: 12 / 05 / 2015
 
Urgent Attention My Dear Friend,
 
How are you today? hope fine. well my dear, this is to let you know that this 
fund was Approved in the name of one Melo one of our contractors that have not 
recieve their contract payment, but from the information we recieved telling us 
that Mr Robert J Penalva is no more alive to claim his contract fund worth of 
usd$5,000 000 00 only Now my dear, i will like you to make this as a deal 
between you and i for me to make sure that this fund.

My dear this is to let you know that after our board meeting last week Friday, 
the JP Morgan Chase Bank wishes to inform Mr Robert J Penalva that we have come 
to conclusion that we really need to set up an online account in the name of 
Beneficiary here in our Bank so that Chase Bank can credit your online account 
with your Fund valued Usd$5,000.000.00 (Five Million United States Dollars) 
immediately and give you the online details which you can view your account 
information's to see your Fund and make transfer of your Fund to any bank of 
your choice you can call to speak with  Customer careline 509 592-9622 Chase 
Bank.

Now what i like you to know is that everything in regards of the transfer of 
this fund into your online account with JP Morgan Chase Bank will be made here 
at my office as the Executive Chairman, Chief Executive Officer,
President Mr. James Dimon CEO before i will forward the transfer order to the 
Key Tested Telex Transfer Department of this Bank for immediate transfer of 
this fund into your online account.
 
To enable me carry on the process of transfer of this fund in your favour, i 
will like you to send the following information to me.
 
1) Your full name.
2) Phone, fax and mobile#.
3) Company name and address.
4) Profession, age and marital status.
Scan Copy of your ID Card.

 
Please my dear make sure you forward all these to me for it will enable us 
tramsfer this fund to you without any further delay, meanwhile after the 
transfer of this fund into your online account, we are going to share the money 
You 70% Me 30% NEXT OF KIN and i will come over to your country to invest my 
own share ok.
 
This transaction is 100% risk free and i will like you to keep it  so 
confidencial untill the transfer take place and also give me all your attention 
to make this transaction a suceess.
 
Meanwhile view the attachment file for my international passport and official 
working identity Card for your clearification.

This is information of Name Mr Robert J Penalva Address 429 W. Doncrest St.  
Monterey Park, CA. 91754-5522 And Number 323304-8335 And E-mail address  
pena...@pacbell.ne
 
Get back to me immediately you recieve this mail for unward  transaction.
 
Waiting for your Urgent respons.
 
Thanks.
  
Mr. Jamie Dimon.Executive Chairman, Chief Executive Officer,
President and Member of Operating Committee, JPMorgan Chase & Co
Chase Bank is a full service financial firm and the largest U.S
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] Documentation: email-clients.txt

2015-12-06 Thread Jonathan Corbet
On Sun, 6 Dec 2015 01:09:39 -0500
Sanidhya Solanki  wrote:

> Patch included below. As an aside, thank you for the excellent work on
> the books and other documentation.

Thanks for the nice comments.  Future praise, however, should go below the
"---" marker so I don't have to edit it out of the changelogs :)

> Documentation: email-clients.txt
> 
> The information for Claws Mail, Evolution and Thunderbird was out of
> date. It has been updated with new instructions and warnings.

So I feel like I'm missing some sort of intentional irony, but I do have
to point out that this patch has been corrupted by your mailer and cannot
be applied.  The usual advice here applies: try sending the email to
yourself and applying the result.

> diff --git a/Documentation/email-clients.txt
> b/Documentation/email-clients.txt index 2d485de..8819c90 100644
> --- a/Documentation/email-clients.txt
> +++ b/Documentation/email-clients.txt
> @@ -79,17 +79,27 @@ to insert into the message.
>  ~~
>  Claws Mail (GUI)
>  
> -Works. Some people use this successfully for patches.
> +Tested and Works as of December 2015. Some people use this successfully
> +for patches.

Not sure we need datestamps like this here.  In any case, a few kernel
developers are known to use claws - myself included.  We test it every day :)

>  To insert a patch use Message->Insert File (CTRL+i) or an external
> editor. 
>  If the inserted patch has to be edited in the Claws composition window
>  "Auto wrapping" in Configuration->Preferences->Compose->Wrapping
> should be -disabled.
> +disabled. Also, under the heading "View", sub-heading "Character
> Encoding" +, choose "Unicode (UTF - 8)"
> +
> +Do remember that if you insert or type something in the main text area,
> +and decide to delete it, you will need to reset the formatting by
> opening +a new window for the change you want to make. Re-using the
> window in which +you deleted the text will lead to the new message
> being mangled. 

...and this makes no sense to me.  I've never seen any such behavior in
claws?

>  Evolution (GUI)
>  
> +As of December 2015, the composing & inserting  method described below
> +does not work.

Could it really be that nobody is using evolution?  Much nicer here would
be to describe how it fails to work, and, ideally, come up with a fix.

>  Some people use this successfully for patches.
>  
>  When composing mail select: Preformat
> @@ -244,8 +254,9 @@ Sylpheed (GUI)
>  ~~
>  Thunderbird (GUI)
>  
> -Thunderbird is an Outlook clone that likes to mangle text, but there
> are ways -to coerce it into behaving.
> +Thunderbird is an Outlook clone that likes to mangle text, but there
> are +ways to coerce it into behaving. In December 2015, the internal
> editor +options do not appear to work.

Again, what's the problem here?  I suspect there are people using
Thunderbird out there, how are they doing it if the documented approach
doesn't work?

Thanks,

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/


Re: gigaset: freeing an active object

2015-12-06 Thread Tilman Schmidt
Am 06.12.2015 um 14:31 schrieb Paul Bolle:
> On wo, 2015-12-02 at 18:48 -0500, Peter Hurley wrote:
>> On 11/30/2015 01:01 PM, Paul Bolle wrote:

>>> --- a/drivers/isdn/gigaset/ser-gigaset.c
>>> +++ b/drivers/isdn/gigaset/ser-gigaset.c
>>> @@ -42,8 +42,9 @@ MODULE_PARM_DESC(cidmode, "stay in CID mode when
>>> idle");
>>>  
>>>  static struct gigaset_driver *driver;
>>>  
>>> +static struct platform_device pdev;
>>> +
>>>  struct ser_cardstate {
>>> -   struct platform_device  dev;
>>> struct tty_struct   *tty;
>>> atomic_trefcnt;
>>> struct completion   dead_cmp;
>>> @@ -370,8 +371,8 @@ static void gigaset_freecshw(struct cardstate
>>> *cs)
>>> tasklet_kill(&cs->write_tasklet);
>>> if (!cs->hw.ser)
>>> return;
>>> -   dev_set_drvdata(&cs->hw.ser->dev.dev, NULL);
>>> -   platform_device_unregister(&cs->hw.ser->dev);
>>> +   dev_set_drvdata(&pdev.dev, NULL);
>>> +   platform_device_unregister(&pdev);
>>> kfree(cs->hw.ser);
>>
>> Tilman,
>>
>> Is there a 1:1 correspondence and lifetime for the embedded platform
>> device and it's containing memory?
> 
> (Haven't heard from Tilman, so I'll give this a try.)

Sorry for that. Been busy.

> That containing memory is a struct ser_cardstate. And currently
> instances of struct _ser_cardstate are malloced and freed in routines
> that also call platform_device_register() and
> platform_device_unregister(). So yes, I think there's a 1:1
> correspondence.

Correct.

>> I ask because the typical approach for device teardown is to put the
>> kfree() in the release method;
> 
> (Side note: the (struct device) release method of this driver 
> -gigaset_device_release() - is actually a nop. It only frees device
> ->platform_data and platform_device->resource, but neither are actually
> used: they remain NULL through their entire life.)

Yeah, that was just copied unthinkingly from driver/base/platform.c.

So the solution might be as simple as moving the kfree() call from
gigaset_freecshw() to gigaset_device_release(). Something like this:

--- a/drivers/isdn/gigaset/ser-gigaset.c
+++ b/drivers/isdn/gigaset/ser-gigaset.c
@@ -370,19 +370,18 @@ static void gigaset_freecshw(struct cardstate *cs)
tasklet_kill(&cs->write_tasklet);
if (!cs->hw.ser)
return;
-   dev_set_drvdata(&cs->hw.ser->dev.dev, NULL);
platform_device_unregister(&cs->hw.ser->dev);
-   kfree(cs->hw.ser);
-   cs->hw.ser = NULL;
 }

 static void gigaset_device_release(struct device *dev)
 {
-   struct platform_device *pdev = to_platform_device(dev);
+   struct cardstate *cs = dev_get_drvdata(dev);

-   /* adapted from platform_device_release() in
drivers/base/platform.c */
-   kfree(dev->platform_data);
-   kfree(pdev->resource);
+   if (!cs)
+   return;
+   dev_set_drvdata(dev, NULL);
+   kfree(cs->hw.ser);
+   cs->hw.ser = NULL;
 }

 /*

(Off the top of my hat, completely untested, don't even know if that
will compile.)

-- 
Tilman Schmidt  E-Mail: til...@imap.cc
Bonn, Germany
Nous, on a des fleurs et des bougies pour nous protéger.



signature.asc
Description: OpenPGP digital signature


[PATCH] Gpu: drm: tilcdc: don't use devm_pinctrl_get_select_default() in probe

2015-12-06 Thread Nizam Haider
Since commit ab78029ecc34 (drivers/pinctrl: grab default handles from device
core), we can rely on device core for setting the default pins.

Signed-off-by: Nizam Haider 
---
 drivers/gpu/drm/tilcdc/tilcdc_tfp410.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c 
b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
index 354c47c..205f461 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
@@ -18,8 +18,6 @@
 #include 
 #include 
 #include 
-#include 
-#include 
 
 #include "tilcdc_drv.h"
 
@@ -312,7 +310,6 @@ static int tfp410_probe(struct platform_device *pdev)
struct device_node *i2c_node;
struct tfp410_module *tfp410_mod;
struct tilcdc_module *mod;
-   struct pinctrl *pinctrl;
uint32_t i2c_phandle;
int ret = -EINVAL;
 
@@ -331,10 +328,6 @@ static int tfp410_probe(struct platform_device *pdev)
 
tilcdc_module_init(mod, "tfp410", &tfp410_module_ops);
 
-   pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
-   if (IS_ERR(pinctrl))
-   dev_warn(&pdev->dev, "pins are not configured\n");
-
if (of_property_read_u32(node, "i2c", &i2c_phandle)) {
dev_err(&pdev->dev, "could not get i2c bus phandle\n");
goto fail;
-- 
1.8.1.4

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


[PATCH] [media] constify stv6110x_devctl structure

2015-12-06 Thread Julia Lawall
The stv6110x_devctl structure is never modified, so declare is as
const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall 

---
 drivers/media/dvb-frontends/stv6110x.c   |4 ++--
 drivers/media/dvb-frontends/stv6110x.h   |4 ++--
 drivers/media/dvb-frontends/stv6110x_priv.h  |2 +-
 drivers/media/pci/ddbridge/ddbridge-core.c   |2 +-
 drivers/media/pci/ngene/ngene-cards.c|2 +-
 drivers/media/pci/ttpci/budget.c |4 ++--
 drivers/media/platform/sti/c8sectpfe/c8sectpfe-dvb.c |2 +-
 drivers/media/usb/dvb-usb/technisat-usb2.c   |2 +-
 8 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/media/dvb-frontends/stv6110x.c 
b/drivers/media/dvb-frontends/stv6110x.c
index e66154e..a62c01e 100644
--- a/drivers/media/dvb-frontends/stv6110x.c
+++ b/drivers/media/dvb-frontends/stv6110x.c
@@ -355,7 +355,7 @@ static struct dvb_tuner_ops stv6110x_ops = {
.release= stv6110x_release
 };
 
-static struct stv6110x_devctl stv6110x_ctl = {
+static const struct stv6110x_devctl stv6110x_ctl = {
.tuner_init = stv6110x_init,
.tuner_sleep= stv6110x_sleep,
.tuner_set_mode = stv6110x_set_mode,
@@ -369,7 +369,7 @@ static struct stv6110x_devctl stv6110x_ctl = {
.tuner_get_status   = stv6110x_get_status,
 };
 
-struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe,
+const struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe,
const struct stv6110x_config *config,
struct i2c_adapter *i2c)
 {
diff --git a/drivers/media/dvb-frontends/stv6110x.h 
b/drivers/media/dvb-frontends/stv6110x.h
index 9f7eb25..696b6e5 100644
--- a/drivers/media/dvb-frontends/stv6110x.h
+++ b/drivers/media/dvb-frontends/stv6110x.h
@@ -55,12 +55,12 @@ struct stv6110x_devctl {
 
 #if IS_REACHABLE(CONFIG_DVB_STV6110x)
 
-extern struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe,
+extern const struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe,
   const struct stv6110x_config 
*config,
   struct i2c_adapter *i2c);
 
 #else
-static inline struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe,
+static inline const struct stv6110x_devctl *stv6110x_attach(struct 
dvb_frontend *fe,
  const struct 
stv6110x_config *config,
  struct i2c_adapter *i2c)
 {
diff --git a/drivers/media/dvb-frontends/stv6110x_priv.h 
b/drivers/media/dvb-frontends/stv6110x_priv.h
index 0ec936a..a993aba 100644
--- a/drivers/media/dvb-frontends/stv6110x_priv.h
+++ b/drivers/media/dvb-frontends/stv6110x_priv.h
@@ -70,7 +70,7 @@ struct stv6110x_state {
const struct stv6110x_config*config;
u8  regs[8];
 
-   struct stv6110x_devctl  *devctl;
+   const struct stv6110x_devctl*devctl;
 };
 
 #endif /* __STV6110x_PRIV_H */
diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c 
b/drivers/media/pci/ddbridge/ddbridge-core.c
index fba5b40..17f56a8 100644
--- a/drivers/media/pci/ddbridge/ddbridge-core.c
+++ b/drivers/media/pci/ddbridge/ddbridge-core.c
@@ -690,7 +690,7 @@ static int tuner_attach_stv6110(struct ddb_input *input, 
int type)
struct stv090x_config *feconf = type ? &stv0900_aa : &stv0900;
struct stv6110x_config *tunerconf = (input->nr & 1) ?
&stv6110b : &stv6110a;
-   struct stv6110x_devctl *ctl;
+   const struct stv6110x_devctl *ctl;
 
ctl = dvb_attach(stv6110x_attach, input->fe, tunerconf, i2c);
if (!ctl) {
diff --git a/drivers/media/pci/ngene/ngene-cards.c 
b/drivers/media/pci/ngene/ngene-cards.c
index 039bed3..4e783a6 100644
--- a/drivers/media/pci/ngene/ngene-cards.c
+++ b/drivers/media/pci/ngene/ngene-cards.c
@@ -57,7 +57,7 @@ static int tuner_attach_stv6110(struct ngene_channel *chan)
chan->dev->card_info->fe_config[chan->number];
struct stv6110x_config *tunerconf = (struct stv6110x_config *)
chan->dev->card_info->tuner_config[chan->number];
-   struct stv6110x_devctl *ctl;
+   const struct stv6110x_devctl *ctl;
 
/* tuner 1+2: i2c adapter #0, tuner 3+4: i2c adapter #1 */
if (chan->number < 2)
diff --git a/drivers/media/pci/ttpci/budget.c b/drivers/media/pci/ttpci/budget.c
index 99972be..b44639c 100644
--- a/drivers/media/pci/ttpci/budget.c
+++ b/drivers/media/pci/ttpci/budget.c
@@ -644,7 +644,7 @@ static void frontend_init(struct budget *budget)
}
 
case 0x101c: { /* TT S2-1600 */
-   struct stv6110x_devctl *ctl;
+   const struct stv6110x_devctl *ctl;
saa7146_setgpio(budget->

Re: [PATCH 00/13] perf tools: Move perf subcommand framework into lib/tools

2015-12-06 Thread Jiri Olsa
On Sun, Dec 06, 2015 at 10:37:52AM +0100, Ingo Molnar wrote:
> 
> * Josh Poimboeuf  wrote:
> 
> > Ingo suggested that I factor out the perf subcommand functionality
> > (originally copied from git) into tools/lib so that it can be used by
> > stacktool[*] and possibly others.
> > 
> > All the subcommand option handling files have been moved into libapi,
> > including parse-options.c, run-command.c, exec_cmd.c, help.c, usage.c,
> > and their dependencies.  Since several of the dependencies are more
> > general-purpose "utilities" which aren't directly related to
> > subcommands, I put everything in 'tools/lib/api/util'.  They're linked
> > into perf as part of the libapi.a library.
> > 
> > Patches 1-10 do some cleanups and splitting up of the code in
> > preparation for the move.
> > 
> > Patch 11 does the actual moving of the files into tools/lib/api/util.
> > 
> > [*] https://lkml.kernel.org/r/cover.1445443144.git.jpoim...@redhat.com
> > 
> > Josh Poimboeuf (13):
> >   perf: Use -iquote for local include paths
> >   perf: Split up util.h
> >   perf: Move term functions out of util.c
> >   perf: Remove unused pager_use_color variable
> >   perf: Split up cache.h
> >   perf: Remove cache.h
> >   perf: Save cmdline arguments earlier
> >   perf: Remove check for unused PERF_PAGER_IN_USE
> >   perf: Move cmd_version() to builtin-version.c
> >   perf: Move help_unknown_cmd() to its own file
> >   perf tools: Move strlcpy() to tools/lib/string.c
> >   perf tools: Move perf subcommand framework into a library
> >   perf tools: Move subcommand framework and related utils to libapi
> 
> >  133 files changed, 852 insertions(+), 761 deletions(-)
> 
> So this split-out looks great to me!
> 
> A bit of a background: this series is a necessary precondition of me being 
> able to 
> merge 'stacktool' and the frame pointer handling enhancements Josh is working 
> on - 
> but it would be nice if this could all be done via Arnaldo's perf tree to 
> minimize 
> any impact on pending perf work.
> 
> I've Cc:-ed Namhyung and Jiri as well, who've done a lot of work in 
> perf/util/.
> 

heya,
got compilation error over this patchset:

[jolsa@krava perf]$ make clean && make JOBS=1

  ...

  CC   tests/llvm-src-base.o
tests/llvm-src-base.c:1:24: fatal error: tests/llvm.h: No such file or directory
compilation terminated.
mv: cannot stat ‘tests/.llvm-src-base.o.tmp’: No such file or directory
/home/jolsa/kernel/linux-perf/tools/build/Makefile.build:77: recipe for target 
'tests/llvm-src-base.o' failed
make[3]: *** [tests/llvm-src-base.o] Error 1
/home/jolsa/kernel/linux-perf/tools/build/Makefile.build:116: recipe for target 
'tests' failed
make[2]: *** [tests] Error 2
Makefile.perf:313: recipe for target 'perf-in.o' failed
make[1]: *** [perf-in.o] Error 2
Makefile:68: recipe for target 'all' failed
make: *** [all] Error 2


jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/media/usb/as102: constify as102_priv_ops_t structure

2015-12-06 Thread Julia Lawall
The as102_priv_ops_t structure is never modified, so declare it as
const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall 

---
 drivers/media/usb/as102/as102_drv.h |2 +-
 drivers/media/usb/as102/as102_usb_drv.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/as102/as102_drv.h 
b/drivers/media/usb/as102/as102_drv.h
index aee2d76..8def19d 100644
--- a/drivers/media/usb/as102/as102_drv.h
+++ b/drivers/media/usb/as102/as102_drv.h
@@ -52,7 +52,7 @@ struct as10x_bus_adapter_t {
struct as10x_cmd_t *cmd, *rsp;
 
/* bus adapter private ops callback */
-   struct as102_priv_ops_t *ops;
+   const struct as102_priv_ops_t *ops;
 };
 
 struct as102_dev_t {
diff --git a/drivers/media/usb/as102/as102_usb_drv.c 
b/drivers/media/usb/as102/as102_usb_drv.c
index 3f66906..0e8030c 100644
--- a/drivers/media/usb/as102/as102_usb_drv.c
+++ b/drivers/media/usb/as102/as102_usb_drv.c
@@ -189,7 +189,7 @@ static int as102_read_ep2(struct as10x_bus_adapter_t 
*bus_adap,
return actual_len;
 }
 
-static struct as102_priv_ops_t as102_priv_ops = {
+static const struct as102_priv_ops_t as102_priv_ops = {
.upload_fw_pkt  = as102_send_ep1,
.xfer_cmd   = as102_usb_xfer_cmd,
.as102_read_ep2 = as102_read_ep2,

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


Re: [PATCH 2/7] perf test: Use machine__new_host in mma thread lookup test

2015-12-06 Thread Jiri Olsa
On Fri, Dec 04, 2015 at 10:22:15PM +0900, Namhyung Kim wrote:
> Hi Jiri,
> 
> In the subject, please do 's/mma/mmap/'.  Ditto for 3/7.

I updated that in the perf/fixes branch

Arnaldo please let me know if you need me to resend those again

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


[PATCHv2 7/7] perf test: Create kernel maps properly for hist entries test

2015-12-06 Thread Jiri Olsa
On Fri, Dec 04, 2015 at 10:23:37PM +0900, Namhyung Kim wrote:
> On Thu, Dec 03, 2015 at 09:34:18AM +0100, Jiri Olsa wrote:
> > It fixes segfault within machine__exit, that's caused
> > but not creating kernel maps for machine.. We're calling
> > machine__destroy_kernel_maps in machine__exit since commit:
> > 
> >   ebe9729c8c31 perf machine: Fix to destroy kernel maps when machine exits
> > 
> > Link: http://lkml.kernel.org/n/tip-k4snzv5t4dvdckggzwdzy...@git.kernel.org
> > Signed-off-by: Jiri Olsa 
> > ---
> >  tools/perf/tests/hists_common.c | 7 +++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/tools/perf/tests/hists_common.c 
> > b/tools/perf/tests/hists_common.c
> > index ce80b274b097..6ccdc8ac9578 100644
> > --- a/tools/perf/tests/hists_common.c
> > +++ b/tools/perf/tests/hists_common.c
> > @@ -87,6 +87,11 @@ struct machine *setup_fake_machine(struct machines 
> > *machines)
> > return NULL;
> > }
> >  
> > +   if (machine__create_kernel_maps(machine)) {
> > +   pr_debug("Not enough memory for machine setup\n");
> > +   goto out_maps;
> 
> Why not just doing 'goto out'?
> 

right.. v2 attached, perf-fixes branch updated

thanks,
jirka


---
Subject: [PATCH] perf test: Create kernel maps properly for hist entries test

It fixes segfault within machine__exit, that's caused
but not creating kernel maps for machine.. We're calling
machine__destroy_kernel_maps in machine__exit since commit:

  ebe9729c8c31 perf machine: Fix to destroy kernel maps when machine exits

Link: http://lkml.kernel.org/n/tip-k4snzv5t4dvdckggzwdzy...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/perf/tests/hists_common.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/tools/perf/tests/hists_common.c b/tools/perf/tests/hists_common.c
index ce80b274b097..46f453b1de60 100644
--- a/tools/perf/tests/hists_common.c
+++ b/tools/perf/tests/hists_common.c
@@ -87,6 +87,11 @@ struct machine *setup_fake_machine(struct machines *machines)
return NULL;
}
 
+   if (machine__create_kernel_maps(machine)) {
+   pr_debug("Not enough memory for machine setup\n");
+   goto out;
+   }
+
for (i = 0; i < ARRAY_SIZE(fake_threads); i++) {
struct thread *thread;
 
-- 
2.4.3

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


[PATCH v3 0/4] Add PWM clock support for bcm2835

2015-12-06 Thread Remi Pommarel
Hi,

This patchset adds support for pwm clock. At boot, this clock does not have a
default parent nor a default rate set. Thus we should be able to change its
parent to get this clock working. The current clock implementation is using a
mux to select the parent, but these clocks need to add a password (0x5a) in
higher register bits when changing parent. So a generic mux cannot be used
here.

The two first patches fix the clock parent selection, while the last ones are
actually adding the pwm clock registration.

Changes since v1:
- determine_rate now based its parent selection upon divided rate
  instead of the parent one
- bcm2835_clock_choose_div has been modified to produce an avarage rate
  lower or equal to the requested one
- devicetree modifications have removed to be send in another patch

Changes since v2:
- Remove useless variable and include
- Make bcm2835_clock_choose_div() divisor round up ability optional
- Set rate in bcm2835_determine_rate()
- Add device tree modification in a separate patch


Remi Pommarel (4):
  clk: bcm2835: add a round up ability to the clock divisor
  clk: bcm2835: Support for clock parent selection
  clk: bcm2835: Add PWM clock support
  clk: bcm2835: Add PWM clock support to the device tree

 arch/arm/boot/dts/bcm2835-rpi.dtsi  |   4 +
 arch/arm/boot/dts/bcm2835.dtsi  |   9 +++
 drivers/clk/bcm/clk-bcm2835.c   | 155 +++-
 include/dt-bindings/clock/bcm2835.h |   3 +-
 4 files changed, 116 insertions(+), 55 deletions(-)

-- 
2.0.1

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


[PATCH v3 3/4] clk: bcm2835: Add PWM clock support

2015-12-06 Thread Remi Pommarel
Register the pwm clock for bcm2835.

Signed-off-by: Remi Pommarel 
---
 drivers/clk/bcm/clk-bcm2835.c   | 13 +
 include/dt-bindings/clock/bcm2835.h |  3 ++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
index 6e4dd6f..015e687 100644
--- a/drivers/clk/bcm/clk-bcm2835.c
+++ b/drivers/clk/bcm/clk-bcm2835.c
@@ -807,6 +807,16 @@ static const struct bcm2835_clock_data 
bcm2835_clock_emmc_data = {
.frac_bits = 8,
 };
 
+static const struct bcm2835_clock_data bcm2835_clock_pwm_data = {
+   .name = "pwm",
+   .num_mux_parents = ARRAY_SIZE(bcm2835_clock_per_parents),
+   .parents = bcm2835_clock_per_parents,
+   .ctl_reg = CM_PWMCTL,
+   .div_reg = CM_PWMDIV,
+   .int_bits = 12,
+   .frac_bits = 12,
+};
+
 struct bcm2835_pll {
struct clk_hw hw;
struct bcm2835_cprman *cprman;
@@ -1584,6 +1594,9 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
  cprman->regs + CM_PERIICTL, CM_GATE_BIT,
  0, &cprman->regs_lock);
 
+   clks[BCM2835_CLOCK_PWM] =
+   bcm2835_register_clock(cprman, &bcm2835_clock_pwm_data);
+
return of_clk_add_provider(dev->of_node, of_clk_src_onecell_get,
   &cprman->onecell);
 }
diff --git a/include/dt-bindings/clock/bcm2835.h 
b/include/dt-bindings/clock/bcm2835.h
index d323efa..61f1d20 100644
--- a/include/dt-bindings/clock/bcm2835.h
+++ b/include/dt-bindings/clock/bcm2835.h
@@ -43,5 +43,6 @@
 #define BCM2835_CLOCK_TSENS27
 #define BCM2835_CLOCK_EMMC 28
 #define BCM2835_CLOCK_PERI_IMAGE   29
+#define BCM2835_CLOCK_PWM  30
 
-#define BCM2835_CLOCK_COUNT30
+#define BCM2835_CLOCK_COUNT31
-- 
2.0.1

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


[PATCH v3 1/4] clk: bcm2835: add a round up ability to the clock divisor

2015-12-06 Thread Remi Pommarel
Make bcm2835_clock_choose_div to optionally round up the chosen MASH divisor
so that the resulting average rate will not be higher than the requested one.

Signed-off-by: Remi Pommarel 
---
 drivers/clk/bcm/clk-bcm2835.c | 22 --
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
index 39bf582..9e881ee 100644
--- a/drivers/clk/bcm/clk-bcm2835.c
+++ b/drivers/clk/bcm/clk-bcm2835.c
@@ -1148,22 +1148,24 @@ static int bcm2835_clock_is_on(struct clk_hw *hw)
 
 static u32 bcm2835_clock_choose_div(struct clk_hw *hw,
unsigned long rate,
-   unsigned long parent_rate)
+   unsigned long parent_rate,
+   bool round_up)
 {
struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw);
const struct bcm2835_clock_data *data = clock->data;
-   u32 unused_frac_mask = GENMASK(CM_DIV_FRAC_BITS - data->frac_bits, 0);
+   u32 unused_frac_mask =
+   GENMASK(CM_DIV_FRAC_BITS - data->frac_bits, 0) >> 1;
u64 temp = (u64)parent_rate << CM_DIV_FRAC_BITS;
+   u64 rem;
u32 div;
 
-   do_div(temp, rate);
+   rem = do_div(temp, rate);
div = temp;
 
-   /* Round and mask off the unused bits */
-   if (unused_frac_mask != 0) {
-   div += unused_frac_mask >> 1;
-   div &= ~unused_frac_mask;
-   }
+   /* Round up and mask off the unused bits */
+   if (round_up && ((div & unused_frac_mask) != 0 || rem != 0))
+   div += unused_frac_mask + 1;
+   div &= ~unused_frac_mask;
 
/* Clamp to the limits. */
div = max(div, unused_frac_mask + 1);
@@ -1202,7 +1204,7 @@ static long bcm2835_clock_round_rate(struct clk_hw *hw,
 unsigned long *parent_rate)
 {
struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw);
-   u32 div = bcm2835_clock_choose_div(hw, rate, *parent_rate);
+   u32 div = bcm2835_clock_choose_div(hw, rate, *parent_rate, false);
 
return bcm2835_clock_rate_from_divisor(clock, *parent_rate, div);
 }
@@ -1271,7 +1273,7 @@ static int bcm2835_clock_set_rate(struct clk_hw *hw,
struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw);
struct bcm2835_cprman *cprman = clock->cprman;
const struct bcm2835_clock_data *data = clock->data;
-   u32 div = bcm2835_clock_choose_div(hw, rate, parent_rate);
+   u32 div = bcm2835_clock_choose_div(hw, rate, parent_rate, false);
 
cprman_write(cprman, data->div_reg, div);
 
-- 
2.0.1

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


[PATCH v3 2/4] clk: bcm2835: Support for clock parent selection

2015-12-06 Thread Remi Pommarel
Some bcm2835 clocks used by hardware (like "PWM" or "H264") can have multiple
parent clocks. These clocks divide the rate of a parent which can be selected by
setting the proper bits in the clock control register.

Previously all these parents where handled by a mux clock. But a mux clock
cannot be used because updating clock control register to select parent needs a
password to be xor'd with the parent index.

This patch get rid of mux clock and make these clocks handle their own parent,
allowing them to select the one to use.

Signed-off-by: Remi Pommarel 
---
 drivers/clk/bcm/clk-bcm2835.c | 122 ++
 1 file changed, 77 insertions(+), 45 deletions(-)

diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
index 9e881ee..6e4dd6f 100644
--- a/drivers/clk/bcm/clk-bcm2835.c
+++ b/drivers/clk/bcm/clk-bcm2835.c
@@ -1199,16 +1199,6 @@ static long bcm2835_clock_rate_from_divisor(struct 
bcm2835_clock *clock,
return temp;
 }
 
-static long bcm2835_clock_round_rate(struct clk_hw *hw,
-unsigned long rate,
-unsigned long *parent_rate)
-{
-   struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw);
-   u32 div = bcm2835_clock_choose_div(hw, rate, *parent_rate, false);
-
-   return bcm2835_clock_rate_from_divisor(clock, *parent_rate, div);
-}
-
 static unsigned long bcm2835_clock_get_rate(struct clk_hw *hw,
unsigned long parent_rate)
 {
@@ -1280,13 +1270,75 @@ static int bcm2835_clock_set_rate(struct clk_hw *hw,
return 0;
 }
 
+static int bcm2835_clock_determine_rate(struct clk_hw *hw,
+   struct clk_rate_request *req)
+{
+   struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw);
+   struct clk_hw *parent, *best_parent = NULL;
+   unsigned long rate, best_rate = 0;
+   unsigned long prate, best_prate = 0;
+   size_t i;
+   u32 div;
+
+   /*
+* Select parent clock that results in the closest but lower rate
+*/
+   for (i = 0; i < clk_hw_get_num_parents(hw); ++i) {
+   parent = clk_hw_get_parent_by_index(hw, i);
+   if (!parent)
+   continue;
+   prate = clk_hw_get_rate(parent);
+   div = bcm2835_clock_choose_div(hw, req->rate, prate, true);
+   rate = bcm2835_clock_rate_from_divisor(clock, prate, div);
+   if (rate > best_rate && rate <= req->rate) {
+   best_parent = parent;
+   best_prate = prate;
+   best_rate = rate;
+   }
+   }
+
+   if (!best_parent)
+   return -EINVAL;
+
+   req->best_parent_hw = best_parent;
+   req->best_parent_rate = best_prate;
+
+   req->rate = best_rate;
+
+   return 0;
+}
+
+static int bcm2835_clock_set_parent(struct clk_hw *hw, u8 index)
+{
+   struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw);
+   struct bcm2835_cprman *cprman = clock->cprman;
+   const struct bcm2835_clock_data *data = clock->data;
+   u8 src = (index << CM_SRC_SHIFT) & CM_SRC_MASK;
+
+   cprman_write(cprman, data->ctl_reg, src);
+   return 0;
+}
+
+static u8 bcm2835_clock_get_parent(struct clk_hw *hw)
+{
+   struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw);
+   struct bcm2835_cprman *cprman = clock->cprman;
+   const struct bcm2835_clock_data *data = clock->data;
+   u32 src = cprman_read(cprman, data->ctl_reg);
+
+   return (src & CM_SRC_MASK) >> CM_SRC_SHIFT;
+}
+
+
 static const struct clk_ops bcm2835_clock_clk_ops = {
.is_prepared = bcm2835_clock_is_on,
.prepare = bcm2835_clock_on,
.unprepare = bcm2835_clock_off,
.recalc_rate = bcm2835_clock_get_rate,
.set_rate = bcm2835_clock_set_rate,
-   .round_rate = bcm2835_clock_round_rate,
+   .determine_rate = bcm2835_clock_determine_rate,
+   .set_parent = bcm2835_clock_set_parent,
+   .get_parent = bcm2835_clock_get_parent,
 };
 
 static int bcm2835_vpu_clock_is_on(struct clk_hw *hw)
@@ -1302,7 +1354,9 @@ static const struct clk_ops bcm2835_vpu_clock_clk_ops = {
.is_prepared = bcm2835_vpu_clock_is_on,
.recalc_rate = bcm2835_clock_get_rate,
.set_rate = bcm2835_clock_set_rate,
-   .round_rate = bcm2835_clock_round_rate,
+   .determine_rate = bcm2835_clock_determine_rate,
+   .set_parent = bcm2835_clock_set_parent,
+   .get_parent = bcm2835_clock_get_parent,
 };
 
 static struct clk *bcm2835_register_pll(struct bcm2835_cprman *cprman,
@@ -1396,45 +1450,23 @@ static struct clk *bcm2835_register_clock(struct 
bcm2835_cprman *cprman,
 {
struct bcm2835_clock *clock;
struct clk_init_data init;
-   const char *parent;
+   const char *parents[1 << CM_SRC_BITS];
+   size_t i;
 
/*
-* Most of the clock generators have a mux field, so

[PATCH v3 4/4] clk: bcm2835: Add PWM clock support to the device tree

2015-12-06 Thread Remi Pommarel
Signed-off-by: Remi Pommarel 
---
 arch/arm/boot/dts/bcm2835-rpi.dtsi | 4 
 arch/arm/boot/dts/bcm2835.dtsi | 9 +
 2 files changed, 13 insertions(+)

diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi 
b/arch/arm/boot/dts/bcm2835-rpi.dtsi
index 3572f03..55801e0 100644
--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi
+++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi
@@ -60,3 +60,7 @@
status = "okay";
bus-width = <4>;
 };
+
+&pwm {
+   status = "okay";
+};
diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi
index aef64de..641f7f4 100644
--- a/arch/arm/boot/dts/bcm2835.dtsi
+++ b/arch/arm/boot/dts/bcm2835.dtsi
@@ -149,6 +149,15 @@
status = "disabled";
};
 
+   pwm: pwm@7e20c000 {
+   compatible = "brcm,bcm2835-pwm";
+   reg = <0x7e20c000 0x28>;
+   clocks = <&clocks BCM2835_CLOCK_PWM>;
+   assigned-clocks = <&clocks BCM2835_CLOCK_PWM>;
+   assigned-clock-rates = <1000>;
+   status = "disabled";
+   };
+
sdhci: sdhci@7e30 {
compatible = "brcm,bcm2835-sdhci";
reg = <0x7e30 0x100>;
-- 
2.0.1

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


Re: [PATCH] USB: serial: cp210x: Cleaned up USB access functions.

2015-12-06 Thread Johan Hovold
On Mon, Nov 30, 2015 at 04:50:38PM -0600, Konstantin Shkolnyy wrote:
> cp210x_get_config and cp210x_set_config were hard to use. They required
> the buffer as an array of 32-bit values even for smaller values, and did
> endian conversions on per-32-bit value basis, which is wrong for some
> cp210x data structures (although not for any that were actually used.)
> This change introduces separate register accessor functions for single
> 8, 16 and 32-bit values, with endian conversion, as well as "block"
> access functions without conversion.
> 
> Signed-off-by: Konstantin Shkolnyy 
> ---
>  drivers/usb/serial/cp210x.c | 314 
> ++--
>  1 file changed, 186 insertions(+), 128 deletions(-)

There's a bit too much going on here at once. Please split this into
multiple patches to facilitate review (e.g. separate get and set, and
possibly also the three widths).

Thanks,
Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] net: hisilicon: constify hnae_buf_ops and hnae_ae_ops structures

2015-12-06 Thread Julia Lawall
The hnae_buf_ops and hnae_ae_ops structures are never modified, so declare
them as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall 

---

I have the impression that this driver is not recorded properly in the
MAINTAINERS file.

 drivers/net/ethernet/hisilicon/hns/hnae.c |4 ++--
 drivers/net/ethernet/hisilicon/hns/hnae.h |   13 +++--
 drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c |2 +-
 drivers/net/ethernet/hisilicon/hns/hns_enet.c |4 ++--
 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c  |   16 
 5 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.c 
b/drivers/net/ethernet/hisilicon/hns/hnae.c
index b364529..8bf84ad 100644
--- a/drivers/net/ethernet/hisilicon/hns/hnae.c
+++ b/drivers/net/ethernet/hisilicon/hns/hnae.c
@@ -85,7 +85,7 @@ static void hnae_unmap_buffer(struct hnae_ring *ring, struct 
hnae_desc_cb *cb)
   ring_to_dma_dir(ring));
 }
 
-static struct hnae_buf_ops hnae_bops = {
+static const struct hnae_buf_ops hnae_bops = {
.alloc_buffer = hnae_alloc_buffer,
.free_buffer = hnae_free_buffer,
.map_buffer = hnae_map_buffer,
@@ -317,7 +317,7 @@ EXPORT_SYMBOL(hnae_reinit_handle);
  */
 struct hnae_handle *hnae_get_handle(struct device *owner_dev,
const char *ae_id, u32 port_id,
-   struct hnae_buf_ops *bops)
+   const struct hnae_buf_ops *bops)
 {
struct hnae_ae_dev *dev;
struct hnae_handle *handle;
diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.h 
b/drivers/net/ethernet/hisilicon/hns/hnae.h
index cec95ac..95c4ee8 100644
--- a/drivers/net/ethernet/hisilicon/hns/hnae.h
+++ b/drivers/net/ethernet/hisilicon/hns/hnae.h
@@ -451,7 +451,7 @@ struct hnae_ae_ops {
 struct hnae_ae_dev {
struct device cls_dev; /* the class dev */
struct device *dev; /* the presented dev */
-   struct hnae_ae_ops *ops;
+   const struct hnae_ae_ops *ops;
struct list_head node;
struct module *owner; /* the module who provides this dev */
int id;
@@ -471,14 +471,15 @@ struct hnae_handle {
u32 eport_id;
enum hnae_port_type port_type;
struct list_head node;/* list to hnae_ae_dev->handle_list */
-   struct hnae_buf_ops *bops; /* operation for the buffer */
+   const struct hnae_buf_ops *bops; /* operation for the buffer */
struct hnae_queue **qs;  /* array base of all queues */
 };
 
 #define ring_to_dev(ring) ((ring)->q->dev->dev)
 
 struct hnae_handle *hnae_get_handle(struct device *owner_dev, const char 
*ae_id,
-   u32 port_id, struct hnae_buf_ops *bops);
+   u32 port_id,
+   const struct hnae_buf_ops *bops);
 void hnae_put_handle(struct hnae_handle *handle);
 int hnae_ae_register(struct hnae_ae_dev *dev, struct module *owner);
 void hnae_ae_unregister(struct hnae_ae_dev *dev);
@@ -497,7 +498,7 @@ int hnae_reinit_handle(struct hnae_handle *handle);
 static inline int hnae_reserve_buffer_map(struct hnae_ring *ring,
  struct hnae_desc_cb *cb)
 {
-   struct hnae_buf_ops *bops = ring->q->handle->bops;
+   const struct hnae_buf_ops *bops = ring->q->handle->bops;
int ret;
 
ret = bops->alloc_buffer(ring, cb);
@@ -536,7 +537,7 @@ static inline void hnae_buffer_detach(struct hnae_ring 
*ring, int i)
 
 static inline void hnae_free_buffer_detach(struct hnae_ring *ring, int i)
 {
-   struct hnae_buf_ops *bops = ring->q->handle->bops;
+   const struct hnae_buf_ops *bops = ring->q->handle->bops;
struct hnae_desc_cb *cb = &ring->desc_cb[i];
 
if (!ring->desc_cb[i].dma)
@@ -550,7 +551,7 @@ static inline void hnae_free_buffer_detach(struct hnae_ring 
*ring, int i)
 static inline void hnae_replace_buffer(struct hnae_ring *ring, int i,
   struct hnae_desc_cb *res_cb)
 {
-   struct hnae_buf_ops *bops = ring->q->handle->bops;
+   const struct hnae_buf_ops *bops = ring->q->handle->bops;
struct hnae_desc_cb tmp_cb = ring->desc_cb[i];
 
bops->unmap_buffer(ring, &ring->desc_cb[i]);
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c 
b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
index 1a16c03..06461d2 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
@@ -730,7 +730,7 @@ int hns_ae_get_regs_len(struct hnae_handle *handle)
return total_num;
 }
 
-static struct hnae_ae_ops hns_dsaf_ops = {
+static const struct hnae_ae_ops hns_dsaf_ops = {
.get_handle = hns_ae_get_handle,
.put_handle = hns_ae_put_handle,
.init_queue = hns_ae_init_queue,
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c 
b/drivers/net

[PATCH] PCI: constify pci_platform_pm_ops structure

2015-12-06 Thread Julia Lawall
The pci_platform_pm_ops structure is never modified, so declare it as
const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall 

---
 drivers/pci/pci-acpi.c |2 +-
 drivers/pci/pci.c  |4 ++--
 drivers/pci/pci.h  |2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index a32ba75..8400f80 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -529,7 +529,7 @@ static bool acpi_pci_need_resume(struct pci_dev *dev)
return !!adev->power.flags.dsw_present;
 }
 
-static struct pci_platform_pm_ops acpi_pci_platform_pm = {
+static const struct pci_platform_pm_ops acpi_pci_platform_pm = {
.is_manageable = acpi_pci_power_manageable,
.set_state = acpi_pci_set_power_state,
.choose_state = acpi_pci_choose_state,
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 314db8c..d1a7105 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -527,9 +527,9 @@ static void pci_restore_bars(struct pci_dev *dev)
pci_update_resource(dev, i);
 }
 
-static struct pci_platform_pm_ops *pci_platform_pm;
+static const struct pci_platform_pm_ops *pci_platform_pm;
 
-int pci_set_platform_pm(struct pci_platform_pm_ops *ops)
+int pci_set_platform_pm(const struct pci_platform_pm_ops *ops)
 {
if (!ops->is_manageable || !ops->set_state || !ops->choose_state
|| !ops->sleep_wake)
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index d390fc1..f6f151a 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -68,7 +68,7 @@ struct pci_platform_pm_ops {
bool (*need_resume)(struct pci_dev *dev);
 };
 
-int pci_set_platform_pm(struct pci_platform_pm_ops *ops);
+int pci_set_platform_pm(const struct pci_platform_pm_ops *ops);
 void pci_update_current_state(struct pci_dev *dev, pci_power_t state);
 void pci_power_up(struct pci_dev *dev);
 void pci_disable_enabled_device(struct pci_dev *dev);

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


Re: [PATCH] net: qca_spi: fix transmit queue timeout handling

2015-12-06 Thread David Miller
From: Stefan Wahren 
Date: Fri,  4 Dec 2015 16:29:10 +0100

> In case of a tx queue timeout every transmit is blocked until the
> QCA7000 resets himself and triggers a sync which makes the driver
> flushs the tx ring. So avoid this blocking situation by triggering
> the sync immediately after the timeout. Waking the queue doesn't
> make sense in this situation.
> 
> Signed-off-by: Stefan Wahren 
> Fixes: 291ab06ecf67 ("net: qualcomm: new Ethernet over SPI driver for 
> QCA7000")

Applied and queued up for -stable.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] Add __GFP_ZERO to alloc_cpumask_var_node() if ptr is zero

2015-12-06 Thread Ingo Molnar

* Rusty Russell  wrote:

> Ingo Molnar  writes:
> > * Steven Rostedt  wrote:
> >
> >> On Fri, 04 Dec 2015 12:05:12 +1030
> >> Rusty Russell  wrote:
> >> 
> >> > This is clever, but I would advise against such subtle code.  We will 
> >> > never be 
> >> > able to remove this code once it is in.
> >> > 
> >> > Would suggest making the non-CPUMASK_OFFSTACK stubs write garbage into 
> >> > the 
> >> > cpumasks instead, iff !(flags & __GFP_ZERO).
> >>
> >> I actually thought of the same thing, but thought it was a bit harsh. If 
> >> others 
> >> think that's a better solution, then I'll submit a patch to do that.
> >
> > That just makes things more fragile - 'garbage' will spread the breakage, 
> > and if 
> > the breakage is subtle, it will spread subtle breakage.
> >
> > So why not use a kzmalloc_node() [equivalent] call instead of 
> > kmalloc_node(), to 
> > make sure it's all zeroed instead of uninitialized?
> 
> OTOH, why not make *every* kmalloc a kzmalloc?

The big difference to alloc_cpumask_var_node() is that kmalloc() is 
well-defined 
in the sense that it will return uninitialized buffers (sometimes even poisoned 
ones), all the time.

But alloc_cpumask_var_node() will return a zeroed cpumask 99.9% of the time 
when 
the kernel being run is using on-stack cpumasks. So it's very easy to not 
initialize and not discover it for extended periods of time.

As it happened here, and as was fixed with the patch. Hence my suggestion.

> The issue here is not that the issue is subtle (not using a zeroing allocator 
> is 
> a pretty clear bug), it's that it's papered over by the normal config.

Exactly.

> If we had a config option already to garbage-fill allocations, it'd be a 
> simple 
> solution.
> 
> I don't think there are great answers here.  But adding more subtle zeroing 
> semantics feels wrong, even if it will mostly Just Work.

It's not subtle if the naming clearly reflects it (hence my suggestion to 
rename 
the API) - and the status quo for on-stack allocations is zeroing anyway, so 
it's 
not a big jump...

Thanks,

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


[git pull] vfs.git fixes

2015-12-06 Thread Al Viro
A couple of fixes (-stable fodder) + dead code removal after the
overlayfs fix; I agree that it's better to separate from the fix part
to make backporting easier, but IMO it's not worth delaying said dead
code removal until the next window.  Please, pull from

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

Shortlog:
Al Viro (2):
  ovl: get rid of the dead code left from broken (and disabled) 
optimizations
  Don't reset ->total_link_count on nested calls of vfs_path_lookup()

Miklos Szeredi (1):
  ovl: fix permission checking for setattr

Diffstat:
 fs/namei.c   |  1 -
 fs/overlayfs/copy_up.c   | 23 ++-
 fs/overlayfs/inode.c | 19 ---
 fs/overlayfs/overlayfs.h |  3 +--
 4 files changed, 15 insertions(+), 31 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/


From Office Of Mr. James Dimon CEO

2015-12-06 Thread Mr
>From Office Of Mr. James Dimon CEO
JP Morgan Chase Bank
Wa1-2213 5508N
Division St Spokane, WA 99208
Direct Tele: Number: (509) 592-9622
Fax 630-733-6138
My office e-mail: customerc...@jpchaseinfo.com 
chasebank43...@gmail.com
DATE: 12 / 05 / 2015
 
Urgent Attention My Dear Friend,
 
How are you today? hope fine. well my dear, this is to let you know that this 
fund was Approved in the name of one Melo one of our contractors that have not 
recieve their contract payment, but from the information we recieved telling us 
that Mr Robert J Penalva is no more alive to claim his contract fund worth of 
usd$5,000 000 00 only Now my dear, i will like you to make this as a deal 
between you and i for me to make sure that this fund.

My dear this is to let you know that after our board meeting last week Friday, 
the JP Morgan Chase Bank wishes to inform Mr Robert J Penalva that we have come 
to conclusion that we really need to set up an online account in the name of 
Beneficiary here in our Bank so that Chase Bank can credit your online account 
with your Fund valued Usd$5,000.000.00 (Five Million United States Dollars) 
immediately and give you the online details which you can view your account 
information's to see your Fund and make transfer of your Fund to any bank of 
your choice you can call to speak with  Customer careline 509 592-9622 Chase 
Bank.

Now what i like you to know is that everything in regards of the transfer of 
this fund into your online account with JP Morgan Chase Bank will be made here 
at my office as the Executive Chairman, Chief Executive Officer,
President Mr. James Dimon CEO before i will forward the transfer order to the 
Key Tested Telex Transfer Department of this Bank for immediate transfer of 
this fund into your online account.
 
To enable me carry on the process of transfer of this fund in your favour, i 
will like you to send the following information to me.
 
1) Your full name.
2) Phone, fax and mobile#.
3) Company name and address.
4) Profession, age and marital status.
Scan Copy of your ID Card.

 
Please my dear make sure you forward all these to me for it will enable us 
tramsfer this fund to you without any further delay, meanwhile after the 
transfer of this fund into your online account, we are going to share the money 
You 70% Me 30% NEXT OF KIN and i will come over to your country to invest my 
own share ok.
 
This transaction is 100% risk free and i will like you to keep it  so 
confidencial untill the transfer take place and also give me all your attention 
to make this transaction a suceess.
 
Meanwhile view the attachment file for my international passport and official 
working identity Card for your clearification.

This is information of Name Mr Robert J Penalva Address 429 W. Doncrest St.  
Monterey Park, CA. 91754-5522 And Number 323304-8335 And E-mail address  
pena...@pacbell.ne
 
Get back to me immediately you recieve this mail for unward  transaction.
 
Waiting for your Urgent respons.
 
Thanks.
  
Mr. Jamie Dimon.Executive Chairman, Chief Executive Officer,
President and Member of Operating Committee, JPMorgan Chase & Co
Chase Bank is a full service financial firm and the largest U.S
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] rtlwifi: fix gigantic memleak in rtl_usb

2015-12-06 Thread Peter Wu
Free skb for received frames with a wrong checksum.

While using the rtl8192cu driver in monitor mode, somehow 5G of memory
was permanently lost (observable via the Available column in `free -m`).

Test scenario:

ip link set down wlan1
iw wlan1 set type monitor
ip link set up wlan1
iw wlan1 set channel 11

Then stream a video on a smartphone on channel 11. Without this patch
the memory usage grows linearly with the number of received packets:

grep MemAvailable /proc/meminfo
ip -s link show dev wlan1

Signed-off-by: Peter Wu 
---
Hi,

This issue has existed since the introduction of this driver in v2.6.x,
using kmemleak I was about to figure out the source. There is also a
_rtl_usb_rx_process_agg that has similarly looking code, but that one is
unaffected. The pci code already frees the skb and is unaffected too.

Tested with kernel v4.3, this patch is simply rebased on v4.4-rc3 (due
to changed paths).

Kind regards,
Peter
---
 drivers/net/wireless/realtek/rtlwifi/usb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c 
b/drivers/net/wireless/realtek/rtlwifi/usb.c
index 2721cf8..aac1ed3 100644
--- a/drivers/net/wireless/realtek/rtlwifi/usb.c
+++ b/drivers/net/wireless/realtek/rtlwifi/usb.c
@@ -531,6 +531,8 @@ static void _rtl_usb_rx_process_noagg(struct ieee80211_hw 
*hw,
ieee80211_rx(hw, skb);
else
dev_kfree_skb_any(skb);
+   } else {
+   dev_kfree_skb_any(skb);
}
 }
 
-- 
2.6.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/


Re: [PATCH V3 2/6] acpi: pci: Setup MSI domain for ACPI based pci devices

2015-12-06 Thread Tomasz Nowicki

Hi Marc,


On 11/22/2015 12:35 PM, Marc Zyngier wrote:

On Sat, 21 Nov 2015 15:18:45 -0600
Suravee Suthikulpanit  wrote:


Hi Marc,

On 11/19/15 06:08, Marc Zyngier wrote:

On Wed, 21 Oct 2015 11:47:25 -0700
Suravee Suthikulpanit  wrote:

Hi Suravee,

Sorry it took so long to get to this series. Comments below.

No worry.


This patch introduces pci_host_bridge_acpi_msi_domain(), which returns
the MSI domain of the specified PCI host bridge with DOMAIN_BUS_PCI_MSI
bus token. Then, it is assigned to pci device.

Signed-off-by: Suravee Suthikulpanit 
---
   drivers/pci/pci-acpi.c | 13 +
   drivers/pci/probe.c|  2 ++
   include/linux/pci.h|  7 +++
   3 files changed, 22 insertions(+)

diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index a32ba75..0e21ef4 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -9,7 +9,9 @@

   #include 
   #include 
+#include 
   #include 
+#include 
   #include 
   #include 
   #include 
@@ -689,6 +691,17 @@ static struct acpi_bus_type acpi_pci_bus = {
.cleanup = pci_acpi_cleanup,
   };

+struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus)
+{
+   struct irq_domain *dom = NULL;
+   struct fwnode_handle *fwnode = pci_msi_get_fwnode(&bus->dev);
+
+   if (fwnode)
+   dom = irq_find_matching_fwnode(fwnode,
+  DOMAIN_BUS_PCI_MSI);
+   return dom;
+}
+

Given this, I really question the need for what you define in patch #1
to be standalone. It is only used by ACPI (DT has its own private
helpers), and it is so far unlikely that it will be of any use for
other firmware interfaces.

My suggestion is to get rid of pci_msi_get_fwnode() and move the
registration helper into this file. That'd be much simpler.

Thanks,

M.


Ok, I'll take care of this. I assume the rest of the patches looks ok.

I still need to finish going through it (I have minor comments so far
on some of the other patches), but I want to get the core ACPI stuff in
shape before doing anything else.

I am trying to do similar thing for GICv3 & ITS, can you please have a look:
http://lkml.iu.edu/hypermail/linux/kernel/1510.1/06139.html

Can you please explain what ACPI core changes do you mean?

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


Re: [PATCH] Documentation: email-clients.txt

2015-12-06 Thread Joe Perches
On Sun, 2015-12-06 aASCIIt 08:30 -0700, Jonathan Corbet wrote:
> On Sun, 6 Dec 2015 01:09:39 -0500
> Sanidhya Solanki  wrote:
[]
> >  Evolution (GUI)
> >  
> > +As of December 2015, the composing & inserting  method described below
> > +does not work.
> 
> Could it really be that nobody is using evolution?  Much nicer here would
> be to describe how it fails to work, and, ideally, come up with a fix.

Evolution 3.12 works fine.

The text editor for Evolution versions > 3.12 is broken
and unrepairable.

Evolution 3.16 has very poor behavior when replying to
text emails with tabs.  A ">" character is added before
every tab in the reply.

Evolution 3.18 occasionally uses the Non-Breaking-Space
(NBSP) character instead of the standand ASCII 32 space
which breaks applying patches sent with that email client.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] Documentation: email-clients.txt

2015-12-06 Thread Jonathan Corbet
On Sun, 06 Dec 2015 10:11:04 -0800
Joe Perches  wrote:

> > Could it really be that nobody is using evolution?  Much nicer here would
> > be to describe how it fails to work, and, ideally, come up with a fix.  
> 
> Evolution 3.12 works fine.
> 
> The text editor for Evolution versions > 3.12 is broken
> and unrepairable.
> 
> Evolution 3.16 has very poor behavior when replying to
> text emails with tabs.  A ">" character is added before
> every tab in the reply.
> 
> Evolution 3.18 occasionally uses the Non-Breaking-Space
> (NBSP) character instead of the standand ASCII 32 space
> which breaks applying patches sent with that email client.

OK, this is good to know; this is the kind of info that should go into
email-clients.txt.

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/


tmpfs sizing broken in 4.4-rc*

2015-12-06 Thread Andi Kleen

Hi,

It seems on 4.4-rc2 something is wrong how tmpfs is sized by default.

On a 4GB system with /tmp as tmpfs I only have an 1MB sized /tmp now. Which
breaks a lot of stuff, including the scripts to install new kernels.

When I remount it manually with a larger size things works again.

I haven't tried to bisect or debug it, but I'm reasonably sure the
problem wasn't there with 4.3.

-Andi

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


Re: [PATCH] perf hists browser: Fix segfault if use symbol filter in cmdline

2015-12-06 Thread Arnaldo Carvalho de Melo
Em Thu, Dec 03, 2015 at 12:49:42AM +0900, Namhyung Kim escreveu:
> Hi,
> 
> On Wed, Dec 02, 2015 at 11:28:52AM +, Wang Nan wrote:
> > If feed perf a symbol filter in cmdline and the result is empty,
> > pressing 'Enter' in the hist browser causes crash:
> > 
> >  # ./perf report perf.data   <-- Common mistake for beginners
> > 
> > Then press 'Enter':
> > 
> >  perf: Segmentation fault
> >   backtrace 
> >  /home/wangnan/perf[0x53e578]
> >  /lib64/libc.so.6(+0x3545f)[0x7f76bafe045f]
> >  /home/wangnan/perf[0x539dd4]
> >  /home/wangnan/perf(perf_evlist__tui_browse_hists+0x96)[0x53d216]
> >  /home/wangnan/perf(cmd_report+0x1b9f)[0x442c7f]
> >  /home/wangnan/perf[0x47efa2]
> >  /home/wangnan/perf(main+0x5f5)[0x432fa5]
> >  /lib64/libc.so.6(__libc_start_main+0xf4)[0x7f76bafccbd4]
> >  /home/wangnan/perf[0x4330d4]
> > 
> > This is because 'perf.data' is interperted as a symbol filter, and the
> > result is empty, so selection is empty. However,
> > hist_browser__toggle_fold() forgets to check it.
> > 
> > This patch simply return faluse when selection is NULL.
> 
> s/faluse/false/

Fixed this and the 'interperted' and some other text details, and also
the container_of usage as reported by you below.

Thanks!

- Arnaldo
 
> > 
> > Signed-off-by: Wang Nan 
> > Cc: Arnaldo Carvalho de Melo 
> 
> Acked-by: Namhyung Kim 
> 
> One nitpick below..
> 
> > ---
> >  tools/perf/ui/browsers/hists.c | 5 -
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
> > index dcdcbaf..33da341 100644
> > --- a/tools/perf/ui/browsers/hists.c
> > +++ b/tools/perf/ui/browsers/hists.c
> > @@ -337,9 +337,12 @@ static bool hist_browser__toggle_fold(struct 
> > hist_browser *browser)
> >  {
> > struct hist_entry *he = browser->he_selection;
> > struct map_symbol *ms = browser->selection;
> > -   struct callchain_list *cl = container_of(ms, struct callchain_list, ms);
> > +   struct callchain_list *cl = ms ? container_of(ms, struct 
> > callchain_list, ms) : NULL;
> 
> I think this line is not needed as container_of doesn't make a pointer
> dereference by itself.  Just checking below is enough IMHO.

Agreed, changing this.
 
> Thanks,
> Namhyung
> 
> 
> > bool has_children;
> >  
> > +   if (!ms)
> > +   return false;
> > +
> > if (ms == &he->ms)
> > has_children = hist_entry__toggle_fold(he);
> > else
> > -- 
> > 1.8.3.4
> > 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 00/13] perf tools: Move perf subcommand framework into lib/tools

2015-12-06 Thread Arnaldo Carvalho de Melo
Em Sun, Dec 06, 2015 at 10:37:52AM +0100, Ingo Molnar escreveu:
> 
> * Josh Poimboeuf  wrote:
> 
> > Ingo suggested that I factor out the perf subcommand functionality
> > (originally copied from git) into tools/lib so that it can be used by
> > stacktool[*] and possibly others.
> > 
> > All the subcommand option handling files have been moved into libapi,
> > including parse-options.c, run-command.c, exec_cmd.c, help.c, usage.c,
> > and their dependencies.  Since several of the dependencies are more
> > general-purpose "utilities" which aren't directly related to
> > subcommands, I put everything in 'tools/lib/api/util'.  They're linked
> > into perf as part of the libapi.a library.
> > 
> > Patches 1-10 do some cleanups and splitting up of the code in
> > preparation for the move.
> > 
> > Patch 11 does the actual moving of the files into tools/lib/api/util.
> > 
> > [*] https://lkml.kernel.org/r/cover.1445443144.git.jpoim...@redhat.com
> > 
> > Josh Poimboeuf (13):
> >   perf: Use -iquote for local include paths
> >   perf: Split up util.h
> >   perf: Move term functions out of util.c
> >   perf: Remove unused pager_use_color variable
> >   perf: Split up cache.h
> >   perf: Remove cache.h
> >   perf: Save cmdline arguments earlier
> >   perf: Remove check for unused PERF_PAGER_IN_USE
> >   perf: Move cmd_version() to builtin-version.c
> >   perf: Move help_unknown_cmd() to its own file
> >   perf tools: Move strlcpy() to tools/lib/string.c
> >   perf tools: Move perf subcommand framework into a library
> >   perf tools: Move subcommand framework and related utils to libapi
> 
> >  133 files changed, 852 insertions(+), 761 deletions(-)
> 
> So this split-out looks great to me!

I briefly looked at it on the smartphone, what I can remember as an
issue was naming, i.e. IIRC there is a util_cfg struct that looks too
vague, I'll re-read and suggest something.
 
> A bit of a background: this series is a necessary precondition of me being 
> able to 
> merge 'stacktool' and the frame pointer handling enhancements Josh is working 
> on - 
> but it would be nice if this could all be done via Arnaldo's perf tree to 
> minimize 
> any impact on pending perf work.
 
> I've Cc:-ed Namhyung and Jiri as well, who've done a lot of work in 
> perf/util/.

Commens from them would be more than welcome, Acks, even more.

- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 1/5] dt-bindings: add SMP enable-method for Broadcom NSP

2015-12-06 Thread Kapil Hali
Hi Rob,

On 12/6/2015 6:22 AM, Rob Herring wrote:
> On Wed, Dec 2, 2015 at 10:06 AM, Kapil Hali  wrote:
>> Hi Rob,
>>
>> On 12/2/2015 8:56 PM, Rob Herring wrote:
>>> On Tue, Dec 01, 2015 at 11:24:05AM -0500, Kapil Hali wrote:
 Add a compatible string "brcm,bcm-nsp-smp" for Broadcom's
 Northstar Plus CPU to the 32-bit ARM CPU device tree binding
 documentation file and create a new binding documentation for
 Northstar Plus CPU.

 Signed-off-by: Kapil Hali 
 ---
  .../bindings/arm/bcm/brcm,nsp-cpu-method.txt   | 39 
 ++
  Documentation/devicetree/bindings/arm/cpus.txt |  1 +
  2 files changed, 40 insertions(+)
  create mode 100644 
 Documentation/devicetree/bindings/arm/bcm/brcm,nsp-cpu-method.txt

 diff --git 
 a/Documentation/devicetree/bindings/arm/bcm/brcm,nsp-cpu-method.txt 
 b/Documentation/devicetree/bindings/arm/bcm/brcm,nsp-cpu-method.txt
 new file mode 100644
 index 000..bf08872
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/arm/bcm/brcm,nsp-cpu-method.txt
 @@ -0,0 +1,39 @@
 +Broadcom Northstar Plus SoC CPU Enable Method
 +-
 +This binding defines the enable method used for starting secondary
 +CPUs in the following Broadcom SoCs:
 +  BCM58522, BCM58525, BCM58535, BCM58622, BCM58623, BCM58625, BCM88312
 +
 +The enable method is specified by defining the following required
 +properties in the "cpus" device tree node:
 +  - enable-method = "brcm,bcm-nsp-smp";
 +  - secondary-boot-reg = <...>;
>>>
>>> Both of these are supposed to be per cpu core.
>>
>> 'enable-method' if not found in 'cpu' node is looked at in the 'cpus'
>> node. Except for two-three SoC families, 'enable-method' is within
>> 'cpus' node. Is my interpretation incorrect? Did I miss anything here?
> 
> I'm not sure how you counted, but it is much more than 2-3 that are
> correct (including all of PPC). It is quite mixed in dts files, but it
> is documented to be per cpu node, so lets follow the documentation
> please.
> 
> Rob
> 
I looked at arch/arm/* and not other arch types. But, as you said, let
us keep it how it is in documentation and I have already updated latest
patch set reflecting this change.

Thanks,
Kapil
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: tmpfs sizing broken in 4.4-rc*

2015-12-06 Thread Andi Kleen
On Sun, Dec 06, 2015 at 07:16:55PM +0100, Andi Kleen wrote:
> 
> Hi,
> 
> It seems on 4.4-rc2 something is wrong how tmpfs is sized by default.
> 
> On a 4GB system with /tmp as tmpfs I only have an 1MB sized /tmp now. Which
> breaks a lot of stuff, including the scripts to install new kernels.
> 
> When I remount it manually with a larger size things works again.
> 
> I haven't tried to bisect or debug it, but I'm reasonably sure the
> problem wasn't there with 4.3.

Never mind. I did some more experiments and tmp seems to be back
to the expected size now after some experiments/reboots. Must have been some
fluke or a rogue script.

-Andi

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] drm: msm: dsi: Added missing mutex_unlock

2015-12-06 Thread Saurabh Sengar
in case of failed to get iova, function was returning without releasing
the mutex. Added it.

Signed-off-by: Saurabh Sengar 
---
 drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c 
b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 4c49868..13f937b 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -849,11 +849,11 @@ static int dsi_tx_buf_alloc(struct msm_dsi_host 
*msm_host, int size)
}
 
ret = msm_gem_get_iova_locked(msm_host->tx_gem_obj, 0, &iova);
+   mutex_unlock(&dev->struct_mutex);
if (ret) {
pr_err("%s: failed to get iova, %d\n", __func__, ret);
return ret;
}
-   mutex_unlock(&dev->struct_mutex);
 
if (iova & 0x07) {
pr_err("%s: buf NOT 8 bytes aligned\n", __func__);
-- 
1.9.1

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


[RFC/RFT PATCH] watchdog: Move watchdog device creation to watchdog_dev.c

2015-12-06 Thread Guenter Roeck
The watchdog character device s currently created in watchdog_dev.c,
and the watchdog device in watchdog_core.c. This results in
cross-dependencies, as the device creation needs to know the watchdog
character device number.

On top of that, the watchdog character device is created before the
watchdog device is created. This can result in race conditions if the
watchdog device node is accessed before the watchdog device has been
created.

To solve the problem, move watchdog device creation into watchdog_dev.c,
and create the watchdog device prior to creating its device node.
Also move device class creation into watchdog_dev.c, since this is now
the only place where the watchdog class is needed.

Inspired by an earlier patch set from Damien Riegel.

Cc: Damien Riegel 
Signed-off-by: Guenter Roeck 
---
Hi Damien,

I think this approach would be a bit better. The watchdog device isn't
really used in the watchdog core code, so it is better created in
watchdog_dev.c. That also fits well with other pending changes, such as
sysfs attribute support, and my attempts to move the ref/unref functions
completely into the watchdog core. As a side effect, it also cleans up
the error path in __watchdog_register_device().

What do you think ?

The code has been compile tested only so far. I'll try to test it later
today, but I wanted to get it out for discussion.

Thanks,
Guenter

 drivers/watchdog/watchdog_core.c | 37 ++--
 drivers/watchdog/watchdog_core.h |  2 +-
 drivers/watchdog/watchdog_dev.c  | 61 
 3 files changed, 54 insertions(+), 46 deletions(-)

diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c
index 873f13972cf4..089e930fce19 100644
--- a/drivers/watchdog/watchdog_core.c
+++ b/drivers/watchdog/watchdog_core.c
@@ -41,7 +41,6 @@
 #include "watchdog_core.h" /* For watchdog_dev_register/... */
 
 static DEFINE_IDA(watchdog_ida);
-static struct class *watchdog_class;
 
 /*
  * Deferred Registration infrastructure.
@@ -139,7 +138,7 @@ EXPORT_SYMBOL_GPL(watchdog_init_timeout);
 
 static int __watchdog_register_device(struct watchdog_device *wdd)
 {
-   int ret, id = -1, devno;
+   int ret, id = -1;
 
if (wdd == NULL || wdd->info == NULL || wdd->ops == NULL)
return -EINVAL;
@@ -192,16 +191,6 @@ static int __watchdog_register_device(struct 
watchdog_device *wdd)
}
}
 
-   devno = wdd->cdev.dev;
-   wdd->dev = device_create(watchdog_class, wdd->parent, devno,
-   NULL, "watchdog%d", wdd->id);
-   if (IS_ERR(wdd->dev)) {
-   watchdog_dev_unregister(wdd);
-   ida_simple_remove(&watchdog_ida, id);
-   ret = PTR_ERR(wdd->dev);
-   return ret;
-   }
-
return 0;
 }
 
@@ -232,19 +221,8 @@ EXPORT_SYMBOL_GPL(watchdog_register_device);
 
 static void __watchdog_unregister_device(struct watchdog_device *wdd)
 {
-   int ret;
-   int devno;
-
-   if (wdd == NULL)
-   return;
-
-   devno = wdd->cdev.dev;
-   ret = watchdog_dev_unregister(wdd);
-   if (ret)
-   pr_err("error unregistering /dev/watchdog (err=%d)\n", ret);
-   device_destroy(watchdog_class, devno);
+   watchdog_dev_unregister(wdd);
ida_simple_remove(&watchdog_ida, wdd->id);
-   wdd->dev = NULL;
 }
 
 /**
@@ -287,17 +265,9 @@ static int __init watchdog_init(void)
 {
int err;
 
-   watchdog_class = class_create(THIS_MODULE, "watchdog");
-   if (IS_ERR(watchdog_class)) {
-   pr_err("couldn't create class\n");
-   return PTR_ERR(watchdog_class);
-   }
-
err = watchdog_dev_init();
-   if (err < 0) {
-   class_destroy(watchdog_class);
+   if (err < 0)
return err;
-   }
 
watchdog_deferred_registration();
return 0;
@@ -306,7 +276,6 @@ static int __init watchdog_init(void)
 static void __exit watchdog_exit(void)
 {
watchdog_dev_exit();
-   class_destroy(watchdog_class);
ida_destroy(&watchdog_ida);
 }
 
diff --git a/drivers/watchdog/watchdog_core.h b/drivers/watchdog/watchdog_core.h
index 6c951418fca7..86ff962d1e15 100644
--- a/drivers/watchdog/watchdog_core.h
+++ b/drivers/watchdog/watchdog_core.h
@@ -32,6 +32,6 @@
  * Functions/procedures to be called by the core
  */
 extern int watchdog_dev_register(struct watchdog_device *);
-extern int watchdog_dev_unregister(struct watchdog_device *);
+extern void watchdog_dev_unregister(struct watchdog_device *);
 extern int __init watchdog_dev_init(void);
 extern void __exit watchdog_dev_exit(void);
diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
index 56a649e66eb2..07abe8c9e58c 100644
--- a/drivers/watchdog/watchdog_dev.c
+++ b/drivers/watchdog/watchdog_dev.c
@@ -49,6 +49,9 @@ static dev_t watchdog_devt;
 /* the watchdog device behind /dev/watchdog */
 stat

Re: [PATCH 00/13] perf tools: Move perf subcommand framework into lib/tools

2015-12-06 Thread Josh Poimboeuf
On Sun, Dec 06, 2015 at 04:50:06PM +0100, Jiri Olsa wrote:
> On Sun, Dec 06, 2015 at 10:37:52AM +0100, Ingo Molnar wrote:
> > 
> > * Josh Poimboeuf  wrote:
> > 
> > > Ingo suggested that I factor out the perf subcommand functionality
> > > (originally copied from git) into tools/lib so that it can be used by
> > > stacktool[*] and possibly others.
> > > 
> > > All the subcommand option handling files have been moved into libapi,
> > > including parse-options.c, run-command.c, exec_cmd.c, help.c, usage.c,
> > > and their dependencies.  Since several of the dependencies are more
> > > general-purpose "utilities" which aren't directly related to
> > > subcommands, I put everything in 'tools/lib/api/util'.  They're linked
> > > into perf as part of the libapi.a library.
> > > 
> > > Patches 1-10 do some cleanups and splitting up of the code in
> > > preparation for the move.
> > > 
> > > Patch 11 does the actual moving of the files into tools/lib/api/util.
> > > 
> > > [*] https://lkml.kernel.org/r/cover.1445443144.git.jpoim...@redhat.com
> > > 
> > > Josh Poimboeuf (13):
> > >   perf: Use -iquote for local include paths
> > >   perf: Split up util.h
> > >   perf: Move term functions out of util.c
> > >   perf: Remove unused pager_use_color variable
> > >   perf: Split up cache.h
> > >   perf: Remove cache.h
> > >   perf: Save cmdline arguments earlier
> > >   perf: Remove check for unused PERF_PAGER_IN_USE
> > >   perf: Move cmd_version() to builtin-version.c
> > >   perf: Move help_unknown_cmd() to its own file
> > >   perf tools: Move strlcpy() to tools/lib/string.c
> > >   perf tools: Move perf subcommand framework into a library
> > >   perf tools: Move subcommand framework and related utils to libapi
> > 
> > >  133 files changed, 852 insertions(+), 761 deletions(-)
> > 
> > So this split-out looks great to me!
> > 
> > A bit of a background: this series is a necessary precondition of me being 
> > able to 
> > merge 'stacktool' and the frame pointer handling enhancements Josh is 
> > working on - 
> > but it would be nice if this could all be done via Arnaldo's perf tree to 
> > minimize 
> > any impact on pending perf work.
> > 
> > I've Cc:-ed Namhyung and Jiri as well, who've done a lot of work in 
> > perf/util/.
> > 
> 
> heya,
> got compilation error over this patchset:
> 
> [jolsa@krava perf]$ make clean && make JOBS=1
> 
>   ...
> 
>   CC   tests/llvm-src-base.o
> tests/llvm-src-base.c:1:24: fatal error: tests/llvm.h: No such file or 
> directory
> compilation terminated.
> mv: cannot stat ‘tests/.llvm-src-base.o.tmp’: No such file or directory
> /home/jolsa/kernel/linux-perf/tools/build/Makefile.build:77: recipe for 
> target 'tests/llvm-src-base.o' failed
> make[3]: *** [tests/llvm-src-base.o] Error 1
> /home/jolsa/kernel/linux-perf/tools/build/Makefile.build:116: recipe for 
> target 'tests' failed
> make[2]: *** [tests] Error 2
> Makefile.perf:313: recipe for target 'perf-in.o' failed
> make[1]: *** [perf-in.o] Error 2
> Makefile:68: recipe for target 'all' failed
> make: *** [all] Error 2

I think the problem is that you have a stale version of the
auto-generated file llvm-src-base.c.  Looks like "make clean" doesn't
remove it.  I'll add a patch to fix it.

-- 
Josh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] gpu: host1x: mipi: Added missing mutex_unlock

2015-12-06 Thread Saurabh Sengar
In case of error too function should return after releasing the mutex

Signed-off-by: Saurabh Sengar 
---
 drivers/gpu/host1x/mipi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/host1x/mipi.c b/drivers/gpu/host1x/mipi.c
index 52a6fd2..6e559a9 100644
--- a/drivers/gpu/host1x/mipi.c
+++ b/drivers/gpu/host1x/mipi.c
@@ -250,6 +250,7 @@ struct tegra_mipi_device *tegra_mipi_request(struct device 
*device)
dev_err(dev->mipi->dev,
"failed to power up MIPI bricks: %d\n",
err);
+   mutex_unlock(&dev->mipi->lock);
return ERR_PTR(err);
}
}
-- 
1.9.1

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


Re: gigaset: freeing an active object

2015-12-06 Thread Paul Bolle
On zo, 2015-12-06 at 16:29 +0100, Tilman Schmidt wrote:
> So the solution might be as simple as moving the kfree() call from
> gigaset_freecshw() to gigaset_device_release(). Something like this:
> 
> --- a/drivers/isdn/gigaset/ser-gigaset.c
> +++ b/drivers/isdn/gigaset/ser-gigaset.c
> @@ -370,19 +370,18 @@ static void gigaset_freecshw(struct cardstate
> *cs)
> tasklet_kill(&cs->write_tasklet);
> if (!cs->hw.ser)
> return;
> -   dev_set_drvdata(&cs->hw.ser->dev.dev, NULL);
> platform_device_unregister(&cs->hw.ser->dev);
> -   kfree(cs->hw.ser);
> -   cs->hw.ser = NULL;
>  }
> 
>  static void gigaset_device_release(struct device *dev)
>  {
> -   struct platform_device *pdev = to_platform_device(dev);
> +   struct cardstate *cs = dev_get_drvdata(dev);
> 
> -   /* adapted from platform_device_release() in
> drivers/base/platform.c */
> -   kfree(dev->platform_data);
> -   kfree(pdev->resource);
> +   if (!cs)
> +   return;
> +   dev_set_drvdata(dev, NULL);
> +   kfree(cs->hw.ser);
> +   cs->hw.ser = NULL;
>  }

This solution assumes that the struct platform_device is moved out of
the struct ser_cardstate, doesn't it? In other words, this is something
to do on top of my (draft) patch. Otherwise we'd still be freeing memory
managed through reference counting.

Thanks,


Paul Bolle
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] rtlwifi: fix gigantic memleak in rtl_usb

2015-12-06 Thread Larry Finger

On 12/06/2015 11:57 AM, Peter Wu wrote:

Free skb for received frames with a wrong checksum.

While using the rtl8192cu driver in monitor mode, somehow 5G of memory
was permanently lost (observable via the Available column in `free -m`).

Test scenario:

 ip link set down wlan1
 iw wlan1 set type monitor
 ip link set up wlan1
 iw wlan1 set channel 11

Then stream a video on a smartphone on channel 11. Without this patch
the memory usage grows linearly with the number of received packets:

 grep MemAvailable /proc/meminfo
 ip -s link show dev wlan1

Signed-off-by: Peter Wu 
---
Hi,

This issue has existed since the introduction of this driver in v2.6.x,
using kmemleak I was about to figure out the source. There is also a
_rtl_usb_rx_process_agg that has similarly looking code, but that one is
unaffected. The pci code already frees the skb and is unaffected too.

Tested with kernel v4.3, this patch is simply rebased on v4.4-rc3 (due
to changed paths).

Kind regards,
Peter
---
  drivers/net/wireless/realtek/rtlwifi/usb.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c 
b/drivers/net/wireless/realtek/rtlwifi/usb.c
index 2721cf8..aac1ed3 100644
--- a/drivers/net/wireless/realtek/rtlwifi/usb.c
+++ b/drivers/net/wireless/realtek/rtlwifi/usb.c
@@ -531,6 +531,8 @@ static void _rtl_usb_rx_process_noagg(struct ieee80211_hw 
*hw,
ieee80211_rx(hw, skb);
else
dev_kfree_skb_any(skb);
+   } else {
+   dev_kfree_skb_any(skb);
}
  }




Thanks for finding and fixing this memory leak.

The patch is OK, but the commit message and subject are not. I do not like the 
use of the word "gigantic" in the subject. A better subject would be: "rtlwifi: 
Fix memory leak for USB device while in monitor mode".


The commit message should say that a memory leak was observed, and found with 
kmemleak. If you were simply reportimg the bug, then the steps needed to 
reproduce it would be important, but as you have a fix, those steps are 
extraneous. You should also include a "Cc: Stable When the patch is picked up for stable kernels, it will be necessary to rebase 
the patch to compensate for the directory change.


NACK for the moment.

Larry

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] of: Fix comparison of reserved memory regions

2015-12-06 Thread Rob Herring
On Sat, Dec 5, 2015 at 5:43 AM, Michael Ellerman  wrote:
>
>
> On 5 December 2015 04:07:39 GMT+11:00, Mitchel Humpherys 
>  wrote:
>>On Wed, Nov 18 2015 at 09:46:38 PM, Michael Ellerman
>> wrote:
>>> In order to check for overlapping reserved memory regions, we first
>>need
>>> to sort the array of memory regions. This is implemented using
>>sort(),
>>> and a custom comparison function __rmem_cmp().
>>>
>>> Unfortunatley __rmem_cmp() doesn't work in all cases. Because the two
>>> base values are phys_addr_t, they may be u64 on some platforms, in
>>which
>>> case subtracting one from the other and then (implicitly) casting to
>>int
>>> does not give us the -ve/0/+ve value we need.
>>>
>>> This leads to incorrect reports about overlaps, eg:
>>>
>>>   ibm,slw-image@1ffe60 (0x001ffe60--0x001ffe70)
>>overlaps with
>>>   ibm,firmware-allocs-memory@10
>>(0x0010--0x001000dc0200)
>>>
>>> Fix it by just doing the standard double if and return 0 logic.
>>>
>>> Fixes: ae1add247bf8 ("of: Check for overlap in reserved memory
>>regions")
>>> Signed-off-by: Michael Ellerman 
>>> ---
>>>  drivers/of/of_reserved_mem.c | 8 +++-
>>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>
>>Woops, thanks.
>>
>>Tested-by: Mitchel Humpherys 
>
> Thanks for testing.
>
> Rob, can we get this merged for 4.4 please?

Yes. I meant to last week, but was waiting on getting another issue
sorted out. I should get it to Linus in the next couple of days.

Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] of/address: replace printk(KERN_ERR ...) with pr_err(...)

2015-12-06 Thread Rob Herring
On Mon, Nov 30, 2015 at 12:14 AM, Masahiro Yamada
 wrote:
> A trivial change suggested by checkpatch.pl.

You might as well all levels while you are at it. Looks like that is
only one more:

drivers/of/address.c:   printk(KERN_DEBUG "%s", s);

Rob

>
> Signed-off-by: Masahiro Yamada 
> ---
>
>  drivers/of/address.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/of/address.c b/drivers/of/address.c
> index cd53fe4..5289c80 100644
> --- a/drivers/of/address.c
> +++ b/drivers/of/address.c
> @@ -596,7 +596,7 @@ static u64 __of_translate_address(struct device_node *dev,
> pbus = of_match_bus(parent);
> pbus->count_cells(dev, &pna, &pns);
> if (!OF_CHECK_COUNTS(pna, pns)) {
> -   printk(KERN_ERR "prom_parse: Bad cell count for %s\n",
> +   pr_err("prom_parse: Bad cell count for %s\n",
>of_node_full_name(dev));
> break;
> }
> --
> 1.9.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] of/address: fix typo in comment block of of_translate_one()

2015-12-06 Thread Rob Herring
On Mon, Nov 30, 2015 at 12:22 AM, Masahiro Yamada
 wrote:
> Remove the "not" before "cannot".
>
> I am fixing the comment block style while I am here.
>
> Signed-off-by: Masahiro Yamada 

Applied for 4.4. Thanks.

Rob

> ---
>
>  drivers/of/address.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/of/address.c b/drivers/of/address.c
> index 5289c80..91a469d 100644
> --- a/drivers/of/address.c
> +++ b/drivers/of/address.c
> @@ -485,9 +485,10 @@ static int of_translate_one(struct device_node *parent, 
> struct of_bus *bus,
> int rone;
> u64 offset = OF_BAD_ADDR;
>
> -   /* Normally, an absence of a "ranges" property means we are
> +   /*
> +* Normally, an absence of a "ranges" property means we are
>  * crossing a non-translatable boundary, and thus the addresses
> -* below the current not cannot be converted to CPU physical ones.
> +* below the current cannot be converted to CPU physical ones.
>  * Unfortunately, while this is very clear in the spec, it's not
>  * what Apple understood, and they do have things like /uni-n or
>  * /ht nodes with no "ranges" property and a lot of perfectly
> --
> 1.9.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] of/irq: optimize device node matching loop in of_irq_init()

2015-12-06 Thread Rob Herring
On Tue, Nov 24, 2015 at 7:10 AM, Masahiro Yamada
 wrote:
> Currently, of_irq_init() iterates over interrupt controller nodes
> with for_each_matching_node(), and then gets each init function with
> of_match_node() later.
>
> This routine can be optimized with for_each_matching_node_and_match().
> It allows to get the interrupt controller node and its init function
> at the same time, saving __of_match_node() callings.
>
> Signed-off-by: Masahiro Yamada 

Applied, thanks.

Rob

> ---
>
>  drivers/of/irq.c | 27 +--
>  1 file changed, 13 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/of/irq.c b/drivers/of/irq.c
> index 902b89b..4c0da87 100644
> --- a/drivers/of/irq.c
> +++ b/drivers/of/irq.c
> @@ -472,6 +472,7 @@ EXPORT_SYMBOL_GPL(of_irq_to_resource_table);
>
>  struct of_intc_desc {
> struct list_headlist;
> +   of_irq_init_cb_tirq_init_cb;
> struct device_node  *dev;
> struct device_node  *interrupt_parent;
>  };
> @@ -485,6 +486,7 @@ struct of_intc_desc {
>   */
>  void __init of_irq_init(const struct of_device_id *matches)
>  {
> +   const struct of_device_id *match;
> struct device_node *np, *parent = NULL;
> struct of_intc_desc *desc, *temp_desc;
> struct list_head intc_desc_list, intc_parent_list;
> @@ -492,10 +494,15 @@ void __init of_irq_init(const struct of_device_id 
> *matches)
> INIT_LIST_HEAD(&intc_desc_list);
> INIT_LIST_HEAD(&intc_parent_list);
>
> -   for_each_matching_node(np, matches) {
> +   for_each_matching_node_and_match(np, matches, &match) {
> if (!of_find_property(np, "interrupt-controller", NULL) ||
> !of_device_is_available(np))
> continue;
> +
> +   if (WARN(!match->data, "of_irq_init: no init function for 
> %s\n",
> +match->compatible))
> +   continue;
> +
> /*
>  * Here, we allocate and populate an of_intc_desc with the 
> node
>  * pointer, interrupt-parent device_node etc.
> @@ -506,6 +513,7 @@ void __init of_irq_init(const struct of_device_id 
> *matches)
> goto err;
> }
>
> +   desc->irq_init_cb = match->data;
> desc->dev = of_node_get(np);
> desc->interrupt_parent = of_irq_find_parent(np);
> if (desc->interrupt_parent == np)
> @@ -525,27 +533,18 @@ void __init of_irq_init(const struct of_device_id 
> *matches)
>  * The assumption is that NULL parent means a root controller.
>  */
> list_for_each_entry_safe(desc, temp_desc, &intc_desc_list, 
> list) {
> -   const struct of_device_id *match;
> int ret;
> -   of_irq_init_cb_t irq_init_cb;
>
> if (desc->interrupt_parent != parent)
> continue;
>
> list_del(&desc->list);
> -   match = of_match_node(matches, desc->dev);
> -   if (WARN(!match->data,
> -   "of_irq_init: no init function for %s\n",
> -   match->compatible)) {
> -   kfree(desc);
> -   continue;
> -   }
>
> -   pr_debug("of_irq_init: init %s @ %p, parent %p\n",
> -match->compatible,
> +   pr_debug("of_irq_init: init %s (%p), parent %p\n",
> +desc->dev->full_name,
>  desc->dev, desc->interrupt_parent);
> -   irq_init_cb = (of_irq_init_cb_t)match->data;
> -   ret = irq_init_cb(desc->dev, desc->interrupt_parent);
> +   ret = desc->irq_init_cb(desc->dev,
> +   desc->interrupt_parent);
> if (ret) {
> kfree(desc);
> continue;
> --
> 1.9.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Documentation: email-clients.txt

2015-12-06 Thread Randy Dunlap
On 12/06/15 07:30, Jonathan Corbet wrote:
> On Sun, 6 Dec 2015 01:09:39 -0500
> Sanidhya Solanki  wrote:
> 
>> Patch included below. As an aside, thank you for the excellent work on
>> the books and other documentation.
> 
> Thanks for the nice comments.  Future praise, however, should go below the
> "---" marker so I don't have to edit it out of the changelogs :)
> 
>> Documentation: email-clients.txt
>>
>> The information for Claws Mail, Evolution and Thunderbird was out of
>> date. It has been updated with new instructions and warnings.
> 
> So I feel like I'm missing some sort of intentional irony, but I do have
> to point out that this patch has been corrupted by your mailer and cannot
> be applied.  The usual advice here applies: try sending the email to
> yourself and applying the result.
> 
>> diff --git a/Documentation/email-clients.txt
>> b/Documentation/email-clients.txt index 2d485de..8819c90 100644
>> --- a/Documentation/email-clients.txt
>> +++ b/Documentation/email-clients.txt
>> @@ -79,17 +79,27 @@ to insert into the message.
>>  ~~
>>  Claws Mail (GUI)
>>  
>> -Works. Some people use this successfully for patches.
>> +Tested and Works as of December 2015. Some people use this successfully
>> +for patches.
> 
> Not sure we need datestamps like this here.  In any case, a few kernel
> developers are known to use claws - myself included.  We test it every day :)
> 
>>  To insert a patch use Message->Insert File (CTRL+i) or an external
>> editor. 
>>  If the inserted patch has to be edited in the Claws composition window
>>  "Auto wrapping" in Configuration->Preferences->Compose->Wrapping
>> should be -disabled.
>> +disabled. Also, under the heading "View", sub-heading "Character
>> Encoding" +, choose "Unicode (UTF - 8)"
>> +
>> +Do remember that if you insert or type something in the main text area,
>> +and decide to delete it, you will need to reset the formatting by
>> opening +a new window for the change you want to make. Re-using the
>> window in which +you deleted the text will lead to the new message
>> being mangled. 
> 
> ...and this makes no sense to me.  I've never seen any such behavior in
> claws?
> 
>>  Evolution (GUI)
>>  
>> +As of December 2015, the composing & inserting  method described below
>> +does not work.
> 
> Could it really be that nobody is using evolution?  Much nicer here would
> be to describe how it fails to work, and, ideally, come up with a fix.
> 
>>  Some people use this successfully for patches.
>>  
>>  When composing mail select: Preformat
>> @@ -244,8 +254,9 @@ Sylpheed (GUI)
>>  ~~
>>  Thunderbird (GUI)
>>  
>> -Thunderbird is an Outlook clone that likes to mangle text, but there
>> are ways -to coerce it into behaving.
>> +Thunderbird is an Outlook clone that likes to mangle text, but there
>> are +ways to coerce it into behaving. In December 2015, the internal
>> editor +options do not appear to work.
> 
> Again, what's the problem here?  I suspect there are people using
> Thunderbird out there, how are they doing it if the documented approach
> doesn't work?

I use thunderbird with an external editor plugin, so I just insert patches with
the external editor.


-- 
~Randy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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   >