perf header: Support HYBRID_TOPOLOGY feature
PATCH 1/2 perf header: Support HYBRID_TOPOLOGY feature
It would be useful to let user know the hybrid topology. Adding HYBRID_TOPOLOGY feature in header to indicate the core cpus and the atom cpus.
With this patch,
For the perf.data generated on hybrid platform, reports the hybrid cpu list.
root@otcpl-adl-s-2:~# perf report --header-only -I ... # cpu_core cpu list : 0-15 # cpu_atom cpu list : 16-23
For the perf.data generated on non-hybrid platform, reports the message that HYBRID_TOPOLOGY is missing.
root@kbl-ppc:~# perf report --header-only -I ... # missing features: TRACING_DATA BRANCH_STACK GROUP_DESC AUXTRACE STAT CLOCKID DIR_FORMAT COMPRESSED CLOCK_DATA HYBRID_TOPOLOGY
Note that: this patch is on tmp.perf/core.
--- tools/perf/util/cputopo.c | 80 +++++++++++++++++++++++++++++++ tools/perf/util/cputopo.h | 13 +++++ tools/perf/util/env.c | 6 +++ tools/perf/util/env.h | 7 +++ tools/perf/util/header.c | 92 ++++++++++++++++++++++++++++++++++++ tools/perf/util/header.h | 1 + tools/perf/util/pmu-hybrid.h | 11 +++++ 7 files changed, 210 insertions(+)
tools/perf/util/cputopo.c +80 -0
@@ -12,6 +12,7 @@#include "cpumap.h" #include "debug.h" #include "env.h" +#include "pmu-hybrid.h" #define CORE_SIB_FMT \ "%s/devices/system/cpu/cpu%d/topology/core_siblings_list"
@@ -351,3 +352,82 @@ void numa_topology__delete(struct numa_topology *tp)free (tp); } + +static int load_hybrid_node (struct hybrid_topology_node *node, +struct perf_pmu *pmu) +{ +const char *sysfs; +char path[PATH_MAX ]; +char *buf =NULL , *p; +FILE *fp; +size_t len =0 ; + + node->pmu_name =strdup (pmu->name); +if (!node->pmu_name) +return -1 ; + + sysfs =sysfs__mountpoint (); +if (!sysfs) + goto err; + +snprintf (path,PATH_MAX ,CPUS_TEMPLATE_CPU , sysfs, pmu->name); + fp =fopen (path,"r" ); +if (!fp) + goto err; + +if (getline (&buf, &len, fp) <=0 ) { +fclose (fp); + goto err; + } + + p =strchr (buf,'\n' ); +if (p) + *p ='\0' ; + +fclose (fp); + node->cpus = buf; +return 0 ; + +err: +zfree (&node->pmu_name); +free (buf); +return -1 ; +} + +struct hybrid_topology *hybrid_topology__new (void ) +{ +struct perf_pmu *pmu; +struct hybrid_topology *tp =NULL ; +u32 nr =0 , i =0 ; + + nr =perf_pmu__hybrid_pmu_num (); +if (nr ==0 ) +return NULL ; + + tp =zalloc (sizeof (*tp) +sizeof (tp->nodes[0 ]) * nr); +if (!tp) +return NULL ; + + tp->nr = nr; +perf_pmu__for_each_hybrid_pmu (pmu) { +if (load_hybrid_node (&tp->nodes[i], pmu)) { +hybrid_topology__delete (tp); +return NULL ; + } + i++; + } + +return tp; +} + +void hybrid_topology__delete (struct hybrid_topology *tp) +{ +u32 i; + +for (i =0 ; i < tp->nr; i++) { +zfree (&tp->nodes[i].pmu_name); +zfree (&tp->nodes[i].cpus); + } + +free (tp); +}
tools/perf/util/cputopo.h +13 -0
@@ -25,10 +25,23 @@ struct numa_topology { struct numa_topology_node nodes[]; }; +struct hybrid_topology_node { +char *pmu_name; +char *cpus; +}; + +struct hybrid_topology { +u32 nr; +struct hybrid_topology_node nodes[]; +}; +struct cpu_topology *cpu_topology__new (void );void cpu_topology__delete (struct cpu_topology *tp);struct numa_topology *numa_topology__new (void );void numa_topology__delete (struct numa_topology *tp); +struct hybrid_topology *hybrid_topology__new (void ); +void hybrid_topology__delete (struct hybrid_topology *tp); +#endif /* __PERF_CPUTOPO_H */
tools/perf/util/env.c +6 -0
@@ -202,6 +202,12 @@ void perf_env__exit(struct perf_env *env)for (i =0 ; i < env->nr_memory_nodes; i++)zfree (&env->memory_nodes[i].set);zfree (&env->memory_nodes); + +for (i =0 ; i < env->nr_hybrid_nodes; i++) { +perf_cpu_map__put (env->hybrid_nodes[i].map); +zfree (&env->hybrid_nodes[i].pmu_name); + } +zfree (&env->hybrid_nodes); }void perf_env__init (struct perf_env *env__maybe_unused )
tools/perf/util/env.h +7 -0
@@ -37,6 +37,11 @@ struct memory_node {unsigned long *set; }; +struct hybrid_node { +char *pmu_name; +struct perf_cpu_map *map; +}; +struct perf_env {char *hostname;char *os_release;
@@ -59,6 +64,7 @@ struct perf_env {int nr_pmu_mappings;int nr_groups;int nr_cpu_pmu_caps; +int nr_hybrid_nodes;char *cmdline;const char **cmdline_argv;char *sibling_cores;
@@ -77,6 +83,7 @@ struct perf_env {struct numa_node *numa_nodes;struct memory_node *memory_nodes;unsigned long long memory_bsize; +struct hybrid_node *hybrid_nodes;#ifdef HAVE_LIBBPF_SUPPORT /* * bpf_info_lock protects bpf rbtrees. This is needed because the
tools/perf/util/header.c +92 -0
116 lines not on this page · raw message
tools/perf/util/header.h +1 -0
@@ -45,6 +45,7 @@ enum {HEADER_COMPRESSED ,HEADER_CPU_PMU_CAPS ,HEADER_CLOCK_DATA , +HEADER_HYBRID_TOPOLOGY ,HEADER_LAST_FEATURE , HEADER_FEAT_BITS = 256, };
tools/perf/util/pmu-hybrid.h +11 -0
@@ -19,4 +19,15 @@ struct perf_pmu *perf_pmu__find_hybrid_pmu(const char *name);bool perf_pmu__is_hybrid (const char *name);char *perf_pmu__hybrid_type_to_pmu (const char *type); +static inline int perf_pmu__hybrid_pmu_num (void ) +{ +struct perf_pmu *pmu; +int num =0 ; + +perf_pmu__for_each_hybrid_pmu (pmu) + num++; + +return num; +} +#endif /* __PMU_HYBRID_H */
Signature · 1 line
2.17.1
PATCH 2/2 perf header: Support hybrid CPU_PMU_CAPS
On hybrid platform, it may have several cpu pmus, such as, "cpu_core" and "cpu_atom". The CPU_PMU_CAPS feature in perf header needs to be improved to support multiple cpu pmus.
The new layout in header is defined as:
<nr_caps>
<caps string>
<caps string>
<pmu name>
<nr of rest pmus>
It's considered to be compatible with old perf.data (the perf.data generated by old perf tool).
With this patch, some examples,
New perf tool with new perf.data
(new perf.data is generated on hybrid platform):
root@otcpl-adl-s-2:~# perf report --header-only -I ... # cpu_core pmu capabilities: branches=32, max_precise=3, pmu_name=alderlake_hybrid # cpu_atom pmu capabilities: branches=32, max_precise=3, pmu_name=alderlake_hybrid
New perf tool with new perf.data
(new perf.data is generated on non-hybrid platform):
root@kbl-ppc:~# perf report --header-only -I ... # cpu pmu capabilities: branches=32, max_precise=3, pmu_name=skylake
New perf tool with old perf.data
(old perf.data is generated by old perf tool on non-hybrid platform):
root@kbl-ppc:~# perf report --header-only -I ... # cpu pmu capabilities: branches=32, max_precise=3, pmu_name=skylake
Note that: this patch is on tmp.perf/core.
--- tools/perf/util/env.c | 6 ++ tools/perf/util/env.h | 11 ++- tools/perf/util/header.c | 175 ++++++++++++++++++++++++++++++++++----- 3 files changed, 168 insertions(+), 24 deletions(-)
tools/perf/util/env.c +6 -0
@@ -208,6 +208,12 @@ void perf_env__exit(struct perf_env *env)zfree (&env->hybrid_nodes[i].pmu_name); }zfree (&env->hybrid_nodes); + +for (i =0 ; i < env->nr_cpu_pmu_caps_nodes; i++) { +zfree (&env->cpu_pmu_caps_nodes[i].cpu_pmu_caps); +zfree (&env->cpu_pmu_caps_nodes[i].pmu_name); + } +zfree (&env->cpu_pmu_caps_nodes); }void perf_env__init (struct perf_env *env__maybe_unused )
tools/perf/util/env.h +9 -2
@@ -42,6 +42,13 @@ struct hybrid_node {struct perf_cpu_map *map; }; +struct cpu_pmu_caps_node { +int nr_cpu_pmu_caps; +unsigned int max_branches; +char *cpu_pmu_caps; +char *pmu_name; +}; +struct perf_env {char *hostname;char *os_release;
@@ -63,15 +70,14 @@ struct perf_env {int nr_memory_nodes;int nr_pmu_mappings;int nr_groups; -int nr_cpu_pmu_caps;int nr_hybrid_nodes; +int nr_cpu_pmu_caps_nodes;char *cmdline;const char **cmdline_argv;char *sibling_cores;char *sibling_dies;char *sibling_threads;char *pmu_mappings; -char *cpu_pmu_caps;struct cpu_topology_map *cpu;struct cpu_cache_level *caches;int caches_cnt;
@@ -84,6 +90,7 @@ struct perf_env {struct memory_node *memory_nodes;unsigned long long memory_bsize;struct hybrid_node *hybrid_nodes; +struct cpu_pmu_caps_node *cpu_pmu_caps_nodes;#ifdef HAVE_LIBBPF_SUPPORT /* * bpf_info_lock protects bpf rbtrees. This is needed because the
tools/perf/util/header.c +153 -22
256 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [PATCH v1 2/2] perf header: Support hybrid CPU_PMU_CAPS
Quoted 11 lines · Jin Yao
On hybrid platform, it may have several cpu pmus, such as, "
cpu_core" and "cpu_atom". TheCPU_PMU_CAPSfeature in perf header needs to be improved to support multiple cpu pmus.The new layout in header is defined as:
<
nr_caps>
<caps string>
<caps string>
<pmu name>
<nr of rest pmus>
not sure why is the 'nr of rest pmus' needed
the current format is:
u32 nr_cpu_pmu_caps;
{
char name[];
char value[];
} [nr_cpu_pmu_caps]I guess we could extend it to:
u32 nr_cpu_pmu_caps;
{
char name[];
char value[];
} [nr_cpu_pmu_caps]
char pmu_name[]
u32 nr_cpu_pmu_caps;
{
char name[];
char value[];
} [nr_cpu_pmu_caps]
char pmu_name[]
...and we could detect the old format by checking that there's no pmu name.. but maybe I'm missing something, I did not check deeply, please let me know
also would be great to move the format change and storing hybrid pmus in separate patches
thanks,
jirka
Re: [PATCH v1 2/2] perf header: Support hybrid CPU_PMU_CAPS
Hi Jiri,
Quoted 7 lines · Jiri Olsa
Quoted 6 lines · Jin Yao
On hybrid platform, it may have several cpu pmus, such as, "
cpu_core" and "cpu_atom". TheCPU_PMU_CAPSfeature in perf header needs to be improved to support multiple cpu pmus.The new layout in header is defined as:
Quoted 8 lines
Quoted 5 lines
<
nr_caps>
<caps string>
<caps string>
<pmu name>
<nr of rest pmus>not sure why is the 'nr of rest pmus' needed
The 'nr of rest pmus' indicates the remaining pmus which are waiting for process.
For example,
<nr_caps>
<caps string>
"cpu_core"
1
<nr_caps>
<caps string>
"cpu_atom"
0
When we see '0' in data file processing, we know all the pmu have been processed yet.
Quoted 27 lines
the current format is:
u32 nr_cpu_pmu_caps; { char name[]; char value[]; } [nr_cpu_pmu_caps]I guess we could extend it to:
u32 nr_cpu_pmu_caps; { char name[]; char value[]; } [nr_cpu_pmu_caps] char pmu_name[] u32 nr_cpu_pmu_caps; { char name[]; char value[]; } [nr_cpu_pmu_caps] char pmu_name[] ...
Quoted 4 lines
and we could detect the old format by checking that there's no pmu name.. but maybe I'm missing something, I did not check deeply, please let me know
Actually we do the same thing, but I just add an extra 'nr of rest pmus' after the pmu_name. The purpose of 'nr of rest pmus' is when we see '0' at 'nr of rest pmus', we know that all pmus have been processed.
Otherwise, we have to continue reading data file till we find something incorrect and then finally drop the last read data.
So is this solution acceptable?
Quoted 3 lines
also would be great to move the format change and storing hybrid pmus in separate patches
Maybe we have to put the storing and processing into one patch.
Say patch 1 contains the format change and storing hybrid pmus. And patch 2 contains the processing for the new format. If the repo only contains the patch 1, I'm afraid that may introduce the compatible issue.
Thanks
Jin Yao
Quoted 3 lines
thanks,
jirka
Re: [PATCH v1 2/2] perf header: Support hybrid CPU_PMU_CAPS
Quoted 66 lines · Yao
Hi Jiri,
Quoted 7 lines · Jiri Olsa
Quoted 6 lines · Jin Yao
On hybrid platform, it may have several cpu pmus, such as, "
cpu_core" and "cpu_atom". TheCPU_PMU_CAPSfeature in perf header needs to be improved to support multiple cpu pmus.The new layout in header is defined as:
Quoted 8 lines
Quoted 5 lines
<
nr_caps>
<caps string>
<caps string>
<pmu name>
<nr of rest pmus>not sure why is the 'nr of rest pmus' needed
The 'nr of rest pmus' indicates the remaining pmus which are waiting for process.
For example,
<
nr_caps>
<caps string>
"cpu_core"
1
<nr_caps>
<caps string>
"cpu_atom"
0When we see '0' in data file processing, we know all the pmu have been processed yet.
Quoted 27 lines
the current format is:
u32 nr_cpu_pmu_caps; { char name[]; char value[]; } [nr_cpu_pmu_caps]I guess we could extend it to:
u32 nr_cpu_pmu_caps; { char name[]; char value[]; } [nr_cpu_pmu_caps] char pmu_name[] u32 nr_cpu_pmu_caps; { char name[]; char value[]; } [nr_cpu_pmu_caps] char pmu_name[] ...Quoted 4 lines
and we could detect the old format by checking that there's no pmu name.. but maybe I'm missing something, I did not check deeply, please let me know
Quoted 6 lines
Actually we do the same thing, but I just add an extra 'nr of rest pmus' after the
pmu_name. The purpose of 'nr of rest pmus' is when we see '0' at 'nr of rest pmus', we know that all pmus have been processed.Otherwise, we have to continue reading data file till we find something incorrect and then finally drop the last read data.
you have the size of the feature data right? I think we use it in other cases to check if there are more data
Quoted 7 lines
So is this solution acceptable?
Quoted 3 lines
also would be great to move the format change and storing hybrid pmus in separate patches
Quoted 5 lines
Maybe we have to put the storing and processing into one patch.
Say patch 1 contains the format change and storing hybrid pmus. And patch 2 contains the processing for the new format. If the repo only contains the patch 1, I'm afraid that may introduce the compatible issue.
maybe you can have change of caps format in one patch and storing/processing hybrid pmus in another?
jirka
Re: [PATCH v1 2/2] perf header: Support hybrid CPU_PMU_CAPS
Hi Jiri,
Quoted 71 lines · Jiri Olsa
Quoted 70 lines · Yao
Hi Jiri,
Quoted 7 lines · Jiri Olsa
Quoted 6 lines · Jin Yao
On hybrid platform, it may have several cpu pmus, such as, "
cpu_core" and "cpu_atom". TheCPU_PMU_CAPSfeature in perf header needs to be improved to support multiple cpu pmus.The new layout in header is defined as:
Quoted 8 lines
Quoted 5 lines
<
nr_caps>
<caps string>
<caps string>
<pmu name>
<nr of rest pmus>not sure why is the 'nr of rest pmus' needed
The 'nr of rest pmus' indicates the remaining pmus which are waiting for process.
For example,
<
nr_caps>
<caps string>
"cpu_core"
1
<nr_caps>
<caps string>
"cpu_atom"
0When we see '0' in data file processing, we know all the pmu have been processed yet.
Quoted 27 lines
the current format is:
u32 nr_cpu_pmu_caps; { char name[]; char value[]; } [nr_cpu_pmu_caps]I guess we could extend it to:
u32 nr_cpu_pmu_caps; { char name[]; char value[]; } [nr_cpu_pmu_caps] char pmu_name[] u32 nr_cpu_pmu_caps; { char name[]; char value[]; } [nr_cpu_pmu_caps] char pmu_name[] ...Quoted 4 lines
and we could detect the old format by checking that there's no pmu name.. but maybe I'm missing something, I did not check deeply, please let me know
Actually we do the same thing, but I just add an extra 'nr of rest pmus' after the
pmu_name. The purpose of 'nr of rest pmus' is when we see '0' at 'nr of rest pmus', we know that all pmus have been processed.
Quoted 6 lines
Quoted 2 lines
Otherwise, we have to continue reading data file till we find something incorrect and then finally drop the last read data.
you have the size of the feature data right? I think we use it in other cases to check if there are more data
The challenge for us is if we need to compatible with the old perf.data which was generated by old perf tool.
For the old perf.data, the layout in header is:
nr of caps
caps string 1
caps string 2
...
caps string N
It doesn't carry with any other fields such as size of caps data.
To be compatible with old perf.data, so I have to extend the layout to:
nr of caps for pmu 1
caps string 1
caps string 2
...
caps string N
name of pmu 1
nr of rest pmus
nr of caps for pmu2
caps string 1
caps string 2
...
caps string N
name of pmu 2
nr of rest pmus
When the new perf tool detects the string such as "cpu_", it can know that it's the pmu name field in new perf.data, otherwise it's the old perf.data.
If we add new field such as "size" to the layout, I'm afraid the new perf tool can not process the old perf.data correctly.
If we don't need to support old perf.data, that makes things easy.
Quoted 7 lines
Quoted 7 lines
So is this solution acceptable?
Quoted 3 lines
also would be great to move the format change and storing hybrid pmus in separate patches
Quoted 9 lines
Quoted 5 lines
Maybe we have to put the storing and processing into one patch.
Say patch 1 contains the format change and storing hybrid pmus. And patch 2 contains the processing for the new format. If the repo only contains the patch 1, I'm afraid that may introduce the compatible issue.
maybe you can have change of caps format in one patch and storing/processing hybrid pmus in another?
But there is no data structure defined in header.h for each feature.
It directly uses do_write/do_write_string in 'write()' ops to write the feature data.
So for the new layout, as I mentioned above, if we change the layout to
nr of caps for pmu 1
caps string 1
caps string 2
...
caps string N
"cpu"
0
We need to call do_write/do_write_string, actually it's the storing method. So I don't understand well for having changes of caps format in one patch, I'm sorry about that. :(
Thanks
Jin Yao
Quoted 2 lines
jirka
Re: [PATCH v1 2/2] perf header: Support hybrid CPU_PMU_CAPS
On Thu, May 06, 2021 at 10:43:39PM +0800, Jin, Yao wrote:
SNIP
Quoted 40 lines
Quoted 8 lines
Quoted 4 lines
'nr of rest pmus', we know that all pmus have been processed.
Otherwise, we have to continue reading data file till we find something incorrect and then finally drop the last read data.
you have the size of the feature data right? I think we use it in other cases to check if there are more data
The challenge for us is if we need to compatible with the old perf.data which was generated by old perf tool.
For the old perf.data, the layout in header is:
nr of caps
caps string 1
caps string 2
...
caps string NIt doesn't carry with any other fields such as size of caps data.
To be compatible with old perf.data, so I have to extend the layout to:
nr of caps for pmu 1
caps string 1
caps string 2
...
caps string N
name of pmu 1
nr of rest pmusnr of caps for pmu2
caps string 1
caps string 2
...
caps string N
name of pmu 2
nr of rest pmus
Quoted 2 lines
When the new perf tool detects the string such as "
cpu_", it can know that it's the pmu name field in new perf.data, otherwise it's the old perf.data.
what if the cap string starts with 'cpu_' ?
I think it might be better to create new feature that stores caps for multiple pmus in generic way
Quoted 5 lines
If we add new field such as "size" to the layout, I'm afraid the new perf tool can not process the old perf.data correctly.
If we don't need to support old perf.data, that makes things easy.
we need to
jirka
Re: [PATCH v1 2/2] perf header: Support hybrid CPU_PMU_CAPS
Hi Jiri,
Quoted 44 lines · Jiri Olsa
On Thu, May 06, 2021 at 10:43:39PM +0800, Jin, Yao wrote:
SNIP
Quoted 40 lines
Quoted 8 lines
Quoted 4 lines
'nr of rest pmus', we know that all pmus have been processed.
Otherwise, we have to continue reading data file till we find something incorrect and then finally drop the last read data.
you have the size of the feature data right? I think we use it in other cases to check if there are more data
The challenge for us is if we need to compatible with the old perf.data which was generated by old perf tool.
For the old perf.data, the layout in header is:
nr of caps
caps string 1
caps string 2
...
caps string NIt doesn't carry with any other fields such as size of caps data.
To be compatible with old perf.data, so I have to extend the layout to:
nr of caps for pmu 1
caps string 1
caps string 2
...
caps string N
name of pmu 1
nr of rest pmusnr of caps for pmu2
caps string 1
caps string 2
...
caps string N
name of pmu 2
nr of rest pmus
Quoted 5 lines
Quoted 2 lines
When the new perf tool detects the string such as "
cpu_", it can know that it's the pmu name field in new perf.data, otherwise it's the old perf.data.what if the cap string starts with '
cpu_' ?
I just assume the cap string would not have 'cpu_' string. Yes, I agree, that's not a very good solution.
Quoted 3 lines
I think it might be better to create new feature that stores caps for multiple pmus in generic way
Yes, creating a new feature in header (such as "HYBRID_CPU_PMU_CAPS") is a better way.
Quoted 8 lines
Quoted 5 lines
If we add new field such as "size" to the layout, I'm afraid the new perf tool can not process the old perf.data correctly.
If we don't need to support old perf.data, that makes things easy.
we need to
Yes, we need to. I'm now preparing v3.
Thanks
Jin Yao
Quoted 2 lines
jirka
Arnaldo Carvalho de Melo
maintainerEm Fri, Apr 30, 2021 at 03:46:01PM +0800, Jin Yao escreveu:
tools/perf/util/cputopo.c void numa_topology__delete(struct numa_topology *tp) · line 403
Quoted 7 lines
tools/perf/util/cputopo.c +7
-0+struct hybrid_topology *hybrid_topology__new (void ) +{ +struct perf_pmu *pmu; +struct hybrid_topology *tp =NULL ; +u32 nr =0 , i =0 ; + + nr =perf_pmu__hybrid_pmu_num ();
Initialize it to zero and right away overwrite it with a function return?
tools/perf/util/cputopo.c void numa_topology__delete(struct numa_topology *tp) · line 401
Quoted 1 line
tools/perf/util/cputopo.c +1
-0+u32 nr =0 , i =0 ;
u32 nr = perf_pmu__hybrid_pmu_num(), i;
tools/perf/util/cputopo.c void numa_topology__delete(struct numa_topology *tp) · line 411
Quoted 8 lines
tools/perf/util/cputopo.c +8
-0+if (nr ==0 ) +return NULL ; + + tp =zalloc (sizeof (*tp) +sizeof (tp->nodes[0 ]) * nr); +if (!tp) +return NULL ; + + tp->nr = nr;
i = 0;
Please fix these and add an entry to tools/perf/Documentation/perf.data-file-format.txt for this new feature, then submit v2.
And on 2/2 please update the CPU_PMU_CAPS entry in tools/perf/Documentation/perf.data-file-format.txt.
Thanks,
- Arnaldo
Quoted 258 lines
tools/perf/util/cputopo.c +22
-0+perf_pmu__for_each_hybrid_pmu (pmu) { +if (load_hybrid_node (&tp->nodes[i], pmu)) { +hybrid_topology__delete (tp); +return NULL ; + } + i++; + } + +return tp; +} + +void hybrid_topology__delete (struct hybrid_topology *tp) +{ +u32 i; + +for (i =0 ; i < tp->nr; i++) { +zfree (&tp->nodes[i].pmu_name); +zfree (&tp->nodes[i].cpus); + } + +free (tp); +}tools/perf/util/cputopo.h +13
-0@@ -25,10 +25,23 @@ struct numa_topology { struct numa_topology_node nodes[]; }; +struct hybrid_topology_node { +char *pmu_name; +char *cpus; +}; + +struct hybrid_topology { +u32 nr; +struct hybrid_topology_node nodes[]; +}; +struct cpu_topology *cpu_topology__new (void );void cpu_topology__delete (struct cpu_topology *tp);struct numa_topology *numa_topology__new (void );void numa_topology__delete (struct numa_topology *tp); +struct hybrid_topology *hybrid_topology__new (void ); +void hybrid_topology__delete (struct hybrid_topology *tp); +#endif /* __PERF_CPUTOPO_H */ tools/perf/util/env.c +6
-0@@ -202,6 +202,12 @@ void perf_env__exit(struct perf_env *env)for (i =0 ; i < env->nr_memory_nodes; i++)zfree (&env->memory_nodes[i].set);zfree (&env->memory_nodes); + +for (i =0 ; i < env->nr_hybrid_nodes; i++) { +perf_cpu_map__put (env->hybrid_nodes[i].map); +zfree (&env->hybrid_nodes[i].pmu_name); + } +zfree (&env->hybrid_nodes); }void perf_env__init (struct perf_env *env__maybe_unused )tools/perf/util/env.h +7
-0@@ -37,6 +37,11 @@ struct memory_node {unsigned long *set; }; +struct hybrid_node { +char *pmu_name; +struct perf_cpu_map *map; +}; +struct perf_env {char *hostname;char *os_release;@@ -59,6 +64,7 @@ struct perf_env {int nr_pmu_mappings;int nr_groups;int nr_cpu_pmu_caps; +int nr_hybrid_nodes;char *cmdline;const char **cmdline_argv;char *sibling_cores;@@ -77,6 +83,7 @@ struct perf_env {struct numa_node *numa_nodes;struct memory_node *memory_nodes;unsigned long long memory_bsize; +struct hybrid_node *hybrid_nodes;#ifdef HAVE_LIBBPF_SUPPORT /* * bpf_info_lock protects bpf rbtrees. This is needed because the tools/perf/util/header.c +92
-0@@ -932,6 +932,40 @@ static int write_clock_data(struct feat_fd *ff,return do_write (ff, data64,sizeof (*data64)); } +static int write_hybrid_topology (struct feat_fd *ff, +struct evlist *evlist__maybe_unused ) +{ +struct hybrid_topology *tp; +int ret; +u32 i; + + tp =hybrid_topology__new (); +if (!tp) +return -1 ; + + ret =do_write (ff, &tp->nr,sizeof (u32)); +if (ret <0 ) + goto err; + +for (i =0 ; i < tp->nr; i++) { +struct hybrid_topology_node *n = &tp->nodes[i]; + + ret =do_write_string (ff, n->pmu_name); +if (ret <0 ) + goto err; + + ret =do_write_string (ff, n->cpus); +if (ret <0 ) + goto err; + } + + ret =0 ; + +err: +hybrid_topology__delete (tp); +return ret; +} +static int write_dir_format (struct feat_fd *ff,struct evlist *evlist__maybe_unused ) {@@ -1623,6 +1657,19 @@ static void print_clock_data(struct feat_fd *ff, FILE *fp) clockid_name(clockid)); } +static void print_hybrid_topology (struct feat_fd *ff,FILE *fp) +{ +int i; +struct hybrid_node *n; + +for (i =0 ; i < ff->ph->env.nr_hybrid_nodes; i++) { + n = &ff->ph->env.hybrid_nodes[i]; + +fprintf (fp,"# %s cpu list : " , n->pmu_name); +cpu_map__fprintf (n->map, fp); + } +} +static void print_dir_format (struct feat_fd *ff,FILE *fp) {struct perf_session *session;@@ -2849,6 +2896,50 @@ static int process_clock_data(struct feat_fd *ff,return 0 ; } +static int process_hybrid_topology (struct feat_fd *ff, +void *data__maybe_unused ) +{ +struct hybrid_node *nodes, *n; +u32 nr, i; +char *str; + +/* nr nodes */ +if (do_read_u32 (ff, &nr)) +return -1 ; + + nodes =zalloc (sizeof (*nodes) * nr); +if (!nodes) +return -ENOMEM ; + +for (i =0 ; i < nr; i++) { + n = &nodes[i]; + + n->pmu_name =do_read_string (ff); +if (!n->pmu_name) + goto error; + + str =do_read_string (ff); +if (!str) + goto error; + + n->map =perf_cpu_map__new (str); +free (str); +if (!n->map) + goto error; + } + + ff->ph->env.nr_hybrid_nodes = nr; + ff->ph->env.hybrid_nodes = nodes; +return 0 ; + +error: +for (i =0 ; i < nr; i++) +free (nodes[i].pmu_name); + +free (nodes); +return -1 ; +} +static int process_dir_format (struct feat_fd *ff,void *_data__maybe_unused ) {@@ -3117,6 +3208,7 @@ const struct perf_header_feature_ops feat_ops[HEADER_LAST_FEATURE] = {FEAT_OPR (COMPRESSED , compressed, false),FEAT_OPR (CPU_PMU_CAPS , cpu_pmu_caps, false),FEAT_OPR (CLOCK_DATA , clock_data, false), + FEAT_OPN(HYBRID_TOPOLOGY, hybrid_topology, true), }; struct header_print_data {tools/perf/util/header.h +1
-0@@ -45,6 +45,7 @@ enum {HEADER_COMPRESSED ,HEADER_CPU_PMU_CAPS ,HEADER_CLOCK_DATA , +HEADER_HYBRID_TOPOLOGY ,HEADER_LAST_FEATURE , HEADER_FEAT_BITS = 256, };tools/perf/util/pmu-hybrid.h +11
-0@@ -19,4 +19,15 @@ struct perf_pmu *perf_pmu__find_hybrid_pmu(const char *name);bool perf_pmu__is_hybrid (const char *name);char *perf_pmu__hybrid_type_to_pmu (const char *type); +static inline int perf_pmu__hybrid_pmu_num (void ) +{ +struct perf_pmu *pmu; +int num =0 ; + +perf_pmu__for_each_hybrid_pmu (pmu) + num++; + +return num; +} +#endif /* __PMU_HYBRID_H */ Signature · 1 line
2.17.1
Signature · 1 line
- Arnaldo
Hi Arnaldo,
Quoted 12 lines · Arnaldo Carvalho de Melo
Em Fri, Apr 30, 2021 at 03:46:01PM +0800, Jin Yao escreveu:
tools/perf/util/cputopo.c void numa_topology__delete(struct numa_topology *tp) · line 403
Quoted 7 lines
tools/perf/util/cputopo.c +7
-0+struct hybrid_topology *hybrid_topology__new (void ) +{ +struct perf_pmu *pmu; +struct hybrid_topology *tp =NULL ; +u32 nr =0 , i =0 ; + + nr =perf_pmu__hybrid_pmu_num ();Initialize it to zero and right away overwrite it with a function return?
Hmm, yes, the 'nr' doesn't need to be initialized to 0, sorry about that.
Quoted 15 lines
tools/perf/util/cputopo.c void numa_topology__delete(struct numa_topology *tp) · line 401
Quoted 1 line
tools/perf/util/cputopo.c +1
-0+u32 nr =0 , i =0 ;u32 nr = perf_pmu__hybrid_pmu_num(), i;tools/perf/util/cputopo.c void numa_topology__delete(struct numa_topology *tp) · line 411
Quoted 8 lines
tools/perf/util/cputopo.c +8
-0+if (nr ==0 ) +return NULL ; + + tp =zalloc (sizeof (*tp) +sizeof (tp->nodes[0 ]) * nr); +if (!tp) +return NULL ; + + tp->nr = nr;i = 0;
Quoted 9 lines
Please fix these and add an entry to
tools/perf/Documentation/perf.data-file-format.txtfor this new feature, then submit v2.And on 2/2 please update the
CPU_PMU_CAPSentry intools/perf/Documentation/perf.data-file-format.txt.Thanks,
OK, I will add these features to perf.data-file-format.txt and then post v2.
Thanks
Jin Yao
Quoted 529 lines
- Arnaldo
Quoted 228 lines
tools/perf/util/cputopo.c +22
-0+perf_pmu__for_each_hybrid_pmu (pmu) { +if (load_hybrid_node (&tp->nodes[i], pmu)) { +hybrid_topology__delete (tp); +return NULL ; + } + i++; + } + +return tp; +} + +void hybrid_topology__delete (struct hybrid_topology *tp) +{ +u32 i; + +for (i =0 ; i < tp->nr; i++) { +zfree (&tp->nodes[i].pmu_name); +zfree (&tp->nodes[i].cpus); + } + +free (tp); +}tools/perf/util/cputopo.h +13
-0@@ -25,10 +25,23 @@ struct numa_topology { struct numa_topology_node nodes[]; }; +struct hybrid_topology_node { +char *pmu_name; +char *cpus; +}; + +struct hybrid_topology { +u32 nr; +struct hybrid_topology_node nodes[]; +}; +struct cpu_topology *cpu_topology__new (void );void cpu_topology__delete (struct cpu_topology *tp);struct numa_topology *numa_topology__new (void );void numa_topology__delete (struct numa_topology *tp); +struct hybrid_topology *hybrid_topology__new (void ); +void hybrid_topology__delete (struct hybrid_topology *tp); +#endif /* __PERF_CPUTOPO_H */ tools/perf/util/env.c +6
-0@@ -202,6 +202,12 @@ void perf_env__exit(struct perf_env *env)for (i =0 ; i < env->nr_memory_nodes; i++)zfree (&env->memory_nodes[i].set);zfree (&env->memory_nodes); + +for (i =0 ; i < env->nr_hybrid_nodes; i++) { +perf_cpu_map__put (env->hybrid_nodes[i].map); +zfree (&env->hybrid_nodes[i].pmu_name); + } +zfree (&env->hybrid_nodes); }void perf_env__init (struct perf_env *env__maybe_unused )tools/perf/util/env.h +7
-0@@ -37,6 +37,11 @@ struct memory_node {unsigned long *set; }; +struct hybrid_node { +char *pmu_name; +struct perf_cpu_map *map; +}; +struct perf_env {char *hostname;char *os_release;@@ -59,6 +64,7 @@ struct perf_env {int nr_pmu_mappings;int nr_groups;int nr_cpu_pmu_caps; +int nr_hybrid_nodes;char *cmdline;const char **cmdline_argv;char *sibling_cores;@@ -77,6 +83,7 @@ struct perf_env {struct numa_node *numa_nodes;struct memory_node *memory_nodes;unsigned long long memory_bsize; +struct hybrid_node *hybrid_nodes;#ifdef HAVE_LIBBPF_SUPPORT /* * bpf_info_lock protects bpf rbtrees. This is needed because the tools/perf/util/header.c +92
-0@@ -932,6 +932,40 @@ static int write_clock_data(struct feat_fd *ff,return do_write (ff, data64,sizeof (*data64)); } +static int write_hybrid_topology (struct feat_fd *ff, +struct evlist *evlist__maybe_unused ) +{ +struct hybrid_topology *tp; +int ret; +u32 i; + + tp =hybrid_topology__new (); +if (!tp) +return -1 ; + + ret =do_write (ff, &tp->nr,sizeof (u32)); +if (ret <0 ) + goto err; + +for (i =0 ; i < tp->nr; i++) { +struct hybrid_topology_node *n = &tp->nodes[i]; + + ret =do_write_string (ff, n->pmu_name); +if (ret <0 ) + goto err; + + ret =do_write_string (ff, n->cpus); +if (ret <0 ) + goto err; + } + + ret =0 ; + +err: +hybrid_topology__delete (tp); +return ret; +} +static int write_dir_format (struct feat_fd *ff,struct evlist *evlist__maybe_unused ) {@@ -1623,6 +1657,19 @@ static void print_clock_data(struct feat_fd *ff, FILE *fp) clockid_name(clockid)); } +static void print_hybrid_topology (struct feat_fd *ff,FILE *fp) +{ +int i; +struct hybrid_node *n; + +for (i =0 ; i < ff->ph->env.nr_hybrid_nodes; i++) { + n = &ff->ph->env.hybrid_nodes[i]; + +fprintf (fp,"# %s cpu list : " , n->pmu_name); +cpu_map__fprintf (n->map, fp); + } +} +static void print_dir_format (struct feat_fd *ff,FILE *fp) {struct perf_session *session;@@ -2849,6 +2896,50 @@ static int process_clock_data(struct feat_fd *ff,return 0 ; } +static int process_hybrid_topology (struct feat_fd *ff, +void *data__maybe_unused ) +{ +struct hybrid_node *nodes, *n; +u32 nr, i; +char *str; + +/* nr nodes */ +if (do_read_u32 (ff, &nr)) +return -1 ; + + nodes =zalloc (sizeof (*nodes) * nr); +if (!nodes) +return -ENOMEM ; + +for (i =0 ; i < nr; i++) { + n = &nodes[i]; + + n->pmu_name =do_read_string (ff); +if (!n->pmu_name) + goto error; + + str =do_read_string (ff); +if (!str) + goto error; + + n->map =perf_cpu_map__new (str); +free (str); +if (!n->map) + goto error; + } + + ff->ph->env.nr_hybrid_nodes = nr; + ff->ph->env.hybrid_nodes = nodes; +return 0 ; + +error: +for (i =0 ; i < nr; i++) +free (nodes[i].pmu_name); + +free (nodes); +return -1 ; +} +static int process_dir_format (struct feat_fd *ff,void *_data__maybe_unused ) {@@ -3117,6 +3208,7 @@ const struct perf_header_feature_ops feat_ops[HEADER_LAST_FEATURE] = {FEAT_OPR (COMPRESSED , compressed, false),FEAT_OPR (CPU_PMU_CAPS , cpu_pmu_caps, false),FEAT_OPR (CLOCK_DATA , clock_data, false), + FEAT_OPN(HYBRID_TOPOLOGY, hybrid_topology, true), }; struct header_print_data {tools/perf/util/header.h +0
-0tools/perf/util/header.h enum { · line 48
Quoted 4 lines
tools/perf/util/header.h +1
-0@@ -45,6 +45,7 @@ enum {HEADER_COMPRESSED ,HEADER_CPU_PMU_CAPS ,HEADER_CLOCK_DATA , + HEADER_HYBRID_TOPOLOGY,Return-Path: <[email protected]>
X-Original-To: [email protected]
Delivered-To: [email protected]
Received: from fmsmga001.fm.intel.com (fmsmga001.fm.intel.com [10.253.24.23])(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by linux.intel.com (Postfix) with ESMTPS id 36D9D580906; Mon, 3 May 2021 14:36:22 -0700 (PDT)IronPort-SDR: esi0FcPI009YsspGtVZcbgLx4B9FM+DVeKXdx+v+ajHsniBl02v1XF8B+GMpGwaPP2H9NXBHuF
joSEEGiTA5aJAoGf5ZBZFiJIiA6enxguk=
X-IronPort-AV: E=McAfee;i="6200,9189,9973"; a="530707860"
X-IronPort-AV: E=Sophos;i="5.82,271,1613462400";d="scan'208";a="530707860"Received: from orsmga105.jf.intel.com ([10.7.208.20])
by fmsmga001-1.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 May 2021 14:36:20 -0700
IronPort-SDR: 1MJbwfsAApKPsXRZYJaw3MaQlazYe6d7MM5ej4rEMjuYIk6Y+2Z9DqulfOSCsHkn0nZr0G2HbP
q+BNQ+kZ+1D8MTqu9shQXHRg9QFF2M1HE=
X-SG-BADATTACHMENTNOREPLY: True
X-IPAS-Result: =?us-ascii?q?A0FLAAAhbJBghxJggBdaHAEBAQEBAQcBARIBAQQEAQGCA?=
=?us-ascii?q?wcBAQsBg3gBASUSMYxoYIcDgR8qJQOBDJlzFIFfFAEBAQEBAQEBAQkdFAECB?= =?us-ascii?q?AEBhk4CJTQJDQECBAEBAQMCAQIBAQEBAQECAgEBAQIBAQUCAQEBAQIQAQEBA?= =?us-ascii?q?YEFAWBjAYFGAYFxBgQ9gjgig3QDAwECJAsBRgYJAR8yA1QHEgWCbIMIBapPM?= =?us-ascii?q?4EBiDmBRIE6AYhzdIN4J4EEgSOBFTOCOXSEKIYSBII3DwEqE1EBMBI9eEcTB?= =?us-ascii?q?UkDnlCcPgeDE4Eom3YQJ4NUkSmQJZUvghadQ4QwgVQ4gVwzGiODOU0BAgECA?= =?us-ascii?q?QwBAgIDAQIBAgEHAQECAY4nFo5LIQEBMAI2AgYKAQEDCVkBAYw0AQE?=
IronPort-PHdr: A9a23:XIaJvhVUx1aBDpY6+i5LE4vNh53V8KyPWjF92vIco4ILSbyq+tHYB
Gea288FpGHAUYiT0f9Yke2e6/mmBTVRp8za7DtbKsIEfiRGoP1epxYnDs+BBB+zB9/RRAt+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DDR3amtv+q2zRXRzQbonu5rseH8wdhODtHksLlzFhzQjG+TFeFccozHnCsyp9io80tvuO akmXtOX/hb2jf0dmGxrQCF4XiZ7B8er1vryVqZhnWmhMziWVsBert8ub4=
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-AV: E=McAfee;i="6200,9189,9973"; a="261790135"
X-IronPort-AV: E=Sophos;i="5.82,271,1613462400";d="scan'208";a="261790135"X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from vger.kernel.org ([23.128.96.18])
by mtab.intel.com with ESMTP; 03 May 2021 14:36:07 -0700
Received: ([email protected]) by vger.kernel.org via listexpand
id S229846AbhECVg4 (ORCPT <rfc822;[email protected]>
+ 29 others); Mon, 3 May 2021 17:36:56 -0400
Received: from mga18.intel.com ([134.134.136.126]:6730 "EHLO mga18.intel.com"rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229764AbhECVgw (ORCPT <rfc822;[email protected]>); Mon, 3 May 2021 17:36:52 -0400IronPort-SDR: 1csj0DEIMG/4QUsFu3BmUbvFdT7jBonCObhRz0qmqggHKb35l90RoafgGQbJRBABy2bIFj1oyz
QE6rWT57N1bw==
X-IronPort-AV: E=McAfee;i="6200,9189,9973"; a="185312154"
X-IronPort-AV: E=Sophos;i="5.82,271,1613462400";d="scan'208";a="185312154"Received: from fmsmga008.fm.intel.com ([10.253.24.58])
by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 May 2021 14:35:57 -0700
IronPort-SDR: /v7zWWgeCpbkRPEz3SQB9i9+7fEAMEScp2HIQ7R0gaTFo8YKVYigkoddcEJ3InSW9wC39KNvod
e9jWlQq2QaDQ==X-IronPort-AV: E=Sophos;i="5.82,271,1613462400"; d="scan'208";a="428548807" Received: from rhweight-mobl2.amr.corp.intel.com (HELO rhweight-mobl2.ra.intel.com) ([10.212.218.202]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 May 2021 14:35:56 -0700 From: Russ Weight <[email protected]> To: [email protected], [email protected],[email protected]
Cc: [email protected], [email protected], [email protected],
[email protected], [email protected], [email protected], Russ Weight <[email protected]>
Subject: [PATCH v12 3/7] fpga: sec-mgr: expose sec-mgr update status
Date: Mon, 3 May 2021 14:35:42 -0700
Message-Id: <[email protected]>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <[email protected]>
References: <[email protected]>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: [email protected]Extend the FPGA Security Manager class driver to include an update/status sysfs node that can be polled and read to monitor the progress of an ongoing secure update.
Sysfs_notify()is used to signal transitions between different phases of the update process.Signed-off-by Russ Weight <[email protected]>Reviewed-by Tom Rix <[email protected]>---
v12:- Updated Date and KernelVersion fields in ABI documentation - Changed syntax of sec_mgr_prog_str[] array definition from: "idle", /* FPGA_SEC_PROG_IDLE */ to: [FPGA_SEC_PROG_IDLE] = "idle",v11:
- No change
v10:
- Rebased to 5.12-rc2 next
- Updated Date and KernelVersion in ABI documentation
v9:
- Updated Date and KernelVersion in ABI documentation
v8:
- No change
v7:
- Changed Date in documentation file to December 2020
v6:
- No change
v5:
- Use new functionsysfs_emit()in thestatus_show()function
v4:
- Changed from "Intel FPGA Security Manager" to FPGA Security Manager" and removed unnecessary references to "Intel".
- Changed: iops -> sops, imgr -> smgr,IFPGA_->FPGA_,ifpga_tofpga_
v3:
- Use a local variable to read progress once instatus_show()
- Usedev_errto report invalid progress status
v2:
- Bumped documentation date and version
- Changed progress state "read_file" to "reading"--- .../ABI/testing/sysfs-class-fpga-sec-mgr | 11 +++++ drivers/fpga/fpga-sec-mgr.c | 42 +++++++++++++++++-- 2 files changed, 49 insertions(+), 4 deletions(-)Documentation/ABI/testing/sysfs-class-fpga-sec-mgr +11
-0@@ -16,3 +16,14 @@ Description: Write only. Write the filename of an image BMC images, BMC firmware, Static Region images, and Root Entry Hashes, and to cancel Code Signing Keys (CSK). + +What: /sys/class/fpga_sec_mgr/fpga_secX/update/status +Date: June 2021 +KernelVersion: 5.14 +Contact: Russ Weight <[email protected]> +Description: Read-only. Returns a string describing the current + status of an update. The string will be one of the + following: idle, reading, preparing, writing, + programming. Userspace code can poll on this file, + as it will be signaled by sysfs_notify() on each + state change.drivers/fpga/fpga-sec-mgr.c +38
-4@@ -23,6 +23,13 @@ struct fpga_sec_mgr_devres {#define to_sec_mgr (d) container_of(d, struct fpga_sec_mgr, dev) +static void update_progress (struct fpga_sec_mgr *smgr, +enum fpga_sec_prog new_progress) +{ + smgr->progress = new_progress; +sysfs_notify (&smgr->dev.kobj,"update" ,"status" ); +} +static void fpga_sec_dev_error (struct fpga_sec_mgr *smgr,enum fpga_sec_err err_code) {@@ -33,7 +40,7 @@ static void fpga_sec_dev_error(struct fpga_sec_mgr *smgr,static void progress_complete (struct fpga_sec_mgr *smgr) {mutex_lock (&smgr->lock); - smgr->progress =FPGA_SEC_PROG_IDLE ; +update_progress (smgr,FPGA_SEC_PROG_IDLE );complete_all (&smgr->update_done);mutex_unlock (&smgr->lock); }@@ -61,14 +68,14 @@ static void fpga_sec_mgr_update(struct work_struct *work) goto release_fw_exit; } - smgr->progress =FPGA_SEC_PROG_PREPARING ; +update_progress (smgr,FPGA_SEC_PROG_PREPARING ); ret = smgr->sops->prepare (smgr);if (ret !=FPGA_SEC_ERR_NONE ) {fpga_sec_dev_error (smgr, ret); goto modput_exit; } - smgr->progress =FPGA_SEC_PROG_WRITING ; +update_progress (smgr,FPGA_SEC_PROG_WRITING );while (smgr->remaining_size) { ret = smgr->sops->write_blk (smgr, offset);if (ret !=FPGA_SEC_ERR_NONE ) {@@ -79,7 +86,7 @@ static void fpga_sec_mgr_update(struct work_struct *work) offset = fw->size - smgr->remaining_size; } - smgr->progress =FPGA_SEC_PROG_PROGRAMMING ; +update_progress (smgr,FPGA_SEC_PROG_PROGRAMMING ); ret = smgr->sops->poll_complete (smgr);if (ret !=FPGA_SEC_ERR_NONE )fpga_sec_dev_error (smgr, ret);@@ -107,6 +114,32 @@ static void fpga_sec_mgr_update(struct work_struct *work)progress_complete (smgr); } +static const char *const sec_mgr_prog_str[] = { + [FPGA_SEC_PROG_IDLE ] ="idle" , + [FPGA_SEC_PROG_READING ] ="reading" , + [FPGA_SEC_PROG_PREPARING ] ="preparing" , + [FPGA_SEC_PROG_WRITING ] ="writing" , + [FPGA_SEC_PROG_PROGRAMMING ] ="programming" +}; + +static ssize_t +status_show (struct device *dev,struct device_attribute *attr,char *buf) +{ +struct fpga_sec_mgr *smgr =to_sec_mgr (dev); +const char *status ="unknown-status" ; +enum fpga_sec_prog progress; + + progress = smgr->progress; +if (progress <FPGA_SEC_PROG_MAX ) + status = sec_mgr_prog_str[progress]; +else +dev_err (dev,"Invalid status during secure update: %d\n" , + progress); + +return sysfs_emit (buf,"%s\n" , status); +} +static DEVICE_ATTR_RO (status); +static ssize_t filename_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) {@@ -141,6 +174,7 @@ static DEVICE_ATTR_WO(filename);static struct attribute *sec_mgr_update_attrs[] = { &dev_attr_filename.attr, + &dev_attr_status.attr,NULL , };
On Fri, Apr 30, 2021 at 03:46:01PM +0800, Jin Yao wrote:
SNIP
Quoted 41 lines
tools/perf/util/header.c +34
-0+static int write_hybrid_topology (struct feat_fd *ff, +struct evlist *evlist__maybe_unused ) +{ +struct hybrid_topology *tp; +int ret; +u32 i; + + tp =hybrid_topology__new (); +if (!tp) +return -1 ; + + ret =do_write (ff, &tp->nr,sizeof (u32)); +if (ret <0 ) + goto err; + +for (i =0 ; i < tp->nr; i++) { +struct hybrid_topology_node *n = &tp->nodes[i]; + + ret =do_write_string (ff, n->pmu_name); +if (ret <0 ) + goto err; + + ret =do_write_string (ff, n->cpus); +if (ret <0 ) + goto err; + } + + ret =0 ; + +err: +hybrid_topology__delete (tp); +return ret; +} +static int write_dir_format (struct feat_fd *ff,struct evlist *evlist__maybe_unused ) {@@ -1623,6 +1657,19 @@ static void print_clock_data(struct feat_fd *ff, FILE *fp) clockid_name(clockid)); }
tools/perf/util/header.c static void print_clock_data(struct feat_fd *ff, FILE *fp) · line 1669
Quoted 10 lines
tools/perf/util/header.c +10
-0+static void print_hybrid_topology (struct feat_fd *ff,FILE *fp) +{ +int i; +struct hybrid_node *n; + +for (i =0 ; i < ff->ph->env.nr_hybrid_nodes; i++) { + n = &ff->ph->env.hybrid_nodes[i]; + +fprintf (fp,"# %s cpu list : " , n->pmu_name); +cpu_map__fprintf (n->map, fp);
do you plan to do anything else with n->map in the future? because right now you could just print the stored cpus string no? it should be already in the cpumask shape
jirka
Hi Jiri,
Quoted 60 lines · Jiri Olsa
On Fri, Apr 30, 2021 at 03:46:01PM +0800, Jin Yao wrote:
SNIP
Quoted 41 lines
tools/perf/util/header.c +34
-0+static int write_hybrid_topology (struct feat_fd *ff, +struct evlist *evlist__maybe_unused ) +{ +struct hybrid_topology *tp; +int ret; +u32 i; + + tp =hybrid_topology__new (); +if (!tp) +return -1 ; + + ret =do_write (ff, &tp->nr,sizeof (u32)); +if (ret <0 ) + goto err; + +for (i =0 ; i < tp->nr; i++) { +struct hybrid_topology_node *n = &tp->nodes[i]; + + ret =do_write_string (ff, n->pmu_name); +if (ret <0 ) + goto err; + + ret =do_write_string (ff, n->cpus); +if (ret <0 ) + goto err; + } + + ret =0 ; + +err: +hybrid_topology__delete (tp); +return ret; +} +static int write_dir_format (struct feat_fd *ff,struct evlist *evlist__maybe_unused ) {@@ -1623,6 +1657,19 @@ static void print_clock_data(struct feat_fd *ff, FILE *fp) clockid_name(clockid)); }tools/perf/util/header.c static void print_clock_data(struct feat_fd *ff, FILE *fp) · line 1669
Quoted 10 lines
tools/perf/util/header.c +10
-0+static void print_hybrid_topology (struct feat_fd *ff,FILE *fp) +{ +int i; +struct hybrid_node *n; + +for (i =0 ; i < ff->ph->env.nr_hybrid_nodes; i++) { + n = &ff->ph->env.hybrid_nodes[i]; + +fprintf (fp,"# %s cpu list : " , n->pmu_name); +cpu_map__fprintf (n->map, fp);do you plan to do anything else with
n->mapin the future? because right now you could just print the stored cpus string no? it should be already in the cpumask shape
Quoted 2 lines
jirka
Yes, you are right, we don't need to use n->map at least now.
Following code should be much simpler.
+struct hybrid_node {
+ char *pmu_name; + char *cpus;
+};
+static int process_hybrid_topology(struct feat_fd *ff,
+ void *data __maybe_unused)
+{
+ struct hybrid_node *nodes, *n;
+ u32 nr, i;
+
+ /* nr nodes */
+ if (do_read_u32(ff, &nr))
+ return -1;
+
+ nodes = zalloc(sizeof(*nodes) * nr);
+ if (!nodes)
+ return -ENOMEM;
+
+ for (i = 0; i < nr; i++) {
+ n = &nodes[i];
+
+ n->pmu_name = do_read_string(ff);
+ if (!n->pmu_name)
+ goto error;
+
+ n->cpus = do_read_string(ff);
+ if (!n->cpus)
+ goto error;
+ }
+
+ ff->ph->env.nr_hybrid_nodes = nr; + ff->ph->env.hybrid_nodes = nodes; + return 0;
+
+error:
...
+static void print_hybrid_topology(struct feat_fd *ff, FILE *fp) +{
+ int i;
+ struct hybrid_node *n;
+
+ for (i = 0; i < ff->ph->env.nr_hybrid_nodes; i++) {
+ n = &ff->ph->env.hybrid_nodes[i];
+ fprintf(fp, "# %s cpu list : %s\n", n->pmu_name, n->cpus);
+ }
+}
Thanks
Jin Yao
Quoted 6 lines · Jin Yao
It would be useful to let user know the hybrid topology. Adding
HYBRID_TOPOLOGYfeature in header to indicate the core cpus and the atom cpus.With this patch,
Quoted 7 lines
For the perf.data generated on hybrid platform, reports the hybrid cpu list.
root@otcpl-adl-s-2:~# perf report --header-only -I ... # cpu_core cpu list : 0-15 # cpu_atom cpu list : 16-23
hum, should we print 'hybrid:' or something to make sure its not confused with something else? like
# hybrid cpu_core cpu list : 0-15 # hybrid cpu_atom cpu list : 16-23
jirka
Arnaldo Carvalho de Melo
maintainerEm Tue, May 04, 2021 at 04:56:44PM +0200, Jiri Olsa escreveu:
Quoted 15 lines · Jin Yao
Quoted 6 lines
It would be useful to let user know the hybrid topology. Adding
HYBRID_TOPOLOGYfeature in header to indicate the core cpus and the atom cpus.With this patch,
Quoted 7 lines
For the perf.data generated on hybrid platform, reports the hybrid cpu list.
root@otcpl-adl-s-2:~# perf report --header-only -I ... # cpu_core cpu list : 0-15 # cpu_atom cpu list : 16-23
Quoted 5 lines
hum, should we print 'hybrid:' or something to make sure its not confused with something else? like
# hybrid cpu_core cpu list : 0-15 # hybrid cpu_atom cpu list : 16-23
But this _core/_atom already got to be enough? I disagreed with that naming, but neverthless having one or the other present in an output is a clear mark of this hybrid topology.
I.e having that extra hybrid string that wouldn't add information to the output.
IMHO.
- Arnaldo
Quoted 22 lines · Arnaldo Carvalho de Melo
Em Tue, May 04, 2021 at 04:56:44PM +0200, Jiri Olsa escreveu:
Quoted 15 lines · Jin Yao
Quoted 6 lines
It would be useful to let user know the hybrid topology. Adding
HYBRID_TOPOLOGYfeature in header to indicate the core cpus and the atom cpus.With this patch,
Quoted 7 lines
For the perf.data generated on hybrid platform, reports the hybrid cpu list.
root@otcpl-adl-s-2:~# perf report --header-only -I ... # cpu_core cpu list : 0-15 # cpu_atom cpu list : 16-23Quoted 5 lines
hum, should we print 'hybrid:' or something to make sure its not confused with something else? like
# hybrid cpu_core cpu list : 0-15 # hybrid cpu_atom cpu list : 16-23
Quoted 6 lines
But this _core/_atom already got to be enough? I disagreed with that naming, but neverthless having one or the other present in an output is a clear mark of this hybrid topology.
I.e having that extra hybrid string that wouldn't add information to the output.
sure when you know that cpu_core/cpu_atom are hybrid pmus ;-) and I guess other arch will come with other names
jirka
Quoted 5 lines
IMHO.
- Arnaldo
Arnaldo Carvalho de Melo
maintainerEm Tue, May 04, 2021 at 09:37:34PM +0200, Jiri Olsa escreveu:
Quoted 27 lines · Arnaldo Carvalho de Melo
Quoted 26 lines
Em Tue, May 04, 2021 at 04:56:44PM +0200, Jiri Olsa escreveu:
Quoted 15 lines · Jin Yao
Quoted 6 lines
It would be useful to let user know the hybrid topology. Adding
HYBRID_TOPOLOGYfeature in header to indicate the core cpus and the atom cpus.With this patch,
Quoted 7 lines
For the perf.data generated on hybrid platform, reports the hybrid cpu list.
root@otcpl-adl-s-2:~# perf report --header-only -I ... # cpu_core cpu list : 0-15 # cpu_atom cpu list : 16-23Quoted 5 lines
hum, should we print 'hybrid:' or something to make sure its not confused with something else? like
# hybrid cpu_core cpu list : 0-15 # hybrid cpu_atom cpu list : 16-23But this _core/_atom already got to be enough? I disagreed with that naming, but neverthless having one or the other present in an output is a clear mark of this hybrid topology.
Quoted 5 lines
Quoted 2 lines
I.e having that extra hybrid string that wouldn't add information to the output.
sure when you know that cpu_core/cpu_atom are hybrid pmus ;-) and I guess other arch will come with other names
Yeah, its too Intel centric, I thought they would come up with cpu_big/cpu_little and map it to core/atom on Intel and whatever other BIG/little arches come up with.
Perhaps:
root@otcpl-adl-s-2:~# perf report --header-only -I ... # hybrid cpu system: # cpu_core cpu list : 0-15 # cpu_atom cpu list : 16-23
?
- Arnaldo
Quoted 40 lines · Arnaldo Carvalho de Melo
Em Tue, May 04, 2021 at 09:37:34PM +0200, Jiri Olsa escreveu:
Quoted 27 lines · Arnaldo Carvalho de Melo
Quoted 26 lines
Em Tue, May 04, 2021 at 04:56:44PM +0200, Jiri Olsa escreveu:
Quoted 15 lines · Jin Yao
Quoted 6 lines
It would be useful to let user know the hybrid topology. Adding
HYBRID_TOPOLOGYfeature in header to indicate the core cpus and the atom cpus.With this patch,
Quoted 7 lines
For the perf.data generated on hybrid platform, reports the hybrid cpu list.
root@otcpl-adl-s-2:~# perf report --header-only -I ... # cpu_core cpu list : 0-15 # cpu_atom cpu list : 16-23Quoted 5 lines
hum, should we print 'hybrid:' or something to make sure its not confused with something else? like
# hybrid cpu_core cpu list : 0-15 # hybrid cpu_atom cpu list : 16-23But this _core/_atom already got to be enough? I disagreed with that naming, but neverthless having one or the other present in an output is a clear mark of this hybrid topology.
Quoted 5 lines
Quoted 2 lines
I.e having that extra hybrid string that wouldn't add information to the output.
sure when you know that cpu_core/cpu_atom are hybrid pmus ;-) and I guess other arch will come with other names
Yeah, its too Intel centric, I thought they would come up with cpu_big/cpu_little and map it to core/atom on Intel and whatever other BIG/little arches come up with.
Perhaps:
Quoted 7 lines
root@otcpl-adl-s-2:~# perf report --header-only -I ... # hybrid cpu system: # cpu_core cpu list : 0-15 # cpu_atom cpu list : 16-23?
'hybrid pmus' would sounds better to me, but as long as there's hybrid in there I'm good ;-)
thanks,
jirka
Quoted 3 lines
- Arnaldo
Hi Jiri,
Quoted 47 lines · Jiri Olsa
Quoted 46 lines · Arnaldo Carvalho de Melo
Em Tue, May 04, 2021 at 09:37:34PM +0200, Jiri Olsa escreveu:
Quoted 27 lines · Arnaldo Carvalho de Melo
Quoted 26 lines
Em Tue, May 04, 2021 at 04:56:44PM +0200, Jiri Olsa escreveu:
Quoted 15 lines · Jin Yao
Quoted 6 lines
It would be useful to let user know the hybrid topology. Adding
HYBRID_TOPOLOGYfeature in header to indicate the core cpus and the atom cpus.With this patch,
Quoted 7 lines
For the perf.data generated on hybrid platform, reports the hybrid cpu list.
root@otcpl-adl-s-2:~# perf report --header-only -I ... # cpu_core cpu list : 0-15 # cpu_atom cpu list : 16-23Quoted 5 lines
hum, should we print 'hybrid:' or something to make sure its not confused with something else? like
# hybrid cpu_core cpu list : 0-15 # hybrid cpu_atom cpu list : 16-23But this _core/_atom already got to be enough? I disagreed with that naming, but neverthless having one or the other present in an output is a clear mark of this hybrid topology.
Quoted 5 lines
Quoted 2 lines
I.e having that extra hybrid string that wouldn't add information to the output.
sure when you know that cpu_core/cpu_atom are hybrid pmus ;-) and I guess other arch will come with other names
Yeah, its too Intel centric, I thought they would come up with cpu_big/cpu_little and map it to core/atom on Intel and whatever other BIG/little arches come up with.
Perhaps:
root@otcpl-adl-s-2:~# perf report --header-only -I ... # hybrid cpu system: # cpu_core cpu list : 0-15 # cpu_atom cpu list : 16-23
Quoted 8 lines
Quoted 1 line
?
'hybrid pmus' would sounds better to me, but as long as there's hybrid in there I'm good ;-)
thanks,
jirka
:)
Thanks
Jin Yao
Quoted 4 lines
Quoted 3 lines
- Arnaldo
Hi Arnaldo,
Quoted 40 lines · Arnaldo Carvalho de Melo
Em Tue, May 04, 2021 at 09:37:34PM +0200, Jiri Olsa escreveu:
Quoted 27 lines · Arnaldo Carvalho de Melo
Quoted 26 lines
Em Tue, May 04, 2021 at 04:56:44PM +0200, Jiri Olsa escreveu:
Quoted 15 lines · Jin Yao
Quoted 6 lines
It would be useful to let user know the hybrid topology. Adding
HYBRID_TOPOLOGYfeature in header to indicate the core cpus and the atom cpus.With this patch,
Quoted 7 lines
For the perf.data generated on hybrid platform, reports the hybrid cpu list.
root@otcpl-adl-s-2:~# perf report --header-only -I ... # cpu_core cpu list : 0-15 # cpu_atom cpu list : 16-23Quoted 5 lines
hum, should we print 'hybrid:' or something to make sure its not confused with something else? like
# hybrid cpu_core cpu list : 0-15 # hybrid cpu_atom cpu list : 16-23But this _core/_atom already got to be enough? I disagreed with that naming, but neverthless having one or the other present in an output is a clear mark of this hybrid topology.
Quoted 5 lines
Quoted 2 lines
I.e having that extra hybrid string that wouldn't add information to the output.
sure when you know that cpu_core/cpu_atom are hybrid pmus ;-) and I guess other arch will come with other names
Yeah, its too Intel centric, I thought they would come up with cpu_big/cpu_little and map it to core/atom on Intel and whatever other BIG/little arches come up with.
Perhaps:
Quoted 8 lines
root@otcpl-adl-s-2:~# perf report --header-only -I ... # hybrid cpu system: # cpu_core cpu list : 0-15 # cpu_atom cpu list : 16-23?
That's a good idea! :)
On my ADL test machine, it's now output like:
# hybrid cpu system: # cpu_core cpu list : 0-15 # cpu_atom cpu list : 16-23
Thanks
Jin Yao
Quoted 2 lines
- Arnaldo