[PATCH 4/5] xen/events: unmask a fifo event channel only if it was masked

From: Juergen Gross
Date: Thu Oct 22 2020 - 03:42:45 EST


Unmasking an event channel with fifo events channels being used can
require a hypercall to be made, so try to avoid that by checking
whether the event channel was really masked.

Suggested-by: Jan Beulich <jbeulich@xxxxxxxx>
Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
drivers/xen/events/events_fifo.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/xen/events/events_fifo.c b/drivers/xen/events/events_fifo.c
index 243e7b6d7b96..f60c5a9ec833 100644
--- a/drivers/xen/events/events_fifo.c
+++ b/drivers/xen/events/events_fifo.c
@@ -236,6 +236,9 @@ static bool clear_masked_cond(volatile event_word_t *word)

w = *word;

+ if (!(w & (1 << EVTCHN_FIFO_MASKED)))
+ return true;
+
do {
if (w & (1 << EVTCHN_FIFO_PENDING))
return false;
--
2.26.2