All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Lynch <nathanl@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: tyreld@linux.ibm.com, srikar@linux.vnet.ibm.com,
	ego@linux.vnet.ibm.com, npiggin@gmail.com,
	svaidy@linux.vnet.ibm.com
Subject: [PATCH 18/18] powerpc/pseries: remove obsolete memory hotplug DT notifier code
Date: Fri, 12 Jun 2020 00:12:38 -0500	[thread overview]
Message-ID: <20200612051238.1007764-19-nathanl@linux.ibm.com> (raw)
In-Reply-To: <20200612051238.1007764-1-nathanl@linux.ibm.com>

pseries_update_drconf_memory() runs from a DT notifier in response to
an update to the ibm,dynamic-memory property of the
/ibm,dynamic-reconfiguration-memory node. This property is an older
less compact format than the ibm,dynamic-memory-v2 property used in
most currently supported firmwares. There has never been an equivalent
function for the v2 property.

pseries_update_drconf_memory() compares the 'assigned' flag for each
LMB in the old vs new properties and adds or removes the block
accordingly. However it appears to be of no actual utility:

* Partition suspension and PRRNs are specified only to change LMBs'
  NUMA affinity information. This notifier should be a no-op for those
  scenarios since the assigned flags should not change.

* The memory hotplug/DLPAR path has a hack which short-circuits
  execution of the notifier:
     dlpar_memory()
        ...
        rtas_hp_event = true;
        drmem_update_dt()
           of_update_property()
              pseries_memory_notifier()
                 pseries_update_drconf_memory()
                    if (rtas_hp_event) return;

So this code only makes sense as a relic of the time when more of the
DLPAR workflow took place in user space. I don't see a purpose for it
now.

Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
---
 .../platforms/pseries/hotplug-memory.c        | 65 +------------------
 1 file changed, 1 insertion(+), 64 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 67ece3ac9ac2..73a5dcd977e1 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -22,8 +22,6 @@
 #include <asm/drmem.h>
 #include "pseries.h"
 
-static bool rtas_hp_event;
-
 unsigned long pseries_memory_block_size(void)
 {
 	struct device_node *np;
@@ -871,11 +869,8 @@ int dlpar_memory(struct pseries_hp_errorlog *hp_elog)
 		break;
 	}
 
-	if (!rc) {
-		rtas_hp_event = true;
+	if (!rc)
 		rc = drmem_update_dt();
-		rtas_hp_event = false;
-	}
 
 	unlock_device_hotplug();
 	return rc;
@@ -911,60 +906,6 @@ static int pseries_add_mem_node(struct device_node *np)
 	return (ret < 0) ? -EINVAL : 0;
 }
 
-static int pseries_update_drconf_memory(struct of_reconfig_data *pr)
-{
-	struct of_drconf_cell_v1 *new_drmem, *old_drmem;
-	unsigned long memblock_size;
-	u32 entries;
-	__be32 *p;
-	int i, rc = -EINVAL;
-
-	if (rtas_hp_event)
-		return 0;
-
-	memblock_size = pseries_memory_block_size();
-	if (!memblock_size)
-		return -EINVAL;
-
-	if (!pr->old_prop)
-		return 0;
-
-	p = (__be32 *) pr->old_prop->value;
-	if (!p)
-		return -EINVAL;
-
-	/* The first int of the property is the number of lmb's described
-	 * by the property. This is followed by an array of of_drconf_cell
-	 * entries. Get the number of entries and skip to the array of
-	 * of_drconf_cell's.
-	 */
-	entries = be32_to_cpu(*p++);
-	old_drmem = (struct of_drconf_cell_v1 *)p;
-
-	p = (__be32 *)pr->prop->value;
-	p++;
-	new_drmem = (struct of_drconf_cell_v1 *)p;
-
-	for (i = 0; i < entries; i++) {
-		if ((be32_to_cpu(old_drmem[i].flags) & DRCONF_MEM_ASSIGNED) &&
-		    (!(be32_to_cpu(new_drmem[i].flags) & DRCONF_MEM_ASSIGNED))) {
-			rc = pseries_remove_memblock(
-				be64_to_cpu(old_drmem[i].base_addr),
-						     memblock_size);
-			break;
-		} else if ((!(be32_to_cpu(old_drmem[i].flags) &
-			    DRCONF_MEM_ASSIGNED)) &&
-			    (be32_to_cpu(new_drmem[i].flags) &
-			    DRCONF_MEM_ASSIGNED)) {
-			rc = memblock_add(be64_to_cpu(old_drmem[i].base_addr),
-					  memblock_size);
-			rc = (rc < 0) ? -EINVAL : 0;
-			break;
-		}
-	}
-	return rc;
-}
-
 static int pseries_memory_notifier(struct notifier_block *nb,
 				   unsigned long action, void *data)
 {
@@ -978,10 +919,6 @@ static int pseries_memory_notifier(struct notifier_block *nb,
 	case OF_RECONFIG_DETACH_NODE:
 		err = pseries_remove_mem_node(rd->dn);
 		break;
-	case OF_RECONFIG_UPDATE_PROPERTY:
-		if (!strcmp(rd->prop->name, "ibm,dynamic-memory"))
-			err = pseries_update_drconf_memory(rd);
-		break;
 	}
 	return notifier_from_errno(err);
 }
