Received: by 10.223.185.116 with SMTP id b49csp6491926wrg; Thu, 8 Mar 2018 08:17:32 -0800 (PST) X-Google-Smtp-Source: AG47ELuuyyyq9YcumsiEfp3+nkAuIlJV4H/pFXvpAnjeOrDPQN6RtntUbK4Xk0fUQQtvY1npe8Ey X-Received: by 10.99.126.19 with SMTP id z19mr21410188pgc.108.1520525852263; Thu, 08 Mar 2018 08:17:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520525852; cv=none; d=google.com; s=arc-20160816; b=0xfs7iKFCv7ElgSokNF6C1WNALuADy57TmqpsVisYMzCUPOn1z3G7JHC9SF8pEiuDP qLKC9uJz04N1jJGUoddz6KF7RQglsl85wRBy5hRF2Klcho8SUtGCf5Lr6icY0xsi8uku +eXLfToOCD5VVEv1aL5IgQRoy7lfGO97lofWYabECOhoojTae9YhH+YXJxn8gbrVHAkO hvkqxCXnio4DOeS7gBYWa1QKhMbBmBdG4vf0rAgQuQbrUrjZF35/QwcEYgitjY1WXJ6M pEOr2/pDBS9HYj/Sy2NgwexCah9NsPqVu/AtrrSRY2gpW9neqAey1fWjGLRixWjt3yBf gfhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=Om+VG4LE6XV+LIIC3GZ7szKiB/nYhVE9LQ123b4qp60=; b=XsWCvwm6DP58HNPywaqiTA0brK0JK49JJEMSrdKf/47Jx0gQD+iPa93EMjIri+69Gh eQIQIKJa9P/ckXsiLF8pUTsDOgmiQdWc6rL7ByISw3jmvKa3eMZ6TqgHL0BWAuQPafTu /UaIqWRk7bCzGRpWjBx3pUDwlBhb2aLYVOrRMu0djHTn16ZMtsX1buTXwP8kqP+NYDfJ 08rdi1I1gFoeuBEKOqBMDTawKYL3RtWWaJyJqltVGXoernOWvCU0aqVBzyUXzJS3mlVL RD7J0eZxDDsW+gzEomS/wYxFT7J9wrFGk/4r35IfbUPhgiPtPgXQ514Zd9Tm2i22+ISs FDIw== 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 e11si13026055pgn.261.2018.03.08.08.17.17; Thu, 08 Mar 2018 08:17:32 -0800 (PST) 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 S1756007AbeCHQQT (ORCPT + 99 others); Thu, 8 Mar 2018 11:16:19 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:58624 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752059AbeCHQQS (ORCPT ); Thu, 8 Mar 2018 11:16:18 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7BB2D87ABA; Thu, 8 Mar 2018 16:16:17 +0000 (UTC) Received: from flask (unknown [10.43.2.80]) by smtp.corp.redhat.com (Postfix) with SMTP id 222CE10A7E22; Thu, 8 Mar 2018 16:16:15 +0000 (UTC) Received: by flask (sSMTP sendmail emulation); Thu, 08 Mar 2018 17:15:36 +0100 Date: Thu, 8 Mar 2018 17:15:36 +0100 From: "rkrcmar@redhat.com" To: Tianyu Lan Cc: "pbonzini@redhat.com" , "tglx@linutronix.de" , "mingo@redhat.com" , "hpa@zytor.com" , "x86@kernel.org" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] KVM/X86: Check input sreg values before loading vcpu Message-ID: <20180308161536.GH12290@flask> References: <1519714664-2649-1-git-send-email-Tianyu.Lan@microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1519714664-2649-1-git-send-email-Tianyu.Lan@microsoft.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 08 Mar 2018 16:16:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 08 Mar 2018 16:16:17 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'rkrcmar@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-02-27 06:57+0000, Tianyu Lan: > From: Lan Tianyu > > This patch is to check sreg value first and then load vcpu in order > to avoid redundant loading/putting vcpu. > > Signed-off-by: Lan Tianyu > --- Patch "KVM: x86: KVM_CAP_SYNC_REGS" made significant changes to the sregs setter, so the patch cannot be applied in current form. I think that moving the X86_CR4_OSXSAVE check to guest_cpuid_has still makes sense, but avoiding the vcpu_load/put would produce worse code elsewhere and avoiding the load/put is not critical as any error is probably going to be the end for this VM. Thanks.