xen/events: unmask a fifo event channel only if it was masked
authorJuergen Gross <jgross@suse.com>
Thu, 22 Oct 2020 09:49:06 +0000 (11:49 +0200)
committerBoris Ostrovsky <boris.ostrovsky@oracle.com>
Fri, 23 Oct 2020 10:41:25 +0000 (05:41 -0500)
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@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Link: https://lore.kernel.org/r/20201022094907.28560-5-jgross@suse.com
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
drivers/xen/events/events_fifo.c

index 243e7b6..b234f17 100644 (file)
@@ -237,6 +237,9 @@ static bool clear_masked_cond(volatile event_word_t *word)
        w = *word;
 
        do {
+               if (!(w & (1 << EVTCHN_FIFO_MASKED)))
+                       return true;
+
                if (w & (1 << EVTCHN_FIFO_PENDING))
                        return false;