From 36d73efcbbf7d8be839a2ca648e3f41ef494bf75 Mon Sep 17 00:00:00 2001 From: Tyrel Datwyler Date: Wed, 7 Feb 2024 17:12:44 -0600 Subject: [PATCH] librtas: return CALL_AGAIN on RC_BUSY status in handle_delay() There is no need to delay before retrying on RC_BUSY return status. The kernel used to get this wrong too. https://github.com/torvalds/linux/commit/38f7b7067dae0c101be573106018e8af22a90fdf Excerpt referenced from above commit: RTAS_BUSY (-2): RTAS has suspended a potentially long-running operation in order to meet its latency obligation and give the OS the opportunity to perform other work. RTAS can resume making progress as soon as the OS reattempts the call. To avoid uselessly sleeping update handle_delay() to return CALL_AGAIN immediately when it is passed RC_BUSY. Suggested-by: Nathan Lynch Signed-off-by: Tyrel Datwyler --- librtas_src/syscall_calls.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/librtas_src/syscall_calls.c b/librtas_src/syscall_calls.c index 76e4bb7..0f15827 100644 --- a/librtas_src/syscall_calls.c +++ b/librtas_src/syscall_calls.c @@ -75,8 +75,8 @@ unsigned int handle_delay(int status, uint64_t * elapsed) for (ms = 1; order > 0; order--) ms = ms * 10; } else if (status == RC_BUSY) { - /* Regular Delay */ - ms = 1; + /* Retry */ + return CALL_AGAIN; } else { /* Not a delay return code */ return 0;