All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Thomas Renninger <trenn@suse.de>
Cc: Len Brown <lenb@kernel.org>, linux-acpi@vger.kernel.org
Subject: Re: [PATCH] ACPI: Make Embedded Controller command timeout delay configurable
Date: Thu, 21 Oct 2010 21:53:03 +0200	[thread overview]
Message-ID: <201010212153.03664.rjw@sisk.pl> (raw)
In-Reply-To: <201010211824.57893.trenn@suse.de>

On Thursday, October 21, 2010, Thomas Renninger wrote:
> Here and then there show up machines which need higher timeout values.
> Finding this on affected machines can be cumbersome, because
> ACPI_EC_DELAY is a compile option -> make it configurable via boot param.

I think the users should not be allowed to decrease the delay below certain
reasonable limit (perhaps current value of ACPI_EC_DELAY).

> This can even be provided writable at runtime via:
> /sys/modules/acpi/parameters/ec_delay

Would it be safe?

> Known machines where this helps:
> Some HP machines where for whatever reasons specific EC accesses take
> very long at resume from S3 (in _WAK function).
> The AE_TIME error is passed upwards and the ACPI interpreter will
> not execute the rest of the _WAK function which results in not properly
> initialized devices/variables with different side-effects.
> 
> Afaik, on some MSI machines this helped as well.
> 
> If this param is needed there probably are underlying problems like:
>   - EC firmware bug
>   - A kernel EC driver bug
>   - An ACPI interpreter behavior (e.g. timings when specific
>     EC accesses happen and how) which the EC does not like
>   - ...
> which should get evaluated further, but often are nasty or
> impossible to fix from OS side.
> 
> 
> Signed-off-by: Thomas Renninger <trenn@suse.de>
> CC: lenb@kernel.org
> CC: "Rafael J. Wysocki" <rjw@sisk.pl>
> CC: linux-acpi@vger.kernel.org
> 
> diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
> index f31291b..6499cc4 100644
> --- a/drivers/acpi/ec.c
> +++ b/drivers/acpi/ec.c
> @@ -83,6 +83,11 @@ enum {
>  	EC_FLAGS_BLOCKED,		/* Transactions are blocked */
>  };
>  
> +/* ec.c is compiled in acpi namespace so this shows up as acpi.ec_delay param */
> +static unsigned int ec_delay __read_mostly = ACPI_EC_DELAY;
> +module_param(ec_delay, uint, 0644);
> +MODULE_PARM_DESC(ec_delay, "Timeout(ms) waited until an EC command completes");
> +
>  /* If we find an EC via the ECDT, we need to keep a ptr to its context */
>  /* External interfaces use first EC only, so remember */
>  typedef int (*acpi_ec_query_func) (void *data);
> @@ -210,7 +215,7 @@ static int ec_poll(struct acpi_ec *ec)
>  	int repeat = 2; /* number of command restarts */
>  	while (repeat--) {
>  		unsigned long delay = jiffies +
> -			msecs_to_jiffies(ACPI_EC_DELAY);
> +			msecs_to_jiffies(ec_delay);
>  		do {
>  			/* don't sleep with disabled interrupts */
>  			if (EC_FLAGS_MSI || irqs_disabled()) {
> @@ -265,7 +270,7 @@ static int ec_check_ibf0(struct acpi_ec *ec)
>  
>  static int ec_wait_ibf0(struct acpi_ec *ec)
>  {
> -	unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);
> +	unsigned long delay = jiffies + msecs_to_jiffies(ec_delay);
>  	/* interrupt wait manually if GPE mode is not active */
>  	while (time_before(jiffies, delay))
>  		if (wait_event_timeout(ec->wait, ec_check_ibf0(ec),

Thanks,
Rafael

  reply	other threads:[~2010-10-21 19:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-21 16:24 [PATCH] ACPI: Make Embedded Controller command timeout delay configurable Thomas Renninger
2010-10-21 19:53 ` Rafael J. Wysocki [this message]
2010-10-22  5:25   ` Len Brown
2010-10-22  5:22 ` Len Brown
2010-10-22 21:22   ` Rafael J. Wysocki
2010-10-22 22:46     ` Thomas Renninger
2010-10-22 23:43       ` Rafael J. Wysocki
2010-10-24 22:34         ` Thomas Renninger

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=201010212153.03664.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=trenn@suse.de \
    /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.