acrn-kernel/arch
Zhenhua Huang 558b8ee45f mm,kfence: decouple kfence from page granularity mapping judgement
[ Upstream commit bfa7965b33 ]

Kfence only needs its pool to be mapped as page granularity, if it is
inited early. Previous judgement was a bit over protected. From [1], Mark
suggested to "just map the KFENCE region a page granularity". So I
decouple it from judgement and do page granularity mapping for kfence
pool only. Need to be noticed that late init of kfence pool still requires
page granularity mapping.

Page granularity mapping in theory cost more(2M per 1GB) memory on arm64
platform. Like what I've tested on QEMU(emulated 1GB RAM) with
gki_defconfig, also turning off rodata protection:
Before:
[root@liebao ]# cat /proc/meminfo
MemTotal:         999484 kB
After:
[root@liebao ]# cat /proc/meminfo
MemTotal:        1001480 kB

To implement this, also relocate the kfence pool allocation before the
linear mapping setting up, arm64_kfence_alloc_pool is to allocate phys
addr, __kfence_pool is to be set after linear mapping set up.

LINK: [1] https://lore.kernel.org/linux-arm-kernel/Y+IsdrvDNILA59UN@FVFF77S0Q05N/
Suggested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Zhenhua Huang <quic_zhenhuah@quicinc.com>
Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: Marco Elver <elver@google.com>
Link: https://lore.kernel.org/r/1679066974-690-1-git-send-email-quic_zhenhuah@quicinc.com
Signed-off-by: Will Deacon <will@kernel.org>
Stable-dep-of: acfa60dbe038 ("arm64: mm: Fix "rodata=on" when CONFIG_RODATA_FULL_DEFAULT_ENABLED=y")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-03 07:32:08 +01:00
..
alpha
arc ARC: atomics: Add compiler barrier to atomic operations... 2023-09-19 12:28:04 +02:00
arm arm/xen: fix xen_vcpu_info allocation alignment 2023-12-03 07:32:08 +01:00
arm64 mm,kfence: decouple kfence from page granularity mapping judgement 2023-12-03 07:32:08 +01:00
csky
hexagon
ia64
loongarch LoongArch: Mark __percpu functions as always inline 2023-11-28 17:07:19 +00:00
m68k m68k: Fix invalid .section syntax 2023-09-13 09:42:21 +02:00
microblaze
mips MIPS: Alchemy: only build mmc support helpers if au1xmmc is enabled 2023-10-06 14:56:45 +02:00
nios2
openrisc
parisc parisc/pgtable: Do not drop upper 5 address bits of physical address 2023-11-28 17:07:14 +00:00
powerpc powerpc/powernv: Fix fortify source warnings in opal-prd.c 2023-11-28 17:07:23 +00:00
riscv RISC-V: drop error print from riscv_hartid_to_cpuid() 2023-11-28 17:07:23 +00:00
s390 s390/cmma: fix detection of DAT pages 2023-11-28 17:07:14 +00:00
sh sh: bios: Revive earlyprintk support 2023-11-20 11:52:07 +01:00
sparc sparc32: fix a braino in fault handling in csum_and_copy_..._user() 2023-11-02 09:35:32 +01:00
um um: Fix hostaudio build errors 2023-09-13 09:42:58 +02:00
x86 KVM: x86: Clear bit12 of ICR after APIC-write VM-exit 2023-11-28 17:07:08 +00:00
xtensa xtensa: boot/lib: fix function prototypes 2023-10-06 14:56:49 +02:00
.gitignore
Kconfig