From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B4C6175A81 for ; Tue, 21 Jul 2026 23:01:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784674865; cv=none; b=dQQtSbS46lQ7hElt2/AYkzVCKryT10LuutJW1dV/3V7zo1AIHRZNiX94k8xMepGcabuhj8lfKzh7fbRD4BI0eaR0hQfnJUWhn2YaaKNbc/oIBSia3cFFua8gYy3z9fQnBY7IykxxIlvIeHAnJKC83cL+ZeOicRkjYIkfbJmhIPg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784674865; c=relaxed/simple; bh=j8Zp27oFQeS4hyqTts8Q4HhxxFNBFnfExuS2wqHSf0o=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=bvE9gWZXuwNE/srzZK9k9W0YDJcbcot4bHrkUkQZIOKO9NJEmF5wwqw2HBxdWKBwXXkxEKXa0s8TMgNNMfQ6+g2h8YjbR/+Bm7pBU6P1/l0T2GbuDocTAKOCZOPpeXyLq+CutZr+eAGnms3zwtNykrJm6ox7L+10cueFXukAzHM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bC3iLC6m; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bC3iLC6m" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71EEE1F00A3A; Tue, 21 Jul 2026 23:01:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784674864; bh=MGbzU3rXW1IbCyqsDLNTfiEd5EcdqQM79u5u7bcXVps=; h=Date:From:To:cc:Subject:In-Reply-To:References; b=bC3iLC6mA7hkMPadwh0cG/Po+ri1uUxF3ZMgLDxUn83L4BBO0bgPjmptJzngzCjgU +TnJx5pYGK42zz9tCx1a+uLZjpe8JIAxfm1PSnCvbDjUhgTc2gjnFoNbBN7uLkrpwL JO8xiMttfQT0mF4dh1MbfTYHENfm1rzxr4gzURqNdW4YCPt54MlViaV8CGz+NNYWIn lgsaly7k9b3ViQ+XpObbUAx/txLbskWAvsay7kXAKTUOgx7HuFhJlIIvreVoKQJg2i 9CfB5bWOchRSCDuolDw4s11Ay6VPjh4wR7+wG24My/KWLQwZWr1pIUroBtbDATUDUA wW0m/BE9m7bTg== Date: Tue, 21 Jul 2026 17:00:58 -0600 (MDT) From: Paul Walmsley To: Eder Zulian cc: pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] riscv: mm: Move dma_contiguous_reserve() after NUMA initialization In-Reply-To: <20260714185648.1082483-1-ezulian@redhat.com> Message-ID: References: <20260714185648.1082483-1-ezulian@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Hi, On Tue, 14 Jul 2026, Eder Zulian wrote: > Move the dma_contiguous_reserve() call from setup_bootmem() to > misc_mem_init(), placing it after arch_numa_init(). This ensures that > NUMA topology is initialized when reserving contiguous memory for DMA. > > Tested with CMA_SIZE_PERNUMA enabled and two NUMA nodes on QEMU: > > qemu-system-riscv64 \ > -machine virt \ > -nographic \ > -smp 2 -m 512M \ > -numa node,nodeid=0,cpus=0,memdev=m0 \ > -numa node,nodeid=1,cpus=1,memdev=m1 \ > -object memory-backend-ram,id=m0,size=256M \ > -object memory-backend-ram,id=m1,size=256M \ > -kernel arch/riscv/boot/Image \ > -append "console=ttyS0 earlycon loglevel=7 cma=16M" > > Unpatched kernel's log (one global CMA pool and no per-nodepools, 16 MiB > cma-reserved): > > [ 0.000000] cma: Reserved 16 MiB at 0x000000009ee00000 > ... > [ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x000000008fffffff] > [ 0.000000] Initmem setup node 1 [mem 0x0000000090000000-0x000000009fffffff] > ... > [ 0.056397] smp: Brought up 2 nodes, 2 CPUs > [ 0.066135] Memory: 449288K/524288K available (12279K kernel code, 5980K rwdata, 6144K rodata, 2467K init, 482K bss, 54504K reserved, 16384K cma-reserved) > > Patched kernel's log (three CMA pools are created, 48 MiB total), > > [ 0.000000] cma: Reserved 16 MiB at 0x000000009ee00000 > [ 0.000000] cma: Reserved 16 MiB at 0x000000008ee00000 > [ 0.000000] cma: Reserved 16 MiB at 0x000000009de00000 > ... > [ 0.054251] smp: Brought up 2 nodes, 2 CPUs > [ 0.064082] Memory: 416520K/524288K available (12279K kernel code, 5980K rwdata, 6144K rodata, 2467K init, 482K bss, 54504K reserved, 49152K cma-reserved) > > Signed-off-by: Eder Zulian Thanks, queued for v7.3. - Paul