linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael D Labriola <mlabriol@gdeb.com>
To: Michael D Labriola <mlabriol@gdeb.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Kushal Koolwal <kushalkoolwal@gmail.com>,
	linux-kernel@vger.kernel.org, michael.d.labriola@gmail.com,
	Ingo Molnar <mingo@elte.hu>,
	Matthew Garrett <mjg59@srcf.ucam.org>,
	support@versalogic.com, Thomas Gleixner <tglx@linutronix.de>,
	x86@kernel.org
Subject: Re: [PATCH] x86, reboot: skip DMI checks if reboot set by user
Date: Thu, 19 Jan 2012 12:46:55 -0500	[thread overview]
Message-ID: <OF2B909250.6078896E-ON8525798A.0058FF49-8525798A.0061AEA1@gdeb.com> (raw)
In-Reply-To: <OF8642E997.5ED041E1-ON8525798A.0056983A-8525798A.0056E05B@LocalDomain>

Michael D Labriola/EB/GDYN wrote on 01/19/2012 10:48:53 AM:

> Alan Cox <alan@lxorguk.ukuu.org.uk> wrote on 01/19/2012 10:45:04 AM:
>
> > > checking if reboot_type's value is anything other than BOOT_ACPI 
(which
> > > is the default), but that does assume BOOT_ACPI is the default. What 
if
> > > that's ever changed?  Seems likely to me that whoever changes the 
default
> > > in the future could very easily re-break this at that point.
> > > 
> > > Thoughts?
> > 
> > Fair point - how about a BOOT_DEFAULT define value if it hasn't been 
set
> > and we can just make it do the same as ACPI in the switch ?
> 
> Sounds good to me.  I'll whip that up and resubmit.

Well, how about this.  Using a #define won't do as far as I can tell.
But I can reduce the size of the diff considerably like this.

Random question...  why do we have a reboot_init function that does DMI
checking with reboot_dmi_table (callbacks are mostly set_bios_reboot, but
there is a single set_kbd_reboot) and also a pci_reboot_init which does
the DMI check again using a separate pci_reboot_dmi_table (all callbacks
are to set_pci_reboot)?

Wouldn't it make more sense to do a single DMI scan using one big table?


diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 37a458b..0fc5b31 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -39,6 +39,14 @@ static int reboot_mode;
 enum reboot_type reboot_type = BOOT_ACPI;
 int reboot_force;
 
+/* This variable is used privately to keep track of whether or not
+ * reboot_type is still set to its default value (i.e., reboot= hasn't
+ * been set on the command line).  This is needed so that we can
+ * suppress DMI scanning for reboot quirks.  Without it, it's
+ * impossible to override a faulty reboot quirk without recompiling.
+ */
+static int reboot_default = 1;
+
 #if defined(CONFIG_X86_32) && defined(CONFIG_SMP)
 static int reboot_cpu = -1;
 #endif
@@ -67,6 +75,12 @@ bool port_cf9_safe = false;
 static int __init reboot_setup(char *str)
 {
        for (;;) {
+               /* Having anything passed on the command line via
+                * reboot= will cause us to disable DMI checking
+                * below.
+                */
+               reboot_default = 0;
+
                switch (*str) {
                case 'w':
                        reboot_mode = 0x1234;
@@ -316,7 +330,12 @@ static struct dmi_system_id __initdata 
reboot_dmi_table[] = {
 
 static int __init reboot_init(void)
 {
-       dmi_check_system(reboot_dmi_table);
+       /* Only do the DMI check if reboot_type hasn't been overridden
+        * on the command line
+        */
+       if (reboot_default) {
+               dmi_check_system(reboot_dmi_table);
+       }
        return 0;
 }
 core_initcall(reboot_init);
@@ -465,7 +484,12 @@ static struct dmi_system_id __initdata 
pci_reboot_dmi_table[] = {
 
 static int __init pci_reboot_init(void)
 {
-       dmi_check_system(pci_reboot_dmi_table);
+       /* Only do the DMI check if reboot_type hasn't been overridden
+        * on the command line
+        */
+       if (reboot_default) {
+               dmi_check_system(pci_reboot_dmi_table);
+       }
        return 0;
 }
 core_initcall(pci_reboot_init);



  parent reply	other threads:[~2012-01-19 17:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-17 15:16 [PATCH] x86, reboot: skip DMI checks if reboot set by user Michael D Labriola
2012-01-17 19:58 ` Alan Cox
2012-01-19 15:32   ` Michael D Labriola
2012-01-19 15:45     ` Alan Cox
2012-01-19 15:48       ` Michael D Labriola
     [not found]       ` <OF8642E997.5ED041E1-ON8525798A.0056983A-8525798A.0056E05B@LocalDomain>
2012-01-19 17:46         ` Michael D Labriola [this message]
2012-01-19 17:52           ` H. Peter Anvin
2012-01-19 19:14             ` Michael D Labriola
2012-01-19 19:17               ` H. Peter Anvin
2012-01-19 19:34                 ` Michael D Labriola
2012-01-19 19:41               ` Ingo Molnar

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=OF2B909250.6078896E-ON8525798A.0058FF49-8525798A.0061AEA1@gdeb.com \
    --to=mlabriol@gdeb.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=hpa@zytor.com \
    --cc=kushalkoolwal@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.d.labriola@gmail.com \
    --cc=mingo@elte.hu \
    --cc=mjg59@srcf.ucam.org \
    --cc=support@versalogic.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;
as well as URLs for NNTP newsgroup(s).