[PATCH v7 5/5] powerpc/64s: enable MMU_LAZY_TLB_SHOOTDOWN

2023-02-02 Thread Nicholas Piggin
On a 16-socket 192-core POWER8 system, the context_switch1_threads benchmark from will-it-scale (see earlier changelog), upstream can achieve a rate of about 1 million context switches per second, due to contention on the mm refcount. 64s meets the prerequisites for CONFIG_MMU_LAZY_TLB_SHOOTDOWN,

[PATCH v7 4/5] lazy tlb: shoot lazies, non-refcounting lazy tlb mm reference handling scheme

2023-02-02 Thread Nicholas Piggin
On big systems, the mm refcount can become highly contented when doing a lot of context switching with threaded applications. user<->idle switch is one of the important cases. Abandoning lazy tlb entirely slows this switching down quite a bit in the common uncontended case, so that is not viable.

[PATCH v7 3/5] lazy tlb: allow lazy tlb mm refcounting to be configurable

2023-02-02 Thread Nicholas Piggin
Add CONFIG_MMU_TLB_REFCOUNT which enables refcounting of the lazy tlb mm when it is context switched. This can be disabled by architectures that don't require this refcounting if they clean up lazy tlb mms when the last refcount is dropped. Currently this is always enabled, so the patch introduces

[PATCH v7 2/5] lazy tlb: introduce lazy tlb mm refcount helper functions

2023-02-02 Thread Nicholas Piggin
Add explicit _lazy_tlb annotated functions for lazy tlb mm refcounting. This makes the lazy tlb mm references more obvious, and allows the refcounting scheme to be modified in later changes. There is no functional change with this patch. Acked-by: Linus Torvalds Signed-off-by: Nicholas Piggin

[PATCH v7 1/5] kthread: simplify kthread_use_mm refcounting

2023-02-02 Thread Nicholas Piggin
Remove the special case avoiding refcounting when the mm to be used is the same as the kernel thread's active (lazy tlb) mm. kthread_use_mm() should not be such a performance critical path that this matters much. This simplifies a later change to lazy tlb mm refcounting. Acked-by: Linus Torvalds

[PATCH v7 0/5] shoot lazy tlbs (lazy tlb refcount scalability improvement)

2023-02-02 Thread Nicholas Piggin
(Sorry about the double send) Hi Andrew, This series improves scalability of context switching between user and kernel threads on large systems with a threaded process spread across a lot of CPUs. Please consider these patches for mm. Discussion of v6 here:

Re: [PATCH v2 3/6] hvcs: Use driver groups to manage driver attributes

2023-02-02 Thread Greg KH
On Thu, Feb 02, 2023 at 04:28:01PM -0600, Brian King wrote: > Rather than manually creating attributes for the hvcs driver, > let the driver core do this for us. This also fixes some hotplug > remove issues and ensures that cleanup of these attributes > is done in the right order. > >

Re: [PATCH v2 1/6] hvcs: Fix hvcs port reference counting

2023-02-02 Thread Greg KH
On Thu, Feb 02, 2023 at 04:27:59PM -0600, Brian King wrote: > The hvcs driver only ever gets two references to the port. One > at initialization time, and one at install time. Remove the code > that was trying to do multiple port puts for each open, which > would result in more puts than gets. >

Re: [PATCH v2 2/6] hvcs: Use dev_groups to manage hvcs device attributes

2023-02-02 Thread Greg KH
On Thu, Feb 02, 2023 at 04:28:00PM -0600, Brian King wrote: > Use the dev_groups functionality to manage the attribute groups > for hvcs devices. This simplifies the code and also eliminates > errors coming from kernfs when attempting to remove a console > device that is in use. > >

Re: [PATCH] powerpc/hv-24x7: Fix pvr check when setting interface version

2023-02-02 Thread kajoljain
On 2/1/23 19:41, Sachin Sant wrote: > > >> On 01-Feb-2023, at 12:18 AM, Kajol Jain wrote: >> >> Commit ec3eb9d941a9 ("powerpc/perf: Use PVR rather than >> oprofile field to determine CPU version") added usage >> of pvr value instead of oprofile field to determine the >> platform. In hv-24x7

Re: Bug: Write fault blocked by KUAP! (kernel 6.2-rc6, Talos II)

2023-02-02 Thread Nicholas Piggin
On Fri Feb 3, 2023 at 12:02 PM AEST, Benjamin Gray wrote: > On Fri, 2023-02-03 at 00:46 +0100, Erhard F. wrote: > > Happened during boot: > > > > [...] > > Creating 6 MTD partitions on "flash@0": > > 0x-0x0400 : "PNOR" > > 0x01b21000-0x03921000 : "BOOTKERNEL" > >

