x86: Introduce a new option --reuse-video-type
Subsystems (2)
PATCH v2 1/1 x86: Introduce a new option --reuse-video-type
After commit 060eee58 "x86: use old screen_info if needed", kexec-tools will force use old screen_info and vga type if failed to determine current vga type. But it is not always a good idea.
Currently kernel hanging is inspected on some hyper-v VMs after this commit, because hyperv_fb will mimic EFI (or VESA) VGA on first boot up, but after the real driver is loaded, it will switch to new mode and no longer compatible with EFI/VESA VGA. Keep setting orig_video_isVGA to EFI/VESA VGA flag will get wrong driver loaded and try to manipulate the framebuffer in a wrong way.
We can't ensure this won't happen on other framebuffer drivers, But it's a helpful feature if the framebuffer drivers just work. So this patch introduce a --reuse-video-type options to let user decide if the old screen_info hould be used unconditional or not.
---
Update from V1:
- Fix a fd leak
- Rename the option from --force-vga to --reuse-video-type
kexec/arch/i386/include/arch/options.h | 2 ++ kexec/arch/i386/kexec-x86.h | 1 + kexec/arch/i386/x86-linux-setup.c | 8 ++++++-- kexec/arch/x86_64/kexec-x86_64.c | 5 +++++ 4 files changed, 14 insertions(+), 2 deletions(-)
kexec/arch/i386/include/arch/options.h +2 -0
@@ -32,6 +32,7 @@#define OPT_ENTRY_32BIT (OPT_ARCH_MAX+10)#define OPT_PASS_MEMMAP_CMDLINE (OPT_ARCH_MAX+11)#define OPT_NOEFI (OPT_ARCH_MAX+12) +#define OPT_REUSE_VIDEO_TYPE (OPT_ARCH_MAX+13)/* Options relevant to the architecture (excluding loader-specific ones): */ #define KEXEC_ARCH_OPTIONS \
@@ -45,6 +46,7 @@ { "elf64-core-headers", 0, 0, OPT_ELF64_CORE }, \ { "pass-memmap-cmdline", 0, 0, OPT_PASS_MEMMAP_CMDLINE }, \ { "noefi", 0, 0, OPT_NOEFI}, \ + { "reuse-video-type", 0, 0, OPT_REUSE_VIDEO_TYPE }, \ #define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR ""
kexec/arch/i386/kexec-x86.h +1 -0
@@ -52,6 +52,7 @@ struct arch_options_t {enum coretype core_header_type;uint8_t pass_memmap_cmdline;uint8_t noefi; +uint8_t reuse_video_type; };int multiboot_x86_probe (const char *buf,off_t len);
kexec/arch/i386/x86-linux-setup.c +6 -2
@@ -144,7 +144,7 @@ static int setup_linux_vesafb(struct x86_linux_param_header *real_mode) }else if (0 ==strcmp (fix.id,"EFI VGA" )) {/* VIDEO_TYPE_EFI */ real_mode->orig_video_isVGA =0x70 ; - }else { + }else if (arch_options.reuse_video_type) {int err; off_t offset = offsetof(typeof(*real_mode), orig_video_isVGA);
@@ -152,6 +152,10 @@ static int setup_linux_vesafb(struct x86_linux_param_header *real_mode) err =get_bootparam (&real_mode->orig_video_isVGA, offset,1 );if (err) goto out; + }else { + real_mode->orig_video_isVGA =0 ; +close (fd); +return 0 ; }close (fd);
@@ -844,7 +848,7 @@ void setup_linux_system_parameters(struct kexec_info *info,setup_subarch (real_mode);if (bzImage_support_efi_boot && !arch_options.noefi)setup_efi_info (info, real_mode); - +/* Default screen size */ real_mode->orig_x =0 ; real_mode->orig_y =0 ;
kexec/arch/x86_64/kexec-x86_64.c +5 -0
@@ -55,6 +55,7 @@ void arch_usage(void)" --console-serial Enable the serial console\n" " --pass-memmap-cmdline Pass memory map via command line in kexec on panic case\n" " --noefi Disable efi support\n" +" --reuse-video-type Reuse old boot time video type blindly\n" ); }
@@ -67,6 +68,7 @@ struct arch_options_t arch_options = { .core_header_type = CORE_TYPE_ELF64, .pass_memmap_cmdline = 0, .noefi = 0, + .reuse_video_type = 0, };int arch_process_options (int argc,char **argv)
@@ -136,6 +138,9 @@ int arch_process_options(int argc, char **argv)case OPT_NOEFI : arch_options.noefi =1 ;break ; +case OPT_REUSE_VIDEO_TYPE : + arch_options.reuse_video_type =1 ; +break ; } }/* Reset getopt for the next pass; called in other source modules */
Signature · 7 lines
2.20.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Quoted 128 lines · Kairui Song
After commit
060eee58"x86: use oldscreen_infoif needed", kexec-tools will force use oldscreen_infoand vga type if failed to determine current vga type. But it is not always a good idea.Currently kernel hanging is inspected on some hyper-v VMs after this commit, because
hyperv_fbwill mimic EFI (or VESA) VGA on first boot up, but after the real driver is loaded, it will switch to new mode and no longer compatible with EFI/VESA VGA. Keep settingorig_video_isVGAto EFI/VESA VGA flag will get wrong driver loaded and try to manipulate the framebuffer in a wrong way.We can't ensure this won't happen on other framebuffer drivers, But it's a helpful feature if the framebuffer drivers just work. So this patch introduce a --reuse-video-type options to let user decide if the old
screen_infohould be used unconditional or not.Signed-off-by Kairui Song <[email protected]>---
Update from V1:
- Fix a fd leak
- Rename the option from --force-vga to --reuse-video-typekexec/arch/i386/include/arch/options.h | 2 ++ kexec/arch/i386/kexec-x86.h | 1 + kexec/arch/i386/x86-linux-setup.c | 8 ++++++-- kexec/arch/x86_64/kexec-x86_64.c | 5 +++++ 4 files changed, 14 insertions(+), 2 deletions(-)kexec/arch/i386/include/arch/options.h +2
-0@@ -32,6 +32,7 @@#define OPT_ENTRY_32BIT (OPT_ARCH_MAX+10)#define OPT_PASS_MEMMAP_CMDLINE (OPT_ARCH_MAX+11)#define OPT_NOEFI (OPT_ARCH_MAX+12) +#define OPT_REUSE_VIDEO_TYPE (OPT_ARCH_MAX+13)/* Options relevant to the architecture (excluding loader-specific ones): */ #define KEXEC_ARCH_OPTIONS \@@ -45,6 +46,7 @@ { "elf64-core-headers", 0, 0, OPT_ELF64_CORE }, \ { "pass-memmap-cmdline", 0, 0, OPT_PASS_MEMMAP_CMDLINE }, \ { "noefi", 0, 0, OPT_NOEFI}, \ + { "reuse-video-type", 0, 0, OPT_REUSE_VIDEO_TYPE }, \ #define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR ""kexec/arch/i386/kexec-x86.h +1
-0@@ -52,6 +52,7 @@ struct arch_options_t {enum coretype core_header_type;uint8_t pass_memmap_cmdline;uint8_t noefi; +uint8_t reuse_video_type; };int multiboot_x86_probe (const char *buf,off_t len);kexec/arch/i386/x86-linux-setup.c +6
-2@@ -144,7 +144,7 @@ static int setup_linux_vesafb(struct x86_linux_param_header *real_mode) }else if (0 ==strcmp (fix.id,"EFI VGA" )) {/* VIDEO_TYPE_EFI */ real_mode->orig_video_isVGA =0x70 ; - }else { + }else if (arch_options.reuse_video_type) {int err; off_t offset = offsetof(typeof(*real_mode), orig_video_isVGA);@@ -152,6 +152,10 @@ static int setup_linux_vesafb(struct x86_linux_param_header *real_mode) err =get_bootparam (&real_mode->orig_video_isVGA, offset,1 );if (err) goto out; + }else { + real_mode->orig_video_isVGA =0 ; +close (fd); +return 0 ; }close (fd);@@ -844,7 +848,7 @@ void setup_linux_system_parameters(struct kexec_info *info,setup_subarch (real_mode);if (bzImage_support_efi_boot && !arch_options.noefi)setup_efi_info (info, real_mode); - +/* Default screen size */ real_mode->orig_x =0 ; real_mode->orig_y =0 ;kexec/arch/x86_64/kexec-x86_64.c +5
-0@@ -55,6 +55,7 @@ void arch_usage(void)" --console-serial Enable the serial console\n" " --pass-memmap-cmdline Pass memory map via command line in kexec on panic case\n" " --noefi Disable efi support\n" +" --reuse-video-type Reuse old boot time video type blindly\n" ); }@@ -67,6 +68,7 @@ struct arch_options_t arch_options = { .core_header_type = CORE_TYPE_ELF64, .pass_memmap_cmdline = 0, .noefi = 0, + .reuse_video_type = 0, };int arch_process_options (int argc,char **argv)@@ -136,6 +138,9 @@ int arch_process_options(int argc, char **argv)case OPT_NOEFI : arch_options.noefi =1 ;break ; +case OPT_REUSE_VIDEO_TYPE : + arch_options.reuse_video_type =1 ; +break ; } }/* Reset getopt for the next pass; called in other source modules */ Signature · 1 line
2.20.1
Thanks
Dave
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Simon Horman
AppliedQuoted 18 lines · Dave Young
Quoted 17 lines · Kairui Song
After commit
060eee58"x86: use oldscreen_infoif needed", kexec-tools will force use oldscreen_infoand vga type if failed to determine current vga type. But it is not always a good idea.Currently kernel hanging is inspected on some hyper-v VMs after this commit, because
hyperv_fbwill mimic EFI (or VESA) VGA on first boot up, but after the real driver is loaded, it will switch to new mode and no longer compatible with EFI/VESA VGA. Keep settingorig_video_isVGAto EFI/VESA VGA flag will get wrong driver loaded and try to manipulate the framebuffer in a wrong way.We can't ensure this won't happen on other framebuffer drivers, But it's a helpful feature if the framebuffer drivers just work. So this patch introduce a --reuse-video-type options to let user decide if the old
screen_infohould be used unconditional or not.Signed-off-by Kairui Song <[email protected]>
...
Quoted 1 line
Reviewed-by Dave Young <[email protected]>
Thanks, applied
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec