All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Eric Engestrom <eric-op+oiCINJLTt9jDmeYuA0g@public.gmane.org>
Cc: "David Zhou" <David1.Zhou-5C7GfCeVMHo@public.gmane.org>,
	"Francisco Jerez"
	<currojerez-sGOZH3hwPm2sTnJN9+BGXg@public.gmane.org>,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	"Russell King"
	<linux+etnaviv-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org>,
	"Christian Gmeiner"
	<christian.gmeiner-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	etnaviv-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	"Rob Clark" <robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"Lucas Stach" <l.stach-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"Alex Deucher" <alexander.deucher-5C7GfCeVMHo@public.gmane.org>,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	"Sean Paul" <sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>,
	"Christian König" <christian.koenig-5C7GfCeVMHo@public.gmane.org>,
	"Ben Skeggs" <bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH v2 0/9] drm/print: add and use drm_debug_enabled()
Date: Tue, 01 Oct 2019 17:08:04 +0300	[thread overview]
Message-ID: <8736gcd0e3.fsf@intel.com> (raw)
In-Reply-To: <20191001123444.xtp7wpickwjus4m2-op+oiCINJLTt9jDmeYuA0g@public.gmane.org>

On Tue, 01 Oct 2019, Eric Engestrom <eric@engestrom.ch> wrote:
> On Tuesday, 2019-10-01 14:03:55 +0300, Jani Nikula wrote:
>> On Thu, 26 Sep 2019, Eric Engestrom <eric@engestrom.ch> wrote:
>> > On Tuesday, 2019-09-24 15:58:56 +0300, Jani Nikula wrote:
>> >> Hi all, v2 of [1], a little refactoring around drm_debug access to
>> >> abstract it better. There shouldn't be any functional changes.
>> >> 
>> >> I'd appreciate acks for merging the lot via drm-misc. If there are any
>> >> objections to that, we'll need to postpone the last patch until
>> >> everything has been merged and converted in drm-next.
>> >> 
>> >> BR,
>> >> Jani.
>> >> 
>> >> Cc: Eric Engestrom <eric.engestrom@intel.com>
>> >> Cc: Alex Deucher <alexander.deucher@amd.com>
>> >> Cc: Christian König <christian.koenig@amd.com>
>> >> Cc: David (ChunMing) Zhou <David1.Zhou@amd.com>
>> >> Cc: amd-gfx@lists.freedesktop.org
>> >> Cc: Ben Skeggs <bskeggs@redhat.com>
>> >> Cc: nouveau@lists.freedesktop.org
>> >> Cc: Rob Clark <robdclark@gmail.com>
>> >> Cc: Sean Paul <sean@poorly.run>
>> >> Cc: linux-arm-msm@vger.kernel.org
>> >> Cc: freedreno@lists.freedesktop.org
>> >> Cc: Francisco Jerez <currojerez@riseup.net>
>> >> Cc: Lucas Stach <l.stach@pengutronix.de>
>> >> Cc: Russell King <linux+etnaviv@armlinux.org.uk>
>> >> Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
>> >> Cc: etnaviv@lists.freedesktop.org
>> >> 
>> >> 
>> >> [1] http://mid.mail-archive.com/cover.1568375189.git.jani.nikula@intel.com
>> >> 
>> >> Jani Nikula (9):
>> >>   drm/print: move drm_debug variable to drm_print.[ch]
>> >>   drm/print: add drm_debug_enabled()
>> >>   drm/i915: use drm_debug_enabled() to check for debug categories
>> >>   drm/print: rename drm_debug to __drm_debug to discourage use
>> >
>> > The above four patches are:
>> > Reviewed-by: Eric Engestrom <eric@engestrom.ch>
>> >
>> > Did you check to make sure the `unlikely()` is propagated correctly
>> > outside the `drm_debug_enabled()` call?
>> 
>> I did now.
>> 
>> Having drm_debug_enabled() as a macro vs. as an inline function does not
>> seem to make a difference, so I think the inline is clearly preferrable.
>
> Agreed :)
>
>> 
>> However, for example
>> 
>> 	unlikely(foo && drm_debug & DRM_UT_DP)
>> 
>> does produce code different from
>> 
>> 	(foo && drm_debug_enabled(DRM_UT_DP))
>> 
>> indicating that the unlikely() within drm_debug_enabled() does not
>> propagate to the whole condition. It's possible to retain the same
>> assembly output with
>> 
>> 	(unlikely(foo) && drm_debug_enabled(DRM_UT_DP))
>> 
>> but it's unclear to me whether this is really worth it, either
>> readability or performance wise.
>> 
>> Thoughts?
>
> That kind of code only happens 2 times, both in
> drivers/gpu/drm/drm_dp_mst_topology.c (in patch 2/9), right?
>
> I think your suggestion is the right thing to do here:
>
> -   if (unlikely(ret && drm_debug & DRM_UT_DP)) {
> +   if (unlikely(ret) && drm_debug_enabled(DRM_UT_DP)) {
>
> It doesn't really cost much in readability (especially compared to what
> it was before), and whether it's important performance wise I couldn't
> tell, but I think it's best to keep the code optimised as it was before
> unless there's a reason to drop it.
>
> Lyude might know more since she wrote 2f015ec6eab69301fdcf5, if you want
> to ping her?

Just ended up sending the updated version with what you suggest and I
agree with; pedantically the change should be a separate patch anyway.

Thanks for your inputs.

BR,
Jani.


>
>> 
>> BR,
>> Jani.
>> 
>> 
>> -- 
>> Jani Nikula, Intel Open Source Graphics Center

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

WARNING: multiple messages have this Message-ID (diff)
From: Jani Nikula <jani.nikula@intel.com>
To: Eric Engestrom <eric@engestrom.ch>
Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"David Zhou" <David1.Zhou@amd.com>,
	amd-gfx@lists.freedesktop.org, "Ben Skeggs" <bskeggs@redhat.com>,
	nouveau@lists.freedesktop.org, "Rob Clark" <robdclark@gmail.com>,
	"Sean Paul" <sean@poorly.run>,
	linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org,
	"Francisco Jerez" <currojerez@riseup.net>,
	"Lucas Stach" <l.stach@pengutronix.de>,
	"Russell King" <linux+etnaviv@armlinux.org.uk>,
	"Christian Gmeiner" <christian.gmeiner@gmail.com>,
	etnaviv@lists.freedesktop.org
Subject: Re: [PATCH v2 0/9] drm/print: add and use drm_debug_enabled()
Date: Tue, 01 Oct 2019 17:08:04 +0300	[thread overview]
Message-ID: <8736gcd0e3.fsf@intel.com> (raw)
In-Reply-To: <20191001123444.xtp7wpickwjus4m2@engestrom.ch>

On Tue, 01 Oct 2019, Eric Engestrom <eric@engestrom.ch> wrote:
> On Tuesday, 2019-10-01 14:03:55 +0300, Jani Nikula wrote:
>> On Thu, 26 Sep 2019, Eric Engestrom <eric@engestrom.ch> wrote:
>> > On Tuesday, 2019-09-24 15:58:56 +0300, Jani Nikula wrote:
>> >> Hi all, v2 of [1], a little refactoring around drm_debug access to
>> >> abstract it better. There shouldn't be any functional changes.
>> >> 
>> >> I'd appreciate acks for merging the lot via drm-misc. If there are any
>> >> objections to that, we'll need to postpone the last patch until
>> >> everything has been merged and converted in drm-next.
>> >> 
>> >> BR,
>> >> Jani.
>> >> 
>> >> Cc: Eric Engestrom <eric.engestrom@intel.com>
>> >> Cc: Alex Deucher <alexander.deucher@amd.com>
>> >> Cc: Christian König <christian.koenig@amd.com>
>> >> Cc: David (ChunMing) Zhou <David1.Zhou@amd.com>
>> >> Cc: amd-gfx@lists.freedesktop.org
>> >> Cc: Ben Skeggs <bskeggs@redhat.com>
>> >> Cc: nouveau@lists.freedesktop.org
>> >> Cc: Rob Clark <robdclark@gmail.com>
>> >> Cc: Sean Paul <sean@poorly.run>
>> >> Cc: linux-arm-msm@vger.kernel.org
>> >> Cc: freedreno@lists.freedesktop.org
>> >> Cc: Francisco Jerez <currojerez@riseup.net>
>> >> Cc: Lucas Stach <l.stach@pengutronix.de>
>> >> Cc: Russell King <linux+etnaviv@armlinux.org.uk>
>> >> Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
>> >> Cc: etnaviv@lists.freedesktop.org
>> >> 
>> >> 
>> >> [1] http://mid.mail-archive.com/cover.1568375189.git.jani.nikula@intel.com
>> >> 
>> >> Jani Nikula (9):
>> >>   drm/print: move drm_debug variable to drm_print.[ch]
>> >>   drm/print: add drm_debug_enabled()
>> >>   drm/i915: use drm_debug_enabled() to check for debug categories
>> >>   drm/print: rename drm_debug to __drm_debug to discourage use
>> >
>> > The above four patches are:
>> > Reviewed-by: Eric Engestrom <eric@engestrom.ch>
>> >
>> > Did you check to make sure the `unlikely()` is propagated correctly
>> > outside the `drm_debug_enabled()` call?
>> 
>> I did now.
>> 
>> Having drm_debug_enabled() as a macro vs. as an inline function does not
>> seem to make a difference, so I think the inline is clearly preferrable.
>
> Agreed :)
>
>> 
>> However, for example
>> 
>> 	unlikely(foo && drm_debug & DRM_UT_DP)
>> 
>> does produce code different from
>> 
>> 	(foo && drm_debug_enabled(DRM_UT_DP))
>> 
>> indicating that the unlikely() within drm_debug_enabled() does not
>> propagate to the whole condition. It's possible to retain the same
>> assembly output with
>> 
>> 	(unlikely(foo) && drm_debug_enabled(DRM_UT_DP))
>> 
>> but it's unclear to me whether this is really worth it, either
>> readability or performance wise.
>> 
>> Thoughts?
>
> That kind of code only happens 2 times, both in
> drivers/gpu/drm/drm_dp_mst_topology.c (in patch 2/9), right?
>
> I think your suggestion is the right thing to do here:
>
> -   if (unlikely(ret && drm_debug & DRM_UT_DP)) {
> +   if (unlikely(ret) && drm_debug_enabled(DRM_UT_DP)) {
>
> It doesn't really cost much in readability (especially compared to what
> it was before), and whether it's important performance wise I couldn't
> tell, but I think it's best to keep the code optimised as it was before
> unless there's a reason to drop it.
>
> Lyude might know more since she wrote 2f015ec6eab69301fdcf5, if you want
> to ping her?

Just ended up sending the updated version with what you suggest and I
agree with; pedantically the change should be a separate patch anyway.

Thanks for your inputs.

BR,
Jani.


>
>> 
>> BR,
>> Jani.
>> 
>> 
>> -- 
>> Jani Nikula, Intel Open Source Graphics Center

-- 
Jani Nikula, Intel Open Source Graphics Center

  parent reply	other threads:[~2019-10-01 14:08 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-24 12:58 [PATCH v2 0/9] drm/print: add and use drm_debug_enabled() Jani Nikula
2019-09-24 12:58 ` Jani Nikula
2019-09-24 12:58 ` [PATCH v2 1/9] drm/print: move drm_debug variable to drm_print.[ch] Jani Nikula
2019-09-24 17:45   ` Alex Deucher
2019-09-24 12:58 ` [PATCH v2 2/9] drm/print: add drm_debug_enabled() Jani Nikula
2019-09-24 17:45   ` Alex Deucher
2019-10-01 14:06   ` [PATCH v3] " Jani Nikula
2019-10-01 15:02     ` Eric Engestrom
2019-09-24 12:58 ` [PATCH v2 3/9] drm/etnaviv: use drm_debug_enabled() to check for debug categories Jani Nikula
2019-09-24 12:59 ` [PATCH v2 4/9] drm/i2c/sil164: " Jani Nikula
2019-09-24 19:29   ` Francisco Jerez
2019-09-24 12:59 ` [PATCH v2 5/9] drm/i915: " Jani Nikula
2019-09-24 12:59 ` [PATCH v2 6/9] drm/msm: " Jani Nikula
2019-09-24 12:59   ` Jani Nikula
2019-09-24 12:59 ` [PATCH v2 7/9] drm/nouveau: " Jani Nikula
2019-09-24 12:59 ` [PATCH v2 8/9] drm/amdgpu: " Jani Nikula
2019-09-24 17:44   ` Alex Deucher
2019-09-24 12:59 ` [PATCH v2 9/9] drm/print: rename drm_debug to __drm_debug to discourage use Jani Nikula
2019-09-24 17:46   ` Alex Deucher
2019-09-24 14:15 ` ✓ Fi.CI.BAT: success for drm/print: add and use drm_debug_enabled() (rev2) Patchwork
2019-09-25  2:39 ` ✗ Fi.CI.IGT: failure " Patchwork
2019-09-26  7:48 ` [PATCH v2 0/9] drm/print: add and use drm_debug_enabled() Eric Engestrom
2019-09-26  7:48   ` Eric Engestrom
     [not found]   ` <20190926074814.rdzxjmut6izqf4d5-op+oiCINJLTt9jDmeYuA0g@public.gmane.org>
2019-10-01 11:03     ` Jani Nikula
2019-10-01 11:03       ` Jani Nikula
     [not found]       ` <875zl8d8x0.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2019-10-01 12:34         ` Eric Engestrom
2019-10-01 12:34           ` Eric Engestrom
     [not found]           ` <20191001123444.xtp7wpickwjus4m2-op+oiCINJLTt9jDmeYuA0g@public.gmane.org>
2019-10-01 14:08             ` Jani Nikula [this message]
2019-10-01 14:08               ` Jani Nikula
2019-10-01 17:26 ` ✓ Fi.CI.BAT: success for drm/print: add and use drm_debug_enabled() (rev3) Patchwork
2019-10-02  1:45 ` ✓ Fi.CI.IGT: " Patchwork
     [not found] ` <cover.1569329774.git.jani.nikula-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2019-10-02 14:11   ` [PATCH v2 0/9] drm/print: add and use drm_debug_enabled() Jani Nikula
2019-10-02 14:11     ` Jani Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8736gcd0e3.fsf@intel.com \
    --to=jani.nikula-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=David1.Zhou-5C7GfCeVMHo@public.gmane.org \
    --cc=alexander.deucher-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=christian.gmeiner-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
    --cc=currojerez-sGOZH3hwPm2sTnJN9+BGXg@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=eric-op+oiCINJLTt9jDmeYuA0g@public.gmane.org \
    --cc=etnaviv-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=l.stach-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=linux+etnaviv-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.