From: Vladimir Dronnikov <[email protected]>
drivers/md/unroll.pl replaced by awk script to drop build-time dependency on perl
Signed-off-by: Vladimir Dronnikov <[email protected]>
---
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(-)
--- linux-2.6.31.orig/drivers/md/Makefile Wed Sep 9 22:13:59 2009
+++ linux-2.6.31/drivers/md/Makefile Mon Oct 5 20:10:15 2009
@@ -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 $@
--- linux-2.6.31.orig/drivers/md/raid6altivec.uc Wed Sep 9 22:13:59 2009
+++ linux-2.6.31/drivers/md/raid6altivec.uc Mon Oct 5 20:10:15 2009
@@ -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
--- linux-2.6.31.orig/drivers/md/raid6int.uc Wed Sep 9 22:13:59 2009
+++ linux-2.6.31/drivers/md/raid6int.uc Mon Oct 5 20:10:15 2009
@@ -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>
--- linux-2.6.31.orig/drivers/md/raid6test/Makefile Wed Sep 9 22:13:59 2009
+++ linux-2.6.31/drivers/md/raid6test/Makefile Mon Oct 5 20:10:15 2009
@@ -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
@@ -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 > $@
-raid6altivec2.c: raid6altivec.uc ../unroll.pl
- $(PERL) ../unroll.pl 2 < raid6altivec.uc > $@
+raid6altivec2.c: raid6altivec.uc ../unroll.awk
+ $(AWK) ../unroll.awk 2 < raid6altivec.uc > $@
-raid6altivec4.c: raid6altivec.uc ../unroll.pl
- $(PERL) ../unroll.pl 4 < raid6altivec.uc > $@
+raid6altivec4.c: raid6altivec.uc ../unroll.awk
+ $(AWK) ../unroll.awk 4 < raid6altivec.uc > $@
-raid6altivec8.c: raid6altivec.uc ../unroll.pl
- $(PERL) ../unroll.pl 8 < raid6altivec.uc > $@
+raid6altivec8.c: raid6altivec.uc ../unroll.awk
+ $(AWK) ../unroll.awk 8 < raid6altivec.uc > $@
-raid6int1.c: raid6int.uc ../unroll.pl
- $(PERL) ../unroll.pl 1 < raid6int.uc > $@
+raid6int1.c: raid6int.uc ../unroll.awk
+ $(AWK) ../unroll.awk 1 < raid6int.uc > $@
-raid6int2.c: raid6int.uc ../unroll.pl
- $(PERL) ../unroll.pl 2 < raid6int.uc > $@
+raid6int2.c: raid6int.uc ../unroll.awk
+ $(AWK) ../unroll.awk 2 < raid6int.uc > $@
-raid6int4.c: raid6int.uc ../unroll.pl
- $(PERL) ../unroll.pl 4 < raid6int.uc > $@
+raid6int4.c: raid6int.uc ../unroll.awk
+ $(AWK) ../unroll.awk 4 < raid6int.uc > $@
-raid6int8.c: raid6int.uc ../unroll.pl
- $(PERL) ../unroll.pl 8 < raid6int.uc > $@
+raid6int8.c: raid6int.uc ../unroll.awk
+ $(AWK) ../unroll.awk 8 < raid6int.uc > $@
-raid6int16.c: raid6int.uc ../unroll.pl
- $(PERL) ../unroll.pl 16 < raid6int.uc > $@
+raid6int16.c: raid6int.uc ../unroll.awk
+ $(AWK) ../unroll.awk 16 < raid6int.uc > $@
-raid6int32.c: raid6int.uc ../unroll.pl
- $(PERL) ../unroll.pl 32 < raid6int.uc > $@
+raid6int32.c: raid6int.uc ../unroll.awk
+ $(AWK) ../unroll.awk 32 < raid6int.uc > $@
raid6tables.c: mktables
./mktables > raid6tables.c
--- /dev/null Thu Jan 1 00:00:00 1970
+++ linux-2.6.31/drivers/md/unroll.awk Mon Oct 5 20:12:24 2009
@@ -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
+ }
+}
--- linux-2.6.31.orig/drivers/md/unroll.pl Wed Sep 9 22:13:59 2009
+++ /dev/null Thu Jan 1 00:00:00 1970
@@ -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;
- }
-}
On Monday 05 October 2009 11:01:39 Vladimir Dronnikov wrote:
> From: Vladimir Dronnikov <[email protected]>
>
> drivers/md/unroll.pl replaced by awk script to drop build-time dependency
> on perl
>
> Signed-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-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
--
Latency is more important than throughput. It's that simple. - Linus Torvalds
On Monday October 5, [email protected] wrote:
> From: Vladimir Dronnikov <[email protected]>
>
> drivers/md/unroll.pl replaced 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:
> 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 )
>
The top level Makefile defines
AWK = awk
so I think $(AWK) should be used here, rather than a literal 'awk'.
> --- linux-2.6.31.orig/drivers/md/raid6test/Makefile Wed Sep 9 22:13:59 2009
> +++ linux-2.6.31/drivers/md/raid6test/Makefile Mon Oct 5 20:10:15 2009
> @@ -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
>
> @@ -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.....
> --- /dev/null Thu Jan 1 00:00:00 1970
> +++ linux-2.6.31/drivers/md/unroll.awk Mon Oct 5 20:12:24 2009
> @@ -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
> +#
> +# 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
> +{
> + if (/\$\$/) { rep = n } else { rep = 1 }
> + for (i = 0; i < rep; ++i) {
> + tmp = $0
> + gsub(/\$\$/, i, tmp)
> + gsub(/\$\#/, n, tmp)
> + gsub(/\$\*/, "$", tmp)
> + print tmp
> + }
> +}
> --- linux-2.6.31.orig/drivers/md/unroll.pl Wed Sep 9 22:13:59 2009
> +++ /dev/null Thu Jan 1 00:00:00 1970
> @@ -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;
> - }
> -}
Rob Landley wrote:
> On Monday 05 October 2009 11:01:39 Vladimir Dronnikov wrote:
>> From: Vladimir Dronnikov <[email protected]>
>>
>> drivers/md/unroll.pl replaced by awk script to drop build-time dependency
>> on perl
>>
>> Signed-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-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-
On Monday 05 October 2009 18:57:14 berk walker wrote:
> Rob Landley wrote:
> > On Monday 05 October 2009 11:01:39 Vladimir Dronnikov wrote:
> >> From: Vladimir Dronnikov <[email protected]>
> >>
> >> drivers/md/unroll.pl replaced by awk script to drop build-time
> >> dependency on perl
> >>
> >> Signed-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.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-
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
--
Latency is more important than throughput. It's that simple. - Linus Torvalds
On Tue, October 6, 2009 3:44 pm, Rob Landley wrote:
> On Monday 05 October 2009 18:57:14 berk walker wrote:
>> Rob Landley wrote:
>> > On Monday 05 October 2009 11:01:39 Vladimir Dronnikov wrote:
>> >> From: Vladimir Dronnikov <[email protected]>
>> >>
>> >> drivers/md/unroll.pl replaced by awk script to drop build-time
>> >> dependency on perl
>> >>
>> >> Signed-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.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-
>
> 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
> 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
>
> Just a couple of little changes needed:
Right. I've sent the updated patch. Please, take a look.
Best regards,
--
Vladimir
On Tuesday 06 October 2009 00:03:50 NeilBrown wrote:
> On Tue, October 6, 2009 3:44 pm, Rob Landley wrote:
> > On Monday 05 October 2009 18:57:14 berk walker wrote:
> >> Rob Landley wrote:
> >> > On Monday 05 October 2009 11:01:39 Vladimir Dronnikov wrote:
> >> >> From: Vladimir Dronnikov <[email protected]>
> >> >>
> >> >> drivers/md/unroll.pl replaced by awk script to drop build-time
> >> >> dependency on perl
> >> >>
> >> >> Signed-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.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-
> >
> > 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
--
Latency is more important than throughput. It's that simple. - Linus Torvalds
On Tuesday October 6, [email protected] wrote:
> > 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
>
> That's good, thanks.
> I'll queue it up for 2.6.33.
>
Thanks!
Best regards,
--
Vladimir