Skip to contentSkip to conversation

Confusing Junk in the results: Last errno: 25, Inappropriate ioctl for device

Bug 110354 [email protected] 1 participant 3 messages Apr 8, 2019 – Aug 6, 2019 Library code

lore
Share & tools
lore
#0 lore raw

https://bugs.freedesktop.org/show_bug.cgi?id=110354

Bug ID: 110354
Summary: Confusing Junk in the results: Last errno: 25,
Inappropriate ioctl for device
Product: DRI
Version: unspecified
Hardware: Other
OS: All
Status: NEW
Severity: major
Priority: medium
Component: IGT
Assignee: [email protected]
Reporter: [email protected]

IGT's asserts log the last errno if it's not 0, and it seems like we get this "Inappropriate ioctl for device" quite often polluting the CI results and confusing people.

We have to locate where is it originating from and set errno to 0 after handling it to stop the pollution.

Some examples:
https://bugs.freedesktop.org/show_bug.cgi?id=109358
https://bugs.freedesktop.org/show_bug.cgi?id=110037
https://bugs.freedesktop.org/show_bug.cgi?id=110279

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw

https://bugs.freedesktop.org/show_bug.cgi?id=110354

--- Comment #1 from Arek Hiler <[email protected]> ---

lib/igt_aux.c +4 -1
index 266aa832..b235b18c 100644
@@ -984,8 +984,11 @@ void igt_debug_wait_for_keypress(const char *var)
 {
        struct termios oldt, newt;
 
-       if (!isatty(STDIN_FILENO))
+       if (!isatty(STDIN_FILENO)) {
+               errno = 0; /* otherwise may be ENOTTY */
                return;
+       }
+
 
        if (!igt_interactive_debug)
                return;

Found the culprit in this particular case. This would suppress most of the weird errno logged in kms tests.

The questions is now: do we really want to hunt all similar cases down? A round of gdb through a couple of tests with 'watch errno' shows that it gets set to non-zero value about a dozen times every single subtest. Depending when we hit an assert we may get any of those printed out adding to confusion.

I see 3 options:
1. make sure that errno is reset to 0 by everything that touches it and change my nickname to Sisyphus
2. get rid of printing errno in igt_assert(), but then lose valuable information for all those igt_assert(write(...));
3. change igt_assert*(expr,...) macros so that they 'errno = 0;' before evaluating expr

I think that 3 makes the most sense, then we can quickly go through all the 4000-ish of calls we have to make sure that we don't have any weird 'int ret = write(); igt_assert(ret);' for those functions where errno matters.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author Reviewed-by Petri Latvala Reviewed-by Petri Latvala
#2 lore raw
In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=110354

Arek Hiler <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Arek Hiler <[email protected]> --- There was a patch merged that resets errno in the few places where errno pollution is likely and in the few places where it may require resetting:

commit a558c2e2405473f4157ca71638e5a111ebfa80d1

Author: Arkadiusz Hiler <[email protected]>
Date:   Tue Apr 9 17:21:41 2019 +0300

lib: Reset errno to 0 after isatty

Since igt_assert family of functions logs last errno we get a lot of
those: "Last errno: 25, Inappropriate ioctl for device"

isatty() seems to be the biggest offender in that area, so this patch should limit amount of confusing messages significantly.

commit 02b1706e8b1ca93a53d4ef0f9c484a6f1a0d18f2

Author: Arkadiusz Hiler <[email protected]>
Date:   Thu Apr 4 16:17:40 2019 +0300

lib/igt_kms: Be more verbose about failure in kmstest_wait_for_pageflip

First, we set errno to 0 before doing select() to avoid random pollution of the assert message with things like:
"Last errno: 25, Inappropriate ioctl for device"

Second, we log explicitly if we exceeded the timeout (ret == 0).

Third, if we fail the select() we log that with some explanation.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel