All of lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t 1/6] tests/kms_ccs: Make sure to free GEM and FB objects
Date: Tue, 31 Aug 2021 21:54:37 +0300	[thread overview]
Message-ID: <20210831185437.GG3458504@ideak-desk.fi.intel.com> (raw)
In-Reply-To: <60f7c750-9ab4-8193-a019-63ff68ebd826@gmail.com>

On Tue, Aug 31, 2021 at 08:47:49PM +0300, Juha-Pekka Heikkila wrote:
> On 27.8.2021 17.57, Imre Deak wrote:
> > At the moment we're leaking the GEM and FB objects that could lead to
> > OOM if multiple subtests are run (vs. each subtest in a seperate test
> > run).
> > 
> > Signed-off-by: Imre Deak <imre.deak@intel.com>
> > ---
> >   tests/kms_ccs.c | 15 +++++++++++----
> >   1 file changed, 11 insertions(+), 4 deletions(-)
> > 
> > diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
> > index 586680ae1..f376f1c80 100644
> > --- a/tests/kms_ccs.c
> > +++ b/tests/kms_ccs.c
> > @@ -345,6 +345,10 @@ static void generate_fb(data_t *data, struct igt_fb *fb,
> >   	if (data->flags & TEST_FAIL_ON_ADDFB2) {
> >   		igt_assert_eq(ret, -1);
> >   		igt_assert_eq(errno, EINVAL);
> > +
> > +		if (f.handles[index])
> > +			gem_close(data->drm_fd, f.handles[index]);
> > +
> 
> I guess this gem_close could be called before doing asserts.

Ah yes, the assert will continue with the next subtest, doh:/

> >   		return;
> >   	} else
> >   		igt_assert_eq(ret, 0);
> > @@ -387,7 +391,8 @@ static bool try_config(data_t *data, enum test_fb_flags fb_flags,
> >   	drmModeModeInfo *drm_mode = igt_output_get_mode(data->output);
> >   	int fb_width = drm_mode->hdisplay;
> >   	enum igt_commit_style commit;
> > -	struct igt_fb fb, fb_sprite;
> > +	struct igt_fb fb = {};
> > +	struct igt_fb fb_sprite = {};
> >   	int ret;
> >   	if (data->display.is_atomic)
> > @@ -425,7 +430,7 @@ static bool try_config(data_t *data, enum test_fb_flags fb_flags,
> >   	}
> >   	if (data->flags & TEST_FAIL_ON_ADDFB2)
> > -		return true;
> > +		goto out_free_fbs;
> >   	igt_plane_set_position(primary, 0, 0);
> >   	igt_plane_set_size(primary, drm_mode->hdisplay, drm_mode->vdisplay);
> > @@ -458,14 +463,16 @@ static bool try_config(data_t *data, enum test_fb_flags fb_flags,
> >   		igt_plane_set_position(data->plane, 0, 0);
> >   		igt_plane_set_size(data->plane, 0, 0);
> >   		igt_plane_set_fb(data->plane, NULL);
> > -		igt_remove_fb(display->drm_fd, &fb_sprite);
> >   	}
> >   	igt_plane_set_fb(primary, NULL);
> >   	igt_plane_set_rotation(primary, IGT_ROTATION_0);
> >   	igt_display_commit2(display, commit);
> > -	if (data->flags & TEST_CRC)
> > +out_free_fbs:
> > +	if (fb_sprite.fb_id)
> > +		igt_remove_fb(data->drm_fd, &fb_sprite);
> > +	if (fb.fb_id)
> >   		igt_remove_fb(data->drm_fd, &fb);
> 
> These igt_remove_fb could be called unconditionally, they do as first things
> same check for fb_id

Ok, missed that.

> >   	return true;
> > 
> 
> those are just minor comments, fix or no fix either way
> 
> Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>

  reply	other threads:[~2021-08-31 18:54 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-27 14:57 [igt-dev] [PATCH i-g-t 0/6] lib/igt_fb: Remove stride, offset restrictions on CCS FBs Imre Deak
2021-08-27 14:57 ` [igt-dev] [PATCH i-g-t 1/6] tests/kms_ccs: Make sure to free GEM and FB objects Imre Deak
2021-08-31 17:47   ` Juha-Pekka Heikkila
2021-08-31 18:54     ` Imre Deak [this message]
2021-08-27 14:57 ` [igt-dev] [PATCH i-g-t 2/6] tests/kms_ccs: Use test pattern when possible Imre Deak
2021-08-31 17:48   ` Juha-Pekka Heikkila
2021-08-31 18:51     ` Juha-Pekka Heikkila
2021-08-27 14:57 ` [igt-dev] [PATCH i-g-t 3/6] tests/kms_ccs: Fix small aux stride subtest Imre Deak
2021-08-31 17:48   ` Juha-Pekka Heikkila
2021-08-27 14:57 ` [igt-dev] [PATCH i-g-t 4/6] tests/kms_ccs: Test bad params for all CCS planes Imre Deak
2021-08-31 17:49   ` Juha-Pekka Heikkila
2021-08-27 14:57 ` [igt-dev] [PATCH i-g-t 5/6] lib/igt_fb: Add support for remapping CCS FBs Imre Deak
2021-08-31 17:49   ` Juha-Pekka Heikkila
2021-08-27 14:57 ` [igt-dev] [PATCH i-g-t 6/6] for-ci: Check for ccs remap support Imre Deak
2021-08-31 17:52   ` Juha-Pekka Heikkila
2021-08-31 19:08     ` Imre Deak
2021-09-14  7:46   ` Zbigniew Kempczyński
2021-09-14  8:40     ` Imre Deak
2021-08-27 16:05 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_fb: Remove stride, offset restrictions on CCS FBs Patchwork
2021-08-27 19:08 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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=20210831185437.GG3458504@ideak-desk.fi.intel.com \
    --to=imre.deak@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=juhapekka.heikkila@gmail.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 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.