public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Zhang Rui <rui.zhang@intel.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	sukumar.ghorai@intel.com
Subject: Re: [PATCH] acpi: reboot: fix racing after writing to ACPI RESET_REG
Date: Tue, 13 Oct 2020 16:19:39 +0800	[thread overview]
Message-ID: <147e71b70b123b37be982158946784da3ff35a04.camel@intel.com> (raw)
In-Reply-To: <CAJZ5v0jM-B5VxGSVYf9DVoWkwbGpNFZw_-wTxLxifGap6OA2ug@mail.gmail.com>

On Mon, 2020-10-12 at 12:42 +0200, Rafael J. Wysocki wrote:
> On Sat, Oct 10, 2020 at 4:36 AM Zhang Rui <rui.zhang@intel.com>
> wrote:
> > 
> > According to the ACPI spec, "The system must reset immediately
> > following
> > the write to the ACPI RESET_REG register.", but there are cases
> > that the
> > system does not follow this and results in racing with the
> > subsequetial
> > reboot mechanism, which brings unexpected behavior.
> > 
> > Fix this by adding a 15ms delay after writing to the ACPI
> > RESET_REG.
> > 
> > Reported-by: Ghorai, Sukumar <sukumar.ghorai@intel.com>
> > Signed-off-by: Zhang Rui <rui.zhang@intel.com>
> > ---
> >  drivers/acpi/reboot.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/drivers/acpi/reboot.c b/drivers/acpi/reboot.c
> > index ca707f5b521d..88e6b083d702 100644
> > --- a/drivers/acpi/reboot.c
> > +++ b/drivers/acpi/reboot.c
> > @@ -3,6 +3,7 @@
> >  #include <linux/pci.h>
> >  #include <linux/acpi.h>
> >  #include <acpi/reboot.h>
> > +#include <linux/delay.h>
> > 
> >  #ifdef CONFIG_PCI
> >  static void acpi_pci_reboot(struct acpi_generic_address *rr, u8
> > reset_value)
> > @@ -66,4 +67,10 @@ void acpi_reboot(void)
> >                 acpi_reset();
> >                 break;
> >         }
> > +
> > +       /*
> > +        * delay for 15ms in case the system does not shutdown
> > immediately after
> > +        * writing to the ACPI reset register
> 
> It would also be good to make a note of where the 15ms value comes
> from.
> 
> Even if it has been guessed, it will still be good to know that, say,
> 5 years from now.
> 
Agreed, patch V2 sent out.

-rui
> > +        */
> > +       mdelay(15);
> >  }
> > --
> > 2.17.1
> > 


      reply	other threads:[~2020-10-13  8:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-10  2:26 [PATCH] acpi: reboot: fix racing after writing to ACPI RESET_REG Zhang Rui
2020-10-12 10:42 ` Rafael J. Wysocki
2020-10-13  8:19   ` Zhang Rui [this message]

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=147e71b70b123b37be982158946784da3ff35a04.camel@intel.com \
    --to=rui.zhang@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=sukumar.ghorai@intel.com \
    /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