Re: [RFC kvm-unit-tests PATCH] build: fix .aux.o target building

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

 



On Thu Jun 6, 2024 at 1:07 AM AEST, Marc Hartmayer wrote:
> On Wed, Jun 05, 2024 at 08:53 PM +1000, "Nicholas Piggin" <npiggin@xxxxxxxxx> wrote:
> > On Wed Jun 5, 2024 at 8:42 PM AEST, Marc Hartmayer wrote:
> >> On Wed, Jun 05, 2024 at 06:16 PM +1000, Nicholas Piggin <npiggin@xxxxxxxxx> wrote:
> >> > Here's another oddity I ran into with the build system. Try run make
> >> > twice. With arm64 and ppc64, the first time it removes some intermediate
> >> > files and the second causes another rebuild of several files. After
> >> > that it's fine. s390x seems to follow a similar pattern but does not
> >> > suffer from the problem. Also, the .PRECIOUS directive is not preventing
> >> > them from being deleted inthe first place. So... that probably means I
> >> > haven't understood it properly and the fix may not be correct, but it
> >> > does appear to DTRT... Anybody with some good Makefile knowledge might
> >> > have a better idea.
> >> >
> >>
> >> $ make clean -j &>/dev/null && make -d
> >> …
> >> Successfully remade target file 'all'.
> >> Removing intermediate files...
> >> rm powerpc/emulator.aux.o powerpc/tm.aux.o powerpc/spapr_hcall.aux.o powerpc/interrupts.aux.o powerpc/selftest.aux.o powerpc/smp.aux.o powerpc/selftest-migration.aux.o powerpc/spapr_vpa.aux.o powerpc/sprs.aux.o powerpc/rtas.aux.o powerpc/memory-verify.aux.o
> >>
> >> So an easier fix would be to add %.aux.o to .PRECIOUS (but that’s probably still not clean).
> >>
> >> .PRECIOUS: %.o %.aux.o
> >
> > Ah, so %.o does not match %.aux.o. That answers that. Did you see
> > why s390x is immune? Maybe it defines the target explicitly somewhere.
>
> Not yet :/

Strange. Both unpatched powerpc and s390x have these lines.

   Looking for a rule with intermediate file 'powerpc/emulator.aux.o'.

I think that's why it's considered intermediate at least for powerpc,
but I can't see why s390x is different... oh, taking out the .SECONDARY
lines makes s390x delete the aux intermediates. I guess those targets
transitively depend on the aux files which prevents the aux from being
deleted.

Is that fragile? I'm not sure. The patch that introduced them was not
solving this problem (that came before your %.aux.o target patch).
s390x does not need any .PRECIOUS targets at all at the moment.

I guess that mostly explains things.


> But what was also interesting is that if I’m using multiple
> jobs I don’t see the issue.
>
> make clean -j; make -j; make -j # <- the last make has nothing to do
>
> if I’m using:
>
> make clean -j; make; make -j # <- the last make has something to do…
>                                   that something that irritates me

This is with s390x? Maybe with parallel make, the target is getting
rebuilt via a different prerequisite that is not a .SECONDARY target?
Adding %.aux.o in PRECIOUS there should help in that case.

> >
> > Is it better to define explicit targets if we want to keep them, or
> > add to .PRECIOUS? Your patch would be simpler.
>
> Normally, I would say without .PRECIOUS it’s cleaner, but there is
> already a .PRECIOUS for %.so… So as Andrew has already written
>
> .PRECIOUS: %.so %.aux.o
>
> should also be fine.

Okay, for a minimal fix I will do that.

Thanks,
Nick





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux