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 71302C282DD for ; Wed, 8 Jan 2020 12:48:27 +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 4F1F02067D for ; Wed, 8 Jan 2020 12:48:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4F1F02067D 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 7826B6E1D8; Wed, 8 Jan 2020 12:48:26 +0000 (UTC) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2D0B46E1B7 for ; Wed, 8 Jan 2020 12:48:25 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2020 04:48:24 -0800 X-IronPort-AV: E=Sophos;i="5.69,410,1571727600"; d="scan'208,217";a="223532240" Received: from jnikula-mobl3.fi.intel.com (HELO localhost) ([10.237.66.161]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2020 04:48:21 -0800 From: Jani Nikula To: Sam Ravnborg , Pankaj Bharadiya In-Reply-To: <20200106175722.GA23862@ravnborg.org> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20200106172326.32592-1-pankaj.laxminarayan.bharadiya@intel.com> <20200106172326.32592-5-pankaj.laxminarayan.bharadiya@intel.com> <20200106175722.GA23862@ravnborg.org> Date: Wed, 08 Jan 2020 14:48:18 +0200 Message-ID: <87ftgqqfl9.fsf@intel.com> MIME-Version: 1.0 Subject: Re: [Intel-gfx] [RFC 4/7] drm/i915: Make WARN* device specific where drm_device ptr available 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: intel-gfx@lists.freedesktop.org, irlied@linux.ie Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Mon, 06 Jan 2020, Sam Ravnborg wrote: > Hi Pankaj. > > On Mon, Jan 06, 2020 at 10:53:23PM +0530, Pankaj Bharadiya wrote: >> Device specific WARN* calls include device information in the >> backtrace, so we know what device the warnings originate from. >> >> Covert all the calls of WARN* with device specific dev_WARN* >> variants in functions where drm_device struct pointer is readily >> available. > > We have recently introduced > drm_err(struct drm_device *, fmt, ...) > drm_warn(struct drm_device *, fmt, ...) > drm_info(struct drm_device *, fmt, ...) > > It seems like a logical step to introduce: > drm_WARN(struct drm_device *, fmt, ...) > drm_WARN_ON(struct drm_device *, fmt, ...) > drm_WARN_ONCE(struct drm_device *, fmt, ...) > drm_WARN_ON_ONCE(struct drm_device *, fmt, ...) > > Jani was the architect behind drm_err() and friends. > Added to this mail. I'd like that. If, additionally, we could agree on incorporating the __stringify(x) part on printing the condition, we could use those directly and get rid of the hacks in i915/i915_utils.h altogether. BR, Jani. > > Sam > >> >> The conversion was done automatically with below coccinelle semantic >> patch. checkpatch errors/warnings are fixed manually. >> >> @rule1@ >> identifier func, T; >> @@ >> func(...) { >> ... >> struct drm_device *T = ...; >> <... >> ( >> -WARN( >> +dev_WARN(T->dev, >> ...) >> | >> -WARN_ON( >> +dev_WARN_ON(T->dev, >> ...) >> | >> -WARN_ONCE( >> +dev_WARN_ONCE(T->dev, >> ...) >> | >> -WARN_ON_ONCE( >> +dev_WARN_ON_ONCE(T->dev, >> ...) >> ) >> ...> >> } >> >> @rule2@ >> identifier func, T; >> @@ >> func(struct drm_device *T,...) { >> <... >> ( >> -WARN( >> +dev_WARN(T->dev, >> ...) >> | >> -WARN_ON( >> +dev_WARN_ON(T->dev, >> ...) >> | >> -WARN_ONCE( >> +dev_WARN_ONCE(T->dev, >> ...) >> | >> -WARN_ON_ONCE( >> +dev_WARN_ON_ONCE(T->dev, >> ...) >> ) >> ...> >> } >> >> command: spatch --sp-file