[PATCH i-g-t 0/2] test/kms_cursor_crc: tie some loose ends in the prepare_crtc

0 views
Skip to first unread message

Melissa Wen

unread,
Jun 22, 2020, 12:37:26 PM6/22/20
to inte...@lists.freedesktop.org, Rodrigo....@amd.com, rodrigosi...@gmail.com, twoe...@gmail.com, kerne...@googlegroups.com
Using vkms, when running a sequence of subtests from kms_cursor_crc,
several strange timeout failures occurred. For example, running the
alpha-opaque cursor twice, the first run is successful and the second
fails. In addition, if we run the entire test in a call (i.e.: sudo
IGT_FORCE_DRIVER=vkms build/tests/kms_cursor_crc), the first subtest
passes and the rest of the subtests fail - even those that succeed when
run in isolation.

igt_debugfs-DEBUG: Opening debugfs directory '/sys/kernel/debug/dri/0'
igt_core-INFO: Timed out: Opening crc fd, and poll for first CRC.

During my debugging process, I found two issues that were blocking
execution and the solution is in this patchset:

1 - When a subtest fails, it exits and skips the cleaning step, leaving
the pipe_crc allocated and blocked for the next subtest. The first patch
fixes it by releasing any old pipe_crc before creating a new one.

2 - When the CRC capture process starts, it enters an endless wait; this
seems to be related to the fact that the VKMS simulates vblank events,
generating a time mismatch between vblank and CRC capture. Waiting for
vblank before starting the capture process sets the pace, as shown in
the second patch.

Melissa Wen (2):
test/kms_cursor_crc: release old pipe_crc before create a new one
test/kms_cursor_crc: align the start of the CRC capture to a vblank

tests/kms_cursor_crc.c | 3 +++
1 file changed, 3 insertions(+)

--
2.27.0

Melissa Wen

unread,
Jun 22, 2020, 12:38:03 PM6/22/20
to inte...@lists.freedesktop.org, Rodrigo....@amd.com, rodrigosi...@gmail.com, twoe...@gmail.com, kerne...@googlegroups.com
When a subtest fails, it skips the cleanup, and its pipe_crc remains allocated.
As a consequence, the following subtest also fails (timeout) when trying to
create a new one. This patch releases any remaining pipe_crc to enable the
creation of a new one for the next subtest.

Signed-off-by: Melissa Wen <melis...@gmail.com>
---
tests/kms_cursor_crc.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index f105e295..5976df5f 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -423,6 +423,8 @@ static void prepare_crtc(data_t *data, igt_output_t *output,
igt_display_commit(display);

/* create the pipe_crc object for this pipe */
+ if (data->pipe_crc)
+ igt_pipe_crc_free(data->pipe_crc);
data->pipe_crc = igt_pipe_crc_new(data->drm_fd, data->pipe,
INTEL_PIPE_CRC_SOURCE_AUTO);

--
2.27.0

Melissa Wen

unread,
Jun 22, 2020, 12:38:34 PM6/22/20
to inte...@lists.freedesktop.org, Rodrigo....@amd.com, rodrigosi...@gmail.com, twoe...@gmail.com, kerne...@googlegroups.com
When running subtests in sequence using vkms, the beginning of CRC capture
process does not match the simulated vblank timing. This mismatch leads to
an endless busy wait and, consequently, timeout failures for the remaining
subtests in the test sequence. This patch sets the pace by waiting for
vblank before starting the CRC capture.

Signed-off-by: Melissa Wen <melis...@gmail.com>
---
tests/kms_cursor_crc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index 5976df5f..755c34ed 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -474,6 +474,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output,
igt_assert(data->batch);
}

+ igt_wait_for_vblank(data->drm_fd, data->pipe);
igt_pipe_crc_start(data->pipe_crc);
}

--
2.27.0

Arkadiusz Hiler

unread,
Jul 15, 2020, 8:47:12 AM7/15/20
to Melissa Wen, inte...@lists.freedesktop.org, kerne...@googlegroups.com, Rodrigo....@amd.com, rodrigosi...@gmail.com, twoe...@gmail.com
On Mon, Jun 22, 2020 at 01:37:55PM -0300, Melissa Wen wrote:
> When a subtest fails, it skips the cleanup, and its pipe_crc remains allocated.
> As a consequence, the following subtest also fails (timeout) when trying to
> create a new one. This patch releases any remaining pipe_crc to enable the
> creation of a new one for the next subtest.
>
> Signed-off-by: Melissa Wen <melis...@gmail.com>
> ---
> tests/kms_cursor_crc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
> index f105e295..5976df5f 100644
> --- a/tests/kms_cursor_crc.c
> +++ b/tests/kms_cursor_crc.c
> @@ -423,6 +423,8 @@ static void prepare_crtc(data_t *data, igt_output_t *output,
> igt_display_commit(display);
>
> /* create the pipe_crc object for this pipe */
> + if (data->pipe_crc)
> + igt_pipe_crc_free(data->pipe_crc);

That's a welcome improvement, but you may want to also look at
06333955bf3d ("tests/kms_cursor_crc: start crc only once per test")
for some extra inspiration for future work on this.

It should be possible to initiate pipe crc to be initalized only once
per each tested pipe in run_tests_on_pipe() - igt_pipe_crc_new() can be
costly on some real panels.

Anyway,
Reviewed-by: Arkadiusz Hiler <arkadiu...@intel.com>


> data->pipe_crc = igt_pipe_crc_new(data->drm_fd, data->pipe,
> INTEL_PIPE_CRC_SOURCE_AUTO);
>
> --
> 2.27.0
>
> _______________________________________________
> Intel-gfx mailing list
> Inte...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Arkadiusz Hiler

unread,
Jul 15, 2020, 9:02:18 AM7/15/20
to Melissa Wen, inte...@lists.freedesktop.org, kerne...@googlegroups.com, Rodrigo....@amd.com, rodrigosi...@gmail.com, twoe...@gmail.com
On Mon, Jun 22, 2020 at 01:38:26PM -0300, Melissa Wen wrote:
> When running subtests in sequence using vkms, the beginning of CRC capture
> process does not match the simulated vblank timing. This mismatch leads to
> an endless busy wait and, consequently, timeout failures for the remaining
> subtests in the test sequence. This patch sets the pace by waiting for
> vblank before starting the CRC capture.
>
> Signed-off-by: Melissa Wen <melis...@gmail.com>

This one is quite interetesing. The test seems to be working just fine
on the real hardware and causes the endless busy wait on VKMS only...

DRM is bad at describing usage sequences and what's defined and what's
undefined when it comes to behavior. We just try not to break any of the
existing users. On top of that CRC capture is a testing/debug feature
that doesn't have have to be stable - it's not really obvious what's the
correct course of action here.

The vblank wait won't harm anyone, especially in the context presented
above. You have to keep in mind that other implementations of CRC
caputring doesn't have that requirement and you will likely find more
similar instances of this usage pattern. There may be even more of them
introduced over time - there's no CI on VKMS (fingers crossed that this
is going to change).

Have you thought about what's easier here - making the current code work
on the VKMS side or fixing the test? I would like to know your thoughts
on this.

--
Cheers,
Arek




> ---
> tests/kms_cursor_crc.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
> index 5976df5f..755c34ed 100644
> --- a/tests/kms_cursor_crc.c
> +++ b/tests/kms_cursor_crc.c
> @@ -474,6 +474,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output,
> igt_assert(data->batch);
> }
>
> + igt_wait_for_vblank(data->drm_fd, data->pipe);
> igt_pipe_crc_start(data->pipe_crc);
> }
>
> --
> 2.27.0
>

Melissa Wen

unread,
Jul 15, 2020, 12:22:54 PM7/15/20
to Arkadiusz Hiler, inte...@lists.freedesktop.org, kerne...@googlegroups.com, Rodrigo....@amd.com, rodrigosi...@gmail.com, twoe...@gmail.com
On 07/15, Arkadiusz Hiler wrote:
> On Mon, Jun 22, 2020 at 01:38:26PM -0300, Melissa Wen wrote:
> > When running subtests in sequence using vkms, the beginning of CRC capture
> > process does not match the simulated vblank timing. This mismatch leads to
> > an endless busy wait and, consequently, timeout failures for the remaining
> > subtests in the test sequence. This patch sets the pace by waiting for
> > vblank before starting the CRC capture.
> >
> > Signed-off-by: Melissa Wen <melis...@gmail.com>
>
> This one is quite interetesing. The test seems to be working just fine
> on the real hardware and causes the endless busy wait on VKMS only...
>
> DRM is bad at describing usage sequences and what's defined and what's
> undefined when it comes to behavior. We just try not to break any of the
> existing users. On top of that CRC capture is a testing/debug feature
> that doesn't have have to be stable - it's not really obvious what's the
> correct course of action here.
>
> The vblank wait won't harm anyone, especially in the context presented
> above. You have to keep in mind that other implementations of CRC
> caputring doesn't have that requirement and you will likely find more
> similar instances of this usage pattern. There may be even more of them
> introduced over time - there's no CI on VKMS (fingers crossed that this
> is going to change).
>
> Have you thought about what's easier here - making the current code work
> on the VKMS side or fixing the test? I would like to know your thoughts
> on this.
Hi,

Thank you very much for the review!

I've been investigating more about this with the community help and, in
fact, the problem seems to be more linked to vkms. I mean, this problem
of waiting for a vblank before starting to capture the CRC seems to
affect vkms in other igt tests too. So the most accurate thing is to
treat it over there.

I will send a v2 only with the other patch that releases the pipe_crc
before creating a new one.

Thanks again,

Melissa

Melissa Wen

unread,
Jul 16, 2020, 7:40:47 AM7/16/20
to Arkadiusz Hiler, igt...@lists.freedesktop.org, kerne...@googlegroups.com, Rodrigo....@amd.com, rodrigosi...@gmail.com, twoe...@gmail.com
On 07/15, Arkadiusz Hiler wrote:
Hi,

Thanks for the advice!
As I have one more refactoring in mind for this test, I will add this in
the works and send a patchset with everything together.

For now, I just submitted a v2 of this patch because I dropped the other
one that was in the same patchset.

Melissa
Reply all
Reply to author
Forward
0 new messages