linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: teawater <teawaterz@linux.alibaba.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux MM <linux-mm@kvack.org>,
	virtio-dev@lists.oasis-open.org,
	Linux Virtualization <virtualization@lists.linux-foundation.org>,
	kvm@vger.kernel.org, Michal Hocko <mhocko@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Sebastien Boeuf <sebastien.boeuf@intel.com>,
	Samuel Ortiz <samuel.ortiz@intel.com>,
	Robert Bradford <robert.bradford@intel.com>,
	Luiz Capitulino <lcapitulino@redhat.com>,
	Pankaj Gupta <pankaj.gupta.linux@gmail.com>,
	Igor Mammedov <imammedo@redhat.com>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	Alexander Duyck <alexander.h.duyck@linux.intel.com>,
	Alexander Potapenko <glider@google.com>,
	Anshuman Khandual <anshuman.khandual@arm.com>,
	Anthony Yznaga <anthony.yznaga@oracle.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Dave Young <dyoung@redhat.com>, Jason Wang <jasowang@redhat.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Juergen Gross <jgross@suse.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Len Brown <lenb@kernel.org>,
	Mel Gorman <mgorman@techsingularity.net>,
	Michal Hocko <mhocko@suse.com>,
	Mike Rapoport <rppt@linux.ibm.com>,
	Oscar Salvador <osalvador@suse.com>,
	Oscar Salvador <osalvador@suse.de>,
	Pavel Tatashin <pasha.tatashin@soleen.com>,
	Pavel Tatashin <pavel.tatashin@microsoft.com>,
	Pingfan Liu <kernelfans@gmail.com>, Qian Cai <cai@lca.pw>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	Wei Yang <richard.weiyang@gmail.com>
Subject: Re: [virtio-dev] [PATCH v3 00/15] virtio-mem: paravirtualized memory
Date: Thu, 14 May 2020 14:19:51 +0200	[thread overview]
Message-ID: <cda84c4d-0f4c-1dd8-44f6-68f211e5de6d@redhat.com> (raw)
In-Reply-To: <e48ded49-9b92-7025-a06f-49b24f1c53a6@redhat.com>

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 <david@redhat.com> 写道:
>>>>>
>>>>> 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.

-- 
Thanks,

David / dhildenb


  reply	other threads:[~2020-05-14 12:20 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-07 10:31 [PATCH v3 00/15] virtio-mem: paravirtualized memory David Hildenbrand
2020-05-07 10:31 ` [PATCH v3 01/15] virtio-mem: Paravirtualized memory hotplug David Hildenbrand
2020-05-07 10:31 ` [PATCH v3 02/15] virtio-mem: Allow to specify an ACPI PXM as nid David Hildenbrand
2020-05-07 10:31 ` [PATCH v3 03/15] virtio-mem: Paravirtualized memory hotunplug part 1 David Hildenbrand
2020-05-07 10:31 ` [PATCH v3 04/15] virtio-mem: Paravirtualized memory hotunplug part 2 David Hildenbrand
2020-05-07 10:31 ` [PATCH v3 05/15] mm: Allow to offline unmovable PageOffline() pages via MEM_GOING_OFFLINE David Hildenbrand
2020-05-07 10:48   ` Michael S. Tsirkin
2020-05-07 10:31 ` [PATCH v3 06/15] virtio-mem: Allow to offline partially unplugged memory blocks David Hildenbrand
2020-05-07 10:31 ` [PATCH v3 07/15] mm/memory_hotplug: Introduce offline_and_remove_memory() David Hildenbrand
2020-05-07 10:46   ` Michael S. Tsirkin
2020-05-07 11:24     ` David Hildenbrand
2020-05-07 11:33       ` David Hildenbrand
2020-05-07 11:34         ` Michael S. Tsirkin
2020-05-07 11:37           ` David Hildenbrand
2020-05-07 12:11             ` Michael S. Tsirkin
2020-05-07 12:24               ` David Hildenbrand
2020-05-07 11:33       ` Michael S. Tsirkin
2020-05-07 10:31 ` [PATCH v3 08/15] virtio-mem: Offline and remove completely unplugged memory blocks David Hildenbrand
2020-05-07 10:31 ` [PATCH v3 09/15] virtio-mem: Better retry handling David Hildenbrand
2020-05-07 10:31 ` [PATCH v3 10/15] MAINTAINERS: Add myself as virtio-mem maintainer David Hildenbrand
2020-05-07 10:47   ` Michael S. Tsirkin
2020-05-07 11:25     ` David Hildenbrand
2020-05-07 10:31 ` [PATCH v3 11/15] virtio-mem: Add parent resource for all added "System RAM" David Hildenbrand
2020-05-07 10:31 ` [PATCH v3 12/15] virtio-mem: Drop manual check for already present memory David Hildenbrand
2020-05-07 10:31 ` [PATCH v3 13/15] virtio-mem: Unplug subblocks right-to-left David Hildenbrand
2020-05-07 10:31 ` [PATCH v3 14/15] virtio-mem: Use -ETXTBSY as error code if the device is busy David Hildenbrand
2020-05-07 10:31 ` [PATCH v3 15/15] virtio-mem: Try to unplug the complete online memory block first David Hildenbrand
2020-05-07 10:48 ` [PATCH v3 00/15] virtio-mem: paravirtualized memory Michael S. Tsirkin
2020-05-07 11:23   ` David Hildenbrand
2020-05-14  6:44 ` [virtio-dev] " teawater
2020-05-14  8:48   ` David Hildenbrand
2020-05-14 10:02     ` teawater
2020-05-14 10:12       ` David Hildenbrand
2020-05-14 11:10         ` David Hildenbrand
2020-05-14 11:47           ` David Hildenbrand
2020-05-14 12:19             ` David Hildenbrand [this message]
2020-05-15  2:58               ` teawater

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cda84c4d-0f4c-1dd8-44f6-68f211e5de6d@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.h.duyck@linux.intel.com \
    --cc=anshuman.khandual@arm.com \
    --cc=anthony.yznaga@oracle.com \
    --cc=cai@lca.pw \
    --cc=dan.j.williams@intel.com \
    --cc=dgilbert@redhat.com \
    --cc=dyoung@redhat.com \
    --cc=glider@google.com \
    --cc=hannes@cmpxchg.org \
    --cc=imammedo@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=jgross@suse.com \
    --cc=kernelfans@gmail.com \
    --cc=konrad.wilk@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=lcapitulino@redhat.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@kernel.org \
    --cc=mhocko@suse.com \
    --cc=mst@redhat.com \
    --cc=osalvador@suse.com \
    --cc=osalvador@suse.de \
    --cc=pankaj.gupta.linux@gmail.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=pavel.tatashin@microsoft.com \
    --cc=rafael@kernel.org \
    --cc=richard.weiyang@gmail.com \
    --cc=rjw@rjwysocki.net \
    --cc=robert.bradford@intel.com \
    --cc=rppt@linux.ibm.com \
    --cc=samuel.ortiz@intel.com \
    --cc=sebastien.boeuf@intel.com \
    --cc=stefanha@redhat.com \
    --cc=teawaterz@linux.alibaba.com \
    --cc=vbabka@suse.cz \
    --cc=virtio-dev@lists.oasis-open.org \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).