Re: [PATCH 05/28] kvm tools: 64-bit tidy; use PRIx64 when printf'ing

Ingo Molnar
2011-12-06T10:24:28Z

* Paul Mackerras <paulus@samba.org> wrote:

> On Tue, Dec 06, 2011 at 09:28:27AM +0100, Ingo Molnar wrote:
> >
> > * Sasha Levin <levinsasha928@gmail.com> wrote:
> >
> > > Ingo actually got us to remove all the PRI* specifiers, but
> > > that was back when we only did x86 :)
> > >
> > > Ingo, does it make sense to use them now when we support
> > > different architectures?
> >
> > Not at all - ppc should use a sane u64/s64 definition, i.e.
> > int-ll64.h instead of the int-l64.h crap.
> >
> > The powerpc maintainers indicated that they'd fix that, a couple
> > of years ago, but nothing appears to have come out of that.
>
> We changed it for the kernel, but not for userspace (i.e.
> glibc) because of concerns about possibly breaking existing
> userspace programs. [...]

Indeed, you do:

#if defined(__powerpc64__) && !defined(__KERNEL__)
# include <asm-generic/int-l64.h>
#else
# include <asm-generic/int-ll64.h>
#endif

which correctly uses int-ll64.h everywhere except 64-bit
userspace inclusions. So i take back my 'nothing appears to have
come out of that' comment - it's all nicely fixed!

> [...] I haven't looked closely at Matt's
> patches, but it should be possible to use [un]signed long long
> for the u64/s64 types, I would think.

In tools/kvm/ we are using our own u64/s64 definitions, not
glibc's, so i think it should be fine - as long as we don't pick
up int-l64.h accidentally via the
arch/powerpc/include/asm/types.h exception for user-space.

Stray uses of int64 should be converted to u64 (i see some in
tools/kvm/virtio/9p-pdu.c) but otherwise we should be ok -
unless i'm missing some complication.

Thanks,

Ingo