diff mbox series

[v8,10/16] i915/gvt: remove spaces in pr_debug "gvt: core:" etc prefixes

Message ID 20210915163957.2949166-11-jim.cromie@gmail.com (mailing list archive)
State New, archived
Headers show
Series use DYNAMIC_DEBUG to implement DRM.debug | expand

Commit Message

Jim Cromie Sept. 15, 2021, 4:39 p.m. UTC
Taking embedded spaces out of existing prefixes makes them better
class-prefixes; simplifying the extra quoting needed otherwise:

  $> echo format "^gvt: core:" +p >control

Dropping the internal spaces means any trailing space in a query will
more clearly terminate the prefix being searched for.

Consider a generic drm-debug example:

  # turn off ATOMIC reports
  echo format "^drm:atomic: " -p > control

  # turn off all ATOMIC:* reports, including any sub-categories
  echo format "^drm:atomic:" -p > control

  # turn on ATOMIC:FAIL: reports
  echo format "^drm:atomic:fail: " +p > control

Removing embedded spaces in the class-prefixes simplifies the
corresponding match-prefix.  This means that "quoted" match-prefixes
are only needed when the trailing space is desired, in order to
exclude explicitly sub-categorized pr-debugs; in this example,
"drm:atomic:fail:".

RFC: maybe the prefix catenation should paste in the " " class-prefix
terminator explicitly.  A pr_debug_() flavor could exclude the " ",
allowing ad-hoc sub-categorization by appending for example, "fail:"
to "drm:atomic:" without the default " " insertion.

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
v8:
. fix patchwork CI warning
---
 drivers/gpu/drm/i915/gvt/debug.h | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Zhenyu Wang Sept. 23, 2021, 7:36 a.m. UTC | #1
On 2021.09.15 10:39:51 -0600, Jim Cromie wrote:
> Taking embedded spaces out of existing prefixes makes them better
> class-prefixes; simplifying the extra quoting needed otherwise:
> 
>   $> echo format "^gvt: core:" +p >control
> 
> Dropping the internal spaces means any trailing space in a query will
> more clearly terminate the prefix being searched for.
> 
> Consider a generic drm-debug example:
> 
>   # turn off ATOMIC reports
>   echo format "^drm:atomic: " -p > control
> 
>   # turn off all ATOMIC:* reports, including any sub-categories
>   echo format "^drm:atomic:" -p > control
> 
>   # turn on ATOMIC:FAIL: reports
>   echo format "^drm:atomic:fail: " +p > control
> 
> Removing embedded spaces in the class-prefixes simplifies the
> corresponding match-prefix.  This means that "quoted" match-prefixes
> are only needed when the trailing space is desired, in order to
> exclude explicitly sub-categorized pr-debugs; in this example,
> "drm:atomic:fail:".
> 
> RFC: maybe the prefix catenation should paste in the " " class-prefix
> terminator explicitly.  A pr_debug_() flavor could exclude the " ",
> allowing ad-hoc sub-categorization by appending for example, "fail:"
> to "drm:atomic:" without the default " " insertion.
> 
> Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
> ---
> v8:
> . fix patchwork CI warning
> ---
>  drivers/gpu/drm/i915/gvt/debug.h | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/debug.h b/drivers/gpu/drm/i915/gvt/debug.h
> index c6027125c1ec..bbecc279e077 100644
> --- a/drivers/gpu/drm/i915/gvt/debug.h
> +++ b/drivers/gpu/drm/i915/gvt/debug.h
> @@ -36,30 +36,30 @@ do {									\
>  } while (0)
>  
>  #define gvt_dbg_core(fmt, args...) \
> -	pr_debug("gvt: core: "fmt, ##args)
> +	pr_debug("gvt:core: " fmt, ##args)
>  
>  #define gvt_dbg_irq(fmt, args...) \
> -	pr_debug("gvt: irq: "fmt, ##args)
> +	pr_debug("gvt:irq: " fmt, ##args)
>  
>  #define gvt_dbg_mm(fmt, args...) \
> -	pr_debug("gvt: mm: "fmt, ##args)
> +	pr_debug("gvt:mm: " fmt, ##args)
>  
>  #define gvt_dbg_mmio(fmt, args...) \
> -	pr_debug("gvt: mmio: "fmt, ##args)
> +	pr_debug("gvt:mmio: " fmt, ##args)
>  
>  #define gvt_dbg_dpy(fmt, args...) \
> -	pr_debug("gvt: dpy: "fmt, ##args)
> +	pr_debug("gvt:dpy: " fmt, ##args)
>  
>  #define gvt_dbg_el(fmt, args...) \
> -	pr_debug("gvt: el: "fmt, ##args)
> +	pr_debug("gvt:el: " fmt, ##args)
>  
>  #define gvt_dbg_sched(fmt, args...) \
> -	pr_debug("gvt: sched: "fmt, ##args)
> +	pr_debug("gvt:sched: " fmt, ##args)
>  
>  #define gvt_dbg_render(fmt, args...) \
> -	pr_debug("gvt: render: "fmt, ##args)
> +	pr_debug("gvt:render: " fmt, ##args)
>  
>  #define gvt_dbg_cmd(fmt, args...) \
> -	pr_debug("gvt: cmd: "fmt, ##args)
> +	pr_debug("gvt:cmd: " fmt, ##args)
>  
>  #endif
> -- 

Looks good to me. Thanks!

Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gvt/debug.h b/drivers/gpu/drm/i915/gvt/debug.h
index c6027125c1ec..bbecc279e077 100644
--- a/drivers/gpu/drm/i915/gvt/debug.h
+++ b/drivers/gpu/drm/i915/gvt/debug.h
@@ -36,30 +36,30 @@  do {									\
 } while (0)
 
 #define gvt_dbg_core(fmt, args...) \
-	pr_debug("gvt: core: "fmt, ##args)
+	pr_debug("gvt:core: " fmt, ##args)
 
 #define gvt_dbg_irq(fmt, args...) \
-	pr_debug("gvt: irq: "fmt, ##args)
+	pr_debug("gvt:irq: " fmt, ##args)
 
 #define gvt_dbg_mm(fmt, args...) \
-	pr_debug("gvt: mm: "fmt, ##args)
+	pr_debug("gvt:mm: " fmt, ##args)
 
 #define gvt_dbg_mmio(fmt, args...) \
-	pr_debug("gvt: mmio: "fmt, ##args)
+	pr_debug("gvt:mmio: " fmt, ##args)
 
 #define gvt_dbg_dpy(fmt, args...) \
-	pr_debug("gvt: dpy: "fmt, ##args)
+	pr_debug("gvt:dpy: " fmt, ##args)
 
 #define gvt_dbg_el(fmt, args...) \
-	pr_debug("gvt: el: "fmt, ##args)
+	pr_debug("gvt:el: " fmt, ##args)
 
 #define gvt_dbg_sched(fmt, args...) \
-	pr_debug("gvt: sched: "fmt, ##args)
+	pr_debug("gvt:sched: " fmt, ##args)
 
 #define gvt_dbg_render(fmt, args...) \
-	pr_debug("gvt: render: "fmt, ##args)
+	pr_debug("gvt:render: " fmt, ##args)
 
 #define gvt_dbg_cmd(fmt, args...) \
-	pr_debug("gvt: cmd: "fmt, ##args)
+	pr_debug("gvt:cmd: " fmt, ##args)
 
 #endif