Skip to contentSkip to conversation

lib/igt_core: Move write_stderr out of LIBUNWIND ifdef

PATCH In review Arkadiusz Hiler 4 participants 6 messages Nov 24, 2017 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/igt_core: Move write_stderr out of LIBUNWIND ifdef

write_stderr() and __write_stderr() are defined behind ifdef on HAVE_LIBUNWIND, but do no depend on the lib in any way.

fatal_sig_handler() uses those helpers unconditionally.

This patch just moves the code couple of lines up, so the helpers are always available and do not break build on systems without libunwind.

---
 lib/igt_core.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
lib/igt_core.c +10 -10
index 4fe48c97..6ce83bec 100644
@@ -1231,6 +1231,16 @@ static bool run_under_gdb(void)
 		strncmp(basename(buf), "gdb", 3) == 0);
 }
 
+static void __write_stderr(const char *str, size_t len)
+{
+	igt_ignore_warn(write(STDERR_FILENO, str, len));
+}
+
+static void write_stderr(const char *str)
+{
+	__write_stderr(str, strlen(str));
+}
+
 #ifdef HAVE_LIBUNWIND
 #define UNW_LOCAL_ONLY
 #include <libunwind.h>
@@ -1407,16 +1417,6 @@ xprintf(const char *fmt, ...)
 	va_end(ap);
 }
 
-static void __write_stderr(const char *str, size_t len)
-{
-	igt_ignore_warn(write(STDERR_FILENO, str, len));
-}
-
-static void write_stderr(const char *str)
-{
-	__write_stderr(str, strlen(str));
-}
-
 static void print_backtrace_sig_safe(void)
 {
 	unw_cursor_t cursor;
Signature · 6 lines
2.13.6

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

Quoting Arkadiusz Hiler (2017-11-24 10:32:07)

Quoted 2 lines

write_stderr() and __write_stderr() are defined behind ifdef on HAVE_LIBUNWIND, but do no depend on the lib in any way.

Hmm, we keep getting caught out by large ifdefs. Although I guess conditionally enabled code itself is less-than-welcome, we should probably aim to make whole C files be conditionally compiled, exporting no-op interfaces when not enabled. Just a thought.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
Quoted 9 lines · Chris Wilson

Quoting Arkadiusz Hiler (2017-11-24 10:32:07)

Quoted 2 lines

write_stderr() and __write_stderr() are defined behind ifdef on HAVE_LIBUNWIND, but do no depend on the lib in any way.

Hmm, we keep getting caught out by large ifdefs. Although I guess conditionally enabled code itself is less-than-welcome, we should probably aim to make whole C files be conditionally compiled, exporting no-op interfaces when not enabled. Just a thought.
-Chris

Sounds about right, and... unwinding the libunwind mess would be a good way to start.

Any volunteers? I may be able to give it a shot next week...

Signature · 6 lines
Cheers,
Arek
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#3 lore raw
In reply to Arkadiusz Hiler
Quoted 43 lines · Arkadiusz Hiler

write_stderr() and __write_stderr() are defined behind ifdef on HAVE_LIBUNWIND, but do no depend on the lib in any way.

fatal_sig_handler() uses those helpers unconditionally.

This patch just moves the code couple of lines up, so the helpers are always available and do not break build on systems without libunwind.

---
  lib/igt_core.c | 20 ++++++++++----------
  1 file changed, 10 insertions(+), 10 deletions(-)
lib/igt_core.c +10 -3
index 4fe48c97..6ce83bec 100644
@@ -1231,6 +1231,16 @@ static bool run_under_gdb(void)
  		strncmp(basename(buf), "gdb", 3) == 0);
  }
 
+static void __write_stderr(const char *str, size_t len)
+{
+	igt_ignore_warn(write(STDERR_FILENO, str, len));
+}
+
+static void write_stderr(const char *str)
+{
+	__write_stderr(str, strlen(str));
+}
+
  #ifdef HAVE_LIBUNWIND
  #define UNW_LOCAL_ONLY
  #include <libunwind.h>
@@ -1407,16 +1417,6 @@ xprintf(const char *fmt, ...)
  	va_end(ap);
  }
 
-static void __write_stderr(const char *str, size_t len)
-{
-	igt_ignore_warn(write(STDERR_FILENO, str, len));

lib/igt_core.c xprintf(const char *fmt, ...) · line 1422

Quoted 10 lines
lib/igt_core.c +0 -7
-}
-
-static void write_stderr(const char *str)
-{
-	__write_stderr(str, strlen(str));
-}
-
  static void print_backtrace_sig_safe(void)
  {
  	unw_cursor_t cursor;

Oopsie, I did not spot that #ifdef block.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

✓ Fi.CI.BAT: success for lib/igt_core: Move write_stderr out of LIBUNWIND ifdef

In reply to Arkadiusz Hiler
== Series Details ==

== Series Details ==

Series: lib/igt_core: Move write_stderr out of LIBUNWIND ifdef
URL : https://patchwork.freedesktop.org/series/34349/
State : success

== Summary ==

IGT patchset tested on top of latest successful build 2a1c1c099113022f091f9e9585be88c6c9cefec5 igt/perf_pmu: Recalibrate interrupt loop.

with latest DRM-Tip kernel build CI_DRM_3383
99e3e01d35c9 drm-tip: 2017y-11m-24d-13h-20m-57s UTC integration manifest

No testlist changes.

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:444s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:455s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:387s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:545s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:280s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:508s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:512s
fi-byt-j1900     total:289  pass:254  dwarn:0   dfail:0   fail:0   skip:35  time:505s
fi-byt-n2820     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:492s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:427s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:543s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:431s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:442s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:434s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:484s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:468s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:480s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:533s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:475s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:540s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:570s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:457s
fi-skl-6600u     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:546s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:568s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:498s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:469s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:567s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:423s
Blacklisted hosts:
fi-cfl-s2        total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:605s
fi-cnl-y         total:289  pass:261  dwarn:1   dfail:0   fail:0   skip:27  time:557s
fi-glk-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:492s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_548/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

✗ Fi.CI.IGT: warning for lib/igt_core: Move write_stderr out of LIBUNWIND ifdef

In reply to Arkadiusz Hiler
== Series Details ==

== Series Details ==

Series: lib/igt_core: Move write_stderr out of LIBUNWIND ifdef
URL : https://patchwork.freedesktop.org/series/34349/
State : warning

== Summary ==

Test kms_flip:

        Subgroup wf_vblank-vs-modeset-interruptible:
                pass       -> SKIP       (shard-hsw) fdo#102614
        Subgroup vblank-vs-suspend-interruptible:
                pass       -> SKIP       (shard-hsw) fdo#100368
Test kms_plane:
        Subgroup plane-panning-bottom-right-suspend-pipe-b-planes:
                pass       -> SKIP       (shard-hsw)
        Subgroup plane-panning-bottom-right-suspend-pipe-a-planes:
                pass       -> SKIP       (shard-snb) fdo#103667
Test drv_selftest:
        Subgroup mock_sanitycheck:
                pass       -> DMESG-WARN (shard-snb) fdo#103717
Test gem_busy:
        Subgroup close-race:
                fail       -> PASS       (shard-snb) fdo#103829
Test kms_frontbuffer_tracking:
        Subgroup fbc-rgb565-draw-blt:
                fail       -> PASS       (shard-snb) fdo#101623
Test kms_setmode:
        Subgroup basic:
                fail       -> PASS       (shard-hsw) fdo#99912

fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#103667 https://bugs.freedesktop.org/show_bug.cgi?id=103667
fdo#103717 https://bugs.freedesktop.org/show_bug.cgi?id=103717
fdo#103829 https://bugs.freedesktop.org/show_bug.cgi?id=103829
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912

shard-hsw        total:2667 pass:1533 dwarn:1   dfail:0   fail:9   skip:1124 time:9396s
shard-snb        total:2667 pass:1308 dwarn:2   dfail:0   fail:14  skip:1343 time:8047s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_548/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx