public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor_core-yWtbtysYrB+LZ21kGMrzwg@public.gmane.org>
To: "Li, Shaohua" <shaohua.li-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	Andi Kleen <ak-l3A5Bk7waGM@public.gmane.org>,
	"Yu, Luming" <luming.yu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Matthew Wilcox <matthew-Ztpu424NOJ8@public.gmane.org>,
	"Fu,
	Michael" <michael.fu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"Brown, Len" <len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"Moore,
	Robert" <robert.moore-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH] Don't disable interrupts during EC access
Date: Wed, 17 Nov 2004 02:58:23 -0500	[thread overview]
Message-ID: <200411170258.23552.dtor_core@ameritech.net> (raw)
In-Reply-To: <16A54BF5D6E14E4D916CE26C9AD305758EF9BD-4yWAQGcml66iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>

On Wednesday 17 November 2004 02:10 am, Li, Shaohua wrote:
> >On Tuesday 16 November 2004 10:37 am, Andi Kleen wrote:
> >> > For detail, please refer to ACPI spec :
> >> > 12 ? ACPI Embedded Controller Interface Specification.
> >>
> >> Ok. But the problem is not the actual write, but the waiting
> >> for the event which takes extremly long on these machines
> >> (it's not a single broken machine, but has been observed
> >> on several VIA based laptops). Would it work to only disable
> >> interrupts during the register write/read, but not during the
> >> polling delay?
> >
> >Actually, the proper solution would be to get rid of polling entirely,
> >like in the patch below. Could anyone with a box with EC verify that
> >it works?
> >
> >Btw, what's up with initializing every variable in ACPI code? It is
> >not free after all...
> >
> I agree the right solution should be to stop polling, but did you look
> at the comments in ec.c (line 361)? It said some systems can't work with
> asynchronous mode.
> 

Hmm... Let's see. We can only have 1 reader/writer active at the same time
per EC becuase they are serialized via ec->sem. So the only thing we can
race with is SCI generated by firmware in response to external factors.
So I guess we still need sleep-polling in acpi_ec_query_data, something
like this:

	while (unlikely(down_trylock(&ec->sem))) {
		/* reader or writer is waiting for completion */
		value = acpi_ec_read_status(ec);

        	if ((value & ACPI_EC_FLAG_OBF) ||
            	    (ec->expect_ibe && !(value & ACPI_EC_FLAG_IBF))) {
                	ec->expect_ibe = 0;
                	wake_up(&ec->wait);
        	}
		
		msleep(1);
	}

        acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->command_addr);
        result = acpi_ec_wait_obf(ec);
        if (result < 0)
                goto end;
	.....

Will this work?

-- 
Dmitry


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8

  parent reply	other threads:[~2004-11-17  7:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-17  7:10 [PATCH] Don't disable interrupts during EC access Li, Shaohua
     [not found] ` <16A54BF5D6E14E4D916CE26C9AD305758EF9BD-4yWAQGcml66iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2004-11-17  7:58   ` Dmitry Torokhov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-11-17  7:46 Yu, Luming
2004-11-17  8:02 ` Dmitry Torokhov
     [not found]   ` <200411170302.58634.dtor_core-yWtbtysYrB+LZ21kGMrzwg@public.gmane.org>
2004-11-17 21:53     ` Len Brown
2004-11-18  6:14       ` Dmitry Torokhov
2004-11-17  6:12 Yu, Luming
2004-11-16 15:41 Yu, Luming
2004-11-16 15:21 Yu, Luming
2004-11-16 15:37 ` Andi Kleen
     [not found]   ` <20041116153709.GA2392-B4tOwbsTzaBolqkO4TVVkw@public.gmane.org>
2004-11-17  6:55     ` Dmitry Torokhov
2004-11-16  6:15 Yu, Luming
2004-11-16 12:16 ` Matthew Wilcox
     [not found]   ` <20041116121616.GG1108-+pPCBgu9SkPzIGdyhVEDUDl5KyyQGfY2kSSpQ9I8OhVaa/9Udqfwiw@public.gmane.org>
2004-11-16 12:29     ` Andi Kleen
     [not found]       ` <20041116122946.GG28839-B4tOwbsTzaBolqkO4TVVkw@public.gmane.org>
2004-11-17  1:25         ` Stefan Seyfried
2004-11-15 22:56 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=200411170258.23552.dtor_core@ameritech.net \
    --to=dtor_core-ywtbtysyrb+lz21kgmrzwg@public.gmane.org \
    --cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=ak-l3A5Bk7waGM@public.gmane.org \
    --cc=len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=luming.yu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=matthew-Ztpu424NOJ8@public.gmane.org \
    --cc=michael.fu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=robert.moore-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=shaohua.li-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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