d->max_vcpus = config->max_vcpus;
}
- lock_profile_register_struct(LOCKPROF_TYPE_PERDOM, d, domid, "Domain");
+ lock_profile_register_struct(LOCKPROF_TYPE_PERDOM, d, domid);
if ( (err = xsm_alloc_security_domain(d)) != 0 )
goto fail;
struct lock_profile_anc {
struct lock_profile_qhead *head_q; /* first head of this type */
- char *name; /* descriptive string for print */
+ const char *name; /* descriptive string for print */
};
typedef void lock_profile_subfunc(
extern struct lock_profile *__lock_profile_end;
static s_time_t lock_profile_start;
-static struct lock_profile_anc lock_profile_ancs[LOCKPROF_TYPE_N];
+static struct lock_profile_anc lock_profile_ancs[] = {
+ [LOCKPROF_TYPE_GLOBAL] = { .name = "Global" },
+ [LOCKPROF_TYPE_PERDOM] = { .name = "Domain" },
+};
static struct lock_profile_qhead lock_profile_glb_q;
static spinlock_t lock_profile_lock = SPIN_LOCK_UNLOCKED;
}
void _lock_profile_register_struct(
- int32_t type, struct lock_profile_qhead *qhead, int32_t idx, char *name)
+ int32_t type, struct lock_profile_qhead *qhead, int32_t idx)
{
qhead->idx = idx;
spin_lock(&lock_profile_lock);
qhead->head_q = lock_profile_ancs[type].head_q;
lock_profile_ancs[type].head_q = qhead;
- lock_profile_ancs[type].name = name;
spin_unlock(&lock_profile_lock);
}
{
struct lock_profile **q;
+ BUILD_BUG_ON(ARRAY_SIZE(lock_profile_ancs) != LOCKPROF_TYPE_N);
+
for ( q = &__lock_profile_start; q < &__lock_profile_end; q++ )
{
(*q)->next = lock_profile_glb_q.elem_q;
(*q)->lock->profile = *q;
}
- _lock_profile_register_struct(
- LOCKPROF_TYPE_GLOBAL, &lock_profile_glb_q,
- 0, "Global lock");
+ _lock_profile_register_struct(LOCKPROF_TYPE_GLOBAL,
+ &lock_profile_glb_q, 0);
return 0;
}
struct lock_profile {
struct lock_profile *next; /* forward link */
- char *name; /* lock name */
+ const char *name; /* lock name */
struct spinlock *lock; /* the lock itself */
u64 lock_cnt; /* # of complete locking ops */
u64 block_cnt; /* # of complete wait for lock */
} while(0)
void _lock_profile_register_struct(
- int32_t, struct lock_profile_qhead *, int32_t, char *);
+ int32_t, struct lock_profile_qhead *, int32_t);
void _lock_profile_deregister_struct(int32_t, struct lock_profile_qhead *);
-#define lock_profile_register_struct(type, ptr, idx, print) \
- _lock_profile_register_struct(type, &((ptr)->profile_head), idx, print)
+#define lock_profile_register_struct(type, ptr, idx) \
+ _lock_profile_register_struct(type, &((ptr)->profile_head), idx)
#define lock_profile_deregister_struct(type, ptr) \
_lock_profile_deregister_struct(type, &((ptr)->profile_head))
#define DEFINE_SPINLOCK(l) spinlock_t l = SPIN_LOCK_UNLOCKED
#define spin_lock_init_prof(s, l) spin_lock_init(&((s)->l))
-#define lock_profile_register_struct(type, ptr, idx, print)
+#define lock_profile_register_struct(type, ptr, idx)
#define lock_profile_deregister_struct(type, ptr)
#define spinlock_profile_printall(key)