* 2.6.5-mc2 switch_to() fix
@ 2004-04-08 12:25 William Lee Irwin III
2004-04-08 18:45 ` David S. Miller
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: William Lee Irwin III @ 2004-04-08 12:25 UTC (permalink / raw)
To: sparclinux
I needed the following fix to boot. There were -Werror issues in the
32-bit exec() emulation code too, but those should probably be attacked
some other way besides removing -Werror (which is what I did).
This patch changes bne,pn to branch to a newly-introduced unconditional
branch, which may accept larger relocations than the conditional branch.
The branch delay slot of the converted conditional branch remains
intact, preserving the semantics where mov %g5, %0 is done
unconditionally. The annul bit is also set on the unconditional branch,
which prevents the execution of any instruction that may occur in its
branch delay slot from ever happening, rendering its position at the
end of the assembly fragment safe.
With this patch in place an Ultra2 and E3000 were able to boot and run
userspace on otherwise unadulterated 2.6.5-mc2 where they were not able
to do so without the patch. I'm not terribly familiar with SPARC
assembly (though I've dabbled in it before) so hopefully the above is
sufficiently coherent and/or at least shows I tried to do my homework.
-- wli
Index: hugetlb-2.6.5-1/include/asm-sparc64/system.h
=================================--- hugetlb-2.6.5-1.orig/include/asm-sparc64/system.h 2004-04-03 19:36:14.000000000 -0800
+++ hugetlb-2.6.5-1/include/asm-sparc64/system.h 2004-04-08 04:42:47.000000000 -0700
@@ -205,8 +205,10 @@
"ldx [%%g6 + %7], %%g4\n\t" \
"wrpr %%g0, 0x96, %%pstate\n\t" \
"andcc %%o7, %6, %%g0\n\t" \
- "bne,pn %%icc, ret_from_syscall\n\t" \
+ "beq,pn %%icc, 1f\n\t" \
" mov %%g5, %0\n\t" \
+ "b,a ret_from_syscall\n\t" \
+ "1:\n\t" \
: "=&r" (last) \
: "0" (next->thread_info), \
"i" (TI_WSTATE), "i" (TI_KSP), "i" (TI_FLAGS), "i" (TI_CWP), \
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: 2.6.5-mc2 switch_to() fix
2004-04-08 12:25 2.6.5-mc2 switch_to() fix William Lee Irwin III
@ 2004-04-08 18:45 ` David S. Miller
2004-04-08 19:03 ` Andrew Morton
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: David S. Miller @ 2004-04-08 18:45 UTC (permalink / raw)
To: sparclinux
On Thu, 8 Apr 2004 05:25:17 -0700
William Lee Irwin III <wli@holomorphy.com> wrote:
> This patch changes bne,pn to branch to a newly-introduced unconditional
> branch, which may accept larger relocations than the conditional branch.
> The branch delay slot of the converted conditional branch remains
> intact, preserving the semantics where mov %g5, %0 is done
> unconditionally. The annul bit is also set on the unconditional branch,
> which prevents the execution of any instruction that may occur in its
> branch delay slot from ever happening, rendering its position at the
> end of the assembly fragment safe.
This patch looks fine. But I'm very curious what changed in the -mm
tree which moved the kernel/sched.o object so far away from the link
into the arch/sparc64/kernel/head.o object (which is where the
ret_from_syscall destination symbol is located).
Some Makefile or vmlinux.lds hacking has been taking place? Actually,
doesn't Rusty's early setup stuff mess with things like that?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: 2.6.5-mc2 switch_to() fix
2004-04-08 12:25 2.6.5-mc2 switch_to() fix William Lee Irwin III
2004-04-08 18:45 ` David S. Miller
@ 2004-04-08 19:03 ` Andrew Morton
2004-04-08 20:05 ` David S. Miller
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2004-04-08 19:03 UTC (permalink / raw)
To: sparclinux
"David S. Miller" <davem@redhat.com> wrote:
>
> On Thu, 8 Apr 2004 05:25:17 -0700
> William Lee Irwin III <wli@holomorphy.com> wrote:
>
> > This patch changes bne,pn to branch to a newly-introduced unconditional
> > branch, which may accept larger relocations than the conditional branch.
> > The branch delay slot of the converted conditional branch remains
> > intact, preserving the semantics where mov %g5, %0 is done
> > unconditionally. The annul bit is also set on the unconditional branch,
> > which prevents the execution of any instruction that may occur in its
> > branch delay slot from ever happening, rendering its position at the
> > end of the assembly fragment safe.
>
> This patch looks fine. But I'm very curious what changed in the -mm
> tree which moved the kernel/sched.o object so far away from the link
> into the arch/sparc64/kernel/head.o object (which is where the
> ret_from_syscall destination symbol is located).
>
> Some Makefile or vmlinux.lds hacking has been taking place? Actually,
> doesn't Rusty's early setup stuff mess with things like that?
Probably it's Bill's patches which move the scheduler functions into their
own ELF section for wcahn identification purposes.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: 2.6.5-mc2 switch_to() fix
2004-04-08 12:25 2.6.5-mc2 switch_to() fix William Lee Irwin III
2004-04-08 18:45 ` David S. Miller
2004-04-08 19:03 ` Andrew Morton
@ 2004-04-08 20:05 ` David S. Miller
2004-04-08 20:16 ` Andrew Morton
2004-04-08 20:17 ` David S. Miller
4 siblings, 0 replies; 6+ messages in thread
From: David S. Miller @ 2004-04-08 20:05 UTC (permalink / raw)
To: sparclinux
On Thu, 8 Apr 2004 12:03:05 -0700
Andrew Morton <akpm@osdl.org> wrote:
> Probably it's Bill's patches which move the scheduler functions into their
> own ELF section for wcahn identification purposes.
That's right, I saw those changes.
I think the best thing to do, therefore, is just to rearrange
where that ELF section sits wrt. the main text in the sparc64
vmlinux.lds file.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: 2.6.5-mc2 switch_to() fix
2004-04-08 12:25 2.6.5-mc2 switch_to() fix William Lee Irwin III
` (2 preceding siblings ...)
2004-04-08 20:05 ` David S. Miller
@ 2004-04-08 20:16 ` Andrew Morton
2004-04-08 20:17 ` David S. Miller
4 siblings, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2004-04-08 20:16 UTC (permalink / raw)
To: sparclinux
"David S. Miller" <davem@redhat.com> wrote:
>
> On Thu, 8 Apr 2004 12:03:05 -0700
> Andrew Morton <akpm@osdl.org> wrote:
>
> > Probably it's Bill's patches which move the scheduler functions into their
> > own ELF section for wcahn identification purposes.
>
> That's right, I saw those changes.
>
> I think the best thing to do, therefore, is just to rearrange
> where that ELF section sits wrt. the main text in the sparc64
> vmlinux.lds file.
@@ -15,6 +15,7 @@ SECTIONS
.text 0x0000000000404000 :
{
*(.text)
+ SCHED_TEXT
*(.gnu.warning)
} =0
_etext = .;
Moving SCHED_TEXT to before .text should do it?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: 2.6.5-mc2 switch_to() fix
2004-04-08 12:25 2.6.5-mc2 switch_to() fix William Lee Irwin III
` (3 preceding siblings ...)
2004-04-08 20:16 ` Andrew Morton
@ 2004-04-08 20:17 ` David S. Miller
4 siblings, 0 replies; 6+ messages in thread
From: David S. Miller @ 2004-04-08 20:17 UTC (permalink / raw)
To: sparclinux
On Thu, 8 Apr 2004 13:16:56 -0700
Andrew Morton <akpm@osdl.org> wrote:
> @@ -15,6 +15,7 @@ SECTIONS
> .text 0x0000000000404000 :
> {
> *(.text)
> + SCHED_TEXT
> *(.gnu.warning)
> } =0
> _etext = .;
>
> Moving SCHED_TEXT to before .text should do it?
Actually, that might not work, since some of the trap table
and other stuff has to sit at the beginning to get aligned
correctly etc.
Ok, looks like wli's fix is the best for the time being until
I get a better idea :-)
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-04-08 20:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-08 12:25 2.6.5-mc2 switch_to() fix William Lee Irwin III
2004-04-08 18:45 ` David S. Miller
2004-04-08 19:03 ` Andrew Morton
2004-04-08 20:05 ` David S. Miller
2004-04-08 20:16 ` Andrew Morton
2004-04-08 20:17 ` David S. Miller
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.