public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexey Starikovskiy <astarikovskiy@suse.de>
To: Guillaume Chazarain <guichaz@gmail.com>
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	lenb@kernel.org
Subject: Re: ACPI regression in 2.6.25-rc6 (function keys stop working)
Date: Tue, 18 Mar 2008 13:22:38 +0300	[thread overview]
Message-ID: <47DF97EE.3080402@suse.de> (raw)
In-Reply-To: <3d8471ca0803171713q31b87939y557f6408543ac881@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3183 bytes --]

Hi,

Please provide 'cat /proc/interrupts'.
Could you try if such patch works?

Thanks,
Alex.

Guillaume Chazarain wrote:
> Hi,
> 
> There is an ACPI regression in 2.6.25-rc6, which causes the ACPI keys
> to stop working on my laptop, an Asus V6VA. git bisect identified the
> appended commit as guilty, and reverting it indeed fixes the problem
> for me. Attached are my .config, a good dmesg and a bad one. The diff
> between both dmesg reveals this interesting hunk:
> 
> @@ -121,8 +121,9 @@
>  ACPI: (supports S0 S1 S3 S4 S5)
>  ACPI: Using IOAPIC for interrupt routing
>  ACPI: EC: non-query interrupt received, switching to interrupt mode
> +ACPI: EC: GPE storm detected, disabling EC GPE
>  ACPI: EC: GPE = 0x1c, I/O: command/status = 0x66, data = 0x62
> -ACPI: EC: driver started in interrupt mode
> +ACPI: EC: driver started in poll mode
>  ACPI: PCI Root Bridge [PCI0] (0000:00)
>  pci 0000:00:1f.0: Enabled ICH6/i801 SMBus device
>  pci 0000:00:1f.0: quirk: region 0800-087f claimed by ICH6 ACPI/GPIO/TCO
> 
> 
> Thanks.
> 
> 
> commit 2c81ce4c9c37b910210f2640c28e98a0c398dc26
> Author: Alexey Starikovskiy <astarikovskiy@suse.de>
> Date:   Tue Mar 11 13:30:00 2008 -0400
> 
>     ACPI: EC: Handle IRQ storm on Acer laptops
> 
>     On some Acer systems, the HW fails to clear the GPE source,
>     causing an interrupt storm.
> 
>     So in EC interrupt mode, we count how many interrupts we
>     receive when waiting.  If we get more than 5, we give
>     up on interrupt mode and revert to polling mode.
> 
>     Also, for polling mode to work on Acers, we need
>     to insert a delay.
> 
>     Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
>     Signed-off-by: Len Brown <len.brown@intel.com>
> 
> diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
> index caf873c..2c77359 100644
> --- a/drivers/acpi/ec.c
> +++ b/drivers/acpi/ec.c
> @@ -129,6 +129,7 @@ static struct acpi_ec {
>  	struct mutex lock;
>  	wait_queue_head_t wait;
>  	struct list_head list;
> +	atomic_t irq_count;
>  	u8 handlers_installed;
>  } *boot_ec, *first_ec;
> 
> @@ -181,6 +182,8 @@ static int acpi_ec_wait(struct acpi_ec *ec, enum
> ec_event event, int force_poll)
>  {
>  	int ret = 0;
> 
> +	atomic_set(&ec->irq_count, 0);
> +
>  	if (unlikely(event == ACPI_EC_EVENT_OBF_1 &&
>  		     test_bit(EC_FLAGS_NO_OBF1_GPE, &ec->flags)))
>  		force_poll = 1;
> @@ -227,6 +230,7 @@ static int acpi_ec_wait(struct acpi_ec *ec, enum
> ec_event event, int force_poll)
>  		while (time_before(jiffies, delay)) {
>  			if (acpi_ec_check_status(ec, event))
>  				goto end;
> +			msleep(5);
>  		}
>  	}
>  	pr_err(PREFIX "acpi_ec_wait timeout,"
> @@ -529,6 +533,13 @@ static u32 acpi_ec_gpe_handler(void *data)
>  	struct acpi_ec *ec = data;
> 
>  	pr_debug(PREFIX "~~~> interrupt\n");
> +	atomic_inc(&ec->irq_count);
> +	if (atomic_read(&ec->irq_count) > 5) {
> +		pr_err(PREFIX "GPE storm detected, disabling EC GPE\n");
> +		acpi_disable_gpe(NULL, ec->gpe, ACPI_ISR);
> +		clear_bit(EC_FLAGS_GPE_MODE, &ec->flags);
> +		return ACPI_INTERRUPT_HANDLED;
> +	}
>  	clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
>  	if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags))
>  		wake_up(&ec->wait);
> 
> 


[-- Attachment #2: dont_disable_ec_gpe_completely_at_storm.patch --]
[-- Type: text/x-patch, Size: 1401 bytes --]

ACPI: EC: Don't disable EC GPE completely at detected storm

From: Alexey Starikovskiy <astarikovskiy@suse.de>

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
---

 drivers/acpi/ec.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index e7e197e..461acd1 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -527,17 +527,30 @@ static void acpi_ec_gpe_query(void *ec_cxt)
 	mutex_unlock(&ec->lock);
 }
 
+static void acpi_ec_enable_gpe(void *context)
+{
+	struct acpi_ec *ec = context;
+	acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR);
+	atomic_set(&ec->irq_count, 0);
+	set_bit(EC_FLAGS_GPE_MODE, &ec->flags);
+}
+
 static u32 acpi_ec_gpe_handler(void *data)
 {
 	acpi_status status = AE_OK;
 	struct acpi_ec *ec = data;
+	static bool gpe_storm = 0;
 
 	pr_debug(PREFIX "~~~> interrupt\n");
 	atomic_inc(&ec->irq_count);
-	if (atomic_read(&ec->irq_count) > 5) {
-		pr_err(PREFIX "GPE storm detected, disabling EC GPE\n");
+	if (atomic_read(&ec->irq_count) > 2) {
+		if (!gpe_storm) {
+			pr_err(PREFIX "GPE storm detected, throttle EC GPE\n");
+			gpe_storm = 1;
+		}
 		acpi_disable_gpe(NULL, ec->gpe, ACPI_ISR);
 		clear_bit(EC_FLAGS_GPE_MODE, &ec->flags);
+		acpi_os_execute(OSL_EC_BURST_HANDLER, acpi_ec_enable_gpe, ec);
 		return ACPI_INTERRUPT_HANDLED;
 	}
 	clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);

  reply	other threads:[~2008-03-18 10:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-18  0:13 ACPI regression in 2.6.25-rc6 (function keys stop working) Guillaume Chazarain
2008-03-18 10:22 ` Alexey Starikovskiy [this message]
2008-03-18 13:17 ` Alexey Starikovskiy
2008-03-18 17:23   ` Tim Elliott
2008-03-18 19:48     ` Alexey Starikovskiy
2008-03-19 22:10       ` Rafael J. Wysocki
2008-03-18 23:29   ` Guillaume Chazarain
2008-03-18 23:40     ` Alexey Starikovskiy
2008-03-18 23:53     ` Alexey Starikovskiy
2008-03-19  1:14     ` Alexey Starikovskiy

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=47DF97EE.3080402@suse.de \
    --to=astarikovskiy@suse.de \
    --cc=guichaz@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.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