1 From afb5519fdb346201728040cab4e08ce53e7ff4fd Mon Sep 17 00:00:00 2001
2 From: John Allen <jallen@linux.vnet.ibm.com>
3 Date: Wed, 23 Aug 2017 12:18:43 -0500
4 Subject: powerpc/pseries: Don't attempt to acquire drc during memory hot add for assigned lmbs
6 From: John Allen <jallen@linux.vnet.ibm.com>
8 commit afb5519fdb346201728040cab4e08ce53e7ff4fd upstream.
10 Check if an LMB is assigned before attempting to call dlpar_acquire_drc
11 in order to avoid any unnecessary rtas calls. This substantially
12 reduces the running time of memory hot add on lpars with large amounts
15 [mpe: We need to explicitly set rc to 0 in the success case, otherwise
16 the compiler might think we use rc without initialising it.]
18 Fixes: c21f515c7436 ("powerpc/pseries: Make the acquire/release of the drc for memory a seperate step")
19 Signed-off-by: John Allen <jallen@linux.vnet.ibm.com>
20 Reviewed-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
21 Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
22 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25 arch/powerpc/platforms/pseries/hotplug-memory.c | 4 ++++
26 1 file changed, 4 insertions(+)
28 --- a/arch/powerpc/platforms/pseries/hotplug-memory.c
29 +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
30 @@ -817,6 +817,9 @@ static int dlpar_memory_add_by_count(u32
33 for (i = 0; i < num_lmbs && lmbs_to_add != lmbs_added; i++) {
34 + if (lmbs[i].flags & DRCONF_MEM_ASSIGNED)
37 rc = dlpar_acquire_drc(lmbs[i].drc_index);
40 @@ -859,6 +862,7 @@ static int dlpar_memory_add_by_count(u32
41 lmbs[i].base_addr, lmbs[i].drc_index);