From patchwork Tue Mar 20 19:17:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 10297755 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EF6F9600F6 for ; Tue, 20 Mar 2018 19:18:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E08C327F8E for ; Tue, 20 Mar 2018 19:18:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D52BE28BF6; Tue, 20 Mar 2018 19:18:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72BAD27F8E for ; Tue, 20 Mar 2018 19:18:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751550AbeCTTSR (ORCPT ); Tue, 20 Mar 2018 15:18:17 -0400 Received: from mga17.intel.com ([192.55.52.151]:9473 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751317AbeCTTSP (ORCPT ); Tue, 20 Mar 2018 15:18:15 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Mar 2018 12:18:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,336,1517904000"; d="scan'208";a="36662449" Received: from sjchrist-meh.jf.intel.com ([10.54.75.132]) by orsmga003.jf.intel.com with ESMTP; 20 Mar 2018 12:18:14 -0700 From: Sean Christopherson To: kvm@vger.kernel.org, pbonzini@redhat.com, rkrcmar@redhat.com Cc: thomas.lendacky@amd.com, brijesh.singh@amd.com, suravee.suthikulpanit@amd.com, Sean Christopherson Subject: [PATCH 5/5] KVM: SVM: rename svm_vm_data_hash[_lock] to kvm_svm_hash[_lock] Date: Tue, 20 Mar 2018 12:17:22 -0700 Message-Id: <1521573442-12206-6-git-send-email-sean.j.christopherson@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521573442-12206-1-git-send-email-sean.j.christopherson@intel.com> References: <1521573442-12206-1-git-send-email-sean.j.christopherson@intel.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The information that is ultimately consumed when walking through the hash is now stored in struct kvm_svm, e.g. avic_vm_id. Rename the hash variables so that their nomenclature is consistent with the new struct and its usage. Cc: Tom Lendacky Cc: Brijesh Singh Cc: Suravee Suthikulpanit Signed-off-by: Sean Christopherson --- arch/x86/kvm/svm.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 540721d..5a20f2e 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -1116,11 +1116,11 @@ static void disable_nmi_singlestep(struct vcpu_svm *svm) * when handling AMD IOMMU GALOG notification to schedule in * a particular vCPU. */ -#define SVM_VM_DATA_HASH_BITS 8 -static DEFINE_HASHTABLE(svm_vm_data_hash, SVM_VM_DATA_HASH_BITS); +#define KVM_SVM_HASH_BITS 8 +static DEFINE_HASHTABLE(kvm_svm_hash, KVM_SVM_HASH_BITS); static u32 next_vm_id = 0; static bool next_vm_id_wrapped = 0; -static DEFINE_SPINLOCK(svm_vm_data_hash_lock); +static DEFINE_SPINLOCK(kvm_svm_hash_lock); /* Note: * This function is called from IOMMU driver to notify @@ -1136,14 +1136,14 @@ static int avic_ga_log_notifier(u32 ga_tag) pr_debug("SVM: %s: vm_id=%#x, vcpu_id=%#x\n", __func__, vm_id, vcpu_id); - spin_lock_irqsave(&svm_vm_data_hash_lock, flags); - hash_for_each_possible(svm_vm_data_hash, kvm_svm, hnode, vm_id) { + spin_lock_irqsave(&kvm_svm_hash_lock, flags); + hash_for_each_possible(kvm_svm_hash, kvm_svm, hnode, vm_id) { if (kvm_svm->avic_vm_id != vm_id) continue; vcpu = kvm_get_vcpu_by_id(&kvm_svm->kvm, vcpu_id); break; } - spin_unlock_irqrestore(&svm_vm_data_hash_lock, flags); + spin_unlock_irqrestore(&kvm_svm_hash_lock, flags); /* Note: * At this point, the IOMMU should have already set the pending @@ -1791,9 +1791,9 @@ static void avic_vm_destroy(struct kvm *kvm) if (kvm_svm->avic_physical_id_table_page) __free_page(kvm_svm->avic_physical_id_table_page); - spin_lock_irqsave(&svm_vm_data_hash_lock, flags); + spin_lock_irqsave(&kvm_svm_hash_lock, flags); hash_del(&kvm_svm->hnode); - spin_unlock_irqrestore(&svm_vm_data_hash_lock, flags); + spin_unlock_irqrestore(&kvm_svm_hash_lock, flags); } static void svm_vm_destroy(struct kvm *kvm) @@ -1831,7 +1831,7 @@ static int avic_vm_init(struct kvm *kvm) kvm_svm->avic_logical_id_table_page = l_page; clear_page(page_address(l_page)); - spin_lock_irqsave(&svm_vm_data_hash_lock, flags); + spin_lock_irqsave(&kvm_svm_hash_lock, flags); again: vm_id = next_vm_id = (next_vm_id + 1) & AVIC_VM_ID_MASK; if (vm_id == 0) { /* id is 1-based, zero is not okay */ @@ -1840,14 +1840,14 @@ static int avic_vm_init(struct kvm *kvm) } /* Is it still in use? Only possible if wrapped at least once */ if (next_vm_id_wrapped) { - hash_for_each_possible(svm_vm_data_hash, k2, hnode, vm_id) { + hash_for_each_possible(kvm_svm_hash, k2, hnode, vm_id) { if (k2->avic_vm_id == vm_id) goto again; } } kvm_svm->avic_vm_id = vm_id; - hash_add(svm_vm_data_hash, &kvm_svm->hnode, kvm_svm->avic_vm_id); - spin_unlock_irqrestore(&svm_vm_data_hash_lock, flags); + hash_add(kvm_svm_hash, &kvm_svm->hnode, kvm_svm->avic_vm_id); + spin_unlock_irqrestore(&kvm_svm_hash_lock, flags); return 0;