Skip to contentSkip to conversation

x86/idt: Unbreak MS HyperV hypercall vector install

PATCH In review Thomas Gleixner 4 participants 5 messages Sep 8, 2017 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/idt: Unbreak MS HyperV hypercall vector install

The rework of the IDT setup changed the way how unused system gates are accounted. At the end of the gate initialization all unused gates in the system vector area are set to the spurios handler and marked as used for consistency reasons.

Marking them as used breaks MS HyperV because it installs its hypercall vector after that point and the installation is guarded by the bit in the used_vectors map. So the hyperv vector stays directed to the spurious interrupt handler.

Leave them marked as unused again and unbreak HyperV that way.

Fixes dc20b2d52653 ("x86/idt: Move interrupt gate initialization to IDT code")
---
 arch/x86/kernel/idt.c |    1 -
 1 file changed, 1 deletion(-)
arch/x86/kernel/idt.c +0 -1
@@ -320,7 +320,6 @@ void __init idt_setup_apic_and_irq_gates
 
 	for_each_clear_bit_from(i, used_vectors, NR_VECTORS) {
 #ifdef CONFIG_X86_LOCAL_APIC
-		set_bit(i, used_vectors);
 		set_intr_gate(i, spurious_interrupt);
 #else
 		entry = irq_entries_start + 8 * (i - FIRST_EXTERNAL_VECTOR);
#1 lore raw
Quoted 27 lines

-----Original Message-----
From: Thomas Gleixner [mailto:[email protected]]
Sent: Friday, September 8, 2017 4:20 AM
To: LKML <[email protected]>
Cc: Stephen Hemminger <[email protected]>; Simon Xiao <[email protected]>; KY Srinivasan <[email protected]>; Haiyang Zhang <[email protected]>; Steven Rostedt <[email protected]>; Peter Zijlstra <[email protected]>; Linus Torvalds <torvalds@linux- foundation.org>; Josh Poimboeuf <[email protected]>; H. Peter Anvin <[email protected]>; Denys Vlasenko <[email protected]>; Brian Gerst <[email protected]>; Borislav Petkov <[email protected]>; Andy Lutomirski <[email protected]>
Subject: [PATCH] x86/idt: Unbreak MS HyperV hypercall vector install

The rework of the IDT setup changed the way how unused system gates are accounted. At the end of the gate initialization all unused gates in the system vector area are set to the spurios handler and marked as used for consistency reasons.

Marking them as used breaks MS HyperV because it installs its hypercall vector after that point and the installation is guarded by the bit in the
used_vectors map. So the hyperv vector stays directed to the spurious interrupt handler.

Quoted 6 lines

Leave them marked as unused again and unbreak HyperV that way.

Fixes dc20b2d52653 ("x86/idt: Move interrupt gate initialization to IDT

code")

Thanks for the quick response.
I tested the patch and the kernel boots up on Hyper-V now.

Reviewed-and-Tested-by Haiyang Zhang <[email protected]>
Tested-by on v1 1/1
#2 lore raw
In reply to Thomas Gleixner
Quoted 10 lines · On Fri, 8 Sep 2017 01:19:52 -0700 "Thomas Gleixner" <[email protected]> wrote:

The rework of the IDT setup changed the way how unused system gates are accounted. At the end of the gate initialization all unused gates in the system vector area are set to the spurios handler and marked as used for consistency reasons.

Marking them as used breaks MS HyperV because it installs its hypercall vector after that point and the installation is guarded by the bit in the used_vectors map. So the hyperv vector stays directed to the spurious interrupt handler.

Quoted 6 lines

Leave them marked as unused again and unbreak HyperV that way.

Fixes dc20b2d52653 ("x86/idt: Move interrupt gate initialization to IDT

code")

This fixes it, thanks.

#3 lore raw
Quoted 15 lines · Stephen Hemminger
Quoted 12 lines · On Fri, 8 Sep 2017 01:19:52 -0700 "Thomas Gleixner" <[email protected]> wrote:

The rework of the IDT setup changed the way how unused system gates are accounted. At the end of the gate initialization all unused gates in the system vector area are set to the spurios handler and marked as used for consistency reasons.

Marking them as used breaks MS HyperV because it installs its hypercall vector after that point and the installation is guarded by the bit in the used_vectors map. So the hyperv vector stays directed to the spurious interrupt handler.

Leave them marked as unused again and unbreak HyperV that way.

Quoted 8 lines
Quoted 4 lines
Fixes dc20b2d52653 ("x86/idt: Move interrupt gate initialization to IDT

code")

This fixes it, thanks.

What's the reason that the vector is not set up early in the boot process?

Thanks,

tglx

#4 lore raw
Quoted 39 lines

-----Original Message-----
From: Thomas Gleixner [mailto:[email protected]]
Sent: Friday, September 8, 2017 10:09 AM
To: Stephen Hemminger <[email protected]>
Cc: LKML <[email protected]>; Stephen Hemminger <[email protected]>; Simon Xiao <[email protected]>; KY Srinivasan <[email protected]>; Haiyang Zhang <[email protected]>; Steven Rostedt <[email protected]>; Peter Zijlstra <[email protected]>; Linus Torvalds <torvalds@linux- foundation.org>; Josh Poimboeuf <[email protected]>; H. Peter Anvin <[email protected]>; Denys Vlasenko <[email protected]>; Brian Gerst <[email protected]>; Borislav Petkov <[email protected]>; Andy Lutomirski <[email protected]>
Subject: Re: [PATCH] x86/idt: Unbreak MS HyperV hypercall vector install

Quoted 4 lines · Stephen Hemminger
Quoted 1 line · On Fri, 8 Sep 2017 01:19:52 -0700 "Thomas Gleixner" <[email protected]> wrote:

The rework of the IDT setup changed the way how unused system gates

are

Quoted 16 lines
Quoted 15 lines

accounted. At the end of the gate initialization all unused gates in the system vector area are set to the spurios handler and marked as used for consistency reasons.

Marking them as used breaks MS HyperV because it installs its hypercall vector after that point and the installation is guarded by the bit in the used_vectors map. So the hyperv vector stays directed to the spurious interrupt handler.

Leave them marked as unused again and unbreak HyperV that way.

Fixes dc20b2d52653 ("x86/idt: Move interrupt gate initialization to IDT

code")

Quoted 5 lines
Quoted 3 lines

This fixes it, thanks.

What's the reason that the vector is not set up early in the boot process?

No specific reason other than that was the way I had coded it up initially. I will send in a patch to fix that.

Regards,

K. Y

Quoted 5 lines

Thanks,

tglx