From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Huang Ying <ying.huang@intel.com>
Cc: Andi Kleen <andi@firstfloor.org>, linux-acpi@vger.kernel.org
Subject: acpi_atomic_read() requirements
Date: Thu, 2 Sep 2010 19:34:52 -0600 [thread overview]
Message-ID: <201009021934.52861.bjorn.helgaas@hp.com> (raw)
Hello,
You recently added acpi_atomic_read() and acpi_atomic_write().
These are similar to acpi_read() and acpi_write(), but differ
mainly in two ways:
- The atomic ones can be used in interrupt context, because the
ioremap() (which may block) can be done earlier by acpi_pre_map_gar()
- The atomic ones do 64-bit accesses directly with readq() rather
than splitting them into two 32-bit accesses as acpi_read() does.
It's obvious to me that you need the first property (usable in
interrupt context). Do you also rely on the second property
(doing a single 64-bit access rather than two 32-bit accesses)?
I'm curious because there's another path that performs memory
accesses from interrupt context, using acpi_read() and
acpi_os_read_memory(). The ACPI IRQ handler reads the PM1
Status register to learn the interrupt source. If this is
memory mapped (not in I/O port space), we currently panic
because ioremap() can't be called in interrupt context:
http://marc.info/?l=linux-acpi&m=128094238920118&w=2
I wrote a patch that fixes this by premapping these areas so the
ioremap() happens at boot-time rather than interrupt-time. This
works fine, but it ends up looking very much like the atomic
functions you added. I'd like to integrate them somehow rather
than adding more code that does basically the same thing as your
code.
If your APEI code that uses acpi_atomic_read()/write() doesn't
require the single 64-bit access, it might be possible to keep
the premapping support, i.e., acpi_pre_map_gar(), change
acpi_os_read_memory() to check the acpi_iomaps list first and
only do the ioremap() if it doesn't find anything, remove
acpi_atomic_read(), and just use acpi_read() instead.
Bjorn
next reply other threads:[~2010-09-03 1:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-03 1:34 Bjorn Helgaas [this message]
2010-09-03 1:49 ` acpi_atomic_read() requirements Huang Ying
2010-09-03 4:32 ` Bjorn Helgaas
2010-09-03 9:17 ` Andi Kleen
2010-09-03 15:00 ` Bjorn Helgaas
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=201009021934.52861.bjorn.helgaas@hp.com \
--to=bjorn.helgaas@hp.com \
--cc=andi@firstfloor.org \
--cc=linux-acpi@vger.kernel.org \
--cc=ying.huang@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