All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jessica Zhang <quic_jesszhan@quicinc.com>
To: Nidhi Gupta <nidhi1.gupta@intel.com>, <igt-dev@lists.freedesktop.org>
Subject: Re: [igt-dev] [PATCH 2/2] tests/kms_writeback: Test Cleanup
Date: Fri, 26 Aug 2022 11:49:12 -0700	[thread overview]
Message-ID: <bdcdae01-f001-e4b8-0bec-70046d99b794@quicinc.com> (raw)
In-Reply-To: <20220825210611.19636-3-nidhi1.gupta@intel.com>

Hi Nidhi,

On 8/25/2022 2:06 PM, Nidhi Gupta wrote:
> Sanitize the system state before starting the subtest.
> 
> Signed-off-by: Nidhi Gupta <nidhi1.gupta@intel.com>
> ---
>   tests/kms_writeback.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/tests/kms_writeback.c b/tests/kms_writeback.c
> index 2508b1e1..0c6c64b3 100644
> --- a/tests/kms_writeback.c
> +++ b/tests/kms_writeback.c
> @@ -169,6 +169,7 @@ static void detach_crtc(igt_display_t *display, igt_output_t *output)
>   	if (get_writeback_fb_id(output) == 0)
>   		return;
>   
> +	igt_display_fini(&display);

igt_display_fini() frees the memory for various members of the 
igt_display_t struct [1]. Since there's already a call to 
igt_display_fini() in the same fixture that detach_crtc() is called [2], 
adding an extra call here will cause a double free.

[1] 
https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/blob/master/lib/igt_kms.c#L2752

[2] 
https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/blob/master/tests/kms_writeback.c#L607

>   	igt_output_set_pipe(output, PIPE_NONE);
>   	igt_display_commit2(display, COMMIT_ATOMIC);
>   }
> @@ -580,6 +581,9 @@ igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL)
>   		     "the combination of possible bad options");
>   	igt_subtest_with_dynamic("writeback-invalid-parameters") {
>   		igt_fb_t invalid_output_fb;
> +		igt_display_reset(&display);
> +		igt_display_commit(&display);

I have a doubt about this:

There's a lot of set up going on in the initial igt_fixture here [3], 
specifically within kms_writeback_get_output() [4], where the output 
pipe is set.

If you just reset the display then do a commit, the output->pending pipe 
will be set to NONE within igt_output_reset() [5]. This will cause the 
commit to detach the CRTC (in a similar manner to what detach_crtc() 
does [6]).

If you don't redo the setup from the initial igt_fixture after resetting 
the display, the commits within do_writeback_test() will fail since 
there won't be a CRTC attached to the connector.

Thanks,

Jessica Zhang

[3] 
https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/blob/master/tests/kms_writeback.c#L491

[4] 
https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/blob/master/tests/kms_writeback.c#L108

[5] 
https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/blob/master/lib/igt_kms.c#L2180

[6] 
https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/blob/master/tests/kms_writeback.c#L167

> +
>   
>   		igt_skip_on(data.dump_check || data.list_modes);
>   		fb_id = igt_create_fb(display.drm_fd, mode.hdisplay / 2,
> @@ -597,6 +601,8 @@ igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL)
>   	igt_describe("Validate WRITEBACK_FB_ID with valid and invalid options");
>   	igt_subtest_with_dynamic("writeback-fb-id") {
>   		igt_fb_t output_fb;
> +		igt_display_reset(&display);
> +		igt_display_commit(&display);
>   
>   		igt_skip_on(data.dump_check || data.list_modes);
>   		fb_id = igt_create_fb(display.drm_fd, mode.hdisplay, mode.vdisplay,
> @@ -613,6 +619,8 @@ igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL)
>   	igt_describe("Check writeback output with CRC validation");
>   	igt_subtest_with_dynamic("writeback-check-output") {
>   		igt_fb_t output_fb;
> +		igt_display_reset(&display);
> +		igt_display_commit(&display);
>   
>   		igt_skip_on(data.dump_check || data.list_modes);
>   		fb_id = igt_create_fb(display.drm_fd, mode.hdisplay, mode.vdisplay,
> -- 
> 2.36.0
> 

  reply	other threads:[~2022-08-26 18:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-25 21:06 [igt-dev] [PATCH 0/2] tests/kms_writeback: Test Cleanup Nidhi Gupta
2022-08-25 21:06 ` [igt-dev] [PATCH 1/2] tests/kms_writeback: Convert tests to dynamic Nidhi Gupta
2022-08-26 18:15   ` Jessica Zhang
2022-08-25 21:06 ` [igt-dev] [PATCH 2/2] tests/kms_writeback: Test Cleanup Nidhi Gupta
2022-08-26 18:49   ` Jessica Zhang [this message]
2022-08-25 21:36 ` [igt-dev] ✗ Fi.CI.BUILD: failure for " Patchwork
2022-09-08  8:48 [igt-dev] [PATCH 0/2] tests/kms_writeback: Test cleanup Nidhi Gupta
2022-09-08  8:48 ` [igt-dev] [PATCH 2/2] " Nidhi Gupta
2022-09-08 18:03   ` Jessica Zhang
2022-09-22  0:58 [igt-dev] [PATCH 0/2] " Nidhi Gupta
2022-09-22  0:58 ` [igt-dev] [PATCH 2/2] " Nidhi Gupta
2022-09-22 10:02   ` Modem, Bhanuprakash
2022-09-30  5:32 [igt-dev] [PATCH 0/2] " Jeevan B
2022-09-30  5:32 ` [igt-dev] [PATCH 2/2] " Jeevan B
2022-09-30  5:41 [igt-dev] [PATCH 0/2] " Nidhi Gupta
2022-09-30  5:41 ` [igt-dev] [PATCH 2/2] " Nidhi Gupta

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=bdcdae01-f001-e4b8-0bec-70046d99b794@quicinc.com \
    --to=quic_jesszhan@quicinc.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=nidhi1.gupta@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 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.