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


Groups > linux.kernel > #1682729 > unrolled thread

Re: [PATCH 14/21] x86/intel_rdt/cqm: Add mon_data

Started byShivappa Vikas <vikas.shivappa@intel.com>
First post2017-07-06 23:50 +0200
Last post2017-07-11 23:40 +0200
Articles 4 — 3 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

  Re: [PATCH 14/21] x86/intel_rdt/cqm: Add mon_data Shivappa Vikas <vikas.shivappa@intel.com> - 2017-07-06 23:50 +0200
    Re: [PATCH 14/21] x86/intel_rdt/cqm: Add mon_data Thomas Gleixner <tglx@linutronix.de> - 2017-07-07 08:30 +0200
      Re: [PATCH 14/21] x86/intel_rdt/cqm: Add mon_data Shivappa Vikas <vikas.shivappa@intel.com> - 2017-07-11 23:20 +0200
        Re: [PATCH 14/21] x86/intel_rdt/cqm: Add mon_data "Luck, Tony" <tony.luck@intel.com> - 2017-07-11 23:40 +0200

#1682729 — Re: [PATCH 14/21] x86/intel_rdt/cqm: Add mon_data

FromShivappa Vikas <vikas.shivappa@intel.com>
Date2017-07-06 23:50 +0200
SubjectRe: [PATCH 14/21] x86/intel_rdt/cqm: Add mon_data
Message-ID<u0mOS-2P4-1@gated-at.bofh.it>

On Sun, 2 Jul 2017, Thomas Gleixner wrote:

> On Mon, 26 Jun 2017, Vikas Shivappa wrote:
>
>> Add a mon_data directory for the root rdtgroup and all other rdtgroups.
>> The directory holds all of the monitored data for all domains and events
>> of all resources being monitored.
>
> Again. This does two things at once. Move the existing code to a new file
> and add the monitoring stuff. Please split it apart.

Will fix.

