public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Douglas Freimuth <freimuth@linux.ibm.com>
To: borntraeger@linux.ibm.com, imbrenda@linux.ibm.com,
	frankja@linux.ibm.com, david@kernel.org, hca@linux.ibm.com,
	gor@linux.ibm.com, agordeev@linux.ibm.com, svens@linux.ibm.com,
	kvm@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: mjrosato@linux.ibm.com, freimuth@linux.ibm.com
Subject: [PATCH v3 0/3] KVM: s390: Introducing kvm_arch_set_irq_inatomic Fast Inject
Date: Mon,  6 Apr 2026 08:44:16 +0200	[thread overview]
Message-ID: <20260406064419.14384-1-freimuth@linux.ibm.com> (raw)

S390 needs this series of three patches in order to enable a non-blocking
path for irqfd injection on s390 via kvm_arch_set_irq_inatomic(). Before
these changes, kvm_arch_set_irq_inatomic() would just return -EWOULDBLOCK
and place all interrupts on the global work queue, which must subsequently
be processed by a different thread. This series of patches implements an
s390 version of inatomic and is relevant to virtio-blk and virtio-net and
was tested against virtio-pci and virtio-ccw.

The inatomic fast path cannot lose control since it is running with
interrupts disabled. This meant making the following changes that exist on
the slow path today. First, the adapter_indicators page needs to be mapped
since it is accessed with interrupts disabled, so we added map/unmap
functions. Second, access to shared resources between the fast and slow
paths needed to be changed from mutex and semaphores to spin_lock's.
Finally, the memory allocation on the slow path utilizes GFP_KERNEL_ACCOUNT
but we had to implement the fast path with GFP_ATOMIC allocation. Each of
these enhancements were required to prevent blocking on the fast inject
path.

Statistical counters have been added to enable analysis of irq injection on
the fast path and slow path including io_390_inatomic, io_flic_inject_airq,
io_set_adapter_int and io_390_inatomic_adapter_masked. And counters have
been added to analyze map/unmap of the adapter_indicator
pages in non-Secure Execution environments and to track fencing of Fast
Inject in Secure Execution environments. In order to take advantage of this
kernel series with virtio-pci, a QEMU that includes the
's390x/pci: set kvm_msi_via_irqfd_allowed' fix is needed.  Additionally,
the guest xml needs a thread pool and threads explicitly assigned per disk
device using the common way of defining threads for disks.

Patch 1 enables map/unmap of adapter indicator pages but for Secure
Execution environments it avoids the long term mapping.

v2->v3: GFP_KERNEL to GFP_KERNEL_ACCOUNT in one instance of allocation.
v2->v3: Fix alignment error.
v2->v3: Increment nr_maps after new map added to list
v2->v3: kvm_s390_adapter_unmap do mark_page_dirty and set_page_dirty_lock.
v2->v3: In unmap_all_adapters_pv do mark_page_dirty, set_page_dirty_lock.
v2->v3: Move kvm_s390_unmap_all_adapters_pv() to after check if in pv.
v2->v3: Move mutex_unlock after map/unmap in modify_io_adapter.
v2->v3: Add spin_lock to get maps->lock in kvm_s390_unmap_all_adapters_pv.
v2->v3: Only put_page(ind_page) if !ind_info which allocates ind_page.
v2->v3: Move the spin_lock inside of the adapter_indicators_set in patch 2.
v2->v3: On last conditional in kvm_arch_set_irq_inatomic, add else clause.
v2->v3: Clear ind/summ bits if inject fails upon return to inatomic.

Douglas Freimuth (3):
  Add map/unmap ioctl and clean mappings post-guest
  Enable adapter_indicators_set to use mapped pages
  Introducing kvm_arch_set_irq_inatomic fast inject

 arch/s390/include/asm/kvm_host.h |  11 +-
 arch/s390/kvm/interrupt.c        | 392 ++++++++++++++++++++++++++-----
 arch/s390/kvm/kvm-s390.c         |  51 +++-
 arch/s390/kvm/kvm-s390.h         |   3 +-
 4 files changed, 387 insertions(+), 70 deletions(-)

-- 
2.52.0


             reply	other threads:[~2026-04-06  6:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-06  6:44 Douglas Freimuth [this message]
2026-04-06  6:44 ` [PATCH v3 1/3] KVM: s390: Add map/unmap ioctl and clean mappings post-guest Douglas Freimuth
2026-04-06 13:39   ` Matthew Rosato
2026-04-06  6:44 ` [PATCH v3 2/3] KVM: s390: Enable adapter_indicators_set to use mapped pages Douglas Freimuth
2026-04-06 15:33   ` Matthew Rosato
2026-04-06  6:44 ` [PATCH v3 3/3] KVM: s390: Introducing kvm_arch_set_irq_inatomic fast inject Douglas Freimuth
2026-04-06 16:15   ` Matthew Rosato
2026-04-06 17:59     ` Sean Christopherson
2026-04-06 18:24       ` Matthew Rosato
2026-04-06 16:25   ` Matthew Rosato

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=20260406064419.14384-1-freimuth@linux.ibm.com \
    --to=freimuth@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=david@kernel.org \
    --cc=frankja@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mjrosato@linux.ibm.com \
    --cc=svens@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