From: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [i-g-t PATCH 1/2] igt_dummyload: clear signal handler on the desructor
Date: Thu, 1 Dec 2016 12:58:45 +0200 [thread overview]
Message-ID: <1480589926-23053-1-git-send-email-abdiel.janulgue@linux.intel.com> (raw)
Fixes an issue when calling igt_spin_batch_set_timeout and then
tearing down the spinner right away before it has the chance
to timeout, causes the associated signal handler to linger. Make
sure to remove the handler on the destructor as well.
Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
---
lib/igt_dummyload.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index 99515ea..b201af0 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -169,9 +169,17 @@ igt_spin_batch_new(int fd, int engine, unsigned int dep_handle)
return spin;
}
-static void sig_handler(int sig, siginfo_t *info, void *arg)
+static void clear_sig_handler(int sig)
{
struct sigaction act;
+
+ memset(&act, 0, sizeof(act));
+ act.sa_handler = SIG_DFL;
+ igt_assert(sigaction(sig, &act, NULL) == 0);
+}
+
+static void sig_handler(int sig, siginfo_t *info, void *arg)
+{
struct igt_spin *iter;
igt_list_for_each(iter, &spin_list, link) {
@@ -181,9 +189,7 @@ static void sig_handler(int sig, siginfo_t *info, void *arg)
}
}
- memset(&act, 0, sizeof(act));
- act.sa_handler = SIG_DFL;
- igt_assert(sigaction(info->si_signo, &act, NULL) == 0);
+ clear_sig_handler(info->si_signo);
}
/**
@@ -248,6 +254,7 @@ void igt_spin_batch_end(igt_spin_t *spin)
*spin->batch = MI_BATCH_BUFFER_END;
__sync_synchronize();
+ clear_sig_handler(spin->signo);
}
/**
--
2.7.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next reply other threads:[~2016-12-01 10:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-01 10:58 Abdiel Janulgue [this message]
2016-12-01 10:58 ` [i-g-t PATCH 2/2] igt/kms_flip: Fix set_dpms called with an idle bo Abdiel Janulgue
2016-12-01 11:23 ` Chris Wilson
2017-03-24 11:55 ` Ander Conselvan De Oliveira
2017-03-24 12:11 ` Chris Wilson
2016-12-01 11:23 ` [i-g-t PATCH 1/2] igt_dummyload: clear signal handler on the desructor Chris Wilson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1480589926-23053-1-git-send-email-abdiel.janulgue@linux.intel.com \
--to=abdiel.janulgue@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.