On Mon, Jun 06, 2016 at 09:14:48AM -0500, Nathan Fontenot wrote: > On 06/06/2016 06:37 AM, Bharata B Rao wrote: > > Memory hotplug can fail for some combinations of RAM and maxmem when > > DDW is enabled in the presence of devices like nec-usb-xhci. DDW depends > > on maximum addressable memory returned by guest and this value is currently > > being calculated wrongly by the guest kernel routine memory_hotplug_max(). > > While there is an attempt to fix the guest kernel, this patch works > > around the problem within QEMU itself. > > > > memory_hotplug_max() routine in the guest kernel arrives at max > > addressable memory by multiplying lmb-size with the lmb-count obtained > > from ibm,dynamic-memory property. There are two assumptions here: > > > > - All LMBs are part of ibm,dynamic memory: This is not true for PowerKVM > > where only hot-pluggable LMBs are present in this property. > > - The memory area comprising of RAM and hotplug region is contiguous: This > > needn't be true always for PowerKVM as there can be gap between > > boot time RAM and hotplug region. > > > > To work around this guest kernel bug, ensure that ibm,dynamic-memory > > has information about all the LMBs (RMA, boot-time LMBs, future > > hotpluggable LMBs, and dummy LMBs to cover the gap between RAM and > > hotpluggable region). > > > > RMA is represented separately by memory@0 node. Hence mark RMA LMBs > > and also the LMBs for the gap b/n RAM and hotpluggable region as > > reserved so that these LMBs are not recounted/counted by guest. > > What does qemu do if a guest tries to add or remove a reserved LMB?
Currently in this approach, LMBs belonging two regions are marked as reserved: - RMA region - Gap b/n end of RAM and beginning of hotplug region Any hotplug attempts to above regions will be refused by QEMU as they don't fall under the hotplug memory region. > > Asking because the current guest code (drmgr and kernel) does not > take the reserved flag into consideration when searching for lmbs to > add/remove. This seems like something I should be fixed on the guest > side. Oh ok, but as I said earlier QEMU won't send hotplug request for such LMBs. However, I am seeing that when I mark RMA LMBs as reserved in ibm,dynamic-memory and create separate memory@0 to represent RMA, guest is just ignoring those LMBs and not doing double detection of RMA memory. Same is true for the reserved LMBs that I put in ibm,dyanamic-memory to cover the gap b/n RAM and hotplug region. Guest isn't not considering this. Do you still see any problems ? Regards, Bharata.