[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] include/compat: produce stubs for headers not otherwise generated


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 12 Jan 2023 10:17:47 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rcCUI5uWmX3KBPnNjDCJtytod74+7velJJnLKEUL42Y=; b=DLfvGMCPDMAd8rRKJybtkvjpXNAHYZH5iztKw67/tktcHCLAy7swa8xV0B/Rrf22nznWZbtVZ+C2HCnCzBrSHozcCyEzAhdQzKu2igtKdG4dneuoBHLy4h0u3+/hMy34ruTU9kvlOlHOOTHXuky8VaanuUruaDgYcaUSZVqohuuuy57WvQuneTxh475/BenumxU8qtIS/JkCPWT6MqviJqUwKjam2XjRX60x3NKYz2YQIBse/SHgo8OWGuM4DaeyEyKE602BuQvmJBjR2eNzmtcAwXSX6OgDGcdpzdRIN3QRlUtuqnJkNf3FIBcVftJ3Ij61zja5QvG7URaBO29hZg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jy+oa6BwyNonTn+EQbtnnvjI+/E/m1RPpYTRYt6gFnixa5VQS/rs2yVL7hcMkWXT0lvkrEXZP+m9dUVlnhm2o7J5Z12fSjet91bdt2OI3309qBcIpzqPd3TXf03Z9tRA1nFCXfxOkaBNaJXDVgfwanx496eX6sCRZn+FovQb6bIM4s4VrFQqZ4HF+B7RhgcNVxE4C10CUw/TttAf8r+0Q8tYz0YLn9PK0kXGeiq0tOOijpMm6GnnlcEIuZ/G/nT3MvmM3cWQ5V3RnEEvRnICIjakbbGKhhq4xz0+qYml8oUaaffBD1zB7L5Xx1jK2V3yjC/nBkztfE+Jw7z5dSC5ZQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Thu, 12 Jan 2023 09:17:55 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Public headers can include other public headers. Such interdependencies
are retained in their compat counterparts. Since some compat headers are
generated only in certain configurations, the referenced headers still
need to exist. The lack thereof was observed with hvm/hvm_op.h needing
trace.h, where generation of the latter depends on TRACEBUFFER=y. Make
empty stubs in such cases (as generating the extra headers is relatively
slow and hence better to avoid). Changes to .config and incrementally
(re-)building is covered by the respective .*.cmd then no longer
matching the command to be used, resulting in the necessary re-creation
of the (possibly stub) header.

Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
There may be differing views on which commit this actually fixes, hence
I'd prefer to omit a Fixes: tag here. The issue was exposed by
4c5edd2449bc ("xen: Drop $ARCH/trace.h").

--- a/xen/include/Makefile
+++ b/xen/include/Makefile
@@ -34,6 +34,8 @@ headers-$(CONFIG_TRACEBUFFER) += compat/
 headers-$(CONFIG_XENOPROF) += compat/xenoprof.h
 headers-$(CONFIG_XSM_FLASK) += compat/xsm/flask_op.h
 
+headers-n := $(filter-out $(headers-y),$(headers-n) $(headers-))
+
 cppflags-y                := -include public/xen-compat.h 
-DXEN_GENERATING_COMPAT_HEADERS
 cppflags-$(CONFIG_X86)    += -m32
 
@@ -43,13 +45,16 @@ public-$(CONFIG_X86) := $(wildcard $(src
 public-$(CONFIG_ARM) := $(wildcard $(srcdir)/public/arch-arm/*.h 
$(srcdir)/public/arch-arm/*/*.h)
 
 .PHONY: all
-all: $(addprefix $(obj)/,$(headers-y))
+all: $(addprefix $(obj)/,$(headers-y) $(headers-n))
 
 quiet_cmd_compat_h = GEN     $@
 cmd_compat_h = \
     $(PYTHON) $(srctree)/tools/compat-build-header.py <$< $(patsubst 
$(obj)/%,%,$@) >>$@.new; \
     mv -f $@.new $@
 
+quiet_cmd_stub_h = GEN     $@
+cmd_stub_h = echo '/* empty */' >$@
+
 quiet_cmd_compat_i = CPP     $@
 cmd_compat_i = $(CPP) $(filter-out -Wa$(comma)% -include 
%/include/xen/config.h,$(XEN_CFLAGS)) $(cppflags-y) -o $@ $<
 
@@ -69,6 +74,13 @@ targets += $(headers-y)
 $(obj)/compat/%.h: $(obj)/compat/%.i $(srctree)/tools/compat-build-header.py 
FORCE
        $(call if_changed,compat_h)
 
+# Placeholders may be needed in case files in $(headers-y) include files we
+# don't otherwise generate.  Real dependencies would need spelling out 
explicitly,
+# for them to appear in $(headers-y) instead.
+targets += $(headers-n)
+$(addprefix $(obj)/,$(headers-n)): FORCE
+       $(call if_changed,stub_h)
+
 .PRECIOUS: $(obj)/compat/%.i
 targets += $(patsubst %.h, %.i, $(headers-y))
 $(obj)/compat/%.i: $(obj)/compat/%.c FORCE



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.