Skip to contentSkip to conversation

x86/platform/hyperv: When on Hyper-v use NULL legacy PIC

PATCH In review K. Y. Srinivasan 4 participants 10 messages Apr 4, 2014 – Apr 7, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/platform/hyperv: When on Hyper-v use NULL legacy PIC

Use the NULL legacy PIC when on Hyper-V. With this change we can support kexec even when booting on EFI firmware. This patch has been tested on both EFI as well as non-EFI firmware stacks on Hyper-V.

This patch is required to support kexec on EFI firmware on Hyper-V. Please apply.

---
 arch/x86/kernel/cpu/mshyperv.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)
arch/x86/kernel/cpu/mshyperv.c +2 -8
index 76f98fe..47359f7 100644
@@ -133,14 +133,8 @@ static void __init ms_hyperv_init_platform(void)
 		printk(KERN_INFO "HyperV: LAPIC Timer Frequency: %#x\n",
 				lapic_timer_frequency);
 
-		/*
-		 * On Hyper-V, when we are booting off an EFI firmware stack,
-		 * we do not have many legacy devices including PIC, PIT etc.
-		 */
-		if (efi_enabled(EFI_BOOT)) {
-			printk(KERN_INFO "HyperV: Using null_legacy_pic\n");
-			legacy_pic = &null_legacy_pic;
-		}
+		printk(KERN_INFO "HyperV: Using null_legacy_pic\n");
+		legacy_pic = &null_legacy_pic;
 	}
 #endif
 
Signature · 1 line
1.7.4.1
#1 lore raw

[tip:x86/hyperv] x86, hyperv: When on Hyper-v use NULL legacy PIC

x86, hyperv: When on Hyper-v use NULL legacy PIC
Commit-ID:  8df28b82ff0649dd293f0469b97792cfb9ed10ab
Gitweb:     http://git.kernel.org/tip/8df28b82ff0649dd293f0469b97792cfb9ed10ab
Author:     K. Y. Srinivasan <[email protected]>
AuthorDate: Thu, 3 Apr 2014 18:16:33 -0700
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Thu, 3 Apr 2014 22:00:13 -0700

x86, hyperv: When on Hyper-v use NULL legacy PIC

Use the NULL legacy PIC when on Hyper-V. With this change we can support kexec even when booting on EFI firmware. This patch has been tested on both EFI as well as non-EFI firmware stacks on Hyper-V.

This patch is required to support kexec on EFI firmware on Hyper-V. Please apply.

[ hpa: HyperV in EFI mode doesn't include a legacy PIC, and apparently doesn't stub it out in a meaningful way. This becomes an issue after kexec if the second kernel doesn't know it is EFI-booted. Since HyperV presumably never actually *needs* the legacy PIC, we can just disable it. ]

---
 arch/x86/kernel/cpu/mshyperv.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
arch/x86/kernel/cpu/mshyperv.c +2 -8
index 832d05a..b7d82c7 100644
@@ -93,14 +93,8 @@ static void __init ms_hyperv_init_platform(void)
 		printk(KERN_INFO "HyperV: LAPIC Timer Frequency: %#x\n",
 				lapic_timer_frequency);
 
-		/*
-		 * On Hyper-V, when we are booting off an EFI firmware stack,
-		 * we do not have many legacy devices including PIC, PIT etc.
-		 */
-		if (efi_enabled(EFI_BOOT)) {
-			printk(KERN_INFO "HyperV: Using null_legacy_pic\n");
-			legacy_pic = &null_legacy_pic;
-		}
+		printk(KERN_INFO "HyperV: Using null_legacy_pic\n");
+		legacy_pic = &null_legacy_pic;
 	}
 #endif
 
#2 lore raw
In reply to K. Y. Srinivasan
Quoted 6 lines · K. Y. Srinivasan

Use the NULL legacy PIC when on Hyper-V. With this change we can support kexec even when booting on EFI firmware. This patch has been tested on both EFI as well as non-EFI firmware stacks on Hyper-V.

This patch is required to support kexec on EFI firmware on Hyper-V. Please apply.

Can you give some more details about what's the problem we run into with kexec on EFI on hyper-V.

Now EFI should be enabled in kexeced kernel. That means efi_enabled(EFI_BOOT) should be true and that means you would set legacy_pic to null anyway.

So with this patch, what changed w.r.t kexec on EFI.

Thansk
Vivek

Quoted 36 lines
---
 arch/x86/kernel/cpu/mshyperv.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)
arch/x86/kernel/cpu/mshyperv.c +2 -8
index 76f98fe..47359f7 100644
@@ -133,14 +133,8 @@ static void __init ms_hyperv_init_platform(void)
 		printk(KERN_INFO "HyperV: LAPIC Timer Frequency: %#x\n",
 				lapic_timer_frequency);
 
-		/*
-		 * On Hyper-V, when we are booting off an EFI firmware stack,
-		 * we do not have many legacy devices including PIC, PIT etc.
-		 */
-		if (efi_enabled(EFI_BOOT)) {
-			printk(KERN_INFO "HyperV: Using null_legacy_pic\n");
-			legacy_pic = &null_legacy_pic;
-		}
+		printk(KERN_INFO "HyperV: Using null_legacy_pic\n");
+		legacy_pic = &null_legacy_pic;
 	}
 #endif
 
Signature · 7 lines
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
#3 lore raw
Quoted 20 lines

-----Original Message-----
From: Vivek Goyal [mailto:[email protected]]
Sent: Friday, April 4, 2014 7:12 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; KY Srinivasan; [email protected]
Subject: Re: [PATCH 1/1] x86/platform/hyperv: When on Hyper-v use NULL legacy PIC

Quoted 6 lines · K. Y. Srinivasan

Use the NULL legacy PIC when on Hyper-V. With this change we can support kexec even when booting on EFI firmware. This patch has been tested on both EFI as well as non-EFI firmware stacks on Hyper-V.

This patch is required to support kexec on EFI firmware on Hyper-V. Please apply.

Quoted 8 lines

Can you give some more details about what's the problem we run into with kexec on EFI on hyper-V.

Now EFI should be enabled in kexeced kernel. That means efi_enabled(EFI_BOOT) should be true and that means you would set legacy_pic to null anyway.

So with this patch, what changed w.r.t kexec on EFI.

Vivek,

On Hyper-V EFI firmware stack we have to set the legacy PIC to NULL legacy PIC since legacy PIC is not emulated and if this were not set to NULL legacy PIC, we would crash in PIC based calibration code. Hypervisor gives us the calibration information so we don't need PIC based calibration.

Even on non-EFI firmware, the hypervisor gives us the calibration information and so, we can set the legacy PIC to NULL legacy PIC unconditionally.

The problem we were having is that the initial boot on the EFI firmware would succeed as the legacy PIC would be NULL legacy PIC, however in the kexeced kernel, the initial boot information is not available and so we would not set the legacy PIC to NULL legacy PIC. Thus, we would crash in PIC based calibration code in the kexeced kernel.

Since we don't need legacy PIC both on EFI and non-EFI firmware, we can set the legacy PIC to NULL legacy PIC unconditionally.

K. Y

Quoted 42 lines

Thansk
Vivek

Quoted 12 lines
---
 arch/x86/kernel/cpu/mshyperv.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)
(quoted diff) +0 -0

b/arch/x86/kernel/cpu/mshyperv.c index 76f98fe..47359f7 100644

arch/x86/kernel/cpu/mshyperv.c static void __init ms_hyperv_init_platform(void) · line 137

Quoted 5 lines
arch/x86/kernel/cpu/mshyperv.c +0 -2
@@ -133,14 +133,8 @@ static void __init ms_hyperv_init_platform(void)
 		printk(KERN_INFO "HyperV: LAPIC Timer Frequency: %#x\n",
 				lapic_timer_frequency);
 
-		/*
-		 * On Hyper-V, when we are booting off an EFI firmware

stack,

arch/x86/kernel/cpu/mshyperv.c static void __init ms_hyperv_init_platform(void)

Quoted 4 lines
arch/x86/kernel/cpu/mshyperv.c +0 -4
-		 * we do not have many legacy devices including PIC, PIT etc.
-		 */
-		if (efi_enabled(EFI_BOOT)) {
-			printk(KERN_INFO "HyperV: Using

null_legacy_pic\n");

Quoted 15 lines
arch/x86/kernel/cpu/mshyperv.c +2 -3
-			legacy_pic = &null_legacy_pic;
-		}
+		printk(KERN_INFO "HyperV: Using null_legacy_pic\n");
+		legacy_pic = &null_legacy_pic;
 	}
 #endif
 
--

1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#4 lore raw

On Fri, Apr 04, 2014 at 03:01:51PM +0000, KY Srinivasan wrote:

[..]

Quoted 4 lines

The problem we were having is that the initial boot on the EFI firmware would succeed as the legacy PIC would be NULL legacy PIC, however in the kexeced kernel, the initial boot information is not available and so we would not set the legacy PIC to NULL legacy PIC.

I am curious to know what "initial boot information" is not available in kexeced kernel and who is supposed to provide that.

Is it a bug or that's how it is supposed to work.

Thanks
Vivek

#5 lore raw
Quoted 20 lines

-----Original Message-----
From: Vivek Goyal [mailto:[email protected]]
Sent: Friday, April 4, 2014 8:16 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Dave Young
Subject: Re: [PATCH 1/1] x86/platform/hyperv: When on Hyper-v use NULL legacy PIC

On Fri, Apr 04, 2014 at 03:01:51PM +0000, KY Srinivasan wrote:

[..]

Quoted 4 lines

The problem we were having is that the initial boot on the EFI firmware would succeed as the legacy PIC would be NULL legacy PIC, however in the kexeced kernel, the initial boot information is not available and so we would not set the legacy PIC to NULL legacy PIC.

Quoted 4 lines

I am curious to know what "initial boot information" is not available in kexeced kernel and who is supposed to provide that.

Is it a bug or that's how it is supposed to work.

As the name indicates, the dump kernel is not "booted" but it is kexeced. In the address space of this second kernel, the initial boot state is not visible. This is the way it is supposed to work.

K. Y

Quoted 3 lines

Thanks
Vivek

#6 lore raw
Quoted 20 lines · KY Srinivasan
Quoted 20 lines

-----Original Message-----
From: Vivek Goyal [mailto:[email protected]]
Sent: Friday, April 4, 2014 8:16 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Dave Young
Subject: Re: [PATCH 1/1] x86/platform/hyperv: When on Hyper-v use NULL legacy PIC

On Fri, Apr 04, 2014 at 03:01:51PM +0000, KY Srinivasan wrote:

[..]

Quoted 4 lines

The problem we were having is that the initial boot on the EFI firmware would succeed as the legacy PIC would be NULL legacy PIC, however in the kexeced kernel, the initial boot information is not available and so we would not set the legacy PIC to NULL legacy PIC.

Quoted 7 lines
Quoted 4 lines

I am curious to know what "initial boot information" is not available in kexeced kernel and who is supposed to provide that.

Is it a bug or that's how it is supposed to work.

As the name indicates, the dump kernel is not "booted" but it is kexeced. In the address space of this second kernel, the initial boot state is not visible.

What do you mean by "initial boot state"? Most of the state we pass to second kernel in bootparams and on command line and rest second kernel can query from firmware as needed.

Thanks
Vivek

#7 lore raw
Quoted 38 lines

-----Original Message-----
From: Vivek Goyal [mailto:[email protected]]
Sent: Friday, April 4, 2014 1:32 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Dave Young
Subject: Re: [PATCH 1/1] x86/platform/hyperv: When on Hyper-v use NULL legacy PIC

Quoted 25 lines · KY Srinivasan
Quoted 24 lines

-----Original Message-----
From: Vivek Goyal [mailto:[email protected]]
Sent: Friday, April 4, 2014 8:16 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Dave Young
Subject: Re: [PATCH 1/1] x86/platform/hyperv: When on Hyper-v use NULL legacy PIC

On Fri, Apr 04, 2014 at 03:01:51PM +0000, KY Srinivasan wrote:

[..]

Quoted 4 lines

The problem we were having is that the initial boot on the EFI firmware would succeed as the legacy PIC would be NULL legacy PIC, however in the kexeced kernel, the initial boot information is not available and so we would not set the legacy PIC to NULL legacy PIC.

I am curious to know what "initial boot information" is not available in kexeced kernel and who is supposed to provide that.

Is it a bug or that's how it is supposed to work.

Quoted 7 lines
Quoted 2 lines

As the name indicates, the dump kernel is not "booted" but it is kexeced. In the address space of this second kernel, the initial boot state is not

visible.

What do you mean by "initial boot state"? Most of the state we pass to second kernel in bootparams and on command line and rest second kernel can query from firmware as needed.

Specifically, this check I had:
if (efi_enabled(EFI_BOOT)) {
}

Fails in the kexeced kernel even when running on EFI firmware.

K. Y

#8 lore raw
In reply to K. Y. Srinivasan

arch/x86/kernel/cpu/mshyperv.c static void __init ms_hyperv_init_platform(void) · line 136

Quoted 1 line · K. Y. Srinivasan
arch/x86/kernel/cpu/mshyperv.c +1 -0
+		printk(KERN_INFO "HyperV: Using null_legacy_pic\n");

Maybe this printk can be removed as well, unless its valuable info.

Olaf

#9 lore raw
Quoted 11 lines

-----Original Message-----
From: Olaf Hering [mailto:[email protected]]
Sent: Monday, April 7, 2014 12:06 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] x86/platform/hyperv: When on Hyper-v use NULL legacy PIC

Quoted 5 lines

arch/x86/kernel/cpu/mshyperv.c static void __init ms_hyperv_init_platform(void) · line 136

Quoted 1 line · K. Y. Srinivasan
arch/x86/kernel/cpu/mshyperv.c +1 -0
+		printk(KERN_INFO "HyperV: Using null_legacy_pic\n");

Maybe this printk can be removed as well, unless its valuable info.

I will take a look at this.

K. Y

Quoted 2 lines

Olaf