Received: by 10.223.164.202 with SMTP id h10csp204404wrb; Mon, 13 Nov 2017 16:48:12 -0800 (PST) X-Google-Smtp-Source: AGs4zMb8gJGjvzBGY/UJDT9M3wRC5jkCOURgNe1EPdZthtfn5nPJJrGB3Kpp5XoJ4hy8erc5G5Fl X-Received: by 10.101.69.76 with SMTP id x12mr10459367pgr.284.1510620492434; Mon, 13 Nov 2017 16:48:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510620492; cv=none; d=google.com; s=arc-20160816; b=1FzJf98vPcdx4YiBX5i7zW0zmefQdGeI2BPrztmh80vtBuMpLFP9ty1Lt6wpXwybe6 WhjBVxSpAb4AwWGDZjf5kyMybiYm/oikB8Rc8yVo5Huy16H8x/p6wMTboYfm7PckDrML qTAK1A+kF6rUBVrGwBcQ0QKrZOspql9pszOrdVldRDO98fNbKGQvwiNIaq161e67f7b+ cNCV+P+Htc+uliPIUzQu4AFFxGraRNr/s21WwK+DkoeLs+ul+NKpz5G1GY7kB9cO+cQ9 yVU2osxJWX+lZ0lkyg0ofLaaCLV/A/Fc3MhMuVrgn6uP9jFSX3iND9So57+D9IRZGL/1 7GQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=EzAdo/iEdTHdiT6JODNxZWIoqPIJRXlFzeTXroRcFU0=; b=LazMpcRtlhMFkkl0Nn490ZLbcECu66S2GoICFi8CsA2O80ferqvT3a2GA8fyryGeVG D8NQeK9q0arq6wfpbZ2gBjOynJ9TVfQFIO/H+VQiPSPd3FCG8ZAhLJC8dgAuIK3t7blV jcz0xYrZOzP/8dSmZmtvu/pBgiF5u1fTjeOgMYSBN4uxrCl3jPvg/Cyw8+45lgxZ2nM4 1r07R8b2JCd9AYU96E7ISo1A57EUG1r/Qhco/wl00Vls8t0XqdxZ2k00oAhmZlLYhRD5 ItAFekKS7Z1ZItpwW4phKO2O2aHgaBTuhKm5xr1dND8SjAiS9JzG8m6ZyF0+ibwAv0t+ PpRw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r21si7255679pfl.178.2017.11.13.16.48.00; Mon, 13 Nov 2017 16:48:12 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753229AbdKNAqU (ORCPT + 90 others); Mon, 13 Nov 2017 19:46:20 -0500 Received: from mga01.intel.com ([192.55.52.88]:37796 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752512AbdKNAmU (ORCPT ); Mon, 13 Nov 2017 19:42:20 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Nov 2017 16:42:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,392,1505804400"; d="scan'208";a="2288280" Received: from rchatre-s.jf.intel.com ([10.54.70.76]) by fmsmga001.fm.intel.com with ESMTP; 13 Nov 2017 16:42:19 -0800 From: Reinette Chatre To: tglx@linutronix.de, fenghua.yu@intel.com, tony.luck@intel.com Cc: vikas.shivappa@linux.intel.com, dave.hansen@intel.com, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org, Reinette Chatre Subject: [RFC PATCH 09/20] x86/intel_rdt: Discover supported platforms via prefetch disable bits Date: Mon, 13 Nov 2017 08:39:32 -0800 Message-Id: <689adebbf70d23c15715c3b540a7bda245288dbe.1510568528.git.reinette.chatre@intel.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Knowing the model specific prefetch disable bits is required to support cache pseudo-locking because the hardware prefetchers need to be disabled when the kernel memory is pseudo-locked to cache. We add these bits only for platforms known to support cache pseudo-locking. If we have not validated pseudo-locking on a platform that does support RDT/CAT this should not be seen as a failure of CAT, the pseudo-locking interface will just not be set up. Signed-off-by: Reinette Chatre --- arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c | 80 +++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c b/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c index 94bd1b4fbfee..a0c144b5b09b 100644 --- a/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c +++ b/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c @@ -24,8 +24,22 @@ #include #include #include +#include #include "intel_rdt.h" +/* + * MSR_MISC_FEATURE_CONTROL register enables the modification of hardware + * prefetcher state. Details about this register can be found in the MSR + * tables for specific platforms found in Intel's SDM. + */ +#define MSR_MISC_FEATURE_CONTROL 0x000001a4 + +/* + * The bits needed to disable hardware prefetching varies based on the + * platform. During initialization we will discover which bits to use. + */ +static u64 prefetch_disable_bits; + struct kernfs_node *pseudo_lock_kn; /* @@ -358,6 +372,57 @@ int rdt_pseudo_lock_rmdir(struct kernfs_node *kn) } /** + * get_prefetch_disable_bits - prefetch disable bits of supported platforms + * + * Here we capture the list of platforms that have been validated to support + * pseudo-locking. This includes testing to ensure pseudo-locked regions + * with low cache miss rates can be created under variety of load conditions + * as well as that these pseudo-locked regions can maintain their low cache + * miss rates under variety of load conditions for significant lengths of time. + * + * After a platform has been validated to support pseudo-locking its + * hardware prefetch disable bits are included here as they are documented + * in the SDM. + * + * RETURNS + * If platform is supported, the bits to disable hardware prefetchers, 0 + * if platform is not supported. + */ +static u64 get_prefetch_disable_bits(void) +{ + if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL || + boot_cpu_data.x86 != 6) + return 0; + + switch (boot_cpu_data.x86_model) { + case INTEL_FAM6_BROADWELL_X: + /* + * SDM defines bits of MSR_MISC_FEATURE_CONTROL register + * as: + * 0 L2 Hardware Prefetcher Disable (R/W) + * 1 L2 Adjacent Cache Line Prefetcher Disable (R/W) + * 2 DCU Hardware Prefetcher Disable (R/W) + * 3 DCU IP Prefetcher Disable (R/W) + * 63:4 Reserved + */ + return 0xF; + case INTEL_FAM6_ATOM_GOLDMONT: + case INTEL_FAM6_ATOM_GEMINI_LAKE: + /* + * SDM defines bits of MSR_MISC_FEATURE_CONTROL register + * as: + * 0 L2 Hardware Prefetcher Disable (R/W) + * 1 Reserved + * 2 DCU Hardware Prefetcher Disable (R/W) + * 63:3 Reserved + */ + return 0x5; + } + + return 0; +} + +/** * rdt_pseudo_lock_fs_init - Create and initialize pseudo-locking files * @root: location in kernfs where directory and files should be created * @@ -377,6 +442,17 @@ int rdt_pseudo_lock_fs_init(struct kernfs_node *root) lockdep_assert_held(&rdtgroup_mutex); + /* + * Not knowing the bits to disable prefetching is not a failure + * that should be propagated since we only return prefetching bits + * for those platforms pseudo-locking has been tested on. If + * pseudo-locking has not been tested to work on this platform the + * other RDT features should continue to be available. + */ + prefetch_disable_bits = get_prefetch_disable_bits(); + if (prefetch_disable_bits == 0) + return 0; + pseudo_lock_kn = kernfs_create_dir(root, "pseudo_lock", root->mode, NULL); if (IS_ERR(pseudo_lock_kn)) @@ -420,6 +496,10 @@ int rdt_pseudo_lock_fs_init(struct kernfs_node *root) void rdt_pseudo_lock_fs_remove(void) { lockdep_assert_held(&rdtgroup_mutex); + + if (!pseudo_lock_kn) + return; + mutex_lock(&rdt_pseudo_lock_mutex); if (new_plr) { -- 2.13.5 From 1583749196061336613@xxx Sat Nov 11 06:15:31 +0000 2017 X-GM-THRID: 1583749196061336613 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread