[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM5PR21MB0476F21DFE4BA884C83E8FD9A09E0@DM5PR21MB0476.namprd21.prod.outlook.com>
Date: Mon, 28 Aug 2017 14:35:52 +0000
From: KY Srinivasan <kys@...rosoft.com>
To: Thomas Gleixner <tglx@...utronix.de>,
LKML <linux-kernel@...r.kernel.org>
CC: Ingo Molnar <mingo@...nel.org>, Peter Anvin <hpa@...or.com>,
"Peter Zijlstra" <peterz@...radead.org>,
Andy Lutomirski <luto@...nel.org>,
"Borislav Petkov" <bp@...en8.de>,
Steven Rostedt <rostedt@...dmis.org>,
Juergen Gross <jgross@...e.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
"Boris Ostrovsky" <boris.ostrovsky@...cle.com>
Subject: RE: [patch V3 43/44] x86/idt: Simplify alloc_intr_gate
> -----Original Message-----
> From: Thomas Gleixner [mailto:tglx@...utronix.de]
> Sent: Sunday, August 27, 2017 11:48 PM
> To: LKML <linux-kernel@...r.kernel.org>
> Cc: Ingo Molnar <mingo@...nel.org>; Peter Anvin <hpa@...or.com>; Peter
> Zijlstra <peterz@...radead.org>; Andy Lutomirski <luto@...nel.org>;
> Borislav Petkov <bp@...en8.de>; Steven Rostedt <rostedt@...dmis.org>;
> Juergen Gross <jgross@...e.com>; KY Srinivasan <kys@...rosoft.com>;
> Stephen Hemminger <sthemmin@...rosoft.com>; Boris Ostrovsky
> <boris.ostrovsky@...cle.com>
> Subject: [patch V3 43/44] x86/idt: Simplify alloc_intr_gate
>
> The only users of alloc_intr_gate() are hypervisors, which both check the
> used_vectors bitmap whether they have allocated the gate already. Move
> that
> check into alloc_intr_gate() and simplify the users.
>
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> Reviewed-by: Juergen Gross <jgross@...e.com>
> Cc: "K. Y. Srinivasan" <kys@...rosoft.com>
Reviewed-by: K. Y. Srinivasan <kys@...rosoft.com>
> Cc: Stephen Hemminger <sthemmin@...rosoft.com>
> Cc: Boris Ostrovsky <boris.ostrovsky@...cle.com>
> Cc: Juergen Gross <jgross@...e.com>
> ---
> arch/x86/kernel/cpu/mshyperv.c | 9 ++-------
> arch/x86/kernel/idt.c | 6 +++---
> drivers/xen/events/events_base.c | 6 ++----
> 3 files changed, 7 insertions(+), 14 deletions(-)
>
> --- a/arch/x86/kernel/cpu/mshyperv.c
> +++ b/arch/x86/kernel/cpu/mshyperv.c
> @@ -59,13 +59,8 @@ void hyperv_vector_handler(struct pt_reg
> void hv_setup_vmbus_irq(void (*handler)(void))
> {
> vmbus_handler = handler;
> - /*
> - * Setup the IDT for hypervisor callback. Prevent reallocation
> - * at module reload.
> - */
> - if (!test_bit(HYPERVISOR_CALLBACK_VECTOR, used_vectors))
> - alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR,
> - hyperv_callback_vector);
> + /* Setup the IDT for hypervisor callback */
> + alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR,
> hyperv_callback_vector);
> }
>
> void hv_remove_vmbus_irq(void)
> --- a/arch/x86/kernel/idt.c
> +++ b/arch/x86/kernel/idt.c
> @@ -354,7 +354,7 @@ void set_intr_gate(unsigned int n, const
>
> void alloc_intr_gate(unsigned int n, const void *addr)
> {
> - BUG_ON(test_bit(n, used_vectors) || n < FIRST_SYSTEM_VECTOR);
> - set_bit(n, used_vectors);
> - set_intr_gate(n, addr);
> + BUG_ON(n < FIRST_SYSTEM_VECTOR);
> + if (!test_and_set_bit(n, used_vectors))
> + set_intr_gate(n, addr);
> }
> --- a/drivers/xen/events/events_base.c
> +++ b/drivers/xen/events/events_base.c
> @@ -1653,10 +1653,8 @@ void xen_callback_vector(void)
> return;
> }
> pr_info("Xen HVM callback vector for event delivery is
> enabled\n");
> - /* in the restore case the vector has already been allocated
> */
> - if (!test_bit(HYPERVISOR_CALLBACK_VECTOR,
> used_vectors))
> - alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR,
> - xen_hvm_callback_vector);
> + alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR,
> + xen_hvm_callback_vector);
> }
> }
> #else
>
Powered by blists - more mailing lists