[PATCH] kernel: x86: tboot: Replace mdelay with usleep_range in tboot_wait_for_aps

From: Jia-Ju Bai
Date: Tue Jan 23 2018 - 20:54:00 EST


The function tboot_wait_for_aps is not called in atomic context.
Thus mdelay can be replaced with usleep_range, to reduce busy wait.

Signed-off-by: Jia-Ju Bai <baijiaju1990@xxxxxxxxx>
---
arch/x86/kernel/tboot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index a4eb279..c1d523e 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -317,7 +317,7 @@ static int tboot_wait_for_aps(int num_aps)
timeout = AP_WAIT_TIMEOUT*HZ;
while (atomic_read((atomic_t *)&tboot->num_in_wfs) != num_aps &&
timeout) {
- mdelay(1);
+ usleep_range(1000, 2000);
timeout--;
}

--
1.7.9.5