|
From: Hollis B. <ho...@us...> - 2007-08-27 14:45:50
|
On Mon, 2007-08-27 at 13:34 +0200, Christian Ehrhardt wrote:
> *resent because I forgot to use reply-all*
>
> Hollis Blanchard wrote:
> > ...
> > +struct kvm_vcpu {
> > + /* This is an unmodified copy of the guest's TLB. */
> > + struct tlbe guest_tlb[PPC44x_TLB_SIZE];
> > + /* This is the TLB that's actually used when the guest is running. */
> > + struct tlbe shadow_tlb[PPC44x_TLB_SIZE];
> > + /* This is a copy of the host's TLB. */
> > + struct tlbe host_tlb[PPC44x_TLB_SIZE];
> > +
> > + u32 host_stack;
> > ...
> >
>
> I understood from you mail before that you need all the vcpu content
> together with the exception handlers in one 64k mapping.
>
> I just roughly estimate sizes here - 3xTLB = 3kb + rest of u32 vcpu
> values (33+16+32)x4byte = 324b and te rest of the u64 values 32x8byte =
> 256b.
> So all together one vcpu struct has ~3,5kb.
>
> It looks strange to me that host_tlb is part of the guest vcpu structure
> since the host_tlb exists only once. Can you think of any
> multiprocessor/multiguest scenario where we need really one per guest vcpu?
> Shall these design you posted at the moment be
> multiprocessor/multiguest/multiguestcpu aware at all ?
>
> Maybe it would be possible to put the host_tlb array outside of the vcpu
> struct as a single instance (still in your 64k mapping) to
> a) have it only as often as it exists in hardware and
> b) to save space in the 64k mapping reducing the per vcpu size nearly a
> by 1/3.
The trouble is that when an interrupt occurs while running the guest,
the KVM exception handler must restore the host TLB before calling out
to the host handler.
What we could do is have the vcpu contain only the mappings needed to
cover the host kernel. Then if the host decides to schedule out the
guest, we restore the rest of the host TLB in the "heavyweight" exit
path.
Of course, we're not sure exactly how many entries the host kernel is
using: it depends on the amount of physical RAM. Also, we're adding
complexity in where to find the host TLB state.
Since we've got 64KB to work with for our vcpu, I'm not sure it's really
worth the effort.
--
Hollis Blanchard
IBM Linux Technology Center
|