Currently, memory must be hot removed and subsequently re-added in order
to dynamically update the affinity of LMBs specified by a PRRN event.
Earlier implementations of the PRRN event handler ran into issues in which
the hot remove would occur successfully, but a hotplug event would be
initiated from another source and grab the hotplug lock preventing the hot
add from occurring. To prevent this situation, this patch introduces the
notion of a hot "readd" action for memory which atomizes a hot remove and
a hot add into a single, serialized operation on the hotplug queue.

Signed-off-by: John Allen <jal...@linux.vnet.ibm.com>
---
diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h
index 9c23baa..076b892 100644
--- a/arch/powerpc/include/asm/rtas.h
+++ b/arch/powerpc/include/asm/rtas.h
@@ -318,6 +318,7 @@ struct pseries_hp_errorlog {

 #define PSERIES_HP_ELOG_ACTION_ADD     1
 #define PSERIES_HP_ELOG_ACTION_REMOVE  2
+#define PSERIES_HP_ELOG_ACTION_READD   3

 #define PSERIES_HP_ELOG_ID_DRC_NAME    1
 #define PSERIES_HP_ELOG_ID_DRC_INDEX   2
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c 
b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 76ec104..291d49b 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -766,6 +766,11 @@ int dlpar_memory(struct pseries_hp_errorlog *hp_elog)
                else
                        rc = -EINVAL;
                break;
+       case PSERIES_HP_ELOG_ACTION_READD:
+               rc = dlpar_memory_remove_by_index(drc_index, prop);
+               if (!rc)
+                       dlpar_memory_add_by_index(drc_index, prop);
+               break;
        default:
                pr_err("Invalid action (%d) specified\n", hp_elog->action);
                rc = -EINVAL;

Reply via email to