Commit 648eb8e5 authored by Jack Steiner's avatar Jack Steiner Committed by Linus Torvalds

gru: improve messages for malfunctioning GRUs

Improve error messages for malfunctioning GRUs.  Identify the type of
instruction that is failing.
Signed-off-by: default avatarJack Steiner <steiner@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f2965d68
...@@ -54,6 +54,21 @@ static void start_instruction(void *h) ...@@ -54,6 +54,21 @@ static void start_instruction(void *h)
gru_flush_cache(h); gru_flush_cache(h);
} }
static void report_instruction_timeout(void *h)
{
unsigned long goff = GSEGPOFF((unsigned long)h);
char *id = "???";
if (TYPE_IS(CCH, goff))
id = "CCH";
else if (TYPE_IS(TGH, goff))
id = "TGH";
else if (TYPE_IS(TFH, goff))
id = "TFH";
panic(KERN_ALERT "GRU %p (%s) is malfunctioning\n", h, id);
}
static int wait_instruction_complete(void *h, enum mcs_op opc) static int wait_instruction_complete(void *h, enum mcs_op opc)
{ {
int status; int status;
...@@ -64,9 +79,10 @@ static int wait_instruction_complete(void *h, enum mcs_op opc) ...@@ -64,9 +79,10 @@ static int wait_instruction_complete(void *h, enum mcs_op opc)
status = GET_MSEG_HANDLE_STATUS(h); status = GET_MSEG_HANDLE_STATUS(h);
if (status != CCHSTATUS_ACTIVE) if (status != CCHSTATUS_ACTIVE)
break; break;
if (GRU_OPERATION_TIMEOUT < (get_cycles() - start_time)) if (GRU_OPERATION_TIMEOUT < (get_cycles() - start_time)) {
panic("GRU %p is malfunctioning: start %ld, end %ld\n", report_instruction_timeout(h);
h, start_time, (unsigned long)get_cycles()); start_time = get_cycles();
}
} }
if (gru_options & OPT_STATS) if (gru_options & OPT_STATS)
update_mcs_stats(opc, get_cycles() - start_time); update_mcs_stats(opc, get_cycles() - start_time);
......
...@@ -91,6 +91,12 @@ ...@@ -91,6 +91,12 @@
/* Convert an arbitrary handle address to the beginning of the GRU segment */ /* Convert an arbitrary handle address to the beginning of the GRU segment */
#define GRUBASE(h) ((void *)((unsigned long)(h) & ~(GRU_SIZE - 1))) #define GRUBASE(h) ((void *)((unsigned long)(h) & ~(GRU_SIZE - 1)))
/* Test a valid handle address to determine the type */
#define TYPE_IS(hn, h) ((h) >= GRU_##hn##_BASE && (h) < \
GRU_##hn##_BASE + GRU_NUM_##hn * GRU_HANDLE_STRIDE && \
(((h) & (GRU_HANDLE_STRIDE - 1)) == 0))
/* General addressing macros. */ /* General addressing macros. */
static inline void *get_gseg_base_address(void *base, int ctxnum) static inline void *get_gseg_base_address(void *base, int ctxnum)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment