Skip to contentSkip to conversation

Tracing patches

GIT PULL Applied Stefan Hajnoczi 4 participants 7 messages Mar 16, 2017 – Mar 21, 2017 Kbuild

lore
Share & tools
lore
#0 lore raw

The following changes since commit 1883ff34b540daacae948f493b0ba525edf5f642:

Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2017-03-15 18:44:05 +0000)

are available in the git repository at:

git://github.com/stefanha/qemu.git tags/tracing-pull-request

for you to fetch changes up to 8755b4afbdcf1c274cab7545a9f76d3d6c7f5c29:

  trace: ensure $(tracetool-y) is defined in top level makefile (2017-03-16 11:51:26 +0800)

----------------------------------------------------------------
Pull request

Tracing makefile fixes for QEMU 2.9.

----------------------------------------------------------------

Daniel P. Berrange (3):
makefile: merge GENERATED_HEADERS & GENERATED_SOURCES variables
makefile: generate trace-events-all upfront
trace: ensure $(tracetool-y) is defined in top level makefile

 Makefile                   | 42 ++++++++++++++++++++++--------------------
 Makefile.target            |  6 +++---
 target/s390x/Makefile.objs |  2 +-
 tests/Makefile.include     |  2 +-
 trace/Makefile.objs        |  8 --------
 5 files changed, 27 insertions(+), 33 deletions(-)
Signature · 1 line
2.9.3
#1 lore raw

[Qemu-devel] [PULL 1/3] makefile: merge GENERATED_HEADERS & GENERATED_SOURCES variables

From: "Daniel P. Berrange" <[email protected]>

The only functional difference between the GENERATED_HEADERS and GENERATED_SOURCES variables is that 'Makefile' has a dependancy on GENERATED_HEADERS, causing generated header files to be created immediatey at the start of the build process. There is no reason why this early creation should be restricted to the .h files, and not include .c files too. Merge both of the variables into a single GENERATED_FILES variable to make it clear it is for any type of generated file.

Message-id: [email protected]

---
 Makefile                   | 35 +++++++++++++++++------------------
 Makefile.target            |  6 +++---
 target/s390x/Makefile.objs |  2 +-
 tests/Makefile.include     |  2 +-
 4 files changed, 22 insertions(+), 23 deletions(-)
Makefile +17 -18
index 1c4c04f..a8024c0 100644
@@ -50,24 +50,24 @@ endif
 
 include $(SRC_PATH)/rules.mak
 
-GENERATED_HEADERS = qemu-version.h config-host.h qemu-options.def
-GENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h qapi-event.h
-GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c qapi-event.c
-GENERATED_HEADERS += qmp-introspect.h
-GENERATED_SOURCES += qmp-introspect.c
+GENERATED_FILES = qemu-version.h config-host.h qemu-options.def
+GENERATED_FILES += qmp-commands.h qapi-types.h qapi-visit.h qapi-event.h
+GENERATED_FILES += qmp-marshal.c qapi-types.c qapi-visit.c qapi-event.c
+GENERATED_FILES += qmp-introspect.h
+GENERATED_FILES += qmp-introspect.c
 
-GENERATED_HEADERS += trace/generated-tcg-tracers.h
+GENERATED_FILES += trace/generated-tcg-tracers.h
 
-GENERATED_HEADERS += trace/generated-helpers-wrappers.h
-GENERATED_HEADERS += trace/generated-helpers.h
-GENERATED_SOURCES += trace/generated-helpers.c
+GENERATED_FILES += trace/generated-helpers-wrappers.h
+GENERATED_FILES += trace/generated-helpers.h
+GENERATED_FILES += trace/generated-helpers.c
 
 ifdef CONFIG_TRACE_UST
-GENERATED_HEADERS += trace-ust-all.h
-GENERATED_SOURCES += trace-ust-all.c
+GENERATED_FILES += trace-ust-all.h
+GENERATED_FILES += trace-ust-all.c
 endif
 
-GENERATED_HEADERS += module_block.h
+GENERATED_FILES += module_block.h
 
 TRACE_HEADERS = trace-root.h $(trace-events-subdirs:%=%/trace.h)
 TRACE_SOURCES = trace-root.c $(trace-events-subdirs:%=%/trace.c)
@@ -80,8 +80,8 @@ ifdef CONFIG_TRACE_UST
 TRACE_HEADERS += trace-ust-root.h $(trace-events-subdirs:%=%/trace-ust.h)
 endif
 
-GENERATED_HEADERS += $(TRACE_HEADERS)
-GENERATED_SOURCES += $(TRACE_SOURCES)
+GENERATED_FILES += $(TRACE_HEADERS)
+GENERATED_FILES += $(TRACE_SOURCES)
 
 trace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g')
 
@@ -485,11 +485,10 @@ clean:
 	rm -f fsdev/*.pod
 	rm -f qemu-img-cmds.h
 	rm -f ui/shader/*-vert.h ui/shader/*-frag.h
-	@# May not be present in GENERATED_HEADERS
+	@# May not be present in GENERATED_FILES
 	rm -f trace/generated-tracers-dtrace.dtrace*
 	rm -f trace/generated-tracers-dtrace.h*
-	rm -f $(foreach f,$(GENERATED_HEADERS),$(f) $(f)-timestamp)
-	rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp)
+	rm -f $(foreach f,$(GENERATED_FILES),$(f) $(f)-timestamp)
 	rm -rf qapi-generated
 	rm -rf qga/qapi-generated
 	for d in $(ALL_SUBDIRS); do \
@@ -784,7 +783,7 @@ endif # CONFIG_WIN
 # Add a dependency on the generated files, so that they are always
 # rebuilt before other object files
 ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
-Makefile: $(GENERATED_HEADERS)
+Makefile: $(GENERATED_FILES)
 endif
 
 .SECONDARY: $(TRACE_HEADERS) $(TRACE_HEADERS:%=%-timestamp) \
Makefile.target +3 -3
index 924304c..7df2b8c 100644
@@ -162,7 +162,7 @@ else
 obj-y += hw/$(TARGET_BASE_ARCH)/
 endif
 
-GENERATED_HEADERS += hmp-commands.h hmp-commands-info.h
+GENERATED_FILES += hmp-commands.h hmp-commands-info.h
 
 endif # CONFIG_SOFTMMU
 
@@ -238,5 +238,5 @@ ifdef CONFIG_TRACE_SYSTEMTAP
 	$(INSTALL_DATA) $(QEMU_PROG)-simpletrace.stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-simpletrace.stp"
 endif
 
-GENERATED_HEADERS += config-target.h
-Makefile: $(GENERATED_HEADERS)
+GENERATED_FILES += config-target.h
+Makefile: $(GENERATED_FILES)
target/s390x/Makefile.objs +1 -1
index c573633..46f6a8c 100644
@@ -8,7 +8,7 @@ obj-$(CONFIG_KVM) += kvm.o
 feat-src = $(SRC_PATH)/target/$(TARGET_BASE_ARCH)/
 feat-dst = $(BUILD_DIR)/$(TARGET_DIR)
 ifneq ($(MAKECMDGOALS),clean)
-GENERATED_HEADERS += $(feat-dst)gen-features.h
+GENERATED_FILES += $(feat-dst)gen-features.h
 endif
 
 $(feat-dst)gen-features.h: $(feat-dst)gen-features.h-timestamp
tests/Makefile.include +1 -1
index 346345e..479dcd9 100644
@@ -482,7 +482,7 @@ qapi-schema += unknown-expr-key.json
 
 check-qapi-schema-y := $(addprefix tests/qapi-schema/, $(qapi-schema))
 
-GENERATED_HEADERS += tests/test-qapi-types.h tests/test-qapi-visit.h \
+GENERATED_FILES += tests/test-qapi-types.h tests/test-qapi-visit.h \
 	tests/test-qmp-commands.h tests/test-qapi-event.h \
 	tests/test-qmp-introspect.h
 
Signature · 1 line
2.9.3
#4 lore raw

[Qemu-devel] [PULL 2/3] makefile: generate trace-events-all upfront

In reply to Stefan Hajnoczi

From: "Daniel P. Berrange" <[email protected]>

Files should not be created in the build dir during the 'make install' phase. List 'trace-events-all' as a generated file so that it gets created upfront during build.

Message-id: [email protected]

---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
index a8024c0..6291764 100644
@@ -82,6 +82,7 @@ endif
 
 GENERATED_FILES += $(TRACE_HEADERS)
 GENERATED_FILES += $(TRACE_SOURCES)
+GENERATED_FILES += $(BUILD_DIR)/trace-events-all
 
 trace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g')
 
@@ -592,8 +593,7 @@ endif
 endif
 
 
-install: all $(if $(BUILD_DOCS),install-doc) $(BUILD_DIR)/trace-events-all \
-install-datadir install-localstatedir
+install: all $(if $(BUILD_DOCS),install-doc) install-datadir install-localstatedir
 ifneq ($(TOOLS),)
 	$(call install-prog,$(subst qemu-ga,qemu-ga$(EXESUF),$(TOOLS)),$(DESTDIR)$(bindir))
 endif
Signature · 1 line
2.9.3
#5 lore raw

[Qemu-devel] [PULL 3/3] trace: ensure $(tracetool-y) is defined in top level makefile

In reply to Stefan Hajnoczi

From: "Daniel P. Berrange" <[email protected]>

The build rules for trace files have a dependancy on $(tracetool-y). This variable populated in the trace/Makefile.objs file and thus its definition gets pulled into the top level makefile. This happens too late in the process though, so by the time $(tracetool-y) is defined, make has already evaluated $(tracetool-y) in the dependancies and found it to be empty. The result is that when the tracetool source is changed, the generated files are not rebuilt. The solution is to define the variable in the top level makefile too

Message-id: [email protected]

---
 Makefile            | 3 +++
 trace/Makefile.objs | 8 --------
 2 files changed, 3 insertions(+), 8 deletions(-)
Makefile +3 -0
index 6291764..108b984 100644
@@ -86,6 +86,9 @@ GENERATED_FILES += $(BUILD_DIR)/trace-events-all
 
 trace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g')
 
+tracetool-y = $(SRC_PATH)/scripts/tracetool.py
+tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
+
 %/trace.h: %/trace.h-timestamp
 	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
 %/trace.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y)
trace/Makefile.objs +0 -8
index 7de840a..1b8eb4a 100644
@@ -1,13 +1,5 @@
 # -*- mode: makefile -*-
 
-######################################################################
-# tracetool source files
-# Every rule that invokes tracetool must depend on this so code is regenerated
-# if tracetool itself changes.
-
-tracetool-y = $(SRC_PATH)/scripts/tracetool.py
-tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
-
 $(BUILD_DIR)/trace-events-all: $(trace-events-files)
 	$(call quiet-command,cat $^ > $@)
 
Signature · 1 line
2.9.3
#2 lore raw

Re: [Qemu-devel] [PULL 1/3] makefile: merge GENERATED_HEADERS & GENERATED_SOURCES variables

In reply to Stefan Hajnoczi

Sorry for chiming in late, I had missed this change.

Quoted 8 lines · Stefan Hajnoczi

From: "Daniel P. Berrange" <[email protected]>

The only functional difference between the GENERATED_HEADERS and GENERATED_SOURCES variables is that 'Makefile' has a dependancy on GENERATED_HEADERS, causing generated header files to be created immediatey at the start of the build process. There is no reason why this early creation should be restricted to the .h files, and not include .c files too.

Actually, there is.

Any prerequisites of Makefile are made even by make -n. Restricting them to the ones make -n absolutely needs is good practice.

Generated headers must be prerequisites of Makefile, because automatic dependency generation may fail without them.

There is no such reason for generated non-headers.

Quoted 3 lines

Merge both of
the variables into a single GENERATED_FILES variable to make it clear it is for any type of generated file.

I don't hate this quite enough for an outright NAK at this late stage. I do hate it enough to ask you to think about it once more.

#6 lore raw
In reply to Stefan Hajnoczi
Quoted 24 lines · Stefan Hajnoczi

The following changes since commit 1883ff34b540daacae948f493b0ba525edf5f642:

Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2017-03-15 18:44:05 +0000)

are available in the git repository at:

git://github.com/stefanha/qemu.git tags/tracing-pull-request

for you to fetch changes up to 8755b4afbdcf1c274cab7545a9f76d3d6c7f5c29:

  trace: ensure $(tracetool-y) is defined in top level makefile (2017-03-16 11:51:26 +0800)

----------------------------------------------------------------
Pull request

Tracing makefile fixes for QEMU 2.9.

----------------------------------------------------------------

Daniel P. Berrange (3):
makefile: merge GENERATED_HEADERS & GENERATED_SOURCES variables
makefile: generate trace-events-all upfront
trace: ensure $(tracetool-y) is defined in top level makefile

Quoted 6 lines
 Makefile                   | 42 ++++++++++++++++++++++--------------------
 Makefile.target            |  6 +++---
 target/s390x/Makefile.objs |  2 +-
 tests/Makefile.include     |  2 +-
 trace/Makefile.objs        |  8 --------
 5 files changed, 27 insertions(+), 33 deletions(-)

Applied, thanks.

-- PMM

#3 lore raw

Re: [Qemu-devel] [PULL 1/3] makefile: merge GENERATED_HEADERS & GENERATED_SOURCES variables

In reply to Markus Armbruster
Quoted 13 lines · Markus Armbruster

Sorry for chiming in late, I had missed this change.

Quoted 8 lines · Stefan Hajnoczi

From: "Daniel P. Berrange" <[email protected]>

The only functional difference between the GENERATED_HEADERS and GENERATED_SOURCES variables is that 'Makefile' has a dependancy on GENERATED_HEADERS, causing generated header files to be created immediatey at the start of the build process. There is no reason why this early creation should be restricted to the .h files, and not include .c files too.

Quoted 4 lines

Actually, there is.

Any prerequisites of Makefile are made even by make -n. Restricting them to the ones make -n absolutely needs is good practice.

In fact, this is part of what tripped me up in trying to get to a root cause in why modifying scripts/tracetool/format/h.py didn't cause trace.h to be regenerated. When trace.h is treated as a prerequisite of Makefile, it's rules get run automatically and don't show up in 'make --debug' output (you have to resort to the noisier 'make -d' to see that the rule was run).

Quoted 14 lines

Generated headers must be prerequisites of Makefile, because automatic dependency generation may fail without them.

There is no such reason for generated non-headers.

Quoted 3 lines

Merge both of
the variables into a single GENERATED_FILES variable to make it clear it is for any type of generated file.

I don't hate this quite enough for an outright NAK at this late stage. I do hate it enough to ask you to think about it once more.

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org