Resguardo inicial

This commit is contained in:
lastdragon
2026-09-06 12:53:21 -06:00
parent 662efe3c2a
commit ad2088d178
94853 changed files with 43200404 additions and 0 deletions
@@ -0,0 +1,14 @@
# SPDX-License-Identifier: GPL-2.0-only
#
config RV_MON_WIP
depends on RV
depends on TRACE_PREEMPT_TOGGLE
select DA_MON_EVENTS_IMPLICIT
bool "wip monitor"
help
Enable wip (wakeup in preemptive) sample monitor that illustrates
the usage of per-cpu monitors, and one limitation of the
preempt_disable/enable events.
For further information, see:
Documentation/trace/rv/monitor_wip.rst
@@ -0,0 +1,85 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/ftrace.h>
#include <linux/tracepoint.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/rv.h>
#include <rv/instrumentation.h>
#define MODULE_NAME "wip"
#include <rv_trace.h>
#include <trace/events/sched.h>
#include <trace/events/preemptirq.h>
#define RV_MON_TYPE RV_MON_PER_CPU
#include "wip.h"
#include <rv/da_monitor.h>
static void handle_preempt_disable(void *data, unsigned long ip, unsigned long parent_ip)
{
da_handle_event(preempt_disable_wip);
}
static void handle_preempt_enable(void *data, unsigned long ip, unsigned long parent_ip)
{
da_handle_start_event(preempt_enable_wip);
}
static void handle_sched_waking(void *data, struct task_struct *task)
{
da_handle_event(sched_waking_wip);
}
static int enable_wip(void)
{
int retval;
retval = da_monitor_init();
if (retval)
return retval;
rv_attach_trace_probe("wip", preempt_enable, handle_preempt_enable);
rv_attach_trace_probe("wip", sched_waking, handle_sched_waking);
rv_attach_trace_probe("wip", preempt_disable, handle_preempt_disable);
return 0;
}
static void disable_wip(void)
{
rv_this.enabled = 0;
rv_detach_trace_probe("wip", preempt_disable, handle_preempt_disable);
rv_detach_trace_probe("wip", preempt_enable, handle_preempt_enable);
rv_detach_trace_probe("wip", sched_waking, handle_sched_waking);
da_monitor_destroy();
}
static struct rv_monitor rv_this = {
.name = "wip",
.description = "wakeup in preemptive per-cpu testing monitor.",
.enable = enable_wip,
.disable = disable_wip,
.reset = da_monitor_reset_all,
.enabled = 0,
};
static int __init register_wip(void)
{
return rv_register_monitor(&rv_this, NULL);
}
static void __exit unregister_wip(void)
{
rv_unregister_monitor(&rv_this);
}
module_init(register_wip);
module_exit(unregister_wip);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Daniel Bristot de Oliveira <bristot@kernel.org>");
MODULE_DESCRIPTION("wip: wakeup in preemptive - per-cpu sample monitor.");
@@ -0,0 +1,49 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Automatically generated C representation of wip automaton
* For further information about this format, see kernel documentation:
* Documentation/trace/rv/deterministic_automata.rst
*/
#define MONITOR_NAME wip
enum states_wip {
preemptive_wip,
non_preemptive_wip,
state_max_wip,
};
#define INVALID_STATE state_max_wip
enum events_wip {
preempt_disable_wip,
preempt_enable_wip,
sched_waking_wip,
event_max_wip,
};
struct automaton_wip {
char *state_names[state_max_wip];
char *event_names[event_max_wip];
unsigned char function[state_max_wip][event_max_wip];
unsigned char initial_state;
bool final_states[state_max_wip];
};
static const struct automaton_wip automaton_wip = {
.state_names = {
"preemptive",
"non_preemptive",
},
.event_names = {
"preempt_disable",
"preempt_enable",
"sched_waking",
},
.function = {
{ non_preemptive_wip, INVALID_STATE, INVALID_STATE },
{ INVALID_STATE, preemptive_wip, non_preemptive_wip },
},
.initial_state = preemptive_wip,
.final_states = { 1, 0 },
};
@@ -0,0 +1,15 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Snippet to be included in rv_trace.h
*/
#ifdef CONFIG_RV_MON_WIP
DEFINE_EVENT(event_da_monitor, event_wip,
TP_PROTO(char *state, char *event, char *next_state, bool final_state),
TP_ARGS(state, event, next_state, final_state));
DEFINE_EVENT(error_da_monitor, error_wip,
TP_PROTO(char *state, char *event),
TP_ARGS(state, event));
#endif /* CONFIG_RV_MON_WIP */