* [PATCH] iproute2: fix type incompatibility in ifstat.c
@ 2024-02-06 14:22 Stephen Gallagher
2024-02-06 16:17 ` Andrea Claudi
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Stephen Gallagher @ 2024-02-06 14:22 UTC (permalink / raw)
To: netdev; +Cc: Stephen Gallagher
Throughout ifstat.c, ifstat_ent.val is accessed as a long long unsigned
type, however it is defined as __u64. This works by coincidence on many
systems, however on ppc64le, __u64 is a long unsigned.
This patch makes the type definition consistent with all of the places
where it is accessed.
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
---
misc/ifstat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/misc/ifstat.c b/misc/ifstat.c
index 721f4914..767cedd4 100644
--- a/misc/ifstat.c
+++ b/misc/ifstat.c
@@ -58,7 +58,7 @@ struct ifstat_ent {
struct ifstat_ent *next;
char *name;
int ifindex;
- __u64 val[MAXS];
+ unsigned long long val[MAXS];
double rate[MAXS];
__u32 ival[MAXS];
};
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] iproute2: fix type incompatibility in ifstat.c
2024-02-06 14:22 [PATCH] iproute2: fix type incompatibility in ifstat.c Stephen Gallagher
@ 2024-02-06 16:17 ` Andrea Claudi
2024-02-06 16:52 ` [PATCH iproute] Fix " Stephen Gallagher
2024-02-07 3:12 ` Stephen Hemminger
2 siblings, 0 replies; 8+ messages in thread
From: Andrea Claudi @ 2024-02-06 16:17 UTC (permalink / raw)
To: Stephen Gallagher; +Cc: netdev, stephen, dsahern
On Tue, Feb 06, 2024 at 09:22:06AM -0500, Stephen Gallagher wrote:
> Throughout ifstat.c, ifstat_ent.val is accessed as a long long unsigned
> type, however it is defined as __u64. This works by coincidence on many
> systems, however on ppc64le, __u64 is a long unsigned.
>
> This patch makes the type definition consistent with all of the places
> where it is accessed.
>
> Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
> ---
> misc/ifstat.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/misc/ifstat.c b/misc/ifstat.c
> index 721f4914..767cedd4 100644
> --- a/misc/ifstat.c
> +++ b/misc/ifstat.c
> @@ -58,7 +58,7 @@ struct ifstat_ent {
> struct ifstat_ent *next;
> char *name;
> int ifindex;
> - __u64 val[MAXS];
> + unsigned long long val[MAXS];
> double rate[MAXS];
> __u32 ival[MAXS];
> };
> --
> 2.43.0
>
Hi Stephen, thanks for taking care of this.
FYI, patch directed to iproute2 or iproute2-next tree should:
- preferrably have [PATCH iproute2] in their subject
- be directed or cc'd to iproute2 maintainers Stephen Hemminger and
David Ahern, and to the author of the fixed commit if possible.
This should include a Fixes: line on the commit changing val to __u64:
Fixes: 5a52102b7c8f ("ifstat: Add extended statistics to ifstat")
Stephen, David: do Stephen needs to resend this?
That said, patch looks good to me, so feel free to add my reviewed-by to
the following versions of this patch.
Reviewed-by: Andrea Claudi <aclaudi@redhat.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH iproute] Fix type incompatibility in ifstat.c
2024-02-06 14:22 [PATCH] iproute2: fix type incompatibility in ifstat.c Stephen Gallagher
2024-02-06 16:17 ` Andrea Claudi
@ 2024-02-06 16:52 ` Stephen Gallagher
2024-02-06 16:52 ` [PATCH] iproute2: fix " Stephen Gallagher
2024-02-07 3:12 ` Stephen Hemminger
2 siblings, 1 reply; 8+ messages in thread
From: Stephen Gallagher @ 2024-02-06 16:52 UTC (permalink / raw)
To: netdev; +Cc: stephen, dsahern
Fixes: 5a52102b7c8f ("ifstat: Add extended statistics to ifstat")
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] iproute2: fix type incompatibility in ifstat.c
2024-02-06 16:52 ` [PATCH iproute] Fix " Stephen Gallagher
@ 2024-02-06 16:52 ` Stephen Gallagher
2024-02-15 3:10 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 8+ messages in thread
From: Stephen Gallagher @ 2024-02-06 16:52 UTC (permalink / raw)
To: netdev; +Cc: stephen, dsahern, Stephen Gallagher, Andrea Claudi
Throughout ifstat.c, ifstat_ent.val is accessed as a long long unsigned
type, however it is defined as __u64. This works by coincidence on many
systems, however on ppc64le, __u64 is a long unsigned.
This patch makes the type definition consistent with all of the places
where it is accessed.
Fixes: 5a52102b7c8f ("ifstat: Add extended statistics to ifstat")
Reviewed-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
---
misc/ifstat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/misc/ifstat.c b/misc/ifstat.c
index 721f4914..767cedd4 100644
--- a/misc/ifstat.c
+++ b/misc/ifstat.c
@@ -58,7 +58,7 @@ struct ifstat_ent {
struct ifstat_ent *next;
char *name;
int ifindex;
- __u64 val[MAXS];
+ unsigned long long val[MAXS];
double rate[MAXS];
__u32 ival[MAXS];
};
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] iproute2: fix type incompatibility in ifstat.c
2024-02-06 14:22 [PATCH] iproute2: fix type incompatibility in ifstat.c Stephen Gallagher
2024-02-06 16:17 ` Andrea Claudi
2024-02-06 16:52 ` [PATCH iproute] Fix " Stephen Gallagher
@ 2024-02-07 3:12 ` Stephen Hemminger
2024-02-07 6:44 ` Florian Weimer
2024-02-08 18:17 ` Stephen Gallagher
2 siblings, 2 replies; 8+ messages in thread
From: Stephen Hemminger @ 2024-02-07 3:12 UTC (permalink / raw)
To: Stephen Gallagher; +Cc: netdev
On Tue, 6 Feb 2024 09:22:06 -0500
Stephen Gallagher <sgallagh@redhat.com> wrote:
> Throughout ifstat.c, ifstat_ent.val is accessed as a long long unsigned
> type, however it is defined as __u64. This works by coincidence on many
> systems, however on ppc64le, __u64 is a long unsigned.
>
> This patch makes the type definition consistent with all of the places
> where it is accessed.
>
> Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
> ---
Why not fix the use of unsigned long long to be __u64 instead?
That would make more sense.
Looking at ifstat it has other problems.
It doesn't check the sizes in the netlink response.
It really should be using 64 bit stat counters, not the legacy 32 bit
values. (ie IFLA_STATS64). Anyone want to take this on?X
Also, the cpu_hits offload code is a wart. If it is of interest, it should
be more than one stat.
One last issue, is that change the size of this structure will break old
history files.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] iproute2: fix type incompatibility in ifstat.c
2024-02-07 3:12 ` Stephen Hemminger
@ 2024-02-07 6:44 ` Florian Weimer
2024-02-08 18:17 ` Stephen Gallagher
1 sibling, 0 replies; 8+ messages in thread
From: Florian Weimer @ 2024-02-07 6:44 UTC (permalink / raw)
To: Stephen Hemminger
Cc: Stephen Gallagher, netdev, linux-kernel, linux-toolchains
* Stephen Hemminger:
> On Tue, 6 Feb 2024 09:22:06 -0500
> Stephen Gallagher <sgallagh@redhat.com> wrote:
>
>> Throughout ifstat.c, ifstat_ent.val is accessed as a long long unsigned
>> type, however it is defined as __u64. This works by coincidence on many
>> systems, however on ppc64le, __u64 is a long unsigned.
>>
>> This patch makes the type definition consistent with all of the places
>> where it is accessed.
>>
>> Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
>> ---
Patch was:
diff --git a/misc/ifstat.c b/misc/ifstat.c
index 721f4914..767cedd4 100644
--- a/misc/ifstat.c
+++ b/misc/ifstat.c
@@ -58,7 +58,7 @@ struct ifstat_ent {
struct ifstat_ent *next;
char *name;
int ifindex;
- __u64 val[MAXS];
+ unsigned long long val[MAXS];
double rate[MAXS];
__u32 ival[MAXS];
};
> Why not fix the use of unsigned long long to be __u64 instead?
> That would make more sense.
You still won't be able to use %llu to print it. I don't think the UAPI
headers provide anything like the <stdint.h> macros because the
assumption is that %llu is okay for printing __u64 on all architectures.
But we have this in POWER:
/*
* This is here because we used to use l64 for 64bit powerpc
* and we don't want to impact user mode with our change to ll64
* in the kernel.
*
* However, some user programs are fine with this. They can
* flag __SANE_USERSPACE_TYPES__ to get int-ll64.h here.
*/
#if !defined(__SANE_USERSPACE_TYPES__) && defined(__powerpc64__) && !defined(__KERNEL__)
# include <asm-generic/int-l64.h>
#else
# include <asm-generic/int-ll64.h>
#endif
I didn't know some architectures are that … different. Sadly this
wasn't fixed as part of the transition to powerpc64le.
I suppose iproute2 should build with -D__SANE_USERSPACE_TYPES__.
Thanks,
Florian
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] iproute2: fix type incompatibility in ifstat.c
2024-02-07 3:12 ` Stephen Hemminger
2024-02-07 6:44 ` Florian Weimer
@ 2024-02-08 18:17 ` Stephen Gallagher
1 sibling, 0 replies; 8+ messages in thread
From: Stephen Gallagher @ 2024-02-08 18:17 UTC (permalink / raw)
To: stephen; +Cc: netdev
On Tue, Feb 6, 2024 at 10:12 PM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> On Tue, 6 Feb 2024 09:22:06 -0500
> Stephen Gallagher <sgallagh@redhat.com> wrote:
>
> > Throughout ifstat.c, ifstat_ent.val is accessed as a long long unsigned
> > type, however it is defined as __u64. This works by coincidence on many
> > systems, however on ppc64le, __u64 is a long unsigned.
> >
> > This patch makes the type definition consistent with all of the places
> > where it is accessed.
> >
> > Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
> > ---
>
> Why not fix the use of unsigned long long to be __u64 instead?
> That would make more sense.
>
FWIW, that's the first path I tried, but it's accessed in dozens of
places, every one of which treats it as a 'long long unsigned'. That
led me to the belief that the specified type was just wrong (or at
minimum, in contravention of the consumers' expectations).
> Looking at ifstat it has other problems.
> It doesn't check the sizes in the netlink response.
>
> It really should be using 64 bit stat counters, not the legacy 32 bit
> values. (ie IFLA_STATS64). Anyone want to take this on?X
I definitely don't have the subject-matter expertise to do this,
sorry. Given that this issue is blocking our builds in Fedora/RHEL, I
was hoping we could try to solve the acute problem and leave
wider-ranging fixes to a separate effort.
> Also, the cpu_hits offload code is a wart. If it is of interest, it should
> be more than one stat.
>
> One last issue, is that change the size of this structure will break old
> history files.
>
I'm not sure I understand this; it looks to me like this is a private
structure. If it has API impact (as in, it's written directly to
output data meant to be re-read), shouldn't it be in a public header
and/or otherwise denoted as API?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] iproute2: fix type incompatibility in ifstat.c
2024-02-06 16:52 ` [PATCH] iproute2: fix " Stephen Gallagher
@ 2024-02-15 3:10 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-02-15 3:10 UTC (permalink / raw)
To: Stephen Gallagher; +Cc: netdev, stephen, dsahern, aclaudi
Hello:
This patch was applied to iproute2/iproute2.git (main)
by Stephen Hemminger <stephen@networkplumber.org>:
On Tue, 6 Feb 2024 11:52:34 -0500 you wrote:
> Throughout ifstat.c, ifstat_ent.val is accessed as a long long unsigned
> type, however it is defined as __u64. This works by coincidence on many
> systems, however on ppc64le, __u64 is a long unsigned.
>
> This patch makes the type definition consistent with all of the places
> where it is accessed.
>
> [...]
Here is the summary with links:
- iproute2: fix type incompatibility in ifstat.c
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=d9b886d745ad
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-02-15 3:10 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-06 14:22 [PATCH] iproute2: fix type incompatibility in ifstat.c Stephen Gallagher
2024-02-06 16:17 ` Andrea Claudi
2024-02-06 16:52 ` [PATCH iproute] Fix " Stephen Gallagher
2024-02-06 16:52 ` [PATCH] iproute2: fix " Stephen Gallagher
2024-02-15 3:10 ` patchwork-bot+netdevbpf
2024-02-07 3:12 ` Stephen Hemminger
2024-02-07 6:44 ` Florian Weimer
2024-02-08 18:17 ` Stephen Gallagher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).