* [PATCH] Documentation: Fix typo in testing/sysfs-class-cxl
From: Sohaib Mohamed @ 2021-10-06 15:50 UTC (permalink / raw)
To: sohaib.amhmd
Cc: Frederic Barrat, linuxppc-dev, Andrew Donnellan, linux-kernel
Remove repeated words: "the the lowest" and "this this kernel"
Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
---
Documentation/ABI/testing/sysfs-class-cxl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/ABI/testing/sysfs-class-cxl b/Documentation/ABI/testing/sysfs-class-cxl
index 3c77677e0ca7..594fda254130 100644
--- a/Documentation/ABI/testing/sysfs-class-cxl
+++ b/Documentation/ABI/testing/sysfs-class-cxl
@@ -103,8 +103,8 @@ What: /sys/class/cxl/<afu>/api_version_compatible
Date: September 2014
Contact: linuxppc-dev@lists.ozlabs.org
Description: read only
- Decimal value of the the lowest version of the userspace API
- this this kernel supports.
+ Decimal value of the lowest version of the userspace API
+ this kernel supports.
Users: https://github.com/ibm-capi/libcxl
--
2.25.1
^ permalink raw reply related
* Re: [PATCH 06/12] openrisc: Use of_get_cpu_hwid()
From: Stafford Horne @ 2021-10-06 21:25 UTC (permalink / raw)
To: Rob Herring
Cc: Rich Felker, Rafael J. Wysocki, linux-kernel@vger.kernel.org,
Guo Ren, H. Peter Anvin, linux-riscv, Will Deacon, Jonas Bonn,
Florian Fainelli, Yoshinori Sato, SH-Linux, X86 ML, Russell King,
linux-csky, Ingo Molnar,
maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE, Catalin Marinas,
Palmer Dabbelt, devicetree, Albert Ou, Ray Jui,
Stefan Kristiansson, Openrisc, Borislav Petkov, Paul Walmsley,
Thomas Gleixner, linux-arm-kernel, Scott Branden,
Greg Kroah-Hartman, Frank Rowand, James Morse, Paul Mackerras,
linuxppc-dev
In-Reply-To: <CAL_JsqLv+Ym=hxxz2vm0H3pbx1FRkBpHs3V=8DKjG43n+gS+RA@mail.gmail.com>
On Wed, Oct 06, 2021 at 04:08:38PM -0500, Rob Herring wrote:
> On Wed, Oct 6, 2021 at 3:44 PM Stafford Horne <shorne@gmail.com> wrote:
> >
> > On Wed, Oct 06, 2021 at 11:43:26AM -0500, Rob Herring wrote:
> > > Replace open coded parsing of CPU nodes' 'reg' property with
> > > of_get_cpu_hwid().
> > >
> > > Cc: Jonas Bonn <jonas@southpole.se>
> > > Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
> > > Cc: Stafford Horne <shorne@gmail.com>
> > > Cc: openrisc@lists.librecores.org
> > > Signed-off-by: Rob Herring <robh@kernel.org>
> > > ---
> > > arch/openrisc/kernel/smp.c | 6 +-----
> > > 1 file changed, 1 insertion(+), 5 deletions(-)
> > >
> > > diff --git a/arch/openrisc/kernel/smp.c b/arch/openrisc/kernel/smp.c
> > > index 415e209732a3..7d5a4f303a5a 100644
> > > --- a/arch/openrisc/kernel/smp.c
> > > +++ b/arch/openrisc/kernel/smp.c
> > > @@ -65,11 +65,7 @@ void __init smp_init_cpus(void)
> > > u32 cpu_id;
> > >
> > > for_each_of_cpu_node(cpu) {
> > > - if (of_property_read_u32(cpu, "reg", &cpu_id)) {
> > > - pr_warn("%s missing reg property", cpu->full_name);
> > > - continue;
> > > - }
> > > -
> > > + cpu_id = of_get_cpu_hwid(cpu);
>
> Oops, that should be: of_get_cpu_hwid(cpu, 0);
OK. I checked all other patches in the series, it seems OpenRISC was the only
one missing that. Sorry I missed it initially.
> I thought I double checked all those...
>
> > You have defined of_get_cpu_hwid to return u64, will this create compiler
> > warnings when since we are storing a u64 into a u32?
>
> I'm counting on the caller to know the max size for their platform.
OK.
> >
> > It seems only if we make with W=3.
> >
> > I thought we usually warned on this. Oh well, for the openrisc bits.
>
> That's only on ptr truncation I think.
Right, that makes sense.
-Stafford
^ permalink raw reply
* Re: [PATCH 06/12] openrisc: Use of_get_cpu_hwid()
From: Segher Boessenkool @ 2021-10-06 21:27 UTC (permalink / raw)
To: Stafford Horne
Cc: Rich Felker, Rafael J. Wysocki, Catalin Marinas, x86, Guo Ren,
H. Peter Anvin, linux-riscv, Will Deacon, Jonas Bonn, Rob Herring,
Florian Fainelli, Frank Rowand, linux-sh, Russell King,
linux-csky, Ingo Molnar, bcm-kernel-feedback-list, James Morse,
devicetree, Albert Ou, Ray Jui, Stefan Kristiansson, openrisc,
Borislav Petkov, Paul Walmsley, Thomas Gleixner, linux-arm-kernel,
Scott Branden, Yoshinori Sato, linux-kernel, Palmer Dabbelt,
Greg Kroah-Hartman, Paul Mackerras, linuxppc-dev
In-Reply-To: <YV4KkAC2p9D4yCnH@antec>
On Thu, Oct 07, 2021 at 05:44:00AM +0900, Stafford Horne wrote:
> You have defined of_get_cpu_hwid to return u64, will this create compiler
> warnings when since we are storing a u64 into a u32?
>
> It seems only if we make with W=3.
Yes. This is done by -Wconversion, "Warn for implicit conversions that
may alter a value."
> I thought we usually warned on this.
This warning is not in -Wall or -Wextra either, it suffers too much from
false positives. It is very natural to just ignore the high bits of
modulo types (which is what "unsigned" types *are*). Or the bits that
"fall off" on a conversion. The C standard makes this required
behaviour, it is useful, and it is the only convenient way of getting
this!
Segher
^ permalink raw reply
* Re: [PATCH 06/12] openrisc: Use of_get_cpu_hwid()
From: Stafford Horne @ 2021-10-06 22:37 UTC (permalink / raw)
To: Segher Boessenkool
Cc: Rich Felker, Rafael J. Wysocki, Catalin Marinas, x86, Guo Ren,
H. Peter Anvin, linux-riscv, Will Deacon, Jonas Bonn, Rob Herring,
Florian Fainelli, Frank Rowand, linux-sh, Russell King,
linux-csky, Ingo Molnar, bcm-kernel-feedback-list, James Morse,
devicetree, Albert Ou, Ray Jui, Stefan Kristiansson, openrisc,
Borislav Petkov, Paul Walmsley, Thomas Gleixner, linux-arm-kernel,
Scott Branden, Yoshinori Sato, linux-kernel, Palmer Dabbelt,
Greg Kroah-Hartman, Paul Mackerras, linuxppc-dev
In-Reply-To: <20211006212728.GM10333@gate.crashing.org>
Hi Segher,
On Wed, Oct 06, 2021 at 04:27:28PM -0500, Segher Boessenkool wrote:
> On Thu, Oct 07, 2021 at 05:44:00AM +0900, Stafford Horne wrote:
> > You have defined of_get_cpu_hwid to return u64, will this create compiler
> > warnings when since we are storing a u64 into a u32?
> >
> > It seems only if we make with W=3.
>
> Yes. This is done by -Wconversion, "Warn for implicit conversions that
> may alter a value."
Yeah, that is what I found out when I looked into it.
> > I thought we usually warned on this.
>
> This warning is not in -Wall or -Wextra either, it suffers too much from
> false positives. It is very natural to just ignore the high bits of
> modulo types (which is what "unsigned" types *are*). Or the bits that
> "fall off" on a conversion. The C standard makes this required
> behaviour, it is useful, and it is the only convenient way of getting
> this!
Thanks for the background, It does make sense. I guess I was confused with java
which requires casting when you store to a smaller size. I.e.
Test.java:5: error: incompatible types: possible lossy conversion from int to short
s = i;
-Stafford
^ permalink raw reply
* Re: [PATCH] Documentation: Fix typo in testing/sysfs-class-cxl
From: Andrew Donnellan @ 2021-10-07 0:09 UTC (permalink / raw)
To: Sohaib Mohamed; +Cc: Frederic Barrat, linuxppc-dev, linux-kernel
In-Reply-To: <20211006155017.135592-1-sohaib.amhmd@gmail.com>
On 7/10/21 2:50 am, Sohaib Mohamed wrote:
> Remove repeated words: "the the lowest" and "this this kernel"
>
> Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
Thanks for catching this.
Acked-by: Andrew Donnellan <ajd@linux.ibm.com>
--
Andrew Donnellan OzLabs, ADL Canberra
ajd@linux.ibm.com IBM Australia Limited
^ permalink raw reply
* Re: [PATCH 00/12] DT: CPU h/w id parsing clean-ups and cacheinfo id support
From: Florian Fainelli @ 2021-10-07 2:24 UTC (permalink / raw)
To: Rob Herring, Russell King, James Morse, Catalin Marinas,
Will Deacon, Guo Ren, Jonas Bonn, Stefan Kristiansson,
Stafford Horne, Michael Ellerman, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Yoshinori Sato, Rich Felker, x86, Greg Kroah-Hartman
Cc: devicetree, linuxppc-dev, Scott Branden, Rafael J. Wysocki,
linux-sh, Ray Jui, H. Peter Anvin, linux-kernel, linux-csky,
openrisc, Ingo Molnar, Paul Mackerras, Borislav Petkov,
bcm-kernel-feedback-list, Thomas Gleixner, Frank Rowand,
linux-riscv, linux-arm-kernel
In-Reply-To: <20211006164332.1981454-1-robh@kernel.org>
On 10/6/2021 9:43 AM, Rob Herring wrote:
> The first 10 patches add a new function, of_get_cpu_hwid(), which parses
> CPU DT node 'reg' property, and then use it to replace all the open
> coded versions of parsing CPU node 'reg' properties.
>
> The last 2 patches add support for populating the cacheinfo 'id' on DT
> platforms. The minimum associated CPU hwid is used for the id. The id is
> optional, but necessary for resctrl which is being adapted for Arm MPAM.
>
> Tested on arm64. Compile tested on arm, x86 and powerpc.
On ARM and ARM64:
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
lscpu -C continues to work on ARM64 as before with cache properties
provided in the FDT.
--
Florian
^ permalink raw reply
* Re: [PATCH 03/12] ARM: broadcom: Use of_get_cpu_hwid()
From: Florian Fainelli @ 2021-10-07 2:24 UTC (permalink / raw)
To: Rob Herring, Russell King, James Morse, Catalin Marinas,
Will Deacon, Guo Ren, Jonas Bonn, Stefan Kristiansson,
Stafford Horne, Michael Ellerman, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Yoshinori Sato, Rich Felker, x86, Greg Kroah-Hartman
Cc: devicetree, linuxppc-dev, Scott Branden, Rafael J. Wysocki,
linux-sh, Ray Jui, H. Peter Anvin, linux-kernel, linux-csky,
openrisc, Ingo Molnar, Paul Mackerras, Borislav Petkov,
bcm-kernel-feedback-list, Thomas Gleixner, Frank Rowand,
linux-riscv, linux-arm-kernel
In-Reply-To: <20211006164332.1981454-4-robh@kernel.org>
On 10/6/2021 9:43 AM, Rob Herring wrote:
> Replace open coded parsing of CPU nodes 'reg' property with
> of_get_cpu_hwid().
>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Cc: Ray Jui <rjui@broadcom.com>
> Cc: Scott Branden <sbranden@broadcom.com>
> Cc: bcm-kernel-feedback-list@broadcom.com
> Cc: Russell King <linux@armlinux.org.uk>
> Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply
* Re: [PATCH v3 0/4] Add mem_hops field in perf_mem_data_src structure
From: Peter Zijlstra @ 2021-10-07 6:49 UTC (permalink / raw)
To: Kajol Jain
Cc: mark.rutland, atrajeev, ak, daniel, rnsastry, alexander.shishkin,
linux-kernel, acme, ast, linux-perf-users, yao.jin, mingo, paulus,
maddy, jolsa, namhyung, songliubraving, linuxppc-dev, kan.liang
In-Reply-To: <20211006140654.298352-1-kjain@linux.ibm.com>
On Wed, Oct 06, 2021 at 07:36:50PM +0530, Kajol Jain wrote:
> Kajol Jain (4):
> perf: Add comment about current state of PERF_MEM_LVL_* namespace and
> remove an extra line
> perf: Add mem_hops field in perf_mem_data_src structure
> tools/perf: Add mem_hops field in perf_mem_data_src structure
> powerpc/perf: Fix data source encodings for L2.1 and L3.1 accesses
>
> arch/powerpc/perf/isa207-common.c | 26 +++++++++++++++++++++-----
> arch/powerpc/perf/isa207-common.h | 2 ++
> include/uapi/linux/perf_event.h | 19 ++++++++++++++++---
> tools/include/uapi/linux/perf_event.h | 19 ++++++++++++++++---
> tools/perf/util/mem-events.c | 20 ++++++++++++++++++--
> 5 files changed, 73 insertions(+), 13 deletions(-)
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
How do we want this routed? Shall I take it, or does Michael want it in
the Power tree?
^ permalink raw reply
* [V3 0/4] powerpc/perf: Add instruction and data address registers to extended regs
From: Athira Rajeev @ 2021-10-07 6:55 UTC (permalink / raw)
To: mpe, acme, jolsa; +Cc: kjain, maddy, linuxppc-dev, rnsastry
Patch set adds PMU registers namely Sampled Instruction Address Register
(SIAR) and Sampled Data Address Register (SDAR) as part of extended regs
in PowerPC. These registers provides the instruction/data address and
adding these to extended regs helps in debug purposes.
Patch 1/4 and 2/4 refactors the existing macro definition of
PERF_REG_PMU_MASK_300 and PERF_REG_PMU_MASK_31 to make it more
readable.
Patch 3/4 adds SIAR and SDAR as part of the extended regs mask.
Patch 4/4 includes perf tools side changes to add the SPRs to
sample_reg_mask to use with -I? option.
Changelog:
Change from v2 -> v3:
Addressed review comments from Michael Ellerman
- Fixed the macro definition to use "unsigned long long"
which otherwise will cause build error with perf on
32-bit.
- Added Reviewed-by from Daniel Axtens for patch3.
Change from v1 -> v2:
Addressed review comments from Michael Ellerman
- Refactored the perf reg extended mask value macros for
PERF_REG_PMU_MASK_300 and PERF_REG_PMU_MASK_31 to
make it more readable. Also moved PERF_REG_EXTENDED_MAX
along with enum definition similar to PERF_REG_POWERPC_MAX.
Athira Rajeev (4):
powerpc/perf: Refactor the code definition of perf reg extended mask
tools/perf: Refactor the code definition of perf reg extended mask in
tools side header file
powerpc/perf: Expose instruction and data address registers as part of
extended regs
tools/perf: Add perf tools support to expose instruction and data
address registers as part of extended regs
arch/powerpc/include/uapi/asm/perf_regs.h | 28 ++++++++++++-------
arch/powerpc/perf/perf_regs.c | 4 +++
.../arch/powerpc/include/uapi/asm/perf_regs.h | 28 ++++++++++++-------
tools/perf/arch/powerpc/include/perf_regs.h | 2 ++
tools/perf/arch/powerpc/util/perf_regs.c | 2 ++
5 files changed, 44 insertions(+), 20 deletions(-)
--
2.30.1 (Apple Git-130)
^ permalink raw reply
* [V3 1/4] powerpc/perf: Refactor the code definition of perf reg extended mask
From: Athira Rajeev @ 2021-10-07 6:55 UTC (permalink / raw)
To: mpe, acme, jolsa; +Cc: kjain, maddy, linuxppc-dev, rnsastry
In-Reply-To: <20211007065505.27809-1-atrajeev@linux.vnet.ibm.com>
PERF_REG_PMU_MASK_300 and PERF_REG_PMU_MASK_31 defines the mask
value for extended registers. Current definition of these mask values
uses hex constant and does not use registers by name, making it less
readable. Patch refactor the macro values by or'ing together the actual
register value constants. Also include PERF_REG_EXTENDED_MAX as
part of enum definition.
Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
arch/powerpc/include/uapi/asm/perf_regs.h | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/include/uapi/asm/perf_regs.h b/arch/powerpc/include/uapi/asm/perf_regs.h
index 578b3ee86105..085094553f3b 100644
--- a/arch/powerpc/include/uapi/asm/perf_regs.h
+++ b/arch/powerpc/include/uapi/asm/perf_regs.h
@@ -61,27 +61,32 @@ enum perf_event_powerpc_regs {
PERF_REG_POWERPC_PMC4,
PERF_REG_POWERPC_PMC5,
PERF_REG_POWERPC_PMC6,
- /* Max regs without the extended regs */
+ /* Max mask value for interrupt regs w/o extended regs */
PERF_REG_POWERPC_MAX = PERF_REG_POWERPC_MMCRA + 1,
+ /* Max mask value for interrupt regs including extended regs */
+ PERF_REG_EXTENDED_MAX = PERF_REG_POWERPC_PMC6 + 1,
};
#define PERF_REG_PMU_MASK ((1ULL << PERF_REG_POWERPC_MAX) - 1)
-/* Exclude MMCR3, SIER2, SIER3 for CPU_FTR_ARCH_300 */
-#define PERF_EXCLUDE_REG_EXT_300 (7ULL << PERF_REG_POWERPC_MMCR3)
-
/*
* PERF_REG_EXTENDED_MASK value for CPU_FTR_ARCH_300
* includes 9 SPRS from MMCR0 to PMC6 excluding the
- * unsupported SPRS in PERF_EXCLUDE_REG_EXT_300.
+ * unsupported SPRS MMCR3, SIER2 and SIER3.
*/
-#define PERF_REG_PMU_MASK_300 ((0xfffULL << PERF_REG_POWERPC_MMCR0) - PERF_EXCLUDE_REG_EXT_300)
+#define PERF_REG_PMU_MASK_300 \
+ ((1ULL << PERF_REG_POWERPC_MMCR0) | (1ULL << PERF_REG_POWERPC_MMCR1) | \
+ (1ULL << PERF_REG_POWERPC_MMCR2) | (1ULL << PERF_REG_POWERPC_PMC1) | \
+ (1ULL << PERF_REG_POWERPC_PMC2) | (1ULL << PERF_REG_POWERPC_PMC3) | \
+ (1ULL << PERF_REG_POWERPC_PMC4) | (1ULL << PERF_REG_POWERPC_PMC5) | \
+ (1ULL << PERF_REG_POWERPC_PMC6))
/*
* PERF_REG_EXTENDED_MASK value for CPU_FTR_ARCH_31
* includes 12 SPRs from MMCR0 to PMC6.
*/
-#define PERF_REG_PMU_MASK_31 (0xfffULL << PERF_REG_POWERPC_MMCR0)
+#define PERF_REG_PMU_MASK_31 \
+ (PERF_REG_PMU_MASK_300 | (1ULL << PERF_REG_POWERPC_MMCR3) | \
+ (1ULL << PERF_REG_POWERPC_SIER2) | (1ULL << PERF_REG_POWERPC_SIER3))
-#define PERF_REG_EXTENDED_MAX (PERF_REG_POWERPC_PMC6 + 1)
#endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */
--
2.30.1 (Apple Git-130)
^ permalink raw reply related
* [V3 2/4] tools/perf: Refactor the code definition of perf reg extended mask in tools side header file
From: Athira Rajeev @ 2021-10-07 6:55 UTC (permalink / raw)
To: mpe, acme, jolsa; +Cc: kjain, maddy, linuxppc-dev, rnsastry
In-Reply-To: <20211007065505.27809-1-atrajeev@linux.vnet.ibm.com>
PERF_REG_PMU_MASK_300 and PERF_REG_PMU_MASK_31 defines the mask
value for extended registers. Current definition of these mask values
uses hex constant and does not use registers by name, making it less
readable. Patch refactor the macro values in perf tools side header file
by or'ing together the actual register value constants.
Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
.../arch/powerpc/include/uapi/asm/perf_regs.h | 21 ++++++++++++-------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/tools/arch/powerpc/include/uapi/asm/perf_regs.h b/tools/arch/powerpc/include/uapi/asm/perf_regs.h
index 578b3ee86105..085094553f3b 100644
--- a/tools/arch/powerpc/include/uapi/asm/perf_regs.h
+++ b/tools/arch/powerpc/include/uapi/asm/perf_regs.h
@@ -61,27 +61,32 @@ enum perf_event_powerpc_regs {
PERF_REG_POWERPC_PMC4,
PERF_REG_POWERPC_PMC5,
PERF_REG_POWERPC_PMC6,
- /* Max regs without the extended regs */
+ /* Max mask value for interrupt regs w/o extended regs */
PERF_REG_POWERPC_MAX = PERF_REG_POWERPC_MMCRA + 1,
+ /* Max mask value for interrupt regs including extended regs */
+ PERF_REG_EXTENDED_MAX = PERF_REG_POWERPC_PMC6 + 1,
};
#define PERF_REG_PMU_MASK ((1ULL << PERF_REG_POWERPC_MAX) - 1)
-/* Exclude MMCR3, SIER2, SIER3 for CPU_FTR_ARCH_300 */
-#define PERF_EXCLUDE_REG_EXT_300 (7ULL << PERF_REG_POWERPC_MMCR3)
-
/*
* PERF_REG_EXTENDED_MASK value for CPU_FTR_ARCH_300
* includes 9 SPRS from MMCR0 to PMC6 excluding the
- * unsupported SPRS in PERF_EXCLUDE_REG_EXT_300.
+ * unsupported SPRS MMCR3, SIER2 and SIER3.
*/
-#define PERF_REG_PMU_MASK_300 ((0xfffULL << PERF_REG_POWERPC_MMCR0) - PERF_EXCLUDE_REG_EXT_300)
+#define PERF_REG_PMU_MASK_300 \
+ ((1ULL << PERF_REG_POWERPC_MMCR0) | (1ULL << PERF_REG_POWERPC_MMCR1) | \
+ (1ULL << PERF_REG_POWERPC_MMCR2) | (1ULL << PERF_REG_POWERPC_PMC1) | \
+ (1ULL << PERF_REG_POWERPC_PMC2) | (1ULL << PERF_REG_POWERPC_PMC3) | \
+ (1ULL << PERF_REG_POWERPC_PMC4) | (1ULL << PERF_REG_POWERPC_PMC5) | \
+ (1ULL << PERF_REG_POWERPC_PMC6))
/*
* PERF_REG_EXTENDED_MASK value for CPU_FTR_ARCH_31
* includes 12 SPRs from MMCR0 to PMC6.
*/
-#define PERF_REG_PMU_MASK_31 (0xfffULL << PERF_REG_POWERPC_MMCR0)
+#define PERF_REG_PMU_MASK_31 \
+ (PERF_REG_PMU_MASK_300 | (1ULL << PERF_REG_POWERPC_MMCR3) | \
+ (1ULL << PERF_REG_POWERPC_SIER2) | (1ULL << PERF_REG_POWERPC_SIER3))
-#define PERF_REG_EXTENDED_MAX (PERF_REG_POWERPC_PMC6 + 1)
#endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */
--
2.30.1 (Apple Git-130)
^ permalink raw reply related
* [V3 3/4] powerpc/perf: Expose instruction and data address registers as part of extended regs
From: Athira Rajeev @ 2021-10-07 6:55 UTC (permalink / raw)
To: mpe, acme, jolsa; +Cc: kjain, maddy, linuxppc-dev, rnsastry
In-Reply-To: <20211007065505.27809-1-atrajeev@linux.vnet.ibm.com>
Patch adds support to include Sampled Instruction Address Register
(SIAR) and Sampled Data Address Register (SDAR) SPRs as part of extended
registers. Update the definition of PERF_REG_PMU_MASK_300/31 and
PERF_REG_EXTENDED_MAX to include these SPR's.
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
---
arch/powerpc/include/uapi/asm/perf_regs.h | 11 +++++++----
arch/powerpc/perf/perf_regs.c | 4 ++++
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/include/uapi/asm/perf_regs.h b/arch/powerpc/include/uapi/asm/perf_regs.h
index 085094553f3b..749a2e3af89e 100644
--- a/arch/powerpc/include/uapi/asm/perf_regs.h
+++ b/arch/powerpc/include/uapi/asm/perf_regs.h
@@ -61,17 +61,19 @@ enum perf_event_powerpc_regs {
PERF_REG_POWERPC_PMC4,
PERF_REG_POWERPC_PMC5,
PERF_REG_POWERPC_PMC6,
+ PERF_REG_POWERPC_SDAR,
+ PERF_REG_POWERPC_SIAR,
/* Max mask value for interrupt regs w/o extended regs */
PERF_REG_POWERPC_MAX = PERF_REG_POWERPC_MMCRA + 1,
/* Max mask value for interrupt regs including extended regs */
- PERF_REG_EXTENDED_MAX = PERF_REG_POWERPC_PMC6 + 1,
+ PERF_REG_EXTENDED_MAX = PERF_REG_POWERPC_SIAR + 1,
};
#define PERF_REG_PMU_MASK ((1ULL << PERF_REG_POWERPC_MAX) - 1)
/*
* PERF_REG_EXTENDED_MASK value for CPU_FTR_ARCH_300
- * includes 9 SPRS from MMCR0 to PMC6 excluding the
+ * includes 11 SPRS from MMCR0 to SIAR excluding the
* unsupported SPRS MMCR3, SIER2 and SIER3.
*/
#define PERF_REG_PMU_MASK_300 \
@@ -79,11 +81,12 @@ enum perf_event_powerpc_regs {
(1ULL << PERF_REG_POWERPC_MMCR2) | (1ULL << PERF_REG_POWERPC_PMC1) | \
(1ULL << PERF_REG_POWERPC_PMC2) | (1ULL << PERF_REG_POWERPC_PMC3) | \
(1ULL << PERF_REG_POWERPC_PMC4) | (1ULL << PERF_REG_POWERPC_PMC5) | \
- (1ULL << PERF_REG_POWERPC_PMC6))
+ (1ULL << PERF_REG_POWERPC_PMC6) | (1ULL << PERF_REG_POWERPC_SDAR) | \
+ (1ULL << PERF_REG_POWERPC_SIAR))
/*
* PERF_REG_EXTENDED_MASK value for CPU_FTR_ARCH_31
- * includes 12 SPRs from MMCR0 to PMC6.
+ * includes 14 SPRs from MMCR0 to SIAR.
*/
#define PERF_REG_PMU_MASK_31 \
(PERF_REG_PMU_MASK_300 | (1ULL << PERF_REG_POWERPC_MMCR3) | \
diff --git a/arch/powerpc/perf/perf_regs.c b/arch/powerpc/perf/perf_regs.c
index b931eed482c9..51d31b65e423 100644
--- a/arch/powerpc/perf/perf_regs.c
+++ b/arch/powerpc/perf/perf_regs.c
@@ -90,7 +90,11 @@ static u64 get_ext_regs_value(int idx)
return mfspr(SPRN_SIER2);
case PERF_REG_POWERPC_SIER3:
return mfspr(SPRN_SIER3);
+ case PERF_REG_POWERPC_SDAR:
+ return mfspr(SPRN_SDAR);
#endif
+ case PERF_REG_POWERPC_SIAR:
+ return mfspr(SPRN_SIAR);
default: return 0;
}
}
--
2.30.1 (Apple Git-130)
^ permalink raw reply related
* [V3 4/4] tools/perf: Add perf tools support to expose instruction and data address registers as part of extended regs
From: Athira Rajeev @ 2021-10-07 6:55 UTC (permalink / raw)
To: mpe, acme, jolsa; +Cc: kjain, maddy, linuxppc-dev, rnsastry
In-Reply-To: <20211007065505.27809-1-atrajeev@linux.vnet.ibm.com>
Patch enables presenting of Sampled Instruction Address Register (SIAR)
and Sampled Data Address Register (SDAR) SPRs as part of extended regsiters
for perf tool. Add these SPR's to sample_reg_mask in the tool side (to use
with -I? option).
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
tools/arch/powerpc/include/uapi/asm/perf_regs.h | 11 +++++++----
tools/perf/arch/powerpc/include/perf_regs.h | 2 ++
tools/perf/arch/powerpc/util/perf_regs.c | 2 ++
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/tools/arch/powerpc/include/uapi/asm/perf_regs.h b/tools/arch/powerpc/include/uapi/asm/perf_regs.h
index 085094553f3b..749a2e3af89e 100644
--- a/tools/arch/powerpc/include/uapi/asm/perf_regs.h
+++ b/tools/arch/powerpc/include/uapi/asm/perf_regs.h
@@ -61,17 +61,19 @@ enum perf_event_powerpc_regs {
PERF_REG_POWERPC_PMC4,
PERF_REG_POWERPC_PMC5,
PERF_REG_POWERPC_PMC6,
+ PERF_REG_POWERPC_SDAR,
+ PERF_REG_POWERPC_SIAR,
/* Max mask value for interrupt regs w/o extended regs */
PERF_REG_POWERPC_MAX = PERF_REG_POWERPC_MMCRA + 1,
/* Max mask value for interrupt regs including extended regs */
- PERF_REG_EXTENDED_MAX = PERF_REG_POWERPC_PMC6 + 1,
+ PERF_REG_EXTENDED_MAX = PERF_REG_POWERPC_SIAR + 1,
};
#define PERF_REG_PMU_MASK ((1ULL << PERF_REG_POWERPC_MAX) - 1)
/*
* PERF_REG_EXTENDED_MASK value for CPU_FTR_ARCH_300
- * includes 9 SPRS from MMCR0 to PMC6 excluding the
+ * includes 11 SPRS from MMCR0 to SIAR excluding the
* unsupported SPRS MMCR3, SIER2 and SIER3.
*/
#define PERF_REG_PMU_MASK_300 \
@@ -79,11 +81,12 @@ enum perf_event_powerpc_regs {
(1ULL << PERF_REG_POWERPC_MMCR2) | (1ULL << PERF_REG_POWERPC_PMC1) | \
(1ULL << PERF_REG_POWERPC_PMC2) | (1ULL << PERF_REG_POWERPC_PMC3) | \
(1ULL << PERF_REG_POWERPC_PMC4) | (1ULL << PERF_REG_POWERPC_PMC5) | \
- (1ULL << PERF_REG_POWERPC_PMC6))
+ (1ULL << PERF_REG_POWERPC_PMC6) | (1ULL << PERF_REG_POWERPC_SDAR) | \
+ (1ULL << PERF_REG_POWERPC_SIAR))
/*
* PERF_REG_EXTENDED_MASK value for CPU_FTR_ARCH_31
- * includes 12 SPRs from MMCR0 to PMC6.
+ * includes 14 SPRs from MMCR0 to SIAR.
*/
#define PERF_REG_PMU_MASK_31 \
(PERF_REG_PMU_MASK_300 | (1ULL << PERF_REG_POWERPC_MMCR3) | \
diff --git a/tools/perf/arch/powerpc/include/perf_regs.h b/tools/perf/arch/powerpc/include/perf_regs.h
index 04e5dc07e93f..93339d17acc4 100644
--- a/tools/perf/arch/powerpc/include/perf_regs.h
+++ b/tools/perf/arch/powerpc/include/perf_regs.h
@@ -77,6 +77,8 @@ static const char *reg_names[] = {
[PERF_REG_POWERPC_PMC4] = "pmc4",
[PERF_REG_POWERPC_PMC5] = "pmc5",
[PERF_REG_POWERPC_PMC6] = "pmc6",
+ [PERF_REG_POWERPC_SDAR] = "sdar",
+ [PERF_REG_POWERPC_SIAR] = "siar",
};
static inline const char *__perf_reg_name(int id)
diff --git a/tools/perf/arch/powerpc/util/perf_regs.c b/tools/perf/arch/powerpc/util/perf_regs.c
index 8116a253f91f..8d07a78e742a 100644
--- a/tools/perf/arch/powerpc/util/perf_regs.c
+++ b/tools/perf/arch/powerpc/util/perf_regs.c
@@ -74,6 +74,8 @@ const struct sample_reg sample_reg_masks[] = {
SMPL_REG(pmc4, PERF_REG_POWERPC_PMC4),
SMPL_REG(pmc5, PERF_REG_POWERPC_PMC5),
SMPL_REG(pmc6, PERF_REG_POWERPC_PMC6),
+ SMPL_REG(sdar, PERF_REG_POWERPC_SDAR),
+ SMPL_REG(siar, PERF_REG_POWERPC_SIAR),
SMPL_REG_END
};
--
2.30.1 (Apple Git-130)
^ permalink raw reply related
* [V2] powerpc/perf: Fix cycles/instructions as PM_CYC/PM_INST_CMPL in power10
From: Athira Rajeev @ 2021-10-07 7:51 UTC (permalink / raw)
To: mpe; +Cc: kjain, maddy, linuxppc-dev, rnsastry
From: Athira Rajeev <atrajeev@linux.vnet.ibm.cm>
In power9 and before platforms, the default event used for cyles and
instructions is PM_CYC (0x0001e) and PM_INST_CMPL (0x00002) respectively.
These events uses two programmable PMCs and by default will count
irrespective of the run latch state. But since it is using programmable
PMCs, these events will cause multiplexing with basic event set supported
by perf stat. Hence in power10, performance monitoring unit (PMU) driver
uses performance monitor counter 5 (PMC5) and performance monitor counter6
(PMC6) for counting instructions and cycles.
In power10, event used for cycles is PM_RUN_CYC (0x600F4) and instructions
is PM_RUN_INST_CMPL (0x500fa). But counting of these events in idle state
is controlled by the CC56RUN bit setting in Monitor Mode Control Register0
(MMCR0). If the CC56RUN bit is not set, PMC5/6 will not count when
CTRL[RUN] is zero. This could lead to miss some counts if a thread
is in idle state during system wide profiling.
Patch sets the CC56RUN bit in MMCR0 for power10 which makes PMC5 and
PMC6 count instructions and cycles regardless of the run bit. Since
this change make PMC5/6 count as PM_INST_CMPL/PM_CYC, renamed event
code 0x600f4 as PM_CYC instead of PM_RUN_CYC and event code 0x500fa
as PM_INST_CMPL instead of PM_RUN_INST_CMPL. The changes are only for
PMC5/6 event codes and will not affect the behaviour of
PM_RUN_CYC/PM_RUN_INST_CMPL if progammed in other PMC's.
Fixes: a64e697cef23 ("powerpc/perf: power10 Performance Monitoring support")
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.cm>
Reviewed-by: Madhavan Srinivasan <maddy@linux.ibm.com>
---
Changelog:
Updated commit message to explain in detail on why and
how it affects counting.
Notes on testing done for this change:
Tested this patch change with a kernel module that
turns off and turns on the runlatch. kernel module also
reads the counter values for PMC5 and PMC6 during the
period when runlatch is off.
- Started PMU counters via "perf stat" and loaded the
test module.
- Checked the counter values captured from module during
the runlatch off period.
- Verified that counters were frozen without the patch and
with the patch, observed counters were incrementing.
arch/powerpc/perf/power10-events-list.h | 8 ++---
arch/powerpc/perf/power10-pmu.c | 44 +++++++++++++++++--------
2 files changed, 35 insertions(+), 17 deletions(-)
diff --git a/arch/powerpc/perf/power10-events-list.h b/arch/powerpc/perf/power10-events-list.h
index 93be7197d250..564f14097f07 100644
--- a/arch/powerpc/perf/power10-events-list.h
+++ b/arch/powerpc/perf/power10-events-list.h
@@ -9,10 +9,10 @@
/*
* Power10 event codes.
*/
-EVENT(PM_RUN_CYC, 0x600f4);
+EVENT(PM_CYC, 0x600f4);
EVENT(PM_DISP_STALL_CYC, 0x100f8);
EVENT(PM_EXEC_STALL, 0x30008);
-EVENT(PM_RUN_INST_CMPL, 0x500fa);
+EVENT(PM_INST_CMPL, 0x500fa);
EVENT(PM_BR_CMPL, 0x4d05e);
EVENT(PM_BR_MPRED_CMPL, 0x400f6);
EVENT(PM_BR_FIN, 0x2f04a);
@@ -50,8 +50,8 @@ EVENT(PM_DTLB_MISS, 0x300fc);
/* ITLB Reloaded */
EVENT(PM_ITLB_MISS, 0x400fc);
-EVENT(PM_RUN_CYC_ALT, 0x0001e);
-EVENT(PM_RUN_INST_CMPL_ALT, 0x00002);
+EVENT(PM_CYC_ALT, 0x0001e);
+EVENT(PM_INST_CMPL_ALT, 0x00002);
/*
* Memory Access Events
diff --git a/arch/powerpc/perf/power10-pmu.c b/arch/powerpc/perf/power10-pmu.c
index f9d64c63bb4a..9dd75f385837 100644
--- a/arch/powerpc/perf/power10-pmu.c
+++ b/arch/powerpc/perf/power10-pmu.c
@@ -91,8 +91,8 @@ extern u64 PERF_REG_EXTENDED_MASK;
/* Table of alternatives, sorted by column 0 */
static const unsigned int power10_event_alternatives[][MAX_ALT] = {
- { PM_RUN_CYC_ALT, PM_RUN_CYC },
- { PM_RUN_INST_CMPL_ALT, PM_RUN_INST_CMPL },
+ { PM_CYC_ALT, PM_CYC },
+ { PM_INST_CMPL_ALT, PM_INST_CMPL },
};
static int power10_get_alternatives(u64 event, unsigned int flags, u64 alt[])
@@ -118,8 +118,8 @@ static int power10_check_attr_config(struct perf_event *ev)
return 0;
}
-GENERIC_EVENT_ATTR(cpu-cycles, PM_RUN_CYC);
-GENERIC_EVENT_ATTR(instructions, PM_RUN_INST_CMPL);
+GENERIC_EVENT_ATTR(cpu-cycles, PM_CYC);
+GENERIC_EVENT_ATTR(instructions, PM_INST_CMPL);
GENERIC_EVENT_ATTR(branch-instructions, PM_BR_CMPL);
GENERIC_EVENT_ATTR(branch-misses, PM_BR_MPRED_CMPL);
GENERIC_EVENT_ATTR(cache-references, PM_LD_REF_L1);
@@ -148,8 +148,8 @@ CACHE_EVENT_ATTR(dTLB-load-misses, PM_DTLB_MISS);
CACHE_EVENT_ATTR(iTLB-load-misses, PM_ITLB_MISS);
static struct attribute *power10_events_attr_dd1[] = {
- GENERIC_EVENT_PTR(PM_RUN_CYC),
- GENERIC_EVENT_PTR(PM_RUN_INST_CMPL),
+ GENERIC_EVENT_PTR(PM_CYC),
+ GENERIC_EVENT_PTR(PM_INST_CMPL),
GENERIC_EVENT_PTR(PM_BR_CMPL),
GENERIC_EVENT_PTR(PM_BR_MPRED_CMPL),
GENERIC_EVENT_PTR(PM_LD_REF_L1),
@@ -173,8 +173,8 @@ static struct attribute *power10_events_attr_dd1[] = {
};
static struct attribute *power10_events_attr[] = {
- GENERIC_EVENT_PTR(PM_RUN_CYC),
- GENERIC_EVENT_PTR(PM_RUN_INST_CMPL),
+ GENERIC_EVENT_PTR(PM_CYC),
+ GENERIC_EVENT_PTR(PM_INST_CMPL),
GENERIC_EVENT_PTR(PM_BR_FIN),
GENERIC_EVENT_PTR(PM_MPRED_BR_FIN),
GENERIC_EVENT_PTR(PM_LD_REF_L1),
@@ -271,8 +271,8 @@ static const struct attribute_group *power10_pmu_attr_groups[] = {
};
static int power10_generic_events_dd1[] = {
- [PERF_COUNT_HW_CPU_CYCLES] = PM_RUN_CYC,
- [PERF_COUNT_HW_INSTRUCTIONS] = PM_RUN_INST_CMPL,
+ [PERF_COUNT_HW_CPU_CYCLES] = PM_CYC,
+ [PERF_COUNT_HW_INSTRUCTIONS] = PM_INST_CMPL,
[PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = PM_BR_CMPL,
[PERF_COUNT_HW_BRANCH_MISSES] = PM_BR_MPRED_CMPL,
[PERF_COUNT_HW_CACHE_REFERENCES] = PM_LD_REF_L1,
@@ -280,8 +280,8 @@ static int power10_generic_events_dd1[] = {
};
static int power10_generic_events[] = {
- [PERF_COUNT_HW_CPU_CYCLES] = PM_RUN_CYC,
- [PERF_COUNT_HW_INSTRUCTIONS] = PM_RUN_INST_CMPL,
+ [PERF_COUNT_HW_CPU_CYCLES] = PM_CYC,
+ [PERF_COUNT_HW_INSTRUCTIONS] = PM_INST_CMPL,
[PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = PM_BR_FIN,
[PERF_COUNT_HW_BRANCH_MISSES] = PM_MPRED_BR_FIN,
[PERF_COUNT_HW_CACHE_REFERENCES] = PM_LD_REF_L1,
@@ -548,6 +548,24 @@ static u64 power10_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {
#undef C
+/*
+ * Set the MMCR0[CC56RUN] bit to enable counting for
+ * PMC5 and PMC6 regardless of the state of CTRL[RUN],
+ * so that we can use counters 5 and 6 as PM_INST_CMPL and
+ * PM_CYC.
+ */
+static int power10_compute_mmcr(u64 event[], int n_ev,
+ unsigned int hwc[], struct mmcr_regs *mmcr,
+ struct perf_event *pevents[], u32 flags)
+{
+ int ret;
+
+ ret = isa207_compute_mmcr(event, n_ev, hwc, mmcr, pevents, flags);
+ if (!ret)
+ mmcr->mmcr0 |= MMCR0_C56RUN;
+ return ret;
+}
+
static struct power_pmu power10_pmu = {
.name = "POWER10",
.n_counter = MAX_PMU_COUNTERS,
@@ -555,7 +573,7 @@ static struct power_pmu power10_pmu = {
.test_adder = ISA207_TEST_ADDER,
.group_constraint_mask = CNST_CACHE_PMC4_MASK,
.group_constraint_val = CNST_CACHE_PMC4_VAL,
- .compute_mmcr = isa207_compute_mmcr,
+ .compute_mmcr = power10_compute_mmcr,
.config_bhrb = power10_config_bhrb,
.bhrb_filter_map = power10_bhrb_filter_map,
.get_constraint = isa207_get_constraint,
--
2.30.1 (Apple Git-130)
^ permalink raw reply related
* RE: [PATCH 06/12] openrisc: Use of_get_cpu_hwid()
From: David Laight @ 2021-10-07 7:53 UTC (permalink / raw)
To: 'Segher Boessenkool', Stafford Horne
Cc: Rich Felker, Rafael J. Wysocki, Catalin Marinas, x86@kernel.org,
Guo Ren, H. Peter Anvin, linux-riscv@lists.infradead.org,
Frank Rowand, Jonas Bonn, Rob Herring, Florian Fainelli,
Will Deacon, linux-sh@vger.kernel.org, Russell King,
linux-csky@vger.kernel.org, Ingo Molnar,
bcm-kernel-feedback-list@broadcom.com, Palmer Dabbelt,
devicetree@vger.kernel.org, Albert Ou, Ray Jui,
Stefan Kristiansson, openrisc@lists.librecores.org,
Borislav Petkov, Paul Walmsley, Thomas Gleixner,
linux-arm-kernel@lists.infradead.org, Scott Branden,
Yoshinori Sato, linux-kernel@vger.kernel.org, James Morse,
Greg Kroah-Hartman, Paul Mackerras, linuxppc-dev@lists.ozlabs.org
In-Reply-To: <20211006212728.GM10333@gate.crashing.org>
From: Segher Boessenkool
> Sent: 06 October 2021 22:27
>
> On Thu, Oct 07, 2021 at 05:44:00AM +0900, Stafford Horne wrote:
> > You have defined of_get_cpu_hwid to return u64, will this create compiler
> > warnings when since we are storing a u64 into a u32?
> >
> > It seems only if we make with W=3.
>
> Yes. This is done by -Wconversion, "Warn for implicit conversions that
> may alter a value."
>
> > I thought we usually warned on this.
The microsoft compiler does - best to turn all those warnings off.
> This warning is not in -Wall or -Wextra either, it suffers too much from
> false positives. It is very natural to just ignore the high bits of
> modulo types (which is what "unsigned" types *are*). Or the bits that
> "fall off" on a conversion. The C standard makes this required
> behaviour, it is useful, and it is the only convenient way of getting
> this!
I've also seen a compiler convert:
struct->char_member = (char)(int_val & 0xff);
into:
reg = int_val;
reg &= 0xff; // for the & 0xff
reg &= 0xff; // for the cast
struct->char_member = low_8bits(reg);
You really don't want the extra noise.
I'll bet that (char)int_val is actually an arithmetic expression.
So its type will be 'int'.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
^ permalink raw reply
* Re: [PATCH 04/12] arm64: Use of_get_cpu_hwid()
From: Will Deacon @ 2021-10-07 8:07 UTC (permalink / raw)
To: Rob Herring
Cc: Rich Felker, Rafael J. Wysocki, Guo Ren, H. Peter Anvin,
linux-riscv, Frank Rowand, Stafford Horne, Jonas Bonn,
Florian Fainelli, Yoshinori Sato, linux-sh, x86, Russell King,
linux-csky, Ingo Molnar, bcm-kernel-feedback-list,
Catalin Marinas, Palmer Dabbelt, devicetree, Albert Ou, Ray Jui,
Stefan Kristiansson, openrisc, Borislav Petkov, Paul Walmsley,
Thomas Gleixner, linux-arm-kernel, Scott Branden,
Greg Kroah-Hartman, linux-kernel, James Morse, Paul Mackerras,
linuxppc-dev
In-Reply-To: <20211006164332.1981454-5-robh@kernel.org>
On Wed, Oct 06, 2021 at 11:43:24AM -0500, Rob Herring wrote:
> Replace the open coded parsing of CPU nodes' 'reg' property with
> of_get_cpu_hwid().
>
> This change drops an error message for missing 'reg' property, but that
> should not be necessary as the DT tools will ensure 'reg' is present.
>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
> arch/arm64/kernel/smp.c | 31 ++-----------------------------
> 1 file changed, 2 insertions(+), 29 deletions(-)
Acked-by: Will Deacon <will@kernel.org>
It's a shame INVALID_HWID can't be removed too, but looks like it's still
used in a couple of places.
Will
^ permalink raw reply
* Re: [PATCH v1 1/6] mm/memory_hotplug: remove CONFIG_X86_64_ACPI_NUMA dependency from CONFIG_MEMORY_HOTPLUG
From: Oscar Salvador @ 2021-10-07 8:09 UTC (permalink / raw)
To: David Hildenbrand
Cc: Michal Hocko, Michael S. Tsirkin, Peter Zijlstra, Jason Wang,
Dave Hansen, virtualization, linux-mm, Paul Mackerras,
linux-kselftest, H. Peter Anvin, Shuah Khan, Alex Shi,
Jonathan Corbet, x86, Ingo Molnar, Borislav Petkov,
Andy Lutomirski, Thomas Gleixner, Greg Kroah-Hartman, linux-doc,
linux-kernel, Rafael J. Wysocki, Andrew Morton, linuxppc-dev,
Mike Rapoport
In-Reply-To: <20210929143600.49379-2-david@redhat.com>
On Wed, Sep 29, 2021 at 04:35:55PM +0200, David Hildenbrand wrote:
> SPARSEMEM is the only possible memory model for x86-64, FLATMEM is not
> possible:
> config ARCH_FLATMEM_ENABLE
> def_bool y
> depends on X86_32 && !NUMA
>
> And X86_64_ACPI_NUMA (obviously) only supports x86-64:
> config X86_64_ACPI_NUMA
> def_bool y
> depends on X86_64 && NUMA && ACPI && PCI
>
> Let's just remove the CONFIG_X86_64_ACPI_NUMA dependency, as it does no
> longer make sense.
>
> Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
> ---
> mm/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/Kconfig b/mm/Kconfig
> index d16ba9249bc5..b7fb3f0b485e 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -123,7 +123,7 @@ config ARCH_ENABLE_MEMORY_HOTPLUG
> config MEMORY_HOTPLUG
> bool "Allow for memory hot-add"
> select MEMORY_ISOLATION
> - depends on SPARSEMEM || X86_64_ACPI_NUMA
> + depends on SPARSEMEM
> depends on ARCH_ENABLE_MEMORY_HOTPLUG
> depends on 64BIT || BROKEN
> select NUMA_KEEP_MEMINFO if NUMA
> --
> 2.31.1
>
>
--
Oscar Salvador
SUSE Labs
^ permalink raw reply
* Re: [PATCH v1 2/6] mm/memory_hotplug: remove CONFIG_MEMORY_HOTPLUG_SPARSE
From: Oscar Salvador @ 2021-10-07 8:20 UTC (permalink / raw)
To: David Hildenbrand
Cc: Michal Hocko, Michael S. Tsirkin, Peter Zijlstra, Jason Wang,
Dave Hansen, virtualization, linux-mm, Paul Mackerras,
linux-kselftest, H. Peter Anvin, Shuah Khan, Alex Shi,
Jonathan Corbet, x86, Ingo Molnar, Borislav Petkov,
Andy Lutomirski, Thomas Gleixner, Greg Kroah-Hartman, linux-doc,
linux-kernel, Rafael J. Wysocki, Andrew Morton, linuxppc-dev,
Mike Rapoport
In-Reply-To: <20210929143600.49379-3-david@redhat.com>
On Wed, Sep 29, 2021 at 04:35:56PM +0200, David Hildenbrand wrote:
> CONFIG_MEMORY_HOTPLUG depends on CONFIG_SPARSEMEM, so there is no need for
> CONFIG_MEMORY_HOTPLUG_SPARSE anymore; adjust all instances to use
> CONFIG_MEMORY_HOTPLUG and remove CONFIG_MEMORY_HOTPLUG_SPARSE.
>
> Signed-off-by: David Hildenbrand <david@redhat.com>
Acked-by: Oscar Salvador <osalvador@suse.de>
> ---
> arch/powerpc/include/asm/machdep.h | 2 +-
> arch/powerpc/kernel/setup_64.c | 2 +-
> arch/powerpc/platforms/powernv/setup.c | 4 ++--
> arch/powerpc/platforms/pseries/setup.c | 2 +-
> drivers/base/Makefile | 2 +-
> drivers/base/node.c | 9 ++++-----
> drivers/virtio/Kconfig | 2 +-
> include/linux/memory.h | 18 +++++++-----------
> include/linux/node.h | 4 ++--
> lib/Kconfig.debug | 2 +-
> mm/Kconfig | 4 ----
> mm/memory_hotplug.c | 2 --
> tools/testing/selftests/memory-hotplug/config | 1 -
> 13 files changed, 21 insertions(+), 33 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
> index 764f2732a821..d8a2ca007082 100644
> --- a/arch/powerpc/include/asm/machdep.h
> +++ b/arch/powerpc/include/asm/machdep.h
> @@ -32,7 +32,7 @@ struct machdep_calls {
> void (*iommu_save)(void);
> void (*iommu_restore)(void);
> #endif
> -#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
> +#ifdef CONFIG_MEMORY_HOTPLUG
> unsigned long (*memory_block_size)(void);
> #endif
> #endif /* CONFIG_PPC64 */
> diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
> index eaa79a0996d1..21f15d82f062 100644
> --- a/arch/powerpc/kernel/setup_64.c
> +++ b/arch/powerpc/kernel/setup_64.c
> @@ -912,7 +912,7 @@ void __init setup_per_cpu_areas(void)
> }
> #endif
>
> -#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
> +#ifdef CONFIG_MEMORY_HOTPLUG
> unsigned long memory_block_size_bytes(void)
> {
> if (ppc_md.memory_block_size)
> diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
> index a8db3f153063..ad56a54ac9c5 100644
> --- a/arch/powerpc/platforms/powernv/setup.c
> +++ b/arch/powerpc/platforms/powernv/setup.c
> @@ -440,7 +440,7 @@ static void pnv_kexec_cpu_down(int crash_shutdown, int secondary)
> }
> #endif /* CONFIG_KEXEC_CORE */
>
> -#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
> +#ifdef CONFIG_MEMORY_HOTPLUG
> static unsigned long pnv_memory_block_size(void)
> {
> /*
> @@ -553,7 +553,7 @@ define_machine(powernv) {
> #ifdef CONFIG_KEXEC_CORE
> .kexec_cpu_down = pnv_kexec_cpu_down,
> #endif
> -#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
> +#ifdef CONFIG_MEMORY_HOTPLUG
> .memory_block_size = pnv_memory_block_size,
> #endif
> };
> diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
> index f79126f16258..d29f6f1f7f37 100644
> --- a/arch/powerpc/platforms/pseries/setup.c
> +++ b/arch/powerpc/platforms/pseries/setup.c
> @@ -1089,7 +1089,7 @@ define_machine(pseries) {
> .machine_kexec = pSeries_machine_kexec,
> .kexec_cpu_down = pseries_kexec_cpu_down,
> #endif
> -#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
> +#ifdef CONFIG_MEMORY_HOTPLUG
> .memory_block_size = pseries_memory_block_size,
> #endif
> };
> diff --git a/drivers/base/Makefile b/drivers/base/Makefile
> index ef8e44a7d288..02f7f1358e86 100644
> --- a/drivers/base/Makefile
> +++ b/drivers/base/Makefile
> @@ -13,7 +13,7 @@ obj-y += power/
> obj-$(CONFIG_ISA_BUS_API) += isa.o
> obj-y += firmware_loader/
> obj-$(CONFIG_NUMA) += node.o
> -obj-$(CONFIG_MEMORY_HOTPLUG_SPARSE) += memory.o
> +obj-$(CONFIG_MEMORY_HOTPLUG) += memory.o
> ifeq ($(CONFIG_SYSFS),y)
> obj-$(CONFIG_MODULES) += module.o
> endif
> diff --git a/drivers/base/node.c b/drivers/base/node.c
> index c56d34f8158f..b5a4ba18f9f9 100644
> --- a/drivers/base/node.c
> +++ b/drivers/base/node.c
> @@ -629,7 +629,7 @@ static void node_device_release(struct device *dev)
> {
> struct node *node = to_node(dev);
>
> -#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
> +#if defined(CONFIG_MEMORY_HOTPLUG) && defined(CONFIG_HUGETLBFS)
> /*
> * We schedule the work only when a memory section is
> * onlined/offlined on this node. When we come here,
> @@ -782,7 +782,7 @@ int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
> return 0;
> }
>
> -#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
> +#ifdef CONFIG_MEMORY_HOTPLUG
> static int __ref get_nid_for_pfn(unsigned long pfn)
> {
> #ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT
> @@ -958,10 +958,9 @@ static int node_memory_callback(struct notifier_block *self,
> return NOTIFY_OK;
> }
> #endif /* CONFIG_HUGETLBFS */
> -#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */
> +#endif /* CONFIG_MEMORY_HOTPLUG */
>
> -#if !defined(CONFIG_MEMORY_HOTPLUG_SPARSE) || \
> - !defined(CONFIG_HUGETLBFS)
> +#if !defined(CONFIG_MEMORY_HOTPLUG) || !defined(CONFIG_HUGETLBFS)
> static inline int node_memory_callback(struct notifier_block *self,
> unsigned long action, void *arg)
> {
> diff --git a/drivers/virtio/Kconfig b/drivers/virtio/Kconfig
> index ce1b3f6ec325..3654def9915c 100644
> --- a/drivers/virtio/Kconfig
> +++ b/drivers/virtio/Kconfig
> @@ -98,7 +98,7 @@ config VIRTIO_MEM
> default m
> depends on X86_64
> depends on VIRTIO
> - depends on MEMORY_HOTPLUG_SPARSE
> + depends on MEMORY_HOTPLUG
> depends on MEMORY_HOTREMOVE
> depends on CONTIG_ALLOC
> help
> diff --git a/include/linux/memory.h b/include/linux/memory.h
> index 7efc0a7c14c9..dd6e608c3e0b 100644
> --- a/include/linux/memory.h
> +++ b/include/linux/memory.h
> @@ -110,7 +110,7 @@ struct mem_section;
> #define SLAB_CALLBACK_PRI 1
> #define IPC_CALLBACK_PRI 10
>
> -#ifndef CONFIG_MEMORY_HOTPLUG_SPARSE
> +#ifndef CONFIG_MEMORY_HOTPLUG
> static inline void memory_dev_init(void)
> {
> return;
> @@ -126,7 +126,11 @@ static inline int memory_notify(unsigned long val, void *v)
> {
> return 0;
> }
> -#else
> +#define hotplug_memory_notifier(fn, pri) ({ 0; })
> +/* These aren't inline functions due to a GCC bug. */
> +#define register_hotmemory_notifier(nb) ({ (void)(nb); 0; })
> +#define unregister_hotmemory_notifier(nb) ({ (void)(nb); })
> +#else /* CONFIG_MEMORY_HOTPLUG */
> extern int register_memory_notifier(struct notifier_block *nb);
> extern void unregister_memory_notifier(struct notifier_block *nb);
> int create_memory_block_devices(unsigned long start, unsigned long size,
> @@ -149,9 +153,6 @@ struct memory_group *memory_group_find_by_id(int mgid);
> typedef int (*walk_memory_groups_func_t)(struct memory_group *, void *);
> int walk_dynamic_memory_groups(int nid, walk_memory_groups_func_t func,
> struct memory_group *excluded, void *arg);
> -#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */
> -
> -#ifdef CONFIG_MEMORY_HOTPLUG
> #define hotplug_memory_notifier(fn, pri) ({ \
> static __meminitdata struct notifier_block fn##_mem_nb =\
> { .notifier_call = fn, .priority = pri };\
> @@ -159,12 +160,7 @@ int walk_dynamic_memory_groups(int nid, walk_memory_groups_func_t func,
> })
> #define register_hotmemory_notifier(nb) register_memory_notifier(nb)
> #define unregister_hotmemory_notifier(nb) unregister_memory_notifier(nb)
> -#else
> -#define hotplug_memory_notifier(fn, pri) ({ 0; })
> -/* These aren't inline functions due to a GCC bug. */
> -#define register_hotmemory_notifier(nb) ({ (void)(nb); 0; })
> -#define unregister_hotmemory_notifier(nb) ({ (void)(nb); })
> -#endif
> +#endif /* CONFIG_MEMORY_HOTPLUG */
>
> /*
> * Kernel text modification mutex, used for code patching. Users of this lock
> diff --git a/include/linux/node.h b/include/linux/node.h
> index 8e5a29897936..bb21fd631b16 100644
> --- a/include/linux/node.h
> +++ b/include/linux/node.h
> @@ -85,7 +85,7 @@ struct node {
> struct device dev;
> struct list_head access_list;
>
> -#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
> +#if defined(CONFIG_MEMORY_HOTPLUG) && defined(CONFIG_HUGETLBFS)
> struct work_struct node_work;
> #endif
> #ifdef CONFIG_HMEM_REPORTING
> @@ -98,7 +98,7 @@ struct memory_block;
> extern struct node *node_devices[];
> typedef void (*node_registration_func_t)(struct node *);
>
> -#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_NUMA)
> +#if defined(CONFIG_MEMORY_HOTPLUG) && defined(CONFIG_NUMA)
> void link_mem_sections(int nid, unsigned long start_pfn,
> unsigned long end_pfn,
> enum meminit_context context);
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index 2a9b6dcdac4f..669fee1d26b8 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -877,7 +877,7 @@ config DEBUG_MEMORY_INIT
>
> config MEMORY_NOTIFIER_ERROR_INJECT
> tristate "Memory hotplug notifier error injection module"
> - depends on MEMORY_HOTPLUG_SPARSE && NOTIFIER_ERROR_INJECTION
> + depends on MEMORY_HOTPLUG && NOTIFIER_ERROR_INJECTION
> help
> This option provides the ability to inject artificial errors to
> memory hotplug notifier chain callbacks. It is controlled through
> diff --git a/mm/Kconfig b/mm/Kconfig
> index b7fb3f0b485e..ea8762cd8e1e 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -128,10 +128,6 @@ config MEMORY_HOTPLUG
> depends on 64BIT || BROKEN
> select NUMA_KEEP_MEMINFO if NUMA
>
> -config MEMORY_HOTPLUG_SPARSE
> - def_bool y
> - depends on SPARSEMEM && MEMORY_HOTPLUG
> -
> config MEMORY_HOTPLUG_DEFAULT_ONLINE
> bool "Online the newly added memory blocks by default"
> depends on MEMORY_HOTPLUG
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 9fd0be32a281..8d7b2b593a26 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -220,7 +220,6 @@ static void release_memory_resource(struct resource *res)
> kfree(res);
> }
>
> -#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
> static int check_pfn_span(unsigned long pfn, unsigned long nr_pages,
> const char *reason)
> {
> @@ -1163,7 +1162,6 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages,
> mem_hotplug_done();
> return ret;
> }
> -#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */
>
> static void reset_node_present_pages(pg_data_t *pgdat)
> {
> diff --git a/tools/testing/selftests/memory-hotplug/config b/tools/testing/selftests/memory-hotplug/config
> index a7e8cd5bb265..1eef042a31e1 100644
> --- a/tools/testing/selftests/memory-hotplug/config
> +++ b/tools/testing/selftests/memory-hotplug/config
> @@ -1,5 +1,4 @@
> CONFIG_MEMORY_HOTPLUG=y
> -CONFIG_MEMORY_HOTPLUG_SPARSE=y
> CONFIG_NOTIFIER_ERROR_INJECTION=y
> CONFIG_MEMORY_NOTIFIER_ERROR_INJECT=m
> CONFIG_MEMORY_HOTREMOVE=y
> --
> 2.31.1
>
>
--
Oscar Salvador
SUSE Labs
^ permalink raw reply
* Re: [PATCH v2 04/10] powerpc/bpf: Fix BPF_SUB when imm == 0x80000000
From: Naveen N. Rao @ 2021-10-07 8:47 UTC (permalink / raw)
To: Alexei Starovoitov, Christophe Leroy, Daniel Borkmann,
Jordan Niethe, Johan Almbladh, Michael Ellerman, Nicholas Piggin,
Song Liu
Cc: bpf, linuxppc-dev
In-Reply-To: <90494652-7551-7ecb-e44d-a2adbb6a1afe@csgroup.eu>
Christophe Leroy wrote:
>
>
> Le 05/10/2021 à 22:25, Naveen N. Rao a écrit :
>> We aren't handling subtraction involving an immediate value of
>> 0x80000000 properly. Fix the same.
>>
>> Fixes: 156d0e290e969c ("powerpc/ebpf/jit: Implement JIT compiler for extended BPF")
>> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
>> ---
>> Changelog:
>> - Split up BPF_ADD and BPF_SUB cases per Christophe's comments
>>
>> arch/powerpc/net/bpf_jit_comp64.c | 27 +++++++++++++++++----------
>> 1 file changed, 17 insertions(+), 10 deletions(-)
>>
>> diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c
>> index d67f6d62e2e1ff..6626e6c17d4ed2 100644
>> --- a/arch/powerpc/net/bpf_jit_comp64.c
>> +++ b/arch/powerpc/net/bpf_jit_comp64.c
>> @@ -330,18 +330,25 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *
>> EMIT(PPC_RAW_SUB(dst_reg, dst_reg, src_reg));
>> goto bpf_alu32_trunc;
>> case BPF_ALU | BPF_ADD | BPF_K: /* (u32) dst += (u32) imm */
>> - case BPF_ALU | BPF_SUB | BPF_K: /* (u32) dst -= (u32) imm */
>> case BPF_ALU64 | BPF_ADD | BPF_K: /* dst += imm */
>> + if (!imm) {
>> + goto bpf_alu32_trunc;
>> + } else if (imm >= -32768 && imm < 32768) {
>> + EMIT(PPC_RAW_ADDI(dst_reg, dst_reg, IMM_L(imm)));
>> + } else {
>> + PPC_LI32(b2p[TMP_REG_1], imm);
>> + EMIT(PPC_RAW_ADD(dst_reg, dst_reg, b2p[TMP_REG_1]));
>> + }
>> + goto bpf_alu32_trunc;
>> + case BPF_ALU | BPF_SUB | BPF_K: /* (u32) dst -= (u32) imm */
>> case BPF_ALU64 | BPF_SUB | BPF_K: /* dst -= imm */
>> - if (BPF_OP(code) == BPF_SUB)
>> - imm = -imm;
>> - if (imm) {
>> - if (imm >= -32768 && imm < 32768)
>> - EMIT(PPC_RAW_ADDI(dst_reg, dst_reg, IMM_L(imm)));
>> - else {
>> - PPC_LI32(b2p[TMP_REG_1], imm);
>> - EMIT(PPC_RAW_ADD(dst_reg, dst_reg, b2p[TMP_REG_1]));
>> - }
>> + if (!imm) {
>> + goto bpf_alu32_trunc;
>> + } else if (imm > -32768 && imm < 32768) {
>
> Why do you exclude imm == 32768 ?
>
> Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Good catch -- that was from an earlier version where this was shared
across BPF_ADD and BPF_SUB. I missed updating this section before
posting.
Michael, please consider squashing in the below diff into this patch.
Thanks!
- Naveen
---
diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c
index f5a804d8c95bc1..0fdc1ff86e4f1c 100644
--- a/arch/powerpc/net/bpf_jit_comp64.c
+++ b/arch/powerpc/net/bpf_jit_comp64.c
@@ -368,7 +368,7 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *
case BPF_ALU64 | BPF_SUB | BPF_K: /* dst -= imm */
if (!imm) {
goto bpf_alu32_trunc;
- } else if (imm > -32768 && imm < 32768) {
+ } else if (imm > -32768 && imm <= 32768) {
EMIT(PPC_RAW_ADDI(dst_reg, dst_reg, IMM_L(-imm)));
} else {
PPC_LI32(b2p[TMP_REG_1], imm);
^ permalink raw reply related
* Re: [PATCH v1 3/6] mm/memory_hotplug: restrict CONFIG_MEMORY_HOTPLUG to 64 bit
From: Oscar Salvador @ 2021-10-07 9:02 UTC (permalink / raw)
To: David Hildenbrand
Cc: Michal Hocko, Michael S. Tsirkin, Peter Zijlstra, Jason Wang,
Dave Hansen, virtualization, linux-mm, Paul Mackerras,
linux-kselftest, H. Peter Anvin, Shuah Khan, Alex Shi,
Jonathan Corbet, x86, Ingo Molnar, Borislav Petkov,
Andy Lutomirski, Thomas Gleixner, Greg Kroah-Hartman, linux-doc,
linux-kernel, Rafael J. Wysocki, Andrew Morton, linuxppc-dev,
Mike Rapoport
In-Reply-To: <20210929143600.49379-4-david@redhat.com>
On Wed, Sep 29, 2021 at 04:35:57PM +0200, David Hildenbrand wrote:
> 32 bit support is broken in various ways: for example, we can online
> memory that should actually go to ZONE_HIGHMEM to ZONE_MOVABLE or in
> some cases even to one of the other kernel zones.
>
> We marked it BROKEN in commit b59d02ed0869 ("mm/memory_hotplug: disable the
> functionality for 32b") almost one year ago. According to that commit
> it might be broken at least since 2017. Further, there is hardly a sane use
> case nowadays.
>
> Let's just depend completely on 64bit, dropping the "BROKEN" dependency to
> make clear that we are not going to support it again. Next, we'll remove
> some HIGHMEM leftovers from memory hotplug code to clean up.
>
> Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
> ---
> mm/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/Kconfig b/mm/Kconfig
> index ea8762cd8e1e..88273dd5c6d6 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -125,7 +125,7 @@ config MEMORY_HOTPLUG
> select MEMORY_ISOLATION
> depends on SPARSEMEM
> depends on ARCH_ENABLE_MEMORY_HOTPLUG
> - depends on 64BIT || BROKEN
> + depends on 64BIT
> select NUMA_KEEP_MEMINFO if NUMA
>
> config MEMORY_HOTPLUG_DEFAULT_ONLINE
> --
> 2.31.1
>
>
--
Oscar Salvador
SUSE Labs
^ permalink raw reply
* Re: [PATCH v1 4/6] mm/memory_hotplug: remove HIGHMEM leftovers
From: Oscar Salvador @ 2021-10-07 9:13 UTC (permalink / raw)
To: David Hildenbrand
Cc: Michal Hocko, Michael S. Tsirkin, Peter Zijlstra, Jason Wang,
Dave Hansen, virtualization, linux-mm, Paul Mackerras,
linux-kselftest, H. Peter Anvin, Shuah Khan, Alex Shi,
Jonathan Corbet, x86, Ingo Molnar, Borislav Petkov,
Andy Lutomirski, Thomas Gleixner, Greg Kroah-Hartman, linux-doc,
linux-kernel, Rafael J. Wysocki, Andrew Morton, linuxppc-dev,
Mike Rapoport
In-Reply-To: <20210929143600.49379-5-david@redhat.com>
On Wed, Sep 29, 2021 at 04:35:58PM +0200, David Hildenbrand wrote:
> We don't support CONFIG_MEMORY_HOTPLUG on 32 bit and consequently not
> HIGHMEM. Let's remove any leftover code -- including the unused
> "status_change_nid_high" field part of the memory notifier.
>
> Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
> ---
> Documentation/core-api/memory-hotplug.rst | 3 --
> .../zh_CN/core-api/memory-hotplug.rst | 4 ---
> include/linux/memory.h | 1 -
> mm/memory_hotplug.c | 36 ++-----------------
> 4 files changed, 2 insertions(+), 42 deletions(-)
>
> diff --git a/Documentation/core-api/memory-hotplug.rst b/Documentation/core-api/memory-hotplug.rst
> index de7467e48067..682259ee633a 100644
> --- a/Documentation/core-api/memory-hotplug.rst
> +++ b/Documentation/core-api/memory-hotplug.rst
> @@ -57,7 +57,6 @@ The third argument (arg) passes a pointer of struct memory_notify::
> unsigned long start_pfn;
> unsigned long nr_pages;
> int status_change_nid_normal;
> - int status_change_nid_high;
> int status_change_nid;
> }
>
> @@ -65,8 +64,6 @@ The third argument (arg) passes a pointer of struct memory_notify::
> - nr_pages is # of pages of online/offline memory.
> - status_change_nid_normal is set node id when N_NORMAL_MEMORY of nodemask
> is (will be) set/clear, if this is -1, then nodemask status is not changed.
> -- status_change_nid_high is set node id when N_HIGH_MEMORY of nodemask
> - is (will be) set/clear, if this is -1, then nodemask status is not changed.
> - status_change_nid is set node id when N_MEMORY of nodemask is (will be)
> set/clear. It means a new(memoryless) node gets new memory by online and a
> node loses all memory. If this is -1, then nodemask status is not changed.
> diff --git a/Documentation/translations/zh_CN/core-api/memory-hotplug.rst b/Documentation/translations/zh_CN/core-api/memory-hotplug.rst
> index 161f4d2c18cc..9a204eb196f2 100644
> --- a/Documentation/translations/zh_CN/core-api/memory-hotplug.rst
> +++ b/Documentation/translations/zh_CN/core-api/memory-hotplug.rst
> @@ -63,7 +63,6 @@ memory_notify结构体的指针::
> unsigned long start_pfn;
> unsigned long nr_pages;
> int status_change_nid_normal;
> - int status_change_nid_high;
> int status_change_nid;
> }
>
> @@ -74,9 +73,6 @@ memory_notify结构体的指针::
> - status_change_nid_normal是当nodemask的N_NORMAL_MEMORY被设置/清除时设置节
> 点id,如果是-1,则nodemask状态不改变。
>
> -- status_change_nid_high是当nodemask的N_HIGH_MEMORY被设置/清除时设置的节点
> - id,如果这个值为-1,那么nodemask状态不会改变。
> -
> - status_change_nid是当nodemask的N_MEMORY被(将)设置/清除时设置的节点id。这
> 意味着一个新的(没上线的)节点通过联机获得新的内存,而一个节点失去了所有的内
> 存。如果这个值为-1,那么nodemask的状态就不会改变。
> diff --git a/include/linux/memory.h b/include/linux/memory.h
> index dd6e608c3e0b..c46ff374d48d 100644
> --- a/include/linux/memory.h
> +++ b/include/linux/memory.h
> @@ -96,7 +96,6 @@ struct memory_notify {
> unsigned long start_pfn;
> unsigned long nr_pages;
> int status_change_nid_normal;
> - int status_change_nid_high;
> int status_change_nid;
> };
>
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 8d7b2b593a26..95c927c8bfb8 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -21,7 +21,6 @@
> #include <linux/memory.h>
> #include <linux/memremap.h>
> #include <linux/memory_hotplug.h>
> -#include <linux/highmem.h>
> #include <linux/vmalloc.h>
> #include <linux/ioport.h>
> #include <linux/delay.h>
> @@ -585,10 +584,6 @@ void generic_online_page(struct page *page, unsigned int order)
> debug_pagealloc_map_pages(page, 1 << order);
> __free_pages_core(page, order);
> totalram_pages_add(1UL << order);
> -#ifdef CONFIG_HIGHMEM
> - if (PageHighMem(page))
> - totalhigh_pages_add(1UL << order);
> -#endif
> }
> EXPORT_SYMBOL_GPL(generic_online_page);
>
> @@ -625,16 +620,11 @@ static void node_states_check_changes_online(unsigned long nr_pages,
>
> arg->status_change_nid = NUMA_NO_NODE;
> arg->status_change_nid_normal = NUMA_NO_NODE;
> - arg->status_change_nid_high = NUMA_NO_NODE;
>
> if (!node_state(nid, N_MEMORY))
> arg->status_change_nid = nid;
> if (zone_idx(zone) <= ZONE_NORMAL && !node_state(nid, N_NORMAL_MEMORY))
> arg->status_change_nid_normal = nid;
> -#ifdef CONFIG_HIGHMEM
> - if (zone_idx(zone) <= ZONE_HIGHMEM && !node_state(nid, N_HIGH_MEMORY))
> - arg->status_change_nid_high = nid;
> -#endif
> }
>
> static void node_states_set_node(int node, struct memory_notify *arg)
> @@ -642,9 +632,6 @@ static void node_states_set_node(int node, struct memory_notify *arg)
> if (arg->status_change_nid_normal >= 0)
> node_set_state(node, N_NORMAL_MEMORY);
>
> - if (arg->status_change_nid_high >= 0)
> - node_set_state(node, N_HIGH_MEMORY);
> -
> if (arg->status_change_nid >= 0)
> node_set_state(node, N_MEMORY);
> }
> @@ -1801,7 +1788,6 @@ static void node_states_check_changes_offline(unsigned long nr_pages,
>
> arg->status_change_nid = NUMA_NO_NODE;
> arg->status_change_nid_normal = NUMA_NO_NODE;
> - arg->status_change_nid_high = NUMA_NO_NODE;
>
> /*
> * Check whether node_states[N_NORMAL_MEMORY] will be changed.
> @@ -1816,24 +1802,9 @@ static void node_states_check_changes_offline(unsigned long nr_pages,
> if (zone_idx(zone) <= ZONE_NORMAL && nr_pages >= present_pages)
> arg->status_change_nid_normal = zone_to_nid(zone);
>
> -#ifdef CONFIG_HIGHMEM
> - /*
> - * node_states[N_HIGH_MEMORY] contains nodes which
> - * have normal memory or high memory.
> - * Here we add the present_pages belonging to ZONE_HIGHMEM.
> - * If the zone is within the range of [0..ZONE_HIGHMEM), and
> - * we determine that the zones in that range become empty,
> - * we need to clear the node for N_HIGH_MEMORY.
> - */
> - present_pages += pgdat->node_zones[ZONE_HIGHMEM].present_pages;
> - if (zone_idx(zone) <= ZONE_HIGHMEM && nr_pages >= present_pages)
> - arg->status_change_nid_high = zone_to_nid(zone);
> -#endif
> -
> /*
> - * We have accounted the pages from [0..ZONE_NORMAL), and
> - * in case of CONFIG_HIGHMEM the pages from ZONE_HIGHMEM
> - * as well.
> + * We have accounted the pages from [0..ZONE_NORMAL); ZONE_HIGHMEM
> + * does not apply as we don't support 32bit.
> * Here we count the possible pages from ZONE_MOVABLE.
> * If after having accounted all the pages, we see that the nr_pages
> * to be offlined is over or equal to the accounted pages,
> @@ -1851,9 +1822,6 @@ static void node_states_clear_node(int node, struct memory_notify *arg)
> if (arg->status_change_nid_normal >= 0)
> node_clear_state(node, N_NORMAL_MEMORY);
>
> - if (arg->status_change_nid_high >= 0)
> - node_clear_state(node, N_HIGH_MEMORY);
> -
> if (arg->status_change_nid >= 0)
> node_clear_state(node, N_MEMORY);
> }
> --
> 2.31.1
>
>
--
Oscar Salvador
SUSE Labs
^ permalink raw reply
* Re: [PATCH v1 5/6] mm/memory_hotplug: remove stale function declarations
From: Oscar Salvador @ 2021-10-07 9:14 UTC (permalink / raw)
To: David Hildenbrand
Cc: Michal Hocko, Michael S. Tsirkin, Peter Zijlstra, Jason Wang,
Dave Hansen, virtualization, linux-mm, Paul Mackerras,
linux-kselftest, H. Peter Anvin, Shuah Khan, Alex Shi,
Jonathan Corbet, x86, Ingo Molnar, Borislav Petkov,
Andy Lutomirski, Thomas Gleixner, Greg Kroah-Hartman, linux-doc,
linux-kernel, Rafael J. Wysocki, Andrew Morton, linuxppc-dev,
Mike Rapoport
In-Reply-To: <20210929143600.49379-6-david@redhat.com>
On Wed, Sep 29, 2021 at 04:35:59PM +0200, David Hildenbrand wrote:
> These functions no longer exist.
>
> Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
> ---
> include/linux/memory_hotplug.h | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
> index e5a867c950b2..be48e003a518 100644
> --- a/include/linux/memory_hotplug.h
> +++ b/include/linux/memory_hotplug.h
> @@ -98,9 +98,6 @@ static inline void zone_seqlock_init(struct zone *zone)
> {
> seqlock_init(&zone->span_seqlock);
> }
> -extern int zone_grow_free_lists(struct zone *zone, unsigned long new_nr_pages);
> -extern int zone_grow_waitqueues(struct zone *zone, unsigned long nr_pages);
> -extern int add_one_highpage(struct page *page, int pfn, int bad_ppro);
> extern void adjust_present_page_count(struct page *page,
> struct memory_group *group,
> long nr_pages);
> --
> 2.31.1
>
>
--
Oscar Salvador
SUSE Labs
^ permalink raw reply
* Re: [PATCH v1 6/6] x86: remove memory hotplug support on X86_32
From: Oscar Salvador @ 2021-10-07 9:15 UTC (permalink / raw)
To: David Hildenbrand
Cc: Michal Hocko, Michael S. Tsirkin, Peter Zijlstra, Jason Wang,
Dave Hansen, virtualization, linux-mm, Paul Mackerras,
linux-kselftest, H. Peter Anvin, Shuah Khan, Alex Shi,
Jonathan Corbet, x86, Ingo Molnar, Borislav Petkov,
Andy Lutomirski, Thomas Gleixner, Greg Kroah-Hartman, linux-doc,
linux-kernel, Rafael J. Wysocki, Andrew Morton, linuxppc-dev,
Mike Rapoport
In-Reply-To: <20210929143600.49379-7-david@redhat.com>
On Wed, Sep 29, 2021 at 04:36:00PM +0200, David Hildenbrand wrote:
> CONFIG_MEMORY_HOTPLUG was marked BROKEN over one year and we just
> restricted it to 64 bit. Let's remove the unused x86 32bit implementation
> and simplify the Kconfig.
>
> Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
> ---
> arch/x86/Kconfig | 6 +++---
> arch/x86/mm/init_32.c | 31 -------------------------------
> 2 files changed, 3 insertions(+), 34 deletions(-)
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index ab83c22d274e..85f4762429f1 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -62,7 +62,7 @@ config X86
> select ARCH_32BIT_OFF_T if X86_32
> select ARCH_CLOCKSOURCE_INIT
> select ARCH_ENABLE_HUGEPAGE_MIGRATION if X86_64 && HUGETLB_PAGE && MIGRATION
> - select ARCH_ENABLE_MEMORY_HOTPLUG if X86_64 || (X86_32 && HIGHMEM)
> + select ARCH_ENABLE_MEMORY_HOTPLUG if X86_64
> select ARCH_ENABLE_MEMORY_HOTREMOVE if MEMORY_HOTPLUG
> select ARCH_ENABLE_SPLIT_PMD_PTLOCK if (PGTABLE_LEVELS > 2) && (X86_64 || X86_PAE)
> select ARCH_ENABLE_THP_MIGRATION if X86_64 && TRANSPARENT_HUGEPAGE
> @@ -1615,7 +1615,7 @@ config ARCH_SELECT_MEMORY_MODEL
>
> config ARCH_MEMORY_PROBE
> bool "Enable sysfs memory/probe interface"
> - depends on X86_64 && MEMORY_HOTPLUG
> + depends on MEMORY_HOTPLUG
> help
> This option enables a sysfs memory/probe interface for testing.
> See Documentation/admin-guide/mm/memory-hotplug.rst for more information.
> @@ -2395,7 +2395,7 @@ endmenu
>
> config ARCH_HAS_ADD_PAGES
> def_bool y
> - depends on X86_64 && ARCH_ENABLE_MEMORY_HOTPLUG
> + depends on ARCH_ENABLE_MEMORY_HOTPLUG
>
> config ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
> def_bool y
> diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
> index bd90b8fe81e4..5cd7ea6d645c 100644
> --- a/arch/x86/mm/init_32.c
> +++ b/arch/x86/mm/init_32.c
> @@ -779,37 +779,6 @@ void __init mem_init(void)
> test_wp_bit();
> }
>
> -#ifdef CONFIG_MEMORY_HOTPLUG
> -int arch_add_memory(int nid, u64 start, u64 size,
> - struct mhp_params *params)
> -{
> - unsigned long start_pfn = start >> PAGE_SHIFT;
> - unsigned long nr_pages = size >> PAGE_SHIFT;
> - int ret;
> -
> - /*
> - * The page tables were already mapped at boot so if the caller
> - * requests a different mapping type then we must change all the
> - * pages with __set_memory_prot().
> - */
> - if (params->pgprot.pgprot != PAGE_KERNEL.pgprot) {
> - ret = __set_memory_prot(start, nr_pages, params->pgprot);
> - if (ret)
> - return ret;
> - }
> -
> - return __add_pages(nid, start_pfn, nr_pages, params);
> -}
> -
> -void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
> -{
> - unsigned long start_pfn = start >> PAGE_SHIFT;
> - unsigned long nr_pages = size >> PAGE_SHIFT;
> -
> - __remove_pages(start_pfn, nr_pages, altmap);
> -}
> -#endif
> -
> int kernel_set_to_readonly __read_mostly;
>
> static void mark_nxdata_nx(void)
> --
> 2.31.1
>
>
--
Oscar Salvador
SUSE Labs
^ permalink raw reply
* Re: [PATCH v1 6/6] x86: remove memory hotplug support on X86_32
From: David Hildenbrand @ 2021-10-07 9:27 UTC (permalink / raw)
To: Oscar Salvador
Cc: Michal Hocko, Michael S. Tsirkin, Peter Zijlstra, Jason Wang,
Dave Hansen, virtualization, linux-mm, Paul Mackerras,
linux-kselftest, H. Peter Anvin, Shuah Khan, Alex Shi,
Jonathan Corbet, x86, Ingo Molnar, Borislav Petkov,
Andy Lutomirski, Thomas Gleixner, Greg Kroah-Hartman, linux-doc,
linux-kernel, Rafael J. Wysocki, Andrew Morton, linuxppc-dev,
Mike Rapoport
In-Reply-To: <YV66zoLEP3niIHEu@localhost.localdomain>
On 07.10.21 11:15, Oscar Salvador wrote:
> On Wed, Sep 29, 2021 at 04:36:00PM +0200, David Hildenbrand wrote:
>> CONFIG_MEMORY_HOTPLUG was marked BROKEN over one year and we just
>> restricted it to 64 bit. Let's remove the unused x86 32bit implementation
>> and simplify the Kconfig.
>>
>> Signed-off-by: David Hildenbrand <david@redhat.com>
>
> Reviewed-by: Oscar Salvador <osalvador@suse.de>
Thanks for the review Oscar!
--
Thanks,
David / dhildenb
^ permalink raw reply
* Re: [PATCH] video: fbdev: use memset_io() instead of memset()
From: Michael Ellerman @ 2021-10-07 11:28 UTC (permalink / raw)
To: Christophe Leroy, Benjamin Herrenschmidt, Andrew Morton
Cc: linux-fbdev, Finn Thain, Stan Johnson, linux-kernel, dri-devel,
linuxppc-dev
In-Reply-To: <884a54f1e5cb774c1d9b4db780209bee5d4f6718.1631712563.git.christophe.leroy@csgroup.eu>
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> While investigating a lockup at startup on Powerbook 3400C, it was
> identified that the fbdev driver generates alignment exception at
> startup:
...
>
> Use fb_memset() instead of memset(). fb_memset() is defined as
> memset_io() for powerpc.
>
> Fixes: 8c8709334cec ("[PATCH] ppc32: Remove CONFIG_PMAC_PBOOK")
> Reported-by: Stan Johnson <userm57@yahoo.com>
> Cc: Finn Thain <fthain@linux-m68k.org>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> drivers/video/fbdev/chipsfb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Looks like drivers/video/fbdev is orphaned, so I'll pick this up via
powerpc.
cheers
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox