<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/s390/boot, branch linux-6.4.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.4.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.4.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2023-04-13T15:36:28Z</updated>
<entry>
<title>s390/mm: fix direct map accounting</title>
<updated>2023-04-13T15:36:28Z</updated>
<author>
<name>Heiko Carstens</name>
</author>
<published>2023-04-06T11:31:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=81e8479649853ffafc714aca4a9c0262efd3160a'/>
<id>urn:sha1:81e8479649853ffafc714aca4a9c0262efd3160a</id>
<content type='text'>
Commit bb1520d581a3 ("s390/mm: start kernel with DAT enabled") did not
implement direct map accounting in the early page table setup code. In
result the reported values are bogus now:

$cat /proc/meminfo
...
DirectMap4k:        5120 kB
DirectMap1M:    18446744073709546496 kB
DirectMap2G:           0 kB

Fix this by adding the missing accounting. The result looks sane again:

$cat /proc/meminfo
...
DirectMap4k:        6156 kB
DirectMap1M:     2091008 kB
DirectMap2G:     6291456 kB

Fixes: bb1520d581a3 ("s390/mm: start kernel with DAT enabled")
Reviewed-by: Alexander Gordeev &lt;agordeev@linux.ibm.com&gt;
Signed-off-by: Heiko Carstens &lt;hca@linux.ibm.com&gt;
Signed-off-by: Vasily Gorbik &lt;gor@linux.ibm.com&gt;
</content>
</entry>
<entry>
<title>s390/mm: rename POPULATE_ONE2ONE to POPULATE_DIRECT</title>
<updated>2023-04-13T15:36:28Z</updated>
<author>
<name>Heiko Carstens</name>
</author>
<published>2023-04-06T11:31:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=07fdd6627f7f9c72ed68d531653b56df81da9996'/>
<id>urn:sha1:07fdd6627f7f9c72ed68d531653b56df81da9996</id>
<content type='text'>
Architectures generally use the "direct map" wording for mapping the whole
physical memory. Use that wording as well in arch/s390/boot/vmem.c, instead
of "one to one" in order to avoid confusion.

This also matches what is already done in arch/s390/mm/vmem.c.

Reviewed-by: Alexander Gordeev &lt;agordeev@linux.ibm.com&gt;
Signed-off-by: Heiko Carstens &lt;hca@linux.ibm.com&gt;
Signed-off-by: Vasily Gorbik &lt;gor@linux.ibm.com&gt;
</content>
</entry>
<entry>
<title>s390/boot: improve install.sh script</title>
<updated>2023-04-13T15:36:28Z</updated>
<author>
<name>Marc Hartmayer</name>
</author>
<published>2022-01-31T13:22:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d24e18ef7e13c9cd580ebee771f7ccb9d3f6ee42'/>
<id>urn:sha1:d24e18ef7e13c9cd580ebee771f7ccb9d3f6ee42</id>
<content type='text'>
Use proper quoting for the variables and explicitly distinguish between
command options and positional arguments.

Acked-by: Heiko Carstens &lt;hca@linux.ibm.com&gt;
Signed-off-by: Marc Hartmayer &lt;mhartmay@linux.ibm.com&gt;
Signed-off-by: Vasily Gorbik &lt;gor@linux.ibm.com&gt;
</content>
</entry>
<entry>
<title>s390/kaslr: randomize amode31 base address</title>
<updated>2023-04-13T15:36:27Z</updated>
<author>
<name>Vasily Gorbik</name>
</author>
<published>2023-03-15T12:54:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b3e0423c4e76b19f04799e01b6443949f5fecbbc'/>
<id>urn:sha1:b3e0423c4e76b19f04799e01b6443949f5fecbbc</id>
<content type='text'>
When the KASLR is enabled, randomize the base address of the amode31 image
within the first 2 GB, similar to the approach taken for the vmlinux
image. This makes it harder to predict the location of amode31 data
and code.

