mirror of https://github.com/torvalds/linux.git
KVM: Rename kvm_arch_vcpu_async_ioctl() to kvm_arch_vcpu_unlocked_ioctl()
Rename the "async" ioctl API to "unlocked" so that upcoming usage in x86's TDX code doesn't result in a massive misnomer. To avoid having to retry SEAMCALLs, TDX needs to acquire kvm->lock *and* all vcpu->mutex locks, and acquiring all of those locks after/inside the current vCPU's mutex is a non-starter. However, TDX also needs to acquire the vCPU's mutex and load the vCPU, i.e. the handling is very much not async to the vCPU. No functional change intended. Acked-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Reviewed-by: Yan Zhao <yan.y.zhao@intel.com> Tested-by: Yan Zhao <yan.y.zhao@intel.com> Tested-by: Kai Huang <kai.huang@intel.com> Link: https://patch.msgid.link/20251030200951.3402865-3-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
parent
0a0da3f921
commit
50efc2340a
|
|
@ -1835,7 +1835,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
long kvm_arch_vcpu_async_ioctl(struct file *filp, unsigned int ioctl,
|
long kvm_arch_vcpu_unlocked_ioctl(struct file *filp, unsigned int ioctl,
|
||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
return -ENOIOCTLCMD;
|
return -ENOIOCTLCMD;
|
||||||
|
|
|
||||||
|
|
@ -1471,8 +1471,8 @@ int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
long kvm_arch_vcpu_async_ioctl(struct file *filp,
|
long kvm_arch_vcpu_unlocked_ioctl(struct file *filp, unsigned int ioctl,
|
||||||
unsigned int ioctl, unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
void __user *argp = (void __user *)arg;
|
void __user *argp = (void __user *)arg;
|
||||||
struct kvm_vcpu *vcpu = filp->private_data;
|
struct kvm_vcpu *vcpu = filp->private_data;
|
||||||
|
|
|
||||||
|
|
@ -895,7 +895,7 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
long kvm_arch_vcpu_async_ioctl(struct file *filp, unsigned int ioctl,
|
long kvm_arch_vcpu_unlocked_ioctl(struct file *filp, unsigned int ioctl,
|
||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
struct kvm_vcpu *vcpu = filp->private_data;
|
struct kvm_vcpu *vcpu = filp->private_data;
|
||||||
|
|
|
||||||
|
|
@ -2028,8 +2028,8 @@ int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
long kvm_arch_vcpu_async_ioctl(struct file *filp,
|
long kvm_arch_vcpu_unlocked_ioctl(struct file *filp, unsigned int ioctl,
|
||||||
unsigned int ioctl, unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
struct kvm_vcpu *vcpu = filp->private_data;
|
struct kvm_vcpu *vcpu = filp->private_data;
|
||||||
void __user *argp = (void __user *)arg;
|
void __user *argp = (void __user *)arg;
|
||||||
|
|
|
||||||
|
|
@ -238,8 +238,8 @@ vm_fault_t kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
|
||||||
return VM_FAULT_SIGBUS;
|
return VM_FAULT_SIGBUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
long kvm_arch_vcpu_async_ioctl(struct file *filp,
|
long kvm_arch_vcpu_unlocked_ioctl(struct file *filp, unsigned int ioctl,
|
||||||
unsigned int ioctl, unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
struct kvm_vcpu *vcpu = filp->private_data;
|
struct kvm_vcpu *vcpu = filp->private_data;
|
||||||
void __user *argp = (void __user *)arg;
|
void __user *argp = (void __user *)arg;
|
||||||
|
|
|
||||||
|
|
@ -5730,8 +5730,8 @@ static long kvm_s390_vcpu_memsida_op(struct kvm_vcpu *vcpu,
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
long kvm_arch_vcpu_async_ioctl(struct file *filp,
|
long kvm_arch_vcpu_unlocked_ioctl(struct file *filp, unsigned int ioctl,
|
||||||
unsigned int ioctl, unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
struct kvm_vcpu *vcpu = filp->private_data;
|
struct kvm_vcpu *vcpu = filp->private_data;
|
||||||
void __user *argp = (void __user *)arg;
|
void __user *argp = (void __user *)arg;
|
||||||
|
|
|
||||||
|
|
@ -7240,7 +7240,7 @@ static int kvm_vm_ioctl_set_clock(struct kvm *kvm, void __user *argp)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
long kvm_arch_vcpu_async_ioctl(struct file *filp, unsigned int ioctl,
|
long kvm_arch_vcpu_unlocked_ioctl(struct file *filp, unsigned int ioctl,
|
||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
return -ENOIOCTLCMD;
|
return -ENOIOCTLCMD;
|
||||||
|
|
|
||||||
|
|
@ -1557,6 +1557,8 @@ long kvm_arch_dev_ioctl(struct file *filp,
|
||||||
unsigned int ioctl, unsigned long arg);
|
unsigned int ioctl, unsigned long arg);
|
||||||
long kvm_arch_vcpu_ioctl(struct file *filp,
|
long kvm_arch_vcpu_ioctl(struct file *filp,
|
||||||
unsigned int ioctl, unsigned long arg);
|
unsigned int ioctl, unsigned long arg);
|
||||||
|
long kvm_arch_vcpu_unlocked_ioctl(struct file *filp,
|
||||||
|
unsigned int ioctl, unsigned long arg);
|
||||||
vm_fault_t kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf);
|
vm_fault_t kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf);
|
||||||
|
|
||||||
int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext);
|
int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext);
|
||||||
|
|
@ -2437,8 +2439,6 @@ static inline bool kvm_arch_no_poll(struct kvm_vcpu *vcpu)
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_HAVE_KVM_NO_POLL */
|
#endif /* CONFIG_HAVE_KVM_NO_POLL */
|
||||||
|
|
||||||
long kvm_arch_vcpu_async_ioctl(struct file *filp,
|
|
||||||
unsigned int ioctl, unsigned long arg);
|
|
||||||
void kvm_arch_guest_memory_reclaimed(struct kvm *kvm);
|
void kvm_arch_guest_memory_reclaimed(struct kvm *kvm);
|
||||||
|
|
||||||
#ifdef CONFIG_HAVE_KVM_VCPU_RUN_PID_CHANGE
|
#ifdef CONFIG_HAVE_KVM_VCPU_RUN_PID_CHANGE
|
||||||
|
|
|
||||||
|
|
@ -4434,10 +4434,10 @@ static long kvm_vcpu_ioctl(struct file *filp,
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some architectures have vcpu ioctls that are asynchronous to vcpu
|
* Let arch code handle select vCPU ioctls without holding vcpu->mutex,
|
||||||
* execution; mutex_lock() would break them.
|
* e.g. to support ioctls that can run asynchronous to vCPU execution.
|
||||||
*/
|
*/
|
||||||
r = kvm_arch_vcpu_async_ioctl(filp, ioctl, arg);
|
r = kvm_arch_vcpu_unlocked_ioctl(filp, ioctl, arg);
|
||||||
if (r != -ENOIOCTLCMD)
|
if (r != -ENOIOCTLCMD)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue