Linux s390 Architecture development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Claudio Imbrenda" <imbrenda@linux.ibm.com>, kvm@vger.kernel.org
Cc: linux-s390@vger.kernel.org, "Heiko Carstens" <hca@linux.ibm.com>,
	"Vasily Gorbik" <gor@linux.ibm.com>,
	"Alexander Gordeev" <agordeev@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>
Subject: Re: [PATCH v1 1/5] KVM: s390: Only allocate page table when cmma is enabled
Date: Fri, 04 Dec 2026 17:06:14 +0000	[thread overview]
Message-ID: <sashiko-outbox-250261@kernel.org> (raw)
In-Reply-To: <20261204163735.237528-2-imbrenda@linux.ibm.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] KVM: s390: missing MMU cache topup on -ENOMEM in
  kvm_s390_faultin_gfn()
--

commit 0d1f3b314bae87061643363aac78552599afc310
Author: Claudio Imbrenda <imbrenda@linux.ibm.com>

KVM: s390: Only allocate page table when cmma is enabled

When a guest-originated fault hits an unallocated segment with CMMA
enabled, this commit allocates only the page table instead of also
faulting in the backing guest memory.

> diff --git a/arch/s390/kvm/gmap/faultin.c b/arch/s390/kvm/gmap/faultin.c
> index 2e93bd563d5c3..8d0e86943b23c 100644
> --- a/arch/s390/kvm/gmap/faultin.c
> +++ b/arch/s390/kvm/gmap/faultin.c

[ ... ]

> @@ -67,6 +69,21 @@ int kvm_s390_faultin_gfn(struct kvm_vcpu *vcpu, struct kvm *kvm, struct guest_fa
>  		mc = local_mc;
>  	}
>  
> +	/*
> +	 * For guest-originated faults when CMMA is active, if no leaf
> +	 * tables were present, allocate the page table only, do not also
> +	 * fault-in the memory.
> +	 */
> +	if (cmm_first_fault) {
> +		scoped_guard(read_lock, &kvm->mmu_lock) {
> +			rc = dat_entry_walk(mc, f->gfn, kvm->arch.gmap->asce, DAT_WALK_ALLOC,
> +					    TABLE_TYPE_PAGE_TABLE, &f->crstep, &f->ptep);
> +			if (!rc)
> +				return 0;
> +		}
> +	}
> +
> +	rc = -EAGAIN;
>  	while (rc == -EAGAIN) {
>  		f->valid = false;
>  		inv_seq = kvm->mmu_invalidate_seq;

[Severity: Medium]
Should this handle -ENOMEM from dat_entry_walk() by calling
kvm_s390_mmu_cache_topup(mc) outside mmu_lock and retrying?

vcpu->arch.mc only caches 2 page tables and 6 CRST tables, so an ESSA
sweep quickly drains it and leaves dat_entry_walk() falling back to
GFP_ATOMIC allocations (including order-2 CRST tables).

When an atomic allocation fails under memory pressure or fragmentation,
falling through to the main loop calls __kvm_faultin_pfn() and faults in
the guest backing page (or full huge page) for an ESSA fault before
gmap_link() hits -ENOMEM and finally tops up mc.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204163735.237528-1-imbrenda@linux.ibm.com?part=1

  reply	other threads:[~2026-12-04 17:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 16:37 [PATCH v1 0/5] KVM: s390: Even more fixes for 7.4 Claudio Imbrenda
2026-12-04 16:37 ` [PATCH v1 1/5] KVM: s390: Only allocate page table when cmma is enabled Claudio Imbrenda
2026-12-04 17:06   ` sashiko-bot [this message]
2026-12-04 16:37 ` [PATCH v1 2/5] KVM: s390: Fix race in handle_essa() Claudio Imbrenda
2026-12-04 16:37 ` [PATCH v1 3/5] KVM: s390: Fix race in _do_shadow_crste() Claudio Imbrenda
2026-12-04 16:37 ` [PATCH v1 4/5] KVM: s390: Fix _crste_fc1() Claudio Imbrenda
2026-12-04 16:37 ` [PATCH v1 5/5] KVM: s390: Fix dat_split_crste() Claudio Imbrenda
2026-12-04 17:23 ` [PATCH v1 0/5] KVM: s390: Even more fixes for 7.4 sashiko-bot

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=sashiko-outbox-250261@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@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-s390@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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