Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp172403ybk; Thu, 14 May 2020 20:07:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6O6ejei3lvB20w2yx3H3pv+fIPuTzmnXm/47DtGbKp7GPRoiDVAm3njcppQANIKMjKsXU X-Received: by 2002:a17:906:1d13:: with SMTP id n19mr861236ejh.287.1589512058188; Thu, 14 May 2020 20:07:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589512058; cv=none; d=google.com; s=arc-20160816; b=EwG/2shhsvjUUyv23kYaVMwZATg+eG3peBzvyo/6Zk5UPJoN2kRyPgV9sAbvpqWL43 TzdylGanQZE/1Wzz+yH+052kCTVyV/O6ITbDuAMg/T49t6TGLeZwBp7w1UYC42MJozP6 Pcy7AX9FWJjrD+hAtA1CZeJkY6z8HgXmkHWljllQPTefq9IcVmbEflGi29Jn6phTEsLc GYj+Vzupc+0uaMlXkgchsRrRZqtxuky2POVBH6oYOxERnv6Ke3wM0YbWPtx23Nq8zFK3 USM1V3bNds0/CDdgy9WDJS0huXv/NpPTJhvItR6PCKSAxD7CnqjpHA1dqeb3C1+IZPb0 6ltg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=XuR07JrWraweUnO3lWbKx4W5HyI7q5XZ+6rKtiq2EGY=; b=CDoEPu0ySRk0GCvXVgz0i8sS3RWxfYbHI3eLdLoVPH6NwWUbxr9I7fGblMDuLzXzCk //Wz20dvgrmv3isG837IPQuJmuM4MuHu886DjeQu1D2+AoyCh5tdE+y3I7+EQUkPuK+O U0mt212u8jwmTP9jA6fD2CffRC70TfoCUTfWh46IM9yyIB8mNADxv2XBlDkHhbBjR4bJ sxdXkoXzv/8L4OYNKH+LUCabiQ+GqILeJu8olz2B2lmrcgVTL4zuWPEOOqgrcv/6ToVu AX/3a9lxJYFOhNL/GyIiL0zXtFK6Zb0827Ri04090J/JagOVV6mRo+5KUQm9yLmeO+dF DP8g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s19si467498ejz.320.2020.05.14.20.07.15; Thu, 14 May 2020 20:07:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728209AbgEOC6X convert rfc822-to-8bit (ORCPT + 99 others); Thu, 14 May 2020 22:58:23 -0400 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:43156 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727029AbgEOC6X (ORCPT ); Thu, 14 May 2020 22:58:23 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R641e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07484;MF=teawaterz@linux.alibaba.com;NM=1;PH=DS;RN=41;SR=0;TI=SMTPD_---0TyZxr82_1589511481; Received: from 127.0.0.1(mailfrom:teawaterz@linux.alibaba.com fp:SMTPD_---0TyZxr82_1589511481) by smtp.aliyun-inc.com(127.0.0.1); Fri, 15 May 2020 10:58:15 +0800 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: [virtio-dev] [PATCH v3 00/15] virtio-mem: paravirtualized memory From: teawater In-Reply-To: Date: Fri, 15 May 2020 10:58:00 +0800 Cc: LKML , Linux MM , virtio-dev@lists.oasis-open.org, Linux Virtualization , kvm@vger.kernel.org, Michal Hocko , Andrew Morton , "Michael S . Tsirkin" , Sebastien Boeuf , Samuel Ortiz , Robert Bradford , Luiz Capitulino , Pankaj Gupta , Igor Mammedov , "Dr . David Alan Gilbert" , Alexander Duyck , Alexander Potapenko , Anshuman Khandual , Anthony Yznaga , Dan Williams , Dave Young , Jason Wang , Johannes Weiner , Juergen Gross , Konrad Rzeszutek Wilk , Len Brown , Mel Gorman , Michal Hocko , Mike Rapoport , Oscar Salvador , Oscar Salvador , Pavel Tatashin , Pavel Tatashin , Pingfan Liu , Qian Cai , "Rafael J. Wysocki" , "Rafael J. Wysocki" , Stefan Hajnoczi , Vlastimil Babka , Wei Yang Content-Transfer-Encoding: 8BIT Message-Id: <9708F43A-9BD2-4377-8EE8-7FB1D95C6F69@linux.alibaba.com> References: <20200507103119.11219-1-david@redhat.com> <7848642F-6AA7-4B5E-AE0E-DB0857C94A93@linux.alibaba.com> <31c5d2f9-c104-53e8-d9c8-cb45f7507c85@redhat.com> <389b6bdc-b196-e4b9-b6be-dcac57524fdf@redhat.com> <3c82e149-6c42-690e-9d58-bb8e69870fe0@redhat.com> To: David Hildenbrand X-Mailer: Apple Mail (2.3608.80.23.2.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 2020年5月14日 20:19,David Hildenbrand 写道: > > On 14.05.20 13:47, David Hildenbrand wrote: >> On 14.05.20 13:10, David Hildenbrand wrote: >>> On 14.05.20 12:12, David Hildenbrand wrote: >>>> On 14.05.20 12:02, teawater wrote: >>>>> >>>>> >>>>>> 2020年5月14日 16:48,David Hildenbrand 写道: >>>>>> >>>>>> On 14.05.20 08:44, teawater wrote: >>>>>>> Hi David, >>>>>>> >>>>>>> I got a kernel warning with v2 and v3. >>>>>> >>>>>> Hi Hui, >>>>>> >>>>>> thanks for playing with the latest versions. Surprisingly, I can >>>>>> reproduce even by hotplugging a DIMM instead as well - that's good, so >>>>>> it's not related to virtio-mem, lol. Seems to be some QEMU setup issue >>>>>> with older machine types. >>>>>> >>>>>> Can you switch to a newer qemu machine version, especially >>>>>> pc-i440fx-5.0? Both, hotplugging DIMMs and virtio-mem works for me with >>>>>> that QEMU machine just fine. >>>>> >>>>> I still could reproduce this issue with pc-i440fx-5.0 or pc. Did I miss anything? >>>>> >>>> >>>> Below I don't even see virtio_mem. I had to repair the image (filesystem >>>> fsck) because it was broken, can you try that as well? >>>> >>>> Also, it would be great if you could test with v4. >>>> >>> >>> Correction, something seems to be broken either in QEMU or the kernel. Once I >>> define a DIMM so it's added and online during boot, I get these issues: >>> >>> (I have virtio-mem v4 installed in the guest) >>> >>> #! /bin/bash >>> sudo x86_64-softmmu/qemu-system-x86_64 \ >>> -machine pc-i440fx-5.0,accel=kvm,usb=off \ >>> -cpu host \ >>> -no-reboot \ >>> -nographic \ >>> -device ide-hd,drive=hd \ >>> -drive if=none,id=hd,file=/home/dhildenb/git/Fedora-Cloud-Base-31-1.9.x86_64.qcow2,format=qcow2 \ >>> -m 1g,slots=10,maxmem=2G \ >>> -smp 1 \ >>> -object memory-backend-ram,id=mem0,size=256m \ >>> -device pc-dimm,id=dimm0,memdev=mem0 \ >>> -s \ >>> -monitor unix:/var/tmp/monitor,server,nowait >>> >>> >>> Without the DIMM it seems to work just fine. >>> >> >> And another correction. >> >> Using QEMU v5.0.0, Linux 5.7-rc5, untouched >> Fedora-Cloud-Base-32-1.6.x86_64.qcow2, I get even without any memory hotplug: >> >> #! /bin/bash >> sudo x86_64-softmmu/qemu-system-x86_64 \ >> -machine pc-i440fx-5.0,accel=kvm,usb=off \ >> -cpu host \ >> -no-reboot \ >> -nographic \ >> -device ide-hd,drive=hd \ >> -drive if=none,id=hd,file=/home/dhildenb/git/Fedora-Cloud-Base-32-1.6.x86_64.qcow2,format=qcow2 \ >> -m 5g,slots=10,maxmem=6G \ >> -smp 1 \ >> -s \ >> -kernel /home/dhildenb/git/linux/arch/x86/boot/bzImage \ >> -append "console=ttyS0 rd.shell nokaslr swiotlb=noforce" \ >> -monitor unix:/var/tmp/monitor,server,nowait >> >> >> Observe how big the initial RAM even is! >> >> >> So this is no DIMM/hotplug/virtio_mem issue. With memory hotplug, it seems to get >> more likely to trigger if "swiotlb=noforce" is not specified. >> >> "swiotlb=noforce" seems to trigger some pre-existing issue here. Without >> "swiotlb=noforce", I was only able to observe this via pc-i440fx-2.1, >> > > (talking to myself :) ) > > I think I finally understood why using "swiotlb=noforce" with hotplugged > memory is wrong - or with memory > 3GB. Via "swiotlb=noforce" you tell > the system to "Never use bounce buffers (for debugging)". This works as > long as all memory is DMA memory (e.g., < 3GB) AFAIK. > > "If specified, trying to map memory that cannot be used with DMA will > fail, and a rate-limited warning will be printed." > > Hotplugged memory (under QEMU) is never added below 4GB, because of the > PCI hole. So both, memory from DIMMs and from virtio-mem will end up at > or above 4GB. To make a device use that memory, you need bounce buffers. > > Hotplugged memory is never DMA memory. > Hi David, It is fixed when I remove "swiotlb=noforce”. Thanks for your help. Best, Hui > -- > Thanks, > > David / dhildenb