Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp846271pxb; Wed, 29 Sep 2021 10:52:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+5EZXtpAeg8jNiEWvlPXKYuzdVvIgVomZLddXcOjb6zsnLQZirCXo9Pj6XtUT0x0VBSIK X-Received: by 2002:a05:6402:2682:: with SMTP id w2mr1475731edd.62.1632937979449; Wed, 29 Sep 2021 10:52:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632937979; cv=none; d=google.com; s=arc-20160816; b=qoKsxav66nARutvqAvAi7zHVklQ8BdMECy26DkO7c+504Myp6NvpDU3MtrmfYYLNbk EqfUnzvHoYFAZWRfsIfcVP0mQ/0/sE7VAXV89M7I6k4Zl2uRJEEqJ1c0uBf+grIA6iX1 JMIAsfpkucRLHvGb1Ou1RwZVkTmTolPjcjULv5p9ru6OQcPRNCSdp3ver2idhbRl+8R7 6WqRbOalObKSlXTj8AK8afLIIYpqQceqKq8NOz6so3CKqlglCnR515Sfgl4pE4gVssgZ LBYlIsP+TB7eoNBkZlAoWOjUE9gIxEWbYQ2tTr2ywFKTnbGU2R/98Egq1/3UgMksfA6V 6ZLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Ex1xh4JhLNuRjwVHKmAy483YLG+a3ehRitYfYt/oN28=; b=Ju1izyYpYGJxzQxkk9ClhBnOki3E0iU32D+zyh0VtXY3opsIa3XHI2yaqUqV9Db/6y 4MtSEFGT40BUsGcggXqfcsTuTPimRbOv29EyfRg3KfxtThBiEZhHgAlKPcLGJGgm/xtf dVenOynXSBqFgX+vQtxjxuvLV4MOtCgyg5mrur2SNPU2jDcZ/N70W6q5HITLmkvSp45C cS7tj6lkrE09kh9Gcp4tg1F2ReOrImLrcNefbjUEFPeH7XntDMBVNqXdizSKYE4Szc+Y djav0Szscs1lDq0c83D2KZfY3A3qTJJ5N3o3aOBQyFDw+5BssT0LNtxWd/oR3dG4ionq n01w== 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 qw25si567373ejc.519.2021.09.29.10.52.35; Wed, 29 Sep 2021 10:52:59 -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 S1345192AbhI2RKW (ORCPT + 99 others); Wed, 29 Sep 2021 13:10:22 -0400 Received: from mga01.intel.com ([192.55.52.88]:1355 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344818AbhI2RKV (ORCPT ); Wed, 29 Sep 2021 13:10:21 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10122"; a="247522719" X-IronPort-AV: E=Sophos;i="5.85,332,1624345200"; d="scan'208";a="247522719" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2021 10:07:55 -0700 X-IronPort-AV: E=Sophos;i="5.85,332,1624345200"; d="scan'208";a="538924770" Received: from agluck-desk2.sc.intel.com (HELO agluck-desk2.amr.corp.intel.com) ([10.3.52.146]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2021 10:07:55 -0700 Date: Wed, 29 Sep 2021 10:07:54 -0700 From: "Luck, Tony" To: Andy Lutomirski Cc: Dave Hansen , Fenghua Yu , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "Peter Zijlstra (Intel)" , Lu Baolu , Joerg Roedel , Josh Poimboeuf , Dave Jiang , Jacob Jun Pan , 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 Message-ID: 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> <308a72e4-6aa9-0c84-21e6-ee613eea35a8@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <308a72e4-6aa9-0c84-21e6-ee613eea35a8@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 29, 2021 at 09:58:22AM -0700, Andy Lutomirski wrote: > On 9/28/21 16:10, Luck, Tony wrote: > > Moving beyond pseudo-code and into compiles-but-probably-broken-code. > > > > > > The intent of the functions below is that Fenghua should be able to > > do: > > > > void fpu__pasid_write(u32 pasid) > > { > > u64 msr_val = pasid | MSR_IA32_PASID_VALID; > > struct ia32_pasid_state *addr; > > > > addr = begin_update_one_xsave_feature(current, XFEATURE_PASID, true); > > addr->pasid = msr_val; > > finish_update_one_xsave_feature(current); > > } > > > > This gets gnarly because we would presumably like to optimize the case where > we can do the update directly in registers. I wonder if we can do it with a > bit of macro magic in a somewhat generic way: Can we defere the optimizations until there is a use case that cares? The existing use case (fixing up the #GP fault by setting the PASID MSR) isn't performance critical. Let's just have something that is clear (or as clear as any xsave code can be) and correct. -Tony