diff options
author | Tony Luck <tony.luck@intel.com> | 2017-08-24 12:26:51 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2017-08-25 16:00:45 -0400 |
commit | 1d9807fc64c131a83a96917f2b2da1c9b00cf127 (patch) | |
tree | fb26c36ddde0561a7fb3031f2b730afb483e29f3 | |
parent | 0576113a387e0c8a5d9e24b4cd62605d1c9c0db8 (diff) |
x86/intel_rdt: Add command line options for resource director technology
Command line options allow us to ignore features that we don't want.
Also we can re-enable options that have been disabled on a platform
(so long as the underlying h/w actually supports the option).
[ tglx: Marked the option array __initdata and the helper function __init ]
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Fenghua" <fenghua.yu@intel.com>
Cc: Ravi V" <ravi.v.shankar@intel.com>
Cc: "Peter Zijlstra" <peterz@infradead.org>
Cc: "Stephane Eranian" <eranian@google.com>
Cc: "Andi Kleen" <ak@linux.intel.com>
Cc: "David Carrillo-Cisneros" <davidcc@google.com>
Cc: Vikas Shivappa <vikas.shivappa@linux.intel.com>
Link: http://lkml.kernel.org/r/0c37b0d4dbc30977a3c1cee08b66420f83662694.1503512900.git.tony.luck@intel.com
-rw-r--r-- | Documentation/admin-guide/kernel-parameters.rst | 1 | ||||
-rw-r--r-- | Documentation/admin-guide/kernel-parameters.txt | 6 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/intel_rdt.c | 96 |
3 files changed, 95 insertions, 8 deletions
diff --git a/Documentation/admin-guide/kernel-parameters.rst b/Documentation/admin-guide/kernel-parameters.rst index d76ab3907e2b..b2598cc9834c 100644 --- a/Documentation/admin-guide/kernel-parameters.rst +++ b/Documentation/admin-guide/kernel-parameters.rst | |||
@@ -138,6 +138,7 @@ parameter is applicable:: | |||
138 | PPT Parallel port support is enabled. | 138 | PPT Parallel port support is enabled. |
139 | PS2 Appropriate PS/2 support is enabled. | 139 | PS2 Appropriate PS/2 support is enabled. |
140 | RAM RAM disk support is enabled. | 140 | RAM RAM disk support is enabled. |
141 | RDT Intel Resource Director Technology. | ||
141 | S390 S390 architecture is enabled. | 142 | S390 S390 architecture is enabled. |
142 | SCSI Appropriate SCSI support is enabled. | 143 | SCSI Appropriate SCSI support is enabled. |
143 | A lot of drivers have their options described inside | 144 | A lot of drivers have their options described inside |
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index d9c171ce4190..ef52ae4ed6e8 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt | |||
@@ -3598,6 +3598,12 @@ | |||
3598 | Run specified binary instead of /init from the ramdisk, | 3598 | Run specified binary instead of /init from the ramdisk, |
3599 | used for early userspace startup. See initrd. | 3599 | used for early userspace startup. See initrd. |
3600 | 3600 | ||
3601 | rdt= [HW,X86,RDT] | ||
3602 | Turn on/off individual RDT features. List is: | ||
3603 | cmt, mbmtotal, mbmlocal, l3cat, l3cdp, l2cat, mba. | ||
3604 | E.g. to turn on cmt and turn off mba use: | ||
3605 | rdt=cmt,!mba | ||
3606 | |||
3601 | reboot= [KNL] | 3607 | reboot= [KNL] |
3602 | Format (x86 or x86_64): | 3608 | Format (x86 or x86_64): |
3603 | [w[arm] | c[old] | h[ard] | s[oft] | g[pio]] \ | 3609 | [w[arm] | c[old] | h[ard] | s[oft] | g[pio]] \ |
diff --git a/arch/x86/kernel/cpu/intel_rdt.c b/arch/x86/kernel/cpu/intel_rdt.c index 25514cd454b3..b641622003cf 100644 --- a/arch/x86/kernel/cpu/intel_rdt.c +++ b/arch/x86/kernel/cpu/intel_rdt.c | |||
@@ -637,6 +637,85 @@ static __init void rdt_init_padding(void) | |||
637 | } | 637 | } |
638 | } | 638 | } |
639 | 639 | ||
640 | enum { | ||
641 | RDT_FLAG_CMT, | ||
642 | RDT_FLAG_MBM_TOTAL, | ||
643 | RDT_FLAG_MBM_LOCAL, | ||
644 | RDT_FLAG_L3_CAT, | ||
645 | RDT_FLAG_L3_CDP, | ||
646 | RDT_FLAG_L2_CAT, | ||
647 | RDT_FLAG_MBA, | ||
648 | }; | ||
649 | |||
650 | #define RDT_OPT(idx, n, f) \ | ||
651 | [idx] = { \ | ||
652 | .name = n, \ | ||
653 | .flag = f \ | ||
654 | } | ||
655 | |||
656 | struct rdt_options { | ||
657 | char *name; | ||
658 | int flag; | ||
659 | bool force_off, force_on; | ||
660 | }; | ||
661 | |||
662 | static struct rdt_options rdt_options[] __initdata = { | ||
663 | RDT_OPT(RDT_FLAG_CMT, "cmt", X86_FEATURE_CQM_OCCUP_LLC), | ||
664 | RDT_OPT(RDT_FLAG_MBM_TOTAL, "mbmtotal", X86_FEATURE_CQM_MBM_TOTAL), | ||
665 | RDT_OPT(RDT_FLAG_MBM_LOCAL, "mbmlocal", X86_FEATURE_CQM_MBM_LOCAL), | ||
666 | RDT_OPT(RDT_FLAG_L3_CAT, "l3cat", X86_FEATURE_CAT_L3), | ||
667 | RDT_OPT(RDT_FLAG_L3_CDP, "l3cdp", X86_FEATURE_CDP_L3), | ||
668 | RDT_OPT(RDT_FLAG_L2_CAT, "l2cat", X86_FEATURE_CAT_L2), | ||
669 | RDT_OPT(RDT_FLAG_MBA, "mba", X86_FEATURE_MBA), | ||
670 | }; | ||
671 | #define NUM_RDT_OPTIONS ARRAY_SIZE(rdt_options) | ||
672 | |||
673 | static int __init set_rdt_options(char *str) | ||
674 | { | ||
675 | struct rdt_options *o; | ||
676 | bool force_off; | ||
677 | char *tok; | ||
678 | |||
679 | if (*str == '=') | ||
680 | str++; | ||
681 | while ((tok = strsep(&str, ",")) != NULL) { | ||
682 | force_off = *tok == '!'; | ||
683 | if (force_off) | ||
684 | tok++; | ||
685 | for (o = rdt_options; o < &rdt_options[NUM_RDT_OPTIONS]; o++) { | ||
686 | if (strcmp(tok, o->name) == 0) { | ||
687 | if (force_off) | ||
688 | o->force_off = true; | ||
689 | else | ||
690 | o->force_on = true; | ||
691 | break; | ||
692 | } | ||
693 | } | ||
694 | } | ||
695 | return 1; | ||
696 | } | ||
697 | __setup("rdt", set_rdt_options); | ||
698 | |||
699 | static bool __init rdt_cpu_has(int flag) | ||
700 | { | ||
701 | bool ret = boot_cpu_has(flag); | ||
702 | struct rdt_options *o; | ||
703 | |||
704 | if (!ret) | ||
705 | return ret; | ||
706 | |||
707 | for (o = rdt_options; o < &rdt_options[NUM_RDT_OPTIONS]; o++) { | ||
708 | if (flag == o->flag) { | ||
709 | if (o->force_off) | ||
710 | ret = false; | ||
711 | if (o->force_on) | ||
712 | ret = true; | ||
713 | break; | ||
714 | } | ||
715 | } | ||
716 | return ret; | ||
717 | } | ||
718 | |||
640 | static __init bool get_rdt_alloc_resources(void) | 719 | static __init bool get_rdt_alloc_resources(void) |
641 | { | 720 | { |
642 | bool ret = false; | 721 | bool ret = false; |
@@ -647,21 +726,21 @@ static __init bool get_rdt_alloc_resources(void) | |||
647 | if (!boot_cpu_has(X86_FEATURE_RDT_A)) | 726 | if (!boot_cpu_has(X86_FEATURE_RDT_A)) |
648 | return false; | 727 | return false; |
649 | 728 | ||
650 | if (boot_cpu_has(X86_FEATURE_CAT_L3)) { | 729 | if (rdt_cpu_has(X86_FEATURE_CAT_L3)) { |
651 | rdt_get_cache_alloc_cfg(1, &rdt_resources_all[RDT_RESOURCE_L3]); | 730 | rdt_get_cache_alloc_cfg(1, &rdt_resources_all[RDT_RESOURCE_L3]); |
652 | if (boot_cpu_has(X86_FEATURE_CDP_L3)) { | 731 | if (rdt_cpu_has(X86_FEATURE_CDP_L3)) { |
653 | rdt_get_cdp_l3_config(RDT_RESOURCE_L3DATA); | 732 | rdt_get_cdp_l3_config(RDT_RESOURCE_L3DATA); |
654 | rdt_get_cdp_l3_config(RDT_RESOURCE_L3CODE); | 733 | rdt_get_cdp_l3_config(RDT_RESOURCE_L3CODE); |
655 | } | 734 | } |
656 | ret = true; | 735 | ret = true; |
657 | } | 736 | } |
658 | if (boot_cpu_has(X86_FEATURE_CAT_L2)) { | 737 | if (rdt_cpu_has(X86_FEATURE_CAT_L2)) { |
659 | /* CPUID 0x10.2 fields are same format at 0x10.1 */ | 738 | /* CPUID 0x10.2 fields are same format at 0x10.1 */ |
660 | rdt_get_cache_alloc_cfg(2, &rdt_resources_all[RDT_RESOURCE_L2]); | 739 | rdt_get_cache_alloc_cfg(2, &rdt_resources_all[RDT_RESOURCE_L2]); |
661 | ret = true; | 740 | ret = true; |
662 | } | 741 | } |
663 | 742 | ||
664 | if (boot_cpu_has(X86_FEATURE_MBA)) { | 743 | if (rdt_cpu_has(X86_FEATURE_MBA)) { |
665 | if (rdt_get_mem_config(&rdt_resources_all[RDT_RESOURCE_MBA])) | 744 | if (rdt_get_mem_config(&rdt_resources_all[RDT_RESOURCE_MBA])) |
666 | ret = true; | 745 | ret = true; |
667 | } | 746 | } |
@@ -670,11 +749,11 @@ static __init bool get_rdt_alloc_resources(void) | |||
670 | 749 | ||
671 | static __init bool get_rdt_mon_resources(void) | 750 | static __init bool get_rdt_mon_resources(void) |
672 | { | 751 | { |
673 | if (boot_cpu_has(X86_FEATURE_CQM_OCCUP_LLC)) | 752 | if (rdt_cpu_has(X86_FEATURE_CQM_OCCUP_LLC)) |
674 | rdt_mon_features |= (1 << QOS_L3_OCCUP_EVENT_ID); | 753 | rdt_mon_features |= (1 << QOS_L3_OCCUP_EVENT_ID); |
675 | if (boot_cpu_has(X86_FEATURE_CQM_MBM_TOTAL)) | 754 | if (rdt_cpu_has(X86_FEATURE_CQM_MBM_TOTAL)) |
676 | rdt_mon_features |= (1 << QOS_L3_MBM_TOTAL_EVENT_ID); | 755 | rdt_mon_features |= (1 << QOS_L3_MBM_TOTAL_EVENT_ID); |
677 | if (boot_cpu_has(X86_FEATURE_CQM_MBM_LOCAL)) | 756 | if (rdt_cpu_has(X86_FEATURE_CQM_MBM_LOCAL)) |
678 | rdt_mon_features |= (1 << QOS_L3_MBM_LOCAL_EVENT_ID); | 757 | rdt_mon_features |= (1 << QOS_L3_MBM_LOCAL_EVENT_ID); |
679 | 758 | ||
680 | if (!rdt_mon_features) | 759 | if (!rdt_mon_features) |
@@ -687,7 +766,8 @@ static __init void rdt_quirks(void) | |||
687 | { | 766 | { |
688 | switch (boot_cpu_data.x86_model) { | 767 | switch (boot_cpu_data.x86_model) { |
689 | case INTEL_FAM6_HASWELL_X: | 768 | case INTEL_FAM6_HASWELL_X: |
690 | cache_alloc_hsw_probe(); | 769 | if (!rdt_options[RDT_FLAG_L3_CAT].force_off) |
770 | cache_alloc_hsw_probe(); | ||
691 | break; | 771 | break; |
692 | } | 772 | } |
693 | } | 773 | } |