From: "Jan Beulich" <JBeulich@suse.com>
To: xen-devel <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [PATCH] x86: get_page_from_gfn() should not return misleading type
Date: Thu, 08 Jun 2017 09:21:09 -0600 [thread overview]
Message-ID: <593987850200007800160F0E@prv-mh.provo.novell.com> (raw)
In-Reply-To: 593987850200007800160F0E@prv-mh.provo.novell.com
[-- Attachment #1: Type: text/plain, Size: 842 bytes --]
It is not impossible that the page owner is dom_io. While no current
caller cares about this case, let's nevertheless return an appropriate
type even in that case.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -479,9 +479,9 @@ static inline struct page_info *get_page
if ( paging_mode_translate(d) )
return get_page_from_gfn_p2m(d, p2m_get_hostp2m(d), gfn, t, NULL, q);
- /* Non-translated guests see 1-1 RAM mappings everywhere */
- if (t)
- *t = p2m_ram_rw;
+ /* Non-translated guests see 1-1 RAM / MMIO mappings everywhere */
+ if ( t )
+ *t = likely(d != dom_io) ? p2m_ram_rw : p2m_mmio_direct;
page = __mfn_to_page(gfn);
return mfn_valid(_mfn(gfn)) && get_page(page, d) ? page : NULL;
}
[-- Attachment #2: x86-gpfg-type.patch --]
[-- Type: text/plain, Size: 898 bytes --]
x86: get_page_from_gfn() should not return misleading type
It is not impossible that the page owner is dom_io. While no current
caller cares about this case, let's nevertheless return an appropriate
type even in that case.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -479,9 +479,9 @@ static inline struct page_info *get_page
if ( paging_mode_translate(d) )
return get_page_from_gfn_p2m(d, p2m_get_hostp2m(d), gfn, t, NULL, q);
- /* Non-translated guests see 1-1 RAM mappings everywhere */
- if (t)
- *t = p2m_ram_rw;
+ /* Non-translated guests see 1-1 RAM / MMIO mappings everywhere */
+ if ( t )
+ *t = likely(d != dom_io) ? p2m_ram_rw : p2m_mmio_direct;
page = __mfn_to_page(gfn);
return mfn_valid(_mfn(gfn)) && get_page(page, d) ? page : NULL;
}
[-- Attachment #3: Type: text/plain, Size: 127 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next parent reply other threads:[~2017-06-08 15:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-08 15:21 Jan Beulich [this message]
2017-06-09 17:22 ` [PATCH] x86: get_page_from_gfn() should not return misleading type Andrew Cooper
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=593987850200007800160F0E@prv-mh.provo.novell.com \
--to=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).