Common KVM changes for 6.3:

- Account allocations in generic kvm_arch_alloc_vm()
 
  - Fix a typo and a stale comment
 
  - Fix a memory leak if coalesced MMIO unregistration fails
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCgAwFiEEMHr+pfEFOIzK+KY1YJEiAU0MEvkFAmPsCgsSHHNlYW5qY0Bn
 b29nbGUuY29tAAoJEGCRIgFNDBL5/dkP/iCvrfcOCtjiWR3Lcik6Xy7QTkTu4cTC
 T9X0e1cRfIWj4oiNV2QE7y7mW8DM/ZDYsm88ZHCQu6gFsHAoQML1YjURTT9jlyXn
 Nj6ZD9sMbQN0s2lMzWI6u0itPyPsIdpupuV2i2nbs2i+ihj5LkGldNSB7G25TqMi
 LUbRKmRGtfn5JxwQVwWiR91/U/zcoShkWv+Ez9LmE7MT8s7rKYaCuu923nQUlTJY
 F4Z4uzeP/hq7QwBCqQMeo6MUs/0mJVFfewXKHUih4Y0XFrQ9uGrLZYxQxTbtRZU2
 Cbm8xTwO58B1ffikNXdDlVB7KKhDLzJGD+PshwQDEEWTWiD6UQEnH3ahJOhLGInf
 lB9V/wlfUkI0ZY425ujXUc07VngadbWt6Mb02LKDSd8ACRizcQwyTph+v++aohUE
 YGBWd+hVtwAR8fucXUUkc/ueOubUbFcXZMbJmWEEdZO80aZfN+hULorq9T4F2CG2
 ZbAoTGDxdSpYlmkHctXxJS0CQzjZwAwirqpFSxHvJGV3he5x/sErGtZYahrtHlvq
 XW+VWPaFcTsVMkr0giiqPnb9Hlbw59ToT/dNPgGZKdudBZPKjKnho6B0iHZIiHHQ
 m/JxniXh1vtQUUfTFZmJTDtKXNQJSDKt1QyxQ9HcBElc5T4dO1sHsvaT3yVofVSk
 pVpWPgCW4uIP
 =RibF
 -----END PGP SIGNATURE-----

Merge tag 'kvm-x86-generic-6.3' of https://github.com/kvm-x86/linux into HEAD

Common KVM changes for 6.3:

 - Account allocations in generic kvm_arch_alloc_vm()

 - Fix a typo and a stale comment

 - Fix a memory leak if coalesced MMIO unregistration fails
This commit is contained in:
Paolo Bonzini 2023-02-15 07:30:43 -05:00
commit cf8e6cf6e7
2 changed files with 8 additions and 6 deletions

View File

@ -324,7 +324,7 @@ struct kvm_vcpu {
#endif
int cpu;
int vcpu_id; /* id given by userspace at creation */
int vcpu_idx; /* index in kvm->vcpus array */
int vcpu_idx; /* index into kvm->vcpu_array */
int ____srcu_idx; /* Don't use this directly. You've been warned. */
#ifdef CONFIG_PROVE_RCU
int srcu_depth;
@ -1353,7 +1353,7 @@ void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu);
bool kvm_vcpu_wake_up(struct kvm_vcpu *vcpu);
void kvm_vcpu_kick(struct kvm_vcpu *vcpu);
int kvm_vcpu_yield_to(struct kvm_vcpu *target);
void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu, bool usermode_vcpu_not_eligible);
void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu, bool yield_to_kernel_mode);
void kvm_flush_remote_tlbs(struct kvm *kvm);
@ -1461,7 +1461,7 @@ int kvm_arch_create_vm_debugfs(struct kvm *kvm);
*/
static inline struct kvm *kvm_arch_alloc_vm(void)
{
return kzalloc(sizeof(struct kvm), GFP_KERNEL);
return kzalloc(sizeof(struct kvm), GFP_KERNEL_ACCOUNT);
}
#endif

View File

@ -187,15 +187,17 @@ int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *kvm,
r = kvm_io_bus_unregister_dev(kvm,
zone->pio ? KVM_PIO_BUS : KVM_MMIO_BUS, &dev->dev);
kvm_iodevice_destructor(&dev->dev);
/*
* On failure, unregister destroys all devices on the
* bus _except_ the target device, i.e. coalesced_zones
* has been modified. No need to restart the walk as
* there aren't any zones left.
* has been modified. Bail after destroying the target
* device, there's no need to restart the walk as there
* aren't any zones left.
*/
if (r)
break;
kvm_iodevice_destructor(&dev->dev);
}
}