Re: Bug: Write fault blocked by KUAP! (kernel 6.2-rc6, Talos II)

2023-02-02 Thread Benjamin Gray
On Fri, 2023-02-03 at 00:46 +0100, Erhard F. wrote: > Happened during boot: > > [...] > Creating 6 MTD partitions on "flash@0": > 0x-0x0400 : "PNOR" > 0x01b21000-0x03921000 : "BOOTKERNEL" > 0x03a44000-0x03a68000 : "CAPP" > 0x03a88000-0x03a89000 :

Re: [PATCH v1] perf pmu: Fix aarch64 build

2023-02-02 Thread Ian Rogers
On Thu, Feb 2, 2023 at 5:40 PM Ian Rogers wrote: > > ARM64 overrides a weak function but a previous change had broken the > build. > > Fixes: 8cefeb8bd336 ("perf pmu-events: Introduce pmu_metrics_table") As 8cefeb8bd336 ("perf pmu-events: Introduce pmu_metrics_table") is only on tmp.perf/core

[PATCH v1] perf pmu: Fix aarch64 build

2023-02-02 Thread Ian Rogers
ARM64 overrides a weak function but a previous change had broken the build. Fixes: 8cefeb8bd336 ("perf pmu-events: Introduce pmu_metrics_table") Signed-off-by: Ian Rogers --- tools/perf/arch/arm64/util/pmu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/perf/arch/arm64/util/pmu.c

[PATCH 1/5] selftests/powerpc: Add generic read/write file util

2023-02-02 Thread Benjamin Gray
File read/write is reimplemented in about 5 different ways in the various PowerPC selftests. This indicates it should be a common util. Add a common read_file / write_file implementation and convert users to it where (easily) possible. Signed-off-by: Benjamin Gray --- v4: * Set errno as

[PATCH 4/5] selftests/powerpc: Add {read,write}_{long,ulong}

2023-02-02 Thread Benjamin Gray
Add helper functions to read and write (unsigned) long values directly from/to files. One of the kernel interfaces uses hex strings, so we need to allow passing a base too. Signed-off-by: Benjamin Gray --- v4: * Set errno where it isn't already set ---

[PATCH 0/5] Expand selftest utils

2023-02-02 Thread Benjamin Gray
Started this when writing tests for a feature I'm working on, needing a way to read/write numbers to system files. After writing some utils to safely handle file IO and parsing, I realised I'd made the ~6th file read/write implementation and only(?) number parser that checks all the failure modes

[PATCH 5/5] selftests/powerpc: Add automatically allocating read_file

2023-02-02 Thread Benjamin Gray
A couple of tests roll their own auto-allocating file read logic. Add a generic implementation and convert them to use it. Signed-off-by: Benjamin Gray --- v4: * Make allocation more concise using realloc(NULL, length) without special casing initial malloc(length) ---

[PATCH 2/5] selftests/powerpc: Add read/write debugfs file, int

2023-02-02 Thread Benjamin Gray
Debugfs files are not always integers, so make *_file return/write a byte buffer, and *_int deal with int values specifically. This increases consistency with the other file read/write helpers. Signed-off-by: Benjamin Gray Reviewed-by: Andrew Donnellan --- v4: * Add reviewed-by ---

[PATCH 3/5] selftests/powerpc: Parse long/unsigned long value safely

