Skip to content

Commit 0e14e06

Browse files
ilkka-koskinenSuzuki K Poulose
authored andcommitted
coresight: catu: Fix number of pages while using 64k pages
Trying to record a trace on kernel with 64k pages resulted in -ENOMEM. This happens due to a bug in calculating the number of table pages, which returns zero. Fix the issue by rounding up. $ perf record --kcore -e cs_etm/@tmc_etr55,cycacc,branch_broadcast/k --per-thread taskset --cpu-list 1 dd if=/dev/zero of=/dev/null failed to mmap with 12 (Cannot allocate memory) Fixes: 8ed536b ("coresight: catu: Add support for scatter gather tables") Signed-off-by: Ilkka Koskinen <[email protected]> Signed-off-by: Suzuki K Poulose <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0ad2507 commit 0e14e06

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/hwtracing/coresight/coresight-catu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ catu_init_sg_table(struct device *catu_dev, int node,
269269
* Each table can address upto 1MB and we can have
270270
* CATU_PAGES_PER_SYSPAGE tables in a system page.
271271
*/
272-
nr_tpages = DIV_ROUND_UP(size, SZ_1M) / CATU_PAGES_PER_SYSPAGE;
272+
nr_tpages = DIV_ROUND_UP(size, CATU_PAGES_PER_SYSPAGE * SZ_1M);
273273
catu_table = tmc_alloc_sg_table(catu_dev, node, nr_tpages,
274274
size >> PAGE_SHIFT, pages);
275275
if (IS_ERR(catu_table))

0 commit comments

Comments
 (0)