All of lore.kernel.org
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH] x86: eventinj: Do a real io_delay()
@ 2019-05-02 18:49 nadav.amit
  2019-05-03 17:38 ` Krish Sadhukhan
  0 siblings, 1 reply; 3+ messages in thread
From: nadav.amit @ 2019-05-02 18:49 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, Nadav Amit

From: Nadav Amit <nadav.amit@gmail.com>

There is no guarantee that a self-IPI would be delivered immediately.
io_delay() is called after self-IPI is generated but does nothing.
Instead, change io_delay() to wait for 10000 cycles, which should be
enough on any system whatsoever.

Signed-off-by: Nadav Amit <nadav.amit@gmail.com>
---
 x86/eventinj.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/x86/eventinj.c b/x86/eventinj.c
index 8064eb9..250537b 100644
--- a/x86/eventinj.c
+++ b/x86/eventinj.c
@@ -18,6 +18,11 @@ void do_pf_tss(void);
 
 static inline void io_delay(void)
 {
+	u64 start = rdtsc();
+
+	do {
+		pause();
+	} while (rdtsc() - start < 10000);
 }
 
 static void apic_self_ipi(u8 v)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-03 17:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-02 18:49 [kvm-unit-tests PATCH] x86: eventinj: Do a real io_delay() nadav.amit
2019-05-03 17:38 ` Krish Sadhukhan
2019-05-03 17:45   ` Nadav Amit

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.