2023-10-16 12:49:34

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH] neighbor: tracing: Move pin6 inside CONFIG_IPV6=y section

When CONFIG_IPV6=n, and building with W=1:

In file included from include/trace/define_trace.h:102,
from include/trace/events/neigh.h:255,
from net/core/net-traces.c:51:
include/trace/events/neigh.h: In function ‘trace_event_raw_event_neigh_create’:
include/trace/events/neigh.h:42:34: error: variable ‘pin6’ set but not used [-Werror=unused-but-set-variable]
42 | struct in6_addr *pin6;
| ^~~~
include/trace/trace_events.h:402:11: note: in definition of macro ‘DECLARE_EVENT_CLASS’
402 | { assign; } \
| ^~~~~~
include/trace/trace_events.h:44:30: note: in expansion of macro ‘PARAMS’
44 | PARAMS(assign), \
| ^~~~~~
include/trace/events/neigh.h:23:1: note: in expansion of macro ‘TRACE_EVENT’
23 | TRACE_EVENT(neigh_create,
| ^~~~~~~~~~~
include/trace/events/neigh.h:41:9: note: in expansion of macro ‘TP_fast_assign’
41 | TP_fast_assign(
| ^~~~~~~~~~~~~~
In file included from include/trace/define_trace.h:103,
from include/trace/events/neigh.h:255,
from net/core/net-traces.c:51:
include/trace/events/neigh.h: In function ‘perf_trace_neigh_create’:
include/trace/events/neigh.h:42:34: error: variable ‘pin6’ set but not used [-Werror=unused-but-set-variable]
42 | struct in6_addr *pin6;
| ^~~~
include/trace/perf.h:51:11: note: in definition of macro ‘DECLARE_EVENT_CLASS’
51 | { assign; } \
| ^~~~~~
include/trace/trace_events.h:44:30: note: in expansion of macro ‘PARAMS’
44 | PARAMS(assign), \
| ^~~~~~
include/trace/events/neigh.h:23:1: note: in expansion of macro ‘TRACE_EVENT’
23 | TRACE_EVENT(neigh_create,
| ^~~~~~~~~~~
include/trace/events/neigh.h:41:9: note: in expansion of macro ‘TP_fast_assign’
41 | TP_fast_assign(
| ^~~~~~~~~~~~~~

Indeed, the variable pin6 is declared and initialized unconditionally,
while it is only used and needlessly re-initialized when support for
IPv6 is enabled.

Fix this by dropping the unused variable initialization, and moving the
variable declaration inside the existing section protected by a check
for CONFIG_IPV6.

Fixes: fc651001d2c5ca4f ("neighbor: Add tracepoint to __neigh_create")
Signed-off-by: Geert Uytterhoeven <[email protected]>
---
No changes in generated code.

include/trace/events/neigh.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/trace/events/neigh.h b/include/trace/events/neigh.h
index 5eaa1fa9917153f6..833143d0992e063b 100644
--- a/include/trace/events/neigh.h
+++ b/include/trace/events/neigh.h
@@ -39,7 +39,6 @@ TRACE_EVENT(neigh_create,
),

TP_fast_assign(
- struct in6_addr *pin6;
__be32 *p32;

__entry->family = tbl->family;
@@ -47,7 +46,6 @@ TRACE_EVENT(neigh_create,
__entry->entries = atomic_read(&tbl->gc_entries);
__entry->created = n != NULL;
__entry->gc_exempt = exempt_from_gc;
- pin6 = (struct in6_addr *)__entry->primary_key6;
p32 = (__be32 *)__entry->primary_key4;

if (tbl->family == AF_INET)
@@ -57,6 +55,8 @@ TRACE_EVENT(neigh_create,

#if IS_ENABLED(CONFIG_IPV6)
if (tbl->family == AF_INET6) {
+ struct in6_addr *pin6;
+
pin6 = (struct in6_addr *)__entry->primary_key6;
*pin6 = *(struct in6_addr *)pkey;
}
--
2.34.1


2023-10-17 10:00:00

by Simon Horman

[permalink] [raw]
Subject: Re: [PATCH] neighbor: tracing: Move pin6 inside CONFIG_IPV6=y section

On Mon, Oct 16, 2023 at 02:49:04PM +0200, Geert Uytterhoeven wrote:
> When CONFIG_IPV6=n, and building with W=1:
>
> In file included from include/trace/define_trace.h:102,
> from include/trace/events/neigh.h:255,
> from net/core/net-traces.c:51:
> include/trace/events/neigh.h: In function ‘trace_event_raw_event_neigh_create’:
> include/trace/events/neigh.h:42:34: error: variable ‘pin6’ set but not used [-Werror=unused-but-set-variable]
> 42 | struct in6_addr *pin6;
> | ^~~~
> include/trace/trace_events.h:402:11: note: in definition of macro ‘DECLARE_EVENT_CLASS’
> 402 | { assign; } \
> | ^~~~~~
> include/trace/trace_events.h:44:30: note: in expansion of macro ‘PARAMS’
> 44 | PARAMS(assign), \
> | ^~~~~~
> include/trace/events/neigh.h:23:1: note: in expansion of macro ‘TRACE_EVENT’
> 23 | TRACE_EVENT(neigh_create,
> | ^~~~~~~~~~~
> include/trace/events/neigh.h:41:9: note: in expansion of macro ‘TP_fast_assign’
> 41 | TP_fast_assign(
> | ^~~~~~~~~~~~~~
> In file included from include/trace/define_trace.h:103,
> from include/trace/events/neigh.h:255,
> from net/core/net-traces.c:51:
> include/trace/events/neigh.h: In function ‘perf_trace_neigh_create’:
> include/trace/events/neigh.h:42:34: error: variable ‘pin6’ set but not used [-Werror=unused-but-set-variable]
> 42 | struct in6_addr *pin6;
> | ^~~~
> include/trace/perf.h:51:11: note: in definition of macro ‘DECLARE_EVENT_CLASS’
> 51 | { assign; } \
> | ^~~~~~
> include/trace/trace_events.h:44:30: note: in expansion of macro ‘PARAMS’
> 44 | PARAMS(assign), \
> | ^~~~~~
> include/trace/events/neigh.h:23:1: note: in expansion of macro ‘TRACE_EVENT’
> 23 | TRACE_EVENT(neigh_create,
> | ^~~~~~~~~~~
> include/trace/events/neigh.h:41:9: note: in expansion of macro ‘TP_fast_assign’
> 41 | TP_fast_assign(
> | ^~~~~~~~~~~~~~
>
> Indeed, the variable pin6 is declared and initialized unconditionally,
> while it is only used and needlessly re-initialized when support for
> IPv6 is enabled.
>
> Fix this by dropping the unused variable initialization, and moving the
> variable declaration inside the existing section protected by a check
> for CONFIG_IPV6.
>
> Fixes: fc651001d2c5ca4f ("neighbor: Add tracepoint to __neigh_create")
> Signed-off-by: Geert Uytterhoeven <[email protected]>

Reviewed-by: Simon Horman <[email protected]>
Tested-by: Simon Horman <[email protected]> # build-tested

2023-10-17 15:06:56

by David Ahern

[permalink] [raw]
Subject: Re: [PATCH] neighbor: tracing: Move pin6 inside CONFIG_IPV6=y section

On 10/16/23 6:49 AM, Geert Uytterhoeven wrote:
> When CONFIG_IPV6=n, and building with W=1:
>
> In file included from include/trace/define_trace.h:102,
> from include/trace/events/neigh.h:255,
> from net/core/net-traces.c:51:
> include/trace/events/neigh.h: In function ‘trace_event_raw_event_neigh_create’:
> include/trace/events/neigh.h:42:34: error: variable ‘pin6’ set but not used [-Werror=unused-but-set-variable]
> 42 | struct in6_addr *pin6;
> | ^~~~
> include/trace/trace_events.h:402:11: note: in definition of macro ‘DECLARE_EVENT_CLASS’
> 402 | { assign; } \
> | ^~~~~~
> include/trace/trace_events.h:44:30: note: in expansion of macro ‘PARAMS’
> 44 | PARAMS(assign), \
> | ^~~~~~
> include/trace/events/neigh.h:23:1: note: in expansion of macro ‘TRACE_EVENT’
> 23 | TRACE_EVENT(neigh_create,
> | ^~~~~~~~~~~
> include/trace/events/neigh.h:41:9: note: in expansion of macro ‘TP_fast_assign’
> 41 | TP_fast_assign(
> | ^~~~~~~~~~~~~~
> In file included from include/trace/define_trace.h:103,
> from include/trace/events/neigh.h:255,
> from net/core/net-traces.c:51:
> include/trace/events/neigh.h: In function ‘perf_trace_neigh_create’:
> include/trace/events/neigh.h:42:34: error: variable ‘pin6’ set but not used [-Werror=unused-but-set-variable]
> 42 | struct in6_addr *pin6;
> | ^~~~
> include/trace/perf.h:51:11: note: in definition of macro ‘DECLARE_EVENT_CLASS’
> 51 | { assign; } \
> | ^~~~~~
> include/trace/trace_events.h:44:30: note: in expansion of macro ‘PARAMS’
> 44 | PARAMS(assign), \
> | ^~~~~~
> include/trace/events/neigh.h:23:1: note: in expansion of macro ‘TRACE_EVENT’
> 23 | TRACE_EVENT(neigh_create,
> | ^~~~~~~~~~~
> include/trace/events/neigh.h:41:9: note: in expansion of macro ‘TP_fast_assign’
> 41 | TP_fast_assign(
> | ^~~~~~~~~~~~~~
>
> Indeed, the variable pin6 is declared and initialized unconditionally,
> while it is only used and needlessly re-initialized when support for
> IPv6 is enabled.
>
> Fix this by dropping the unused variable initialization, and moving the
> variable declaration inside the existing section protected by a check
> for CONFIG_IPV6.
>
> Fixes: fc651001d2c5ca4f ("neighbor: Add tracepoint to __neigh_create")
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> ---
> No changes in generated code.
>
> include/trace/events/neigh.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>

Reviewed-by: David Ahern <[email protected]>

Google put your email in the spam folder, BTW.

2023-10-18 10:21:12

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH] neighbor: tracing: Move pin6 inside CONFIG_IPV6=y section

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:

On Mon, 16 Oct 2023 14:49:04 +0200 you wrote:
> When CONFIG_IPV6=n, and building with W=1:
>
> In file included from include/trace/define_trace.h:102,
> from include/trace/events/neigh.h:255,
> from net/core/net-traces.c:51:
> include/trace/events/neigh.h: In function ‘trace_event_raw_event_neigh_create’:
> include/trace/events/neigh.h:42:34: error: variable ‘pin6’ set but not used [-Werror=unused-but-set-variable]
> 42 | struct in6_addr *pin6;
> | ^~~~
> include/trace/trace_events.h:402:11: note: in definition of macro ‘DECLARE_EVENT_CLASS’
> 402 | { assign; } \
> | ^~~~~~
> include/trace/trace_events.h:44:30: note: in expansion of macro ‘PARAMS’
> 44 | PARAMS(assign), \
> | ^~~~~~
> include/trace/events/neigh.h:23:1: note: in expansion of macro ‘TRACE_EVENT’
> 23 | TRACE_EVENT(neigh_create,
> | ^~~~~~~~~~~
> include/trace/events/neigh.h:41:9: note: in expansion of macro ‘TP_fast_assign’
> 41 | TP_fast_assign(
> | ^~~~~~~~~~~~~~
> In file included from include/trace/define_trace.h:103,
> from include/trace/events/neigh.h:255,
> from net/core/net-traces.c:51:
> include/trace/events/neigh.h: In function ‘perf_trace_neigh_create’:
> include/trace/events/neigh.h:42:34: error: variable ‘pin6’ set but not used [-Werror=unused-but-set-variable]
> 42 | struct in6_addr *pin6;
> | ^~~~
> include/trace/perf.h:51:11: note: in definition of macro ‘DECLARE_EVENT_CLASS’
> 51 | { assign; } \
> | ^~~~~~
> include/trace/trace_events.h:44:30: note: in expansion of macro ‘PARAMS’
> 44 | PARAMS(assign), \
> | ^~~~~~
> include/trace/events/neigh.h:23:1: note: in expansion of macro ‘TRACE_EVENT’
> 23 | TRACE_EVENT(neigh_create,
> | ^~~~~~~~~~~
> include/trace/events/neigh.h:41:9: note: in expansion of macro ‘TP_fast_assign’
> 41 | TP_fast_assign(
> | ^~~~~~~~~~~~~~
>
> [...]

Here is the summary with links:
- neighbor: tracing: Move pin6 inside CONFIG_IPV6=y section
https://git.kernel.org/netdev/net/c/2915240eddba

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html