md: drivers/md/unroll.pl replaced with awk analog
Subsystems (2)
PATCH 1/1 md: drivers/md/unroll.pl replaced with awk analog
From: Vladimir Dronnikov <[email protected]>
drivers/md/unroll.pl replaced by awk script to drop build-time dependency on perl
---
drivers/md/Makefile | 22 ++++++++-------- drivers/md/raid6altivec.uc | 2 - drivers/md/raid6int.uc | 2 - drivers/md/raid6test/Makefile | 42 ++++++++++++++++---------------- drivers/md/unroll.awk | 20 +++++++++++++++ drivers/md/unroll.pl | 24 ------------------ 6 files changed, 54 insertions(+), 58 deletions(-)
drivers/md/Makefile +11 -11
@@ -46,7 +46,7 @@ obj-$(CONFIG_DM_ZERO) += dm-zero.o quiet_cmd_unroll = UNROLL $@ - cmd_unroll = $(PERL) $(srctree)/$(src)/unroll.pl $(UNROLL) \ + cmd_unroll = awk -f$(srctree)/$(src)/unroll.awk -vN=$(UNROLL) \ < $< > $@ || ( rm -f $@ && exit 1 ) ifeq ($(CONFIG_ALTIVEC),y)
@@ -59,56 +59,56 @@ targets += raid6int1.c $(obj)/raid6int1.c: UNROLL := 1 -$(obj)/raid6int1.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE +$(obj)/raid6int1.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE $(call if_changed,unroll) targets += raid6int2.c $(obj)/raid6int2.c: UNROLL := 2 -$(obj)/raid6int2.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE +$(obj)/raid6int2.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE $(call if_changed,unroll) targets += raid6int4.c $(obj)/raid6int4.c: UNROLL := 4 -$(obj)/raid6int4.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE +$(obj)/raid6int4.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE $(call if_changed,unroll) targets += raid6int8.c $(obj)/raid6int8.c: UNROLL := 8 -$(obj)/raid6int8.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE +$(obj)/raid6int8.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE $(call if_changed,unroll) targets += raid6int16.c $(obj)/raid6int16.c: UNROLL := 16 -$(obj)/raid6int16.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE +$(obj)/raid6int16.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE $(call if_changed,unroll) targets += raid6int32.c $(obj)/raid6int32.c: UNROLL := 32 -$(obj)/raid6int32.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE +$(obj)/raid6int32.c: $(src)/raid6int.uc $(src)/unroll.awk FORCE $(call if_changed,unroll) CFLAGS_raid6altivec1.o += $(altivec_flags) targets += raid6altivec1.c $(obj)/raid6altivec1.c: UNROLL := 1 -$(obj)/raid6altivec1.c: $(src)/raid6altivec.uc $(src)/unroll.pl FORCE +$(obj)/raid6altivec1.c: $(src)/raid6altivec.uc $(src)/unroll.awk FORCE $(call if_changed,unroll) CFLAGS_raid6altivec2.o += $(altivec_flags) targets += raid6altivec2.c $(obj)/raid6altivec2.c: UNROLL := 2 -$(obj)/raid6altivec2.c: $(src)/raid6altivec.uc $(src)/unroll.pl FORCE +$(obj)/raid6altivec2.c: $(src)/raid6altivec.uc $(src)/unroll.awk FORCE $(call if_changed,unroll) CFLAGS_raid6altivec4.o += $(altivec_flags) targets += raid6altivec4.c $(obj)/raid6altivec4.c: UNROLL := 4 -$(obj)/raid6altivec4.c: $(src)/raid6altivec.uc $(src)/unroll.pl FORCE +$(obj)/raid6altivec4.c: $(src)/raid6altivec.uc $(src)/unroll.awk FORCE $(call if_changed,unroll) CFLAGS_raid6altivec8.o += $(altivec_flags) targets += raid6altivec8.c $(obj)/raid6altivec8.c: UNROLL := 8 -$(obj)/raid6altivec8.c: $(src)/raid6altivec.uc $(src)/unroll.pl FORCE +$(obj)/raid6altivec8.c: $(src)/raid6altivec.uc $(src)/unroll.awk FORCE $(call if_changed,unroll) quiet_cmd_mktable = TABLE $@
drivers/md/raid6altivec.uc +1 -1
@@ -15,7 +15,7 @@ * * $#-way unrolled portable integer math RAID-6 instruction set * - * This file is postprocessed using unroll.pl + * This file is postprocessed using unroll.awk * * <benh> hpa: in process, * you can just "steal" the vec unit with enable_kernel_altivec() (but
drivers/md/raid6int.uc +1 -1
@@ -15,7 +15,7 @@ * * $#-way unrolled portable integer math RAID-6 instruction set * - * This file is postprocessed using unroll.pl + * This file is postprocessed using unroll.awk */ #include <linux/raid/pq.h>
drivers/md/raid6test/Makefile +21 -21
63 lines not on this page · raw message
drivers/md/unroll.awk new file +20 -0
@@ -0,0 +1,20 @@ + +# This filter requires one command line argument (n) which must be a +# decimal number. +# +# Repeat each input line containing $$ n times, replacing $$ with 0...n-1. +# Replace each $# with n, and each $* with a single $. + +BEGIN { + n = N + 0 +} +{ + if (/\$\$/) { rep = n } else { rep = 1 } + for (i = 0; i < rep; ++i) { + tmp = $0 + gsub(/\$\$/, i, tmp) + gsub(/\$\#/, n, tmp) + gsub(/\$\*/, "$", tmp) + print tmp + } +}
drivers/md/unroll.pl deleted +0 -24
@@ -1,24 +0,0 @@ -#!/usr/bin/perl -# -# Take a piece of C code and for each line which contains the sequence $$ -# repeat n times with $ replaced by 0...n-1; the sequence $# is replaced -# by the unrolling factor, and $* with a single $ -# - -($n) = @ARGV; -$n += 0; - -while ( defined($line = <STDIN>) ) { - if ( $line =~ /\$\$/ ) { - $rep = $n; - } else { - $rep = 1; - } - for ( $i = 0 ; $i < $rep ; $i++ ) { - $tmp = $line; - $tmp =~ s/\$\$/$i/g; - $tmp =~ s/\$\#/$n/g; - $tmp =~ s/\$\*/\$/g; - print $tmp; - } -}
Quoted 6 lines · On Monday 05 October 2009 11:01:39 Vladimir Dronnikov wrote:
From: Vladimir Dronnikov <[email protected]>
drivers/md/unroll.plreplaced by awk script to drop build-time dependency on perlSigned-off-by Vladimir Dronnikov <[email protected]>
We already discussed this on another mailing list, thread starts at:
http://lists.impactlinux.com/pipermail/firmware-impactlinux.com/2009-October/000328.html
I've added this as patch #4 in the perl removal series I've submitted during the last few merge windows.
Thanks,
Rob
Signature · 1 line
Latency is more important than throughput. It's that simple. - Linus Torvalds
Quoted 3 lines · On Monday October 5, [email protected] wrote:
From: Vladimir Dronnikov <[email protected]>
drivers/md/unroll.plreplaced by awk script to drop build-time dependency on perl
Thanks for the patch,
and thanks to Rob Landley for the pointer to where this was discussed elsewhere. The change makes sense to me.
Just a couple of little changes needed:
drivers/md/Makefile line 50
Quoted 5 lines
quiet_cmd_unroll= UNROLL $@drivers/md/Makefile +1
-1- cmd_unroll = $(PERL) $(srctree)/$(src)/unroll.pl $(UNROLL) \ + cmd_unroll = awk -f$(srctree)/$(src)/unroll.awk -vN=$(UNROLL) \ < $< > $@ || ( rm -f $@ && exit 1 )
The top level Makefile defines
AWK = awk
so I think $(AWK) should be used here, rather than a literal 'awk'.
Quoted 12 lines
drivers/md/raid6test/Makefile +1
-1@@ -7,7 +7,7 @@ OPTFLAGS = -O2 # Adjust as desired CFLAGS = -I.. -I ../../../include -g $(OPTFLAGS) LD = ld -PERL = perl +AWK = awk AR = ar RANLIB = ranlib
drivers/md/raid6test/Makefile line 39
Quoted 7 lines
drivers/md/raid6test/Makefile +2
-2@@ -35,35 +35,35 @@ raid6test: test.c raid6.a $(CC) $(CFLAGS) -o raid6test $^ -raid6altivec1.c: raid6altivec.uc ../unroll.pl - $(PERL) ../unroll.pl 1 < raid6altivec.uc > $@ +raid6altivec1.c: raid6altivec.uc ../unroll.awk + $(AWK) ../unroll.awk 1 < raid6altivec.uc > $@
In the md/Makefile, you pass the unroll count as
-vN=$NUMBER
in raid6test/Makefile you pass it as just
$NUMBER
one of these is wrong. Which one?
Well.....
drivers/md/unroll.awk line 3
Quoted 6 lines
drivers/md/unroll.awk new file +3
-0@@ -0,0 +1,20 @@ + +# This filter requires one command line argument (n) which must be a +# decimal number.
According to the comment, "$NUMBER" is correct. But
drivers/md/unroll.awk line 10
Quoted 7 lines
drivers/md/unroll.awk new file +7
-0+# +# Repeat each input line containing $$ n times, replacing $$ with 0...n-1. +# Replace each $# with n, and each $* with a single $. + +BEGIN { + n = N + 0 +}
according to the code "-vN=$NUMBER" is correct.
So you need to fix either the code or the comment, then fix one of the two Makefiles.
You might like to try running the test in raid6test as well, just to triple check that it all still works.
Thanks,
NeilBrown
Quoted 37 lines
drivers/md/unroll.awk new file +10
-0+{ + if (/\$\$/) { rep = n } else { rep = 1 } + for (i = 0; i < rep; ++i) { + tmp = $0 + gsub(/\$\$/, i, tmp) + gsub(/\$\#/, n, tmp) + gsub(/\$\*/, "$", tmp) + print tmp + } +}drivers/md/unroll.pl deleted +0
-24@@ -1,24 +0,0 @@ -#!/usr/bin/perl -# -# Take a piece of C code and for each line which contains the sequence $$ -# repeat n times with $ replaced by 0...n-1; the sequence $# is replaced -# by the unrolling factor, and $* with a single $ -# - -($n) = @ARGV; -$n += 0; - -while ( defined($line = <STDIN>) ) { - if ( $line =~ /\$\$/ ) { - $rep = $n; - } else { - $rep = 1; - } - for ( $i = 0 ; $i < $rep ; $i++ ) { - $tmp = $line; - $tmp =~ s/\$\$/$i/g; - $tmp =~ s/\$\#/$n/g; - $tmp =~ s/\$\*/\$/g; - print $tmp; - } -}
Quoted 12 lines · Rob Landley
Quoted 6 lines · On Monday 05 October 2009 11:01:39 Vladimir Dronnikov wrote:
From: Vladimir Dronnikov <[email protected]>
drivers/md/unroll.plreplaced by awk script to drop build-time dependency on perlSigned-off-by Vladimir Dronnikov <[email protected]>Acked-by Rob Landley <[email protected]>We already discussed this on another mailing list, thread starts at:
Quoted 8 lines
http://lists.impactlinux.com/pipermail/firmware-impactlinux.com/2009-October/000328.html
I've added this as patch #4 in the perl removal series I've submitted during the last few merge windows.
Thanks,
Rob
Why is perl being removed? [I know that I have missed a lot] berk-
Quoted 19 lines · On Monday 05 October 2009 18:57:14 berk walker wrote:
Quoted 18 lines · Rob Landley
Quoted 6 lines · On Monday 05 October 2009 11:01:39 Vladimir Dronnikov wrote:
From: Vladimir Dronnikov <[email protected]>
drivers/md/unroll.plreplaced by awk script to drop build-time dependency on perlSigned-off-by Vladimir Dronnikov <[email protected]>Acked-by Rob Landley <[email protected]>We already discussed this on another mailing list, thread starts at:
http://lists.impactlinux.com/pipermail/firmware-impactlinux.com/2009-Octo
ber/000328.htmlI've added this as patch #4 in the perl removal series I've submitted during the last few merge windows.
Quoted 6 lines
Quoted 3 lines
Thanks,
Rob
Why is perl being removed? [I know that I have missed a lot] berk-
Before 2.6.25 the kernel build had never used perl, and the first perl removal patches were submitted for 2.6.26, so the real question is "why was it added, and was it worth it?"
There was a long thread on an earlier submission of the patches, which Alan Cox concluded (as far as I'm concerned, unless Linus, Andrew Morton, or maybe Al Viro want to weigh in) with this post:
http://lkml.indiana.edu/hypermail/linux/kernel/0901.1/02108.html
Archives are linked from there, you might have to check adjacent weeks too.
Rob
Signature · 1 line
Latency is more important than throughput. It's that simple. - Linus Torvalds
Quoted 20 lines · Rob Landley
Quoted 19 lines · On Monday 05 October 2009 18:57:14 berk walker wrote:
Quoted 18 lines · Rob Landley
Quoted 6 lines · On Monday 05 October 2009 11:01:39 Vladimir Dronnikov wrote:
From: Vladimir Dronnikov <[email protected]>
drivers/md/unroll.plreplaced by awk script to drop build-time dependency on perlSigned-off-by Vladimir Dronnikov <[email protected]>Acked-by Rob Landley <[email protected]>We already discussed this on another mailing list, thread starts at:
http://lists.impactlinux.com/pipermail/firmware-impactlinux.com/2009-Octo
ber/000328.htmlI've added this as patch #4 in the perl removal series I've submitted during the last few merge windows.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Thanks,
Rob
Why is perl being removed? [I know that I have missed a lot] berk-
Before 2.6.25 the kernel build had never used perl,
Uhhhmmmm. md has used perl for creating some C files since RAID6 was added, which is before the dawn of git.
So I don't think this statement is true.
I'm have to remove the perl dependency though.
NeilBrown
Quoted 22 lines
and the first perl
removal
patches were submitted for 2.6.26, so the real question is "why was it added,
and was it worth it?"There was a long thread on an earlier submission of the patches, which Alan
Cox concluded (as far as I'm concerned, unless Linus, Andrew Morton, or maybe
Al Viro want to weigh in) with this post:http://lkml.indiana.edu/hypermail/linux/kernel/0901.1/02108.html
Archives are linked from there, you might have to check adjacent weeks too.
Rob
--
Latency is more important than throughput. It's that simple. - Linus Torvalds
Quoted 1 line
Just a couple of little changes needed:
Right. I've sent the updated patch. Please, take a look.
Best regards,
--
Vladimir
Quoted 28 lines · On Tuesday 06 October 2009 00:03:50 NeilBrown wrote:
Quoted 27 lines · Rob Landley
Quoted 25 lines · On Monday 05 October 2009 18:57:14 berk walker wrote:
Quoted 15 lines · Rob Landley
Quoted 6 lines · On Monday 05 October 2009 11:01:39 Vladimir Dronnikov wrote:
From: Vladimir Dronnikov <[email protected]>
drivers/md/unroll.plreplaced by awk script to drop build-time dependency on perlSigned-off-by Vladimir Dronnikov <[email protected]>Acked-by Rob Landley <[email protected]>We already discussed this on another mailing list, thread starts at:
http://lists.impactlinux.com/pipermail/firmware-impactlinux.com/2009-O
cto ber/000328.htmlQuoted 6 lines
I've added this as patch #4 in the perl removal series I've submitted during the last few merge windows.
Thanks,
Rob
Why is perl being removed? [I know that I have missed a lot] berk-
Quoted 6 lines
Quoted 1 line
Before 2.6.25 the kernel build had never used perl,
Uhhhmmmm. md has used perl for creating some C files since RAID6 was added, which is before the dawn of git.
So I don't think this statement is true.
I was wrong, my mistake. (The kernel builds I was doing had never needed perl, but I wasn't building raid for any target systems. The systems that had raid were generally big suckers using distro kernels. Vladimir _is_ building with raid support, so he addressed the issue.)
My current perl removal patch series started when timeconst.pl came in, meaning you couldn't build any kernel without perl anymore because _everything_ uses time constants. My current patch to remove that is something like the fifth version I've had to do to keep up with various changes to the kernel since then. Most recently reposted here:
http://lkml.indiana.edu/hypermail/linux/kernel/0909.2/01661.html
Before that, I noticed (and removed) perl from the User Mode Linux build in 2005:
http://lkml.indiana.edu/hypermail/linux/kernel/0503.1/0806.html
It's not _just_ perl, it's gratuitous build dependencies in general, which make a cross-compiler's life unpleasant. For example, there was a window during which you needed curses development headers to run "make oldconfig" (and that leaked into uClibc's copy of kconfig when they synced with upstream), but it was pretty easy to patch out and Sam Ravnborg had already fixed it upstream before I got around to pushing that.
I hit this sort of thing and have to fix it locally, life is easier for me if it's fixed upstream so I don't have to maintain out-of-tree patches...
Thanks,
Rob
Signature · 1 line
Latency is more important than throughput. It's that simple. - Linus Torvalds
Quoted 3 lines · On Tuesday October 6, [email protected] wrote:
Quoted 1 line
Just a couple of little changes needed:
Right. I've sent the updated patch. Please, take a look.
That's good, thanks.
I'll queue it up for 2.6.33.
NeilBrown
Quoted 4 lines
That's good, thanks.
I'll queue it up for 2.6.33.
Thanks!
Best regards,
--
Vladimir