!760 LoongArch: kvm: fix bug of kvm's hugepage
Merge Pull Request from: @Hongchen_Zhang
The virtual machine will cause the physical machine to die when using the huge page because kvm does not enable the huge page feature,
In order to fix this problem,kvm need to enable the huge page feature when the physical machine enable the huge page feature at the same time.
Test passed with below step:
1.Allocate huge page resources to virtual machines
echo 68 > /sys/kernel/mm/hugepages/hugepages-32768kB/nr_hugepages
mount -t hugetlbfs -o pagesize=32768K none /mnt/kvm_hugepage
2.Start a virtual machine with huge page
MALLOC_PERTURB_=1 /usr/libexec/qemu-kvm
-name 'avocado-vt-vm1'
-machine loongson7a,memory-backend=mem-machine_mem
-device pcie-root-port,id=pcie-root-port-0,multifunction=on,bus=pcie.0,addr=0x1,chassis=1
-device pcie-pci-bridge,id=pcie-pci-bridge-0,addr=0x0,bus=pcie-root-port-0
-nodefaults
-device qxl-vga,bus=pcie.0,addr=0x2
-m 2048
-object memory-backend-file,size=2048M,mem-path=/mnt/kvm_hugepage,id=mem-machine_mem
-smp 2,maxcpus=2,cores=2,threads=1,sockets=1
-cpu 'Loongson-3A5000'
-device pcie-root-port,id=pcie-root-port-1,port=0x1,addr=0x1.0x1,bus=pcie.0,chassis=2
-device qemu-xhci,id=usb1,bus=pcie-root-port-1,addr=0x0
-device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1
-device pcie-root-port,id=pcie-root-port-2,port=0x2,addr=0x1.0x2,bus=pcie.0,chassis=3
-device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pcie-root-port-2,addr=0x0
-blockdev node-name=file_image1,driver=file,filename=/root/avocado/data/avocado-vt/images/openEuler-22.03-loongarch64.qcow2
-blockdev node-name=drive_image1,driver=qcow2,file=file_image1
-device scsi-hd,id=image1,drive=drive_image1
-device pcie-root-port,id=pcie-root-port-3,port=0x3,addr=0x1.0x3,bus=pcie.0,chassis=4
-device virtio-net-pci,mac=9a:ab:6e:88:2f:5b,id=idk4GfF4,netdev=idwjd54m,bus=pcie-root-port-3,addr=0x0
-netdev tap,id=idwjd54m
-vnc :0
-rtc base=utc,clock=host
-boot menu=off,order=cdn,once=c,strict=off
-bios /usr/share/qemu/loongarch_bios.bin
-enable-kvm
-monitor telnet:localhost:4444,server,nowait
-serial stdio
Link:https://gitee.com/openeuler/kernel/pulls/760
Reviewed-by:
Guo Dongtai <guodongtai@kylinos.cn>
Reviewed-by:
Kevin Zhu <zhukeqian1@huawei.com>
Reviewed-by:
Jialin Zhang <zhangjialin11@huawei.com>
Signed-off-by:
Jialin Zhang <zhangjialin11@huawei.com>
Loading
Please sign in to comment