From: Andrew Morton <akpm@linux-foundation.org>
To: stable@kernel.org
Cc: linux-acpi@vger.kernel.org, Len Brown <lenb@kernel.org>,
Zhao Yakui <yakui.zhao@intel.com>,
Zhang Rui <rui.zhang@intel.com>, Andi Kleen <andi@firstfloor.org>,
Robert Epprecht <epprecht@solnet.ch>
Subject: Fw: ACPI: Avoid bogus EC timeout when EC is in Polling mode
Date: Fri, 19 Sep 2008 13:29:18 -0700 [thread overview]
Message-ID: <20080919132918.342efbcb.akpm@linux-foundation.org> (raw)
In http://bugzilla.kernel.org/show_bug.cgi?id=11594, Robert points out
that this fix should be backported into 2.6.26.x.
Begin forwarded message:
Date: Fri, 15 Aug 2008 17:00:31 GMT
From: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
To: git-commits-head@vger.kernel.org
Subject: ACPI: Avoid bogus EC timeout when EC is in Polling mode
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9d699ed92a459cb408e2577e8bbeabc8ec3989e1
Commit: 9d699ed92a459cb408e2577e8bbeabc8ec3989e1
Parent: 2500822bf4eb0179ef80e5b072c1e0fa83037381
Author: Zhao Yakui <yakui.zhao@intel.com>
AuthorDate: Mon Aug 11 10:33:31 2008 +0800
Committer: Andi Kleen <ak@linux.intel.com>
CommitDate: Fri Aug 15 03:13:06 2008 +0200
ACPI: Avoid bogus EC timeout when EC is in Polling mode
When EC is in Polling mode, OS will check the EC status continually by using
the following source code:
clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
while (time_before(jiffies, delay)) {
if (acpi_ec_check_status(ec, event))
return 0;
msleep(1);
}
But msleep is realized by the function of schedule_timeout. At the same time
although one process is already waken up by some events, it won't be scheduled
immediately. So maybe there exists the following phenomena:
a. The current jiffies is already after the predefined jiffies.
But before timeout happens, OS has no chance to check the EC
status again.
b. If preemptible schedule is enabled, maybe preempt schedule will happen
before checking loop. When the process is resumed again, maybe
timeout already happens, which means that OS has no chance to check
the EC status.
In such case maybe EC status is already what OS expects when timeout happens.
But OS has no chance to check the EC status and regards it as AE_TIME.
So it will be more appropriate that OS will try to check the EC status again
when timeout happens. If the EC status is what we expect, it won't be regarded
as timeout. Only when the EC status is not what we expect, it will be regarded
as timeout, which means that EC controller can't give a response in time.
http://bugzilla.kernel.org/show_bug.cgi?id=9823
http://bugzilla.kernel.org/show_bug.cgi?id=11141
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
drivers/acpi/ec.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 76784ae..13593f9 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -221,6 +221,8 @@ static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll)
return 0;
msleep(1);
}
+ if (acpi_ec_check_status(ec,event))
+ return 0;
}
pr_err(PREFIX "acpi_ec_wait timeout, status = 0x%2.2x, event = %s\n",
acpi_ec_read_status(ec),
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2008-09-19 20:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-19 20:29 Andrew Morton [this message]
2008-09-21 4:16 ` Fw: ACPI: Avoid bogus EC timeout when EC is in Polling mode Andi Kleen
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=20080919132918.342efbcb.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=epprecht@solnet.ch \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=rui.zhang@intel.com \
--cc=stable@kernel.org \
--cc=yakui.zhao@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