Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4700182imw; Tue, 12 Jul 2022 12:40:33 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vwZcgc79/aYuf1/HSZJCBiYEkJO/b5ketNJXbRsbLfK1Ym9pnTKqN16+SfkgeINAZSQCBU X-Received: by 2002:a17:907:97c8:b0:72b:1cc7:3c4d with SMTP id js8-20020a17090797c800b0072b1cc73c4dmr25157754ejc.217.1657654833153; Tue, 12 Jul 2022 12:40:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657654833; cv=none; d=google.com; s=arc-20160816; b=SGRg8Rx0zIw2bJgsDQp2hDBBfJJinhsZ/1Z6ZoJ29pix7ED6ZMwFJHKqQ8o26qcXl2 8o7JSUhzCZg8y45aGT9f8VLlL5WCGEXiu52WE/lnwj2nniFlZ83kfX1GQPw/H8XYjOGd nQ8FZpyf7o//uMOqYUdi3mXlFe5xaMKlQGuV9cgITOJcXFA7n9te4jKe64HGvjncShx0 izP5mODIuYCGeHYgTvQPMVJFRdgBW2wwp1lDHqjjdQgtuzCKNaPbxBVRnN/eW7ACini+ ZxTPopOKp/RmcaBMF2Ocso7C3I9XSIrmU53Zp6UQ7Wb0P89uIbNfLybLVsx4x2vF0huQ JT5g== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FdeK4EK0VU0popbzRa6VQgjTOAR+L4/UFaIlPg/ulTg=; b=oUy/lVvTjfz24e1bxY22esVLcU9JaoTbabYcmKo65l7IVXAyPXBJl/02zHa01t6Uyq AuG2xkdJwGvDJVebtVYuTOgTIBeZHzVaFr37CgaEhLynKjKlFv11o8wyxCfVlwOXsXFS SDYNcbCXxpkCaeB++oIyMV4MAww9vSpPpCuH+YgP3C8iAf19UwnwyhzWyNYsMCgiXVQZ DhmX+hTPYP+2R3KHnpwInli1Wsb0HLp400YTZkeKh9e7drNYqMOaJkYF2eF042umm0SM z0oYm6xs2C91X0cLW52reK9sYzHAw+XrKbTZD4sVSi20rgrlH4OXVgxOcjzBDR3dpx/p Rxqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Isg4KN78; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd22-20020a1709069b9600b0072b505d08a2si11921184ejc.804.2022.07.12.12.40.08; Tue, 12 Jul 2022 12:40:33 -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=@linuxfoundation.org header.s=korg header.b=Isg4KN78; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235083AbiGLTMp (ORCPT + 99 others); Tue, 12 Jul 2022 15:12:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235859AbiGLTMS (ORCPT ); Tue, 12 Jul 2022 15:12:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79BD8E680D; Tue, 12 Jul 2022 11:53:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 06ABE61274; Tue, 12 Jul 2022 18:53:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AF12C3411C; Tue, 12 Jul 2022 18:53:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657651990; bh=Blu1wDuwQwj1vl2Ovptffjjz0/kzFxLq7KwHo/jSTCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Isg4KN78xrGIwbjoeH/Nqi7OSN2EgB/+u20yPVlhHebmSl2uyzhnTJpfi9PnMEGvz MvguOJlP2exU1MXPQzaOBP17vBOCvgqKCoeNOz5fDF33IckBX7hrbWrBXCGF8V+cBW bIqvG5eoMe5tA+YnqhHjmKIzIkSsWpCLNYWGhnVM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Peter Zijlstra (Intel)" , Borislav Petkov , Thadeu Lima de Souza Cascardo Subject: [PATCH 5.18 06/61] x86/kvm/vmx: Make noinstr clean Date: Tue, 12 Jul 2022 20:39:03 +0200 Message-Id: <20220712183237.195528665@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220712183236.931648980@linuxfoundation.org> References: <20220712183236.931648980@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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: Peter Zijlstra commit 742ab6df974ae8384a2dd213db1a3a06cf6d8936 upstream. The recent mmio_stale_data fixes broke the noinstr constraints: vmlinux.o: warning: objtool: vmx_vcpu_enter_exit+0x15b: call to wrmsrl.constprop.0() leaves .noinstr.text section vmlinux.o: warning: objtool: vmx_vcpu_enter_exit+0x1bf: call to kvm_arch_has_assigned_device() leaves .noinstr.text section make it all happy again. Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Borislav Petkov Signed-off-by: Thadeu Lima de Souza Cascardo Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/vmx/vmx.c | 6 +++--- arch/x86/kvm/x86.c | 4 ++-- include/linux/kvm_host.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -383,9 +383,9 @@ static __always_inline void vmx_disable_ if (!vmx->disable_fb_clear) return; - rdmsrl(MSR_IA32_MCU_OPT_CTRL, msr); + msr = __rdmsr(MSR_IA32_MCU_OPT_CTRL); msr |= FB_CLEAR_DIS; - wrmsrl(MSR_IA32_MCU_OPT_CTRL, msr); + native_wrmsrl(MSR_IA32_MCU_OPT_CTRL, msr); /* Cache the MSR value to avoid reading it later */ vmx->msr_ia32_mcu_opt_ctrl = msr; } @@ -396,7 +396,7 @@ static __always_inline void vmx_enable_f return; vmx->msr_ia32_mcu_opt_ctrl &= ~FB_CLEAR_DIS; - wrmsrl(MSR_IA32_MCU_OPT_CTRL, vmx->msr_ia32_mcu_opt_ctrl); + native_wrmsrl(MSR_IA32_MCU_OPT_CTRL, vmx->msr_ia32_mcu_opt_ctrl); } static void vmx_update_fb_clear_dis(struct kvm_vcpu *vcpu, struct vcpu_vmx *vmx) --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -12531,9 +12531,9 @@ void kvm_arch_end_assignment(struct kvm } EXPORT_SYMBOL_GPL(kvm_arch_end_assignment); -bool kvm_arch_has_assigned_device(struct kvm *kvm) +bool noinstr kvm_arch_has_assigned_device(struct kvm *kvm) { - return atomic_read(&kvm->arch.assigned_device_count); + return arch_atomic_read(&kvm->arch.assigned_device_count); } EXPORT_SYMBOL_GPL(kvm_arch_has_assigned_device); --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -1511,7 +1511,7 @@ static inline void kvm_arch_end_assignme { } -static inline bool kvm_arch_has_assigned_device(struct kvm *kvm) +static __always_inline bool kvm_arch_has_assigned_device(struct kvm *kvm) { return false; }