From f36c12ab311c7db808bfeda93bb95022020110cd Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 13 Apr 2011 15:57:39 -0400 Subject: [PATCH] Remove immediate values code (non-effective anyway) Signed-off-by: Mathieu Desnoyers --- include/Makefile.am | 1 - include/ust/immediate.h | 97 ---------------------------------------- include/ust/marker.h | 40 ++++------------- include/ust/tracepoint.h | 29 +++--------- include/ust/ust.h | 1 - libust/marker.c | 21 ++++----- libust/tracectl.c | 2 +- libust/tracepoint.c | 7 +-- 8 files changed, 26 insertions(+), 172 deletions(-) delete mode 100644 include/ust/immediate.h diff --git a/include/Makefile.am b/include/Makefile.am index e703ffd0..2133efdc 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,5 +1,4 @@ nobase_include_HEADERS = \ - ust/immediate.h \ ust/marker.h \ ust/tracepoint.h \ ust/define_trace.h \ diff --git a/include/ust/immediate.h b/include/ust/immediate.h deleted file mode 100644 index 1b117cfe..00000000 --- a/include/ust/immediate.h +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef _LINUX_IMMEDIATE_H -#define _LINUX_IMMEDIATE_H - -/* - * Immediate values, can be updated at runtime and save cache lines. - * - * (C) Copyright 2007 Mathieu Desnoyers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifdef USE_IMMEDIATE - -#include - -/** - * imv_set - set immediate variable (with locking) - * @name: immediate value name - * @i: required value - * - * Sets the value of @name, taking the module_mutex if required by - * the architecture. - */ -#define imv_set(name, i) \ - do { \ - name##__imv = (i); \ - core_imv_update(); \ - module_imv_update(); \ - } while (0) - -/* - * Internal update functions. - */ -extern void core_imv_update(void); -extern void imv_update_range(const struct __imv *begin, - const struct __imv *end); -extern void imv_unref_core_init(void); -extern void imv_unref(struct __imv *begin, struct __imv *end, void *start, - unsigned long size); - -#else - -/* - * Generic immediate values: a simple, standard, memory load. - */ - -/** - * imv_read - read immediate variable - * @name: immediate value name - * - * Reads the value of @name. - */ -#define imv_read(name) _imv_read(name) - -/** - * imv_set - set immediate variable (with locking) - * @name: immediate value name - * @i: required value - * - * Sets the value of @name, taking the module_mutex if required by - * the architecture. - */ -#define imv_set(name, i) (name##__imv = (i)) - -static inline void core_imv_update(void) { } -static inline void imv_unref_core_init(void) { } - -#endif - -#define DECLARE_IMV(type, name) extern __typeof__(type) name##__imv -#define DEFINE_IMV(type, name) __typeof__(type) name##__imv - -#define EXPORT_IMV_SYMBOL(name) EXPORT_SYMBOL(name##__imv) -#define EXPORT_IMV_SYMBOL_GPL(name) EXPORT_SYMBOL_GPL(name##__imv) - -/** - * _imv_read - Read immediate value with standard memory load. - * @name: immediate value name - * - * Force a data read of the immediate value instead of the immediate value - * based mechanism. Useful for __init and __exit section data read. - */ -#define _imv_read(name) (name##__imv) - -#endif diff --git a/include/ust/marker.h b/include/ust/marker.h index 99bb724c..13d81040 100644 --- a/include/ust/marker.h +++ b/include/ust/marker.h @@ -25,7 +25,6 @@ #define _UST_MARKER_H #include -#include #include #include #include @@ -64,7 +63,7 @@ struct ust_marker { const char *format; /* Marker format string, describing the * variable argument list. */ - DEFINE_IMV(char, state);/* Immediate value state. */ + char state; /* State. */ char ptype; /* probe type : 0 : single, 1 : multi */ /* Probe wrapper */ u16 channel_id; /* Numeric channel identifier, dynamic */ @@ -161,27 +160,18 @@ struct ust_marker { * Make sure the alignment of the structure in the __ust_marker section will * not add unwanted padding between the beginning of the section and the * structure. Force alignment to the same alignment as the section start. - * - * The "generic" argument controls which marker enabling mechanism must be used. - * If generic is true, a variable read is used. - * If generic is false, immediate values are used. */ -#define __ust_marker(generic, channel, name, call_private, format, args...) \ - __ust_marker_counter(generic, channel, name, __LINE__, call_private, format, ## args) +#define __ust_marker(channel, name, call_private, format, args...) \ + __ust_marker_counter(channel, name, __LINE__, call_private, format, ## args) -#define __ust_marker_counter(generic, channel, name, unique, call_private, format, args...) \ +#define __ust_marker_counter(channel, name, unique, call_private, format, args...) \ do { \ struct ust_marker *__ust_marker_counter_ptr; \ _DEFINE_UST_MARKER(channel, name, NULL, NULL, format, unique, __ust_marker_counter_ptr); \ __ust_marker_check_format(format, ## args); \ - if (!generic) { \ - if (unlikely(imv_read(__ust_marker_counter_ptr->state))) \ - (__ust_marker_counter_ptr->call)(__ust_marker_counter_ptr, call_private, &__ust_marker_regs, ## args); \ - } else { \ - if (unlikely(_imv_read(__ust_marker_counter_ptr->state))) \ - (__ust_marker_counter_ptr->call)(__ust_marker_counter_ptr, call_private, &__ust_marker_regs, ## args); \ - } \ + if (unlikely(__ust_marker_counter_ptr->state)) \ + (__ust_marker_counter_ptr->call)(__ust_marker_counter_ptr, call_private, &__ust_marker_regs, ## args); \ } while (0) #define __ust_marker_tp(channel, name, call_private, tp_name, tp_cb, format, args...) \ @@ -209,24 +199,10 @@ extern void ust_marker_update_probe_range(struct ust_marker * const *begin, * @format: format string * @args...: variable argument list * - * Places a marker using optimized code patching technique (imv_read()) - * to be enabled when immediate values are present. + * Places a marker at caller site. */ #define ust_marker(name, format, args...) \ - __ust_marker(0, ust, name, NULL, format, ## args) - -/** - * _ust_marker - Marker using variable read - * @name: marker name, not quoted. - * @format: format string - * @args...: variable argument list - * - * Places a marker using a standard memory read (_imv_read()) to be - * enabled. Should be used for markers in code paths where instruction - * modification based enabling is not welcome. - */ -#define _ust_marker(name, format, args...) \ - __ust_marker(1, ust, name, NULL, format, ## args) + __ust_marker(ust, name, NULL, format, ## args) /** * ust_marker_tp - Marker in a tracepoint callback diff --git a/include/ust/tracepoint.h b/include/ust/tracepoint.h index 626f8af5..34272053 100644 --- a/include/ust/tracepoint.h +++ b/include/ust/tracepoint.h @@ -27,7 +27,6 @@ #define _LGPL_SOURCE #include -#include #include struct module; @@ -40,7 +39,7 @@ struct probe { struct tracepoint { const char *name; /* Tracepoint name */ - DEFINE_IMV(char, state); /* State. */ + char state; /* State. */ struct probe *probes; }; @@ -86,39 +85,23 @@ struct tracepoint { rcu_read_unlock(); \ } while (0) -#define __CHECK_TRACE(name, generic, proto, args) \ +#define __CHECK_TRACE(name, proto, args) \ do { \ - if (!generic) { \ - if (unlikely(imv_read(__tracepoint_##name.state))) \ - __DO_TRACE(&__tracepoint_##name, \ - TP_PROTO(proto), TP_ARGS(args)); \ - } else { \ - if (unlikely(_imv_read(__tracepoint_##name.state))) \ - __DO_TRACE(&__tracepoint_##name, \ - TP_PROTO(proto), TP_ARGS(args)); \ - } \ + if (unlikely(__tracepoint_##name.state)) \ + __DO_TRACE(&__tracepoint_##name, \ + TP_PROTO(proto), TP_ARGS(args)); \ } while (0) /* * Make sure the alignment of the structure in the __tracepoints section will * not add unwanted padding between the beginning of the section and the * structure. Force alignment to the same alignment as the section start. - * - * The "generic" argument, passed to the declared __trace_##name inline - * function controls which tracepoint enabling mechanism must be used. - * If generic is true, a variable read is used. - * If generic is false, immediate values are used. */ #define __DECLARE_TRACE(name, proto, args, data_proto, data_args) \ extern struct tracepoint __tracepoint_##name; \ static inline void __trace_##name(proto) \ { \ - __CHECK_TRACE(name, 0, TP_PROTO(data_proto), \ - TP_ARGS(data_args)); \ - } \ - static inline void _trace_##name(proto) \ - { \ - __CHECK_TRACE(name, 1, TP_PROTO(data_proto), \ + __CHECK_TRACE(name, TP_PROTO(data_proto), \ TP_ARGS(data_args)); \ } \ static inline int \ diff --git a/include/ust/ust.h b/include/ust/ust.h index d99a706a..0c7e83fb 100644 --- a/include/ust/ust.h +++ b/include/ust/ust.h @@ -18,7 +18,6 @@ #ifndef UST_H #define UST_H -#include #include #include #include diff --git a/libust/marker.c b/libust/marker.c index 4a7eec63..ef606398 100644 --- a/libust/marker.c +++ b/libust/marker.c @@ -448,7 +448,7 @@ static struct ust_marker_entry *add_ust_marker(const char *channel, const char * e->call = ust_marker_probe_cb_noarg; else e->call = ust_marker_probe_cb; - __ust_marker(0, metadata, core_marker_format, NULL, + __ust_marker(metadata, core_marker_format, NULL, "channel %s name %s format %s", e->channel, e->name, e->format); } else { @@ -515,7 +515,7 @@ static int ust_marker_set_format(struct ust_marker_entry *entry, const char *for return -ENOMEM; entry->format_allocated = 1; - __ust_marker(0, metadata, core_marker_format, NULL, + __ust_marker(metadata, core_marker_format, NULL, "channel %s name %s format %s", entry->channel, entry->name, entry->format); return 0; @@ -580,7 +580,7 @@ static int set_ust_marker(struct ust_marker_entry *entry, struct ust_marker *ele cmm_smp_wmb(); elem->ptype = entry->ptype; - if (elem->tp_name && (active ^ _imv_read(elem->state))) { + if (elem->tp_name && (active ^ elem->state)) { WARN_ON(!elem->tp_cb); /* * It is ok to directly call the probe registration because type @@ -610,7 +610,7 @@ static int set_ust_marker(struct ust_marker_entry *entry, struct ust_marker *ele //ust// (unsigned long)elem->tp_cb)); } } - elem->state__imv = active; + elem->state = active; return ret; } @@ -626,7 +626,7 @@ static void disable_ust_marker(struct ust_marker *elem) int ret; /* leave "call" as is. It is known statically. */ - if (elem->tp_name && _imv_read(elem->state)) { + if (elem->tp_name && elem->state) { WARN_ON(!elem->tp_cb); /* * It is ok to directly call the probe registration because type @@ -641,7 +641,7 @@ static void disable_ust_marker(struct ust_marker *elem) */ //ust// module_put(__module_text_address((unsigned long)elem->tp_cb)); } - elem->state__imv = 0; + elem->state = 0; elem->single.func = __ust_marker_empty_function; /* Update the function before setting the ptype */ cmm_smp_wmb(); @@ -734,9 +734,6 @@ static void ust_marker_update_probes(void) { lib_update_ust_marker(); tracepoint_probe_update_all(); - /* Update immediate values */ - core_imv_update(); -//ust// module_imv_update(); /* FIXME: need to port for libs? */ ust_marker_update_processes(); } @@ -782,7 +779,7 @@ int ust_marker_probe_register(const char *channel, const char *name, goto error_unregister_channel; entry->event_id = ret; ret = 0; - __ust_marker(0, metadata, core_marker_id, NULL, + __ust_marker(metadata, core_marker_id, NULL, "channel %s name %s event_id %hu " "int #1u%zu long #1u%zu pointer #1u%zu " "size_t #1u%zu alignment #1u%u", @@ -1297,7 +1294,7 @@ void ltt_dump_ust_marker_state(struct ust_trace *trace) for (i = 0; i < ust_marker_TABLE_SIZE; i++) { head = &ust_marker_table[i]; cds_hlist_for_each_entry(entry, node, head, hlist) { - __ust_marker(0, metadata, core_marker_id, + __ust_marker(metadata, core_marker_id, &call_data, "channel %s name %s event_id %hu " "int #1u%zu long #1u%zu pointer #1u%zu " @@ -1309,7 +1306,7 @@ void ltt_dump_ust_marker_state(struct ust_trace *trace) sizeof(void *), sizeof(size_t), ltt_get_alignment()); if (entry->format) - __ust_marker(0, metadata, + __ust_marker(metadata, core_marker_format, &call_data, "channel %s name %s format %s", diff --git a/libust/tracectl.c b/libust/tracectl.c index 414162c1..9634f227 100644 --- a/libust/tracectl.c +++ b/libust/tracectl.c @@ -110,7 +110,7 @@ static void print_ust_marker(FILE *fp) fprintf(fp, "ust_marker: %s/%s %d \"%s\" %p\n", (*iter.ust_marker)->channel, (*iter.ust_marker)->name, - (int)imv_read((*iter.ust_marker)->state), + (int)(*iter.ust_marker)->state, (*iter.ust_marker)->format, (*iter.ust_marker)->location); ust_marker_iter_next(&iter); diff --git a/libust/tracepoint.c b/libust/tracepoint.c index a1aac826..87e53cc9 100644 --- a/libust/tracepoint.c +++ b/libust/tracepoint.c @@ -265,7 +265,7 @@ static void set_tracepoint(struct tracepoint_entry **entry, * is used. */ rcu_assign_pointer(elem->probes, (*entry)->probes); - elem->state__imv = active; + elem->state = active; } /* @@ -276,7 +276,7 @@ static void set_tracepoint(struct tracepoint_entry **entry, */ static void disable_tracepoint(struct tracepoint *elem) { - elem->state__imv = 0; + elem->state = 0; rcu_assign_pointer(elem->probes, NULL); } @@ -333,9 +333,6 @@ static void tracepoint_update_probes(void) //ust// __stop___tracepoints); /* tracepoints in modules. */ lib_update_tracepoints(); - /* Update immediate values */ - core_imv_update(); -//ust// module_imv_update(); } static struct probe * -- 2.34.1