From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWP0i-0000ST-CM for qemu-devel@nongnu.org; Wed, 16 Oct 2013 07:11:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VWP0e-00068n-An for qemu-devel@nongnu.org; Wed, 16 Oct 2013 07:11:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12012) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWP0e-00068e-2P for qemu-devel@nongnu.org; Wed, 16 Oct 2013 07:11:24 -0400 From: Markus Armbruster References: <33183CC9F5247A488A2544077AF190208159E77D@SZXEMA503-MBS.china.huawei.com> <525E7E7A02000078000FB627@nat28.tlf.novell.com> <1381917877.21901.62.camel@kazak.uk.xensource.com> <871u3lmqwt.fsf@blackfin.pond.sub.org> <1381921102.21901.73.camel@kazak.uk.xensource.com> Date: Wed, 16 Oct 2013 13:10:55 +0200 In-Reply-To: <1381921102.21901.73.camel@kazak.uk.xensource.com> (Ian Campbell's message of "Wed, 16 Oct 2013 11:58:22 +0100") Message-ID: <87txghii80.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [Xen-devel] Hvmloader: Modify ACPI to only supply _EJ0 methods for PCIslots that support hotplug by runtime patching List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ian Campbell Cc: "Gonglei (Arei)" , Stefano Stabellini , Yanqiangjun , Luonengjun , "qemu-devel@nongnu.org" , "xen-devel@lists.xen.org" , Fabio Fantoni , Jan Beulich , "anthony.perard@citrix.com" , "Hanweidong (Randy)" , "Gaowei (UVP)" , "Huangweidong (Hardware)" Ian Campbell writes: > On Wed, 2013-10-16 at 12:49 +0200, Markus Armbruster wrote: >> Ian Campbell writes: >> >> > On Wed, 2013-10-16 at 10:54 +0100, Jan Beulich wrote: >> >> >>> On 16.10.13 at 08:30, "Gonglei (Arei)" wrote: >> >> > --- hvmloader/acpi/Makefile 2013-10-16 11:51:53.000000000 +0800 >> >> > +++ hvmloader_new//acpi/Makefile 2013-10-16 11:51:58.000000000 +0800 >> >> > @@ -36,18 +36,34 @@ >> >> > >> >> > dsdt_anycpu_qemu_xen.asl: dsdt.asl mk_dsdt >> >> > awk 'NR > 1 {print s} {s=$$0}' $< > $@ >> >> > - ./mk_dsdt --dm-version qemu-xen >> $@ >> >> > + sed -i 's/AmlCode/dsdt_anycpu_qemu_xen/g' $@ >> >> >> >> This must never be done - if someone hits Ctrl-C in the middle of >> >> this, you'll have a modified but incomplete generated file. You >> >> either need to use properly chained rules, or do all output to a >> >> temporary file which you rename as the last step. >> >> >> >> I realize that the problem existed before your change, but you >> >> making it worse requires doing it properly now. >> > >> > The correct way to do this is to generate to a temporary file and then >> > use $(call move-if-changed,$@.tmp,$@). There are a bunch of examples in >> > tools/libxl/Makefile and elsewhere. >> >> Quoting the GNU make manual[*]: >> >> So generally the right thing to do is to delete the target file if >> the recipe fails after beginning to change the file. make will do >> this if .DELETE_ON_ERROR appears as a target. This is almost always >> what you want make to do, but it is not historical practice; so for >> compatibility, you must explicitly request it. >> >> In my opinion, every Makefile should request it. >> >> [*] https://www.gnu.org/software/make/manual/html_node/Errors.html > > I think this is somewhat orthogonal to the use of move-if-changed which > is there to ensure that the timestamp doesn't change gratuitously and > cause a load of knock on rebuilds even though the regenerated content is > identical. Yes. I was latching onto the "if someone hits Ctrl-C in the middle of this, you'll have a modified but incomplete generated file" phrase.