Skip to content

Commit b2d07e5

Browse files
author
Herton R. Krzesinski
committed
Merge: perf hv_gpci events fails with not supported error
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/1946 Description: Updates for Perf Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2162652 Build Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=50274806 Tested: Verified Brew build test kernel RPMs and confirmed issue is resovled Signed-off-by: Mamatha Inamdar <minamdar@redhat.com> Approved-by: Steve Best <sbest@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2 parents 3b4f343 + f1f1312 commit b2d07e5

File tree

20 files changed

+89
-33
lines changed

20 files changed

+89
-33
lines changed

arch/powerpc/include/asm/spu.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ void unregister_spu_syscalls(struct spufs_calls *calls);
249249
int spu_add_dev_attr(struct device_attribute *attr);
250250
void spu_remove_dev_attr(struct device_attribute *attr);
251251

252-
int spu_add_dev_attr_group(struct attribute_group *attrs);
253-
void spu_remove_dev_attr_group(struct attribute_group *attrs);
252+
int spu_add_dev_attr_group(const struct attribute_group *attrs);
253+
void spu_remove_dev_attr_group(const struct attribute_group *attrs);
254254

255255
extern void notify_spus_active(void);
256256
extern void do_notify_spus_active(void);

arch/powerpc/perf/generic-compat-pmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static struct attribute *generic_compat_events_attr[] = {
130130
NULL
131131
};
132132

133-
static struct attribute_group generic_compat_pmu_events_group = {
133+
static const struct attribute_group generic_compat_pmu_events_group = {
134134
.name = "events",
135135
.attrs = generic_compat_events_attr,
136136
};
@@ -146,7 +146,7 @@ static struct attribute *generic_compat_pmu_format_attr[] = {
146146
NULL,
147147
};
148148

149-
static struct attribute_group generic_compat_pmu_format_group = {
149+
static const struct attribute_group generic_compat_pmu_format_group = {
150150
.name = "format",
151151
.attrs = generic_compat_pmu_format_attr,
152152
};

arch/powerpc/perf/hv-24x7.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ static struct attribute *format_attrs[] = {
204204
NULL,
205205
};
206206

207-
static struct attribute_group format_group = {
207+
static const struct attribute_group format_group = {
208208
.name = "format",
209209
.attrs = format_attrs,
210210
};
@@ -1148,7 +1148,7 @@ static struct attribute *cpumask_attrs[] = {
11481148
NULL,
11491149
};
11501150

1151-
static struct attribute_group cpumask_attr_group = {
1151+
static const struct attribute_group cpumask_attr_group = {
11521152
.attrs = cpumask_attrs,
11531153
};
11541154

@@ -1162,7 +1162,7 @@ static struct attribute *if_attrs[] = {
11621162
NULL,
11631163
};
11641164

1165-
static struct attribute_group if_group = {
1165+
static const struct attribute_group if_group = {
11661166
.name = "interface",
11671167
.bin_attrs = if_bin_attrs,
11681168
.attrs = if_attrs,

arch/powerpc/perf/hv-gpci-requests.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ REQUEST(__field(0, 8, partition_id)
7979
)
8080
#include I(REQUEST_END)
8181

82+
#ifdef ENABLE_EVENTS_COUNTERINFO_V6
8283
/*
8384
* Not available for counter_info_version >= 0x8, use
8485
* run_instruction_cycles_by_partition(0x100) instead.
@@ -92,6 +93,7 @@ REQUEST(__field(0, 8, partition_id)
9293
__count(0x10, 8, cycles)
9394
)
9495
#include I(REQUEST_END)
96+
#endif
9597

9698
#define REQUEST_NAME system_performance_capabilities
9799
#define REQUEST_NUM 0x40
@@ -103,6 +105,7 @@ REQUEST(__field(0, 1, perf_collect_privileged)
103105
)
104106
#include I(REQUEST_END)
105107

108+
#ifdef ENABLE_EVENTS_COUNTERINFO_V6
106109
#define REQUEST_NAME processor_bus_utilization_abc_links
107110
#define REQUEST_NUM 0x50
108111
#define REQUEST_IDX_KIND "hw_chip_id=?"
@@ -194,6 +197,7 @@ REQUEST(__field(0, 4, phys_processor_idx)
194197
__count(0x28, 8, instructions_completed)
195198
)
196199
#include I(REQUEST_END)
200+
#endif
197201

198202
/* Processor_core_power_mode (0x95) skipped, no counters */
199203
/* Affinity_domain_information_by_virtual_processor (0xA0) skipped,

arch/powerpc/perf/hv-gpci.c

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ static struct attribute *format_attrs[] = {
6565
NULL,
6666
};
6767

68-
static struct attribute_group format_group = {
68+
static const struct attribute_group format_group = {
6969
.name = "format",
7070
.attrs = format_attrs,
7171
};
7272

7373
static struct attribute_group event_group = {
7474
.name = "events",
75-
.attrs = hv_gpci_event_attrs,
75+
/* .attrs is set in init */
7676
};
7777

7878
#define HV_CAPS_ATTR(_name, _format) \
@@ -126,11 +126,11 @@ static struct attribute *cpumask_attrs[] = {
126126
NULL,
127127
};
128128

129-
static struct attribute_group cpumask_attr_group = {
129+
static const struct attribute_group cpumask_attr_group = {
130130
.attrs = cpumask_attrs,
131131
};
132132

133-
static struct attribute_group interface_group = {
133+
static const struct attribute_group interface_group = {
134134
.name = "interface",
135135
.attrs = interface_attrs,
136136
};
@@ -330,6 +330,7 @@ static int hv_gpci_init(void)
330330
int r;
331331
unsigned long hret;
332332
struct hv_perf_caps caps;
333+
struct hv_gpci_request_buffer *arg;
333334

334335
hv_gpci_assert_offsets_correct();
335336

@@ -353,6 +354,36 @@ static int hv_gpci_init(void)
353354
/* sampling not supported */
354355
h_gpci_pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
355356

357+
arg = (void *)get_cpu_var(hv_gpci_reqb);
358+
memset(arg, 0, HGPCI_REQ_BUFFER_SIZE);
359+
360+
/*
361+
* hcall H_GET_PERF_COUNTER_INFO populates the output
362+
* counter_info_version value based on the system hypervisor.
363+
* Pass the counter request 0x10 corresponds to request type
364+
* 'Dispatch_timebase_by_processor', to get the supported
365+
* counter_info_version.
366+
*/
367+
arg->params.counter_request = cpu_to_be32(0x10);
368+
369+
r = plpar_hcall_norets(H_GET_PERF_COUNTER_INFO,
370+
virt_to_phys(arg), HGPCI_REQ_BUFFER_SIZE);
371+
if (r) {
372+
pr_devel("hcall failed, can't get supported counter_info_version: 0x%x\n", r);
373+
arg->params.counter_info_version_out = 0x8;
374+
}
375+
376+
/*
377+
* Use counter_info_version_out value to assign
378+
* required hv-gpci event list.
379+
*/
380+
if (arg->params.counter_info_version_out >= 0x8)
381+
event_group.attrs = hv_gpci_event_attrs;
382+
else
383+
event_group.attrs = hv_gpci_event_attrs_v6;
384+
385+
put_cpu_var(hv_gpci_reqb);
386+
356387
r = perf_pmu_register(&h_gpci_pmu, h_gpci_pmu.name, -1);
357388
if (r)
358389
return r;

arch/powerpc/perf/hv-gpci.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ enum {
2626
#define REQUEST_FILE "../hv-gpci-requests.h"
2727
#define NAME_LOWER hv_gpci
2828
#define NAME_UPPER HV_GPCI
29+
#define ENABLE_EVENTS_COUNTERINFO_V6
2930
#include "req-gen/perf.h"
3031
#undef REQUEST_FILE
3132
#undef NAME_LOWER

arch/powerpc/perf/imc-pmu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static struct attribute *imc_format_attrs[] = {
7171
NULL,
7272
};
7373

74-
static struct attribute_group imc_format_group = {
74+
static const struct attribute_group imc_format_group = {
7575
.name = "format",
7676
.attrs = imc_format_attrs,
7777
};
@@ -90,7 +90,7 @@ static struct attribute *trace_imc_format_attrs[] = {
9090
NULL,
9191
};
9292

93-
static struct attribute_group trace_imc_format_group = {
93+
static const struct attribute_group trace_imc_format_group = {
9494
.name = "format",
9595
.attrs = trace_imc_format_attrs,
9696
};
@@ -125,7 +125,7 @@ static struct attribute *imc_pmu_cpumask_attrs[] = {
125125
NULL,
126126
};
127127

128-
static struct attribute_group imc_pmu_cpumask_attr_group = {
128+
static const struct attribute_group imc_pmu_cpumask_attr_group = {
129129
.attrs = imc_pmu_cpumask_attrs,
130130
};
131131

arch/powerpc/perf/isa207-common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static struct attribute *isa207_pmu_format_attr[] = {
3737
NULL,
3838
};
3939

40-
struct attribute_group isa207_pmu_format_group = {
40+
const struct attribute_group isa207_pmu_format_group = {
4141
.name = "format",
4242
.attrs = isa207_pmu_format_attr,
4343
};

arch/powerpc/perf/power10-pmu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,12 @@ static struct attribute *power10_events_attr[] = {
200200
NULL
201201
};
202202

203-
static struct attribute_group power10_pmu_events_group_dd1 = {
203+
static const struct attribute_group power10_pmu_events_group_dd1 = {
204204
.name = "events",
205205
.attrs = power10_events_attr_dd1,
206206
};
207207

208-
static struct attribute_group power10_pmu_events_group = {
208+
static const struct attribute_group power10_pmu_events_group = {
209209
.name = "events",
210210
.attrs = power10_events_attr,
211211
};
@@ -253,7 +253,7 @@ static struct attribute *power10_pmu_format_attr[] = {
253253
NULL,
254254
};
255255

256-
static struct attribute_group power10_pmu_format_group = {
256+
static const struct attribute_group power10_pmu_format_group = {
257257
.name = "format",
258258
.attrs = power10_pmu_format_attr,
259259
};

arch/powerpc/perf/power7-pmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ static struct attribute *power7_events_attr[] = {
405405
NULL
406406
};
407407

408-
static struct attribute_group power7_pmu_events_group = {
408+
static const struct attribute_group power7_pmu_events_group = {
409409
.name = "events",
410410
.attrs = power7_events_attr,
411411
};
@@ -417,7 +417,7 @@ static struct attribute *power7_pmu_format_attr[] = {
417417
NULL,
418418
};
419419

420-
static struct attribute_group power7_pmu_format_group = {
420+
static const struct attribute_group power7_pmu_format_group = {
421421
.name = "format",
422422
.attrs = power7_pmu_format_attr,
423423
};

0 commit comments

Comments
 (0)