Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Shyti <andi.shyti@linux.intel.com>
To: "Upadhyay, Tejas" <tejas.upadhyay@intel.com>
Cc: "Wajdeczko, Michal" <Michal.Wajdeczko@intel.com>,
	"intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
	Andi Shyti <andi.shyti@linux.intel.com>,
	"Vishwanathapura,
	Niranjana" <niranjana.vishwanathapura@intel.com>
Subject: Re: [PATCH] drm/xe/gt: Remove redundant num_engine check
Date: Fri, 8 Mar 2024 12:32:36 +0100	[thread overview]
Message-ID: <Zer3VEMhwktXTg36@ashyti-mobl2.lan> (raw)
In-Reply-To: <SJ1PR11MB6204115AB85BA65F78AC3C2981272@SJ1PR11MB6204.namprd11.prod.outlook.com>

> > > In __xe_gt_apply_ccs_mode num_engines will never be 0 as it is already
> > > checked by parent function.
> > 
> > and that's why we are using xe_assert() instead of explicit checks, so you can't
> > say it's redundant
> > 
> > note that the purpose of xe_assert() inside one function is to enforce the SLA
> > for the caller who should be responsible for doing actual runtime checks
> 
> The static analysis tool Coverity is also complaining about checking obvious condition on num_engines to be 0. So decided to remove this.

yesm because it was checked before, as well.

BTW, please do not consider static analysis failures as bugs to
be fixed with the Fixes tag.

Unless they really are bugs, of course. Coverity is also able to
detect memory leaks and buffer overflows that need to be fixed
with massive Fixes tag :-)

Andi

> 
> Thanks,
> Tejas
> > 
> > >
> > > Fixes: 0d97ecce16bd ("drm/xe: Enable Fixed CCS mode setting")
> > > Signed-off-by: Tejas Upadhyay <tejas.upadhyay@intel.com>
> > > ---
> > >  drivers/gpu/drm/xe/xe_gt_ccs_mode.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/xe/xe_gt_ccs_mode.c
> > > b/drivers/gpu/drm/xe/xe_gt_ccs_mode.c
> > > index 529fc286cd06..2bbd7b203cc2 100644
> > > --- a/drivers/gpu/drm/xe/xe_gt_ccs_mode.c
> > > +++ b/drivers/gpu/drm/xe/xe_gt_ccs_mode.c
> > > @@ -22,7 +22,7 @@ static void __xe_gt_apply_ccs_mode(struct xe_gt *gt,
> > > u32 num_engines)
> > >
> > >  	xe_assert(xe, xe_gt_ccs_mode_enabled(gt));
> > >
> > > -	xe_assert(xe, num_engines && num_engines <= num_slices);
> > 
> > btw, instead of dropping num_engines condition completely this should be
> > rather split into two separate xe_asserts():
> > 
> > 	xe_assert(xe, num_engines);
> > 	xe_assert(xe, num_engines <= num_slices);
> > 
> > > +	xe_assert(xe, num_engines <= num_slices);
> > >  	xe_assert(xe, !(num_slices % num_engines));
> > >
> > >  	/*

  reply	other threads:[~2024-03-08 11:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-08  7:03 [PATCH] drm/xe/gt: Remove redundant num_engine check Tejas Upadhyay
2024-03-08  7:00 ` Ghimiray, Himal Prasad
2024-03-08  7:28 ` ✓ CI.Patch_applied: success for " Patchwork
2024-03-08  7:28 ` ✓ CI.checkpatch: " Patchwork
2024-03-08  7:29 ` ✓ CI.KUnit: " Patchwork
2024-03-08  7:40 ` ✓ CI.Build: " Patchwork
2024-03-08  7:40 ` ✗ CI.Hooks: failure " Patchwork
2024-03-08  7:41 ` ✓ CI.checksparse: success " Patchwork
2024-03-08  8:09 ` ✓ CI.BAT: " Patchwork
2024-03-08  9:11 ` [PATCH] " Andi Shyti
2024-03-08  9:55 ` Michal Wajdeczko
2024-03-08 10:29   ` Upadhyay, Tejas
2024-03-08 11:32     ` Andi Shyti [this message]
2024-03-08 14:00       ` Upadhyay, Tejas

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=Zer3VEMhwktXTg36@ashyti-mobl2.lan \
    --to=andi.shyti@linux.intel.com \
    --cc=Michal.Wajdeczko@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=niranjana.vishwanathapura@intel.com \
    --cc=tejas.upadhyay@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