On Thu, Nov 10, 2022 at 01:53:47AM +0000, Sean Christopherson wrote: > On Thu, Nov 10, 2022, Yan Zhao wrote: > > kvm_prepare_memory_region() is not useful for KVM_MR_DELETE, > > and each kvm_arch_prepare_memory_region() does nothing more than returning > > 0 for KVM_MR_DELETE. > > This is not true, s390 has an error path that fires in the DELETE case. > > /* When we are protected, we should not change the memory slots */ > if (kvm_s390_pv_get_handle(kvm)) > return -EINVAL; > > if (change == KVM_MR_DELETE || change == KVM_MR_FLAGS_ONLY) > return 0; > > > > So, just don't call into kvm_prepare_memory_region() to avoid unnecessary > > error handling for KVM_MR_DELETE. > > Even if the s390 case didn't exit, I would still prefer keeping the code as is. > I agree that a "dummy" call is somewhat confusing, but skipping the arch call > for one operation is equally confusing and could easily lead to future bugs, > e.g. if the order of changes were reversed and an s390 developer wasn't aware > that s390's arch hook would be bypassed on memslot deletion. yes, you are right!