mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: joeyli <jlee@suse.com>, Julian Wollrath <jwollrath@web.de>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	x86@kernel.org, LKML <linux-kernel@vger.kernel.org>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [RESEND] Fast TSC calibration fails with v3.14-rc1 and later
Date: Wed, 12 Mar 2014 14:30:31 +0100	[thread overview]
Message-ID: <53642014.xoKWERQIvL@vostro.rjw.lan> (raw)
In-Reply-To: <1902317.cSAIh6fs84@vostro.rjw.lan>

On Wednesday, March 12, 2014 12:20:02 PM Rafael J. Wysocki wrote:
> On Wednesday, March 12, 2014 12:00:07 PM joeyli wrote:
> > Hi Julian, 
> > 
> > 於 二,2014-03-11 於 18:15 +0100,Julian Wollrath 提到:
> > > Am Tue, 11 Mar 2014 14:56:41 +0100 (CET)
> > > schrieb Thomas Gleixner <tglx@linutronix.de>:
> > > > > Ok, via bisecting I found commit
> > > > > 73f7d1ca32638028e3271f54616773727e2f9f26 (see below) to be the one
> > > > > that introduced this regression.
> > > > 
> > > > Interesting. I have no idea what's going on. But maybe can the ACPI
> > > > folks shed some light on it.
> > > 
> > 
> > My patch moved acpi_early_init() to before timekeeping_init() is for
> > prepare the later using ACPI TAD to set system clock. I think that
> > because acpi_early_init() setup SCI interrupt and enable acpi subsystem,
> > it causes fast TSC calibration fail.
> > 
> > > I have absolutely no idea, if it is the right thing to do and why it
> > > works, but the patch below fixes the problem. Thank you for your help.
> > > 
> > > 
> > > Cheers,
> > > Julian Wollrath
> > > 
> > > From 7664f495039d93adfce073e58840a46549904f04 Mon Sep 17 00:00:00 2001
> > > From: Julian Wollrath <jwollrath@web.de>
> > > Date: Tue, 11 Mar 2014 18:05:43 +0100
> > > Subject: [PATCH] Fix fast TSC calibration
> > > 
> > > Since commit 73f7d1ca32638028e3271f54616773727e2f9f26 the fast TSC calibration
> > > failed on a Thinkpad X121e with an AMD E450 APU. Moving acpi_early_init() after
> > > late_time_init() fixes this.
> > > 
> > > Signed-off-by: Julian Wollrath <jwollrath@web.de>
> > > ---
> > >  init/main.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/init/main.c b/init/main.c
> > > index eb03090cdced..bf9d99148bd6 100644
> > > --- a/init/main.c
> > > +++ b/init/main.c
> > > @@ -561,7 +561,6 @@ asmlinkage void __init start_kernel(void)
> > >  	init_timers();
> > >  	hrtimers_init();
> > >  	softirq_init();
> > > -	acpi_early_init();
> > >  	timekeeping_init();
> > >  	time_init();
> > >  	sched_clock_postinit();
> > > @@ -609,6 +608,7 @@ asmlinkage void __init start_kernel(void)
> > >  	numa_policy_init();
> > >  	if (late_time_init)
> > >  		late_time_init();
> > > +	acpi_early_init();
> > >  	sched_clock_init();
> > >  	calibrate_delay();
> > >  	pidmap_init();
> > 
> > The late_time_init() dependent on timekeeping_init(), if we don't want
> > move acpi_early_init() before timekeeping_init() then just direct put it
> > before efi_enter_virtual_mode() because we tested this changed.
> > 
> > This patch restricts the position to run acpi_early_init() before
> > timekeeping_init() when only "CMOS RTC Not Present" bit set in FADT.
> > 
> > Could you please help to test it on your machine?
> > 
> > 
> > Thanks a lot!
> > Joey Lee
> > 
> > 
> > >From 8ef4fff76dd2f50bef1e8eb9c96f3b0228a38401 Mon Sep 17 00:00:00 2001
> > From: Lee, Chun-Yi <jlee@suse.com>
> > Date: Wed, 12 Mar 2014 11:36:32 +0800
> > Subject: [PATCH] ACPI / init: Run acpi_early_init() before timekeeping_init() when CMOS RTC Not Present bit set
> > 
> > This is a variant patch from Rafael J. Wysocki's
> > ACPI / init: Run acpi_early_init() before efi_enter_virtual_mode()
> > 
> > According to Matt Fleming, if acpi_early_init() was executed before
> > efi_enter_virtual_mode(), the EFI initialization could benefit from
> > it, so Rafael's patch makes that happen.
> > 
> > And, later we want accessing ACPI TAD device to set system clock, so
> > move acpi_early_init() before timekeeping_init() when "CMOS RTC Not
> > Present" bit set. This position is also before efi_enter_virtual_mode().
> > 
> > Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
> > ---
> >  init/main.c |    7 ++++++-
> >  1 files changed, 6 insertions(+), 1 deletions(-)
> > 
> > diff --git a/init/main.c b/init/main.c
> > index eb03090..e1b69d2 100644
> > --- a/init/main.c
> > +++ b/init/main.c
> > @@ -561,7 +561,9 @@ asmlinkage void __init start_kernel(void)
> >  	init_timers();
> >  	hrtimers_init();
> >  	softirq_init();
> > -	acpi_early_init();
> > +	if (acpi_gbl_FADT.header.revision >= 5 &&
> > +	    acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC)
> > +		acpi_early_init();
> 
> Sorry, this is not the right way to address that.
> 
> First of all, checking fields in acpi_gbl_FADT from anything in init/main.c
> is wrong.  If anything, please move that check to acpi_early_init().  And
> make it check it if it's been called already.
> 
> >  	timekeeping_init();
> >  	time_init();
> >  	sched_clock_postinit();
> > @@ -613,6 +615,9 @@ asmlinkage void __init start_kernel(void)
> >  	calibrate_delay();
> >  	pidmap_init();
> >  	anon_vma_init();
> > +	if (!(acpi_gbl_FADT.header.revision >= 5 &&
> > +	      acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC))
> > +		acpi_early_init();
> 
> And then you can call it here again.
> 
> >  #ifdef CONFIG_X86
> >  	if (efi_enabled(EFI_RUNTIME_SERVICES))
> >  		efi_enter_virtual_mode();
> > 
> 
> But I wonder: Can we simply enable SCI later?  In other words, can we
> split acpi_early_init() so that the part before acpi_enable_subsystem()
> is done before timekeeping_init() and the part including and after
> is done right after anon_vma_init()?  Would the TAD initialization work
> then?

