linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Ways to deprecate /sys/devices/system/memory/memoryX/phys_device ?
@ 2020-09-10 10:20 David Hildenbrand
  2020-09-10 20:00 ` Dave Hansen
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: David Hildenbrand @ 2020-09-10 10:20 UTC (permalink / raw)
  To: Gerald Schaefer, Michal Hocko, akpm, Greg KH, Jan Höppner,
	Heiko Carstens, linux-mm, linux-api, Dave Hansen, linux-kernel

Hi everybody,

I was just exploring how /sys/devices/system/memory/memoryX/phys_device
is/was used. It's one of these interfaces that most probably never
should have been added but now we are stuck with it.

"phys_device" was used on s390x in older versions of lsmem[2]/chmem[3],
back when they were still part of s390x-tools. They were later replaced
[5] by the variants in linux-utils. For example, RHEL6 and RHEL7 contain
lsmem/chmem from s390-utils. RHEL8 switched to versions from util-linux
on s390x [4].

"phys_device" was added with sysfs support for memory hotplug in commit
3947be1969a9 ("[PATCH] memory hotplug: sysfs and add/remove functions")
in 2005. It always returned 0.

s390x started returning something != 0 on some setups (if sclp.rzm is
set by HW) in 2010 via commit 57b552ba0b2f("memory hotplug/s390: set
phys_device").

For s390x, it allowed for identifying which memory block devices belong
to the same memory increment (RZM). Only if all memory block devices
comprising a single memory increment were offline, the memory could
actually be removed in the hypervisor.

Since commit e5d709bb5fb7 ("s390/memory hotplug: provide
memory_block_size_bytes() function") in 2013 a memory block devices
spans at least one memory increment - which is why the interface isn't
really helpful/used anymore (except by old lsmem/chmem tools).

There were once RFC patches to make use of it in ACPI, but it could be
solved using different interfaces [1].


While I'd love to rip it out completely, I think it would break old
lsmem/chmem completely - and I assume that's not acceptable. I was
wondering what would be considered safe to do now/in the future:

1. Make it always return 0 (just as if "sclp.rzm" would be set to 0 on
s390x). This will make old lsmem/chmem behave differently after
switching to a new kernel, like if sclp.rzm would not be set by HW -
AFAIU, it will assume all memory is in a single memory increment. Do we
care?
2. Restrict it to s390x only. It always returned 0 on other
architectures, I was not able to find any user.

I think 2 should be safe to do (never used on other archs). I do wonder
what the feelings are about 1.

Thoughts?


[1] https://patchwork.kernel.org/patch/2163871/
[2] https://github.com/ibm-s390-tools/s390-tools/blob/v2.1.0/zconf/lsmem
[3] https://github.com/ibm-s390-tools/s390-tools/blob/v2.1.0/zconf/chmem
[4] https://bugzilla.redhat.com/show_bug.cgi?id=1504134
[5]
https://github.com/ibm-s390-tools/s390-tools/commit/778292e771fb00cfcbd7ff6535ee3d9fde612dc5#diff-82c32a7f4c597c50db90157ed0c581b3

-- 
Thanks,

David / dhildenb


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2020-09-25 15:47 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-10 10:20 Ways to deprecate /sys/devices/system/memory/memoryX/phys_device ? David Hildenbrand
2020-09-10 20:00 ` Dave Hansen
2020-09-10 20:31   ` David Hildenbrand
2020-09-11  7:20     ` Michal Hocko
2020-09-11  8:09       ` David Hildenbrand
2020-09-11  9:12         ` Michal Hocko
2020-09-11 10:09           ` David Hildenbrand
2020-09-11 19:24             ` Dave Hansen
2020-09-11 19:35               ` Luck, Tony
2020-09-11 19:56                 ` David Hildenbrand
2020-09-11 20:09                   ` Luck, Tony
2020-09-11 20:49                     ` David Hildenbrand
2020-09-14 11:24             ` Michal Hocko
2020-09-14 12:14               ` David Hildenbrand
2020-09-10 20:57 ` Dave Hansen
2020-09-22 13:56 ` Gerald Schaefer
2020-09-25 14:49   ` David Hildenbrand
2020-09-25 15:00     ` Greg KH
2020-09-25 15:05       ` David Hildenbrand
2020-09-25 15:39     ` Michal Hocko
2020-09-25 15:47       ` David Hildenbrand

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).