linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Re: Fwd: Re: still no accelerated X ($#!$*)
@ 2000-01-21 13:53 Kevin_Hendricks
  0 siblings, 0 replies; 29+ messages in thread
From: Kevin_Hendricks @ 2000-01-21 13:53 UTC (permalink / raw)
  To: bh40, paubert; +Cc: khendricks, linuxppc-dev


Hi,

>> Another thing to take care of is PCI write posting: Basically, when you
>> write, let's say, a MMIO register, you are not guaranteed that this write
>> have actually been done unless you do a read from the same io space. For
>> example: If you write an interrupt mask register to disable an interrupt
>> followed by critical code in which this interrupt _must not_ happen, you
>> need absolutely to do a read (typically to re-read the mask you just
>> wrote to) after the write, and before the critical code.
>
>In this case, I think that you need the following:
>
>- write,
>- eieio,
>- read,
>- isync to make sure that the read has reached the registers and is not in
>a load pending queue or whatever which can be quite deep especially if the
>processor does never need the result of the read...


Okay, please let me be specific here to make sure I understand.

In fixing the xf3.9.17 code in the r128 module, there is a routine that

1. reads from an MMIO register to get the current value of the hardware cursor
enable bit

2. writes to that same MMIO register to turn off the hardware cursor

3. copies an new image for the cursor into framebuffer memory

4. reloads the MMIO register to put back the original value for the hardware
cursor enable bit.


There are no eieios or isyncs anywhere in the current implementation.  The
problem is that sometimes that hardware cursor flashes garabage as if the
hardware cursor disable was never done.

So from what I have read here, I should rewrite this routine to look as follows:


1. read the current value of the MMIO register for the hardware cursor enable

2. write to that same register to disable tha hardware cursor

3. eieio

4. read back in from the hardware cursor enable register to make sure a PCI
write post has been done  (does this need to be in a loop?)

5. isync

6. write the new cursor image into framebuffer memory with no eieios to allow
for burst writing

7. eieio (to make sure the complete image had been written)

8. write back to the MMIO register to put back its original value

9. eieio

10.  read the current value from the MMIO register to make sure the write post
was done properly

11. isync



This seems like extreme overkill.

Am I simply misunderstanding this PCI write post thing and the need for eieio
and isync?

I really thought I only needed an sync or isync when I was reading from value
(say a semaphore or spin lock) and wanted to make sure absolutely *no*
pre-fetches or other accesses happened in the code or datastructures protected
by the spinlock or semaphore.

I always though all other forms of access on PPC did enforce in order of
completion (i.e. allowed pre-fetching of operands, data, etc) but that a write
to memory really would complete before any later read or write to any location
which came from a later instruction.

If that is true, then you only need eieio or sync/isync when you are writing a
value that somehow will impact other later accesses and you need to be sure it
is complete before the later accesses do any pre-fetching of data.

Am I messed up here?  I really thought I understood this but now I am very
unsure.

Thanks,

Kevin


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 29+ messages in thread
* Re: Fwd: Re: still no accelerated X ($#!$*)
@ 2000-01-21 20:25 jlquinn
  2000-01-23 13:06 ` Gabriel Paubert
  0 siblings, 1 reply; 29+ messages in thread
From: jlquinn @ 2000-01-21 20:25 UTC (permalink / raw)
  To: Gabriel Paubert; +Cc: linuxppc-dev


Can you list some of these efficiency issues?  In case anybody wants to
tackle them.

In fact, it would be interesting to have a page of potential ppc-related
kernel projects (others as well) that people could refer to if they're
looking for something to do.  Is there such a page already?  If not, I'd be
willing to assemble one.  However I don't have a place to host it.

Thanks,
Jerry Quinn
jlquinn@us.ibm.com


Gabriel Paubert <paubert@iram.es>@lists.linuxppc.org on 01/21/2000 02:08:30
PM
[snip]
I remember, but my goal is a memory-clobber-free kernel, although there
are many other efficiency issues right now in Linux/PPC...

     Gabriel
     (desperately trying to build gcc_latest_snapshot)


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 29+ messages in thread
* Re: Fwd: Re: still no accelerated X ($#!$*)
@ 2000-01-21 17:32 David Edelsohn
  0 siblings, 0 replies; 29+ messages in thread
From: David Edelsohn @ 2000-01-21 17:32 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: khendricks


asm volatile ("stwbrx %1,%2,%3; eieio"
	: "=m" (*(volatile unsigned *)(base_addr+regindex))
	: "r" (regdata), "b" (regindex), "r" (base_addr));

asm volatile ("lwbrx %0,%1,%2; eieio"
	: "=r"(val)
	: "b"(regindex), "r"(base_addr),
	  "m" (*(volatile unsigned *)(base_addr+regindex)));

BTW, one of the main stylistic points which confused me yesterday is that
the inlined assembly statement associates variable "regindex" with the
second parameter of the instruction and varable "base_addr" with the third
parameter of the instruction.  As long as the second parameter is not
assigned to register r0, the two are commucative in their function, so
this is not an error.

	In the instruction architecture, the second parameter is intended
to be the base and the third as the index, so it is confusing for someone
familiar with the POWER and PowerPC instruction set to read the order in
which the parameters are assigned.  Instructions loading from addresses
with displacements, e.g.,

	lwz %0,%1(%2)

specify the displacement second and the base register last, so the
ordering can get confused.  That was what threw me off yesterday in my
haste.

David
===============================================================================
David Edelsohn                                      T.J. Watson Research Center
dje@watson.ibm.com                                  P.O. Box 218
+1 914 945 4364 (TL 862)                            Yorktown Heights, NY 10598

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 29+ messages in thread
[parent not found: <200001211355.NAA05477@granada.iram.es>]
[parent not found: <Message from Kevin Hendricks <khendricks@ivey.uwo.ca>]

end of thread, other threads:[~2000-01-23 13:06 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-01-21 13:53 Fwd: Re: still no accelerated X ($#!$*) Kevin_Hendricks
  -- strict thread matches above, loose matches on Subject: below --
2000-01-21 20:25 jlquinn
2000-01-23 13:06 ` Gabriel Paubert
2000-01-21 17:32 David Edelsohn
     [not found] <200001211355.NAA05477@granada.iram.es>
2000-01-21 15:13 ` Gabriel Paubert
2000-01-21 15:29   ` Benjamin Herrenschmidt
     [not found] <Message from Kevin Hendricks <khendricks@ivey.uwo.ca>
2000-01-20 18:12 ` Kevin Hendricks
2000-01-20 18:26   ` David Edelsohn
2000-01-20 18:45     ` Benjamin Herrenschmidt
2000-01-20 18:51       ` David Edelsohn
2000-01-20 18:52     ` Franz Sirl
2000-01-20 19:31       ` Gabriel Paubert
2000-01-20 19:36         ` Kevin Hendricks
2000-01-20 19:51           ` Geert Uytterhoeven
2000-01-20 19:59           ` Gabriel Paubert
2000-01-20 20:08             ` David Edelsohn
2000-01-20 22:34             ` Franz Sirl
2000-01-21  0:05               ` Gabriel Paubert
2000-01-21  0:35                 ` Kevin Hendricks
2000-01-21  1:53                   ` Gabriel Paubert
2000-01-21  2:19                     ` Kevin Hendricks
2000-01-21  7:58                       ` Geert Uytterhoeven
2000-01-21 14:15                       ` Benjamin Herrenschmidt
2000-01-21 11:54                   ` Benjamin Herrenschmidt
2000-01-21 13:34                     ` Gabriel Paubert
2000-01-21 14:06                       ` Benjamin Herrenschmidt
2000-01-21 15:47                 ` Franz Sirl
2000-01-21 19:08                   ` Gabriel Paubert
2000-01-20 18:46   ` Franz Sirl

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).