Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control triggers at runtime #1646

Merged
merged 6 commits into from Jun 15, 2023
Merged

Conversation

clementguidi
Copy link
Contributor

@clementguidi clementguidi commented Mar 6, 2023

These commits give the user full control over triggers at runtime. It applies to
all actions.

It allows the user to control the target process from the client as follows:

  • add or update trigger actions
    • $ uftrace -p PID -T func@act1[,act2]
  • delete one or more trigger actions
    • $ uftrace -p PID -T func@act1[,act2],clear
  • delete all trigger actions for a symbol
    • $ uftrace -p PID -T func@clear

Trigger parameters can be omitted when deleting actions. For example:

  • $ uftrace -p PID -T func@depth,clear
  • $ uftrace -p PID -T func@time,read,clear

We also fix the --trigger option which was actually not implemented.

Based on #1645.

Copy link
Owner

@namhyung namhyung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. It might be in v0.14 if it finishes in time.

uftrace.c Show resolved Hide resolved
uftrace.h Outdated Show resolved Hide resolved
cmds/live.c Outdated Show resolved Hide resolved
utils/filter.c Outdated Show resolved Hide resolved
utils/filter.c Outdated Show resolved Hide resolved
utils/filter.c Outdated Show resolved Hide resolved
utils/filter.c Outdated Show resolved Hide resolved
tests/t286_agent_trigger.py Outdated Show resolved Hide resolved
tests/t286_agent_trigger.py Show resolved Hide resolved
tests/t286_agent_trigger.py Outdated Show resolved Hide resolved
@clementguidi
Copy link
Contributor Author

It might be in v0.14 if it finishes in time.

When do you plan to release v0.14?

@namhyung
Copy link
Owner

When do you plan to release v0.14?

No specific date, but I hope I can do it this weekend. :)

utils/filter.c Outdated Show resolved Hide resolved
utils/filter.c Outdated Show resolved Hide resolved
tests/t286_agent_trigger.py Outdated Show resolved Hide resolved
tests/t286_agent_trigger.py Outdated Show resolved Hide resolved
tests/t286_agent_trigger.py Outdated Show resolved Hide resolved
Copy link
Owner

@namhyung namhyung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update.

utils/filter.c Outdated Show resolved Hide resolved
utils/filter.c Outdated Show resolved Hide resolved
utils/filter.h Outdated Show resolved Hide resolved
utils/filter.c Outdated Show resolved Hide resolved
utils/filter.c Outdated Show resolved Hide resolved
tests/t286_agent_trigger.py Outdated Show resolved Hide resolved
@clementguidi
Copy link
Contributor Author

clementguidi commented Jun 12, 2023

Note: I renamed a field in the action structure, because I can never figure out intuitively whether flags represent the compatible or incompatible actions.

struct trigger_action_parser {
	const char *name;
	int (*parse)(char *action, struct uftrace_trigger *tr,
		     struct uftrace_filter_setting *setting);
-	unsigned long flags;
+	enum trigger_flag compat_flags; /* flags the action is restricted to */
};

@namhyung
Copy link
Owner

I'm ok with compat_flags, thanks!

utils/filter.c Outdated Show resolved Hide resolved
utils/filter.c Outdated Show resolved Hide resolved
utils/filter.c Outdated Show resolved Hide resolved
utils/filter.c Outdated Show resolved Hide resolved
utils/filter.c Outdated Show resolved Hide resolved
utils/filter.c Show resolved Hide resolved
Copy link
Owner

@namhyung namhyung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second last commit message looks squashed, please update. Otherwise looks good!

@clementguidi
Copy link
Contributor Author

The second last commit message looks squashed

Yes I missed that. Thank you again Namhyung!

@namhyung
Copy link
Owner

Can you please rebase to the current master?

The --trigger option was documented but not implemented.

Signed-off-by: Clément Guidi <cguidi@ciena.com>
Make it clear that the action flags are the flags the action is
compatible with.

Signed-off-by: Clément Guidi <cguidi@ciena.com>
Register triggers at runtime using the agent. The '--trigger' option can
be used from the client, and is forwarded to the target.

Signed-off-by: Clément Guidi <cguidi@ciena.com>
Handle 'clear' action separately so it doesn't interfere with other
actions' flags.

Signed-off-by: Clément Guidi <cguidi@ciena.com>
Disable and delete trigger actions at runtime from the client.

Use the 'clear' action to delete the given actions, or all actions
associated to a given symbol.

$ uftrace -p PID -T func@clear            # clear all 'func' triggers
$ uftrace -p PID -T func@clear=act1+act2  # clear act1 and act2 on 'func'

The following trigger actions are supported: arg, retval, filter, depth,
time, size, hide, trace, finish, read, color, backtrace, recover.

Signed-off-by: Clément Guidi <cguidi@ciena.com>
Add and remove various trigger actions at runtime.

Signed-off-by: Clément Guidi <cguidi@ciena.com>
@clementguidi
Copy link
Contributor Author

Done. I'm updating #1647 now.

Copy link
Owner

@namhyung namhyung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@namhyung namhyung merged commit ddf0017 into namhyung:master Jun 15, 2023
3 checks passed
@honggyukim honggyukim added this to the v0.14 milestone Jun 15, 2023
@clementguidi clementguidi deleted the runtime-triggers branch June 16, 2023 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants