Skip to content

Commit

Permalink
WIP: Linux 6.10 compat: fix tracepoint compilation
Browse files Browse the repository at this point in the history
6.10 changed __assign_str() macro from two to one arg, so we need to
detect it.

WIP: needs configure to detect and set HAVE_ASSIGN_STR_2ARG

Signed-off-by: Rob Norris <[email protected]>
  • Loading branch information
robn committed Aug 24, 2024
1 parent cb36f4f commit ee94ce9
Show file tree
Hide file tree
Showing 17 changed files with 57 additions and 18 deletions.
1 change: 1 addition & 0 deletions include/os/linux/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ kernel_linux_HEADERS = \
%D%/kernel/linux/simd_arm.h \
%D%/kernel/linux/simd_powerpc.h \
%D%/kernel/linux/simd_x86.h \
%D%/kernel/linux/tracepoint_compat.h \
%D%/kernel/linux/utsname_compat.h \
%D%/kernel/linux/vfs_compat.h \
%D%/kernel/linux/xattr_compat.h
Expand Down
38 changes: 38 additions & 0 deletions include/os/linux/kernel/linux/tracepoint_compat.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or https://opensource.org/licenses/CDDL-1.0.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/

/*
* Copyright (c) 2024, Rob Norris <[email protected]>
*/

#ifndef _ZFS_TRACEPOINT_COMPAT_H
#define _ZFS_TRACEPOINT_COMPAT_H

#include <linux/tracepoint.h>

/* 6.10 __assign_str() dropped second arg. */
#ifdef HAVE_ASSIGN_STR_2ARG
#define __zfs_tracepoint_assign_str(a, b) __assign_str(a, b)
#else
#define __zfs_tracepoint_assign_str(a, b) __assign_str(a)

#endif /* _ZFS_TRACEPOINT_COMPAT_H */

2 changes: 1 addition & 1 deletion include/os/linux/spl/sys/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
#if !defined(_TRACE_ZFS_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_ZFS_H

#include <linux/tracepoint.h>
#include <linux/tracepoint_compat.h>
#include <sys/types.h>

/*
Expand Down
2 changes: 1 addition & 1 deletion include/os/linux/spl/sys/trace_taskq.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#if !defined(_TRACE_TASKQ_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_TASKQ_H

#include <linux/tracepoint.h>
#include <linux/tracepoint_compat.h>
#include <sys/types.h>

/*
Expand Down
2 changes: 1 addition & 1 deletion include/os/linux/zfs/sys/trace_acl.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#if !defined(_TRACE_ACL_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_ACL_H

#include <linux/tracepoint.h>
#include <linux/tracepoint_compat.h>
#include <linux/vfs_compat.h>
#include <sys/types.h>

Expand Down
2 changes: 1 addition & 1 deletion include/os/linux/zfs/sys/trace_arc.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#if !defined(_TRACE_ARC_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_ARC_H

#include <linux/tracepoint.h>
#include <linux/tracepoint_compat.h>
#include <sys/types.h>
#include <sys/trace_common.h> /* For ZIO macros */

Expand Down
2 changes: 1 addition & 1 deletion include/os/linux/zfs/sys/trace_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#ifndef _SYS_TRACE_COMMON_H
#define _SYS_TRACE_COMMON_H
#include <linux/tracepoint.h>
#include <linux/tracepoint_compat.h>

/* ZIO macros */
#define ZIO_TP_STRUCT_ENTRY \
Expand Down
4 changes: 2 additions & 2 deletions include/os/linux/zfs/sys/trace_dbgmsg.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#if !defined(_TRACE_DBGMSG_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_DBGMSG_H

#include <linux/tracepoint.h>
#include <linux/tracepoint_compat.h>

/*
* This file defines tracepoint events for use by the dbgmsg(),
Expand Down Expand Up @@ -59,7 +59,7 @@ DECLARE_EVENT_CLASS(zfs_dprintf_class,
__string(msg, msg)
),
TP_fast_assign(
__assign_str(msg, msg);
__zfs_tracepoint_assign_str(msg, msg);
),
TP_printk("%s", __get_str(msg))
);
Expand Down
6 changes: 3 additions & 3 deletions include/os/linux/zfs/sys/trace_dbuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#if !defined(_TRACE_DBUF_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_DBUF_H

#include <linux/tracepoint.h>
#include <linux/tracepoint_compat.h>
#include <sys/types.h>

#ifndef TRACE_DBUF_MSG_MAX
Expand Down Expand Up @@ -61,10 +61,10 @@
#define DBUF_TP_FAST_ASSIGN \
if (db != NULL) { \
if (POINTER_IS_VALID(DB_DNODE(db)->dn_objset)) { \
__assign_str(os_spa, \
__zfs_tracepoint_assign_str(os_spa, \
spa_name(DB_DNODE(db)->dn_objset->os_spa)); \
} else { \
__assign_str(os_spa, "NULL"); \
__zfs_tracepoint_assign_str(os_spa, "NULL"); \
} \
\
__entry->ds_object = db->db_objset->os_dsl_dataset ? \
Expand Down
2 changes: 1 addition & 1 deletion include/os/linux/zfs/sys/trace_dmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#if !defined(_TRACE_DMU_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_DMU_H

#include <linux/tracepoint.h>
#include <linux/tracepoint_compat.h>
#include <sys/types.h>

/*
Expand Down
2 changes: 1 addition & 1 deletion include/os/linux/zfs/sys/trace_dnode.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#if !defined(_TRACE_DNODE_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_DNODE_H

#include <linux/tracepoint.h>
#include <linux/tracepoint_compat.h>
#include <sys/types.h>

/*
Expand Down
2 changes: 1 addition & 1 deletion include/os/linux/zfs/sys/trace_multilist.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#if !defined(_TRACE_MULTILIST_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_MULTILIST_H

#include <linux/tracepoint.h>
#include <linux/tracepoint_compat.h>
#include <sys/types.h>

/*
Expand Down
2 changes: 1 addition & 1 deletion include/os/linux/zfs/sys/trace_txg.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#if !defined(_TRACE_TXG_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_TXG_H

#include <linux/tracepoint.h>
#include <linux/tracepoint_compat.h>
#include <sys/types.h>

/*
Expand Down
2 changes: 1 addition & 1 deletion include/os/linux/zfs/sys/trace_vdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#if !defined(_TRACE_VDEV_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_VDEV_H

#include <linux/tracepoint.h>
#include <linux/tracepoint_compat.h>
#include <sys/types.h>

/*
Expand Down
2 changes: 1 addition & 1 deletion include/os/linux/zfs/sys/trace_zil.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#if !defined(_TRACE_ZIL_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_ZIL_H

#include <linux/tracepoint.h>
#include <linux/tracepoint_compat.h>
#include <sys/types.h>

#define ZILOG_TP_STRUCT_ENTRY \
Expand Down
2 changes: 1 addition & 1 deletion include/os/linux/zfs/sys/trace_zio.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#if !defined(_TRACE_ZIO_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_ZIO_H

#include <linux/tracepoint.h>
#include <linux/tracepoint_compat.h>
#include <sys/types.h>
#include <sys/trace_common.h> /* For ZIO macros */

Expand Down
2 changes: 1 addition & 1 deletion include/os/linux/zfs/sys/trace_zrlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#if !defined(_TRACE_ZRLOCK_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_ZRLOCK_H

#include <linux/tracepoint.h>
#include <linux/tracepoint_compat.h>
#include <sys/types.h>

/*
Expand Down

0 comments on commit ee94ce9

Please sign in to comment.