On Mon, 7 Nov 2022 at 04:27, zhaowenhui (A) <zhaowenhui8@xxxxxxxxxx> wrote: > > Hello, > > We compiled the kernel with x86_64_defconfig and the following configs > from commit d4c6399900364facd84c9e35ce1540b6046c345f (vmlinux.lds.h: > Avoid orphan section with !SMP ): > > CONFIG_SMP=n > CONFIG_AMD_MEM_ENCRYPT=y > CONFIG_HYPERVISOR_GUEST=y > CONFIG_KVM=y > CONFIG_PARAVIRT=y > > Then start virtual machine with the following command (OS: Ubuntu; Arch: > x86-64): > > qemu-system-x86_64 -enable-kvm -cpu Skylake-Server -smp 10 -m 8192 > -boot menu=on,splash-time=1000 \ > -device virtio-scsi-pci \ > -initrd ${initramfs} \ > -kernel ./linux/arch/x86/boot/bzImage \ > -append "root=/dev/ram rw rdinit=/sbin/init console=tty0 > console=ttyS0,115200 earlyprintk=ttyS0 debug " \ > -nographic -vnc :18 > > (Note: ./linux/arch/x86/boot/bzImage is the compiled kernel bzImage path > On my machine, initramfs=./x86_procfs.cpio.gz_1 ) > > QEMU reports an error: BUG: unable to handle page fault for address: > ffffffff8ad01040 > > The bug was introduced by commit d4c6399900, and the problem can be > avoided by rolling back the patch. > Patch link: > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d4c6399900364facd84c9e35ce1540b6046c345f. > We speculate that the problem is related to the hardware memory > encryption feature in the virtualization scenario of the AMD platform. > That patch looks incorrect to me. Without CONFIG_SMP, the PERCPU sections are not instantiated, and the only copy of those variables is created in the ordinary .data/.bss sections Does the change below fix the issue for you? --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -347,6 +347,7 @@ #define DATA_DATA \ *(.xiptext) \ *(DATA_MAIN) \ + *(.data..decrypted) \ *(.ref.data) \ *(.data..shared_aligned) /* percpu related */ \ MEM_KEEP(init.data*) \ @@ -995,7 +996,6 @@ #ifdef CONFIG_AMD_MEM_ENCRYPT #define PERCPU_DECRYPTED_SECTION \ . = ALIGN(PAGE_SIZE); \ - *(.data..decrypted) \ *(.data..percpu..decrypted) \ . = ALIGN(PAGE_SIZE); #else