2023-02-02 Thread Benjamin Gray
Often a file is expected to hold an integral value. Existing functions will use a C stdlib function like atoi or strtol to parse the file. These operations are error prone, with complicated error conditions (atoi returns 0 if not a number, and is undefined behaviour if not in range. strtol returns

[PATCH v2 6/6] hvcs: Synchronize hotplug remove with port free

2023-02-02 Thread Brian King
Synchronizes hotplug remove with the freeing of the port. This ensures we have freed all the memory associated with this port and are not leaking memory. Signed-off-by: Brian King --- drivers/tty/hvc/hvcs.c | 26 +++--- 1 file changed, 15 insertions(+), 11 deletions(-) diff

[PATCH v2 5/6] hvcs: Use vhangup in hotplug remove

2023-02-02 Thread Brian King
When hotplug removing an hvcs device, we need to ensure the hangup processing is done prior to exiting the remove function, so use tty_vhangup to do the hangup processing directly rather than using tty_hangup which simply schedules the hangup work for later execution. Signed-off-by: Brian King

[PATCH v2 4/6] hvcs: Get reference to tty in remove

2023-02-02 Thread Brian King
Grab a reference to the tty when removing the hvcs to ensure it does not get freed unexpectedly. Signed-off-by: Brian King --- drivers/tty/hvc/hvcs.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c index

[PATCH v2 3/6] hvcs: Use driver groups to manage driver attributes

2023-02-02 Thread Brian King
Rather than manually creating attributes for the hvcs driver, let the driver core do this for us. This also fixes some hotplug remove issues and ensures that cleanup of these attributes is done in the right order. Signed-off-by: Brian King --- drivers/tty/hvc/hvcs.c | 24

[PATCH v2 2/6] hvcs: Use dev_groups to manage hvcs device attributes

2023-02-02 Thread Brian King
Use the dev_groups functionality to manage the attribute groups for hvcs devices. This simplifies the code and also eliminates errors coming from kernfs when attempting to remove a console device that is in use. Signed-off-by: Brian King --- drivers/tty/hvc/hvcs.c | 24 +++-

[PATCH v2 1/6] hvcs: Fix hvcs port reference counting

2023-02-02 Thread Brian King
The hvcs driver only ever gets two references to the port. One at initialization time, and one at install time. Remove the code that was trying to do multiple port puts for each open, which would result in more puts than gets. Signed-off-by: Brian King --- drivers/tty/hvc/hvcs.c | 18

[PATCH v2 0/6] hvcs: Various hvcs device hotplug fixes

2023-02-02 Thread Brian King
This patch series fixes a number of issues with hotplugging hvcs devices including memory leaks as well as, the inability to reconnect to a console device after it has been hot added back, since it was not getting cleaned up properly on the hotplug remove path. Changes since initial version: -

Re: [PATCH v8 4/8] crash: add phdr for possible CPUs in elfcorehdr

2023-02-02 Thread Eric DeVolder
On 2/2/23 09:37, Eric DeVolder wrote: On 2/1/23 00:38, Sourabh Jain wrote: On architectures like PowerPC the crash notes are available for all possible CPUs. So let's populate the elfcorehdr for all possible CPUs having crash notes to avoid updating elfcorehdr during in-kernel crash update

RE: [PATCH 1/1] PCI: layerscape: Add the workaround for A-010305

2023-02-02 Thread Frank Li
> Subject: [PATCH 1/1] PCI: layerscape: Add the workaround for A-010305 > > From: Xiaowei Bao > > When a link down or hot reset event occurs, the PCI Express EP > controller's Link Capabilities Register should retain the values of > the Maximum Link Width and Supported Link Speed configured by

RE: [PATCH 1/1] PCI: layerscape: Set 64-bit DMA mask

2023-02-02 Thread Frank Li
> Subject: [PATCH 1/1] PCI: layerscape: Set 64-bit DMA mask > > From: Guanhua Gao > > Set DMA mask and coherent DMA mask to enable 64-bit addressing. > > Signed-off-by: Guanhua Gao > Signed-off-by: Hou Zhiqiang > Signed-off-by: Frank Li > --- Ping >

RE: [EXT] [PATCH v2 1/1] PCI: layerscape: Add EP mode support for ls1028a

2023-02-02 Thread Frank Li
> Subject: [EXT] [PATCH v2 1/1] PCI: layerscape: Add EP mode support for > ls1028a > > Caution: EXT Email > > From: Xiaowei Bao > > Add PCIe EP mode support for ls1028a. > > Signed-off-by: Xiaowei Bao > Signed-off-by: Hou Zhiqiang > Signed-off-by: Frank Li > Acked-by: Roy Zang >

Re: [PATCH V2 1/3] core/device: Add function to return child node using name at substring "@"

2023-02-02 Thread Athira Rajeev
> On 30-Jan-2023, at 3:14 PM, Mahesh J Salgaonkar wrote: > > On 2023-01-18 11:14:50 Wed, Athira Rajeev wrote: >> Add a function dt_find_by_name_substr() that returns the child node if >> it matches till first occurence at "@" of a given name, otherwise NULL. >> This is helpful for cases with

[PATCH] tools/perf/tests: Add system wide check for perf bench workload in all metric test

2023-02-02 Thread Kajol Jain
Testcase stat_all_metrics.sh fails in powerpc: 92: perf all metrics test : FAILED! Logs with verbose: [command]# ./perf test 92 -vv 92: perf all metrics test : --- start --- test child forked, pid 13262 Testing BRU_STALL_CPI Testing

[powerpc:next-test 14/40] arch/powerpc/kernel/pci_32.c:233:5: error: no previous prototype for 'pci_device_from_OF_node'

2023-02-02 Thread kernel test robot
-20230202 (https://download.01.org/0day-ci/archive/20230203/202302030001.hqpci490-...@intel.com/config) compiler: powerpc-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod

Re: [PATCH v8 4/8] crash: add phdr for possible CPUs in elfcorehdr

2023-02-02 Thread Eric DeVolder
On 2/1/23 00:38, Sourabh Jain wrote: On architectures like PowerPC the crash notes are available for all possible CPUs. So let's populate the elfcorehdr for all possible CPUs having crash notes to avoid updating elfcorehdr during in-kernel crash update on CPU hotplug events. The similar

[PATCH] ppc: iommu: fix memory leak with using debugfs_lookup()

2023-02-02 Thread Greg Kroah-Hartman
When calling debugfs_lookup() the result must have dput() called on it, otherwise the memory will leak over time. To make things simpler, just call debugfs_lookup_and_remove() instead which handles all of the logic at once. Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc:

Re: WARN include/linux/trace_recursion.h:162 (powerpc)

2023-02-02 Thread Sachin Sant
>> ---[ end trace ]--- >> [ cut here ] >> RCU not on for: shared_cede_loop+0xc/0x170 >> >> The code in question was added by >> commit d099dbfd330686a8c09cd8944bcc77a56f9e7815 >>cpuidle: tracing: Warn about !rcu_is_watching() > > Note that by

Re: [PATCH] powerpc: Don't select ARCH_WANTS_NO_INSTR

2023-02-02 Thread Sachin Sant
> > Reported-by: Sachin Sant > Suggested-by: Peter Zijlstra > Signed-off-by: Michael Ellerman > --- Thanks for the patch Michael. Tested-by: Sachin Sant > arch/powerpc/Kconfig | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig > index

[PATCH] powerpc: Don't select ARCH_WANTS_NO_INSTR

2023-02-02 Thread Michael Ellerman
Commit 41b7a347bf14 ("powerpc: Book3S 64-bit outline-only KASAN support") added a select of ARCH_WANTS_NO_INSTR, because it also added some uses of noinstr. However noinstr is always defined, regardless of ARCH_WANTS_NO_INSTR, so there's no need to select it just for that. As PeterZ says [1]:

[PATCH] powerpc: Disable CPU unknown by CLANG when CC_IS_CLANG

2023-02-02 Thread Christophe Leroy
CLANG only knows the following CPUs: generic, 440, 450, 601, 602, 603, 603e, 603ev, 604, 604e, 620, 630, g3, 7400, g4, 7450, g4+, 750, 8548, 970, g5, a2, e500, e500mc, e5500, power3, pwr3, power4, pwr4, power5, pwr5, power5x, pwr5x, power6, pwr6, power6x, pwr6x, power7, pwr7, power8, pwr8,

[powerpc:next-test] BUILD REGRESSION 9ffcf6a19dbb2a24de2c2d7b2af1e130986cd565

2023-02-02 Thread kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next-test branch HEAD: 9ffcf6a19dbb2a24de2c2d7b2af1e130986cd565 integrity/powerpc: Support loading keys from PLPKS Error/Warning ids grouped by kconfigs: gcc_recent_errors `-- powerpc-allmodconfig `--

Re: WARN include/linux/trace_recursion.h:162 (powerpc)

2023-02-02 Thread Peter Zijlstra
On Thu, Feb 02, 2023 at 01:46:32PM +0530, Sachin Sant wrote: > Following warning is seen with 6.2.0-rc6-next-20230201 on a > Power10 server. > > [ cut here ] > RCU not on for: check_return_regs_valid+0xc/0x1e0 > WARNING: CPU: 9 PID: 0 at include/linux/trace_recursion.h:162

WARN include/linux/trace_recursion.h:162 (powerpc)

2023-02-02 Thread Sachin Sant
Following warning is seen with 6.2.0-rc6-next-20230201 on a Power10 server. [ cut here ] RCU not on for: check_return_regs_valid+0xc/0x1e0 WARNING: CPU: 9 PID: 0 at include/linux/trace_recursion.h:162 arch_ftrace_ops_list_func+0x2c0/0x2e0 Modules linked in: kmem

Re: [PATCH v5 00/15] jevents/pmu-events improvements

2023-02-02 Thread kajoljain
Patchset looks goot to me Reviewed-By: Kajol Jain On 1/27/23 05:06, Ian Rogers wrote: > Add an optimization to jevents using the metric code, rewrite metrics > in terms of each other in order to minimize size and improve > readability. For example, on Power8 > other_stall_cpi is rewritten from: