[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <04d5169f-3289-4aac-abca-90b20ad4e9c9@redhat.com>
Date: Thu, 17 Oct 2024 10:19:36 +0200
From: David Hildenbrand <david@...hat.com>
To: Alexander Gordeev <agordeev@...ux.ibm.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-s390@...r.kernel.org, virtualization@...ts.linux.dev,
linux-doc@...r.kernel.org, kvm@...r.kernel.org,
Heiko Carstens <hca@...ux.ibm.com>, Vasily Gorbik <gor@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Sven Schnelle <svens@...ux.ibm.com>, Thomas Huth <thuth@...hat.com>,
Cornelia Huck <cohuck@...hat.com>, Janosch Frank <frankja@...ux.ibm.com>,
Claudio Imbrenda <imbrenda@...ux.ibm.com>,
"Michael S. Tsirkin" <mst@...hat.com>, Jason Wang <jasowang@...hat.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>, Eugenio PĂ©rez
<eperezma@...hat.com>, Andrew Morton <akpm@...ux-foundation.org>,
Jonathan Corbet <corbet@....net>, Mario Casquero <mcasquer@...hat.com>
Subject: Re: [PATCH v2 4/7] s390/physmem_info: query diag500(STORAGE LIMIT) to
support QEMU/KVM memory devices
On 17.10.24 09:36, Alexander Gordeev wrote:
> On Mon, Oct 14, 2024 at 04:46:16PM +0200, David Hildenbrand wrote:
>
> Hi David!
Hi Alexander!
>
>> @@ -157,7 +189,9 @@ unsigned long detect_max_physmem_end(void)
>> {
>> unsigned long max_physmem_end = 0;
>>
>> - if (!sclp_early_get_memsize(&max_physmem_end)) {
>> + if (!diag500_storage_limit(&max_physmem_end)) {
>> + physmem_info.info_source = MEM_DETECT_DIAG500_STOR_LIMIT;
>> + } else if (!sclp_early_get_memsize(&max_physmem_end)) {
>> physmem_info.info_source = MEM_DETECT_SCLP_READ_INFO;
>> } else {
>> max_physmem_end = search_mem_end();
>> @@ -170,11 +204,17 @@ void detect_physmem_online_ranges(unsigned long max_physmem_end)
>> {
>> if (!sclp_early_read_storage_info()) {
>> physmem_info.info_source = MEM_DETECT_SCLP_STOR_INFO;
>> + return;
>> } else if (!diag260()) {
>> physmem_info.info_source = MEM_DETECT_DIAG260;
>> - } else if (max_physmem_end) {
>> - add_physmem_online_range(0, max_physmem_end);
>> + return;
>> + } else if (physmem_info.info_source == MEM_DETECT_DIAG500_STOR_LIMIT) {
>> + max_physmem_end = 0;
>> + if (!sclp_early_get_memsize(&max_physmem_end))
>> + physmem_info.info_source = MEM_DETECT_SCLP_READ_INFO;
>
> Why search_mem_end() is not tried in case sclp_early_get_memsize() failed?
Patch #3 documents that:
+ The storage limit does not indicate currently usable storage, it may
+ include holes, standby storage and areas reserved for other means, such
+ as memory hotplug or virtio-mem devices. Other interfaces for detecting
+ actually usable storage, such as SCLP, must be used in conjunction with
+ this subfunction.
If SCLP would fail, something would be seriously wrong and we should just crash
instead of trying to fallback to the legacy way of scanning.
>
>> }
>> + if (max_physmem_end)
>> + add_physmem_online_range(0, max_physmem_end);
>> }
>>
>> void physmem_set_usable_limit(unsigned long limit)
>> diff --git a/arch/s390/include/asm/physmem_info.h b/arch/s390/include/asm/physmem_info.h
>> index f45cfc8bc233..51b68a43e195 100644
>> --- a/arch/s390/include/asm/physmem_info.h
>> +++ b/arch/s390/include/asm/physmem_info.h
>> @@ -9,6 +9,7 @@ enum physmem_info_source {
>> MEM_DETECT_NONE = 0,
>> MEM_DETECT_SCLP_STOR_INFO,
>> MEM_DETECT_DIAG260,
>> + MEM_DETECT_DIAG500_STOR_LIMIT,
>> MEM_DETECT_SCLP_READ_INFO,
>> MEM_DETECT_BIN_SEARCH
>> };
>> @@ -107,6 +108,8 @@ static inline const char *get_physmem_info_source(void)
>> return "sclp storage info";
>> case MEM_DETECT_DIAG260:
>> return "diag260";
>> + case MEM_DETECT_DIAG500_STOR_LIMIT:
>> + return "diag500 storage limit";
>
> AFAIU you want to always override MEM_DETECT_DIAG500_STOR_LIMIT method
> with an online memory detection method. In that case this code is dead.
Not in the above case, pathological case above where something went wrong
during sclp_early_get_memsize(). In that scenario, die_oom() would indicate
that there are no memory ranges but that "diag500 storage limit" worked.
Does that make sense?
Thanks for the review!
--
Cheers,
David / dhildenb
Powered by blists - more mailing lists