changeset d135bc832ffe in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=d135bc832ffe
description:
x86: Invalidating TLB entry on page fault
As per the x86 architecture specification, matching TLB entries need to
be
invalidated on a page fault. For instance, after a page fault due to
inadequate
protection bits on a TLB hit, the TLB entry needs to be invalidated.
This
behavior is clearly specified in the x86 architecture manuals from both
AMD and
Intel. This invalidation is missing currently in gem5, due to which
linux
kernel versions 3.8 and up cannot be simulated efficiently. This is
exposed by
a linux optimisation in commit
e4a1cc56e4d728eb87072c71c07581524e5160b1, which
removes a tlb flush on updating page table entries in x86.
Testing: Linux kernel versions 3.8 onwards were booting very slowly in
FS mode,
due to repeated page faults (~300000 before the first print statement
in a
bash file). Ensured that page fault rate drops drastically and observed
reduction in boot time from order of hours to minutes for linux kernel
v3.8
and v3.11
diffstat:
src/arch/x86/faults.cc | 3 +++
src/arch/x86/faults.hh | 2 +-
2 files changed, 4 insertions(+), 1 deletions(-)
diffs (25 lines):
diff -r b29d5816936f -r d135bc832ffe src/arch/x86/faults.cc
--- a/src/arch/x86/faults.cc Mon Nov 16 04:58:39 2015 -0600
+++ b/src/arch/x86/faults.cc Mon Nov 16 05:08:54 2015 -0600
@@ -135,6 +135,9 @@
void PageFault::invoke(ThreadContext * tc, const StaticInstPtr &inst)
{
if (FullSystem) {
+ /* Invalidate any matching TLB entries before handling the page
fault */
+ tc->getITBPtr()->demapPage(addr, 0);
+ tc->getDTBPtr()->demapPage(addr, 0);
HandyM5Reg m5reg = tc->readMiscRegNoEffect(MISCREG_M5_REG);
X86FaultBase::invoke(tc);
/*
diff -r b29d5816936f -r d135bc832ffe src/arch/x86/faults.hh
--- a/src/arch/x86/faults.hh Mon Nov 16 04:58:39 2015 -0600
+++ b/src/arch/x86/faults.hh Mon Nov 16 05:08:54 2015 -0600
@@ -42,7 +42,7 @@
#include <string>
-#include "arch/generic/tlb.hh"
+#include "arch/x86/tlb.hh"
#include "base/bitunion.hh"
#include "base/misc.hh"
#include "sim/faults.hh"
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev