diff mbox series

[2/7] s390/cio: Set vfio-ccw FSM state before ioeventfd

Message ID 20190503134912.39756-3-farman@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390: vfio-ccw fixes | expand

Commit Message

Eric Farman May 3, 2019, 1:49 p.m. UTC
Otherwise, the guest can believe it's okay to start another I/O
and bump into the non-idle state.  This results in a cc=3
(or cc=2 with the pending async CSCH/HSCH code [1]) to the guest,
which is unfortunate since everything is otherwise working normally.

[1] https://patchwork.kernel.org/comment/22588563/

Signed-off-by: Eric Farman <farman@linux.ibm.com>

---

I think this might've been part of Pierre's FSM cleanup?
---
 drivers/s390/cio/vfio_ccw_drv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Cornelia Huck May 6, 2019, 2:51 p.m. UTC | #1
On Fri,  3 May 2019 15:49:07 +0200
Eric Farman <farman@linux.ibm.com> wrote:

> Otherwise, the guest can believe it's okay to start another I/O
> and bump into the non-idle state.  This results in a cc=3
> (or cc=2 with the pending async CSCH/HSCH code [1]) to the guest,

I think you can now refer to cc=2, as the csch/hsch is on its way in :)

> which is unfortunate since everything is otherwise working normally.
> 
> [1] https://patchwork.kernel.org/comment/22588563/
> 
> Signed-off-by: Eric Farman <farman@linux.ibm.com>
> 
> ---
> 
> I think this might've been part of Pierre's FSM cleanup?

Not sure if I saw this before, but there have been quite a number of
patches going around...

> ---
>  drivers/s390/cio/vfio_ccw_drv.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_drv.c
> index 0b3b9de45c60..ddd21b6149fd 100644
> --- a/drivers/s390/cio/vfio_ccw_drv.c
> +++ b/drivers/s390/cio/vfio_ccw_drv.c
> @@ -86,11 +86,11 @@ static void vfio_ccw_sch_io_todo(struct work_struct *work)
>  	}
>  	memcpy(private->io_region->irb_area, irb, sizeof(*irb));
>  
> -	if (private->io_trigger)
> -		eventfd_signal(private->io_trigger, 1);
> -
>  	if (private->mdev && is_final)
>  		private->state = VFIO_CCW_STATE_IDLE;
> +
> +	if (private->io_trigger)
> +		eventfd_signal(private->io_trigger, 1);
>  }
>  
>  /*
Eric Farman May 6, 2019, 4:36 p.m. UTC | #2
On 5/6/19 10:51 AM, Cornelia Huck wrote:
> On Fri,  3 May 2019 15:49:07 +0200
> Eric Farman <farman@linux.ibm.com> wrote:
> 
>> Otherwise, the guest can believe it's okay to start another I/O
>> and bump into the non-idle state.  This results in a cc=3
>> (or cc=2 with the pending async CSCH/HSCH code [1]) to the guest,
> 
> I think you can now refer to cc=2, as the csch/hsch is on its way in :)

Woohoo!  :)

> 
>> which is unfortunate since everything is otherwise working normally.
>>
>> [1] https://patchwork.kernel.org/comment/22588563/
>>
>> Signed-off-by: Eric Farman <farman@linux.ibm.com>
>>
>> ---
>>
>> I think this might've been part of Pierre's FSM cleanup?
> 
> Not sure if I saw this before, but there have been quite a number of
> patches going around...

I guess I should have said his original cleanup from last year.  I 
didn't find it, but it also seems familiar to me.

> 
>> ---
>>   drivers/s390/cio/vfio_ccw_drv.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_drv.c
>> index 0b3b9de45c60..ddd21b6149fd 100644
>> --- a/drivers/s390/cio/vfio_ccw_drv.c
>> +++ b/drivers/s390/cio/vfio_ccw_drv.c
>> @@ -86,11 +86,11 @@ static void vfio_ccw_sch_io_todo(struct work_struct *work)
>>   	}
>>   	memcpy(private->io_region->irb_area, irb, sizeof(*irb));
>>   
>> -	if (private->io_trigger)
>> -		eventfd_signal(private->io_trigger, 1);
>> -
>>   	if (private->mdev && is_final)
>>   		private->state = VFIO_CCW_STATE_IDLE;
>> +
>> +	if (private->io_trigger)
>> +		eventfd_signal(private->io_trigger, 1);
>>   }
>>   
>>   /*
>
Pierre Morel May 7, 2019, 8:32 a.m. UTC | #3
On 06/05/2019 18:36, Eric Farman wrote:
> 
> 
> On 5/6/19 10:51 AM, Cornelia Huck wrote:
>> On Fri,  3 May 2019 15:49:07 +0200
>> Eric Farman <farman@linux.ibm.com> wrote:
>>
>>> Otherwise, the guest can believe it's okay to start another I/O
>>> and bump into the non-idle state.  This results in a cc=3
>>> (or cc=2 with the pending async CSCH/HSCH code [1]) to the guest,
>>
>> I think you can now refer to cc=2, as the csch/hsch is on its way in :)
> 
> Woohoo!  :)
> 
>>
>>> which is unfortunate since everything is otherwise working normally.
>>>
>>> [1] https://patchwork.kernel.org/comment/22588563/
>>>
>>> Signed-off-by: Eric Farman <farman@linux.ibm.com>
>>>
>>> ---
>>>
>>> I think this might've been part of Pierre's FSM cleanup?
>>
>> Not sure if I saw this before, but there have been quite a number of
>> patches going around...
> 
> I guess I should have said his original cleanup from last year.  I 
> didn't find it, but it also seems familiar to me.

May be, I am not sure, but does not mater.
It looks good to me to change the state before to send the IRQ signal to 
the guest, just in case we get asynchronism sometime.

> 
>>
>>> ---
>>>   drivers/s390/cio/vfio_ccw_drv.c | 6 +++---
>>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/s390/cio/vfio_ccw_drv.c 
>>> b/drivers/s390/cio/vfio_ccw_drv.c
>>> index 0b3b9de45c60..ddd21b6149fd 100644
>>> --- a/drivers/s390/cio/vfio_ccw_drv.c
>>> +++ b/drivers/s390/cio/vfio_ccw_drv.c
>>> @@ -86,11 +86,11 @@ static void vfio_ccw_sch_io_todo(struct 
>>> work_struct *work)
>>>       }
>>>       memcpy(private->io_region->irb_area, irb, sizeof(*irb));
>>> -    if (private->io_trigger)
>>> -        eventfd_signal(private->io_trigger, 1);
>>> -
>>>       if (private->mdev && is_final)
>>>           private->state = VFIO_CCW_STATE_IDLE;
>>> +
>>> +    if (private->io_trigger)
>>> +        eventfd_signal(private->io_trigger, 1);
>>>   }
>>>   /*
>>

Reviewed-by: Pierre Morel<pmorel@linux.ibm.com>
diff mbox series

Patch

diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_drv.c
index 0b3b9de45c60..ddd21b6149fd 100644
--- a/drivers/s390/cio/vfio_ccw_drv.c
+++ b/drivers/s390/cio/vfio_ccw_drv.c
@@ -86,11 +86,11 @@  static void vfio_ccw_sch_io_todo(struct work_struct *work)
 	}
 	memcpy(private->io_region->irb_area, irb, sizeof(*irb));
 
-	if (private->io_trigger)
-		eventfd_signal(private->io_trigger, 1);
-
 	if (private->mdev && is_final)
 		private->state = VFIO_CCW_STATE_IDLE;
+
+	if (private->io_trigger)
+		eventfd_signal(private->io_trigger, 1);
 }
 
 /*