From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Deepak R Varma <drv@mailo.com>,
Jani Nikula <jani.nikula@linux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org,
Matthew Auld <matthew.auld@intel.com>,
Thomas Hellstrom <thomas.hellstrom@intel.com>
Cc: Saurabh Singh Sengar <ssengar@microsoft.com>,
Praveen Kumar <kumarpraveen@linux.microsoft.com>
Subject: Re: [PATCH] drm/i915/gt: Avoid redundant pointer validity check
Date: Mon, 6 Feb 2023 09:45:10 +0000 [thread overview]
Message-ID: <d58fff32-edad-4a7f-7409-7e57593df3ed@linux.intel.com> (raw)
In-Reply-To: <Y91g081OauhQNxMe@ubun2204.myguest.virtualbox.org>
Hi,
Adding Matt & Thomas as potential candidates to review.
Regards,
Tvrtko
On 03/02/2023 19:30, Deepak R Varma wrote:
> The macro definition of gen6_for_all_pdes() expands to a for loop such
> that it breaks when the page table is null. Hence there is no need to
> again test validity of the page table entry pointers in the pde list.
> This change is identified using itnull.cocci semantic patch.
>
> Signed-off-by: Deepak R Varma <drv@mailo.com>
> ---
> Please note: Proposed change is compile tested only.
>
> drivers/gpu/drm/i915/gt/gen6_ppgtt.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/gen6_ppgtt.c b/drivers/gpu/drm/i915/gt/gen6_ppgtt.c
> index 5aaacc53fa4c..787b9e6d9f59 100644
> --- a/drivers/gpu/drm/i915/gt/gen6_ppgtt.c
> +++ b/drivers/gpu/drm/i915/gt/gen6_ppgtt.c
> @@ -258,8 +258,7 @@ static void gen6_ppgtt_free_pd(struct gen6_ppgtt *ppgtt)
> u32 pde;
>
> gen6_for_all_pdes(pt, pd, pde)
> - if (pt)
> - free_pt(&ppgtt->base.vm, pt);
> + free_pt(&ppgtt->base.vm, pt);
> }
>
> static void gen6_ppgtt_cleanup(struct i915_address_space *vm)
> @@ -304,7 +303,7 @@ static void pd_vma_unbind(struct i915_address_space *vm,
>
> /* Free all no longer used page tables */
> gen6_for_all_pdes(pt, ppgtt->base.pd, pde) {
> - if (!pt || atomic_read(&pt->used))
> + if (atomic_read(&pt->used))
> continue;
>
> free_pt(&ppgtt->base.vm, pt);
next prev parent reply other threads:[~2023-02-06 9:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-03 19:30 [PATCH] drm/i915/gt: Avoid redundant pointer validity check Deepak R Varma
2023-02-06 9:45 ` Tvrtko Ursulin [this message]
2023-02-06 10:33 ` Matthew Auld
2023-02-06 18:42 ` Deepak R Varma
2023-02-06 18:53 ` Deepak R Varma
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=d58fff32-edad-4a7f-7409-7e57593df3ed@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=drv@mailo.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=kumarpraveen@linux.microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.auld@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=ssengar@microsoft.com \
--cc=thomas.hellstrom@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox