From: Eric Dumazet <dada1@cosmosbay.com>
To: Andi Kleen <ak@suse.de>
Cc: Ingo Molnar <mingo@elte.hu>,
akpm@osdl.org, Arjan van de Ven <arjan@infradead.org>,
Jeremy Fitzhardinge <jeremy@goop.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] i386-pda UP optimization
Date: Wed, 15 Nov 2006 18:46:30 +0100 [thread overview]
Message-ID: <200611151846.31109.dada1@cosmosbay.com> (raw)
In-Reply-To: <200611151824.36198.ak@suse.de>
[-- Attachment #1: Type: text/plain, Size: 1164 bytes --]
On Wednesday 15 November 2006 18:24, Andi Kleen wrote:
> On Wednesday 15 November 2006 18:20, Ingo Molnar wrote:
> > * Andi Kleen <ak@suse.de> wrote:
> > > On Wednesday 15 November 2006 12:27, Eric Dumazet wrote:
> > > > Seeing %gs prefixes used now by i386 port, I recalled seeing strange
> > > > oprofile results on Opteron machines.
> > > >
> > > > I really think %gs prefixes can be expensive in some (most ?) cases,
> > > > even if the Intel/AMD docs say they are free.
> > >
> > > They aren't free, just very cheap.
> >
> > Eric's test shows a 5% slowdown. That's far from cheap.
>
> I have my doubts about the accuracy of his test results. That is why I
> asked him to double check.
Fair enough :)
I plan doing *lot* of tests as soon as possible (not possible during daytime
unfortunately, I miss a dev machine)
By the way, I tried this patch to avoid reload %gs at syscall start. Since %gs
is not anymore used inside kernel (after i386-pda UP optimization is
applied) : We can let in %gs the User Program %gs value. (I still force a
reload of %gs before syscall exit of course)
Machine boots but freeze when init starts. Any idea ?
Thank you
Eric
[-- Attachment #2: entry.patch --]
[-- Type: text/plain, Size: 1398 bytes --]
--- linux-2.6.19-rc5-mm2/arch/i386/kernel/entry.S 2006-11-15 11:21:25.000000000 +0100
+++ linux-2.6.19-rc5-mm2-ed/arch/i386/kernel/entry.S 2006-11-15 18:40:53.000000000 +0100
@@ -97,6 +97,16 @@
#define resume_userspace_sig resume_userspace
#endif
+/*
+ * On UP, we dont need to change %gs since PDA accesses dont use %gs
+ */
+#if defined(CONFIG_SMP)
+#define LOAD_KERNEL_GS(reg) movl $(__KERNEL_PDA), reg; \
+ movl reg, %gs
+#else
+#define LOAD_KERNEL_GS(reg)
+#endif
+
#define SAVE_ALL \
cld; \
pushl %gs; \
@@ -132,8 +142,7 @@
movl $(__USER_DS), %edx; \
movl %edx, %ds; \
movl %edx, %es; \
- movl $(__KERNEL_PDA), %edx; \
- movl %edx, %gs
+ LOAD_KERNEL_GS(%edx);
#define RESTORE_INT_REGS \
popl %ebx; \
@@ -544,9 +553,15 @@
jmp resume_userspace
CFI_ENDPROC
+#ifdef CONFIG_SMP
+# define GET_CPU_NUM(reg) movl %gs:PDA_cpu, reg;
+#else
+# define GET_CPU_NUM(reg)
+#endif
+
#define FIXUP_ESPFIX_STACK \
/* since we are on a wrong stack, we cant make it a C code :( */ \
- movl %gs:PDA_cpu, %ebx; \
+ GET_CPU_NUM(%ebx) \
PER_CPU(cpu_gdt_descr, %ebx); \
movl GDS_address(%ebx), %ebx; \
GET_DESC_BASE(GDT_ENTRY_ESPFIX_SS, %ebx, %eax, %ax, %al, %ah); \
@@ -660,8 +675,7 @@
pushl %gs
CFI_ADJUST_CFA_OFFSET 4
/*CFI_REL_OFFSET gs, 0*/
- movl $(__KERNEL_PDA), %ecx
- movl %ecx, %gs
+ LOAD_KERNEL_GS(%ecx)
UNWIND_ESPFIX_STACK
popl %ecx
CFI_ADJUST_CFA_OFFSET -4
next prev parent reply other threads:[~2006-11-15 17:46 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-12 7:35 i386 PDA patches use of %gs Arjan van de Ven
2006-09-12 7:48 ` Jeremy Fitzhardinge
2006-09-12 7:56 ` Arjan van de Ven
2006-09-12 8:31 ` Jeremy Fitzhardinge
2006-11-15 11:27 ` [PATCH] i386-pda UP optimization Eric Dumazet
2006-11-15 11:32 ` Andi Kleen
2006-11-15 17:20 ` Ingo Molnar
2006-11-15 17:24 ` Andi Kleen
2006-11-15 17:46 ` Eric Dumazet [this message]
2006-11-15 17:49 ` Ingo Molnar
2006-11-15 17:58 ` Eric Dumazet
2006-11-15 18:01 ` Ingo Molnar
2006-11-21 11:38 ` Eric Dumazet
2006-11-21 21:42 ` Jeremy Fitzhardinge
2006-11-21 21:52 ` Andi Kleen
2006-11-21 22:10 ` Jeremy Fitzhardinge
2006-11-21 21:58 ` Eric Dumazet
2006-11-21 23:12 ` Jeremy Fitzhardinge
2006-11-15 17:28 ` Jeremy Fitzhardinge
2006-11-15 17:32 ` Ingo Molnar
2006-11-15 17:59 ` Jeremy Fitzhardinge
2006-11-15 18:05 ` Eric Dumazet
2006-11-15 18:28 ` Jeremy Fitzhardinge
2006-11-15 18:31 ` Ingo Molnar
2006-11-15 18:01 ` Arjan van de Ven
2006-11-15 18:24 ` Jeremy Fitzhardinge
2006-11-15 19:06 ` Ingo Molnar
2006-11-17 0:24 ` Jeremy Fitzhardinge
2006-11-15 17:52 ` Jeremy Fitzhardinge
2006-11-28 23:12 ` Jeremy Fitzhardinge
2006-11-29 9:30 ` Eric Dumazet
2006-11-29 9:56 ` Jeremy Fitzhardinge
2006-09-13 1:00 ` i386 PDA patches use of %gs Jeremy Fitzhardinge
2006-09-13 9:59 ` Ingo Molnar
2006-09-13 16:17 ` Jeremy Fitzhardinge
2006-11-15 18:26 ` Ingo Molnar
2006-11-15 18:29 ` Ingo Molnar
2006-11-15 18:43 ` Jeremy Fitzhardinge
2006-11-15 18:44 ` Ingo Molnar
2006-11-15 18:39 ` Jeremy Fitzhardinge
2006-11-15 18:43 ` Ingo Molnar
2006-11-15 18:49 ` Jeremy Fitzhardinge
2006-11-15 18:49 ` Ingo Molnar
2006-11-15 19:00 ` Jeremy Fitzhardinge
2006-11-15 19:03 ` Ingo Molnar
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=200611151846.31109.dada1@cosmosbay.com \
--to=dada1@cosmosbay.com \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=arjan@infradead.org \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®