* [PATCH] [Powerpc] fix switch_slb handling of 1T ESID values
@ 2007-10-26 20:46 Will Schmidt
2007-10-27 4:19 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 3+ messages in thread
From: Will Schmidt @ 2007-10-26 20:46 UTC (permalink / raw)
To: linuxppc-dev; +Cc: paulus
[Powerpc] fix switch_slb handling of 1T ESID values
Now that we have 1TB segment size support, we need to be using the
GET_ESID_1T macro when comparing ESID values for pc,stack, and
unmapped_base within switch_slb() when we're on a CPU that supports it.
This also happens to fix a duplicate-slb-entry inspired machine-check
exception I was seeing when trying to run java on a power6 partition.
Tested on power6 and power5.
Signed-Off-By: Will Schmidt <will_schmidt@vnet.ibm.com>
---
There is a similar bit of code in stab.c switch_stab(). Should this change also be made there?
---
arch/powerpc/mm/slb.c | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
index bbd2c51..0c527d7 100644
--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -193,16 +193,25 @@ void switch_slb(struct task_struct *tsk, struct mm_struct *mm)
return;
slb_allocate(pc);
- if (GET_ESID(pc) == GET_ESID(stack))
- return;
+ if (cpu_has_feature(CPU_FTR_1T_SEGMENT)) {
+ if (GET_ESID_1T(pc) == GET_ESID_1T(stack))
+ return;
+ } else
+ if (GET_ESID(pc) == GET_ESID(stack))
+ return;
if (is_kernel_addr(stack))
return;
slb_allocate(stack);
- if ((GET_ESID(pc) == GET_ESID(unmapped_base))
- || (GET_ESID(stack) == GET_ESID(unmapped_base)))
- return;
+ if (cpu_has_feature(CPU_FTR_1T_SEGMENT)) {
+ if ((GET_ESID_1T(pc) == GET_ESID_1T(unmapped_base))
+ || (GET_ESID_1T(stack) == GET_ESID_1T(unmapped_base)))
+ return;
+ } else
+ if ((GET_ESID(pc) == GET_ESID(unmapped_base))
+ || (GET_ESID(stack) == GET_ESID(unmapped_base)))
+ return;
if (is_kernel_addr(unmapped_base))
return;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] [Powerpc] fix switch_slb handling of 1T ESID values
2007-10-26 20:46 [PATCH] [Powerpc] fix switch_slb handling of 1T ESID values Will Schmidt
@ 2007-10-27 4:19 ` Benjamin Herrenschmidt
2007-10-27 17:36 ` Will Schmidt
0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2007-10-27 4:19 UTC (permalink / raw)
To: Will Schmidt; +Cc: linuxppc-dev, paulus
On Fri, 2007-10-26 at 15:46 -0500, Will Schmidt wrote:
> [Powerpc] fix switch_slb handling of 1T ESID values
>
> Now that we have 1TB segment size support, we need to be using the
> GET_ESID_1T macro when comparing ESID values for pc,stack, and
> unmapped_base within switch_slb() when we're on a CPU that supports it.
>
> This also happens to fix a duplicate-slb-entry inspired machine-check
> exception I was seeing when trying to run java on a power6 partition.
>
> Tested on power6 and power5.
>
> Signed-Off-By: Will Schmidt <will_schmidt@vnet.ibm.com>
Good catch !
A minor comment is maybe you could factor out the code better doing
something like a ESID_COMPARE() macro ?
> ---
>
> There is a similar bit of code in stab.c switch_stab(). Should this change also be made there?
> ---
There is no machine that does stab and 1T segments.
Ben.
>
> arch/powerpc/mm/slb.c | 19 ++++++++++++++-----
> 1 files changed, 14 insertions(+), 5 deletions(-)
>
>
> diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
> index bbd2c51..0c527d7 100644
> --- a/arch/powerpc/mm/slb.c
> +++ b/arch/powerpc/mm/slb.c
> @@ -193,16 +193,25 @@ void switch_slb(struct task_struct *tsk, struct mm_struct *mm)
> return;
> slb_allocate(pc);
>
> - if (GET_ESID(pc) == GET_ESID(stack))
> - return;
> + if (cpu_has_feature(CPU_FTR_1T_SEGMENT)) {
> + if (GET_ESID_1T(pc) == GET_ESID_1T(stack))
> + return;
> + } else
> + if (GET_ESID(pc) == GET_ESID(stack))
> + return;
>
> if (is_kernel_addr(stack))
> return;
> slb_allocate(stack);
>
> - if ((GET_ESID(pc) == GET_ESID(unmapped_base))
> - || (GET_ESID(stack) == GET_ESID(unmapped_base)))
> - return;
> + if (cpu_has_feature(CPU_FTR_1T_SEGMENT)) {
> + if ((GET_ESID_1T(pc) == GET_ESID_1T(unmapped_base))
> + || (GET_ESID_1T(stack) == GET_ESID_1T(unmapped_base)))
> + return;
> + } else
> + if ((GET_ESID(pc) == GET_ESID(unmapped_base))
> + || (GET_ESID(stack) == GET_ESID(unmapped_base)))
> + return;
>
> if (is_kernel_addr(unmapped_base))
> return;
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [Powerpc] fix switch_slb handling of 1T ESID values
2007-10-27 4:19 ` Benjamin Herrenschmidt
@ 2007-10-27 17:36 ` Will Schmidt
0 siblings, 0 replies; 3+ messages in thread
From: Will Schmidt @ 2007-10-27 17:36 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev, paulus
On Sat, 2007-10-27 at 14:19 +1000, Benjamin Herrenschmidt wrote:
> On Fri, 2007-10-26 at 15:46 -0500, Will Schmidt wrote:
> > [Powerpc] fix switch_slb handling of 1T ESID values
> >
> > Now that we have 1TB segment size support, we need to be using the
> > GET_ESID_1T macro when comparing ESID values for pc,stack, and
> > unmapped_base within switch_slb() when we're on a CPU that supports it.
> >
> > This also happens to fix a duplicate-slb-entry inspired machine-check
> > exception I was seeing when trying to run java on a power6 partition.
> >
> > Tested on power6 and power5.
> >
> > Signed-Off-By: Will Schmidt <will_schmidt@vnet.ibm.com>
>
> Good catch !
>
> A minor comment is maybe you could factor out the code better doing
> something like a ESID_COMPARE() macro ?
Yeah, thats a good idea. I'll spin up a new patch in the next day or
so.
It occurred to me that I should continue to use GET_ESID when the user
address is < 1T too.
>
> > ---
> >
> > There is a similar bit of code in stab.c switch_stab(). Should this change also be made there?
> > ---
>
> There is no machine that does stab and 1T segments.
Ok, thanks for the clarification.
-Will
>
> Ben.
>
> >
> > arch/powerpc/mm/slb.c | 19 ++++++++++++++-----
> > 1 files changed, 14 insertions(+), 5 deletions(-)
> >
> >
> > diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
> > index bbd2c51..0c527d7 100644
> > --- a/arch/powerpc/mm/slb.c
> > +++ b/arch/powerpc/mm/slb.c
> > @@ -193,16 +193,25 @@ void switch_slb(struct task_struct *tsk, struct mm_struct *mm)
> > return;
> > slb_allocate(pc);
> >
> > - if (GET_ESID(pc) == GET_ESID(stack))
> > - return;
> > + if (cpu_has_feature(CPU_FTR_1T_SEGMENT)) {
> > + if (GET_ESID_1T(pc) == GET_ESID_1T(stack))
> > + return;
> > + } else
> > + if (GET_ESID(pc) == GET_ESID(stack))
> > + return;
> >
> > if (is_kernel_addr(stack))
> > return;
> > slb_allocate(stack);
> >
> > - if ((GET_ESID(pc) == GET_ESID(unmapped_base))
> > - || (GET_ESID(stack) == GET_ESID(unmapped_base)))
> > - return;
> > + if (cpu_has_feature(CPU_FTR_1T_SEGMENT)) {
> > + if ((GET_ESID_1T(pc) == GET_ESID_1T(unmapped_base))
> > + || (GET_ESID_1T(stack) == GET_ESID_1T(unmapped_base)))
> > + return;
> > + } else
> > + if ((GET_ESID(pc) == GET_ESID(unmapped_base))
> > + || (GET_ESID(stack) == GET_ESID(unmapped_base)))
> > + return;
> >
> > if (is_kernel_addr(unmapped_base))
> > return;
> >
> >
> > _______________________________________________
> > Linuxppc-dev mailing list
> > Linuxppc-dev@ozlabs.org
> > https://ozlabs.org/mailman/listinfo/linuxppc-dev
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-10-27 17:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-26 20:46 [PATCH] [Powerpc] fix switch_slb handling of 1T ESID values Will Schmidt
2007-10-27 4:19 ` Benjamin Herrenschmidt
2007-10-27 17:36 ` Will Schmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).