Re: [PATCH 3/6] x86/intel_rdt/mba_sc: Add initialization support

From: Shivappa Vikas
Date: Tue Apr 03 2018 - 14:54:22 EST




On Tue, 3 Apr 2018, Thomas Gleixner wrote:

On Thu, 29 Mar 2018, Vikas Shivappa wrote:
+void setup_ctrlval(struct rdt_resource *r, u32 *dc, u32 *dm)
+{
+ int i;
+
+ /*
+ * Initialize the Control MSRs to having no control.
+ * For Cache Allocation: Set all bits in cbm
+ * For Memory Allocation: Set b/w requested to 100%
+ * and the b/w in MB to U32_MAX
+ */
+ for (i = 0; i < r->num_closid; i++, dc++, dm++) {
+ *dc = r->membw.bw_byte ? MBA_BW_MAX_MB : r->default_ctrl;
+ *dm = r->default_ctrl;

No! Please stop duct taping your stuff into the existing code. So far the
ctrl value was the same as the value which was actually written into the
MSR. With your new mode you have to split that up into the user supplied
value and the value which gets written into the MSR.

So the right thing to do is to separate the user value and the MSR value
first and independent of the mode. Then the new mode falls into place
naturally because r->default_ctrl and r->default_msrval are set up at mount
time with the values which correspond to the mount mode.

will fix. I tried both and this implementation assumes what user modifies is the control values (because then schemata read and write is easy as user does it directly) but agree we can change that.

Thanks,
Vikas


Thanks,

tglx