xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86: get_page_from_gfn() should not return misleading type
@ 2017-06-08 15:21 Jan Beulich
  2017-06-09 17:22 ` Andrew Cooper
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2017-06-08 15:21 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper

[-- 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86: get_page_from_gfn() should not return misleading type
  2017-06-08 15:21 [PATCH] x86: get_page_from_gfn() should not return misleading type Jan Beulich
@ 2017-06-09 17:22 ` Andrew Cooper
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cooper @ 2017-06-09 17:22 UTC (permalink / raw)
  To: Jan Beulich, xen-devel

On 08/06/17 16:21, Jan Beulich wrote:
> 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>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-09 17:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-08 15:21 [PATCH] x86: get_page_from_gfn() should not return misleading type Jan Beulich
2017-06-09 17:22 ` Andrew Cooper

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).