All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>, qemu-devel@nongnu.org
Cc: Thomas Huth <thuth@redhat.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	Cornelia Huck <cohuck@redhat.com>,
	Halil Pasic <pasic@linux.ibm.com>,
	qemu-s390x@nongnu.org, Claudio Imbrenda <imbrenda@linux.ibm.com>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH RFC 2/5] s390x: implement diag260
Date: Thu, 9 Jul 2020 20:15:49 +0200	[thread overview]
Message-ID: <c86e5b12-883a-8522-a15c-9af3804e003c@redhat.com> (raw)
In-Reply-To: <efe7e845-2e0f-96ba-7e29-c6ac74db9e2f@de.ibm.com>

On 09.07.20 12:52, Christian Borntraeger wrote:
> 
> On 08.07.20 20:51, David Hildenbrand wrote:
>> Let's implement the "storage configuration" part of diag260. This diag
>> is found under z/VM, to indicate usable chunks of memory tot he guest OS.
>> As I don't have access to documentation, I have no clue what the actual
>> error cases are, and which other stuff we could eventually query using this
>> interface. Somebody with access to documentation should fix this. This
>> implementation seems to work with Linux guests just fine.
>>
>> The Linux kernel supports diag260 to query the available memory since
>> v4.20. Older kernels / kvm-unit-tests will later fail to run in such a VM
>> (with maxmem being defined and bigger than the memory size, e.g., "-m
>>  2G,maxmem=4G"), just as if support for SCLP storage information is not
>> implemented. They will fail to detect the actual initial memory size.
>>
>> This interface allows us to expose the maximum ramsize via sclp
>> and the initial ramsize via diag260 - without having to mess with the
>> memory increment size and having to align the initial memory size to it.
>>
>> This is a preparation for memory device support. We'll unlock the
>> implementation with a new QEMU machine that supports memory devices.
>>
>> Signed-off-by: David Hildenbrand <david@redhat.com>
> 
> I have not looked into this, so this is purely a question. 
> 
> Is there a way to hotplug virtio-mem memory beyond the initial size of 
> the memory as specified by the  initial sclp)? then we could avoid doing
> this platform specfic diag260?

We need a way to tell the guest about the maximum possible PFN, so it
can prepare for that. E.g. on x86-64 this is usually done via ACPI SRAT
tables. On s390x, the only way I see is using a combination of diag260,
without introducing any other new mechanisms.

Currently Linux selects 3. vs 4 level page tables based on that size (I
think that's what you were referring to with the 4TB limit). I can see
that kasan also does some magic based on the value ("populate kasan
shadow for untracked memory"), but did not look into the details. I
*think* kasan will never be able to track that memory, but am not
completely sure.

I'd like to avoid something as you propose (that's why I searched and
discovered diag260 after all :) ), especially to not silently break in
the future, when other assumptions based on that value are introduced.

E.g., on my z/VM LinuxOne Community Cloud machine, diag260 gets used as
default, so it does not seem to be a corner case mechanism nowadays.

> the only issue I see is when we need to go beyond 4TB due to the page table
> upgrade in the kernel. 
> 
> FWIW diag 260 is publicly documented. 

Yeah, Conny pointed me at the doc - makes things easier :)


-- 
Thanks,

David / dhildenb



  reply	other threads:[~2020-07-09 18:17 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-08 18:51 [PATCH RFC 0/5] s390x: initial support for virtio-mem David Hildenbrand
2020-07-08 18:51 ` [PATCH RFC 1/5] s390x: move setting of maximum ram size to machine init David Hildenbrand
2020-07-08 18:51 ` [PATCH RFC 2/5] s390x: implement diag260 David Hildenbrand
2020-07-09 10:37   ` Cornelia Huck
2020-07-09 17:54     ` David Hildenbrand
2020-07-10  8:32     ` David Hildenbrand
2020-07-10  8:41       ` David Hildenbrand
2020-07-10  9:19         ` Cornelia Huck
2020-07-13 11:54       ` Christian Borntraeger
2020-07-13 12:11         ` Cornelia Huck
2020-07-13 12:13           ` Christian Borntraeger
2020-07-09 10:52   ` Christian Borntraeger
2020-07-09 18:15     ` David Hildenbrand [this message]
2020-07-10  9:17       ` David Hildenbrand
2020-07-10 12:12         ` David Hildenbrand
2020-07-10 15:18           ` Heiko Carstens
2020-07-10 15:24             ` David Hildenbrand
2020-07-10 15:43               ` Heiko Carstens
2020-07-10 15:45                 ` David Hildenbrand
2020-07-13  9:12               ` Heiko Carstens
2020-07-13 10:27                 ` David Hildenbrand
2020-07-13 11:08                   ` Christian Borntraeger
2020-07-15  9:42                     ` David Hildenbrand
2020-07-15 10:43                       ` Heiko Carstens
2020-07-15 11:21                         ` David Hildenbrand
2020-07-15 11:34                           ` Heiko Carstens
2020-07-15 11:42                             ` David Hildenbrand
2020-07-15 16:14                               ` Heiko Carstens
2020-07-15 17:38                                 ` David Hildenbrand
2020-07-15 17:51                                   ` David Hildenbrand
2020-07-20 14:43                                     ` Heiko Carstens
2020-07-20 15:43                                       ` David Hildenbrand
2020-07-08 18:51 ` [PATCH RFC 3/5] s390x: prepare device memory address space David Hildenbrand
2020-07-09 10:59   ` Cornelia Huck
2020-07-10  7:46     ` David Hildenbrand
2020-07-08 18:51 ` [PATCH RFC 4/5] s390x: implement virtio-mem-ccw David Hildenbrand
2020-07-09  9:24   ` Cornelia Huck
2020-07-09  9:26     ` David Hildenbrand
2020-07-08 18:51 ` [PATCH RFC 5/5] s390x: initial support for virtio-mem David Hildenbrand

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=c86e5b12-883a-8522-a15c-9af3804e003c@redhat.com \
    --to=david@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=mst@redhat.com \
    --cc=pasic@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=thuth@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.