(Longhaul 1/5) PCI: Protect bus master DMA from Longhaul by rw semaphores
PATCH 1/1 (Longhaul 1/5) PCI: Protect bus master DMA from Longhaul by rw semaphores
Quoted 2 lines
You mean the longhaul driver can change the frequency of the PCI bus? Oh, that's a recipe for disaster...
No. Sorry. My English is bad. I mean changing CPU frequency.
Quoted 1 line
No, it's a hack :)
Again :-)
Quoted 3 lines
No, this is not acceptable. What exactly do you want to do here? Make sure the PCI drivers are not doing DMA when the longhaul driver wants to change the pci bus speed?
I'm trying not to break DMA. Current version of longhaul (marked broken in 2.6.16.2) simply clears bus master bit on every device.
Quoted 1 line
Does it really save battery?
Yes. And CPU temperature is lower.
Quoted 2 lines
And what about PCI devices that always do DMA? (think USB controllers, they can easily saturate the PCI bus all the time).
This is worst for SATA. USB (this is strange) seems to work correcly. I know that this is 10% coverage, but it is better then nothing. It is always possible to add support for longhaul to driver.
Quoted 2 lines
Why not just suspend all PCI devices make the bus change, and then resume them? That would require no PCI core, or driver changes.
This was my first idea. But trust me in current kernel this is simply worst idea.
Quoted 4 lines
greg k-h
Though currently in the driver, voltage scaling is missing,
so we never save any power, and just run at the maximum voltage the whole time.
I added this to longhaul, but it only works on non EBGA CPU's. EBGA CPU's (at least Nehemiah) seem to have voltage scaling disabled.
Quoted 5 lines
It needs there to be no bus mastering occuring at the time
of a CPU speed transition. Though I'm unable to find the part that mentions this in the specs I have right now.Dave
"Once this is set, the processor will switch to the
value in [26:23] on the next AUTOHALT transition. The duration of the AUTOHALT
should be >=1ms to ensure the CPU's internal PLL is resynchronized. For AUTOHALT, this means interrupts must be disabled except for the time tick, which should be reset to >=1ms. Care must be taken to avoid other system events that could interfere with this operation. A few examples are snooping, NMI, INIT, SMI and FLUSH."
For CPU's with Longhaul MSR this time is equal to 200us.
Rafał
----------------------------------------------------------------------
PS. Fajny portal... >>> http://link.interia.pl/f196a
Ar Mer, 2006-06-28 am 20:25 +0200, ysgrifennodd Rafał Bilski:
Quoted 4 lines
AUTOHALT, this means interrupts must be disabled except for the time tick, which should be reset to >=1ms. Care must be taken to avoid other system events that could interfere with this operation. A few examples are snooping, NMI, INIT, SMI and FLUSH."
"snooping". So we do need the cache sorting out.
Quoted 8 lines · Alan Cox
Ar Mer, 2006-06-28 am 20:25 +0200, ysgrifennodd Rafał Bilski:
Quoted 4 lines
AUTOHALT, this means interrupts must be disabled except for the time tick, which should be reset to >=1ms. Care must be taken to avoid other system events that could interfere with this operation. A few examples are snooping, NMI, INIT, SMI and FLUSH."
"snooping". So we do need the cache sorting out.
If I understand correctly, trouble occurs when the processor tries to snoop? Would disabling (via MSR) and flushing the caches before changing the frequency help in that case?
Groeten,
Bart
Signature · 1 line
Bart Hartgers - TUE Eindhoven - http://plasimo.phys.tue.nl/bart/contact/
Bart Hartgers napisał(a):
Quoted 9 lines
Quoted 7 lines · Alan Cox
Ar Mer, 2006-06-28 am 20:25 +0200, ysgrifennodd Rafał Bilski:
Quoted 4 lines
AUTOHALT, this means interrupts must be disabled except for the time tick, which should be reset to >=1ms. Care must be taken to avoid other system events that could interfere with this operation. A few examples are snooping, NMI, INIT, SMI and FLUSH."
"snooping". So we do need the cache sorting out.
Quoted 7 lines
If I understand correctly, trouble occurs when the processor tries to snoop? Would disabling (via MSR) and flushing the caches before changing the frequency help in that case?
Groeten,
Bart
I will check that. If this was so simple all this time... I hope this "few examples" aren't many more.
Rafał
----------------------------------------------------------------------
PS. Fajny portal... >>> http://link.interia.pl/f196a
PATCH 1/1 (Longhaul 1/5) PCI: Protect bus master DMA from Longhaul by rw semaphores
In reply to Bart HartgersQuoted 7 lines
If I understand correctly, trouble occurs when the processor tries to snoop? Would disabling (via MSR) and flushing the caches before changing the frequency help in that case?
Groeten,
Bart
CPU is VIA C3 in EBGA "Nehemiah" core 6.9.8.
I'm using flush_cache_all(). Is there anything more powerfull? I'm using MSR_VIA_FCR.
I can disable L2 cache (or at least I think so) - this doesn't help. I can't disable L1 cache - processor stops when I'm trying to set I-cache or D-cache disable bit.
Thanks
Rafał
----------------------------------------------------------------------
PS. Fajny portal... >>> http://link.interia.pl/f196a
Quoted 10 lines · Rafał Bilski
CPU is VIA C3 in EBGA "Nehemiah" core 6.9.8.
I'm usingflush_cache_all(). Is there anything more powerfull? I'm usingMSR_VIA_FCR.
I can disable L2 cache (or at least I think so) - this doesn't help. I can't disable L1 cache - processor stops when I'm trying to set I-cache or D-cache disable bit.Thanks
Rafał
Hi Rafał,
Any code to show? Just in case... ;-)
Groeten,
Bart
Signature · 1 line
Bart Hartgers - TUE Eindhoven - http://plasimo.phys.tue.nl/bart/contact/
Quoted 7 lines
Hi Rafał,
Any code to show? Just in case... ;-)
Groeten,
Bart
I'm using this for L2 cache:
preempt_disable(); local_irq_save(flags); rdmsr(MSR_VIA_FCR, lo, hi); flush_cache_all(); wrmsr(MSR_VIA_FCR, lo | 1 << 8, hi); and this doesn't stop the processor, but when I'm adding 1 << 13 or 1 << 14 CPU stops. I have tried flush_cache_all(); wrmsr(MSR_VIA_FCR, lo | 1 << 8, hi); flush_cache_all(); wrmsr(MSR_VIA_FCR, lo | 1 << 8 | 1 << 13, hi); and flush_cache_all(); wrmsr(MSR_VIA_FCR, lo | 1 << 8 | 1 << 13, hi);
and more, but result was always the same.
I will be very gratefull if You tell me what I'm doing wrong.
Rafał
----------------------------------------------------------------------
PS. Fajny portal... >>> http://link.interia.pl/f196a
Quoted 15 lines · Rafał Bilski
I'm using this for L2 cache:
preempt_disable(); local_irq_save(flags); rdmsr(MSR_VIA_FCR, lo, hi); flush_cache_all(); wrmsr(MSR_VIA_FCR, lo | 1 << 8, hi); and this doesn't stop the processor, but when I'm adding 1 << 13 or 1 << 14 CPU stops. I have tried flush_cache_all(); wrmsr(MSR_VIA_FCR, lo | 1 << 8, hi); flush_cache_all(); wrmsr(MSR_VIA_FCR, lo | 1 << 8 | 1 << 13, hi); and flush_cache_all(); wrmsr(MSR_VIA_FCR, lo | 1 << 8 | 1 << 13, hi);
Quoted 5 lines
and more, but result was always the same.
I will be very gratefull if You tell me what I'm doing wrong.
Rafał
Sorry, I have no idea. The code looks fine.
Signature · 1 line
Bart Hartgers - TUE Eindhoven - http://plasimo.phys.tue.nl/bart/contact/
Quoted 8 lines · Rafał Bilski
Quoted 7 lines
If I understand correctly, trouble occurs when the processor tries to snoop? Would disabling (via MSR) and flushing the caches before changing the frequency help in that case?
Groeten,
Bart
Quoted 6 lines
CPU is VIA C3 in EBGA "Nehemiah" core 6.9.8.
I'm usingflush_cache_all(). Is there anything more powerfull? I'm usingMSR_VIA_FCR.
I can disable L2 cache (or at least I think so) - this doesn't help. I can't disable L1 cache - processor stops when I'm trying to set I-cache or D-cache disable bit.
Maybe you need to do something with the cache bits in CR0 as well. It could be something like that. Hardware can be stuborn. I remember the old Winchips (C3 predecessors) hanging when trying to disable caching of plain ram via MCR's for instance.
Signature · 1 line
Bart Hartgers - TUE Eindhoven - http://plasimo.phys.tue.nl/bart/contact/
Ar Iau, 2006-06-29 am 17:16 +0200, ysgrifennodd Bart Hartgers:
Quoted 7 lines
Quoted 6 lines · Rafał Bilski
CPU is VIA C3 in EBGA "Nehemiah" core 6.9.8.
I'm usingflush_cache_all(). Is there anything more powerfull? I'm usingMSR_VIA_FCR.
I can disable L2 cache (or at least I think so) - this doesn't help. I can't disable L1 cache - processor stops when I'm trying to set I-cache or D-cache disable bit.
If you can flush any cached writes to RAM before you do the changeover and after you disabled interrupts then it ought to be sufficient to invalidate the cache just before re-enabling everything.
The reason I make that claim is that you know nobody will be DMAing over the pages of memory you use for the speed change itself. Might need a little care with the stack that is all.
Alan
Quoted 5 lines
Maybe you need to do something with the cache bits in CR0 as well. It could be something like that. Hardware can be stuborn. I remember the old Winchips (C3 predecessors) hanging when trying to disable caching of plain ram via MCR's for instance.
I did it like in chapter 10.5.3. Result is exacly the same - processor stops. If I set NW flag CPU is still going, but I have "exception in interrupt" message.
I'm starting thinking that this will not work for "Nehemiah" core.
Thanks
Rafał
----------------------------------------------------------------------
PS. Fajny portal... >>> http://link.interia.pl/f196a
Ar Iau, 2006-06-29 am 14:03 +0200, ysgrifennodd Bart Hartgers:
Quoted 6 lines
Quoted 2 lines
"snooping". So we do need the cache sorting out.
If I understand correctly, trouble occurs when the processor tries to snoop? Would disabling (via MSR) and flushing the caches before changing the frequency help in that case?
I would think so. Some other processors have similar requirements for deep sleeping.
Alan