Message ID | 20210622133923.295373-2-danielhb413@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | powerpc/pseries: cleanups for dlpar_memory_add* functions | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch powerpc/merge (7f030e9d57b8ff6025bde4162f42378e6081126a) |
snowpatch_ozlabs/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 9 lines checked |
snowpatch_ozlabs/needsstable | success | Patch has no Fixes tags |
Le 22/06/2021 à 15:39, Daniel Henrique Barboza a écrit : > The function is counting reserved LMBs as available to be added, but > they aren't. This will cause the function to miscalculate the available > LMBs and can trigger errors later on when executing dlpar_add_lmb(). Indeed I'm wondering if dlpar_add_lmb() would fail in that case, so that's even better to check for that flag earlier. Reviewed-by: Laurent Dufour <ldufour@linux.ibm.com> > Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> > --- > arch/powerpc/platforms/pseries/hotplug-memory.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c > index 36f66556a7c6..28a7fd90232f 100644 > --- a/arch/powerpc/platforms/pseries/hotplug-memory.c > +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c > @@ -683,6 +683,9 @@ static int dlpar_memory_add_by_count(u32 lmbs_to_add) > > /* Validate that there are enough LMBs to satisfy the request */ > for_each_drmem_lmb(lmb) { > + if (lmb->flags & DRCONF_MEM_RESERVED) > + continue; > + > if (!(lmb->flags & DRCONF_MEM_ASSIGNED)) > lmbs_available++; > >
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c index 36f66556a7c6..28a7fd90232f 100644 --- a/arch/powerpc/platforms/pseries/hotplug-memory.c +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c @@ -683,6 +683,9 @@ static int dlpar_memory_add_by_count(u32 lmbs_to_add) /* Validate that there are enough LMBs to satisfy the request */ for_each_drmem_lmb(lmb) { + if (lmb->flags & DRCONF_MEM_RESERVED) + continue; + if (!(lmb->flags & DRCONF_MEM_ASSIGNED)) lmbs_available++;
The function is counting reserved LMBs as available to be added, but they aren't. This will cause the function to miscalculate the available LMBs and can trigger errors later on when executing dlpar_add_lmb(). Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> --- arch/powerpc/platforms/pseries/hotplug-memory.c | 3 +++ 1 file changed, 3 insertions(+)