linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Matthew Garrett <mjg@redhat.com>
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org
Subject: Re: [PATCH 1/4] X86: Revamp reboot behaviour to match Windows more closely
Date: Fri, 11 Mar 2011 23:08:18 +0100	[thread overview]
Message-ID: <201103112308.18221.rjw@sisk.pl> (raw)
In-Reply-To: <1299877940-6870-1-git-send-email-mjg@redhat.com>

On Friday, March 11, 2011, Matthew Garrett wrote:
> Windows reboots by hitting the ACPI reboot vector (if available), trying
> the keyboard controller, hitting the ACPI reboot vector again and then
> giving the keyboard controller one last go. Rework our reboot process a
> little to default to matching this behaviour, although we'll fall through
> to attempting a triple fault if nothing else works.

Does this fix a particular problem observed in practice?

Rafael


> Signed-off-by: Matthew Garrett <mjg@redhat.com>
> ---
>  arch/x86/kernel/reboot.c |   23 ++++++++++++++++++++++-
>  1 files changed, 22 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
> index 715037c..2b8d03c 100644
> --- a/arch/x86/kernel/reboot.c
> +++ b/arch/x86/kernel/reboot.c
> @@ -35,7 +35,7 @@ EXPORT_SYMBOL(pm_power_off);
>  
>  static const struct desc_ptr no_idt = {};
>  static int reboot_mode;
> -enum reboot_type reboot_type = BOOT_KBD;
> +enum reboot_type reboot_type = BOOT_ACPI;
>  int reboot_force;
>  
>  #if defined(CONFIG_X86_32) && defined(CONFIG_SMP)
> @@ -547,9 +547,23 @@ void __attribute__((weak)) mach_reboot_fixups(void)
>  {
>  }
>  
> +/*
> + * Windows does the following on reboot:
> + * 1) If the FADT has the ACPI reboot register flag set, try it
> + * 2) If still alive, write to the keyboard controller
> + * 3) If still alive, write to the ACPI reboot register again
> + * 4) If still alive, write to the keyboard controller again
> + *
> + * If the machine is still alive at this stage, it gives up. We default to
> + * following the same pattern, except that if we're still alive after (4) we'll
> + * try to force a triple fault and then cycle between hitting the keyboard
> + * controller and doing that
> + */
>  static void native_machine_emergency_restart(void)
>  {
>  	int i;
> +	int attempt = 0;
> +	int orig_reboot_type = reboot_type;
>  
>  	if (reboot_emergency)
>  		emergency_vmx_disable_all();
> @@ -571,6 +585,13 @@ static void native_machine_emergency_restart(void)
>  				outb(0xfe, 0x64); /* pulse reset low */
>  				udelay(50);
>  			}
> +			if (attempt == 0 && orig_reboot_type == BOOT_ACPI) {
> +				attempt = 1;
> +				reboot_type = BOOT_ACPI;
> +			} else {
> +				reboot_type = BOOT_TRIPLE;
> +			}
> +			break;
>  
>  		case BOOT_TRIPLE:
>  			load_idt(&no_idt);
> 


  parent reply	other threads:[~2011-03-11 22:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-11 21:12 [PATCH 1/4] X86: Revamp reboot behaviour to match Windows more closely Matthew Garrett
2011-03-11 21:12 ` [PATCH 2/4] ACPICA: Fix access width for reset vector Matthew Garrett
2011-03-23  3:52   ` Len Brown
2011-03-11 21:12 ` [PATCH 3/4] ACPI: Bug compatibility for Windows on the ACPI reboot vector Matthew Garrett
2011-03-23  3:52   ` Len Brown
2011-03-11 21:12 ` [PATCH 4/4] ACPI: Make sure the FADT is at least rev 2 before using the reset register Matthew Garrett
2011-03-23  4:01   ` Len Brown
2011-03-23 10:59     ` Matthew Garrett
2011-03-11 22:08 ` Rafael J. Wysocki [this message]
2011-03-11 22:15   ` [PATCH 1/4] X86: Revamp reboot behaviour to match Windows more closely Matthew Garrett
2011-03-11 22:18     ` Rafael J. Wysocki
2011-03-23  3:49       ` Len Brown
2011-03-23  4:08 ` Len Brown

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=201103112308.18221.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).