From: neroden@fastmail.fm (Nathanael Nerode)
To: linux-kernel@vger.kernel.org
Subject: Re: i486 emu in mainline?
Date: Sun, 10 Oct 2004 16:33:23 -0400 [thread overview]
Message-ID: <20041010203323.GA3166@fastmail.fm> (raw)
Some thread necromancy...
On Sun, 23 May 2004 02:20:58 +0000, Andrew Morton wrote:
>Willy Tarreau <willy <at> w.ods.org> wrote:
>>
>> On Sun, May 23, 2004 at 09:13:20AM +0200, Arjan van de Ven wrote:
>> > on first look it seems to be missing a bunch of get_user() calls and
>> > does direct access instead....
>>
>> It was intentional for speed purpose. The areas are checked once with
>> verify_area() when we need to access memory, then data is copied directly
>> from/to memory. I don't think there's any risk, but I can be wrong.
>
>verify_area() simply checks that the address is a legal one for a userspace
>access (it's not a chunk of kernel memory). But the kernel can still take
>a pagefault when accessing the address, so you need to use the uaccess
>functions which will handle the fault appropriately.
>
>That's put_user(), get_user(), copy_*_user(), etc. Those functions
>internally perform verify_area(), so if you've already done a verify_area()
>you can use __put_user(), __get_user(), etc which skip the verify_area()
>but which still know how to deal with user address faults.
After reviewing the thread, this seems to be the most important reason
why this patch can't be included. So I thought, "Hey, I'll fix that."
But put_user, get_user, etc. may sleep (of course).
They're also "user context only".
This is a hardware trap handler. What sort of context is that? Is
it really "user context"? Worse, we're attempting to emulate an
*atomic* instruction (CMPXCHG).
So how do I guarantee:
(1) the original process doesn't get resumed during the sleep
(perhaps this is guaranteed by other things?)
(2) nobody else messes with the data we're messing with, so that this is
actually atomic. (Note that we're assuming there's no SMP, because this
is an i386 and there are no known i386 SMP machines supported by Linux.
So the only problem is stuff woken during sleep.) Basically, this means
no other process which might share the memory can be woken up during the
sleep either. :-P
Is this possible, or hopelessly difficult?
--
This space intentionally left blank.
next reply other threads:[~2004-10-10 20:33 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-10 20:33 Nathanael Nerode [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-05-25 17:03 i486 emu in mainline? Albert Cahalan
2004-05-25 22:43 ` Alan Cox
2004-05-22 23:40 Christoph Hellwig
2004-05-23 0:20 ` Rene Rebe
2004-05-23 7:13 ` Arjan van de Ven
2004-05-23 8:44 ` Willy Tarreau
2004-05-23 9:13 ` Arjan van de Ven
2004-05-23 9:48 ` Willy Tarreau
2004-05-23 9:58 ` Arjan van de Ven
2004-05-23 11:49 ` Helge Hafting
2004-05-23 9:20 ` Andrew Morton
2004-05-23 17:11 ` Brian Gerst
2004-05-24 2:47 ` Herbert Xu
2004-05-27 21:03 ` Pavel Machek
2004-05-23 8:29 ` Willy Tarreau
2004-05-23 11:08 ` Alan Cox
2004-05-23 11:57 ` Willy Tarreau
2004-05-23 13:15 ` Alan Cox
2004-05-24 15:17 ` Jan-Benedict Glaw
2004-05-24 17:41 ` Alan Cox
2004-05-25 9:36 ` Jan-Benedict Glaw
2004-05-25 13:48 ` Alan Cox
[not found] ` <20040523105130.GA588@samarkand.rivenstone.net>
2004-05-23 11:59 ` Willy Tarreau
2004-05-24 9:08 ` P
2004-05-23 15:18 ` Jeff Garzik
2004-05-23 21:14 ` Alan Cox
2004-05-24 12:28 ` Maciej W. Rozycki
2004-05-25 17:21 ` Kronos
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=20041010203323.GA3166@fastmail.fm \
--to=neroden@fastmail.fm \
--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