On 09/17/2014 02:07 AM, Michael Ellerman wrote:
> 
> On Mon, 2014-09-15 at 15:32 -0500, Nathan Fontenot wrote:
>> This patch adds the ability to do memory hotplug adding in the kernel.
>>
>> Currently the hotplug add/remove of memory is handled by the drmgr
>> command. The drmgr command performs the add/remove by performing
>> some work in user-space and making requests to the kernel to handle 
>> other pieces. By moving all of the work to the kernel we can do the
>> add and remove faster, and provide a common place to do memory hotplug
>> for both the PowerVM and PowerKVM environments.
>>
>> Signed-off-by: Nathan Fontenot <nf...@linux.vnet.ibm.com>
>> ---

>> +    for (i = 0; i < entries; i++, lmb++) {
>> +            u32 drc_index = be32_to_cpu(lmb->drc_index);
>> +
>> +            if (lmbs_to_add == lmbs_added)
>> +                    break;
>> +
>> +            if (be32_to_cpu(lmb->flags) & DRCONF_MEM_ASSIGNED)
>> +                    continue;
>> +
>> +            if (hp_elog->id_type == PSERIES_HP_ELOG_ID_DRC_INDEX
>> +                && lmb->drc_index != hp_elog->_drc_u.drc_index)
>> +                    continue;
>> +
>> +            rc = dlpar_acquire_drc(drc_index);
>> +            if (rc)
>> +                    continue;
>> +
>> +            rc = dlpar_add_one_lmb(lmb);
>> +            if (rc) {
>> +                    dlpar_release_drc(drc_index);
>> +                    continue;
>> +            }
> 
> In both the above error cases you just move along. That means we potentially
> hotplugged some memory but not everything that we were asked to. That seems
> like a bad idea, we should either do everything or nothing.
> 

Michael, how set are you on the all or nothing approach?

Note that I think the all or nothing approach is best but I think it will
present some problems. We do memory add (and remove) on a LMB basis, so it
is possible to hit a scenario in which we cannot revert back to the original
state. For example, a request to add 5 LMBs only succeeds in adding 4 LMBs.
There is no guarantee that we then remove the 4 MLBs that were added. That
memory could be in use somewhere that it cannot be moved.

I would suggest we continue with the current approach in that we try to
satisfy the request but not try to roll-back the changes if the entire
request cannot be satisfied.

-Nathan   

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to