All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools/dma: fix building from the top level with O=
@ 2026-10-11 22:33 ` Sasha Levin
  2026-10-11 22:43   ` sashiko-bot
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Sasha Levin @ 2026-10-11 22:33 UTC (permalink / raw)
  To: Barry Song, Qinxin Xia, Marek Szyprowski
  Cc: Sasha Levin, stable, iommu, linux-kernel, bpf

"make O=<dir> tools/dma" fails:

  Makefile:27: /tools/build/Makefile.include: No such file or directory

tools/Makefile clears srctree, and the dma Makefile only works it out
again when building_out_of_srctree is not set, which the top-level
Makefile sets for O= builds.

Also work out srctree when it is empty, as tools/bpf/Makefile does
since commit a89b2cbf71d64 ("tools, bpf: Fix build for 'make -s
tools/bpf O=<dir>'").

Fixes: f74ee32963f1b ("tools/dma: move dma_map_benchmark from selftests to tools/dma")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 tools/dma/Makefile | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/dma/Makefile b/tools/dma/Makefile
index 0c239a6b9eae5..20ae7f09cd206 100644
--- a/tools/dma/Makefile
+++ b/tools/dma/Makefile
@@ -7,7 +7,13 @@ bindir ?= /usr/bin
 # isn't set and when invoked from selftests build, where srctree
 # is set to ".". building_out_of_srctree is undefined for in srctree
 # builds
+ifeq ($(srctree),)
+update_srctree := 1
+endif
 ifndef building_out_of_srctree
+update_srctree := 1
+endif
+ifeq ($(update_srctree),1)
 srctree := $(patsubst %/,%,$(dir $(CURDIR)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
 endif
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] tools/dma: fix building from the top level with O=
  2026-10-11 22:33 ` [PATCH] tools/dma: fix building from the top level with O= Sasha Levin
@ 2026-10-11 22:43   ` sashiko-bot
  2026-10-11 23:58     ` Sasha Levin
  2026-10-13  2:09   ` Qinxin Xia
  2026-10-13 11:42   ` Marek Szyprowski
  2 siblings, 1 reply; 5+ messages in thread
From: sashiko-bot @ 2026-10-11 22:43 UTC (permalink / raw)
  To: Sasha Levin; +Cc: bpf

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] tools/dma: incomplete fix for out-of-tree (O=) builds
--

commit f9ebfb989b6d469df7135b7ea719817656f0b606
Author: Sasha Levin <sashal@kernel.org>

tools/dma: fix building from the top level with O=

This commit attempts to fix the out-of-tree build for tools/dma when using
O=<dir> by correctly setting the srctree variable. It ensures that srctree
is worked out even when it is empty or when building_out_of_srctree is set.

> diff --git a/tools/dma/Makefile b/tools/dma/Makefile
> index e4abf37bf020c..b5fe6e2625eef 100644
> --- a/tools/dma/Makefile
> +++ b/tools/dma/Makefile
> @@ -7,7 +7,13 @@ bindir ?= /usr/bin
>  # isn't set and when invoked from selftests build, where srctree
>  # is set to ".". building_out_of_srctree is undefined for in srctree
>  # builds
> +ifeq ($(srctree),)
> +update_srctree := 1
> +endif
>  ifndef building_out_of_srctree
> +update_srctree := 1
> +endif
> +ifeq ($(update_srctree),1)
>  srctree := $(patsubst %/,%,$(dir $(CURDIR)))
>  srctree := $(patsubst %/,%,$(dir $(srctree)))
>  endif

[Severity: Low]
Does this commit completely fix the out-of-tree (O=) builds?

While this resolves the srctree issue to successfully locate Makefile.include,
an out-of-tree build via O=<dir> will still fail immediately afterwards.

The default all target depends on $(ALL_PROGRAMS), which correctly expands to
include $(OUTPUT) (e.g., out/.../dma_map_benchmark). However, the explicit
build rule for $(DMA_MAP_BENCHMARK) lacks the $(OUTPUT) prefix:

tools/dma/Makefile:
    DMA_MAP_BENCHMARK = dma_map_benchmark
    $(DMA_MAP_BENCHMARK): prepare FORCE
        $(CC) $(CFLAGS) $(DMA_MAP_BENCHMARK).c -o $(DMA_MAP_BENCHMARK)

As a result, Make will abort with a 'No rule to make target' error.

Furthermore, the compilation command places the resulting binary back in the
source tree instead of the requested output directory.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261011223358.2327625-4-sashal@kernel.org?part=1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] tools/dma: fix building from the top level with O=
  2026-10-11 22:43   ` sashiko-bot
@ 2026-10-11 23:58     ` Sasha Levin
  0 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2026-10-11 23:58 UTC (permalink / raw)
  To: sashiko-reviews; +Cc: bpf

On Sun, Oct 11, 2026 at 10:43:33PM +0000, sashiko-bot@kernel.org wrote:
>Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
>- [Low] tools/dma: incomplete fix for out-of-tree (O=) builds
>--
>
>commit f9ebfb989b6d469df7135b7ea719817656f0b606
>Author: Sasha Levin <sashal@kernel.org>
>
>tools/dma: fix building from the top level with O=
>
>This commit attempts to fix the out-of-tree build for tools/dma when using
>O=<dir> by correctly setting the srctree variable. It ensures that srctree
>is worked out even when it is empty or when building_out_of_srctree is set.
>
>> diff --git a/tools/dma/Makefile b/tools/dma/Makefile
>> index e4abf37bf020c..b5fe6e2625eef 100644
>> --- a/tools/dma/Makefile
>> +++ b/tools/dma/Makefile
>> @@ -7,7 +7,13 @@ bindir ?= /usr/bin
>>  # isn't set and when invoked from selftests build, where srctree
>>  # is set to ".". building_out_of_srctree is undefined for in srctree
>>  # builds
>> +ifeq ($(srctree),)
>> +update_srctree := 1
>> +endif
>>  ifndef building_out_of_srctree
>> +update_srctree := 1
>> +endif
>> +ifeq ($(update_srctree),1)
>>  srctree := $(patsubst %/,%,$(dir $(CURDIR)))
>>  srctree := $(patsubst %/,%,$(dir $(srctree)))
>>  endif
>
>[Severity: Low]
>Does this commit completely fix the out-of-tree (O=) builds?
>
>While this resolves the srctree issue to successfully locate Makefile.include,
>an out-of-tree build via O=<dir> will still fail immediately afterwards.

This was fixed in a different patch here: https://lore.kernel.org/r/20261011223358.2327625-3-sashal@kernel.org

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] tools/dma: fix building from the top level with O=
  2026-10-11 22:33 ` [PATCH] tools/dma: fix building from the top level with O= Sasha Levin
  2026-10-11 22:43   ` sashiko-bot
@ 2026-10-13  2:09   ` Qinxin Xia
  2026-10-13 11:42   ` Marek Szyprowski
  2 siblings, 0 replies; 5+ messages in thread
From: Qinxin Xia @ 2026-10-13  2:09 UTC (permalink / raw)
  To: Sasha Levin, Barry Song, Marek Szyprowski
  Cc: stable, iommu, linux-kernel, bpf



On 2026/10/12 06:33:32, Sasha Levin <sashal@kernel.org> wrote:
> "make O=<dir> tools/dma" fails:
> 
>    Makefile:27: /tools/build/Makefile.include: No such file or directory
> 
> tools/Makefile clears srctree, and the dma Makefile only works it out
> again when building_out_of_srctree is not set, which the top-level
> Makefile sets for O= builds.
> 
> Also work out srctree when it is empty, as tools/bpf/Makefile does
> since commit a89b2cbf71d64 ("tools, bpf: Fix build for 'make -s
> tools/bpf O=<dir>'").
> 
> Fixes: f74ee32963f1b ("tools/dma: move dma_map_benchmark from selftests to tools/dma")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>   tools/dma/Makefile | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/tools/dma/Makefile b/tools/dma/Makefile
> index 0c239a6b9eae5..20ae7f09cd206 100644
> --- a/tools/dma/Makefile
> +++ b/tools/dma/Makefile
> @@ -7,7 +7,13 @@ bindir ?= /usr/bin
>   # isn't set and when invoked from selftests build, where srctree
>   # is set to ".". building_out_of_srctree is undefined for in srctree
>   # builds
> +ifeq ($(srctree),)
> +update_srctree := 1
> +endif
>   ifndef building_out_of_srctree
> +update_srctree := 1
> +endif
> +ifeq ($(update_srctree),1)
>   srctree := $(patsubst %/,%,$(dir $(CURDIR)))
>   srctree := $(patsubst %/,%,$(dir $(srctree)))
>   endif

Acked-by: Qinxin Xia <xiaqinxin@huawei.com>
-- 
Thanks,
Qinxin


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] tools/dma: fix building from the top level with O=
  2026-10-11 22:33 ` [PATCH] tools/dma: fix building from the top level with O= Sasha Levin
  2026-10-11 22:43   ` sashiko-bot
  2026-10-13  2:09   ` Qinxin Xia
@ 2026-10-13 11:42   ` Marek Szyprowski
  2 siblings, 0 replies; 5+ messages in thread
From: Marek Szyprowski @ 2026-10-13 11:42 UTC (permalink / raw)
  To: Sasha Levin, Barry Song, Qinxin Xia; +Cc: stable, iommu, linux-kernel, bpf

On 12.10.2026 00:33, Sasha Levin wrote:
> "make O=<dir> tools/dma" fails:
>
>   Makefile:27: /tools/build/Makefile.include: No such file or directory
>
> tools/Makefile clears srctree, and the dma Makefile only works it out
> again when building_out_of_srctree is not set, which the top-level
> Makefile sets for O= builds.
>
> Also work out srctree when it is empty, as tools/bpf/Makefile does
> since commit a89b2cbf71d64 ("tools, bpf: Fix build for 'make -s
> tools/bpf O=<dir>'").
>
> Fixes: f74ee32963f1b ("tools/dma: move dma_map_benchmark from selftests to tools/dma")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Sasha Levin <sashal@kernel.org>

Applied to dma-mapping-for-next. Thanks!


Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-13 11:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20261011223410eucas1p1db84283e5fc98bfb7d0bdeff84fd1a7c@eucas1p1.samsung.com>
2026-10-11 22:33 ` [PATCH] tools/dma: fix building from the top level with O= Sasha Levin
2026-10-11 22:43   ` sashiko-bot
2026-10-11 23:58     ` Sasha Levin
2026-10-13  2:09   ` Qinxin Xia
2026-10-13 11:42   ` Marek Szyprowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.