public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oded Gabbay <ogabbay@kernel.org>
To: rostedt@goodmis.org
Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
	Ohad Sharabi <osharabi@habana.ai>
Subject: [PATCH 2/3] habanalabs: trace MMU map/unmap page
Date: Thu, 11 Aug 2022 14:39:52 +0300	[thread overview]
Message-ID: <20220811113953.1963412-3-ogabbay@kernel.org> (raw)
In-Reply-To: <20220811113953.1963412-1-ogabbay@kernel.org>

From: Ohad Sharabi <osharabi@habana.ai>

This patch utilize the defined tracepoint to trace the MMU's pages
map/unmap operations.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
---
 drivers/misc/habanalabs/common/mmu/mmu.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/habanalabs/common/mmu/mmu.c b/drivers/misc/habanalabs/common/mmu/mmu.c
index 60740de47b34..60d2a3f8af13 100644
--- a/drivers/misc/habanalabs/common/mmu/mmu.c
+++ b/drivers/misc/habanalabs/common/mmu/mmu.c
@@ -9,6 +9,8 @@
 
 #include "../habanalabs.h"
 
+#include <trace/events/habanalabs.h>
+
 /**
  * hl_mmu_get_funcs() - get MMU functions structure
  * @hdev: habanalabs device structure.
@@ -259,7 +261,12 @@ int hl_mmu_unmap_page(struct hl_ctx *ctx, u64 virt_addr, u32 page_size, bool flu
 	if (flush_pte)
 		mmu_funcs->flush(ctx);
 
-	return rc;
+	if (rc)
+		return rc;
+
+	trace_habanalabs_mmu_unmap(hdev->dev, virt_addr, 0, page_size, flush_pte);
+
+	return 0;
 }
 
 /*
@@ -344,6 +351,8 @@ int hl_mmu_map_page(struct hl_ctx *ctx, u64 virt_addr, u64 phys_addr, u32 page_s
 	if (flush_pte)
 		mmu_funcs->flush(ctx);
 
+	trace_habanalabs_mmu_map(hdev->dev, virt_addr, phys_addr, page_size, flush_pte);
+
 	return 0;
 
 err:
-- 
2.25.1


  parent reply	other threads:[~2022-08-11 11:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-11 11:39 [PATCH 0/3] Adding support for trace events to habanalabs Oded Gabbay
2022-08-11 11:39 ` [PATCH 1/3] habanalabs: define trace events Oded Gabbay
2022-08-11 13:44   ` Steven Rostedt
2022-08-11 11:39 ` Oded Gabbay [this message]
2022-08-11 13:50   ` [PATCH 2/3] habanalabs: trace MMU map/unmap page Steven Rostedt
2022-08-11 11:39 ` [PATCH 3/3] habanalabs: trace DMA allocations Oded Gabbay
2022-08-11 13:53   ` Steven Rostedt

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=20220811113953.1963412-3-ogabbay@kernel.org \
    --to=ogabbay@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=osharabi@habana.ai \
    --cc=rostedt@goodmis.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