[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] mem_access: Fix npfec.kind propagation



commit f736a3b7285384529de932055856be0703f8ac20
Author:     George Dunlap <george.dunlap@xxxxxxxxxx>
AuthorDate: Thu Sep 27 12:25:36 2018 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed Oct 17 14:46:45 2018 +0100

    mem_access: Fix npfec.kind propagation
    
    The name of the "with_gla" flag is confusing; it has nothing to do
    with the existence or lack thereof of a faulting GLA, but rather where
    the fault originated.  The npfec.kind value is always valid, and
    should thus be propagated, regardless of whether gla_valid is set or
    not.
    
    In particular, gla_valid will never be set on AMD systems; but
    npfec.kind will still be valid and should still be propagated.
    
    Signed-off-by: Alexandru Isaila <aisaila@xxxxxxxxxxxxxxx>
    Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Alexandru Isaila <aisaila@xxxxxxxxxxxxxxx>
    Acked-by: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>
---
 xen/arch/x86/mm/mem_access.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/mm/mem_access.c b/xen/arch/x86/mm/mem_access.c
index 2b5a6217db..2f1295e56a 100644
--- a/xen/arch/x86/mm/mem_access.c
+++ b/xen/arch/x86/mm/mem_access.c
@@ -228,16 +228,24 @@ bool p2m_mem_access_check(paddr_t gpa, unsigned long gla,
         req->reason = VM_EVENT_REASON_MEM_ACCESS;
         req->u.mem_access.gfn = gfn_x(gfn);
         req->u.mem_access.offset = gpa & ((1 << PAGE_SHIFT) - 1);
+
         if ( npfec.gla_valid )
         {
             req->u.mem_access.flags |= MEM_ACCESS_GLA_VALID;
             req->u.mem_access.gla = gla;
+        }
 
-            if ( npfec.kind == npfec_kind_with_gla )
-                req->u.mem_access.flags |= MEM_ACCESS_FAULT_WITH_GLA;
-            else if ( npfec.kind == npfec_kind_in_gpt )
-                req->u.mem_access.flags |= MEM_ACCESS_FAULT_IN_GPT;
+        switch ( npfec.kind )
+        {
+        case npfec_kind_with_gla:
+            req->u.mem_access.flags |= MEM_ACCESS_FAULT_WITH_GLA;
+            break;
+
+        case npfec_kind_in_gpt:
+            req->u.mem_access.flags |= MEM_ACCESS_FAULT_IN_GPT;
+            break;
         }
+
         req->u.mem_access.flags |= npfec.read_access    ? MEM_ACCESS_R : 0;
         req->u.mem_access.flags |= npfec.write_access   ? MEM_ACCESS_W : 0;
         req->u.mem_access.flags |= npfec.insn_fetch     ? MEM_ACCESS_X : 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.