RE: removing shadow TLB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> On Wed, 2008-09-10 at 10:54 +0800, Liu Yu-B13201 wrote:
> > > The shadow TLB allows us to skip the repopulation phase, 
> but at the
> > > expense of some memory and some overhead on every exit. Also, it's
> > > difficult or impossible to implement a shadow TLB on cores where
> > > software cannot address TLB entries by index (i.e. the hardware
> > > automatically selects the index).
> > 
> > Shadow TLB also avoid recalculation, the value of shadow 
> tlb entry can
> > be directly written into hardware.
> > And get and put page can be save as well.
> > 
> > btw, why do we need to update TLB on every exit, why can't we just
> > update it on miss?
> 
> Linux can actually modify the host TLB at any time. For example, if
> Linux gets a fault touching vmalloc'ed memory, or printk faults trying
> to touch the UART, a new host TLB entry will be inserted without the
> knowledge of KVM.
> 
> If that happens though, it's just clobbered a guest TLB 
> entry, so we put
> it back. Ideally we don't want to reload the *entire* TLB, 
> only entries
> that the host has changed, but I think that optimization is not yet
> implemented. That's what this comment is about:
> 	/* Save the host's non-pinned TLB mappings, and load 
> the guest mappings
> 	 * over them. Leave the host's "pinned" kernel mappings 
> in place. */
> 	/* XXX optimization: use generation count to avoid 
> swapping unmodified
> 	 * entries. */
> 

To avoid host kernel disturbing TLB, I think we'd better prevent
kernel's unnecessary action, not rob TLB resource.
In some sense, updating all entries influence the host's performance.
E.g, reload all entries and then enter guest, after a couple of
instructions, then exit and back to qemu which will certainly encounter
tlb miss.

You have checked that the optimization of writing only modifed entry
improved the performance.
Maybe it's not only because alleviating workload on entering path, but
also because just updating needed entry leave qemu's tlb more space.

How about using host's method to update TLB in miss case?
Then the conflict may be reduced to the least.
And the entry written by kvm has little chance to be rewritten by host
kernel.

E.g. when tlb miss but guest tlb hit, then
	local_disable_irq();
	map splited shadow entry on index "tlb_44x_index"
	write shadow entry tlb[tlb_44x_index] into hardware
	tlb_44x_index ++   		// so that host kernel knows
this update
	local_enable_irq();

Then updating TLB can be removed from the entering guest path.
Also, the invalidation need some adjustment.


--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM Development]     [KVM ARM]     [KVM ia64]     [Linux Virtualization]     [Linux USB Devel]     [Linux Video]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux