]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf/x86/intel/pt: Fix pt_topa_entry_for_page() address calculation
authorAdrian Hunter <adrian.hunter@intel.com>
Mon, 24 Jun 2024 20:10:57 +0000 (23:10 +0300)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 4 Jul 2024 14:00:21 +0000 (16:00 +0200)
Currently, perf allocates an array of page pointers which is limited in
size by MAX_PAGE_ORDER. That in turn limits the maximum Intel PT buffer
size to 2GiB. Should that limitation be lifted, the Intel PT driver can
support larger sizes, except for one calculation in
pt_topa_entry_for_page(), which is limited to 32-bits.

Fix pt_topa_entry_for_page() address calculation by adding a cast.

Fixes: 39152ee51b77 ("perf/x86/intel/pt: Get rid of reverse lookup table for ToPA")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240624201101.60186-4-adrian.hunter@intel.com
arch/x86/events/intel/pt.c

index 047a2cd5b3fe24a815cef6ede1be1f6f06d24f2e..b4aa8daa47738f39c463bc6dad1fb0c647c65a0c 100644 (file)
@@ -990,7 +990,7 @@ pt_topa_entry_for_page(struct pt_buffer *buf, unsigned int pg)
         * order allocations, there shouldn't be many of these.
         */
        list_for_each_entry(topa, &buf->tables, list) {
-               if (topa->offset + topa->size > pg << PAGE_SHIFT)
+               if (topa->offset + topa->size > (unsigned long)pg << PAGE_SHIFT)
                        goto found;
        }