[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v5 5/5] xen: add function name to lock profiling data



On 13.09.19 11:53, Jan Beulich wrote:
On 12.09.2019 15:28, Juergen Gross wrote:
--- a/xen/common/spinlock.c
+++ b/xen/common/spinlock.c
@@ -348,6 +348,7 @@ static s_time_t lock_profile_start;
  static struct lock_profile_anc *lock_profile_ancs;
  static struct lock_profile_qhead lock_profile_glb_q;
  static spinlock_t lock_profile_lock = SPIN_LOCK_UNLOCKED;
+static const char *lock_profile_nofunc = __PRETTY_FUNCTION__;

const also for the variable itself?

@@ -371,8 +372,10 @@ static void spinlock_profile_print_elem(struct 
lock_profile *data,
      printk("%s ", type);
      if ( idx != LOCKPROF_IDX_NONE )
          printk("%d ", idx);
-    printk("%s: addr=%p, lockval=%08x, ", data->name, lock,
-           lock->tickets.head_tail);
+    printk("%s", data->name);
+    if ( data->func && strcmp(data->func, lock_profile_nofunc) )
+        printk("@%s", data->func);
+    printk(": addr=%p, lockval=%08x, ", lock, lock->tickets.head_tail);

As long as this is used from a key handler only, I guess the
splitting of the printk()s isn't much of a problem.

@@ -427,7 +430,14 @@ static void spinlock_profile_ucopy_elem(struct 
lock_profile *data,
if ( p->pc->nr_elem < p->pc->max_elem )
      {
-        safe_strcpy(elem.name, data->name);
+        if ( data->func && strcmp(data->func, lock_profile_nofunc) )
+        {
+            snprintf(elem.name, sizeof(elem.name), "%s@%s", data->name,
+                     data->func);
+            elem.name[sizeof(elem.name) - 1] = 0;

This isn't needed after snprintf(), is it?

With the two suggested adjustments (provided you agree, and
which could probably be done while committing)
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

Yes, I agree, thanks


Juergen


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.