Reviewed-by: Alexander Gordeev &lt;agordeev@linux.ibm.com&gt;
Signed-off-by: Vasily Gorbik &lt;gor@linux.ibm.com&gt;
</content>
</entry>
<entry>
<title>s390/kaslr: generalize and improve random base distribution</title>
<updated>2023-04-13T15:36:27Z</updated>
<author>
<name>Vasily Gorbik</name>
</author>
<published>2023-02-21T22:08:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6e259bc5a15ec49693fa3d19fdd4511f7679a20d'/>
<id>urn:sha1:6e259bc5a15ec49693fa3d19fdd4511f7679a20d</id>
<content type='text'>
Improve the distribution algorithm of random base address to ensure
a uniformity among all suitable addresses. To generate a random value
once, and to build a continuous range in which every value is suitable,
count all the suitable addresses (referred to as positions) that can be
used as a base address. The positions are counted by iterating over the
usable memory ranges. For each range that is big enough to accommodate
the image, count all the suitable addresses where the image can be placed,
while taking reserved memory ranges into consideration.

A new function "iterate_valid_positions()" has dual purpose. Firstly, it
is called to count the positions in a given memory range, and secondly,
to convert a random position back to an address.

"get_random_base()" has been replaced with more generic
"randomize_within_range()" which now could be called for randomizing
base addresses not just for the kernel image.

Acked-by: Alexander Gordeev &lt;agordeev@linux.ibm.com&gt;
Signed-off-by: Vasily Gorbik &lt;gor@linux.ibm.com&gt;
</content>
</entry>
<entry>
<title>s390/boot: pin amode31 default lma</title>
<updated>2023-04-13T15:36:27Z</updated>
<author>
<name>Vasily Gorbik</name>
</author>
<published>2023-03-15T10:00:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=898435203c115b164b96f30be7d9c790bbb50338'/>
<id>urn:sha1:898435203c115b164b96f30be7d9c790bbb50338</id>
<content type='text'>
The special amode31 part of the kernel must always remain below 2Gb. Place
it just under vmlinux.default_lma by default, which makes it easier to
debug amode31 as its default lma is known 0x10000 - 0x3000 (currently,
amode31's size is 3 pages). This location is always available as it is
originally occupied by the vmlinux archive.

Reviewed-by: Alexander Gordeev &lt;agordeev@linux.ibm.com&gt;
Signed-off-by: Vasily Gorbik &lt;gor@linux.ibm.com&gt;
</content>
</entry>
<entry>
<title>s390/boot: do not change default_lma</title>
<updated>2023-04-13T15:36:27Z</updated>
<author>
<name>Vasily Gorbik</name>
</author>
<published>2023-03-15T09:19:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a1d2d9cbaf0512451471705264bee7b3f50d4c29'/>
<id>urn:sha1:a1d2d9cbaf0512451471705264bee7b3f50d4c29</id>
<content type='text'>
The current modification of the default_lma is illogical and should be
avoided. It would be more appropriate to introduce and utilize a new
variable vmlinux_lma instead, so that default_lma remains unchanged and
at its original "default" value of 0x100000.

Signed-off-by: Vasily Gorbik &lt;gor@linux.ibm.com&gt;
</content>
</entry>
<entry>
<title>s390/kaslr: provide kaslr_enabled() function</title>
<updated>2023-04-13T15:36:25Z</updated>
<author>
<name>Heiko Carstens</name>
</author>
<published>2023-03-31T13:03:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bb87190c9d46c4285696e071d5972a534bb107cc'/>
<id>urn:sha1:bb87190c9d46c4285696e071d5972a534bb107cc</id>
<content type='text'>
Just like other architectures provide a kaslr_enabled() function, instead
of directly accessing a global variable.

Also pass the renamed __kaslr_enabled variable from the decompressor to the
kernel, so that kalsr_enabled() is available there too. This will be used
by a subsequent patch which randomizes the module base load address.

Reviewed-by: Vasily Gorbik &lt;gor@linux.ibm.com&gt;
Signed-off-by: Heiko Carstens &lt;hca@linux.ibm.com&gt;
Signed-off-by: Vasily Gorbik &lt;gor@linux.ibm.com&gt;
</content>
</entry>
<entry>
<title>s390/kasan: move shadow mapping to decompressor</title>
<updated>2023-03-20T10:02:51Z</updated>
<author>
<name>Vasily Gorbik</name>
</author>
<published>2023-02-09T21:05:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=557b19709da97bc93ea5cf61926ca05800c15a13'/>
<id>urn:sha1:557b19709da97bc93ea5cf61926ca05800c15a13</id>
<content type='text'>
Since regular paging structs are initialized in decompressor already
move KASAN shadow mapping to decompressor as well. This helps to avoid
allocating KASAN required memory in 1 large chunk, de-duplicate paging
structs creation code and start the uncompressed kernel with KASAN
instrumentation right away. This also allows to avoid all pitfalls
accidentally calling KASAN instrumented code during KASAN initialization.

Acked-by: Heiko Carstens &lt;hca@linux.ibm.com&gt;
Reviewed-by: Alexander Gordeev &lt;agordeev@linux.ibm.com&gt;
Signed-off-by: Vasily Gorbik &lt;gor@linux.ibm.com&gt;
Signed-off-by: Heiko Carstens &lt;hca@linux.ibm.com&gt;
</content>
</entry>
<entry>
<title>s390/boot: rework decompressor reserved tracking</title>
<updated>2023-03-20T10:02:50Z</updated>
<author>
<name>Vasily Gorbik</name>
</author>
<published>2023-02-02T12:59:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f913a6600491d3f478ea976a9be0fb1001476c10'/>
<id>urn:sha1:f913a6600491d3f478ea976a9be0fb1001476c10</id>
<content type='text'>
Currently several approaches for finding unused memory in decompressor
are utilized. While "safe_addr" grows towards higher addresses, vmem
code allocates paging structures top down. The former requires careful
ordering. In addition to that ipl report handling code verifies potential
intersections with secure boot certificates on its own. Neither of two
approaches are memory holes aware and consistent with each other in low
memory conditions.

To solve that, existing approaches are generalized and combined
together, as well as online memory ranges are now taken into
consideration.

physmem_info has been extended to contain reserved memory ranges. New
set of functions allow to handle reserves and find unused memory.
All reserves and memory allocations are "typed". In case of out of
memory condition decompressor fails with detailed info on current
reserved ranges and usable online memory.

Linux version 6.2.0 ...
Kernel command line: ... mem=100M
Our of memory allocating 100000 bytes 100000 aligned in range 0:5800000
Reserved memory ranges:
0000000000000000 0000000003e33000 DECOMPRESSOR
0000000003f00000 00000000057648a3 INITRD
00000000063e0000 00000000063e8000 VMEM
00000000063eb000 00000000063f4000 VMEM
00000000063f7800 0000000006400000 VMEM
0000000005800000 0000000006300000 KASAN
Usable online memory ranges (info source: sclp read info [3]):
0000000000000000 0000000006400000
Usable online memory total: 6400000 Reserved: 61b10a3 Free: 24ef5d
Call Trace:
(sp:000000000002bd58 [&lt;0000000000012a70&gt;] physmem_alloc_top_down+0x60/0x14c)
 sp:000000000002bdc8 [&lt;0000000000013756&gt;] _pa+0x56/0x6a
 sp:000000000002bdf0 [&lt;0000000000013bcc&gt;] pgtable_populate+0x45c/0x65e
 sp:000000000002be90 [&lt;00000000000140aa&gt;] setup_vmem+0x2da/0x424
 sp:000000000002bec8 [&lt;0000000000011c20&gt;] startup_kernel+0x428/0x8b4
 sp:000000000002bf60 [&lt;00000000000100f4&gt;] startup_normal+0xd4/0xd4

physmem_alloc_range allows to find free memory in specified range. It
should be used for one time allocations only like finding position for
amode31 and vmlinux.
physmem_alloc_top_down can be used just like physmem_alloc_range, but
it also allows multiple allocations per type and tries to merge sequential
allocations together. Which is useful for paging structures allocations.
If sequential allocations cannot be merged together they are "chained",
allowing easy per type reserved ranges enumeration and migration to
memblock later. Extra "struct reserved_range" allocated for chaining are
not tracked or reserved but rely on the fact that both
physmem_alloc_range and physmem_alloc_top_down search for free memory
only below current top down allocator position. All reserved ranges
should be transferred to memblock before memblock allocations are
enabled.

The startup code has been reordered to delay any memory allocations until
online memory ranges are detected and occupied memory ranges are marked as
reserved to be excluded from follow-up allocations.
Ipl report certificates are a special case, ipl report certificates list
is checked together with other memory reserves until certificates are
saved elsewhere.
KASAN required memory for shadow memory allocation and mapping is reserved
as 1 large chunk which is later passed to KASAN early initialization code.

Acked-by: Heiko Carstens &lt;hca@linux.ibm.com&gt;
Reviewed-by: Alexander Gordeev &lt;agordeev@linux.ibm.com&gt;
Signed-off-by: Vasily Gorbik &lt;gor@linux.ibm.com&gt;
Signed-off-by: Heiko Carstens &lt;hca@linux.ibm.com&gt;
</content>
</entry>
</feed>
