Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1684167ybi; Thu, 20 Jun 2019 01:56:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4UjZwbXahyGg6PcIf4/AlYkGKst6k8nb7ZL26A1BDISz6LiLOlM4XUpdcqEkc6WH6h7kR X-Received: by 2002:a17:902:2862:: with SMTP id e89mr124803100plb.258.1561020965914; Thu, 20 Jun 2019 01:56:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561020965; cv=none; d=google.com; s=arc-20160816; b=y6F3Y7ugk700IgZxDxyvZ+ZECIvDJmetQmcHpTHZVQkaIHCGEe4TI40x9OxBoPZGRU QaTbBQNU94yuVq2P6XFGH59usGuzq29jQkepUAAlEXN3bGx8wJageHL1TXhwSIHb18QE JAnoFSVutL8JAGK9c0zAgoRiqG9CuxT2CbbOesBiB/JFDx+097T+4xDH8fsroeLHot+Z iIrYxdVJ8jgUVZEB9u3KJGgqz5Y0RiHvie4jHeoOmqnibZBIBWLHPhR10LHy3llPVwbJ DT61nfoCTd9A8UqVfqL+3sEavVg9xAMWcivSOsEAKQ8vaHwXAdfYudJPKgVO1sGPQX6T hp7w== 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=ZrUXpSYBSjwXLfAVTc9O9NL95+EqsGSEUkxTjv2dIPU=; b=kw/tnIlVdRrbocj9bPOXuSzX0Jp4/Hruv/035E8sgCh6Zx3EVr8ZD2GrDdn3o3L24F b96PdkNrkkJGn7w6nghxetxMfguTaelVyzFXQci1mSF+3kj2xSvbOMQXYVG081RMPfa4 pYSY3+J18zUnuJPmFdNesyi9qM1UtbeTkLTE1piDS6XXbRmGpNdimmMrHeKdBWMGZT+1 6VLePyyoNRu1pErGacjb+FK9KlK/CG9vU1WAqrHdHmSLiVOa4KmWG0cQjZMonvA19NKI +6uj5NtRgTL884zN5JFGeuc8jhpGFkR/L+D09nv+qbhEoAnOvCG/2Xzio+6muYWR83ya R0BQ== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1si19379427plb.337.2019.06.20.01.55.50; Thu, 20 Jun 2019 01:56:05 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726072AbfFTIzP (ORCPT + 99 others); Thu, 20 Jun 2019 04:55:15 -0400 Received: from mga09.intel.com ([134.134.136.24]:60921 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731736AbfFTIzJ (ORCPT ); Thu, 20 Jun 2019 04:55:09 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jun 2019 01:55:09 -0700 X-IronPort-AV: E=Sophos;i="5.63,396,1557212400"; d="scan'208";a="154057431" Received: from xiaoyaol-mobl.ccr.corp.intel.com (HELO [10.239.13.123]) ([10.239.13.123]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/AES256-SHA; 20 Jun 2019 01:55:07 -0700 Subject: Re: [PATCH] KVM: vmx: Fix the broken usage of vmx_xsaves_supported To: Paolo Bonzini , 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: Xiaoyao Li Message-ID: <2032f811-b583-eca1-3ece-d1e95738ff64@linux.intel.com> Date: Thu, 20 Jun 2019 16:55:05 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed 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 6/20/2019 4:17 PM, Paolo Bonzini wrote: > 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. > At this point. Agreed. It's harmless to set a default value. > 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. SECONDARY_EXEC_XSAVES is in the opt when setup_vmcs_config, and vmx_compute_secondary_exec_control() is to clear SECONDARY_EXEC_XSAVES based on guest cpuid. > 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. you mean this part about XSS_EXIT_BITMAP? how about the other part in vmx_set/get_msr() in this patch? > Paolo >