From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36310) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9wz0-0007TH-CB for qemu-devel@nongnu.org; Mon, 06 Jun 2016 12:02:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9wyq-0003Cd-Ax for qemu-devel@nongnu.org; Mon, 06 Jun 2016 12:02:29 -0400 Received: from e37.co.us.ibm.com ([32.97.110.158]:49266) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9wyq-0003CE-1w for qemu-devel@nongnu.org; Mon, 06 Jun 2016 12:02:20 -0400 Received: from localhost by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 6 Jun 2016 10:02:17 -0600 References: <1465213069-16578-1-git-send-email-bharata@linux.vnet.ibm.com> <57558558.8090401@linux.vnet.ibm.com> <20160606144729.GC5343@in.ibm.com> From: Nathan Fontenot Message-ID: <57559E7C.20707@linux.vnet.ibm.com> Date: Mon, 6 Jun 2016 11:02:04 -0500 MIME-Version: 1.0 In-Reply-To: <20160606144729.GC5343@in.ibm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH v2] spapr: Ensure all LMBs are represented in ibm, dynamic-memory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: bharata@linux.vnet.ibm.com Cc: qemu-devel@nongnu.org, david@gibson.dropbear.id.au, mdroth@linux.vnet.ibm.com, aik@au1.ibm.com, qemu-ppc@nongnu.org On 06/06/2016 09:47 AM, Bharata B Rao wrote: > 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. That's good. I wanted to make sure that this wouldn't break anything with the current memory hotplug code paths. > >> >> 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. Yes, but that doesn't stop a user from running the drmgr command and making a request. > > 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 ? This should be fine. The boot-up code ignores any LMB that has the 'reserved' flag set. -Nathan > > Regards, > Bharata. >