From: Wei Liu <wei.liu2@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Kevin Tian <kevin.tian@intel.com>, Wei Liu <wei.liu2@citrix.com>,
Jun Nakajima <jun.nakajima@intel.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Eddie Dong <eddie.dong@intel.com>,
Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>,
suravee.suthikulpanit@amd.com,
xen-devel <xen-devel@lists.xenproject.org>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Keir Fraser <keir@xen.org>
Subject: Re: [PATCH] x86/HVM: honor p2m_ram_ro in hvm_map_guest_frame_rw()
Date: Fri, 24 Jul 2015 11:26:47 +0100 [thread overview]
Message-ID: <20150724102647.GB30594@zion.uk.xensource.com> (raw)
In-Reply-To: <55B224660200007800095083@prv-mh.provo.novell.com>
On Fri, Jul 24, 2015 at 03:41:26AM -0600, Jan Beulich wrote:
> ... and its callers.
>
> While all non-nested users are made fully honor the semantics of that
> type, doing so in the nested case seemed insane (if doable at all,
> considering VMCS shadowing), and hence there the respective operations
> are simply made fail.
>
> One case not (yet) taken care of is that of a page getting transitioned
> to this type after a mapping got established.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> ---
> Beyond that log-dirty handling in _hvm_map_guest_frame() looks bogus
> too: What if a XEN_DOMCTL_SHADOW_OP_* gets issued and acted upon
> between the setting of the dirty flag and the actual write happening?
> I.e. shouldn't the flag instead be set in hvm_unmap_guest_frame()?
>
> Note that this is conflicting with the altp2m series (adding another
> call to hvm_map_guest_frame_rw(), reviewing of which made me spot the
> issue in the first place).
>
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -3594,8 +3594,8 @@ int hvm_virtual_to_linear_addr(
>
> /* On non-NULL return, we leave this function holding an additional
> * ref on the underlying mfn, if any */
> -static void *__hvm_map_guest_frame(unsigned long gfn, bool_t writable,
> - bool_t permanent)
> +static void *_hvm_map_guest_frame(unsigned long gfn, bool_t permanent,
> + bool_t *writable)
> {
> void *map;
> p2m_type_t p2mt;
> @@ -3618,7 +3618,12 @@ static void *__hvm_map_guest_frame(unsig
> }
>
> if ( writable )
I don't claim I know this piece of code, but checking the pointer but
not the content looks suspicious.
> - paging_mark_dirty(d, page_to_mfn(page));
> + {
> + if ( !p2m_is_discard_write(p2mt) )
> + paging_mark_dirty(d, page_to_mfn(page));
> + else
> + *writable = 0;
You then set *writable here, which makes it even more suspicious.
Wei.
next prev parent reply other threads:[~2015-07-24 10:26 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-24 9:41 [PATCH] x86/HVM: honor p2m_ram_ro in hvm_map_guest_frame_rw() Jan Beulich
2015-07-24 10:26 ` Wei Liu [this message]
2015-07-24 10:37 ` Jan Beulich
2015-07-24 10:41 ` Wei Liu
2015-07-24 12:02 ` Andrew Cooper
2015-07-24 12:33 ` Jan Beulich
2015-07-27 11:09 ` Tim Deegan
2015-08-11 13:51 ` Jan Beulich
2015-08-11 14:34 ` Tim Deegan
2015-08-11 15:37 ` Jan Beulich
2015-08-11 15:45 ` Tim Deegan
2015-08-11 16:01 ` Jan Beulich
2015-07-31 1:41 ` Tian, Kevin
2015-07-31 16:06 ` Boris Ostrovsky
2015-08-11 10:32 ` Jan Beulich
2015-08-14 10:38 ` Jan Beulich
2015-08-14 13:26 ` Boris Ostrovsky
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=20150724102647.GB30594@zion.uk.xensource.com \
--to=wei.liu2@citrix.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=aravind.gopalakrishnan@amd.com \
--cc=boris.ostrovsky@oracle.com \
--cc=eddie.dong@intel.com \
--cc=jun.nakajima@intel.com \
--cc=keir@xen.org \
--cc=kevin.tian@intel.com \
--cc=suravee.suthikulpanit@amd.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).