Re: Build regressions/improvements in v5.1

2019-05-06 Thread Geert Uytterhoeven
On Tue, May 7, 2019 at 8:49 AM Geert Uytterhoeven  wrote:
> Below is the list of build error/warning regressions/improvements in
> v5.1[1] compared to v5.0[2].
>
> Summarized:
>   - build errors: +1/-1
>   - build warnings: +126/-105
>
> JFYI, when comparing v5.1[1] to v5.1-rc7[3], the summaries are:
>   - build errors: +0/-1
>   - build warnings: +102/-61

The warning regressions look a bit excessive to me, for a final
v5.1 release...

> [1] 
> http://kisskb.ellerman.id.au/kisskb/branch/linus/head/e93c9c99a629c61837d5a7fc2120cd2b6c70dbdd/
>  (all 236 configs)
> [2] 
> http://kisskb.ellerman.id.au/kisskb/branch/linus/head/1c163f4c7b3f621efff9b28a47abb36f7378d783/
>  (all 236 configs)
> [3] 
> http://kisskb.ellerman.id.au/kisskb/branch/linus/head/37624b58542fb9f2d9a70e6ea006ef8a5f66c30b/
>  (all 236 configs)

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


Re: [PATCH] arm64: dts: qcom: qcs404: Add PSCI cpuidle support

2019-05-06 Thread Bjorn Andersson
On Mon 06 May 22:35 PDT 2019, Vinod Koul wrote:

> On 06-05-19, 21:31, Niklas Cassel wrote:
> > Add device bindings for CPUs to suspend using PSCI as the enable-method.
> > 
> > Signed-off-by: Niklas Cassel 
> > ---
> >  arch/arm64/boot/dts/qcom/qcs404.dtsi | 15 +++
> >  1 file changed, 15 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/qcom/qcs404.dtsi 
> > b/arch/arm64/boot/dts/qcom/qcs404.dtsi
> > index ffedf9640af7..f9db9f3ee10c 100644
> > --- a/arch/arm64/boot/dts/qcom/qcs404.dtsi
> > +++ b/arch/arm64/boot/dts/qcom/qcs404.dtsi
> > @@ -31,6 +31,7 @@
> > reg = <0x100>;
> > enable-method = "psci";
> > next-level-cache = <&L2_0>;
> > +   cpu-idle-states = <&CPU_PC>;
> > };
> >  
> > CPU1: cpu@101 {
> > @@ -39,6 +40,7 @@
> > reg = <0x101>;
> > enable-method = "psci";
> > next-level-cache = <&L2_0>;
> > +   cpu-idle-states = <&CPU_PC>;
> > };
> >  
> > CPU2: cpu@102 {
> > @@ -47,6 +49,7 @@
> > reg = <0x102>;
> > enable-method = "psci";
> > next-level-cache = <&L2_0>;
> > +   cpu-idle-states = <&CPU_PC>;
> > };
> >  
> > CPU3: cpu@103 {
> > @@ -55,12 +58,24 @@
> > reg = <0x103>;
> > enable-method = "psci";
> > next-level-cache = <&L2_0>;
> > +   cpu-idle-states = <&CPU_PC>;
> > };
> >  
> > L2_0: l2-cache {
> > compatible = "cache";
> > cache-level = <2>;
> > };
> > +
> > +   idle-states {
> 
> Since we are trying to sort the file per address and
> alphabetically, it would be great if this can be moved before l2-cache
> :)
> 

Picked up, with the order adjusted.

> Other than that this lgtm
>  

I presume that lgtm == Reviewed-by...

Thanks,
Bjorn

> > +   CPU_PC: pc {
> > +   compatible = "arm,idle-state";
> > +   arm,psci-suspend-param = <0x4003>;
> > +   entry-latency-us = <125>;
> > +   exit-latency-us = <180>;
> > +   min-residency-us = <595>;
> > +   local-timer-stop;
> > +   };
> > +   };
> > };
> >  
> > firmware {
> > -- 
> > 2.21.0
> 
> -- 
> ~Vinod


Re: [PATCH V4 1/2] PCI: dwc: Add API support to de-initialize host

2019-05-06 Thread Vidya Sagar

On 5/7/2019 11:19 AM, Vidya Sagar wrote:

On 5/3/2019 4:53 PM, Lorenzo Pieralisi wrote:

On Thu, May 02, 2019 at 10:34:25PM +0530, Vidya Sagar wrote:

Add an API to group all the tasks to be done to de-initialize host which
can then be called by any DesignWare core based driver implementations
while adding .remove() support in their respective drivers.

Signed-off-by: Vidya Sagar 
Acked-by: Gustavo Pimentel 
---
Changes from v3:
* Added check if (pci_msi_enabled() && !pp->ops->msi_host_init) before calling
   dw_pcie_free_msi() API to mimic init path

Changes from v2:
* Rebased on top of linux-next top of the tree branch

Changes from v1:
* s/Designware/DesignWare

  drivers/pci/controller/dwc/pcie-designware-host.c | 8 
  drivers/pci/controller/dwc/pcie-designware.h  | 5 +
  2 files changed, 13 insertions(+)


Series doesn't apply to v5.1-rc1, what's based on ? I suspect
there is a dependency on pci/keystone, given the tight timeline
for the merge window, would you mind postponing it to v5.3 ?

I do not think it is urgent, I am happy to create a branch
for it as soon as v5.2-rc1 is released.

I rebased my changes on top of linux-next. I see that they have conflicts
on top of v5.1-rc1. Do you want me to rebase them on top of v5.1-rc1 instead
of linux-next?
I'm fine with v5.2-rc1 as well.I forgot to mention that these changes are made 
on top of Jisheng's patches

FWIW, Jisheng's patches are approved and applied to pci/dwc for v5.2
https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1968324.html





Thanks,
Lorenzo


diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c 
b/drivers/pci/controller/dwc/pcie-designware-host.c
index 77db32529319..d069e4290180 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -496,6 +496,14 @@ int dw_pcie_host_init(struct pcie_port *pp)
  return ret;
  }
+void dw_pcie_host_deinit(struct pcie_port *pp)
+{
+    pci_stop_root_bus(pp->root_bus);
+    pci_remove_root_bus(pp->root_bus);
+    if (pci_msi_enabled() && !pp->ops->msi_host_init)
+    dw_pcie_free_msi(pp);
+}
+
  static int dw_pcie_access_other_conf(struct pcie_port *pp, struct pci_bus 
*bus,
   u32 devfn, int where, int size, u32 *val,
   bool write)
diff --git a/drivers/pci/controller/dwc/pcie-designware.h 
b/drivers/pci/controller/dwc/pcie-designware.h
index deab426affd3..4f48ec78c7b9 100644
--- a/drivers/pci/controller/dwc/pcie-designware.h
+++ b/drivers/pci/controller/dwc/pcie-designware.h
@@ -348,6 +348,7 @@ void dw_pcie_msi_init(struct pcie_port *pp);
  void dw_pcie_free_msi(struct pcie_port *pp);
  void dw_pcie_setup_rc(struct pcie_port *pp);
  int dw_pcie_host_init(struct pcie_port *pp);
+void dw_pcie_host_deinit(struct pcie_port *pp);
  int dw_pcie_allocate_domains(struct pcie_port *pp);
  #else
  static inline irqreturn_t dw_handle_msi_irq(struct pcie_port *pp)
@@ -372,6 +373,10 @@ static inline int dw_pcie_host_init(struct pcie_port *pp)
  return 0;
  }
+static inline void dw_pcie_host_deinit(struct pcie_port *pp)
+{
+}
+
  static inline int dw_pcie_allocate_domains(struct pcie_port *pp)
  {
  return 0;
--
2.17.1







Re: [PATCH v3 2/2] RISC-V: sifive_l2_cache: Add L2 cache controller driver for SiFive SoCs

2019-05-06 Thread Yash Shah
On Mon, May 6, 2019 at 5:48 PM Andrew F. Davis  wrote:
>
> On 5/6/19 6:48 AM, Yash Shah wrote:
> > The driver currently supports only SiFive FU540-C000 platform.
> >
> > The initial version of L2 cache controller driver includes:
> > - Initial configuration reporting at boot up.
> > - Support for ECC related functionality.
> >
> > Signed-off-by: Yash Shah 
> > ---
> >  arch/riscv/include/asm/sifive_l2_cache.h |  16 +++
> >  arch/riscv/mm/Makefile   |   1 +
> >  arch/riscv/mm/sifive_l2_cache.c  | 175 
> > +++
> >  3 files changed, 192 insertions(+)
> >  create mode 100644 arch/riscv/include/asm/sifive_l2_cache.h
> >  create mode 100644 arch/riscv/mm/sifive_l2_cache.c
> >
> > diff --git a/arch/riscv/include/asm/sifive_l2_cache.h 
> > b/arch/riscv/include/asm/sifive_l2_cache.h
> > new file mode 100644
> > index 000..04f6748
> > --- /dev/null
> > +++ b/arch/riscv/include/asm/sifive_l2_cache.h
> > @@ -0,0 +1,16 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +/*
> > + * SiFive L2 Cache Controller header file
> > + *
> > + */
> > +
> > +#ifndef _ASM_RISCV_SIFIVE_L2_CACHE_H
> > +#define _ASM_RISCV_SIFIVE_L2_CACHE_H
> > +
> > +extern int register_sifive_l2_error_notifier(struct notifier_block *nb);
> > +extern int unregister_sifive_l2_error_notifier(struct notifier_block *nb);
> > +
> > +#define SIFIVE_L2_ERR_TYPE_CE 0
> > +#define SIFIVE_L2_ERR_TYPE_UE 1
> > +
> > +#endif /* _ASM_RISCV_SIFIVE_L2_CACHE_H */
> > diff --git a/arch/riscv/mm/Makefile b/arch/riscv/mm/Makefile
> > index eb22ab4..1523ee5 100644
> > --- a/arch/riscv/mm/Makefile
> > +++ b/arch/riscv/mm/Makefile
> > @@ -3,3 +3,4 @@ obj-y += fault.o
> >  obj-y += extable.o
> >  obj-y += ioremap.o
> >  obj-y += cacheflush.o
> > +obj-y += sifive_l2_cache.o
> > diff --git a/arch/riscv/mm/sifive_l2_cache.c 
> > b/arch/riscv/mm/sifive_l2_cache.c
> > new file mode 100644
> > index 000..4eb6461
> > --- /dev/null
> > +++ b/arch/riscv/mm/sifive_l2_cache.c
> > @@ -0,0 +1,175 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * SiFive L2 cache controller Driver
> > + *
> > + * Copyright (C) 2018-2019 SiFive, Inc.
> > + *
> > + */
[...]
> > +
> > +#ifdef CONFIG_DEBUG_FS
> > +static struct dentry *sifive_test;
> > +
> > +static ssize_t l2_write(struct file *file, const char __user *data,
> > + size_t count, loff_t *ppos)
> > +{
> > + unsigned int val;
> > +
> > + if (kstrtouint_from_user(data, count, 0, &val))
> > + return -EINVAL;
> > + if ((val >= 0 && val < 0xFF) || (val >= 0x1 && val < 0x100FF))
>
> I'm guessing bit 16 is the enable and the lower 8 are some kind of
> region to enable the error? This is probably a bad interface, it looks
> useful for testing but doesn't provide any debugging info useful for
> running systems. Do you really want userspace to be able to do this?

Bit 16 selects the type of ECC error (0=data or 1=directory error).
The lower 8 bits toggles (corrupt) that bit index.
Are you suggesting to remove this debug interface altogether or you
want me to improve the current interface?
Something like providing 2 separate debugfs files for data and
directory errors. And create a separate 8-bit debugfs variable to
select the bit index to toggle.

- Yash

>
> Andrew
>

-- 
The information transmitted is intended only for the person or entity to 
which it is addressed and may contain confidential and/or privileged 
material. If you are not the intended recipient of this message please do 
not read, copy, use or disclose this communication and notify the sender 
immediately. It should be noted that any review, retransmission, 
dissemination or other use of, or taking action or reliance upon, this 
information by persons or entities other than the intended recipient is 
prohibited.


Build regressions/improvements in v5.1

2019-05-06 Thread Geert Uytterhoeven
Below is the list of build error/warning regressions/improvements in
v5.1[1] compared to v5.0[2].

Summarized:
  - build errors: +1/-1
  - build warnings: +126/-105

JFYI, when comparing v5.1[1] to v5.1-rc7[3], the summaries are:
  - build errors: +0/-1
  - build warnings: +102/-61

Happy fixing! ;-)

Thanks to the linux-next team for providing the build service.

[1] 
http://kisskb.ellerman.id.au/kisskb/branch/linus/head/e93c9c99a629c61837d5a7fc2120cd2b6c70dbdd/
 (all 236 configs)
[2] 
http://kisskb.ellerman.id.au/kisskb/branch/linus/head/1c163f4c7b3f621efff9b28a47abb36f7378d783/
 (all 236 configs)
[3] 
http://kisskb.ellerman.id.au/kisskb/branch/linus/head/37624b58542fb9f2d9a70e6ea006ef8a5f66c30b/
 (all 236 configs)


*** ERRORS ***

1 error regressions:
  + error: arch/sh/kernel/cpu/sh2/clock-sh7619.o: undefined reference to 
`followparent_recalc':  => .data+0x70)

1 error improvements:
  - error: ene_ub6250.c: relocation truncated to fit: R_NDS32_9_PCREL_RELA 
against `.text': (.text+0x348) => 


*** WARNINGS ***

126 warning regressions:
  + /kisskb/src/arch/arm/mm/init.c: warning: unused variable 'dtcm_end' 
[-Wunused-variable]:  => 470:13
  + /kisskb/src/arch/arm/mm/init.c: warning: unused variable 'itcm_end' 
[-Wunused-variable]:  => 471:13
  + /kisskb/src/arch/s390/kernel/perf_cpum_cf_diag.c: warning: 
'cf_diag_push_sample' uses dynamic stack allocation [enabled by default]:  => 
514:1
  + /kisskb/src/drivers/clk/ti/clk.c: warning: 'ret' may be used uninitialized 
in this function [-Wuninitialized]:  => 578:2
  + /kisskb/src/drivers/gpu/drm/arm/display/komeda/komeda_dev.c: warning: 'ret' 
may be used uninitialized in this function [-Wuninitialized]:  => 145:5
  + /kisskb/src/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c: warning: (near 
initialization for 'opts.mipi_dphy') [-Wmissing-braces]:  => 620:8
  + /kisskb/src/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c: warning: missing braces 
around initializer [-Wmissing-braces]:  => 620:8
  + /kisskb/src/drivers/i2c/busses/i2c-sh_mobile.c: warning: 'data' may be used 
uninitialized in this function [-Wmaybe-uninitialized]:  => 399:26
  + /kisskb/src/drivers/i2c/busses/i2c-sh_mobile.c: warning: 'data' may be used 
uninitialized in this function [-Wuninitialized]:  => 399:26
  + /kisskb/src/drivers/iio/adc/ad7606_par.c: warning: unused variable 'st' 
[-Wunused-variable]:  => 36:23, 21:23
  + /kisskb/src/drivers/iio/imu/bmi160/bmi160_core.c: warning: 'int_latch_mask' 
may be used uninitialized in this function [-Wuninitialized]:  => 599:29
  + /kisskb/src/drivers/iio/imu/bmi160/bmi160_core.c: warning: 'int_map_mask' 
may be used uninitialized in this function [-Wuninitialized]:  => 606:29
  + /kisskb/src/drivers/iio/imu/bmi160/bmi160_core.c: warning: 
'int_out_ctrl_shift' may be used uninitialized in this function 
[-Wuninitialized]:  => 577:47
  + /kisskb/src/drivers/iio/imu/bmi160/bmi160_core.c: warning: 'pin_name' may 
be used uninitialized in this function [-Wuninitialized]:  => 618:3
  + /kisskb/src/drivers/mtd/ubi/wl.c: warning: 'err' may be used uninitialized 
in this function [-Wuninitialized]:  => 1520:19
  + /kisskb/src/fs/ocfs2/alloc.c: warning: 'first_bit' may be used 
uninitialized in this function [-Wuninitialized]:  => 7604:17
  + /kisskb/src/init/main.c: warning: format '%zu' expects argument of type 
'size_t', but argument 3 has type '__kernel_size_t {aka unsigned int}' 
[-Wformat=]:  => 787:37
  + /kisskb/src/init/main.c: warning: format '%zu' expects argument of type 
'size_t', but argument 3 has type 'unsigned int' [-Wformat=]:  => 388:35, 
384:35, 380:35
  + /kisskb/src/kernel/events/core.c: warning: 'perf_event_bpf_output' uses 
dynamic stack allocation [enabled by default]:  => 7858:1
  + /kisskb/src/kernel/events/core.c: warning: 'perf_event_ksymbol_output' uses 
dynamic stack allocation [enabled by default]:  => 7769:1
  + /kisskb/src/kernel/rcu/srcutree.c: warning: 'levelspread[]' may be 
used uninitialized in this function [-Wuninitialized]:  => 121:34
  + /kisskb/src/kernel/rcu/srcutree.c: warning: 'levelspread[]' may be 
used uninitialized in this function [-Wuninitialized]:  => 140:32
  + /kisskb/src/kernel/rcu/srcutree.c: warning: 'levelspread[]' may be 
used uninitialized in this function [-Wuninitialized]:  => 121:34
  + /kisskb/src/kernel/rcu/srcutree.c: warning: 'levelspread[]' may be 
used uninitialized in this function [-Wuninitialized]:  => 121:34
  + /kisskb/src/kernel/rcu/srcutree.c: warning: 'levelspread[]' may be 
used uninitialized in this function [-Wuninitialized]:  => 121:34
  + /kisskb/src/kernel/rcu/srcutree.c: warning: 'levelspread[]' may be 
used uninitialized in this function [-Wuninitialized]:  => 121:34
  + /kisskb/src/kernel/rcu/srcutree.c: warning: 'levelspread[]' may be 
used uninitialized in this function [-Wuninitialized]:  => 121:34
  + /kisskb/src/kernel/rcu/srcutree.c: warning: 'levelspread[]' may be 
used uninitialized in this function [-Wuninitialized]:  => 121:34
  + /kisskb/src/kernel/rcu/srcutree.c: wa

Re: [PATCH] nds32: don't export low-level cache flushing routines

2019-05-06 Thread Greentime Hu
Hi Christoph,

Christoph Hellwig  於 2019年4月29日 週一 下午7:52寫道:
>
> None of these is used by modules.  Nor should they as we have better
> highlevel primitives.
>
> Signed-off-by: Christoph Hellwig 
> ---
>  arch/nds32/kernel/nds32_ksyms.c | 6 --
>  1 file changed, 6 deletions(-)
>
> diff --git a/arch/nds32/kernel/nds32_ksyms.c b/arch/nds32/kernel/nds32_ksyms.c
> index 5ecebd0e60cb..20719e42ae36 100644
> --- a/arch/nds32/kernel/nds32_ksyms.c
> +++ b/arch/nds32/kernel/nds32_ksyms.c
> @@ -23,9 +23,3 @@ EXPORT_SYMBOL(memzero);
>  EXPORT_SYMBOL(__arch_copy_from_user);
>  EXPORT_SYMBOL(__arch_copy_to_user);
>  EXPORT_SYMBOL(__arch_clear_user);
> -
> -/* cache handling */
> -EXPORT_SYMBOL(cpu_icache_inval_all);
> -EXPORT_SYMBOL(cpu_dcache_wbinval_all);
> -EXPORT_SYMBOL(cpu_dma_inval_range);
> -EXPORT_SYMBOL(cpu_dma_wb_range);

Acked-by: Greentime Hu 
Thanks for your patch. I will put in my next tree.


[PATCH 3/5] ARM: dts: imx6sl-evk: Assign corresponding power supply for LDOs

2019-05-06 Thread Anson Huang
On i.MX6SL EVK board, sw2 supplies vdd1p1/vdd2p5/vdd3p0 LDO, this
patch assigns corresponding power supply for vdd1p1/vdd2p5/vdd3p0
to avoid confusion by below log:

vdd1p1: supplied by regulator-dummy
vdd3p0: supplied by regulator-dummy
vdd2p5: supplied by regulator-dummy

With this patch, the power supply is more accurate:

vdd1p1: supplied by SW2
vdd3p0: supplied by SW2
vdd2p5: supplied by SW2

Signed-off-by: Anson Huang 
---
 arch/arm/boot/dts/imx6sl-evk.dts | 12 
 arch/arm/boot/dts/imx6sl.dtsi|  6 +++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/imx6sl-evk.dts b/arch/arm/boot/dts/imx6sl-evk.dts
index f7a48e4..4829aa6 100644
--- a/arch/arm/boot/dts/imx6sl-evk.dts
+++ b/arch/arm/boot/dts/imx6sl-evk.dts
@@ -580,6 +580,18 @@
status = "okay";
 };
 
+®_vdd1p1 {
+   vin-supply = <&sw2_reg>;
+};
+
+®_vdd3p0 {
+   vin-supply = <&sw2_reg>;
+};
+
+®_vdd2p5 {
+   vin-supply = <&sw2_reg>;
+};
+
 &snvs_poweroff {
status = "okay";
 };
diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
index 9393f03..b36fc01 100644
--- a/arch/arm/boot/dts/imx6sl.dtsi
+++ b/arch/arm/boot/dts/imx6sl.dtsi
@@ -531,7 +531,7 @@
 <0 54 IRQ_TYPE_LEVEL_HIGH>,
 <0 127 IRQ_TYPE_LEVEL_HIGH>;
 
-   regulator-1p1 {
+   reg_vdd1p1: regulator-1p1 {
compatible = "fsl,anatop-regulator";
regulator-name = "vdd1p1";
regulator-min-microvolt = <100>;
@@ -546,7 +546,7 @@
anatop-enable-bit = <0>;
};
 
-   regulator-3p0 {
+   reg_vdd3p0: regulator-3p0 {
compatible = "fsl,anatop-regulator";
regulator-name = "vdd3p0";
regulator-min-microvolt = <280>;
@@ -561,7 +561,7 @@
anatop-enable-bit = <0>;
};
 
-   regulator-2p5 {
+   reg_vdd2p5: regulator-2p5 {
compatible = "fsl,anatop-regulator";
regulator-name = "vdd2p5";
regulator-min-microvolt = <225>;
-- 
2.7.4



[PATCH 2/5] ARM: dts: imx7d-sdb: Assign corresponding power supply for LDOs

2019-05-06 Thread Anson Huang
On i.MX7D SDB board, sw2 supplies 1p0d/1p2 LDO, this patch assigns
corresponding power supply for 1p0d/1p2 LDO to avoid confusion by
below log:

vdd1p0d: supplied by regulator-dummy
vdd1p2: supplied by regulator-dummy

With this patch, the power supply is more accurate:

vdd1p0d: supplied by SW2
vdd1p2: supplied by SW2

Signed-off-by: Anson Huang 
---
 arch/arm/boot/dts/imx7d-sdb.dts | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/imx7d-sdb.dts b/arch/arm/boot/dts/imx7d-sdb.dts
index 202922e..efc83bc 100644
--- a/arch/arm/boot/dts/imx7d-sdb.dts
+++ b/arch/arm/boot/dts/imx7d-sdb.dts
@@ -379,6 +379,14 @@
status = "okay";
 };
 
+®_1p0d {
+   vin-supply = <&sw2_reg>;
+};
+
+®_1p2 {
+   vin-supply = <&sw2_reg>;
+};
+
 &uart1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart1>;
-- 
2.7.4



[PATCH] [next] KVM: lapic: allow setting apic debug dynamically

2019-05-06 Thread Yi Wang
There are many functions invoke apic_debug(), which is defined
as a null function by default, and that's incovenient for debuging
lapic.

This patch allows setting apic debug according to add a apic_dbg
parameter of kvm.

Signed-off-by: Yi Wang 
---
 arch/x86/kvm/lapic.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 9bf70cf..4d8f10f 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -54,8 +54,13 @@
 #define PRIu64 "u"
 #define PRIo64 "o"
 
+static int apic_dbg;
+module_param(apic_dbg, bool, 0644);
+
 /* #define apic_debug(fmt,arg...) printk(KERN_WARNING fmt,##arg) */
-#define apic_debug(fmt, arg...) do {} while (0)
+#define apic_debug(fmt, arg...) do {  if (apic_dbg)   \
+   printk(KERN_DEBUG fmt, ##arg);\
+} while (0)
 
 /* 14 is the version for Xeon and Pentium 8.4.8*/
 #define APIC_VERSION   (0x14UL | ((KVM_APIC_LVT_NUM - 1) << 
16))
-- 
1.8.3.1



[PATCH 5/5] ARM: dts: imx6sx-sdb: Assign corresponding power supply for LDOs

2019-05-06 Thread Anson Huang
On i.MX6SX SDB board, vgen6 supplies vdd1p1/vdd2p5 LDO and
sw2 supplies vdd3p0 LDO, this patch assigns corresponding power
supply for vdd1p1/vdd2p5/vdd3p0 to avoid confusion by below log:

vdd1p1: supplied by regulator-dummy
vdd3p0: supplied by regulator-dummy
vdd2p5: supplied by regulator-dummy

With this patch, the power supply is more accurate:

vdd1p1: supplied by VGEN6
vdd3p0: supplied by SW2
vdd2p5: supplied by VGEN6

Signed-off-by: Anson Huang 
---
 arch/arm/boot/dts/imx6sx-sdb-reva.dts | 12 
 arch/arm/boot/dts/imx6sx-sdb.dts  | 12 
 arch/arm/boot/dts/imx6sx.dtsi |  6 +++---
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/imx6sx-sdb-reva.dts 
b/arch/arm/boot/dts/imx6sx-sdb-reva.dts
index 00c4854..5b3d6c10 100644
--- a/arch/arm/boot/dts/imx6sx-sdb-reva.dts
+++ b/arch/arm/boot/dts/imx6sx-sdb-reva.dts
@@ -154,3 +154,15 @@
enable-active-high;
vin-supply = <®_can_en>;
 };
+
+®_vdd1p1 {
+   vin-supply = <&vgen6_reg>;
+};
+
+®_vdd3p0 {
+   vin-supply = <&sw2_reg>;
+};
+
+®_vdd2p5 {
+   vin-supply = <&vgen6_reg>;
+};
diff --git a/arch/arm/boot/dts/imx6sx-sdb.dts b/arch/arm/boot/dts/imx6sx-sdb.dts
index 998e3e1..10f6da8 100644
--- a/arch/arm/boot/dts/imx6sx-sdb.dts
+++ b/arch/arm/boot/dts/imx6sx-sdb.dts
@@ -137,6 +137,18 @@
vin-supply = <&sw1a_reg>;
 };
 
+®_vdd1p1 {
+   vin-supply = <&vgen6_reg>;
+};
+
+®_vdd3p0 {
+   vin-supply = <&sw2_reg>;
+};
+
+®_vdd2p5 {
+   vin-supply = <&vgen6_reg>;
+};
+
 ®_can_stby {
/* Transceiver EN/STBY is active low on RevB board */
gpio = <&gpio4 27 GPIO_ACTIVE_LOW>;
diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi
index b16a123..bbdfdd8 100644
--- a/arch/arm/boot/dts/imx6sx.dtsi
+++ b/arch/arm/boot/dts/imx6sx.dtsi
@@ -600,7 +600,7 @@
 ,
 ;
 
-   regulator-1p1 {
+   reg_vdd1p1: regulator-1p1 {
compatible = "fsl,anatop-regulator";
regulator-name = "vdd1p1";
regulator-min-microvolt = <100>;
@@ -615,7 +615,7 @@
anatop-enable-bit = <0>;
};
 
-   regulator-3p0 {
+   reg_vdd3p0: regulator-3p0 {
compatible = "fsl,anatop-regulator";
regulator-name = "vdd3p0";
regulator-min-microvolt = <280>;
@@ -630,7 +630,7 @@
anatop-enable-bit = <0>;
};
 
-   regulator-2p5 {
+   reg_vdd2p5: regulator-2p5 {
compatible = "fsl,anatop-regulator";
regulator-name = "vdd2p5";
regulator-min-microvolt = <225>;
-- 
2.7.4



Re: [PATCH v15 13/17] IB, arm64: untag user pointers in ib_uverbs_(re)reg_mr()

2019-05-06 Thread Leon Romanovsky
On Mon, May 06, 2019 at 04:50:20PM -0300, Jason Gunthorpe wrote:
> On Mon, May 06, 2019 at 06:30:59PM +0200, Andrey Konovalov wrote:
> > This patch is a part of a series that extends arm64 kernel ABI to allow to
> > pass tagged user pointers (with the top byte set to something else other
> > than 0x00) as syscall arguments.
> >
> > ib_uverbs_(re)reg_mr() use provided user pointers for vma lookups (through
> > e.g. mlx4_get_umem_mr()), which can only by done with untagged pointers.
> >
> > Untag user pointers in these functions.
> >
> > Signed-off-by: Andrey Konovalov 
> > ---
> >  drivers/infiniband/core/uverbs_cmd.c | 4 
> >  1 file changed, 4 insertions(+)
>
> I think this is OK.. We should really get it tested though.. Leon?

It can be done after v5.2-rc1.

Thanks

>
> Jason


[GIT PULL] MMC and MEMSTICK updates for v5.2

2019-05-06 Thread Ulf Hansson
Hi Linus,

Here's the PR with MMC updates for v5.1. This time and onwards I will continue
to include changes also for the MEMSTICK subsystem in the PR, please tell me if
you prefer another setup.

Details about the highlights are as usual found in the signed tag.

Please pull this in!

Kind regards
Ulf Hansson


The following changes since commit dc4060a5dc2557e6b5aa813bf5b73677299d62d2:

  Linux 5.1-rc5 (2019-04-14 15:17:41 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git tags/mmc-v5.2

for you to fetch changes up to 0a49a619e7e1aeb3f5f5511ca59314423c83dae2:

  mmc: sdhci-pci: Fix BYT OCP setting (2019-05-06 12:33:03 +0200)


MMC core:
 - Fix a few memoryleaks
 - Minor improvements to the card initialization sequence
 - Partially support sleepy GPIO controllers for pwrseq eMMC

MMC host:
 - alcor: Work with multiple-entry sglists
 - alcor: Enable DMA for writes
 - meson-gx: Improve tuning support
 - meson-gx: Avoid clock glitch when switching to DDR modes
 - meson-gx: Disable unreliable HS400 mode
 - mmci: Minor updates for support of HW busy detection
 - mmci: Support data transfers for the stm32_sdmmc variant
 - mmci: Restructure code to better support different variants
 - mtk-sd: Add support for version found on MT7620 family SOCs
 - mtk-sd: Add support for the MT8516 version
 - mtk-sd: Add Chaotian Jing as the maintainer
 - sdhci: Reorganize request-code to convert from tasklet to workqueue
 - sdhci_am654: Stabilize support for lower speed modes
 - sdhci-esdhc-imx: Add HS400 support for iMX7ULP
 - sdhci-esdhc-imx: Add support for iMX7ULP version
 - sdhci-of-arasan: Allow to disable DCMDs via DT for CQE
 - sdhci-of-esdhc: Add support for the ls1028a version
 - sdhci-of-esdhc: Several fixups for errata
 - sdhci-pci: Fix BYT OCP setting
 - sdhci-pci: Add support for Intel CML
 - sdhci-tegra: Add support for system suspend/resume
 - sdhci-tegra: Add CQE support for Tegra186 WAR
 - sdhci-tegra: Add support for Tegra194
 - sdhci-tegra: Update HW tuning process

MEMSTICK:
 - I volunteered to help as a maintainer for the memstick subsystem, which is
   reflected by an update to the MAINTAINERS file. Changes are funneled through
   my MMC git and we will use the linux-mmc mailing list.

MEMSTICK host:
 - A few minor cleanups


Adrian Hunter (7):
  mmc: sdhci-pci: Add support for Intel CML
  mmc: sdhci: Reorganize sdhci_finish_mrq() and __sdhci_finish_mrq()
  mmc: sdhci: Move timer and has_requests functions
  mmc: sdhci: Move some processing to __sdhci_finish_mrq()
  mmc: sdhci: Call mmc_request_done() from IRQ handler if possible
  mmc: sdhci: Remove finish_tasklet
  mmc: sdhci-pci: Fix BYT OCP setting

Andrea Merello (1):
  mmc: core: make pwrseq_emmc (partially) support sleepy GPIO controllers

Andy Shevchenko (5):
  mmc: mmc_spi: Remove redundant dev_set_drvdata()
  mmc: mmc_spi: Remove useless NULL check at ->remove()
  mmc: mmc_spi: Join string literals back
  mmc: mmc_spi: Indentation fixes
  mmc: mmc_spi: Convert to use SPDX identifier

BOUGH CHEN (3):
  dt-bindings: mmc: fsl-imx-esdhc: add imx7ulp compatible string
  mmc: sdhci-esdhc-imx: add pm_qos to interact with cpuidle
  mmc: sdhci-esdhc-imx: Add HS400 support for iMX7ULP

Christoph Muellner (2):
  dt-bindings: mmc: Add disable-cqe-dcmd property.
  mmc: sdhci-of-arasan: Add DTS property to disable DCMDs.

Daniel Drake (4):
  mmc: alcor: enable DMA for writes
  mmc: alcor: enable DMA transfer of large buffers
  Revert "mmc: alcor: enable DMA transfer of large buffers"
  mmc: alcor: work with multiple-entry sglists

Enrico Weigelt, metux IT consult (1):
  mmc: host: Pedantic cleanups to Kconfig

Fabien Parent (3):
  mmc: mtk-sd: add support for MT8516
  mmc: mtk-sd: check for valid optional memory resource
  dt-bindings: mmc: Add support for MT8516 to mtk-sd

Faiz Abbas (1):
  mmc: sdhci_am654: Clear HISPD_ENA in some lower speed modes

Gustavo A. R. Silva (1):
  mmc: usdhi6rol0: mark expected switch fall-throughs

Jerome Brunet (7):
  mmc: meson-gx: remove open coded read with timeout
  mmc: meson-gx: ack only raised irq
  mmc: meson-gx: correct irq flag
  mmc: meson-gx: disable HS400
  mmc: meson-gx: avoid clock glitch when switching to DDR modes
  mmc: meson-gx: remove Rx phase tuning
  mmc: meson-gx: add signal resampling tuning

Kamlesh Gurudasani (1):
  mmc: alcor: Drop pointer to mmc_host from alcor_sdmmc_host

Kangjie Lu (1):
  mmc_spi: add a status check for spi_sync_locked

Kefeng Wang (1):
  mmc: omap_hsmmc: Use dev_get_drvdata()

Ludovic Barre (7):
  mmc: mmci: add get_datactrl_cfg callback and helper functions
  mmc: mmci: define get_dctrl_cfg for legacy variant
  mmc: mmci: qcom: define 

[PATCH 4/5] ARM: dts: imx6sll-evk: Assign corresponding power supply for vdd3p0

2019-05-06 Thread Anson Huang
On i.MX6SLL EVK board, sw2 supplies vdd3p0 LDO, this patch assigns
corresponding power supply for vdd3p0 to avoid confusion by below log:

vdd3p0: supplied by regulator-dummy

With this patch, the power supply is more accurate:

vdd3p0: supplied by SW2

Signed-off-by: Anson Huang 
---
 arch/arm/boot/dts/imx6sll-evk.dts | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/imx6sll-evk.dts 
b/arch/arm/boot/dts/imx6sll-evk.dts
index 4a31a41..78809ea 100644
--- a/arch/arm/boot/dts/imx6sll-evk.dts
+++ b/arch/arm/boot/dts/imx6sll-evk.dts
@@ -265,6 +265,10 @@
status = "okay";
 };
 
+®_3p0 {
+   vin-supply = <&sw2_reg>;
+};
+
 &uart1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart1>;
-- 
2.7.4



[PATCH 1/5] ARM: dts: imx6qdl-sabresd: Assign corresponding power supply for LDOs

2019-05-06 Thread Anson Huang
On i.MX6Q/DL SabreSD board, vgen5 supplies vdd1p1/vdd2p5 LDO and
sw2 supplies vdd3p0 LDO, this patch assigns corresponding power
supply for vdd1p1/vdd2p5/vdd3p0 to avoid confusion by below log:

vdd1p1: supplied by regulator-dummy
vdd3p0: supplied by regulator-dummy
vdd2p5: supplied by regulator-dummy

With this patch, the power supply is more accurate:

vdd1p1: supplied by VGEN5
vdd3p0: supplied by SW2
vdd2p5: supplied by VGEN5

Signed-off-by: Anson Huang 
---
 arch/arm/boot/dts/imx6qdl-sabresd.dtsi | 12 
 arch/arm/boot/dts/imx6qdl.dtsi |  6 +++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi 
b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
index 185fb17..11103a4 100644
--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
@@ -745,6 +745,18 @@
vin-supply = <&sw1c_reg>;
 };
 
+®_vdd1p1 {
+   vin-supply = <&vgen5_reg>;
+};
+
+®_vdd3p0 {
+   vin-supply = <&sw2_reg>;
+};
+
+®_vdd2p5 {
+   vin-supply = <&vgen5_reg>;
+};
+
 &snvs_poweroff {
status = "okay";
 };
diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index 664f7b5..929fc7d 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -701,7 +701,7 @@
 <0 54 IRQ_TYPE_LEVEL_HIGH>,
 <0 127 IRQ_TYPE_LEVEL_HIGH>;
 
-   regulator-1p1 {
+   reg_vdd1p1: regulator-1p1 {
compatible = "fsl,anatop-regulator";
regulator-name = "vdd1p1";
regulator-min-microvolt = <100>;
@@ -716,7 +716,7 @@
anatop-enable-bit = <0>;
};
 
-   regulator-3p0 {
+   reg_vdd3p0: regulator-3p0 {
compatible = "fsl,anatop-regulator";
regulator-name = "vdd3p0";
regulator-min-microvolt = <280>;
@@ -731,7 +731,7 @@
anatop-enable-bit = <0>;
};
 
-   regulator-2p5 {
+   reg_vdd2p5: regulator-2p5 {
compatible = "fsl,anatop-regulator";
regulator-name = "vdd2p5";
regulator-min-microvolt = <225>;
-- 
2.7.4



Re: [PATCH 1/2] mmc: sdhci-iproc: cygnus: Set NO_HISPD bit to fix HS50 data hold time problem

2019-05-06 Thread Adrian Hunter
On 6/05/19 8:01 PM, Scott Branden wrote:
> From: Trac Hoang 
> 
> The iproc host eMMC/SD controller hold time does not meet the
> specification in the HS50 mode. This problem can be mitigated
> by disabling the HISPD bit; thus forcing the controller output
> data to be driven on the falling clock edges rather than the
> rising clock edges.
> 
> This change applies only to the Cygnus platform.
> 
> Fixes: c833e92bbb60 ("mmc: sdhci-iproc: support standard byte register 
> accesses")
> Signed-off-by: Trac Hoang 
> Signed-off-by: Scott Branden 

Acked-by: Adrian Hunter 

> ---
>  drivers/mmc/host/sdhci-iproc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
> index 9d12c06c7fd6..9d4071c41c94 100644
> --- a/drivers/mmc/host/sdhci-iproc.c
> +++ b/drivers/mmc/host/sdhci-iproc.c
> @@ -196,7 +196,8 @@ static const struct sdhci_ops sdhci_iproc_32only_ops = {
>  };
>  
>  static const struct sdhci_pltfm_data sdhci_iproc_cygnus_pltfm_data = {
> - .quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK,
> + .quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
> +   SDHCI_QUIRK_NO_HISPD_BIT,
>   .quirks2 = SDHCI_QUIRK2_ACMD23_BROKEN | SDHCI_QUIRK2_HOST_OFF_CARD_ON,
>   .ops = &sdhci_iproc_32only_ops,
>  };
> 



Re: [PATCH 2/2] mmc: sdhci-iproc: Set NO_HISPD bit to fix HS50 data hold time problem

2019-05-06 Thread Adrian Hunter
On 6/05/19 8:01 PM, Scott Branden wrote:
> From: Trac Hoang 
> 
> The iproc host eMMC/SD controller hold time does not meet the
> specification in the HS50 mode.  This problem can be mitigated
> by disabling the HISPD bit; thus forcing the controller output
> data to be driven on the falling clock edges rather than the
> rising clock edges.
> 
> Fixes: f5f968f2371c ("mmc: sdhci-iproc: suppress spurious interrupt with 
> Multiblock read")

Is this fixes tag correct, because it doesn't seem related.  Maybe explain
that in the commit message.

> Signed-off-by: Trac Hoang 
> Signed-off-by: Scott Branden 
> ---
>  drivers/mmc/host/sdhci-iproc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
> index 9d4071c41c94..2feb4ef32035 100644
> --- a/drivers/mmc/host/sdhci-iproc.c
> +++ b/drivers/mmc/host/sdhci-iproc.c
> @@ -220,7 +220,8 @@ static const struct sdhci_iproc_data iproc_cygnus_data = {
>  
>  static const struct sdhci_pltfm_data sdhci_iproc_pltfm_data = {
>   .quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
> -   SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
> +   SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 |
> +   SDHCI_QUIRK_NO_HISPD_BIT,
>   .quirks2 = SDHCI_QUIRK2_ACMD23_BROKEN,
>   .ops = &sdhci_iproc_ops,
>  };
> 



Re: [PATCH AUTOSEL 4.14 79/95] x86/asm: Remove dead __GNUC__ conditionals

2019-05-06 Thread Greg KH
On Tue, May 07, 2019 at 07:57:01AM +0200, Rasmus Villemoes wrote:
> On 07/05/2019 07.38, Sasha Levin wrote:
> > From: Rasmus Villemoes 
> > 
> > [ Upstream commit 88ca66d8540ca26119b1428cddb96b37925bdf01 ]
> > 
> > The minimum supported gcc version is >= 4.6, so these can be removed.
> 
> Eh, that bump happened for the 4.19 kernel, so this is not true for the
> 4.14 branch. Has cafa0010cd51fb711fdcb50fc55f394c5f167a0a been applied
> to 4.14.y? Otherwise I don't think this is appropriate.

No, that commit is not in 4.14, so we still have to "support" older
versions of gcc there :(

Sasha, can you drop this?

thanks,

greg k-h


[PATCH 1/8] dmaengine: Add matching device node validation in __dma_request_channel()

2019-05-06 Thread Baolin Wang
When user try to request one DMA channel by __dma_request_channel(), it won't
validate if it is the correct DMA device to request, that will lead each DMA
engine driver to validate the correct device node in their filter function
if it is necessary.

Thus we can add the matching device node validation in the DMA engine core,
to remove all of device node validation in the drivers.

Signed-off-by: Baolin Wang 
---
 drivers/dma/dmaengine.c   |   10 --
 drivers/dma/of-dma.c  |4 ++--
 include/linux/dmaengine.h |   12 
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 3a11b10..610080c 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -641,11 +641,13 @@ struct dma_chan *dma_get_any_slave_channel(struct 
dma_device *device)
  * @mask: capabilities that the channel must satisfy
  * @fn: optional callback to disposition available channels
  * @fn_param: opaque parameter to pass to dma_filter_fn
+ * @np: device node to look for DMA channels
  *
  * Returns pointer to appropriate DMA channel on success or NULL.
  */
 struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
-  dma_filter_fn fn, void *fn_param)
+  dma_filter_fn fn, void *fn_param,
+  struct device_node *np)
 {
struct dma_device *device, *_d;
struct dma_chan *chan = NULL;
@@ -653,6 +655,10 @@ struct dma_chan *__dma_request_channel(const 
dma_cap_mask_t *mask,
/* Find a channel */
mutex_lock(&dma_list_mutex);
list_for_each_entry_safe(device, _d, &dma_device_list, global_node) {
+   /* Finds a DMA controller with matching device node */
+   if (np && device->dev->of_node && np != device->dev->of_node)
+   continue;
+
chan = find_candidate(device, mask, fn, fn_param);
if (!IS_ERR(chan))
break;
@@ -769,7 +775,7 @@ struct dma_chan *dma_request_chan_by_mask(const 
dma_cap_mask_t *mask)
if (!mask)
return ERR_PTR(-ENODEV);
 
-   chan = __dma_request_channel(mask, NULL, NULL);
+   chan = __dma_request_channel(mask, NULL, NULL, NULL);
if (!chan) {
mutex_lock(&dma_list_mutex);
if (list_empty(&dma_device_list))
diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c
index 91fd395..6b43d04 100644
--- a/drivers/dma/of-dma.c
+++ b/drivers/dma/of-dma.c
@@ -316,8 +316,8 @@ struct dma_chan *of_dma_simple_xlate(struct of_phandle_args 
*dma_spec,
if (count != 1)
return NULL;
 
-   return dma_request_channel(info->dma_cap, info->filter_fn,
-   &dma_spec->args[0]);
+   return __dma_request_channel(&info->dma_cap, info->filter_fn,
+&dma_spec->args[0], dma_spec->np);
 }
 EXPORT_SYMBOL_GPL(of_dma_simple_xlate);
 
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index d49ec5c..504085b 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -1314,7 +1314,8 @@ static inline enum dma_status 
dma_async_is_complete(dma_cookie_t cookie,
 enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx);
 void dma_issue_pending_all(void);
 struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
-   dma_filter_fn fn, void *fn_param);
+  dma_filter_fn fn, void *fn_param,
+  struct device_node *np);
 struct dma_chan *dma_request_slave_channel(struct device *dev, const char 
*name);
 
 struct dma_chan *dma_request_chan(struct device *dev, const char *name);
@@ -1339,7 +1340,9 @@ static inline void dma_issue_pending_all(void)
 {
 }
 static inline struct dma_chan *__dma_request_channel(const dma_cap_mask_t 
*mask,
- dma_filter_fn fn, void *fn_param)
+dma_filter_fn fn,
+void *fn_param,
+struct device_node *np)
 {
return NULL;
 }
@@ -1411,7 +1414,8 @@ static inline int dmaengine_desc_free(struct 
dma_async_tx_descriptor *desc)
 void dma_run_dependencies(struct dma_async_tx_descriptor *tx);
 struct dma_chan *dma_get_slave_channel(struct dma_chan *chan);
 struct dma_chan *dma_get_any_slave_channel(struct dma_device *device);
-#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y)
+#define dma_request_channel(mask, x, y) \
+   __dma_request_channel(&(mask), x, y, NULL)
 #define dma_request_slave_channel_compat(mask, x, y, dev, name) \
__dma_request_slave_channel_compat(&(mask), x, y, dev, name)
 
@@ -1429,6 +1433,6 @@ static inline int dmaengine_desc_free(struct 
dma_async

[PATCH 8/8] dmaengine: sh: usb-dmac: Let the core do the device node validation

2019-05-06 Thread Baolin Wang
Let the DMA engine core do the device node validation instead of drivers.

Signed-off-by: Baolin Wang 
---
 drivers/dma/sh/usb-dmac.c |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/sh/usb-dmac.c b/drivers/dma/sh/usb-dmac.c
index 59403f6..0afabf3 100644
--- a/drivers/dma/sh/usb-dmac.c
+++ b/drivers/dma/sh/usb-dmac.c
@@ -636,9 +636,6 @@ static bool usb_dmac_chan_filter(struct dma_chan *chan, 
void *arg)
struct usb_dmac_chan *uchan = to_usb_dmac_chan(chan);
struct of_phandle_args *dma_spec = arg;
 
-   if (dma_spec->np != chan->device->dev->of_node)
-   return false;
-
/* USB-DMAC should be used with fixed usb controller's FIFO */
if (uchan->index != dma_spec->args[0])
return false;
@@ -659,7 +656,8 @@ static struct dma_chan *usb_dmac_of_xlate(struct 
of_phandle_args *dma_spec,
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);
 
-   chan = dma_request_channel(mask, usb_dmac_chan_filter, dma_spec);
+   chan = __dma_request_channel(&mask, usb_dmac_chan_filter, dma_spec,
+ofdma->of_node);
if (!chan)
return NULL;
 
-- 
1.7.9.5



[PATCH 6/8] dmaengine: mxs-dma: Let the core do the device node validation

2019-05-06 Thread Baolin Wang
Let the DMA engine core do the device node validation instead of drivers.

Signed-off-by: Baolin Wang 
---
 drivers/dma/mxs-dma.c |8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
index 22cc7f6..8ce5e79 100644
--- a/drivers/dma/mxs-dma.c
+++ b/drivers/dma/mxs-dma.c
@@ -716,7 +716,6 @@ static int __init mxs_dma_init(struct mxs_dma_engine 
*mxs_dma)
 }
 
 struct mxs_dma_filter_param {
-   struct device_node *of_node;
unsigned int chan_id;
 };
 
@@ -727,9 +726,6 @@ static bool mxs_dma_filter_fn(struct dma_chan *chan, void 
*fn_param)
struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
int chan_irq;
 
-   if (mxs_dma->dma_device.dev->of_node != param->of_node)
-   return false;
-
if (chan->chan_id != param->chan_id)
return false;
 
@@ -752,13 +748,13 @@ static struct dma_chan *mxs_dma_xlate(struct 
of_phandle_args *dma_spec,
if (dma_spec->args_count != 1)
return NULL;
 
-   param.of_node = ofdma->of_node;
param.chan_id = dma_spec->args[0];
 
if (param.chan_id >= mxs_dma->nr_channels)
return NULL;
 
-   return dma_request_channel(mask, mxs_dma_filter_fn, ¶m);
+   return __dma_request_channel(&mask, mxs_dma_filter_fn, ¶m,
+ofdma->of_node);
 }
 
 static int __init mxs_dma_probe(struct platform_device *pdev)
-- 
1.7.9.5



[PATCH 7/8] dmaengine: sh: rcar-dmac: Let the core do the device node validation

2019-05-06 Thread Baolin Wang
Let the DMA engine core do the device node validation instead of drivers.

Signed-off-by: Baolin Wang 
---
 drivers/dma/sh/rcar-dmac.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index 2b4f256..9474d5b 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -1632,8 +1632,7 @@ static bool rcar_dmac_chan_filter(struct dma_chan *chan, 
void *arg)
 * Forcing it to call dma_request_channel() and iterate through all
 * channels from all controllers is just pointless.
 */
-   if (chan->device->device_config != rcar_dmac_device_config ||
-   dma_spec->np != chan->device->dev->of_node)
+   if (chan->device->device_config != rcar_dmac_device_config)
return false;
 
return !test_and_set_bit(dma_spec->args[0], dmac->modules);
@@ -1653,7 +1652,8 @@ static struct dma_chan *rcar_dmac_of_xlate(struct 
of_phandle_args *dma_spec,
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);
 
-   chan = dma_request_channel(mask, rcar_dmac_chan_filter, dma_spec);
+   chan = __dma_request_channel(&mask, rcar_dmac_chan_filter, dma_spec,
+ofdma->of_node);
if (!chan)
return NULL;
 
-- 
1.7.9.5



[PATCH 5/8] dmaengine: mmp_tdma: Let the core do the device node validation

2019-05-06 Thread Baolin Wang
Let the DMA engine core do the device node validation instead of drivers.

Signed-off-by: Baolin Wang 
---
 drivers/dma/mmp_tdma.c |   10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/dma/mmp_tdma.c b/drivers/dma/mmp_tdma.c
index 0c56faa0..e76858b 100644
--- a/drivers/dma/mmp_tdma.c
+++ b/drivers/dma/mmp_tdma.c
@@ -586,18 +586,12 @@ static int mmp_tdma_chan_init(struct mmp_tdma_device 
*tdev,
 }
 
 struct mmp_tdma_filter_param {
-   struct device_node *of_node;
unsigned int chan_id;
 };
 
 static bool mmp_tdma_filter_fn(struct dma_chan *chan, void *fn_param)
 {
struct mmp_tdma_filter_param *param = fn_param;
-   struct mmp_tdma_chan *tdmac = to_mmp_tdma_chan(chan);
-   struct dma_device *pdma_device = tdmac->chan.device;
-
-   if (pdma_device->dev->of_node != param->of_node)
-   return false;
 
if (chan->chan_id != param->chan_id)
return false;
@@ -615,13 +609,13 @@ static struct dma_chan *mmp_tdma_xlate(struct 
of_phandle_args *dma_spec,
if (dma_spec->args_count != 1)
return NULL;
 
-   param.of_node = ofdma->of_node;
param.chan_id = dma_spec->args[0];
 
if (param.chan_id >= TDMA_CHANNEL_NUM)
return NULL;
 
-   return dma_request_channel(mask, mmp_tdma_filter_fn, ¶m);
+   return __dma_request_channel(&mask, mmp_tdma_filter_fn, ¶m,
+ofdma->of_node);
 }
 
 static const struct of_device_id mmp_tdma_dt_ids[] = {
-- 
1.7.9.5



[PATCH 4/8] dmaengine: dma-jz4780: Let the core do the device node validation

2019-05-06 Thread Baolin Wang
Let the DMA engine core do the device node validation instead of drivers.

Signed-off-by: Baolin Wang 
---
 drivers/dma/dma-jz4780.c |7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c
index 9ce0a38..7e1d381 100644
--- a/drivers/dma/dma-jz4780.c
+++ b/drivers/dma/dma-jz4780.c
@@ -160,7 +160,6 @@ struct jz4780_dma_dev {
 };
 
 struct jz4780_dma_filter_data {
-   struct device_node *of_node;
uint32_t transfer_type;
int channel;
 };
@@ -765,8 +764,6 @@ static bool jz4780_dma_filter_fn(struct dma_chan *chan, 
void *param)
struct jz4780_dma_dev *jzdma = jz4780_dma_chan_parent(jzchan);
struct jz4780_dma_filter_data *data = param;
 
-   if (jzdma->dma_device.dev->of_node != data->of_node)
-   return false;
 
if (data->channel > -1) {
if (data->channel != jzchan->id)
@@ -790,7 +787,6 @@ static struct dma_chan *jz4780_of_dma_xlate(struct 
of_phandle_args *dma_spec,
if (dma_spec->args_count != 2)
return NULL;
 
-   data.of_node = ofdma->of_node;
data.transfer_type = dma_spec->args[0];
data.channel = dma_spec->args[1];
 
@@ -815,7 +811,8 @@ static struct dma_chan *jz4780_of_dma_xlate(struct 
of_phandle_args *dma_spec,
return dma_get_slave_channel(
&jzdma->chan[data.channel].vchan.chan);
} else {
-   return dma_request_channel(mask, jz4780_dma_filter_fn, &data);
+   return __dma_request_channel(&mask, jz4780_dma_filter_fn, &data,
+ofdma->of_node);
}
 }
 
-- 
1.7.9.5



[PATCH 2/8] soc: tegra: fuse: Change to the correct __dma_request_channel() prototype

2019-05-06 Thread Baolin Wang
Since we've introduced one device node parameter for __dma_request_channel(),
thus change to the correct function prototype.

Signed-off-by: Baolin Wang 
---
 drivers/soc/tegra/fuse/fuse-tegra20.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/tegra/fuse/fuse-tegra20.c 
b/drivers/soc/tegra/fuse/fuse-tegra20.c
index 49ff017..e2571b6 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra20.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra20.c
@@ -110,7 +110,7 @@ static int tegra20_fuse_probe(struct tegra_fuse *fuse)
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);
 
-   fuse->apbdma.chan = __dma_request_channel(&mask, dma_filter, NULL);
+   fuse->apbdma.chan = __dma_request_channel(&mask, dma_filter, NULL, 
NULL);
if (!fuse->apbdma.chan)
return -EPROBE_DEFER;
 
-- 
1.7.9.5



Re: [PATCH] cifs: fix strcat buffer overflow in smb21_set_oplock_level()

2019-05-06 Thread Christoph Probst


Steve French schrieb am 06.05.2019 um 23:18 Uhr:

> On Mon, May 6, 2019 at 2:03 PM Pavel Shilovsky
>  wrote:
> >
> > The patch itself is fine but I think we have a bigger problem here:
> 
> Good point.  Perhaps make update to the same patch to include both changes

I'll update my patch to implement the change suggested by Pavel.

I'll also switch the strcat to strncat and use strncpy in the "None"-case.

Regards,
Christoph





[PATCH 3/8] dmaengine: imx-sdma: Let the core do the device node validation

2019-05-06 Thread Baolin Wang
Let the DMA engine core do the device node validation instead of drivers.

Signed-off-by: Baolin Wang 
---
 drivers/dma/imx-sdma.c|9 ++---
 include/linux/platform_data/dma-imx.h |1 -
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 5f3c137..1a8 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -1921,16 +1921,11 @@ static int sdma_init(struct sdma_engine *sdma)
 static bool sdma_filter_fn(struct dma_chan *chan, void *fn_param)
 {
struct sdma_channel *sdmac = to_sdma_chan(chan);
-   struct sdma_engine *sdma = sdmac->sdma;
struct imx_dma_data *data = fn_param;
 
if (!imx_dma_is_general_purpose(chan))
return false;
 
-   /* return false if it's not the right device */
-   if (sdma->dev->of_node != data->of_node)
-   return false;
-
sdmac->data = *data;
chan->private = &sdmac->data;
 
@@ -1958,9 +1953,9 @@ static struct dma_chan *sdma_xlate(struct of_phandle_args 
*dma_spec,
 * be set to sdmac->event_id1.
 */
data.dma_request2 = 0;
-   data.of_node = ofdma->of_node;
 
-   return dma_request_channel(mask, sdma_filter_fn, &data);
+   return __dma_request_channel(&mask, sdma_filter_fn, &data,
+ofdma->of_node);
 }
 
 static int sdma_probe(struct platform_device *pdev)
diff --git a/include/linux/platform_data/dma-imx.h 
b/include/linux/platform_data/dma-imx.h
index 9daea8d..7d964e7 100644
--- a/include/linux/platform_data/dma-imx.h
+++ b/include/linux/platform_data/dma-imx.h
@@ -55,7 +55,6 @@ struct imx_dma_data {
int dma_request2; /* secondary DMA request line */
enum sdma_peripheral_type peripheral_type;
int priority;
-   struct device_node *of_node;
 };
 
 static inline int imx_dma_is_ipu(struct dma_chan *chan)
-- 
1.7.9.5



[PATCH 0/8] Add matching device node validation in DMA engine core

2019-05-06 Thread Baolin Wang
Hi,

This patch set adds a device node validation in DMA engine core, that will
help some drivers to remove the duplicate device node validation in each
driver.

Any comments are welcome. Thanks.

Baolin Wang (8):
  dmaengine: Add matching device node validation in
__dma_request_channel()
  soc: tegra: fuse: Change to the correct __dma_request_channel()
prototype
  dmaengine: imx-sdma: Let the core do the device node validation
  dmaengine: dma-jz4780: Let the core do the device node validation
  dmaengine: mmp_tdma: Let the core do the device node validation
  dmaengine: mxs-dma: Let the core do the device node validation
  dmaengine: sh: rcar-dmac: Let the core do the device node validation
  dmaengine: sh: usb-dmac: Let the core do the device node validation

 drivers/dma/dma-jz4780.c  |7 ++-
 drivers/dma/dmaengine.c   |   10 --
 drivers/dma/imx-sdma.c|9 ++---
 drivers/dma/mmp_tdma.c|   10 ++
 drivers/dma/mxs-dma.c |8 ++--
 drivers/dma/of-dma.c  |4 ++--
 drivers/dma/sh/rcar-dmac.c|6 +++---
 drivers/dma/sh/usb-dmac.c |6 ++
 drivers/soc/tegra/fuse/fuse-tegra20.c |2 +-
 include/linux/dmaengine.h |   12 
 include/linux/platform_data/dma-imx.h |1 -
 11 files changed, 32 insertions(+), 43 deletions(-)

-- 
1.7.9.5



[PATCH AUTOSEL 5.0 08/99] HID: input: add mapping for "Toggle Display" key

2019-05-06 Thread Sasha Levin
From: Dmitry Torokhov 

[ Upstream commit c01908a14bf735b871170092807c618bb9dae654 ]

According to HUT 1.12 usage 0xb5 from the generic desktop page is reserved
for switching between external and internal display, so let's add the
mapping.

Signed-off-by: Dmitry Torokhov 
Signed-off-by: Sasha Levin 
---
 drivers/hid/hid-input.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index a985d55e3510..e2b933972465 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -677,6 +677,14 @@ static void hidinput_configure_usage(struct hid_input 
*hidinput, struct hid_fiel
break;
}
 
+   if ((usage->hid & 0xf0) == 0xb0) {  /* SC - Display */
+   switch (usage->hid & 0xf) {
+   case 0x05: map_key_clear(KEY_SWITCHVIDEOMODE); break;
+   default: goto ignore;
+   }
+   break;
+   }
+
/*
 * Some lazy vendors declare 255 usages for System Control,
 * leading to the creation of ABS_X|Y axis and too many others.
-- 
2.20.1



[PATCH AUTOSEL 5.0 10/99] s390/dasd: Fix capacity calculation for large volumes

2019-05-06 Thread Sasha Levin
From: Peter Oberparleiter 

[ Upstream commit 2cc9637ce825f3a9f51f8f78af7474e9e85bfa5f ]

The DASD driver incorrectly limits the maximum number of blocks of ECKD
DASD volumes to 32 bit numbers. Volumes with a capacity greater than
2^32-1 blocks are incorrectly recognized as smaller volumes.

This results in the following volume capacity limits depending on the
formatted block size:

  BLKSIZE  MAX_GB   MAX_CYL
  5122047   5843492
 10244095   8676701
 20488191  13634816
 4096   16383  23860929

The same problem occurs when a volume with more than 17895697 cylinders
is accessed in raw-track-access mode.

Fix this problem by adding an explicit type cast when calculating the
maximum number of blocks.

Signed-off-by: Peter Oberparleiter 
Reviewed-by: Stefan Haberland 
Signed-off-by: Martin Schwidefsky 
Signed-off-by: Sasha Levin 
---
 drivers/s390/block/dasd_eckd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 6e294b4d3635..f89f9d02e788 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -2004,14 +2004,14 @@ static int dasd_eckd_end_analysis(struct dasd_block 
*block)
blk_per_trk = recs_per_track(&private->rdc_data, 0, block->bp_block);
 
 raw:
-   block->blocks = (private->real_cyl *
+   block->blocks = ((unsigned long) private->real_cyl *
  private->rdc_data.trk_per_cyl *
  blk_per_trk);
 
dev_info(&device->cdev->dev,
-"DASD with %d KB/block, %d KB total size, %d KB/track, "
+"DASD with %u KB/block, %lu KB total size, %u KB/track, "
 "%s\n", (block->bp_block >> 10),
-((private->real_cyl *
+(((unsigned long) private->real_cyl *
   private->rdc_data.trk_per_cyl *
   blk_per_trk * (block->bp_block >> 9)) >> 1),
 ((blk_per_trk * block->bp_block) >> 10),
-- 
2.20.1



[PATCH AUTOSEL 5.0 13/99] cfg80211: Handle WMM rules in regulatory domain intersection

2019-05-06 Thread Sasha Levin
From: Ilan Peer 

[ Upstream commit 08a75a887ee46828b54600f4bb7068d872a5edd5 ]

The support added for regulatory WMM rules did not handle
the case of regulatory domain intersections. Fix it.

Signed-off-by: Ilan Peer 
Fixes: 230ebaa189af ("cfg80211: read wmm rules from regulatory database")
Signed-off-by: Luca Coelho 
Signed-off-by: Johannes Berg 
Signed-off-by: Sasha Levin 
---
 net/wireless/reg.c | 39 +++
 1 file changed, 39 insertions(+)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index dd58b9909ac9..649c89946dec 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1298,6 +1298,16 @@ reg_intersect_dfs_region(const enum nl80211_dfs_regions 
dfs_region1,
return dfs_region1;
 }
 
+static void reg_wmm_rules_intersect(const struct ieee80211_wmm_ac *wmm_ac1,
+   const struct ieee80211_wmm_ac *wmm_ac2,
+   struct ieee80211_wmm_ac *intersect)
+{
+   intersect->cw_min = max_t(u16, wmm_ac1->cw_min, wmm_ac2->cw_min);
+   intersect->cw_max = max_t(u16, wmm_ac1->cw_max, wmm_ac2->cw_max);
+   intersect->cot = min_t(u16, wmm_ac1->cot, wmm_ac2->cot);
+   intersect->aifsn = max_t(u8, wmm_ac1->aifsn, wmm_ac2->aifsn);
+}
+
 /*
  * Helper for regdom_intersect(), this does the real
  * mathematical intersection fun
@@ -1312,6 +1322,8 @@ static int reg_rules_intersect(const struct 
ieee80211_regdomain *rd1,
struct ieee80211_freq_range *freq_range;
const struct ieee80211_power_rule *power_rule1, *power_rule2;
struct ieee80211_power_rule *power_rule;
+   const struct ieee80211_wmm_rule *wmm_rule1, *wmm_rule2;
+   struct ieee80211_wmm_rule *wmm_rule;
u32 freq_diff, max_bandwidth1, max_bandwidth2;
 
freq_range1 = &rule1->freq_range;
@@ -1322,6 +1334,10 @@ static int reg_rules_intersect(const struct 
ieee80211_regdomain *rd1,
power_rule2 = &rule2->power_rule;
power_rule = &intersected_rule->power_rule;
 
+   wmm_rule1 = &rule1->wmm_rule;
+   wmm_rule2 = &rule2->wmm_rule;
+   wmm_rule = &intersected_rule->wmm_rule;
+
freq_range->start_freq_khz = max(freq_range1->start_freq_khz,
 freq_range2->start_freq_khz);
freq_range->end_freq_khz = min(freq_range1->end_freq_khz,
@@ -1365,6 +1381,29 @@ static int reg_rules_intersect(const struct 
ieee80211_regdomain *rd1,
intersected_rule->dfs_cac_ms = max(rule1->dfs_cac_ms,
   rule2->dfs_cac_ms);
 
+   if (rule1->has_wmm && rule2->has_wmm) {
+   u8 ac;
+
+   for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
+   reg_wmm_rules_intersect(&wmm_rule1->client[ac],
+   &wmm_rule2->client[ac],
+   &wmm_rule->client[ac]);
+   reg_wmm_rules_intersect(&wmm_rule1->ap[ac],
+   &wmm_rule2->ap[ac],
+   &wmm_rule->ap[ac]);
+   }
+
+   intersected_rule->has_wmm = true;
+   } else if (rule1->has_wmm) {
+   *wmm_rule = *wmm_rule1;
+   intersected_rule->has_wmm = true;
+   } else if (rule2->has_wmm) {
+   *wmm_rule = *wmm_rule2;
+   intersected_rule->has_wmm = true;
+   } else {
+   intersected_rule->has_wmm = false;
+   }
+
if (!is_valid_reg_rule(intersected_rule))
return -EINVAL;
 
-- 
2.20.1



[PATCH AUTOSEL 5.0 07/99] HID: input: add mapping for keyboard Brightness Up/Down/Toggle keys

2019-05-06 Thread Sasha Levin
From: Dmitry Torokhov 

[ Upstream commit 7975a1d6a7afeb3eb61c971a153d24dd8fa032f3 ]

According to HUTRR73 usages 0x79, 0x7a and 0x7c from the consumer page
correspond to Brightness Up/Down/Toggle keys, so let's add the mappings.

Signed-off-by: Dmitry Torokhov 
Signed-off-by: Sasha Levin 
---
 drivers/hid/hid-input.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index f55bfcabd718..a985d55e3510 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -908,6 +908,10 @@ static void hidinput_configure_usage(struct hid_input 
*hidinput, struct hid_fiel
case 0x074: map_key_clear(KEY_BRIGHTNESS_MAX);  break;
case 0x075: map_key_clear(KEY_BRIGHTNESS_AUTO); break;
 
+   case 0x079: map_key_clear(KEY_KBDILLUMUP);  break;
+   case 0x07a: map_key_clear(KEY_KBDILLUMDOWN);break;
+   case 0x07c: map_key_clear(KEY_KBDILLUMTOGGLE);  break;
+
case 0x082: map_key_clear(KEY_VIDEO_NEXT);  break;
case 0x083: map_key_clear(KEY_LAST);break;
case 0x084: map_key_clear(KEY_ENTER);   break;
-- 
2.20.1



[PATCH AUTOSEL 5.0 06/99] HID: input: add mapping for Expose/Overview key

2019-05-06 Thread Sasha Levin
From: Dmitry Torokhov 

[ Upstream commit 96dd86871e1fffbc39e4fa61c9c75ec54ee9af0f ]

According to HUTRR77 usage 0x29f from the consumer page is reserved for
the Desktop application to present all running user’s application windows.
Linux defines KEY_SCALE to request Compiz Scale (Expose) mode, so let's
add the mapping.

Signed-off-by: Dmitry Torokhov 
Signed-off-by: Sasha Levin 
---
 drivers/hid/hid-input.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 59a5608b8dc0..f55bfcabd718 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -1041,6 +1041,8 @@ static void hidinput_configure_usage(struct hid_input 
*hidinput, struct hid_fiel
case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT);   break;
case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL);   break;
 
+   case 0x29f: map_key_clear(KEY_SCALE);   break;
+
default: map_key_clear(KEY_UNKNOWN);
}
break;
-- 
2.20.1



[PATCH AUTOSEL 5.0 11/99] mac80211: fix unaligned access in mesh table hash function

2019-05-06 Thread Sasha Levin
From: Felix Fietkau 

[ Upstream commit 40586e3fc400c00c11151804dcdc93f8c831c808 ]

The pointer to the last four bytes of the address is not guaranteed to be
aligned, so we need to use __get_unaligned_cpu32 here

Signed-off-by: Felix Fietkau 
Signed-off-by: Johannes Berg 
Signed-off-by: Sasha Levin 
---
 net/mac80211/mesh_pathtbl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index 88a6d5e18ccc..ac1f5db52994 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -23,7 +23,7 @@ static void mesh_path_free_rcu(struct mesh_table *tbl, struct 
mesh_path *mpath);
 static u32 mesh_table_hash(const void *addr, u32 len, u32 seed)
 {
/* Use last four bytes of hw addr as hash index */
-   return jhash_1word(*(u32 *)(addr+2), seed);
+   return jhash_1word(__get_unaligned_cpu32((u8 *)addr + 2), seed);
 }
 
 static const struct rhashtable_params mesh_rht_params = {
-- 
2.20.1



[PATCH AUTOSEL 5.0 31/99] afs: Unlock pages for __pagevec_release()

2019-05-06 Thread Sasha Levin
From: Marc Dionne 

[ Upstream commit 21bd68f196ca91fc0f3d9bd1b32f6e530e8c1c88 ]

__pagevec_release() complains loudly if any page in the vector is still
locked.  The pages need to be locked for generic_error_remove_page(), but
that function doesn't actually unlock them.

Unlock the pages afterwards.

Signed-off-by: Marc Dionne 
Signed-off-by: David Howells 
Tested-by: Jonathan Billings 
Signed-off-by: Sasha Levin 
---
 fs/afs/write.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/afs/write.c b/fs/afs/write.c
index 72efcfcf9f95..0122d7445fba 100644
--- a/fs/afs/write.c
+++ b/fs/afs/write.c
@@ -264,6 +264,7 @@ static void afs_kill_pages(struct address_space *mapping,
first = page->index + 1;
lock_page(page);
generic_error_remove_page(mapping, page);
+   unlock_page(page);
}
 
__pagevec_release(&pv);
-- 
2.20.1



[PATCH AUTOSEL 5.0 39/99] s390/pkey: add one more argument space for debug feature entry

2019-05-06 Thread Sasha Levin
From: Harald Freudenberger 

[ Upstream commit 6b1f16ba730d4c0cda1247568c3a1bf4fa3a2f2f ]

The debug feature entries have been used with up to 5 arguents
(including the pointer to the format string) but there was only
space reserved for 4 arguemnts. So now the registration does
reserve space for 5 times a long value.

This fixes a sometime appearing weired value as the last
value of an debug feature entry like this:

... pkey_sec2protkey zcrypt_send_cprb (cardnr=10 domain=12)
   failed with errno -2143346254

Signed-off-by: Harald Freudenberger 
Reported-by: Christian Rund 
Signed-off-by: Martin Schwidefsky 
Signed-off-by: Sasha Levin 
---
 drivers/s390/crypto/pkey_api.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/s390/crypto/pkey_api.c b/drivers/s390/crypto/pkey_api.c
index 2f92bbed4bf6..097e890e0d6d 100644
--- a/drivers/s390/crypto/pkey_api.c
+++ b/drivers/s390/crypto/pkey_api.c
@@ -51,7 +51,8 @@ static debug_info_t *debug_info;
 
 static void __init pkey_debug_init(void)
 {
-   debug_info = debug_register("pkey", 1, 1, 4 * sizeof(long));
+   /* 5 arguments per dbf entry (including the format string ptr) */
+   debug_info = debug_register("pkey", 1, 1, 5 * sizeof(long));
debug_register_view(debug_info, &debug_sprintf_view);
debug_set_level(debug_info, 3);
 }
-- 
2.20.1



[PATCH AUTOSEL 5.0 44/99] KVM: nVMX: always use early vmcs check when EPT is disabled

2019-05-06 Thread Sasha Levin
From: Paolo Bonzini 

[ Upstream commit 2b27924bb1d48e3775f432b70bdad5e6dd4e7798 ]

The remaining failures of vmx.flat when EPT is disabled are caused by
incorrectly reflecting VMfails to the L1 hypervisor.  What happens is
that nested_vmx_restore_host_state corrupts the guest CR3, reloading it
with the host's shadow CR3 instead, because it blindly loads GUEST_CR3
from the vmcs01.

For simplicity let's just always use hardware VMCS checks when EPT is
disabled.  This way, nested_vmx_restore_host_state is not reached at
all (or at least shouldn't be reached).

Signed-off-by: Paolo Bonzini 
Signed-off-by: Sasha Levin 
---
 arch/x86/include/uapi/asm/vmx.h |  1 +
 arch/x86/kvm/vmx/nested.c   | 22 --
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/uapi/asm/vmx.h b/arch/x86/include/uapi/asm/vmx.h
index f0b0c90dd398..d213ec5c3766 100644
--- a/arch/x86/include/uapi/asm/vmx.h
+++ b/arch/x86/include/uapi/asm/vmx.h
@@ -146,6 +146,7 @@
 
 #define VMX_ABORT_SAVE_GUEST_MSR_FAIL1
 #define VMX_ABORT_LOAD_HOST_PDPTE_FAIL   2
+#define VMX_ABORT_VMCS_CORRUPTED 3
 #define VMX_ABORT_LOAD_HOST_MSR_FAIL 4
 
 #endif /* _UAPIVMX_H */
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index f90b3a948291..c1de052d8748 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -3790,8 +3790,18 @@ static void nested_vmx_restore_host_state(struct 
kvm_vcpu *vcpu)
vmx_set_cr4(vcpu, vmcs_readl(CR4_READ_SHADOW));
 
nested_ept_uninit_mmu_context(vcpu);
-   vcpu->arch.cr3 = vmcs_readl(GUEST_CR3);
-   __set_bit(VCPU_EXREG_CR3, (ulong *)&vcpu->arch.regs_avail);
+
+   /*
+* This is only valid if EPT is in use, otherwise the vmcs01 GUEST_CR3
+* points to shadow pages!  Fortunately we only get here after a WARN_ON
+* if EPT is disabled, so a VMabort is perfectly fine.
+*/
+   if (enable_ept) {
+   vcpu->arch.cr3 = vmcs_readl(GUEST_CR3);
+   __set_bit(VCPU_EXREG_CR3, (ulong *)&vcpu->arch.regs_avail);
+   } else {
+   nested_vmx_abort(vcpu, VMX_ABORT_VMCS_CORRUPTED);
+   }
 
/*
 * Use ept_save_pdptrs(vcpu) to load the MMU's cached PDPTRs
@@ -5739,6 +5749,14 @@ __init int nested_vmx_hardware_setup(int 
(*exit_handlers[])(struct kvm_vcpu *))
 {
int i;
 
+   /*
+* Without EPT it is not possible to restore L1's CR3 and PDPTR on
+* VMfail, because they are not available in vmcs01.  Just always
+* use hardware checks.
+*/
+   if (!enable_ept)
+   nested_early_check = 1;
+
if (!cpu_has_vmx_shadow_vmcs())
enable_shadow_vmcs = 0;
if (enable_shadow_vmcs) {
-- 
2.20.1



Re: [[repost]RFC PATCH] mm/workingset : judge file page activity via timestamp

2019-05-06 Thread Zhaoyang Huang
On Mon, May 6, 2019 at 10:57 PM Johannes Weiner  wrote:
>
> On Sun, Apr 28, 2019 at 03:44:34PM +0800, Zhaoyang Huang wrote:
> > From: Zhaoyang Huang 
> >
> > this patch introduce timestamp into workingset's entry and judge if the 
> > page is
> > active or inactive via active_file/refault_ratio instead of refault 
> > distance.
> >
> > The original thought is coming from the logs we got from trace_printk in 
> > this
> > patch, we can find about 1/5 of the file pages' refault are under the
> > scenario[1],which will be counted as inactive as they have a long refault 
> > distance
> > in between access. However, we can also know from the time information that 
> > the
> > page refault quickly as comparing to the average refault time which is 
> > calculated
> > by the number of active file and refault ratio. We want to save these kinds 
> > of
> > pages from evicted earlier as it used to be via setting it to ACTIVE 
> > instead.
> > The refault ratio is the value which can reflect lru's average file access
> > frequency in the past and provide the judge criteria for page's activation.
> >
> > The patch is tested on an android system and reduce 30% of page faults, 
> > while
> > 60% of the pages remain the original status as (refault_distance < 
> > active_file)
> > indicates. Pages status got from ftrace during the test can refer to [2].
> >
Hi Johannes,
Thank you for your feedback. I have answer previous comments many
times in different context. I don't expect you accept this patch but
want to have you pay attention to the phenomenon reported in [1],
which has a big refault distance but refaulted very quickly after
evicted. Do you think if this kind of page should be set to INACTIVE?
> > [1]
> > system_server workingset_refault: WKST_ACT[0]:rft_dis 265976, act_file 
> > 34268 rft_ratio 3047 rft_time 0 avg_rft_time 11 refault 295592 eviction 
> > 29616 secs 97 pre_secs 97
> > HwBinder:922  workingset_refault: WKST_ACT[0]:rft_dis 264478, act_file 
> > 35037 rft_ratio 3070 rft_time 2 avg_rft_time 11 refault 310078 eviction 
> > 45600 secs 101 pre_secs 99
> >
> > [2]
> > WKST_ACT[0]:   original--INACTIVE  commit--ACTIVE
> > WKST_ACT[1]:   original--ACTIVEcommit--ACTIVE
> > WKST_INACT[0]: original--INACTIVE  commit--INACTIVE
> > WKST_INACT[1]: original--ACTIVEcommit--INACTIVE
> >
> > Signed-off-by: Zhaoyang Huang 
>
> Nacked-by: Johannes Weiner 
>
> You haven't addressed any of the questions raised during previous
> submissions.


[PATCH AUTOSEL 5.0 47/99] KVM: fix spectrev1 gadgets

2019-05-06 Thread Sasha Levin
From: Paolo Bonzini 

[ Upstream commit 1d487e9bf8ba66a7174c56a0029c54b1eca8f99c ]

These were found with smatch, and then generalized when applicable.

Signed-off-by: Paolo Bonzini 
Signed-off-by: Sasha Levin 
---
 arch/x86/kvm/lapic.c |  4 +++-
 include/linux/kvm_host.h | 10 ++
 virt/kvm/irqchip.c   |  5 +++--
 virt/kvm/kvm_main.c  |  6 --
 4 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 4b6c2da7265c..e196e187d2f1 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -138,6 +138,7 @@ static inline bool kvm_apic_map_get_logical_dest(struct 
kvm_apic_map *map,
if (offset <= max_apic_id) {
u8 cluster_size = min(max_apic_id - offset + 1, 16U);
 
+   offset = array_index_nospec(offset, map->max_apic_id + 
1);
*cluster = &map->phys_map[offset];
*mask = dest_id & (0x >> (16 - cluster_size));
} else {
@@ -900,7 +901,8 @@ static inline bool kvm_apic_map_get_dest_lapic(struct kvm 
*kvm,
if (irq->dest_id > map->max_apic_id) {
*bitmap = 0;
} else {
-   *dst = &map->phys_map[irq->dest_id];
+   u32 dest_id = array_index_nospec(irq->dest_id, 
map->max_apic_id + 1);
+   *dst = &map->phys_map[dest_id];
*bitmap = 1;
}
return true;
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index cf761ff58224..e41503b2c5a1 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -492,10 +493,10 @@ static inline struct kvm_io_bus *kvm_get_bus(struct kvm 
*kvm, enum kvm_bus idx)
 
 static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i)
 {
-   /* Pairs with smp_wmb() in kvm_vm_ioctl_create_vcpu, in case
-* the caller has read kvm->online_vcpus before (as is the case
-* for kvm_for_each_vcpu, for example).
-*/
+   int num_vcpus = atomic_read(&kvm->online_vcpus);
+   i = array_index_nospec(i, num_vcpus);
+
+   /* Pairs with smp_wmb() in kvm_vm_ioctl_create_vcpu.  */
smp_rmb();
return kvm->vcpus[i];
 }
@@ -579,6 +580,7 @@ void kvm_put_kvm(struct kvm *kvm);
 
 static inline struct kvm_memslots *__kvm_memslots(struct kvm *kvm, int as_id)
 {
+   as_id = array_index_nospec(as_id, KVM_ADDRESS_SPACE_NUM);
return srcu_dereference_check(kvm->memslots[as_id], &kvm->srcu,
lockdep_is_held(&kvm->slots_lock) ||
!refcount_read(&kvm->users_count));
diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c
index b1286c4e0712..0bd0683640bd 100644
--- a/virt/kvm/irqchip.c
+++ b/virt/kvm/irqchip.c
@@ -144,18 +144,19 @@ static int setup_routing_entry(struct kvm *kvm,
 {
struct kvm_kernel_irq_routing_entry *ei;
int r;
+   u32 gsi = array_index_nospec(ue->gsi, KVM_MAX_IRQ_ROUTES);
 
/*
 * Do not allow GSI to be mapped to the same irqchip more than once.
 * Allow only one to one mapping between GSI and non-irqchip routing.
 */
-   hlist_for_each_entry(ei, &rt->map[ue->gsi], link)
+   hlist_for_each_entry(ei, &rt->map[gsi], link)
if (ei->type != KVM_IRQ_ROUTING_IRQCHIP ||
ue->type != KVM_IRQ_ROUTING_IRQCHIP ||
ue->u.irqchip.irqchip == ei->irqchip.irqchip)
return -EINVAL;
 
-   e->gsi = ue->gsi;
+   e->gsi = gsi;
e->type = ue->type;
r = kvm_set_routing_entry(kvm, e, ue);
if (r)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index b4f2d892a1d3..ff68b07e94e9 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2974,12 +2974,14 @@ static int kvm_ioctl_create_device(struct kvm *kvm,
struct kvm_device_ops *ops = NULL;
struct kvm_device *dev;
bool test = cd->flags & KVM_CREATE_DEVICE_TEST;
+   int type;
int ret;
 
if (cd->type >= ARRAY_SIZE(kvm_device_ops_table))
return -ENODEV;
 
-   ops = kvm_device_ops_table[cd->type];
+   type = array_index_nospec(cd->type, ARRAY_SIZE(kvm_device_ops_table));
+   ops = kvm_device_ops_table[type];
if (ops == NULL)
return -ENODEV;
 
@@ -2994,7 +2996,7 @@ static int kvm_ioctl_create_device(struct kvm *kvm,
dev->kvm = kvm;
 
mutex_lock(&kvm->lock);
-   ret = ops->create(dev, cd->type);
+   ret = ops->create(dev, type);
if (ret < 0) {
mutex_unlock(&kvm->lock);
kfree(dev);
-- 
2.20.1



[PATCH AUTOSEL 5.0 49/99] tools lib traceevent: Fix missing equality check for strcmp

2019-05-06 Thread Sasha Levin
From: Rikard Falkeborn 

[ Upstream commit f32c2877bcb068a718bb70094cd59ccc29d4d082 ]

There was a missing comparison with 0 when checking if type is "s64" or
"u64". Therefore, the body of the if-statement was entered if "type" was
"u64" or not "s64", which made the first strcmp() redundant since if
type is "u64", it's not "s64".

If type is "s64", the body of the if-statement is not entered but since
the remainder of the function consists of if-statements which will not
be entered if type is "s64", we will just return "val", which is
correct, albeit at the cost of a few more calls to strcmp(), i.e., it
will behave just as if the if-statement was entered.

If type is neither "s64" or "u64", the body of the if-statement will be
entered incorrectly and "val" returned. This means that any type that is
checked after "s64" and "u64" is handled the same way as "s64" and
"u64", i.e., the limiting of "val" to fit in for example "s8" is never
reached.

This was introduced in the kernel tree when the sources were copied from
trace-cmd in commit f7d82350e597 ("tools/events: Add files to create
libtraceevent.a"), and in the trace-cmd repo in 1cdbae6035cei
("Implement typecasting in parser") when the function was introduced,
i.e., it has always behaved the wrong way.

Detected by cppcheck.

Signed-off-by: Rikard Falkeborn 
Reviewed-by: Steven Rostedt (VMware) 
Cc: Tzvetomir Stoyanov 
Fixes: f7d82350e597 ("tools/events: Add files to create libtraceevent.a")
Link: http://lkml.kernel.org/r/20190409091529.2686-1-rikard.falkeb...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 tools/lib/traceevent/event-parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/traceevent/event-parse.c 
b/tools/lib/traceevent/event-parse.c
index 87494c7c619d..981c6ce2da2c 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -2233,7 +2233,7 @@ eval_type_str(unsigned long long val, const char *type, 
int pointer)
return val & 0x;
 
if (strcmp(type, "u64") == 0 ||
-   strcmp(type, "s64"))
+   strcmp(type, "s64") == 0)
return val;
 
if (strcmp(type, "s8") == 0)
-- 
2.20.1



[PATCH AUTOSEL 5.0 48/99] KVM: x86: avoid misreporting level-triggered irqs as edge-triggered in tracing

2019-05-06 Thread Sasha Levin
From: Vitaly Kuznetsov 

[ Upstream commit 7a223e06b1a411cef6c4cd7a9b9a33c8d225b10e ]

In __apic_accept_irq() interface trig_mode is int and actually on some code
paths it is set above u8:

kvm_apic_set_irq() extracts it from 'struct kvm_lapic_irq' where trig_mode
is u16. This is done on purpose as e.g. kvm_set_msi_irq() sets it to
(1 << 15) & e->msi.data

kvm_apic_local_deliver sets it to reg & (1 << 15).

Fix the immediate issue by making 'tm' into u16. We may also want to adjust
__apic_accept_irq() interface and use proper sizes for vector, level,
trig_mode but this is not urgent.

Signed-off-by: Vitaly Kuznetsov 
Signed-off-by: Paolo Bonzini 
Signed-off-by: Sasha Levin 
---
 arch/x86/kvm/trace.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
index 6432d08c7de7..4d47a2631d1f 100644
--- a/arch/x86/kvm/trace.h
+++ b/arch/x86/kvm/trace.h
@@ -438,13 +438,13 @@ TRACE_EVENT(kvm_apic_ipi,
 );
 
 TRACE_EVENT(kvm_apic_accept_irq,
-   TP_PROTO(__u32 apicid, __u16 dm, __u8 tm, __u8 vec),
+   TP_PROTO(__u32 apicid, __u16 dm, __u16 tm, __u8 vec),
TP_ARGS(apicid, dm, tm, vec),
 
TP_STRUCT__entry(
__field(__u32,  apicid  )
__field(__u16,  dm  )
-   __field(__u8,   tm  )
+   __field(__u16,  tm  )
__field(__u8,   vec )
),
 
-- 
2.20.1



[PATCH AUTOSEL 5.0 57/99] mm/hotplug: treat CMA pages as unmovable

2019-05-06 Thread Sasha Levin
From: Qian Cai 

[ Upstream commit 1a9f219157b22d0ffb340a9c5f431afd02cd2cf3 ]

has_unmovable_pages() is used by allocating CMA and gigantic pages as
well as the memory hotplug.  The later doesn't know how to offline CMA
pool properly now, but if an unused (free) CMA page is encountered, then
has_unmovable_pages() happily considers it as a free memory and
propagates this up the call chain.  Memory offlining code then frees the
page without a proper CMA tear down which leads to an accounting issues.
Moreover if the same memory range is onlined again then the memory never
gets back to the CMA pool.

State after memory offline:

 # grep cma /proc/vmstat
 nr_free_cma 205824

 # cat /sys/kernel/debug/cma/cma-kvm_cma/count
 209920

Also, kmemleak still think those memory address are reserved below but
have already been used by the buddy allocator after onlining.  This
patch fixes the situation by treating CMA pageblocks as unmovable except
when has_unmovable_pages() is called as part of CMA allocation.

  Offlined Pages 4096
  kmemleak: Cannot insert 0xc000201f7d040008 into the object search tree 
(overlaps existing)
  Call Trace:
dump_stack+0xb0/0xf4 (unreliable)
create_object+0x344/0x380
__kmalloc_node+0x3ec/0x860
kvmalloc_node+0x58/0x110
seq_read+0x41c/0x620
__vfs_read+0x3c/0x70
vfs_read+0xbc/0x1a0
ksys_read+0x7c/0x140
system_call+0x5c/0x70
  kmemleak: Kernel memory leak detector disabled
  kmemleak: Object 0xc000201cc800 (size 13757317120):
  kmemleak:   comm "swapper/0", pid 0, jiffies 4294937297
  kmemleak:   min_count = -1
  kmemleak:   count = 0
  kmemleak:   flags = 0x5
  kmemleak:   checksum = 0
  kmemleak:   backtrace:
   cma_declare_contiguous+0x2a4/0x3b0
   kvm_cma_reserve+0x11c/0x134
   setup_arch+0x300/0x3f8
   start_kernel+0x9c/0x6e8
   start_here_common+0x1c/0x4b0
  kmemleak: Automatic memory scanning thread ended

[c...@lca.pw: use is_migrate_cma_page() and update commit log]
  Link: http://lkml.kernel.org/r/20190416170510.20048-1-...@lca.pw
Link: http://lkml.kernel.org/r/20190413002623.8967-1-...@lca.pw
Signed-off-by: Qian Cai 
Acked-by: Michal Hocko 
Acked-by: Vlastimil Babka 
Reviewed-by: Oscar Salvador 
Signed-off-by: Andrew Morton 
Signed-off-by: Linus Torvalds 
Signed-off-by: Sasha Levin 
---
 mm/page_alloc.c | 30 ++
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 318ef6ccdb3b..eedb57f9b40b 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -7945,7 +7945,10 @@ void *__init alloc_large_system_hash(const char 
*tablename,
 bool has_unmovable_pages(struct zone *zone, struct page *page, int count,
 int migratetype, int flags)
 {
-   unsigned long pfn, iter, found;
+   unsigned long found;
+   unsigned long iter = 0;
+   unsigned long pfn = page_to_pfn(page);
+   const char *reason = "unmovable page";
 
/*
 * TODO we could make this much more efficient by not checking every
@@ -7955,17 +7958,20 @@ bool has_unmovable_pages(struct zone *zone, struct page 
*page, int count,
 * can still lead to having bootmem allocations in zone_movable.
 */
 
-   /*
-* CMA allocations (alloc_contig_range) really need to mark isolate
-* CMA pageblocks even when they are not movable in fact so consider
-* them movable here.
-*/
-   if (is_migrate_cma(migratetype) &&
-   is_migrate_cma(get_pageblock_migratetype(page)))
-   return false;
+   if (is_migrate_cma_page(page)) {
+   /*
+* CMA allocations (alloc_contig_range) really need to mark
+* isolate CMA pageblocks even when they are not movable in fact
+* so consider them movable here.
+*/
+   if (is_migrate_cma(migratetype))
+   return false;
+
+   reason = "CMA page";
+   goto unmovable;
+   }
 
-   pfn = page_to_pfn(page);
-   for (found = 0, iter = 0; iter < pageblock_nr_pages; iter++) {
+   for (found = 0; iter < pageblock_nr_pages; iter++) {
unsigned long check = pfn + iter;
 
if (!pfn_valid_within(check))
@@ -8045,7 +8051,7 @@ bool has_unmovable_pages(struct zone *zone, struct page 
*page, int count,
 unmovable:
WARN_ON_ONCE(zone_idx(zone) == ZONE_MOVABLE);
if (flags & REPORT_FAILURE)
-   dump_page(pfn_to_page(pfn+iter), "unmovable page");
+   dump_page(pfn_to_page(pfn + iter), reason);
return true;
 }
 
-- 
2.20.1



[PATCH AUTOSEL 5.0 51/99] ipmi: ipmi_si_hardcode.c: init si_type array to fix a crash

2019-05-06 Thread Sasha Levin
From: Tony Camuso 

[ Upstream commit a885bcfd152f97b25005298ab2d6b741aed9b49c ]

The intended behavior of function ipmi_hardcode_init_one() is to default
to kcs interface when no type argument is presented when initializing
ipmi with hard coded addresses.

However, the array of char pointers allocated on the stack by function
ipmi_hardcode_init() was not inited to zeroes, so it contained stack
debris.

Consequently, passing the cruft stored in this array to function
ipmi_hardcode_init_one() caused a crash when it was unable to detect
that the char * being passed was nonsense and tried to access the
address specified by the bogus pointer.

The fix is simply to initialize the si_type array to zeroes, so if
there were no type argument given to at the command line, function
ipmi_hardcode_init_one() could properly default to the kcs interface.

Signed-off-by: Tony Camuso 
Message-Id: <1554837603-40299-1-git-send-email-tcam...@redhat.com>
Signed-off-by: Corey Minyard 
Signed-off-by: Sasha Levin 
---
 drivers/char/ipmi/ipmi_si_hardcode.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/char/ipmi/ipmi_si_hardcode.c 
b/drivers/char/ipmi/ipmi_si_hardcode.c
index 1e5783961b0d..ab7180c46d8d 100644
--- a/drivers/char/ipmi/ipmi_si_hardcode.c
+++ b/drivers/char/ipmi/ipmi_si_hardcode.c
@@ -201,6 +201,8 @@ void __init ipmi_hardcode_init(void)
char *str;
char *si_type[SI_MAX_PARMS];
 
+   memset(si_type, 0, sizeof(si_type));
+
/* Parse out the si_type string into its components. */
str = si_type_str;
if (*str != '\0') {
-- 
2.20.1



[PATCH AUTOSEL 5.0 52/99] ocelot: Don't sleep in atomic context (irqs_disabled())

2019-05-06 Thread Sasha Levin
From: Claudiu Manoil 

[ Upstream commit a8fd48b50deaa20808bbf0f6685f6f1acba6a64c ]

Preemption disabled at:
 [] dev_set_rx_mode+0x1c/0x38
 Call trace:
 [] dump_backtrace+0x0/0x3d0
 [] show_stack+0x14/0x20
 [] dump_stack+0xac/0xe4
 [] ___might_sleep+0x164/0x238
 [] __might_sleep+0x50/0x88
 [] kmem_cache_alloc+0x17c/0x1d0
 [] ocelot_set_rx_mode+0x108/0x188 [mscc_ocelot_common]
 [] __dev_set_rx_mode+0x58/0xa0
 [] dev_set_rx_mode+0x24/0x38

Fixes: a556c76adc05 ("net: mscc: Add initial Ocelot switch support")

Signed-off-by: Claudiu Manoil 
Signed-off-by: David S. Miller 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/mscc/ocelot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mscc/ocelot.c 
b/drivers/net/ethernet/mscc/ocelot.c
index 215a45374d7b..0ef95abde6bb 100644
--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -613,7 +613,7 @@ static int ocelot_mact_mc_add(struct ocelot_port *port,
  struct netdev_hw_addr *hw_addr)
 {
struct ocelot *ocelot = port->ocelot;
-   struct netdev_hw_addr *ha = kzalloc(sizeof(*ha), GFP_KERNEL);
+   struct netdev_hw_addr *ha = kzalloc(sizeof(*ha), GFP_ATOMIC);
 
if (!ha)
return -ENOMEM;
-- 
2.20.1



[PATCH AUTOSEL 5.0 58/99] mm: fix inactive list balancing between NUMA nodes and cgroups

2019-05-06 Thread Sasha Levin
From: Johannes Weiner 

[ Upstream commit 3b991208b897f52507168374033771a984b947b1 ]

During !CONFIG_CGROUP reclaim, we expand the inactive list size if it's
thrashing on the node that is about to be reclaimed.  But when cgroups
are enabled, we suddenly ignore the node scope and use the cgroup scope
only.  The result is that pressure bleeds between NUMA nodes depending
on whether cgroups are merely compiled into Linux.  This behavioral
difference is unexpected and undesirable.

When the refault adaptivity of the inactive list was first introduced,
there were no statistics at the lruvec level - the intersection of node
and memcg - so it was better than nothing.

But now that we have that infrastructure, use lruvec_page_state() to
make the list balancing decision always NUMA aware.

[han...@cmpxchg.org: fix bisection hole]
  Link: http://lkml.kernel.org/r/20190417155241.gb23...@cmpxchg.org
Link: http://lkml.kernel.org/r/20190412144438.2645-1-han...@cmpxchg.org
Fixes: 2a2e48854d70 ("mm: vmscan: fix IO/refault regression in cache workingset 
transition")
Signed-off-by: Johannes Weiner 
Reviewed-by: Shakeel Butt 
Cc: Roman Gushchin 
Cc: Michal Hocko 
Signed-off-by: Andrew Morton 
Signed-off-by: Linus Torvalds 
Signed-off-by: Sasha Levin 
---
 mm/vmscan.c | 29 +
 1 file changed, 9 insertions(+), 20 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index e979705bbf32..022afabac3f6 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2199,7 +2199,6 @@ static void shrink_active_list(unsigned long nr_to_scan,
  *   10TB 32032GB
  */
 static bool inactive_list_is_low(struct lruvec *lruvec, bool file,
-struct mem_cgroup *memcg,
 struct scan_control *sc, bool actual_reclaim)
 {
enum lru_list active_lru = file * LRU_FILE + LRU_ACTIVE;
@@ -2220,16 +2219,12 @@ static bool inactive_list_is_low(struct lruvec *lruvec, 
bool file,
inactive = lruvec_lru_size(lruvec, inactive_lru, sc->reclaim_idx);
active = lruvec_lru_size(lruvec, active_lru, sc->reclaim_idx);
 
-   if (memcg)
-   refaults = memcg_page_state(memcg, WORKINGSET_ACTIVATE);
-   else
-   refaults = node_page_state(pgdat, WORKINGSET_ACTIVATE);
-
/*
 * When refaults are being observed, it means a new workingset
 * is being established. Disable active list protection to get
 * rid of the stale workingset quickly.
 */
+   refaults = lruvec_page_state(lruvec, WORKINGSET_ACTIVATE);
if (file && actual_reclaim && lruvec->refaults != refaults) {
inactive_ratio = 0;
} else {
@@ -2250,12 +2245,10 @@ static bool inactive_list_is_low(struct lruvec *lruvec, 
bool file,
 }
 
 static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,
-struct lruvec *lruvec, struct mem_cgroup 
*memcg,
-struct scan_control *sc)
+struct lruvec *lruvec, struct scan_control *sc)
 {
if (is_active_lru(lru)) {
-   if (inactive_list_is_low(lruvec, is_file_lru(lru),
-memcg, sc, true))
+   if (inactive_list_is_low(lruvec, is_file_lru(lru), sc, true))
shrink_active_list(nr_to_scan, lruvec, sc, lru);
return 0;
}
@@ -2355,7 +2348,7 @@ static void get_scan_count(struct lruvec *lruvec, struct 
mem_cgroup *memcg,
 * anonymous pages on the LRU in eligible zones.
 * Otherwise, the small LRU gets thrashed.
 */
-   if (!inactive_list_is_low(lruvec, false, memcg, sc, 
false) &&
+   if (!inactive_list_is_low(lruvec, false, sc, false) &&
lruvec_lru_size(lruvec, LRU_INACTIVE_ANON, 
sc->reclaim_idx)
>> sc->priority) {
scan_balance = SCAN_ANON;
@@ -2373,7 +2366,7 @@ static void get_scan_count(struct lruvec *lruvec, struct 
mem_cgroup *memcg,
 * lruvec even if it has plenty of old anonymous pages unless the
 * system is under heavy pressure.
 */
-   if (!inactive_list_is_low(lruvec, true, memcg, sc, false) &&
+   if (!inactive_list_is_low(lruvec, true, sc, false) &&
lruvec_lru_size(lruvec, LRU_INACTIVE_FILE, sc->reclaim_idx) >> 
sc->priority) {
scan_balance = SCAN_FILE;
goto out;
@@ -2526,7 +2519,7 @@ static void shrink_node_memcg(struct pglist_data *pgdat, 
struct mem_cgroup *memc
nr[lru] -= nr_to_scan;
 
nr_reclaimed += shrink_list(lru, nr_to_scan,
-   lruvec, memcg, sc);
+   lruvec, sc);

Re: [PATCH v3 06/10] mfd: Add support for the MediaTek MT6358 PMIC

2019-05-06 Thread Nicolas Boichat
On Fri, May 3, 2019 at 6:34 PM Hsin-Hsiung Wang
 wrote:
>
> This adds support for the MediaTek MT6358 PMIC. This is a
> multifunction device with the following sub modules:
>
> - Regulator
> - RTC
> - Codec
> - Interrupt
>
> It is interfaced to the host controller using SPI interface
> by a proprietary hardware called PMIC wrapper or pwrap.
> MT6358 MFD is a child device of the pwrap.
>
> Signed-off-by: Hsin-Hsiung Wang 
> ---
>  drivers/mfd/Makefile |   3 +-
>  drivers/mfd/mt6358-irq.c | 229 ++
>  drivers/mfd/mt6397-core.c|  64 +-
>  include/linux/mfd/mt6358/core.h  | 158 +++
>  include/linux/mfd/mt6358/registers.h | 282 +++
>  include/linux/mfd/mt6397/core.h  |   3 +
>  6 files changed, 737 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/mfd/mt6358-irq.c
>  create mode 100644 include/linux/mfd/mt6358/core.h
>  create mode 100644 include/linux/mfd/mt6358/registers.h
>
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index ab1e228b5a2f..6e7b2b0951e7 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -234,7 +234,8 @@ obj-$(CONFIG_INTEL_SOC_PMIC)+= intel-soc-pmic.o
>  obj-$(CONFIG_INTEL_SOC_PMIC_BXTWC) += intel_soc_pmic_bxtwc.o
>  obj-$(CONFIG_INTEL_SOC_PMIC_CHTWC) += intel_soc_pmic_chtwc.o
>  obj-$(CONFIG_INTEL_SOC_PMIC_CHTDC_TI)  += intel_soc_pmic_chtdc_ti.o
> -mt6397-objs:= mt6397-core.o mt6397-irq.o
> +
> +mt6397-objs:= mt6397-core.o mt6397-irq.o mt6358-irq.o
>  obj-$(CONFIG_MFD_MT6397)   += mt6397.o
>
>  obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o
> diff --git a/drivers/mfd/mt6358-irq.c b/drivers/mfd/mt6358-irq.c
> new file mode 100644
> index ..a6e8252c3431
> --- /dev/null
> +++ b/drivers/mfd/mt6358-irq.c
> @@ -0,0 +1,229 @@
> +// SPDX-License-Identifier: GPL-2.0
> +//
> +// Copyright (c) 2019 MediaTek Inc.
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +static struct irq_top_t mt6358_ints[] = {
> +   MT6358_TOP_GEN(BUCK),
> +   MT6358_TOP_GEN(LDO),
> +   MT6358_TOP_GEN(PSC),
> +   MT6358_TOP_GEN(SCK),
> +   MT6358_TOP_GEN(BM),
> +   MT6358_TOP_GEN(HK),
> +   MT6358_TOP_GEN(AUD),
> +   MT6358_TOP_GEN(MISC),
> +};
> +
> +static void pmic_irq_enable(struct irq_data *data)
> +{
> +   unsigned int hwirq = irqd_to_hwirq(data);
> +   struct mt6397_chip *chip = irq_data_get_irq_chip_data(data);
> +   struct pmic_irq_data *irqd = chip->irq_data;
> +
> +   irqd->enable_hwirq[hwirq] = true;
> +}
> +
> +static void pmic_irq_disable(struct irq_data *data)
> +{
> +   unsigned int hwirq = irqd_to_hwirq(data);
> +   struct mt6397_chip *chip = irq_data_get_irq_chip_data(data);
> +   struct pmic_irq_data *irqd = chip->irq_data;
> +
> +   irqd->enable_hwirq[hwirq] = false;
> +}
> +
> +static void pmic_irq_lock(struct irq_data *data)
> +{
> +   struct mt6397_chip *chip = irq_data_get_irq_chip_data(data);
> +
> +   mutex_lock(&chip->irqlock);
> +}
> +
> +static void pmic_irq_sync_unlock(struct irq_data *data)
> +{
> +   unsigned int i, top_gp, en_reg, int_regs, shift;
> +   struct mt6397_chip *chip = irq_data_get_irq_chip_data(data);
> +   struct pmic_irq_data *irqd = chip->irq_data;
> +
> +   for (i = 0; i < irqd->num_pmic_irqs; i++) {
> +   if (irqd->enable_hwirq[i] == irqd->cache_hwirq[i])
> +   continue;
> +
> +   top_gp = 0;
> +   while ((top_gp + 1) < ARRAY_SIZE(mt6358_ints) && i >=
> +   mt6358_ints[top_gp + 1].hwirq_base)

nit: Move all of:
i >= mt6358_ints[top_gp + 1].hwirq_base
to the second line

> +   top_gp++;
> +
> +   if (top_gp >= ARRAY_SIZE(mt6358_ints)) {
> +   mutex_unlock(&chip->irqlock);
> +   dev_err(chip->dev,
> +   "Failed to get top_group: %d\n", top_gp);
> +   return;
> +   }
> +
> +   int_regs = (i - mt6358_ints[top_gp].hwirq_base) /
> +   MT6358_REG_WIDTH;
> +   en_reg = mt6358_ints[top_gp].en_reg +
> +   mt6358_ints[top_gp].en_reg_shift * int_regs;
> +   shift = (i - mt6358_ints[top_gp].hwirq_base) % 
> MT6358_REG_WIDTH;
> +   regmap_update_bits(chip->regmap, en_reg, BIT(shift),
> +  irqd->enable_hwirq[i] << shift);
> +   irqd->cache_hwirq[i] = irqd->enable_hwirq[i];
> +   }
> +   mutex_unlock(&chip->irqlock);
> +}
> +
> +static struct irq_chip mt6358_irq_chip = {
> +   .name = "mt6358-irq",
> +   .flags = IRQCHIP_SKIP_SET_WAKE,
> +   .irq_enable = pmic_irq_enable,
> +   .irq_disable = pmic_irq_disable,
> +   .irq_bus_lock = pmic_irq_lock,
> +

[PATCH AUTOSEL 5.0 63/99] netfilter: ctnetlink: don't use conntrack/expect object addresses as id

2019-05-06 Thread Sasha Levin
From: Florian Westphal 

[ Upstream commit 3c79107631db1f7fd32cf3f7368e4672004a3010 ]

else, we leak the addresses to userspace via ctnetlink events
and dumps.

Compute an ID on demand based on the immutable parts of nf_conn struct.

Another advantage compared to using an address is that there is no
immediate re-use of the same ID in case the conntrack entry is freed and
reallocated again immediately.

Fixes: 3583240249ef ("[NETFILTER]: nf_conntrack_expect: kill unique ID")
Fixes: 7f85f914721f ("[NETFILTER]: nf_conntrack: kill unique ID")
Signed-off-by: Florian Westphal 
Signed-off-by: Pablo Neira Ayuso 
Signed-off-by: Sasha Levin 
---
 include/net/netfilter/nf_conntrack.h |  2 ++
 net/netfilter/nf_conntrack_core.c| 35 
 net/netfilter/nf_conntrack_netlink.c | 34 +++
 3 files changed, 66 insertions(+), 5 deletions(-)

diff --git a/include/net/netfilter/nf_conntrack.h 
b/include/net/netfilter/nf_conntrack.h
index 249d0a5b12b8..63fd47e924b9 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -318,6 +318,8 @@ struct nf_conn *nf_ct_tmpl_alloc(struct net *net,
 gfp_t flags);
 void nf_ct_tmpl_free(struct nf_conn *tmpl);
 
+u32 nf_ct_get_id(const struct nf_conn *ct);
+
 static inline void
 nf_ct_set(struct sk_buff *skb, struct nf_conn *ct, enum ip_conntrack_info info)
 {
diff --git a/net/netfilter/nf_conntrack_core.c 
b/net/netfilter/nf_conntrack_core.c
index 9dd4c2048a2b..1982faf21ebb 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -424,6 +425,40 @@ nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
 }
 EXPORT_SYMBOL_GPL(nf_ct_invert_tuple);
 
+/* Generate a almost-unique pseudo-id for a given conntrack.
+ *
+ * intentionally doesn't re-use any of the seeds used for hash
+ * table location, we assume id gets exposed to userspace.
+ *
+ * Following nf_conn items do not change throughout lifetime
+ * of the nf_conn after it has been committed to main hash table:
+ *
+ * 1. nf_conn address
+ * 2. nf_conn->ext address
+ * 3. nf_conn->master address (normally NULL)
+ * 4. tuple
+ * 5. the associated net namespace
+ */
+u32 nf_ct_get_id(const struct nf_conn *ct)
+{
+   static __read_mostly siphash_key_t ct_id_seed;
+   unsigned long a, b, c, d;
+
+   net_get_random_once(&ct_id_seed, sizeof(ct_id_seed));
+
+   a = (unsigned long)ct;
+   b = (unsigned long)ct->master ^ net_hash_mix(nf_ct_net(ct));
+   c = (unsigned long)ct->ext;
+   d = (unsigned long)siphash(&ct->tuplehash, sizeof(ct->tuplehash),
+  &ct_id_seed);
+#ifdef CONFIG_64BIT
+   return siphash_4u64((u64)a, (u64)b, (u64)c, (u64)d, &ct_id_seed);
+#else
+   return siphash_4u32((u32)a, (u32)b, (u32)c, (u32)d, &ct_id_seed);
+#endif
+}
+EXPORT_SYMBOL_GPL(nf_ct_get_id);
+
 static void
 clean_from_lists(struct nf_conn *ct)
 {
diff --git a/net/netfilter/nf_conntrack_netlink.c 
b/net/netfilter/nf_conntrack_netlink.c
index 1213beb5a714..36619ad8ab8c 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -485,7 +486,9 @@ static int ctnetlink_dump_ct_synproxy(struct sk_buff *skb, 
struct nf_conn *ct)
 
 static int ctnetlink_dump_id(struct sk_buff *skb, const struct nf_conn *ct)
 {
-   if (nla_put_be32(skb, CTA_ID, htonl((unsigned long)ct)))
+   __be32 id = (__force __be32)nf_ct_get_id(ct);
+
+   if (nla_put_be32(skb, CTA_ID, id))
goto nla_put_failure;
return 0;
 
@@ -1286,8 +1289,9 @@ static int ctnetlink_del_conntrack(struct net *net, 
struct sock *ctnl,
}
 
if (cda[CTA_ID]) {
-   u_int32_t id = ntohl(nla_get_be32(cda[CTA_ID]));
-   if (id != (u32)(unsigned long)ct) {
+   __be32 id = nla_get_be32(cda[CTA_ID]);
+
+   if (id != (__force __be32)nf_ct_get_id(ct)) {
nf_ct_put(ct);
return -ENOENT;
}
@@ -2694,6 +2698,25 @@ static int ctnetlink_exp_dump_mask(struct sk_buff *skb,
 
 static const union nf_inet_addr any_addr;
 
+static __be32 nf_expect_get_id(const struct nf_conntrack_expect *exp)
+{
+   static __read_mostly siphash_key_t exp_id_seed;
+   unsigned long a, b, c, d;
+
+   net_get_random_once(&exp_id_seed, sizeof(exp_id_seed));
+
+   a = (unsigned long)exp;
+   b = (unsigned long)exp->helper;
+   c = (unsigned long)exp->master;
+   d = (unsigned long)siphash(&exp->tuple, sizeof(exp->tuple), 
&exp_id_seed);
+
+#ifdef CONFIG_64BIT
+   return (__force __be32)siphash_4u64((u64)a, (u64)b, (u64)c, (u64)d, 
&exp_id_seed);
+#else
+   return (__force __be32)siphash_4u32((u32)a, (u32)b, (u32)c, (u32)d, 
&exp_id_seed);
+#endi

[PATCH AUTOSEL 5.0 56/99] slab: store tagged freelist for off-slab slabmgmt

2019-05-06 Thread Sasha Levin
From: Qian Cai 

[ Upstream commit 1a62b18d51e5c5ecc0345c85bb9fef870ab721ed ]

Commit 51dedad06b5f ("kasan, slab: make freelist stored without tags")
calls kasan_reset_tag() for off-slab slab management object leading to
freelist being stored non-tagged.

However, cache_grow_begin() calls alloc_slabmgmt() which calls
kmem_cache_alloc_node() assigns a tag for the address and stores it in
the shadow address.  As the result, it causes endless errors below
during boot due to drain_freelist() -> slab_destroy() ->
kasan_slab_free() which compares already untagged freelist against the
stored tag in the shadow address.

Since off-slab slab management object freelist is such a special case,
just store it tagged.  Non-off-slab management object freelist is still
stored untagged which has not been assigned a tag and should not cause
any other troubles with this inconsistency.

  BUG: KASAN: double-free or invalid-free in slab_destroy+0x84/0x88
  Pointer tag: [ff], memory tag: [99]

  CPU: 0 PID: 1376 Comm: kworker/0:4 Tainted: GW 5.1.0-rc3+ #8
  Hardware name: HPE Apollo 70 /C01_APACHE_MB , BIOS 
L50_5.13_1.0.6 07/10/2018
  Workqueue: cgroup_destroy css_killed_work_fn
  Call trace:
   print_address_description+0x74/0x2a4
   kasan_report_invalid_free+0x80/0xc0
   __kasan_slab_free+0x204/0x208
   kasan_slab_free+0xc/0x18
   kmem_cache_free+0xe4/0x254
   slab_destroy+0x84/0x88
   drain_freelist+0xd0/0x104
   __kmem_cache_shrink+0x1ac/0x224
   __kmemcg_cache_deactivate+0x1c/0x28
   memcg_deactivate_kmem_caches+0xa0/0xe8
   memcg_offline_kmem+0x8c/0x3d4
   mem_cgroup_css_offline+0x24c/0x290
   css_killed_work_fn+0x154/0x618
   process_one_work+0x9cc/0x183c
   worker_thread+0x9b0/0xe38
   kthread+0x374/0x390
   ret_from_fork+0x10/0x18

  Allocated by task 1625:
   __kasan_kmalloc+0x168/0x240
   kasan_slab_alloc+0x18/0x20
   kmem_cache_alloc_node+0x1f8/0x3a0
   cache_grow_begin+0x4fc/0xa24
   cache_alloc_refill+0x2f8/0x3e8
   kmem_cache_alloc+0x1bc/0x3bc
   sock_alloc_inode+0x58/0x334
   alloc_inode+0xb8/0x164
   new_inode_pseudo+0x20/0xec
   sock_alloc+0x74/0x284
   __sock_create+0xb0/0x58c
   sock_create+0x98/0xb8
   __sys_socket+0x60/0x138
   __arm64_sys_socket+0xa4/0x110
   el0_svc_handler+0x2c0/0x47c
   el0_svc+0x8/0xc

  Freed by task 1625:
   __kasan_slab_free+0x114/0x208
   kasan_slab_free+0xc/0x18
   kfree+0x1a8/0x1e0
   single_release+0x7c/0x9c
   close_pdeo+0x13c/0x43c
   proc_reg_release+0xec/0x108
   __fput+0x2f8/0x784
   fput+0x1c/0x28
   task_work_run+0xc0/0x1b0
   do_notify_resume+0xb44/0x1278
   work_pending+0x8/0x10

  The buggy address belongs to the object at 809681b89e00
   which belongs to the cache kmalloc-128 of size 128
  The buggy address is located 0 bytes inside of
   128-byte region [809681b89e00, 809681b89e80)
  The buggy address belongs to the page:
  page:7fe025a06e00 count:1 mapcount:0 mapping:01ff80082000fb00
  index:0x809681b8fe04
  flags: 0x17ffc000200(slab)
  raw: 017ffc000200 7fe025a06d08 7fe022ef7b88 01ff80082000fb00
  raw: 809681b8fe04 809681b8 000100e0 
  page dumped because: kasan: bad access detected
  page allocated via order 0, migratetype Unmovable, gfp_mask
  0x2420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE)
   prep_new_page+0x4e0/0x5e0
   get_page_from_freelist+0x4ce8/0x50d4
   __alloc_pages_nodemask+0x738/0x38b8
   cache_grow_begin+0xd8/0xa24
   cache_alloc_node+0x14c/0x268
   __kmalloc+0x1c8/0x3fc
   ftrace_free_mem+0x408/0x1284
   ftrace_free_init_mem+0x20/0x28
   kernel_init+0x24/0x548
   ret_from_fork+0x10/0x18

  Memory state around the buggy address:
   809681b89c00: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe
   809681b89d00: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe
  >809681b89e00: 99 99 99 99 99 99 99 99 fe fe fe fe fe fe fe fe
 ^
   809681b89f00: 43 43 43 43 43 fe fe fe fe fe fe fe fe fe fe fe
   809681b8a000: 6d fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe

Link: http://lkml.kernel.org/r/20190403022858.97584-1-...@lca.pw
Fixes: 51dedad06b5f ("kasan, slab: make freelist stored without tags")
Signed-off-by: Qian Cai 
Reviewed-by: Andrey Konovalov 
Cc: Christoph Lameter 
Cc: Pekka Enberg 
Cc: David Rientjes 
Cc: Joonsoo Kim 
Cc: Andrey Ryabinin 
Cc: Alexander Potapenko 
Cc: Dmitry Vyukov 
Signed-off-by: Andrew Morton 
Signed-off-by: Linus Torvalds 
Signed-off-by: Sasha Levin 
---
 mm/slab.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/mm/slab.c b/mm/slab.c
index 2f2aa8eaf7d9..516df2d854ef 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2371,7 +2371,6 @@ static void *alloc_slabmgmt(struct kmem_cache *cachep,
/* Slab management obj is off-slab. */
freelist = kmem_cache_alloc_node(cachep->freelist_cache,
  local_flags, nodeid);
-   freelist = kasan_reset_tag(freelist);
if (!freelist)
   

[PATCH AUTOSEL 5.0 68/99] s390: ctcm: fix ctcm_new_device error return code

2019-05-06 Thread Sasha Levin
From: Arnd Bergmann 

[ Upstream commit 27b141fc234a3670d21bd742c35d7205d03cbb3a ]

clang points out that the return code from this function is
undefined for one of the error paths:

../drivers/s390/net/ctcm_main.c:1595:7: warning: variable 'result' is used 
uninitialized whenever 'if' condition is true
  [-Wsometimes-uninitialized]
if (priv->channel[direction] == NULL) {
^~~~
../drivers/s390/net/ctcm_main.c:1638:9: note: uninitialized use occurs here
return result;
   ^~
../drivers/s390/net/ctcm_main.c:1595:3: note: remove the 'if' if its condition 
is always false
if (priv->channel[direction] == NULL) {
^~~
../drivers/s390/net/ctcm_main.c:1539:12: note: initialize the variable 'result' 
to silence this warning
int result;
  ^

Make it return -ENODEV here, as in the related failure cases.
gcc has a known bug in underreporting some of these warnings
when it has already eliminated the assignment of the return code
based on some earlier optimization step.

Reviewed-by: Nathan Chancellor 
Signed-off-by: Arnd Bergmann 
Signed-off-by: Julian Wiedmann 
Signed-off-by: David S. Miller 
Signed-off-by: Sasha Levin 
---
 drivers/s390/net/ctcm_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c
index 7617d21cb296..f63c5c871d3d 100644
--- a/drivers/s390/net/ctcm_main.c
+++ b/drivers/s390/net/ctcm_main.c
@@ -1595,6 +1595,7 @@ static int ctcm_new_device(struct ccwgroup_device *cgdev)
if (priv->channel[direction] == NULL) {
if (direction == CTCM_WRITE)
channel_free(priv->channel[CTCM_READ]);
+   result = -ENODEV;
goto out_dev;
}
priv->channel[direction]->netdev = dev;
-- 
2.20.1



[PATCH AUTOSEL 5.0 67/99] IB/mlx5: Fix scatter to CQE in DCT QP creation

2019-05-06 Thread Sasha Levin
From: Guy Levi 

[ Upstream commit 7249c8ea227a582c14f63e9e8853eb7369122f10 ]

When scatter to CQE is enabled on a DCT QP it corrupts the mailbox command
since it tried to treat it as as QP create mailbox command instead of a
DCT create command.

The corrupted mailbox command causes userspace to malfunction as the
device doesn't create the QP as expected.

A new mlx5 capability is exposed to user-space which ensures that it will
not enable the feature on DCT without this fix in the kernel.

Fixes: 5d6ff1babe78 ("IB/mlx5: Support scatter to CQE for DC transport type")
Signed-off-by: Guy Levi 
Signed-off-by: Leon Romanovsky 
Signed-off-by: Jason Gunthorpe 
Signed-off-by: Sasha Levin 
---
 drivers/infiniband/hw/mlx5/main.c |  2 ++
 drivers/infiniband/hw/mlx5/qp.c   | 11 +++
 include/uapi/rdma/mlx5-abi.h  |  1 +
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/main.c 
b/drivers/infiniband/hw/mlx5/main.c
index 497181f5ba09..c6bdd0d16c4b 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -1025,6 +1025,8 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,
if (MLX5_CAP_GEN(mdev, qp_packet_based))
resp.flags |=
MLX5_IB_QUERY_DEV_RESP_PACKET_BASED_CREDIT_MODE;
+
+   resp.flags |= MLX5_IB_QUERY_DEV_RESP_FLAGS_SCAT2CQE_DCT;
}
 
if (field_avail(typeof(resp), sw_parsing_caps,
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 7db778d96ef5..afc88e6e172e 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -1724,13 +1724,16 @@ static void configure_responder_scat_cqe(struct 
ib_qp_init_attr *init_attr,
 
rcqe_sz = mlx5_ib_get_cqe_size(init_attr->recv_cq);
 
-   if (rcqe_sz == 128) {
-   MLX5_SET(qpc, qpc, cs_res, MLX5_RES_SCAT_DATA64_CQE);
+   if (init_attr->qp_type == MLX5_IB_QPT_DCT) {
+   if (rcqe_sz == 128)
+   MLX5_SET(dctc, qpc, cs_res, MLX5_RES_SCAT_DATA64_CQE);
+
return;
}
 
-   if (init_attr->qp_type != MLX5_IB_QPT_DCT)
-   MLX5_SET(qpc, qpc, cs_res, MLX5_RES_SCAT_DATA32_CQE);
+   MLX5_SET(qpc, qpc, cs_res,
+rcqe_sz == 128 ? MLX5_RES_SCAT_DATA64_CQE :
+ MLX5_RES_SCAT_DATA32_CQE);
 }
 
 static void configure_requester_scat_cqe(struct mlx5_ib_dev *dev,
diff --git a/include/uapi/rdma/mlx5-abi.h b/include/uapi/rdma/mlx5-abi.h
index 87b3198f4b5d..f4d4010b7e3e 100644
--- a/include/uapi/rdma/mlx5-abi.h
+++ b/include/uapi/rdma/mlx5-abi.h
@@ -238,6 +238,7 @@ enum mlx5_ib_query_dev_resp_flags {
MLX5_IB_QUERY_DEV_RESP_FLAGS_CQE_128B_COMP = 1 << 0,
MLX5_IB_QUERY_DEV_RESP_FLAGS_CQE_128B_PAD  = 1 << 1,
MLX5_IB_QUERY_DEV_RESP_PACKET_BASED_CREDIT_MODE = 1 << 2,
+   MLX5_IB_QUERY_DEV_RESP_FLAGS_SCAT2CQE_DCT = 1 << 3,
 };
 
 enum mlx5_ib_tunnel_offloads {
-- 
2.20.1



[PATCH AUTOSEL 5.0 66/99] MIPS: perf: ath79: Fix perfcount IRQ assignment

2019-05-06 Thread Sasha Levin
From: Petr Štetiar 

[ Upstream commit a1e8783db8e0d58891681bc1e6d9ada66eae8e20 ]

Currently it's not possible to use perf on ath79 due to genirq flags
mismatch happening on static virtual IRQ 13 which is used for
performance counters hardware IRQ 5.

On TP-Link Archer C7v5:

   CPU0
  2:  0  MIPS   2  ath9k
  4:318  MIPS   4  1900.eth
  7:  55034  MIPS   7  timer
  8:   1236  MISC   3  ttyS0
 12:  0  INTC   1  ehci_hcd:usb1
 13:  0  gpio-ath79   2  keys
 14:  0  gpio-ath79   5  keys
 15: 31  AR724X PCI1  ath10k_pci

 $ perf top
 genirq: Flags mismatch irq 13. 00014c83 (mips_perf_pmu) vs. 2003 (keys)

On TP-Link Archer C7v4:

 CPU0
  4:  0  MIPS   4  1900.eth
  5:   7135  MIPS   5  1a00.eth
  7:  98379  MIPS   7  timer
  8: 30  MISC   3  ttyS0
 12:  90028  INTC   0  ath9k
 13:   5520  INTC   1  ehci_hcd:usb1
 14:   4623  INTC   2  ehci_hcd:usb2
 15:  32844  AR724X PCI1  ath10k_pci
 16:  0  gpio-ath79  16  keys
 23:  0  gpio-ath79  23  keys

 $ perf top
 genirq: Flags mismatch irq 13. 00014c80 (mips_perf_pmu) vs. 0080 
(ehci_hcd:usb1)

This problem is happening, because currently statically assigned virtual
IRQ 13 for performance counters is not claimed during the initialization
of MIPS PMU during the bootup, so the IRQ subsystem doesn't know, that
this interrupt isn't available for further use.

So this patch fixes the issue by simply booking hardware IRQ 5 for MIPS PMU.

Tested-by: Kevin 'ldir' Darbyshire-Bryant 
Signed-off-by: Petr Štetiar 
Acked-by: John Crispin 
Acked-by: Marc Zyngier 
Signed-off-by: Paul Burton 
Cc: linux-m...@vger.kernel.org
Cc: Ralf Baechle 
Cc: James Hogan 
Cc: Thomas Gleixner 
Cc: Jason Cooper 
Signed-off-by: Sasha Levin 
---
 arch/mips/ath79/setup.c  |  6 --
 drivers/irqchip/irq-ath79-misc.c | 11 +++
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/arch/mips/ath79/setup.c b/arch/mips/ath79/setup.c
index 9728abcb18fa..c04ae685003f 100644
--- a/arch/mips/ath79/setup.c
+++ b/arch/mips/ath79/setup.c
@@ -211,12 +211,6 @@ const char *get_system_type(void)
return ath79_sys_type;
 }
 
-int get_c0_perfcount_int(void)
-{
-   return ATH79_MISC_IRQ(5);
-}
-EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
-
 unsigned int get_c0_compare_int(void)
 {
return CP0_LEGACY_COMPARE_IRQ;
diff --git a/drivers/irqchip/irq-ath79-misc.c b/drivers/irqchip/irq-ath79-misc.c
index aa7290784636..0390603170b4 100644
--- a/drivers/irqchip/irq-ath79-misc.c
+++ b/drivers/irqchip/irq-ath79-misc.c
@@ -22,6 +22,15 @@
 #define AR71XX_RESET_REG_MISC_INT_ENABLE   4
 
 #define ATH79_MISC_IRQ_COUNT   32
+#define ATH79_MISC_PERF_IRQ5
+
+static int ath79_perfcount_irq;
+
+int get_c0_perfcount_int(void)
+{
+   return ath79_perfcount_irq;
+}
+EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
 
 static void ath79_misc_irq_handler(struct irq_desc *desc)
 {
@@ -113,6 +122,8 @@ static void __init ath79_misc_intc_domain_init(
 {
void __iomem *base = domain->host_data;
 
+   ath79_perfcount_irq = irq_create_mapping(domain, ATH79_MISC_PERF_IRQ);
+
/* Disable and clear all interrupts */
__raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_ENABLE);
__raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_STATUS);
-- 
2.20.1



[PATCH AUTOSEL 5.0 76/99] dmaengine: bcm2835: Avoid GFP_KERNEL in device_prep_slave_sg

2019-05-06 Thread Sasha Levin
From: Stefan Wahren 

[ Upstream commit f147384774a7b24dda4783a3dcd61af272757ea8 ]

The commit af19b7ce76ba ("mmc: bcm2835: Avoid possible races on
data requests") introduces a possible circular locking dependency,
which is triggered by swapping to the sdhost interface.

So instead of reintroduce the race condition again, we could also
avoid this situation by using GFP_NOWAIT for the allocation of the
DMA buffer descriptors.

Reported-by: Aaro Koskinen 
Signed-off-by: Stefan Wahren 
Fixes: af19b7ce76ba ("mmc: bcm2835: Avoid possible races on data requests")
Link: 
http://lists.infradead.org/pipermail/linux-rpi-kernel/2019-March/008615.html
Signed-off-by: Vinod Koul 
Signed-off-by: Sasha Levin 
---
 drivers/dma/bcm2835-dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c
index ae10f5614f95..bf5119203637 100644
--- a/drivers/dma/bcm2835-dma.c
+++ b/drivers/dma/bcm2835-dma.c
@@ -674,7 +674,7 @@ static struct dma_async_tx_descriptor 
*bcm2835_dma_prep_slave_sg(
d = bcm2835_dma_create_cb_chain(chan, direction, false,
info, extra,
frames, src, dst, 0, 0,
-   GFP_KERNEL);
+   GFP_NOWAIT);
if (!d)
return NULL;
 
-- 
2.20.1



[PATCH AUTOSEL 5.0 74/99] netfilter: never get/set skb->tstamp

2019-05-06 Thread Sasha Levin
From: Florian Westphal 

[ Upstream commit 916f6efae62305796e012e7c3a7884a267cbacbf ]

setting net.netfilter.nf_conntrack_timestamp=1 breaks xmit with fq
scheduler.  skb->tstamp might be "refreshed" using ktime_get_real(),
but fq expects CLOCK_MONOTONIC.

This patch removes all places in netfilter that check/set skb->tstamp:

1. To fix the bogus "start" time seen with conntrack timestamping for
   outgoing packets, never use skb->tstamp and always use current time.
2. In nfqueue and nflog, only use skb->tstamp for incoming packets,
   as determined by current hook (prerouting, input, forward).
3. xt_time has to use system clock as well rather than skb->tstamp.
   We could still use skb->tstamp for prerouting/input/foward, but
   I see no advantage to make this conditional.

Fixes: fb420d5d91c1 ("tcp/fq: move back to CLOCK_MONOTONIC")
Cc: Eric Dumazet 
Reported-by: Michal Soltys 
Signed-off-by: Florian Westphal 
Acked-by: Eric Dumazet 
Signed-off-by: Pablo Neira Ayuso 
Signed-off-by: Sasha Levin 
---
 net/netfilter/nf_conntrack_core.c |  7 ++-
 net/netfilter/nfnetlink_log.c |  2 +-
 net/netfilter/nfnetlink_queue.c   |  2 +-
 net/netfilter/xt_time.c   | 23 ++-
 4 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/net/netfilter/nf_conntrack_core.c 
b/net/netfilter/nf_conntrack_core.c
index 1982faf21ebb..d7ac2f82bb6d 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -983,12 +983,9 @@ __nf_conntrack_confirm(struct sk_buff *skb)
 
/* set conntrack timestamp, if enabled. */
tstamp = nf_conn_tstamp_find(ct);
-   if (tstamp) {
-   if (skb->tstamp == 0)
-   __net_timestamp(skb);
+   if (tstamp)
+   tstamp->start = ktime_get_real_ns();
 
-   tstamp->start = ktime_to_ns(skb->tstamp);
-   }
/* Since the lookup is lockless, hash insertion must be done after
 * starting the timer and setting the CONFIRMED bit. The RCU barriers
 * guarantee that no other CPU can find the conntrack before the above
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index b1f9c5303f02..0b3347570265 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -540,7 +540,7 @@ __build_packet_message(struct nfnl_log_net *log,
goto nla_put_failure;
}
 
-   if (skb->tstamp) {
+   if (hooknum <= NF_INET_FORWARD && skb->tstamp) {
struct nfulnl_msg_packet_timestamp ts;
struct timespec64 kts = ktime_to_timespec64(skb->tstamp);
ts.sec = cpu_to_be64(kts.tv_sec);
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index 0dcc3592d053..e057b2961d31 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -582,7 +582,7 @@ nfqnl_build_packet_message(struct net *net, struct 
nfqnl_instance *queue,
if (nfqnl_put_bridge(entry, skb) < 0)
goto nla_put_failure;
 
-   if (entskb->tstamp) {
+   if (entry->state.hook <= NF_INET_FORWARD && entskb->tstamp) {
struct nfqnl_msg_packet_timestamp ts;
struct timespec64 kts = ktime_to_timespec64(entskb->tstamp);
 
diff --git a/net/netfilter/xt_time.c b/net/netfilter/xt_time.c
index c13bcd0ab491..8dbb4d48f2ed 100644
--- a/net/netfilter/xt_time.c
+++ b/net/netfilter/xt_time.c
@@ -163,19 +163,24 @@ time_mt(const struct sk_buff *skb, struct xt_action_param 
*par)
s64 stamp;
 
/*
-* We cannot use get_seconds() instead of __net_timestamp() here.
+* We need real time here, but we can neither use skb->tstamp
+* nor __net_timestamp().
+*
+* skb->tstamp and skb->skb_mstamp_ns overlap, however, they
+* use different clock types (real vs monotonic).
+*
 * Suppose you have two rules:
-*  1. match before 13:00
-*  2. match after 13:00
+*  1. match before 13:00
+*  2. match after 13:00
+*
 * If you match against processing time (get_seconds) it
 * may happen that the same packet matches both rules if
-* it arrived at the right moment before 13:00.
+* it arrived at the right moment before 13:00, so it would be
+* better to check skb->tstamp and set it via __net_timestamp()
+* if needed.  This however breaks outgoing packets tx timestamp,
+* and causes them to get delayed forever by fq packet scheduler.
 */
-   if (skb->tstamp == 0)
-   __net_timestamp((struct sk_buff *)skb);
-
-   stamp = ktime_to_ns(skb->tstamp);
-   stamp = div_s64(stamp, NSEC_PER_SEC);
+   stamp = get_seconds();
 
if (info->flags & XT_TIME_LOCAL_TZ)
/* Adjust for local timezone */
-- 
2.20.1



[PATCH AUTOSEL 5.0 77/99] arm64/module: ftrace: deal with place relative nature of PLTs

2019-05-06 Thread Sasha Levin
From: Ard Biesheuvel 

[ Upstream commit 4e69ecf4da1ee0b2ac735e1f1bb13935acd5a38d ]

Another bodge for the ftrace PLT code: plt_entries_equal() now takes
the place relative nature of the ADRP/ADD based PLT entries into
account, which means that a struct trampoline instance on the stack
is no longer equal to the same set of opcodes in the module struct,
given that they don't point to the same place in memory anymore.

Work around this by using memcmp() in the ftrace PLT handling code.

Acked-by: Will Deacon 
Tested-by: dann frazier 
Signed-off-by: Ard Biesheuvel 
Signed-off-by: Catalin Marinas 
Signed-off-by: Sasha Levin 
---
 arch/arm64/kernel/ftrace.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
index 07b298120182..65a51331088e 100644
--- a/arch/arm64/kernel/ftrace.c
+++ b/arch/arm64/kernel/ftrace.c
@@ -103,10 +103,15 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned 
long addr)
 * to be revisited if support for multiple ftrace entry points
 * is added in the future, but for now, the pr_err() below
 * deals with a theoretical issue only.
+*
+* Note that PLTs are place relative, and plt_entries_equal()
+* checks whether they point to the same target. Here, we need
+* to check if the actual opcodes are in fact identical,
+* regardless of the offset in memory so use memcmp() instead.
 */
trampoline = get_plt_entry(addr, mod->arch.ftrace_trampoline);
-   if (!plt_entries_equal(mod->arch.ftrace_trampoline,
-  &trampoline)) {
+   if (memcmp(mod->arch.ftrace_trampoline, &trampoline,
+  sizeof(trampoline))) {
if 
(plt_entry_is_initialized(mod->arch.ftrace_trampoline)) {
pr_err("ftrace: far branches to multiple entry 
points unsupported inside a single module\n");
return -EINVAL;
-- 
2.20.1



[PATCH AUTOSEL 5.0 79/99] drm/imx: don't skip DP channel disable for background plane

2019-05-06 Thread Sasha Levin
From: Lucas Stach 

[ Upstream commit 7bcde275eb1d0ac8793c77c7e666a886eb16633d ]

In order to make sure that the plane color space gets reset correctly.

Signed-off-by: Lucas Stach 
Signed-off-by: Philipp Zabel 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/imx/ipuv3-crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c
index 058b53c0aa7e..1bb3e598cb84 100644
--- a/drivers/gpu/drm/imx/ipuv3-crtc.c
+++ b/drivers/gpu/drm/imx/ipuv3-crtc.c
@@ -70,7 +70,7 @@ static void ipu_crtc_disable_planes(struct ipu_crtc *ipu_crtc,
if (disable_partial)
ipu_plane_disable(ipu_crtc->plane[1], true);
if (disable_full)
-   ipu_plane_disable(ipu_crtc->plane[0], false);
+   ipu_plane_disable(ipu_crtc->plane[0], true);
 }
 
 static void ipu_crtc_atomic_disable(struct drm_crtc *crtc,
-- 
2.20.1



[PATCH AUTOSEL 5.0 84/99] ceph: handle the case where a dentry has been renamed on outstanding req

2019-05-06 Thread Sasha Levin
From: Jeff Layton 

[ Upstream commit 4b8222870032715f9d995f3eb7c7acd8379a275d ]

It's possible for us to issue a lookup to revalidate a dentry
concurrently with a rename. If done in the right order, then we could
end up processing dentry info in the reply that no longer reflects the
state of the dentry.

If req->r_dentry->d_name differs from the one in the trace, then just
ignore the trace in the reply. We only need to do this however if the
parent's i_rwsem is not held.

Signed-off-by: Jeff Layton 
Reviewed-by: "Yan, Zheng" 
Signed-off-by: Ilya Dryomov 
Signed-off-by: Sasha Levin 
---
 fs/ceph/inode.c | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 9d1f34d46627..5880ee20ada4 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -1152,6 +1152,19 @@ static int splice_dentry(struct dentry **pdn, struct 
inode *in)
return 0;
 }
 
+static int d_name_cmp(struct dentry *dentry, const char *name, size_t len)
+{
+   int ret;
+
+   /* take d_lock to ensure dentry->d_name stability */
+   spin_lock(&dentry->d_lock);
+   ret = dentry->d_name.len - len;
+   if (!ret)
+   ret = memcmp(dentry->d_name.name, name, len);
+   spin_unlock(&dentry->d_lock);
+   return ret;
+}
+
 /*
  * Incorporate results into the local cache.  This is either just
  * one inode, or a directory, dentry, and possibly linked-to inode (e.g.,
@@ -1401,7 +1414,8 @@ int ceph_fill_trace(struct super_block *sb, struct 
ceph_mds_request *req)
err = splice_dentry(&req->r_dentry, in);
if (err < 0)
goto done;
-   } else if (rinfo->head->is_dentry) {
+   } else if (rinfo->head->is_dentry &&
+  !d_name_cmp(req->r_dentry, rinfo->dname, rinfo->dname_len)) {
struct ceph_vino *ptvino = NULL;
 
if ((le32_to_cpu(rinfo->diri.in->cap.caps) & 
CEPH_CAP_FILE_SHARED) ||
-- 
2.20.1



[PATCH AUTOSEL 5.0 88/99] Input: snvs_pwrkey - make it depend on ARCH_MXC

2019-05-06 Thread Sasha Levin
From: Jacky Bai 

[ Upstream commit f06eba72274788db6a43012a05a99915c0283aef ]

The SNVS power key is not only used on i.MX6SX and i.MX7D, it is also
used by i.MX6UL and NXP's latest ARMv8 based i.MX8M series SOC. So
update the config dependency to use ARCH_MXC, and add the COMPILE_TEST
too.

Signed-off-by: Jacky Bai 
Reviewed-by: Dong Aisheng 
Signed-off-by: Dmitry Torokhov 
Signed-off-by: Sasha Levin 
---
 drivers/input/keyboard/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index a878351f1643..52d7f55fca32 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -420,7 +420,7 @@ config KEYBOARD_MPR121
 
 config KEYBOARD_SNVS_PWRKEY
tristate "IMX SNVS Power Key Driver"
-   depends on SOC_IMX6SX || SOC_IMX7D
+   depends on ARCH_MXC || COMPILE_TEST
depends on OF
help
  This is the snvs powerkey driver for the Freescale i.MX application
-- 
2.20.1



[PATCH AUTOSEL 5.0 94/99] mm/memory_hotplug.c: drop memory device reference after find_memory_block()

2019-05-06 Thread Sasha Levin
From: David Hildenbrand 

[ Upstream commit 89c02e69fc5245f8a2f34b58b42d43a737af1a5e ]

Right now we are using find_memory_block() to get the node id for the
pfn range to online.  We are missing to drop a reference to the memory
block device.  While the device still gets unregistered via
device_unregister(), resulting in no user visible problem, the device is
never released via device_release(), resulting in a memory leak.  Fix
that by properly using a put_device().

Link: http://lkml.kernel.org/r/2019040955.1430-1-da...@redhat.com
Fixes: d0dc12e86b31 ("mm/memory_hotplug: optimize memory hotplug")
Signed-off-by: David Hildenbrand 
Reviewed-by: Oscar Salvador 
Reviewed-by: Wei Yang 
Acked-by: Michal Hocko 
Acked-by: Pankaj Gupta 
Cc: David Hildenbrand 
Cc: Pavel Tatashin 
Cc: Qian Cai 
Cc: Arun KS 
Cc: Mathieu Malaterre 
Signed-off-by: Andrew Morton 
Signed-off-by: Linus Torvalds 
Signed-off-by: Sasha Levin 
---
 mm/memory_hotplug.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 11593a03c051..7493f50ee880 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -858,6 +858,7 @@ int __ref online_pages(unsigned long pfn, unsigned long 
nr_pages, int online_typ
 */
mem = find_memory_block(__pfn_to_section(pfn));
nid = mem->nid;
+   put_device(&mem->dev);
 
/* associate pfn range with the zone */
zone = move_pfn_range(online_type, nid, pfn, nr_pages);
-- 
2.20.1



[PATCH AUTOSEL 5.0 91/99] gpio: Fix gpiochip_add_data_with_key() error path

2019-05-06 Thread Sasha Levin
From: Geert Uytterhoeven 

[ Upstream commit 357798909164bf423eac6a78ff7da7e98d2d7f7f ]

The err_remove_chip block is too coarse, and may perform cleanup that
must not be done.  E.g. if of_gpiochip_add() fails, of_gpiochip_remove()
is still called, causing:

OF: ERROR: Bad of_node_put() on /soc/gpio@e605
CPU: 1 PID: 20 Comm: kworker/1:1 Not tainted 5.1.0-rc2-koelsch+ #407
Hardware name: Generic R-Car Gen2 (Flattened Device Tree)
Workqueue: events deferred_probe_work_func
[] (unwind_backtrace) from [] (show_stack+0x10/0x14)
[] (show_stack) from [] (dump_stack+0x7c/0x9c)
[] (dump_stack) from [] (kobject_put+0x94/0xbc)
[] (kobject_put) from [] 
(gpiochip_add_data_with_key+0x8d8/0xa3c)
[] (gpiochip_add_data_with_key) from [] 
(gpio_rcar_probe+0x1d4/0x314)
[] (gpio_rcar_probe) from [] 
(platform_drv_probe+0x48/0x94)

and later, if a GPIO consumer tries to use a GPIO from a failed
controller:

WARNING: CPU: 0 PID: 1 at lib/refcount.c:156 kobject_get+0x38/0x4c
refcount_t: increment on 0; use-after-free.
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.1.0-rc2-koelsch+ #407
Hardware name: Generic R-Car Gen2 (Flattened Device Tree)
[] (unwind_backtrace) from [] (show_stack+0x10/0x14)
[] (show_stack) from [] (dump_stack+0x7c/0x9c)
[] (dump_stack) from [] (__warn+0xd0/0xec)
[] (__warn) from [] (warn_slowpath_fmt+0x44/0x6c)
[] (warn_slowpath_fmt) from [] (kobject_get+0x38/0x4c)
[] (kobject_get) from [] (of_node_get+0x14/0x1c)
[] (of_node_get) from [] 
(of_find_node_by_phandle+0xc0/0xf0)
[] (of_find_node_by_phandle) from [] 
(of_phandle_iterator_next+0x68/0x154)
[] (of_phandle_iterator_next) from [] 
(__of_parse_phandle_with_args+0x40/0xd0)
[] (__of_parse_phandle_with_args) from [] 
(of_parse_phandle_with_args_map+0x100/0x3ac)
[] (of_parse_phandle_with_args_map) from [] 
(of_get_named_gpiod_flags+0x38/0x380)
[] (of_get_named_gpiod_flags) from [] 
(gpiod_get_from_of_node+0x24/0xd8)
[] (gpiod_get_from_of_node) from [] 
(devm_fwnode_get_index_gpiod_from_child+0xa0/0x144)
[] (devm_fwnode_get_index_gpiod_from_child) from [] 
(gpio_keys_probe+0x418/0x7bc)
[] (gpio_keys_probe) from [] 
(platform_drv_probe+0x48/0x94)

Fix this by splitting the cleanup block, and adding a missing call to
gpiochip_irqchip_remove().

Fixes: 28355f81969962cf ("gpio: defer probe if pinctrl cannot be found")
Signed-off-by: Geert Uytterhoeven 
Reviewed-by: Mukesh Ojha 
Signed-off-by: Linus Walleij 
Signed-off-by: Sasha Levin 
---
 drivers/gpio/gpiolib.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index d1adfdf50fb3..34fbf879411f 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1379,7 +1379,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, 
void *data,
 
status = gpiochip_add_irqchip(chip, lock_key, request_key);
if (status)
-   goto err_remove_chip;
+   goto err_free_gpiochip_mask;
 
status = of_gpiochip_add(chip);
if (status)
@@ -1387,7 +1387,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, 
void *data,
 
status = gpiochip_init_valid_mask(chip);
if (status)
-   goto err_remove_chip;
+   goto err_remove_of_chip;
 
for (i = 0; i < chip->ngpio; i++) {
struct gpio_desc *desc = &gdev->descs[i];
@@ -1415,14 +1415,18 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, 
void *data,
if (gpiolib_initialized) {
status = gpiochip_setup_dev(gdev);
if (status)
-   goto err_remove_chip;
+   goto err_remove_acpi_chip;
}
return 0;
 
-err_remove_chip:
+err_remove_acpi_chip:
acpi_gpiochip_remove(chip);
+err_remove_of_chip:
gpiochip_free_hogs(chip);
of_gpiochip_remove(chip);
+err_remove_chip:
+   gpiochip_irqchip_remove(chip);
+err_free_gpiochip_mask:
gpiochip_free_valid_mask(chip);
 err_remove_irqchip_mask:
gpiochip_irqchip_free_valid_mask(chip);
-- 
2.20.1



[PATCH AUTOSEL 5.0 95/99] mm/page_alloc.c: avoid potential NULL pointer dereference

2019-05-06 Thread Sasha Levin
From: Andrey Ryabinin 

[ Upstream commit 8139ad043d632c0e9e12d760068a7a8e91659aa1 ]

ac.preferred_zoneref->zone passed to alloc_flags_nofragment() can be NULL.
'zone' pointer unconditionally derefernced in alloc_flags_nofragment().
Bail out on NULL zone to avoid potential crash.  Currently we don't see
any crashes only because alloc_flags_nofragment() has another bug which
allows compiler to optimize away all accesses to 'zone'.

Link: http://lkml.kernel.org/r/20190423120806.3503-1-aryabi...@virtuozzo.com
Fixes: 6bb154504f8b ("mm, page_alloc: spread allocations across zones before 
introducing fragmentation")
Signed-off-by: Andrey Ryabinin 
Acked-by: Mel Gorman 
Signed-off-by: Andrew Morton 
Signed-off-by: Linus Torvalds 
Signed-off-by: Sasha Levin 
---
 mm/page_alloc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index eedb57f9b40b..d59be95ba45c 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3385,6 +3385,9 @@ alloc_flags_nofragment(struct zone *zone, gfp_t gfp_mask)
alloc_flags |= ALLOC_KSWAPD;
 
 #ifdef CONFIG_ZONE_DMA32
+   if (!zone)
+   return alloc_flags;
+
if (zone_idx(zone) != ZONE_NORMAL)
goto out;
 
-- 
2.20.1



[PATCH 1/2] x86/boot: move early_serial_base to .data section

2019-05-06 Thread Pingfan Liu
arch/x86/boot/compressed/head_64.S clears BSS after relocated. If early
serial is set up before clearing BSS, the early_serial_base will be reset
to 0.

Initializing early_serial_base as -1 to push it to .data section.

Signed-off-by: Pingfan Liu 
Cc: Thomas Gleixner 
Cc: Ingo Molnar 
Cc: Borislav Petkov 
Cc: "H. Peter Anvin" 
Cc: Jordan Borgner 
Cc: linux-kernel@vger.kernel.org
---
 arch/x86/boot/compressed/early_serial_console.c | 2 +-
 arch/x86/boot/early_serial_console.c| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/boot/compressed/early_serial_console.c 
b/arch/x86/boot/compressed/early_serial_console.c
index 261e81f..624e334 100644
--- a/arch/x86/boot/compressed/early_serial_console.c
+++ b/arch/x86/boot/compressed/early_serial_console.c
@@ -1,5 +1,5 @@
 #include "misc.h"
 
-int early_serial_base;
+int early_serial_base = -1;
 
 #include "../early_serial_console.c"
diff --git a/arch/x86/boot/early_serial_console.c 
b/arch/x86/boot/early_serial_console.c
index 023bf1c..d8de15a 100644
--- a/arch/x86/boot/early_serial_console.c
+++ b/arch/x86/boot/early_serial_console.c
@@ -149,6 +149,6 @@ void console_init(void)
 {
parse_earlyprintk();
 
-   if (!early_serial_base)
+   if (early_serial_base <= 0)
parse_console_uart8250();
 }
-- 
2.7.4



[PATCH AUTOSEL 5.0 98/99] net: mvpp2: fix validate for PPv2.1

2019-05-06 Thread Sasha Levin
From: Antoine Tenart 

[ Upstream commit 8b318f30ab4ef9bbc1241e6f8c1db366dbd347f2 ]

The Phylink validate function is the Marvell PPv2 driver makes a check
on the GoP id. This is valid an has to be done when using PPv2.2 engines
but makes no sense when using PPv2.1. The check done when using an RGMII
interface makes sure the GoP id is not 0, but this breaks PPv2.1. Fixes
it.

Fixes: 0fb628f0f250 ("net: mvpp2: fix phylink handling of invalid PHY modes")
Signed-off-by: Antoine Tenart 
Signed-off-by: David S. Miller 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c 
b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 931beac3359d..70031e2b2294 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -4370,7 +4370,7 @@ static void mvpp2_phylink_validate(struct net_device *dev,
case PHY_INTERFACE_MODE_RGMII_ID:
case PHY_INTERFACE_MODE_RGMII_RXID:
case PHY_INTERFACE_MODE_RGMII_TXID:
-   if (port->gop_id == 0)
+   if (port->priv->hw_version == MVPP22 && port->gop_id == 0)
goto empty_set;
break;
default:
-- 
2.20.1



Re: [PATCH] arm64: dts: qcom: qcs404: Add PSCI cpuidle support

2019-05-06 Thread Vinod Koul
On 06-05-19, 21:31, Niklas Cassel wrote:
> Add device bindings for CPUs to suspend using PSCI as the enable-method.
> 
> Signed-off-by: Niklas Cassel 
> ---
>  arch/arm64/boot/dts/qcom/qcs404.dtsi | 15 +++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/qcom/qcs404.dtsi 
> b/arch/arm64/boot/dts/qcom/qcs404.dtsi
> index ffedf9640af7..f9db9f3ee10c 100644
> --- a/arch/arm64/boot/dts/qcom/qcs404.dtsi
> +++ b/arch/arm64/boot/dts/qcom/qcs404.dtsi
> @@ -31,6 +31,7 @@
>   reg = <0x100>;
>   enable-method = "psci";
>   next-level-cache = <&L2_0>;
> + cpu-idle-states = <&CPU_PC>;
>   };
>  
>   CPU1: cpu@101 {
> @@ -39,6 +40,7 @@
>   reg = <0x101>;
>   enable-method = "psci";
>   next-level-cache = <&L2_0>;
> + cpu-idle-states = <&CPU_PC>;
>   };
>  
>   CPU2: cpu@102 {
> @@ -47,6 +49,7 @@
>   reg = <0x102>;
>   enable-method = "psci";
>   next-level-cache = <&L2_0>;
> + cpu-idle-states = <&CPU_PC>;
>   };
>  
>   CPU3: cpu@103 {
> @@ -55,12 +58,24 @@
>   reg = <0x103>;
>   enable-method = "psci";
>   next-level-cache = <&L2_0>;
> + cpu-idle-states = <&CPU_PC>;
>   };
>  
>   L2_0: l2-cache {
>   compatible = "cache";
>   cache-level = <2>;
>   };
> +
> + idle-states {

Since we are trying to sort the file per address and
alphabetically, it would be great if this can be moved before l2-cache
:)

Other than that this lgtm
 
> + CPU_PC: pc {
> + compatible = "arm,idle-state";
> + arm,psci-suspend-param = <0x4003>;
> + entry-latency-us = <125>;
> + exit-latency-us = <180>;
> + min-residency-us = <595>;
> + local-timer-stop;
> + };
> + };
>   };
>  
>   firmware {
> -- 
> 2.21.0

-- 
~Vinod


[PATCH AUTOSEL 4.19 02/81] iio: adc: xilinx: fix potential use-after-free on probe

2019-05-06 Thread Sasha Levin
From: Sven Van Asbroeck 

[ Upstream commit 862e4644fd2d7df8998edc65e0963ea2f567bde9 ]

If probe errors out after request_irq(), its error path
does not explicitly cancel the delayed work, which may
have been scheduled by the interrupt handler.

This means the delayed work may still be running when
the core frees the private structure (struct xadc).
This is a potential use-after-free.

Fix by inserting cancel_delayed_work_sync() in the probe
error path.

Signed-off-by: Sven Van Asbroeck 
Signed-off-by: Jonathan Cameron 
Signed-off-by: Sasha Levin 
---
 drivers/iio/adc/xilinx-xadc-core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iio/adc/xilinx-xadc-core.c 
b/drivers/iio/adc/xilinx-xadc-core.c
index 1960694e8007..15e1a103f37d 100644
--- a/drivers/iio/adc/xilinx-xadc-core.c
+++ b/drivers/iio/adc/xilinx-xadc-core.c
@@ -1290,6 +1290,7 @@ static int xadc_probe(struct platform_device *pdev)
 
 err_free_irq:
free_irq(xadc->irq, indio_dev);
+   cancel_delayed_work_sync(&xadc->zynq_unmask_work);
 err_clk_disable_unprepare:
clk_disable_unprepare(xadc->clk);
 err_free_samplerate_trigger:
-- 
2.20.1



[PATCH AUTOSEL 4.19 04/81] acpi/nfit: Always dump _DSM output payload

2019-05-06 Thread Sasha Levin
From: Dan Williams 

[ Upstream commit 351f339faa308c1c1461314a18c832239a841ca0 ]

The dynamic-debug statements for command payload output only get emitted
when the command is not ND_CMD_CALL. Move the output payload dumping
ahead of the early return path for ND_CMD_CALL.

Fixes: 31eca76ba2fc9 ("...whitelisted dimm command marshaling mechanism")
Reported-by: Vishal Verma 
Signed-off-by: Dan Williams 
Signed-off-by: Sasha Levin 
---
 drivers/acpi/nfit/core.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index 925dbc751322..8340c81b258b 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -542,6 +542,12 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, 
struct nvdimm *nvdimm,
goto out;
}
 
+   dev_dbg(dev, "%s cmd: %s output length: %d\n", dimm_name,
+   cmd_name, out_obj->buffer.length);
+   print_hex_dump_debug(cmd_name, DUMP_PREFIX_OFFSET, 4, 4,
+   out_obj->buffer.pointer,
+   min_t(u32, 128, out_obj->buffer.length), true);
+
if (call_pkg) {
call_pkg->nd_fw_size = out_obj->buffer.length;
memcpy(call_pkg->nd_payload + call_pkg->nd_size_in,
@@ -560,12 +566,6 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, 
struct nvdimm *nvdimm,
return 0;
}
 
-   dev_dbg(dev, "%s cmd: %s output length: %d\n", dimm_name,
-   cmd_name, out_obj->buffer.length);
-   print_hex_dump_debug(cmd_name, DUMP_PREFIX_OFFSET, 4, 4,
-   out_obj->buffer.pointer,
-   min_t(u32, 128, out_obj->buffer.length), true);
-
for (i = 0, offset = 0; i < desc->out_num; i++) {
u32 out_size = nd_cmd_out_size(nvdimm, cmd, desc, i, buf,
(u32 *) out_obj->buffer.pointer,
-- 
2.20.1



[PATCH 2/2] x86/boot: push console_init forward

2019-05-06 Thread Pingfan Liu
At the very early boot stage, early console is badly needed. Push its
initialization as early as possible, just after stack is ready.

Signed-off-by: Pingfan Liu 
Cc: Thomas Gleixner 
Cc: Ingo Molnar 
Cc: Borislav Petkov 
Cc: "H. Peter Anvin" 
Cc: Jordan Borgner 
Cc: linux-kernel@vger.kernel.org
---
 arch/x86/boot/compressed/early_serial_console.c | 7 +++
 arch/x86/boot/compressed/head_64.S  | 4 
 arch/x86/boot/compressed/misc.c | 1 -
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/x86/boot/compressed/early_serial_console.c 
b/arch/x86/boot/compressed/early_serial_console.c
index 624e334..223954a 100644
--- a/arch/x86/boot/compressed/early_serial_console.c
+++ b/arch/x86/boot/compressed/early_serial_console.c
@@ -3,3 +3,10 @@
 int early_serial_base = -1;
 
 #include "../early_serial_console.c"
+
+void early_console_init(void *rmode)
+{
+   boot_params = rmode;
+   console_init();
+   debug_putstr("early console is ready\n");
+}
diff --git a/arch/x86/boot/compressed/head_64.S 
b/arch/x86/boot/compressed/head_64.S
index fafb75c..e4a25f9 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -323,6 +323,10 @@ ENTRY(startup_64)
subq$1b, %rdi
 
calladjust_got
+   pushq   %rsi
+   movq%rsi, %rdi
+   callearly_console_init
+   popq%rsi
 
/*
 * At this point we are in long mode with 4-level paging enabled,
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index cafc6aa..475a3c6 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -368,7 +368,6 @@ asmlinkage __visible void *extract_kernel(void *rmode, 
memptr heap,
lines = boot_params->screen_info.orig_video_lines;
cols = boot_params->screen_info.orig_video_cols;
 
-   console_init();
debug_putstr("early console in extract_kernel\n");
 
free_mem_ptr = heap;/* Heap */
-- 
2.7.4



[PATCH AUTOSEL 4.19 06/81] HID: input: add mapping for Expose/Overview key

2019-05-06 Thread Sasha Levin
From: Dmitry Torokhov 

[ Upstream commit 96dd86871e1fffbc39e4fa61c9c75ec54ee9af0f ]

According to HUTRR77 usage 0x29f from the consumer page is reserved for
the Desktop application to present all running user’s application windows.
Linux defines KEY_SCALE to request Compiz Scale (Expose) mode, so let's
add the mapping.

Signed-off-by: Dmitry Torokhov 
Signed-off-by: Sasha Levin 
---
 drivers/hid/hid-input.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index a3916e58dbf5..150b14623749 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -1025,6 +1025,8 @@ static void hidinput_configure_usage(struct hid_input 
*hidinput, struct hid_fiel
case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT);   break;
case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL);   break;
 
+   case 0x29f: map_key_clear(KEY_SCALE);   break;
+
default: map_key_clear(KEY_UNKNOWN);
}
break;
-- 
2.20.1



[PATCH AUTOSEL 4.19 03/81] iio: adc: xilinx: prevent touching unclocked h/w on remove

2019-05-06 Thread Sasha Levin
From: Sven Van Asbroeck 

[ Upstream commit 2e4b88f73966adead360e47621df0183586fac32 ]

In remove, the clock is disabled before canceling the
delayed work. This means that the delayed work may be
touching unclocked hardware.

Fix by disabling the clock after the delayed work is
fully canceled. This is consistent with the probe error
path order.

Signed-off-by: Sven Van Asbroeck 
Signed-off-by: Jonathan Cameron 
Signed-off-by: Sasha Levin 
---
 drivers/iio/adc/xilinx-xadc-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/xilinx-xadc-core.c 
b/drivers/iio/adc/xilinx-xadc-core.c
index 15e1a103f37d..1ae86e7359f7 100644
--- a/drivers/iio/adc/xilinx-xadc-core.c
+++ b/drivers/iio/adc/xilinx-xadc-core.c
@@ -1320,8 +1320,8 @@ static int xadc_remove(struct platform_device *pdev)
iio_triggered_buffer_cleanup(indio_dev);
}
free_irq(xadc->irq, indio_dev);
-   clk_disable_unprepare(xadc->clk);
cancel_delayed_work_sync(&xadc->zynq_unmask_work);
+   clk_disable_unprepare(xadc->clk);
kfree(xadc->data);
kfree(indio_dev->channels);
 
-- 
2.20.1



[PATCH AUTOSEL 4.19 07/81] HID: input: add mapping for keyboard Brightness Up/Down/Toggle keys

2019-05-06 Thread Sasha Levin
From: Dmitry Torokhov 

[ Upstream commit 7975a1d6a7afeb3eb61c971a153d24dd8fa032f3 ]

According to HUTRR73 usages 0x79, 0x7a and 0x7c from the consumer page
correspond to Brightness Up/Down/Toggle keys, so let's add the mappings.

Signed-off-by: Dmitry Torokhov 
Signed-off-by: Sasha Levin 
---
 drivers/hid/hid-input.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 150b14623749..eeb9ba7e8fc6 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -895,6 +895,10 @@ static void hidinput_configure_usage(struct hid_input 
*hidinput, struct hid_fiel
case 0x074: map_key_clear(KEY_BRIGHTNESS_MAX);  break;
case 0x075: map_key_clear(KEY_BRIGHTNESS_AUTO); break;
 
+   case 0x079: map_key_clear(KEY_KBDILLUMUP);  break;
+   case 0x07a: map_key_clear(KEY_KBDILLUMDOWN);break;
+   case 0x07c: map_key_clear(KEY_KBDILLUMTOGGLE);  break;
+
case 0x082: map_key_clear(KEY_VIDEO_NEXT);  break;
case 0x083: map_key_clear(KEY_LAST);break;
case 0x084: map_key_clear(KEY_ENTER);   break;
-- 
2.20.1



[PATCH AUTOSEL 4.19 05/81] libnvdimm/namespace: Fix a potential NULL pointer dereference

2019-05-06 Thread Sasha Levin
From: Kangjie Lu 

[ Upstream commit 55c1fc0af29a6c1b92f217b7eb7581a882e0c07c ]

In case kmemdup fails, the fix goes to blk_err to avoid NULL
pointer dereference.

Signed-off-by: Kangjie Lu 
Signed-off-by: Dan Williams 
Signed-off-by: Sasha Levin 
---
 drivers/nvdimm/namespace_devs.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c
index 54d79837f7c6..73a444c41cde 100644
--- a/drivers/nvdimm/namespace_devs.c
+++ b/drivers/nvdimm/namespace_devs.c
@@ -2251,9 +2251,12 @@ static struct device *create_namespace_blk(struct 
nd_region *nd_region,
if (!nsblk->uuid)
goto blk_err;
memcpy(name, nd_label->name, NSLABEL_NAME_LEN);
-   if (name[0])
+   if (name[0]) {
nsblk->alt_name = kmemdup(name, NSLABEL_NAME_LEN,
GFP_KERNEL);
+   if (!nsblk->alt_name)
+   goto blk_err;
+   }
res = nsblk_add_resource(nd_region, ndd, nsblk,
__le64_to_cpu(nd_label->dpa));
if (!res)
-- 
2.20.1



[PATCH AUTOSEL 4.19 16/81] Input: snvs_pwrkey - initialize necessary driver data before enabling IRQ

2019-05-06 Thread Sasha Levin
From: Anson Huang 

[ Upstream commit bf2a7ca39fd3ab47ef71c621a7ee69d1813b1f97 ]

SNVS IRQ is requested before necessary driver data initialized,
if there is a pending IRQ during driver probe phase, kernel
NULL pointer panic will occur in IRQ handler. To avoid such
scenario, just initialize necessary driver data before enabling
IRQ. This patch is inspired by NXP's internal kernel tree.

Fixes: d3dc6e232215 ("input: keyboard: imx: add snvs power key driver")
Signed-off-by: Anson Huang 
Signed-off-by: Dmitry Torokhov 
Signed-off-by: Sasha Levin 
---
 drivers/input/keyboard/snvs_pwrkey.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/input/keyboard/snvs_pwrkey.c 
b/drivers/input/keyboard/snvs_pwrkey.c
index effb63205d3d..4c67cf30a5d9 100644
--- a/drivers/input/keyboard/snvs_pwrkey.c
+++ b/drivers/input/keyboard/snvs_pwrkey.c
@@ -148,6 +148,9 @@ static int imx_snvs_pwrkey_probe(struct platform_device 
*pdev)
return error;
}
 
+   pdata->input = input;
+   platform_set_drvdata(pdev, pdata);
+
error = devm_request_irq(&pdev->dev, pdata->irq,
   imx_snvs_pwrkey_interrupt,
   0, pdev->name, pdev);
@@ -163,9 +166,6 @@ static int imx_snvs_pwrkey_probe(struct platform_device 
*pdev)
return error;
}
 
-   pdata->input = input;
-   platform_set_drvdata(pdev, pdata);
-
device_init_wakeup(&pdev->dev, pdata->wakeup);
 
return 0;
-- 
2.20.1



[PATCH AUTOSEL 4.19 08/81] HID: input: add mapping for "Toggle Display" key

2019-05-06 Thread Sasha Levin
From: Dmitry Torokhov 

[ Upstream commit c01908a14bf735b871170092807c618bb9dae654 ]

According to HUT 1.12 usage 0xb5 from the generic desktop page is reserved
for switching between external and internal display, so let's add the
mapping.

Signed-off-by: Dmitry Torokhov 
Signed-off-by: Sasha Levin 
---
 drivers/hid/hid-input.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index eeb9ba7e8fc6..be0a6958a65a 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -677,6 +677,14 @@ static void hidinput_configure_usage(struct hid_input 
*hidinput, struct hid_fiel
break;
}
 
+   if ((usage->hid & 0xf0) == 0xb0) {  /* SC - Display */
+   switch (usage->hid & 0xf) {
+   case 0x05: map_key_clear(KEY_SWITCHVIDEOMODE); break;
+   default: goto ignore;
+   }
+   break;
+   }
+
/*
 * Some lazy vendors declare 255 usages for System Control,
 * leading to the creation of ABS_X|Y axis and too many others.
-- 
2.20.1



[PATCH AUTOSEL 4.19 19/81] s390/3270: fix lockdep false positive on view->lock

2019-05-06 Thread Sasha Levin
From: Martin Schwidefsky 

[ Upstream commit 5712f3301a12c0c3de9cc423484496b0464f2faf ]

The spinlock in the raw3270_view structure is used by con3270, tty3270
and fs3270 in different ways. For con3270 the lock can be acquired in
irq context, for tty3270 and fs3270 the highest context is bh.

Lockdep sees the view->lock as a single class and if the 3270 driver
is used for the console the following message is generated:

WARNING: inconsistent lock state
5.1.0-rc3-05157-g5c168033979d #12 Not tainted

inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
swapper/0/1 [HC0[0]:SC1[1]:HE1:SE0] takes:
(ptrval) (&(&view->lock)->rlock){?.-.}, at: tty3270_update+0x7c/0x330

Introduce a lockdep subclass for the view lock to distinguish bh from
irq locks.

Signed-off-by: Martin Schwidefsky 

Signed-off-by: Sasha Levin 
---
 drivers/s390/char/con3270.c | 2 +-
 drivers/s390/char/fs3270.c  | 3 ++-
 drivers/s390/char/raw3270.c | 3 ++-
 drivers/s390/char/raw3270.h | 4 +++-
 drivers/s390/char/tty3270.c | 3 ++-
 5 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/s390/char/con3270.c b/drivers/s390/char/con3270.c
index fd2146bcc0ad..e17364e13d2f 100644
--- a/drivers/s390/char/con3270.c
+++ b/drivers/s390/char/con3270.c
@@ -629,7 +629,7 @@ con3270_init(void)
 (void (*)(unsigned long)) con3270_read_tasklet,
 (unsigned long) condev->read);
 
-   raw3270_add_view(&condev->view, &con3270_fn, 1);
+   raw3270_add_view(&condev->view, &con3270_fn, 1, RAW3270_VIEW_LOCK_IRQ);
 
INIT_LIST_HEAD(&condev->freemem);
for (i = 0; i < CON3270_STRING_PAGES; i++) {
diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c
index 16a4e8528bbc..2f9905ee047c 100644
--- a/drivers/s390/char/fs3270.c
+++ b/drivers/s390/char/fs3270.c
@@ -463,7 +463,8 @@ fs3270_open(struct inode *inode, struct file *filp)
 
init_waitqueue_head(&fp->wait);
fp->fs_pid = get_pid(task_pid(current));
-   rc = raw3270_add_view(&fp->view, &fs3270_fn, minor);
+   rc = raw3270_add_view(&fp->view, &fs3270_fn, minor,
+ RAW3270_VIEW_LOCK_BH);
if (rc) {
fs3270_free_view(&fp->view);
goto out;
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c
index f8cd2935fbfd..63a41b168761 100644
--- a/drivers/s390/char/raw3270.c
+++ b/drivers/s390/char/raw3270.c
@@ -920,7 +920,7 @@ raw3270_deactivate_view(struct raw3270_view *view)
  * Add view to device with minor "minor".
  */
 int
-raw3270_add_view(struct raw3270_view *view, struct raw3270_fn *fn, int minor)
+raw3270_add_view(struct raw3270_view *view, struct raw3270_fn *fn, int minor, 
int subclass)
 {
unsigned long flags;
struct raw3270 *rp;
@@ -942,6 +942,7 @@ raw3270_add_view(struct raw3270_view *view, struct 
raw3270_fn *fn, int minor)
view->cols = rp->cols;
view->ascebc = rp->ascebc;
spin_lock_init(&view->lock);
+   lockdep_set_subclass(&view->lock, subclass);
list_add(&view->list, &rp->view_list);
rc = 0;
spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags);
diff --git a/drivers/s390/char/raw3270.h b/drivers/s390/char/raw3270.h
index 114ca7cbf889..3afaa35f7351 100644
--- a/drivers/s390/char/raw3270.h
+++ b/drivers/s390/char/raw3270.h
@@ -150,6 +150,8 @@ struct raw3270_fn {
 struct raw3270_view {
struct list_head list;
spinlock_t lock;
+#define RAW3270_VIEW_LOCK_IRQ  0
+#define RAW3270_VIEW_LOCK_BH   1
atomic_t ref_count;
struct raw3270 *dev;
struct raw3270_fn *fn;
@@ -158,7 +160,7 @@ struct raw3270_view {
unsigned char *ascebc;  /* ascii -> ebcdic table */
 };
 
-int raw3270_add_view(struct raw3270_view *, struct raw3270_fn *, int);
+int raw3270_add_view(struct raw3270_view *, struct raw3270_fn *, int, int);
 int raw3270_activate_view(struct raw3270_view *);
 void raw3270_del_view(struct raw3270_view *);
 void raw3270_deactivate_view(struct raw3270_view *);
diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c
index 5b8af2782282..81067f5bb178 100644
--- a/drivers/s390/char/tty3270.c
+++ b/drivers/s390/char/tty3270.c
@@ -980,7 +980,8 @@ static int tty3270_install(struct tty_driver *driver, 
struct tty_struct *tty)
return PTR_ERR(tp);
 
rc = raw3270_add_view(&tp->view, &tty3270_fn,
- tty->index + RAW3270_FIRSTMINOR);
+ tty->index + RAW3270_FIRSTMINOR,
+ RAW3270_VIEW_LOCK_BH);
if (rc) {
tty3270_free_view(tp);
return rc;
-- 
2.20.1



[PATCH AUTOSEL 4.19 10/81] s390/dasd: Fix capacity calculation for large volumes

2019-05-06 Thread Sasha Levin
From: Peter Oberparleiter 

[ Upstream commit 2cc9637ce825f3a9f51f8f78af7474e9e85bfa5f ]

The DASD driver incorrectly limits the maximum number of blocks of ECKD
DASD volumes to 32 bit numbers. Volumes with a capacity greater than
2^32-1 blocks are incorrectly recognized as smaller volumes.

This results in the following volume capacity limits depending on the
formatted block size:

  BLKSIZE  MAX_GB   MAX_CYL
  5122047   5843492
 10244095   8676701
 20488191  13634816
 4096   16383  23860929

The same problem occurs when a volume with more than 17895697 cylinders
is accessed in raw-track-access mode.

Fix this problem by adding an explicit type cast when calculating the
maximum number of blocks.

Signed-off-by: Peter Oberparleiter 
Reviewed-by: Stefan Haberland 
Signed-off-by: Martin Schwidefsky 
Signed-off-by: Sasha Levin 
---
 drivers/s390/block/dasd_eckd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 6e294b4d3635..f89f9d02e788 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -2004,14 +2004,14 @@ static int dasd_eckd_end_analysis(struct dasd_block 
*block)
blk_per_trk = recs_per_track(&private->rdc_data, 0, block->bp_block);
 
 raw:
-   block->blocks = (private->real_cyl *
+   block->blocks = ((unsigned long) private->real_cyl *
  private->rdc_data.trk_per_cyl *
  blk_per_trk);
 
dev_info(&device->cdev->dev,
-"DASD with %d KB/block, %d KB total size, %d KB/track, "
+"DASD with %u KB/block, %lu KB total size, %u KB/track, "
 "%s\n", (block->bp_block >> 10),
-((private->real_cyl *
+(((unsigned long) private->real_cyl *
   private->rdc_data.trk_per_cyl *
   blk_per_trk * (block->bp_block >> 9)) >> 1),
 ((blk_per_trk * block->bp_block) >> 10),
-- 
2.20.1



[PATCH AUTOSEL 4.19 22/81] clocksource/drivers/oxnas: Fix OX820 compatible

2019-05-06 Thread Sasha Levin
From: Neil Armstrong 

[ Upstream commit fbc87aa0f7c42dc31f1bac3b2615008cac32 ]

The OX820 compatible is wrong is the driver, fix it.

Fixes: 2ea3401e2a84 ("clocksource/drivers/oxnas: Add OX820 compatible")
Reported-by: Daniel Golle 
Signed-off-by: Neil Armstrong 
Signed-off-by: Daniel Lezcano 
Signed-off-by: Sasha Levin 
---
 drivers/clocksource/timer-oxnas-rps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-oxnas-rps.c 
b/drivers/clocksource/timer-oxnas-rps.c
index eed6feff8b5f..30c6f4ce672b 100644
--- a/drivers/clocksource/timer-oxnas-rps.c
+++ b/drivers/clocksource/timer-oxnas-rps.c
@@ -296,4 +296,4 @@ static int __init oxnas_rps_timer_init(struct device_node 
*np)
 TIMER_OF_DECLARE(ox810se_rps,
   "oxsemi,ox810se-rps-timer", oxnas_rps_timer_init);
 TIMER_OF_DECLARE(ox820_rps,
-  "oxsemi,ox820se-rps-timer", oxnas_rps_timer_init);
+  "oxsemi,ox820-rps-timer", oxnas_rps_timer_init);
-- 
2.20.1



[PATCH AUTOSEL 4.19 21/81] clocksource/drivers/npcm: select TIMER_OF

2019-05-06 Thread Sasha Levin
From: Arnd Bergmann 

[ Upstream commit 99834eead2a04e93a120abb112542b87c42ff5e1 ]

When this is disabled, we get a link failure:

drivers/clocksource/timer-npcm7xx.o: In function `npcm7xx_timer_init':
timer-npcm7xx.c:(.init.text+0xf): undefined reference to `timer_of_init'

Fixes: 1c00289ecd12 ("clocksource/drivers/npcm: Add NPCM7xx timer driver")
Signed-off-by: Arnd Bergmann 
Signed-off-by: Daniel Lezcano 
Signed-off-by: Sasha Levin 
---
 drivers/clocksource/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index c1ddafa4c299..4d37f018d846 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -136,6 +136,7 @@ config VT8500_TIMER
 config NPCM7XX_TIMER
bool "NPCM7xx timer driver" if COMPILE_TEST
depends on HAS_IOMEM
+   select TIMER_OF
select CLKSRC_MMIO
help
  Enable 24-bit TIMER0 and TIMER1 counters in the NPCM7xx architecture,
-- 
2.20.1



[PATCH AUTOSEL 4.19 27/81] afs: Unlock pages for __pagevec_release()

2019-05-06 Thread Sasha Levin
From: Marc Dionne 

[ Upstream commit 21bd68f196ca91fc0f3d9bd1b32f6e530e8c1c88 ]

__pagevec_release() complains loudly if any page in the vector is still
locked.  The pages need to be locked for generic_error_remove_page(), but
that function doesn't actually unlock them.

Unlock the pages afterwards.

Signed-off-by: Marc Dionne 
Signed-off-by: David Howells 
Tested-by: Jonathan Billings 
Signed-off-by: Sasha Levin 
---
 fs/afs/write.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/afs/write.c b/fs/afs/write.c
index 19c04caf3c01..e00461a6de9a 100644
--- a/fs/afs/write.c
+++ b/fs/afs/write.c
@@ -253,6 +253,7 @@ static void afs_kill_pages(struct address_space *mapping,
first = page->index + 1;
lock_page(page);
generic_error_remove_page(mapping, page);
+   unlock_page(page);
}
 
__pagevec_release(&pv);
-- 
2.20.1



[PATCH AUTOSEL 4.19 26/81] qede: fix write to free'd pointer error and double free of ptp

2019-05-06 Thread Sasha Levin
From: Colin Ian King 

[ Upstream commit 1dc2b3d65523780ed1972d446c76e62e13f3e8f5 ]

The err2 error return path calls qede_ptp_disable that cleans up
on an error and frees ptp. After this, the free'd ptp is dereferenced
when ptp->clock is set to NULL and the code falls-through to error
path err1 that frees ptp again.

Fix this by calling qede_ptp_disable and exiting via an error
return path that does not set ptp->clock or kfree ptp.

Addresses-Coverity: ("Write to pointer after free")
Fixes: 035744975aec ("qede: Add support for PTP resource locking.")
Signed-off-by: Colin Ian King 
Signed-off-by: David S. Miller 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/qlogic/qede/qede_ptp.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qede/qede_ptp.c 
b/drivers/net/ethernet/qlogic/qede/qede_ptp.c
index 013ff567283c..5e574c3b625e 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_ptp.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_ptp.c
@@ -490,18 +490,17 @@ int qede_ptp_enable(struct qede_dev *edev, bool init_tc)
 
ptp->clock = ptp_clock_register(&ptp->clock_info, &edev->pdev->dev);
if (IS_ERR(ptp->clock)) {
-   rc = -EINVAL;
DP_ERR(edev, "PTP clock registration failed\n");
+   qede_ptp_disable(edev);
+   rc = -EINVAL;
goto err2;
}
 
return 0;
 
-err2:
-   qede_ptp_disable(edev);
-   ptp->clock = NULL;
 err1:
kfree(ptp);
+err2:
edev->ptp = NULL;
 
return rc;
-- 
2.20.1



[PATCH AUTOSEL 4.19 30/81] x86/build/lto: Fix truncated .bss with -fdata-sections

2019-05-06 Thread Sasha Levin
From: Sami Tolvanen 

[ Upstream commit 6a03469a1edc94da52b65478f1e00837add869a3 ]

With CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y, we compile the kernel with
-fdata-sections, which also splits the .bss section.

The new section, with a new .bss.* name, which pattern gets missed by the
main x86 linker script which only expects the '.bss' name. This results
in the discarding of the second part and a too small, truncated .bss
section and an unhappy, non-working kernel.

Use the common BSS_MAIN macro in the linker script to properly capture
and merge all the generated BSS sections.

Signed-off-by: Sami Tolvanen 
Reviewed-by: Nick Desaulniers 
Reviewed-by: Kees Cook 
Cc: Borislav Petkov 
Cc: Kees Cook 
Cc: Linus Torvalds 
Cc: Nicholas Piggin 
Cc: Nick Desaulniers 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Link: http://lkml.kernel.org/r/20190415164956.124067-1-samitolva...@google.com
[ Extended the changelog. ]
Signed-off-by: Ingo Molnar 
Signed-off-by: Sasha Levin 
---
 arch/x86/kernel/vmlinux.lds.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index c63bab98780c..85e6d5620188 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -372,7 +372,7 @@ SECTIONS
.bss : AT(ADDR(.bss) - LOAD_OFFSET) {
__bss_start = .;
*(.bss..page_aligned)
-   *(.bss)
+   *(BSS_MAIN)
BSS_DECRYPTED
. = ALIGN(PAGE_SIZE);
__bss_stop = .;
-- 
2.20.1



[PATCH AUTOSEL 4.19 39/81] x86/mm/KASLR: Fix the size of the direct mapping section

2019-05-06 Thread Sasha Levin
From: Baoquan He 

[ Upstream commit ec3937107ab43f3e8b2bc9dad95710043c462ff7 ]

kernel_randomize_memory() uses __PHYSICAL_MASK_SHIFT to calculate
the maximum amount of system RAM supported. The size of the direct
mapping section is obtained from the smaller one of the below two
values:

  (actual system RAM size + padding size) vs (max system RAM size supported)

This calculation is wrong since commit

  b83ce5ee9147 ("x86/mm/64: Make __PHYSICAL_MASK_SHIFT always 52").

In it, __PHYSICAL_MASK_SHIFT was changed to be 52, regardless of whether
the kernel is using 4-level or 5-level page tables. Thus, it will always
use 4 PB as the maximum amount of system RAM, even in 4-level paging
mode where it should actually be 64 TB.

Thus, the size of the direct mapping section will always
be the sum of the actual system RAM size plus the padding size.

Even when the amount of system RAM is 64 TB, the following layout will
still be used. Obviously KALSR will be weakened significantly.

   ||___actual RAM___|_padding_|__the rest___|
   064TB~120TB

Instead, it should be like this:

   ||___actual RAM___|_the rest__|
   064TB~120TB

The size of padding region is controlled by
CONFIG_RANDOMIZE_MEMORY_PHYSICAL_PADDING, which is 10 TB by default.

The above issue only exists when
CONFIG_RANDOMIZE_MEMORY_PHYSICAL_PADDING is set to a non-zero value,
which is the case when CONFIG_MEMORY_HOTPLUG is enabled. Otherwise,
using __PHYSICAL_MASK_SHIFT doesn't affect KASLR.

Fix it by replacing __PHYSICAL_MASK_SHIFT with MAX_PHYSMEM_BITS.

 [ bp: Massage commit message. ]

Fixes: b83ce5ee9147 ("x86/mm/64: Make __PHYSICAL_MASK_SHIFT always 52")
Signed-off-by: Baoquan He 
Signed-off-by: Borislav Petkov 
Reviewed-by: Thomas Garnier 
Acked-by: Kirill A. Shutemov 
Cc: "H. Peter Anvin" 
Cc: Andy Lutomirski 
Cc: Dave Hansen 
Cc: Ingo Molnar 
Cc: Kees Cook 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: frank.ram...@hpe.com
Cc: herb...@gondor.apana.org.au
Cc: kir...@shutemov.name
Cc: mike.tra...@hpe.com
Cc: thgar...@google.com
Cc: x86-ml 
Cc: yamada.masah...@socionext.com
Link: https://lkml.kernel.org/r/20190417083536.GE7065@MiWiFi-R3L-srv
Signed-off-by: Sasha Levin 
---
 arch/x86/mm/kaslr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/mm/kaslr.c b/arch/x86/mm/kaslr.c
index 61db77b0eda9..0988971069c9 100644
--- a/arch/x86/mm/kaslr.c
+++ b/arch/x86/mm/kaslr.c
@@ -93,7 +93,7 @@ void __init kernel_randomize_memory(void)
if (!kaslr_memory_enabled())
return;
 
-   kaslr_regions[0].size_tb = 1 << (__PHYSICAL_MASK_SHIFT - TB_SHIFT);
+   kaslr_regions[0].size_tb = 1 << (MAX_PHYSMEM_BITS - TB_SHIFT);
kaslr_regions[1].size_tb = VMALLOC_SIZE_TB;
 
/*
-- 
2.20.1



[PATCH AUTOSEL 4.19 31/81] x86/reboot, efi: Use EFI reboot for Acer TravelMate X514-51T

2019-05-06 Thread Sasha Levin
From: Jian-Hong Pan 

[ Upstream commit 0082517fa4bce073e7cf542633439f26538a14cc ]

Upon reboot, the Acer TravelMate X514-51T laptop appears to complete the
shutdown process, but then it hangs in BIOS POST with a black screen.

The problem is intermittent - at some points it has appeared related to
Secure Boot settings or different kernel builds, but ultimately we have
not been able to identify the exact conditions that trigger the issue to
come and go.

Besides, the EFI mode cannot be disabled in the BIOS of this model.

However, after extensive testing, we observe that using the EFI reboot
method reliably avoids the issue in all cases.

So add a boot time quirk to use EFI reboot on such systems.

Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=203119
Signed-off-by: Jian-Hong Pan 
Signed-off-by: Daniel Drake 
Cc: Ard Biesheuvel 
Cc: Borislav Petkov 
Cc: Linus Torvalds 
Cc: Matt Fleming 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: linux-...@vger.kernel.org
Cc: li...@endlessm.com
Link: http://lkml.kernel.org/r/20190412080152.3718-1-jian-h...@endlessm.com
[ Fix !CONFIG_EFI build failure, clarify the code and the changelog a bit. ]
Signed-off-by: Ingo Molnar 
Signed-off-by: Sasha Levin 
---
 arch/x86/kernel/reboot.c | 21 +
 include/linux/efi.h  |  7 ++-
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 725624b6c0c0..8fd3cedd9acc 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -81,6 +81,19 @@ static int __init set_bios_reboot(const struct dmi_system_id 
*d)
return 0;
 }
 
+/*
+ * Some machines don't handle the default ACPI reboot method and
+ * require the EFI reboot method:
+ */
+static int __init set_efi_reboot(const struct dmi_system_id *d)
+{
+   if (reboot_type != BOOT_EFI && !efi_runtime_disabled()) {
+   reboot_type = BOOT_EFI;
+   pr_info("%s series board detected. Selecting EFI-method for 
reboot.\n", d->ident);
+   }
+   return 0;
+}
+
 void __noreturn machine_real_restart(unsigned int type)
 {
local_irq_disable();
@@ -166,6 +179,14 @@ static const struct dmi_system_id reboot_dmi_table[] 
__initconst = {
DMI_MATCH(DMI_PRODUCT_NAME, "AOA110"),
},
},
+   {   /* Handle reboot issue on Acer TravelMate X514-51T */
+   .callback = set_efi_reboot,
+   .ident = "Acer TravelMate X514-51T",
+   .matches = {
+   DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+   DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate X514-51T"),
+   },
+   },
 
/* Apple */
{   /* Handle problems with rebooting on Apple MacBook5 */
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 401e4b254e30..cc3391796c0b 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -1564,7 +1564,12 @@ efi_status_t efi_setup_gop(efi_system_table_t 
*sys_table_arg,
   struct screen_info *si, efi_guid_t *proto,
   unsigned long size);
 
-bool efi_runtime_disabled(void);
+#ifdef CONFIG_EFI
+extern bool efi_runtime_disabled(void);
+#else
+static inline bool efi_runtime_disabled(void) { return true; }
+#endif
+
 extern void efi_call_virt_check_flags(unsigned long flags, const char *call);
 
 enum efi_secureboot_mode {
-- 
2.20.1



[PATCH AUTOSEL 4.19 37/81] ipmi: ipmi_si_hardcode.c: init si_type array to fix a crash

2019-05-06 Thread Sasha Levin
From: Tony Camuso 

[ Upstream commit a885bcfd152f97b25005298ab2d6b741aed9b49c ]

The intended behavior of function ipmi_hardcode_init_one() is to default
to kcs interface when no type argument is presented when initializing
ipmi with hard coded addresses.

However, the array of char pointers allocated on the stack by function
ipmi_hardcode_init() was not inited to zeroes, so it contained stack
debris.

Consequently, passing the cruft stored in this array to function
ipmi_hardcode_init_one() caused a crash when it was unable to detect
that the char * being passed was nonsense and tried to access the
address specified by the bogus pointer.

The fix is simply to initialize the si_type array to zeroes, so if
there were no type argument given to at the command line, function
ipmi_hardcode_init_one() could properly default to the kcs interface.

Signed-off-by: Tony Camuso 
Message-Id: <1554837603-40299-1-git-send-email-tcam...@redhat.com>
Signed-off-by: Corey Minyard 
Signed-off-by: Sasha Levin 
---
 drivers/char/ipmi/ipmi_si_hardcode.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/char/ipmi/ipmi_si_hardcode.c 
b/drivers/char/ipmi/ipmi_si_hardcode.c
index 9ae2405c28bb..0c28e872ad3a 100644
--- a/drivers/char/ipmi/ipmi_si_hardcode.c
+++ b/drivers/char/ipmi/ipmi_si_hardcode.c
@@ -200,6 +200,8 @@ void __init ipmi_hardcode_init(void)
char *str;
char *si_type[SI_MAX_PARMS];
 
+   memset(si_type, 0, sizeof(si_type));
+
/* Parse out the si_type string into its components. */
str = si_type_str;
if (*str != '\0') {
-- 
2.20.1



[PATCH AUTOSEL 4.19 35/81] KVM: x86: avoid misreporting level-triggered irqs as edge-triggered in tracing

2019-05-06 Thread Sasha Levin
From: Vitaly Kuznetsov 

[ Upstream commit 7a223e06b1a411cef6c4cd7a9b9a33c8d225b10e ]

In __apic_accept_irq() interface trig_mode is int and actually on some code
paths it is set above u8:

kvm_apic_set_irq() extracts it from 'struct kvm_lapic_irq' where trig_mode
is u16. This is done on purpose as e.g. kvm_set_msi_irq() sets it to
(1 << 15) & e->msi.data

kvm_apic_local_deliver sets it to reg & (1 << 15).

Fix the immediate issue by making 'tm' into u16. We may also want to adjust
__apic_accept_irq() interface and use proper sizes for vector, level,
trig_mode but this is not urgent.

Signed-off-by: Vitaly Kuznetsov 
Signed-off-by: Paolo Bonzini 
Signed-off-by: Sasha Levin 
---
 arch/x86/kvm/trace.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
index 0f997683404f..b3f219b7c840 100644
--- a/arch/x86/kvm/trace.h
+++ b/arch/x86/kvm/trace.h
@@ -438,13 +438,13 @@ TRACE_EVENT(kvm_apic_ipi,
 );
 
 TRACE_EVENT(kvm_apic_accept_irq,
-   TP_PROTO(__u32 apicid, __u16 dm, __u8 tm, __u8 vec),
+   TP_PROTO(__u32 apicid, __u16 dm, __u16 tm, __u8 vec),
TP_ARGS(apicid, dm, tm, vec),
 
TP_STRUCT__entry(
__field(__u32,  apicid  )
__field(__u16,  dm  )
-   __field(__u8,   tm  )
+   __field(__u16,  tm  )
__field(__u8,   vec )
),
 
-- 
2.20.1



[PATCH AUTOSEL 4.19 32/81] x86/mm/tlb: Revert "x86/mm: Align TLB invalidation info"

2019-05-06 Thread Sasha Levin
From: Peter Zijlstra 

[ Upstream commit 780e0106d468a2962b16b52fdf42898f2639e0a0 ]

Revert the following commit:

  515ab7c41306: ("x86/mm: Align TLB invalidation info")

I found out (the hard way) that under some .config options (notably 
L1_CACHE_SHIFT=7)
and compiler combinations this on-stack alignment leads to a 320 byte
stack usage, which then triggers a KASAN stack warning elsewhere.

Using 320 bytes of stack space for a 40 byte structure is ludicrous and
clearly not right.

Signed-off-by: Peter Zijlstra (Intel) 
Acked-by: Linus Torvalds 
Acked-by: Nadav Amit 
Cc: Andy Lutomirski 
Cc: Borislav Petkov 
Cc: Dave Hansen 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Fixes: 515ab7c41306 ("x86/mm: Align TLB invalidation info")
Link: 
http://lkml.kernel.org/r/20190416080335.gm7...@worktop.programming.kicks-ass.net
[ Minor changelog edits. ]
Signed-off-by: Ingo Molnar 
Signed-off-by: Sasha Levin 
---
 arch/x86/mm/tlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index a6d1b0241aea..a6836ab0fcc7 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -694,7 +694,7 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long 
start,
 {
int cpu;
 
-   struct flush_tlb_info info __aligned(SMP_CACHE_BYTES) = {
+   struct flush_tlb_info info = {
.mm = mm,
};
 
-- 
2.20.1



[PATCH AUTOSEL 4.19 43/81] selftests: netfilter: check icmp pkttoobig errors are set as related

2019-05-06 Thread Sasha Levin
From: Florian Westphal 

[ Upstream commit becf2319f320cae43e20cf179cc51a355a0deb5f ]

When an icmp error such as pkttoobig is received, conntrack checks
if the "inner" header (header of packet that did not fit link mtu)
is matches an existing connection, and, if so, sets that packet as
being related to the conntrack entry it found.

It was recently reported that this "related" setting also works
if the inner header is from another, different connection (i.e.,
artificial/forged icmp error).

Add a test, followup patch will add additional "inner dst matches
outer dst in reverse direction" check before setting related state.

Link: https://www.synacktiv.com/posts/systems/icmp-reachable.html
Signed-off-by: Florian Westphal 
Signed-off-by: Pablo Neira Ayuso 
Signed-off-by: Sasha Levin 
---
 tools/testing/selftests/netfilter/Makefile|   2 +-
 .../netfilter/conntrack_icmp_related.sh   | 283 ++
 2 files changed, 284 insertions(+), 1 deletion(-)
 create mode 100755 tools/testing/selftests/netfilter/conntrack_icmp_related.sh

diff --git a/tools/testing/selftests/netfilter/Makefile 
b/tools/testing/selftests/netfilter/Makefile
index c9ff2b47bd1c..a37cb1192c6a 100644
--- a/tools/testing/selftests/netfilter/Makefile
+++ b/tools/testing/selftests/netfilter/Makefile
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 # Makefile for netfilter selftests
 
-TEST_PROGS := nft_trans_stress.sh nft_nat.sh
+TEST_PROGS := nft_trans_stress.sh nft_nat.sh conntrack_icmp_related.sh
 
 include ../lib.mk
diff --git a/tools/testing/selftests/netfilter/conntrack_icmp_related.sh 
b/tools/testing/selftests/netfilter/conntrack_icmp_related.sh
new file mode 100755
index ..b48e1833bc89
--- /dev/null
+++ b/tools/testing/selftests/netfilter/conntrack_icmp_related.sh
@@ -0,0 +1,283 @@
+#!/bin/bash
+#
+# check that ICMP df-needed/pkttoobig icmp are set are set as related
+# state
+#
+# Setup is:
+#
+# nsclient1 -> nsrouter1 -> nsrouter2 -> nsclient2
+# MTU 1500, except for nsrouter2 <-> nsclient2 link (1280).
+# ping nsclient2 from nsclient1, checking that conntrack did set RELATED
+# 'fragmentation needed' icmp packet.
+#
+# In addition, nsrouter1 will perform IP masquerading, i.e. also
+# check the icmp errors are propagated to the correct host as per
+# nat of "established" icmp-echo "connection".
+
+# Kselftest framework requirement - SKIP code is 4.
+ksft_skip=4
+ret=0
+
+nft --version > /dev/null 2>&1
+if [ $? -ne 0 ];then
+   echo "SKIP: Could not run test without nft tool"
+   exit $ksft_skip
+fi
+
+ip -Version > /dev/null 2>&1
+if [ $? -ne 0 ];then
+   echo "SKIP: Could not run test without ip tool"
+   exit $ksft_skip
+fi
+
+cleanup() {
+   for i in 1 2;do ip netns del nsclient$i;done
+   for i in 1 2;do ip netns del nsrouter$i;done
+}
+
+ipv4() {
+echo -n 192.168.$1.2
+}
+
+ipv6 () {
+echo -n dead:$1::2
+}
+
+check_counter()
+{
+   ns=$1
+   name=$2
+   expect=$3
+   local lret=0
+
+   cnt=$(ip netns exec $ns nft list counter inet filter "$name" | grep -q 
"$expect")
+   if [ $? -ne 0 ]; then
+   echo "ERROR: counter $name in $ns has unexpected value 
(expected $expect)" 1>&2
+   ip netns exec $ns nft list counter inet filter "$name" 1>&2
+   lret=1
+   fi
+
+   return $lret
+}
+
+check_unknown()
+{
+   expect="packets 0 bytes 0"
+   for n in nsclient1 nsclient2 nsrouter1 nsrouter2; do
+   check_counter $n "unknown" "$expect"
+   if [ $? -ne 0 ] ;then
+   return 1
+   fi
+   done
+
+   return 0
+}
+
+for n in nsclient1 nsclient2 nsrouter1 nsrouter2; do
+  ip netns add $n
+  ip -net $n link set lo up
+done
+
+DEV=veth0
+ip link add $DEV netns nsclient1 type veth peer name eth1 netns nsrouter1
+DEV=veth0
+ip link add $DEV netns nsclient2 type veth peer name eth1 netns nsrouter2
+
+DEV=veth0
+ip link add $DEV netns nsrouter1 type veth peer name eth2 netns nsrouter2
+
+DEV=veth0
+for i in 1 2; do
+ip -net nsclient$i link set $DEV up
+ip -net nsclient$i addr add $(ipv4 $i)/24 dev $DEV
+ip -net nsclient$i addr add $(ipv6 $i)/64 dev $DEV
+done
+
+ip -net nsrouter1 link set eth1 up
+ip -net nsrouter1 link set veth0 up
+
+ip -net nsrouter2 link set eth1 up
+ip -net nsrouter2 link set eth2 up
+
+ip -net nsclient1 route add default via 192.168.1.1
+ip -net nsclient1 -6 route add default via dead:1::1
+
+ip -net nsclient2 route add default via 192.168.2.1
+ip -net nsclient2 route add default via dead:2::1
+
+i=3
+ip -net nsrouter1 addr add 192.168.1.1/24 dev eth1
+ip -net nsrouter1 addr add 192.168.3.1/24 dev veth0
+ip -net nsrouter1 addr add dead:1::1/64 dev eth1
+ip -net nsrouter1 addr add dead:3::1/64 dev veth0
+ip -net nsrouter1 route add default via 192.168.3.10
+ip -net nsrouter1 -6 route add default via dead:3::10
+
+ip -net nsrouter2 addr add 192.168.2.1/24 dev eth1
+ip -net nsrouter2 addr add 192.168.3.10/24 dev eth2
+ip

[PATCH AUTOSEL 4.19 49/81] drm/sun4i: Set device driver data at bind time for use in unbind

2019-05-06 Thread Sasha Levin
From: Paul Kocialkowski 

[ Upstream commit 02b92adbe33e6dbd15dc6e32540b22f47c4ff0a2 ]

Our sun4i_drv_unbind gets the drm device using dev_get_drvdata.
However, that driver data is never set in sun4i_drv_bind.

Set it there to avoid getting a NULL pointer at unbind time.

Fixes: 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support")
Signed-off-by: Paul Kocialkowski 
Signed-off-by: Maxime Ripard 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20190418132727.5128-3-paul.kocialkow...@bootlin.com
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/sun4i/sun4i_drv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c 
b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 8b0cd08034e0..7cac01c72c02 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -92,6 +92,8 @@ static int sun4i_drv_bind(struct device *dev)
ret = -ENOMEM;
goto free_drm;
}
+
+   dev_set_drvdata(dev, drm);
drm->dev_private = drv;
INIT_LIST_HEAD(&drv->frontend_list);
INIT_LIST_HEAD(&drv->engine_list);
-- 
2.20.1



[PATCH AUTOSEL 4.19 50/81] drm/sun4i: Fix component unbinding and component master deletion

2019-05-06 Thread Sasha Levin
From: Paul Kocialkowski 

[ Upstream commit f5a9ed867c83875546c9aadd4ed8e785e9adcc3c ]

For our component-backed driver to be properly removed, we need to
delete the component master in sun4i_drv_remove and make sure to call
component_unbind_all in the master's unbind so that all components are
unbound when the master is.

Fixes: 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support")
Signed-off-by: Paul Kocialkowski 
Signed-off-by: Maxime Ripard 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20190418132727.5128-4-paul.kocialkow...@bootlin.com
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/sun4i/sun4i_drv.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c 
b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 7cac01c72c02..62703630090a 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -160,6 +160,8 @@ static void sun4i_drv_unbind(struct device *dev)
drm_mode_config_cleanup(drm);
of_reserved_mem_device_release(dev);
drm_dev_put(drm);
+
+   component_unbind_all(dev, NULL);
 }
 
 static const struct component_master_ops sun4i_drv_master_ops = {
@@ -407,6 +409,8 @@ static int sun4i_drv_probe(struct platform_device *pdev)
 
 static int sun4i_drv_remove(struct platform_device *pdev)
 {
+   component_master_del(&pdev->dev, &sun4i_drv_master_ops);
+
return 0;
 }
 
-- 
2.20.1



Re: [PATCH AUTOSEL 4.14 79/95] x86/asm: Remove dead __GNUC__ conditionals

2019-05-06 Thread Rasmus Villemoes
On 07/05/2019 07.38, Sasha Levin wrote:
> From: Rasmus Villemoes 
> 
> [ Upstream commit 88ca66d8540ca26119b1428cddb96b37925bdf01 ]
> 
> The minimum supported gcc version is >= 4.6, so these can be removed.

Eh, that bump happened for the 4.19 kernel, so this is not true for the
4.14 branch. Has cafa0010cd51fb711fdcb50fc55f394c5f167a0a been applied
to 4.14.y? Otherwise I don't think this is appropriate.

Rasmus


[PATCH AUTOSEL 4.19 58/81] x86/mm: Fix a crash with kmemleak_scan()

2019-05-06 Thread Sasha Levin
From: Qian Cai 

[ Upstream commit 0d02113b31b2017dd349ec9df2314e798a90fa6e ]

The first kmemleak_scan() call after boot would trigger the crash below
because this callpath:

  kernel_init
free_initmem
  mem_encrypt_free_decrypted_mem
free_init_pages

unmaps memory inside the .bss when DEBUG_PAGEALLOC=y.

kmemleak_init() will register the .data/.bss sections and then
kmemleak_scan() will scan those addresses and dereference them looking
for pointer references. If free_init_pages() frees and unmaps pages in
those sections, kmemleak_scan() will crash if referencing one of those
addresses:

  BUG: unable to handle kernel paging request at bd402000
  CPU: 12 PID: 325 Comm: kmemleak Not tainted 5.1.0-rc4+ #4
  RIP: 0010:scan_block
  Call Trace:
   scan_gray_list
   kmemleak_scan
   kmemleak_scan_thread
   kthread
   ret_from_fork

Since kmemleak_free_part() is tolerant to unknown objects (not tracked
by kmemleak), it is fine to call it from free_init_pages() even if not
all address ranges passed to this function are known to kmemleak.

 [ bp: Massage. ]

Fixes: b3f0907c71e0 ("x86/mm: Add .bss..decrypted section to hold shared 
variables")
Signed-off-by: Qian Cai 
Signed-off-by: Borislav Petkov 
Reviewed-by: Catalin Marinas 
Cc: Andy Lutomirski 
Cc: Brijesh Singh 
Cc: Dave Hansen 
Cc: "H. Peter Anvin" 
Cc: Ingo Molnar 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: x86-ml 
Link: https://lkml.kernel.org/r/20190423165811.36699-1-...@lca.pw
Signed-off-by: Sasha Levin 
---
 arch/x86/mm/init.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index d883869437b5..fb5f29c60019 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -6,6 +6,7 @@
 #include  /* for max_low_pfn */
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -767,6 +768,11 @@ void free_init_pages(char *what, unsigned long begin, 
unsigned long end)
if (debug_pagealloc_enabled()) {
pr_info("debug: unmapping init [mem %#010lx-%#010lx]\n",
begin, end - 1);
+   /*
+* Inform kmemleak about the hole in the memory since the
+* corresponding pages will be unmapped.
+*/
+   kmemleak_free_part((void *)begin, end - begin);
set_memory_np(begin, (end - begin) >> PAGE_SHIFT);
} else {
/*
-- 
2.20.1



[PATCH AUTOSEL 4.19 67/81] mm/memory.c: fix modifying of page protection by insert_pfn()

2019-05-06 Thread Sasha Levin
From: Jan Kara 

[ Upstream commit cae85cb8add35f678cf487139d05e083ce2f570a ]

Aneesh has reported that PPC triggers the following warning when
excercising DAX code:

  IP set_pte_at+0x3c/0x190
  LR insert_pfn+0x208/0x280
  Call Trace:
 insert_pfn+0x68/0x280
 dax_iomap_pte_fault.isra.7+0x734/0xa40
 __xfs_filemap_fault+0x280/0x2d0
 do_wp_page+0x48c/0xa40
 __handle_mm_fault+0x8d0/0x1fd0
 handle_mm_fault+0x140/0x250
 __do_page_fault+0x300/0xd60
 handle_page_fault+0x18

Now that is WARN_ON in set_pte_at which is

VM_WARN_ON(pte_hw_valid(*ptep) && !pte_protnone(*ptep));

The problem is that on some architectures set_pte_at() cannot cope with
a situation where there is already some (different) valid entry present.

Use ptep_set_access_flags() instead to modify the pfn which is built to
deal with modifying existing PTE.

Link: http://lkml.kernel.org/r/20190311084537.16029-1-j...@suse.cz
Fixes: b2770da64254 "mm: add vm_insert_mixed_mkwrite()"
Signed-off-by: Jan Kara 
Reported-by: "Aneesh Kumar K.V" 
Reviewed-by: Aneesh Kumar K.V 
Acked-by: Dan Williams 
Cc: Chandan Rajendra 
Cc: 
Signed-off-by: Andrew Morton 
Signed-off-by: Linus Torvalds 
Signed-off-by: Sasha Levin 
---
 mm/memory.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index 9c69278173b7..e0010cb870e0 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1796,10 +1796,12 @@ static int insert_pfn(struct vm_area_struct *vma, 
unsigned long addr,
WARN_ON_ONCE(!is_zero_pfn(pte_pfn(*pte)));
goto out_unlock;
}
-   entry = *pte;
-   goto out_mkwrite;
-   } else
-   goto out_unlock;
+   entry = pte_mkyoung(*pte);
+   entry = maybe_mkwrite(pte_mkdirty(entry), vma);
+   if (ptep_set_access_flags(vma, addr, pte, entry, 1))
+   update_mmu_cache(vma, addr, pte);
+   }
+   goto out_unlock;
}
 
/* Ok, finally just insert the thing.. */
@@ -1808,7 +1810,6 @@ static int insert_pfn(struct vm_area_struct *vma, 
unsigned long addr,
else
entry = pte_mkspecial(pfn_t_pte(pfn, prot));
 
-out_mkwrite:
if (mkwrite) {
entry = pte_mkyoung(entry);
entry = maybe_mkwrite(pte_mkdirty(entry), vma);
-- 
2.20.1



Re: [alsa-devel] [RFC PATCH 5/7] soundwire: add debugfs support

2019-05-06 Thread Greg KH
On Mon, May 06, 2019 at 10:08:10PM +0530, Vinod Koul wrote:
> Yes, but then device exit routine is supposed to do debugfs cleanup as
> well, so that would ensure these references are dropped at that point of
> time. Greg should that not take care of it or we *should* always do
> refcounting.

Always do refcounting.  How else can you "guarantee" that it is safe?


Re: [alsa-devel] [RFC PATCH 1/7] soundwire: Add sysfs support for master(s)

2019-05-06 Thread Greg KH
On Tue, May 07, 2019 at 10:57:32AM +0530, Vinod Koul wrote:
> On 06-05-19, 21:24, Pierre-Louis Bossart wrote:
> > 
> > > > +int sdw_sysfs_bus_init(struct sdw_bus *bus)
> > > > +{
> > > > +   struct sdw_master_sysfs *master;
> > > > +   int err;
> > > > +
> > > > +   if (bus->sysfs) {
> > > > +   dev_err(bus->dev, "SDW sysfs is already initialized\n");
> > > > +   return -EIO;
> > > > +   }
> > > > +
> > > > +   master = kzalloc(sizeof(*master), GFP_KERNEL);
> > > > +   if (!master)
> > > > +   return -ENOMEM;
> > > 
> > > Why are you creating a whole new device to put all of this under?  Is
> > > this needed?  What will the sysfs tree look like when you do this?  Why
> > > can't the "bus" device just get all of these attributes and no second
> > > device be created?
> > 
> > I tried a quick hack and indeed we could simplify the code with something as
> > simple as:
> > 
> > [attributes omitted]
> > 
> > static const struct attribute_group sdw_master_node_group = {
> > .attrs = master_node_attrs,
> > .name = "mipi-disco"
> > };
> > 
> > int sdw_sysfs_bus_init(struct sdw_bus *bus)
> > {
> > return sysfs_create_group(&bus->dev->kobj, &sdw_master_node_group);
> > }
> > 
> > void sdw_sysfs_bus_exit(struct sdw_bus *bus)
> > {
> > sysfs_remove_group(&bus->dev->kobj, &sdw_master_node_group);
> > }
> > 
> > which gives me a simpler structure and doesn't require additional
> > pretend-devices:
> > 
> > /sys/bus/acpi/devices/PRP1:00/int-sdw.0/mipi-disco# ls
> > clock_gears
> > /sys/bus/acpi/devices/PRP1:00/int-sdw.0/mipi-disco# more clock_gears
> > 8086
> > 
> > The issue I have is that for the _show() functions, I don't see a way to go
> > from the device argument to bus. In the example above I forced the output
> > but would need a helper.
> > 
> > static ssize_t clock_gears_show(struct device *dev,
> > struct device_attribute *attr, char *buf)
> > {
> > struct sdw_bus *bus; // this is what I need to find from dev
> > ssize_t size = 0;
> > int i;
> > 
> > return sprintf(buf, "%d \n", 8086);
> > }
> > 
> > my brain is starting to fry, but I don't see how container_of() would work
> > here since the bus structure contains a pointer to the device. I don't also
> > see a way to check for all devices for the bus_type soundwire.
> > For the slaves we do have a macro based on container_of(), so wondering if
> > we made a mistake in the bus definition? Vinod, any thoughts?
> 
> yeah I dont recall a way to get bus fed into create_group, I did look at
> the other examples back then and IIRC and most of them were using a
> global to do the trick (I didn't want to go down that route).
> 
> I think that was the reason I wrote it this way...
> 
> BTW if you do use psedo-device you can create your own struct foo which
> embeds device and then then you can use container approach to get foo
> (and foo contains bus as a member).
> 
> Greg, any thoughts?

Why would you have "bus" attributes on a device?  I don't think you are
using "bus" here like the driver model uses the term "bus", right?

What are you really trying to show here?

And if you need to know the bus pointer from the device, why don't you
have a pointer to it in your device-specific structure?

thanks,

greg k-h


[PATCH AUTOSEL 4.19 79/81] NFC: nci: Add some bounds checking in nci_hci_cmd_received()

2019-05-06 Thread Sasha Levin
From: Dan Carpenter 

[ Upstream commit d7ee81ad09f072eab1681877fc71ec05f9c1ae92 ]

This is similar to commit 674d9de02aa7 ("NFC: Fix possible memory
corruption when handling SHDLC I-Frame commands").

I'm not totally sure, but I think that commit description may have
overstated the danger.  I was under the impression that this data came
from the firmware?  If you can't trust your networking firmware, then
you're already in trouble.

Anyway, these days we add bounds checking where ever we can and we call
it kernel hardening.  Better safe than sorry.

Fixes: 11f54f228643 ("NFC: nci: Add HCI over NCI protocol support")
Signed-off-by: Dan Carpenter 
Signed-off-by: David S. Miller 
Signed-off-by: Sasha Levin 
---
 net/nfc/nci/hci.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/net/nfc/nci/hci.c b/net/nfc/nci/hci.c
index ddfc52ac1f9b..c0d323b58e73 100644
--- a/net/nfc/nci/hci.c
+++ b/net/nfc/nci/hci.c
@@ -312,6 +312,10 @@ static void nci_hci_cmd_received(struct nci_dev *ndev, u8 
pipe,
create_info = (struct nci_hci_create_pipe_resp *)skb->data;
dest_gate = create_info->dest_gate;
new_pipe = create_info->pipe;
+   if (new_pipe >= NCI_HCI_MAX_PIPES) {
+   status = NCI_HCI_ANY_E_NOK;
+   goto exit;
+   }
 
/* Save the new created pipe and bind with local gate,
 * the description for skb->data[3] is destination gate id
@@ -336,6 +340,10 @@ static void nci_hci_cmd_received(struct nci_dev *ndev, u8 
pipe,
goto exit;
}
delete_info = (struct nci_hci_delete_pipe_noti *)skb->data;
+   if (delete_info->pipe >= NCI_HCI_MAX_PIPES) {
+   status = NCI_HCI_ANY_E_NOK;
+   goto exit;
+   }
 
ndev->hci_dev->pipes[delete_info->pipe].gate =
NCI_HCI_INVALID_GATE;
-- 
2.20.1



[PATCH AUTOSEL 4.19 78/81] net: strparser: partially revert "strparser: Call skb_unclone conditionally"

2019-05-06 Thread Sasha Levin
From: Jakub Kicinski 

[ Upstream commit 4a9c2e3746e6151fd5d077259d79ce9ca86d47d7 ]

This reverts the first part of commit 4e485d06bb8c ("strparser: Call
skb_unclone conditionally").  To build a message with multiple
fragments we need our own root of frag_list.  We can't simply
use the frag_list of orig_skb, because it will lead to linking
all orig_skbs together creating very long frag chains, and causing
stack overflow on kfree_skb() (which is called recursively on
the frag_lists).

BUG: stack guard page was hit at d40fad41 (stack is 
29dde9f4..8cce03d5)
kernel stack overflow (double-fault):  [#1] PREEMPT SMP
RIP: 0010:free_one_page+0x2b/0x490

Call Trace:
  __free_pages_ok+0x143/0x2c0
  skb_release_data+0x8e/0x140
  ? skb_release_data+0xad/0x140
  kfree_skb+0x32/0xb0

  [...]

  skb_release_data+0xad/0x140
  ? skb_release_data+0xad/0x140
  kfree_skb+0x32/0xb0
  skb_release_data+0xad/0x140
  ? skb_release_data+0xad/0x140
  kfree_skb+0x32/0xb0
  skb_release_data+0xad/0x140
  ? skb_release_data+0xad/0x140
  kfree_skb+0x32/0xb0
  skb_release_data+0xad/0x140
  ? skb_release_data+0xad/0x140
  kfree_skb+0x32/0xb0
  skb_release_data+0xad/0x140
  __kfree_skb+0xe/0x20
  tcp_disconnect+0xd6/0x4d0
  tcp_close+0xf4/0x430
  ? tcp_check_oom+0xf0/0xf0
  tls_sk_proto_close+0xe4/0x1e0 [tls]
  inet_release+0x36/0x60
  __sock_release+0x37/0xa0
  sock_close+0x11/0x20
  __fput+0xa2/0x1d0
  task_work_run+0x89/0xb0
  exit_to_usermode_loop+0x9a/0xa0
  do_syscall_64+0xc0/0xf0
  entry_SYSCALL_64_after_hwframe+0x44/0xa9

Let's leave the second unclone conditional, as I'm not entirely
sure what is its purpose :)

Fixes: 4e485d06bb8c ("strparser: Call skb_unclone conditionally")
Signed-off-by: Jakub Kicinski 
Reviewed-by: Dirk van der Merwe 
Reviewed-by: Eric Dumazet 
Signed-off-by: David S. Miller 
Signed-off-by: Sasha Levin 
---
 net/strparser/strparser.c | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/net/strparser/strparser.c b/net/strparser/strparser.c
index da1a676860ca..0f4e42792878 100644
--- a/net/strparser/strparser.c
+++ b/net/strparser/strparser.c
@@ -140,13 +140,11 @@ static int __strp_recv(read_descriptor_t *desc, struct 
sk_buff *orig_skb,
/* We are going to append to the frags_list of head.
 * Need to unshare the frag_list.
 */
-   if (skb_has_frag_list(head)) {
-   err = skb_unclone(head, GFP_ATOMIC);
-   if (err) {
-   STRP_STATS_INCR(strp->stats.mem_fail);
-   desc->error = err;
-   return 0;
-   }
+   err = skb_unclone(head, GFP_ATOMIC);
+   if (err) {
+   STRP_STATS_INCR(strp->stats.mem_fail);
+   desc->error = err;
+   return 0;
}
 
if (unlikely(skb_shinfo(head)->frag_list)) {
-- 
2.20.1



[PATCH AUTOSEL 4.19 81/81] x86/kprobes: Avoid kretprobe recursion bug

2019-05-06 Thread Sasha Levin
From: Masami Hiramatsu 

[ Upstream commit b191fa96ea6dc00d331dcc28c1f7db5e075693a0 ]

Avoid kretprobe recursion loop bg by setting a dummy
kprobes to current_kprobe per-CPU variable.

This bug has been introduced with the asm-coded trampoline
code, since previously it used another kprobe for hooking
the function return placeholder (which only has a nop) and
trampoline handler was called from that kprobe.

This revives the old lost kprobe again.

With this fix, we don't see deadlock anymore.

And you can see that all inner-called kretprobe are skipped.

  event_1  235   0
  event_219375   19612

The 1st column is recorded count and the 2nd is missed count.
Above shows (event_1 rec) + (event_2 rec) ~= (event_2 missed)
(some difference are here because the counter is racy)

Reported-by: Andrea Righi 
Tested-by: Andrea Righi 
Signed-off-by: Masami Hiramatsu 
Acked-by: Steven Rostedt 
Cc: Linus Torvalds 
Cc: Mathieu Desnoyers 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: sta...@vger.kernel.org
Fixes: c9becf58d935 ("[PATCH] kretprobe: kretprobe-booster")
Link: http://lkml.kernel.org/r/155094064889.6137.972160690963039.stgit@devbox
Signed-off-by: Ingo Molnar 
Signed-off-by: Sasha Levin 
---
 arch/x86/kernel/kprobes/core.c | 22 --
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index acb901b43ce4..544bc2dfe408 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -749,11 +749,16 @@ asm(
 NOKPROBE_SYMBOL(kretprobe_trampoline);
 STACK_FRAME_NON_STANDARD(kretprobe_trampoline);
 
+static struct kprobe kretprobe_kprobe = {
+   .addr = (void *)kretprobe_trampoline,
+};
+
 /*
  * Called from kretprobe_trampoline
  */
 __visible __used void *trampoline_handler(struct pt_regs *regs)
 {
+   struct kprobe_ctlblk *kcb;
struct kretprobe_instance *ri = NULL;
struct hlist_head *head, empty_rp;
struct hlist_node *tmp;
@@ -763,6 +768,17 @@ __visible __used void *trampoline_handler(struct pt_regs 
*regs)
void *frame_pointer;
bool skipped = false;
 
+   preempt_disable();
+
+   /*
+* Set a dummy kprobe for avoiding kretprobe recursion.
+* Since kretprobe never run in kprobe handler, kprobe must not
+* be running at this point.
+*/
+   kcb = get_kprobe_ctlblk();
+   __this_cpu_write(current_kprobe, &kretprobe_kprobe);
+   kcb->kprobe_status = KPROBE_HIT_ACTIVE;
+
INIT_HLIST_HEAD(&empty_rp);
kretprobe_hash_lock(current, &head, &flags);
/* fixup registers */
@@ -838,10 +854,9 @@ __visible __used void *trampoline_handler(struct pt_regs 
*regs)
orig_ret_address = (unsigned long)ri->ret_addr;
if (ri->rp && ri->rp->handler) {
__this_cpu_write(current_kprobe, &ri->rp->kp);
-   get_kprobe_ctlblk()->kprobe_status = KPROBE_HIT_ACTIVE;
ri->ret_addr = correct_ret_addr;
ri->rp->handler(ri, regs);
-   __this_cpu_write(current_kprobe, NULL);
+   __this_cpu_write(current_kprobe, &kretprobe_kprobe);
}
 
recycle_rp_inst(ri, &empty_rp);
@@ -857,6 +872,9 @@ __visible __used void *trampoline_handler(struct pt_regs 
*regs)
 
kretprobe_hash_unlock(current, &flags);
 
+   __this_cpu_write(current_kprobe, NULL);
+   preempt_enable();
+
hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) {
hlist_del(&ri->hlist);
kfree(ri);
-- 
2.20.1



Re: [PATCH v2 2/3] staging: vchiq: revert "switch to wait_for_completion_killable"

2019-05-06 Thread Dan Carpenter
On Mon, May 06, 2019 at 04:40:29PM +0200, Nicolas Saenz Julienne wrote:
> The killable version of wait_for_completion() is meant to be used on
> situations where it should not fail at all costs, but still have the
> convenience of being able to kill it if really necessary. VCHIQ doesn't
> fit this criteria, as it's mainly used as an interface to V4L2 and ALSA
> devices.
> 
> Fixes: a772f116702e ("staging: vchiq: switch to wait_for_completion_killable")
> Signed-off-by: Nicolas Saenz Julienne 
> 
> This reverts commit a772f116702e3f0afdd7e6acadc1b8fb3b20b9ff.
> ---

Git just sets you up for failure with its revert.  That code was from
when git was really new and now everyone gets annoyed when they see a
raw git hash without a human readable subject.  Just say at the start of
the commit message:

This reverts commit a772f116702e ("staging: vchiq: switch to
wait_for_completion_killable").

The killable version of wait_for_completion() is meant to be used on
situations where it should not fail at all costs, but still have the
convenience of being able to kill it if really necessary. VCHIQ doesn't
fit this criteria, as it's mainly used as an interface to V4L2 and ALSA
devices.

Fixes: a772f116702e ("staging: vchiq: switch to wait_for_completion_killable")

regards,
dan carpenter



[PATCH AUTOSEL 4.19 76/81] mlxsw: core: Do not use WQ_MEM_RECLAIM for mlxsw workqueue

2019-05-06 Thread Sasha Levin
From: Ido Schimmel 

[ Upstream commit b442fed1b724af0de087912a5718ddde1b87acbb ]

The workqueue is used to periodically update the networking stack about
activity / statistics of various objects such as neighbours and TC
actions.

It should not be called as part of memory reclaim path, so remove the
WQ_MEM_RECLAIM flag.

Fixes: 3d5479e92087 ("mlxsw: core: Remove deprecated create_workqueue")
Signed-off-by: Ido Schimmel 
Acked-by: Jiri Pirko 
Signed-off-by: David S. Miller 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/mellanox/mlxsw/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c 
b/drivers/net/ethernet/mellanox/mlxsw/core.c
index 7482db0767af..2e6df5804b35 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core.c
@@ -1875,7 +1875,7 @@ static int __init mlxsw_core_module_init(void)
 {
int err;
 
-   mlxsw_wq = alloc_workqueue(mlxsw_core_driver_name, WQ_MEM_RECLAIM, 0);
+   mlxsw_wq = alloc_workqueue(mlxsw_core_driver_name, 0, 0);
if (!mlxsw_wq)
return -ENOMEM;
mlxsw_owq = alloc_ordered_workqueue("%s_ordered", 0,
-- 
2.20.1



[PATCH AUTOSEL 4.14 03/95] HID: input: add mapping for Expose/Overview key

2019-05-06 Thread Sasha Levin
From: Dmitry Torokhov 

[ Upstream commit 96dd86871e1fffbc39e4fa61c9c75ec54ee9af0f ]

According to HUTRR77 usage 0x29f from the consumer page is reserved for
the Desktop application to present all running user’s application windows.
Linux defines KEY_SCALE to request Compiz Scale (Expose) mode, so let's
add the mapping.

Signed-off-by: Dmitry Torokhov 
Signed-off-by: Sasha Levin 
---
 drivers/hid/hid-input.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index d146a9b545ee..35422c419f52 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -1016,6 +1016,8 @@ static void hidinput_configure_usage(struct hid_input 
*hidinput, struct hid_fiel
case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT);   break;
case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL);   break;
 
+   case 0x29f: map_key_clear(KEY_SCALE);   break;
+
default: map_key_clear(KEY_UNKNOWN);
}
break;
-- 
2.20.1



[PATCH AUTOSEL 4.14 05/95] HID: input: add mapping for "Toggle Display" key

2019-05-06 Thread Sasha Levin
From: Dmitry Torokhov 

[ Upstream commit c01908a14bf735b871170092807c618bb9dae654 ]

According to HUT 1.12 usage 0xb5 from the generic desktop page is reserved
for switching between external and internal display, so let's add the
mapping.

Signed-off-by: Dmitry Torokhov 
Signed-off-by: Sasha Levin 
---
 drivers/hid/hid-input.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 9eeac82e9542..2597b0eddd64 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -677,6 +677,14 @@ static void hidinput_configure_usage(struct hid_input 
*hidinput, struct hid_fiel
break;
}
 
+   if ((usage->hid & 0xf0) == 0xb0) {  /* SC - Display */
+   switch (usage->hid & 0xf) {
+   case 0x05: map_key_clear(KEY_SWITCHVIDEOMODE); break;
+   default: goto ignore;
+   }
+   break;
+   }
+
/*
 * Some lazy vendors declare 255 usages for System Control,
 * leading to the creation of ABS_X|Y axis and too many others.
-- 
2.20.1



[PATCH AUTOSEL 4.14 07/95] s390/dasd: Fix capacity calculation for large volumes

2019-05-06 Thread Sasha Levin
From: Peter Oberparleiter 

[ Upstream commit 2cc9637ce825f3a9f51f8f78af7474e9e85bfa5f ]

The DASD driver incorrectly limits the maximum number of blocks of ECKD
DASD volumes to 32 bit numbers. Volumes with a capacity greater than
2^32-1 blocks are incorrectly recognized as smaller volumes.

This results in the following volume capacity limits depending on the
formatted block size:

  BLKSIZE  MAX_GB   MAX_CYL
  5122047   5843492
 10244095   8676701
 20488191  13634816
 4096   16383  23860929

The same problem occurs when a volume with more than 17895697 cylinders
is accessed in raw-track-access mode.

Fix this problem by adding an explicit type cast when calculating the
maximum number of blocks.

Signed-off-by: Peter Oberparleiter 
Reviewed-by: Stefan Haberland 
Signed-off-by: Martin Schwidefsky 
Signed-off-by: Sasha Levin 
---
 drivers/s390/block/dasd_eckd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 0a1e7f9b5239..0d5e2d92e05b 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -2001,14 +2001,14 @@ static int dasd_eckd_end_analysis(struct dasd_block 
*block)
blk_per_trk = recs_per_track(&private->rdc_data, 0, block->bp_block);
 
 raw:
-   block->blocks = (private->real_cyl *
+   block->blocks = ((unsigned long) private->real_cyl *
  private->rdc_data.trk_per_cyl *
  blk_per_trk);
 
dev_info(&device->cdev->dev,
-"DASD with %d KB/block, %d KB total size, %d KB/track, "
+"DASD with %u KB/block, %lu KB total size, %u KB/track, "
 "%s\n", (block->bp_block >> 10),
-((private->real_cyl *
+(((unsigned long) private->real_cyl *
   private->rdc_data.trk_per_cyl *
   blk_per_trk * (block->bp_block >> 9)) >> 1),
 ((blk_per_trk * block->bp_block) >> 10),
-- 
2.20.1



[PATCH AUTOSEL 4.14 04/95] HID: input: add mapping for keyboard Brightness Up/Down/Toggle keys

2019-05-06 Thread Sasha Levin
From: Dmitry Torokhov 

[ Upstream commit 7975a1d6a7afeb3eb61c971a153d24dd8fa032f3 ]

According to HUTRR73 usages 0x79, 0x7a and 0x7c from the consumer page
correspond to Brightness Up/Down/Toggle keys, so let's add the mappings.

Signed-off-by: Dmitry Torokhov 
Signed-off-by: Sasha Levin 
---
 drivers/hid/hid-input.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 35422c419f52..9eeac82e9542 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -886,6 +886,10 @@ static void hidinput_configure_usage(struct hid_input 
*hidinput, struct hid_fiel
case 0x074: map_key_clear(KEY_BRIGHTNESS_MAX);  break;
case 0x075: map_key_clear(KEY_BRIGHTNESS_AUTO); break;
 
+   case 0x079: map_key_clear(KEY_KBDILLUMUP);  break;
+   case 0x07a: map_key_clear(KEY_KBDILLUMDOWN);break;
+   case 0x07c: map_key_clear(KEY_KBDILLUMTOGGLE);  break;
+
case 0x082: map_key_clear(KEY_VIDEO_NEXT);  break;
case 0x083: map_key_clear(KEY_LAST);break;
case 0x084: map_key_clear(KEY_ENTER);   break;
-- 
2.20.1



  1   2   3   4   5   6   7   8   9   10   >