From: Peter Dinda Date: Wed, 25 Mar 2009 18:39:28 +0000 (-0500) Subject: First attempt at speculative paging around the address that faulted X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=9487b7d59cab801ef521a89187dfd1e33fa36c45 First attempt at speculative paging around the address that faulted It only attempts to fill the leaf page table --- diff --git a/geekos/src/geekos/main.c b/geekos/src/geekos/main.c index 5d71341..310fcf9 100644 --- a/geekos/src/geekos/main.c +++ b/geekos/src/geekos/main.c @@ -241,7 +241,7 @@ void Main(struct Boot_Info* bootInfo) #endif -#if 1 +#if 0 struct Kernel_Thread *spin_thread; spin_thread=Start_Kernel_Thread(Spin,0,PRIORITY_NORMAL,false); diff --git a/manual/manual.pdf b/manual/manual.pdf index 887fd33..78e5043 100644 Binary files a/manual/manual.pdf and b/manual/manual.pdf differ diff --git a/palacios/src/palacios/vmm_shadow_paging.c b/palacios/src/palacios/vmm_shadow_paging.c index 8074c16..91004f9 100644 --- a/palacios/src/palacios/vmm_shadow_paging.c +++ b/palacios/src/palacios/vmm_shadow_paging.c @@ -30,6 +30,14 @@ #include + +// set this to 1 if you want us to attempt to +// fetch multiple entries on a page fault +#define SPECULATIVE_PAGING 1 + +#define REGULAR_PAGE_FAULT 0 +#define SPECULATIVE_PAGE_FAULT 1 + #ifndef DEBUG_SHADOW_PAGING #undef PrintDebug #define PrintDebug(fmt, args...) @@ -126,6 +134,7 @@ int v3_activate_passthrough_pt(struct guest_info * info) { int v3_handle_shadow_pagefault(struct guest_info * info, addr_t fault_addr, pf_error_t error_code) { + int rc; if (v3_get_mem_mode(info) == PHYSICAL_MEM) { // If paging is not turned on we need to handle the special cases @@ -134,14 +143,38 @@ int v3_handle_shadow_pagefault(struct guest_info * info, addr_t fault_addr, pf_e switch (v3_get_cpu_mode(info)) { case PROTECTED: - return handle_shadow_pagefault_32(info, fault_addr, error_code); + return handle_shadow_pagefault_32(info, fault_addr, error_code); break; case PROTECTED_PAE: return handle_shadow_pagefault_32pae(info, fault_addr, error_code); case LONG: case LONG_32_COMPAT: - case LONG_16_COMPAT: - return handle_shadow_pagefault_64(info, fault_addr, error_code); + case LONG_16_COMPAT: { + addr_t curr_addr; + addr_t fault_addr_base; + // first, we will handle the actual fault, non-speculatively + rc=handle_shadow_pagefault_64(info, fault_addr, error_code, REGULAR_PAGE_FAULT); + if (rc) { + return -1; + } + if (!SPECULATIVE_PAGING) { + return 0; + } + fault_addr_base=PAGE_ADDR_4KB(fault_addr); + PrintDebug("Attempting speculative paging around %p\n",(void*)fault_addr_base); + for (curr_addr = (fault_addr_base & (~0x1fffffLL)) ; + curr_addr < (fault_addr_base | (0x1fffffLL)) ; + curr_addr+=PAGE_SIZE) { + if (curr_addr!=fault_addr_base) { + rc=handle_shadow_pagefault_64(info, curr_addr, error_code, SPECULATIVE_PAGE_FAULT); + if (rc) { + PrintDebug("Speculative page fault handler failed at %p\n",(void*)curr_addr); + return -1; + } + } + } + return 0; + } break; default: PrintError("Unhandled CPU Mode: %s\n", v3_cpu_mode_to_str(v3_get_cpu_mode(info)));