From 083d7038d1f6ee277791afa96669b0865726a291 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Thu, 6 Jun 2024 11:39:48 +0100 Subject: [PATCH] trace: Fix build for Linux v6.10 In Linux v6.10, the __assign_str() macro was updated to remove the 2nd argument. Add a test to the conftest script to detect this and update the various trace header files as necessary. Bug 4593750 Change-Id: I495e78658249baa84cca5b864f4e172c1f3f0838 Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3152310 Tested-by: mobile promotions Reviewed-by: mobile promotions --- include/trace/events/camera_common.h | 18 +++++++++++++--- include/trace/events/imx185.h | 11 +++++++--- include/trace/events/nvmap.h | 30 +++++++++++++++++++++++++++ include/trace/events/ov5693.h | 13 ++++++++---- scripts/conftest/Makefile | 1 + scripts/conftest/conftest.sh | 31 ++++++++++++++++++++++++++++ 6 files changed, 94 insertions(+), 10 deletions(-) diff --git a/include/trace/events/camera_common.h b/include/trace/events/camera_common.h index dff5dc9a..c98bf0fd 100644 --- a/include/trace/events/camera_common.h +++ b/include/trace/events/camera_common.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (c) 2017-2023, NVIDIA CORPORATION, All rights reserved. - */ +/* SPDX-FileCopyrightText: Copyright (c) 2017-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ + +#include #undef TRACE_SYSTEM #define TRACE_SYSTEM camera_common @@ -22,7 +22,11 @@ DECLARE_EVENT_CLASS(channel_simple, __string(name, name) ), TP_fast_assign( +#if defined(NV___ASSIGN_STR_HAS_NO_SRC_ARG) + __assign_str(name); +#else __assign_str(name, name); +#endif ), TP_printk("%s", __get_str(name)) ); @@ -50,7 +54,11 @@ DECLARE_EVENT_CLASS(channel, __field(int, num) ), TP_fast_assign( +#if defined(NV___ASSIGN_STR_HAS_NO_SRC_ARG) + __assign_str(name); +#else __assign_str(name, name); +#endif __entry->num = num; ), TP_printk("%s : 0x%x", __get_str(name), (int)__entry->num) @@ -110,7 +118,11 @@ DECLARE_EVENT_CLASS(frame, __field(long, tv_nsec) ), TP_fast_assign( +#if defined(NV___ASSIGN_STR_HAS_NO_SRC_ARG) + __assign_str(str); +#else __assign_str(str, str); +#endif __entry->tv_sec = ts->tv_sec; __entry->tv_nsec = ts->tv_nsec; ), diff --git a/include/trace/events/imx185.h b/include/trace/events/imx185.h index 083a2c06..ec2da3ff 100644 --- a/include/trace/events/imx185.h +++ b/include/trace/events/imx185.h @@ -1,10 +1,11 @@ -/* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* SPDX-FileCopyrightText: Copyright (c) 2017-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ /* * imx185.h - * - * Copyright (c) 2017-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ +#include + #undef TRACE_SYSTEM #define TRACE_SYSTEM imx185 @@ -22,7 +23,11 @@ TRACE_EVENT(imx185_s_stream, __field(int, mode) ), TP_fast_assign( +#if defined(NV___ASSIGN_STR_HAS_NO_SRC_ARG) + __assign_str(name); +#else __assign_str(name, name); +#endif __entry->enable = enable; __entry->mode = mode; ), diff --git a/include/trace/events/nvmap.h b/include/trace/events/nvmap.h index 29f3fb8b..739d9b49 100644 --- a/include/trace/events/nvmap.h +++ b/include/trace/events/nvmap.h @@ -4,6 +4,8 @@ * NvMap event logging to ftrace. */ +#include + #undef TRACE_SYSTEM #define TRACE_SYSTEM nvmap @@ -28,7 +30,11 @@ DECLARE_EVENT_CLASS(nvmap, ), TP_fast_assign( __entry->client = client; +#if defined(NV___ASSIGN_STR_HAS_NO_SRC_ARG) + __assign_str(sname); +#else __assign_str(sname, name); +#endif ), TP_printk("client=%p, name=%s", __entry->client, __get_str(sname)) @@ -64,7 +70,11 @@ TRACE_EVENT(nvmap_create_handle, TP_fast_assign( __entry->client = client; +#if defined(NV___ASSIGN_STR_HAS_NO_SRC_ARG) + __assign_str(sname); +#else __assign_str(sname, name); +#endif __entry->h = h; __entry->size = size; __entry->ref = ref; @@ -147,7 +157,11 @@ DECLARE_EVENT_CLASS(nvmap_handle_summary, __entry->size = size; __entry->flags = flags; __entry->tag = tag; +#if defined(NV___ASSIGN_STR_HAS_NO_SRC_ARG) + __assign_str(tag_name); +#else __assign_str(tag_name, tag_name); +#endif ), TP_printk("client=0x%p pid=%d dupes=%u handle=0x%p share=%u base=%llx size=%zu flags=0x%x tag=0x%x %s", @@ -419,7 +433,11 @@ DECLARE_EVENT_CLASS(pin_unpin, TP_fast_assign( __entry->client = client; +#if defined(NV___ASSIGN_STR_HAS_NO_SRC_ARG) + __assign_str(sname); +#else __assign_str(sname, name); +#endif __entry->h = h; __entry->pin_count = pin_count; ), @@ -473,7 +491,11 @@ DECLARE_EVENT_CLASS(nvmap_dmabuf_2, TP_fast_assign( __entry->dbuf = dbuf; +#if defined(NV___ASSIGN_STR_HAS_NO_SRC_ARG) + __assign_str(name); +#else __assign_str(name, dev_name(dev)); +#endif ), TP_printk("dmabuf=%p, device=%s", @@ -841,7 +863,11 @@ TRACE_EVENT(refcount_get_handle_from_sci_ipc_id, __entry->handle = handle; __entry->dmabuf = dmabuf; __entry->handle_ref = handle_ref; +#if defined(NV___ASSIGN_STR_HAS_NO_SRC_ARG) + __assign_str(acc_perm); +#else __assign_str(acc_perm, perm); +#endif ), TP_printk("handle=0x%p, dmabuf=0x%p, handle_ref=%d, perm=%s", @@ -868,7 +894,11 @@ DECLARE_EVENT_CLASS(nvmap_refcount, __entry->dmabuf = dmabuf; __entry->handle_ref = handle_ref; __entry->dmabuf_ref = dmabuf_ref; +#if defined(NV___ASSIGN_STR_HAS_NO_SRC_ARG) + __assign_str(acc_perm); +#else __assign_str(acc_perm, perm); +#endif ), TP_printk("handle=0x%p, dmabuf=0x%p, handle_ref=%d, dmabuf_ref=%ld, perm=%s", diff --git a/include/trace/events/ov5693.h b/include/trace/events/ov5693.h index 4adf414d..c8052808 100644 --- a/include/trace/events/ov5693.h +++ b/include/trace/events/ov5693.h @@ -1,10 +1,11 @@ -/* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* SPDX-FileCopyrightText: Copyright (c) 2017-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ /* - * Copyright (c) 2017-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. - * * ov5693.h - * */ + +#include + #undef TRACE_SYSTEM #define TRACE_SYSTEM ov5693 @@ -22,7 +23,11 @@ TRACE_EVENT(ov5693_s_stream, __field(int, mode) ), TP_fast_assign( +#if defined(NV___ASSIGN_STR_HAS_NO_SRC_ARG) + __assign_str(name); +#else __assign_str(name, name); +#endif __entry->enable = enable; __entry->mode = mode; ), diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index 87fdeb1d..afd86e1a 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -89,6 +89,7 @@ endef # NV_CONFTEST_FUNCTION_COMPILE_TESTS += __alloc_disk_node_has_lkclass_arg +NV_CONFTEST_FUNCTION_COMPILE_TESTS += __assign_str_has_no_src_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += blk_execute_rq_has_no_gendisk_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += blk_mq_alloc_disk_for_queue NV_CONFTEST_FUNCTION_COMPILE_TESTS += blk_mq_alloc_queue diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index 78d21af6..07b04f61 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -6483,6 +6483,37 @@ compile_test() { compile_check_conftest "$CODE" "NV_CRYPTO_PRESENT" "" "symbols" ;; + __assign_str_has_no_src_arg) + # + echo " + #define TRACE_INCLUDE_FILE conftest$$ + #define TRACE_INCLUDE_PATH ${PWD} + + #include + #include + + TRACE_EVENT(conftest, + TP_PROTO(const char *test), + TP_ARGS(test), + TP_STRUCT__entry( + __string(test, test) + ), + TP_fast_assign( + __assign_str(test); + ), + TP_printk(\"test=%s\", __get_str(test)) + ); + #include " > conftest$$.h + + CODE=" + #define CREATE_TRACE_POINTS + #include \"conftest$$.h\" + " + + compile_check_conftest "$CODE" "NV___ASSIGN_STR_HAS_NO_SRC_ARG" "" "types" + rm conftest$$.h + ;; + __alloc_disk_node_has_lkclass_arg) # # Determine if the function __alloc_disk_node() has an 'lkclass'