All of lore.kernel.org
 help / color / mirror / Atom feed
From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: Ilkka Koskinen <ilkka@os.amperecomputing.com>,
	Mike Leach <mike.leach@linaro.org>,
	James Clark <james.clark@linaro.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] coresight: catu: Fix number of pages while using 64k pages
Date: Fri, 10 Jan 2025 10:44:35 +0000	[thread overview]
Message-ID: <7fa2c7c2-0bbf-4d45-bc90-71c4a4a82c0c@arm.com> (raw)
In-Reply-To: <20250109215348.5483-1-ilkka@os.amperecomputing.com>

On 09/01/2025 21:53, Ilkka Koskinen wrote:
> 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)
> 

Needs a Fixes tag.

Fixes : 8ed536b1e283 ("coresight: catu: Add support for scatter gather 
tables")

> Signed-off-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>
> ---
>   drivers/hwtracing/coresight/coresight-catu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c
> index 275cc0d9f505..3378bb77e6b4 100644
> --- a/drivers/hwtracing/coresight/coresight-catu.c
> +++ b/drivers/hwtracing/coresight/coresight-catu.c
> @@ -269,7 +269,7 @@ catu_init_sg_table(struct device *catu_dev, int node,
>   	 * Each table can address upto 1MB and we can have
>   	 * CATU_PAGES_PER_SYSPAGE tables in a system page.
>   	 */
> -	nr_tpages = DIV_ROUND_UP(size, SZ_1M) / CATU_PAGES_PER_SYSPAGE;
> +	nr_tpages = DIV_ROUND_UP(size, CATU_PAGES_PER_SYSPAGE * SZ_1M);
>   	catu_table = tmc_alloc_sg_table(catu_dev, node, nr_tpages,
>   					size >> PAGE_SHIFT, pages);
>   	if (IS_ERR(catu_table))

Looks good to me, I will queue this later for v6.15.

Suzuki


  reply	other threads:[~2025-01-10 10:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-09 21:53 [PATCH] coresight: catu: Fix number of pages while using 64k pages Ilkka Koskinen
2025-01-10 10:44 ` Suzuki K Poulose [this message]
2025-01-10 21:32   ` Ilkka Koskinen
2025-01-13 16:49     ` Suzuki K Poulose
2025-01-14  0:28       ` Ilkka Koskinen
2025-02-21 16:11 ` Suzuki K Poulose

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7fa2c7c2-0bbf-4d45-bc90-71c4a4a82c0c@arm.com \
    --to=suzuki.poulose@arm.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=coresight@lists.linaro.org \
    --cc=ilkka@os.amperecomputing.com \
    --cc=james.clark@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.leach@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.