[Intel-xe] [PATCH v2 3/3] drm/xe/macro: Display XE_WARN_ON messages only in debug mode

Francois Dugast francois.dugast at intel.com
Thu Jul 27 14:42:17 UTC 2023


On Thu, Jul 27, 2023 at 10:03:43AM -0400, Rodrigo Vivi wrote:
> On Thu, Jul 27, 2023 at 01:26:30PM +0000, Francois Dugast wrote:
> > Make printing of XE_WARN_ON messages depend on Xe debug flag
> > CONFIG_DRM_XE_DEBUG, so that those messages are not printed in production
> > environments.
> > 
> > Signed-off-by: Francois Dugast <francois.dugast at intel.com>
> > ---
> >  drivers/gpu/drm/xe/xe_macros.h | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/xe/xe_macros.h b/drivers/gpu/drm/xe/xe_macros.h
> > index daf56c846d03..6ce86cf9605c 100644
> > --- a/drivers/gpu/drm/xe/xe_macros.h
> > +++ b/drivers/gpu/drm/xe/xe_macros.h
> > @@ -8,7 +8,14 @@
> >  
> >  #include <linux/bug.h>
> >  
> > +#if IS_ENABLED(CONFIG_DRM_XE_DEBUG)
> >  #define XE_WARN_ON WARN_ON
> > +#else
> > +#define XE_WARN_ON(condition) ({					\
> > +	int __ret_warn_on = !!(condition);				\
> > +	unlikely(__ret_warn_on);					\
> > +})
> > +#endif
> 
> What about getting rid of XE_WARN_ON all together and replacing with
> regular WARN_ON or drm_warn when we need the stack info or drm_{err,dbg,info}
> on other cases?
> 
> I'm afraid that if we add this condition here now we will pave or way to
> have a driver full of xe-isms instead of aligning with other regular drivers.

Yes I agree and will send a new series. As mentioned in the cover letter, using
drm_* goes a bit further so for now I suggest just getting rid of XE_WARN_ON.

> 
> 
> >  
> >  #define XE_IOCTL_DBG(xe, cond) \
> >  	((cond) && (drm_dbg(&(xe)->drm, \
> > -- 
> > 2.34.1
> > 


More information about the Intel-xe mailing list