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

Re: [XEN PATCH] tools: Have flex and bison mandatory


  • To: Elliott Mitchell <ehem+xen@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 9 Feb 2023 09:23:43 +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=2MSLTr5bJCc0vZPXbtdi9LRKuhnsxihgxdpYrsAZF5s=; b=R1zdywdUPgnkqE56gNH+VVk8VSe/lRRQHHT9JKEbkGJ6hqYpf6bSpyN3ksUCYGXhjE+EvHXoXNcH5MbcM+Xca4P/7JHTTBjU4GjHE3hjmjn5piUq3O9URudf3EgAHiD7UGLYKh/JAodkpBhfTsQR/nstroT6YGCHWPE3ZGL4/nPxMmxRBP5dBoS2mRsy1QZN/UDNgMHNmlI5PXhlDIXoVCkAHE37kYefjWuw67fl0GogmVsRVv8FDpGgLJNSnRJfYLGEtqV7t6MdQ//V9DFUpB6/ZKZ6IlGjoSXMQm7wQxSP2ss0pSBWd6GOvimSgZ44pciBRkbGnobDWNzkAwX10w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SgiMCKGz8LMNIXI0+nAQBUVH488RTAPjgc7T9KVqoGipERBegv20iWr1YuMhZyIv9FKM+d6yrk8WorxWYQREW81tb/RPy1hmPLsUt9A8P/RuEGJkSyF81ZlQHUSv2w9J1UpwQkX5GvieK4P6S/IVf1GE7PSGOXQnLz7+R5tcfFsyVB/W8c7HTH8lZM47swJYx9mNw3bfTzOPmfg338oUSZjbmtggePWxe5cq/ZJ8eiiDVbIQc1kC4lC49Z7hhA05d0djISboJOkO7qxeNjwo5vNfjV2/8DAL7R7Rqi8JrmdJ54zL7Zq2WoQYId59aWRXGpViT7wpdJS9F6R/GUyPsw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Anthony PERARD <anthony.perard@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 09 Feb 2023 08:24:25 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 08.02.2023 19:51, Elliott Mitchell wrote:
> On Wed, Feb 08, 2023 at 09:02:35AM +0100, Jan Beulich wrote:
>> On 07.02.2023 19:02, Anthony PERARD wrote:
>>>
>>> I think the issue that Andrew saw in the CI with "libxlu_cfg_y.o"
>>> failing to build while "libxlu_cfg_l.[ch]" are been regenerated is
>>> probably because make doesn't consider "libxlu_cfg_l.[ch]" as a group of
>>> targets.
>>>
>>> If for some reason we have:
>>>     libxlu_cfg_l.h newer than libxlu_cfg_l.l newer than libxlu_cfg_l.c
>>>
>>> Then make seems to take two parallel decision:
>>>     When building libxlu_cfg_y.o:
>>>         libxlu_cfg_l.h is newer than libxlu_cfg_l.l
>>>         -> libxlu_cfg_l.h is up-to-date, start building libxlu_cfg_y.o
>>>     When building libxlu_cfg_l.o:
>>>         libxlu_cfg_l.c is older than libxlu_cfg_l.l
>>>         -> we need to generate libxlu_cfg_l.c first
>>> Then, libxlu_cfg_y.o fails to build because libxlu_cfg_l.h is been
>>> updated do to the parallel build of libxlu_cfg_l.o.
>>>
>>> I can easily reproduce the issue with:
>>>     touch libxlu_cfg_l.c; sleep .1; touch libxlu_cfg_l.l; sleep .1;
>>>     touch libxlu_cfg_l.h; sleep .1; make -j
>>> And having "sleep 1" in "%.c %.h: %.l" recipe, between `rm` and `flex`.
>>
>> Interesting. In my somewhat similar experiments I found that an issue
>> exists only when one of the .c files is missing. Things looked to work
>> properly when both were there, but one was outdated. Clearly that's
>> yet more surprising behavior than, as you appear to observe, the issue
>> simply being tied too "needs updating".
> 
> The actual problem is flex and bison output both files at the same time.
> One process sees all of its prerequisites are up to do and therefore
> proceeds to the next step.  A second process sees an out of date
> prerequisite, and starts to run flex which wipes out the prerequisite of
> the first process.
> 
> 
> Crucially libxlu_cfg_y.o does NOT depend on libxlu_cfg_l.c, therefore GNU
> Make is allowed to proceed with building libxlu_cfg_y.o even if
> libxlu_cfg_l.c is out of date.
> 
> The problem is the rule to update libxlu_cfg_l.c ALSO updates
> libxlu_cfg_l.h as a side-effect.
> 
> 
> As such libxlu_cfg_y.o needs an order-only dependency (assuming GNU Make
> syntax is allowed) on libxlu_cfg_l.c, so the two rules DON'T run in
> parallel and cause havoc.

Since you keep referring to this: Yes, GNU make syntax is allowed. We
use pattern rules, which themselves are an extension of the original
suffix rules. The issue is that we can't (unconditionally) use stuff
which was added only in newer versions of GNU make. (See ./README
both for a statement on us requiring GNU make as well as one on the
minimum version we expect to be in use.)

According to my reading, an order-only prereq isn't what would help
us here: "Occasionally you may want to ensure that a prerequisite is
built before a target, but without forcing the target to be updated
if the prerequisite is updated." This isn't the situation we're
dealing with, I would say. We want the prereq updating to occur and
the building of the dependent target to be deferred until all the
prereqs were updated.

>>> I don't know how to properly fix this yet.
>>> Event writing "%.c %.h &: %.l" doesn't work, with make 4.3, which is
>>> supposed to be grouped targets. But that's is maybe fixed in 4.4.
>>
>> Well, in my tests while 4.4 has fixed one issue with intermediate files
>> affecting the behavior here, the issue we're possibly running into is
>> still there. I've sent an inquiry to bug-make@xxxxxxx.
> 
> I do not believe this is a bug in GNU Make.  Merely double-output rules
> cause precisely this sort of trouble in Make when run in parallel.

I suppose it can be viewed both ways: Make has all information to know
that the file _is_ going to be touched, so it _could_ order operations
accordingly.

Jan



 


Rackspace

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