From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796335698; b=0/BXmj4PRTFg1gj0mL272Vme7SHSPm+i2r+dFizuQsZ4hUtHOVJRh7mkm6RknBc/Q0Jx deK6lHVDpdNzVRV7IHF1wlD2fyQD778ii2txiwr82tx0Eazb1WdQS9clF8WEObaxT8SjZ PW2n7u4Do5CgSdvfvHN8b/mFiyDGIv/74EzCbRKdKulO++jaM0RqUP3gEs9+xRzlzR9Ek ZDFxBiXrdll8c7D+fwz74veVN0GQ/7fcevK39J7K4hJGRIkqb2y+0RcR3SeWke9/p3fqz jV1Ty7U83e0tSKDo9LqZ/NKIMPuRMTmjEGJP4aJaYJIxBWaNFeV5O/uiWbr1cLQW2ig== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796335698; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=jRRNUvbby0TP7MTdMITNmOuUK4fopBDNO2OJIjRe+PQ=; b=C8wYTNGB9BgU7QqxxGk39cmfP4Nz3xWzjt/2Vxu27YKfMocGLkSXVB2od+SugEGbg//S 3HD/7W5/A+bL4jZaVPEGo/NsKHui4FuElBJk36Nfw/arPcs7jfV/3pZy2Qh/6phtXOVsh AKW6G5YquU+JNvMe/PsP9/XIj4OyfiU8+B0Fz2ACOzet42qp2/8+SfYzJtYie1DCm9qxP moRkNLYPEjPl2kjg974IGLgC0l7wiIq2Rq7Uy1+Xd8B12L9/D41jwKRedPFBUUetCuAsD B/1gWY/72I7iw7ZLb729fV2Er2xGRFHkoHCkVksdNMeuHAOljBZXWtc5RiXWTnC7oNg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="nDt/4eSG"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10CEA606A322 for ; Thu, 3 Dec 2026 22:08:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nDt/4eSG Received: by smtp.kernel.org (Postfix) with ESMTPSA id A53351F000C2; Thu, 3 Dec 2026 22:08:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796335697; bh=jRRNUvbby0TP7MTdMITNmOuUK4fopBDNO2OJIjRe+PQ=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=nDt/4eSGC2YUikydtmeytxLAL5T/tYJODMEEpp1llWxXq1AjtvNP7WMAJy/HbW9F8 H7CpSdzgW9QbBmRQPzy6M5DXZsg99/IfOBLPKg2cwTNyJsY2XJ5nhFq1fJGcNA7VIQ CH1yzAU8kBId4mpCcEqPg+fg8WZgi8anJI+H94o4p/xs9shXAPs2zdK4g/angSP+tK Cx/WMlRoMCVyS++YZ90ZN40XkekcL8E6J64ZrHG8Yvx0aG7BAQcrfjKBYWANAQBguU aAddnFdLW+bsdK36biiwWPEw5C/JsIjomh9XZqnwIU8tKM91APBkIE7gh8Mwr+E9ch NOZMJonjzKvJw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 1/5] s390/vfio-ap: Prevent passing unreset queues Reply-To: sashiko-reviews@lists.linux.dev To: "Jason J. Herne" , linux-s390@vger.kernel.org Cc: "Heiko Carstens" , "Vasily Gorbik" , "Alexander Gordeev" , "Christian Borntraeger" In-Reply-To: <20261203214531.1395796-2-jjherne@linux.ibm.com> References: <20261203214531.1395796-1-jjherne@linux.ibm.com> <20261203214531.1395796-2-jjherne@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 22:08:17 +0000 X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] s390/vfio-ap: _queue_passable() permanently blocks recovered adapters - [Low] s390/vfio-ap: missing Fixes tag for commit 65e05ec252a9 -- commit cac07ffe34091f7a1854821a6b6958aa7fdc8799 Author: Jason J. Herne > s390/vfio-ap: Prevent passing unreset queues > > vfio_ap_mdev_reset_queues() and _queue_passable() use q->reset_status > to decide whether a queue was reset and may be passed to a guest. > apq_reset_check() can leave the status from the initial ZAPQ (usually > AP_RESPONSE_NORMAL) in place when the reset is not confirmed, so an > unreset queue looks reset. Fix the cases where this happens: > > - TAPQ returns an invalid response code (-EIO), or > AP_RESPONSE_Q_NOT_AVAIL (-ENODEV, e.g. ZAPQ rc 00 then TAPQ rc 01): > the worker returns without saving the TAPQ status. Save it. In the > -EIO case the AQIC resources are still intentionally leaked, since > it is unknown whether the queue can still write to the NIB. Not > saving the status on -EIO predates the DECONFIGURED and > CHECKSTOPPED handling below. > > - AP_RESPONSE_DECONFIGURED and AP_RESPONSE_CHECKSTOPPED are treated > as success by apq_status_check(), but neither confirms a zeroize: > all status bits are zero for these codes and a checkstop resets the > queue rather than zeroizing it. Return -ENODEV for them so the > worker frees the AQIC resources (the queue can no longer write to > the NIB) and saves the status. > > Make _queue_passable() accept only AP_RESPONSE_NORMAL, so deconfigured > and checkstopped queues are no longer passed to a guest. This drops > the earlier policy of passing such queues through to avoid possible > data leaks. > > Fixes: c51f8c6bb5c8 ("s390/vfio-ap: allow deconfigured queue to be passed= through to a guest") > Fixes: dd174833e44e ("s390/vfio-ap: remove upper limit on wait for queue = reset to complete") > Fixes: a681226c675c ("s390/vfio-ap: handle hardware checkstop state on qu= eue reset operation") > Cc: stable@vger.kernel.org > Signed-off-by: Jason J. Herne [Severity: Low] Since this also fixes the -ENODEV path in apq_reset_check() returning without saving the TAPQ status for AP_RESPONSE_Q_NOT_AVAIL, should this include: Fixes: 65e05ec252a9 ("s390/vfio-ap: fix KVM GISC and page leak when queue= removed from host config") > diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio= _ap_ops.c > index 373ce574c4319..10430b9446dbb 100644 > --- a/drivers/s390/crypto/vfio_ap_ops.c > +++ b/drivers/s390/crypto/vfio_ap_ops.c > @@ -694,8 +694,6 @@ static bool _queue_passable(struct vfio_ap_queue *q) > =20 > switch (q->reset_status.response_code) { > case AP_RESPONSE_NORMAL: > - case AP_RESPONSE_DECONFIGURED: > - case AP_RESPONSE_CHECKSTOPPED: > return true; > default: > return false; [Severity: High] Can rejecting AP_RESPONSE_DECONFIGURED and AP_RESPONSE_CHECKSTOPPED here permanently block a recovered adapter from being passed to a guest? If a queue reset runs while an adapter is deconfigured (for example in vfio_ap_mdev_unset_kvm()), q->reset_status records AP_RESPONSE_DECONFIGURED. When the adapter comes back online, ap_scan_domains() updates the ap_queue in place without re-probing it or triggering vfio_ap_on_cfg_changed(). Later assigning the adapter via assign_adapter_store() links the existing vfio_ap_queue without retrying a reset, so vfio_ap_mdev_filter_matrix() sees the stale status and clears the APID from shadow_apcb.apm. Unassigning also skips the reset because the APID is already clear in shadow_apcb.apm. The same happens after checkstop recovery, leaving a healthy adapter unusable for guests until the queue is manually unbound and rebound from vfio_ap. Should vfio_ap retry resetting queues with a non-normal reset_status when linking or filtering them? --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203214531.1395= 796-1-jjherne@linux.ibm.com?part=3D1