* [PATCH] Don't access HID registers if running on a Hypervisor.
@ 2006-06-21 23:15 Jimi Xenidis
2006-06-21 23:51 ` Olof Johansson
2006-06-21 23:58 ` Paul Mackerras
0 siblings, 2 replies; 8+ messages in thread
From: Jimi Xenidis @ 2006-06-21 23:15 UTC (permalink / raw)
To: linuxppc-dev
The following patch avoids accessing Hypervisor privilege HID
registers when running on a Hypervisor (MSR[HV]=0).
Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
diff -r 87d019e8edc2 arch/powerpc/kernel/cpu_setup_power4.S
--- a/arch/powerpc/kernel/cpu_setup_power4.S Tue Jun 20 13:50:49 2006 -0400
+++ b/arch/powerpc/kernel/cpu_setup_power4.S Wed Jun 21 19:10:22 2006 -0400
@@ -149,7 +149,12 @@ _GLOBAL(__save_cpu_setup)
cmpwi r0,0x44
bne 2f
-1: /* Save HID0,1,4 and 5 */
+1: /* skip if not running in HV mode */
+ mfmsr r0
+ rldicl. r0,r0,4,63
+ beq 2f
+
+ /* Save HID0,1,4 and 5 */
mfspr r3,SPRN_HID0
std r3,CS_HID0(r5)
mfspr r3,SPRN_HID1
@@ -183,7 +188,12 @@ _GLOBAL(__restore_cpu_setup)
cmpwi r0,0x44
bnelr
-1: /* Before accessing memory, we make sure rm_ci is clear */
+1: /* skip if not running in HV mode */
+ mfmsr r0
+ rldicl. r0,r0,4,63
+ beqlr
+
+ /* Before accessing memory, we make sure rm_ci is clear */
li r0,0
mfspr r3,SPRN_HID4
rldimi r3,r0,40,23 /* clear bit 23 (rm_ci) */
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Don't access HID registers if running on a Hypervisor.
2006-06-21 23:15 [PATCH] Don't access HID registers if running on a Hypervisor Jimi Xenidis
@ 2006-06-21 23:51 ` Olof Johansson
2006-06-22 10:58 ` Jimi Xenidis
2006-06-21 23:58 ` Paul Mackerras
1 sibling, 1 reply; 8+ messages in thread
From: Olof Johansson @ 2006-06-21 23:51 UTC (permalink / raw)
To: Jimi Xenidis; +Cc: linuxppc-dev
On Wed, Jun 21, 2006 at 07:15:55PM -0400, Jimi Xenidis wrote:
>
> The following patch avoids accessing Hypervisor privilege HID
> registers when running on a Hypervisor (MSR[HV]=0).
I'm curious, why is this causing problems now? JS20 has been running
that code with a hypervisor since a long time back.
-Olof
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Don't access HID registers if running on a Hypervisor.
2006-06-21 23:15 [PATCH] Don't access HID registers if running on a Hypervisor Jimi Xenidis
2006-06-21 23:51 ` Olof Johansson
@ 2006-06-21 23:58 ` Paul Mackerras
2006-06-22 2:35 ` Jimi Xenidis
1 sibling, 1 reply; 8+ messages in thread
From: Paul Mackerras @ 2006-06-21 23:58 UTC (permalink / raw)
To: Jimi Xenidis; +Cc: linuxppc-dev
Jimi Xenidis writes:
> The following patch avoids accessing Hypervisor privilege HID
> registers when running on a Hypervisor (MSR[HV]=0).
Why? Aren't the writes defined to be no-ops when not in hypervisor
mode?
Paul.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Don't access HID registers if running on a Hypervisor.
2006-06-21 23:58 ` Paul Mackerras
@ 2006-06-22 2:35 ` Jimi Xenidis
2006-06-22 16:23 ` Olof Johansson
0 siblings, 1 reply; 8+ messages in thread
From: Jimi Xenidis @ 2006-06-22 2:35 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
On Jun 21, 2006, at 7:58 PM, Paul Mackerras wrote:
> Jimi Xenidis writes:
>
>> The following patch avoids accessing Hypervisor privilege HID
>> registers when running on a Hypervisor (MSR[HV]=0).
>
> Why? Aren't the writes defined to be no-ops when not in hypervisor
> mode?
The write are no-ops but look at the instructions required to be
around the write for some of them.
I believe read may have performance issues as well.
I juts think its good practice and as Xell and newer processes come
along we may want to start using the PACA(?) rather then peeking at
the msr all the time.
-JX
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Don't access HID registers if running on a Hypervisor.
2006-06-21 23:51 ` Olof Johansson
@ 2006-06-22 10:58 ` Jimi Xenidis
2006-06-22 12:09 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 8+ messages in thread
From: Jimi Xenidis @ 2006-06-22 10:58 UTC (permalink / raw)
To: Olof Johansson; +Cc: linuxppc-dev
On Jun 21, 2006, at 7:51 PM, Olof Johansson wrote:
> On Wed, Jun 21, 2006 at 07:15:55PM -0400, Jimi Xenidis wrote:
>>
>> The following patch avoids accessing Hypervisor privilege HID
>> registers when running on a Hypervisor (MSR[HV]=0).
>
> I'm curious, why is this causing problems now?
Every once in a while I run Xen on one of our simulators thats is
sensitive to this code that does this.
First time we hit it (a while ago) we discovered that mtsdr1 was used
(even though a no-op)
> JS20 has been running
> that code with a hypervisor since a long time back.
970s consider this a no-op (I believe an expensive one) especially
when you consider some of the synchronization issues around the mtspr
HIDx.
And though this is 970 specific code, Cell and future processors,
will no longer allow writing to to these registers if !(MSR[0]=1 &&
MSR[PR]=0)
-JX
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Don't access HID registers if running on a Hypervisor.
2006-06-22 10:58 ` Jimi Xenidis
@ 2006-06-22 12:09 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 8+ messages in thread
From: Benjamin Herrenschmidt @ 2006-06-22 12:09 UTC (permalink / raw)
To: Jimi Xenidis; +Cc: Olof Johansson, linuxppc-dev
On Thu, 2006-06-22 at 06:58 -0400, Jimi Xenidis wrote:
> 970s consider this a no-op (I believe an expensive one) especially
> when you consider some of the synchronization issues around the mtspr
> HIDx.
> And though this is 970 specific code, Cell and future processors,
> will no longer allow writing to to these registers if !(MSR[0]=1 &&
> MSR[PR]=0)
Fair enough, let's fix it.
Ben.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Don't access HID registers if running on a Hypervisor.
2006-06-22 2:35 ` Jimi Xenidis
@ 2006-06-22 16:23 ` Olof Johansson
2006-06-22 17:22 ` Jimi Xenidis
0 siblings, 1 reply; 8+ messages in thread
From: Olof Johansson @ 2006-06-22 16:23 UTC (permalink / raw)
To: Jimi Xenidis; +Cc: linuxppc-dev, Paul Mackerras
On Wed, Jun 21, 2006 at 10:35:28PM -0400, Jimi Xenidis wrote:
>
> On Jun 21, 2006, at 7:58 PM, Paul Mackerras wrote:
>
> > Jimi Xenidis writes:
> >
> >> The following patch avoids accessing Hypervisor privilege HID
> >> registers when running on a Hypervisor (MSR[HV]=0).
> >
> > Why? Aren't the writes defined to be no-ops when not in hypervisor
> > mode?
>
> The write are no-ops but look at the instructions required to be
> around the write for some of them.
> I believe read may have performance issues as well.
Are you aware that this code runs only once per processor during
boot (and/or during cpu hotplug)? A few extra cycles there won't kill
anyone.
That being said, not touching the registers makes sense, but I don't buy
the performance motivation. :-)
> I juts think its good practice and as Xell and newer processes come
> along we may want to start using the PACA(?) rather then peeking at
> the msr all the time.
PACA means it's a mfspr + dependent load + test instead of mfmsr + mask,
right? It'd need benchmarking on several processors to show if it's
better or not.
-Olof
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Don't access HID registers if running on a Hypervisor.
2006-06-22 16:23 ` Olof Johansson
@ 2006-06-22 17:22 ` Jimi Xenidis
0 siblings, 0 replies; 8+ messages in thread
From: Jimi Xenidis @ 2006-06-22 17:22 UTC (permalink / raw)
To: Olof Johansson; +Cc: linuxppc-dev, Paul Mackerras
On Jun 22, 2006, at 12:23 PM, Olof Johansson wrote:
>
> Are you aware that this code runs only once per processor during
> boot (and/or during cpu hotplug)? A few extra cycles there won't kill
> anyone.
Hey, I never said it was a hot path, only that it had performance
issues.
I agree about the a "few extra cycles"
> That being said, not touching the registers makes sense, but I
> don't buy
> the performance motivation. :-)
>
>> I juts think its good practice and as Xell and newer processes come
>> along we may want to start using the PACA(?) rather then peeking at
>> the msr all the time.
>
> PACA means it's a mfspr + dependent load + test instead of mfmsr +
> mask,
> right? It'd need benchmarking on several processors to show if it's
> better or not.
>
>
> -Olof
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-06-22 17:23 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-21 23:15 [PATCH] Don't access HID registers if running on a Hypervisor Jimi Xenidis
2006-06-21 23:51 ` Olof Johansson
2006-06-22 10:58 ` Jimi Xenidis
2006-06-22 12:09 ` Benjamin Herrenschmidt
2006-06-21 23:58 ` Paul Mackerras
2006-06-22 2:35 ` Jimi Xenidis
2006-06-22 16:23 ` Olof Johansson
2006-06-22 17:22 ` Jimi Xenidis
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).