* [igt-dev] [PATCH i-g-t v2 1/2] igt/gem_fd_exhaustion: Actually test error handling on fd exhaustion
@ 2018-03-05 17:36 Karol Krol
2018-03-05 17:36 ` [igt-dev] [PATCH i-g-t v2 2/2] igt/gem_fd_exhaustion: Modify fs.nr_open for duration of the test Karol Krol
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Karol Krol @ 2018-03-05 17:36 UTC (permalink / raw)
To: igt-dev; +Cc: Karol Krol
Long time ago, there was an issue with driver crashing due to lack of
error handling on struct file creation (gem_create()). We're unable to hit
this scenario, because dup() does not creat flip. Let's replace dup() with
open() and assert that error is returned on exhaustion.
v2: Pass if gem_create fails on exhaustion, no matter the errno.
Signed-off-by: Karol Krol <karol.krol@intel.com>
---
I'm still working on getting rid of e-mail footer. I'll appreciate reviews.
---
tests/gem_fd_exhaustion.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tests/gem_fd_exhaustion.c b/tests/gem_fd_exhaustion.c
index 0969f9c6..fdcb7f36 100644
--- a/tests/gem_fd_exhaustion.c
+++ b/tests/gem_fd_exhaustion.c
@@ -65,7 +65,7 @@ igt_simple_main
igt_drop_root();
for (int i = 0; ; i++) {
- int leak = dup(fd);
+ int leak = open("/dev/null", O_RDONLY);
uint32_t handle;
if (__gem_create(fd, 4096, &handle) == 0)
@@ -73,6 +73,8 @@ igt_simple_main
if (leak < 0) {
igt_info("fd exhaustion after %i rounds.\n", i);
+ igt_assert(__gem_create(fd, 4096,
+ &handle) < 0);
break;
}
}
--
2.14.3
--------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.
Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [igt-dev] [PATCH i-g-t v2 2/2] igt/gem_fd_exhaustion: Modify fs.nr_open for duration of the test
2018-03-05 17:36 [igt-dev] [PATCH i-g-t v2 1/2] igt/gem_fd_exhaustion: Actually test error handling on fd exhaustion Karol Krol
@ 2018-03-05 17:36 ` Karol Krol
2018-03-05 19:05 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,1/2] igt/gem_fd_exhaustion: Actually test error handling on fd exhaustion Patchwork
2018-03-06 1:21 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2 siblings, 0 replies; 4+ messages in thread
From: Karol Krol @ 2018-03-05 17:36 UTC (permalink / raw)
To: igt-dev; +Cc: Karol Krol
We also need to adjust fs.nr_open to allow setting rlimit equal to
fs.file-max. Otherwise we're getting EPREM on setrlimit().
Signed-off-by: Karol Krol <karol.krol@intel.com>
---
I'm still working on getting rid of e-mail footer. I'll appreciate reviews.
---
tests/gem_fd_exhaustion.c | 49 ++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 42 insertions(+), 7 deletions(-)
diff --git a/tests/gem_fd_exhaustion.c b/tests/gem_fd_exhaustion.c
index fdcb7f36..d04cdd09 100644
--- a/tests/gem_fd_exhaustion.c
+++ b/tests/gem_fd_exhaustion.c
@@ -33,17 +33,44 @@
#include <fcntl.h>
#include <limits.h>
+unsigned int original_nr_open;
+
+static int read_sysctl(const char *path)
+{
+ unsigned int val;
+ FILE *f = fopen(path, "r");
+
+ if (f) {
+ igt_assert(fscanf(f, "%u", &val) == 1);
+ fclose(f);
+ return val;
+ }
+ return -errno;
+}
+
+static int write_sysctl(const char *path, unsigned int val)
+{
+ FILE *f = fopen(path, "w");
+
+ if (f) {
+ igt_assert(fprintf(f, "%u", val));
+ fclose(f);
+ return 0;
+ }
+ return -errno;
+}
+
static bool allow_unlimited_files(void)
{
+ unsigned int nofile_rlim = 1024*1024;
struct rlimit rlim;
- unsigned nofile_rlim = 1024*1024;
+ unsigned int buf;
- FILE *file = fopen("/proc/sys/fs/file-max", "r");
- if (file) {
- igt_assert(fscanf(file, "%u", &nofile_rlim) == 1);
- igt_info("System limit for open files is %u\n", nofile_rlim);
- fclose(file);
- }
+ buf = read_sysctl("/proc/sys/fs/file-max");
+ if (buf > 0)
+ nofile_rlim = buf;
+ original_nr_open = read_sysctl("/proc/sys/fs/nr_open");
+ igt_assert(write_sysctl("/proc/sys/fs/nr_open", nofile_rlim) == 0);
if (getrlimit(RLIMIT_NOFILE, &rlim))
return false;
@@ -53,6 +80,12 @@ static bool allow_unlimited_files(void)
return setrlimit(RLIMIT_NOFILE, &rlim) == 0;
}
+static void restore_original_sysctl(void)
+{
+ if (original_nr_open > 0)
+ write_sysctl("/proc/sys/fs/nr_open", original_nr_open);
+}
+
igt_simple_main
{
int fd;
@@ -61,6 +94,8 @@ igt_simple_main
fd = drm_open_driver(DRIVER_INTEL);
+ igt_install_exit_handler(restore_original_sysctl);
+
igt_fork(n, 1) {
igt_drop_root();
--
2.14.3
--------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.
Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,1/2] igt/gem_fd_exhaustion: Actually test error handling on fd exhaustion
2018-03-05 17:36 [igt-dev] [PATCH i-g-t v2 1/2] igt/gem_fd_exhaustion: Actually test error handling on fd exhaustion Karol Krol
2018-03-05 17:36 ` [igt-dev] [PATCH i-g-t v2 2/2] igt/gem_fd_exhaustion: Modify fs.nr_open for duration of the test Karol Krol
@ 2018-03-05 19:05 ` Patchwork
2018-03-06 1:21 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2018-03-05 19:05 UTC (permalink / raw)
To: Karol Krol; +Cc: igt-dev
== Series Details ==
Series: series starting with [i-g-t,v2,1/2] igt/gem_fd_exhaustion: Actually test error handling on fd exhaustion
URL : https://patchwork.freedesktop.org/series/39392/
State : success
== Summary ==
IGT patchset tested on top of latest successful build
23f7da18a92059610792299cfdb03d2c922a9948 lib/igt_pm: Restore runtime pm state on test exit
with latest DRM-Tip kernel build CI_DRM_3873
8c42420f7780 drm-tip: 2018y-03m-05d-18h-20m-17s UTC integration manifest
No testlist changes.
---- Known issues:
Test debugfs_test:
Subgroup read_all_entries:
pass -> INCOMPLETE (fi-snb-2520m) fdo#103713
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fi-bdw-5557u total:288 pass:267 dwarn:0 dfail:0 fail:0 skip:21 time:419s
fi-bdw-gvtdvm total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:428s
fi-blb-e6850 total:288 pass:223 dwarn:1 dfail:0 fail:0 skip:64 time:373s
fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:489s
fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:279s
fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:483s
fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:474s
fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:459s
fi-cfl-8700k total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:395s
fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:564s
fi-cnl-y3 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:572s
fi-elk-e7500 total:288 pass:229 dwarn:0 dfail:0 fail:0 skip:59 time:411s
fi-gdg-551 total:288 pass:179 dwarn:0 dfail:0 fail:1 skip:108 time:293s
fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:507s
fi-hsw-4770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:390s
fi-ilk-650 total:288 pass:228 dwarn:0 dfail:0 fail:0 skip:60 time:413s
fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:444s
fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:414s
fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:450s
fi-kbl-7560u total:108 pass:104 dwarn:0 dfail:0 fail:0 skip:3
fi-kbl-7567u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:452s
fi-kbl-r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:496s
fi-pnv-d510 total:288 pass:222 dwarn:1 dfail:0 fail:0 skip:65 time:583s
fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:428s
fi-skl-6600u total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:504s
fi-skl-6700hq total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:521s
fi-skl-6700k2 total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:482s
fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:476s
fi-skl-guc total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:409s
fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:431s
fi-snb-2520m total:3 pass:2 dwarn:0 dfail:0 fail:0 skip:0
fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:395s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1063/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 4+ messages in thread
* [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,v2,1/2] igt/gem_fd_exhaustion: Actually test error handling on fd exhaustion
2018-03-05 17:36 [igt-dev] [PATCH i-g-t v2 1/2] igt/gem_fd_exhaustion: Actually test error handling on fd exhaustion Karol Krol
2018-03-05 17:36 ` [igt-dev] [PATCH i-g-t v2 2/2] igt/gem_fd_exhaustion: Modify fs.nr_open for duration of the test Karol Krol
2018-03-05 19:05 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,1/2] igt/gem_fd_exhaustion: Actually test error handling on fd exhaustion Patchwork
@ 2018-03-06 1:21 ` Patchwork
2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2018-03-06 1:21 UTC (permalink / raw)
To: Karol Krol; +Cc: igt-dev
== Series Details ==
Series: series starting with [i-g-t,v2,1/2] igt/gem_fd_exhaustion: Actually test error handling on fd exhaustion
URL : https://patchwork.freedesktop.org/series/39392/
State : success
== Summary ==
---- Known issues:
Test kms_chv_cursor_fail:
Subgroup pipe-b-256x256-bottom-edge:
dmesg-warn -> PASS (shard-snb) fdo#105185 +1
Test kms_flip:
Subgroup 2x-plain-flip-ts-check-interruptible:
fail -> PASS (shard-hsw) fdo#100368 +1
Test kms_frontbuffer_tracking:
Subgroup fbc-1p-primscrn-cur-indfb-onoff:
pass -> FAIL (shard-apl) fdo#103167
fdo#105185 https://bugs.freedesktop.org/show_bug.cgi?id=105185
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
shard-apl total:3379 pass:1777 dwarn:1 dfail:0 fail:8 skip:1591 time:11861s
shard-hsw total:3468 pass:1773 dwarn:1 dfail:0 fail:2 skip:1691 time:11729s
shard-snb total:3468 pass:1365 dwarn:1 dfail:0 fail:1 skip:2101 time:7139s
Blacklisted hosts:
shard-kbl total:3379 pass:1895 dwarn:8 dfail:0 fail:7 skip:1468 time:9080s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1063/shards.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-03-06 1:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-05 17:36 [igt-dev] [PATCH i-g-t v2 1/2] igt/gem_fd_exhaustion: Actually test error handling on fd exhaustion Karol Krol
2018-03-05 17:36 ` [igt-dev] [PATCH i-g-t v2 2/2] igt/gem_fd_exhaustion: Modify fs.nr_open for duration of the test Karol Krol
2018-03-05 19:05 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,1/2] igt/gem_fd_exhaustion: Actually test error handling on fd exhaustion Patchwork
2018-03-06 1:21 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
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.