From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:47349) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBz5R-0005Y5-Il for qemu-devel@nongnu.org; Thu, 04 Apr 2019 05:55:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBz5Q-0007BD-3j for qemu-devel@nongnu.org; Thu, 04 Apr 2019 05:55:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51110) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hBz5P-0007AR-QS for qemu-devel@nongnu.org; Thu, 04 Apr 2019 05:55:08 -0400 Date: Thu, 4 Apr 2019 17:45:50 +0800 From: Peter Xu Message-ID: <20190404094550.GD23212@xz-x1> References: <1553010562-13561-1-git-send-email-catherine.hecx@gmail.com> <1554219001-18301-1-git-send-email-catherine.hecx@gmail.com> <20190403022532.GJ11008@xz-x1> <20190404042503.GA23212@xz-x1> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2] migration: avoid filling ignore-shared ramblock when in incoming migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Catherine Ho Cc: Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , Markus Armbruster , Juan Quintela , QEMU Developers On Thu, Apr 04, 2019 at 03:33:20PM +0800, Catherine Ho wrote: > Hi Peter Xu >=20 > On Thu, 4 Apr 2019 at 12:25, Peter Xu wrote: >=20 > > On Wed, Apr 03, 2019 at 11:21:47PM +0800, Catherine Ho wrote: > > > Hi Peter Xu > > > > > > On Wed, 3 Apr 2019 at 10:25, Peter Xu wrote: > > > > > > > On Tue, Apr 02, 2019 at 11:30:01AM -0400, Catherine Ho wrote: > > > > > Commit 18269069c310 ("migration: Introduce ignore-shared capabi= lity") > > > > > addes ignore-shared capability to bypass the shared ramblock (e= ,g, > > > > > membackend + numa node). It does good to live migration. > > > > > > > > > > This commit expectes that QEMU doesn't write to guest RAM until > > > > > VM starts, but it does on aarch64 qemu: > > > > > Backtrace: > > > > > 1 0x000055f4a296dd84 in address_space_write_rom_internal () at > > > > exec.c:3458 > > > > > 2 0x000055f4a296de3a in address_space_write_rom () at exec.c:3= 479 > > > > > 3 0x000055f4a2d519ff in rom_reset () at hw/core/loader.c:1101 > > > > > 4 0x000055f4a2d475ec in qemu_devices_reset () at hw/core/reset= .c:69 > > > > > 5 0x000055f4a2c90a28 in qemu_system_reset () at vl.c:1675 > > > > > 6 0x000055f4a2c9851d in main () at vl.c:4552 > > > > > > > > > > Actually, on arm64 virt marchine, ramblock "dtb" will be filled= into > > ram > > > > > during rom_reset. In ignore-shared incoming case, this rom fill= ing > > > > > is not required since all the data has been stored in memory ba= ckend > > > > file. > > > > > > > > > > Fixes: commit 18269069c310 ("migration: Introduce ignore-shared > > > > capability") > > > > > Signed-off-by: Catherine Ho > > > > > Suggested-by: Yury Kotov > > > > > > > > (note: IIUC normally you should have your signed-off to be the la= st > > > > line before the suggested-by :) > > > > > > > > About the patch content, I have had a question on whether we shou= ld > > > > need to check ignore-shared at all... That question lies in: > > > > > > > > https://patchwork.kernel.org/patch/10859889/#22546487 > > > > > > > > And if my understanding was correct above, IMHO the patch could b= e as > > > > simply be as "if (runstate_check(RUN_STATE_INMIGRATE)) return;" a= t [1] > > > > below. > > > > > > > > > > > Thanks=EF=BC=8C but I thought this method would break the x86 rom_r= eset logic > > during > > > RUN_STATE_INMIGRATE. > > > Please see the debugging patch and log lines below: > > > diff --git a/hw/core/loader.c b/hw/core/loader.c > > > index fe5cb24122..b0c871af26 100644 > > > --- a/hw/core/loader.c > > > +++ b/hw/core/loader.c > > > @@ -1086,8 +1086,9 @@ int rom_add_option(const char *file, int32_t > > > bootindex) > > > static void rom_reset(void *unused) > > > { > > > Rom *rom; > > > - > > > QTAILQ_FOREACH(rom, &roms, next) { > > > + if (runstate_check(RUN_STATE_INMIGRATE)) > > > + printf("rom name=3D%s\n",rom->name); > > > if (rom->fw_file) { > > > continue; > > > } > > > > > > rom name=3Dkvmvapic.bin > > > rom name=3Dlinuxboot_dma.bin > > > rom name=3Dbios-256k.bin > > > rom name=3Detc/acpi/tables > > > rom name=3Detc/table-loader > > > rom name=3Detc/acpi/rsdp > > > > Hi, Catherine, > > > > I only see that rom names were dumped. Could you help explain what i= s > > broken? Thanks, > > > > Sorry, I have another concern here. What if there is no memory_backen= d > file? > If there is no memory backend file (i.e. without -object > memory-backend-file,id=3Ddimm1,size=3D512M,mem-path=3D/path/memory) >=20 > Should the rom blobs still be written into ram in such case? Please see my previous reply - I think it shouldn't be needed because we should migrate very soon after this point for those RAM. In other words, IIUC even if we do rom_reset() now with these ROMs then the RAM data should be re-filled again too with the migration stream coming in. Regards, --=20 Peter Xu