Skip to contentSkip to conversation

x86/resctrl: Fix repeating rdtgroup mode initialization

PATCH New Xiaochen Shen 2 participants 2 messages Apr 9, 2019 – Apr 14, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 x86/resctrl: Fix repeating rdtgroup mode initialization

When cache allocation is supported and the user creates a new resctrl resource group the allocations of the new resource group are initialized to all regions that it can possibly use. At this time these regions are all that are shareable by other resource groups as well as regions that are not currently used. The new resource group's mode is also initialized to reflect this initialization and set to "shareable".

The new resource group's mode is currently repeatedly initialized within the loop that configures the hardware with the resource group's default allocations.

Move the initialization of the resource group's mode outside the hardware configuration loop. The resource group's mode is now initialized only once as the final step to reflect that its configured allocations are "shareable".

Fixes 95f0b77efa57 ("x86/intel_rdt: Initialize new resource group with sane defaults")
---
 arch/x86/kernel/cpu/resctrl/rdtgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/resctrl/rdtgroup.c +1 -1
index 54b9eef..08e0333 100644
@@ -2610,8 +2610,8 @@ static int rdtgroup_init_alloc(struct rdtgroup *rdtgrp)
 			rdt_last_cmd_puts("Failed to initialize allocations\n");
 			return ret;
 		}
-		rdtgrp->mode = RDT_MODE_SHAREABLE;
 	}
+	rdtgrp->mode = RDT_MODE_SHAREABLE;
 
 	return 0;
 }
Signature · 1 line
1.8.3.1
#1 lore raw

[tip:x86/urgent] x86/resctrl: Do not repeat rdtgroup mode initialization

x86/resctrl: Do not repeat rdtgroup mode initialization
Commit-ID:  40fba00ffa431c8597ca785ea1cfa4d9f6503390
Gitweb:     https://git.kernel.org/tip/40fba00ffa431c8597ca785ea1cfa4d9f6503390
Author:     Xiaochen Shen <[email protected]>
AuthorDate: Wed, 10 Apr 2019 03:53:49 +0800
Committer:  Borislav Petkov <[email protected]>
CommitDate: Sun, 14 Apr 2019 18:23:13 +0200

x86/resctrl: Do not repeat rdtgroup mode initialization

When cache allocation is supported and the user creates a new resctrl resource group, the allocations of the new resource group are initialized to all regions that it can possibly use. At this time these regions are all that are shareable by other resource groups as well as regions that are not currently used. The new resource group's mode is also initialized to reflect this initialization and set to "shareable".

The new resource group's mode is currently repeatedly initialized within the loop that configures the hardware with the resource group's default allocations.

Move the initialization of the resource group's mode outside the hardware configuration loop. The resource group's mode is now initialized only once as the final step to reflect that its configured allocations are "shareable".

Fixes 95f0b77efa57 ("x86/intel_rdt: Initialize new resource group with sane defaults")
Cc "H. Peter Anvin" <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Tony Luck <[email protected]>
Cc x86-ml <[email protected]>
---
 arch/x86/kernel/cpu/resctrl/rdtgroup.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/resctrl/rdtgroup.c +2 -1
index 54b9eef3eea9..85212a32b54d 100644
@@ -2610,9 +2610,10 @@ static int rdtgroup_init_alloc(struct rdtgroup *rdtgrp)
 			rdt_last_cmd_puts("Failed to initialize allocations\n");
 			return ret;
 		}
-		rdtgrp->mode = RDT_MODE_SHAREABLE;
 	}
 
+	rdtgrp->mode = RDT_MODE_SHAREABLE;
+
 	return 0;
 }