Skip to contentSkip to conversation

fix parallel builds for aic7xxx]

TRIVIAL Rusty Trivial Russell 6 participants 7 messages Sep 24, 2003 – Sep 26, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

[ Sorry, did you guys end up with consensus on this? Should I forward
or drop? Thanks, Rusty ]

From: John Cherry <[email protected]>

My compile regression scripts were getting random build failures for aic7xxx. The two makefiles could not handle parallel build. Occasionally they would succeed...timing dependent. The following two patches fix this.

Part 1 - drivers/scsi/aic7xxx/Makefile
Part 2 - drivers/scsi/aic7xxx/aicasm/Makefile

John

drivers/scsi/aic7xxx/Makefile renamed from drivers/scsi/aic7xxx/Makefile.orig +6 -2
@@ -58,7 +58,9 @@
 	-p $(obj)/aic7xxx_reg_print.c -i aic7xxx_osm.h
 
 ifeq ($(CONFIG_AIC7XXX_BUILD_FIRMWARE),y)
-$(aic7xxx-gen-y): $(src)/aic7xxx.seq $(src)/aic7xxx.reg $(obj)/aicasm/aicasm
+$(aic7xxx-gen-y): $(src)/aic7xxx.seq 
+
+$(src)/aic7xxx.seq: $(obj)/aicasm/aicasm $(src)/aic7xxx.reg
 	$(obj)/aicasm/aicasm -I$(src) -r $(obj)/aic7xxx_reg.h \
 			      $(aicasm-7xxx-opts-y) -o $(obj)/aic7xxx_seq.h \
 			      $(src)/aic7xxx.seq
@@ -72,7 +74,9 @@
 	-p $(obj)/aic79xx_reg_print.c -i aic79xx_osm.h
 
 ifeq ($(CONFIG_AIC79XX_BUILD_FIRMWARE),y)
-$(aic79xx-gen-y): $(src)/aic79xx.seq $(src)/aic79xx.reg $(obj)/aicasm/aicasm
+$(aic79xx-gen-y): $(src)/aic79xx.seq
+
+$(src)/aic79xx.seq: $(obj)/aicasm/aicasm $(src)/aic79xx.reg
 	$(obj)/aicasm/aicasm -I$(src) -r $(obj)/aic79xx_reg.h \
 			      $(aicasm-79xx-opts-y) -o $(obj)/aic79xx_seq.h \
 			      $(src)/aic79xx.seq
drivers/scsi/aic7xxx/aicasm/Makefile renamed from drivers/scsi/aic7xxx/aicasm/Makefile.orig +8 -4
@@ -49,14 +49,18 @@
 clean:
 	rm -f $(clean-files)
 
-aicasm_gram.c aicasm_gram.h: aicasm_gram.y
+aicasm_gram.c: aicasm_gram.h 
+	mv $(<:.h=).tab.c $(<:.h=.c)
+
+aicasm_gram.h: aicasm_gram.y
 	$(YACC) $(YFLAGS) -b $(<:.y=) $<
-	mv $(<:.y=).tab.c $(<:.y=.c)
 	mv $(<:.y=).tab.h $(<:.y=.h)
 
-aicasm_macro_gram.c aicasm_macro_gram.h: aicasm_macro_gram.y
+aicasm_macro_gram.c: aicasm_macro_gram.h
+	mv $(<:.h=).tab.c $(<:.h=.c)
+
+aicasm_macro_gram.h: aicasm_macro_gram.y
 	$(YACC) $(YFLAGS) -b $(<:.y=) -p mm $<
-	mv $(<:.y=).tab.c $(<:.y=.c)
 	mv $(<:.y=).tab.h $(<:.y=.h)
 
 aicasm_scan.c: aicasm_scan.l
Signature · 3 lines
  What is this? http://www.kernel.org/pub/linux/kernel/people/rusty/trivial/
  Don't blame me: the Monkey is driving
  File: John Cherry <[email protected]>: [TRIVIAL][PATCH] fix parallel builds for aic7xxx]
#1 lore raw
Quoted 2 lines · Rusty Trivial Russell

[ Sorry, did you guys end up with consensus on this? Should I forward
or drop? Thanks, Rusty ]

Please forward. Wait.. linux-scsi already is the right list :)

#2 lore raw
In reply to Rusty Trivial Russell
Quoted 2 lines · Rusty Trivial Russell

[ Sorry, did you guys end up with consensus on this? Should I forward
or drop? Thanks, Rusty ]

