All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Tamas K Lengyel <tamas.k.lengyel@gmail.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	Jan Beulich <JBeulich@suse.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH 2/2] memory: don't hand MFN info to translated guests
Date: Mon, 19 Jun 2017 15:52:39 +0100	[thread overview]
Message-ID: <dd255e4b-ba0f-7b5b-6c6f-114a08aedc58@arm.com> (raw)
In-Reply-To: <CABfawhkznf_EbQChAi90O2zNKnyfp9AKtkFn2yqA+9x_OC4okQ@mail.gmail.com>



On 19/06/17 15:39, Tamas K Lengyel wrote:
> On Mon, Jun 19, 2017 at 3:09 AM, Julien Grall <julien.grall@arm.com> wrote:
>> Hi,
>>
>>
>> On 19/06/17 09:15, Jan Beulich wrote:
>>>>>>
>>>>>> On 18.06.17 at 21:19, <tamas.k.lengyel@gmail.com> wrote:
>>>>
>>>> On Tue, Apr 4, 2017 at 1:04 PM, Andrew Cooper <andrew.cooper3@citrix.com>
>>>> wrote:
>>>>>
>>>>> On 04/04/17 14:14, Jan Beulich wrote:
>>>>>>
>>>>>> We shouldn't hand MFN info back from increase-reservation for
>>>>>> translated domains, just like we don't for populate-physmap and
>>>>>> memory-exchange. For full symmetry also check for a NULL guest handle
>>>>>> in populate_physmap() (but note this makes no sense in
>>>>>> memory_exchange(), as there the array is also an input).
>>>>>>
>>>>>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>>>>>
>>>>>
>>>>> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
>>>>
>>>>
>>>> Unfortunately I just had time to do testing with this change and I
>>>> have to report that introduces a critical regression for my tools.
>>>> With this change in-place performing increase_reservation on a target
>>>> domain no longer reports the guest frame number for external tools,
>>>> thus completely breaking advanced use-cases that require this
>>>> information to be able to do altp2m gfn remapping. This is a critical
>>>> step in being able to introduce shadow-pages that are used to hide
>>>> breakpoints and other memory modifications from the guest.
>>>
>>>
>>> While I can see your point, I'm afraid that's not how the
>>> interface was meant to be used. The mere fact that
>>> populate-physmap and memory-exchange didn't return the
>>> MFN(s) suggests to me that you already need to have a way
>>> to deal with having to find out another way. Or are you
>>> suggesting you rely on guests not using these interfaces?
>>>
>>> As to a solution, I could possibly see us relax the change to
>>> return the MFN(s) when the current and subject domains differ,
>>> or even check paging mode of the caller domain instead of the
>>> subject one (which would mean PVH Dom0 still wouldn't get to
>>> see them). But if we do, imo we should do this consistently for
>>> all three operations, rather than just for increase-reservation.
>>>
>>>> If at all possible, I would like to request this change not to be part
>>>> of the 4.9 release.
>>>
>>>
>>> Hmm, it's been there for all of the RCs, so I'm not really happy
>>> to consider the option of reverting at this point in time. But
>>> Julien will have the final say anyway.
>>
>>
>> I am a bit confuse with the description of the problem. I understood "guest
>> frame number" as GFN. But AFAICT, this hypercall was returning MFN even for
>> HVM guests. So how this change is breaking altp2m remapping?
>
> For HVM guests this hypercall returns a GFN that can subsequently be
> populated into the guest physmap:
>
> xc_domain_increase_reservation_exact(xch, domid, 1, 0, 0, &new_gfn);
> xc_domain_populate_physmap_exact(xch, domid, 1, 0, 0, &new_gfn);

I am sorry, I can't see how this can return a GFN for the HVM. Looking 
at the implementation of increase_reservation in Xen:

mfn = page_to_mfn(page);
if ( unlikely(__copy_to_guest_offset(a->extent_list, i, &mfn, 1)) )
   goto out;

This is an MFN and not a GFN. Except the strict check before, the code 
has not change for a while.

AFAICT, the purpose of increase_reservation is not to allocate a new 
GFN, it will just allocate the host memory for it. At least on ARM we 
have nothing to say "this GFN region is free". I would be surprised that 
such things exists on x86.

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-06-19 14:52 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-04 12:53 [PATCH 0/2] memory: XSA-212 follow-up Jan Beulich
2017-04-04 13:13 ` [PATCH 1/2] memory: exit early from memory_exchange() upon write-back error Jan Beulich
2017-04-04 18:45   ` Andrew Cooper
2017-04-05  6:58     ` Jan Beulich
2017-04-05  7:00     ` Jan Beulich
2017-04-04 13:14 ` [PATCH 2/2] memory: don't hand MFN info to translated guests Jan Beulich
2017-04-04 19:04   ` Andrew Cooper
2017-06-18 19:19     ` Tamas K Lengyel
2017-06-19  8:15       ` Jan Beulich
2017-06-19  9:09         ` Julien Grall
2017-06-19 14:39           ` Tamas K Lengyel
2017-06-19 14:52             ` Julien Grall [this message]
2017-06-19 14:57               ` Tamas K Lengyel
2017-06-19 15:34                 ` Julien Grall
2017-06-19 16:38                   ` Tamas K Lengyel
2017-06-19 16:57                     ` Tamas K Lengyel
2017-06-19  9:11         ` George Dunlap
2017-06-19 10:52           ` Jan Beulich
2017-06-19 14:48           ` Tamas K Lengyel
2017-06-19 14:54             ` George Dunlap
2017-06-19 14:56               ` Tamas K Lengyel
2017-04-05 13:12 ` [PATCH 0/2] memory: XSA-212 follow-up Julien Grall

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=dd255e4b-ba0f-7b5b-6c6f-114a08aedc58@arm.com \
    --to=julien.grall@arm.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=tamas.k.lengyel@gmail.com \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.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.