* [PATCH] powerpc/perf/hv-24x7: Update domain value check
@ 2023-08-25 5:56 Kajol Jain
2023-08-25 11:35 ` Disha Goel
2023-09-21 9:24 ` Michael Ellerman
0 siblings, 2 replies; 3+ messages in thread
From: Kajol Jain @ 2023-08-25 5:56 UTC (permalink / raw)
To: mpe
Cc: atrajeev, kjain, linux-kernel, linux-perf-users, maddy,
Krishan Gopal Sarawast, disgoel, linuxppc-dev
Valid domain value is in range 1 to HV_PERF_DOMAIN_MAX.
Current code has check for domain value greater than or
equal to HV_PERF_DOMAIN_MAX. But the check for domain value 0
is missing.
Fix this issue by adding check for domain value 0.
Fixes: ebd4a5a3ebd9 ("powerpc/perf/hv-24x7: Minor improvements")
Reported-by: Krishan Gopal Sarawast <krishang@linux.vnet.ibm.com>
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
---
arch/powerpc/perf/hv-24x7.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
index 317175791d23..644881cc1c00 100644
--- a/arch/powerpc/perf/hv-24x7.c
+++ b/arch/powerpc/perf/hv-24x7.c
@@ -1418,7 +1418,7 @@ static int h_24x7_event_init(struct perf_event *event)
}
domain = event_get_domain(event);
- if (domain >= HV_PERF_DOMAIN_MAX) {
+ if (domain == 0 || domain >= HV_PERF_DOMAIN_MAX) {
pr_devel("invalid domain %d\n", domain);
return -EINVAL;
}
--
2.35.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] powerpc/perf/hv-24x7: Update domain value check 2023-08-25 5:56 [PATCH] powerpc/perf/hv-24x7: Update domain value check Kajol Jain @ 2023-08-25 11:35 ` Disha Goel 2023-09-21 9:24 ` Michael Ellerman 1 sibling, 0 replies; 3+ messages in thread From: Disha Goel @ 2023-08-25 11:35 UTC (permalink / raw) To: Kajol Jain, mpe Cc: atrajeev, linux-kernel, linux-perf-users, maddy, Krishan Gopal Sarawast, linuxppc-dev [-- Attachment #1: Type: text/plain, Size: 2148 bytes --] On 25/08/23 11:26 am, Kajol Jain wrote: > Valid domain value is in range 1 to HV_PERF_DOMAIN_MAX. > Current code has check for domain value greater than or > equal to HV_PERF_DOMAIN_MAX. But the check for domain value 0 > is missing. > Fix this issue by adding check for domain value 0. > > Fixes: ebd4a5a3ebd9 ("powerpc/perf/hv-24x7: Minor improvements") > Reported-by: Krishan Gopal Sarawast<krishang@linux.vnet.ibm.com> > Signed-off-by: Kajol Jain<kjain@linux.ibm.com> Tested the patch on power, with domain=0 not getting hcall failure after patch changes. Before patch changes: # ./perf stat -v -e hv_24x7/CPM_ADJUNCT_INST,domain=0,core=1/ sleep 1 Using CPUID 00800200 Control descriptor is not initialized Error: The sys_perf_event_open() syscall returned with 5 (Input/output error) for event (hv_24x7/CPM_ADJUNCT_INST,domain=0,core=1/). /bin/dmesg | grep -i perf may provide additional information. Result from dmesg: [ 37.819387] hv-24x7: hcall failed: [0 0x60040000 0x100 0] => ret 0xfffffffffffffffc (-4) detail=0x2000000 failing ix=0 After patch changes: # ./perf stat -v -e hv_24x7/CPM_ADJUNCT_INST,domain=0,core=1/ sleep 1 Using CPUID 00800200 Control descriptor is not initialized Warning: hv_24x7/CPM_ADJUNCT_INST,domain=0,core=1/ event is not supported by the kernel. failed to read counter hv_24x7/CPM_ADJUNCT_INST,domain=0,core=1/ Performance counter stats for 'system wide': <not supported> hv_24x7/CPM_ADJUNCT_INST,domain=0,core=1/ 1.001352771 seconds time elapsed Tested-by: Disha Goel<disgoel@linux.ibm.com> > --- > arch/powerpc/perf/hv-24x7.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c > index 317175791d23..644881cc1c00 100644 > --- a/arch/powerpc/perf/hv-24x7.c > +++ b/arch/powerpc/perf/hv-24x7.c > @@ -1418,7 +1418,7 @@ static int h_24x7_event_init(struct perf_event *event) > } > > domain = event_get_domain(event); > - if (domain >= HV_PERF_DOMAIN_MAX) { > + if (domain == 0 || domain >= HV_PERF_DOMAIN_MAX) { > pr_devel("invalid domain %d\n", domain); > return -EINVAL; > } [-- Attachment #2: Type: text/html, Size: 2811 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/perf/hv-24x7: Update domain value check 2023-08-25 5:56 [PATCH] powerpc/perf/hv-24x7: Update domain value check Kajol Jain 2023-08-25 11:35 ` Disha Goel @ 2023-09-21 9:24 ` Michael Ellerman 1 sibling, 0 replies; 3+ messages in thread From: Michael Ellerman @ 2023-09-21 9:24 UTC (permalink / raw) To: Kajol Jain Cc: atrajeev, linux-kernel, linux-perf-users, maddy, Krishan Gopal Sarawast, disgoel, linuxppc-dev On Fri, 25 Aug 2023 11:26:01 +0530, Kajol Jain wrote: > Valid domain value is in range 1 to HV_PERF_DOMAIN_MAX. > Current code has check for domain value greater than or > equal to HV_PERF_DOMAIN_MAX. But the check for domain value 0 > is missing. > Fix this issue by adding check for domain value 0. > > > [...] Applied to powerpc/fixes. [1/1] powerpc/perf/hv-24x7: Update domain value check https://git.kernel.org/powerpc/c/4ff3ba4db5943cac1045e3e4a3c0463ea10f6930 cheers ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-09-21 9:27 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-08-25 5:56 [PATCH] powerpc/perf/hv-24x7: Update domain value check Kajol Jain 2023-08-25 11:35 ` Disha Goel 2023-09-21 9:24 ` Michael Ellerman
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).