Justin, I think after some discussion you agreed this to be correct. I'll apply it unless I hear otherwise.

James

#3 lore raw
Quoted 5 lines · Rusty Trivial Russell
Quoted 2 lines

[ Sorry, did you guys end up with consensus on this? Should I forward
or drop? Thanks, Rusty ]

Justin, I think after some discussion you agreed this to be correct.

Actually, no. Here's the latest information on this issue that I sent to both Sam and John:

Date: Wed, 17 Sep 2003 16:09:58 -0600
From: "Justin T. Gibbs" <[email protected]>
Reply-To: "Justin T. Gibbs" <[email protected]>
To: John Cherry <[email protected]>, Sam Ravnborg <[email protected]>
Subject: Re: [TRIVIAL][PATCH] fix parallel builds for aic7xxx]
Message-ID: <[email protected]>
In-Reply-To: <[email protected]>

Quoted 5 lines

Justin,

I assume you are the scsi guy (I can take a clue). Is Sam's patch for the aic7xxx Makefiles more acceptable to you? How do we move this forward?

There are still problems with both patches.

Option 1 looks like this:

$(aic7xxx-gen-y): $(src)/aic7xxx.seq

$(src)/aic7xxx.seq: $(obj)/aicasm/aicasm $(src)/aic7xxx.reg
run assembler...

The .seq file is not a generated file, so unless you touch it, this rule will always be invoked so long as the .seq file is older than the .reg file. This also means that if the .seq file is newer than the reg file and aicasm, the assembler will not run.

Option 2 looks like this:

$(aic7xxx-gen-y): $(src)/aic7xxx.seq $(src)/aic7xxx.reg $(aic7xxx-gen-y): doaic7xasm

.PHONY: doaic7xasm
$(aic7xxx-gen-y): doaic7xasm

doaic7xasm: $(obj)/aicasm/aicasm
run assembler ...

In this case, the assembler will aways be run since a phony target that is a prerequisite to a real target will always be executed (the make manual explicitly warns about this). Running the assembler guarantees a recompile of the entire driver. Even if this were not the case, the generated files would not be rebuilt if only the assembler changed. This strategy also seems to confuse make into attempting to pull the generated files out of RCS/SCCS if, for example, you have a BK tree.

What we really want is an order only pre-requisite, but not all Linux installations have a make new enough to support this. (This is the pipe prerequisite syntax). Baring that, I plan to just chain the generated files as a dependency which still causes the assembler to be run multiple times if any generated file is out of date, but at least the assembler will not be run concurrently. This also avoids having the files rebuilt on each build.

It would be really nice if gnu make would grow a .ORDER target like bmake so that you can selectively disable parallelism on certain targets.

--
Justin

==== //depot/linux-aic79xx-2.4.0/drivers/scsi/aic7xxx/Makefile#15 - /home/gibbs/bk/linux-2.4/drivers/scsi/aic7xxx/Makefile ====

home/gibbs/bk/linux-2.4/drivers/scsi/aic7xxx/Makefile renamed from tmp/tmp.12649.0 +10 -0
@@ -64,8 +64,13 @@
 	$(LD) $(LD_RFLAG) -r -o $@ $(obj-aic79xx)
 
 ifeq ($(CONFIG_AIC7XXX_BUILD_FIRMWARE),y)
+# Create a dependency chain in generated files
+# to avoid concurrent invocations of the single
+# rule that builds them all.
+aic7xxx_seq.h: aic7xxx_reg.h
 aic7xxx_gen = aic7xxx_seq.h aic7xxx_reg.h
 ifeq ($(CONFIG_AIC7XXX_REG_PRETTY_PRINT),y)
+aic7xxx_reg.h: aic7xxx_reg_print.c
 aic7xxx_gen += aic7xxx_reg_print.c
 aic7xxx_asm_cmd = aicasm/aicasm -I. -r aic7xxx_reg.h		\
 		 -p aic7xxx_reg_print.c -i aic7xxx_osm.h	\
@@ -79,8 +84,13 @@
 endif
 
 ifeq ($(CONFIG_AIC79XX_BUILD_FIRMWARE),y)
+# Create a dependency chain in generated files
+# to avoid concurrent invocations of the single
+# rule that builds them all.
+aic79xx_seq.h: aic79xx_reg.h
 aic79xx_gen = aic79xx_seq.h aic79xx_reg.h
 ifeq ($(CONFIG_AIC79XX_REG_PRETTY_PRINT),y)
+aic79xx_reg.h: aic79xx_reg_print.c
 aic79xx_gen += aic79xx_reg_print.c
 aic79xx_asm_cmd = aicasm/aicasm -I. -r aic79xx_reg.h		\
 		 -p aic79xx_reg_print.c -i aic79xx_osm.h	\

==== //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aicasm/Makefile#14 - /home/gibbs/bk/linux-2.4/drivers/scsi/aic7xxx/aicasm/Makefile
====

home/gibbs/bk/linux-2.4/drivers/scsi/aic7xxx/aicasm/Makefile renamed from tmp/tmp.12649.7 +8 -0
@@ -49,11 +49,19 @@
 clean:
 	rm -f $(clean-files)
 
+# Create a dependency chain in generated files
+# to avoid concurrent invocations of the single
+# rule that builds them all.
+aicasm_gram.c: aicasm_gram.h
 aicasm_gram.c aicasm_gram.h: aicasm_gram.y
 	$(YACC) $(YFLAGS) -b $(<:.y=) $<
 	mv $(<:.y=).tab.c $(<:.y=.c)
 	mv $(<:.y=).tab.h $(<:.y=.h)
 
+# Create a dependency chain in generated files
+# to avoid concurrent invocations of the single
+# rule that builds them all.
+aicasm_macro_gram.c: aicasm_macro_gram.h
 aicasm_macro_gram.c aicasm_macro_gram.h: aicasm_macro_gram.y
 	$(YACC) $(YFLAGS) -b $(<:.y=) -p mm $<
 	mv $(<:.y=).tab.c $(<:.y=.c)
#4 lore raw

While any of the 3 patches (John's, Sam's, and Justin's) should work, Justin has a case (below) for his patch.

I have verified John's and Sam's patch, but I have not been able to cleanly apply Justin's patch to 2.4 or 2.6 yet. So please do not forward this patch until we can verify it.

John

Quoted 135 lines · Justin T. Gibbs
Quoted 5 lines · Rusty Trivial Russell
Quoted 2 lines

[ Sorry, did you guys end up with consensus on this? Should I forward
or drop? Thanks, Rusty ]

Justin, I think after some discussion you agreed this to be correct.

Actually, no. Here's the latest information on this issue that I sent to both Sam and John:

Date: Wed, 17 Sep 2003 16:09:58 -0600
From: "Justin T. Gibbs" <[email protected]>
Reply-To: "Justin T. Gibbs" <[email protected]>
To: John Cherry <[email protected]>, Sam Ravnborg <[email protected]>
Subject: Re: [TRIVIAL][PATCH] fix parallel builds for aic7xxx]
Message-ID: <[email protected]>
In-Reply-To: <[email protected]>

Quoted 5 lines

Justin,

I assume you are the scsi guy (I can take a clue). Is Sam's patch for the aic7xxx Makefiles more acceptable to you? How do we move this forward?

There are still problems with both patches.

Option 1 looks like this:

$(aic7xxx-gen-y): $(src)/aic7xxx.seq

$(src)/aic7xxx.seq: $(obj)/aicasm/aicasm $(src)/aic7xxx.reg
run assembler...

The .seq file is not a generated file, so unless you touch it, this rule will always be invoked so long as the .seq file is older than the .reg file. This also means that if the .seq file is newer than the reg file and aicasm, the assembler will not run.

Option 2 looks like this:

$(aic7xxx-gen-y): $(src)/aic7xxx.seq $(src)/aic7xxx.reg $(aic7xxx-gen-y): doaic7xasm

.PHONY: doaic7xasm
$(aic7xxx-gen-y): doaic7xasm

doaic7xasm: $(obj)/aicasm/aicasm
run assembler ...

In this case, the assembler will aways be run since a phony target that is a prerequisite to a real target will always be executed (the make manual explicitly warns about this). Running the assembler guarantees a recompile of the entire driver. Even if this were not the case, the generated files would not be rebuilt if only the assembler changed. This strategy also seems to confuse make into attempting to pull the generated files out of RCS/SCCS if, for example, you have a BK tree.

What we really want is an order only pre-requisite, but not all Linux installations have a make new enough to support this. (This is the pipe prerequisite syntax). Baring that, I plan to just chain the generated files as a dependency which still causes the assembler to be run multiple times if any generated file is out of date, but at least the assembler will not be run concurrently. This also avoids having the files rebuilt on each build.

It would be really nice if gnu make would grow a .ORDER target like bmake so that you can selectively disable parallelism on certain targets.

--
Justin

==== //depot/linux-aic79xx-2.4.0/drivers/scsi/aic7xxx/Makefile#15 - /home/gibbs/bk/linux-2.4/drivers/scsi/aic7xxx/Makefile ====

home/gibbs/bk/linux-2.4/drivers/scsi/aic7xxx/Makefile renamed from tmp/tmp.12649.0 +10 -0
@@ -64,8 +64,13 @@
 	$(LD) $(LD_RFLAG) -r -o $@ $(obj-aic79xx)
 
 ifeq ($(CONFIG_AIC7XXX_BUILD_FIRMWARE),y)
+# Create a dependency chain in generated files
+# to avoid concurrent invocations of the single
+# rule that builds them all.
+aic7xxx_seq.h: aic7xxx_reg.h
 aic7xxx_gen = aic7xxx_seq.h aic7xxx_reg.h
 ifeq ($(CONFIG_AIC7XXX_REG_PRETTY_PRINT),y)
+aic7xxx_reg.h: aic7xxx_reg_print.c
 aic7xxx_gen += aic7xxx_reg_print.c
 aic7xxx_asm_cmd = aicasm/aicasm -I. -r aic7xxx_reg.h		\
 		 -p aic7xxx_reg_print.c -i aic7xxx_osm.h	\
@@ -79,8 +84,13 @@
 endif
 
 ifeq ($(CONFIG_AIC79XX_BUILD_FIRMWARE),y)
+# Create a dependency chain in generated files
+# to avoid concurrent invocations of the single
+# rule that builds them all.
+aic79xx_seq.h: aic79xx_reg.h
 aic79xx_gen = aic79xx_seq.h aic79xx_reg.h
 ifeq ($(CONFIG_AIC79XX_REG_PRETTY_PRINT),y)
+aic79xx_reg.h: aic79xx_reg_print.c
 aic79xx_gen += aic79xx_reg_print.c
 aic79xx_asm_cmd = aicasm/aicasm -I. -r aic79xx_reg.h		\
 		 -p aic79xx_reg_print.c -i aic79xx_osm.h	\

==== //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aicasm/Makefile#14 - /home/gibbs/bk/linux-2.4/drivers/scsi/aic7xxx/aicasm/Makefile
====

home/gibbs/bk/linux-2.4/drivers/scsi/aic7xxx/aicasm/Makefile renamed from tmp/tmp.12649.7 +8 -1
@@ -49,11 +49,19 @@
 clean:
 	rm -f $(clean-files)
 
+# Create a dependency chain in generated files
+# to avoid concurrent invocations of the single
+# rule that builds them all.
+aicasm_gram.c: aicasm_gram.h
 aicasm_gram.c aicasm_gram.h: aicasm_gram.y
 	$(YACC) $(YFLAGS) -b $(<:.y=) $<
 	mv $(<:.y=).tab.c $(<:.y=.c)
 	mv $(<:.y=).tab.h $(<:.y=.h)
 
+# Create a dependency chain in generated files
+# to avoid concurrent invocations of the single
+# rule that builds them all.
+aicasm_macro_gram.c: aicasm_macro_gram.h
 aicasm_macro_gram.c aicasm_macro_gram.h: aicasm_macro_gram.y
 	$(YACC) $(YFLAGS) -b $(<:.y=) -p mm $<
 	mv $(<:.y=).tab.c $(<:.y=.c)
 
-

To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

In message <[email protected]> you write:

Quoted 6 lines

While any of the 3 patches (John's, Sam's, and Justin's) should work, Justin has a case (below) for his patch.

I have verified John's and Sam's patch, but I have not been able to cleanly apply Justin's patch to 2.4 or 2.6 yet. So please do not forward this patch until we can verify it.

OK, I'm closing it out of the Trivial Patch Monkey, since well, it's not trivial 8)

Cheers,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

#6 lore raw

Yes. Close it out. Justin Gibbs is closing the loop on this one.

Quoted 15 lines · Rusty Russell

In message <[email protected]> you write:

Quoted 6 lines

While any of the 3 patches (John's, Sam's, and Justin's) should work, Justin has a case (below) for his patch.

I have verified John's and Sam's patch, but I have not been able to cleanly apply Justin's patch to 2.4 or 2.6 yet. So please do not forward this patch until we can verify it.

OK, I'm closing it out of the Trivial Patch Monkey, since well, it's not trivial 8)

Cheers,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.