From: Yuho Choi <oss.patchbox@gmail.com>
To: Tony Krowiak <akrowiak@linux.ibm.com>,
Halil Pasic <pasic@linux.ibm.com>,
Jason Herne <jjherne@linux.ibm.com>
Cc: Harald Freudenberger <freude@linux.ibm.com>,
Holger Dengler <dengler@linux.ibm.com>,
linux-s390@vger.kernel.org, kvm@vger.kernel.org
Subject: s390/vfio-ap: NIB unpin when the IR bit does not clear
Date: Fri, 6 Nov 2026 14:03:59 -0500 [thread overview]
Message-ID: <20261106190401.468289-2-oss.patchbox@gmail.com> (raw)
Hi Tony, Halil, Jason,
I have a question about how vfio_ap turns off AP interrupts before it
unpins the guest page that holds the NIB
(drivers/s390/crypto/vfio_ap_ops.c, v7.4-rc1).
vfio_ap_irq_disable() issues PQAP(AQIC) to disable interrupts and then
calls vfio_ap_wait_for_irqclear(), which checks the IR bit with TAPQ
five times, 20ms apart. If the bit is still set after that, or if AQIC
keeps returning BUSY or RESET_IN_PROGRESS, the code only warns and
unpins the page anyway:
WARN_ONCE(1, "%s: tapq rc %02x: %04x could not clear IR bit\n",
__func__, status.response_code, apqn);
...
end_free:
vfio_ap_free_aqic_resources(q);
This path is reached both when the guest turns interrupts off with
PQAP(AQIC) (handle_pqap()) and when user space unmaps the IOVA that
holds the NIB (vfio_ap_mdev_dma_unmap()). In the second case, user
space may free the page right after the unmap.
My questions are:
1. While TAPQ still reports the IR bit as set, can the adapter still
store into the NIB?
2. Can that state last longer than about 100ms on working hardware,
for example while long-running requests are still outstanding on
the queue? Or does it only happen when something is broken?
If both are possible, the adapter could write into a page that is no
longer pinned.
I found this by reading the code and have not reproduced it.
Thanks,
Yuho
next reply other threads:[~2026-11-06 19:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 19:03 Yuho Choi [this message]
2026-11-09 15:06 ` s390/vfio-ap: NIB unpin when the IR bit does not clear Anthony Krowiak
2026-11-09 15:18 ` Yuho Choi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261106190401.468289-2-oss.patchbox@gmail.com \
--to=oss.patchbox@gmail.com \
--cc=akrowiak@linux.ibm.com \
--cc=dengler@linux.ibm.com \
--cc=freude@linux.ibm.com \
--cc=jjherne@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=pasic@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox