[RFC PATCH v1] pseries/drmem: don't cache node id in drmem_lmb struct

2020-03-11 Thread Scott Cheloha
At memory hot-remove time we can retrieve an LMB's nid from its corresponding memory_block. There is no need to store the nid in multiple locations. Signed-off-by: Scott Cheloha --- The linear search in powerpc's memory_add_physaddr_to_nid() has become a bottleneck at boot on systems

Re: [RFC PATCH v1] pseries/drmem: don't cache node id in drmem_lmb struct

2020-03-12 Thread Scott Cheloha
Hi Michal, On Thu, Mar 12, 2020 at 06:02:37AM +0100, Michal Suchánek wrote: > On Wed, Mar 11, 2020 at 06:08:15PM -0500, Scott Cheloha wrote: > > At memory hot-remove time we can retrieve an LMB's nid from its > > corresponding memory_block. There is no need to store the

[PATCH] powerpc/drmem: cache LMBs in xarray to accelerate lookup

2020-01-28 Thread Scott Cheloha
256 LMB(s) at index 8100 [...] [ 103.934092] pseries-hotplug-mem: Memory at 3fff000 (drc index 80003fff) was hot-added Signed-off-by: Scott Cheloha --- These linear searches become a serious bottleneck as the machine approaches 64TB. There are just too many LMBs to use a linear search

Re: [PATCH] powerpc/drmem: cache LMBs in xarray to accelerate lookup

2020-01-29 Thread Scott Cheloha
On Tue, Jan 28, 2020 at 05:56:55PM -0600, Nathan Lynch wrote: > Scott Cheloha writes: > > LMB lookup is currently an O(n) linear search. This scales poorly when > > there are many LMBs. > > > > If we cache each LMB by both its base address and its DRC index > > i

Re: [PATCH] powerpc/drmem: cache LMBs in xarray to accelerate lookup

2020-02-03 Thread Scott Cheloha
On Thu, Jan 30, 2020 at 10:09:32AM -0600, Fontenot, Nathan wrote: > On 1/29/2020 12:10 PM, Scott Cheloha wrote: > > On Tue, Jan 28, 2020 at 05:56:55PM -0600, Nathan Lynch wrote: > >> Scott Cheloha writes: > >>> LMB lookup is currently an O(n) linear search. This

Re: [PATCH] powerpc/drmem: cache LMBs in xarray to accelerate lookup

2020-02-04 Thread Scott Cheloha
On Tue, Jan 28, 2020 at 05:56:55PM -0600, Nathan Lynch wrote: > Scott Cheloha writes: > > LMB lookup is currently an O(n) linear search. This scales poorly when > > there are many LMBs. > > > > If we cache each LMB by both its base address and its DRC index > > i

[PATCH v2 1/2] powerpc/drmem: accelerate memory_add_physaddr_to_nid() with LMB xarray

2020-02-21 Thread Scott Cheloha
d() so this patch will also improve memory hot-add speeds on big machines. Signed-off-by: Scott Cheloha --- arch/powerpc/include/asm/drmem.h | 1 + arch/powerpc/mm/drmem.c | 24 arch/powerpc/mm/numa.c | 29 ++--- 3 files chang

pseries: accelerate drmem and simplify hotplug with xarrays

2020-02-21 Thread Scott Cheloha
This patch series introduces two xarrays of LMBs in an effort to speed up the drmem code and simplify the hotplug code on pseries machines. The first patch introduces an xarray of LMBs indexed by physical address. xa_load() is then used to accelerate LMB lookup during memory_add_physaddr_to_nid()

[PATCH v2 2/2] pseries/hotplug-memory: leverage xarray API to simplify code

2020-02-21 Thread Scott Cheloha
ht to run faster, too: several linear searches have been replaced with xa_load(), which runs in sub-linear time. The array of LMBs, drmem_info.lmbs[], is kept to preserve the ordering of LMBs read from the firmware in drmem_init() during firmware writes in drmem_update_dt(). Signed-off-by: Scott Ch

Re: [PATCH 2/3] powerpc/pseries/memhp: Remove unbalanced dlpar_release_drc() call

2023-11-30 Thread Scott Cheloha
> On Nov 28, 2023, at 9:21 AM, Nathan Lynch wrote: > > Nick Child writes: >> Hi Nathan, >> Patches 1 and 3 LGTM > > thanks. > >> Regarding this patch, dlpar_memory_remove_by_count() calls >> dlpar_add_lmb() and does not free drc on add error. >> dlpar_add_lmb() is called here in error recover

[PATCH v1] pseries/hotplug-memory: hot-add: skip redundant LMB lookup

2020-09-10 Thread Scott Cheloha
the drconf range are considered first. On an otherwise idle LPAR with so many LMBs we would expect to find the LMBs we need near the start of the drconf range, hence the smaller speedup. Signed-off-by: Scott Cheloha --- arch/powerpc/mm/numa.c | 2 +- arch/powerpc/platf

Re: [PATCH v3] pseries/drmem: don't cache node id in drmem_lmb struct

2020-09-10 Thread Scott Cheloha
On Fri, Aug 21, 2020 at 10:33:10AM +0200, Laurent Dufour wrote: > Le 11/08/2020 à 03:51, Scott Cheloha a écrit : > > > > [...] > > > > @@ -631,7 +638,7 @@ static int dlpar_memory_remove_by_ic(u32 > > lmbs_to_remove, u32 drc_index) > > static

[PATCH v2] pseries/hotplug-memory: hot-add: skip redundant LMB lookup

2020-09-15 Thread Scott Cheloha
the drconf range are considered first. On an otherwise idle LPAR with so many LMBs we would expect to find the LMBs we need near the start of the drconf range, hence the smaller speedup. Signed-off-by: Scott Cheloha --- Changelog: v1: https://lore.kernel.org/linuxppc-dev/202009101

[PATCH v3] pseries/hotplug-memory: hot-add: skip redundant LMB lookup

2020-09-15 Thread Scott Cheloha
the drconf range are considered first. On an otherwise idle LPAR with so many LMBs we would expect to find the LMBs we need near the start of the drconf range, hence the smaller speedup. Signed-off-by: Scott Cheloha --- Changelog: v1: https://lore.kernel.org/linuxppc-dev/202009101

Re: [PATCH v3] pseries/hotplug-memory: hot-add: skip redundant LMB lookup

2020-09-16 Thread Scott Cheloha
On Wed, Sep 16, 2020 at 09:39:53AM +0200, David Hildenbrand wrote: > On 15.09.20 21:46, Scott Cheloha wrote: > > During memory hot-add, dlpar_add_lmb() calls memory_add_physaddr_to_nid() > > to determine which node id (nid) to use when later calling __add_memory(). > > >

[PATCH v4] pseries/hotplug-memory: hot-add: skip redundant LMB lookup

2020-09-16 Thread Scott Cheloha
the drconf range are considered first. On an otherwise idle LPAR with so many LMBs we would expect to find the LMBs we need near the start of the drconf range, hence the smaller speedup. Signed-off-by: Scott Cheloha --- Changelog: v1: https://lore.kernel.org/linuxppc-dev/202009101

[PATCH] powerpc: topology.h: fix build when CONFIG_NUMA=n

2020-11-05 Thread Scott Cheloha
Add a non-NUMA definition for of_drconf_to_nid_single() to topology.h so we have one even if powerpc/mm/numa.c is not compiled. On a non-NUMA kernel the appropriate node id is always first_online_node. Signed-off-by: Scott Cheloha Reported-by: kernel test robot Fixes: 72cdd117c449 ("ps

[PATCH v2] powerpc: topology.h: fix build when CONFIG_NUMA=n

2020-11-05 Thread Scott Cheloha
Add a non-NUMA definition for of_drconf_to_nid_single() to topology.h so we have one even if powerpc/mm/numa.c is not compiled. On a non-NUMA kernel the appropriate node id is always first_online_node. Signed-off-by: Scott Cheloha Reported-by: kernel test robot Fixes: 72cdd117c449 ("ps

[PATCH v1 1/4] powerpc/pseries: hvcall.h: add H_WATCHDOG opcode, H_NOOP return code

2022-05-20 Thread Scott Cheloha
PAPR v2.12 defines a new hypercall, H_WATCHDOG. The hypercall permits guest control of one or more virtual watchdog timers. Add the opcode for the H_WATCHDOG hypercall to hvcall.h. While here, add a definition for H_NOOP, a possible return code for H_WATCHDOG. Signed-off-by: Scott Cheloha

[PATCH v1 2/4] powerpc/pseries: add FW_FEATURE_WATCHDOG flag

2022-05-20 Thread Scott Cheloha
ned-off-by: Scott Cheloha --- arch/powerpc/include/asm/firmware.h | 3 ++- arch/powerpc/platforms/pseries/firmware.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/firmware.h b/arch/powerpc/include/asm/firmware.h index 834b8ecf..398e0b5e4

[PATCH v1 3/4] powerpc/pseries: register pseries-wdt device with platform bus

2022-05-20 Thread Scott Cheloha
workaround we represent them as platform devices. This patch registers a single platform device, "pseries-wdt", with the platform bus if the FW_FEATURE_WATCHDOG flag is set. A driver for this device, "pseries-wdt", will be introduced in a subsequent patch. Signed-off-by: Scott Cheloh

[PATCH v1 4/4] watchdog/pseries-wdt: initial support for PAPR H_WATCHDOG timers

2022-05-20 Thread Scott Cheloha
es_wdt_start(wd); + return 0; +} + +static const struct platform_device_id pseries_wdt_id[] = { + { .name = "pseries-wdt" }, + {} +}; +MODULE_DEVICE_TABLE(platform, pseries_wdt_id); + +static struct platform_driver pseries_wdt_driver = { + .driver = { + .name = DRV_NAME, + .owner = THIS_MODULE, + }, + .id_table = pseries_wdt_id, + .probe = pseries_wdt_probe, + .resume = pseries_wdt_resume, + .suspend = pseries_wdt_suspend, +}; +module_platform_driver(pseries_wdt_driver); + +MODULE_AUTHOR("Alexey Kardashevskiy "); +MODULE_AUTHOR("Scott Cheloha "); +MODULE_DESCRIPTION("POWER Architecture Platform Watchdog Driver"); +MODULE_LICENSE("GPL"); -- 2.27.0

[PATCH v1 0/4] pseries-wdt: initial support for PAPR virtual watchdog timers

2022-05-20 Thread Scott Cheloha
This series is preceded by two RFCs: RFC v1: https://lore.kernel.org/linux-watchdog/20220413165104.179144-1-chel...@linux.ibm.com/ RFC v2: https://lore.kernel.org/linux-watchdog/20220509174357.5448-1-chel...@linux.ibm.com/ Changes of note from RFC v2: - Separate platform device registration in

[PATCH v1 1/4] powerpc/pseries: hvcall.h: add H_WATCHDOG opcode, H_NOOP return code

2022-05-20 Thread Scott Cheloha
PAPR v2.12 defines a new hypercall, H_WATCHDOG. The hypercall permits guest control of one or more virtual watchdog timers. Add the opcode for the H_WATCHDOG hypercall to hvcall.h. While here, add a definition for H_NOOP, a possible return code for H_WATCHDOG. Signed-off-by: Scott Cheloha

[PATCH v1 2/4] powerpc/pseries: add FW_FEATURE_WATCHDOG flag

2022-05-20 Thread Scott Cheloha
ned-off-by: Scott Cheloha --- arch/powerpc/include/asm/firmware.h | 3 ++- arch/powerpc/platforms/pseries/firmware.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/firmware.h b/arch/powerpc/include/asm/firmware.h index 834b8ecf..398e0b5e4

[PATCH v1 3/4] powerpc/pseries: register pseries-wdt device with platform bus

2022-05-20 Thread Scott Cheloha
workaround we represent them as platform devices. This patch registers a single platform device, "pseries-wdt", with the platform bus if the FW_FEATURE_WATCHDOG flag is set. A driver for this device, "pseries-wdt", will be introduced in a subsequent patch. Signed-off-by: Scott Cheloh

[PATCH v1 4/4] watchdog/pseries-wdt: initial support for PAPR H_WATCHDOG timers

2022-05-20 Thread Scott Cheloha
es_wdt_start(wd); + return 0; +} + +static const struct platform_device_id pseries_wdt_id[] = { + { .name = "pseries-wdt" }, + {} +}; +MODULE_DEVICE_TABLE(platform, pseries_wdt_id); + +static struct platform_driver pseries_wdt_driver = { + .driver = { + .name = DRV_NAME, + .owner = THIS_MODULE, + }, + .id_table = pseries_wdt_id, + .probe = pseries_wdt_probe, + .resume = pseries_wdt_resume, + .suspend = pseries_wdt_suspend, +}; +module_platform_driver(pseries_wdt_driver); + +MODULE_AUTHOR("Alexey Kardashevskiy "); +MODULE_AUTHOR("Scott Cheloha "); +MODULE_DESCRIPTION("POWER Architecture Platform Watchdog Driver"); +MODULE_LICENSE("GPL"); -- 2.27.0

