Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: pbonzini@redhat.com (Paolo Bonzini)
Subject: [ltt-dev] [PATCH 07/11] add uatomic_gcc.h, use it for default definitions
Date: Mon, 15 Feb 2010 17:36:30 +0100	[thread overview]
Message-ID: <4B79780E.6060104@redhat.com> (raw)
In-Reply-To: <20100215162354.GA21995@Krystal>

On 02/15/2010 05:23 PM, Mathieu Desnoyers wrote:
> 1) We choose to discard support for old compilers on all architectures.
>    + simple/clean code
>    + easier to maintain
>    + less error-prone, using widely tested gcc builtins.
>    - liburcu become incompatible with lots of systems still being used today.

This is v1 of my patchset, and I understand it's too much.  (To be 
precise v1 was a bit less strict, as x86 and SPARC64 would remain 
compatible with old compilers).

It is too aggressive considering the other possibilities.

> 2) We choose to stick to custom per-architecture macros (only).
>    - more complex code.
>    - more code to maintain.
>    - more testing needed because we are not using gcc builtins.
>    - requires an initial effort to port liburcu to new architectures.
>    + provides support for gcc compilers back to early 3.x versions.
>    + test suites covers all gcc versions (no special-cases for old vs new
>      versions). Ensures that the code does not get bitrotten by not being
>      tested.

This is the status quo, besides the fact that S390 and SPARC64 are 
already using GCC builtins in non-public headers.

> 3) We choose to stick to custom per-arch macros, and use gcc builtins for
>     architectures for new architectures we want to support.
>     Same ? as (2), with this distinction:
>     + diminish initial port effort, because we can provide support for
>       new architectures (except for old compilers) quickly by using builtins.
>
> 4) Detect compiler versions with the precompiler. Use builtins for new
>     compilers, and explicit declarations for old compilers.
>    - more complex code.
>    - more code to maintain.
>    - more testing needed because we are not using gcc builtins.
>    - requires an initial effort to port liburcu to new architectures.
>    - test suites have to test for many compiler versions. Chances are
>      that the "old compiler compatibility" code will get much less
>      tested. This is, IMHO, a recipe for a disaster, as bugs will creap
>      in and testing will be hard.
>    + provides support for gcc compilers back to early 3.x versions.

(5) We choose to discard support for old compilers on all architectures, 
but fallback to non-_LGPL_SOURCE on all compilers
     + simple/clean code
     + easier to maintain
     + less error-prone (even though it's not really possible to use GCC
       builtins everywhere)
    - liburcu becomes less efficient on lots of systems in use today

> The current approach for liburcu is (2), but I think it's good to move
> to (3). However, I really dislike (4) because it makes testing much
> harder, and (1) is, I think, a no-go for a library meant to be usable on
> the large ecosystem of systems we have today (some with old compilers).

Exactly.

(3) is the most balanced and reasonable as things stand now.

(4) is definitely going to bitrot sooner than later (it would cost just 
an #ifdef...#endif around what we have now, but the problem of course is 
what goes inside the #ifdef).

I was thinking of doing (3) with the additional twist that S390 would 
count as a "new architecture".  On it, GCC is providing really 
everything that is needed and furthermore, unlike PPC, your testers 
surely have a new-enough GCC because they're using api_gcc.h.

Switching from (3) to (5) can be done later, after evaluating more 
carefully the pros and cons.  What do you think?

Paolo




  reply	other threads:[~2010-02-15 16:36 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-13 17:16 [ltt-dev] [PATCH 00/11] Simplify system dependent URCU code Paolo Bonzini
2010-02-13 17:16 ` [ltt-dev] [PATCH 01/11] use kernel style makefile output Paolo Bonzini
2010-02-14 14:25   ` Mathieu Desnoyers
2010-02-13 17:16 ` [ltt-dev] [PATCH 02/11] use autoconf symbolic linking Paolo Bonzini
2010-02-14 14:25   ` Mathieu Desnoyers
2010-02-13 17:16 ` [ltt-dev] [PATCH 03/11] add urcu/arch_defaults.h Paolo Bonzini
2010-02-14 14:34   ` Mathieu Desnoyers
2010-02-15  7:53     ` Paolo Bonzini
2010-02-15 14:46       ` Mathieu Desnoyers
2010-02-13 17:16 ` [ltt-dev] [PATCH 04/11] define sync_core for x86 PIC Paolo Bonzini
2010-02-14 14:37   ` Mathieu Desnoyers
2010-02-15  8:10     ` Paolo Bonzini
2010-02-15 14:56       ` Mathieu Desnoyers
2010-02-13 17:16 ` [ltt-dev] [PATCH 05/11] __SIZEOF_LONG__ is always defined by GCC Paolo Bonzini
2010-02-14 14:38   ` Mathieu Desnoyers
2010-02-15  7:54     ` Paolo Bonzini
2010-02-13 17:16 ` [ltt-dev] [PATCH 06/11] remove compat_uatomic_cmpxchg #define from non-x86 Paolo Bonzini
2010-02-14 14:38   ` Mathieu Desnoyers
2010-02-13 17:16 ` [ltt-dev] [PATCH 07/11] add uatomic_gcc.h, use it for default definitions Paolo Bonzini
2010-02-14 14:45   ` Mathieu Desnoyers
2010-02-15  8:05     ` Paolo Bonzini
2010-02-15 14:55       ` Mathieu Desnoyers
2010-02-15 15:38         ` Paolo Bonzini
2010-02-15 16:23           ` Mathieu Desnoyers
2010-02-15 16:36             ` Paolo Bonzini [this message]
2010-02-15 16:51               ` Mathieu Desnoyers
2010-02-15 16:55                 ` Paolo Bonzini
2010-02-15 17:13                   ` Mathieu Desnoyers
2010-02-15  8:06     ` Paolo Bonzini
2010-02-13 17:16 ` [ltt-dev] [PATCH 08/11] use uatomic_gcc.h Paolo Bonzini
2010-02-13 17:16 ` [ltt-dev] [PATCH 09/11] move whether atomic byte/short exists to uatomic_arch_*.h Paolo Bonzini
2010-02-13 17:16 ` [ltt-dev] [PATCH 10/11] add Alpha support Paolo Bonzini
2010-02-13 17:16 ` [ltt-dev] [PATCH 11/11] support compiling on unknown architectures Paolo Bonzini
2010-02-13 17:16 ` [ltt-dev] [PATCH 12/11] test uatomic_gcc.h Paolo Bonzini
2010-02-14 14:25 ` [ltt-dev] [PATCH 00/11] Simplify system dependent URCU code Mathieu Desnoyers

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=4B79780E.6060104@redhat.com \
    --to=pbonzini@redhat.com \
    /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