mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Janosch Frank <frankja@linux.ibm.com>
To: Claudio Imbrenda <imbrenda@linux.ibm.com>, kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org,
	borntraeger@de.ibm.com, nsg@linux.ibm.com, nrb@linux.ibm.com,
	seiden@linux.ibm.com, gra@linux.ibm.com,
	schlameuss@linux.ibm.com, hca@linux.ibm.com, svens@linux.ibm.com,
	agordeev@linux.ibm.com, gor@linux.ibm.com, david@kernel.org,
	gerald.schaefer@linux.ibm.com
Subject: Re: [PATCH v1 1/3] KVM: s390: Use guest address to mark guest page dirty
Date: Fri, 6 Feb 2026 15:56:18 +0100	[thread overview]
Message-ID: <f5c07226-f748-46c9-a59b-e31494a5524f@linux.ibm.com> (raw)
In-Reply-To: <20260206143553.14730-2-imbrenda@linux.ibm.com>

On 2/6/26 15:35, Claudio Imbrenda wrote:
> Stop using the userspace address to mark the guest page dirty.
> mark_page_dirty() expects a guest frame number, but was being passed a
> host virtual frame number. When slot == NULL, mark_page_dirty_in_slot()
> does nothing and does not complain.
> 
> This means that in some circumstances the dirtiness of the guest page
> might have been lost.
> 
> Fix by adding two fields in struct kvm_s390_adapter_int to keep the
> guest addressses, and use those for mark_page_dirty().
> 
> Fixes: f65470661f36 ("KVM: s390/interrupt: do not pin adapter interrupt pages")
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>

Ouff
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>


We had so many of these issues and I wonder if we should move away from 
making everything u64 and enforce type checks in some form.

> ---
>   arch/s390/kvm/interrupt.c | 6 ++++--
>   include/linux/kvm_host.h  | 2 ++
>   2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
> index f55eca9aa638..1c2bb5cd7e12 100644
> --- a/arch/s390/kvm/interrupt.c
> +++ b/arch/s390/kvm/interrupt.c
> @@ -2768,13 +2768,13 @@ static int adapter_indicators_set(struct kvm *kvm,
>   	bit = get_ind_bit(adapter_int->ind_addr,
>   			  adapter_int->ind_offset, adapter->swap);
>   	set_bit(bit, map);
> -	mark_page_dirty(kvm, adapter_int->ind_addr >> PAGE_SHIFT);
> +	mark_page_dirty(kvm, adapter_int->ind_gaddr >> PAGE_SHIFT);
>   	set_page_dirty_lock(ind_page);
>   	map = page_address(summary_page);
>   	bit = get_ind_bit(adapter_int->summary_addr,
>   			  adapter_int->summary_offset, adapter->swap);
>   	summary_set = test_and_set_bit(bit, map);
> -	mark_page_dirty(kvm, adapter_int->summary_addr >> PAGE_SHIFT);
> +	mark_page_dirty(kvm, adapter_int->summary_gaddr >> PAGE_SHIFT);
>   	set_page_dirty_lock(summary_page);
>   	srcu_read_unlock(&kvm->srcu, idx);
>   
> @@ -2870,7 +2870,9 @@ int kvm_set_routing_entry(struct kvm *kvm,
>   		if (kvm_is_error_hva(uaddr_s) || kvm_is_error_hva(uaddr_i))
>   			return -EFAULT;
>   		e->adapter.summary_addr = uaddr_s;
> +		e->adapter.summary_gaddr = ue->u.adapter.summary_addr;
>   		e->adapter.ind_addr = uaddr_i;
> +		e->adapter.ind_gaddr = ue->u.adapter.ind_addr;
>   		e->adapter.summary_offset = ue->u.adapter.summary_offset;
>   		e->adapter.ind_offset = ue->u.adapter.ind_offset;
>   		e->adapter.adapter_id = ue->u.adapter.adapter_id;
> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> index d93f75b05ae2..deb36007480d 100644
> --- a/include/linux/kvm_host.h
> +++ b/include/linux/kvm_host.h
> @@ -645,7 +645,9 @@ static inline unsigned long *kvm_second_dirty_bitmap(struct kvm_memory_slot *mem
>   
>   struct kvm_s390_adapter_int {
>   	u64 ind_addr;
> +	u64 ind_gaddr;
>   	u64 summary_addr;
> +	u64 summary_gaddr;
>   	u64 ind_offset;
>   	u32 summary_offset;
>   	u32 adapter_id;


  reply	other threads:[~2026-02-06 14:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-06 14:35 [PATCH v1 0/3] KVM: s390: Three small fixes Claudio Imbrenda
2026-02-06 14:35 ` [PATCH v1 1/3] KVM: s390: Use guest address to mark guest page dirty Claudio Imbrenda
2026-02-06 14:56   ` Janosch Frank [this message]
2026-02-06 16:29   ` Steffen Eiden
2026-02-09 17:20   ` Christoph Schlameuss
2026-02-06 14:35 ` [PATCH v1 2/3] KVM: s390: vsie: Fix race in walk_guest_tables() Claudio Imbrenda
2026-02-06 15:12   ` Janosch Frank
2026-02-09 17:27   ` Christoph Schlameuss
2026-02-06 14:35 ` [PATCH v1 3/3] KVM: s390: vsie: Fix race in acquire_gmap_shadow() Claudio Imbrenda
2026-02-09 17:42   ` Christoph Schlameuss

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=f5c07226-f748-46c9-a59b-e31494a5524f@linux.ibm.com \
    --to=frankja@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=david@kernel.org \
    --cc=gerald.schaefer@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=gra@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=nrb@linux.ibm.com \
    --cc=nsg@linux.ibm.com \
    --cc=schlameuss@linux.ibm.com \
    --cc=seiden@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

all inboxes | Powered by JetHome®