All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: linux-arm-kernel@lists.infradead.org
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	Linux MIPS Mailing List <linux-mips@linux-mips.org>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Ralf Baechle <ralf@linux-mips.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	DRI Development <dri-devel@lists.freedesktop.org>,
	virtualization@lists.linux-foundation.org,
	Gerd Hoffmann <kraxel@redhat.com>,
	Dave Airlie <airlied@redhat.com>
Subject: Re: [PATCH] drm/virtio: use %llu format string form atomic64_t
Date: Mon, 19 Oct 2015 12:11 +0200	[thread overview]
Message-ID: <4345582.jiHe94XBb3@wuerfel> (raw)
In-Reply-To: <CAMuHMdWbzEFqVctMXTWtdBn2B+guFdphQX5nXUnHPo1szQbtPg@mail.gmail.com>

On Monday 19 October 2015 09:34:15 Geert Uytterhoeven wrote:
> On Wed, Oct 7, 2015 at 1:23 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
> >
> > which truncates the result to 32 bit.
> 
> Woops.
> 
> See also my unanswered question in "atomic64 on 32-bit vs 64-bit (was:
> Re: Add virtio gpu driver.)", which is still valid:
> https://lkml.org/lkml/2015/6/28/18
> 

Regarding your question of

> Instead of sprinkling casts, is there any good reason why atomic64_read()
> and atomic64_t aren't "long long" everywhere, cfr. u64?


I assume the answer is that some (all?) 64-bit architectures intentionally
return 'long' here, in order for atomic_long_read() to return 'long' on
all architectures, given the definitions from
include/asm-generic/atomic-long.h

We would have to either change those, or we have to pick between
atomic_long_* or atomic64_* to have a consistent return type.

	Arnd

WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de>
To: linux-arm-kernel@lists.infradead.org
Cc: Linux MIPS Mailing List <linux-mips@linux-mips.org>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	DRI Development <dri-devel@lists.freedesktop.org>,
	virtualization@lists.linux-foundation.org,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	Dave Airlie <airlied@redhat.com>
Subject: Re: [PATCH] drm/virtio: use %llu format string form atomic64_t
Date: Mon, 19 Oct 2015 12:11 +0200	[thread overview]
Message-ID: <4345582.jiHe94XBb3@wuerfel> (raw)
In-Reply-To: <CAMuHMdWbzEFqVctMXTWtdBn2B+guFdphQX5nXUnHPo1szQbtPg@mail.gmail.com>

On Monday 19 October 2015 09:34:15 Geert Uytterhoeven wrote:
> On Wed, Oct 7, 2015 at 1:23 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
> >
> > which truncates the result to 32 bit.
> 
> Woops.
> 
> See also my unanswered question in "atomic64 on 32-bit vs 64-bit (was:
> Re: Add virtio gpu driver.)", which is still valid:
> https://lkml.org/lkml/2015/6/28/18
> 

Regarding your question of

> Instead of sprinkling casts, is there any good reason why atomic64_read()
> and atomic64_t aren't "long long" everywhere, cfr. u64?


I assume the answer is that some (all?) 64-bit architectures intentionally
return 'long' here, in order for atomic_long_read() to return 'long' on
all architectures, given the definitions from
include/asm-generic/atomic-long.h

We would have to either change those, or we have to pick between
atomic_long_* or atomic64_* to have a consistent return type.

	Arnd

WARNING: multiple messages have this Message-ID (diff)
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] drm/virtio: use %llu format string form atomic64_t
Date: Mon, 19 Oct 2015 12:11 +0200	[thread overview]
Message-ID: <4345582.jiHe94XBb3@wuerfel> (raw)
In-Reply-To: <CAMuHMdWbzEFqVctMXTWtdBn2B+guFdphQX5nXUnHPo1szQbtPg@mail.gmail.com>

On Monday 19 October 2015 09:34:15 Geert Uytterhoeven wrote:
> On Wed, Oct 7, 2015 at 1:23 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
> >
> > which truncates the result to 32 bit.
> 
> Woops.
> 
> See also my unanswered question in "atomic64 on 32-bit vs 64-bit (was:
> Re: Add virtio gpu driver.)", which is still valid:
> https://lkml.org/lkml/2015/6/28/18
> 

Regarding your question of

> Instead of sprinkling casts, is there any good reason why atomic64_read()
> and atomic64_t aren't "long long" everywhere, cfr. u64?


I assume the answer is that some (all?) 64-bit architectures intentionally
return 'long' here, in order for atomic_long_read() to return 'long' on
all architectures, given the definitions from
include/asm-generic/atomic-long.h

We would have to either change those, or we have to pick between
atomic_long_* or atomic64_* to have a consistent return type.

	Arnd

  reply	other threads:[~2015-10-19 10:11 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-07 10:41 [PATCH] drm/virtio: use %llu format string form atomic64_t Arnd Bergmann
2015-10-07 10:41 ` Arnd Bergmann
2015-10-07 10:41 ` Arnd Bergmann
2015-10-07 10:45 ` Russell King - ARM Linux
2015-10-07 10:45   ` Russell King - ARM Linux
2015-10-07 10:45   ` Russell King - ARM Linux
2015-10-07 11:04   ` Arnd Bergmann
2015-10-07 11:04     ` Arnd Bergmann
2015-10-07 11:04     ` Arnd Bergmann
2015-10-07 11:23     ` Arnd Bergmann
2015-10-07 11:23     ` Arnd Bergmann
2015-10-07 11:23       ` Arnd Bergmann
2015-10-19  7:34       ` Geert Uytterhoeven
2015-10-19  7:34       ` Geert Uytterhoeven
2015-10-19  7:34         ` Geert Uytterhoeven
2015-10-19  7:34         ` Geert Uytterhoeven
2015-10-19  7:34         ` Geert Uytterhoeven
2015-10-19 10:11         ` Arnd Bergmann [this message]
2015-10-19 10:11           ` Arnd Bergmann
2015-10-19 10:11           ` Arnd Bergmann
2015-10-19 10:39           ` Geert Uytterhoeven
2015-10-19 10:39           ` Geert Uytterhoeven
2015-10-19 10:39             ` Geert Uytterhoeven
2015-10-19 10:39             ` Geert Uytterhoeven
2015-10-19 10:39             ` Geert Uytterhoeven
2015-10-19  9:37       ` Ralf Baechle
2015-10-19  9:37       ` Ralf Baechle
2015-10-19  9:37         ` Ralf Baechle
2015-10-19 10:06         ` Arnd Bergmann
2015-10-19 10:06           ` Arnd Bergmann
2015-10-19 10:06           ` Arnd Bergmann
2015-10-19 10:06         ` Arnd Bergmann
2015-10-07 11:04   ` Arnd Bergmann
2015-10-07 10:45 ` Russell King - ARM Linux
2015-10-07 10:41 Arnd Bergmann

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=4345582.jiHe94XBb3@wuerfel \
    --to=arnd@arndb.de \
    --cc=airlied@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=geert@linux-m68k.org \
    --cc=kraxel@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux@arm.linux.org.uk \
    --cc=ralf@linux-mips.org \
    --cc=virtualization@lists.linux-foundation.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 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.