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

Re: [XEN][PATCH v2] coverage: extend coverage on .init and lib code


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
  • Date: Mon, 8 Dec 2025 20:54:06 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=WSICRRDqnpMRDRNL1T+UmHwGkBlgOBZJSJ0Sca27Tmg=; b=EXhtNdp9oD2soFCfIdL5mwUCBKbEg36+KCURU0vTXx6LsNE3SEhixx+Hf/NtTcxsbXThUyW642FPdmvvZbdz1otQ5/LLz1XhmEvESnkUMj2IFrZxTqVuAgyfaNTYlOe6hByRn6j+Dz75ZX8oRPheM71gfFZXRYBdyBwEDEgbQLazNd5XFWV3oAy7a5SawEEx6kpQ5Yz7amXzjqgCyImRIKfJhxAQ/bxXzPOJp0NaZTTkqRoudST17U2FofTMD2R2Bu77ekEdzc1/dezwXePKHYkU3R5cFsRsjksxuVDkQgocmUI8nOC0oZqqrZbHsnUgMEKgNSn6QsLatDWYwUwj4g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pgx0YVnvi5mBfxs4/zgYafjNUZmg/vdNrGrll/8X3eUspNgTuOilzKtn4XFD+rS9S6VOLNghmaZzLBhUZkhWJF/ldtQZZKjuHCYEA43BPfTgGlW1o+PVCgPwGejGP5FXjAEJfXc6sb6xk8WLl8kV4LvmMOU/1eAio53bQaSbk/0Rc5rBZgyrSCuz/14pRGHIIHPbNs4chTkzKC2DbI1W12K2i0jmCvTGXLDXffYg893NTjjljlyfOl8fqpPKH3NjHyQM8IqHcfVfCTHgy3J+lqP5+l+e/JZGaFUC+KebT9i4GWjU+J6lp0oKHn8+udHIerUnbaSTQqWhHQLJPH4NyA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Jason Andryuk <jason.andryuk@xxxxxxx>, Victor Lira <victorm.lira@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 08 Dec 2025 18:54:21 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>



On 08.12.25 10:35, Jan Beulich wrote:
On 05.12.2025 20:34, Grygorii Strashko wrote:
--- a/xen/Kconfig.debug
+++ b/xen/Kconfig.debug
@@ -39,11 +39,23 @@ config COVERAGE
        bool "Code coverage support"
        depends on SYSCTL && !LIVEPATCH
        select SUPPRESS_DUPLICATE_SYMBOL_WARNINGS if !ENFORCE_UNIQUE_SYMBOLS
+       select RELAX_INIT_CHECK
+       select DO_NOT_FREE_INIT_MEMORY
        help
          Enable code coverage support.
If unsure, say N here. +config RELAX_INIT_CHECK
+    bool
+    help
+      Relax strict check for .init sections only in %.init.o files.
+
+config DO_NOT_FREE_INIT_MEMORY
+    bool
+    help
+      Prevent freeing of .init sections at the end of Xen boot.
+
  config CONDITION_COVERAGE
        bool "Condition coverage support"
        depends on COVERAGE && CC_HAS_MCDC

Please obey to the somewhat special indentation rules for Kconfig files.

ok.


@@ -259,6 +259,7 @@ $(obj)/%.o: $(src)/%.S FORCE
quiet_cmd_obj_init_o = INIT_O $@
+ifneq ($(CONFIG_RELAX_INIT_CHECK),y)
  define cmd_obj_init_o
      $(OBJDUMP) -h $< | while read idx name sz rest; do \
          case "$$name" in \
@@ -271,6 +272,11 @@ define cmd_obj_init_o
      done || exit $$?; \
      $(OBJCOPY) $(foreach s,$(SPECIAL_DATA_SECTIONS),--rename-section 
.$(s)=.init.$(s)) $< $@
  endef
+else
+define cmd_obj_init_o
+    $(OBJCOPY) $(foreach s,$(SPECIAL_DATA_SECTIONS),--rename-section 
.$(s)=.init.$(s)) $< $@
+endef
+endif

If the objcopy indeed needs suppressing altogether (as Andrew suggests), the
unwanted redundancy here would go away anyway. Otherwise my (recurring)
request to avoid such duplication.

Could you suggest the best way to avoid duplication, please?
if/else/endif is not working inside "Custom commands" make file commands.
May be split it on two - cmd_obj_init_check and obj_init_objcopy?

--- a/xen/common/libfdt/Makefile
+++ b/xen/common/libfdt/Makefile
@@ -5,7 +5,6 @@ SECTIONS := text data $(SPECIAL_DATA_SECTIONS)
  # For CONFIG_OVERLAY_DTB, libfdt functionalities will be needed during 
runtime.
  ifneq ($(CONFIG_OVERLAY_DTB),y)
  OBJCOPYFLAGS := $(foreach s,$(SECTIONS),--rename-section .$(s)=.init.$(s))
-nocov-y += libfdt.o
  endif
obj-y += libfdt.o

Is this sufficient? Don't you first need to replace the custom objcopy use?

It works just fine if .init memory is not freed, as it doesn't matter where 
sections are placed.


--
Best regards,
-grygorii




 


Rackspace

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