From patchwork Thu Jan 7 11:43:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takuya Yoshikawa X-Patchwork-Id: 7976101 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2048BBEEE5 for ; Thu, 7 Jan 2016 11:32:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 347BE20149 for ; Thu, 7 Jan 2016 11:32:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 402FF2014A for ; Thu, 7 Jan 2016 11:32:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752246AbcAGLcJ (ORCPT ); Thu, 7 Jan 2016 06:32:09 -0500 Received: from tama50.ecl.ntt.co.jp ([129.60.39.147]:47127 "EHLO tama50.ecl.ntt.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752052AbcAGLcH (ORCPT ); Thu, 7 Jan 2016 06:32:07 -0500 Received: from vc2.ecl.ntt.co.jp (vc2.ecl.ntt.co.jp [129.60.86.154]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id u07BW2rU008026; Thu, 7 Jan 2016 20:32:02 +0900 Received: from vc2.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id B9C765F611; Thu, 7 Jan 2016 20:32:02 +0900 (JST) Received: from imail2.m.ecl.ntt.co.jp (imail2.m.ecl.ntt.co.jp [129.60.5.247]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id AA95F5F64D; Thu, 7 Jan 2016 20:32:02 +0900 (JST) Received: from localhost.m.ecl.ntt.co.jp (takuya-think.sic.ecl.ntt.co.jp [129.60.241.50]) by imail2.m.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id u07BTuqg024300; Thu, 7 Jan 2016 20:32:02 +0900 From: Takuya Yoshikawa Subject: [PATCH 2/2] KVM: Remove KVM_REQ_MCLOCK_INPROGRESS to save a bit in vcpu->requests Date: Thu, 7 Jan 2016 20:43:14 +0900 Message-Id: <1452166994-11344-3-git-send-email-yoshikawa_takuya_b1@lab.ntt.co.jp> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1452166994-11344-1-git-send-email-yoshikawa_takuya_b1@lab.ntt.co.jp> References: <1452166994-11344-1-git-send-email-yoshikawa_takuya_b1@lab.ntt.co.jp> To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, Takuya Yoshikawa X-TM-AS-MML: disable Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that we are running out of the bits in vcpu->requests, using one of them just to call kvm_make_all_cpus_request() with a valid request number should be avoided. This patch achieves this by making kvm_make_all_cpus_request() handle an empty request. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/x86.c | 2 -- include/linux/kvm_host.h | 27 +++++++++++++-------------- virt/kvm/kvm_main.c | 8 +++++--- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index b6102c1..88260d0 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1701,8 +1701,6 @@ static void kvm_gen_update_masterclock(struct kvm *kvm) kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu); /* guest entries allowed */ - kvm_for_each_vcpu(i, vcpu, kvm) - clear_bit(KVM_REQ_MCLOCK_INPROGRESS, &vcpu->requests); spin_unlock(&ka->pvclock_gtod_sync_lock); #endif diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index ca9b93e..bb9ae4f 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -131,19 +131,18 @@ static inline bool is_error_page(struct page *page) #define KVM_REQ_PMI 15 #define KVM_REQ_WATCHDOG 16 #define KVM_REQ_MASTERCLOCK_UPDATE 17 -#define KVM_REQ_MCLOCK_INPROGRESS 18 -#define KVM_REQ_EPR_EXIT 19 -#define KVM_REQ_SCAN_IOAPIC 20 -#define KVM_REQ_GLOBAL_CLOCK_UPDATE 21 -#define KVM_REQ_ENABLE_IBS 22 -#define KVM_REQ_DISABLE_IBS 23 -#define KVM_REQ_APIC_PAGE_RELOAD 24 -#define KVM_REQ_SMI 25 -#define KVM_REQ_HV_CRASH 26 -#define KVM_REQ_IOAPIC_EOI_EXIT 27 -#define KVM_REQ_HV_RESET 28 -#define KVM_REQ_HV_EXIT 29 -#define KVM_REQ_HV_STIMER 30 +#define KVM_REQ_EPR_EXIT 18 +#define KVM_REQ_SCAN_IOAPIC 19 +#define KVM_REQ_GLOBAL_CLOCK_UPDATE 20 +#define KVM_REQ_ENABLE_IBS 21 +#define KVM_REQ_DISABLE_IBS 22 +#define KVM_REQ_APIC_PAGE_RELOAD 23 +#define KVM_REQ_SMI 24 +#define KVM_REQ_HV_CRASH 25 +#define KVM_REQ_IOAPIC_EOI_EXIT 26 +#define KVM_REQ_HV_RESET 27 +#define KVM_REQ_HV_EXIT 28 +#define KVM_REQ_HV_STIMER 29 #define KVM_USERSPACE_IRQ_SOURCE_ID 0 #define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1 @@ -685,7 +684,7 @@ void kvm_flush_remote_tlbs(struct kvm *kvm); void kvm_reload_remote_mmus(struct kvm *kvm); void kvm_make_mclock_inprogress_request(struct kvm *kvm); void kvm_make_scan_ioapic_request(struct kvm *kvm); -bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req); +bool kvm_make_all_cpus_request(struct kvm *kvm, int req); long kvm_arch_dev_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg); diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index be3cef1..0100a19 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -156,7 +156,7 @@ static void ack_flush(void *_completed) { } -bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req) +bool kvm_make_all_cpus_request(struct kvm *kvm, int req) { int i, cpu, me; cpumask_var_t cpus; @@ -167,7 +167,9 @@ bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req) me = get_cpu(); kvm_for_each_vcpu(i, vcpu, kvm) { - kvm_make_request(req, vcpu); + if (req >= 0) + kvm_make_request(req, vcpu); + cpu = vcpu->cpu; /* Set ->requests bit before we read ->mode */ @@ -208,7 +210,7 @@ void kvm_reload_remote_mmus(struct kvm *kvm) void kvm_make_mclock_inprogress_request(struct kvm *kvm) { - kvm_make_all_cpus_request(kvm, KVM_REQ_MCLOCK_INPROGRESS); + kvm_make_all_cpus_request(kvm, -1); } void kvm_make_scan_ioapic_request(struct kvm *kvm)