-- 
2.25.4


  parent reply	other threads:[~2020-06-12  5:44 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-12  5:12 [PATCH 00/18] remove extended cede offline mode and bogus topology update code Nathan Lynch
2020-06-12  5:12 ` [PATCH 01/18] powerpc/pseries: remove cede offline state for CPUs Nathan Lynch
2020-06-12  5:12 ` [PATCH 02/18] powerpc/rtas: don't online CPUs for partition suspend Nathan Lynch
2020-06-12  5:12 ` [PATCH 03/18] powerpc/numa: remove ability to enable topology updates Nathan Lynch
2020-06-23 16:23   ` Srikar Dronamraju
2020-06-12  5:12 ` [PATCH 04/18] powerpc/numa: remove unreachable topology update code Nathan Lynch
2020-06-23 16:24   ` Srikar Dronamraju
2020-06-12  5:12 ` [PATCH 05/18] powerpc/numa: make vphn_enabled, prrn_enabled flags const Nathan Lynch
2020-06-23 16:24   ` Srikar Dronamraju
2020-06-12  5:12 ` [PATCH 06/18] powerpc/numa: remove unreachable topology timer code Nathan Lynch
2020-06-23 16:25   ` Srikar Dronamraju
2020-06-12  5:12 ` [PATCH 07/18] powerpc/numa: remove unreachable topology workqueue code Nathan Lynch
2020-06-23 16:26   ` Srikar Dronamraju
2020-06-12  5:12 ` [PATCH 08/18] powerpc/numa: remove vphn_enabled and prrn_enabled internal flags Nathan Lynch
2020-06-23 16:27   ` Srikar Dronamraju
2020-06-12  5:12 ` [PATCH 09/18] powerpc/numa: stub out numa_update_cpu_topology() Nathan Lynch
2020-06-23 16:27   ` Srikar Dronamraju
2020-06-12  5:12 ` [PATCH 10/18] powerpc/numa: remove timed_topology_update() Nathan Lynch
2020-06-23 16:28   ` Srikar Dronamraju
2020-06-12  5:12 ` [PATCH 11/18] powerpc/numa: remove start/stop_topology_update() Nathan Lynch
2020-06-23 16:28   ` Srikar Dronamraju
2020-06-12  5:12 ` [PATCH 12/18] powerpc/rtasd: simplify handle_rtas_event(), emit message on events Nathan Lynch
2020-06-23 16:30   ` Srikar Dronamraju
2020-06-12  5:12 ` [PATCH 13/18] powerpc/numa: remove prrn_is_enabled() Nathan Lynch
2020-06-23 16:31   ` Srikar Dronamraju
2020-06-12  5:12 ` [PATCH 14/18] powerpc/numa: remove arch_update_cpu_topology Nathan Lynch
2020-06-23 16:32   ` Srikar Dronamraju
2020-06-12  5:12 ` [PATCH 15/18] powerpc/pseries: remove prrn special case from DT update path Nathan Lynch
2020-06-12  5:12 ` [PATCH 16/18] powerpc/pseries: remove memory "re-add" implementation Nathan Lynch
2020-06-12  5:12 ` [PATCH 17/18] powerpc/pseries: remove dlpar_cpu_readd() Nathan Lynch
2020-06-12  5:12 ` Nathan Lynch [this message]
2020-07-16 12:56 ` [PATCH 00/18] remove extended cede offline mode and bogus topology update code Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200612051238.1007764-19-nathanl@linux.ibm.com \
    --to=nathanl@linux.ibm.com \
    --cc=ego@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=npiggin@gmail.com \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=svaidy@linux.vnet.ibm.com \
    --cc=tyreld@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.