mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: mrmacman_g4@mac.com
Cc: acahalan@gmail.com, dwmw2@infradead.org, arjan@infradead.org,
	maillist@jg555.com, ralf@linux-mips.org,
	linux-kernel@vger.kernel.org
Subject: Re: 2.6.18 Headers - Long
Date: Sun, 16 Jul 2006 18:23:34 -0700 (PDT)	[thread overview]
Message-ID: <20060716.182334.30182563.davem@davemloft.net> (raw)
In-Reply-To: <6C943713-549B-453C-A0B2-1286764FFE13@mac.com>

From: Kyle Moffett <mrmacman_g4@mac.com>
Date: Sun, 16 Jul 2006 08:34:53 -0400

> Both of which may be easily cut and pasted into your GPL programs  
> with little or no effort (Hint: I do this all the time).  Those are  
> so stable you don't even have to maintain it!  IMHO, what you really  
> want, though, is for GCC to export a library of ASM intrinsics (like  
> memory barriers, atomic ops, etc), that are available on your current  
> architecture.  If there is no __gcc_atomic_inc then it wouldn't  
> #define it and you can just go back to pthread_mutex_lock/unlock for  
> protecting an atomic variable.  Such a library layer certainly  
> doesn't belong in the kernel, although if GCC got such a library  
> right the kernel might start to use it (although only the most recent  
> GCC would support it so it wouldn't be very useful).

I agree with your assertions that the stuff in asm/atomic.h should be
steered away from, since they generally are not expected to work in
userspace.  In fact, if you try to use the 32-bit sparc or parisc
ones, it simply won't link because the implementations are external
and use a hash table spinlock scheme which is in the kernel image.

However, the pthread based locking is bad if you want to recover
from arbitrary signals correctly.  I ran into this problem while
trying to get Linux/Sparc Mono working well.

When people want atomic cmpxchg or atomic increment/decrement, they
want a true atomic.  This means either finish the whole thing, or
leave no trace of the atomic having started in the first place.
Spinlock based atomic implementations, which is what a lot of
platforms lacking true atomic use, absolutely cannot reasonably
provide this semantic.

  parent reply	other threads:[~2006-07-17  1:23 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-15 21:09 Albert Cahalan
2006-07-15 21:19 ` Arjan van de Ven
2006-07-17  5:21   ` Ralf Baechle
2006-07-15 21:44 ` Adrian Bunk
2006-07-15 21:47 ` David Woodhouse
2006-07-16  6:18   ` Albert Cahalan
2006-07-16  6:26     ` Arjan van de Ven
2006-07-16  8:05     ` David Woodhouse
2006-07-16  8:20 ` Jakub Jelinek
2006-07-16 12:34 ` Kyle Moffett
2006-07-16 12:48   ` Russell King
2006-07-16 18:38   ` Albert Cahalan
2006-07-16 18:53     ` Russell King
2006-07-16 19:22       ` Albert Cahalan
2006-07-16 19:41         ` Russell King
2006-07-17  1:26         ` Arjan van de Ven
2006-07-17  1:23   ` David Miller [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-07-12  0:35 Jim Gifford
2006-07-14  0:25 ` David Woodhouse
2006-07-14  2:18   ` Jim Gifford
2006-07-14 18:55     ` David Woodhouse
2006-07-14 19:28       ` Jim Gifford
2006-07-14 19:39         ` Arjan van de Ven
2006-07-14 20:16           ` David Woodhouse
2006-07-14 20:19             ` David Miller
2006-07-14 20:57               ` Jim Gifford
2006-07-15  4:33                 ` Randy.Dunlap
2006-07-16 14:08                   ` Nix
2006-07-15  7:19                 ` David Woodhouse
2006-07-15  7:08               ` David Woodhouse
2006-07-14 19:57         ` David Woodhouse
2006-07-14 20:06         ` Erik Andersen
2006-07-14 20:19   ` Christoph Hellwig
2006-08-26 16:09   ` David Woodhouse
2006-08-29 12:25     ` Ralf Baechle

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=20060716.182334.30182563.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=acahalan@gmail.com \
    --cc=arjan@infradead.org \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maillist@jg555.com \
    --cc=mrmacman_g4@mac.com \
    --cc=ralf@linux-mips.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