From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796205579; b=dYTYQ1HhWXQ6c6x3/oLVEexoddApl6D8XvbBL9hH1lQZ3KirrWpq0O1zLyFWYmYJ0WRk RdmDFvKmASOECpcrWqUAEG/e5Y3M+aJEgUSsa7CgYb049jrK1rwnUqLFrknanZ8ks0EXl VF8L/yCuB4I/8MUxLyjevSusitYZGS23WYNu9sbc40C/aj8YE8F52uJyA/WNOZiLH8sYY 7qgJoslZh1bNePd84Gv4YVTVa23BaVWSDDmyIx0wAMHQ0F0pyLHLdNwQjQXfVM2jMgn0f 6fVcQokWT2BeK9LyolPJrnv9JrQpq82BmhvxHqrx8TXvBKHDcakC7hnOUekW85ice4w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796205579; h=DMARC-Filter:Received:Received:DKIM-Signature:Message-ID:Date: MIME-Version:User-Agent:Subject:Cc:References:Content-Language:From: In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=29T1kMkf4DGdnnZ9p17aAIx1UhX5TlUByREy4/698dY=; b=pNZtfRMCKWyqdXzm0sx31CsMduI8Bz3sk7oXkmehRQevwqSPUe4oFoxxtlujl3OkK77i EQPL2x4+tfylkDsINA6wXFvsJdNLP5bnR2SnpDOne1uqTJMqQpC78k+58qiiDUnQ4Hup2 TCWpar1D/KeY2o4coQVCiXqqDXxmU9o23SnL4BriIgY2Dw+WNWe/c2J4yzoly09DKNmDq 0K2Iejy599HpQNpMZ+AGNi4shwEaftofrw7XyCl+LtkvIV/T+1exSZKZJaBu2QQcsP/Et jNtL4uN8eD4T/WzVvP+jgBRTZYNqfvZ58OWwwdDTAY16um8putYBbNFRFmbNE7hVYiA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=E3sz1DQ2; arc=none smtp.remote-ip=217.140.110.172 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 19B14606A31A for ; Wed, 2 Dec 2026 09:59:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 19B14606A31A 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=E3sz1DQ2 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 5C0031570; Wed, 2 Dec 2026 01:59:35 -0800 (PST) Received: from [10.211.55.3] (unknown [10.57.91.208]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8873A3F7D8; Wed, 2 Dec 2026 01:59:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796205578; bh=+8I0IFrrBqfKujp4++7K9zuzMFp9oQ6ApVrXhnnUpOM=; h=Date:Subject:Cc:References:From:In-Reply-To:From; b=E3sz1DQ2Q1atpyhWA3OsMDHEk476vmXhQP/Ha3MvhUjrRSEPc8py0G4wRGM8iOyaB YmPFEhm4Kfgt3Qlne0S2GYlq/Iqy1OnxbjpzdEMXjKjV8b82MhuED0QcOqMxKvBVeZ OKO3f1FKI3ZLG33cdNt9lyvPImkIaLylCRWIOuW4= Message-ID: Date: Wed, 2 Dec 2026 09:59:34 +0000 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Thunderbird Daily Subject: Re: [PATCH v3 3/3] fs/resctrl: Allocate rdt_l3_mon_domain::rmid_busy_llc using kvzalloc_objs() Cc: tony.luck@intel.com, reinette.chatre@intel.com, x86@kernel.org, Dave.Martin@arm.com, james.morse@arm.com, babu.moger@amd.com, fenghuay@nvidia.com, bp@alien8.de, linux-kernel@vger.kernel.org References: <20261125164753.3759904-1-ben.horgan@arm.com> <20261125164753.3759904-4-ben.horgan@arm.com> Content-Language: en-US From: Ben Horgan In-Reply-To: <20261125164753.3759904-4-ben.horgan@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Replying to myself... On 25/11/2026 16:47, Ben Horgan wrote: > The bitmap rdt_l3_mon_domain::rmid_busy_llc has > resctrl_arch_system_num_rmid_idx() entries. On an MPAM system this is the > number of PARTIDs multiplied by the number of PMGs. The maximum possible number > of PARTIDs is 0x10000 and the maximum number of PMGs is 0x100. On a system > approaching these limits the kmalloc() based allocation will consistently fail > and hence fail to bring the monitor domain online. > > As there is no equivalent to bitmap_zalloc() that uses kvmalloc() or vmalloc(), > open code the allocation of rmid_busy_llc using kvzalloc_objs() so that large I chatted to James offline about this and he suggested that even if resctrl is the only user of a kvmalloc() based bitmap allocation that I should make some helpers that could be used verbatim in the bitmap core code even if they at first start life in resctrl. I'll also do some better searching to see if they would be useful elsewhere. (The arm64 asid has large bitmaps that don't need to physically contiguous but these allocated once at boot so we've already got more problems if those allocations are failing.) I'll re-spin with some proper helpers which I'll call bitmap_kvzalloc() and bitmap_kvfree() unless anyone has any better ideas. Thanks, BEn > allocations fall back to vmalloc(). > > Fixes: 264c285999fc ("arm_mpam: resctrl: Add monitor initialisation and domain boilerplate") > Signed-off-by: Ben Horgan > --- > fs/resctrl/rdtgroup.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c > index c55f125ce9a1..a8eebb5a5c4b 100644 > --- a/fs/resctrl/rdtgroup.c > +++ b/fs/resctrl/rdtgroup.c > @@ -4503,7 +4503,7 @@ static void domain_destroy_l3_mon_state(struct rdt_l3_mon_domain *d) > int idx; > > kvfree(d->cntr_cfg); > - bitmap_free(d->rmid_busy_llc); > + kvfree(d->rmid_busy_llc); > for_each_mbm_idx(idx) { > kvfree(d->mbm_states[idx]); > d->mbm_states[idx] = NULL; > @@ -4624,7 +4624,7 @@ static int domain_setup_l3_mon_state(struct rdt_resource *r, struct rdt_l3_mon_d > int idx; > > if (resctrl_is_mon_event_enabled(QOS_L3_OCCUP_EVENT_ID)) { > - d->rmid_busy_llc = bitmap_zalloc(idx_limit, GFP_KERNEL); > + d->rmid_busy_llc = kvzalloc_objs(unsigned long, BITS_TO_LONGS(idx_limit)); > if (!d->rmid_busy_llc) > return -ENOMEM; > } > @@ -4646,7 +4646,7 @@ static int domain_setup_l3_mon_state(struct rdt_resource *r, struct rdt_l3_mon_d > > return 0; > cleanup: > - bitmap_free(d->rmid_busy_llc); > + kvfree(d->rmid_busy_llc); > for_each_mbm_idx(idx) { > kvfree(d->mbm_states[idx]); > d->mbm_states[idx] = NULL;