All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-oe][PATCH] nodejs: ignore QEMU_OPTIONS for native signature generation
@ 2025-06-21 19:40 Gyorgy Sarvari
  2025-06-23  5:35 ` [oe] " Alexander Kanavin
  0 siblings, 1 reply; 5+ messages in thread
From: Gyorgy Sarvari @ 2025-06-21 19:40 UTC (permalink / raw)
  To: openembedded-devel

NodeJS recipe uses qemu to run some target binaries during compilation
in qemu, in case the build machine's and the target machine's CPU
bit-width are different. The task that generates some helper scripts
(do_create_v8_qemu_wrapper) is executed before do_compile.

In case the target machine changes, that also changes the value of
QEMU_OPTIONS variable, since that is always derived from the target
machine's properties, even when the current recipe is class-native.

This also means that in case the target machine changes, that invalidates
the do_create_v8_qemu_wrapper's sstate cache (along with the very costly
do_compile), for both target and native builds.

However for native builds qemu isn't used at all, since the target and build
CPU are the same, their bit-width matches too.

To avoid unnecessarily invalidating the sstate cache of nodejs-native
when the target machine changes, add QEMU_OPTIONS to BB_HASHCONFIG_IGNORE_VARS
in order to exclude it from the signature generation.

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
---
 meta-oe/recipes-devtools/nodejs/nodejs_22.16.0.bb | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_22.16.0.bb b/meta-oe/recipes-devtools/nodejs/nodejs_22.16.0.bb
index 4bc829f140..bf2bae27f1 100644
--- a/meta-oe/recipes-devtools/nodejs/nodejs_22.16.0.bb
+++ b/meta-oe/recipes-devtools/nodejs/nodejs_22.16.0.bb
@@ -47,6 +47,10 @@ CVE_PRODUCT += "node.js"
 # v8 errors out if you have set CCACHE
 CCACHE = ""
 
+# Changing qemu options can incorrectly invalidate sstate, even though it is not used.
+# Exclude it from signature generation.
+BB_HASHCONFIG_IGNORE_VARS:append:class-native = " QEMU_OPTIONS "
+
 def map_nodejs_arch(a, d):
     import re
 


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

* Re: [oe] [meta-oe][PATCH] nodejs: ignore QEMU_OPTIONS for native signature generation
       [not found] <184B26232F1A96E9.12316@lists.openembedded.org>
@ 2025-06-21 19:41 ` Gyorgy Sarvari
  2025-06-22 16:35 ` Gyorgy Sarvari
  1 sibling, 0 replies; 5+ messages in thread
From: Gyorgy Sarvari @ 2025-06-21 19:41 UTC (permalink / raw)
  To: openembedded-devel

This is of course an RFC too, just very small.

I noticed that every time I switch target machine, nodejs-native is
being rebuilt (starting with Scarthgap), which sometimes means
recompiling it 4 times, on all Yocto versions.

Looking at the recipe I believe that qemu is really only used when the
target and build CPU has different bitness, but I'm not that familiar
with the internals of nodejs build process - if someone more familiar
with it could share their opinion on this proposal, that would be helpful.


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

* Re: [oe] [meta-oe][PATCH] nodejs: ignore QEMU_OPTIONS for native signature generation
       [not found] <184B26232F1A96E9.12316@lists.openembedded.org>
  2025-06-21 19:41 ` Gyorgy Sarvari
@ 2025-06-22 16:35 ` Gyorgy Sarvari
  1 sibling, 0 replies; 5+ messages in thread
From: Gyorgy Sarvari @ 2025-06-22 16:35 UTC (permalink / raw)
  To: openembedded-devel

Please ignore this patch. It looks like it solves the problem only in
some specific cases, not in general.


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

* Re: [oe] [meta-oe][PATCH] nodejs: ignore QEMU_OPTIONS for native signature generation
  2025-06-21 19:40 [meta-oe][PATCH] nodejs: ignore QEMU_OPTIONS for native signature generation Gyorgy Sarvari
@ 2025-06-23  5:35 ` Alexander Kanavin
  2025-06-23  5:57   ` Gyorgy Sarvari
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Kanavin @ 2025-06-23  5:35 UTC (permalink / raw)
  To: skandigraun; +Cc: openembedded-devel

This looks like a better fix possible. Why is qemu a dependency for
native variant to begin with, if it's not used? Shouldn't that
dependency be eliminated?

Otherwise, this is prone to regressions if some other qemu-related
variable starts invalidating sstate.

Alex


On Sat, 21 Jun 2025 at 21:40, Gyorgy Sarvari via
lists.openembedded.org <skandigraun=gmail.com@lists.openembedded.org>
wrote:
>
> NodeJS recipe uses qemu to run some target binaries during compilation
> in qemu, in case the build machine's and the target machine's CPU
> bit-width are different. The task that generates some helper scripts
> (do_create_v8_qemu_wrapper) is executed before do_compile.
>
> In case the target machine changes, that also changes the value of
> QEMU_OPTIONS variable, since that is always derived from the target
> machine's properties, even when the current recipe is class-native.
>
> This also means that in case the target machine changes, that invalidates
> the do_create_v8_qemu_wrapper's sstate cache (along with the very costly
> do_compile), for both target and native builds.
>
> However for native builds qemu isn't used at all, since the target and build
> CPU are the same, their bit-width matches too.
>
> To avoid unnecessarily invalidating the sstate cache of nodejs-native
> when the target machine changes, add QEMU_OPTIONS to BB_HASHCONFIG_IGNORE_VARS
> in order to exclude it from the signature generation.
>
> Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
> ---
>  meta-oe/recipes-devtools/nodejs/nodejs_22.16.0.bb | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_22.16.0.bb b/meta-oe/recipes-devtools/nodejs/nodejs_22.16.0.bb
> index 4bc829f140..bf2bae27f1 100644
> --- a/meta-oe/recipes-devtools/nodejs/nodejs_22.16.0.bb
> +++ b/meta-oe/recipes-devtools/nodejs/nodejs_22.16.0.bb
> @@ -47,6 +47,10 @@ CVE_PRODUCT += "node.js"
>  # v8 errors out if you have set CCACHE
>  CCACHE = ""
>
> +# Changing qemu options can incorrectly invalidate sstate, even though it is not used.
> +# Exclude it from signature generation.
> +BB_HASHCONFIG_IGNORE_VARS:append:class-native = " QEMU_OPTIONS "
> +
>  def map_nodejs_arch(a, d):
>      import re
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#118011): https://lists.openembedded.org/g/openembedded-devel/message/118011
> Mute This Topic: https://lists.openembedded.org/mt/113762550/1686489
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


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

* Re: [oe] [meta-oe][PATCH] nodejs: ignore QEMU_OPTIONS for native signature generation
  2025-06-23  5:35 ` [oe] " Alexander Kanavin
@ 2025-06-23  5:57   ` Gyorgy Sarvari
  0 siblings, 0 replies; 5+ messages in thread
From: Gyorgy Sarvari @ 2025-06-23  5:57 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: openembedded-devel

On 6/23/25 07:35, Alexander Kanavin wrote:
> This looks like a better fix possible. Why is qemu a dependency for
> native variant to begin with, if it's not used? Shouldn't that
> dependency be eliminated?
>
> Otherwise, this is prone to regressions if some other qemu-related
> variable starts invalidating sstate.

Unfortunately you are right - that was the reason for withdrawing this
patch, I started to run into new variables. Since this patch was a
failure, currently I'm testing a patch with conditional qemu class
inheritance, which should only pull it in when needed. So far it hasn't
blown up - if it stays like this, will give this submission another go
later today.

> Alex
>


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

end of thread, other threads:[~2025-06-23  5:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-21 19:40 [meta-oe][PATCH] nodejs: ignore QEMU_OPTIONS for native signature generation Gyorgy Sarvari
2025-06-23  5:35 ` [oe] " Alexander Kanavin
2025-06-23  5:57   ` Gyorgy Sarvari
     [not found] <184B26232F1A96E9.12316@lists.openembedded.org>
2025-06-21 19:41 ` Gyorgy Sarvari
2025-06-22 16:35 ` Gyorgy Sarvari

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.