Skip to content

Commit f4bc137

Browse files
committed
Merge tag 'kvm-x86-generic-6.10' of https://github.com/kvm-x86/linux into HEAD
KVM cleanups for 6.10: - Misc cleanups extracted from the "exit on missing userspace mapping" series, which has been put on hold in anticipation of a "KVM Userfault" approach, which should provide a superset of functionality. - Remove kvm_make_all_cpus_request_except(), which got added to hack around an AVIC bug, and then became dead code when a more robust fix came along. - Fix a goof in the KVM_CREATE_GUEST_MEMFD documentation.
2 parents e5f62e2 + 2098aca commit f4bc137

File tree

3 files changed

+9
-22
lines changed

3 files changed

+9
-22
lines changed

Documentation/virt/kvm/api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6316,7 +6316,7 @@ The "flags" field is reserved for future extensions and must be '0'.
63166316
:Architectures: none
63176317
:Type: vm ioctl
63186318
:Parameters: struct kvm_create_guest_memfd(in)
6319-
:Returns: 0 on success, <0 on error
6319+
:Returns: A file descriptor on success, <0 on error
63206320

63216321
KVM_CREATE_GUEST_MEMFD creates an anonymous file and returns a file descriptor
63226322
that refers to it. guest_memfd files are roughly analogous to files created

include/linux/kvm_host.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,6 @@ static inline bool is_error_page(struct page *page)
193193
bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req,
194194
unsigned long *vcpu_bitmap);
195195
bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req);
196-
bool kvm_make_all_cpus_request_except(struct kvm *kvm, unsigned int req,
197-
struct kvm_vcpu *except);
198196

199197
#define KVM_USERSPACE_IRQ_SOURCE_ID 0
200198
#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1

virt/kvm/kvm_main.c

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,7 @@ bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req,
311311
return called;
312312
}
313313

314-
bool kvm_make_all_cpus_request_except(struct kvm *kvm, unsigned int req,
315-
struct kvm_vcpu *except)
314+
bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req)
316315
{
317316
struct kvm_vcpu *vcpu;
318317
struct cpumask *cpus;
@@ -325,22 +324,14 @@ bool kvm_make_all_cpus_request_except(struct kvm *kvm, unsigned int req,
325324
cpus = this_cpu_cpumask_var_ptr(cpu_kick_mask);
326325
cpumask_clear(cpus);
327326

328-
kvm_for_each_vcpu(i, vcpu, kvm) {
329-
if (vcpu == except)
330-
continue;
327+
kvm_for_each_vcpu(i, vcpu, kvm)
331328
kvm_make_vcpu_request(vcpu, req, cpus, me);
332-
}
333329

334330
called = kvm_kick_many_cpus(cpus, !!(req & KVM_REQUEST_WAIT));
335331
put_cpu();
336332

337333
return called;
338334
}
339-
340-
bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req)
341-
{
342-
return kvm_make_all_cpus_request_except(kvm, req, NULL);
343-
}
344335
EXPORT_SYMBOL_GPL(kvm_make_all_cpus_request);
345336

346337
void kvm_flush_remote_tlbs(struct kvm *kvm)
@@ -2932,7 +2923,7 @@ static int hva_to_pfn_remapped(struct vm_area_struct *vma,
29322923
/*
29332924
* Pin guest page in memory and return its pfn.
29342925
* @addr: host virtual address which maps memory to the guest
2935-
* @atomic: whether this function can sleep
2926+
* @atomic: whether this function is forbidden from sleeping
29362927
* @interruptible: whether the process can be interrupted by non-fatal signals
29372928
* @async: whether this function need to wait IO complete if the
29382929
* host page is not in the memory
@@ -3004,16 +2995,12 @@ kvm_pfn_t __gfn_to_pfn_memslot(const struct kvm_memory_slot *slot, gfn_t gfn,
30042995
if (hva)
30052996
*hva = addr;
30062997

3007-
if (addr == KVM_HVA_ERR_RO_BAD) {
3008-
if (writable)
3009-
*writable = false;
3010-
return KVM_PFN_ERR_RO_FAULT;
3011-
}
3012-
30132998
if (kvm_is_error_hva(addr)) {
30142999
if (writable)
30153000
*writable = false;
3016-
return KVM_PFN_NOSLOT;
3001+
3002+
return addr == KVM_HVA_ERR_RO_BAD ? KVM_PFN_ERR_RO_FAULT :
3003+
KVM_PFN_NOSLOT;
30173004
}
30183005

30193006
/* Do not map writable pfn in the readonly memslot. */
@@ -3277,6 +3264,7 @@ static int next_segment(unsigned long len, int offset)
32773264
return len;
32783265
}
32793266

3267+
/* Copy @len bytes from guest memory at '(@gfn * PAGE_SIZE) + @offset' to @data */
32803268
static int __kvm_read_guest_page(struct kvm_memory_slot *slot, gfn_t gfn,
32813269
void *data, int offset, int len)
32823270
{
@@ -3378,6 +3366,7 @@ int kvm_vcpu_read_guest_atomic(struct kvm_vcpu *vcpu, gpa_t gpa,
33783366
}
33793367
EXPORT_SYMBOL_GPL(kvm_vcpu_read_guest_atomic);
33803368

3369+
/* Copy @len bytes from @data into guest memory at '(@gfn * PAGE_SIZE) + @offset' */
33813370
static int __kvm_write_guest_page(struct kvm *kvm,
33823371
struct kvm_memory_slot *memslot, gfn_t gfn,
33833372
const void *data, int offset, int len)

0 commit comments

Comments
 (0)