Lines Matching +full:realm +full:-
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2019-2022 Red Hat, Inc. Daniel Bristot de Oliveira <bristot@kernel.org>
16 * safety-critical systems.
24 * Springer, Cham, 2019. p. 315-332.
28 * De Oliveira, Daniel Bristot, et al. Automata-based formal analysis
29 * and verification of the real-time Linux kernel. PhD Thesis, 2020.
40 * model of the system, a set of instances of the monitor (per-cpu monitor,
41 * per-task monitor, and so on), and the helper functions that glue the
46 * Linux +----- RV Monitor ----------------------------------+ Formal
47 * Realm | | Realm
48 * +-------------------+ +----------------+ +-----------------+
50 * | Tracing | -> | Instance(s) | <- | Model |
52 * +-------------------+ +----------------+ +-----------------+
55 * | +----------+ |
57 * | +--+--+--+-+ |
59 * | | | +-> trace output ? |
60 * +------------------------|--|----------------------+
61 * | +----> panic ?
62 * +-------> <user-specified>
86 * - List the available monitors, one per line.
94 * - Lists the enabled monitors, one per line;
95 * - Writing to it enables a given monitor;
96 * - Writing a monitor name with a '!' prefix disables it;
97 * - Truncating the file disables all enabled monitors.
116 * - It is an on/off general switcher for monitoring. Note
118 * but stops the per-entity monitors from monitoring the events
133 * auto-generated wakeup in preemptive monitor.
138 * Documentation/trace/rv/runtime-verification.rst
177 return -EBUSY; in rv_get_task_monitor_slot()
190 return -EINVAL; in rv_get_task_monitor_slot()
205 task_monitor_count--; in rv_put_task_monitor_slot()
215 return mon->parent != NULL; in rv_is_nested_monitor()
224 * Keep both conditions in case we have some non-compliant containers.
230 if (list_is_last(&mon->list, &rv_monitors_list)) in rv_is_container_monitor()
235 return next->parent == mon || !mon->enable; in rv_is_container_monitor()
244 struct rv_monitor *mon = filp->private_data; in monitor_enable_read_data()
247 buff = mon->enabled ? "1\n" : "0\n"; in monitor_enable_read_data()
253 * __rv_disable_monitor - disabled an enabled monitor
259 if (mon->enabled) { in __rv_disable_monitor()
260 mon->enabled = 0; in __rv_disable_monitor()
261 if (mon->disable) in __rv_disable_monitor()
262 mon->disable(); in __rv_disable_monitor()
267 * be inconsistent. i.e., if the monitor is re-enabled. in __rv_disable_monitor()
287 if (mon->enabled) in rv_enable_single()
290 retval = mon->enable(); in rv_enable_single()
293 mon->enabled = 1; in rv_enable_single()
304 if (p->parent != mon) in rv_disable_container()
310 mon->enabled = 0; in rv_disable_container()
319 if (retval || p->parent != mon) in rv_enable_container()
326 mon->enabled = 1; in rv_enable_container()
331 * rv_disable_monitor - disable a given runtime monitor
347 * rv_enable_monitor - enable a given runtime monitor
370 struct rv_monitor *mon = filp->private_data; in monitor_enable_write_data()
402 struct rv_monitor *mon = filp->private_data; in monitor_desc_read_data()
407 snprintf(buff, sizeof(buff), "%s\n", mon->description); in monitor_desc_read_data()
424 struct dentry *root = parent ? parent->root_d : get_monitors_root(); in create_monitor_dir()
425 const char *name = mon->name; in create_monitor_dir()
429 mon->root_d = rv_create_dir(name, root); in create_monitor_dir()
430 if (!mon->root_d) in create_monitor_dir()
431 return -ENOMEM; in create_monitor_dir()
433 tmp = rv_create_file("enable", RV_MODE_WRITE, mon->root_d, mon, &interface_enable_fops); in create_monitor_dir()
435 retval = -ENOMEM; in create_monitor_dir()
439 tmp = rv_create_file("desc", RV_MODE_READ, mon->root_d, mon, &interface_desc_fops); in create_monitor_dir()
441 retval = -ENOMEM; in create_monitor_dir()
452 rv_remove(mon->root_d); in create_monitor_dir()
463 if (mon->parent) in monitors_show()
464 seq_printf(m, "%s:%s\n", mon->parent->name, mon->name); in monitors_show()
466 seq_printf(m, "%s\n", mon->name); in monitors_show()
503 if (mon->enabled) in enabled_monitors_next()
580 * be inconsistent. i.e., if the monitor is re-enabled. in disable_all_monitors()
590 if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC)) in enabled_monitors_open()
601 int retval = -EINVAL; in enabled_monitors_write()
607 return -EINVAL; in enabled_monitors_write()
611 retval = simple_write_to_buffer(buff, sizeof(buff) - 1, ppos, user_buf, count); in enabled_monitors_write()
613 return -EFAULT; in enabled_monitors_write()
628 retval = -EINVAL; in enabled_monitors_write()
636 if (strcmp(ptr, mon->name) != 0) in enabled_monitors_write()
671 * rv_monitoring_on - checks if monitoring is on
703 if (mon->enabled && mon->reset) in reset_all_monitors()
704 mon->reset(); in reset_all_monitors()
724 * Reset all monitors, forcing a re-sync. in turn_monitoring_on_with_reset()
749 * before returning to user-space. in monitoring_on_write_data()
766 rv_remove(mon->root_d); in destroy_monitor_dir()
770 * rv_register_monitor - register a rv monitor.
781 if (strlen(monitor->name) >= MAX_RV_MONITOR_NAME_SIZE) { in rv_register_monitor()
782 pr_info("Monitor %s has a name longer than %d\n", monitor->name, in rv_register_monitor()
784 return -EINVAL; in rv_register_monitor()
790 if (strcmp(monitor->name, r->name) == 0) { in rv_register_monitor()
791 pr_info("Monitor %s is already registered\n", monitor->name); in rv_register_monitor()
792 retval = -EEXIST; in rv_register_monitor()
799 parent->name); in rv_register_monitor()
800 retval = -EINVAL; in rv_register_monitor()
804 monitor->parent = parent; in rv_register_monitor()
812 list_add(&monitor->list, &parent->list); in rv_register_monitor()
814 list_add_tail(&monitor->list, &rv_monitors_list); in rv_register_monitor()
822 * rv_unregister_monitor - unregister a rv monitor.
832 list_del(&monitor->list); in rv_unregister_monitor()