Re: [PATCH resend 5/9] MIPS: sync after cacheflush

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Maciej W. Rozycki
Date: Saturday, October 23, 2010 - 10:12 pm

On Thu, 21 Oct 2010, Gleb O. Raiko wrote:


 OK, I hoped so, but just double-checked to be sure. :)


 When talking to MMIO you often don't need to force the outstanding writes 
to complete before you exit some driver's code.  They will eventually 
reach the device and to their things in due course.

 A notable exception are some kinds of side effects that need to be 
synchronised to prevent races.  For example to avoid wasting processing 
time for handling spurious interrupts you do want to make sure a write 
that acknowledges a pending interrupt has been recorded by the handler 
reaches the respective device's register before the interrupt has been 
cleared in the interrupt controller.

 On the other hand you do not need to issue a writeback of a request for 
the device to look for more data in the outgoing DMA descriptor ring.


 Ah, framebuffers.  The DEC Alpha people somehow managed to get them 
right. :)  What you say is of course true for a dumb framebuffer -- but 
who cares about dumb framebuffers these days?

 A half-decent graphics controller will provide a set of typical masked 
raster operations: STORE, AND, OR, XOR, etc. so that you don't have to 
issue RMW cycles to framebuffer's memory -- all you need are bulk writes, 
where the order does not really matter and which can be pipelined (the 
graphics controller may be able to replicate writes too, such as across 
the whole scanline -- good for the bandwidth!).

 You may still have to issue some barriers around accesses to 
framebuffer's control registers, but that's about it.  And the TGA X11 
driver undobtedly gets these things right or otherwise nobody could have 
used it and the adapters it supports with an Alpha (as a side note: that 
graphics chip/software applies to MIPS-based DECstation systems too).  
This is all early 1990s' technology, no rocket science anymore. :)

 There's a technical report on the techniques used somewhere on the web -- 
look for "Smart Frame Buffer" (and don't forget to check its date ;) ).

 In general: don't break the CPU because you've got a broken piece of 
software -- fix the piece instead!

 I stand by my choice -- inefficiency from unnecessary (implicit) ordering 
barriers accumulates.  These operations are so slow (with latencies 
possibly counted in hundreds of CPU cycles) it really matters whether you 
need ten or just one, especially with the speeds of contemporary 
processors.

  Maciej
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 2/9] MIPS: Add BMIPS processor types to Kconfig, Kevin Cernekee, (Sat Oct 16, 2:22 pm)
[PATCH 3/9] MIPS: Add BMIPS CP0 register definitions, Kevin Cernekee, (Sat Oct 16, 2:22 pm)
[PATCH 4/9] MIPS: Install handlers for software IRQs, Kevin Cernekee, (Sat Oct 16, 2:22 pm)
[PATCH resend 5/9] MIPS: sync after cacheflush, Kevin Cernekee, (Sat Oct 16, 2:22 pm)
[PATCH v2 resend 7/9] MIPS: Move FIXADDR_TOP into spaces.h, Kevin Cernekee, (Sat Oct 16, 2:22 pm)
[PATCH resend 8/9] MIPS: Honor L2 bypass bit, Kevin Cernekee, (Sat Oct 16, 2:22 pm)
Re: [PATCH 2/9] MIPS: Add BMIPS processor types to Kconfig, Florian Fainelli, (Sun Oct 17, 10:01 am)
Re: [PATCH resend 5/9] MIPS: sync after cacheflush, Shinya Kuribayashi, (Mon Oct 18, 6:44 am)
Re: [PATCH resend 5/9] MIPS: sync after cacheflush, Kevin Cernekee, (Mon Oct 18, 11:34 am)
Re: [PATCH resend 5/9] MIPS: sync after cacheflush, Ralf Baechle, (Mon Oct 18, 12:19 pm)
Re: [PATCH resend 5/9] MIPS: sync after cacheflush, Kevin Cernekee, (Mon Oct 18, 12:41 pm)
Re: [PATCH resend 5/9] MIPS: sync after cacheflush, Ralf Baechle, (Mon Oct 18, 3:50 pm)
Re: [PATCH resend 5/9] MIPS: sync after cacheflush, Shinya Kuribayashi, (Mon Oct 18, 5:03 pm)
Re: [PATCH resend 5/9] MIPS: sync after cacheflush, Maciej W. Rozycki, (Mon Oct 18, 5:45 pm)
Re: [PATCH resend 5/9] MIPS: sync after cacheflush, Kevin Cernekee, (Mon Oct 18, 5:51 pm)
Re: [PATCH resend 5/9] MIPS: sync after cacheflush, Maciej W. Rozycki, (Mon Oct 18, 5:57 pm)
Re: [PATCH resend 5/9] MIPS: sync after cacheflush, Gleb O. Raiko, (Tue Oct 19, 1:54 am)
Re: [PATCH resend 5/9] MIPS: sync after cacheflush, Ralf Baechle, (Tue Oct 19, 2:17 am)
Re: [PATCH resend 5/9] MIPS: sync after cacheflush, Gleb O. Raiko, (Tue Oct 19, 3:15 am)
Re: [PATCH resend 5/9] MIPS: sync after cacheflush, Ralf Baechle, (Tue Oct 19, 5:34 am)
Re: [PATCH resend 5/9] MIPS: sync after cacheflush, Shinya Kuribayashi, (Tue Oct 19, 6:30 am)
Re: [PATCH resend 8/9] MIPS: Honor L2 bypass bit, Ralf Baechle, (Tue Oct 19, 9:16 am)
Re: [PATCH resend 5/9] MIPS: sync after cacheflush, Maciej W. Rozycki, (Tue Oct 19, 1:11 pm)
Re: [PATCH 3/9] MIPS: Add BMIPS CP0 register definitions, Ralf Baechle, (Wed Oct 20, 12:23 am)
Re: [PATCH resend 5/9] MIPS: sync after cacheflush, Gleb O. Raiko, (Wed Oct 20, 1:05 am)
Re: [PATCH resend 5/9] MIPS: sync after cacheflush, Maciej W. Rozycki, (Wed Oct 20, 10:26 am)
Re: [PATCH resend 5/9] MIPS: sync after cacheflush, Gleb O. Raiko, (Thu Oct 21, 1:52 am)
Re: [PATCH resend 5/9] MIPS: sync after cacheflush, Maciej W. Rozycki, (Sat Oct 23, 10:12 pm)