From: "Jan Beulich" <JBeulich@suse.com>
To: Wei Ye <wei.ye@intel.com>
Cc: keir@xen.org, ian.campbell@citrix.com,
stefano.stabellini@eu.citrix.com, Tim Deegan <tim@xen.org>,
ian.jackson@eu.citrix.com, xen-devel@lists.xen.org,
Paul.Durrant@citrix.com
Subject: Re: [PATCH v1 1/2] x86: add p2m_ram_wp
Date: Mon, 28 Jul 2014 09:31:38 +0100 [thread overview]
Message-ID: <53D6268A02000078000266CA@mail.emea.novell.com> (raw)
In-Reply-To: <1406570127-3616-2-git-send-email-wei.ye@intel.com>
>>> On 28.07.14 at 19:55, <wei.ye@intel.com> wrote:
> xen/arch/x86/hvm/hvm.c | 8 +++++++-
> xen/arch/x86/mm/p2m-ept.c | 1 +
> xen/include/asm-x86/p2m.h | 8 +++++++-
> 3 files changed, 15 insertions(+), 2 deletions(-)
This can't be complete: At the very least p2m-pt.c also needs a change
similar to the one to p2m-ept.c.
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -2738,7 +2738,8 @@ int hvm_hap_nested_page_fault(paddr_t gpa,
> * If this GFN is emulated MMIO or marked as read-only, pass the fault
> * to the mmio handler.
> */
> - if ( (p2mt == p2m_mmio_dm) ||
> + if ( (p2mt == p2m_mmio_dm) ||
> + (p2mt == p2m_ram_wp) ||
> (access_w && (p2mt == p2m_ram_ro)) )
Comparing your change with the surrounding existing code, you
would pass even reads happening to fault (perhaps for another
reason) to the DM, other than done for p2m_ram_ro. I don't think
that's correct.
> @@ -3829,6 +3830,11 @@ static enum hvm_copy_result __hvm_copy(
> put_page(page);
> return HVMCOPY_unhandleable;
> }
> + if ( p2m_is_wp_ram(p2mt) )
> + {
> + put_page(page);
> + return HVMCOPY_bad_gfn_to_mfn;
> + }
And again this change can't be complete: __hvm_clear() would also
need a similar change.
> @@ -167,6 +169,9 @@ typedef unsigned int p2m_query_t;
> * and must not be touched. */
> #define P2M_BROKEN_TYPES (p2m_to_mask(p2m_ram_broken))
>
> +/* Write protection types */
> +#define P2M_WP_TYPES (p2m_to_mask(p2m_ram_wp))
> +
> /* Useful predicates */
> #define p2m_is_ram(_t) (p2m_to_mask(_t) & P2M_RAM_TYPES)
> #define p2m_is_hole(_t) (p2m_to_mask(_t) & P2M_HOLE_TYPES)
> @@ -191,6 +196,7 @@ typedef unsigned int p2m_query_t;
> #define p2m_is_any_ram(_t) (p2m_to_mask(_t) & \
> (P2M_RAM_TYPES | P2M_GRANT_TYPES | \
> p2m_to_mask(p2m_map_foreign)))
> +#define p2m_is_wp_ram(_t) (p2m_to_mask(_t) & P2M_WP_TYPES)
To me such single-type classes don't seem very useful. Agreed
there are a number of pre-existing ones, but for classes where
future extensions are rather hard to imagine I wouldn't needlessly
add classes right away. But Tim (whom you failed to Cc anyway)
will have the final say here.
Jan
next prev parent reply other threads:[~2014-07-28 8:31 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-28 17:55 [PATCH v1 0/2] Extend ioreq-server to support page write protection Wei Ye
2014-07-28 8:24 ` Jan Beulich
2014-08-04 5:05 ` Ye, Wei
2014-08-04 7:35 ` Jan Beulich
2014-08-04 21:34 ` Tian, Kevin
2014-08-05 6:35 ` Jan Beulich
2014-08-05 6:46 ` Ye, Wei
2014-08-05 7:51 ` Jan Beulich
2014-08-05 7:35 ` Zhang, Yang Z
2014-08-05 7:51 ` Jan Beulich
2014-08-05 8:20 ` Ye, Wei
2014-08-05 15:41 ` Tian, Kevin
2014-08-06 2:11 ` Zhang, Yang Z
2014-08-06 2:33 ` Tian, Kevin
2014-08-06 2:40 ` Zhang, Yang Z
2014-08-06 2:49 ` Tian, Kevin
2014-08-06 2:50 ` Tian, Kevin
2014-08-06 3:04 ` Zhang, Yang Z
2014-08-06 15:00 ` Konrad Rzeszutek Wilk
2014-08-06 16:08 ` Tian, Kevin
2014-08-07 6:45 ` Jan Beulich
2014-08-07 16:28 ` Tian, Kevin
2014-08-08 6:32 ` Jan Beulich
2014-08-08 16:02 ` Tian, Kevin
2014-08-08 16:04 ` Tian, Kevin
2014-08-12 23:15 ` Ye, Wei
2014-08-13 8:38 ` Tim Deegan
2014-08-13 16:14 ` Tian, Kevin
2014-08-14 8:08 ` Tim Deegan
2014-08-14 17:49 ` Tian, Kevin
2014-08-14 20:25 ` Tim Deegan
2014-08-14 22:53 ` Tian, Kevin
2014-08-14 23:12 ` Jan Beulich
2014-08-14 23:33 ` Tian, Kevin
2014-08-06 17:38 ` Tian, Kevin
2014-07-28 17:55 ` [PATCH v1 1/2] x86: add p2m_ram_wp Wei Ye
2014-07-28 8:31 ` Jan Beulich [this message]
2014-08-04 5:10 ` Ye, Wei
2014-08-04 7:37 ` Jan Beulich
2014-08-05 7:09 ` Ye, Wei
2014-07-28 17:55 ` [PATCH v1 2/2] ioreq-server: Support scatter page forwarding Wei Ye
2014-07-28 8:57 ` Jan Beulich
2014-08-04 5:41 ` Ye, Wei
2014-08-04 7:47 ` Jan Beulich
2014-08-04 21:39 ` Tian, Kevin
2014-08-05 6:38 ` Jan Beulich
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=53D6268A02000078000266CA@mail.emea.novell.com \
--to=jbeulich@suse.com \
--cc=Paul.Durrant@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=keir@xen.org \
--cc=stefano.stabellini@eu.citrix.com \
--cc=tim@xen.org \
--cc=wei.ye@intel.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 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).