LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH net 2/4] dt-bindings: net: Document fsl,erratum-a009885
From: Andrew Lunn @ 2022-01-16 21:56 UTC (permalink / raw)
  To: Tobias Waldekranz
  Cc: devicetree, madalin.bucur, robh+dt, paulus, kuba, netdev,
	linuxppc-dev, davem
In-Reply-To: <20220116211529.25604-3-tobias@waldekranz.com>

On Sun, Jan 16, 2022 at 10:15:27PM +0100, Tobias Waldekranz wrote:
> Update FMan binding documentation with the newly added workaround for
> erratum A-009885.
> 
> Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply

* [PATCH net 0/4] net/fsl: xgmac_mdio: Add workaround for erratum A-009885
From: Tobias Waldekranz @ 2022-01-16 21:15 UTC (permalink / raw)
  To: davem, kuba
  Cc: devicetree, madalin.bucur, robh+dt, paulus, linuxppc-dev, netdev

The individual messages mostly speak for themselves.

It is very possible that there are more chips out there that are
impacted by this, but I only have access to the errata document for
the T1024 family, so I've limited the DT changes to the exact FMan
version used in that device. Hopefully someone from NXP can supply a
follow-up if need be.

The final commit is an unrelated fix that was brought to my attention
by sparse.

Tobias Waldekranz (4):
  net/fsl: xgmac_mdio: Add workaround for erratum A-009885
  dt-bindings: net: Document fsl,erratum-a009885
  powerpc/fsl/dts: Enable WA for erratum A-009885 on fman3l MDIO buses
  net/fsl: xgmac_mdio: Fix incorrect iounmap when removing module

 .../devicetree/bindings/net/fsl-fman.txt      |  9 ++++++
 arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi |  2 ++
 drivers/net/ethernet/freescale/xgmac_mdio.c   | 28 ++++++++++++++-----
 3 files changed, 32 insertions(+), 7 deletions(-)

-- 
2.25.1


^ permalink raw reply

* [PATCH net 1/4] net/fsl: xgmac_mdio: Add workaround for erratum A-009885
From: Tobias Waldekranz @ 2022-01-16 21:15 UTC (permalink / raw)
  To: davem, kuba
  Cc: devicetree, madalin.bucur, robh+dt, paulus, linuxppc-dev, netdev
In-Reply-To: <20220116211529.25604-1-tobias@waldekranz.com>

Once an MDIO read transaction is initiated, we must read back the data
register within 16 MDC cycles after the transaction completes. Outside
of this window, reads may return corrupt data.

Therefore, disable local interrupts in the critical section, to
maximize the probability that we can satisfy this requirement.

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
---
 drivers/net/ethernet/freescale/xgmac_mdio.c | 25 ++++++++++++++++-----
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c
index 5b8b9bcf41a2..bf566ac3195b 100644
--- a/drivers/net/ethernet/freescale/xgmac_mdio.c
+++ b/drivers/net/ethernet/freescale/xgmac_mdio.c
@@ -51,6 +51,7 @@ struct tgec_mdio_controller {
 struct mdio_fsl_priv {
 	struct	tgec_mdio_controller __iomem *mdio_base;
 	bool	is_little_endian;
+	bool	has_a009885;
 	bool	has_a011043;
 };
 
@@ -186,10 +187,10 @@ static int xgmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
 {
 	struct mdio_fsl_priv *priv = (struct mdio_fsl_priv *)bus->priv;
 	struct tgec_mdio_controller __iomem *regs = priv->mdio_base;
+	unsigned long flags;
 	uint16_t dev_addr;
 	uint32_t mdio_stat;
 	uint32_t mdio_ctl;
-	uint16_t value;
 	int ret;
 	bool endian = priv->is_little_endian;
 
@@ -221,12 +222,18 @@ static int xgmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
 			return ret;
 	}
 
+	if (priv->has_a009885)
+		/* Once the operation completes, i.e. MDIO_STAT_BSY clears, we
+		 * must read back the data register within 16 MDC cycles.
+		 */
+		local_irq_save(flags);
+
 	/* Initiate the read */
 	xgmac_write32(mdio_ctl | MDIO_CTL_READ, &regs->mdio_ctl, endian);
 
 	ret = xgmac_wait_until_done(&bus->dev, regs, endian);
 	if (ret)
-		return ret;
+		goto irq_restore;
 
 	/* Return all Fs if nothing was there */
 	if ((xgmac_read32(&regs->mdio_stat, endian) & MDIO_STAT_RD_ER) &&
@@ -234,13 +241,17 @@ static int xgmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
 		dev_dbg(&bus->dev,
 			"Error while reading PHY%d reg at %d.%hhu\n",
 			phy_id, dev_addr, regnum);
-		return 0xffff;
+		ret = 0xffff;
+	} else {
+		ret = xgmac_read32(&regs->mdio_data, endian) & 0xffff;
+		dev_dbg(&bus->dev, "read %04x\n", ret);
 	}
 
-	value = xgmac_read32(&regs->mdio_data, endian) & 0xffff;
-	dev_dbg(&bus->dev, "read %04x\n", value);
+irq_restore:
+	if (priv->has_a009885)
+		local_irq_restore(flags);
 
-	return value;
+	return ret;
 }
 
 static int xgmac_mdio_probe(struct platform_device *pdev)
@@ -287,6 +298,8 @@ static int xgmac_mdio_probe(struct platform_device *pdev)
 	priv->is_little_endian = device_property_read_bool(&pdev->dev,
 							   "little-endian");
 
+	priv->has_a009885 = device_property_read_bool(&pdev->dev,
+						      "fsl,erratum-a009885");
 	priv->has_a011043 = device_property_read_bool(&pdev->dev,
 						      "fsl,erratum-a011043");
 
-- 
2.25.1


^ permalink raw reply related

* [PATCH net 4/4] net/fsl: xgmac_mdio: Fix incorrect iounmap when removing module
From: Tobias Waldekranz @ 2022-01-16 21:15 UTC (permalink / raw)
  To: davem, kuba
  Cc: devicetree, madalin.bucur, robh+dt, paulus, linuxppc-dev, netdev
In-Reply-To: <20220116211529.25604-1-tobias@waldekranz.com>

As reported by sparse: In the remove path, the driver would attempt to
unmap its own priv pointer - instead of the io memory that it mapped
in probe.

Fixes: 9f35a7342cff ("net/fsl: introduce Freescale 10G MDIO driver")
Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
---
 drivers/net/ethernet/freescale/xgmac_mdio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c