[PATCH v2 1/2] powerpc/perf: consolidate GPCI hcall structs into asm/hvcall.h

2020-07-27 Thread Scott Cheloha
The H_GetPerformanceCounterInfo (GPCI) hypercall input/output structs are useful to modules outside of perf/, so move them into asm/hvcall.h to live alongside the other powerpc hypercall structs. Leave the perf-specific GPCI stuff in perf/hv-gpci.h. Signed-off-by: Scott Cheloha --- arch

[PATCH v2 2/2] powerpc/pseries: new lparcfg key/value pair: partition_affinity_score

2020-07-27 Thread Scott Cheloha
A score of 0 indicates the worst possible affinity while a score of 100 indicates perfect affinity. The score can be used to reason about performance. This patch adds the score for the local LPAR to the lparcfg procfile under a new 'partition_affinity_score' key. Signed-off-by: Scot

[PATCH v2] pseries/drmem: don't cache node id in drmem_lmb struct

2020-07-28 Thread Scott Cheloha
we're no longer seeing the soft lockup. drmem_init() now completes in negligible time, even when the LMB count is large. Signed-off-by: Scott Cheloha --- arch/powerpc/include/asm/drmem.h | 21 --- arch/powerpc/mm/drmem.c | 6 +- .../plat

[PATCH v3] pseries/drmem: don't cache node id in drmem_lmb struct

2020-08-10 Thread Scott Cheloha
we're no longer seeing the soft lockup. drmem_init() now completes in negligible time, even when the LMB count is large. Signed-off-by: Scott Cheloha --- v1: - RFC v2: - Adjusted commit message. - Miscellaneous cleanup. v3: - Correct issue found by Laurent Dufour : - Add missing

[PATCH] powerpc/pseries: new lparcfg key/value pair: partition_affinity_score

2020-06-19 Thread Scott Cheloha
terInfo hypercall is already used elsewhere in the kernel, in powerpc/perf/hv-gpci.c. Refactoring that code and this code into a more general API might be worthwhile if additional modules require the hypercall in the future. Signed-off-by: Scott Cheloha --- arch/powerpc/platforms/ps

Re: [PATCH v1 4/4] watchdog/pseries-wdt: initial support for PAPR H_WATCHDOG timers

2022-06-01 Thread Scott Cheloha
On Wed, May 25, 2022 at 04:35:11PM +1000, Alexey Kardashevskiy wrote: > > On 5/21/22 04:35, Scott Cheloha wrote: > > PAPR v2.12 defines a new hypercall, H_WATCHDOG. The hypercall permits > > guest control of one or more virtual watchdog timers. The timers have > > milli

Re: [PATCH v1 4/4] watchdog/pseries-wdt: initial support for PAPR H_WATCHDOG timers

