mirror of https://gitee.com/openkylin/linux.git
x86/entry: Use run_sysvec_on_irqstack_cond() for XEN upcall
To avoid yet another macro implementation reuse the existing run_sysvec_on_irqstack_cond() and move the set_irq_regs() handling into the called function. Makes the code even simpler. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20210210002512.869753106@linutronix.de
This commit is contained in:
parent
5b51e1db9b
commit
359f01d181
|
@ -245,30 +245,23 @@ static __always_inline bool get_and_clear_inhcall(void) { return false; }
|
||||||
static __always_inline void restore_inhcall(bool inhcall) { }
|
static __always_inline void restore_inhcall(bool inhcall) { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void __xen_pv_evtchn_do_upcall(void)
|
static void __xen_pv_evtchn_do_upcall(struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
irq_enter_rcu();
|
struct pt_regs *old_regs = set_irq_regs(regs);
|
||||||
|
|
||||||
inc_irq_stat(irq_hv_callback_count);
|
inc_irq_stat(irq_hv_callback_count);
|
||||||
|
|
||||||
xen_hvm_evtchn_do_upcall();
|
xen_hvm_evtchn_do_upcall();
|
||||||
|
|
||||||
irq_exit_rcu();
|
set_irq_regs(old_regs);
|
||||||
}
|
}
|
||||||
|
|
||||||
__visible noinstr void xen_pv_evtchn_do_upcall(struct pt_regs *regs)
|
__visible noinstr void xen_pv_evtchn_do_upcall(struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
struct pt_regs *old_regs;
|
irqentry_state_t state = irqentry_enter(regs);
|
||||||
bool inhcall;
|
bool inhcall;
|
||||||
irqentry_state_t state;
|
|
||||||
|
|
||||||
state = irqentry_enter(regs);
|
run_sysvec_on_irqstack_cond(__xen_pv_evtchn_do_upcall, regs);
|
||||||
old_regs = set_irq_regs(regs);
|
|
||||||
|
|
||||||
instrumentation_begin();
|
|
||||||
run_on_irqstack_cond(__xen_pv_evtchn_do_upcall, regs);
|
|
||||||
instrumentation_end();
|
|
||||||
|
|
||||||
set_irq_regs(old_regs);
|
|
||||||
|
|
||||||
inhcall = get_and_clear_inhcall();
|
inhcall = get_and_clear_inhcall();
|
||||||
if (inhcall && !WARN_ON_ONCE(state.exit_rcu)) {
|
if (inhcall && !WARN_ON_ONCE(state.exit_rcu)) {
|
||||||
|
|
Loading…
Reference in New Issue