From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752615AbdGFVqo (ORCPT ); Thu, 6 Jul 2017 17:46:44 -0400 Received: from mga07.intel.com ([134.134.136.100]:22878 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751943AbdGFVqn (ORCPT ); Thu, 6 Jul 2017 17:46:43 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,319,1496127600"; d="scan'208";a="876026590" Date: Thu, 6 Jul 2017 14:48:15 -0700 (PDT) From: Shivappa Vikas X-X-Sender: vikas@vshiva-Udesk To: Thomas Gleixner cc: Vikas Shivappa , x86@kernel.org, linux-kernel@vger.kernel.org, hpa@zytor.com, peterz@infradead.org, ravi.v.shankar@intel.com, vikas.shivappa@intel.com, tony.luck@intel.com, fenghua.yu@intel.com, andi.kleen@intel.com Subject: Re: [PATCH 14/21] x86/intel_rdt/cqm: Add mon_data In-Reply-To: Message-ID: References: <1498503368-20173-1-git-send-email-vikas.shivappa@linux.intel.com> <1498503368-20173-15-git-send-email-vikas.shivappa@linux.intel.com> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >