diff mbox series

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

Message ID 20201022074214.21693-5-jgross@suse.com (mailing list archive)
State Superseded
Headers show
Series xen: event handling cleanup | expand

Commit Message

Jürgen Groß Oct. 22, 2020, 7:42 a.m. UTC
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>
---
 drivers/xen/events/events_fifo.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jan Beulich Oct. 22, 2020, 7:55 a.m. UTC | #1
On 22.10.2020 09:42, Juergen Gross wrote:
> --- 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;

Maybe better move this ...

>  	do {
>  		if (w & (1 << EVTCHN_FIFO_PENDING))
>  			return false;
> 

... into the loop, above this check?

Jan
Jürgen Groß Oct. 22, 2020, 8:28 a.m. UTC | #2
On 22.10.20 09:55, Jan Beulich wrote:
> On 22.10.2020 09:42, Juergen Gross wrote:
>> --- 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;
> 
> Maybe better move this ...
> 
>>   	do {
>>   		if (w & (1 << EVTCHN_FIFO_PENDING))
>>   			return false;
>>
> 
> ... into the loop, above this check?

Yes, that should be better.


Juergen
diff mbox series

Patch

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;