Skip to contentSkip to conversation

meson: Only generate trace files for selected targets

RFC PATCH In review Philippe Mathieu-Daudé 4 participants 8 messages Feb 24, 2021 – Mar 9, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

RFC PATCH v2 1/1 meson: Only generate trace files for selected targets

We don't need to generate trace files for targets we are not building. Restrict the the ones selected.

---
 meson.build | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
meson.build +8 -8
index 05a67c20d93..8503aa1b628 100644
@@ -1826,16 +1826,16 @@
   trace_events_subdirs += [
     'accel/tcg',
     'hw/core',
-    'target/arm',
-    'target/hppa',
-    'target/i386',
     'target/i386/kvm',
-    'target/mips',
-    'target/ppc',
-    'target/riscv',
-    'target/s390x',
-    'target/sparc',
   ]
+  foreach target : target_dirs
+    arch = config_target_mak[target]['TARGET_BASE_ARCH']
+    target_trace_events_subdir = 'target' / arch
+    if fs.exists(meson.current_source_dir() / target_trace_events_subdir / 'trace-events') and \
+        target_trace_events_subdir not in trace_events_subdirs
+      trace_events_subdirs += [target_trace_events_subdir]
+    endif
+  endforeach
 endif
 
 vhost_user = not_found
Signature · 1 line
2.26.2
#1 lore raw
Quoted 13 lines · Philippe Mathieu-Daudé

We don't need to generate trace files for targets we are not building. Restrict the the ones selected.

---
 meson.build | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
meson.build +0 -0
index 05a67c20d93..8503aa1b628 100644

meson.build line 1829

Quoted 7 lines
meson.build +0 -3
@@ -1826,16 +1826,16 @@
   trace_events_subdirs += [
     'accel/tcg',
     'hw/core',
-    'target/arm',
-    'target/hppa',
-    'target/i386',
     'target/i386/kvm',

Please add a comment explaining why an exception is needed here and the rest of the target directories are handled by the loop below when you send a non-RFC patch.

That will help people who add sub-directories in the future.

Thanks,
Stefan

#2 lore raw
Quoted 9 lines · Stefan Hajnoczi
Quoted 8 lines · Philippe Mathieu-Daudé

We don't need to generate trace files for targets we are not building. Restrict the the ones selected.

---
 meson.build | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
Quoted 16 lines

meson.build line 1829

Quoted 12 lines
meson.build +0 -3
index 05a67c20d93..8503aa1b628 100644
@@ -1826,16 +1826,16 @@
   trace_events_subdirs += [
     'accel/tcg',
     'hw/core',
-    'target/arm',
-    'target/hppa',
-    'target/i386',
     'target/i386/kvm',

Please add a comment explaining why an exception is needed here and the rest of the target directories are handled by the loop below when you send a non-RFC patch.

Better would be a recursive function that adds the directory if necessary. But I'm happy adding a simple comment =)

Quoted 2 lines

That will help people who add sub-directories in the future.

Yes. Anyhow I expect this to clash with Claudio's work in progress (which split target/ and add multiple subdirectories).

#3 lore raw
Quoted 27 lines · Philippe Mathieu-Daudé
Quoted 9 lines · Stefan Hajnoczi
Quoted 8 lines · Philippe Mathieu-Daudé

We don't need to generate trace files for targets we are not building. Restrict the the ones selected.

---
 meson.build | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
Quoted 16 lines

meson.build line 1829

Quoted 12 lines
meson.build +0 -3
index 05a67c20d93..8503aa1b628 100644
@@ -1826,16 +1826,16 @@
   trace_events_subdirs += [
     'accel/tcg',
     'hw/core',
-    'target/arm',
-    'target/hppa',
-    'target/i386',
     'target/i386/kvm',

Please add a comment explaining why an exception is needed here and the rest of the target directories are handled by the loop below when you send a non-RFC patch.

Quoted 10 lines

Better would be a recursive function that adds the directory if necessary. But I'm happy adding a simple comment =)

Quoted 2 lines

That will help people who add sub-directories in the future.

Yes. Anyhow I expect this to clash with Claudio's work in progress (which split target/ and add multiple subdirectories).

np, just the tracedirs should be easy to solve;

I personally don't see updating a simple list as difficult for the dev; does generating trace files for all require a lot of time?

In any case, I agree that just recursing all directories in target/ looking for trace.h / traceevents files could be better.

But how much time do we spare, compared with just generating all?

Ciao,

Claudio

#4 lore raw
Quoted 39 lines · Claudio Fontana
Quoted 27 lines · Philippe Mathieu-Daudé
Quoted 9 lines · Stefan Hajnoczi
Quoted 8 lines · Philippe Mathieu-Daudé

We don't need to generate trace files for targets we are not building. Restrict the the ones selected.

---
 meson.build | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
Quoted 16 lines

meson.build line 1829

Quoted 12 lines
meson.build +0 -3
index 05a67c20d93..8503aa1b628 100644
@@ -1826,16 +1826,16 @@
   trace_events_subdirs += [
     'accel/tcg',
     'hw/core',
-    'target/arm',
-    'target/hppa',
-    'target/i386',
     'target/i386/kvm',

Please add a comment explaining why an exception is needed here and the rest of the target directories are handled by the loop below when you send a non-RFC patch.

Quoted 10 lines

Better would be a recursive function that adds the directory if necessary. But I'm happy adding a simple comment =)

Quoted 2 lines

That will help people who add sub-directories in the future.

Yes. Anyhow I expect this to clash with Claudio's work in progress (which split target/ and add multiple subdirectories).

Quoted 7 lines

np, just the tracedirs should be easy to solve;

I personally don't see updating a simple list as difficult for the dev; does generating trace files for all require a lot of time?

In any case, I agree that just recursing all directories in target/ looking for trace.h / traceevents files could be better.

But how much time do we spare, compared with just generating all?

Well now on slow 32-bit hosts my impression is we spend more time in meson / generating trace boilerplate files (even if the python code is trivial, it is invoked many times) rather than compiling C.

trace doesn't use Kconfig to filter, so everything is processed. Maybe the root problem is 'hw/core' actually, not the 'target/' directories...

This is more noticeable for the user-only builds, which are the ones likely to be supported longer on 32-bit hosts (there are some discussions about keeping maintaining sysemu there).

That said this is user experience feeling and I didn't care to benchmark it.

Anyhow this doesn't seem to have big impact (yet) so let's postpone this series.

Thanks,

Phil.

#5 lore raw
In reply to Claudio Fontana
Quoted 2 lines · Claudio Fontana

In any case, I agree that just recursing all directories in target/ looking for trace.h / traceevents files could be better.

Using the directory structure to find source files is a bad idea because you don't notice that you haven't "git add"ed a file until it's too late (typically the maintainer notices it for you...).

We do it for default-configs/targets, but that's an exception and I'd rather not extend it more.

In fact, Philippe, perhaps you can add the extra tracedirs for hw/ and target/ to the default-config/targets/*.mak file?

Thanks,

Paolo

#6 lore raw
Quoted 11 lines · Paolo Bonzini
Quoted 2 lines · Claudio Fontana

In any case, I agree that just recursing all directories in target/ looking for trace.h / traceevents files could be better.

Using the directory structure to find source files is a bad idea because you don't notice that you haven't "git add"ed a file until it's too late (typically the maintainer notices it for you...).

We do it for default-configs/targets, but that's an exception and I'd rather not extend it more.

Quoted 7 lines

In fact, Philippe, perhaps you can add the extra tracedirs for hw/ and target/ to the default-config/targets/*.mak file?

Thanks,

Paolo

There was also the discussion of improving check-patch to detect missing updates to trace files, but my attempt to make a reliable patch at the time failed..

Ciao,

Claudio

#7 lore raw
In reply to Paolo Bonzini
Quoted 8 lines · Paolo Bonzini
Quoted 2 lines · Claudio Fontana

In any case, I agree that just recursing all directories in target/ looking for trace.h / traceevents files could be better.

Using the directory structure to find source files is a bad idea because you don't notice that you haven't "git add"ed a file until it's too late (typically the maintainer notices it for you...).

Quoted 5 lines

We do it for default-configs/targets, but that's an exception and I'd rather not extend it more.

In fact, Philippe, perhaps you can add the extra tracedirs for hw/ and target/ to the default-config/targets/*.mak file?

Hmm interesting idea... I'll have a look, thanks!