Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitba0f26d

Browse files
Vikas ShivappaKAGA-KOKO
Vikas Shivappa
authored andcommitted
x86/intel_rdt/mba_sc: Prepare for feedback loop
This is a preparatory patch for the mba feedback loop. Add support tomeasure the "bandwidth in MBps" and the "delta bandwidth". Measure it byreading the MBM IA32_QM_CTR MSRs and calculating the amount of "bytes"moved. There is no user space interface for this and will only be used bythe feedback loop patch.Signed-off-by: Vikas Shivappa <vikas.shivappa@linux.intel.com>Signed-off-by: Thomas Gleixner <tglx@linutronix.de>Cc: ravi.v.shankar@intel.comCc: tony.luck@intel.comCc: fenghua.yu@intel.comCc: vikas.shivappa@intel.comCc: ak@linux.intel.comCc: hpa@zytor.comLink:https://lkml.kernel.org/r/1524263781-14267-6-git-send-email-vikas.shivappa@linux.intel.com
1 parent8205a07 commitba0f26d

File tree

2 files changed

+48
-6
lines changed

2 files changed

+48
-6
lines changed

‎arch/x86/kernel/cpu/intel_rdt.h‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,20 @@ struct rftype {
180180
* struct mbm_state - status for each MBM counter in each domain
181181
* @chunks:Total data moved (multiply by rdt_group.mon_scale to get bytes)
182182
* @prev_msrValue of IA32_QM_CTR for this RMID last time we read it
183+
* @chunks_bwTotal local data moved. Used for bandwidth calculation
184+
* @prev_bw_msr:Value of previous IA32_QM_CTR for bandwidth counting
185+
* @prev_bwThe most recent bandwidth in MBps
186+
* @delta_bwDifference between the current and previous bandwidth
187+
* @delta_compIndicates whether to compute the delta_bw
183188
*/
184189
structmbm_state {
185190
u64chunks;
186191
u64prev_msr;
192+
u64chunks_bw;
193+
u64prev_bw_msr;
194+
u32prev_bw;
195+
u32delta_bw;
196+
booldelta_comp;
187197
};
188198

189199
/**

‎arch/x86/kernel/cpu/intel_rdt_monitor.c‎

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,18 @@ void free_rmid(u32 rmid)
225225
list_add_tail(&entry->list,&rmid_free_lru);
226226
}
227227

228+
staticu64mbm_overflow_count(u64prev_msr,u64cur_msr)
229+
{
230+
u64shift=64-MBM_CNTR_WIDTH,chunks;
231+
232+
chunks= (cur_msr <<shift)- (prev_msr <<shift);
233+
returnchunks >>=shift;
234+
}
235+
228236
staticint__mon_event_count(u32rmid,structrmid_read*rr)
229237
{
230-
u64chunks,shift,tval;
231238
structmbm_state*m;
239+
u64chunks,tval;
232240

233241
tval=__rmid_read(rmid,rr->evtid);
234242
if (tval& (RMID_VAL_ERROR |RMID_VAL_UNAVAIL)) {
@@ -254,21 +262,45 @@ static int __mon_event_count(u32 rmid, struct rmid_read *rr)
254262
}
255263

256264
if (rr->first) {
257-
m->prev_msr=tval;
258-
m->chunks=0;
265+
memset(m,0,sizeof(structmbm_state));
266+
m->prev_bw_msr=m->prev_msr=tval;
259267
return0;
260268
}
261269

262-
shift=64-MBM_CNTR_WIDTH;
263-
chunks= (tval <<shift)- (m->prev_msr <<shift);
264-
chunks >>=shift;
270+
chunks=mbm_overflow_count(m->prev_msr,tval);
265271
m->chunks+=chunks;
266272
m->prev_msr=tval;
267273

268274
rr->val+=m->chunks;
269275
return0;
270276
}
271277

278+
/*
279+
* Supporting function to calculate the memory bandwidth
280+
* and delta bandwidth in MBps.
281+
*/
282+
staticvoidmbm_bw_count(u32rmid,structrmid_read*rr)
283+
{
284+
structrdt_resource*r=&rdt_resources_all[RDT_RESOURCE_L3];
285+
structmbm_state*m=&rr->d->mbm_local[rmid];
286+
u64tval,cur_bw,chunks;
287+
288+
tval=__rmid_read(rmid,rr->evtid);
289+
if (tval& (RMID_VAL_ERROR |RMID_VAL_UNAVAIL))
290+
return;
291+
292+
chunks=mbm_overflow_count(m->prev_bw_msr,tval);
293+
m->chunks_bw+=chunks;
294+
m->chunks=m->chunks_bw;
295+
cur_bw= (chunks*r->mon_scale) >>20;
296+
297+
if (m->delta_comp)
298+
m->delta_bw=abs(cur_bw-m->prev_bw);
299+
m->delta_comp= false;
300+
m->prev_bw=cur_bw;
301+
m->prev_bw_msr=tval;
302+
}
303+
272304
/*
273305
* This is called via IPI to read the CQM/MBM counters
274306
* on a domain.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp