Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp198849pxb; Tue, 28 Sep 2021 19:21:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzmBb83mdznXtuM5rBRkKjHse76usWborTmkHruE2r26jp4OwUHrV/9qfubUlte34UWz0E X-Received: by 2002:a17:902:8d8c:b0:13d:be20:e279 with SMTP id v12-20020a1709028d8c00b0013dbe20e279mr718941plo.5.1632882107629; Tue, 28 Sep 2021 19:21:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632882107; cv=none; d=google.com; s=arc-20160816; b=oFwUknpftzTNIe2IucXiZQv9cnMz4F//h4yPDx1tLa9xFn7FFg7eH4czD4AZsuCqDf eq3IBkPwbxPZG5d/aHSyLSUbaL8UltTpiMvIyRld8uNs3ddRUZ8tdMRKumtI8y11Xo/G wHyco4gd9u0TTNBTz7VYQkTMPbw4BRpXsJPtz4KtcKpeL42I9FvSDHCVkbgj6/BBRmRq TQCTWQMvivzC1G2kntzYat+TAGkHXOzmJzH6OulmURpwzYe+eDDgYxkuDwotbeWTQNB/ XSqHmR0FooDeYgSG7N3zMHIn8ZaUZWwQETYUN1JYQkPgKc2uHRXT80/QBzPsT732Zw1g GJag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :dlp-version:dlp-reaction:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=WedAvFUZXeEGAp01IEoMKRAg6oFauE8Y45SAqm89A8w=; b=jQWwnX7CQFlSnbK4dtSiWBeC+yYS124mxO4cqG6AuxrObMEIaAjOBDVLRldYRTzvqQ +6Wy8nO4fvGUeUPKi3Mu0Cz4MokWd5NepVczxL2cN0f4N4Dgb7JdTXVFoi1Td2Nmy7ab 0VAFepo1UvOKA67Mvf5eX/54+krHxnbtyH3n3Cn0mqsNgl+h9sbMlExQoOn5cSj2dRqd sGRR0/LtLsfcHUUPLdT57eC/XQx+mRSyu3r+85sAZHq8qMryRztSnNjEYgz54Z29QvRk gLJd0PG3Woxh4uts0tQqGXuELiuAF96lPdrTCLrnzeXpSF9XLGke2H3cYbZiwD3ZYg/3 P1jw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id v6si1170728pgj.427.2021.09.28.19.21.34; Tue, 28 Sep 2021 19:21:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S243694AbhI2CRE convert rfc822-to-8bit (ORCPT + 99 others); Tue, 28 Sep 2021 22:17:04 -0400 Received: from mga17.intel.com ([192.55.52.151]:63690 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243628AbhI2CRD (ORCPT ); Tue, 28 Sep 2021 22:17:03 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10121"; a="204994181" X-IronPort-AV: E=Sophos;i="5.85,331,1624345200"; d="scan'208";a="204994181" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2021 19:15:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,331,1624345200"; d="scan'208";a="554425552" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by FMSMGA003.fm.intel.com with ESMTP; 28 Sep 2021 19:15:09 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 28 Sep 2021 19:15:09 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 28 Sep 2021 19:15:08 -0700 Received: from fmsmsx610.amr.corp.intel.com ([10.18.126.90]) by fmsmsx610.amr.corp.intel.com ([10.18.126.90]) with mapi id 15.01.2242.012; Tue, 28 Sep 2021 19:15:08 -0700 From: "Luck, Tony" To: "Yu, Fenghua" CC: "Hansen, Dave" , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "Peter Zijlstra (Intel)" , Lu Baolu , Joerg Roedel , Josh Poimboeuf , "Jiang, Dave" , "Pan, Jacob jun" , "Raj, Ashok" , "Shankar, Ravi V" , "iommu@lists.linux-foundation.org" , "the arch/x86 maintainers" , Linux Kernel Mailing List Subject: RE: [PATCH 4/8] x86/traps: Demand-populate PASID MSR via #GP Thread-Topic: [PATCH 4/8] x86/traps: Demand-populate PASID MSR via #GP Thread-Index: AQHXrlppUXtiT4Ul9UCq0y1lpkQn1quyuuKAgAWuhwCAAKRkgIAAyOqAgAB9aAD//53xAIAAfQEA//+wWACAAICAgP//j4cAABJzk4AADh9DwA== Date: Wed, 29 Sep 2021 02:15:08 +0000 Message-ID: <9e12eba3e78e4bc98d550943ff639ebe@intel.com> References: <20210920192349.2602141-5-fenghua.yu@intel.com> <1aae375d-3cd4-4ab8-9c64-9e387916e6c0@www.fastmail.com> <035290e6-d914-a113-ea6c-e845d71069cf@intel.com> <3f97b77e-a609-997b-3be7-f44ff7312b0d@intel.com> <840148c7b70f4358852c4f1ccbc5d567@intel.com> In-Reply-To: <840148c7b70f4358852c4f1ccbc5d567@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.200.16 x-originating-ip: [10.1.200.100] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >> if (!(xsave->header.xfeatures & fmask)) { >> xsave->header.xfeatures |= fmask; //<<<<< >> xsaves(xsave, fmask); >> } > > I'm not sure why the FPU state is initialized here. > > For updating the PASID state, it's unnecessary to init the PASID state. > > Maybe it is necessary in other cases? Dave had suggested initializing feature state when it is unknown (could be garbage). This is my attempt to follow that guidance. I'm not confident that my tests for "is the state in registers, in memory, or is garbage" really capture all the cases. -Tony