From: Franck Bui-Huu <fbuihuu@gmail.com>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips <linux-mips@linux-mips.org>
Subject: [PATCH] Use __fill_user() to clear bss.
Date: Sun, 11 Nov 2007 09:52:24 +0100 [thread overview]
Message-ID: <4736C2C8.9000709@gmail.com> (raw)
bss is relatively big, more than 70Kb on cobalt config, so it's a pity
to clear it one word per loop. Instead this patch uses __fill_user(),
which should be faster.
Since we do a function jump to __fill_user(), argument registers needs
to be modified. However at this point, they contains the firmware
arguments which are saved the bss section. To avoid issue, this patch
makes them part of the data section.
Also this patch makes sure that sp is setup before doing a jal.
Signed-off-by: Franck Bui-Huu <fbuihuu@gmail.com>
---
Ralf,
I haven't done any benchmarks but it seems the right thing to do.
Please consider,
Franck
arch/mips/kernel/head.S | 14 ++++++--------
arch/mips/kernel/setup.c | 13 ++++++++++---
2 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
index 2367687..97273ae 100644
--- a/arch/mips/kernel/head.S
+++ b/arch/mips/kernel/head.S
@@ -171,14 +171,6 @@ NESTED(kernel_entry, 16, sp) # kernel entry point
mtc0 t0, CP0_STATUS
#endif /* CONFIG_MIPS_MT_SMTC */
- PTR_LA t0, __bss_start # clear .bss
- LONG_S zero, (t0)
- PTR_LA t1, __bss_stop - LONGSIZE
-1:
- PTR_ADDIU t0, LONGSIZE
- LONG_S zero, (t0)
- bne t0, t1, 1b
-
LONG_S a0, fw_arg0 # firmware arguments
LONG_S a1, fw_arg1
LONG_S a2, fw_arg2
@@ -191,6 +183,12 @@ NESTED(kernel_entry, 16, sp) # kernel entry point
set_saved_sp sp, t0, t1
PTR_SUBU sp, 4 * SZREG # init stack pointer
+ PTR_LA a0, __bss_start # clear .bss
+ move a1, zero
+ PTR_LA a2, __bss_stop
+ LONG_SUBU a2, a0
+ jal __fill_user # no need to save ra
+
j start_kernel
END(kernel_entry)
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index a06a27d..0eee73f 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -30,6 +30,7 @@
#include <asm/setup.h>
#include <asm/system.h>
+unsigned long kernelsp[NR_CPUS];
struct cpuinfo_mips cpu_data[NR_CPUS] __read_mostly;
EXPORT_SYMBOL(cpu_data);
@@ -39,6 +40,15 @@ struct screen_info screen_info;
#endif
/*
+ * Note: they're part of the data section because they're used
+ * *before* bss is cleared.
+ */
+unsigned long fw_arg0 = ULONG_MAX;
+unsigned long fw_arg1 = ULONG_MAX;
+unsigned long fw_arg2 = ULONG_MAX;
+unsigned long fw_arg3 = ULONG_MAX;
+
+/*
* Despite it's name this variable is even if we don't have PCI
*/
unsigned int PCI_DMA_BUS_IS_PHYS;
@@ -571,9 +581,6 @@ static int __init dsp_disable(char *s)
__setup("nodsp", dsp_disable);
-unsigned long kernelsp[NR_CPUS];
-unsigned long fw_arg0, fw_arg1, fw_arg2, fw_arg3;
-
#ifdef CONFIG_DEBUG_FS
struct dentry *mips_debugfs_dir;
static int __init debugfs_mips(void)
--
1.5.3.4
reply other threads:[~2007-11-11 8:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4736C2C8.9000709@gmail.com \
--to=fbuihuu@gmail.com \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.