index bf566ac3195b..266e562bd67a 100644
--- a/drivers/net/ethernet/freescale/xgmac_mdio.c
+++ b/drivers/net/ethernet/freescale/xgmac_mdio.c
@@ -331,9 +331,10 @@ static int xgmac_mdio_probe(struct platform_device *pdev)
 static int xgmac_mdio_remove(struct platform_device *pdev)
 {
 	struct mii_bus *bus = platform_get_drvdata(pdev);
+	struct mdio_fsl_priv *priv = bus->priv;
 
 	mdiobus_unregister(bus);
-	iounmap(bus->priv);
+	iounmap(priv->mdio_base);
 	mdiobus_free(bus);
 
 	return 0;
-- 
2.25.1


^ permalink raw reply related

* [PATCH net 3/4] powerpc/fsl/dts: Enable WA for erratum A-009885 on fman3l MDIO buses
From: Tobias Waldekranz @ 2022-01-16 21:15 UTC (permalink / raw)
  To: davem, kuba
  Cc: devicetree, madalin.bucur, robh+dt, paulus, linuxppc-dev, netdev
In-Reply-To: <20220116211529.25604-1-tobias@waldekranz.com>

This block is used in (at least) T1024 and T1040, including their
variants like T1023 etc.

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
---
 arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi
index c90702b04a53..48e5cd61599c 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi
@@ -79,6 +79,7 @@ mdio0: mdio@fc000 {
 		#size-cells = <0>;
 		compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
 		reg = <0xfc000 0x1000>;
+		fsl,erratum-a009885;
 	};
 
 	xmdio0: mdio@fd000 {
@@ -86,6 +87,7 @@ xmdio0: mdio@fd000 {
 		#size-cells = <0>;
 		compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
 		reg = <0xfd000 0x1000>;
+		fsl,erratum-a009885;
 	};
 };
 
-- 
2.25.1


^ permalink raw reply related

* [PATCH net 2/4] dt-bindings: net: Document fsl,erratum-a009885
From: Tobias Waldekranz @ 2022-01-16 21:15 UTC (permalink / raw)
  To: davem, kuba
  Cc: devicetree, madalin.bucur, robh+dt, paulus, linuxppc-dev, netdev
In-Reply-To: <20220116211529.25604-1-tobias@waldekranz.com>

Update FMan binding documentation with the newly added workaround for
erratum A-009885.

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
---
 Documentation/devicetree/bindings/net/fsl-fman.txt | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/fsl-fman.txt b/Documentation/devicetree/bindings/net/fsl-fman.txt
index c00fb0d22c7b..020337f3c05f 100644
--- a/Documentation/devicetree/bindings/net/fsl-fman.txt
+++ b/Documentation/devicetree/bindings/net/fsl-fman.txt
@@ -410,6 +410,15 @@ PROPERTIES
 		The settings and programming routines for internal/external
 		MDIO are different. Must be included for internal MDIO.
 
+- fsl,erratum-a009885
+		Usage: optional
+		Value type: <boolean>
+		Definition: Indicates the presence of the A009885
+		erratum describing that the contents of MDIO_DATA may
+		become corrupt unless it is read within 16 MDC cycles
+		of MDIO_CFG[BSY] being cleared, when performing an
+		MDIO read operation.
+
 - fsl,erratum-a011043
 		Usage: optional
 		Value type: <boolean>
-- 
2.25.1


^ permalink raw reply related

* Re: [PATCH 00/13] powerpc/bpf: Some fixes and updates
From: Michael Ellerman @ 2022-01-16 10:41 UTC (permalink / raw)
  To: Michael Ellerman, Daniel Borkmann, Alexei Starovoitov,
	Naveen N. Rao
  Cc: johan.almbladh, ykaliuta, Jiri Olsa, song, bpf, linuxppc-dev,
	Hari Bathini
In-Reply-To: <cover.1641468127.git.naveen.n.rao@linux.vnet.ibm.com>

On Thu, 6 Jan 2022 17:15:04 +0530, Naveen N. Rao wrote:
> A set of fixes and updates to powerpc BPF JIT:
> - Patches 1-3 fix issues with the existing powerpc JIT and are tagged
>   for -stable.
> - Patch 4 fixes a build issue with bpf selftests on powerpc.
> - Patches 5-9 handle some corner cases and make some small improvements.
> - Patches 10-13 optimize how function calls are handled in ppc64.
> 
> [...]

Patches 1-4, and 8 applied to powerpc/fixes.

[01/13] bpf: Guard against accessing NULL pt_regs in bpf_get_task_stack()
        https://git.kernel.org/powerpc/c/b992f01e66150fc5e90be4a96f5eb8e634c8249e
[02/13] powerpc32/bpf: Fix codegen for bpf-to-bpf calls
        https://git.kernel.org/powerpc/c/fab07611fb2e6a15fac05c4583045ca5582fd826
[03/13] powerpc/bpf: Update ldimm64 instructions during extra pass
        https://git.kernel.org/powerpc/c/f9320c49993ca3c0ec0f9a7026b313735306bb8b
[04/13] tools/bpf: Rename 'struct event' to avoid naming conflict
        https://git.kernel.org/powerpc/c/88a71086c48ae98e93c0208044827621e9717f7e
[08/13] powerpc64/bpf: Limit 'ldbrx' to processors compliant with ISA v2.06
        https://git.kernel.org/powerpc/c/3f5f766d5f7f95a69a630da3544a1a0cee1cdddf

cheers

^ permalink raw reply

* Re: [PATCH v2] powerpc/audit: Fix syscall_get_arch()
From: Michael Ellerman @ 2022-01-16 10:41 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Christophe Leroy,
	Paul Mackerras
  Cc: linuxppc-dev, linux-kernel, stable, Dmitry V . Levin
In-Reply-To: <c55cddb8f65713bf5859ed675d75a50cb37d5995.1642159570.git.christophe.leroy@csgroup.eu>

On Fri, 14 Jan 2022 11:26:25 +0000, Christophe Leroy wrote:
> Commit 770cec16cdc9 ("powerpc/audit: Simplify syscall_get_arch()")
> and commit 898a1ef06ad4 ("powerpc/audit: Avoid unneccessary #ifdef
> in syscall_get_arguments()")
> replaced test_tsk_thread_flag(task, TIF_32BIT)) by is_32bit_task().
> 
> But is_32bit_task() applies on current task while be want the test
> done on task 'task'
> 
> [...]

Applied to powerpc/fixes.

[1/1] powerpc/audit: Fix syscall_get_arch()
      https://git.kernel.org/powerpc/c/252745240ba0ae774d2f80c5e185ed59fbc4fb41

cheers

^ permalink raw reply

* Re: [PATCH] powerpc: Add missing SPDX license identifiers
From: Michael Ellerman @ 2022-01-16  9:57 UTC (permalink / raw)
  To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras
  Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
In-Reply-To: <4f2631b68df111c623a00c7c11af0ec474507ed3.1642157336.git.christophe.leroy@csgroup.eu>

Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Several files are missing SPDX license identifiers.
>
> Add to them the default kernel license identifier, ie GPL-2.0.

I'm not sure if that's OK, or if we're supposed to make some effort to
determine if the files were intended to be licensed some other way. eg.
if a file was added as part of a commit with other files licensed
GPL-2.0-or-later, maybe the intention was to license all files in that
commit that way. But I'm not sure what the process is meant to be.

Can you resend this and the other one and Cc Thomas, Greg and the SPDX
list (linux-spdx@vger.kernel.org). Hopefully they can tell us what to
do.

cheers

>
> DTS files are handled in a separate commit.
>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
>  arch/powerpc/Makefile                                        | 1 +
>  arch/powerpc/boot/44x.h                                      | 1 +
>  arch/powerpc/boot/4xx.h                                      | 1 +
>  arch/powerpc/boot/crtsavres.S                                | 1 +
>  arch/powerpc/boot/dummy.c                                    | 1 +
>  arch/powerpc/boot/install.sh                                 | 1 +
>  arch/powerpc/boot/ops.h                                      | 1 +
>  arch/powerpc/boot/serial.c                                   | 1 +
>  arch/powerpc/boot/simple_alloc.c                             | 1 +
>  arch/powerpc/include/asm/8xx_immap.h                         | 1 +
>  arch/powerpc/include/asm/asm-compat.h                        | 1 +
>  arch/powerpc/include/asm/asm-const.h                         | 1 +
>  arch/powerpc/include/asm/asm-offsets.h                       | 1 +
>  arch/powerpc/include/asm/cpm.h                               | 1 +
>  arch/powerpc/include/asm/dtl.h                               | 1 +
>  arch/powerpc/include/asm/edac.h                              | 1 +
>  arch/powerpc/include/asm/ehv_pic.h                           | 1 +
>  arch/powerpc/include/asm/emergency-restart.h                 | 1 +
>  arch/powerpc/include/asm/epapr_hcalls.h                      | 1 +
>  arch/powerpc/include/asm/fixmap.h                            | 1 +
>  arch/powerpc/include/asm/floppy.h                            | 1 +
>  arch/powerpc/include/asm/fs_pd.h                             | 1 +
>  arch/powerpc/include/asm/fsl_hcalls.h                        | 1 +
>  arch/powerpc/include/asm/hydra.h                             | 1 +
>  arch/powerpc/include/asm/ibmebus.h                           | 1 +
>  arch/powerpc/include/asm/kgdb.h                              | 1 +
>  arch/powerpc/include/asm/membarrier.h                        | 1 +
>  arch/powerpc/include/asm/module.lds.h                        | 1 +
>  arch/powerpc/include/asm/mpc52xx.h                           | 1 +
>  arch/powerpc/include/asm/mpc52xx_psc.h                       | 1 +
>  arch/powerpc/include/asm/pmac_feature.h                      | 1 +
>  arch/powerpc/include/asm/ppc_asm.h                           | 1 +
>  arch/powerpc/include/asm/pte-walk.h                          | 1 +
>  arch/powerpc/include/asm/rheap.h                             | 1 +
>  arch/powerpc/include/asm/sfp-machine.h                       | 1 +
>  arch/powerpc/include/asm/vmalloc.h                           | 1 +
>  arch/powerpc/include/asm/word-at-a-time.h                    | 1 +
>  arch/powerpc/kernel/interrupt_64.S                           | 1 +
>  arch/powerpc/kernel/kgdb.c                                   | 1 +
>  arch/powerpc/kernel/ptrace/ptrace.c                          | 1 +
>  arch/powerpc/kernel/ptrace/ptrace32.c                        | 1 +
>  arch/powerpc/kernel/signal.c                                 | 1 +
>  arch/powerpc/kernel/signal.h                                 | 1 +
>  arch/powerpc/kernel/vdso32/note.S                            | 1 +
>  arch/powerpc/kernel/vdso64/note.S                            | 1 +
>  arch/powerpc/kvm/mpic.c                                      | 1 +
>  arch/powerpc/lib/crtsavres.S                                 | 1 +
>  arch/powerpc/lib/restart_table.c                             | 1 +
>  arch/powerpc/lib/rheap.c                                     | 1 +
>  arch/powerpc/mm/book3s64/hash_4k.c                           | 1 +
>  arch/powerpc/mm/book3s64/hash_64k.c                          | 1 +
>  arch/powerpc/mm/book3s64/hash_hugepage.c                     | 1 +
>  arch/powerpc/mm/hugetlbpage.c                                | 1 +
>  arch/powerpc/perf/req-gen/_end.h                             | 1 +
>  arch/powerpc/platforms/44x/fsp2.h                            | 1 +
>  arch/powerpc/platforms/4xx/pci.c                             | 1 +
>  arch/powerpc/platforms/4xx/pci.h                             | 1 +
>  arch/powerpc/platforms/52xx/efika.c                          | 1 +
>  arch/powerpc/platforms/52xx/mpc52xx_common.c                 | 1 +
>  arch/powerpc/platforms/52xx/mpc52xx_pci.c                    | 1 +
>  arch/powerpc/platforms/52xx/mpc52xx_pic.c                    | 1 +
>  arch/powerpc/platforms/85xx/ksi8560.c                        | 1 +
>  arch/powerpc/platforms/85xx/p1022_ds.c                       | 1 +
>  arch/powerpc/platforms/85xx/p1022_rdk.c                      | 1 +
>  arch/powerpc/platforms/8xx/ep88xc.c                          | 1 +
>  arch/powerpc/platforms/8xx/mpc86xads.h                       | 1 +
>  arch/powerpc/platforms/8xx/mpc86xads_setup.c                 | 1 +
>  arch/powerpc/platforms/8xx/mpc885ads.h                       | 1 +
>  arch/powerpc/platforms/8xx/mpc885ads_setup.c                 | 1 +
>  arch/powerpc/platforms/8xx/mpc8xx.h                          | 1 +
>  arch/powerpc/platforms/8xx/pic.c                             | 1 +
>  arch/powerpc/platforms/8xx/pic.h                             | 1 +
>  arch/powerpc/platforms/8xx/tqm8xx_setup.c                    | 1 +
>  arch/powerpc/platforms/cell/spufs/spu_restore_dump.h_shipped | 1 +
>  arch/powerpc/platforms/cell/spufs/spu_save_dump.h_shipped    | 1 +
>  arch/powerpc/platforms/chrp/gg2.h                            | 1 +
>  arch/powerpc/platforms/embedded6xx/linkstation.c             | 1 +
>  arch/powerpc/platforms/embedded6xx/ls_uart.c                 | 1 +
>  arch/powerpc/platforms/embedded6xx/mpc10x.h                  | 1 +
>  arch/powerpc/platforms/embedded6xx/storcenter.c              | 1 +
>  arch/powerpc/platforms/microwatt/Makefile                    | 1 +
>  arch/powerpc/platforms/microwatt/setup.c                     | 1 +
>  arch/powerpc/platforms/pseries/ibmebus.c                     | 1 +
>  arch/powerpc/sysdev/cpm2.c                                   | 1 +
>  arch/powerpc/sysdev/cpm2_pic.c                               | 1 +
>  arch/powerpc/sysdev/ehv_pic.c                                | 1 +
>  arch/powerpc/sysdev/ge/ge_pic.c                              | 1 +
>  arch/powerpc/sysdev/mpic.c                                   | 1 +
>  arch/powerpc/sysdev/rtc_cmos_setup.c                         | 1 +
>  arch/powerpc/tools/ci-build.sh                               | 1 +
>  arch/powerpc/tools/head_check.sh                             | 1 +
>  arch/powerpc/xmon/ppc.h                                      | 1 +
>  92 files changed, 92 insertions(+)
>
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index 5f16ac1583c5..b0298c5a78d3 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -1,3 +1,4 @@
> +# SPDX-License-Identifier: GPL-2.0
>  # This file is included by the global makefile so that you can add your own
>  # architecture-specific flags and dependencies.
>  #
> diff --git a/arch/powerpc/boot/44x.h b/arch/powerpc/boot/44x.h
> index 02563443788a..16a4c47c8c41 100644
> --- a/arch/powerpc/boot/44x.h
> +++ b/arch/powerpc/boot/44x.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * PowerPC 44x related functions
>   *
> diff --git a/arch/powerpc/boot/4xx.h b/arch/powerpc/boot/4xx.h
> index 7dc5d45361bc..f13267f67155 100644
> --- a/arch/powerpc/boot/4xx.h
> +++ b/arch/powerpc/boot/4xx.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * PowerPC 4xx related functions
>   *
> diff --git a/arch/powerpc/boot/crtsavres.S b/arch/powerpc/boot/crtsavres.S
> index 085fb2b9a8b8..068f3b8b6c58 100644
> --- a/arch/powerpc/boot/crtsavres.S
> +++ b/arch/powerpc/boot/crtsavres.S
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * Special support for eabi and SVR4
>   *
> diff --git a/arch/powerpc/boot/dummy.c b/arch/powerpc/boot/dummy.c
> index 31dbf45bf99c..3f9ccbf52783 100644
> --- a/arch/powerpc/boot/dummy.c
> +++ b/arch/powerpc/boot/dummy.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  int main(void)
>  {
>  	return 0;
> diff --git a/arch/powerpc/boot/install.sh b/arch/powerpc/boot/install.sh
> index 14473150ddb4..62479150e772 100644
> --- a/arch/powerpc/boot/install.sh
> +++ b/arch/powerpc/boot/install.sh
> @@ -1,4 +1,5 @@
>  #!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0
>  #
>  # This file is subject to the terms and conditions of the GNU General Public
>  # License.  See the file "COPYING" in the main directory of this archive
> diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h
> index 6455fc9a244f..eafdb44bb6ed 100644
> --- a/arch/powerpc/boot/ops.h
> +++ b/arch/powerpc/boot/ops.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * Global definition of all the bootwrapper operations.
>   *
> diff --git a/arch/powerpc/boot/serial.c b/arch/powerpc/boot/serial.c
> index 54d2522be485..8aebbeda735c 100644
> --- a/arch/powerpc/boot/serial.c
> +++ b/arch/powerpc/boot/serial.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * Generic serial console support
>   *
> diff --git a/arch/powerpc/boot/simple_alloc.c b/arch/powerpc/boot/simple_alloc.c
> index 65ec135d0157..5b3c2fb16860 100644
> --- a/arch/powerpc/boot/simple_alloc.c
> +++ b/arch/powerpc/boot/simple_alloc.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * Implement primitive realloc(3) functionality.
>   *
> diff --git a/arch/powerpc/include/asm/8xx_immap.h b/arch/powerpc/include/asm/8xx_immap.h
> index bdf0563ba423..0cd91d52e3fd 100644
> --- a/arch/powerpc/include/asm/8xx_immap.h
> +++ b/arch/powerpc/include/asm/8xx_immap.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * MPC8xx Internal Memory Map
>   * Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
> diff --git a/arch/powerpc/include/asm/asm-compat.h b/arch/powerpc/include/asm/asm-compat.h
> index 2b736d9fbb1b..a6cdaf40d7b4 100644
> --- a/arch/powerpc/include/asm/asm-compat.h
> +++ b/arch/powerpc/include/asm/asm-compat.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  #ifndef _ASM_POWERPC_ASM_COMPAT_H
>  #define _ASM_POWERPC_ASM_COMPAT_H
>  
> diff --git a/arch/powerpc/include/asm/asm-const.h b/arch/powerpc/include/asm/asm-const.h
> index bfb3c3534877..922ba500c3f2 100644
> --- a/arch/powerpc/include/asm/asm-const.h
> +++ b/arch/powerpc/include/asm/asm-const.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  #ifndef _ASM_POWERPC_ASM_CONST_H
>  #define _ASM_POWERPC_ASM_CONST_H
>  
> diff --git a/arch/powerpc/include/asm/asm-offsets.h b/arch/powerpc/include/asm/asm-offsets.h
> index d370ee36a182..9f8535716392 100644
> --- a/arch/powerpc/include/asm/asm-offsets.h
> +++ b/arch/powerpc/include/asm/asm-offsets.h
> @@ -1 +1,2 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  #include <generated/asm-offsets.h>
> diff --git a/arch/powerpc/include/asm/cpm.h b/arch/powerpc/include/asm/cpm.h
> index ce483b0f8a4d..475781aa71c5 100644
> --- a/arch/powerpc/include/asm/cpm.h
> +++ b/arch/powerpc/include/asm/cpm.h
> @@ -1 +1,2 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  #include <soc/fsl/cpm.h>
> diff --git a/arch/powerpc/include/asm/dtl.h b/arch/powerpc/include/asm/dtl.h
> index 1625888f27ef..1368c2963dfd 100644
> --- a/arch/powerpc/include/asm/dtl.h
> +++ b/arch/powerpc/include/asm/dtl.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  #ifndef _ASM_POWERPC_DTL_H
>  #define _ASM_POWERPC_DTL_H
>  
> diff --git a/arch/powerpc/include/asm/edac.h b/arch/powerpc/include/asm/edac.h
> index 5571e23d253e..d10e4ea565bb 100644
> --- a/arch/powerpc/include/asm/edac.h
> +++ b/arch/powerpc/include/asm/edac.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * PPC EDAC common defs
>   *
> diff --git a/arch/powerpc/include/asm/ehv_pic.h b/arch/powerpc/include/asm/ehv_pic.h
> index dc7d48e3ea90..fecf32db2014 100644
> --- a/arch/powerpc/include/asm/ehv_pic.h
> +++ b/arch/powerpc/include/asm/ehv_pic.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * EHV_PIC private definitions and structure.
>   *
> diff --git a/arch/powerpc/include/asm/emergency-restart.h b/arch/powerpc/include/asm/emergency-restart.h
> index 3711bd9d50bd..ba702050dced 100644
> --- a/arch/powerpc/include/asm/emergency-restart.h
> +++ b/arch/powerpc/include/asm/emergency-restart.h
> @@ -1 +1,2 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  #include <asm-generic/emergency-restart.h>
> diff --git a/arch/powerpc/include/asm/epapr_hcalls.h b/arch/powerpc/include/asm/epapr_hcalls.h
> index c99ba08a408d..07cc9c8d48fe 100644
> --- a/arch/powerpc/include/asm/epapr_hcalls.h
> +++ b/arch/powerpc/include/asm/epapr_hcalls.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * ePAPR hcall interface
>   *
> diff --git a/arch/powerpc/include/asm/fixmap.h b/arch/powerpc/include/asm/fixmap.h
> index 947b5b9c4424..62d1ba66ea7d 100644
> --- a/arch/powerpc/include/asm/fixmap.h
> +++ b/arch/powerpc/include/asm/fixmap.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * fixmap.h: compile-time virtual memory allocation
>   *
> diff --git a/arch/powerpc/include/asm/floppy.h b/arch/powerpc/include/asm/floppy.h
> index f8ce178b43b7..d84e3ef8ed4b 100644
> --- a/arch/powerpc/include/asm/floppy.h
> +++ b/arch/powerpc/include/asm/floppy.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * Architecture specific parts of the Floppy driver
>   *
> diff --git a/arch/powerpc/include/asm/fs_pd.h b/arch/powerpc/include/asm/fs_pd.h
> index 8def56ec05c6..ae13bdea65d5 100644
> --- a/arch/powerpc/include/asm/fs_pd.h
> +++ b/arch/powerpc/include/asm/fs_pd.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * Platform information definitions.
>   *
> diff --git a/arch/powerpc/include/asm/fsl_hcalls.h b/arch/powerpc/include/asm/fsl_hcalls.h
> index b889d13547fd..07d88dc7b24a 100644
> --- a/arch/powerpc/include/asm/fsl_hcalls.h
> +++ b/arch/powerpc/include/asm/fsl_hcalls.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * Freescale hypervisor call interface
>   *
> diff --git a/arch/powerpc/include/asm/hydra.h b/arch/powerpc/include/asm/hydra.h
> index d024447283a0..94cce3047058 100644
> --- a/arch/powerpc/include/asm/hydra.h
> +++ b/arch/powerpc/include/asm/hydra.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   *  include/asm-ppc/hydra.h -- Mac I/O `Hydra' definitions
>   *
> diff --git a/arch/powerpc/include/asm/ibmebus.h b/arch/powerpc/include/asm/ibmebus.h
> index 088f95b2e14f..866b17f80c61 100644
> --- a/arch/powerpc/include/asm/ibmebus.h
> +++ b/arch/powerpc/include/asm/ibmebus.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * IBM PowerPC eBus Infrastructure Support.
>   *
> diff --git a/arch/powerpc/include/asm/kgdb.h b/arch/powerpc/include/asm/kgdb.h
> index a9e098a3b881..28bf91f99f34 100644
> --- a/arch/powerpc/include/asm/kgdb.h
> +++ b/arch/powerpc/include/asm/kgdb.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * The PowerPC (32/64) specific defines / externs for KGDB.  Based on
>   * the previous 32bit and 64bit specific files, which had the following
> diff --git a/arch/powerpc/include/asm/membarrier.h b/arch/powerpc/include/asm/membarrier.h
> index de7f79157918..012bba812c3a 100644
> --- a/arch/powerpc/include/asm/membarrier.h
> +++ b/arch/powerpc/include/asm/membarrier.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  #ifndef _ASM_POWERPC_MEMBARRIER_H
>  #define _ASM_POWERPC_MEMBARRIER_H
>  
> diff --git a/arch/powerpc/include/asm/module.lds.h b/arch/powerpc/include/asm/module.lds.h
> index cea5dc124be4..a4dd672e8c6a 100644
> --- a/arch/powerpc/include/asm/module.lds.h
> +++ b/arch/powerpc/include/asm/module.lds.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /* Force alignment of .toc section.  */
>  SECTIONS
>  {
> diff --git a/arch/powerpc/include/asm/mpc52xx.h b/arch/powerpc/include/asm/mpc52xx.h
> index ce1e0aabaa64..604d6c3651e8 100644
> --- a/arch/powerpc/include/asm/mpc52xx.h
> +++ b/arch/powerpc/include/asm/mpc52xx.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * Prototypes, etc. for the Freescale MPC52xx embedded cpu chips
>   * May need to be cleaned as the port goes on ...
> diff --git a/arch/powerpc/include/asm/mpc52xx_psc.h b/arch/powerpc/include/asm/mpc52xx_psc.h
> index ec995b289280..d42245686250 100644
> --- a/arch/powerpc/include/asm/mpc52xx_psc.h
> +++ b/arch/powerpc/include/asm/mpc52xx_psc.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * include/asm-ppc/mpc52xx_psc.h
>   *
> diff --git a/arch/powerpc/include/asm/pmac_feature.h b/arch/powerpc/include/asm/pmac_feature.h
> index e08e829261b6..5fe92ff953b1 100644
> --- a/arch/powerpc/include/asm/pmac_feature.h
> +++ b/arch/powerpc/include/asm/pmac_feature.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * Definition of platform feature hooks for PowerMacs
>   *
> diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
> index 3c06a33b5da4..d9c6f12e6d3e 100644
> --- a/arch/powerpc/include/asm/ppc_asm.h
> +++ b/arch/powerpc/include/asm/ppc_asm.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * Copyright (C) 1995-1999 Gary Thomas, Paul Mackerras, Cort Dougan.
>   */
> diff --git a/arch/powerpc/include/asm/pte-walk.h b/arch/powerpc/include/asm/pte-walk.h
> index 714a35f0d425..dc8bd55e749f 100644
> --- a/arch/powerpc/include/asm/pte-walk.h
> +++ b/arch/powerpc/include/asm/pte-walk.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  #ifndef _ASM_POWERPC_PTE_WALK_H
>  #define _ASM_POWERPC_PTE_WALK_H
>  
> diff --git a/arch/powerpc/include/asm/rheap.h b/arch/powerpc/include/asm/rheap.h
> index 8e83703d6736..cd6455e594e4 100644
> --- a/arch/powerpc/include/asm/rheap.h
> +++ b/arch/powerpc/include/asm/rheap.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * include/asm-ppc/rheap.h
>   *
> diff --git a/arch/powerpc/include/asm/sfp-machine.h b/arch/powerpc/include/asm/sfp-machine.h
> index 8b957aabb826..17b376ff8212 100644
> --- a/arch/powerpc/include/asm/sfp-machine.h
> +++ b/arch/powerpc/include/asm/sfp-machine.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /* Machine-dependent software floating-point definitions.  PPC version.
>     Copyright (C) 1997 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
> diff --git a/arch/powerpc/include/asm/vmalloc.h b/arch/powerpc/include/asm/vmalloc.h
> index 4c69ece52a31..6f8df6b07c8a 100644
> --- a/arch/powerpc/include/asm/vmalloc.h
> +++ b/arch/powerpc/include/asm/vmalloc.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  #ifndef _ASM_POWERPC_VMALLOC_H
>  #define _ASM_POWERPC_VMALLOC_H
>  
> diff --git a/arch/powerpc/include/asm/word-at-a-time.h b/arch/powerpc/include/asm/word-at-a-time.h
> index f3f4710d4ff5..96245747720d 100644
> --- a/arch/powerpc/include/asm/word-at-a-time.h
> +++ b/arch/powerpc/include/asm/word-at-a-time.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  #ifndef _ASM_WORD_AT_A_TIME_H
>  #define _ASM_WORD_AT_A_TIME_H
>  
> diff --git a/arch/powerpc/kernel/interrupt_64.S b/arch/powerpc/kernel/interrupt_64.S
> index 92088f848266..46e886c4264b 100644
> --- a/arch/powerpc/kernel/interrupt_64.S
> +++ b/arch/powerpc/kernel/interrupt_64.S
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  #include <asm/asm-offsets.h>
>  #include <asm/bug.h>
>  #ifdef CONFIG_PPC_BOOK3S
> diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
> index 9f8d0fa7b718..10d64d54d2a1 100644
> --- a/arch/powerpc/kernel/kgdb.c
> +++ b/arch/powerpc/kernel/kgdb.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * PowerPC backend to the KGDB stub.
>   *
> diff --git a/arch/powerpc/kernel/ptrace/ptrace.c b/arch/powerpc/kernel/ptrace/ptrace.c
> index 7c7093c17c45..0be1c76a0e65 100644
> --- a/arch/powerpc/kernel/ptrace/ptrace.c
> +++ b/arch/powerpc/kernel/ptrace/ptrace.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   *  PowerPC version
>   *    Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
> diff --git a/arch/powerpc/kernel/ptrace/ptrace32.c b/arch/powerpc/kernel/ptrace/ptrace32.c
> index 19c224808982..adffe6f1e7d8 100644
> --- a/arch/powerpc/kernel/ptrace/ptrace32.c
> +++ b/arch/powerpc/kernel/ptrace/ptrace32.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * ptrace for 32-bit processes running on a 64-bit kernel.
>   *
> diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c
> index b93b87df499d..d541b6e00069 100644
> --- a/arch/powerpc/kernel/signal.c
> +++ b/arch/powerpc/kernel/signal.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * Common signal handling code for both 32 and 64 bits
>   *
> diff --git a/arch/powerpc/kernel/signal.h b/arch/powerpc/kernel/signal.h
> index 618aeccdf691..b2e398dae4fc 100644
> --- a/arch/powerpc/kernel/signal.h
> +++ b/arch/powerpc/kernel/signal.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   *    Copyright (c) 2007 Benjamin Herrenschmidt, IBM Corporation
>   *    Extracted from signal_32.c and signal_64.c
> diff --git a/arch/powerpc/kernel/vdso32/note.S b/arch/powerpc/kernel/vdso32/note.S
> index 227a7327399e..1698e72d4cbf 100644
> --- a/arch/powerpc/kernel/vdso32/note.S
> +++ b/arch/powerpc/kernel/vdso32/note.S
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * This supplies .note.* sections to go into the PT_NOTE inside the vDSO text.
>   * Here we can supply some information useful to userland.
> diff --git a/arch/powerpc/kernel/vdso64/note.S b/arch/powerpc/kernel/vdso64/note.S
> index dc2a509f7e8a..bd1fa23597d6 100644
> --- a/arch/powerpc/kernel/vdso64/note.S
> +++ b/arch/powerpc/kernel/vdso64/note.S
> @@ -1 +1,2 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  #include "../vdso32/note.S"
> diff --git a/arch/powerpc/kvm/mpic.c b/arch/powerpc/kvm/mpic.c
> index 23e9c2bd9f27..e0982f87150a 100644
> --- a/arch/powerpc/kvm/mpic.c
> +++ b/arch/powerpc/kvm/mpic.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * OpenPIC emulation
>   *
> diff --git a/arch/powerpc/lib/crtsavres.S b/arch/powerpc/lib/crtsavres.S
> index 7e5e1c28e56a..d704cf81c19f 100644
> --- a/arch/powerpc/lib/crtsavres.S
> +++ b/arch/powerpc/lib/crtsavres.S
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * Special support for eabi and SVR4
>   *
> diff --git a/arch/powerpc/lib/restart_table.c b/arch/powerpc/lib/restart_table.c
> index bccb662c1b7b..aaf89522d23e 100644
> --- a/arch/powerpc/lib/restart_table.c
> +++ b/arch/powerpc/lib/restart_table.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  #include <asm/interrupt.h>
>  #include <asm/kprobes.h>
>  
> diff --git a/arch/powerpc/lib/rheap.c b/arch/powerpc/lib/rheap.c
> index 6aa774aa5b16..4dbe073766bf 100644
> --- a/arch/powerpc/lib/rheap.c
> +++ b/arch/powerpc/lib/rheap.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * A Remote Heap.  Remote means that we don't touch the memory that the
>   * heap points to. Normal heap implementations use the memory they manage
> diff --git a/arch/powerpc/mm/book3s64/hash_4k.c b/arch/powerpc/mm/book3s64/hash_4k.c
> index 7de1a8a0c62a..847364aa7a55 100644
> --- a/arch/powerpc/mm/book3s64/hash_4k.c
> +++ b/arch/powerpc/mm/book3s64/hash_4k.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * Copyright IBM Corporation, 2015
>   * Author Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> diff --git a/arch/powerpc/mm/book3s64/hash_64k.c b/arch/powerpc/mm/book3s64/hash_64k.c
> index 998c6817ed47..e302942138ee 100644
> --- a/arch/powerpc/mm/book3s64/hash_64k.c
> +++ b/arch/powerpc/mm/book3s64/hash_64k.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * Copyright IBM Corporation, 2015
>   * Author Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> diff --git a/arch/powerpc/mm/book3s64/hash_hugepage.c b/arch/powerpc/mm/book3s64/hash_hugepage.c
> index c0fabe6c5a12..bb6a63e946be 100644
> --- a/arch/powerpc/mm/book3s64/hash_hugepage.c
> +++ b/arch/powerpc/mm/book3s64/hash_hugepage.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * Copyright IBM Corporation, 2013
>   * Author Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
> index ddead41e2194..5cdd7a587e09 100644
> --- a/arch/powerpc/mm/hugetlbpage.c
> +++ b/arch/powerpc/mm/hugetlbpage.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * PPC Huge TLB Page Support for Kernel.
>   *
> diff --git a/arch/powerpc/perf/req-gen/_end.h b/arch/powerpc/perf/req-gen/_end.h
> index 8a406980b6bf..6687fccd3752 100644
> --- a/arch/powerpc/perf/req-gen/_end.h
> +++ b/arch/powerpc/perf/req-gen/_end.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  
>  #undef REQ_GEN_PREFIX
>  #undef REQUEST_BEGIN
> diff --git a/arch/powerpc/platforms/44x/fsp2.h b/arch/powerpc/platforms/44x/fsp2.h
> index 9e1d52754c8b..ae637bf2b58b 100644
> --- a/arch/powerpc/platforms/44x/fsp2.h
> +++ b/arch/powerpc/platforms/44x/fsp2.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  #ifndef _ASM_POWERPC_FSP_DCR_H_
>  #define _ASM_POWERPC_FSP_DCR_H_
>  #ifdef __KERNEL__
> diff --git a/arch/powerpc/platforms/4xx/pci.c b/arch/powerpc/platforms/4xx/pci.c
> index 24f41e178cbc..1dabc65d5b3e 100644
> --- a/arch/powerpc/platforms/4xx/pci.c
> +++ b/arch/powerpc/platforms/4xx/pci.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * PCI / PCI-X / PCI-Express support for 4xx parts
>   *
> diff --git a/arch/powerpc/platforms/4xx/pci.h b/arch/powerpc/platforms/4xx/pci.h
> index bb4821938ab1..364838cc90ff 100644
> --- a/arch/powerpc/platforms/4xx/pci.h
> +++ b/arch/powerpc/platforms/4xx/pci.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * PCI / PCI-X / PCI-Express support for 4xx parts
>   *
> diff --git a/arch/powerpc/platforms/52xx/efika.c b/arch/powerpc/platforms/52xx/efika.c
> index 3b7d70d71692..8a5563ccac30 100644
> --- a/arch/powerpc/platforms/52xx/efika.c
> +++ b/arch/powerpc/platforms/52xx/efika.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * Efika 5K2 platform code
>   * Some code really inspired from the lite5200b platform.
> diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
> index 565e3a83dc9e..15608a2e8d72 100644
> --- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
> +++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   *
>   * Utility functions for the Freescale MPC52xx.
> diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pci.c b/arch/powerpc/platforms/52xx/mpc52xx_pci.c
> index af0f79995214..014e6abb10d0 100644
> --- a/arch/powerpc/platforms/52xx/mpc52xx_pci.c
> +++ b/arch/powerpc/platforms/52xx/mpc52xx_pci.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * PCI code for the Freescale MPC52xx embedded CPU.
>   *
> diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
> index 76a8102bdb98..3b1b3421de3c 100644
> --- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c
> +++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   *
>   * Programmable Interrupt Controller functions for the Freescale MPC52xx.
> diff --git a/arch/powerpc/platforms/85xx/ksi8560.c b/arch/powerpc/platforms/85xx/ksi8560.c
> index 6ef8580fdc0e..8c235d9e876a 100644
> --- a/arch/powerpc/platforms/85xx/ksi8560.c
> +++ b/arch/powerpc/platforms/85xx/ksi8560.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * Board setup routines for the Emerson KSI8560
>   *
> diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c
> index 1f1af0557470..4770108d2d32 100644
> --- a/arch/powerpc/platforms/85xx/p1022_ds.c
> +++ b/arch/powerpc/platforms/85xx/p1022_ds.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * P1022DS board specific routines
>   *
> diff --git a/arch/powerpc/platforms/85xx/p1022_rdk.c b/arch/powerpc/platforms/85xx/p1022_rdk.c
> index fd9e3e7ef234..ab12a8eb80a8 100644
> --- a/arch/powerpc/platforms/85xx/p1022_rdk.c
> +++ b/arch/powerpc/platforms/85xx/p1022_rdk.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * P1022 RDK board specific routines
>   *
> diff --git a/arch/powerpc/platforms/8xx/ep88xc.c b/arch/powerpc/platforms/8xx/ep88xc.c
> index ebcf34a14789..46daa968aa2d 100644
> --- a/arch/powerpc/platforms/8xx/ep88xc.c
> +++ b/arch/powerpc/platforms/8xx/ep88xc.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * Platform setup for the Embedded Planet EP88xC board
>   *
> diff --git a/arch/powerpc/platforms/8xx/mpc86xads.h b/arch/powerpc/platforms/8xx/mpc86xads.h
> index 17b1fe75e0b2..fb3ee1fc5709 100644
> --- a/arch/powerpc/platforms/8xx/mpc86xads.h
> +++ b/arch/powerpc/platforms/8xx/mpc86xads.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * A collection of structures, addresses, and values associated with
>   * the Freescale MPC86xADS board.
> diff --git a/arch/powerpc/platforms/8xx/mpc86xads_setup.c b/arch/powerpc/platforms/8xx/mpc86xads_setup.c
> index 8d02f5ff4481..3676df5d6e37 100644
> --- a/arch/powerpc/platforms/8xx/mpc86xads_setup.c
> +++ b/arch/powerpc/platforms/8xx/mpc86xads_setup.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*arch/powerpc/platforms/8xx/mpc86xads_setup.c
>   *
>   * Platform setup for the Freescale mpc86xads board
> diff --git a/arch/powerpc/platforms/8xx/mpc885ads.h b/arch/powerpc/platforms/8xx/mpc885ads.h
> index 19412f76fa3b..c41f98ea1c06 100644
> --- a/arch/powerpc/platforms/8xx/mpc885ads.h
> +++ b/arch/powerpc/platforms/8xx/mpc885ads.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * A collection of structures, addresses, and values associated with
>   * the Freescale MPC885ADS board.
> diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
> index a0c83c1905c6..5946f86d38f1 100644
> --- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c
> +++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * Platform setup for the Freescale mpc885ads board
>   *
> diff --git a/arch/powerpc/platforms/8xx/mpc8xx.h b/arch/powerpc/platforms/8xx/mpc8xx.h
> index 31cc2ecace42..3baa2def744e 100644
> --- a/arch/powerpc/platforms/8xx/mpc8xx.h
> +++ b/arch/powerpc/platforms/8xx/mpc8xx.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * Prototypes, etc. for the Freescale MPC8xx embedded cpu chips
>   * May need to be cleaned as the port goes on ...
> diff --git a/arch/powerpc/platforms/8xx/pic.c b/arch/powerpc/platforms/8xx/pic.c
> index f2ba837249d6..4130cea17239 100644
> --- a/arch/powerpc/platforms/8xx/pic.c
> +++ b/arch/powerpc/platforms/8xx/pic.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  #include <linux/kernel.h>
>  #include <linux/stddef.h>
>  #include <linux/sched.h>
> diff --git a/arch/powerpc/platforms/8xx/pic.h b/arch/powerpc/platforms/8xx/pic.h
> index 9fe00eebdc8b..45ec3966a2ce 100644
> --- a/arch/powerpc/platforms/8xx/pic.h
> +++ b/arch/powerpc/platforms/8xx/pic.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  #ifndef _PPC_KERNEL_MPC8xx_H
>  #define _PPC_KERNEL_MPC8xx_H
>  
> diff --git a/arch/powerpc/platforms/8xx/tqm8xx_setup.c b/arch/powerpc/platforms/8xx/tqm8xx_setup.c
> index 4cea8b1afa44..e8bbe1df929f 100644
> --- a/arch/powerpc/platforms/8xx/tqm8xx_setup.c
> +++ b/arch/powerpc/platforms/8xx/tqm8xx_setup.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * Platform setup for the MPC8xx based boards from TQM.
>   *
> diff --git a/arch/powerpc/platforms/cell/spufs/spu_restore_dump.h_shipped b/arch/powerpc/platforms/cell/spufs/spu_restore_dump.h_shipped
> index f383b027e8bf..f997a8c9edd2 100644
> --- a/arch/powerpc/platforms/cell/spufs/spu_restore_dump.h_shipped
> +++ b/arch/powerpc/platforms/cell/spufs/spu_restore_dump.h_shipped
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * spu_restore_dump.h: Copyright (C) 2005 IBM.
>   * Hex-dump auto generated from spu_restore.c.
> diff --git a/arch/powerpc/platforms/cell/spufs/spu_save_dump.h_shipped b/arch/powerpc/platforms/cell/spufs/spu_save_dump.h_shipped
> index b9f81ac8a632..f85f798e270e 100644
> --- a/arch/powerpc/platforms/cell/spufs/spu_save_dump.h_shipped
> +++ b/arch/powerpc/platforms/cell/spufs/spu_save_dump.h_shipped
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * spu_save_dump.h: Copyright (C) 2005 IBM.
>   * Hex-dump auto generated from spu_save.c.
> diff --git a/arch/powerpc/platforms/chrp/gg2.h b/arch/powerpc/platforms/chrp/gg2.h
> index 341ae55b99fb..4d984bf6917c 100644
> --- a/arch/powerpc/platforms/chrp/gg2.h
> +++ b/arch/powerpc/platforms/chrp/gg2.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   *  include/asm-ppc/gg2.h -- VLSI VAS96011/12 `Golden Gate 2' register definitions
>   *
> diff --git a/arch/powerpc/platforms/embedded6xx/linkstation.c b/arch/powerpc/platforms/embedded6xx/linkstation.c
> index eb8342e7f84e..02514e2ad67e 100644
> --- a/arch/powerpc/platforms/embedded6xx/linkstation.c
> +++ b/arch/powerpc/platforms/embedded6xx/linkstation.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * Board setup routines for the Buffalo Linkstation / Kurobox Platform.
>   *
> diff --git a/arch/powerpc/platforms/embedded6xx/ls_uart.c b/arch/powerpc/platforms/embedded6xx/ls_uart.c
> index 9d891bd5df5a..87e1264d0c9c 100644
> --- a/arch/powerpc/platforms/embedded6xx/ls_uart.c
> +++ b/arch/powerpc/platforms/embedded6xx/ls_uart.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * AVR power-management chip interface for the Buffalo Linkstation /
>   * Kurobox Platform.
> diff --git a/arch/powerpc/platforms/embedded6xx/mpc10x.h b/arch/powerpc/platforms/embedded6xx/mpc10x.h
> index 5ad12023e562..1f410e478ad5 100644
> --- a/arch/powerpc/platforms/embedded6xx/mpc10x.h
> +++ b/arch/powerpc/platforms/embedded6xx/mpc10x.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /*
>   * Common routines for the Motorola SPS MPC106/8240/107 Host bridge/Mem
>   * ctlr/EPIC/etc.
> diff --git a/arch/powerpc/platforms/embedded6xx/storcenter.c b/arch/powerpc/platforms/embedded6xx/storcenter.c
> index e188b90f7016..ac29d1d1a7b4 100644
> --- a/arch/powerpc/platforms/embedded6xx/storcenter.c
> +++ b/arch/powerpc/platforms/embedded6xx/storcenter.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * Board setup routines for the storcenter
>   *
> diff --git a/arch/powerpc/platforms/microwatt/Makefile b/arch/powerpc/platforms/microwatt/Makefile
> index 116d6d3ad3f0..7defeadac694 100644
> --- a/arch/powerpc/platforms/microwatt/Makefile
> +++ b/arch/powerpc/platforms/microwatt/Makefile
> @@ -1 +1,2 @@
> +# SPDX-License-Identifier: GPL-2.0
>  obj-y	+= setup.o rng.o
> diff --git a/arch/powerpc/platforms/microwatt/setup.c b/arch/powerpc/platforms/microwatt/setup.c
> index 0b02603bdb74..fe6c242f788f 100644
> --- a/arch/powerpc/platforms/microwatt/setup.c
> +++ b/arch/powerpc/platforms/microwatt/setup.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * Microwatt FPGA-based SoC platform setup code.
>   *
> diff --git a/arch/powerpc/platforms/pseries/ibmebus.c b/arch/powerpc/platforms/pseries/ibmebus.c
> index 7ee3ed7d6cc2..517ded1fe467 100644
> --- a/arch/powerpc/platforms/pseries/ibmebus.c
> +++ b/arch/powerpc/platforms/pseries/ibmebus.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * IBM PowerPC IBM eBus Infrastructure Support.
>   *
> diff --git a/arch/powerpc/sysdev/cpm2.c b/arch/powerpc/sysdev/cpm2.c
> index 3f130312b6e9..16ce448f0029 100644
> --- a/arch/powerpc/sysdev/cpm2.c
> +++ b/arch/powerpc/sysdev/cpm2.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * General Purpose functions for the global management of the
>   * 8260 Communication Processor Module.
> diff --git a/arch/powerpc/sysdev/cpm2_pic.c b/arch/powerpc/sysdev/cpm2_pic.c
> index 9e86074719a9..91850496f2e5 100644
> --- a/arch/powerpc/sysdev/cpm2_pic.c
> +++ b/arch/powerpc/sysdev/cpm2_pic.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * Platform information definitions.
>   *
> diff --git a/arch/powerpc/sysdev/ehv_pic.c b/arch/powerpc/sysdev/ehv_pic.c
> index 00705258ecf9..2eb956ffcd27 100644
> --- a/arch/powerpc/sysdev/ehv_pic.c
> +++ b/arch/powerpc/sysdev/ehv_pic.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   *  Driver for ePAPR Embedded Hypervisor PIC
>   *
> diff --git a/arch/powerpc/sysdev/ge/ge_pic.c b/arch/powerpc/sysdev/ge/ge_pic.c
> index 02553a8ce191..73dfe371c783 100644
> --- a/arch/powerpc/sysdev/ge/ge_pic.c
> +++ b/arch/powerpc/sysdev/ge/ge_pic.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * Interrupt handling for GE FPGA based PIC
>   *
> diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
> index d5cb48b61bbd..5071c776eed4 100644
> --- a/arch/powerpc/sysdev/mpic.c
> +++ b/arch/powerpc/sysdev/mpic.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   *  arch/powerpc/kernel/mpic.c
>   *
> diff --git a/arch/powerpc/sysdev/rtc_cmos_setup.c b/arch/powerpc/sysdev/rtc_cmos_setup.c
> index af0f9beddca9..25ba1e7306de 100644
> --- a/arch/powerpc/sysdev/rtc_cmos_setup.c
> +++ b/arch/powerpc/sysdev/rtc_cmos_setup.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * Setup code for PC-style Real-Time Clock.
>   *
> diff --git a/arch/powerpc/tools/ci-build.sh b/arch/powerpc/tools/ci-build.sh
> index 420df6ec5a2f..a861fd722495 100755
> --- a/arch/powerpc/tools/ci-build.sh
> +++ b/arch/powerpc/tools/ci-build.sh
> @@ -1,4 +1,5 @@
>  #!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
>  
>  if [[ -z "$TARGET" || -z "$IMAGE" ]]; then
>      echo "Error: required environment variables not set!"
> diff --git a/arch/powerpc/tools/head_check.sh b/arch/powerpc/tools/head_check.sh
> index 689907cda996..cc055b0ed995 100644
> --- a/arch/powerpc/tools/head_check.sh
> +++ b/arch/powerpc/tools/head_check.sh
> @@ -1,3 +1,4 @@
> +# SPDX-License-Identifier: GPL-2.0
>  # Copyright © 2016 IBM Corporation
>  
>  # This program is free software; you can redistribute it and/or
> diff --git a/arch/powerpc/xmon/ppc.h b/arch/powerpc/xmon/ppc.h
> index d00f33dcf192..4f8db773e01c 100644
> --- a/arch/powerpc/xmon/ppc.h
> +++ b/arch/powerpc/xmon/ppc.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /* ppc.h -- Header file for PowerPC opcode table
>     Copyright (C) 1994-2016 Free Software Foundation, Inc.
>     Written by Ian Lance Taylor, Cygnus Support
> -- 
> 2.33.1

^ permalink raw reply

* Re: [PATCH v2 3/3] x86: Support huge vmalloc mappings
From: Christophe Leroy @ 2022-01-15 10:17 UTC (permalink / raw)
  To: Kefeng Wang, Dave Hansen, Jonathan Corbet, Andrew Morton,
	linuxppc-dev@lists.ozlabs.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org,
	linux-arm-kernel@lists.infradead.org
  Cc: Matthew Wilcox, Catalin Marinas, Dave Hansen, Nicholas Piggin,
	Ingo Molnar, Borislav Petkov, H. Peter Anvin, Paul Mackerras,
	Thomas Gleixner, Will Deacon
In-Reply-To: <6cd5deb3-b71d-1058-f992-1c2f93c16ea4@huawei.com>



Le 29/12/2021 à 12:01, Kefeng Wang a écrit :
> 
> On 2021/12/29 0:14, Dave Hansen wrote:
>> On 12/28/21 2:26 AM, Kefeng Wang wrote:
>>>>> There are some disadvantages about this feature[2], one of the main
>>>>> concerns is the possible memory fragmentation/waste in some scenarios,
>>>>> also archs must ensure that any arch specific vmalloc allocations that
>>>>> require PAGE_SIZE mappings(eg, module alloc with STRICT_MODULE_RWX)
>>>>> use the VM_NO_HUGE_VMAP flag to inhibit larger mappings.
>>>> That just says that x86 *needs* PAGE_SIZE allocations.  But, what
>>>> happens if VM_NO_HUGE_VMAP is not passed (like it was in v1)?  Will the
>>>> subsequent permission changes just fragment the 2M mapping?
>>> Yes, without VM_NO_HUGE_VMAP, it could fragment the 2M mapping.
>>>
>>> When module alloc with STRICT_MODULE_RWX on x86, it calls
>>> __change_page_attr()
>>>
>>> from set_memory_ro/rw/nx which will split large page, so there is no
>>> need to make
>>>
>>> module alloc with HUGE_VMALLOC.
>> This all sounds very fragile to me.  Every time a new architecture would
>> get added for huge vmalloc() support, the developer needs to know to go
>> find that architecture's module_alloc() and add this flag.  They next
>> guy is going to forget, just like you did.
>>
>> Considering that this is not a hot path, a weak function would be a nice
>> choice:
>>
>> /* vmalloc() flags used for all module allocations. */
>> unsigned long __weak arch_module_vm_flags()
>> {
>>     /*
>>      * Modules use a single, large vmalloc().  Different
>>      * permissions are applied later and will fragment
>>      * huge mappings.  Avoid using huge pages for modules.
>>      */
>>     return VM_NO_HUGE_VMAP;
> 
> For x86, it only fragment, but for arm64, due to apply_to_page_range() in
> 
> set_memory_*, without this flag maybe crash. Whatever, we need this
> 
> flag for module.

I see no reason to have this flag by default.

Only ARM should have it if necessary, with a comment explaining why just 
like powerpc.

And maybe the flag should be there only when STRICT_MODULE_RWX is selected.

> 
>> }
>>
>> Stick that in some the common module code, next to:
>>
>>> void * __weak module_alloc(unsigned long size)
>>> {
>>>          return __vmalloc_node_range(size, 1, VMALLOC_START, 
>>> VMALLOC_END,
>> ...
>>
>> Then, put arch_module_vm_flags() in *all* of the module_alloc()
>> implementations, including the generic one.  That way (even with a new
>> architecture) whoever copies-and-pastes their module_alloc()
>> implementation is likely to get it right.  The next guy who just does a
>> "select HAVE_ARCH_HUGE_VMALLOC" will hopefully just work.
> 
> OK, Let me check the VM_FLUSH_RESET_PERMS and try about this way.
> 
> Thanks.
> 
>>
>> VM_FLUSH_RESET_PERMS could probably be dealt with in the same way.
>> .

^ permalink raw reply

* Re: [PATCH v2 3/3] x86: Support huge vmalloc mappings
From: Christophe Leroy @ 2022-01-15 10:15 UTC (permalink / raw)
  To: Dave Hansen, Kefeng Wang, Jonathan Corbet, Andrew Morton,
	linuxppc-dev@lists.ozlabs.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org,
	linux-arm-kernel@lists.infradead.org
  Cc: Matthew Wilcox, Catalin Marinas, Dave Hansen, Nicholas Piggin,
	Ingo Molnar, Borislav Petkov, H. Peter Anvin, Paul Mackerras,
	Thomas Gleixner, Will Deacon
In-Reply-To: <31a75f95-6e6e-b640-2d95-08a95ea8cf51@intel.com>



Le 28/12/2021 à 17:14, Dave Hansen a écrit :
> On 12/28/21 2:26 AM, Kefeng Wang wrote:
>>>> There are some disadvantages about this feature[2], one of the main
>>>> concerns is the possible memory fragmentation/waste in some scenarios,
>>>> also archs must ensure that any arch specific vmalloc allocations that
>>>> require PAGE_SIZE mappings(eg, module alloc with STRICT_MODULE_RWX)
>>>> use the VM_NO_HUGE_VMAP flag to inhibit larger mappings.
>>> That just says that x86 *needs* PAGE_SIZE allocations.  But, what
>>> happens if VM_NO_HUGE_VMAP is not passed (like it was in v1)?  Will the
>>> subsequent permission changes just fragment the 2M mapping?
>>
>> Yes, without VM_NO_HUGE_VMAP, it could fragment the 2M mapping.
>>
>> When module alloc with STRICT_MODULE_RWX on x86, it calls
>> __change_page_attr()
>>
>> from set_memory_ro/rw/nx which will split large page, so there is no
>> need to make
>>
>> module alloc with HUGE_VMALLOC.
> 
> This all sounds very fragile to me.  Every time a new architecture would
> get added for huge vmalloc() support, the developer needs to know to go
> find that architecture's module_alloc() and add this flag.  They next
> guy is going to forget, just like you did.

That's not correct from my point of view.

When powerpc added that, a clear comment explains why:


+	/*
+	 * Don't do huge page allocations for modules yet until more testing
+	 * is done. STRICT_MODULE_RWX may require extra work to support this
+	 * too.
+	 */

So as you can see, this is something specific to powerpc and temporary.

> 
> Considering that this is not a hot path, a weak function would be a nice
> choice:
> 
> /* vmalloc() flags used for all module allocations. */
> unsigned long __weak arch_module_vm_flags()
> {
> 	/*
> 	 * Modules use a single, large vmalloc().  Different
> 	 * permissions are applied later and will fragment
> 	 * huge mappings.  Avoid using huge pages for modules.
> 	 */

Why ? Not everybody use STRICT_MODULES_RWX.
Even if you do so, you can still benefit from huge pages for modules.

Why make what was initially a temporary precaution for powerpc become a 
definitive default limitation for all ?

> 	return VM_NO_HUGE_VMAP;
> }
> 
> Stick that in some the common module code, next to:
> 
>> void * __weak module_alloc(unsigned long size)
>> {
>>          return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END,
> ...
> 
> Then, put arch_module_vm_flags() in *all* of the module_alloc()
> implementations, including the generic one.  That way (even with a new
> architecture) whoever copies-and-pastes their module_alloc()
> implementation is likely to get it right.  The next guy who just does a
> "select HAVE_ARCH_HUGE_VMALLOC" will hopefully just work.
> 
> VM_FLUSH_RESET_PERMS could probably be dealt with in the same way.

^ permalink raw reply

* Re: [PATCH v2 3/3] x86: Support huge vmalloc mappings
From: Christophe Leroy @ 2022-01-15 10:11 UTC (permalink / raw)
  To: Kefeng Wang, Dave Hansen, Jonathan Corbet, Andrew Morton,
	linuxppc-dev@lists.ozlabs.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org,
	linux-arm-kernel@lists.infradead.org
  Cc: Matthew Wilcox, Catalin Marinas, Dave Hansen, Nicholas Piggin,
	Ingo Molnar, Borislav Petkov, H. Peter Anvin, Paul Mackerras,
	Thomas Gleixner, Will Deacon
In-Reply-To: <3858de1f-cdbc-ff52-2890-4254d0f48b0a@huawei.com>



Le 28/12/2021 à 11:26, Kefeng Wang a écrit :
> 
> On 2021/12/27 23:56, Dave Hansen wrote:
>> On 12/27/21 6:59 AM, Kefeng Wang wrote:
>>> This patch select HAVE_ARCH_HUGE_VMALLOC to let X86_64 and X86_PAE
>>> support huge vmalloc mappings.
>> In general, this seems interesting and the diff is simple.  But, I don't
>> see _any_ x86-specific data.  I think the bare minimum here would be a
>> few kernel compiles and some 'perf stat' data for some TLB events.
> 
> When the feature supported on ppc,
> 
> commit 8abddd968a303db75e4debe77a3df484164f1f33
> Author: Nicholas Piggin <npiggin@gmail.com>
> Date:   Mon May 3 19:17:55 2021 +1000
> 
>      powerpc/64s/radix: Enable huge vmalloc mappings
> 
>      This reduces TLB misses by nearly 30x on a `git diff` workload on a
>      2-node POWER9 (59,800 -> 2,100) and reduces CPU cycles by 0.54%, due
>      to vfs hashes being allocated with 2MB pages.
> 
> But the data could be different on different machine/arch.
> 
>>> diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c
>>> index 95fa745e310a..6bf5cb7d876a 100644
>>> --- a/arch/x86/kernel/module.c
>>> +++ b/arch/x86/kernel/module.c
>>> @@ -75,8 +75,8 @@ void *module_alloc(unsigned long size)
>>>       p = __vmalloc_node_range(size, MODULE_ALIGN,
>>>                       MODULES_VADDR + get_module_load_offset(),
>>> -                    MODULES_END, gfp_mask,
>>> -                    PAGE_KERNEL, VM_DEFER_KMEMLEAK, NUMA_NO_NODE,
>>> +                    MODULES_END, gfp_mask, PAGE_KERNEL,
>>> +                    VM_DEFER_KMEMLEAK | VM_NO_HUGE_VMAP, NUMA_NO_NODE,
>>>                       __builtin_return_address(0));
>>>       if (p && (kasan_module_alloc(p, size, gfp_mask) < 0)) {
>>>           vfree(p);
>> To figure out what's going on in this hunk, I had to look at the cover
>> letter (which I wasn't cc'd on).  That's not great and it means that
>> somebody who stumbles upon this in the code is going to have a really
>> hard time figuring out what is going on.  Cover letters don't make it
>> into git history.
> Sorry for that, will add more into arch's patch changelog.
>> This desperately needs a comment and some changelog material in *this*
>> patch.
>>
>> But, even the description from the cover letter is sparse:
>>
>>> There are some disadvantages about this feature[2], one of the main
>>> concerns is the possible memory fragmentation/waste in some scenarios,
>>> also archs must ensure that any arch specific vmalloc allocations that
>>> require PAGE_SIZE mappings(eg, module alloc with STRICT_MODULE_RWX)
>>> use the VM_NO_HUGE_VMAP flag to inhibit larger mappings.
>> That just says that x86 *needs* PAGE_SIZE allocations.  But, what
>> happens if VM_NO_HUGE_VMAP is not passed (like it was in v1)?  Will the
>> subsequent permission changes just fragment the 2M mapping?
>> .
> 
> Yes, without VM_NO_HUGE_VMAP, it could fragment the 2M mapping.
> 
> When module alloc with STRICT_MODULE_RWX on x86, it calls 
> __change_page_attr()
> 
> from set_memory_ro/rw/nx which will split large page, so there is no 
> need to make
> 
> module alloc with HUGE_VMALLOC.
> 

Maybe there is no need to perform the module alloc with HUGE_VMALLOC, 
but it least it would still work if you do so.

Powerpc did add VM_NO_HUGE_VMAP temporarily and for some reason which is 
  explained in a comment.

If x86 already has the necessary logic to handle it, why add 
VM_NO_HUGE_VMAP ?

Christophe

^ permalink raw reply

* Re: [PATCH v2 0/3] mm: support huge vmalloc mapping on arm64/x86
From: Christophe Leroy @ 2022-01-15 10:07 UTC (permalink / raw)
  To: Kefeng Wang, Jonathan Corbet, Andrew Morton,
	linuxppc-dev@lists.ozlabs.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org,
	linux-arm-kernel@lists.infradead.org
  Cc: Matthew Wilcox, Catalin Marinas, Dave Hansen, Nicholas Piggin,
	Ingo Molnar, Borislav Petkov, H. Peter Anvin, Paul Mackerras,
	Thomas Gleixner, Will Deacon
In-Reply-To: <20211227145903.187152-1-wangkefeng.wang@huawei.com>



Le 27/12/2021 à 15:59, Kefeng Wang a écrit :
> Huge vmalloc mappings is supported on PPC[1], but this feature should
> be not only used on PPC, it could be used on arch support HAVE_ARCH_HUGE_VMAP
> and PMD sized vmap mappings. this patchset is to enable this feature
> on arm64/x86.
> 
> There are some disadvantages about this feature[2], one of the main

There are some disadvantage, ok, so are there advantages as well ?

> concerns is the possible memory fragmentation/waste in some scenarios,
> also archs must ensure that any arch specific vmalloc allocations that
> require PAGE_SIZE mappings(eg, module alloc with STRICT_MODULE_RWX)
> use the VM_NO_HUGE_VMAP flag to inhibit larger mappings.
> 
> Based on the above considerations, we add the first patch is to let
> user to control huge vmalloc mapping default behavior.  Meanwhile,
> add new kernel parameter hugevmalloc=on/off to enable/disable this
> feature at boot time, nohugevmalloc parameter is still supported.
> 
> The later two patches to enable this feature on arm64/x86, select
> HAVE_ARCH_HUGE_VMALLOC and mark VM_NO_HUGE_VMAP in arch's module_alloc().
> 
> This patchset based on next-20211224.
> 
> v2:
> - Default y for HUGE_VMALLOC_DEFAULT_ENABLED, not only select it on PPC
> - Fix copy/type error
> - Mark VM_NO_HUGE_VMAP in module_alloc() on arm64/x86
> 
> [1] https://lore.kernel.org/linux-mm/20210317062402.533919-1-npiggin@gmail.com/
> [2] https://lore.kernel.org/linux-mm/1616036421.amjz2efujj.astroid@bobo.none/
> 
> Kefeng Wang (3):
>    mm: vmalloc: Let user to control huge vmalloc default behavior
>    arm64: Support huge vmalloc mappings
>    x86: Support huge vmalloc mappings
> 
>   .../admin-guide/kernel-parameters.txt          | 14 +++++++++++++-
>   arch/arm64/Kconfig                             |  1 +
>   arch/arm64/kernel/module.c                     |  5 +++--
>   arch/x86/Kconfig                               |  1 +
>   arch/x86/kernel/module.c                       |  4 ++--
>   mm/Kconfig                                     |  8 ++++++++
>   mm/vmalloc.c                                   | 18 +++++++++++++++++-
>   7 files changed, 45 insertions(+), 6 deletions(-)
> 

^ permalink raw reply

* Re: [PATCH v2 3/3] x86: Support huge vmalloc mappings
From: Christophe Leroy @ 2022-01-15 10:06 UTC (permalink / raw)
  To: Kefeng Wang, Jonathan Corbet, Andrew Morton,
	linuxppc-dev@lists.ozlabs.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org,
	linux-arm-kernel@lists.infradead.org
  Cc: Matthew Wilcox, Catalin Marinas, Dave Hansen, Nicholas Piggin,
	Ingo Molnar, Borislav Petkov, H. Peter Anvin, Paul Mackerras,
	Thomas Gleixner, Will Deacon
In-Reply-To: <20211227145903.187152-4-wangkefeng.wang@huawei.com>



Le 27/12/2021 à 15:59, Kefeng Wang a écrit :
> This patch select HAVE_ARCH_HUGE_VMALLOC to let X86_64 and X86_PAE
> support huge vmalloc mappings.
> 
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>   Documentation/admin-guide/kernel-parameters.txt | 4 ++--
>   arch/x86/Kconfig                                | 1 +
>   arch/x86/kernel/module.c                        | 4 ++--
>   3 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index e3f9fd7ec106..ffce6591ae64 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -1639,7 +1639,7 @@
>   			precedence over memory_hotplug.memmap_on_memory.
>   
>   
> -	hugevmalloc=	[KNL,PPC,ARM64] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
> +	hugevmalloc=	[KNL,PPC,ARM64,X86] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
>   			Format: { on | off }
>   			Default set by CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED.
>   
> @@ -3424,7 +3424,7 @@
>   
>   	nohugeiomap	[KNL,X86,PPC,ARM64] Disable kernel huge I/O mappings.
>   
> -	nohugevmalloc	[KNL,PPC,ARM64] Disable kernel huge vmalloc mappings.
> +	nohugevmalloc	[KNL,PPC,ARM64,X86] Disable kernel huge vmalloc mappings.
>   
>   	nosmt		[KNL,S390] Disable symmetric multithreading (SMT).
>   			Equivalent to smt=1.
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index ebe8fc76949a..f6bf6675bbe7 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -157,6 +157,7 @@ config X86
>   	select HAVE_ACPI_APEI_NMI		if ACPI
>   	select HAVE_ALIGNED_STRUCT_PAGE		if SLUB
>   	select HAVE_ARCH_AUDITSYSCALL
> +	select HAVE_ARCH_HUGE_VMALLOC		if HAVE_ARCH_HUGE_VMAP
>   	select HAVE_ARCH_HUGE_VMAP		if X86_64 || X86_PAE
>   	select HAVE_ARCH_JUMP_LABEL
>   	select HAVE_ARCH_JUMP_LABEL_RELATIVE
> diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c
> index 95fa745e310a..6bf5cb7d876a 100644
> --- a/arch/x86/kernel/module.c
> +++ b/arch/x86/kernel/module.c
> @@ -75,8 +75,8 @@ void *module_alloc(unsigned long size)
>   
>   	p = __vmalloc_node_range(size, MODULE_ALIGN,
>   				    MODULES_VADDR + get_module_load_offset(),
> -				    MODULES_END, gfp_mask,
> -				    PAGE_KERNEL, VM_DEFER_KMEMLEAK, NUMA_NO_NODE,
> +				    MODULES_END, gfp_mask, PAGE_KERNEL,
> +				    VM_DEFER_KMEMLEAK | VM_NO_HUGE_VMAP, NUMA_NO_NODE,

you should add a comment like powerpc (commit 8abddd968a30 
("powerpc/64s/radix: Enable huge vmalloc mappings")) to explain why this 
requires VM_NO_HUGE_VMAP

>   				    __builtin_return_address(0));
>   	if (p && (kasan_module_alloc(p, size, gfp_mask) < 0)) {
>   		vfree(p);

^ permalink raw reply

* Re: [PATCH v2 2/3] arm64: Support huge vmalloc mappings
From: Christophe Leroy @ 2022-01-15 10:05 UTC (permalink / raw)
  To: Kefeng Wang, Jonathan Corbet, Andrew Morton,
	linuxppc-dev@lists.ozlabs.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org,
	linux-arm-kernel@lists.infradead.org
  Cc: Matthew Wilcox, Catalin Marinas, Dave Hansen, Nicholas Piggin,
	Ingo Molnar, Borislav Petkov, H. Peter Anvin, Paul Mackerras,
	Thomas Gleixner, Will Deacon
In-Reply-To: <20211227145903.187152-3-wangkefeng.wang@huawei.com>



Le 27/12/2021 à 15:59, Kefeng Wang a écrit :
> This patch select HAVE_ARCH_HUGE_VMALLOC to let arm64 support huge
> vmalloc mappings.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>   Documentation/admin-guide/kernel-parameters.txt | 4 ++--
>   arch/arm64/Kconfig                              | 1 +
>   arch/arm64/kernel/module.c                      | 5 +++--
>   3 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 7b2f900fd243..e3f9fd7ec106 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -1639,7 +1639,7 @@
>   			precedence over memory_hotplug.memmap_on_memory.
>   
>   
> -	hugevmalloc=	[PPC] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
> +	hugevmalloc=	[KNL,PPC,ARM64] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
>   			Format: { on | off }
>   			Default set by CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED.
>   
> @@ -3424,7 +3424,7 @@
>   
>   	nohugeiomap	[KNL,X86,PPC,ARM64] Disable kernel huge I/O mappings.
>   
> -	nohugevmalloc	[PPC] Disable kernel huge vmalloc mappings.
> +	nohugevmalloc	[KNL,PPC,ARM64] Disable kernel huge vmalloc mappings.
>   
>   	nosmt		[KNL,S390] Disable symmetric multithreading (SMT).
>   			Equivalent to smt=1.
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 3bb0b67292b5..c34bbb4482b0 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -142,6 +142,7 @@ config ARM64
>   	select HAVE_ARCH_AUDITSYSCALL
>   	select HAVE_ARCH_BITREVERSE
>   	select HAVE_ARCH_COMPILER_H
> +	select HAVE_ARCH_HUGE_VMALLOC
>   	select HAVE_ARCH_HUGE_VMAP
>   	select HAVE_ARCH_JUMP_LABEL
>   	select HAVE_ARCH_JUMP_LABEL_RELATIVE
> diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c
> index 309a27553c87..af7b4cbace2b 100644
> --- a/arch/arm64/kernel/module.c
> +++ b/arch/arm64/kernel/module.c
> @@ -36,7 +36,8 @@ void *module_alloc(unsigned long size)
>   		module_alloc_end = MODULES_END;
>   
>   	p = __vmalloc_node_range(size, MODULE_ALIGN, module_alloc_base,
> -				module_alloc_end, gfp_mask, PAGE_KERNEL, VM_DEFER_KMEMLEAK,
> +				module_alloc_end, gfp_mask, PAGE_KERNEL,
> +				VM_DEFER_KMEMLEAK | VM_NO_HUGE_VMAP,

you should add a comment like powerpc (commit 8abddd968a30 
("powerpc/64s/radix: Enable huge vmalloc mappings")) to explain why this 
requires VM_NO_HUGE_VMAP

>   				NUMA_NO_NODE, __builtin_return_address(0));
>   
>   	if (!p && IS_ENABLED(CONFIG_ARM64_MODULE_PLTS) &&
> @@ -55,7 +56,7 @@ void *module_alloc(unsigned long size)
>   		 */
>   		p = __vmalloc_node_range(size, MODULE_ALIGN, module_alloc_base,
>   				module_alloc_base + SZ_2G, GFP_KERNEL,
> -				PAGE_KERNEL, 0, NUMA_NO_NODE,
> +				PAGE_KERNEL, VM_NO_HUGE_VMAP, NUMA_NO_NODE,

Same

>   				__builtin_return_address(0));
>   
>   	if (p && (kasan_module_alloc(p, size, gfp_mask) < 0)) {

^ permalink raw reply

* [PATCH] powerpc/perf: Fix power_pmu_disable to call clear_pmi_irq_pending only if PMI is pending
From: Athira Rajeev @ 2022-01-15  7:20 UTC (permalink / raw)
  To: mpe; +Cc: kjain, maddy, linuxppc-dev, npiggin, rnsastry

Running selftest with CONFIG_PPC_IRQ_SOFT_MASK_DEBUG enabled in kernel
triggered below warning:

[  172.851380] ------------[ cut here ]------------
[  172.851391] WARNING: CPU: 8 PID: 2901 at arch/powerpc/include/asm/hw_irq.h:246 power_pmu_disable+0x270/0x280
[  172.851402] Modules linked in: dm_mod bonding nft_ct nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip_set nf_tables rfkill nfnetlink sunrpc xfs libcrc32c pseries_rng xts vmx_crypto uio_pdrv_genirq uio sch_fq_codel ip_tables ext4 mbcache jbd2 sd_mod t10_pi sg ibmvscsi ibmveth scsi_transport_srp fuse
[  172.851442] CPU: 8 PID: 2901 Comm: lost_exception_ Not tainted 5.16.0-rc5-03218-g798527287598 #2
[  172.851451] NIP:  c00000000013d600 LR: c00000000013d5a4 CTR: c00000000013b180
[  172.851458] REGS: c000000017687860 TRAP: 0700   Not tainted  (5.16.0-rc5-03218-g798527287598)
[  172.851465] MSR:  8000000000029033 <SF,EE,ME,IR,DR,RI,LE>  CR: 48004884  XER: 20040000
[  172.851482] CFAR: c00000000013d5b4 IRQMASK: 1
[  172.851482] GPR00: c00000000013d5a4 c000000017687b00 c000000002a10600 0000000000000004
[  172.851482] GPR04: 0000000082004000 c0000008ba08f0a8 0000000000000000 00000008b7ed0000
[  172.851482] GPR08: 00000000446194f6 0000000000008000 c00000000013b118 c000000000d58e68
[  172.851482] GPR12: c00000000013d390 c00000001ec54a80 0000000000000000 0000000000000000
[  172.851482] GPR16: 0000000000000000 0000000000000000 c000000015d5c708 c0000000025396d0
[  172.851482] GPR20: 0000000000000000 0000000000000000 c00000000a3bbf40 0000000000000003
[  172.851482] GPR24: 0000000000000000 c0000008ba097400 c0000000161e0d00 c00000000a3bb600
[  172.851482] GPR28: c000000015d5c700 0000000000000001 0000000082384090 c0000008ba0020d8
[  172.851549] NIP [c00000000013d600] power_pmu_disable+0x270/0x280
[  172.851557] LR [c00000000013d5a4] power_pmu_disable+0x214/0x280
[  172.851565] Call Trace:
[  172.851568] [c000000017687b00] [c00000000013d5a4] power_pmu_disable+0x214/0x280 (unreliable)
[  172.851579] [c000000017687b40] [c0000000003403ac] perf_pmu_disable+0x4c/0x60
[  172.851588] [c000000017687b60] [c0000000003445e4] __perf_event_task_sched_out+0x1d4/0x660
[  172.851596] [c000000017687c50] [c000000000d1175c] __schedule+0xbcc/0x12a0
[  172.851602] [c000000017687d60] [c000000000d11ea8] schedule+0x78/0x140
[  172.851608] [c000000017687d90] [c0000000001a8080] sys_sched_yield+0x20/0x40
[  172.851615] [c000000017687db0] [c0000000000334dc] system_call_exception+0x18c/0x380
[  172.851622] [c000000017687e10] [c00000000000c74c] system_call_common+0xec/0x268

The warning indicates that MSR_EE being set(interrupt enabled) when
there was an overflown PMC detected. This could happen in
power_pmu_disable since it runs under interrupt soft disable
condition ( local_irq_save ) and not with interrupts hard disabled.
commit 2c9ac51b850d ("powerpc/perf: Fix PMU callbacks to clear
pending PMI before resetting an overflown PMC") intended to clear
PMI pending bit in Paca when disabling the PMU. It could happen
that PMC gets overflown while code is in power_pmu_disable
callback function. Hence add a check to see if PMI pending bit
is set in Paca before clearing it via clear_pmi_pending.

Fixes: 2c9ac51b850d ("powerpc/perf: Fix PMU callbacks to clear pending PMI before resetting an overflown PMC")
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Reported-by: Sachin Sant <sachinp@linux.ibm.com>
Tested-by: Sachin Sant <sachinp@linux.ibm.com>
---
Note: Address the warning reported here:
https://lists.ozlabs.org/pipermail/linuxppc-dev/2021-December/238190.html
Patch is on top of powerpc/merge

 arch/powerpc/perf/core-book3s.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index a684901b6965..dfb0ea0f0df3 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -1327,9 +1327,10 @@ static void power_pmu_disable(struct pmu *pmu)
 		 * Otherwise provide a warning if there is PMI pending, but
 		 * no counter is found overflown.
 		 */
-		if (any_pmc_overflown(cpuhw))
-			clear_pmi_irq_pending();
-		else
+		if (any_pmc_overflown(cpuhw)) {
+			if (pmi_irq_pending())
+				clear_pmi_irq_pending();
+		} else
 			WARN_ON(pmi_irq_pending());
 
 		val = mmcra = cpuhw->mmcr.mmcra;
-- 
2.33.0


^ permalink raw reply related

* [powerpc:merge] BUILD SUCCESS 64aae3ed0b303954227bf1990dff6fded6889677
From: kernel test robot @ 2022-01-15  3:58 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev

tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git merge
branch HEAD: 64aae3ed0b303954227bf1990dff6fded6889677  Automatic merge of 'next' into merge (2022-01-10 14:38)

elapsed time: 7121m

configs tested: 213
configs skipped: 4

The following configs have been built successfully.
More configs may be tested in the coming days.

gcc tested configs:
arm                                 defconfig
arm64                            allyesconfig
arm64                               defconfig
arm                              allyesconfig
arm                              allmodconfig
i386                          randconfig-c001
powerpc                     tqm8541_defconfig
powerpc                      ppc40x_defconfig
m68k                        stmark2_defconfig
sh                           se7721_defconfig
sh                           se7750_defconfig
arm                          badge4_defconfig
m68k                           sun3_defconfig
powerpc                    sam440ep_defconfig
sh                           sh2007_defconfig
openrisc                  or1klitex_defconfig
sh                           se7780_defconfig
m68k                       m5475evb_defconfig
sh                ecovec24-romimage_defconfig
powerpc                     mpc83xx_defconfig
mips                      maltasmvp_defconfig
m68k                          atari_defconfig
powerpc                        warp_defconfig
arm                           tegra_defconfig
sh                              ul2_defconfig
sh                   sh7724_generic_defconfig
m68k                          hp300_defconfig
arm                         axm55xx_defconfig
um                             i386_defconfig
sparc                            alldefconfig
arm                           stm32_defconfig
arm                           sama5_defconfig
x86_64                           alldefconfig
powerpc                 mpc85xx_cds_defconfig
mips                      fuloong2e_defconfig
csky                             alldefconfig
powerpc                       ppc64_defconfig
powerpc                     taishan_defconfig
h8300                               defconfig
xtensa                  nommu_kc705_defconfig
sh                                  defconfig
powerpc                      ep88xc_defconfig
arm                        mini2440_defconfig
sh                            migor_defconfig
m68k                                defconfig
sparc64                             defconfig
sparc                            allyesconfig
arm                          simpad_defconfig
powerpc                     pq2fads_defconfig
arm                        mvebu_v7_defconfig
arm                           viper_defconfig
arm                      integrator_defconfig
xtensa                generic_kc705_defconfig
xtensa                    xip_kc705_defconfig
sh                   secureedge5410_defconfig
nds32                             allnoconfig
ia64                                defconfig
powerpc                      tqm8xx_defconfig
arm                          iop32x_defconfig
mips                         tb0226_defconfig
arm                            mps2_defconfig
arm                          lpd270_defconfig
riscv                            allmodconfig
parisc                generic-64bit_defconfig
arc                    vdk_hs38_smp_defconfig
arm                        multi_v7_defconfig
sh                          polaris_defconfig
sh                          rsk7269_defconfig
arc                      axs103_smp_defconfig
arm                        cerfcube_defconfig
sh                        dreamcast_defconfig
h8300                       h8s-sim_defconfig
sh                           se7722_defconfig
openrisc                            defconfig
sh                            shmin_defconfig
m68k                            q40_defconfig
mips                           xway_defconfig
xtensa                  audio_kc705_defconfig
sh                            titan_defconfig
arm                            zeus_defconfig
ia64                        generic_defconfig
mips                         mpc30x_defconfig
arc                          axs103_defconfig
powerpc                      pcm030_defconfig
arm                         assabet_defconfig
xtensa                       common_defconfig
arm                           h3600_defconfig
sh                        sh7785lcr_defconfig
mips                            ar7_defconfig
powerpc                       holly_defconfig
powerpc                   motionpro_defconfig
sh                          kfr2r09_defconfig
m68k                             allmodconfig
powerpc                      chrp32_defconfig
sparc                       sparc32_defconfig
h8300                            alldefconfig
sh                           se7751_defconfig
ia64                          tiger_defconfig
m68k                         apollo_defconfig
arm                       aspeed_g5_defconfig
um                               alldefconfig
arm                           u8500_defconfig
mips                             allmodconfig
microblaze                      mmu_defconfig
arm                      footbridge_defconfig
sh                     magicpanelr2_defconfig
ia64                             allmodconfig
arm                  randconfig-c002-20220111
arm                  randconfig-c002-20220113
ia64                             allyesconfig
m68k                             allyesconfig
nios2                               defconfig
arc                              allyesconfig
nds32                               defconfig
nios2                            allyesconfig
csky                                defconfig
alpha                               defconfig
alpha                            allyesconfig
xtensa                           allyesconfig
h8300                            allyesconfig
arc                                 defconfig
sh                               allmodconfig
parisc                              defconfig
s390                             allyesconfig
s390                             allmodconfig
parisc                           allyesconfig
s390                                defconfig
i386                             allyesconfig
sparc                               defconfig
i386                                defconfig
i386                   debian-10.3-kselftests
i386                              debian-10.3
mips                             allyesconfig
powerpc                          allyesconfig
powerpc                          allmodconfig
powerpc                           allnoconfig
x86_64                        randconfig-a006
x86_64                        randconfig-a004
x86_64                        randconfig-a002
x86_64                        randconfig-a011
x86_64                        randconfig-a013
x86_64                        randconfig-a015
i386                          randconfig-a012
i386                          randconfig-a014
i386                          randconfig-a016
riscv                randconfig-r042-20220111
arc                  randconfig-r043-20220111
s390                 randconfig-r044-20220111
riscv                randconfig-r042-20220113
arc                  randconfig-r043-20220113
s390                 randconfig-r044-20220113
riscv                    nommu_k210_defconfig
riscv                            allyesconfig
riscv                    nommu_virt_defconfig
riscv                             allnoconfig
riscv                               defconfig
riscv                          rv32_defconfig
x86_64                    rhel-8.3-kselftests
um                           x86_64_defconfig
x86_64                           allyesconfig
x86_64                              defconfig
x86_64                               rhel-8.3
x86_64                          rhel-8.3-func
x86_64                                  kexec

clang tested configs:
arm                  randconfig-c002-20220111
x86_64                        randconfig-c007
riscv                randconfig-c006-20220111
powerpc              randconfig-c003-20220111
i386                          randconfig-c001
mips                 randconfig-c004-20220111
s390                 randconfig-c005-20220111
powerpc              randconfig-c003-20220113
mips                 randconfig-c004-20220113
s390                 randconfig-c005-20220113
riscv                randconfig-c006-20220113
arm                  randconfig-c002-20220113
arm                  colibri_pxa300_defconfig
mips                          malta_defconfig
arm                          ep93xx_defconfig
powerpc                 mpc836x_mds_defconfig
powerpc                     akebono_defconfig
powerpc                     kilauea_defconfig
powerpc                  mpc885_ads_defconfig
powerpc                        icon_defconfig
powerpc                          g5_defconfig
powerpc                      acadia_defconfig
arm                    vt8500_v6_v7_defconfig
mips                           rs90_defconfig
arm                     davinci_all_defconfig
powerpc                     pseries_defconfig
arm                       spear13xx_defconfig
mips                         tb0219_defconfig
powerpc                    socrates_defconfig
arm                         hackkit_defconfig
powerpc                   lite5200b_defconfig
riscv                             allnoconfig
arm                          ixp4xx_defconfig
riscv                          rv32_defconfig
mips                          rm200_defconfig
hexagon                          alldefconfig
powerpc                      pmac32_defconfig
mips                           ip22_defconfig
arm                        spear3xx_defconfig
arm                      pxa255-idp_defconfig
i386                          randconfig-a002
i386                          randconfig-a006
i386                          randconfig-a004
x86_64                        randconfig-a012
x86_64                        randconfig-a014
x86_64                        randconfig-a016
i386                          randconfig-a011
i386                          randconfig-a013
i386                          randconfig-a015
hexagon              randconfig-r045-20220113
hexagon              randconfig-r045-20220114
riscv                randconfig-r042-20220114
hexagon              randconfig-r041-20220114
hexagon              randconfig-r041-20220113

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply

* Re: [RFC PATCH 3/3] powerpc/pseries/vas: Use migration_in_progress to disable DLPAR
From: Nathan Lynch @ 2022-01-14 17:59 UTC (permalink / raw)
  To: Haren Myneni, mpe, linuxppc-dev, npiggin
In-Reply-To: <92d87ead72556e946d7fa6775c509de8b6d11935.camel@linux.ibm.com>

Haren Myneni <haren@linux.ibm.com> writes:

> Before migration starts, all secondary CPUs will be offline which
> can invoke VAS DLPAR event.

I don't understand this statement, so I can't evaluate the patch. The
current LPM implementation does not offline any CPUs.

^ permalink raw reply

* Re: [PATCH 1/1] powerpc/e500/qemu-e500: allow core to idle without waiting
From: Scott Wood @ 2022-01-14 17:49 UTC (permalink / raw)
  To: Joachim Wiberg, linuxppc-dev, Michael Ellerman,
	Benjamin Herrenschmidt, Paul Mackerras
  Cc: Tobias Waldekranz
In-Reply-To: <20220112112459.1033754-1-troglobit@gmail.com>

On Wed, 2022-01-12 at 12:24 +0100, Joachim Wiberg wrote:
> From: Tobias Waldekranz <tobias@waldekranz.com>
> 
> This means an idle guest won't needlessly consume an entire core on
> the host, waiting for work to show up.
> 
> Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
> Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
> ---
>  arch/powerpc/platforms/85xx/qemu_e500.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/powerpc/platforms/85xx/qemu_e500.c
> b/arch/powerpc/platforms/85xx/qemu_e500.c
> index a4127b0b161f..4c4d577effd9 100644
> --- a/arch/powerpc/platforms/85xx/qemu_e500.c
> +++ b/arch/powerpc/platforms/85xx/qemu_e500.c
> @@ -67,4 +67,9 @@ define_machine(qemu_e500) {
>         .get_irq                = mpic_get_coreint_irq,
>         .calibrate_decr         = generic_calibrate_decr,
>         .progress               = udbg_progress,
> +#ifdef CONFIG_PPC64
> +       .power_save             = book3e_idle,
> +#else
> +       .power_save             = e500_idle,
> +#endif
>  };

Acked-by: Scott Wood <oss@buserror.net>

-Scott



^ permalink raw reply

* Re: [PATCH 1/3] powerpc: Properly return error code from do_patch_instruction()
From: Christophe Leroy @ 2022-01-14 16:19 UTC (permalink / raw)
  To: Naveen N. Rao, linuxppc-dev; +Cc: Steven Rostedt
In-Reply-To: <b1dbbb34a389a6f59eb6c99102d94c0070ddaf98.1587654213.git.naveen.n.rao@linux.vnet.ibm.com>



Le 23/04/2020 à 17:09, Naveen N. Rao a écrit :
> With STRICT_KERNEL_RWX, we are currently ignoring return value from
> __patch_instruction() in do_patch_instruction(), resulting in the error
> not being propagated back. Fix the same.
> 
> Fixes: 37bc3e5fd764f ("powerpc/lib/code-patching: Use alternate map for patch_instruction()")
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>

A similar patch was merged as 
https://github.com/linuxppc/linux/commit/a3483c3dd18c136785a31406fe27210649fc4fba#diff-e084bb6dc223aec74e7fc4208b7b260acc571bd5b50c9b709ec3de175cb1a979

Christophe


> ---
>   arch/powerpc/lib/code-patching.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c
> index 3345f039a876..5c713a6c0bd8 100644
> --- a/arch/powerpc/lib/code-patching.c
> +++ b/arch/powerpc/lib/code-patching.c
> @@ -138,7 +138,7 @@ static inline int unmap_patch_area(unsigned long addr)
>   
>   static int do_patch_instruction(unsigned int *addr, unsigned int instr)
>   {
> -	int err;
> +	int err, rc = 0;
>   	unsigned int *patch_addr = NULL;
>   	unsigned long flags;
>   	unsigned long text_poke_addr;
> @@ -163,7 +163,7 @@ static int do_patch_instruction(unsigned int *addr, unsigned int instr)
>   	patch_addr = (unsigned int *)(text_poke_addr) +
>   			((kaddr & ~PAGE_MASK) / sizeof(unsigned int));
>   
> -	__patch_instruction(addr, instr, patch_addr);
> +	rc = __patch_instruction(addr, instr, patch_addr);
>   
>   	err = unmap_patch_area(text_poke_addr);
>   	if (err)
> @@ -172,7 +172,7 @@ static int do_patch_instruction(unsigned int *addr, unsigned int instr)
>   out:
>   	local_irq_restore(flags);
>   
> -	return err;
> +	return rc ? rc : err;
>   }
>   #else /* !CONFIG_STRICT_KERNEL_RWX */
>   

^ permalink raw reply

* Re: [RFC PATCH v3 7/8] drivers: virtio_mem: use pageblock size as the minimum virtio_mem size.
From: Zi Yan @ 2022-01-14 15:15 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: Mel Gorman, linuxppc-dev, linux-kernel, virtualization, linux-mm,
	iommu, Eric Ren, Robin Murphy, Christoph Hellwig, Vlastimil Babka,
	Marek Szyprowski
In-Reply-To: <60778775-b5f5-0837-092f-9911cec84854@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 979 bytes --]

On 14 Jan 2022, at 8:44, David Hildenbrand wrote:

> On 05.01.22 22:47, Zi Yan wrote:
>> From: Zi Yan <ziy@nvidia.com>
>>
>> alloc_contig_range() now only needs to be aligned to pageblock_order,
>> drop virtio_mem size requirement that it needs to be the max of
>> pageblock_order and MAX_ORDER.
>>
>> Signed-off-by: Zi Yan <ziy@nvidia.com>
>> ---
>>  drivers/virtio/virtio_mem.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c
>> index a6a78685cfbe..2664dc16d0f9 100644
>> --- a/drivers/virtio/virtio_mem.c
>> +++ b/drivers/virtio/virtio_mem.c
>> @@ -2481,8 +2481,7 @@ static int virtio_mem_init_hotplug(struct virtio_mem *vm)
>>  	 * - Is required for now for alloc_contig_range() to work reliably -
>>  	 *   it doesn't properly handle smaller granularity on ZONE_NORMAL.
>>  	 */
>
> Please also update this comment.

No problem. Thanks for pointing this out.


--
Best Regards,
Yan, Zi

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 854 bytes --]

^ permalink raw reply

* Re: [RFC PATCH v3 5/8] mm: page_isolation: check specified range for unmovable pages during isolation.
From: Zi Yan @ 2022-01-14 15:14 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: Mel Gorman, linuxppc-dev, linux-kernel, virtualization, linux-mm,
	iommu, Eric Ren, Robin Murphy, Christoph Hellwig, Vlastimil Babka,
	Marek Szyprowski
In-Reply-To: <ead90b32-da2b-4d66-f103-6fbec0937e93@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1086 bytes --]

On 14 Jan 2022, at 8:38, David Hildenbrand wrote:

> On 05.01.22 22:47, Zi Yan wrote:
>> From: Zi Yan <ziy@nvidia.com>
>>
>> Enable set_migratetype_isolate() to check specified sub-range for
>> unmovable pages during isolation. Page isolation is done
>> at max(MAX_ORDER_NR_PAEGS, pageblock_nr_pages) granularity, but not all
>> pages within that granularity are intended to be isolated. For example,
>> alloc_contig_range(), which uses page isolation, allows ranges without
>> alignment. This commit makes unmovable page check only look for
>> interesting pages, so that page isolation can succeed for any
>> non-overlapping ranges.
>
> Are you handling if we start checking in the middle of a compound page
> and actually have to lookup the head to figure out if movable or not?
>

Yes. has_unmovable_pages() has that check already.


>>
>> has_unmovable_pages() is moved to mm/page_isolation.c since it is only
>> used by page isolation.
>
> Please move that into a separate patch upfront, makes this patch much
> easier to review.

Sure. Will do.

Thanks.

--
Best Regards,
Yan, Zi

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 854 bytes --]

^ permalink raw reply

* Re: [GIT PULL] Please pull powerpc/linux.git powerpc-5.17-1 tag
From: pr-tracker-bot @ 2022-01-14 14:39 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: sachinp, cascardo, guoren, aik, wangborong, wangxiang, amodra,
	jlu.hpw, keescook, robh, anders.roxell, chi.minghao,
	Linus Torvalds, yang.guang5, nathanl, ravi.bangoria, ajd, kjain,
	npiggin, Julia.Lawall, christophe.jaillet, clg,
	Arnaldo Carvalho de Melo, hbathini, dja, atrajeev, nick.child,
	gregkh, rdunlap, linux-kernel, ammarfaizi2, peterz, seanjc,
	oohall, linuxppc-dev
In-Reply-To: <87v8ym1qce.fsf@mpe.ellerman.id.au>

The pull request you sent on Fri, 14 Jan 2022 22:58:25 +1100:

> https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git tags/powerpc-5.17-1

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/29ec39fcf11e4583eb8d5174f756ea109c77cc44

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

^ permalink raw reply

* Re: [RFC PATCH v3 7/8] drivers: virtio_mem: use pageblock size as the minimum virtio_mem size.
From: David Hildenbrand @ 2022-01-14 13:44 UTC (permalink / raw)
  To: Zi Yan, linux-mm
  Cc: Mel Gorman, Robin Murphy, linux-kernel, iommu, Eric Ren,
	virtualization, linuxppc-dev, Christoph Hellwig, Vlastimil Babka,
	Marek Szyprowski
In-Reply-To: <20220105214756.91065-8-zi.yan@sent.com>

On 05.01.22 22:47, Zi Yan wrote:
> From: Zi Yan <ziy@nvidia.com>
> 
> alloc_contig_range() now only needs to be aligned to pageblock_order,
> drop virtio_mem size requirement that it needs to be the max of
> pageblock_order and MAX_ORDER.
> 
> Signed-off-by: Zi Yan <ziy@nvidia.com>
> ---
>  drivers/virtio/virtio_mem.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c
> index a6a78685cfbe..2664dc16d0f9 100644
> --- a/drivers/virtio/virtio_mem.c
> +++ b/drivers/virtio/virtio_mem.c
> @@ -2481,8 +2481,7 @@ static int virtio_mem_init_hotplug(struct virtio_mem *vm)
>  	 * - Is required for now for alloc_contig_range() to work reliably -
>  	 *   it doesn't properly handle smaller granularity on ZONE_NORMAL.
>  	 */

Please also update this comment.

-- 
Thanks,

David / dhildenb


^ permalink raw reply

* Re: [RFC PATCH v3 5/8] mm: page_isolation: check specified range for unmovable pages during isolation.
From: David Hildenbrand @ 2022-01-14 13:38 UTC (permalink / raw)
  To: Zi Yan, linux-mm
  Cc: Mel Gorman, Robin Murphy, linux-kernel, iommu, Eric Ren,
	virtualization, linuxppc-dev, Christoph Hellwig, Vlastimil Babka,
	Marek Szyprowski
In-Reply-To: <20220105214756.91065-6-zi.yan@sent.com>

On 05.01.22 22:47, Zi Yan wrote:
> From: Zi Yan <ziy@nvidia.com>
> 
> Enable set_migratetype_isolate() to check specified sub-range for
> unmovable pages during isolation. Page isolation is done
> at max(MAX_ORDER_NR_PAEGS, pageblock_nr_pages) granularity, but not all
> pages within that granularity are intended to be isolated. For example,
> alloc_contig_range(), which uses page isolation, allows ranges without
> alignment. This commit makes unmovable page check only look for
> interesting pages, so that page isolation can succeed for any
> non-overlapping ranges.

Are you handling if we start checking in the middle of a compound page
and actually have to lookup the head to figure out if movable or not?

> 
> has_unmovable_pages() is moved to mm/page_isolation.c since it is only
> used by page isolation.

Please move that into a separate patch upfront, makes this patch much
easier to review.

-- 
Thanks,

David / dhildenb


^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox