xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Wei Liu <wei.liu2@citrix.com>, Jan Beulich <JBeulich@suse.com>
Subject: [PATCH v6 4/9] x86/mm: add pv prefix to _put_final_page_type
Date: Tue, 13 Feb 2018 20:04:03 +0000	[thread overview]
Message-ID: <20180213200408.5463-5-wei.liu2@citrix.com> (raw)
In-Reply-To: <20180213200408.5463-1-wei.liu2@citrix.com>

... so that it is clear it is PV only and can be moved later.

No functional change intended.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 xen/arch/x86/mm.c           | 14 ++++++++++----
 xen/include/asm-x86/pv/mm.h |  7 +++++++
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 53212bcce3..64950354f4 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -2414,8 +2414,8 @@ int pv_free_page_type(struct page_info *page, unsigned long type,
 }
 
 
-static int _put_final_page_type(struct page_info *page, unsigned long type,
-                                bool preemptible, struct page_info *ptpg)
+int pv_put_final_page_type(struct page_info *page, unsigned long type,
+                           bool preemptible, struct page_info *ptpg)
 {
     int rc = pv_free_page_type(page, type, preemptible);
 
@@ -2473,6 +2473,12 @@ static int _put_page_type(struct page_info *page, bool preemptible,
             {
                 int rc;
 
+                /*
+                 * Only PV guests can enter this branch. HAP guests
+                 * can't use those page types.
+                 */
+                ASSERT(is_pv_domain(page_get_owner(page)));
+
                 /*
                  * Page-table pages must be unvalidated when count is zero. The
                  * 'free' is safe because the refcnt is non-zero and validated
@@ -2483,7 +2489,7 @@ static int _put_page_type(struct page_info *page, bool preemptible,
                                            x, nx)) != x) )
                     continue;
                 /* We cleared the 'valid bit' so we do the clean up. */
-                rc = _put_final_page_type(page, x, preemptible, ptpg);
+                rc = pv_put_final_page_type(page, x, preemptible, ptpg);
                 if ( x & PGT_partial )
                     put_page(page);
 
@@ -2497,7 +2503,7 @@ static int _put_page_type(struct page_info *page, bool preemptible,
                  * linear_pt_count lives in. Pages (including page table ones),
                  * however, don't need their flush time stamp set except when
                  * the last reference is being dropped. For page table pages
-                 * this happens in _put_final_page_type().
+                 * this happens in pv_put_final_page_type().
                  */
                 set_tlbflush_timestamp(page);
             }
diff --git a/xen/include/asm-x86/pv/mm.h b/xen/include/asm-x86/pv/mm.h
index abf798b541..ff9089ec19 100644
--- a/xen/include/asm-x86/pv/mm.h
+++ b/xen/include/asm-x86/pv/mm.h
@@ -35,6 +35,8 @@ int pv_alloc_page_type(struct page_info *page, unsigned long type,
                        bool preemptible);
 int pv_free_page_type(struct page_info *page, unsigned long type,
                       bool preemptible);
+int pv_put_final_page_type(struct page_info *page, unsigned long type,
+                           bool preemptible, struct page_info *ptpg);
 #else
 
 #include <xen/errno.h>
@@ -62,6 +64,11 @@ static inline int pv_alloc_page_type(struct page_info *page, unsigned long type,
 static inline int pv_free_page_type(struct page_info *page, unsigned long type,
                                     bool preemptible)
 { ASSERT_UNREACHABLE(); return -EINVAL; }
+static inline int pv_put_final_page_type(struct page_info *page,
+                                         unsigned long type,
+                                         bool preemptible,
+                                         struct page_info *ptpg)
+{ ASSERT_UNREACHABLE(); return -EINVAL; }
 
 #endif
 
-- 
2.11.0


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

  parent reply	other threads:[~2018-02-13 20:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-13 20:03 [PATCH v6 0/9] x86: refactor mm.c Wei Liu
2018-02-13 20:04 ` [PATCH v6 1/9] x86/mm: add pv prefix to {alloc, free}_page_type Wei Liu
2018-03-08 17:03   ` Jan Beulich
2018-03-08 17:05   ` Jan Beulich
2018-02-13 20:04 ` [PATCH v6 2/9] x86/mm: move disallow masks to pv/mm.h Wei Liu
2018-02-13 20:04 ` [PATCH v6 3/9] x86/mm: add disallow_mask parameter to get_page_from_l1e Wei Liu
2018-03-13 15:54   ` Jan Beulich
2018-03-19 12:10     ` Tim Deegan
2018-02-13 20:04 ` Wei Liu [this message]
2018-03-13 15:55   ` [PATCH v6 4/9] x86/mm: add pv prefix to _put_final_page_type Jan Beulich
2018-02-13 20:04 ` [PATCH v6 5/9] x86/mm: factor out pv_dec_linear_pt Wei Liu
2018-03-13 15:59   ` Jan Beulich
2018-02-13 20:04 ` [PATCH v6 6/9] x86/mm: export set_tlbflush_timestamp Wei Liu
2018-03-13 16:06   ` Jan Beulich
2018-02-13 20:04 ` [PATCH v6 7/9] x86/mm: provide put_page_type_ptpg{, _preemptible} Wei Liu
2018-03-13 16:10   ` Jan Beulich
2018-03-13 16:17   ` Jan Beulich
2018-02-13 20:04 ` [PATCH v6 8/9] x86/mm: move PV code to pv/mm.c Wei Liu
2018-02-13 20:04 ` [PATCH v6 9/9] x86/mm: remove now unused inclusion of pv/mm.h Wei Liu
2018-03-08 12:17 ` [PATCH v6 0/9] x86: refactor mm.c Wei Liu
2018-03-08 12:36   ` 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=20180213200408.5463-5-wei.liu2@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@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 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).