mbox series

[0/2] a couple of corrections to the IRQ enablement function

Message ID 20230913130626.217665-1-akrowiak@linux.ibm.com (mailing list archive)
Headers show
Series a couple of corrections to the IRQ enablement function | expand

Message

Anthony Krowiak Sept. 13, 2023, 1:06 p.m. UTC
This series corrects two issues related to enablement of interrupts in 
response to interception of the PQAP(AQIC) command:

1. Returning a status response code 06 (Invalid address of AP-queue 
   notification byte) when the call to register a guest ISC fails makes no
   sense.
   
2. The pages containing the interrupt notification-indicator byte are not
   freed after a failure to register the guest ISC fails.

Anthony Krowiak (2):
  s390/vfio-ap: unpin pages on gisc registration failure
  s390/vfio-ap: set status response code to 06 on gisc registration
    failure

 drivers/s390/crypto/vfio_ap_ops.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Matthew Rosato Sept. 13, 2023, 6:13 p.m. UTC | #1
On 9/13/23 9:06 AM, Tony Krowiak wrote:
> This series corrects two issues related to enablement of interrupts in 
> response to interception of the PQAP(AQIC) command:
> 
> 1. Returning a status response code 06 (Invalid address of AP-queue 
>    notification byte) when the call to register a guest ISC fails makes no
>    sense.
>    
> 2. The pages containing the interrupt notification-indicator byte are not
>    freed after a failure to register the guest ISC fails.
> 

Hi Tony,

3. Since you're already making changes related to gisc registration, you might consider a 3rd patch that looks at the return code for kvm_s390_gisc_unregister and tags the unexpected error rc somehow.  This came up in a recent conversation I had with Michael, see this conversation towards the bottom:

https://lore.kernel.org/linux-s390/0ddf808c-e929-c975-1b39-5ebc1f2fab62@linux.ibm.com/ 

4. While looking at patch 1 I also had a question re: the AP_RESPONSE_OTHERWISE_CHANGED path in vfio_ap_irq_enable.  Here's a snippet of the current code:

	case AP_RESPONSE_OTHERWISE_CHANGED:
		/* We could not modify IRQ settings: clear new configuration */
		vfio_unpin_pages(&q->matrix_mdev->vdev, nib, 1);
		kvm_s390_gisc_unregister(kvm, isc);
		break;

Is it safe to unpin the page before unregistering the gisc in this case?  Or shouldn't the unpin happen after we have unregistered the gisc / set the IAM?

> Anthony Krowiak (2):
>   s390/vfio-ap: unpin pages on gisc registration failure
>   s390/vfio-ap: set status response code to 06 on gisc registration
>     failure
> 
>  drivers/s390/crypto/vfio_ap_ops.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
Anthony Krowiak Sept. 15, 2023, 2:04 p.m. UTC | #2
On 9/13/23 14:13, Matthew Rosato wrote:
> On 9/13/23 9:06 AM, Tony Krowiak wrote:
>> This series corrects two issues related to enablement of interrupts in
>> response to interception of the PQAP(AQIC) command:
>>
>> 1. Returning a status response code 06 (Invalid address of AP-queue
>>     notification byte) when the call to register a guest ISC fails makes no
>>     sense.
>>     
>> 2. The pages containing the interrupt notification-indicator byte are not
>>     freed after a failure to register the guest ISC fails.
>>
> 
> Hi Tony,
> 
> 3. Since you're already making changes related to gisc registration, you might consider a 3rd patch that looks at the return code for kvm_s390_gisc_unregister and tags the unexpected error rc somehow.  This came up in a recent conversation I had with Michael, see this conversation towards the bottom:
> 
> https://lore.kernel.org/linux-s390/0ddf808c-e929-c975-1b39-5ebc1f2fab62@linux.ibm.com/

When we receive a non-zero return code from kvm_s390_gisc_register, we 
log a DBF warning message. We can do the same for a non-zero rc from 
kvm_s390_gisc_unregister.

> 
> 4. While looking at patch 1 I also had a question re: the AP_RESPONSE_OTHERWISE_CHANGED path in vfio_ap_irq_enable.  Here's a snippet of the current code:
> 
> 	case AP_RESPONSE_OTHERWISE_CHANGED:
> 		/* We could not modify IRQ settings: clear new configuration */
> 		vfio_unpin_pages(&q->matrix_mdev->vdev, nib, 1);
> 		kvm_s390_gisc_unregister(kvm, isc);
> 		break;
> 
> Is it safe to unpin the page before unregistering the gisc in this case?  Or shouldn't the unpin happen after we have unregistered the gisc / set the IAM?

I don't know the answer to the question, but it makes logical sense; so, 
I'll go ahead and create a third patch as you suggested.

> 
>> Anthony Krowiak (2):
>>    s390/vfio-ap: unpin pages on gisc registration failure
>>    s390/vfio-ap: set status response code to 06 on gisc registration
>>      failure
>>
>>   drivers/s390/crypto/vfio_ap_ops.c | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>>
>