23 #include <linux/vmalloc.h> 24 #include <linux/kernel.h> 25 #include <linux/jiffies.h> 26 #include <linux/version.h> 49 " a bitmask or comma separated list of subsystem names" 50 " of what should be printed immediately to console");
55 " trace level: level[+][,level[+]] where level is one of" 56 " call|debug|info|notice|warn|error|fatal");
61 " controls whether to display additional trace point" 62 " info, like subsystem, file, func, etc.; values:" 63 " none, func, short, full");
88 rc = kstrtoul(mask_str, 0, &mask);
97 if (mask_str_copy ==
NULL)
121 static unsigned long prev_jiffies = INITIAL_JIFFIES;
122 static uint64_t prev_logbuf_pos;
123 static uint64_t prev_rec_total;
125 if (prev_jiffies == INITIAL_JIFFIES) {
126 prev_jiffies = jiffies;
133 stats.trs_avg_rec_size = (rec_size +
stats.trs_avg_rec_size) / 2;
134 stats.trs_max_rec_size =
max(rec_size,
stats.trs_max_rec_size);
137 if (time_after_eq(jiffies, prev_jiffies + HZ)) {
138 stats.trs_rec_per_sec =
140 stats.trs_bytes_per_sec =
143 stats.trs_avg_rec_per_sec
144 = (
stats.trs_rec_per_sec +
stats.trs_avg_rec_per_sec) / 2;
145 stats.trs_avg_bytes_per_sec
146 = (
stats.trs_bytes_per_sec +
stats.trs_avg_bytes_per_sec) / 2;
148 stats.trs_max_rec_per_sec
150 stats.trs_max_bytes_per_sec
153 prev_jiffies = jiffies;
200 pr_err(
"motr: incorrect value for trace_buffer_size parameter," 201 " it can't be zero, should be a power of 2 and a" 202 " multiple of PAGE_SIZE value\n");
207 if (trace_area ==
NULL) {
208 pr_err(
"motr: failed to allocate %lu bytes for trace buffer\n",
220 pr_info(
"motr: trace buffer address: 0x%p\n",
m0_logbuf);
static void m0_atomic64_inc(struct m0_atomic64 *a)
M0_INTERNAL void m0_trace_buf_header_init(struct m0_trace_buf_header *tbh, size_t buf_size)
static struct m0_addb2_mach * m
void m0_error_printf(const char *fmt,...)
M0_INTERNAL void m0_trace_logbuf_size_set(size_t size)
M0_INTERNAL const char * m0_trace_file_path_get(void)
static bool m0_is_po2(uint64_t val)
module_param(trace_immediate_mask, charp, S_IRUGO)
void m0_console_vprintf(const char *fmt, va_list args)
#define M0_MOTR_KO_SIZE(module)
#define M0_TRACE_KBUF_SIZE
struct m0_trace_buf_header ta_header
static struct m0_trace_stats stats
M0_INTERNAL const struct module * m0_motr_ko_get_module(void)
M0_INTERNAL void m0_arch_trace_fini(void)
M0_INTERNAL int m0_trace_subsys_list_to_mask(char *subsys_names, unsigned long *ret_mask)
M0_INTERNAL void m0_trace_switch_to_static_logbuf(void)
static char * trace_immediate_mask
M0_INTERNAL int m0_trace_set_print_context(const char *ctx_name)
M0_INTERNAL void m0_trace_stats_update(uint32_t rec_size)
static long long max(long long a, long long b)
char * fmt(const char *format,...) __attribute__((format(printf
static int64_t m0_atomic64_get(const struct m0_atomic64 *a)
#define M0_MOTR_KO_BASE(module)
void m0_console_flush(void)
static unsigned long trace_buf_size
M0_INTERNAL int m0_trace_set_immediate_mask(const char *mask_str)
static char * trace_print_context
M0_INTERNAL const struct m0_trace_stats * m0_trace_get_stats(void)
MODULE_PARM_DESC(trace_immediate_mask, " a bitmask or comma separated list of subsystem names" " of what should be printed immediately to console")
unsigned long m0_trace_immediate_mask
M0_INTERNAL int m0_arch_trace_init()
M0_INTERNAL void m0_arch_trace_buf_header_init(struct m0_trace_buf_header *tbh)
struct m0_trace_buf_header * m0_logbuf_header
M0_INTERNAL uint64_t m0_trace_logbuf_pos_get(void)
static char * trace_level
static void m0_atomic64_set(struct m0_atomic64 *a, int64_t num)
M0_INTERNAL int m0_trace_set_level(const char *level_str)