From: Alexandru Chirvasitu <achirvasub@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>,
kernel list <linux-kernel@vger.kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@alien8.de>,
Brian Gerst <brgerst@gmail.com>,
Denys Vlasenko <dvlasenk@redhat.com>,
"H. Peter Anvin" <hpa@zytor.com>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@kernel.org>
Subject: PROBLEM: consolidated IDT invalidation causes kexec to reboot
Date: Sat, 23 Dec 2017 20:44:15 -0500 [thread overview]
Message-ID: <20171224014415.GA5663@chirva-void> (raw)
Short description: loading a crash kernel with (a) kexec -l [..] or
(b) kexec -p [..] and then testing it with (a) kexec -e or (b) echo c
> /proc/sysrq-trigger results in a regular reboot (going through BIOS,
etc.).
The commit that starts exhibiting this behaviour for me is
e802a51: x86/idt: Consolidate IDT invalidation
with its parent 8f55868 behaving normally (in scenarios (a) and (b)
alike; (b) produces /proc/vmcore, etc.).
For testing purposes, I've altered machine_kexec_32.c making the
following toy commit. It naively undoes part of e802a51, solely to
confirm that's where it goes awry in my setup.
----------------------------------------------
machine_kexec calls set_idt instead of idt_invalidate for testing purposes
diff --git a/arch/x86/kernel/machine_kexec_32.c b/arch/x86/kernel/machine_kexec_32.c
index 00bc751..70f7d05 100644
--- a/arch/x86/kernel/machine_kexec_32.c
+++ b/arch/x86/kernel/machine_kexec_32.c
@@ -26,6 +26,19 @@
#include <asm/set_memory.h>
#include <asm/debugreg.h>
+
+
+static void set_idt(void *newidt, __u16 limit)
+{
+ struct desc_ptr curidt;
+
+ /* ia32 supports unaliged loads & stores */
+ curidt.size = limit;
+ curidt.address = (unsigned long)newidt;
+
+ load_idt(&curidt);
+}
+
static void set_gdt(void *newgdt, __u16 limit)
{
struct desc_ptr curgdt;
@@ -233,7 +246,7 @@ void machine_kexec(struct kimage *image)
* If you want to load them you must set up your own idt & gdt.
*/
set_gdt(phys_to_virt(0), 0);
- idt_invalidate(phys_to_virt(0));
+ set_idt(phys_to_virt(0), 0);
/* now call it */
image->start = relocate_kernel_ptr((unsigned long)image->head
----------------------------------------------
The kernel compiled with these changes restores kexec functionality on
the machine I'm trying it on:
ASUS F5RL Core(TM)2 Duo CPU T5450 @ 1.66GHz
on Debian stable 9.3 32 bit. The loading command I use:
kexec [-l|-p] /boot/dump/vmlinuz-4.14.8-dump --initrd=/boot/dump/initrd.img-4.14.8-dump --append="root=/dev/sda1 1 irqpoll nr_cpus=1 reset_devices"
The nr_cpus=1 is a remnant I left in there; the dump kernel is an
SMP-disabled version of the latest stable one (4.14.8).
Is this expected behaviour?
The issue emerged while reporting a CPU lockup in another email
thread; as this seems different, I figured it wouldn't hurt to send
out a separate message.
Thank you.
next reply other threads:[~2017-12-24 1:42 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-24 1:44 Alexandru Chirvasitu [this message]
2017-12-24 3:30 ` PROBLEM: consolidated IDT invalidation causes kexec to reboot Linus Torvalds
2017-12-24 7:28 ` Alexandru Chirvasitu
2017-12-24 11:28 ` Ingo Molnar
2017-12-24 15:27 ` Alexandru Chirvasitu
2017-12-24 16:40 ` Alexandru Chirvasitu
2017-12-25 9:47 ` Ingo Molnar
2017-12-25 14:40 ` Andy Lutomirski
2017-12-25 21:29 ` Alexandru Chirvasitu
2017-12-26 18:51 ` Linus Torvalds
2017-12-26 19:26 ` hpa
2017-12-26 23:19 ` Alexandru Chirvasitu
2017-12-26 23:39 ` hpa
2017-12-26 23:40 ` hpa
2017-12-26 23:45 ` hpa
2017-12-27 2:16 ` Linus Torvalds
2017-12-27 2:25 ` hpa
2017-12-27 2:54 ` Linus Torvalds
2017-12-27 3:00 ` hpa
2017-12-28 1:30 ` Konrad Rzeszutek Wilk
2017-12-27 4:41 ` Alexandru Chirvasitu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171224014415.GA5663@chirva-void \
--to=achirvasub@gmail.com \
--cc=bp@alien8.de \
--cc=brgerst@gmail.com \
--cc=dvlasenk@redhat.com \
--cc=hpa@zytor.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox