public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oded Gabbay <ogabbay@kernel.org>
To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: Dafna Hirschfeld <dhirschfeld@habana.ai>
Subject: [PATCH 1/6] accel/habanalabs: check failure of eventfd_signal
Date: Tue,  2 Jan 2024 17:06:49 +0200	[thread overview]
Message-ID: <20240102150654.522555-1-ogabbay@kernel.org> (raw)

From: Dafna Hirschfeld <dhirschfeld@habana.ai>

print err log if eventfd_signal return val is not 1 as expected.

Signed-off-by: Dafna Hirschfeld <dhirschfeld@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
---
 drivers/accel/habanalabs/common/device.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/accel/habanalabs/common/device.c b/drivers/accel/habanalabs/common/device.c
index a365791a9f5c..e81ccafddfb3 100644
--- a/drivers/accel/habanalabs/common/device.c
+++ b/drivers/accel/habanalabs/common/device.c
@@ -2043,13 +2043,19 @@ int hl_device_cond_reset(struct hl_device *hdev, u32 flags, u64 event_mask)
 	return hl_device_reset(hdev, flags | HL_DRV_RESET_HARD);
 }
 
-static void hl_notifier_event_send(struct hl_notifier_event *notifier_event, u64 event_mask)
+static void hl_notifier_event_send(struct hl_device *hdev,
+			struct hl_notifier_event *notifier_event, u64 event_mask)
 {
+	u64 n;
+
 	mutex_lock(&notifier_event->lock);
 	notifier_event->events_mask |= event_mask;
 
-	if (notifier_event->eventfd)
-		eventfd_signal(notifier_event->eventfd, 1);
+	if (notifier_event->eventfd) {
+		n = eventfd_signal(notifier_event->eventfd, 1);
+		if (n != 1)
+			dev_err(hdev->dev, "eventfd signal failed, incremented by %llu\n", n);
+	}
 
 	mutex_unlock(&notifier_event->lock);
 }
@@ -2073,7 +2079,7 @@ void hl_notifier_event_send_all(struct hl_device *hdev, u64 event_mask)
 	mutex_lock(&hdev->fpriv_list_lock);
 
 	list_for_each_entry(hpriv, &hdev->fpriv_list, dev_node)
-		hl_notifier_event_send(&hpriv->notifier_event, event_mask);
+		hl_notifier_event_send(hdev, &hpriv->notifier_event, event_mask);
 
 	mutex_unlock(&hdev->fpriv_list_lock);
 }
-- 
2.34.1


             reply	other threads:[~2024-01-02 15:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-02 15:06 Oded Gabbay [this message]
2024-01-02 15:06 ` [PATCH 2/6] accel/habanalabs/gaudi2: add interrupt affinity for user interrupts Oded Gabbay
2024-01-02 15:06 ` [PATCH 3/6] accel/habanalabs: increase HL_MAX_STR to 64 bytes to avoid warnings Oded Gabbay
2024-01-02 15:06 ` [PATCH 4/6] accel/habanalabs: fix DRAM BAR base address calculation Oded Gabbay
2024-01-02 15:06 ` [PATCH 5/6] accel/habanalabs/gaudi2: move HMMU page tables to device memory Oded Gabbay
2024-01-02 15:06 ` [PATCH 6/6] accel/habanalabs: abort device reset for consecutive heartbeat failures 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=20240102150654.522555-1-ogabbay@kernel.org \
    --to=ogabbay@kernel.org \
    --cc=dhirschfeld@habana.ai \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.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