Re: [PATCH v2 4/9] KVM: s390: Fix dirty marking in adapter_indicators_set*()
From: Claudio Imbrenda
Date: Wed Aug 12 2026 - 07:42:40 EST
On Wed, 12 Aug 2026 13:03:39 +0200
Christian Borntraeger <borntraeger@xxxxxxxxxx> wrote:
> Am 12.08.26 um 12:44 schrieb Claudio Imbrenda:
>
> > @@ -3017,26 +3017,30 @@ static int adapter_indicators_set_fast(struct kvm *kvm,
> > struct kvm_s390_adapter_int *adapter_int,
> > int setbit)
> > {
> > + struct s390_map_info *ind_info, *summary_info;
> > unsigned long bit;
> > int summary_set;
> > - struct s390_map_info *ind_info, *summary_info;
> > void *map;
> >
> > - spin_lock(&adapter->maps_lock);
> > + guard(srcu)(&kvm->srcu);
> > + guard(spinlock)(&adapter->maps_lock);
> > +
> > ind_info = get_map_info(adapter, adapter_int->ind_addr);
> > - if (!ind_info) {
> > - spin_unlock(&adapter->maps_lock);
> > + if (!ind_info)
> > return -EWOULDBLOCK;
> > - }
> > +
> > map = page_address(ind_info->page);
> > bit = get_ind_bit(ind_info->addr, adapter_int->ind_offset, adapter->swap);
> > - if (setbit)
> > + if (setbit) {
> > + mark_page_dirty(kvm, gpa_to_gfn(adapter_int->ind_gaddr));
> > + set_page_dirty(ind_info->page);
> > set_bit(bit, map);
> > + }
>
> This marks the indicator page dirty before writing it.
> The summary twenty lines below does it the other way round and so do both
> slow-path branches.
> The order matters because kvm_get_dirty_log_protect() harvests destructively.
yes, that was a typo, but the patch also has other issues, so I'm
dropping it for now.