public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/3] runner: Log when watchdog handling fails
@ 2019-06-14  8:08 Arkadiusz Hiler
  2019-06-14  8:08 ` [igt-dev] [PATCH i-g-t 2/3] runner: Handle SIGHUP too Arkadiusz Hiler
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Arkadiusz Hiler @ 2019-06-14  8:08 UTC (permalink / raw)
  To: igt-dev

If write or ioctl on a watchdog ever fails it will be logged.

Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 runner/executor.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/runner/executor.c b/runner/executor.c
index 7e5fbe8f..f9c69fef 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -25,6 +25,17 @@ static struct {
 	size_t num_dogs;
 } watchdogs;
 
+static void __close_watchdog(int fd)
+{
+	int ret = write(fd, "V", 1);
+
+	if (ret == -1)
+		fprintf(stderr, "Failed to stop a watchdog: %s\n",
+			strerror(errno));
+
+	close(fd);
+}
+
 static void close_watchdogs(struct settings *settings)
 {
 	size_t i;
@@ -33,8 +44,7 @@ static void close_watchdogs(struct settings *settings)
 		printf("Closing watchdogs\n");
 
 	for (i = 0; i < watchdogs.num_dogs; i++) {
-		write(watchdogs.fds[i], "V", 1);
-		close(watchdogs.fds[i]);
+		__close_watchdog(watchdogs.fds[i]);
 	}
 }
 
@@ -81,8 +91,7 @@ static int watchdogs_set_timeout(int timeout)
 
 	for (i = 0; i < watchdogs.num_dogs; i++) {
 		if (ioctl(watchdogs.fds[i], WDIOC_SETTIMEOUT, &timeout)) {
-			write(watchdogs.fds[i], "V", 1);
-			close(watchdogs.fds[i]);
+			__close_watchdog(watchdogs.fds[i]);
 			watchdogs.fds[i] = -1;
 			continue;
 		}
@@ -102,9 +111,14 @@ static int watchdogs_set_timeout(int timeout)
 static void ping_watchdogs(void)
 {
 	size_t i;
+	int ret;
 
 	for (i = 0; i < watchdogs.num_dogs; i++) {
-		ioctl(watchdogs.fds[i], WDIOC_KEEPALIVE, 0);
+		ret = ioctl(watchdogs.fds[i], WDIOC_KEEPALIVE, NULL);
+
+		if (ret == -1)
+			fprintf(stderr, "Failed to ping a watchdog: %s\n",
+				strerror(errno));
 	}
 }
 
-- 
2.21.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-06-15 13:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-14  8:08 [igt-dev] [PATCH i-g-t 1/3] runner: Log when watchdog handling fails Arkadiusz Hiler
2019-06-14  8:08 ` [igt-dev] [PATCH i-g-t 2/3] runner: Handle SIGHUP too Arkadiusz Hiler
2019-06-14  8:20   ` Ser, Simon
2019-06-14  8:08 ` [igt-dev] [PATCH i-g-t 3/3] runner: Log which signal was used to terminate the runner Arkadiusz Hiler
2019-06-14  8:21   ` Ser, Simon
2019-06-14  8:16 ` [igt-dev] [PATCH i-g-t 1/3] runner: Log when watchdog handling fails Ser, Simon
2019-06-14 10:05 ` Petri Latvala
2019-06-14 21:00 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] " Patchwork
2019-06-15 13:07 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox