Thread View: linux.kernel.netdev
6 messages
6 total messages
Started by Uwe Kleine-König
Tue, 24 Nov 2026 11:32
Re: [PATCH v3 2/2] alpha: enable contiguous memory allocation for coherent DMA
Author: Uwe Kleine-König
Date: Tue, 24 Nov 2026 11:32
Date: Tue, 24 Nov 2026 11:32
165 lines
17698 bytes
17698 bytes
--zz6vlopso3otapss
Content-Type: text/plain; protected-headers=v1; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Subject: Re: [PATCH v3 2/2] alpha: enable contiguous memory allocation for
coherent DMA
MIME-Version: 1.0
Hello,
On Sun, Nov 15, 2026 at 11:37:43AM +0100, Magnus Lindholm wrote:
> Select HAVE_DMA_CONTIGUOUS and reserve a default CMA area after the
> machine has initialized its DMA windows. Prefer top-down placement
> below the direct-map and usable RAM limits. Skip the default reservation
> when no direct-map window exists. Explicit cma=3D ranges retain their
> generic override semantics; top-down placement is a preference, not a
> hard lower bound excluding the first 16 MiB.
>=20
> Use dma_alloc_contiguous(), which rejects non-blocking callers, before
> falling back to alloc_pages_exact(). Pair both paths with
> dma_free_contiguous(), whose buddy fallback uses free_pages_exact().
> Skip CMA on the GFP_DMA retry after a mapping failure so it cannot
> return the same unsuitable CMA pages. Retain zeroing for CMA memory.
>=20
> Round the size up to a page boundary in both allocation and free. CMA
> allocates size >> PAGE_SHIFT pages, so an unaligned size could otherwise
> allocate too few pages and overrun the allocation during zeroing. Keep
> the mapping and unmapping lengths consistent with the aligned size.
>=20
> With CONFIG_DMA_CMA=3Dy, the default CMA_SIZE_MBYTES setting reserves
> 16 MiB without a cma=3D argument. cma=3D0 disables the default area.
>=20
> Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
> ---
> .../io/dma-contiguous/arch-support.txt | 2 +-
> arch/alpha/Kconfig | 1 +
> arch/alpha/kernel/pci_iommu.c | 19 +++++++++++++------
> arch/alpha/kernel/setup.c | 15 +++++++++++++++
> 4 files changed, 30 insertions(+), 7 deletions(-)
>=20
> diff --git a/Documentation/features/io/dma-contiguous/arch-support.txt b/=
Documentation/features/io/dma-contiguous/arch-support.txt
> index 3c6ce35d704f..6cd205a991f6 100644
> --- a/Documentation/features/io/dma-contiguous/arch-support.txt
> +++ b/Documentation/features/io/dma-contiguous/arch-support.txt
> @@ -6,7 +6,7 @@
> -----------------------
> | arch |status|
> -----------------------
> - | alpha: | TODO |
> + | alpha: | ok |
> | arc: | TODO |
> | arm: | ok |
> | arm64: | ok |
> diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
> index 6ccb2d230326..cddc1f3af209 100644
> --- a/arch/alpha/Kconfig
> +++ b/arch/alpha/Kconfig
> @@ -30,6 +30,7 @@ config ALPHA
> select HAVE_ARCH_COMPILER_H
> select HAVE_ASM_MODVERSIONS
> select HAVE_DEBUG_KMEMLEAK
> + select HAVE_DMA_CONTIGUOUS
> select HAVE_GUP_FAST
> select HAVE_KERNEL_BZIP2
> select HAVE_KERNEL_GZIP
> diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
> index 955b6ca61627..19aa5c05de2b 100644
> --- a/arch/alpha/kernel/pci_iommu.c
> +++ b/arch/alpha/kernel/pci_iommu.c
> @@ -408,15 +408,20 @@ static void *alpha_pci_alloc_coherent(struct device=
*dev, size_t size,
> {
> struct pci_dev *pdev =3D alpha_gendev_to_pci(dev);
> void *cpu_addr;
> - long order =3D get_order(size);
> + struct page *page;
> =20
> + size =3D PAGE_ALIGN(size);
> gfp &=3D ~GFP_DMA;
> =20
> try_again:
> - cpu_addr =3D (void *)__get_free_pages(gfp | __GFP_ZERO, order);
> + /* A low-memory retry must not return the same unsuitable CMA pages. */
> + page =3D (gfp & GFP_DMA) ? NULL : dma_alloc_contiguous(dev, size, gfp);
> + if (page)
> + cpu_addr =3D page_address(page);
> + else
> + cpu_addr =3D alloc_pages_exact(size, gfp | __GFP_ZERO);
> if (! cpu_addr) {
> - printk(KERN_INFO "pci_alloc_consistent: "
> - "get_free_pages failed from %ps\n",
> + pr_info("pci_alloc_consistent: allocation failed from %ps\n",
> __builtin_return_address(0));
> /* ??? Really atomic allocation? Otherwise we could play
> with vmalloc and sg if we can't find contiguous memory. */
> @@ -426,7 +431,7 @@ static void *alpha_pci_alloc_coherent(struct device *=
dev, size_t size,
> =20
> *dma_addrp =3D pci_map_single_1(pdev, virt_to_phys(cpu_addr), size, 0);
> if (*dma_addrp =3D=3D DMA_MAPPING_ERROR) {
> - free_pages((unsigned long)cpu_addr, order);
> + dma_free_contiguous(dev, virt_to_page(cpu_addr), size);
On next-20261123 I get a build error on an ARCH=3Dalpha allmodconfig build
arch/alpha/kernel/pci_iommu.c: In function =E2=80=98alpha_pci_alloc_coheren=
t=E2=80=99:
arch/alpha/kernel/pci_iommu.c:418:41: error: too few arguments to function =
=E2=80=98dma_alloc_contiguous=E2=80=99; expected 4, have 3
418 | page =3D (gfp & GFP_DMA) ? NULL : dma_alloc_contiguous(dev,=
size, gfp);
| ^~~~~~~~~~~~~~~~~~~~
In file included from arch/alpha/kernel/pci_iommu.c:14:
include/linux/dma-map-ops.h:105:14: note: declared here
105 | struct page *dma_alloc_contiguous(struct device *dev, size_t size, =
gfp_t gfp,
| ^~~~~~~~~~~~~~~~~~~~
which seems to be a conflict between
next-20261123~159^2 =3D f03df6019b56 ("alpha: enable contiguous memory all=
ocation for coherent DMA")
=66rom
https://git.kernel.org/pub/scm/linux/kernel/git/lindholm/alpha.git for-next
and
next-20261123~104^2~23^2~7 =3D 31f7e12d621b ("dma-contiguous: pass the NUM=
A node to dma_alloc_contiguous()")
=66rom
https://git.kernel.org/pub/scm/linux/kernel/git/kuba/linux.git dma_alloc_co=
herent_node
I guess the right thing to do is to pull
https://git.kernel.org/pub/scm/linux/kernel/git/kuba/linux.git dma_alloc_c=
oherent_node
into the alpha tree and fix the offending function call in the merge
commit.
Best regards
Uwe
--zz6vlopso3otapss
Content-Type: application/pgp-signature; name="signature.asc"
-----BEGIN PGP SIGNATURE-----
iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmsFdeMACgkQj4D7WH0S
/k5++gf8Def1hTBgcrh/KoII3KUQugHVpyoXdwJDAayGMHuOUnodDFoEcOG7dRch
ODRC7w2t0rKG/XIYwabEtNnXK6BanW5b3foBoafZTtB+E9v7swJK3Z2TpNYsfIDh
eba7AQFbffHbCTwNlzdCMTEmyqqz0qhL5Mc8YONsN9lq4no+UNOzN9123YxSnsaH
MaVWVYaV/ZLWle1TLI3vUfb+L+fQzX96kFbT6FeX1FGO8Cubq37kGONVgLybBvC+
y5GTwQ0VbUIoYQ74Bt+7Jo7qbU8NSyhEiosy5G7TDUQ05NX1Eikj5eiYv+XvHR2u
zBKgWDi9C98biJIon1f+BFbkWqNA2g==
=1TSm
-----END PGP SIGNATURE-----
--zz6vlopso3otapss--
Re: [PATCH v3 2/2] alpha: enable contiguous memory allocation for coherent DMA
Author: Magnus Lindholm
Date: Tue, 24 Nov 2026 23:22
Date: Tue, 24 Nov 2026 23:22
184 lines
19400 bytes
19400 bytes
Hi Uwe,
On Tue, Nov 24, 2026 at 12:32 PM Uwe Kleine-König
<u.kleine-koenig@baylibre.com> wrote:
>
> Hello,
>
> On Sun, Nov 15, 2026 at 11:37:43AM +0100, Magnus Lindholm wrote:
> > Select HAVE_DMA_CONTIGUOUS and reserve a default CMA area after the
> > machine has initialized its DMA windows. Prefer top-down placement
> > below the direct-map and usable RAM limits. Skip the default reservation
> > when no direct-map window exists. Explicit cma= ranges retain their
> > generic override semantics; top-down placement is a preference, not a
> > hard lower bound excluding the first 16 MiB.
> >
> > Use dma_alloc_contiguous(), which rejects non-blocking callers, before
> > falling back to alloc_pages_exact(). Pair both paths with
> > dma_free_contiguous(), whose buddy fallback uses free_pages_exact().
> > Skip CMA on the GFP_DMA retry after a mapping failure so it cannot
> > return the same unsuitable CMA pages. Retain zeroing for CMA memory.
> >
> > Round the size up to a page boundary in both allocation and free. CMA
> > allocates size >> PAGE_SHIFT pages, so an unaligned size could otherwise
> > allocate too few pages and overrun the allocation during zeroing. Keep
> > the mapping and unmapping lengths consistent with the aligned size.
> >
> > With CONFIG_DMA_CMA=y, the default CMA_SIZE_MBYTES setting reserves
> > 16 MiB without a cma= argument. cma=0 disables the default area.
> >
> > Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
> > ---
> > .../io/dma-contiguous/arch-support.txt | 2 +-
> > arch/alpha/Kconfig | 1 +
> > arch/alpha/kernel/pci_iommu.c | 19 +++++++++++++------
> > arch/alpha/kernel/setup.c | 15 +++++++++++++++
> > 4 files changed, 30 insertions(+), 7 deletions(-)
> >
> > diff --git a/Documentation/features/io/dma-contiguous/arch-support.txt b/Documentation/features/io/dma-contiguous/arch-support.txt
> > index 3c6ce35d704f..6cd205a991f6 100644
> > --- a/Documentation/features/io/dma-contiguous/arch-support.txt
> > +++ b/Documentation/features/io/dma-contiguous/arch-support.txt
> > @@ -6,7 +6,7 @@
> > -----------------------
> > | arch |status|
> > -----------------------
> > - | alpha: | TODO |
> > + | alpha: | ok |
> > | arc: | TODO |
> > | arm: | ok |
> > | arm64: | ok |
> > diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
> > index 6ccb2d230326..cddc1f3af209 100644
> > --- a/arch/alpha/Kconfig
> > +++ b/arch/alpha/Kconfig
> > @@ -30,6 +30,7 @@ config ALPHA
> > select HAVE_ARCH_COMPILER_H
> > select HAVE_ASM_MODVERSIONS
> > select HAVE_DEBUG_KMEMLEAK
> > + select HAVE_DMA_CONTIGUOUS
> > select HAVE_GUP_FAST
> > select HAVE_KERNEL_BZIP2
> > select HAVE_KERNEL_GZIP
> > diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
> > index 955b6ca61627..19aa5c05de2b 100644
> > --- a/arch/alpha/kernel/pci_iommu.c
> > +++ b/arch/alpha/kernel/pci_iommu.c
> > @@ -408,15 +408,20 @@ static void *alpha_pci_alloc_coherent(struct device *dev, size_t size,
> > {
> > struct pci_dev *pdev = alpha_gendev_to_pci(dev);
> > void *cpu_addr;
> > - long order = get_order(size);
> > + struct page *page;
> >
> > + size = PAGE_ALIGN(size);
> > gfp &= ~GFP_DMA;
> >
> > try_again:
> > - cpu_addr = (void *)__get_free_pages(gfp | __GFP_ZERO, order);
> > + /* A low-memory retry must not return the same unsuitable CMA pages. */
> > + page = (gfp & GFP_DMA) ? NULL : dma_alloc_contiguous(dev, size, gfp);
> > + if (page)
> > + cpu_addr = page_address(page);
> > + else
> > + cpu_addr = alloc_pages_exact(size, gfp | __GFP_ZERO);
> > if (! cpu_addr) {
> > - printk(KERN_INFO "pci_alloc_consistent: "
> > - "get_free_pages failed from %ps\n",
> > + pr_info("pci_alloc_consistent: allocation failed from %ps\n",
> > __builtin_return_address(0));
> > /* ??? Really atomic allocation? Otherwise we could play
> > with vmalloc and sg if we can't find contiguous memory. */
> > @@ -426,7 +431,7 @@ static void *alpha_pci_alloc_coherent(struct device *dev, size_t size,
> >
> > *dma_addrp = pci_map_single_1(pdev, virt_to_phys(cpu_addr), size, 0);
> > if (*dma_addrp == DMA_MAPPING_ERROR) {
> > - free_pages((unsigned long)cpu_addr, order);
> > + dma_free_contiguous(dev, virt_to_page(cpu_addr), size);
>
> On next-20261123 I get a build error on an ARCH=alpha allmodconfig build
>
> arch/alpha/kernel/pci_iommu.c: In function ‘alpha_pci_alloc_coherent’:
> arch/alpha/kernel/pci_iommu.c:418:41: error: too few arguments to function ‘dma_alloc_contiguous’; expected 4, have 3
> 418 | page = (gfp & GFP_DMA) ? NULL : dma_alloc_contiguous(dev, size, gfp);
> | ^~~~~~~~~~~~~~~~~~~~
> In file included from arch/alpha/kernel/pci_iommu.c:14:
> include/linux/dma-map-ops.h:105:14: note: declared here
> 105 | struct page *dma_alloc_contiguous(struct device *dev, size_t size, gfp_t gfp,
> | ^~~~~~~~~~~~~~~~~~~~
>
> which seems to be a conflict between
>
> next-20261123~159^2 = f03df6019b56 ("alpha: enable contiguous memory allocation for coherent DMA")
>
> from
> https://git.kernel.org/pub/scm/linux/kernel/git/lindholm/alpha.git for-next
>
> and
>
> next-20261123~104^2~23^2~7 = 31f7e12d621b ("dma-contiguous: pass the NUMA node to dma_alloc_contiguous()")
>
> from
> https://git.kernel.org/pub/scm/linux/kernel/git/kuba/linux.git dma_alloc_coherent_node
>
> I guess the right thing to do is to pull
>
> https://git.kernel.org/pub/scm/linux/kernel/git/kuba/linux.git dma_alloc_coherent_node
>
> into the alpha tree and fix the offending function call in the merge
> commit.
Thanks for catching this and identifying the interacting commits.
I reproduced the error on next-20261123. In
arch/alpha/kernel/pci_iommu.c, I changed:
page = (gfp & GFP_DMA) ? NULL : dma_alloc_contiguous(dev, size, gfp);
to:
page = (gfp & GFP_DMA) ? NULL :
dma_alloc_contiguous(dev, size, gfp, dev_to_node(dev));
This fixes the allmodconfig pci_iommu.o build. A full DP264 UP build
with CMA enabled also passed, as did an object build with CMA disabled.
The full allmodconfig build hit an unrelated cgroup sample error
involving PATH_MAX and LINE_MAX.
I'd prefer to keep the Alpha tree independent of the DMA series.
Could we coordinate with Jakub and Marek to carry the adjustment in
linux-next and ensure it reaches Linus when both changes are present?
I'm happy to help with further testing.
If that proves awkward, I can remove the CMA patch from for-next and
defer it to a separate Alpha pull request once the DMA changes have
landed, updating the caller then.
Thanks,
Magnus
>
> Best regards
> Uwe
Re: [PATCH v3 2/2] alpha: enable contiguous memory allocation for coherent DMA
Author: Marek Szyprowski
Date: Wed, 25 Nov 2026 08:54
Date: Wed, 25 Nov 2026 08:54
170 lines
17436 bytes
17436 bytes
Hi Magnus,
On 25.11.2026 00:22, Magnus Lindholm wrote:
> On Tue, Nov 24, 2026 at 12:32 PM Uwe Kleine-König
> <u.kleine-koenig@baylibre.com> wrote:
>> On Sun, Nov 15, 2026 at 11:37:43AM +0100, Magnus Lindholm wrote:
>>> Select HAVE_DMA_CONTIGUOUS and reserve a default CMA area after the
>>> machine has initialized its DMA windows. Prefer top-down placement
>>> below the direct-map and usable RAM limits. Skip the default reservation
>>> when no direct-map window exists. Explicit cma= ranges retain their
>>> generic override semantics; top-down placement is a preference, not a
>>> hard lower bound excluding the first 16 MiB.
>>>
>>> Use dma_alloc_contiguous(), which rejects non-blocking callers, before
>>> falling back to alloc_pages_exact(). Pair both paths with
>>> dma_free_contiguous(), whose buddy fallback uses free_pages_exact().
>>> Skip CMA on the GFP_DMA retry after a mapping failure so it cannot
>>> return the same unsuitable CMA pages. Retain zeroing for CMA memory.
>>>
>>> Round the size up to a page boundary in both allocation and free. CMA
>>> allocates size >> PAGE_SHIFT pages, so an unaligned size could otherwise
>>> allocate too few pages and overrun the allocation during zeroing. Keep
>>> the mapping and unmapping lengths consistent with the aligned size.
>>>
>>> With CONFIG_DMA_CMA=y, the default CMA_SIZE_MBYTES setting reserves
>>> 16 MiB without a cma= argument. cma=0 disables the default area.
>>>
>>> Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
>>> ---
>>> .../io/dma-contiguous/arch-support.txt | 2 +-
>>> arch/alpha/Kconfig | 1 +
>>> arch/alpha/kernel/pci_iommu.c | 19 +++++++++++++------
>>> arch/alpha/kernel/setup.c | 15 +++++++++++++++
>>> 4 files changed, 30 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/Documentation/features/io/dma-contiguous/arch-support.txt b/Documentation/features/io/dma-contiguous/arch-support.txt
>>> index 3c6ce35d704f..6cd205a991f6 100644
>>> --- a/Documentation/features/io/dma-contiguous/arch-support.txt
>>> +++ b/Documentation/features/io/dma-contiguous/arch-support.txt
>>> @@ -6,7 +6,7 @@
>>> -----------------------
>>> | arch |status|
>>> -----------------------
>>> - | alpha: | TODO |
>>> + | alpha: | ok |
>>> | arc: | TODO |
>>> | arm: | ok |
>>> | arm64: | ok |
>>> diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
>>> index 6ccb2d230326..cddc1f3af209 100644
>>> --- a/arch/alpha/Kconfig
>>> +++ b/arch/alpha/Kconfig
>>> @@ -30,6 +30,7 @@ config ALPHA
>>> select HAVE_ARCH_COMPILER_H
>>> select HAVE_ASM_MODVERSIONS
>>> select HAVE_DEBUG_KMEMLEAK
>>> + select HAVE_DMA_CONTIGUOUS
>>> select HAVE_GUP_FAST
>>> select HAVE_KERNEL_BZIP2
>>> select HAVE_KERNEL_GZIP
>>> diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
>>> index 955b6ca61627..19aa5c05de2b 100644
>>> --- a/arch/alpha/kernel/pci_iommu.c
>>> +++ b/arch/alpha/kernel/pci_iommu.c
>>> @@ -408,15 +408,20 @@ static void *alpha_pci_alloc_coherent(struct device *dev, size_t size,
>>> {
>>> struct pci_dev *pdev = alpha_gendev_to_pci(dev);
>>> void *cpu_addr;
>>> - long order = get_order(size);
>>> + struct page *page;
>>>
>>> + size = PAGE_ALIGN(size);
>>> gfp &= ~GFP_DMA;
>>>
>>> try_again:
>>> - cpu_addr = (void *)__get_free_pages(gfp | __GFP_ZERO, order);
>>> + /* A low-memory retry must not return the same unsuitable CMA pages. */
>>> + page = (gfp & GFP_DMA) ? NULL : dma_alloc_contiguous(dev, size, gfp);
>>> + if (page)
>>> + cpu_addr = page_address(page);
>>> + else
>>> + cpu_addr = alloc_pages_exact(size, gfp | __GFP_ZERO);
>>> if (! cpu_addr) {
>>> - printk(KERN_INFO "pci_alloc_consistent: "
>>> - "get_free_pages failed from %ps\n",
>>> + pr_info("pci_alloc_consistent: allocation failed from %ps\n",
>>> __builtin_return_address(0));
>>> /* ??? Really atomic allocation? Otherwise we could play
>>> with vmalloc and sg if we can't find contiguous memory. */
>>> @@ -426,7 +431,7 @@ static void *alpha_pci_alloc_coherent(struct device *dev, size_t size,
>>>
>>> *dma_addrp = pci_map_single_1(pdev, virt_to_phys(cpu_addr), size, 0);
>>> if (*dma_addrp == DMA_MAPPING_ERROR) {
>>> - free_pages((unsigned long)cpu_addr, order);
>>> + dma_free_contiguous(dev, virt_to_page(cpu_addr), size);
>> On next-20261123 I get a build error on an ARCH=alpha allmodconfig build
>>
>> arch/alpha/kernel/pci_iommu.c: In function ‘alpha_pci_alloc_coherent’:
>> arch/alpha/kernel/pci_iommu.c:418:41: error: too few arguments to function ‘dma_alloc_contiguous’; expected 4, have 3
>> 418 | page = (gfp & GFP_DMA) ? NULL : dma_alloc_contiguous(dev, size, gfp);
>> | ^~~~~~~~~~~~~~~~~~~~
>> In file included from arch/alpha/kernel/pci_iommu.c:14:
>> include/linux/dma-map-ops.h:105:14: note: declared here
>> 105 | struct page *dma_alloc_contiguous(struct device *dev, size_t size, gfp_t gfp,
>> | ^~~~~~~~~~~~~~~~~~~~
>>
>> which seems to be a conflict between
>>
>> next-20261123~159^2 = f03df6019b56 ("alpha: enable contiguous memory allocation for coherent DMA")
>>
>> from
>> https://git.kernel.org/pub/scm/linux/kernel/git/lindholm/alpha.git for-next
>>
>> and
>>
>> next-20261123~104^2~23^2~7 = 31f7e12d621b ("dma-contiguous: pass the NUMA node to dma_alloc_contiguous()")
>>
>> from
>> https://git.kernel.org/pub/scm/linux/kernel/git/kuba/linux.git dma_alloc_coherent_node
>>
>> I guess the right thing to do is to pull
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/kuba/linux.git dma_alloc_coherent_node
>>
>> into the alpha tree and fix the offending function call in the merge
>> commit.
> Thanks for catching this and identifying the interacting commits.
>
> I reproduced the error on next-20261123. In
> arch/alpha/kernel/pci_iommu.c, I changed:
>
> page = (gfp & GFP_DMA) ? NULL : dma_alloc_contiguous(dev, size, gfp);
>
> to:
>
> page = (gfp & GFP_DMA) ? NULL :
> dma_alloc_contiguous(dev, size, gfp, dev_to_node(dev));
>
> This fixes the allmodconfig pci_iommu.o build. A full DP264 UP build
> with CMA enabled also passed, as did an object build with CMA disabled.
> The full allmodconfig build hit an unrelated cgroup sample error
> involving PATH_MAX and LINE_MAX.
>
> I'd prefer to keep the Alpha tree independent of the DMA series.
> Could we coordinate with Jakub and Marek to carry the adjustment in
> linux-next and ensure it reaches Linus when both changes are present?
> I'm happy to help with further testing.
>
> If that proves awkward, I can remove the CMA patch from for-next and
> defer it to a separate Alpha pull request once the DMA changes have
> landed, updating the caller then.
I think that rebasing the alpha changes on top of Jakub's stable tag:
git://git.kernel.org/pub/scm/linux/kernel/git/kuba/linux dma_alloc_coherent_node
would be the easiest way of handling this conflict as this way we will
avoid any build breaks and keep the changes bisectable.
However if You still want to keep Your CMA changes based on v7.4-rc1 in
alpha tree, then please provide a stable tag or branch with them.
I will merge it to dma-mapping-for-next and apply the needed fixup.
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
Re: [PATCH v3 2/2] alpha: enable contiguous memory allocation for coherent DMA
Author: Uwe Kleine-König
Date: Wed, 25 Nov 2026 10:53
Date: Wed, 25 Nov 2026 10:53
67 lines
13830 bytes
13830 bytes
--6sn276mtbb7rvtiq Content-Type: text/plain; protected-headers=v1; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH v3 2/2] alpha: enable contiguous memory allocation for coherent DMA MIME-Version: 1.0 Hello, On Wed, Nov 25, 2026 at 09:54:08AM +0100, Marek Szyprowski wrote: > Hi Magnus, >=20 > On 25.11.2026 00:22, Magnus Lindholm wrote: > > Thanks for catching this and identifying the interacting commits. > > > > I reproduced the error on next-20261123. In > > arch/alpha/kernel/pci_iommu.c, I changed: > > > > page =3D (gfp & GFP_DMA) ? NULL : dma_alloc_contiguous(dev, size, gfp); > > > > to: > > > > page =3D (gfp & GFP_DMA) ? NULL : > > dma_alloc_contiguous(dev, size, gfp, dev_to_node(dev)); > > > > This fixes the allmodconfig pci_iommu.o build. A full DP264 UP build > > with CMA enabled also passed, as did an object build with CMA disabled. > > The full allmodconfig build hit an unrelated cgroup sample error > > involving PATH_MAX and LINE_MAX. > > > > I'd prefer to keep the Alpha tree independent of the DMA series. That's up to you, but in my eyes merging in the immutable branch provided by Jakub into your tree (or rebasing on top of it as suggested by Marek) is really the easiest option. That way you don't have to wait for the change to hit Linus' tree and there is no further need for coordination or others paying attention to not create non-bisectable commit graphs. However looking at the immutable branch I see it contains both the dma API change and then separately various adaptions to ethernet drivers. IMHO the immutable branch should only contain the API changes (that is the commits up to 31f7e12d621b) to reduce the amount of possible conflict. Best regards Uwe --6sn276mtbb7rvtiq Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmsGvgoACgkQj4D7WH0S /k7oNAgAknak/QZHg7BqHZFzHCe4qtzYco0MHY20TLpuveFkHfRuLa9UVG2bG0Ww LQZfbq0hnFip66k6fjmWJ+mGt0QyF7sJj/DpkCtXlI6aQtnnm3D3slJhpH/bWjue fk1SdxjYh64pzlg1UF9rEJri73sW9fln2Gz2EK1iHllG2Z1XRGwb4bBzh6WpzAxc AuLAWN7R4PJvFLQ+kNkR4YocW5+EV0RnYb7/i7Fb9ABP1MxCxi+4OM8+uD8MGuGZ OFggCxgES6vXm2Ostds9EY3vRvG+zs6/ZpyofM5BxVfPInkgG1teIzoXDpivIgkA C+dJzsR+ixI93VaJu1B++KrDBjHhlw== =UmCO -----END PGP SIGNATURE----- --6sn276mtbb7rvtiq--
Re: [PATCH v3 2/2] alpha: enable contiguous memory allocation for coherent DMA
Author: Magnus Lindholm
Date: Wed, 25 Nov 2026 11:52
Date: Wed, 25 Nov 2026 11:52
64 lines
14679 bytes
14679 bytes
Hi Uwe, Marek, Jakub, On Wed, Nov 25, 2026 at 11:53 AM Uwe Kleine-König <u.kleine-koenig@baylibre.com> wrote: > > Hello, > > On Wed, Nov 25, 2026 at 09:54:08AM +0100, Marek Szyprowski wrote: > > Hi Magnus, > > > > On 25.11.2026 00:22, Magnus Lindholm wrote: > > > Thanks for catching this and identifying the interacting commits. > > > > > > I reproduced the error on next-20261123. In > > > arch/alpha/kernel/pci_iommu.c, I changed: > > > > > > page = (gfp & GFP_DMA) ? NULL : dma_alloc_contiguous(dev, size, gfp); > > > > > > to: > > > > > > page = (gfp & GFP_DMA) ? NULL : > > > dma_alloc_contiguous(dev, size, gfp, dev_to_node(dev)); > > > > > > This fixes the allmodconfig pci_iommu.o build. A full DP264 UP build > > > with CMA enabled also passed, as did an object build with CMA disabled. > > > The full allmodconfig build hit an unrelated cgroup sample error > > > involving PATH_MAX and LINE_MAX. > > > > > > I'd prefer to keep the Alpha tree independent of the DMA series. > > That's up to you, but in my eyes merging in the immutable branch > provided by Jakub into your tree (or rebasing on top of it as suggested > by Marek) is really the easiest option. That way you don't have to wait > for the change to hit Linus' tree and there is no further need for > coordination or others paying attention to not create non-bisectable > commit graphs. > > However looking at the immutable branch I see it contains both the dma > API change and then separately various adaptions to ethernet drivers. > IMHO the immutable branch should only contain the API changes (that is > the commits up to 31f7e12d621b) to reduce the amount of possible > conflict. Thanks, that makes sense. I guess best is for me to rebase the Alpha changes onto the shared DMA API changes and update the caller in my CMA commit. As you point out, using only the four API commits through 31f7e12d621b would avoid bringing the Ethernet driver conversions into the Alpha tree. Jakub, Marek, would that commit be a suitable immutable base for this? A separate stable tag at that point would be helpful. I'll then rebase, retest, and notify Mark before updating for-next. Thanks, Magnus > > Best regards > Uwe
Re: [PATCH v3 2/2] alpha: enable contiguous memory allocation for coherent DMA
Author: Marek Szyprowski
Date: Fri, 27 Nov 2026 08:04
Date: Fri, 27 Nov 2026 08:04
59 lines
12237 bytes
12237 bytes
On 25.11.2026 12:52, Magnus Lindholm wrote: > On Wed, Nov 25, 2026 at 11:53 AM Uwe Kleine-König > <u.kleine-koenig@baylibre.com> wrote: >> On Wed, Nov 25, 2026 at 09:54:08AM +0100, Marek Szyprowski wrote: >>> On 25.11.2026 00:22, Magnus Lindholm wrote: >>>> Thanks for catching this and identifying the interacting commits. >>>> >>>> I reproduced the error on next-20261123. In >>>> arch/alpha/kernel/pci_iommu.c, I changed: >>>> >>>> page = (gfp & GFP_DMA) ? NULL : dma_alloc_contiguous(dev, size, gfp); >>>> >>>> to: >>>> >>>> page = (gfp & GFP_DMA) ? NULL : >>>> dma_alloc_contiguous(dev, size, gfp, dev_to_node(dev)); >>>> >>>> This fixes the allmodconfig pci_iommu.o build. A full DP264 UP build >>>> with CMA enabled also passed, as did an object build with CMA disabled. >>>> The full allmodconfig build hit an unrelated cgroup sample error >>>> involving PATH_MAX and LINE_MAX. >>>> >>>> I'd prefer to keep the Alpha tree independent of the DMA series. >> That's up to you, but in my eyes merging in the immutable branch >> provided by Jakub into your tree (or rebasing on top of it as suggested >> by Marek) is really the easiest option. That way you don't have to wait >> for the change to hit Linus' tree and there is no further need for >> coordination or others paying attention to not create non-bisectable >> commit graphs. >> >> However looking at the immutable branch I see it contains both the dma >> API change and then separately various adaptions to ethernet drivers. >> IMHO the immutable branch should only contain the API changes (that is >> the commits up to 31f7e12d621b) to reduce the amount of possible >> conflict. > Thanks, that makes sense. I guess best is for me to rebase the Alpha changes > onto the shared DMA API changes and update the caller in my CMA commit. > > As you point out, using only the four API commits through 31f7e12d621b > would avoid bringing the Ethernet driver conversions into the Alpha tree. > > Jakub, Marek, would that commit be a suitable immutable base for this? Yes, that would also work. > A separate stable tag at that point would be helpful. > > I'll then rebase, retest, and notify Mark before updating for-next. Here is a stable tag for You, I'm sorry for the delay: https://git.kernel.org/pub/scm/linux/kernel/git/mszyprowski/linux.git dma_alloc_coherent_node_api Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads