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 <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3152310
(cherry picked from commit 083d7038d1)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3170281
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Jon Hunter
2024-06-06 11:39:48 +01:00
committed by mobile promotions
parent d99dede530
commit 537492a880
6 changed files with 94 additions and 10 deletions

View File

@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* 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, All rights reserved.
*/ #include <nvidia/conftest.h>
#undef TRACE_SYSTEM #undef TRACE_SYSTEM
#define TRACE_SYSTEM camera_common #define TRACE_SYSTEM camera_common
@@ -22,7 +22,11 @@ DECLARE_EVENT_CLASS(channel_simple,
__string(name, name) __string(name, name)
), ),
TP_fast_assign( TP_fast_assign(
#if defined(NV___ASSIGN_STR_HAS_NO_SRC_ARG)
__assign_str(name);
#else
__assign_str(name, name); __assign_str(name, name);
#endif
), ),
TP_printk("%s", __get_str(name)) TP_printk("%s", __get_str(name))
); );
@@ -50,7 +54,11 @@ DECLARE_EVENT_CLASS(channel,
__field(int, num) __field(int, num)
), ),
TP_fast_assign( TP_fast_assign(
#if defined(NV___ASSIGN_STR_HAS_NO_SRC_ARG)
__assign_str(name);
#else
__assign_str(name, name); __assign_str(name, name);
#endif
__entry->num = num; __entry->num = num;
), ),
TP_printk("%s : 0x%x", __get_str(name), (int)__entry->num) TP_printk("%s : 0x%x", __get_str(name), (int)__entry->num)
@@ -110,7 +118,11 @@ DECLARE_EVENT_CLASS(frame,
__field(long, tv_nsec) __field(long, tv_nsec)
), ),
TP_fast_assign( TP_fast_assign(
#if defined(NV___ASSIGN_STR_HAS_NO_SRC_ARG)
__assign_str(str);
#else
__assign_str(str, str); __assign_str(str, str);
#endif
__entry->tv_sec = ts->tv_sec; __entry->tv_sec = ts->tv_sec;
__entry->tv_nsec = ts->tv_nsec; __entry->tv_nsec = ts->tv_nsec;
), ),

View File

@@ -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 * imx185.h
*
* Copyright (c) 2017-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*/ */
#include <nvidia/conftest.h>
#undef TRACE_SYSTEM #undef TRACE_SYSTEM
#define TRACE_SYSTEM imx185 #define TRACE_SYSTEM imx185
@@ -22,7 +23,11 @@ TRACE_EVENT(imx185_s_stream,
__field(int, mode) __field(int, mode)
), ),
TP_fast_assign( TP_fast_assign(
#if defined(NV___ASSIGN_STR_HAS_NO_SRC_ARG)
__assign_str(name);
#else
__assign_str(name, name); __assign_str(name, name);
#endif
__entry->enable = enable; __entry->enable = enable;
__entry->mode = mode; __entry->mode = mode;
), ),

View File

@@ -4,6 +4,8 @@
* NvMap event logging to ftrace. * NvMap event logging to ftrace.
*/ */
#include <nvidia/conftest.h>
#undef TRACE_SYSTEM #undef TRACE_SYSTEM
#define TRACE_SYSTEM nvmap #define TRACE_SYSTEM nvmap
@@ -28,7 +30,11 @@ DECLARE_EVENT_CLASS(nvmap,
), ),
TP_fast_assign( TP_fast_assign(
__entry->client = client; __entry->client = client;
#if defined(NV___ASSIGN_STR_HAS_NO_SRC_ARG)
__assign_str(sname);
#else
__assign_str(sname, name); __assign_str(sname, name);
#endif
), ),
TP_printk("client=%p, name=%s", TP_printk("client=%p, name=%s",
__entry->client, __get_str(sname)) __entry->client, __get_str(sname))
@@ -64,7 +70,11 @@ TRACE_EVENT(nvmap_create_handle,
TP_fast_assign( TP_fast_assign(
__entry->client = client; __entry->client = client;
#if defined(NV___ASSIGN_STR_HAS_NO_SRC_ARG)
__assign_str(sname);
#else
__assign_str(sname, name); __assign_str(sname, name);
#endif
__entry->h = h; __entry->h = h;
__entry->size = size; __entry->size = size;
__entry->ref = ref; __entry->ref = ref;
@@ -147,7 +157,11 @@ DECLARE_EVENT_CLASS(nvmap_handle_summary,
__entry->size = size; __entry->size = size;
__entry->flags = flags; __entry->flags = flags;
__entry->tag = tag; __entry->tag = tag;
#if defined(NV___ASSIGN_STR_HAS_NO_SRC_ARG)
__assign_str(tag_name);
#else
__assign_str(tag_name, tag_name); __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", 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( TP_fast_assign(
__entry->client = client; __entry->client = client;
#if defined(NV___ASSIGN_STR_HAS_NO_SRC_ARG)
__assign_str(sname);
#else
__assign_str(sname, name); __assign_str(sname, name);
#endif
__entry->h = h; __entry->h = h;
__entry->pin_count = pin_count; __entry->pin_count = pin_count;
), ),
@@ -473,7 +491,11 @@ DECLARE_EVENT_CLASS(nvmap_dmabuf_2,
TP_fast_assign( TP_fast_assign(
__entry->dbuf = dbuf; __entry->dbuf = dbuf;
#if defined(NV___ASSIGN_STR_HAS_NO_SRC_ARG)
__assign_str(name);
#else
__assign_str(name, dev_name(dev)); __assign_str(name, dev_name(dev));
#endif
), ),
TP_printk("dmabuf=%p, device=%s", TP_printk("dmabuf=%p, device=%s",
@@ -841,7 +863,11 @@ TRACE_EVENT(refcount_get_handle_from_sci_ipc_id,
__entry->handle = handle; __entry->handle = handle;
__entry->dmabuf = dmabuf; __entry->dmabuf = dmabuf;
__entry->handle_ref = handle_ref; __entry->handle_ref = handle_ref;
#if defined(NV___ASSIGN_STR_HAS_NO_SRC_ARG)
__assign_str(acc_perm);
#else
__assign_str(acc_perm, perm); __assign_str(acc_perm, perm);
#endif
), ),
TP_printk("handle=0x%p, dmabuf=0x%p, handle_ref=%d, perm=%s", 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->dmabuf = dmabuf;
__entry->handle_ref = handle_ref; __entry->handle_ref = handle_ref;
__entry->dmabuf_ref = dmabuf_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); __assign_str(acc_perm, perm);
#endif
), ),
TP_printk("handle=0x%p, dmabuf=0x%p, handle_ref=%d, dmabuf_ref=%ld, perm=%s", TP_printk("handle=0x%p, dmabuf=0x%p, handle_ref=%d, dmabuf_ref=%ld, perm=%s",

View File

@@ -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 * ov5693.h
*
*/ */
#include <nvidia/conftest.h>
#undef TRACE_SYSTEM #undef TRACE_SYSTEM
#define TRACE_SYSTEM ov5693 #define TRACE_SYSTEM ov5693
@@ -22,7 +23,11 @@ TRACE_EVENT(ov5693_s_stream,
__field(int, mode) __field(int, mode)
), ),
TP_fast_assign( TP_fast_assign(
#if defined(NV___ASSIGN_STR_HAS_NO_SRC_ARG)
__assign_str(name);
#else
__assign_str(name, name); __assign_str(name, name);
#endif
__entry->enable = enable; __entry->enable = enable;
__entry->mode = mode; __entry->mode = mode;
), ),

View File

@@ -89,6 +89,7 @@ endef
# #
NV_CONFTEST_FUNCTION_COMPILE_TESTS += __alloc_disk_node_has_lkclass_arg 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_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_disk_for_queue
NV_CONFTEST_FUNCTION_COMPILE_TESTS += blk_mq_alloc_queue NV_CONFTEST_FUNCTION_COMPILE_TESTS += blk_mq_alloc_queue

View File

@@ -6451,6 +6451,37 @@ compile_test() {
compile_check_conftest "$CODE" "NV_CRYPTO_PRESENT" "" "symbols" 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 <linux/types.h>
#include <linux/tracepoint.h>
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 <trace/define_trace.h>" > 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) __alloc_disk_node_has_lkclass_arg)
# #
# Determine if the function __alloc_disk_node() has an 'lkclass' # Determine if the function __alloc_disk_node() has an 'lkclass'