-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
intel_pmu: core groups feature #2681
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good to me - can you please double check why some of the checks failed?
Thanks @maryamtahhan , it looks like for epel6 build saveptr for strtok_r needs to be initialised. Will fix it with next commit. |
It seems that Jenkins has problems due to environment issue: "Slave went offline during the build". |
@kwiatrox can you rebase this against 5.8.0? It looks good to me it would be great if @rpv-tomsk or @octo could review and approve this is a great addition |
Having this option will allow to configure monitoring of PMU events only on specific CPUs thus decrease number of opened descriptors significantly and avoid 'Too many open files' errors. New "Cores" option is similar to that available in intel_rdt plugin. New tool utils_config_cores is added to parse "Cores" option. Change-Id: I8f792e1f2560c4cf19aee101fdb07c925d682778 Signed-off-by: Kamil Wiatrowski <kamilx.wiatrowski@intel.com>
Use utils_config_cores for core groups configuration so it is in line with intel_pmu and reduce amount of redundant code. Change-Id: If02e2eeea8bcf3e0df705ebcd9a6310b549b5ebe Signed-off-by: Kamil Wiatrowski <kamilx.wiatrowski@intel.com>
Run script contrib/format.sh to format the code. Replace zu with new collectd macro PRIsz. Change-Id: I167b1065461e924d7ab260a35f85f5ab162c4165 Signed-off-by: Kamil Wiatrowski <kamilx.wiatrowski@intel.com>
To avoid compilation error on some versions of gcc the saveptr for strtok_r needs to be initilised to NULL. Change-Id: I7b30e51ecae33a6994ba7ea181cac0f33eef023f Signed-off-by: Kamil Wiatrowski <kamilx.wiatrowski@intel.com>
0a600b5
to
82b0d43
Compare
Add definition for PRIsz macro to make code backward compatible with collectd-5.8 branch. Change-Id: I880340af5ae883a444563422b3e9975b3693683c Signed-off-by: Kamil Wiatrowski <kamilx.wiatrowski@intel.com>
82b0d43
to
12d7e13
Compare
Code is rebased against 5.8 branch and all checks have passed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor comments....
src/utils_config_cores.h
Outdated
/** | ||
* collectd - src/utils_config_cores.h | ||
* | ||
* Copyright(c) 2017 Intel Corporation. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2018, please check in all new files.
src/utils_config_cores.h
Outdated
#define UTILS_CONFIG_CORES_H 1 | ||
|
||
#ifndef PRIsz | ||
#define PRIsz "zu" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the idea of this define? %zu is always used for size_t data type. Why don't use %zu directly in the string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at the PR #2512 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great. So it doesn't make sense to duplicate it here. Just use src/daemon/globals.h.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not backported to 5.8. So it is necessary to be compatible with 5.8 branch. After merge to master it could be deleted. In current state it goes well with both master and 5.8 branches. It is easier to keep this small define than to replace %zu everywhere later on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, that's fine.
* | ||
* For empty string "" *cgl is not modified and zero is returned. | ||
*/ | ||
int config_cores_parse(const oconfig_item_t *ci, core_groups_list_t *cgl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add forward declaration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added include for configfile.h
to avoid forward declaration.
ci->values[i].value.string); | ||
goto parse_error; | ||
} | ||
n = str_list_to_nums(str, cores, STATIC_ARRAY_SIZE(cores)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
size_t n =...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to define variables at the beginning of scope not on first use. It is used in most of the code. Are there any strong arguments for change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The collectd maintainers suggest to minimize the scope of of declaration of variable as much as possible. E.g. see #1971 (comment) comment. That's the why I suggest to declare it in place where this variable is used first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The collectd maintainers suggest to minimize the scope of of declaration of variable as much as possible. E.g. see #1971 (comment) comment. That's the why I suggest to declare it in place where this variable is used first.
rdt_free_cgroups(); | ||
ERROR(RDT_PLUGIN ": Error parsing core groups configuration."); | ||
return -EINVAL; | ||
} | ||
n = g_rdt->cores.num_cgroups; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
size_t n = ..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to define variables at the beginning of scope not on first use. It is used in most of the code and in line with existing implementation. Are there any strong arguments for change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
Fix minor issues found during review. Update year to 2018, add include in utils_config_cores.h to avoid forward declaration. Change-Id: I7d657bab7c97d7193d7977ef129181cad13d73d5 Signed-off-by: Kamil Wiatrowski <kamilx.wiatrowski@intel.com>
Hi @rpv-tomsk, are there chances for this change to be merged into 5.8 branch? |
src/intel_pmu.c
Outdated
return; | ||
} | ||
for (size_t j = 0; j < cgroup->num_cores; j++) | ||
snprintf(cores + strlen(cores), cores_size - strlen(cores), " %d", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check for failure
src/intel_pmu.c
Outdated
@@ -270,20 +325,17 @@ static int pmu_config(oconfig_item_t *ci) { | |||
return 0; | |||
} | |||
|
|||
static void pmu_submit_counter(int cpu, char *event, counter_t value, | |||
static void pmu_submit_counter(char *cgroup, char *event, counter_t value, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cgroup is not modified, can you make it const?
I've left a few comments inline. Once these are resolved I'll merge. Just for future reference, new functionality land in master, the stable branches should just receive bug fixes. |
Check for failure from snprintf. Make cgroup and event const in pmu_submit_counter. Change-Id: I5547375da26c3a63b76588b733e844e3199e9bb8 Signed-off-by: Kamil Wiatrowski <kamilx.wiatrowski@intel.com>
@rubenk, thanks for the review and comments. I've committed next patch to resolve them. |
Thank you @kwiatrox! |
New "Cores" option is similar to that available in intel_rdt plugin.
New tool utils_config_cores is added to parse "Cores" option. It is used by intel_pmu and intel_rdt to avoid redundant code.
Having this option will allow to configure monitoring of PMU events only on specific CPUs thus decrease number of opened descriptors and improve performance significantly.