diff mbox

[v3,1/8] powerpc/perf/hv-24x7: Fix passing of catalog version number

Message ID 20170629215538.1645-2-bauerman@linux.vnet.ibm.com (mailing list archive)
State Accepted
Commit 12bf85a71000af7419b19b5e90910919f36f336c
Headers show

Commit Message

Thiago Jung Bauermann June 29, 2017, 9:55 p.m. UTC
H_GET_24X7_CATALOG_PAGE needs to be passed the version number obtained from
the first catalog page obtained previously. This is a 64 bit number, but
create_events_from_catalog truncates it to 32-bit.

This worked on POWER8, but POWER9 actually uses the upper bits so the call
fails with H_P3 because the hypervisor doesn't recognize the version.

This patch also adds the hcall return code to the error message, which is
helpful when debugging the problem.

Fixes: 5c5cd7b50259 ("powerpc/perf/hv-24x7: parse catalog and populate sysfs with events")
Reviewed-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
---
 arch/powerpc/perf/hv-24x7.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Michael Ellerman July 2, 2017, 11:01 a.m. UTC | #1
On Thu, 2017-06-29 at 21:55:31 UTC, Thiago Jung Bauermann wrote:
> H_GET_24X7_CATALOG_PAGE needs to be passed the version number obtained from
> the first catalog page obtained previously. This is a 64 bit number, but
> create_events_from_catalog truncates it to 32-bit.
> 
> This worked on POWER8, but POWER9 actually uses the upper bits so the call
> fails with H_P3 because the hypervisor doesn't recognize the version.
> 
> This patch also adds the hcall return code to the error message, which is
> helpful when debugging the problem.
> 
> Fixes: 5c5cd7b50259 ("powerpc/perf/hv-24x7: parse catalog and populate sysfs with events")
> Reviewed-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
> Signed-off-by: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/12bf85a71000af7419b19b5e909109

cheers
Thiago Jung Bauermann July 3, 2017, 1:23 p.m. UTC | #2
Michael Ellerman <patch-notifications@ellerman.id.au> writes:

> On Thu, 2017-06-29 at 21:55:31 UTC, Thiago Jung Bauermann wrote:
>> H_GET_24X7_CATALOG_PAGE needs to be passed the version number obtained from
>> the first catalog page obtained previously. This is a 64 bit number, but
>> create_events_from_catalog truncates it to 32-bit.
>> 
>> This worked on POWER8, but POWER9 actually uses the upper bits so the call
>> fails with H_P3 because the hypervisor doesn't recognize the version.
>> 
>> This patch also adds the hcall return code to the error message, which is
>> helpful when debugging the problem.
>> 
>> Fixes: 5c5cd7b50259 ("powerpc/perf/hv-24x7: parse catalog and populate sysfs with events")
>> Reviewed-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
>> Signed-off-by: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
>
> Series applied to powerpc next, thanks.
>
> https://git.kernel.org/powerpc/c/12bf85a71000af7419b19b5e909109

Thanks!
diff mbox

Patch

diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
index 7b2ca16b1eb4..1354cde7095c 100644
--- a/arch/powerpc/perf/hv-24x7.c
+++ b/arch/powerpc/perf/hv-24x7.c
@@ -670,7 +670,7 @@  static int create_events_from_catalog(struct attribute ***events_,
 	       event_data_bytes, junk_events, event_idx, event_attr_ct, i,
 	       attr_max, event_idx_last, desc_ct, long_desc_ct;
 	ssize_t ct, ev_len;
-	uint32_t catalog_version_num;
+	uint64_t catalog_version_num;
 	struct attribute **events, **event_descs, **event_long_descs;
 	struct hv_24x7_catalog_page_0 *page_0 =
 		kmem_cache_alloc(hv_page_cache, GFP_KERNEL);
@@ -706,8 +706,8 @@  static int create_events_from_catalog(struct attribute ***events_,
 	event_data_offs   = be16_to_cpu(page_0->event_data_offs);
 	event_data_len    = be16_to_cpu(page_0->event_data_len);
 
-	pr_devel("cv %zu cl %zu eec %zu edo %zu edl %zu\n",
-			(size_t)catalog_version_num, catalog_len,
+	pr_devel("cv %llu cl %zu eec %zu edo %zu edl %zu\n",
+			catalog_version_num, catalog_len,
 			event_entry_count, event_data_offs, event_data_len);
 
 	if ((MAX_4K < event_data_len)
@@ -761,8 +761,8 @@  static int create_events_from_catalog(struct attribute ***events_,
 				catalog_version_num,
 				i + event_data_offs);
 		if (hret) {
-			pr_err("failed to get event data in page %zu\n",
-					i + event_data_offs);
+			pr_err("Failed to get event data in page %zu: rc=%ld\n",
+			       i + event_data_offs, hret);
 			ret = -EIO;
 			goto e_event_data;
 		}