dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Oded Gabbay <oded.gabbay@amd.com>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH 7/9] drm/amdkfd: Add module parameter of send_sigterm
Date: Tue, 21 Apr 2015 15:47:24 +0300	[thread overview]
Message-ID: <1429620446-28017-7-git-send-email-oded.gabbay@amd.com> (raw)
In-Reply-To: <1429620446-28017-1-git-send-email-oded.gabbay@amd.com>

This patch adds a new kernel module parameter to amdkfd, called
send_sigterm.

This parameter specifies whether amdkfd should send the SIGTERM signal to an
HSA process, when the following conditions occur:

1. The GPU triggers an exception regarding a kernel that was issued by this
   process.

2. The HSA process isn't waiting on an event that handles this exception.

The default behavior is not to send a SIGTERM and suffice with a dmesg error
print.

Reviewed-by: Ben Goz <ben.goz@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_events.c | 12 +++++++++---
 drivers/gpu/drm/amd/amdkfd/kfd_module.c |  5 +++++
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h   |  6 ++++++
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
index 9eed7bb..e52376b 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_events.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
@@ -847,10 +847,16 @@ static void lookup_events_by_type_and_signal(struct kfd_process *p,
 
 	/* Send SIGTERM no event of type "type" has been found*/
 	if (send_signal) {
-		dev_warn(kfd_device,
-			"Sending SIGTERM to HSA Process with PID %d ",
+		if (send_sigterm) {
+			dev_warn(kfd_device,
+				"Sending SIGTERM to HSA Process with PID %d ",
+					p->lead_thread->pid);
+			send_sig(SIGTERM, p->lead_thread, 0);
+		} else {
+			dev_err(kfd_device,
+				"HSA Process (PID %d) got unhandled exception",
 				p->lead_thread->pid);
-		send_sig(SIGTERM, p->lead_thread, 0);
+		}
 	}
 }
 
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_module.c b/drivers/gpu/drm/amd/amdkfd/kfd_module.c
index 4e0a68f..e4fc96e 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_module.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_module.c
@@ -54,6 +54,11 @@ module_param(max_num_of_queues_per_device, int, 0444);
 MODULE_PARM_DESC(max_num_of_queues_per_device,
 	"Maximum number of supported queues per device (1 = Minimum, 4096 = default)");
 
+int send_sigterm;
+module_param(send_sigterm, int, 0444);
+MODULE_PARM_DESC(send_sigterm,
+	"Send sigterm to HSA process on unhandled exception (0 = disable, 1 = enable)");
+
 bool kgd2kfd_init(unsigned interface_version, const struct kgd2kfd_calls **g2f)
 {
 	/*
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
index fe76b79..bd435a7 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -74,6 +74,12 @@ extern int max_num_of_queues_per_device;
 /* Kernel module parameter to specify the scheduling policy */
 extern int sched_policy;
 
+/*
+ * Kernel module parameter to specify whether to send sigterm to HSA process on
+ * unhandled exception
+ */
+extern int send_sigterm;
+
 /**
  * enum kfd_sched_policy
  *
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2015-04-21 12:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-21 12:47 [PATCH 1/9] drm/radeon: Add init interrupt kfd->kgd interface Oded Gabbay
2015-04-21 12:47 ` [PATCH 2/9] drm/amdkfd: Add interrupt handling module Oded Gabbay
2015-04-21 12:47 ` [PATCH 3/9] drm/amdkfd: add events IOCTL set definitions Oded Gabbay
2015-04-21 12:47 ` [PATCH 4/9] drm/amdkfd: Add the events module Oded Gabbay
2015-04-21 12:47 ` [PATCH 5/9] drm/amdkfd: Add memory exception handling Oded Gabbay
2015-04-21 12:47 ` [PATCH 6/9] drm/amdkfd: Add bad opcode " Oded Gabbay
2015-04-21 12:47 ` Oded Gabbay [this message]
2015-04-21 12:47 ` [PATCH 8/9] drm/amdkfd: Implement events IOCTLs Oded Gabbay
2015-04-21 12:47 ` [PATCH 9/9] drm/amdkfd: change driver version to 0.7.2 Oded Gabbay

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=1429620446-28017-7-git-send-email-oded.gabbay@amd.com \
    --to=oded.gabbay@amd.com \
    --cc=dri-devel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox