Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: unixmania@gmail.com
To: buildroot@buildroot.org
Cc: Carlos Santos <unixmania@gmail.com>,
	Romain Naour <romain.naour@gmail.com>
Subject: [Buildroot] [PATCH] package/qemu: add option to enable tracing (default no)
Date: Wed, 12 Jul 2023 19:01:19 -0300	[thread overview]
Message-ID: <20230712220119.1531498-1-unixmania@gmail.com> (raw)

From: Carlos Santos <unixmania@gmail.com>

Tracing is a development feature for debugging, profiling, and observing
QEMU execution. It does not make sense to enable it by default, so add a
config to enable the "log" tracing backend (the default one). Options to
select other backends may be added in the future.

Also pull a patch already reviewed upstream to install the trace events
file only if necessary:

    https://patchwork.kernel.org/project/qemu-devel/patch/20230408010410.281263-1-casantos@redhat.com/

Signed-off-by: Carlos Santos <unixmania@gmail.com>
---
 ...-trace-events-file-only-if-necessary.patch | 29 +++++++++++++++++++
 package/qemu/Config.in                        |  9 ++++++
 package/qemu/qemu.mk                          |  6 ++++
 3 files changed, 44 insertions(+)
 create mode 100644 package/qemu/0004-tracing-install-trace-events-file-only-if-necessary.patch

diff --git a/package/qemu/0004-tracing-install-trace-events-file-only-if-necessary.patch b/package/qemu/0004-tracing-install-trace-events-file-only-if-necessary.patch
new file mode 100644
index 0000000000..0db9a6b647
--- /dev/null
+++ b/package/qemu/0004-tracing-install-trace-events-file-only-if-necessary.patch
@@ -0,0 +1,29 @@
+From 5c43da1e4983cc3c209b325a5228b6149e0a0ccf Mon Sep 17 00:00:00 2001
+From: Carlos Santos <casantos@redhat.com>
+Date: Fri, 24 Mar 2023 21:40:22 -0300
+Subject: [PATCH] tracing: install trace events file only if necessary
+
+It is not useful when configuring with --enable-trace-backends=nop.
+
+Signed-off-by: Carlos Santos <casantos@redhat.com>
+Signed-off-by: Carlos Santos <unixmania@gmail.com>
+---
+ trace/meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/trace/meson.build b/trace/meson.build
+index 8e80be895c..30b1d942eb 100644
+--- a/trace/meson.build
++++ b/trace/meson.build
+@@ -64,7 +64,7 @@ trace_events_all = custom_target('trace-events-all',
+                                  input: trace_events_files,
+                                  command: [ 'cat', '@INPUT@' ],
+                                  capture: true,
+-                                 install: true,
++                                 install: get_option('trace_backends') != [ 'nop' ],
+                                  install_dir: qemu_datadir)
+ 
+ if 'ust' in get_option('trace_backends')
+-- 
+2.31.1
+
diff --git a/package/qemu/Config.in b/package/qemu/Config.in
index 6fb34a0dae..8d53ced300 100644
--- a/package/qemu/Config.in
+++ b/package/qemu/Config.in
@@ -106,6 +106,15 @@ config BR2_PACKAGE_QEMU_FDT
 	  Say 'y' here to have QEMU capable of constructing Device
 	  Trees, and passing them to the VMs.
 
+config BR2_PACKAGE_QEMU_TRACING
+	bool "Enable tracing"
+	help
+	  Say 'y' to enable the "log" tracing infrastructure in QEMU,
+	  used for debugging, profiling, and observing execution. For
+	  detailed documentation, see
+
+	  https://www.qemu.org/docs/master/devel/tracing.html
+
 endif # BR2_PACKAGE_QEMU_SYSTEM
 
 comment "systems emulation needs a toolchain w/ dynamic library"
diff --git a/package/qemu/qemu.mk b/package/qemu/qemu.mk
index c530896fa8..a020dd5226 100644
--- a/package/qemu/qemu.mk
+++ b/package/qemu/qemu.mk
@@ -159,6 +159,12 @@ else
 QEMU_OPTS += --disable-fdt
 endif
 
+ifeq ($(BR2_PACKAGE_QEMU_TRACING),y)
+QEMU_OPTS += --enable-trace-backends=log
+else
+QEMU_OPTS += --enable-trace-backends=nop
+endif
+
 ifeq ($(BR2_PACKAGE_QEMU_TOOLS),y)
 QEMU_OPTS += --enable-tools
 else
-- 
2.39.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

             reply	other threads:[~2023-07-12 22:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-12 22:01 unixmania [this message]
2023-09-02 16:01 ` [Buildroot] [PATCH] package/qemu: add option to enable tracing (default no) Thomas Petazzoni via buildroot

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=20230712220119.1531498-1-unixmania@gmail.com \
    --to=unixmania@gmail.com \
    --cc=buildroot@buildroot.org \
    --cc=romain.naour@gmail.com \
    /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