Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3645637imm; Fri, 25 May 2018 09:07:11 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpfQvkeojE3aISibWdrloyOUx352Fo6sWli77UaQwIaNBt8iHlAH9dd2/g72/SL6opFZS+C X-Received: by 2002:a63:89c2:: with SMTP id v185-v6mr2479192pgd.196.1527264431060; Fri, 25 May 2018 09:07:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527264431; cv=none; d=google.com; s=arc-20160816; b=OlupaH5JxT7xrkJXsP/gLOyTh9O86UJdyLgpVJ8oWSDaeazLtw/f/Jl55s/pO6mi6l rbBiYIFzBgGRkR/5KonuQE7Clkb7EbPF+8s4zjvlRPhA16rROJ2pH97bBpYxoScNN3cY wu4bGtqn+uWROoY6T3QC3XHWW92+ijPzwEj5b/+dnDMZp53AyxAs9nKcGYb4nQnqN3yL LFTuocjU4Fjb4WfVhc4BRbuNx+Xrsi+OYIxsdEa0Nkvqn0qzh52NYCUVoxu8XlPIplku nmbN5OKDtSspiE01rV5FiMYuWCKPc/7nvBYhzbGGCOHEzgR2zvaichZzImJR9lw+qXaD vTPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from :arc-authentication-results; bh=7lti+WqVui7aL04S8fHlZGRRZzVEGdl7p4rcncZmsuo=; b=gmxqE1E6fyxLQsPe4FLIM060pADCmaNmSZnl1WHczHr84miug/GhlgpgB6L9oB+1sP K26RQP+/BuC+DMs6U+aiUOpLM0m+x6i3cIGf0W6zzP/FjLXPU934aw+b4y6XiZkyHrxB bjptTAxgXHN0lQqPsRgV8menBEPWQDqNG53NdEOmE21ssXKjXbRirs9gjrcJ2UXOiG1B ejFkke3ueWPGQ/0CJPFLjsP8I5D+3UBYAshgd+9eOXzBS9nDsGctl4I5weFJKae7Tq0i 5LHinojyP/sn/LmCQPrLY8Vfq/B69c/YUK4HVMqLwiNsfPqNWrQNFyXn610kUTg0uUKq WUww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 189-v6si19100611pgi.254.2018.05.25.09.06.55; Fri, 25 May 2018 09:07:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967081AbeEYQG1 (ORCPT + 99 others); Fri, 25 May 2018 12:06:27 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:41488 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S966464AbeEYQG0 (ORCPT ); Fri, 25 May 2018 12:06:26 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 84EC54071188; Fri, 25 May 2018 16:06:25 +0000 (UTC) Received: from vitty.brq.redhat.com.redhat.com (unknown [10.40.205.154]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F0BCA1C65D; Fri, 25 May 2018 16:06:19 +0000 (UTC) From: Vitaly Kuznetsov To: Arnd Bergmann Cc: Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Lan Tianyu , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Jim Mattson , Wanpeng Li , David Hildenbrand , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] KVM: x86: VMX: fix building without CONFIG_HYPERV References: <20180525153640.3228067-1-arnd@arndb.de> Date: Fri, 25 May 2018 18:06:18 +0200 In-Reply-To: <20180525153640.3228067-1-arnd@arndb.de> (Arnd Bergmann's message of "Fri, 25 May 2018 17:36:17 +0200") Message-ID: <87d0xjwwhx.fsf@vitty.brq.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 25 May 2018 16:06:25 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 25 May 2018 16:06:25 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'vkuznets@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Arnd Bergmann writes: > The global ms_hyperv variable is part of the hyperv support, so > we get a link error from accessing it in kernels that have this > turned off: > > arch/x86/kvm/vmx.o: In function `alloc_loaded_vmcs': > vmx.c:(.text+0x1654a): undefined reference to `ms_hyperv' > vmx.c:(.text+0x1657a): undefined reference to `ms_hyperv' > > This changes the condition to first check the compile-time > configuration symbol to avoid the link error. > > Fixes: ceef7d10dfb6 ("KVM: x86: VMX: hyper-v: Enlightened MSR-Bitmap support") > Signed-off-by: Arnd Bergmann Thanks, Reviewed-by: Vitaly Kuznetsov (I don't really like this IS_ENABLED(CONFIG_HYPERV) spreading across KVM but keeping stuff like this ms_hyperv structure defined when !IS_ENABLED(CONFIG_HYPERV) is also ugly. It may make sense to define helpers similar to kvm_para_has_feature() and define them to 'false' when Hyper-V support code is compiled out. I'll look into this option later, this patch should be taken to fix the immediate issue). > --- > arch/x86/kvm/vmx.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index ea098131dcce..e6d6ccab43c3 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -4232,7 +4232,8 @@ static int alloc_loaded_vmcs(struct loaded_vmcs *loaded_vmcs) > goto out_vmcs; > memset(loaded_vmcs->msr_bitmap, 0xff, PAGE_SIZE); > > - if (static_branch_unlikely(&enable_evmcs) && > + if (IS_ENABLED(CONFIG_HYPERV) && > + static_branch_unlikely(&enable_evmcs) && > (ms_hyperv.nested_features & HV_X64_NESTED_MSR_BITMAP)) { > struct hv_enlightened_vmcs *evmcs = > (struct hv_enlightened_vmcs *)loaded_vmcs->vmcs; -- Vitaly