Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4624576pxf; Tue, 30 Mar 2021 12:27:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8I/2UjeGZvk29KnY14vcrdgbsQo04SplU6w9ZLxjKQ6sgLiisG+4tVIgWadm/LqBk+NAZ X-Received: by 2002:aa7:c346:: with SMTP id j6mr35472004edr.386.1617132474361; Tue, 30 Mar 2021 12:27:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617132474; cv=none; d=google.com; s=arc-20160816; b=Cn+TmKSd9Ip0hy4e2UsKery8EXkSdN2MRKgSQin1roZk2dPlFy6COWvmJnTDlRADdP VqjDKj0ZIyDBX0nHLiIDp9y48Y3V2R/gs1UYlVNHXked4epkDSS/iq2607dmQVoMblc7 +wupPHHv6+qqFkhDaHW37IBDkBYAovgvNXIfRcyFBR0M+KW4rf+WLfSLILF4G73mVFih QSpYyuUdEKiao9g/ivGNY+S7PQOiSofRSlgb9RpsH6sQnl9CERL0kxPAOKcz8J2X4HOU thxnHftwxLs+EzLyz0HxQphXv6gbBJZYyNPF6Dj+x469psrbp+QavtPLKZv1uCoAu5Lr M+sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=/RTC83du6s0pwpWWj7cJ5k6twJM9rvx1N24BByj5DN4=; b=WQPh7KcJHrME8AJgKmfDgMCxKvmyPC5Ugo6W1AXthY0fyoS/HK6gw7W/qeG9QSeYu2 jRLHOSo6vzucmwEsZH5oaMyH3k5DkjHPnR3976DR8ZZLz9ZsbweDH1pq6ATb7y0QtMUT ++i3MLOSfm8LB4vnt+34FIuqWKAP0SOOfoRWCR73OhOSASyn3f4iLJ8RM00PzzYgj12g ihlqDxC3EFlNLNqGoypzEngYNcbP0Stx2kCeqee1fj7eiHQQ0CXLIXMs+VWDVNBEA1Ev okuGu+Bh3jnWQf+RKY30YpU1CQaiRI8YIvpc5g4Vre+SCaB3ge5VCe9hmRQVfQ65JSYg oDHw== 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 a17si15749569edy.160.2021.03.30.12.27.28; Tue, 30 Mar 2021 12:27:54 -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 S233112AbhC3T0U (ORCPT + 99 others); Tue, 30 Mar 2021 15:26:20 -0400 Received: from mga17.intel.com ([192.55.52.151]:14266 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233084AbhC3T0B (ORCPT ); Tue, 30 Mar 2021 15:26:01 -0400 IronPort-SDR: L9sJ7igl1phoiIEXAuQ9xJl3YrFkr5VLBPwSCegmCvDwewQjFDw4MBYaP7f9zeWRHhi9PKl6Gi leJ92X76RCfQ== X-IronPort-AV: E=McAfee;i="6000,8403,9939"; a="171863215" X-IronPort-AV: E=Sophos;i="5.81,291,1610438400"; d="scan'208";a="171863215" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2021 12:25:59 -0700 IronPort-SDR: s4znUWJU2XXel6e0JhbKBdQEeigoyLFbRp7i1UPfMAnK5HT36ADEossmBe48hJB8pmJGbEO6H8 JDsDlUuZuNdA== X-IronPort-AV: E=Sophos;i="5.81,291,1610438400"; d="scan'208";a="418305275" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.147]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2021 12:25:58 -0700 Date: Tue, 30 Mar 2021 12:25:58 -0700 From: Ira Weiny To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Peter Zijlstra Cc: Dan Williams , Fenghua Yu , Dave Hansen , x86@kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH V4 07/10] x86/pks: Preserve the PKRS MSR on context switch Message-ID: <20210330192558.GD3014244@iweiny-DESK2.sc.intel.com> References: <20210322053020.2287058-1-ira.weiny@intel.com> <20210322053020.2287058-8-ira.weiny@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210322053020.2287058-8-ira.weiny@intel.com> User-Agent: Mutt/1.11.1 (2018-12-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [snip] The test bot reported build errors on i386 yesterday. Not sure why they were not caught before... Anyway that caused me to look at this patch again and I've found a couple of issues noted below. Combined with Sean's review I'll be re-spinning a new v5. > diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h > index 546d6ecf0a35..c15a049bf6ac 100644 > --- a/arch/x86/include/asm/msr-index.h > +++ b/arch/x86/include/asm/msr-index.h > @@ -765,6 +765,7 @@ > > #define MSR_IA32_TSC_DEADLINE 0x000006E0 > > +#define MSR_IA32_PKRS 0x000006E1 This belongs in patch 5 where it is 'used'. Note that nothing is really used until the final test patch... But in review this define does not make any sense here... > > #define MSR_TSX_FORCE_ABORT 0x0000010F > > diff --git a/arch/x86/include/asm/pkeys_common.h b/arch/x86/include/asm/pkeys_common.h > index 0681522974ba..6917f1a27479 100644 > --- a/arch/x86/include/asm/pkeys_common.h > +++ b/arch/x86/include/asm/pkeys_common.h > @@ -17,4 +17,18 @@ > #define PKR_AD_KEY(pkey) (PKR_AD_BIT << PKR_PKEY_SHIFT(pkey)) > #define PKR_WD_KEY(pkey) (PKR_WD_BIT << PKR_PKEY_SHIFT(pkey)) > > +/* > + * Define a default PKRS value for each task. > + * > + * Key 0 has no restriction. All other keys are set to the most restrictive > + * value which is access disabled (AD=1). > + * > + * NOTE: This needs to be a macro to be used as part of the INIT_THREAD macro. > + */ > +#define INIT_PKRS_VALUE (PKR_AD_KEY(1) | PKR_AD_KEY(2) | PKR_AD_KEY(3) | \ > + PKR_AD_KEY(4) | PKR_AD_KEY(5) | PKR_AD_KEY(6) | \ > + PKR_AD_KEY(7) | PKR_AD_KEY(8) | PKR_AD_KEY(9) | \ > + PKR_AD_KEY(10) | PKR_AD_KEY(11) | PKR_AD_KEY(12) | \ > + PKR_AD_KEY(13) | PKR_AD_KEY(14) | PKR_AD_KEY(15)) The same is true for this macro. While it is used in this patch it is used first in patch 5. So it should be there. I'm letting 0-day crank on these changes but there should be a v5 out very soon. Sorry for the noise, Ira