KVM: s390: Remove cond_resched() calls

Since [1] cond_resched() is a no-op on s390. Remove all calls.

This also entirely removes uv_call_sched() and replaces all call sites
with uv_call(), since both functions are identical after the removal
of cond_resched().

[1] commit 7dadeaa6e8 ("sched: Further restrict the preemption modes")

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
Heiko Carstens 2026-07-31 18:50:02 +02:00 committed by Vasily Gorbik
parent e11733826f
commit 97d86fc847
9 changed files with 13 additions and 37 deletions

View File

@ -454,18 +454,6 @@ static inline int uv_call(unsigned long r1, unsigned long r2)
return cc;
}
/* Low level uv_call that avoids stalls for long running busy conditions */
static inline int uv_call_sched(unsigned long r1, unsigned long r2)
{
int cc;
do {
cc = __uv_call(r1, r2);
cond_resched();
} while (cc > 1);
return cc;
}
/*
* special variant of uv_call that only transports the cpu or guest
* handle and the command, like destroy or verify.
@ -480,7 +468,7 @@ static inline int uv_cmd_nodata(u64 handle, u16 cmd, u16 *rc, u16 *rrc)
int cc;
WARN(!handle, "No handle provided to Ultravisor call cmd %x\n", cmd);
cc = uv_call_sched(0, (u64)&uvcb);
cc = uv_call(0, (u64)&uvcb);
*rc = uvcb.header.rc;
*rrc = uvcb.header.rrc;
return cc ? -EINVAL : 0;
@ -518,7 +506,7 @@ static inline int uv_list_secrets(struct uv_secret_list *buf, u16 start_idx,
.start_idx = start_idx,
.list_addr = (u64)buf,
};
int cc = uv_call_sched(0, (u64)&uvcb);
int cc = uv_call(0, (u64)&uvcb);
if (rc)
*rc = uvcb.header.rc;

View File

@ -896,7 +896,7 @@ int uv_retrieve_secret(u16 secret_idx, u8 *buf, size_t buf_size)
.buf_size = buf_size,
};
uv_call_sched(0, (u64)&uvcb);
uv_call(0, (u64)&uvcb);
switch (uvcb.header.rc) {
case UVC_RC_EXECUTED:

View File

@ -151,10 +151,8 @@ static void ipte_lock_simple(struct kvm *kvm)
ic = &kvm->arch.sca->ipte_control;
old = READ_ONCE(*ic);
do {
if (old.k) {
cond_resched();
if (old.k)
goto retry;
}
new = old;
new.k = 1;
} while (!try_cmpxchg(&ic->val, &old.val, new.val));
@ -189,10 +187,8 @@ static void ipte_lock_siif(struct kvm *kvm)
ic = &kvm->arch.sca->ipte_control;
old = READ_ONCE(*ic);
do {
if (old.kg) {
cond_resched();
if (old.kg)
goto retry;
}
new = old;
new.k = 1;
new.kh++;

View File

@ -941,7 +941,6 @@ void gmap_split_huge_pages(struct gmap *gmap)
scoped_guard(read_lock, &gmap->kvm->mmu_lock)
start = _dat_walk_gfn_range(start, asce_end(gmap->asce), gmap->asce,
&ops, DAT_WALK_IGN_HOLES, gmap);
cond_resched();
} while (start);
}
@ -963,7 +962,6 @@ static int _gmap_enable_skeys(struct gmap *gmap)
do {
scoped_guard(write_lock, &gmap->kvm->mmu_lock)
start = dat_reset_skeys(gmap->asce, start);
cond_resched();
} while (start);
return 0;
}
@ -1019,7 +1017,6 @@ int gmap_pv_destroy_range(struct gmap *gmap, gfn_t start, gfn_t end, bool interr
DAT_WALK_IGN_HOLES, NULL);
if (interruptible && fatal_signal_pending(current))
return -EINTR;
cond_resched();
} while (start && start < end);
return 0;
}
@ -1138,7 +1135,6 @@ void _gmap_set_cmma_all(struct gmap *gmap, bool dirty)
gfn = _dat_walk_gfn_range(gfn, asce_end(gmap->asce), gmap->asce, &ops,
DAT_WALK_IGN_HOLES,
&gmap->kvm->arch.cmma_dirty_pages);
cond_resched();
} while (gfn);
}

View File

@ -1027,7 +1027,6 @@ static int kvm_s390_set_mem_control(struct kvm *kvm, struct kvm_device_attr *att
do {
scoped_guard(read_lock, &kvm->mmu_lock)
start_gfn = dat_reset_cmma(kvm->arch.gmap->asce, start_gfn);
cond_resched();
} while (start_gfn);
ret = 0;
break;

View File

@ -429,7 +429,7 @@ static int kvm_s390_pv_deinit_vm_fast(struct kvm *kvm, u16 *rc, u16 *rrc)
};
int cc;
cc = uv_call_sched(0, (u64)&uvcb);
cc = uv_call(0, (u64)&uvcb);
if (rc)
*rc = uvcb.header.rc;
if (rrc)
@ -746,7 +746,7 @@ int kvm_s390_pv_init_vm(struct kvm *kvm, u16 *rc, u16 *rrc)
}
gmap_split_huge_pages(kvm->arch.gmap);
cc = uv_call_sched(0, (u64)&uvcb);
cc = uv_call(0, (u64)&uvcb);
*rc = uvcb.header.rc;
*rrc = uvcb.header.rrc;
KVM_UV_EVENT(kvm, 3, "PROTVIRT CREATE VM: handle %llx len %llx rc %x rrc %x flags %04x",
@ -832,7 +832,6 @@ int kvm_s390_pv_unpack(struct kvm *kvm, unsigned long addr, unsigned long size,
while (offset < size) {
ret = unpack_one(kvm, addr, tweak, offset, rc, rrc);
if (ret == -EAGAIN) {
cond_resched();
if (fatal_signal_pending(current))
break;
continue;
@ -875,7 +874,7 @@ int kvm_s390_pv_dump_cpu(struct kvm_vcpu *vcpu, void *buff, u16 *rc, u16 *rrc)
};
int cc;
cc = uv_call_sched(0, (u64)&uvcb);
cc = uv_call(0, (u64)&uvcb);
*rc = uvcb.header.rc;
*rrc = uvcb.header.rrc;
return cc;
@ -959,7 +958,7 @@ int kvm_s390_pv_dump_stor_state(struct kvm *kvm, void __user *buff_user,
/* We will loop until the user buffer is filled or an error occurs */
do {
/* Get 1MB worth of guest storage state data */
cc = uv_call_sched(0, (u64)&uvcb);
cc = uv_call(0, (u64)&uvcb);
/* All or nothing */
if (cc) {
@ -1037,7 +1036,7 @@ int kvm_s390_pv_dump_complete(struct kvm *kvm, void __user *buff_user,
return -ENOMEM;
complete.dump_area_origin = (u64)compl_data;
ret = uv_call_sched(0, (u64)&complete);
ret = uv_call(0, (u64)&complete);
*rc = complete.header.rc;
*rrc = complete.header.rrc;
KVM_UV_EVENT(kvm, 3, "PROTVIRT DUMP COMPLETE: rc %x rrc %x",

View File

@ -1434,7 +1434,6 @@ static int vsie_run(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
}
if (sg)
sg = gmap_put(sg);
cond_resched();
}
if (sg)
sg = gmap_put(sg);

View File

@ -272,7 +272,6 @@ static int __gmap_helper_unshare_zeropages(struct mm_struct *mm)
* truncation. In that case, the shared zeropage would be gone
* and we can simply retry and make progress.
*/
cond_resched();
goto retry;
}

View File

@ -224,7 +224,7 @@ static int uvio_attestation(struct uvio_ioctl_cb *uv_ioctl)
if (ret)
goto out;
uv_call_sched(0, (u64)uvcb_attest);
uv_call(0, (u64)uvcb_attest);
uv_ioctl->uv_rc = uvcb_attest->header.rc;
uv_ioctl->uv_rrc = uvcb_attest->header.rrc;
@ -291,7 +291,7 @@ static int uvio_add_secret(struct uvio_ioctl_cb *uv_ioctl)
ret = 0;
uvcb.addr = (u64)asrcb;
uv_call_sched(0, (u64)&uvcb);
uv_call(0, (u64)&uvcb);
uv_ioctl->uv_rc = uvcb.header.rc;
uv_ioctl->uv_rrc = uvcb.header.rrc;
@ -457,7 +457,7 @@ static int uvio_retr_secret(struct uvio_ioctl_cb *uv_ioctl)
uvcb.buf_addr = (u64)buf;
uvcb.buf_size = buf_len;
uv_call_sched(0, (u64)&uvcb);
uv_call(0, (u64)&uvcb);
if (copy_to_user((__user void *)uv_ioctl->argument_addr, buf, buf_len))
goto err;