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 D9BDA3A8D0 for ; Mon, 13 Jan 2025 16:49:06 +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=1736786949; cv=none; b=fRF2fPbsWYvuLudwirEv5eajKRCbkkrEP5hVl7YqMElJNDbsHQZBnp8pO+GNygZPGNnoStVAI9HPWL6EAeJyDf1jq8Mc612tkJsOSE+XFlY9dlRADbngdM42D0ngDduiCAyguG+8HGQmhjMsPMdspg62r3r3j9fNAyrdznfUah4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736786949; c=relaxed/simple; bh=8Jr3j33KE8+N1R3CXK15M96K/mdILigniALEfPDOkJY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=iKBbdw+eYfKrt4JM/oLkXiEbpANZHpbv/2etr+q5+Y0TWwQWRZVl/+JJrNx99W1NzxegMc1EvVt1wi1q5MfvzEabSPAjoCk+u8D04epN3o24GvOBM9uRo7Iq99Xe2iHGmK/O16SV50xCtF5nvB0B5YG8LMDYakRxq808ViBvLyM= 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 56F0A12FC; Mon, 13 Jan 2025 08:49:34 -0800 (PST) Received: from [10.57.35.117] (unknown [10.57.35.117]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DDE4B3F673; Mon, 13 Jan 2025 08:49:04 -0800 (PST) Message-ID: Date: Mon, 13 Jan 2025 16:49:04 +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 Cc: Mike Leach , James Clark , Alexander Shishkin , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20250109215348.5483-1-ilkka@os.amperecomputing.com> <7fa2c7c2-0bbf-4d45-bc90-71c4a4a82c0c@arm.com> <6d6128d4-778f-fc9c-651b-53de199d023@os.amperecomputing.com> From: Suzuki K Poulose In-Reply-To: <6d6128d4-778f-fc9c-651b-53de199d023@os.amperecomputing.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 10/01/2025 21:32, Ilkka Koskinen wrote: > > Hi Suzuko, > > On Fri, 10 Jan 2025, Suzuki K Poulose wrote: >> 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") > > That's a good point > >> >>> 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 > > Sounds great. Just to confirm, are you ok to add the fixes line or would > you prefer me to submit v2 with it? No, not required. I have picked this up for v6.15, and will push it out once v6.14-rc is out. Suzuki > > Cheers, Ilkka