LKML Archive on lore.kernel.org help / color / mirror / Atom feed
From: Oded Gabbay <ogabbay@kernel.org> To: linux-kernel@vger.kernel.org Cc: Alon Mizrahi <amizrahi@habana.ai> Subject: [PATCH 09/16] habanalabs/gaudi: add monitored SOBs to state dump Date: Wed, 18 Aug 2021 16:39:15 +0300 [thread overview] Message-ID: <20210818133922.63637-9-ogabbay@kernel.org> (raw) In-Reply-To: <20210818133922.63637-1-ogabbay@kernel.org> From: Alon Mizrahi <amizrahi@habana.ai> Current "state dump" is lacking of monitored SOB IDs. Add for convenience. Signed-off-by: Alon Mizrahi <amizrahi@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org> --- drivers/misc/habanalabs/gaudi/gaudi.c | 38 ++++++++++++++++++++++++-- drivers/misc/habanalabs/gaudi/gaudiP.h | 1 + 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalabs/gaudi/gaudi.c index e9a8ed96fe65..d18a1ab42897 100644 --- a/drivers/misc/habanalabs/gaudi/gaudi.c +++ b/drivers/misc/habanalabs/gaudi/gaudi.c @@ -108,6 +108,8 @@ #define BIN_REG_STRING_SIZE sizeof("0b10101010101010101010101010101010") +#define MONITOR_SOB_STRING_SIZE 256 + static const char gaudi_irq_name[GAUDI_MSI_ENTRIES][GAUDI_MAX_STRING_LEN] = { "gaudi cq 0_0", "gaudi cq 0_1", "gaudi cq 0_2", "gaudi cq 0_3", "gaudi cq 1_0", "gaudi cq 1_1", "gaudi cq 1_2", "gaudi cq 1_3", @@ -9185,6 +9187,34 @@ static int gaudi_monitor_valid(struct hl_mon_state_dump *mon) mon->status); } +static void gaudi_fill_sobs_from_mon(char *sobs, struct hl_mon_state_dump *mon) +{ + const size_t max_write = 10; + u32 gid, mask, sob; + int i, offset; + + /* Sync object ID is calculated as follows: + * (8 * group_id + cleared bits in mask) + */ + gid = FIELD_GET(SYNC_MNGR_W_S_SYNC_MNGR_OBJS_MON_ARM_0_SID_MASK, + mon->arm_data); + mask = FIELD_GET(SYNC_MNGR_W_S_SYNC_MNGR_OBJS_MON_ARM_0_MASK_MASK, + mon->arm_data); + + for (i = 0, offset = 0; mask && offset < MONITOR_SOB_STRING_SIZE - + max_write; mask >>= 1, i++) { + if (!(mask & 1)) { + sob = gid * MONITOR_MAX_SOBS + i; + + if (offset > 0) + offset += snprintf(sobs + offset, max_write, + ", "); + + offset += snprintf(sobs + offset, max_write, "%u", sob); + } + } +} + static int gaudi_print_single_monitor(char **buf, size_t *size, size_t *offset, struct hl_device *hdev, struct hl_mon_state_dump *mon) @@ -9192,14 +9222,17 @@ static int gaudi_print_single_monitor(char **buf, size_t *size, size_t *offset, const char *name; char scratch_buf1[BIN_REG_STRING_SIZE], scratch_buf2[BIN_REG_STRING_SIZE]; + char monitored_sobs[MONITOR_SOB_STRING_SIZE] = {0}; name = hl_state_dump_get_monitor_name(hdev, mon); if (!name) name = ""; + gaudi_fill_sobs_from_mon(monitored_sobs, mon); + return hl_snprintf_resize( buf, size, offset, - "Mon id: %u%s, wait for group id: %u mask %s to reach val: %u and write %u to address 0x%llx. Pending: %s", + "Mon id: %u%s, wait for group id: %u mask %s to reach val: %u and write %u to address 0x%llx. Pending: %s. Means sync objects [%s] are being monitored.", mon->id, name, FIELD_GET(SYNC_MNGR_W_S_SYNC_MNGR_OBJS_MON_ARM_0_SID_MASK, mon->arm_data), @@ -9216,7 +9249,8 @@ static int gaudi_print_single_monitor(char **buf, size_t *size, size_t *offset, scratch_buf2, sizeof(scratch_buf2), FIELD_GET( SYNC_MNGR_W_S_SYNC_MNGR_OBJS_MON_STATUS_0_PENDING_MASK, - mon->status))); + mon->status)), + monitored_sobs); } diff --git a/drivers/misc/habanalabs/gaudi/gaudiP.h b/drivers/misc/habanalabs/gaudi/gaudiP.h index 838e98b0d43d..eacc5eadda97 100644 --- a/drivers/misc/habanalabs/gaudi/gaudiP.h +++ b/drivers/misc/habanalabs/gaudi/gaudiP.h @@ -117,6 +117,7 @@ (((mmSYNC_MNGR_E_N_SYNC_MNGR_OBJS_MON_STATUS_511 - \ mmSYNC_MNGR_E_N_SYNC_MNGR_OBJS_MON_STATUS_0) + 4) >> 2) +#define MONITOR_MAX_SOBS 8 /* DRAM Memory Map */ -- 2.17.1
next prev parent reply other threads:[~2021-08-18 13:40 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-08-18 13:39 [PATCH 01/16] habanalabs/gaudi: scrub HBM to a specific value Oded Gabbay 2021-08-18 13:39 ` [PATCH 02/16] habanalabs/gaudi: move scrubbing to late init Oded Gabbay 2021-08-18 13:39 ` [PATCH 03/16] habanalabs: save pid per userptr Oded Gabbay 2021-08-18 13:39 ` [PATCH 04/16] habanalabs: fix mmu node address resolution in debugfs Oded Gabbay 2021-08-18 13:39 ` [PATCH 05/16] habanalabs/gaudi: minimize number of register reads Oded Gabbay 2021-08-18 13:39 ` [PATCH 06/16] habanalabs: update to latest firmware headers Oded Gabbay 2021-08-18 13:39 ` [PATCH 07/16] habanalabs/gaudi: increase boot fit timeout Oded Gabbay 2021-08-18 13:39 ` [PATCH 08/16] habanalabs/gaudi: restore user registers when context opens Oded Gabbay 2021-08-18 13:39 ` Oded Gabbay [this message] 2021-08-18 13:39 ` [PATCH 10/16] habanalabs: modify multi-CS to wait on stream masters Oded Gabbay 2021-08-18 13:39 ` [PATCH 11/16] habanalabs/gaudi: fetch TPC/MME ECC errors from F/W Oded Gabbay 2021-08-18 13:39 ` [PATCH 12/16] habanalabs: add userptr_lookup node in debugfs Oded Gabbay 2021-08-18 13:39 ` [PATCH 13/16] habanalabs/gaudi: unmask out of bounds SLM access interrupt Oded Gabbay 2021-08-18 13:39 ` [PATCH 14/16] habanalabs/gaudi: define DC POWER for secured PMC Oded Gabbay 2021-08-18 13:39 ` [PATCH 15/16] habanalabs/gaudi: size should be printed in decimal Oded Gabbay 2021-08-18 13:39 ` [PATCH 16/16] habanalabs/gaudi: invalidate PMMU mem cache on init 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=20210818133922.63637-9-ogabbay@kernel.org \ --to=ogabbay@kernel.org \ --cc=amizrahi@habana.ai \ --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: linkBe 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; as well as URLs for NNTP newsgroup(s).