All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
	xen-devel@lists.xen.org, Ian.Campbell@citrix.com,
	ian.jackson@eu.citrix.com, stefano.stabellini@eu.citrix.com,
	wei.liu2@citrix.com
Subject: Re: [PATCH 2/4] libxc: support of linear p2m list for migration of pv-domains
Date: Fri, 11 Dec 2015 17:17:37 +0100	[thread overview]
Message-ID: <566AF721.3060607@suse.com> (raw)
In-Reply-To: <566AF53B.5080600@citrix.com>

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

  reply	other threads:[~2015-12-11 16:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-11 11:31 [PATCH 0/4] support linear p2m list in migrate stream v2 Juergen Gross
2015-12-11 11:31 ` [PATCH 1/4] libxc: split mapping p2m leaves into a separate function Juergen Gross
2015-12-11 14:21   ` Andrew Cooper
2015-12-11 11:31 ` [PATCH 2/4] libxc: support of linear p2m list for migration of pv-domains Juergen Gross
2015-12-11 14:51   ` Andrew Cooper
2015-12-11 15:12     ` Juergen Gross
2015-12-11 15:24       ` Andrew Cooper
2015-12-11 16:00         ` Juergen Gross
2015-12-11 16:09           ` Andrew Cooper
2015-12-11 16:17             ` Juergen Gross [this message]
2015-12-11 11:31 ` [PATCH 3/4] libxc: stop migration in case of p2m list structural changes Juergen Gross
2015-12-11 15:20   ` Andrew Cooper
2015-12-11 16:02     ` Juergen Gross
2015-12-11 11:31 ` [PATCH 4/4] libxc: set flag for support of linear p2m list in domain builder Juergen Gross
2015-12-11 14:18 ` [PATCH 0/4] support linear p2m list in migrate stream v2 Andrew Cooper
2015-12-11 14:20   ` Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=566AF721.3060607@suse.com \
    --to=jgross@suse.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.