>
>> +static bool __mon_event_count(u32 rmid, struct rmid_read *rr)
>> +{
>> +	u64 tval;
>> +
>> +	tval = __rmid_read(rmid, rr->evtid);
>> +	if (tval & (RMID_VAL_ERROR | RMID_VAL_UNAVAIL)) {
>> +		rr->val = tval;
>> +		return false;
>> +	}
>> +	switch (rr->evtid) {
>> +	case QOS_L3_OCCUP_EVENT_ID:
>> +		rr->val += tval;
>> +		return true;
>> +	default:
>> +		return false;
>
> I have no idea what that return code means.

false for the invalid event id and all errors for __rmid_read. (IOW all errors 
for __mon_event-read)

>
>> +	}
>> +}
>> +
>> +void mon_event_count(void *info)
>
> Some explanation why this is a void pointer and how that function is called
> (I assume it's via IPI) would be appreciated.
>
>> +{
>> +	struct rdtgroup *rdtgrp, *entry;
>> +	struct rmid_read *rr = info;
>> +	struct list_head *llist;
>
>  *head;
>
>> +
>> +	rdtgrp = rr->rgrp;
>> +
>> +	if (!__mon_event_count(rdtgrp->rmid, rr))
>> +		return;
>> +
>> +	/*
>> +	 * For Ctrl groups read data from child monitor groups.
>> +	 */
>> +	llist = &rdtgrp->crdtgrp_list;
>> +
>> +	if (rdtgrp->type == RDTCTRL_GROUP) {
>> +		list_for_each_entry(entry, llist, crdtgrp_list) {
>> +			if (!__mon_event_count(entry->rmid, rr))
>> +				return;
>> +		}
>> +	}
>> +}
>
>> +static int get_rdt_resourceid(struct rdt_resource *r)
>> +{
>> +	if (r > (rdt_resources_all + RDT_NUM_RESOURCES - 1) ||
>> +	    r < rdt_resources_all ||
>> +	    ((r - rdt_resources_all) % sizeof(struct rdt_resource)))
>> +		return -EINVAL;
>
> If that ever happens, then you have other problems than a wrong pointer.
>
>> +
>> +	return ((r - rdt_resources_all) / sizeof(struct rdt_resource));
>
> Moo. Can't you simply put an index field into struct rdt_resource,
> intialize it with the resource ID and use that?

Ok will fix all above,

thanks,
Vikas

>
> Thanks,
>
> 	tglx
>

[toc] | [next] | [standalone]


#1682952

FromThomas Gleixner <tglx@linutronix.de>
Date2017-07-07 08:30 +0200
Message-ID<u0uW6-8qy-19@gated-at.bofh.it>
In reply to#1682729
On Thu, 6 Jul 2017, Shivappa Vikas wrote:
> On Sun, 2 Jul 2017, Thomas Gleixner wrote:
> > > +static bool __mon_event_count(u32 rmid, struct rmid_read *rr)
> > > +{
> > > +	u64 tval;
> > > +
> > > +	tval = __rmid_read(rmid, rr->evtid);
> > > +	if (tval & (RMID_VAL_ERROR | RMID_VAL_UNAVAIL)) {
> > > +		rr->val = tval;
> > > +		return false;
> > > +	}
> > > +	switch (rr->evtid) {
> > > +	case QOS_L3_OCCUP_EVENT_ID:
> > > +		rr->val += tval;
> > > +		return true;
> > > +	default:
> > > +		return false;
> > 
> > I have no idea what that return code means.
> 
> false for the invalid event id and all errors for __rmid_read. (IOW all errors
> for __mon_event-read)

Sure, but why bool? What's wrong with proper error return codes, so issues
can be distinguished and potentially propagated in the callchain?

Thanks,

	tglx

[toc] | [prev] | [next] | [standalone]


#1685346

FromShivappa Vikas <vikas.shivappa@intel.com>
Date2017-07-11 23:20 +0200
Message-ID<u2aJA-7t8-5@gated-at.bofh.it>
In reply to#1682952

On Thu, 6 Jul 2017, Thomas Gleixner wrote:

> On Thu, 6 Jul 2017, Shivappa Vikas wrote:
>> On Sun, 2 Jul 2017, Thomas Gleixner wrote:
>>>> +static bool __mon_event_count(u32 rmid, struct rmid_read *rr)
>>>> +{
>>>> +	u64 tval;
>>>> +
>>>> +	tval = __rmid_read(rmid, rr->evtid);
>>>> +	if (tval & (RMID_VAL_ERROR | RMID_VAL_UNAVAIL)) {
>>>> +		rr->val = tval;
>>>> +		return false;
>>>> +	}
>>>> +	switch (rr->evtid) {
>>>> +	case QOS_L3_OCCUP_EVENT_ID:
>>>> +		rr->val += tval;
>>>> +		return true;
>>>> +	default:
>>>> +		return false;
>>>
>>> I have no idea what that return code means.
>>
>> false for the invalid event id and all errors for __rmid_read. (IOW all errors
>> for __mon_event-read)
>
> Sure, but why bool? What's wrong with proper error return codes, so issues
> can be distinguished and potentially propagated in the callchain?

Ok, The error is propagated wih the rr->val actually. is this better?

Hardware throws the RMID_VAL_ERROR (bit 63) when an invalid RMID or 
event is written to event select - this case seems similar.

 	default:
 		rr->val = RMID_VAL_ERROR;
 		return -EINVAL;
 	}

Thanks,
Vikas

>
> Thanks,
>
> 	tglx
>
>
>
>
>

[toc] | [prev] | [next] | [standalone]


#1685355

From"Luck, Tony" <tony.luck@intel.com>
Date2017-07-11 23:40 +0200
Message-ID<u2b2W-7At-21@gated-at.bofh.it>
In reply to#1685346
On Tue, Jul 11, 2017 at 02:17:47PM -0700, Shivappa Vikas wrote:
> 
> 
> On Thu, 6 Jul 2017, Thomas Gleixner wrote:
> 
> > On Thu, 6 Jul 2017, Shivappa Vikas wrote:
> > > On Sun, 2 Jul 2017, Thomas Gleixner wrote:
> > > > > +static bool __mon_event_count(u32 rmid, struct rmid_read *rr)
> > > > > +{
> > > > > +	u64 tval;
> > > > > +
> > > > > +	tval = __rmid_read(rmid, rr->evtid);
> > > > > +	if (tval & (RMID_VAL_ERROR | RMID_VAL_UNAVAIL)) {
> > > > > +		rr->val = tval;
> > > > > +		return false;
> > > > > +	}
> > > > > +	switch (rr->evtid) {
> > > > > +	case QOS_L3_OCCUP_EVENT_ID:
> > > > > +		rr->val += tval;
> > > > > +		return true;
> > > > > +	default:
> > > > > +		return false;
> > > > 
> > > > I have no idea what that return code means.
> > > 
> > > false for the invalid event id and all errors for __rmid_read. (IOW all errors
> > > for __mon_event-read)
> > 
> > Sure, but why bool? What's wrong with proper error return codes, so issues
> > can be distinguished and potentially propagated in the callchain?
> 
> Ok, The error is propagated wih the rr->val actually. is this better?
> 
> Hardware throws the RMID_VAL_ERROR (bit 63) when an invalid RMID or
> event is written to event select - this case seems similar.
> 
> 	default:
> 		rr->val = RMID_VAL_ERROR;
> 		return -EINVAL;
> 	}

I'll take the blame for not documenting this better.  What's going
on here is that we are calculating the sum of some list of RMIDs
(for the case where we read a mon_data/*/* file for a CTRL_MON group
that has some MON subgroups ... when reading a from a MON group there
is only one RMID).

Now we might get an error reading one of those (either or both of
RMID_VAL_ERROR and RMID_VAL_UNAVAIL bits set). In which case we can't
compute the sum, and there is no point in reading any more RMIDs.

So the return of this function is:

true: I read this RMID OK and added it to rr->val

false: I got an error. Give up. The error type is in the high bits of rr->val


-Tony

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web