From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34282) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y3kM5-0004Iw-Jk for qemu-devel@nongnu.org; Wed, 24 Dec 2014 06:43:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y3kM2-0007NS-D2 for qemu-devel@nongnu.org; Wed, 24 Dec 2014 06:43:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40044) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y3kM2-0007NM-5j for qemu-devel@nongnu.org; Wed, 24 Dec 2014 06:43:50 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sBOBhmwZ009240 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 24 Dec 2014 06:43:48 -0500 Date: Wed, 24 Dec 2014 13:43:45 +0200 From: "Michael S. Tsirkin" Message-ID: <1419421370-27227-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] qemu_ram_resize: document assumptions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , dgilbert@redhat.com Document that when using qemu_ram_resize for anything mapped into guest address space, it's the job of the resize function to update guest visible state. Signed-off-by: Michael S. Tsirkin --- Adding a comment at dgilbert's request. This is a separate patch to avoid deferring merging the code itself. exec.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/exec.c b/exec.c index 2427319..9b7e515 100644 --- a/exec.c +++ b/exec.c @@ -1301,6 +1301,13 @@ static int memory_try_enable_merging(void *addr, size_t len) return qemu_madvise(addr, len, QEMU_MADV_MERGEABLE); } +/* Only legal before guest might have detected the memory size: e.g. on + * incoming migration, or right after reset. + * + * As memory core doesn't know how is memory accessed, it is up to + * resize callback to update device state and/or add assertions to detect + * misuse, if necessary. + */ int qemu_ram_resize(ram_addr_t base, ram_addr_t newsize, Error **errp) { RAMBlock *block = find_ram_block(base); -- MST