From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E0174204F78 for ; Fri, 10 Jan 2025 10:44:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736505880; cv=none; b=r2XnDBmzXzIaplmF/dgZgQQmGwLSr5AUPOUsjtFoT6LM1cQbE0LA+hUEU+SzxD3rJuIyv/39ZFZTTaAaN/KGuS5QJgPVibGz4pZlMXj2UarhU2Cko+luUMZvt7Nuwth8GrXjmRROTcC3jj1m/Tg8iwmKrS176dz37euNF3SRMaI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736505880; c=relaxed/simple; bh=attvAJQq8eMMynOWS7DLds8D+eyBqrG7zghsQWk9n5g=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jtMVFtrfpiHyzl4TkALY12nDGagLGQnHPqeOhJruQmWz42VQinBTvwAI+neQnnOHFDPQQPe76VSyVkcCQ62mvUSXfmtzHBjp8OeTPAOxuCfzEDOdOml+2+t/KbPA0ULRwPpyiqAp+qalIWBD6zBf2Dioy8URYrs+QBj5emxK7Jw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2F6BD13D5; Fri, 10 Jan 2025 02:45:06 -0800 (PST) Received: from [10.57.32.219] (unknown [10.57.32.219]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A4A9F3F673; Fri, 10 Jan 2025 02:44:36 -0800 (PST) Message-ID: <7fa2c7c2-0bbf-4d45-bc90-71c4a4a82c0c@arm.com> Date: Fri, 10 Jan 2025 10:44:35 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] coresight: catu: Fix number of pages while using 64k pages Content-Language: en-GB To: Ilkka Koskinen , Mike Leach , James Clark , Alexander Shishkin Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20250109215348.5483-1-ilkka@os.amperecomputing.com> From: Suzuki K Poulose In-Reply-To: <20250109215348.5483-1-ilkka@os.amperecomputing.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 > --- > 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