[xen master] x86emul: adjust handling of AVX2 gathers

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen master] x86emul: adjust handling of AVX2 gathers

patchbot
commit 35a61c05ea9dbc8edb95c2e110103110c230a5c1
Author:     Jan Beulich <[hidden email]>
AuthorDate: Thu Apr 26 18:02:37 2018 +0200
Commit:     Jan Beulich <[hidden email]>
CommitDate: Thu Apr 26 18:02:37 2018 +0200

    x86emul: adjust handling of AVX2 gathers
   
    HVM's MMIO cache only has a capacity of three entries. Once running out
    of entries, hvmemul_linear_mmio_access() will return
    X86EMUL_UNHANDLEABLE. Since gathers are an iterative process anyway,
    simply commit the portion of work done in this and hypothetical similar
    cases, exiting back to guest context for the insn to be retried.
   
    Signed-off-by: Jan Beulich <[hidden email]>
    Acked-by: Andrew Cooper <[hidden email]>
    Release-acked-by: Juergen Gross <[hidden email]>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 3389050ab4..8ffda8384a 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -7639,6 +7639,7 @@ x86_emulate(
             int32_t dw[8];
             int64_t qw[4];
         } index, mask;
+        bool done = false;
 
         ASSERT(ea.type == OP_MEM);
         generate_exception_if(modrm_reg == state->sib_index ||
@@ -7692,12 +7693,23 @@ x86_emulate(
                                ea.mem.off + (idx << state->sib_scale),
                                (void *)mmvalp + i * op_bytes, op_bytes, ctxt);
                 if ( rc != X86EMUL_OKAY )
+                {
+                    /*
+                     * If we've made any progress and the access did not fault,
+                     * force a retry instead. This is for example necessary to
+                     * cope with the limited capacity of HVM's MMIO cache.
+                     */
+                    if ( rc != X86EMUL_EXCEPTION && done )
+                        rc = X86EMUL_RETRY;
                     break;
+                }
 
 #ifdef __XEN__
                 if ( i + 1 < n && local_events_need_delivery() )
                     rc = X86EMUL_RETRY;
 #endif
+
+                done = true;
             }
 
             if ( vex.w )
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog