From patchwork Fri Mar 24 22:30:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Beau Belgrave X-Patchwork-Id: 13187424 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 115CAC77B62 for ; Fri, 24 Mar 2023 22:30:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5D4D36B0074; Fri, 24 Mar 2023 18:30:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 55D9C6B0075; Fri, 24 Mar 2023 18:30:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3FDCC900002; Fri, 24 Mar 2023 18:30:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 254DC6B0075 for ; Fri, 24 Mar 2023 18:30:41 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id EB66A1208E6 for ; Fri, 24 Mar 2023 22:30:40 +0000 (UTC) X-FDA: 80605237440.24.F0D06E9 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by imf18.hostedemail.com (Postfix) with ESMTP id 2A0771C0016 for ; Fri, 24 Mar 2023 22:30:38 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=linux.microsoft.com header.s=default header.b=PC3fLGkF; spf=pass (imf18.hostedemail.com: domain of beaub@linux.microsoft.com designates 13.77.154.182 as permitted sender) smtp.mailfrom=beaub@linux.microsoft.com; dmarc=pass (policy=none) header.from=linux.microsoft.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679697039; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=OSmDP26J8YzoMhJc3UKK7slznwSGVE3KNwggNF1IdJc=; b=GctbFklKywGN8Loj+NmiAYBtcc9Gm6kVkK7RTHln6MPM1k6oFNqehjtfhL/LRkuV6JvhvP +petp1nypbhdLUTyCC3MR8wKTRMU8Z5dp4LUlqRvghUmXhfrrkwABsewc819nzptPsmIp/ WCLVQTM30JXtyhQNP9Pxsg0w3DyW3Y8= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=linux.microsoft.com header.s=default header.b=PC3fLGkF; spf=pass (imf18.hostedemail.com: domain of beaub@linux.microsoft.com designates 13.77.154.182 as permitted sender) smtp.mailfrom=beaub@linux.microsoft.com; dmarc=pass (policy=none) header.from=linux.microsoft.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679697039; a=rsa-sha256; cv=none; b=fchisvryTPEZgcwwk0Hg+cypp7MooxwO51EqvuHU3RCAfPkMaixQOzikt/MOD0UvWjeH2I Fw4PA9B7UQQHGFEJcM6upxjM2/S85RdyFQ7dGKoMNaiNobNrLOIz5lGImMiPT+Y0XES5zq Dv2t2aCD0aKkdHD5GMSTQS/7jP/E3W4= Received: from W11-BEAU-MD.localdomain (unknown [76.135.27.212]) by linux.microsoft.com (Postfix) with ESMTPSA id 9C8DA20FC45C; Fri, 24 Mar 2023 15:30:37 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 9C8DA20FC45C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1679697037; bh=OSmDP26J8YzoMhJc3UKK7slznwSGVE3KNwggNF1IdJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PC3fLGkFs4XtaJsoRdT5RfKgAC1GMmcW+2cgDHWwoFbnAwoO0UUq7EFue+kHRzR2H zSqIR9gkMpBxBWgGg1k6v2ZNOwx4uRxzH6Kdqb77Aq8Mt0oo970po/nf9+/yO0gHXd 0Gb2yLD3OieWzydLn1P3MlKXlJyvi8gXOEGeQo94= From: Beau Belgrave To: rostedt@goodmis.org, mhiramat@kernel.org, mathieu.desnoyers@efficios.com, dcook@linux.microsoft.com, alanau@linux.microsoft.com, brauner@kernel.org, akpm@linux-foundation.org, ebiederm@xmission.com, keescook@chromium.org, tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH v9 01/11] tracing/user_events: Split header into uapi and kernel Date: Fri, 24 Mar 2023 15:30:18 -0700 Message-Id: <20230324223028.172-2-beaub@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230324223028.172-1-beaub@linux.microsoft.com> References: <20230324223028.172-1-beaub@linux.microsoft.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 2A0771C0016 X-Stat-Signature: p8r9apnn5ygzwgixxhjuibbfmsjgxrpi X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1679697038-114599 X-HE-Meta: U2FsdGVkX1/RWqFiAClLv1WQVep+l9KRpKNfzEtf7XUZoLTg/axLJkL/Xs4+jwiAbm/LZSia1h2QCq5jmcBUX5gCleI+eMWogcDhTY4cnraDmwfIAHSDRG7vQkZsFFTCvUSOycV5c9XAYSsZlfleYR46IVet7T8vwj4FHlRQQZB/IlID84+7PnFdVVntTYeOGcenTfJ0sQG5/S5MD2eYZUPgRGnxtmX0/GqY++D3pgttVCWAe5Kzsd53guG4CZAiBmHSgah8o5YXBOq49BPdZwm/2J0bCQfEgeLT9uBTWtBpizmjtYOrNai6Se92PQHd3+GGXCgTd+tYqY/EAhZr4wmLVJU9aeYOe3k1Z5ZDrZrzTPCGw7ByzYER9NCcLICJHWHqvxaTTe6iQfzAkMPONvIBDFT6ilIXp0wnrY+a+q6QtUso5KqoZ+2t8JzvHL+ZDI4ZgqQNFN9jfqw2vKdgzq5/Js6ehdIiqsdX9CWGX6i5PegN9prb3gRoLTVcPa9XpmT6JKdVBSzXRFnb4nXIMhmgIsU+1HzpuUJhXV8n0whT+DWTL5NAccBYf/nV3KYPyKWBX0JroKVf1J0yafqIUwb1rXshYqqNtXr4IqEPZU0KO2GkXHBF54AUXhk93ktMz/UmHErMQC78MvnDGMbo3dVTBcQIs6A0Spvai7VW8VREM+8jX6YzySW5NDtU5PnkjmFhEWlU8DiJr5Mk0lnWCoK5qgkR7s4bQ76TPGfG3SdkUxx9hjbTUa+LNjOePsRq2S9s2ohwj9SrUecy8wBwk9KRRvYC3WO185zjnveSXnTK9RdmzBZqdFAcfb65DK+1O4YXTYCwxN+NotAFuAv0eepjO/Dv9kihDvKjMDqX5oYqNCVj6p/N0lSStkoYIUubLjX2SkcrQuUY9Ai+20cOS5z4y/sMVXcPx/nmXkYbqAW/7A3EF4O4tZe/tzu3f1o1UPydx3FTNy2/XRS/hfI u+ABSlYI pupt9VhWvK9zej+rHKhgUDSG1PFq1lafyT2GtXJFmn3pppnO7REygplAA8UdYxu6yeZC82ULiZvkgAEU1qe3dyhU7n4XHCUZ4U1r88D1Vqm9McndkAsNftbsevGtrNGqxqETVQCIfjhATZcpMf4n4aKeng0GEzG0mH8t+TlXFMTwLZlym7oxZuMQtmmLFS2yT48B0lCXhA5xYLtuuSKS9TcwXVJXdF8jeRbklqSDtSVFENx4lzI6fDeElDTaNbbIcbtw3VjXv3nJsLuLtzJDkjL7o/Bq1r+ITCqVVfql6kDr2nxs= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The UAPI parts need to be split out from the kernel parts of user_events now that other parts of the kernel will reference it. Do so by moving the existing include/linux/user_events.h into include/uapi/linux/user_events.h. Signed-off-by: Beau Belgrave --- include/linux/user_events.h | 52 ++++---------------------------- include/uapi/linux/user_events.h | 48 +++++++++++++++++++++++++++++ kernel/trace/trace_events_user.c | 5 --- 3 files changed, 54 insertions(+), 51 deletions(-) create mode 100644 include/uapi/linux/user_events.h diff --git a/include/linux/user_events.h b/include/linux/user_events.h index 592a3fbed98e..13689589d36e 100644 --- a/include/linux/user_events.h +++ b/include/linux/user_events.h @@ -1,54 +1,14 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2021, Microsoft Corporation. + * Copyright (c) 2022, Microsoft Corporation. * * Authors: * Beau Belgrave */ -#ifndef _UAPI_LINUX_USER_EVENTS_H -#define _UAPI_LINUX_USER_EVENTS_H -#include -#include +#ifndef _LINUX_USER_EVENTS_H +#define _LINUX_USER_EVENTS_H -#ifdef __KERNEL__ -#include -#else -#include -#endif +#include -#define USER_EVENTS_SYSTEM "user_events" -#define USER_EVENTS_PREFIX "u:" - -/* Create dynamic location entry within a 32-bit value */ -#define DYN_LOC(offset, size) ((size) << 16 | (offset)) - -/* - * Describes an event registration and stores the results of the registration. - * This structure is passed to the DIAG_IOCSREG ioctl, callers at a minimum - * must set the size and name_args before invocation. - */ -struct user_reg { - - /* Input: Size of the user_reg structure being used */ - __u32 size; - - /* Input: Pointer to string with event name, description and flags */ - __u64 name_args; - - /* Output: Bitwise index of the event within the status page */ - __u32 status_bit; - - /* Output: Index of the event to use when writing data */ - __u32 write_index; -} __attribute__((__packed__)); - -#define DIAG_IOC_MAGIC '*' - -/* Requests to register a user_event */ -#define DIAG_IOCSREG _IOWR(DIAG_IOC_MAGIC, 0, struct user_reg*) - -/* Requests to delete a user_event */ -#define DIAG_IOCSDEL _IOW(DIAG_IOC_MAGIC, 1, char*) - -#endif /* _UAPI_LINUX_USER_EVENTS_H */ +#endif /* _LINUX_USER_EVENTS_H */ diff --git a/include/uapi/linux/user_events.h b/include/uapi/linux/user_events.h new file mode 100644 index 000000000000..03f92366068d --- /dev/null +++ b/include/uapi/linux/user_events.h @@ -0,0 +1,48 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* + * Copyright (c) 2021-2022, Microsoft Corporation. + * + * Authors: + * Beau Belgrave + */ +#ifndef _UAPI_LINUX_USER_EVENTS_H +#define _UAPI_LINUX_USER_EVENTS_H + +#include +#include + +#define USER_EVENTS_SYSTEM "user_events" +#define USER_EVENTS_PREFIX "u:" + +/* Create dynamic location entry within a 32-bit value */ +#define DYN_LOC(offset, size) ((size) << 16 | (offset)) + +/* + * Describes an event registration and stores the results of the registration. + * This structure is passed to the DIAG_IOCSREG ioctl, callers at a minimum + * must set the size and name_args before invocation. + */ +struct user_reg { + + /* Input: Size of the user_reg structure being used */ + __u32 size; + + /* Input: Pointer to string with event name, description and flags */ + __u64 name_args; + + /* Output: Bitwise index of the event within the status page */ + __u32 status_bit; + + /* Output: Index of the event to use when writing data */ + __u32 write_index; +} __attribute__((__packed__)); + +#define DIAG_IOC_MAGIC '*' + +/* Request to register a user_event */ +#define DIAG_IOCSREG _IOWR(DIAG_IOC_MAGIC, 0, struct user_reg *) + +/* Request to delete a user_event */ +#define DIAG_IOCSDEL _IOW(DIAG_IOC_MAGIC, 1, char *) + +#endif /* _UAPI_LINUX_USER_EVENTS_H */ diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c index 908e8a13c675..070551480747 100644 --- a/kernel/trace/trace_events_user.c +++ b/kernel/trace/trace_events_user.c @@ -19,12 +19,7 @@ #include #include #include -/* Reminder to move to uapi when everything works */ -#ifdef CONFIG_COMPILE_TEST #include -#else -#include -#endif #include "trace.h" #include "trace_dynevent.h"