Skip to contentSkip to conversation

kvm/e500: Discard shadow TLB

PATCH New Liu Yu 1 participant 1 message May 15, 2009

Subsystems (2)
lore
Share & tools
lore

Liu Yu

author
#0 lore raw

PATCH 1/5 kvm/e500: Discard shadow TLB

There are several reasons to discard shadow TLB.

1. After implement shadow ID support for E500,
keep shadow TLB may incur potential coherence problem. (if shadow ID mappings change, shadow TLB cannot be updated intime)

2. We use shadow TLB restore hardware TLB in vcpu_load(). However, since after implement shadow ID there is no tlbia() in vcpu_put(), it's no need to restore hardware TLB any more.

3. Discard shadow TLB saves a lot memory.

---
 arch/powerpc/include/asm/kvm_e500.h |    9 +-
 arch/powerpc/kvm/e500_tlb.c         |  275 ++++++++++++-----------------------
 2 files changed, 103 insertions(+), 181 deletions(-)
arch/powerpc/include/asm/kvm_e500.h +7 -2
index 9d497ce..b248f31 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Freescale Semiconductor, Inc. All rights reserved.
+ * Copyright (C) 2008 - 2009 Freescale Semiconductor, Inc. All rights reserved.
  *
  * Author: Yu Liu, <[email protected]>
  *
@@ -29,13 +29,18 @@ struct tlbe{
 	u32 mas7;
 };
 
+struct kvmppc_e500_shadow_ref {
+	struct page *page;
+	struct tlbe *gtlbe;
+};
+
 struct kvmppc_vcpu_e500 {
 	/* Unmodified copy of the guest's TLB. */
 	struct tlbe *guest_tlb[E500_TLB_NUM];
 	/* TLB that's actually used when the guest is running. */
 	struct tlbe *shadow_tlb[E500_TLB_NUM];
 	/* Pages which are referenced in the shadow TLB. */
-	struct page **shadow_pages[E500_TLB_NUM];
+	struct kvmppc_e500_shadow_ref *shadow_refs[E500_TLB_NUM];
 
 	unsigned int guest_tlb_size[E500_TLB_NUM];
 	unsigned int shadow_tlb_size[E500_TLB_NUM];
arch/powerpc/kvm/e500_tlb.c +95 -177

454 lines not on this page · raw message

Signature · 1 line
1.5.4