From: Alexey Starikovskiy <astarikovskiy@suse.de>
To: Zhao Yakui <yakui.zhao@intel.com>
Cc: linux-acpi@vger.kernel.org, lenb@kernel.org
Subject: Re: a problem about the two patches in bug 10724 & 11428
Date: Tue, 02 Sep 2008 13:30:50 +0400 [thread overview]
Message-ID: <48BD07CA.6040602@suse.de> (raw)
In-Reply-To: <1220347864.4039.189.camel@yakui_zhao.sh.intel.com>
Zhao Yakui wrote:
> On Tue, 2008-09-02 at 12:36 +0400, Alexey Starikovskiy wrote:
>> Zhao Yakui wrote:
>>> Maybe I don't understand what you said fully. The following is my
>>> understanding about the patches of bug 11428 and bug 10724.
>>>
>>> a. In the patch of bug 11428 the EC GPE won't be disabled when timeout
>>> happens, which means that it is still possible to switch EC working mode
>>> again from polling mode to interrupt mode. i.e. EC can still be switched
>>> to interrupt mode again. In the current upstream kernel when timeout
>>> happens, EC will be switched to polling mode and can't be switched to
>>> interrupt mode again(EC GPE is disabled). Right?
>> Wrong. EC GPE will stay enabled, driver will just not use it during wait for completion.
> In current upstream kernel when EC timeout happens, EC will be switched
> to polling mode by calling the function of ec_switch_to_poll, in which
> EC GPE is disabled. Right?
> >ec_switch_to_poll_mode(struct acpi_ec *ec)
> {
> set_bit(EC_FLAGS_NO_GPE, &ec->flags);
> clear_bit(EC_FLAGS_GPE_MODE, &ec->flags);
> acpi_disable_gpe(NULL, ec->gpe, ACPI_NOT_ISR);
> set_bit(EC_FLAGS_RESCHEDULE_POLL, &ec->flags);
> }
>
> If the patch in bug 11428 hits the upstream kernel, EC will be switched
> to polling mode when EC timeout happens. But EC GPE is still enabled and
> it can be switched to EC GPE interrupt mode.
> At the same time there is a little error in the patch of bug 10428.
> When EC timeout happens, the EC_FLAGS_NO_GPE bit of ec->flags is set
> and the EC_FLAGS_GPE_MODE is clear. When EC GPE interrupt is triggered,
> the EC_FLAGS_GPE_MODE bit can't be set again.
That is intended behavior. There are interrupts from EC, and if you don't want
to use them for confirmations, you need EC_FLAGS_NO_GPE.
>
>>> In fact when EC timeout happens in interrupt mode, it indicates that
>>> EC controller can't return response in time.
>> Wrong. Some EC controllers are "optimized" to not send interrupts for each confirmation.
>> See history of EC patches for these optimization workarounds.
> Maybe what you said is right. But in fact as is defined in ACPI spec, EC
> controller should issue an interrupt according to the status of IBF and
> OBF. More detailed info about EC interrupt model can be found in the
> section 12.6.2 of ACPI 3.0b spec.
> If some EC controller are "optimized" to not send interrupts, is it
> appropriate to reject such bugs?
According to Len Brown, we should not reject such bugs.
We are not doing reference implementation, we are doing _working_ implementation.
>
> In fact in the bug 11428 when EC real timeout happens in case of GPE
> interrupt mode, the EC status is already what we expected. But no EC GPE
> interrupt is triggered.
> More detailed info can be found in the log of bug 11428, comment
> #16.
>>> In the above source code maybe there exists the following phenomenon:
>>> When the EC GPE interrupt is triggered, the waiting process will be
>>> waked up in the GPE interrupt service routine. But as the process
>>> can't be scheduled immediately, maybe the wait_event_timeout will
>>> also return 0, which means that timeout happens and EC will be
>>> switched from interrupt mode to polling mode.
>> We are speaking about 500msec timeout here. it needs at least 50+ ready to run tasks of same
>> kernel priority to not let queue thread run. Please tell me, how could this happen?
> Please refer to the bug 11141.
> In the bug 11141 the laptop works in polling mode. When timeout happens,
> the EC status is already what OS expected.
>> [ 762.152173] ACPI: EC: acpi_ec_wait timeout, status = 0x01, event =
> "b0=1"
>> [ 762.152173] ACPI: EC: read timeout, command = 128
>> [ 766.444613] ACPI Exception (evregion-0419): AE_TIME, Returned by
> Handler for [EmbeddedControl] [20080609]
In poll mode works this piece of code. What is wrong?
} else {
unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);
clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
while (time_before(jiffies, delay)) {
if (acpi_ec_check_status(ec, event))
return 0;
msleep(1);
}
if (acpi_ec_check_status(ec,event))
return 0;
}
>
> In fact this is related with the mechanism of Linux schedule. When a
> process is waked, it will be added to running queue but it can't be
> scheduled immediately. Maybe before it has an opportunity to be
> scheduled, the timeout already happens.
How so? What could be scheduled before it for 50+ rescheduling events?
next prev parent reply other threads:[~2008-09-02 9:30 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-01 6:40 a problem about the two patches in bug 10724 & 11428 Zhao Yakui
2008-09-01 7:49 ` Alexey Starikovskiy
2008-09-01 9:55 ` Zhao Yakui
2008-09-01 12:18 ` Alexey Starikovskiy
2008-09-02 1:59 ` Zhao Yakui
2008-09-02 8:36 ` Alexey Starikovskiy
2008-09-02 9:31 ` Zhao Yakui
2008-09-02 9:26 ` Alan Jenkins
2008-09-02 9:30 ` Alexey Starikovskiy [this message]
2008-09-02 10:00 ` Zhao Yakui
2008-09-01 12:21 ` Henrique de Moraes Holschuh
2008-09-01 12:52 ` Alexey Starikovskiy
2008-09-01 20:35 ` Alexey Starikovskiy
2008-09-01 20:59 ` Alexey Starikovskiy
2008-09-02 1:03 ` Zhao Yakui
2008-09-02 2:03 ` Henrique de Moraes Holschuh
2008-09-02 3:39 ` Zhao Yakui
2008-09-02 9:19 ` Alan Jenkins
2008-09-02 8:05 ` Zhao Yakui
2008-09-03 6:02 ` Zhao Yakui
2008-09-03 6:46 ` Alexey Starikovskiy
2008-09-03 7:28 ` Zhao Yakui
2008-09-03 8:03 ` Zhao Yakui
2008-09-03 7:53 ` Alexey Starikovskiy
2008-09-03 8:34 ` Zhao Yakui
2008-09-03 21:55 ` RFC: fast transactions in EC [was: a problem about the two patches in bug 10724 & 11428] Alexey Starikovskiy
2008-09-04 2:58 ` Zhao Yakui
2008-09-04 3:06 ` Alexey Starikovskiy
2008-09-04 3:56 ` Alexey Starikovskiy
2008-09-04 4:51 ` Alexey Starikovskiy
2008-09-05 20:07 ` Andrew Morton
2008-09-08 8:19 ` Alexey Starikovskiy
2008-09-08 8:28 ` Andrew Morton
2008-09-08 8:30 ` Alexey Starikovskiy
2008-09-08 8:41 ` Andrew Morton
2008-09-03 22:28 ` a problem about the two patches in bug 10724 & 11428 Alexey Starikovskiy
2008-09-04 3:43 ` Zhao Yakui
2008-09-04 3:47 ` Alexey Starikovskiy
2008-09-04 6:00 ` Zhao Yakui
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=48BD07CA.6040602@suse.de \
--to=astarikovskiy@suse.de \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.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