Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1433862rwe; Thu, 1 Sep 2022 19:31:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR4e1lPP2meeRmZ+xGC/66vjBVsebfVvWb2d0nuztoBChOFfgDqKsFUoL4VO36YTDNp5ciSj X-Received: by 2002:a17:907:60c7:b0:731:2be4:f72d with SMTP id hv7-20020a17090760c700b007312be4f72dmr25869913ejc.639.1662085892038; Thu, 01 Sep 2022 19:31:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662085892; cv=none; d=google.com; s=arc-20160816; b=m3WwPOi2DAVZ2qXxo3gnS9pxqikS8CBrn3td5o8elF7cl8dcbXcPwpOl0y6T11ZqAX Ge1DY9EQNO1ltxSBAPmAIxBgFK1rL++H4GE4zafDp5MJhsB+mBt7EUXD69oRZQKN2hOB jgtKI7sxP7QJFQfcR4TsaHbCIUtiOnDbzYxEjYe43l0v5O+6RNGs87NfaEC9rfnwszE7 9ZqUM2K2xCP6uxhacACYOOFIFGLOwS2BH2nNkKVOiSzQWNRkq7n01jx61uGN/W064uG/ /LhbLdOrUGtB68S0g9NMFz0nDfajJkDyyz3SWoMCq63gOfXlcaIHuOZDHMK3A/gwFjZB 19Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=24OjAYCGnT1F3qD5Dz8XC25IN5P1KYsva/Km6EMKrRI=; b=0AuwK2rxyOH8rj5nUaeG/Hbo7JzQLOFn4M+5YYD5uGR5KVgctzSd0BTmB7XgNgmDL6 Z7iSyYnUcnDm8YZUrCs7xefI4rsiUKE3IVUXcT1yhNb4YTAdDu2BcCfCs2jt1zA+yhcD Uk2u/f778frsfKFGvgo7f2yZeD4rWFPqfQmH6FzmJxEqtJS5Q3C+4ZKoJ0ejVuTb2Kw+ wrjnbALgrLemJJOUUlKXW+mLZf1mvjSqcy+e0zZmq9df+WrM9UPNodM7/XeQFuFY5ScB 5G1zAYrYDVHXKNDUF4sa0n4Gj+lABJpuL5H/Q9A9fyaRBV8JYtHBCdy3BWGEe2UNcnAP yxjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ksyNIr5d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z8-20020a50eb48000000b00445b1de8270si559397edp.608.2022.09.01.19.31.06; Thu, 01 Sep 2022 19:31:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ksyNIr5d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235404AbiIBCT5 (ORCPT + 99 others); Thu, 1 Sep 2022 22:19:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234852AbiIBCS3 (ORCPT ); Thu, 1 Sep 2022 22:18:29 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07EABAB04B; Thu, 1 Sep 2022 19:18:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662085101; x=1693621101; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=n2jr9DdfRbZsXaFA0LJya90JyQP+3BfsD0hNGT1Sqww=; b=ksyNIr5dmVGSsnno3StbWgY01nRAWKXmZeCbX1tyIHyPs6EDQW3l9xkC y3HSe4zbGbdf6X9aR7DVId38L3EoUHAZANyD48v2fOob35rsm7FNiQmmv rL9OYMw4lHbVDPcvf2LfBuQGxRAfjpUqH/NvwAjysSnbG7kp6I193gwAa Zaf0Htrm71va5E4O7un0LW5NwhAScmuaEBSeABYMo/I3T3gV1xQdzJEEj FhT6AuOhV6sX7mFRd1qpLnLinxRTpbLi6cqTNJ2WIhUA8N7q9F4nvpwpY MAgokRQ8mIXXPRwhHGGpszOr4e5RQfTpSZNjZ+xuV76yTerB89rCQN2Zs g==; X-IronPort-AV: E=McAfee;i="6500,9779,10457"; a="297157866" X-IronPort-AV: E=Sophos;i="5.93,281,1654585200"; d="scan'208";a="297157866" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2022 19:18:20 -0700 X-IronPort-AV: E=Sophos;i="5.93,281,1654585200"; d="scan'208";a="608835668" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2022 19:18:20 -0700 From: isaku.yamahata@intel.com To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson , Thomas Gleixner , Marc Zyngier , Will Deacon Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Kai Huang , Chao Gao , Atish Patra , Shaokun Zhang , Qi Liu , John Garry , Daniel Lezcano , Huang Ying , Huacai Chen , Dave Hansen , Borislav Petkov Subject: [PATCH v3 19/22] KVM: x86: Delete kvm_arch_hardware_enable/disable() Date: Thu, 1 Sep 2022 19:17:54 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Isaku Yamahata Now they're function call and there is no point to keep them. Opportunistically make kvm_arch_pre_hardware_unsetup() empty. Suggested-by: Sean Christopherson Signed-off-by: Isaku Yamahata --- arch/x86/kvm/x86.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index fa68bea655f0..f0382f3d5baf 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -354,7 +354,7 @@ static void kvm_on_user_return(struct user_return_notifier *urn) /* * Disabling irqs at this point since the following code could be - * interrupted and executed through kvm_arch_hardware_disable() + * interrupted and executed through hardware_disable() */ local_irq_save(flags); if (msrs->registered) { @@ -11834,17 +11834,6 @@ void kvm_vcpu_deliver_sipi_vector(struct kvm_vcpu *vcpu, u8 vector) } EXPORT_SYMBOL_GPL(kvm_vcpu_deliver_sipi_vector); -int kvm_arch_hardware_enable(void) -{ - return static_call(kvm_x86_hardware_enable)(); -} - -void kvm_arch_hardware_disable(void) -{ - static_call(kvm_x86_hardware_disable)(); - drop_user_return_notifiers(); -} - static cpumask_t cpus_hardware_enabled = CPU_MASK_NONE; static int __hardware_enable(void *caller_name) @@ -11856,7 +11845,7 @@ static int __hardware_enable(void *caller_name) if (cpumask_test_cpu(cpu, &cpus_hardware_enabled)) return 0; - r = kvm_arch_hardware_enable(); + r = static_call(kvm_x86_hardware_enable)(); if (r) pr_warn("kvm: enabling virtualization on CPU%d failed during %s()\n", cpu, (const char *)caller_name); @@ -11882,12 +11871,13 @@ static void hardware_disable(void *junk) if (!cpumask_test_cpu(cpu, &cpus_hardware_enabled)) return; cpumask_clear_cpu(cpu, &cpus_hardware_enabled); - kvm_arch_hardware_disable(); + static_call(kvm_x86_hardware_disable)(); + drop_user_return_notifiers(); } void kvm_arch_pre_hardware_unsetup(void) { - on_each_cpu(hardware_disable, NULL, 1); + /* TODO: eliminate this function */ } /* @@ -11978,7 +11968,7 @@ void kvm_arch_resume(int usage_count) if (kvm_arch_check_processor_compat()) return; - if (kvm_arch_hardware_enable()) + if (static_call(kvm_x86_hardware_enable)()) return; local_tsc = rdtsc(); @@ -12119,6 +12109,8 @@ int kvm_arch_hardware_setup(void *opaque) void kvm_arch_hardware_unsetup(void) { + on_each_cpu(hardware_disable, NULL, 1); + kvm_unregister_perf_callbacks(); static_call(kvm_x86_hardware_unsetup)(); -- 2.25.1