Below is a patch implementing that idea.  Julian, can you please test this one too?

Rafael

---
 drivers/acpi/bus.c   |   20 +++++++++++++++-----
 include/linux/acpi.h |    1 +
 init/main.c          |    1 +
 3 files changed, 17 insertions(+), 5 deletions(-)

Index: linux-pm/drivers/acpi/bus.c
===================================================================
--- linux-pm.orig/drivers/acpi/bus.c
+++ linux-pm/drivers/acpi/bus.c
@@ -494,11 +494,21 @@ void __init acpi_early_init(void)
 	}
 
 	status = acpi_load_tables();
-	if (ACPI_FAILURE(status)) {
-		printk(KERN_ERR PREFIX
-		       "Unable to load the System Description Tables\n");
-		goto error0;
-	}
+	if (ACPI_SUCCESS(status))
+		return;
+
+	printk(KERN_ERR PREFIX "Unable to load the System Description Tables\n");
+
+ error0:
+	disable_acpi();
+}
+
+void __init acpi_subsystem_init(void)
+{
+	acpi_status status;
+
+	if (acpi_disabled)
+		return;
 
 #ifdef CONFIG_X86
 	if (!acpi_ioapic) {
Index: linux-pm/include/linux/acpi.h
===================================================================
--- linux-pm.orig/include/linux/acpi.h
+++ linux-pm/include/linux/acpi.h
@@ -401,6 +401,7 @@ extern acpi_status acpi_pci_osc_control_
 #define ACPI_OST_SC_INSERT_NOT_SUPPORTED	0x82
 
 extern void acpi_early_init(void);
+extern void acpi_subsystem_init(void);
 
 extern int acpi_nvs_register(__u64 start, __u64 size);
 
Index: linux-pm/init/main.c
===================================================================
--- linux-pm.orig/init/main.c
+++ linux-pm/init/main.c
@@ -613,6 +613,7 @@ asmlinkage void __init start_kernel(void
 	calibrate_delay();
 	pidmap_init();
 	anon_vma_init();
+	acpi_subsystem_init();
 #ifdef CONFIG_X86
 	if (efi_enabled(EFI_RUNTIME_SERVICES))
 		efi_enter_virtual_mode();


  reply	other threads:[~2014-03-12 13:15 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-10 10:04 Julian Wollrath
2014-03-10 10:27 ` Paul Bolle
2014-03-10 14:06   ` Thomas Gleixner
2014-03-10 15:28     ` Paul Bolle
2014-03-10 17:04       ` Thomas Gleixner
2014-03-10 18:32         ` Paul Bolle
2014-03-10 18:57           ` Thomas Gleixner
2014-03-10 19:19             ` Paul Bolle
2014-03-10 20:50               ` Thomas Gleixner
2014-03-10 23:06                 ` Paul Bolle
2014-03-11 16:02                   ` Thomas Gleixner
2014-03-11 13:27       ` Julian Wollrath
2014-03-10 10:39 ` Thomas Gleixner
2014-03-11 13:29   ` Julian Wollrath
2014-03-11 13:56     ` Thomas Gleixner
2014-03-11 17:15       ` Julian Wollrath
2014-03-12  4:00         ` joeyli
2014-03-12 10:20           ` Julian Wollrath
2014-03-12 13:52             ` joeyli
2014-03-12 11:20           ` Rafael J. Wysocki
2014-03-12 13:30             ` Rafael J. Wysocki [this message]
2014-03-12 13:55               ` Julian Wollrath
2014-03-12 15:41               ` joeyli
2014-03-12 16:20                 ` Thomas Gleixner
2014-03-12 16:23                   ` Thomas Gleixner
2014-03-12 16:39                     ` Thomas Gleixner
2014-03-12 23:27                       ` Rafael J. Wysocki
2014-03-12 23:49                         ` Thomas Gleixner
2014-03-13  0:13                           ` Rafael J. Wysocki
2014-03-13  2:56                           ` joeyli
2014-03-13  0:54                         ` Thomas Gleixner
2014-03-13  1:01                           ` Thomas Gleixner
2014-03-13  2:38                           ` joeyli
2014-03-13  3:11                             ` H. Peter Anvin
2014-03-13  3:55                               ` joeyli
2014-03-13  3:59                                 ` H. Peter Anvin
2014-03-13  4:12                                   ` joeyli
2014-03-13  8:12                                     ` Thomas Gleixner
2014-03-13  8:59                                       ` joeyli
2014-03-13  3:41                           ` H. Peter Anvin
2014-03-12 14:00             ` joeyli

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=53642014.xoKWERQIvL@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=hpa@zytor.com \
    --cc=jlee@suse.com \
    --cc=jwollrath@web.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®