Skip to content

Commit 784e48a

Browse files
JakeHillionij-intel
authored andcommitted
x86/platform/amd: replace down_timeout() with down_interruptible()
Currently hsmp_send_message() uses down_timeout() with a 100ms timeout to take the semaphore. However __hsmp_send_message(), the content of the critical section, has a sleep in it. On systems with significantly delayed scheduling behaviour this may take over 100ms. Convert this method to down_interruptible(). Leave the error handling the same as the documentation currently is not specific about what error is returned. Previous behaviour: a caller who competes with another caller stuck in the critical section due to scheduler delays would receive -ETIME. New behaviour: a caller who competes with another caller stuck in the critical section due to scheduler delays will complete successfully. Reviewed-by: Suma Hegde <[email protected]> Tested-by: Suma Hegde <[email protected]> Signed-off-by: Jake Hillion <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]>
1 parent f8afb12 commit 784e48a

File tree

1 file changed

+1
-7
lines changed
  • drivers/platform/x86/amd/hsmp

1 file changed

+1
-7
lines changed

drivers/platform/x86/amd/hsmp/hsmp.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,7 @@ int hsmp_send_message(struct hsmp_message *msg)
214214
return -ENODEV;
215215
sock = &hsmp_pdev.sock[msg->sock_ind];
216216

217-
/*
218-
* The time taken by smu operation to complete is between
219-
* 10us to 1ms. Sometime it may take more time.
220-
* In SMP system timeout of 100 millisecs should
221-
* be enough for the previous thread to finish the operation
222-
*/
223-
ret = down_timeout(&sock->hsmp_sem, msecs_to_jiffies(HSMP_MSG_TIMEOUT));
217+
ret = down_interruptible(&sock->hsmp_sem);
224218
if (ret < 0)
225219
return ret;
226220

0 commit comments

Comments
 (0)