From: Andrew Morton <akpm@osdl.org>
To: ebiederm@xmission.com (Eric W. Biederman)
Cc: alan@lxorguk.ukuu.org.uk, linux-kernel@vger.kernel.org
Subject: Re: PATCH: EDAC - clean up atomic stuff
Date: Mon, 31 Oct 2005 12:02:54 -0800 [thread overview]
Message-ID: <20051031120254.4579dc9a.akpm@osdl.org> (raw)
In-Reply-To: <m1oe55abm4.fsf@ebiederm.dsl.xmission.com>
ebiederm@xmission.com (Eric W. Biederman) wrote:
>
> Ok. If I recall correctly atomic kmaps have the rule that they are
> per cpu, and you can't be interrupted when the map is taken, by
> something else that will use the map. But they are safe to use from
> interrupt context. As I recall the code needs to ensure that an
> interrupt handler doesn't use the same buffer and that it isn't
> preempted where another thread will use the buffer. The preemption
> angle is new since that piece of code was written.
Yes, a particular atomic kmap slot is simply a static, per-cpu scalar.
It's just like
int foo[NR_CPUS];
...
foo(smp_processor_id());
and all the same rules apply.
The use of KM_BOUNCE_READ does appear to be incorrect. bounce_copy_vec()
will use KM_BOUNCE_READ from interrupt context, so if the EDAC code is
interrupted by the block layer while it holds that kmap, it will find that
it's suddenly diddling with a different physical page.
So to use KM_BOUNCE_READ, the EDAC code nees to disable local interrupts,
or to use a different (or new) slot.
In what contexts is edac_mc_scrub_block() called? If process context, then
KM_USER0 would suit.
Ah, edac_mc_scrub_block() is passing the pageframe address to
kunmap_atomic() - that's a common bug. It needs to pass in the virtual
address which kmap_atomic() returned.
next prev parent reply other threads:[~2005-10-31 20:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-21 13:40 Alan Cox
2005-10-28 16:33 ` Eric W. Biederman
2005-10-31 15:30 ` Alan Cox
2005-10-31 16:34 ` Eric W. Biederman
2005-10-31 20:02 ` Andrew Morton [this message]
2005-11-01 12:03 ` Eric W. Biederman
2005-11-01 12:46 ` Alan Cox
2005-11-01 12:38 ` Eric W. Biederman
2005-11-02 5:26 ` Andrew Morton
2005-11-02 16:02 ` Alan Cox
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=20051031120254.4579dc9a.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=ebiederm@xmission.com \
--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
Powered by JetHome