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

Re: [PATCH] coverage: filter out lib{fdt,elf}-temp.o


  • To: Anthony PERARD <anthony.perard@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Fri, 19 Jan 2024 09:43:30 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=citrix.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=Rngjgy9wFR31B6/tllA2FHw6Ko9u/eMHQO3ycEUY5Go=; b=m3UUdV6q6N3TOgymPgDqE4obqk3Wc8sTMQwPrSDshyVRwqHSGCMLlhhGZBPB8CamdlvX9S8WsGgOShHm4jm1Tf5Ki0Urdwai7HvsYLAfyfGwitdkrAA3nMbazx96sqRf0CVzA0G7QRC14g+F9NIOtMp0//Kjxxeam7i/oqcr5okOauEuOkH69LjmvU9mTbpYsvkcnIxuL3zPK9G9IlAlcAwPskQaN2JSL/SN20NR2+5Tlill4OTXHXYKeFXYq7inrauW82q6QcfEEMwNnsxnVVX3kltKBHumRuU8reS0hjIR77jAeusDo1zjW31pV83y+0kJjaQVTKvezilHI4bwdA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b2d6ycoKxapZGzWoYcThF7KPn8eH/KHhbvJibVJzngMSPvP1FkHrFMPQ6eY9jPIk5FXD/dgUiJYnOTYM0x/vjlwfa/QsFYcUGdLsrP+nCmF9uKAAJagQcHuDMLG+53PSKSw6/PsHGvV+qG+HA5HHj75XTuqoW5F4PSGi6Rjc4AK8wAjY07tyZ1KtRwTkZTO6qpELTHOfmFTFRZ/icfhgkDJIMj8xnPKa0pjRVH+y3FD/X8xiZkRShRRq6Jh4/NnjNJDw3Td2kVHC3YVKxm/WElPTk8n8buSvCW8MtBftEB9f5CNSruyMuR2CsFmhLj4e8S55lLPfAZpyBGI768QtmQ==
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Javi Merino <javi.merino@xxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 19 Jan 2024 08:43:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Anthony,

On 18/01/2024 18:37, Anthony PERARD wrote:
> 
> 
> On Thu, Jan 18, 2024 at 02:12:21PM +0100, Jan Beulich wrote:
>> On 18.01.2024 13:06, Michal Orzel wrote:
>>> At the moment, trying to run xencov read/reset (calling SYSCTL_coverage_op
>>> under the hood) results in a crash. This is due to an attempt to
>>> access code in the .init.* sections (libfdt for Arm and libelf for x86)
>>> that are stripped after boot. Normally, the build system compiles any
>>> *.init.o file without COV_FLAGS. However, these two libraries are
>>> handled differently as sections will be renamed to init after linking.
>>>
>>> This worked until e321576f4047 ("xen/build: start using if_changed")
>>> that added lib{fdt,elf}-temp.o to extra-y. Any file listed there without
>>> *.init.o suffix will be part of non-init-objects for which COV_FLAGS
>>> will be appended.
>>
>> While this is true, aiui COV_FLAGS would be empty for anything listed
>> in nocov-y and all of the prerequisites of those objects (iirc target-
>> specific variable settings propagate to prerequisites). Therefore ...
>>
>>> In such case, the solution is to add a file to nocov-y.
>>
>> ... libelf.o / libfdt.o already being listed there ought to suffice.
>> Alternatively listing only libelf-temp.o / libfdt-temp.o ought to
>> suffice as well.
>>
>> Since you apparently observed things not working, I must be missing
>> something.
> 
> Yes, $(extra-y) is like $(obj-y), but objects there will not be added
> "built_in.o". So, make is likely building "libelf-temp.o" and deps
> because it's in $(extra-y) rather than because it's a prerequisite of
> "libelf.o". We could ask make to process prerequisite in a reverse
> order, and suddenly, the command line to make all "libelf-*.o" is
> different: `make --shuffle=reverse V=2`.
That's helpful.

> 
> So, adding extra object to $(nocov-y) is a workaround, but I think a
> better fix would be to add those objects to $(targets) instead of
> $(extra-y). I think I've made a mistake by using $(extra-y) instead of
> $(targets) in that original commit.
I can confirm that by moving lib{fdt,elf}-temp.o and deps to targets, the issue 
is gone as well.

Is my understanding correct that by switching from extra-y to targets we are 
preventing these objects to
appear in non-init-objects (and thus having COV_FLAGS appended) while retaining 
the proper if_changed behavior?

According to docs/misc/xen-makefiles/makefiles.rst:
Any target that utilises if_changed must be listed in $(targets),
otherwise the command line check will fail, and the target will
always be built.

~Michal



 


Rackspace

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