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

[RFC PATCH v2 23/34] x86/extable: Remove new dead code in ex_handler_msr()



The MSR read APIs no longer expect RAX or EDX:EAX to be cleared upon
returning from #GP caused by MSR read instructions.

The MSR safe APIs no longer assume -EIO being returned in a register
from #GP caused by MSR instructions.

Remove new dead code due to above changes.

Signed-off-by: Xin Li (Intel) <xin@xxxxxxxxx>
---
 arch/x86/mm/extable.c | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/arch/x86/mm/extable.c b/arch/x86/mm/extable.c
index 6bf4c2a43c2c..ea3fe7f32772 100644
--- a/arch/x86/mm/extable.c
+++ b/arch/x86/mm/extable.c
@@ -165,7 +165,7 @@ static bool ex_handler_uaccess(const struct 
exception_table_entry *fixup,
 }
 
 static bool ex_handler_msr(const struct exception_table_entry *fixup,
-                          struct pt_regs *regs, bool wrmsr, bool safe, int reg)
+                          struct pt_regs *regs, bool wrmsr, bool safe)
 {
        bool imm_insn = is_msr_imm_insn((void *)regs->ip);
        u32 msr;
@@ -207,17 +207,6 @@ static bool ex_handler_msr(const struct 
exception_table_entry *fixup,
                show_stack_regs(regs);
        }
 
-       if (!wrmsr) {
-               /* Pretend that the read succeeded and returned 0. */
-               regs->ax = 0;
-
-               if (!imm_insn)
-                       regs->dx = 0;
-       }
-
-       if (safe)
-               *pt_regs_nr(regs, reg) = -EIO;
-
        return ex_handler_default(fixup, regs);
 }
 
@@ -395,13 +384,13 @@ int fixup_exception(struct pt_regs *regs, int trapnr, 
unsigned long error_code,
                case EX_TYPE_BPF:
                        return ex_handler_bpf(e, regs);
                case EX_TYPE_WRMSR:
-                       return ex_handler_msr(e, regs, true, false, reg);
+                       return ex_handler_msr(e, regs, true, false);
                case EX_TYPE_RDMSR:
-                       return ex_handler_msr(e, regs, false, false, reg);
+                       return ex_handler_msr(e, regs, false, false);
                case EX_TYPE_WRMSR_SAFE:
-                       return ex_handler_msr(e, regs, true, true, reg);
+                       return ex_handler_msr(e, regs, true, true);
                case EX_TYPE_RDMSR_SAFE:
-                       return ex_handler_msr(e, regs, false, true, reg);
+                       return ex_handler_msr(e, regs, false, true);
                case EX_TYPE_WRMSR_IN_MCE:
                        ex_handler_msr_mce(regs, true);
                        break;
-- 
2.49.0




 


Rackspace

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