* [PATCH] purgatory: compile sha256.c only on ia64 with -O0
@ 2013-03-31 20:59 Richard Weinberger
2013-04-01 1:59 ` Zhang Yanfei
2013-04-01 5:04 ` Simon Horman
0 siblings, 2 replies; 5+ messages in thread
From: Richard Weinberger @ 2013-03-31 20:59 UTC (permalink / raw)
To: horms; +Cc: Richard Weinberger, kexec
If we have to compile sha256.c on ia64 with -O0 to produce sane code
do it only on ia64.
This change makes executing a new kernel on my AMD geode CPU much faster.
Without the patch "kexec -e" takes 27 seconds, with only 16.
Signed-off-by: Richard Weinberger <richard@nod.at>
---
purgatory/Makefile | 15 +--------------
purgatory/arch/ia64/Makefile | 3 +++
2 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/purgatory/Makefile b/purgatory/Makefile
index e39adec..6be8362 100644
--- a/purgatory/Makefile
+++ b/purgatory/Makefile
@@ -16,16 +16,7 @@ PURGATORY_SRCS += purgatory/string.c
dist += purgatory/Makefile $(PURGATORY_SRCS) \
purgatory/include/purgatory.h purgatory/include/string.h
-include $(srcdir)/purgatory/arch/alpha/Makefile
-include $(srcdir)/purgatory/arch/arm/Makefile
-include $(srcdir)/purgatory/arch/i386/Makefile
-include $(srcdir)/purgatory/arch/ia64/Makefile
-include $(srcdir)/purgatory/arch/mips/Makefile
-include $(srcdir)/purgatory/arch/ppc/Makefile
-include $(srcdir)/purgatory/arch/ppc64/Makefile
-include $(srcdir)/purgatory/arch/s390/Makefile
-include $(srcdir)/purgatory/arch/sh/Makefile
-include $(srcdir)/purgatory/arch/x86_64/Makefile
+include $(srcdir)/purgatory/arch/$(ARCH)/Makefile
PURGATORY_SRCS+=$($(ARCH)_PURGATORY_SRCS)
@@ -36,10 +27,6 @@ clean += $(PURGATORY_OBJS) $(PURGATORY_DEPS) $(PURGATORY)
-include $(PURGATORY_DEPS)
-# sha256.c needs to be compiled without optimization, else
-# purgatory fails to execute on ia64.
-purgatory/sha256.o: CFLAGS += -O0
-
purgatory/sha256.o: $(srcdir)/util_lib/sha256.c
mkdir -p $(@D)
$(COMPILE.c) -o $@ $^
diff --git a/purgatory/arch/ia64/Makefile b/purgatory/arch/ia64/Makefile
index 32c3d97..a8a5c62 100644
--- a/purgatory/arch/ia64/Makefile
+++ b/purgatory/arch/ia64/Makefile
@@ -11,3 +11,6 @@ ia64_PURGATORY_EXTRA_CFLAGS = -ffixed-r28
dist += purgatory/arch/ia64/Makefile $(ia64_PURGATORY_SRCS) \
purgatory/arch/ia64/io.h purgatory/arch/ia64/purgatory-ia64.h
+# sha256.c needs to be compiled without optimization, else
+# purgatory fails to execute on ia64.
+purgatory/sha256.o: ia64_PURGATORY_EXTRA_CFLAGS += -O0
--
1.8.1.4
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] purgatory: compile sha256.c only on ia64 with -O0
2013-03-31 20:59 [PATCH] purgatory: compile sha256.c only on ia64 with -O0 Richard Weinberger
@ 2013-04-01 1:59 ` Zhang Yanfei
2013-04-01 5:04 ` Simon Horman
1 sibling, 0 replies; 5+ messages in thread
From: Zhang Yanfei @ 2013-04-01 1:59 UTC (permalink / raw)
To: Richard Weinberger, horms; +Cc: kexec
于 2013年04月01日 04:59, Richard Weinberger 写道:
> If we have to compile sha256.c on ia64 with -O0 to produce sane code
> do it only on ia64.
>
> This change makes executing a new kernel on my AMD geode CPU much faster.
> Without the patch "kexec -e" takes 27 seconds, with only 16.
>
> Signed-off-by: Richard Weinberger <richard@nod.at>
> ---
> purgatory/Makefile | 15 +--------------
> purgatory/arch/ia64/Makefile | 3 +++
> 2 files changed, 4 insertions(+), 14 deletions(-)
The fix is sound.
Reviewed-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] purgatory: compile sha256.c only on ia64 with -O0
2013-03-31 20:59 [PATCH] purgatory: compile sha256.c only on ia64 with -O0 Richard Weinberger
2013-04-01 1:59 ` Zhang Yanfei
@ 2013-04-01 5:04 ` Simon Horman
2013-04-01 5:16 ` Zhang Yanfei
1 sibling, 1 reply; 5+ messages in thread
From: Simon Horman @ 2013-04-01 5:04 UTC (permalink / raw)
To: Richard Weinberger; +Cc: kexec
On Sun, Mar 31, 2013 at 10:59:09PM +0200, Richard Weinberger wrote:
> If we have to compile sha256.c on ia64 with -O0 to produce sane code
> do it only on ia64.
>
> This change makes executing a new kernel on my AMD geode CPU much faster.
> Without the patch "kexec -e" takes 27 seconds, with only 16.
>
> Signed-off-by: Richard Weinberger <richard@nod.at>
> ---
> purgatory/Makefile | 15 +--------------
> purgatory/arch/ia64/Makefile | 3 +++
> 2 files changed, 4 insertions(+), 14 deletions(-)
>
> diff --git a/purgatory/Makefile b/purgatory/Makefile
> index e39adec..6be8362 100644
> --- a/purgatory/Makefile
> +++ b/purgatory/Makefile
> @@ -16,16 +16,7 @@ PURGATORY_SRCS += purgatory/string.c
> dist += purgatory/Makefile $(PURGATORY_SRCS) \
> purgatory/include/purgatory.h purgatory/include/string.h
>
> -include $(srcdir)/purgatory/arch/alpha/Makefile
> -include $(srcdir)/purgatory/arch/arm/Makefile
> -include $(srcdir)/purgatory/arch/i386/Makefile
> -include $(srcdir)/purgatory/arch/ia64/Makefile
> -include $(srcdir)/purgatory/arch/mips/Makefile
> -include $(srcdir)/purgatory/arch/ppc/Makefile
> -include $(srcdir)/purgatory/arch/ppc64/Makefile
> -include $(srcdir)/purgatory/arch/s390/Makefile
> -include $(srcdir)/purgatory/arch/sh/Makefile
> -include $(srcdir)/purgatory/arch/x86_64/Makefile
> +include $(srcdir)/purgatory/arch/$(ARCH)/Makefile
I believe the above portion will break make dist my
causing it to omit purgatory/arch/* other than
purgatory/arch/$(ARCH)
>
> PURGATORY_SRCS+=$($(ARCH)_PURGATORY_SRCS)
>
> @@ -36,10 +27,6 @@ clean += $(PURGATORY_OBJS) $(PURGATORY_DEPS) $(PURGATORY)
>
> -include $(PURGATORY_DEPS)
>
> -# sha256.c needs to be compiled without optimization, else
> -# purgatory fails to execute on ia64.
> -purgatory/sha256.o: CFLAGS += -O0
> -
> purgatory/sha256.o: $(srcdir)/util_lib/sha256.c
> mkdir -p $(@D)
> $(COMPILE.c) -o $@ $^
> diff --git a/purgatory/arch/ia64/Makefile b/purgatory/arch/ia64/Makefile
> index 32c3d97..a8a5c62 100644
> --- a/purgatory/arch/ia64/Makefile
> +++ b/purgatory/arch/ia64/Makefile
> @@ -11,3 +11,6 @@ ia64_PURGATORY_EXTRA_CFLAGS = -ffixed-r28
> dist += purgatory/arch/ia64/Makefile $(ia64_PURGATORY_SRCS) \
> purgatory/arch/ia64/io.h purgatory/arch/ia64/purgatory-ia64.h
>
> +# sha256.c needs to be compiled without optimization, else
> +# purgatory fails to execute on ia64.
> +purgatory/sha256.o: ia64_PURGATORY_EXTRA_CFLAGS += -O0
> --
> 1.8.1.4
>
>
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
>
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] purgatory: compile sha256.c only on ia64 with -O0
2013-04-01 5:04 ` Simon Horman
@ 2013-04-01 5:16 ` Zhang Yanfei
2013-04-01 10:05 ` Richard Weinberger
0 siblings, 1 reply; 5+ messages in thread
From: Zhang Yanfei @ 2013-04-01 5:16 UTC (permalink / raw)
To: Simon Horman; +Cc: Richard Weinberger, kexec
于 2013年04月01日 13:04, Simon Horman 写道:
> On Sun, Mar 31, 2013 at 10:59:09PM +0200, Richard Weinberger wrote:
>> If we have to compile sha256.c on ia64 with -O0 to produce sane code
>> do it only on ia64.
>>
>> This change makes executing a new kernel on my AMD geode CPU much faster.
>> Without the patch "kexec -e" takes 27 seconds, with only 16.
>>
>> Signed-off-by: Richard Weinberger <richard@nod.at>
>> ---
>> purgatory/Makefile | 15 +--------------
>> purgatory/arch/ia64/Makefile | 3 +++
>> 2 files changed, 4 insertions(+), 14 deletions(-)
>>
>> diff --git a/purgatory/Makefile b/purgatory/Makefile
>> index e39adec..6be8362 100644
>> --- a/purgatory/Makefile
>> +++ b/purgatory/Makefile
>> @@ -16,16 +16,7 @@ PURGATORY_SRCS += purgatory/string.c
>> dist += purgatory/Makefile $(PURGATORY_SRCS) \
>> purgatory/include/purgatory.h purgatory/include/string.h
>>
>> -include $(srcdir)/purgatory/arch/alpha/Makefile
>> -include $(srcdir)/purgatory/arch/arm/Makefile
>> -include $(srcdir)/purgatory/arch/i386/Makefile
>> -include $(srcdir)/purgatory/arch/ia64/Makefile
>> -include $(srcdir)/purgatory/arch/mips/Makefile
>> -include $(srcdir)/purgatory/arch/ppc/Makefile
>> -include $(srcdir)/purgatory/arch/ppc64/Makefile
>> -include $(srcdir)/purgatory/arch/s390/Makefile
>> -include $(srcdir)/purgatory/arch/sh/Makefile
>> -include $(srcdir)/purgatory/arch/x86_64/Makefile
>> +include $(srcdir)/purgatory/arch/$(ARCH)/Makefile
>
> I believe the above portion will break make dist my
> causing it to omit purgatory/arch/* other than
> purgatory/arch/$(ARCH)
Ah, I've missed this in my review, too.
Other than this, the change about purgatory/sha256.o below looks sound,
right?
Thanks
Zhang
>
>>
>> PURGATORY_SRCS+=$($(ARCH)_PURGATORY_SRCS)
>>
>> @@ -36,10 +27,6 @@ clean += $(PURGATORY_OBJS) $(PURGATORY_DEPS) $(PURGATORY)
>>
>> -include $(PURGATORY_DEPS)
>>
>> -# sha256.c needs to be compiled without optimization, else
>> -# purgatory fails to execute on ia64.
>> -purgatory/sha256.o: CFLAGS += -O0
>> -
>> purgatory/sha256.o: $(srcdir)/util_lib/sha256.c
>> mkdir -p $(@D)
>> $(COMPILE.c) -o $@ $^
>> diff --git a/purgatory/arch/ia64/Makefile b/purgatory/arch/ia64/Makefile
>> index 32c3d97..a8a5c62 100644
>> --- a/purgatory/arch/ia64/Makefile
>> +++ b/purgatory/arch/ia64/Makefile
>> @@ -11,3 +11,6 @@ ia64_PURGATORY_EXTRA_CFLAGS = -ffixed-r28
>> dist += purgatory/arch/ia64/Makefile $(ia64_PURGATORY_SRCS) \
>> purgatory/arch/ia64/io.h purgatory/arch/ia64/purgatory-ia64.h
>>
>> +# sha256.c needs to be compiled without optimization, else
>> +# purgatory fails to execute on ia64.
>> +purgatory/sha256.o: ia64_PURGATORY_EXTRA_CFLAGS += -O0
>> --
>> 1.8.1.4
>>
>>
>> _______________________________________________
>> kexec mailing list
>> kexec@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/kexec
>>
>
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
>
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] purgatory: compile sha256.c only on ia64 with -O0
2013-04-01 5:16 ` Zhang Yanfei
@ 2013-04-01 10:05 ` Richard Weinberger
0 siblings, 0 replies; 5+ messages in thread
From: Richard Weinberger @ 2013-04-01 10:05 UTC (permalink / raw)
To: Zhang Yanfei; +Cc: Simon Horman, kexec
Simon, Zhang,
Am 01.04.2013 07:16, schrieb Zhang Yanfei:
>> I believe the above portion will break make dist my
>> causing it to omit purgatory/arch/* other than
>> purgatory/arch/$(ARCH)
>
> Ah, I've missed this in my review, too.
>
> Other than this, the change about purgatory/sha256.o below looks sound,
> right?
The dist mechanism is quite strange and error prone.
Why can't you just use git archive in the $(TARBALL) target?
I'll happily send a patch...
Back to the purgatory/sha256.o issue, I did some more tests.
First I thought memcpy() within purgatory is slow, but it isn't.
Does kexec reset the CPU so some kind of legacy mode during purgatory?
It looks like the same code in sha256.o is fast in normal user space
but very slow during purgatory.
Computing sha256 of a 9MiB blob takes less than a second in user space
and 16 seconds (with my patch). Otherwise it takes > 25 seconds.
Thanks,
//richard
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-04-01 10:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-31 20:59 [PATCH] purgatory: compile sha256.c only on ia64 with -O0 Richard Weinberger
2013-04-01 1:59 ` Zhang Yanfei
2013-04-01 5:04 ` Simon Horman
2013-04-01 5:16 ` Zhang Yanfei
2013-04-01 10:05 ` Richard Weinberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox