From: Steffen Eiden <seiden@linux.ibm.com>
To: Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org,
borntraeger@de.ibm.com, frankja@linux.ibm.com, david@kernel.org,
nrb@linux.ibm.com, schlameuss@linux.ibm.com, gra@linux.ibm.com
Subject: Re: [PATCH v1 03/12] KVM: s390: Introduce gmap_enable_cmm()
Date: Tue, 1 Dec 2026 13:52:46 +0100 [thread overview]
Message-ID: <20261201125246.818009-A-seiden@linux.ibm.com> (raw)
In-Reply-To: <20261127150411.221072-4-imbrenda@linux.ibm.com>
On Fri, Nov 27, 2026 at 04:04:02PM +0100, Claudio Imbrenda wrote:
> Introduce gmap_enable_cmm_already_locked() and its locking wrapper
> gmap_enable_cmm() to attempt to allocate all page tables of a running
> guest. This means that all hugepages will be mapped with 4k pages
> regardless of the hpage parameter.
>
> Existing mappings with large pages will be split.
>
> If any memory allocation fails, ignore the error and give up. This is
> only a best effort.
>
> Cc: stable@vger.kernel.org # 7.0+: prerequisite for the next patch
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
> arch/s390/kvm/gmap/gmap.c | 48 +++++++++++++++++++++++++++++++++++++++
> arch/s390/kvm/gmap/gmap.h | 14 ++++++++++++
> 2 files changed, 62 insertions(+)
>
> diff --git a/arch/s390/kvm/gmap/gmap.c b/arch/s390/kvm/gmap/gmap.c
> index ef1243ad4e54..c7af1ad9f7c1 100644
> --- a/arch/s390/kvm/gmap/gmap.c
> +++ b/arch/s390/kvm/gmap/gmap.c
> @@ -1527,3 +1527,51 @@ struct gmap *gmap_create_shadow(struct kvm_s390_mmu_cache *mc, struct gmap *pare
> }
> return new;
> }
> +
> +#if KVM_S390_MANAGES_S390_GUEST
> +/* Bail out for any allocation failure. This is only a best effort to allocate all page tables. */
> +void gmap_enable_cmm_already_locked(struct kvm_s390_mmu_cache *mc, struct gmap *gmap)
> +{
[...]
> +}
Wouldn't it make more sense if you put the function in a region that is
already marked as KVM/s390 only? Like just below ''_gmap_set_cmma_all'
then all cmma functions are at one place and we have fewer regions.
> +#endif /* KVM_S390_MANAGES_S390_GUEST */
> diff --git a/arch/s390/kvm/gmap/gmap.h b/arch/s390/kvm/gmap/gmap.h
> index 8f47f29c89fd..fe96268b6de7 100644
> --- a/arch/s390/kvm/gmap/gmap.h
> +++ b/arch/s390/kvm/gmap/gmap.h
> @@ -102,6 +102,7 @@ void gmap_ucas_unmap(struct gmap *gmap, gfn_t c_gfn, unsigned long count);
>
> #if KVM_S390_MANAGES_S390_GUEST
> int gmap_enable_skeys(struct gmap *gmap);
> +void gmap_enable_cmm_already_locked(struct kvm_s390_mmu_cache *mc, struct gmap *gmap);
> #endif /* KVM_S390_MANAGES_S390_GUEST */
>
> int gmap_pv_destroy_range(struct gmap *gmap, gfn_t start, gfn_t end, bool interruptible);
> @@ -345,4 +346,17 @@ static inline bool gmap_is_shadow_valid(struct gmap *sg, union asce asce, int ed
> return sg->guest_asce.val == asce.val && sg->edat_level == edat_level;
> }
>
> +#if KVM_S390_MANAGES_S390_GUEST
> +static inline void gmap_enable_cmm(struct kvm_s390_mmu_cache *mc, struct gmap *gmap)
> +{
> + /* CMMA already enabled, nothing to do */
> + if (uses_cmm(gmap))
> + return;
> +
> + guard(srcu)(&gmap->kvm->srcu);
> + guard(mutex)(&gmap->kvm->slots_arch_lock);
> +
> + gmap_enable_cmm_already_locked(mc, gmap);
> +}
> +#endif /* KVM_S390_MANAGES_S390_GUEST */
> #endif /* ARCH_KVM_GMAP_GMAP_H */
Like above. Both functions might be better placed just below
'gmap_set_cmma_all_clean'
Steffen
next prev parent reply other threads:[~2026-12-01 12:52 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 15:03 [PATCH v1 00/12] KVM: s390: More fixes Claudio Imbrenda
2026-11-27 15:04 ` [PATCH v1 01/12] KVM: s390: ucontrol: Do not mask -ENOMEM when translating Claudio Imbrenda
2026-11-27 15:04 ` [PATCH v1 02/12] KVM: s390: Fix potential leak in kvm_s390_get_io_int() Claudio Imbrenda
2026-11-30 8:23 ` Christian Borntraeger
2026-11-30 14:04 ` Claudio Imbrenda
2026-11-30 14:10 ` Christian Borntraeger
2026-11-27 15:04 ` [PATCH v1 03/12] KVM: s390: Introduce gmap_enable_cmm() Claudio Imbrenda
2026-11-27 15:47 ` sashiko-bot
2026-12-01 12:52 ` Steffen Eiden [this message]
2026-11-27 15:04 ` [PATCH v1 04/12] KVM: s390: Allocate page tables when CMMA is used Claudio Imbrenda
2026-11-27 15:34 ` sashiko-bot
2026-11-27 15:04 ` [PATCH v1 05/12] KVM: s390: Fix dat_entry_walk() with DAT_WALK_CONTINUE Claudio Imbrenda
2026-11-27 15:04 ` [PATCH v1 06/12] KVM: s390: Fix soft-dirty handling in _gmap_link() Claudio Imbrenda
2026-11-30 9:43 ` Janosch Frank
2026-11-27 15:04 ` [PATCH v1 07/12] KVM: s390: Fix race in gmap_clear_young_pte() Claudio Imbrenda
2026-11-30 12:05 ` Janosch Frank
2026-11-27 15:04 ` [PATCH v1 08/12] KVM: s390: Properly adjust page size before calling _gmap_link() Claudio Imbrenda
2026-12-01 13:20 ` Janosch Frank
2026-11-27 15:04 ` [PATCH v1 09/12] KVM: s390: Fix *_test_and_clear_softdirty() functions Claudio Imbrenda
2026-11-27 15:30 ` sashiko-bot
2026-11-27 15:04 ` [PATCH v1 10/12] KVM: s390: Do not unnecessarily drop the soft-dirty bit Claudio Imbrenda
2026-11-27 15:27 ` sashiko-bot
2026-11-27 15:04 ` [PATCH v1 11/12] KVM: s390: Disallow 2G pages for guests up to 2G Claudio Imbrenda
2026-11-27 15:04 ` [PATCH v1 12/12] KVM: s390: vsie: Fix improper shadowing of non-present host ptes Claudio Imbrenda
2026-11-27 15:47 ` [PATCH v1 00/12] KVM: s390: More fixes 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=20261201125246.818009-A-seiden@linux.ibm.com \
--to=seiden@linux.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=david@kernel.org \
--cc=frankja@linux.ibm.com \
--cc=gra@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=nrb@linux.ibm.com \
--cc=schlameuss@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.