All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konstantin Baydarov <kbaidarov@ru.mvista.com>
To: Daniel Walker <dwalker@mvista.com>
Cc: RT <linux-rt-users@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kexec: reenable HPET before kexec
Date: Tue, 21 Aug 2007 17:01:41 +0400	[thread overview]
Message-ID: <20070821170141.70a95dac@windmill.dev.rtsoft.ru> (raw)
In-Reply-To: <1187645464.7732.43.camel@imap.mvista.com>

On Mon, 20 Aug 2007 14:31:04 -0700
Daniel Walker <dwalker@mvista.com> wrote:

> On Tue, 2007-08-21 at 01:10 +0400, Konstantin Baydarov wrote:
> 
> It was in your original email ..  Are you saying this it is not a
> problem in plain 2.6.23-rc2? I thought I read that it was a problem on
> i386 ..
> 
> Daniel
> 

I can reproduce bug with plain 2.6.23-rc3 i386 kernel, without RT patch,
on pentiumd.
So I fixed this issue the same way as I fixed RT kernel. The side effect
of this fix is that when kernel 2 executes both Local APIC timer and HPET
are enabled and produce timer interrupts:
root@192.168.40.10:~# cat /proc/interrupts
           CPU0       CPU1
  0:       5643          0   IO-APIC-edge      timer
  1:          8          0   IO-APIC-edge      i8042
  2:          0          0    XT-PIC-XT        cascade
  4:        303        181   IO-APIC-edge      serial
  6:          3          0   IO-APIC-edge      floppy
 12:          4          0   IO-APIC-edge      i8042
 14:         11          0   IO-APIC-edge      ide0
 17:       5701         16   IO-APIC-fasteoi   uhci_hcd:usb3, eth0
 18:          0          0   IO-APIC-fasteoi   uhci_hcd:usb4
 19:          0          0   IO-APIC-fasteoi   uhci_hcd:usb5
 20:         38          0   IO-APIC-fasteoi   ehci_hcd:usb1, uhci_hcd:usb2
 23:          3          0   IO-APIC-fasteoi   libata
NMI:          0          0
LOC:       5525       5489
ERR:          0
MIS:          0
root@192.168.40.10:~#

IRQ0 and LOC values practically the same.

Also I didn't see this bug on linux-rt-users@vger.kernel.org, maybe I should
resend it?

Patch against 2.6.23-rc3.

Signed-off-by: Konstantin Baydarov <kbaidarov@ru.mvista.com>

 arch/i386/kernel/hpet.c          |   15 +++++++++++++++
 arch/i386/kernel/machine_kexec.c |    5 +++++
 include/asm-i386/hpet.h          |    3 +++
 3 files changed, 23 insertions(+)

Index: linux-2.6.23-rc3-i386/arch/i386/kernel/hpet.c
===================================================================
--- linux-2.6.23-rc3-i386.orig/arch/i386/kernel/hpet.c
+++ linux-2.6.23-rc3-i386/arch/i386/kernel/hpet.c
@@ -340,6 +340,21 @@ out_nohpet:
 	return 0;
 }
 
+#ifdef CONFIG_KEXEC
+/*
+ * reenable HPET timer
+ */
+int hpet_reenable(void)
+{
+	if (!is_hpet_capable())
+		return -1;
+
+	if (hpet_clockevent.mode != CLOCK_EVT_MODE_PERIODIC)
+		hpet_set_mode(CLOCK_EVT_MODE_PERIODIC, &hpet_clockevent);
+
+	return 0;
+}
+#endif
 
 #ifdef CONFIG_HPET_EMULATE_RTC
 
Index: linux-2.6.23-rc3-i386/arch/i386/kernel/machine_kexec.c
===================================================================
--- linux-2.6.23-rc3-i386.orig/arch/i386/kernel/machine_kexec.c
+++ linux-2.6.23-rc3-i386/arch/i386/kernel/machine_kexec.c
@@ -19,6 +19,7 @@
 #include <asm/cpufeature.h>
 #include <asm/desc.h>
 #include <asm/system.h>
+#include <asm/hpet.h>
 
 #define PAGE_ALIGNED __attribute__ ((__aligned__(PAGE_SIZE)))
 static u32 kexec_pgd[1024] PAGE_ALIGNED;
@@ -109,6 +110,10 @@ NORET_TYPE void machine_kexec(struct kim
 	/* Interrupts aren't acceptable while we reboot */
 	local_irq_disable();
 
+#ifdef CONFIG_HPET_TIMER
+	hpet_reenable();
+#endif
+
 	control_page = page_address(image->control_code_page);
 	memcpy(control_page, relocate_kernel, PAGE_SIZE);
 
Index: linux-2.6.23-rc3-i386/include/asm-i386/hpet.h
===================================================================
--- linux-2.6.23-rc3-i386.orig/include/asm-i386/hpet.h
+++ linux-2.6.23-rc3-i386/include/asm-i386/hpet.h
@@ -66,6 +66,9 @@
 extern unsigned long hpet_address;
 extern int is_hpet_enabled(void);
 extern int hpet_enable(void);
+#ifdef CONFIG_KEXEC
+extern int hpet_reenable(void);
+#endif
 
 #ifdef CONFIG_HPET_EMULATE_RTC
 

  reply	other threads:[~2007-08-21 12:55 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-20 16:55 [PATCH] kexec: reenable HPET before kexec Konstantin Baydarov
2007-08-20 18:26 ` Andi Kleen
2007-08-20 21:10 ` Konstantin Baydarov
2007-08-20 21:31   ` Daniel Walker
2007-08-21 13:01     ` Konstantin Baydarov [this message]
2007-08-23  9:08 ` Vivek Goyal
2007-08-23 11:49   ` Konstantin Baydarov
2007-08-27  5:36     ` Vivek Goyal
2007-08-27 18:26       ` Pallipadi, Venkatesh
2007-08-27 18:33         ` Eric W. Biederman
2007-08-28 12:58         ` Konstantin Baydarov
2007-08-28 12:58           ` Konstantin Baydarov
2007-08-30  7:32           ` Eric W. Biederman
2007-08-30  7:32             ` Eric W. Biederman
2007-08-30 16:07             ` Konstantin Baydarov
2007-08-30 16:07               ` Konstantin Baydarov
2007-08-30 18:04               ` Eric W. Biederman
2007-08-30 18:04                 ` Eric W. Biederman
2007-08-30 18:04                 ` Eric W. Biederman
2007-08-31 10:31                 ` Konstantin Baydarov
2007-08-31 10:31                   ` Konstantin Baydarov
2007-09-17  9:47                   ` Konstantin Baydarov
2007-09-17  9:47                     ` Konstantin Baydarov

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=20070821170141.70a95dac@windmill.dev.rtsoft.ru \
    --to=kbaidarov@ru.mvista.com \
    --cc=dwalker@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.