2022-06-01 Thread Scott Cheloha
On Wed, May 25, 2022 at 12:52:09AM -0700, Guenter Roeck wrote: > On 5/24/22 23:35, Alexey Kardashevskiy wrote: > > > > On 5/21/22 04:35, Scott Cheloha wrote: > > > PAPR v2.12 defines a new hypercall, H_WATCHDOG.  The hypercall permits > > > guest control of on

Re: [PATCH v1 4/4] watchdog/pseries-wdt: initial support for PAPR H_WATCHDOG timers

2022-06-01 Thread Scott Cheloha
On Wed, Jun 01, 2022 at 08:45:03AM -0700, Guenter Roeck wrote: > On 6/1/22 08:07, Scott Cheloha wrote: > [ ... ] > > > > > +static unsigned long action = PSERIES_WDTF_ACTION_HARD_RESTART; > > > > > + > > > > > +static int

[PATCH v2 0/4] pseries-wdt: initial support for H_WATCHDOG-based watchdog timers

2022-06-02 Thread Scott Cheloha
PAPR v2.12 defines a new hypercall, H_WATCHDOG. This patch series adds support for this hypercall to powerpc/pseries kernels and introduces a new watchdog driver, "pseries-wdt", for the virtual timers exposed by the hypercall. This series is preceded by the following: RFC v1: https://lore.kerne

[PATCH v2 1/4] powerpc/pseries: hvcall.h: add H_WATCHDOG opcode, H_NOOP return code

2022-06-02 Thread Scott Cheloha
PAPR v2.12 defines a new hypercall, H_WATCHDOG. The hypercall permits guest control of one or more virtual watchdog timers. Add the opcode for the H_WATCHDOG hypercall to hvcall.h. While here, add a definition for H_NOOP, a possible return code for H_WATCHDOG. Signed-off-by: Scott Cheloha

[PATCH v2 2/4] powerpc/pseries: add FW_FEATURE_WATCHDOG flag

2022-06-02 Thread Scott Cheloha
ned-off-by: Scott Cheloha --- arch/powerpc/include/asm/firmware.h | 3 ++- arch/powerpc/platforms/pseries/firmware.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/firmware.h b/arch/powerpc/include/asm/firmware.h index 834b8ecf..398e0b5e4

[PATCH v2 4/4] watchdog/pseries-wdt: initial support for H_WATCHDOG-based watchdog timers

2022-06-02 Thread Scott Cheloha
dt" }, + {} +}; +MODULE_DEVICE_TABLE(platform, pseries_wdt_id); + +static struct platform_driver pseries_wdt_driver = { + .driver = { + .name = DRV_NAME, + .owner = THIS_MODULE, + }, + .id_table = pseries_wdt_id, + .probe = pseries_wdt_probe, + .resume = pseries_wdt_resume, + .suspend = pseries_wdt_suspend, +}; +module_platform_driver(pseries_wdt_driver); + +MODULE_AUTHOR("Alexey Kardashevskiy "); +MODULE_AUTHOR("Scott Cheloha "); +MODULE_DESCRIPTION("POWER Architecture Platform Watchdog Driver"); +MODULE_LICENSE("GPL"); -- 2.27.0

[PATCH v2 3/4] powerpc/pseries: register pseries-wdt device with platform bus

2022-06-02 Thread Scott Cheloha
workaround we represent them as platform devices. This patch registers a single platform device, "pseries-wdt", with the platform bus if the FW_FEATURE_WATCHDOG flag is set. A driver for this device, "pseries-wdt", will be introduced in a subsequent patch. Signed-off-by: Scott Cheloh

Re: [PATCH v2 4/4] watchdog/pseries-wdt: initial support for H_WATCHDOG-based watchdog timers

2022-07-07 Thread Scott Cheloha
On Fri, Jun 24, 2022 at 11:51:01PM +1000, Michael Ellerman wrote: > Scott Cheloha writes: > ... > > + > > +static struct platform_driver pseries_wdt_driver = { > > + .driver = { > > + .name = DRV_NAME, > > + .owner = THIS_MODULE, >

Re: [PATCH v2 3/4] powerpc/pseries: register pseries-wdt device with platform bus

2022-07-07 Thread Scott Cheloha
On Fri, Jun 24, 2022 at 11:27:36PM +1000, Michael Ellerman wrote: > Nathan Lynch writes: > > Scott Cheloha writes: > >> PAPR v2.12 defines a new hypercall, H_WATCHDOG. The hypercall permits > >> guest control of one or more virtual watchdog timers. > ... &g

Re: [PATCH v2 4/4] watchdog/pseries-wdt: initial support for H_WATCHDOG-based watchdog timers

2022-07-07 Thread Scott Cheloha
On Fri, Jun 24, 2022 at 11:27:24PM +1000, Michael Ellerman wrote: > Hi Scott, > > A few comments below ... > > Scott Cheloha writes: > > > > [...] > > > > diff --git a/Documentation/watchdog/watchdog-parameters.rst > > b/Documentation/watchdog/w

[PATCH v3 0/4] pseries-wdt: initial support for H_WATCHDOG-based watchdog timers

2022-07-13 Thread Scott Cheloha
PAPR v2.12 defines a new hypercall, H_WATCHDOG. This patch series adds support for this hypercall to powerpc/pseries kernels and introduces a new watchdog driver, "pseries-wdt", for the virtual timers exposed by the hypercall. This series is preceded by the following: RFC v1: https://lore.kerne

[PATCH v3 1/4] powerpc/pseries: hvcall.h: add H_WATCHDOG opcode, H_NOOP return code

2022-07-13 Thread Scott Cheloha
PAPR v2.12 defines a new hypercall, H_WATCHDOG. The hypercall permits guest control of one or more virtual watchdog timers. Add the opcode for the H_WATCHDOG hypercall to hvcall.h. While here, add a definition for H_NOOP, a possible return code for H_WATCHDOG. Signed-off-by: Scott Cheloha

[PATCH v3 2/4] powerpc/pseries: add FW_FEATURE_WATCHDOG flag

2022-07-13 Thread Scott Cheloha
ned-off-by: Scott Cheloha --- arch/powerpc/include/asm/firmware.h | 3 ++- arch/powerpc/platforms/pseries/firmware.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/firmware.h b/arch/powerpc/include/asm/firmware.h index 834b8ecf..398e0b5e4

[PATCH v3 3/4] powerpc/pseries: register pseries-wdt device with platform bus

2022-07-13 Thread Scott Cheloha
workaround we represent them as platform devices. This patch registers a single platform device, "pseries-wdt", with the platform bus if the FW_FEATURE_WATCHDOG flag is set. A driver for this device, "pseries-wdt", will be introduced in a subsequent patch. Signed-off-by: Scott Cheloh

[PATCH v3 4/4] watchdog/pseries-wdt: initial support for H_WATCHDOG-based watchdog timers

2022-07-13 Thread Scott Cheloha
{} +}; +MODULE_DEVICE_TABLE(platform, pseries_wdt_id); + +static struct platform_driver pseries_wdt_driver = { + .driver = { + .name = DRV_NAME, + }, + .id_table = pseries_wdt_id, + .probe = pseries_wdt_probe, + .resume = pseries_wdt_resume, + .suspend = pseries_wdt_suspend, +}; +module_platform_driver(pseries_wdt_driver); + +MODULE_AUTHOR("Alexey Kardashevskiy"); +MODULE_AUTHOR("Scott Cheloha"); +MODULE_DESCRIPTION("POWER Architecture Platform Watchdog Driver"); +MODULE_LICENSE("GPL"); -- 2.27.0

Re: [PATCH v3 4/4] watchdog/pseries-wdt: initial support for H_WATCHDOG-based watchdog timers

2022-07-25 Thread Scott Cheloha
On Wed, Jul 13, 2022 at 01:50:14PM -0700, Guenter Roeck wrote: > On 7/13/22 13:23, Scott Cheloha wrote: > > PAPR v2.12 defines a new hypercall, H_WATCHDOG. The hypercall permits > > guest control of one or more virtual watchdog timers. The timers have > > millisecond granu