From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3995C33CAD for ; Mon, 13 Jan 2020 12:31:08 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 93FD82081E for ; Mon, 13 Jan 2020 12:31:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 93FD82081E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E7D6B89DEA; Mon, 13 Jan 2020 12:31:06 +0000 (UTC) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0F93189DD5; Mon, 13 Jan 2020 12:31:05 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jan 2020 04:31:00 -0800 X-IronPort-AV: E=Sophos;i="5.69,428,1571727600"; d="scan'208";a="217392562" Received: from jnikula-mobl3.fi.intel.com (HELO localhost) ([10.237.66.161]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jan 2020 04:30:57 -0800 From: Jani Nikula To: Pankaj Bharadiya , daniel@ffwll.ch, sam@ravnborg.org, sudeep.dutt@intel.com, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Maarten Lankhorst , Maxime Ripard , David Airlie Subject: Re: [Intel-gfx] [PATCH 1/6] drm/print: introduce new struct drm_device based WARN* macros In-Reply-To: <20200113115557.32713-2-pankaj.laxminarayan.bharadiya@intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20200113115557.32713-1-pankaj.laxminarayan.bharadiya@intel.com> <20200113115557.32713-2-pankaj.laxminarayan.bharadiya@intel.com> Date: Mon, 13 Jan 2020 14:30:54 +0200 Message-ID: <87ftgjmtc1.fsf@intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pankaj.laxminaryan.bharadiya@outlook.iglb.intel.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Mon, 13 Jan 2020, Pankaj Bharadiya wrote: > Add new struct drm_device based WARN* macros. These are modeled after > the core kernel device based WARN* macros. These would be preferred > over the regular WARN* macros, where possible. > > These macros include device information in the backtrace, so we know > what device the warnings originate from. > > Knowing the device specific information in the backtrace would be > helpful in development all around. > > Signed-off-by: Pankaj Bharadiya > --- > include/drm/drm_print.h | 30 ++++++++++++++++++++++++++++++ > 1 file changed, 30 insertions(+) > > diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h > index 8f99d389792d..61a7224e697d 100644 > --- a/include/drm/drm_print.h > +++ b/include/drm/drm_print.h > @@ -553,4 +553,34 @@ void __drm_err(const char *format, ...); > #define DRM_DEBUG_PRIME_RATELIMITED(fmt, ...) \ > DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##__VA_ARGS__) > > +/* > + * struct drm_device based WARNs > + * > + * > + * drm_WARN*() acts like WARN*(), but with the key difference of > + * using device specific information so that we know from which device > + * warning is originating from. > + * > + * Prefer drm_device based dev_WARN* over regular WARN* drm_WARN, not dev_WARN. I don't really appreciated changing case mid-symbol, but that matches dev_WARN. :/ Other than that, Acked-by: Jani Nikula > + */ > + > +/* Helper for struct drm_device based WARNs */ > +#define drm_WARN(drm, condition, format, arg...) \ > + WARN(condition, "%s %s: " format, \ > + dev_driver_string((drm)->dev), \ > + dev_name((drm)->dev), ## arg) > + > +#define drm_WARN_ONCE(drm, condition, format, arg...) \ > + WARN_ONCE(condition, "%s %s: " format, \ > + dev_driver_string((drm)->dev), \ > + dev_name((drm)->dev), ## arg) > + > +#define drm_WARN_ON(drm, x) \ > + drm_WARN((drm), (x), "%s", \ > + "drm_WARN_ON(" __stringify(x) ")") > + > +#define drm_WARN_ON_ONCE(drm, x) \ > + drm_WARN_ONCE((drm), (x), "%s", \ > + "drm_WARN_ON_ONCE(" __stringify(x) ")") > + > #endif /* DRM_PRINT_H_ */ -- Jani Nikula, Intel Open Source Graphics Center _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F2E1C33CAD for ; Mon, 13 Jan 2020 12:31:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 06F0F2081E for ; Mon, 13 Jan 2020 12:31:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 06F0F2081E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8C1CE89DD5; Mon, 13 Jan 2020 12:31:06 +0000 (UTC) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0F93189DD5; Mon, 13 Jan 2020 12:31:05 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jan 2020 04:31:00 -0800 X-IronPort-AV: E=Sophos;i="5.69,428,1571727600"; d="scan'208";a="217392562" Received: from jnikula-mobl3.fi.intel.com (HELO localhost) ([10.237.66.161]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jan 2020 04:30:57 -0800 From: Jani Nikula To: Pankaj Bharadiya , daniel@ffwll.ch, sam@ravnborg.org, sudeep.dutt@intel.com, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Maarten Lankhorst , Maxime Ripard , David Airlie In-Reply-To: <20200113115557.32713-2-pankaj.laxminarayan.bharadiya@intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20200113115557.32713-1-pankaj.laxminarayan.bharadiya@intel.com> <20200113115557.32713-2-pankaj.laxminarayan.bharadiya@intel.com> Date: Mon, 13 Jan 2020 14:30:54 +0200 Message-ID: <87ftgjmtc1.fsf@intel.com> MIME-Version: 1.0 Subject: Re: [Intel-gfx] [PATCH 1/6] drm/print: introduce new struct drm_device based WARN* macros X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pankaj.laxminaryan.bharadiya@outlook.iglb.intel.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Mon, 13 Jan 2020, Pankaj Bharadiya wrote: > Add new struct drm_device based WARN* macros. These are modeled after > the core kernel device based WARN* macros. These would be preferred > over the regular WARN* macros, where possible. > > These macros include device information in the backtrace, so we know > what device the warnings originate from. > > Knowing the device specific information in the backtrace would be > helpful in development all around. > > Signed-off-by: Pankaj Bharadiya > --- > include/drm/drm_print.h | 30 ++++++++++++++++++++++++++++++ > 1 file changed, 30 insertions(+) > > diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h > index 8f99d389792d..61a7224e697d 100644 > --- a/include/drm/drm_print.h > +++ b/include/drm/drm_print.h > @@ -553,4 +553,34 @@ void __drm_err(const char *format, ...); > #define DRM_DEBUG_PRIME_RATELIMITED(fmt, ...) \ > DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##__VA_ARGS__) > > +/* > + * struct drm_device based WARNs > + * > + * > + * drm_WARN*() acts like WARN*(), but with the key difference of > + * using device specific information so that we know from which device > + * warning is originating from. > + * > + * Prefer drm_device based dev_WARN* over regular WARN* drm_WARN, not dev_WARN. I don't really appreciated changing case mid-symbol, but that matches dev_WARN. :/ Other than that, Acked-by: Jani Nikula > + */ > + > +/* Helper for struct drm_device based WARNs */ > +#define drm_WARN(drm, condition, format, arg...) \ > + WARN(condition, "%s %s: " format, \ > + dev_driver_string((drm)->dev), \ > + dev_name((drm)->dev), ## arg) > + > +#define drm_WARN_ONCE(drm, condition, format, arg...) \ > + WARN_ONCE(condition, "%s %s: " format, \ > + dev_driver_string((drm)->dev), \ > + dev_name((drm)->dev), ## arg) > + > +#define drm_WARN_ON(drm, x) \ > + drm_WARN((drm), (x), "%s", \ > + "drm_WARN_ON(" __stringify(x) ")") > + > +#define drm_WARN_ON_ONCE(drm, x) \ > + drm_WARN_ONCE((drm), (x), "%s", \ > + "drm_WARN_ON_ONCE(" __stringify(x) ")") > + > #endif /* DRM_PRINT_H_ */ -- Jani Nikula, Intel Open Source Graphics Center _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx