[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] xen: handle paged gfn in wrmsr_hypervisor_regs
On Fri, May 03, Olaf Hering wrote: > On Fri, May 03, Jan Beulich wrote: > > > >>> On 02.05.13 at 18:24, Olaf Hering <olaf@xxxxxxxxx> wrote: > > > @@ -1682,14 +1682,15 @@ static int svm_msr_write_intercept(unsig > > > if ( wrmsr_viridian_regs(msr, msr_content) ) > > > break; > > > > > > - wrmsr_hypervisor_regs(msr, msr_content); > > > + ret = wrmsr_hypervisor_regs(msr, msr_content); > > > + retry = ret == -EAGAIN; > > > > If you add error handling, don't constrain this to a single error code > > please. For the case here, the easiest would appear to be a switch > > converting to X86EMUL_OKAY, X86EMUL_RETRY, or > > X86EMUL_UNHANDLEABLE. If the function had ways to fail before, > > it would have been a bug anyway to not check the return value. > > I just sent v2 of this patch. My change v2 causes a boot failure, the return value 0 is not handled correctly. Did you really mean to translate ret == 0 to X86EMUL_UNHANDLEABLE? Olaf +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -2020,6 +2020,7 @@ void vmx_vlapic_msr_changed(struct vcpu static int vmx_msr_write_intercept(unsigned int msr, uint64_t msr_content) { + int ret = 0; struct vcpu *v = current; HVM_DBG_LOG(DBG_LEVEL_1, "ecx=%#x, msr_value=%#"PRIx64, msr, msr_content); @@ -2088,7 +2089,17 @@ static int vmx_msr_write_intercept(unsig case HNDL_unhandled: if ( (vmx_write_guest_msr(msr, msr_content) != 0) && !is_last_branch_msr(msr) ) - wrmsr_hypervisor_regs(msr, msr_content); + ret = wrmsr_hypervisor_regs(msr, msr_content); + printk("%s(%u) msr %x mc %lx r %d\n", __func__, __LINE__, msr, msr_content, ret); + switch ( ret ) + { + case -EAGAIN: + return X86EMUL_RETRY; + case 0: + return X86EMUL_UNHANDLEABLE; + default: + break; + } break; case HNDL_exception_raised: return X86EMUL_EXCEPTION; satriani login: (XEN) HVM2: HVM Loader (XEN) vmx_msr_write_intercept(2093) msr 40000000 mc 80000 r 1 (XEN) HVM2: Detected Xen v4.3.26961-20130503 (XEN) HVM2: Xenbus rings @0xfeffc000, event channel 6 (XEN) HVM2: System requested SeaBIOS (XEN) HVM2: CPU speed is 2926 MHz (XEN) irq.c:270: Dom2 PCI link 0 changed 0 -> 5 (XEN) HVM2: PCI-ISA link 0 routed to IRQ5 (XEN) irq.c:270: Dom2 PCI link 1 changed 0 -> 10 (XEN) HVM2: PCI-ISA link 1 routed to IRQ10 (XEN) irq.c:270: Dom2 PCI link 2 changed 0 -> 11 (XEN) HVM2: PCI-ISA link 2 routed to IRQ11 (XEN) irq.c:270: Dom2 PCI link 3 changed 0 -> 5 (XEN) HVM2: PCI-ISA link 3 routed to IRQ5 (XEN) HVM2: pci dev 01:2 INTD->IRQ5 (XEN) HVM2: pci dev 01:3 INTA->IRQ10 (XEN) HVM2: pci dev 03:0 INTA->IRQ5 (XEN) HVM2: pci dev 02:0 bar 10 size lx: 02000000 (XEN) HVM2: pci dev 03:0 bar 14 size lx: 01000000 (XEN) HVM2: pci dev 02:0 bar 30 size lx: 00010000 (XEN) HVM2: pci dev 02:0 bar 14 size lx: 00001000 (XEN) HVM2: pci dev 03:0 bar 10 size lx: 00000100 (XEN) HVM2: pci dev 01:2 bar 20 size lx: 00000020 (XEN) HVM2: pci dev 01:1 bar 20 size lx: 00000010 (XEN) HVM2: Multiprocessor initialisation: (XEN) HVM2: - CPU0 ... 40-bit phys ... fixed MTRRs ... var MTRRs [2/8] ... done. (XEN) HVM2: - CPU1 ... 40-bit phys ... fixed MTRRs ... var MTRRs [2/8] ... done. (XEN) HVM2: - CPU2 ... 40-bit phys ... fixed MTRRs ... var MTRRs [2/8] ... done. (XEN) HVM2: - CPU3 ... 40-bit phys ... fixed MTRRs ... var MTRRs [2/8] ... done. (XEN) HVM2: Testing HVM environment: (XEN) HVM2: - REP INSB across page boundaries ... passed (XEN) HVM2: - GS base MSRs and SWAPGS ... passed (XEN) HVM2: Passed 2 of 2 tests (XEN) HVM2: Writing SMBIOS tables ... (XEN) HVM2: Loading SeaBIOS ... (XEN) HVM2: Creating MP tables ... (XEN) HVM2: Loading ACPI ... (XEN) HVM2: vm86 TSS at fc00a100 (XEN) HVM2: BIOS map: (XEN) HVM2: 10000-100d3: Scratch space (XEN) HVM2: e0000-fffff: Main BIOS (XEN) HVM2: E820 table: (XEN) HVM2: [00]: 00000000:00000000 - 00000000:000a0000: RAM (XEN) HVM2: HOLE: 00000000:000a0000 - 00000000:000e0000 (XEN) HVM2: [01]: 00000000:000e0000 - 00000000:00100000: RESERVED (XEN) HVM2: [02]: 00000000:00100000 - 00000000:16a00000: RAM (XEN) HVM2: HOLE: 00000000:16a00000 - 00000000:fc000000 (XEN) HVM2: [03]: 00000000:fc000000 - 00000001:00000000: RESERVED (XEN) HVM2: Invoking SeaBIOS ... (XEN) HVM2: SeaBIOS (version ?-20130503_132523-bax) (XEN) HVM2: (XEN) HVM2: Found Xen hypervisor signature at 40000000 (XEN) HVM2: xen: copy e820... (XEN) HVM2: Ram Size=0x16a00000 (0x0000000000000000 high) (XEN) HVM2: Relocating low data from 0x000e2490 to 0x000ef790 (size 2156) (XEN) HVM2: Relocating init from 0x000e2cfc to 0x169e20f0 (size 56804) (XEN) HVM2: CPU Mhz=2926 (XEN) HVM2: Found 7 PCI devices (max PCI bus is 00) (XEN) HVM2: Allocated Xen hypercall page at 169ff000 (XEN) vmx_msr_write_intercept(2093) msr 40000000 mc 169ff000 r 1 (XEN) HVM2: Detected Xen v4.3.26961-20130503 (XEN) HVM2: Found 4 cpu(s) max supported 4 cpu(s) (XEN) HVM2: xen: copy BIOS tables... (XEN) HVM2: Copying SMBIOS entry point from 0x00010010 to 0x000fdb10 (XEN) HVM2: Copying MPTABLE from 0xfc0011c0/fc0011d0 to 0x000fd9f0 (XEN) HVM2: Copying PIR from 0x00010030 to 0x000fd970 (XEN) HVM2: Copying ACPI RSDP from 0x000100b0 to 0x000fd940 (XEN) HVM2: Scan for VGA option rom (XEN) HVM2: Running option rom at c000:0003 (XEN) stdvga.c:147:d2 entering stdvga and caching modes (XEN) HVM2: Turning on vga text mode console (XEN) HVM2: SeaBIOS (version ?-20130503_132523-bax) (XEN) HVM2: (XEN) HVM2: UHCI init on dev 00:01.2 (io=c100) (XEN) HVM2: Found 1 lpt ports (XEN) HVM2: Found 1 serial ports (XEN) HVM2: ATA controller 1 at 1f0/3f4/c120 (irq 14 dev 9) (XEN) HVM2: ATA controller 2 at 170/374/c128 (irq 15 dev 9) (XEN) HVM2: ata0-0: QEMU HARDDISK ATA-7 Hard-Disk (10240 MiBytes) (XEN) HVM2: Searching bootorder for: /pci@i0cf8/*@1,1/drive@0/disk@0 (XEN) HVM2: DVD/CD [ata1-0: QEMU DVD-ROM ATAPI-4 DVD/CD] (XEN) HVM2: Searching bootorder for: /pci@i0cf8/*@1,1/drive@1/disk@0 (XEN) HVM2: PS2 keyboard initialized (XEN) HVM2: All threads complete. (XEN) HVM2: Scan for option roms (XEN) HVM2: Press F12 for boot menu. (XEN) HVM2: (XEN) HVM2: drive 0x000fd8f0: PCHS=16383/16/63 translation=lba LCHS=1024/255/63 s=20971520 (XEN) HVM2: (XEN) HVM2: Space available for UMB: 000c9000-000ee800 (XEN) HVM2: Returned 61440 bytes of ZoneHigh (XEN) HVM2: e820 map has 6 items: (XEN) HVM2: 0: 0000000000000000 - 000000000009fc00 = 1 RAM (XEN) HVM2: 1: 000000000009fc00 - 00000000000a0000 = 2 RESERVED (XEN) HVM2: 2: 00000000000f0000 - 0000000000100000 = 2 RESERVED (XEN) HVM2: 3: 0000000000100000 - 00000000169ff000 = 1 RAM (XEN) HVM2: 4: 00000000169ff000 - 0000000016a00000 = 2 RESERVED (XEN) HVM2: 5: 00000000fc000000 - 0000000100000000 = 2 RESERVED (XEN) HVM2: enter handle_19: (XEN) HVM2: NULL (XEN) HVM2: Booting from DVD/CD... (XEN) HVM2: Booting from 0000:7c00 (XEN) stdvga.c:151:d2 leaving stdvga (XEN) stdvga.c:147:d2 entering stdvga and caching modes (XEN) stdvga.c:151:d2 leaving stdvga (XEN) vmx_msr_write_intercept(2093) msr 8b mc 0 r 0 (XEN) vmx_msr_write_intercept(2093) msr 8b mc 0 r 0 (XEN) vmx_msr_write_intercept(2093) msr 8b mc 0 r 0 (XEN) vmx_msr_write_intercept(2093) msr 8b mc 0 r 0 (XEN) vmx_msr_write_intercept(2093) msr 8b mc 0 r 0 (XEN) vmx_msr_write_intercept(2093) msr 8b mc 0 r 0 (XEN) vmx_msr_write_intercept(2093) msr 8b mc 0 r 0 (XEN) vmx_msr_write_intercept(2093) msr 8b mc 0 r 0 (XEN) vmx_msr_write_intercept(2093) msr 8b mc 0 r 0 (XEN) vmx_msr_write_intercept(2093) msr 8b mc 0 r 0 (XEN) vmx_msr_write_intercept(2093) msr 8b mc 0 r 0 (XEN) vmx_msr_write_intercept(2093) msr 8b mc 0 r 0 (XEN) vmx_msr_write_intercept(2093) msr 8b mc 0 r 0 (XEN) vmx_msr_write_intercept(2093) msr 8b mc 0 r 0 (XEN) vmx_msr_write_intercept(2093) msr 8b mc 0 r 0 (XEN) vmx_msr_write_intercept(2093) msr 8b mc 0 r 0 ... _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |