Hi all, Today's linux-next merge of the ftrace tree got a conflict in: include/trace/trace_events.h between commit: d07c9ad62247 ("tracing: Introduce helpers to safely handle dynamic-sized sockaddrs") from the nfsd tree and commit: af6b9668e85f ("tracing: Move the defines to create TRACE_EVENTS into their own files") from the ftrace tree. Well, this is a pain :-( I fixed it up (I used the latter version of this file and then added the following merge fix patch) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts. From: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> Date: Tue, 15 Mar 2022 14:47:18 +1100 Subject: [PATCH] fix up for "tracing: Move the defines to create TRACE_EVENTS into their own files" Signed-off-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> --- include/trace/stages/stage1_defines.h | 6 ++++++ include/trace/stages/stage2_defines.h | 10 ++++++++-- include/trace/stages/stage3_defines.h | 6 ++++++ include/trace/stages/stage4_defines.h | 6 ++++++ include/trace/stages/stage5_defines.h | 6 ++++++ include/trace/stages/stage6_defines.h | 18 ++++++++++++++++++ include/trace/stages/stage7_defines.h | 2 ++ 7 files changed, 52 insertions(+), 2 deletions(-) diff --git a/include/trace/stages/stage1_defines.h b/include/trace/stages/stage1_defines.h index 8ab88c766d2b..a16783419687 100644 --- a/include/trace/stages/stage1_defines.h +++ b/include/trace/stages/stage1_defines.h @@ -29,6 +29,9 @@ #undef __bitmask #define __bitmask(item, nr_bits) __dynamic_array(char, item, -1) +#undef __sockaddr +#define __sockaddr(field, len) __dynamic_array(u8, field, len) + #undef __rel_dynamic_array #define __rel_dynamic_array(type, item, len) u32 __rel_loc_##item; @@ -41,5 +44,8 @@ #undef __rel_bitmask #define __rel_bitmask(item, nr_bits) __rel_dynamic_array(char, item, -1) +#undef __rel_sockaddr +#define __rel_sockaddr(field, len) __rel_dynamic_array(u8, field, len) + #undef TP_STRUCT__entry #define TP_STRUCT__entry(args...) args diff --git a/include/trace/stages/stage2_defines.h b/include/trace/stages/stage2_defines.h index 9f2341df40da..42fd1e8813ec 100644 --- a/include/trace/stages/stage2_defines.h +++ b/include/trace/stages/stage2_defines.h @@ -29,11 +29,14 @@ #undef __string #define __string(item, src) __dynamic_array(char, item, -1) +#undef __string_len +#define __string_len(item, src, len) __dynamic_array(char, item, -1) + #undef __bitmask #define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1) -#undef __string_len -#define __string_len(item, src, len) __dynamic_array(char, item, -1) +#undef __sockaddr +#define __sockaddr(field, len) __dynamic_array(u8, field, len) #undef __rel_dynamic_array #define __rel_dynamic_array(type, item, len) u32 item; @@ -46,3 +49,6 @@ #undef __rel_bitmask #define __rel_bitmask(item, nr_bits) __rel_dynamic_array(unsigned long, item, -1) + +#undef __rel_sockaddr +#define __rel_sockaddr(field, len) __rel_dynamic_array(u8, field, len) diff --git a/include/trace/stages/stage3_defines.h b/include/trace/stages/stage3_defines.h index 0bc131993b7a..e3b183e9d18e 100644 --- a/include/trace/stages/stage3_defines.h +++ b/include/trace/stages/stage3_defines.h @@ -51,6 +51,12 @@ trace_print_bitmask_seq(p, __bitmask, __bitmask_size); \ }) +#undef __get_sockaddr +#define __get_sockaddr(field) ((struct sockaddr *)__get_dynamic_array(field)) + +#undef __get_rel_sockaddr +#define __get_rel_sockaddr(field) ((struct sockaddr *)__get_rel_dynamic_array(field)) + #undef __print_flags #define __print_flags(flag, delim, flag_array...) \ ({ \ diff --git a/include/trace/stages/stage4_defines.h b/include/trace/stages/stage4_defines.h index 780a10fa5279..e80cdc397a43 100644 --- a/include/trace/stages/stage4_defines.h +++ b/include/trace/stages/stage4_defines.h @@ -41,6 +41,9 @@ #undef __bitmask #define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1) +#undef __sockaddr +#define __sockaddr(field, len) __dynamic_array(u8, field, len) + #undef __rel_dynamic_array #define __rel_dynamic_array(_type, _item, _len) { \ .type = "__rel_loc " #_type "[]", .name = #_item, \ @@ -55,3 +58,6 @@ #undef __rel_bitmask #define __rel_bitmask(item, nr_bits) __rel_dynamic_array(unsigned long, item, -1) + +#undef __rel_sockaddr +#define __rel_sockaddr(field, len) __rel_dynamic_array(u8, field, len) diff --git a/include/trace/stages/stage5_defines.h b/include/trace/stages/stage5_defines.h index fb15394aae31..7ee5931300e6 100644 --- a/include/trace/stages/stage5_defines.h +++ b/include/trace/stages/stage5_defines.h @@ -81,3 +81,9 @@ #undef __rel_bitmask #define __rel_bitmask(item, nr_bits) __rel_dynamic_array(unsigned long, item, \ __bitmask_size_in_longs(nr_bits)) + +#undef __sockaddr +#define __sockaddr(field, len) __dynamic_array(u8, field, len) + +#undef __rel_sockaddr +#define __rel_sockaddr(field, len) __rel_dynamic_array(u8, field, len) diff --git a/include/trace/stages/stage6_defines.h b/include/trace/stages/stage6_defines.h index b3a1f26026be..2ac88e1a7677 100644 --- a/include/trace/stages/stage6_defines.h +++ b/include/trace/stages/stage6_defines.h @@ -45,6 +45,15 @@ #define __assign_bitmask(dst, src, nr_bits) \ memcpy(__get_bitmask(dst), (src), __bitmask_size_in_bytes(nr_bits)) +#undef __sockaddr +#define __sockaddr(field, len) __dynamic_array(u8, field, len) + +#undef __get_sockaddr +#define __get_sockaddr(field) ((struct sockaddr *)__get_dynamic_array(field)) + +#define __assign_sockaddr(dest, src, len) \ + memcpy(__get_dynamic_array(dest), src, len) + #undef __rel_dynamic_array #define __rel_dynamic_array(type, item, len) \ __entry->__rel_loc_##item = __data_offsets.item; @@ -76,6 +85,15 @@ #define __assign_rel_bitmask(dst, src, nr_bits) \ memcpy(__get_rel_bitmask(dst), (src), __bitmask_size_in_bytes(nr_bits)) +#undef __rel_sockaddr +#define __rel_sockaddr(field, len) __rel_dynamic_array(u8, field, len) + +#undef __get_rel_sockaddr +#define __get_rel_sockaddr(field) ((struct sockaddr *)__get_rel_dynamic_array(field)) + +#define __assign_rel_sockaddr(dest, src, len) \ + memcpy(__get_rel_dynamic_array(dest), src, len) + #undef TP_fast_assign #define TP_fast_assign(args...) args diff --git a/include/trace/stages/stage7_defines.h b/include/trace/stages/stage7_defines.h index d65445328f18..8a7ec24c246d 100644 --- a/include/trace/stages/stage7_defines.h +++ b/include/trace/stages/stage7_defines.h @@ -13,10 +13,12 @@ #undef __get_dynamic_array_len #undef __get_str #undef __get_bitmask +#undef __get_sockaddr #undef __get_rel_dynamic_array #undef __get_rel_dynamic_array_len #undef __get_rel_str #undef __get_rel_bitmask +#undef __get_rel_sockaddr #undef __print_array #undef __print_hex_dump -- 2.34.1 However, my x86_64 allmodconfig build then failed like this: In file included from include/trace/define_custom_trace.h:55, from samples/trace_events/trace_custom_sched.h:95, from samples/trace_events/trace_custom_sched.c:24: samples/trace_events/./trace_custom_sched.h: In function 'ftrace_test_custom_probe_sched_switch': include/trace/trace_custom_events.h:178:42: error: passing argument 1 of 'check_trace_callback_type_sched_switch' from incompatible pointer type [-Werror=incompatible-pointer-types] 178 | check_trace_callback_type_##call(trace_custom_event_raw_event_##template); \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | void (*)(void *, bool, struct task_struct *, struct task_struct *) {aka void (*)(void *, _Bool, struct task_struct *, struct task_struct *)} include/trace/trace_custom_events.h:34:9: note: in expansion of macro 'DEFINE_CUSTOM_EVENT' 34 | DEFINE_CUSTOM_EVENT(name, name, PARAMS(proto), PARAMS(args)); | ^~~~~~~~~~~~~~~~~~~ samples/trace_events/./trace_custom_sched.h:21:1: note: in expansion of macro 'TRACE_CUSTOM_EVENT' 21 | TRACE_CUSTOM_EVENT(sched_switch, | ^~~~~~~~~~~~~~~~~~ In file included from include/linux/trace_events.h:11, from samples/trace_events/trace_custom_sched.c:10: include/linux/tracepoint.h:279:49: note: expected 'void (*)(void *, bool, unsigned int, struct task_struct *, struct task_struct *)' {aka 'void (*)(void *, _Bool, unsigned int, struct task_struct *, struct task_struct *)'} but argument is of type 'void (*)(void *, bool, struct task_struct *, struct task_struct *)' {aka 'void (*)(void *, _Bool, struct task_struct *, struct task_struct *)'} 279 | check_trace_callback_type_##name(void (*cb)(data_proto)) \ | ~~~~~~~^~~~~~~~~~~~~~~ include/linux/tracepoint.h:419:9: note: in expansion of macro '__DECLARE_TRACE' 419 | __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \ | ^~~~~~~~~~~~~~~ include/linux/tracepoint.h:553:9: note: in expansion of macro 'DECLARE_TRACE' 553 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) | ^~~~~~~~~~~~~ include/trace/events/sched.h:222:1: note: in expansion of macro 'TRACE_EVENT' 222 | TRACE_EVENT(sched_switch, | ^~~~~~~~~~~ So I gave up and uses the ftrace tree from next-20220310 for today. I am going to need some help with this mess, please. -- Cheers, Stephen Rothwell
Attachment:
pgpTDJ8g7aGO0.pgp
Description: OpenPGP digital signature