[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 2/4] libxc: support of linear p2m list for migration of pv-domains
On 11/12/15 17:09, Andrew Cooper wrote: > On 11/12/15 16:00, Juergen Gross wrote: >> On 11/12/15 16:24, Andrew Cooper wrote: >>>>>> + */ >>>>>> +static int map_p2m_list(struct xc_sr_context *ctx, uint64_t p2m_cr3) >>>>>> +{ >>>>>> + xc_interface *xch = ctx->xch; >>>>>> + xen_vaddr_t p2m_vaddr, p2m_end, mask, off; >>>>>> + xen_pfn_t p2m_mfn, mfn, saved_mfn, max_pfn; >>>>>> + uint64_t *ptes; >>>>>> + xen_pfn_t *mfns; >>>>>> + unsigned fpp, n_pages, level, shift, idx_start, idx_end, idx, >>>>>> saved_idx; >>>>>> + int rc = -1; >>>>>> + >>>>>> + p2m_mfn = cr3_to_mfn(ctx, p2m_cr3); >>>>>> + if ( p2m_mfn == 0 || p2m_mfn > ctx->x86_pv.max_mfn ) >>>>> mfn 0 isn't invalid to use here. It could, in principle, be available >>>>> for PV guest use. >>>> No, the value 0 indicates that the linear p2m info isn't valid. See >>>> comments in xen/include/public/arch-x86/xen.h >>> Technically speaking, that is p2m_cr3, rather than p2m_mfn but I suppose >>> there is a linear mapping between the two. >>> >>> As this function only gets called with a non-zero p2m_cr3, an >>> alternative would be assert(p2m_cr3 > 0). >> Hmm, yes. >> >>> The mfn == 0 comment also applies for reading the ptes in the loop below. >> Sure? Is the hypervisor really giving mfn 0 to a guest? I don't mind >> dropping the test, but I'd be surprised if mfn 0 would be valid. > > Currently no. > > I am thinking longer term for things like a DMLite nested hypervisor, > where none of the RAM below 1MB is special any more. > > I don't expect handing mfn 0 to guests to actually function very well, > but I would prefer to avoid false assumptions about it. Uuh, I really see problems with that approach. A pv guest would have to check the mfn after allocating the top level page table used to map the p2m list. Letting mfn 0 be valid is asking for problems, I guess. I'd rather ban mfn 0 and even gfn 0 from being used as page table, p2m page or gdt/ldt/idt by pv guests. Juergen _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |