From: Andrew Morton <akpm@digeo.com>
To: Hirokazu Takahashi <taka@valinux.co.jp>
Cc: linux-kernel@vger.kernel.org, janetmor@us.ibm.com
Subject: Re: [patch] readv/writev rework
Date: Fri, 13 Sep 2002 10:43:26 -0700 [thread overview]
Message-ID: <3D8223BE.31C564F2@digeo.com> (raw)
In-Reply-To: 20020913.182350.43012479.taka@valinux.co.jp
Hirokazu Takahashi wrote:
>
> Hello,
>
> I fixed the patch.
Thanks again.
> But I have one more question.
>
> Please consider...
> while a process sleep in copy_*_user() another one may call kmap_atomic
> and kunmap_atomic. And the process will restart and might access the
> wrong page as kunmap_atomic do nothing without CONFIG_DEBUG_HIGHMEM flag.
> I mean it wouldn't any faults as another page is still kmapped.
Yes; this is why it is illegal to sleep, or to switch CPUs by any means
while holding an atomic kmap:
kmap_atomic(...);
__copy_*_user(...);
kunmap_atomic(...);
the kmap_atomic() will increment the preempt count (even on CONFIG_PREEMPT=n).
- The incremented preempt count pins this code path onto this CPU
while the kmap is held. (This is only relevant to CONFIG_PREEMPT=y)
- The incremented preempt count tells do_page_fault() that we cannot
handle a pagefault; if a fault is encountered during the copy_*_user(),
do_page_fault() will arrange for the __copy_*_user() to return a short
copy.
So. The code path is atomic, and is pinned to a single CPU. The atomic
kmap pool uses a different batch of virtual addresses for each CPU (it's
a per-CPU pool of addresses).
prev parent reply other threads:[~2002-09-13 17:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-11 8:30 [patch] readv/writev rework Andrew Morton
2002-09-12 13:00 ` Hirokazu Takahashi
2002-09-12 18:47 ` Andrew Morton
2002-09-13 1:18 ` Hirokazu Takahashi
2002-09-13 3:31 ` Andrew Morton
2002-09-14 4:54 ` Andrew Morton
2002-09-14 7:39 ` Hirokazu Takahashi
2002-09-13 7:22 ` Hirokazu Takahashi
2002-09-13 8:29 ` Andrew Morton
2002-09-13 8:26 ` Hirokazu Takahashi
2002-09-13 9:23 ` Hirokazu Takahashi
2002-09-13 17:43 ` Andrew Morton [this message]
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=3D8223BE.31C564F2@digeo.com \
--to=akpm@digeo.com \
--cc=janetmor@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=taka@valinux.co.jp \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.