Linux M68K Architecture development
 help / color / mirror / Atom feed
From: Finn Thain <fthain@telegraphics.com.au>
To: Linux-m68k <linux-m68k@vger.kernel.org>,
	Linux-arch <linux-arch@vger.kernel.org>
Subject: futex_init() vs. KERNEL_DS, was Re: Boot crash on 68030
Date: Fri, 28 Feb 2014 14:12:22 +1100 (EST)	[thread overview]
Message-ID: <alpine.LNX.2.00.1402281202180.21491@nippy.intranet> (raw)
In-Reply-To: <mvmy53t6mac.fsf@hawking.suse.de>


On Tue, 10 Dec 2013, Andreas Schwab wrote:

> Geert Uytterhoeven <geert@linux-m68k.org> writes:
> 
> >> Data read fault at 0x00000000 in Super Data (pc=0x3afec) BAD KERNEL 
> >> BUSERR
> 
> I think futex_init needs to do set_fs(USER_DS), since futex is about 
> user data.

Rhetorical question: does it make sense to explicitly switch to USER_DS 
when we know that current->mm may be invalid at the time?

Given that the presence of USER_DS or KERNEL_DS at initcall-time varies 
between architectures, perhaps this question must be left to arch 
implementors.

Moreover, architectures that have no need for a run-time test for usable 
futex_value ops have no real interest in such questions. AFAICT, only mips 
needs the run-time test.

For every other arch the availability of futex_value ops is known at 
compile-time. We don't need to pursue universal answers to questions like 
these:

1) the correctness of switching to USER_DS with mm->current == NULL [1]

2) the correctness of USER_DS vs. KERNEL_DS for (all) initcalls [2]

3) the correctness of allowing faults when get_fs() == KERNEL_DS [3]

4) the proposition that "[futex_value ops] explicitly take a __user 
   pointer and are expected to do whatever is needed to perform the 
   operation"  ... even during kernel initialization. [4]

The discussion of these questions in various threads on various lists did 
not resolve anything. Again, this is probably because all of these 
questions are actually arch implementation issues.

So it seems to me that the solution to the futex_init() problem is to 
evaluate the futex_cmpxchg_enabled assignment at compile-time where 
possible, and use the run-time test only on mips. Thoughts?

Finn


[1] http://marc.info/?l=linux-next&m=138876015228975&w=2

[2] https://lkml.org/lkml/2014/1/15/476
    http://marc.info/?l=linux-kernel&m=138971456630101&w=2

[3] http://marc.info/?l=linux-next&m=138876367730190&w=2

[4] http://marc.info/?l=linux-kernel&m=138970641726884&w=2

  reply	other threads:[~2014-02-28  3:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-08 14:03 [PATCH][M68K] implement futex.h to support userspace robust futexes and PI mutexes Mikael Pettersson
2013-05-17  8:44 ` Andreas Schwab
2013-05-17  9:02   ` Geert Uytterhoeven
2013-05-17  9:38     ` Andreas Schwab
2013-05-17 10:04 ` Geert Uytterhoeven
2013-05-17 12:05   ` Mikael Pettersson
2013-05-31  9:16     ` Geert Uytterhoeven
2013-12-09 23:11 ` Boot crash on 68030, was " Finn Thain
2013-12-09 23:27   ` Andreas Schwab
2013-12-10  0:54     ` Finn Thain
2013-12-10 10:12       ` Geert Uytterhoeven
2013-12-10 10:19         ` Andreas Schwab
2014-02-28  3:12           ` Finn Thain [this message]
2014-02-28  7:48             ` futex_init() vs. KERNEL_DS, was Re: Boot crash on 68030 Heiko Carstens
2014-02-28 10:30               ` Finn Thain
2014-02-21  2:33         ` Boot crash on 68030, was Re: [PATCH][M68K] implement futex.h to support userspace robust futexes and PI mutexes Finn Thain
2014-02-21  9:53         ` Andreas Schwab
2013-12-10 10:13       ` Mikael Pettersson

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=alpine.LNX.2.00.1402281202180.21491@nippy.intranet \
    --to=fthain@telegraphics.com.au \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-m68k@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