KVM: Introduce kvm_make_all_cpus_request_except()
This allows making request to all other vcpus except the one specified in the parameter. Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> Message-Id: <1588771076-73790-2-git-send-email-suravee.suthikulpanit@amd.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Родитель
45981dedf5
Коммит
54163a346d
|
@ -1427,7 +1427,7 @@ static u64 kvm_hv_flush_tlb(struct kvm_vcpu *current_vcpu, u64 ingpa,
|
||||||
*/
|
*/
|
||||||
kvm_make_vcpus_request_mask(kvm,
|
kvm_make_vcpus_request_mask(kvm,
|
||||||
KVM_REQ_TLB_FLUSH | KVM_REQUEST_NO_WAKEUP,
|
KVM_REQ_TLB_FLUSH | KVM_REQUEST_NO_WAKEUP,
|
||||||
vcpu_mask, &hv_vcpu->tlb_flush);
|
NULL, vcpu_mask, &hv_vcpu->tlb_flush);
|
||||||
|
|
||||||
ret_success:
|
ret_success:
|
||||||
/* We always do full TLB flush, set rep_done = rep_cnt. */
|
/* We always do full TLB flush, set rep_done = rep_cnt. */
|
||||||
|
|
|
@ -8030,7 +8030,7 @@ void kvm_make_scan_ioapic_request_mask(struct kvm *kvm,
|
||||||
zalloc_cpumask_var(&cpus, GFP_ATOMIC);
|
zalloc_cpumask_var(&cpus, GFP_ATOMIC);
|
||||||
|
|
||||||
kvm_make_vcpus_request_mask(kvm, KVM_REQ_SCAN_IOAPIC,
|
kvm_make_vcpus_request_mask(kvm, KVM_REQ_SCAN_IOAPIC,
|
||||||
vcpu_bitmap, cpus);
|
NULL, vcpu_bitmap, cpus);
|
||||||
|
|
||||||
free_cpumask_var(cpus);
|
free_cpumask_var(cpus);
|
||||||
}
|
}
|
||||||
|
|
|
@ -813,8 +813,11 @@ void kvm_flush_remote_tlbs(struct kvm *kvm);
|
||||||
void kvm_reload_remote_mmus(struct kvm *kvm);
|
void kvm_reload_remote_mmus(struct kvm *kvm);
|
||||||
|
|
||||||
bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req,
|
bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req,
|
||||||
|
struct kvm_vcpu *except,
|
||||||
unsigned long *vcpu_bitmap, cpumask_var_t tmp);
|
unsigned long *vcpu_bitmap, cpumask_var_t tmp);
|
||||||
bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req);
|
bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req);
|
||||||
|
bool kvm_make_all_cpus_request_except(struct kvm *kvm, unsigned int req,
|
||||||
|
struct kvm_vcpu *except);
|
||||||
bool kvm_make_cpus_request_mask(struct kvm *kvm, unsigned int req,
|
bool kvm_make_cpus_request_mask(struct kvm *kvm, unsigned int req,
|
||||||
unsigned long *vcpu_bitmap);
|
unsigned long *vcpu_bitmap);
|
||||||
|
|
||||||
|
|
|
@ -259,6 +259,7 @@ static inline bool kvm_kick_many_cpus(const struct cpumask *cpus, bool wait)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req,
|
bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req,
|
||||||
|
struct kvm_vcpu *except,
|
||||||
unsigned long *vcpu_bitmap, cpumask_var_t tmp)
|
unsigned long *vcpu_bitmap, cpumask_var_t tmp)
|
||||||
{
|
{
|
||||||
int i, cpu, me;
|
int i, cpu, me;
|
||||||
|
@ -268,7 +269,8 @@ bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req,
|
||||||
me = get_cpu();
|
me = get_cpu();
|
||||||
|
|
||||||
kvm_for_each_vcpu(i, vcpu, kvm) {
|
kvm_for_each_vcpu(i, vcpu, kvm) {
|
||||||
if (vcpu_bitmap && !test_bit(i, vcpu_bitmap))
|
if ((vcpu_bitmap && !test_bit(i, vcpu_bitmap)) ||
|
||||||
|
vcpu == except)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
kvm_make_request(req, vcpu);
|
kvm_make_request(req, vcpu);
|
||||||
|
@ -288,19 +290,25 @@ bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req,
|
||||||
return called;
|
return called;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req)
|
bool kvm_make_all_cpus_request_except(struct kvm *kvm, unsigned int req,
|
||||||
|
struct kvm_vcpu *except)
|
||||||
{
|
{
|
||||||
cpumask_var_t cpus;
|
cpumask_var_t cpus;
|
||||||
bool called;
|
bool called;
|
||||||
|
|
||||||
zalloc_cpumask_var(&cpus, GFP_ATOMIC);
|
zalloc_cpumask_var(&cpus, GFP_ATOMIC);
|
||||||
|
|
||||||
called = kvm_make_vcpus_request_mask(kvm, req, NULL, cpus);
|
called = kvm_make_vcpus_request_mask(kvm, req, except, NULL, cpus);
|
||||||
|
|
||||||
free_cpumask_var(cpus);
|
free_cpumask_var(cpus);
|
||||||
return called;
|
return called;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req)
|
||||||
|
{
|
||||||
|
return kvm_make_all_cpus_request_except(kvm, req, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_HAVE_KVM_ARCH_TLB_FLUSH_ALL
|
#ifndef CONFIG_HAVE_KVM_ARCH_TLB_FLUSH_ALL
|
||||||
void kvm_flush_remote_tlbs(struct kvm *kvm)
|
void kvm_flush_remote_tlbs(struct kvm *kvm)
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче