Skip to content

Commit b08d725

Browse files
beaubelgraverostedt
authored andcommitted
tracing/user_events: Store register flags on events
Currently we don't have any available flags for user processes to use to indicate options for user_events. We will soon have a flag to indicate the event should or should not auto-delete once it's not being used by anyone. Add a reg_flags field to user_events and parameters to existing functions to allow for this in future patches. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Beau Belgrave <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent ed0e0ae commit b08d725

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

kernel/trace/trace_events_user.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ struct user_event {
8787
struct list_head validators;
8888
refcount_t refcnt;
8989
int min_size;
90+
int reg_flags;
9091
char status;
9192
};
9293

@@ -165,7 +166,7 @@ typedef void (*user_event_func_t) (struct user_event *user, struct iov_iter *i,
165166

166167
static int user_event_parse(struct user_event_group *group, char *name,
167168
char *args, char *flags,
168-
struct user_event **newuser);
169+
struct user_event **newuser, int reg_flags);
169170

170171
static struct user_event_mm *user_event_mm_get(struct user_event_mm *mm);
171172
static struct user_event_mm *user_event_mm_get_all(struct user_event *user);
@@ -810,7 +811,8 @@ static struct list_head *user_event_get_fields(struct trace_event_call *call)
810811
* Upon success user_event has its ref count increased by 1.
811812
*/
812813
static int user_event_parse_cmd(struct user_event_group *group,
813-
char *raw_command, struct user_event **newuser)
814+
char *raw_command, struct user_event **newuser,
815+
int reg_flags)
814816
{
815817
char *name = raw_command;
816818
char *args = strpbrk(name, " ");
@@ -824,7 +826,7 @@ static int user_event_parse_cmd(struct user_event_group *group,
824826
if (flags)
825827
*flags++ = '\0';
826828

827-
return user_event_parse(group, name, args, flags, newuser);
829+
return user_event_parse(group, name, args, flags, newuser, reg_flags);
828830
}
829831

830832
static int user_field_array_size(const char *type)
@@ -1588,7 +1590,7 @@ static int user_event_create(const char *raw_command)
15881590

15891591
mutex_lock(&group->reg_mutex);
15901592

1591-
ret = user_event_parse_cmd(group, name, &user);
1593+
ret = user_event_parse_cmd(group, name, &user, 0);
15921594

15931595
if (!ret)
15941596
refcount_dec(&user->refcnt);
@@ -1751,7 +1753,7 @@ static int user_event_trace_register(struct user_event *user)
17511753
*/
17521754
static int user_event_parse(struct user_event_group *group, char *name,
17531755
char *args, char *flags,
1754-
struct user_event **newuser)
1756+
struct user_event **newuser, int reg_flags)
17551757
{
17561758
int ret;
17571759
u32 key;
@@ -1846,6 +1848,8 @@ static int user_event_parse(struct user_event_group *group, char *name,
18461848
if (ret)
18471849
goto put_user_lock;
18481850

1851+
user->reg_flags = reg_flags;
1852+
18491853
/* Ensure we track self ref and caller ref (2) */
18501854
refcount_set(&user->refcnt, 2);
18511855

@@ -2144,7 +2148,7 @@ static long user_events_ioctl_reg(struct user_event_file_info *info,
21442148
return ret;
21452149
}
21462150

2147-
ret = user_event_parse_cmd(info->group, name, &user);
2151+
ret = user_event_parse_cmd(info->group, name, &user, reg.flags);
21482152

21492153
if (ret) {
21502154
kfree(name);

0 commit comments

Comments
 (0)