Message ID | 1597049570-19536-1-git-send-email-kernelfans@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [PATCHv5,1/2] powerpc/pseries: group lmb operation and memblock's | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch powerpc/merge (1f788123eabf933e828eab9cf8f018ae18faa38f) |
snowpatch_ozlabs/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 65 lines checked |
snowpatch_ozlabs/needsstable | success | Patch has no Fixes tags |
Le 10/08/2020 à 10:52, Pingfan Liu a écrit : > This patch prepares for the incoming patch which swaps the order of > KOBJ_ADD/REMOVE uevent and dt's updating. > > The dt updating should come after lmb operations, and before > __remove_memory()/__add_memory(). Accordingly, grouping all lmb operations > before the memblock's. I can't find the link between this commit description and the code's changes below. > > Signed-off-by: Pingfan Liu <kernelfans@gmail.com> > Cc: Michael Ellerman <mpe@ellerman.id.au> > Cc: Hari Bathini <hbathini@linux.ibm.com> > Cc: Nathan Lynch <nathanl@linux.ibm.com> > Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com> > Cc: Laurent Dufour <ldufour@linux.ibm.com> > To: linuxppc-dev@lists.ozlabs.org > Cc: kexec@lists.infradead.org > --- > v4 -> v5: fix the miss of clearing DRCONF_MEM_ASSIGNED in a failure path > arch/powerpc/platforms/pseries/hotplug-memory.c | 28 +++++++++++++++++-------- > 1 file changed, 19 insertions(+), 9 deletions(-) > > diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c > index 5d545b7..46cbcd1 100644 > --- a/arch/powerpc/platforms/pseries/hotplug-memory.c > +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c > @@ -355,7 +355,8 @@ static int dlpar_add_lmb(struct drmem_lmb *); > static int dlpar_remove_lmb(struct drmem_lmb *lmb) > { > unsigned long block_sz; > - int rc; > + phys_addr_t base_addr; > + int rc, nid; > > if (!lmb_is_removable(lmb)) > return -EINVAL; > @@ -364,17 +365,19 @@ static int dlpar_remove_lmb(struct drmem_lmb *lmb) > if (rc) > return rc; > > + base_addr = lmb->base_addr; > + nid = lmb->nid; > block_sz = pseries_memory_block_size(); > > - __remove_memory(lmb->nid, lmb->base_addr, block_sz); > - > - /* Update memory regions for memory remove */ > - memblock_remove(lmb->base_addr, block_sz); > - > invalidate_lmb_associativity_index(lmb); > lmb_clear_nid(lmb); > lmb->flags &= ~DRCONF_MEM_ASSIGNED; > > + __remove_memory(nid, base_addr, block_sz); > + > + /* Update memory regions for memory remove */ > + memblock_remove(base_addr, block_sz); > + > return 0; > } > > @@ -603,22 +606,29 @@ static int dlpar_add_lmb(struct drmem_lmb *lmb) > } > > lmb_set_nid(lmb); > + lmb->flags |= DRCONF_MEM_ASSIGNED; > + > block_sz = memory_block_size_bytes(); > > /* Add the memory */ > rc = __add_memory(lmb->nid, lmb->base_addr, block_sz); > if (rc) { > invalidate_lmb_associativity_index(lmb); > + lmb_clear_nid(lmb); > + lmb->flags &= ~DRCONF_MEM_ASSIGNED; > return rc; > } > > rc = dlpar_online_lmb(lmb); > if (rc) { > - __remove_memory(lmb->nid, lmb->base_addr, block_sz); > + int nid = lmb->nid; > + phys_addr_t base_addr = lmb->base_addr; > + > invalidate_lmb_associativity_index(lmb); > lmb_clear_nid(lmb); > - } else { > - lmb->flags |= DRCONF_MEM_ASSIGNED; > + lmb->flags &= ~DRCONF_MEM_ASSIGNED; > + > + __remove_memory(nid, base_addr, block_sz); > } > > return rc; >
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c index 5d545b7..46cbcd1 100644 --- a/arch/powerpc/platforms/pseries/hotplug-memory.c +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c @@ -355,7 +355,8 @@ static int dlpar_add_lmb(struct drmem_lmb *); static int dlpar_remove_lmb(struct drmem_lmb *lmb) { unsigned long block_sz; - int rc; + phys_addr_t base_addr; + int rc, nid; if (!lmb_is_removable(lmb)) return -EINVAL; @@ -364,17 +365,19 @@ static int dlpar_remove_lmb(struct drmem_lmb *lmb) if (rc) return rc; + base_addr = lmb->base_addr; + nid = lmb->nid; block_sz = pseries_memory_block_size(); - __remove_memory(lmb->nid, lmb->base_addr, block_sz); - - /* Update memory regions for memory remove */ - memblock_remove(lmb->base_addr, block_sz); - invalidate_lmb_associativity_index(lmb); lmb_clear_nid(lmb); lmb->flags &= ~DRCONF_MEM_ASSIGNED; + __remove_memory(nid, base_addr, block_sz); + + /* Update memory regions for memory remove */ + memblock_remove(base_addr, block_sz); + return 0; } @@ -603,22 +606,29 @@ static int dlpar_add_lmb(struct drmem_lmb *lmb) } lmb_set_nid(lmb); + lmb->flags |= DRCONF_MEM_ASSIGNED; + block_sz = memory_block_size_bytes(); /* Add the memory */ rc = __add_memory(lmb->nid, lmb->base_addr, block_sz); if (rc) { invalidate_lmb_associativity_index(lmb); + lmb_clear_nid(lmb); + lmb->flags &= ~DRCONF_MEM_ASSIGNED; return rc; } rc = dlpar_online_lmb(lmb); if (rc) { - __remove_memory(lmb->nid, lmb->base_addr, block_sz); + int nid = lmb->nid; + phys_addr_t base_addr = lmb->base_addr; + invalidate_lmb_associativity_index(lmb); lmb_clear_nid(lmb); - } else { - lmb->flags |= DRCONF_MEM_ASSIGNED; + lmb->flags &= ~DRCONF_MEM_ASSIGNED; + + __remove_memory(nid, base_addr, block_sz); } return rc;
This patch prepares for the incoming patch which swaps the order of KOBJ_ADD/REMOVE uevent and dt's updating. The dt updating should come after lmb operations, and before __remove_memory()/__add_memory(). Accordingly, grouping all lmb operations before the memblock's. Signed-off-by: Pingfan Liu <kernelfans@gmail.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Hari Bathini <hbathini@linux.ibm.com> Cc: Nathan Lynch <nathanl@linux.ibm.com> Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com> Cc: Laurent Dufour <ldufour@linux.ibm.com> To: linuxppc-dev@lists.ozlabs.org Cc: kexec@lists.infradead.org --- v4 -> v5: fix the miss of clearing DRCONF_MEM_ASSIGNED in a failure path arch/powerpc/platforms/pseries/hotplug-memory.c | 28 +++++++++++++++++-------- 1 file changed, 19 insertions(+), 9 deletions(-)