Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1497603 > unrolled thread

[PATCH v3 06/18] x86/intel_rdt: Add CONFIG, Makefile, and basic initialization

Started by"Fenghua Yu" <fenghua.yu@intel.com>
First post2016-10-08 01:50 +0200
Last post2016-10-08 23:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v3 06/18] x86/intel_rdt: Add CONFIG, Makefile, and basic initialization "Fenghua Yu" <fenghua.yu@intel.com> - 2016-10-08 01:50 +0200
    Re: [PATCH v3 06/18] x86/intel_rdt: Add CONFIG, Makefile, and basic  initialization Borislav Petkov <bp@suse.de> - 2016-10-08 23:00 +0200

#1497603 — [PATCH v3 06/18] x86/intel_rdt: Add CONFIG, Makefile, and basic initialization

From"Fenghua Yu" <fenghua.yu@intel.com>
Date2016-10-08 01:50 +0200
Subject[PATCH v3 06/18] x86/intel_rdt: Add CONFIG, Makefile, and basic initialization
Message-ID<spN3Q-7BE-17@gated-at.bofh.it>
From: Fenghua Yu <fenghua.yu@intel.com>

Introduce CONFIG_INTEL_RDT (default: no, dependent on X86 and
CPU_SUP_INTEL) to control inclusion of Resource Director Technology in
the build.

Simple init() routine just checks which features are present. If they are
pr_info() one line summary for each feature.

Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
---
 arch/x86/Kconfig                | 12 +++++++++
 arch/x86/kernel/cpu/Makefile    |  2 ++
 arch/x86/kernel/cpu/intel_rdt.c | 56 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 70 insertions(+)
 create mode 100644 arch/x86/kernel/cpu/intel_rdt.c

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 2a1f0ce..cfca613 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -406,6 +406,18 @@ config GOLDFISH
        def_bool y
        depends on X86_GOLDFISH
 
+config INTEL_RDT
+	bool "Intel Resource Director Technology support"
+	default n
+	depends on X86 && CPU_SUP_INTEL
+	help
+	  Select to enable resource allocation which is a sub-feature of
+	  Intel Resource Director Technology(RDT). More information about
+	  RDT can be found in the Intel x86 Architecture Software
+	  Developer Manual June 2016, volume 3, section 17.17.
+
+	  Say N if unsure.
+
 if X86_32
 config X86_EXTENDED_PLATFORM
 	bool "Support for extended (non-PC) x86 platforms"
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
index 4a8697f..5a791c8 100644
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@ -34,6 +34,8 @@ obj-$(CONFIG_CPU_SUP_CENTAUR)		+= centaur.o
 obj-$(CONFIG_CPU_SUP_TRANSMETA_32)	+= transmeta.o
 obj-$(CONFIG_CPU_SUP_UMC_32)		+= umc.o
 
+obj-$(CONFIG_INTEL_RDT)	+= intel_rdt.o
+
 obj-$(CONFIG_X86_MCE)			+= mcheck/
 obj-$(CONFIG_MTRR)			+= mtrr/
 obj-$(CONFIG_MICROCODE)			+= microcode/
diff --git a/arch/x86/kernel/cpu/intel_rdt.c b/arch/x86/kernel/cpu/intel_rdt.c
new file mode 100644
index 0000000..ebe8dae
--- /dev/null
+++ b/arch/x86/kernel/cpu/intel_rdt.c
@@ -0,0 +1,56 @@
+/*
+ * Resource Director Technology(RDT)
+ * - Cache Allocation code.
+ *
+ * Copyright (C) 2016 Intel Corporation
+ *
+ * Authors:
+ *    Fenghua Yu <fenghua.yu@intel.com>
+ *    Tony Luck <tony.luck@intel.com>
+ *    Vikas Shivappa <vikas.shivappa@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * More information about RDT be found in the Intel (R) x86 Architecture
+ * Software Developer Manual June 2016, volume 3, section 17.17.
+ */
+
+#define pr_fmt(fmt)	KBUILD_MODNAME ": " fmt
+
+#include <linux/slab.h>
+#include <linux/err.h>
+
+static inline bool get_rdt_resources(struct cpuinfo_x86 *c)
+{
+	bool ret = false;
+
+	if (!cpu_has(c, X86_FEATURE_RDT_A))
+		return false;
+	if (cpu_has(c, X86_FEATURE_CAT_L3))
+		ret = true;
+
+	return ret;
+}
+
+static int __init intel_rdt_late_init(void)
+{
+	struct cpuinfo_x86 *c = &boot_cpu_data;
+
+	if (!get_rdt_resources(c))
+		return -ENODEV;
+
+	pr_info("Intel cache allocation detected\n");
+	if (cpu_has(c, X86_FEATURE_CDP_L3))
+		pr_info("Intel code data prioritization detected\n");
+
+	return 0;
+}
+
+late_initcall(intel_rdt_late_init);
-- 
2.5.0

[toc] | [next] | [standalone]


#1497820 — Re: [PATCH v3 06/18] x86/intel_rdt: Add CONFIG, Makefile, and basic initialization

FromBorislav Petkov <bp@suse.de>
Date2016-10-08 23:00 +0200
SubjectRe: [PATCH v3 06/18] x86/intel_rdt: Add CONFIG, Makefile, and basic initialization
Message-ID<sq6SR-3pc-7@gated-at.bofh.it>
In reply to#1497603
On Fri, Oct 07, 2016 at 07:45:51PM -0700, Fenghua Yu wrote:
> From: Fenghua Yu <fenghua.yu@intel.com>
> 
> Introduce CONFIG_INTEL_RDT (default: no, dependent on X86 and
> CPU_SUP_INTEL) to control inclusion of Resource Director Technology in
> the build.
> 
> Simple init() routine just checks which features are present. If they are
> pr_info() one line summary for each feature.
> 
> Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
> Signed-off-by: Tony Luck <tony.luck@intel.com>
> ---
>  arch/x86/Kconfig                | 12 +++++++++
>  arch/x86/kernel/cpu/Makefile    |  2 ++
>  arch/x86/kernel/cpu/intel_rdt.c | 56 +++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 70 insertions(+)
>  create mode 100644 arch/x86/kernel/cpu/intel_rdt.c

...

> +static inline bool get_rdt_resources(struct cpuinfo_x86 *c)
> +{
> +	bool ret = false;
> +
> +	if (!cpu_has(c, X86_FEATURE_RDT_A))
> +		return false;
> +	if (cpu_has(c, X86_FEATURE_CAT_L3))
> +		ret = true;
> +
> +	return ret;
> +}
> +
> +static int __init intel_rdt_late_init(void)
> +{
> +	struct cpuinfo_x86 *c = &boot_cpu_data;

No need for that - you can do directly

	if (boot_cpu_has(...))

in get_rdt_resources() and here.

> +
> +	if (!get_rdt_resources(c))
> +		return -ENODEV;
> +
> +	pr_info("Intel cache allocation detected\n");

So this reads stupid: Intel cache allocation? Reads like Intel can do
cache allocation. But it does already, even before that RDT stuff.

So you need to think of a more sensible name for it: "Intel cache
partitioning support detected" or some descriptive name which actually
denotes what the technology is.

Everybody can allocate lines in the cache :)

> +	if (cpu_has(c, X86_FEATURE_CDP_L3))
> +		pr_info("Intel code data prioritization detected\n");

Ditto.

-- 
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web