Whamcloud - gitweb
b=22409 Spurious error messages from smp_processor_id() on preemptible kernel
authorDmitry Zogin <dmitry.zogin@sun.com>
Thu, 25 Mar 2010 16:53:32 +0000 (12:53 -0400)
committerJohann Lombardi <johann@sun.com>
Fri, 26 Mar 2010 23:44:51 +0000 (00:44 +0100)
 Disable a preemption by grabbing the lock in fs_trace_get_tcd() first.
 The function fs_trace_get_tcd() was moved up.

 o=andreas.dilger
 i=johann
 i=dmitry.zogin
 i=nathan.rutman

lnet/libcfs/tracefile.c

index a049dc0..0a4dea8 100644 (file)
@@ -258,10 +258,13 @@ int libcfs_debug_vmsg2(cfs_debug_limit_state_t *cdls, int subsys, int mask,
         if (strchr(file, '/'))
                 file = strrchr(file, '/') + 1;
 
+        tcd = trace_get_tcd();
 
+        /* fs_trace_get_tcd() grabs a lock, which disables preemption and
+         * pins us to a particular CPU.  This avoids an smp_processor_id()
+         * warning on Linux when debugging is enabled. */
         set_ptldebug_header(&header, subsys, mask, line, CDEBUG_STACK());
 
-        tcd = trace_get_tcd();
         if (tcd == NULL)                /* arch may not log in IRQ context */
                 goto console;