Commit bd4da68d authored by Haren Myneni's avatar Haren Myneni Committed by Michael Ellerman

powerpc/vas: Display process stuck message

Process can not close send window until all requests are processed.
Means wait until window state is not busy and send credits are
returned. Display debug messages in case taking longer to close the
window.
Signed-off-by: default avatarHaren Myneni <haren@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/1587017219.2275.1073.camel@hbabu-laptop
parent 04f6296c
...@@ -1181,6 +1181,7 @@ static void poll_window_credits(struct vas_window *window) ...@@ -1181,6 +1181,7 @@ static void poll_window_credits(struct vas_window *window)
{ {
u64 val; u64 val;
int creds, mode; int creds, mode;
int count = 0;
val = read_hvwc_reg(window, VREG(WINCTL)); val = read_hvwc_reg(window, VREG(WINCTL));
if (window->tx_win) if (window->tx_win)
...@@ -1199,10 +1200,27 @@ static void poll_window_credits(struct vas_window *window) ...@@ -1199,10 +1200,27 @@ static void poll_window_credits(struct vas_window *window)
creds = GET_FIELD(VAS_LRX_WCRED, val); creds = GET_FIELD(VAS_LRX_WCRED, val);
} }
/*
* Takes around few milliseconds to complete all pending requests
* and return credits.
* TODO: Scan fault FIFO and invalidate CRBs points to this window
* and issue CRB Kill to stop all pending requests. Need only
* if there is a bug in NX or fault handling in kernel.
*/
if (creds < window->wcreds_max) { if (creds < window->wcreds_max) {
val = 0; val = 0;
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(msecs_to_jiffies(10)); schedule_timeout(msecs_to_jiffies(10));
count++;
/*
* Process can not close send window until all credits are
* returned.
*/
if (!(count % 1000))
pr_warn_ratelimited("VAS: pid %d stuck. Waiting for credits returned for Window(%d). creds %d, Retries %d\n",
vas_window_pid(window), window->winid,
creds, count);
goto retry; goto retry;
} }
} }
...@@ -1216,6 +1234,7 @@ static void poll_window_busy_state(struct vas_window *window) ...@@ -1216,6 +1234,7 @@ static void poll_window_busy_state(struct vas_window *window)
{ {
int busy; int busy;
u64 val; u64 val;
int count = 0;
retry: retry:
val = read_hvwc_reg(window, VREG(WIN_STATUS)); val = read_hvwc_reg(window, VREG(WIN_STATUS));
...@@ -1223,7 +1242,16 @@ static void poll_window_busy_state(struct vas_window *window) ...@@ -1223,7 +1242,16 @@ static void poll_window_busy_state(struct vas_window *window)
if (busy) { if (busy) {
val = 0; val = 0;
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(msecs_to_jiffies(5)); schedule_timeout(msecs_to_jiffies(10));
count++;
/*
* Takes around few milliseconds to process all pending
* requests.
*/
if (!(count % 1000))
pr_warn_ratelimited("VAS: pid %d stuck. Window (ID=%d) is in busy state. Retries %d\n",
vas_window_pid(window), window->winid, count);
goto retry; goto retry;
} }
} }
......
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