Skip to contentSkip to conversation

ppc/spapr: Add hotplugged flag on DIMM LMBs on drmem_v2

RFC PATCH Superseded Leonardo Bras 3 participants 4 messages Mar 6, 2020 – Apr 2, 2020

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 ppc/spapr: Add hotplugged flag on DIMM LMBs on drmem_v2

On reboot, all memory that was previously added using object_add and device_add is placed in this DIMM area.

The new SPAPR_LMB_FLAGS_HOTPLUGGED flag helps Linux to put this memory in the correct memory zone, so no unmovable allocations are made there, allowing the object to be easily hot-removed by device_del and object_del.

---
The new flag was already proposed on Power Architecture documentation, and it's waiting for approval.

I would like to get your comments on this change, but it's still not ready for being merged.

Matching Linux change is here:
http://patchwork.ozlabs.org/patch/1249917/

---
 hw/ppc/spapr.c         | 3 ++-
 include/hw/ppc/spapr.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +2 -1
index cc10798be4..01611b7953 100644
@@ -699,7 +699,8 @@ static int spapr_populate_drmem_v2(SpaprMachineState *spapr, void *fdt,
         g_assert(drc);
         elem = spapr_get_drconf_cell(size / lmb_size, addr,
                                      spapr_drc_index(drc), node,
-                                     SPAPR_LMB_FLAGS_ASSIGNED);
+                                     (SPAPR_LMB_FLAGS_ASSIGNED |
+                                      SPAPR_LMB_FLAGS_HOTPLUGGED);
         QSIMPLEQ_INSERT_TAIL(&drconf_queue, elem, entry);
         nr_entries++;
         cur_addr = addr + size;
include/hw/ppc/spapr.h +1 -0
index 09110961a5..64a138d4d4 100644
@@ -870,6 +870,7 @@ int spapr_rtc_import_offset(SpaprRtcState *rtc, int64_t legacy_offset);
 #define SPAPR_LMB_FLAGS_ASSIGNED 0x00000008
 #define SPAPR_LMB_FLAGS_DRC_INVALID 0x00000020
 #define SPAPR_LMB_FLAGS_RESERVED 0x00000080
+#define SPAPR_LMB_FLAGS_HOTPLUGGED 0x00000100
 
 void spapr_do_system_reset_on_cpu(CPUState *cs, run_on_cpu_data arg);
 
Signature · 1 line
2.24.1
#1 lore raw
Quoted 8 lines · Leonardo Bras

On reboot, all memory that was previously added using object_add and device_add is placed in this DIMM area.

The new SPAPR_LMB_FLAGS_HOTPLUGGED flag helps Linux to put this memory in the correct memory zone, so no unmovable allocations are made there, allowing the object to be easily hot-removed by device_del and object_del.

Quoted 8 lines

---
The new flag was already proposed on Power Architecture documentation, and it's waiting for approval.

I would like to get your comments on this change, but it's still not ready for being merged.

This looks reasonable to me - at the very least it doesn't look like it could do much harm.

Quoted 34 lines

Matching Linux change is here:
http://patchwork.ozlabs.org/patch/1249917/

---
 hw/ppc/spapr.c         | 3 ++-
 include/hw/ppc/spapr.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +2 -1
index cc10798be4..01611b7953 100644
@@ -699,7 +699,8 @@ static int spapr_populate_drmem_v2(SpaprMachineState *spapr, void *fdt,
         g_assert(drc);
         elem = spapr_get_drconf_cell(size / lmb_size, addr,
                                      spapr_drc_index(drc), node,
-                                     SPAPR_LMB_FLAGS_ASSIGNED);
+                                     (SPAPR_LMB_FLAGS_ASSIGNED |
+                                      SPAPR_LMB_FLAGS_HOTPLUGGED);
         QSIMPLEQ_INSERT_TAIL(&drconf_queue, elem, entry);
         nr_entries++;
         cur_addr = addr + size;
include/hw/ppc/spapr.h +1 -0
index 09110961a5..64a138d4d4 100644
@@ -870,6 +870,7 @@ int spapr_rtc_import_offset(SpaprRtcState *rtc, int64_t legacy_offset);
 #define SPAPR_LMB_FLAGS_ASSIGNED 0x00000008
 #define SPAPR_LMB_FLAGS_DRC_INVALID 0x00000020
 #define SPAPR_LMB_FLAGS_RESERVED 0x00000080
+#define SPAPR_LMB_FLAGS_HOTPLUGGED 0x00000100
 
 void spapr_do_system_reset_on_cpu(CPUState *cs, run_on_cpu_data arg);
 
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
Reviewed-by
#2 lore raw
Quoted 16 lines · David Gibson
Quoted 14 lines · Leonardo Bras

On reboot, all memory that was previously added using object_add and device_add is placed in this DIMM area.

The new SPAPR_LMB_FLAGS_HOTPLUGGED flag helps Linux to put this memory in the correct memory zone, so no unmovable allocations are made there, allowing the object to be easily hot-removed by device_del and object_del.

---
The new flag was already proposed on Power Architecture documentation, and it's waiting for approval.

Quoted 5 lines
Quoted 2 lines

I would like to get your comments on this change, but it's still not ready for being merged.

This looks reasonable to me - at the very least it doesn't look like it could do much harm.

Looks good to me, also tested with PowerKVM guests.

Regards,
Bharata.

Signature · 1 line
http://raobharata.wordpress.com/
#3 lore raw

Hello Bharata, thank you for reviewing and testing!

During review of this new flag, it was suggested to change it's name to a better one (on platform's viewpoint).

So I will have to change the flag name from SPAPR_LMB_FLAGS_HOTPLUGGED to SPAPR_LMB_FLAGS_HOTREMOVABLE.

Everything should work the same as today.

Best regards,
Leonardo

Quoted 29 lines · Bharata B Rao
Quoted 15 lines · David Gibson
Quoted 14 lines · Leonardo Bras

On reboot, all memory that was previously added using object_add and device_add is placed in this DIMM area.

The new SPAPR_LMB_FLAGS_HOTPLUGGED flag helps Linux to put this memory in the correct memory zone, so no unmovable allocations are made there, allowing the object to be easily hot-removed by device_del and object_del.

---
The new flag was already proposed on Power Architecture documentation, and it's waiting for approval.

Quoted 5 lines
Quoted 2 lines

I would like to get your comments on this change, but it's still not ready for being merged.

This looks reasonable to me - at the very least it doesn't look like it could do much harm.

Looks good to me, also tested with PowerKVM guests.

Regards,
Bharata.