linux-um.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: Shuah Khan <skhan@linuxfoundation.org>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Anton Ivanov <anton.ivanov@cambridgegreys.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	 Richard Weinberger <richard@nod.at>,
	linux-um@lists.infradead.org,  David Gow <davidgow@google.com>
Subject: Re: [PATCH] um: let 'make clean' properly clean underlying SUBARCH as well
Date: Thu, 8 May 2025 08:49:20 +0900	[thread overview]
Message-ID: <CAK7LNARF=ANEEeENSwcWeayympi6Svci+ScWGpWQimyWm8xUzA@mail.gmail.com> (raw)
In-Reply-To: <9ec50ce0-f60b-4d87-bc44-adaf2a1a97a1@linuxfoundation.org>

On Thu, May 8, 2025 at 6:38 AM Shuah Khan <skhan@linuxfoundation.org> wrote:
>
> On 5/7/25 01:49, Masahiro Yamada wrote:
> > Building the kernel with O= is affected by stale in-tree build artifacts.
> >
> > So, if the source tree is not clean, Kbuild displays the following:
> >
> >    $ make ARCH=um O=build defconfig
> >    make[1]: Entering directory '/.../linux/build'
> >    ***
> >    *** The source tree is not clean, please run 'make ARCH=um mrproper'
> >    *** in /.../linux
> >    ***
> >    make[2]: *** [/.../linux/Makefile:673: outputmakefile] Error 1
> >    make[1]: *** [/.../linux/Makefile:248: __sub-make] Error 2
> >    make[1]: Leaving directory '/.../linux/build'
> >    make: *** [Makefile:248: __sub-make] Error 2
> >
> > Usually, running 'make mrproper' is sufficient for cleaning the source
> > tree for out-of-tree builds.
> >
> > However, building UML generates build artifacts not only in arch/um/,
> > but also in the SUBARCH directory (i.e., arch/x86/). If in-tree stale
> > files remain under arch/x86/, Kbuild will reuse them instead of creating
> > new ones under the specified build directory.
> >
> > This commit makes 'make ARCH=um clean' recurse into the SUBARCH directory.
> >
> > Reported-by: Shuah Khan <skhan@linuxfoundation.org>
> > Closes: https://lore.kernel.org/lkml/20250502172459.14175-1-skhan@linuxfoundation.org/
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
>
> It doesn't solve the problem. I still see arch/x86/realmode/rm/pasyms.h
> after running make ARCH=um mrproper


Why not?

This patch allows 'make ARCH=um mrproper'
to clean up both arch/um and arch/x86/.

It is really simple to test the behavior.


[Without this patch]

masahiro@zoe:~/workspace/linux-kbuild(master)$ touch
arch/x86/realmode/rm/pasyms.h
masahiro@zoe:~/workspace/linux-kbuild(master)$ make ARCH=um mrproper
masahiro@zoe:~/workspace/linux-kbuild(master)$ ls arch/x86/realmode/rm/pasyms.h
arch/x86/realmode/rm/pasyms.h

[With this patch]

masahiro@zoe:~/workspace/linux-kbuild(kbuild)$ touch
arch/x86/realmode/rm/pasyms.h
masahiro@zoe:~/workspace/linux-kbuild(kbuild)$ make ARCH=um mrproper
  CLEAN   arch/x86/realmode/rm
masahiro@zoe:~/workspace/linux-kbuild(kbuild)$ ls arch/x86/realmode/rm/pasyms.h
ls: cannot access 'arch/x86/realmode/rm/pasyms.h': No such file or directory





> A subsequent kunit run on x86_64 fails. make ARCH=x86_64 mrproper
> will remove the headers for x86_64 properly. The patch I proposed
> prompts user run mrproper on the arch in compile.h - It works now
> for the case where compile.h doesn't exist. I can send that out
> unless you have other ideas on how to fix this.

No.

If you still see a problem, please explain the bad scenario,
please explain without kunit.









> My workflow:
>
> - Build kernel on x86_64 with CONFIG_AMD_MEM_ENCRYPT enabled
>
> - Check for arch/x86/realmode/rm/pasyms.h
>    ls arch/x86/realmode/rm/pasyms.h
>       arch/x86/realmode/rm/pasyms.h
>
> - make ARCH=um O=/linux/build
>
>    This patch cleans the source tree, but doesn't remove
>    arch/x86/realmode/rm/pasyms.h
>
> - ls arch/x86/realmode/rm/pasyms.h
>       arch/x86/realmode/rm/pasyms.h
>
> - ./tools/testing/kunit/kunit.py run --alltests --arch x86_64
> [15:26:35] Configuring KUnit Kernel ...
> Regenerating .config ...
> Populating config with:
> $ make ARCH=x86_64 O=.kunit olddefconfig
> [15:26:37] Building KUnit Kernel ...
> Populating config with:
> $ make ARCH=x86_64 O=.kunit olddefconfig
> Building with:
> $ make all compile_commands.json scripts_gdb ARCH=x86_64 O=.kunit --jobs=16
> ERROR:root:ld:arch/x86/realmode/rm/realmode.lds:236: undefined symbol `sev_es_trampoline_start' referenced in expression
> make[6]: *** [../arch/x86/realmode/rm/Makefile:49: arch/x86/realmode/rm/realmode.elf] Error 1
> make[5]: *** [../arch/x86/realmode/Makefile:22: arch/x86/realmode/rm/realmode.bin] Error 2
> make[4]: *** [../scripts/Makefile.build:461: arch/x86/realmode] Error 2
> make[4]: *** Waiting for unfinished jobs....
> make[3]: *** [../scripts/Makefile.build:461: arch/x86] Error 2
> make[3]: *** Waiting for unfinished jobs....
> make[2]: *** [/linux/linux_kselftest/Makefile:2009: .] Error 2
> make[1]: *** [/linux/linux_kselftest/Makefile:248: __sub-make] Error 2
> make: *** [Makefile:248: __sub-make] Error 2
>
> thanks,
> -- Shuah



--
Best Regards

Masahiro Yamada


  reply	other threads:[~2025-05-07 23:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-07  7:49 [PATCH] um: let 'make clean' properly clean underlying SUBARCH as well Masahiro Yamada
2025-05-07 16:13 ` Johannes Berg
2025-05-07 21:38 ` Shuah Khan
2025-05-07 23:49   ` Masahiro Yamada [this message]
2025-05-08 22:14     ` Shuah Khan
2025-05-08 23:43       ` Masahiro Yamada
2025-05-08  5:29   ` Johannes Berg
2025-05-08  7:38     ` Geert Uytterhoeven
2025-05-08  8:14       ` Masahiro Yamada
2025-05-08  8:17         ` Geert Uytterhoeven
2025-05-08  6:12 ` David Gow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAK7LNARF=ANEEeENSwcWeayympi6Svci+ScWGpWQimyWm8xUzA@mail.gmail.com' \
    --to=masahiroy@kernel.org \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=davidgow@google.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).