mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
Common KVM changes for 6.4:
- Drop unnecessary casts from "void *" throughout kvm_main.c - Tweak the layout of "struct kvm_mmu_memory_cache" to shrink the struct size by 8 bytes on 64-bit kernels by utilizing a padding hole - Fix a documentation format goof that was introduced when the KVM docs were converted to ReST - Constify MIPS's internal callbacks (a leftover from the hardware enabling rework that landed in 6.3) -----BEGIN PGP SIGNATURE----- iQJGBAABCgAwFiEEMHr+pfEFOIzK+KY1YJEiAU0MEvkFAmRGrVkSHHNlYW5qY0Bn b29nbGUuY29tAAoJEGCRIgFNDBL52ZAP/0/6KOa6ZSvkRh+7MwQDkfeXkkbRIyyY ItPspXCqCmD9X79m2r/5PCfpLgWDizROzOxLXb2bMhh7DqPczWWMvwEfZxBRK9LN 5zpHRdiiJJLR0HMdQtWkM5tdDCw/v37aQPkWyaZC/zDi2Zv6YPtPJVEBd38Squoh vJ8zQp3c1qxHJWKvNaS6JY7NQ1B1sI3e7H9VEldR2d3RAinuAnIMgi+I8WqU6RT1 IdIYkemKrgquO9OPGeBxMV4ri5Km9FBdzb8LRkzzfYaELzVsrRxhXBOc9zaasgYK YVbJSINeq5dIpwoXI9tqDBJTUIAPJ3NOwK/4E6qc6YEIZoT7euKGgGAqI879TSKm zNR8b1ijVu5DquJbDFP8AR2UZnqCEIQ/EuuJdkHxFE5wQnNjgNJtSHZVJX/cKqW9 wnXCqK6wQoAUq7pUgyqTsy3SCiRQddEtwsMcf/CdWRPXcgDqQ1P3UmVupLcEtL0I B+I7S+L64/KOHGeQsEKrohAOFBsMFVEkSkthyflg6/RFv1heHo2lx3njFKYm9lCW LDCd70+iHD8e5/X4RCWAjB0EaqM3MYpAU2UtD8Pbjx/DiZDLWEjDD0B2LkI0uinS +Ebdc5M9zGrNawiAzvF+MhZfDWut4Cr0tS5cPttXX3lg8aPl3nZL2G3nlk4vgpec jgNvjwQ5hUyv =Qw05 -----END PGP SIGNATURE----- Merge tag 'kvm-x86-generic-6.4' of https://github.com/kvm-x86/linux into HEAD Common KVM changes for 6.4: - Drop unnecessary casts from "void *" throughout kvm_main.c - Tweak the layout of "struct kvm_mmu_memory_cache" to shrink the struct size by 8 bytes on 64-bit kernels by utilizing a padding hole - Fix a documentation format goof that was introduced when the KVM docs were converted to ReST - Constify MIPS's internal callbacks (a leftover from the hardware enabling rework that landed in 6.3)
This commit is contained in:
commit
e1a6d5cf10
7 changed files with 19 additions and 20 deletions
|
@ -7330,6 +7330,7 @@ and injected exceptions.
|
|||
will clear DR6.RTM.
|
||||
|
||||
7.18 KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2
|
||||
--------------------------------------
|
||||
|
||||
:Architectures: x86, arm64, mips
|
||||
:Parameters: args[0] whether feature should be enabled or not
|
||||
|
|
|
@ -21,7 +21,7 @@ The acquisition orders for mutexes are as follows:
|
|||
- kvm->mn_active_invalidate_count ensures that pairs of
|
||||
invalidate_range_start() and invalidate_range_end() callbacks
|
||||
use the same memslots array. kvm->slots_lock and kvm->slots_arch_lock
|
||||
are taken on the waiting side in install_new_memslots, so MMU notifiers
|
||||
are taken on the waiting side when modifying memslots, so MMU notifiers
|
||||
must not take either kvm->slots_lock or kvm->slots_arch_lock.
|
||||
|
||||
For SRCU:
|
||||
|
|
|
@ -757,7 +757,7 @@ struct kvm_mips_callbacks {
|
|||
int (*vcpu_run)(struct kvm_vcpu *vcpu);
|
||||
void (*vcpu_reenter)(struct kvm_vcpu *vcpu);
|
||||
};
|
||||
extern struct kvm_mips_callbacks *kvm_mips_callbacks;
|
||||
extern const struct kvm_mips_callbacks * const kvm_mips_callbacks;
|
||||
int kvm_mips_emulation_init(void);
|
||||
|
||||
/* Debug: dump vcpu state */
|
||||
|
|
|
@ -3305,7 +3305,7 @@ static struct kvm_mips_callbacks kvm_vz_callbacks = {
|
|||
};
|
||||
|
||||
/* FIXME: Get rid of the callbacks now that trap-and-emulate is gone. */
|
||||
struct kvm_mips_callbacks *kvm_mips_callbacks = &kvm_vz_callbacks;
|
||||
const struct kvm_mips_callbacks * const kvm_mips_callbacks = &kvm_vz_callbacks;
|
||||
|
||||
int kvm_mips_emulation_init(void)
|
||||
{
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
|
||||
/*
|
||||
* Bit 63 of the memslot generation number is an "update in-progress flag",
|
||||
* e.g. is temporarily set for the duration of install_new_memslots().
|
||||
* e.g. is temporarily set for the duration of kvm_swap_active_memslots().
|
||||
* This flag effectively creates a unique generation number that is used to
|
||||
* mark cached memslot data, e.g. MMIO accesses, as potentially being stale,
|
||||
* i.e. may (or may not) have come from the previous memslots generation.
|
||||
|
@ -713,7 +713,7 @@ struct kvm {
|
|||
* use by the VM. To be used under the slots_lock (above) or in a
|
||||
* kvm->srcu critical section where acquiring the slots_lock would
|
||||
* lead to deadlock with the synchronize_srcu in
|
||||
* install_new_memslots.
|
||||
* kvm_swap_active_memslots().
|
||||
*/
|
||||
struct mutex slots_arch_lock;
|
||||
struct mm_struct *mm; /* userspace tied to this vm */
|
||||
|
|
|
@ -91,11 +91,11 @@ struct gfn_to_pfn_cache {
|
|||
* is topped up (__kvm_mmu_topup_memory_cache()).
|
||||
*/
|
||||
struct kvm_mmu_memory_cache {
|
||||
int nobjs;
|
||||
gfp_t gfp_zero;
|
||||
gfp_t gfp_custom;
|
||||
struct kmem_cache *kmem_cache;
|
||||
int capacity;
|
||||
int nobjs;
|
||||
void **objects;
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -1298,7 +1298,7 @@ static void kvm_destroy_vm(struct kvm *kvm)
|
|||
* At this point, pending calls to invalidate_range_start()
|
||||
* have completed but no more MMU notifiers will run, so
|
||||
* mn_active_invalidate_count may remain unbalanced.
|
||||
* No threads can be waiting in install_new_memslots as the
|
||||
* No threads can be waiting in kvm_swap_active_memslots() as the
|
||||
* last reference on KVM has been dropped, but freeing
|
||||
* memslots would deadlock without this manual intervention.
|
||||
*/
|
||||
|
@ -1742,13 +1742,13 @@ static void kvm_invalidate_memslot(struct kvm *kvm,
|
|||
kvm_arch_flush_shadow_memslot(kvm, old);
|
||||
kvm_arch_guest_memory_reclaimed(kvm);
|
||||
|
||||
/* Was released by kvm_swap_active_memslots, reacquire. */
|
||||
/* Was released by kvm_swap_active_memslots(), reacquire. */
|
||||
mutex_lock(&kvm->slots_arch_lock);
|
||||
|
||||
/*
|
||||
* Copy the arch-specific field of the newly-installed slot back to the
|
||||
* old slot as the arch data could have changed between releasing
|
||||
* slots_arch_lock in install_new_memslots() and re-acquiring the lock
|
||||
* slots_arch_lock in kvm_swap_active_memslots() and re-acquiring the lock
|
||||
* above. Writers are required to retrieve memslots *after* acquiring
|
||||
* slots_arch_lock, thus the active slot's data is guaranteed to be fresh.
|
||||
*/
|
||||
|
@ -1810,11 +1810,11 @@ static int kvm_set_memslot(struct kvm *kvm,
|
|||
int r;
|
||||
|
||||
/*
|
||||
* Released in kvm_swap_active_memslots.
|
||||
* Released in kvm_swap_active_memslots().
|
||||
*
|
||||
* Must be held from before the current memslots are copied until
|
||||
* after the new memslots are installed with rcu_assign_pointer,
|
||||
* then released before the synchronize srcu in kvm_swap_active_memslots.
|
||||
* Must be held from before the current memslots are copied until after
|
||||
* the new memslots are installed with rcu_assign_pointer, then
|
||||
* released before the synchronize srcu in kvm_swap_active_memslots().
|
||||
*
|
||||
* When modifying memslots outside of the slots_lock, must be held
|
||||
* before reading the pointer to the current memslots until after all
|
||||
|
@ -3866,7 +3866,7 @@ static int create_vcpu_fd(struct kvm_vcpu *vcpu)
|
|||
#ifdef __KVM_HAVE_ARCH_VCPU_DEBUGFS
|
||||
static int vcpu_get_pid(void *data, u64 *val)
|
||||
{
|
||||
struct kvm_vcpu *vcpu = (struct kvm_vcpu *) data;
|
||||
struct kvm_vcpu *vcpu = data;
|
||||
*val = pid_nr(rcu_access_pointer(vcpu->pid));
|
||||
return 0;
|
||||
}
|
||||
|
@ -5572,8 +5572,7 @@ static int kvm_debugfs_open(struct inode *inode, struct file *file,
|
|||
const char *fmt)
|
||||
{
|
||||
int ret;
|
||||
struct kvm_stat_data *stat_data = (struct kvm_stat_data *)
|
||||
inode->i_private;
|
||||
struct kvm_stat_data *stat_data = inode->i_private;
|
||||
|
||||
/*
|
||||
* The debugfs files are a reference to the kvm struct which
|
||||
|
@ -5594,8 +5593,7 @@ static int kvm_debugfs_open(struct inode *inode, struct file *file,
|
|||
|
||||
static int kvm_debugfs_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct kvm_stat_data *stat_data = (struct kvm_stat_data *)
|
||||
inode->i_private;
|
||||
struct kvm_stat_data *stat_data = inode->i_private;
|
||||
|
||||
simple_attr_release(inode, file);
|
||||
kvm_put_kvm(stat_data->kvm);
|
||||
|
@ -5644,7 +5642,7 @@ static int kvm_clear_stat_per_vcpu(struct kvm *kvm, size_t offset)
|
|||
static int kvm_stat_data_get(void *data, u64 *val)
|
||||
{
|
||||
int r = -EFAULT;
|
||||
struct kvm_stat_data *stat_data = (struct kvm_stat_data *)data;
|
||||
struct kvm_stat_data *stat_data = data;
|
||||
|
||||
switch (stat_data->kind) {
|
||||
case KVM_STAT_VM:
|
||||
|
@ -5663,7 +5661,7 @@ static int kvm_stat_data_get(void *data, u64 *val)
|
|||
static int kvm_stat_data_clear(void *data, u64 val)
|
||||
{
|
||||
int r = -EFAULT;
|
||||
struct kvm_stat_data *stat_data = (struct kvm_stat_data *)data;
|
||||
struct kvm_stat_data *stat_data = data;
|
||||
|
||||
if (val)
|
||||
return -EINVAL;
|
||||
|
|
Loading…
Reference in a new issue