Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1653973ybi; Thu, 20 Jun 2019 01:18:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7kvok7EHOhuPFZ/koXhFEYu2fvzrNgVOSU3PeZq1YFdZBJoKH2VVRELoZ6yZ1PMNqM+/q X-Received: by 2002:a17:902:6b07:: with SMTP id o7mr101062801plk.180.1561018680004; Thu, 20 Jun 2019 01:18:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561018679; cv=none; d=google.com; s=arc-20160816; b=HQwDYlPNtnMaU3Uqprh6q3xvPiqkAFi9+j8uzxfE+y2HchFqag4xJdRovokArMLZi7 MHTKoO1HKURKxWCgF3mV39bpLL9fg1SNRyuUcxtmY6W914FNlI1xg8qU3zHtfxE/UAeV qY/x6XX7Sg5NQeYwYegnLzqqr7xl+wp2JuNm9ljfRtxkKT574omAJHfGAcAV2WP04KqJ ElGdbYW0NbMTriXplGy8JP4dJ7QvL+VAFVUMFvOV3I6sk8VpibTu54UoB1O0GGz8LKUK LvuSGJ1BP9ggPF8m4tNsppOBpbtfyJkJJ2LKNVSyXrtN2Ixjt7eqt0GxcvsZFVTQrj0D e7sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=sFGIfcUZjU/cwOWwsrC6pPBswmDh2q5+9s+Y8U5BUlc=; b=TiQIbU7EywgyD/Gu7oqmoZcKW1y3l2o80gkty+9+5ACaSbu4V0n3QH4vxau2c/h4UC 5Y2di+D3carr+CarZ+b1F18DJxChYwyT6U+TEm64DfZgP4UAAQcj2iI1RpX8ruM/i3QP NedwJAxKJX2tWVVy08ZH+kuUy/qgecyDOXRvtCJppDuriLAKCyU8sc3u4sgTgdlMHv/u IUZk28GCtnQcrs+ZD2oFnY1sbbUQyHTTIaDD6d3jwvsGoRwU0f6jwM+hHi7g1/0WRfYC q5WMeBC/RhfOS9mT1xgT0sqvfZFbpjiJ8pb17EVrlzekvM0gBDPT0N5HSkyitIKoMiW1 eZbA== 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 132si18569667pfc.57.2019.06.20.01.17.43; Thu, 20 Jun 2019 01:17:59 -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 S1726185AbfFTIRd (ORCPT + 99 others); Thu, 20 Jun 2019 04:17:33 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:53237 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725966AbfFTIRc (ORCPT ); Thu, 20 Jun 2019 04:17:32 -0400 Received: by mail-wm1-f66.google.com with SMTP id s3so2081446wms.2 for ; Thu, 20 Jun 2019 01:17:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=sFGIfcUZjU/cwOWwsrC6pPBswmDh2q5+9s+Y8U5BUlc=; b=Ume/80BZi4tPC8zUHlN7IHziNvG79rCPvpMt+ysT7WSR5GKPmYGz3b3sAp49In3BkB OUE9MP7xKU8I0O+TAqNqSidQJEXLfwykQemh18pRjdwVfnNBMQeO2qdyPbvhXdaQ/kI8 R2r4Smz1whPtSecU3904erQxsybAQN8UKvaQr1R6f9LeZypVapc90dZLDFLudtGPrFjE BI2KnKEoTMDD/66dZspJZhR0vPdni23xRFoSRO8k+YeCPuf42AC3aTwS5QWrJe0G3Y4g Q9oLhdJ/+F1SWKrN10mWIook7ePhlwh9uIjYNKjxH7UEtk65CXqV671xB9WGMLDEC/fw v5zA== X-Gm-Message-State: APjAAAWNRvhya+w+D3Tj6jxBPfnu5sLBiEEzurDPRX4NQf9Z+a7ScVGa aN1+gZVOq9i7wt2n4Lf4E3tazQL65hw= X-Received: by 2002:a1c:a5c8:: with SMTP id o191mr1732649wme.84.1561018650331; Thu, 20 Jun 2019 01:17:30 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:7822:aa18:a9d8:39ab? ([2001:b07:6468:f312:7822:aa18:a9d8:39ab]) by smtp.gmail.com with ESMTPSA id v67sm4998541wme.24.2019.06.20.01.17.29 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 01:17:29 -0700 (PDT) Subject: Re: [PATCH] KVM: vmx: Fix the broken usage of vmx_xsaves_supported To: Xiaoyao Li , Wanpeng Li , Tao Xu Cc: Radim Krcmar , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , kvm , LKML References: <20190620050301.1149-1-tao3.xu@intel.com> From: Paolo Bonzini Message-ID: Date: Thu, 20 Jun 2019 10:17:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/06/19 08:46, Xiaoyao Li wrote: >> >> It depends on whether or not processors support the 1-setting instead >> of “enable XSAVES/XRSTORS” is 1 in VM-exection control field. Anyway, > > Yes, whether this field exist or not depends on whether processors > support the 1-setting. > > But if "enable XSAVES/XRSTORS" is clear to 0, XSS_EXIT_BITMAP doesn't > work. I think in this case, there is no need to set this vmcs field? vmx->secondary_exec_control can change; you are making the code more complex by relying on the value of the field at the point of vmx_vcpu_setup. I do _think_ your version is incorrect, because at this point CPUID has not been initialized yet and therefore vmx_compute_secondary_exec_control has not set SECONDARY_EXEC_XSAVES. However I may be wrong because I didn't review the code very closely: the old code is obvious and so there is no point in changing it. Paolo