1f08c3bdfSopenharmony_ciKVM RAS Test Suite 2f08c3bdfSopenharmony_ci================== 3f08c3bdfSopenharmony_ciThe KVM RAS Test Suite is a collection of test scripts for testing the 4f08c3bdfSopenharmony_ciLinux kernel MCE processing features in KVM guest system. 5f08c3bdfSopenharmony_ci 6f08c3bdfSopenharmony_ciJan 26th, 2010 7f08c3bdfSopenharmony_ci 8f08c3bdfSopenharmony_ciJiajia Zheng 9f08c3bdfSopenharmony_ci 10f08c3bdfSopenharmony_ci 11f08c3bdfSopenharmony_ciIn the Package 12f08c3bdfSopenharmony_ci---------------- 13f08c3bdfSopenharmony_ci 14f08c3bdfSopenharmony_ciHere is a short description of what is included in the package 15f08c3bdfSopenharmony_ci 16f08c3bdfSopenharmony_cihost/* 17f08c3bdfSopenharmony_ci Contains host test scripts, which drive test procedure on host system. 18f08c3bdfSopenharmony_ciguest/* 19f08c3bdfSopenharmony_ci Contains guest test scripts, which drive test procedure on guest system. 20f08c3bdfSopenharmony_ci 21f08c3bdfSopenharmony_ciDependencies 22f08c3bdfSopenharmony_ci---------------- 23f08c3bdfSopenharmony_ci 24f08c3bdfSopenharmony_ciKVM RAS Test Suite has following dependencies on kernel and other tools: 25f08c3bdfSopenharmony_ci 26f08c3bdfSopenharmony_ci* Linux Kernel: 27f08c3bdfSopenharmony_ci Version 2.6.32 or newer, with MCA high level handlers enabled. 28f08c3bdfSopenharmony_ci 29f08c3bdfSopenharmony_ci* mce-inject 30f08c3bdfSopenharmony_ci A tool to inject mce error into kernel 31f08c3bdfSopenharmony_ci 32f08c3bdfSopenharmony_ci* page-types: 33f08c3bdfSopenharmony_ci A tool to query page types, which is accompanied with Linux kernel 34f08c3bdfSopenharmony_ci source (2.6.32 or newer, $KERNEL_SRC/Documentation/vm/page-types.c). 35f08c3bdfSopenharmony_ci 36f08c3bdfSopenharmony_ci* simple_process: 37f08c3bdfSopenharmony_ci A process constantly access the allocated memeory. (../tools/simple_process) 38f08c3bdfSopenharmony_ci 39f08c3bdfSopenharmony_ci* kpartx: 40f08c3bdfSopenharmony_ci A tool to list partition mappings from partition tables 41f08c3bdfSopenharmony_ci 42f08c3bdfSopenharmony_ci* (optionally) losetup 43f08c3bdfSopenharmony_ci A tool to set up and control loop devices 44f08c3bdfSopenharmony_ci 45f08c3bdfSopenharmony_ci* (optionally) pvdisplay/vgchange: 46f08c3bdfSopenharmony_ci A tool to display/change physical volume attribute 47f08c3bdfSopenharmony_ci 48f08c3bdfSopenharmony_ci* (optionally) ssh-keygen 49f08c3bdfSopenharmony_ci A tool to provide the authentication key generation, management and conversion 50f08c3bdfSopenharmony_ci 51f08c3bdfSopenharmony_ciTest method 52f08c3bdfSopenharmony_ci--------------- 53f08c3bdfSopenharmony_ci- Start a process in the guest OS, get a virtual address from guest OS 54f08c3bdfSopenharmony_ci 55f08c3bdfSopenharmony_ci- Translate this address untill we get the physical address on the host OS 56f08c3bdfSopenharmony_ci 57f08c3bdfSopenharmony_ci- Software injects an SRAO MCE at that physical address from host OS 58f08c3bdfSopenharmony_ci 59f08c3bdfSopenharmony_ci- (optionally) Write to the address from the guest, i.e attempt to 60f08c3bdfSopenharmony_ci write to the poisoned page from the guest. 61f08c3bdfSopenharmony_ci 62f08c3bdfSopenharmony_cithe expected result: 63f08c3bdfSopenharmony_ci 64f08c3bdfSopenharmony_ciHOST system dmesg: 65f08c3bdfSopenharmony_ci 66f08c3bdfSopenharmony_ci... 67f08c3bdfSopenharmony_ciMachine check injector initialized 68f08c3bdfSopenharmony_ciTriggering MCE exception on CPU 0 69f08c3bdfSopenharmony_ciDisabling lock debugging due to kernel taint 70f08c3bdfSopenharmony_ci[Hardware Error]: Machine check events logged 71f08c3bdfSopenharmony_ciMCE exception done on CPU 0 72f08c3bdfSopenharmony_ciMCE 0x806324: Killing qemu-system-x86:8829 early due to hardware memory corruption 73f08c3bdfSopenharmony_ciMCE 0x806324: dirty LRU page recovery: Recovered 74f08c3bdfSopenharmony_ci... 75f08c3bdfSopenharmony_ci 76f08c3bdfSopenharmony_ci 77f08c3bdfSopenharmony_ciGUEST system dmesg: 78f08c3bdfSopenharmony_ci... 79f08c3bdfSopenharmony_ci[Hardware Error]: Machine check events logged 80f08c3bdfSopenharmony_ciMCE 0x75925: Killing simple_process:2273 early due to hardware memory corruption 81f08c3bdfSopenharmony_ciMCE 0x75925: dirty LRU page recovery : Recovered 82f08c3bdfSopenharmony_ci... 83f08c3bdfSopenharmony_ci 84f08c3bdfSopenharmony_ci 85f08c3bdfSopenharmony_ciInstallation 86f08c3bdfSopenharmony_ci--------------- 87f08c3bdfSopenharmony_ci1. Build *host* kernel with 88f08c3bdfSopenharmony_ci CONFIG_KVM=y 89f08c3bdfSopenharmony_ci CONFIG_KVM_INTEL=y 90f08c3bdfSopenharmony_ci CONFIG_X86_MCE=y 91f08c3bdfSopenharmony_ci CONFIG_X86_MCE_INTEL=y 92f08c3bdfSopenharmony_ci CONFIG_X86_MCE_INJECT=y or CONFIG_X86_MCE_INJECT=m 93f08c3bdfSopenharmony_ci 94f08c3bdfSopenharmony_ci and following config both on *host* and *guest* 95f08c3bdfSopenharmony_ci CONFIG_ARCH_SUPPORTS_MEMORY_FAILURE=y 96f08c3bdfSopenharmony_ci CONFIG_MEMORY_FAILURE=y 97f08c3bdfSopenharmony_ci 98f08c3bdfSopenharmony_ci NOTE: if the host machine doesn't support software error recovery 99f08c3bdfSopenharmony_ci (MCG_SER_P in IA32_MCG_CAP[24]), please apply the patch fake_ser_p.patch 100f08c3bdfSopenharmony_ci under ./patches/ 101f08c3bdfSopenharmony_ci2. Use ssh-keygen to generate public and privite keys on the host OS, 102f08c3bdfSopenharmony_ci and copy id_rsa and id_rsa.pub from ~/.ssh/ into the testing directory 103f08c3bdfSopenharmony_ci on the host system. 104f08c3bdfSopenharmony_ci3. compile and install qemu-kvm 105f08c3bdfSopenharmony_ci the qemu-kvm source can be got from git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git. 106f08c3bdfSopenharmony_ci Before compile qemu-kvm, a patch p2v.patch should be applied. This patch 107f08c3bdfSopenharmony_ci is located under ./patches/ 108f08c3bdfSopenharmony_ci Please ensure *SDL-devel* library is installed on the host machine, otherwise 109f08c3bdfSopenharmony_ci only VNC can be used substituing local graphic output. 110f08c3bdfSopenharmony_ci4. install the guest OS on the qemu 111f08c3bdfSopenharmony_ci e.g. 112f08c3bdfSopenharmony_ci step 1: qemu-img create -f qcow2 test.img 10G 113f08c3bdfSopenharmony_ci step 2: qemu-system-x86_64 -hda ./test.img -m 2048 -cdrom rhel6.iso -boot d 114f08c3bdfSopenharmony_ci after the installation, please be sure to execute the following check: 115f08c3bdfSopenharmony_ci a) add necessary command line parameters under your boot item. 116f08c3bdfSopenharmony_ci This is to enable console output redirection to the serial. 117f08c3bdfSopenharmony_ci e.g. 118f08c3bdfSopenharmony_ci before: 119f08c3bdfSopenharmony_ci title Red Hat Enterprise Linux Server (2.6.32kvm) 120f08c3bdfSopenharmony_ci root (hd0,1) 121f08c3bdfSopenharmony_ci kernel /boot/vmlinuz-2.6.32kvm ro root=/dev/sda1 122f08c3bdfSopenharmony_ci initrd /boot/initramfs-2.6.32kvm.img 123f08c3bdfSopenharmony_ci after: 124f08c3bdfSopenharmony_ci title Red Hat Enterprise Linux Server (2.6.32kvm) 125f08c3bdfSopenharmony_ci root (hd0,1) 126f08c3bdfSopenharmony_ci kernel /boot/vmlinuz-2.6.32kvm ro root=/dev/sda1 console=tty0 console=ttyS0,115200n8 127f08c3bdfSopenharmony_ci initrd /boot/initramfs-2.6.32kvm.img 128f08c3bdfSopenharmony_ci b) DHCP guest ethernet card. This operation is to ensure the network connection 129f08c3bdfSopenharmony_ci is OK. 130f08c3bdfSopenharmony_ci e.g. 131f08c3bdfSopenharmony_ci bash> dhclient eth0 132f08c3bdfSopenharmony_ci c) enable SSH public/private key authorization, otherwise, the SSH connection password 133f08c3bdfSopenharmony_ci is necessary to be provided in the test progress. 134f08c3bdfSopenharmony_ci please check /etc/ssh/ssd_config and ensure related options are opened. 135f08c3bdfSopenharmony_ci e.g. 136f08c3bdfSopenharmony_ci RSAAuthentication yes 137f08c3bdfSopenharmony_ci PubkeyAuthentication yes 138f08c3bdfSopenharmony_ci after the related options are opened, please restart ssh service 139f08c3bdfSopenharmony_ci e.g. 140f08c3bdfSopenharmony_ci bash> service sshd restart 141f08c3bdfSopenharmony_ci 142f08c3bdfSopenharmony_ci 143f08c3bdfSopenharmony_ciStart Testing 144f08c3bdfSopenharmony_ci--------------- 145f08c3bdfSopenharmony_ciRun testing by 146f08c3bdfSopenharmony_ci ./host_run.sh <option> <argument> 147f08c3bdfSopenharmony_ciYou can get the help information by 148f08c3bdfSopenharmony_ci ./host_run.sh -h 149f08c3bdfSopenharmony_ci 150