linux-stable/arch/s390/mm
Alexander Gordeev 4df29d2b90 s390/smp: rework absolute lowcore access
Temporary unsetting of the prefix page in memcpy_absolute() routine
poses a risk of executing code path with unexpectedly disabled prefix
page. This rework avoids the prefix page uninstalling and disabling
of normal and machine check interrupts when accessing the absolute
zero memory.

Although memcpy_absolute() routine can access the whole memory, it is
only used to update the absolute zero lowcore. This rework therefore
introduces a new mechanism for the absolute zero lowcore access and
scraps memcpy_absolute() routine for good.

Instead, an area is reserved in the virtual memory that is used for
the absolute lowcore access only. That area holds an array of 8KB
virtual mappings - one per CPU. Whenever a CPU is brought online, the
corresponding item is mapped to the real address of the previously
installed prefix page.

The absolute zero lowcore access works like this: a CPU calls the
new primitive get_abs_lowcore() to obtain its 8KB mapping as a
pointer to the struct lowcore. Virtual address references to that
pointer get translated to the real addresses of the prefix page,
which in turn gets swapped with the absolute zero memory addresses
due to prefixing. Once the pointer is not needed it must be released
with put_abs_lowcore() primitive:

	struct lowcore *abs_lc;
	unsigned long flags;

	abs_lc = get_abs_lowcore(&flags);
	abs_lc->... = ...;
	put_abs_lowcore(abs_lc, flags);

To ensure the described mechanism works large segment- and region-
table entries must be avoided for the 8KB mappings. Failure to do
so results in usage of Region-Frame Absolute Address (RFAA) or
Segment-Frame Absolute Address (SFAA) large page fields. In that
case absolute addresses would be used to address the prefix page
instead of the real ones and the prefixing would get bypassed.

Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2022-09-14 16:46:00 +02:00
..
cmm.c s390/cmm: add missing virt_to_phys() conversion 2021-12-10 16:14:25 +01:00
dump_pagetables.c s390/ptdump: add missing amode31 markers 2022-09-07 14:04:52 +02:00
extable.c s390/uaccess: use exception handler to zero result on get_user() failure 2022-06-01 12:03:17 +02:00
extmem.c
fault.c Merge branch 'fixes' into features 2022-09-14 16:41:21 +02:00
gmap.c KVM: s390: pv: refactor s390_reset_acc 2022-07-13 14:42:11 +00:00
hugetlbpage.c s390/mm,hugetlb: don't use pte_val()/pXd_val() as lvalue 2022-03-01 21:05:10 +01:00
init.c s390/smp: rework absolute lowcore access 2022-09-14 16:46:00 +02:00
kasan_init.c s390/mm: use set_pXd()/set_pte() helper functions everywhere 2022-03-01 21:05:10 +01:00
maccess.c s390/smp: rework absolute lowcore access 2022-09-14 16:46:00 +02:00
Makefile s390/extable: move extable related functions to mm/extable.c 2022-03-08 00:33:00 +01:00
mmap.c s390/mm: enable ARCH_HAS_VM_GET_PAGE_PROT 2022-07-17 17:14:40 -07:00
page-states.c s390/extable: move EX_TABLE define to asm-extable.h 2022-03-08 00:33:00 +01:00
pageattr.c s390/mm,pageattr: don't use pte_val()/pXd_val() as lvalue 2022-03-01 21:05:10 +01:00
pgalloc.c s390/mm: use CRST_ALLOC_ORDER instead of number 2022-02-09 22:56:04 +01:00
pgtable.c s390/mm: use non-quiescing sske for KVM switch to keyed guest 2022-06-01 12:03:16 +02:00
vmem.c s390/smp: rework absolute lowcore access 2022-09-14 16:46:00 +02:00