diff mbox series

[v2,3/3] s390/vfio-ap: improve reaction to response code 07 from PQAP(AQIC) command

Message ID 20231018133829.147226-4-akrowiak@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series a couple of corrections to the IRQ enablement function | expand

Commit Message

Anthony Krowiak Oct. 18, 2023, 1:38 p.m. UTC
Let's improve the vfio_ap driver's reaction to reception of response code
07 from the PQAP(AQIC) command when enabling interrupts on behalf of a
guest:

* Unregister the guest's ISC before the pages containing the notification
  indicator bytes are unpinned.

* Capture the return code from the kvm_s390_gisc_unregister function and
  log a DBF warning if it fails.

Suggested-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
---
 drivers/s390/crypto/vfio_ap_ops.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Matthew Rosato Oct. 26, 2023, 2:15 p.m. UTC | #1
On 10/18/23 9:38 AM, Tony Krowiak wrote:
> Let's improve the vfio_ap driver's reaction to reception of response code
> 07 from the PQAP(AQIC) command when enabling interrupts on behalf of a
> guest:
> 
> * Unregister the guest's ISC before the pages containing the notification
>   indicator bytes are unpinned.
> 
> * Capture the return code from the kvm_s390_gisc_unregister function and
>   log a DBF warning if it fails.
> 
> Suggested-by: Matthew Rosato <mjrosato@linux.ibm.com>
> Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>

Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>

I went back-and-forth on whether this should be a stable/fixes candidate but I think no...  I happened to notice it while reviewing other code, I'm not aware that it's ever created a visible issue, and it's on a pretty immediate error path.  If anyone thinks it should be a stable candidate I have no objection but in that case would suggest to break the patch up to separate the new WARN from the fix.
Anthony Krowiak Oct. 26, 2023, 6:18 p.m. UTC | #2
On 10/26/23 10:15, Matthew Rosato wrote:
> On 10/18/23 9:38 AM, Tony Krowiak wrote:
>> Let's improve the vfio_ap driver's reaction to reception of response code
>> 07 from the PQAP(AQIC) command when enabling interrupts on behalf of a
>> guest:
>>
>> * Unregister the guest's ISC before the pages containing the notification
>>    indicator bytes are unpinned.
>>
>> * Capture the return code from the kvm_s390_gisc_unregister function and
>>    log a DBF warning if it fails.
>>
>> Suggested-by: Matthew Rosato <mjrosato@linux.ibm.com>
>> Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
> 
> Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
> 
> I went back-and-forth on whether this should be a stable/fixes candidate but I think no...  I happened to notice it while reviewing other code, I'm not aware that it's ever created a visible issue, and it's on a pretty immediate error path.  If anyone thinks it should be a stable candidate I have no objection but in that case would suggest to break the patch up to separate the new WARN from the fix.

Nothing has ever been reported and is probably very unlikely to be 
reported; so, I agree it should not be a stable/fixes candidate.

> 
> 
>
diff mbox series

Patch

diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
index 25d7ce2094f8..4e80c211ba47 100644
--- a/drivers/s390/crypto/vfio_ap_ops.c
+++ b/drivers/s390/crypto/vfio_ap_ops.c
@@ -476,8 +476,11 @@  static struct ap_queue_status vfio_ap_irq_enable(struct vfio_ap_queue *q,
 		break;
 	case AP_RESPONSE_OTHERWISE_CHANGED:
 		/* We could not modify IRQ settings: clear new configuration */
+		ret = kvm_s390_gisc_unregister(kvm, isc);
+		if (ret)
+			VFIO_AP_DBF_WARN("%s: kvm_s390_gisc_unregister: rc=%d isc=%d, apqn=%#04x\n",
+					 __func__, ret, isc, q->apqn);
 		vfio_unpin_pages(&q->matrix_mdev->vdev, nib, 1);
-		kvm_s390_gisc_unregister(kvm, isc);
 		break;
 	default:
 		pr_warn("%s: apqn %04x: response: %02x\n", __func__, q->apqn,