Skip to contentSkip to conversation

recent fixes in devel tree

DISCUSSION Paul Mackerras 3 participants 5 messages Sep 16, 2000 – Sep 19, 2000

lore
Share & tools
lore
#0 lore raw

I've been fixing a few things in the development kernel (2.4.0-test8) lately:

PCMCIA. I have fixed an endianness bug in the pcmcia/cardbus support in the kernel, and added some code to get the interrupt routing right on my 1999 G3 powerbook ("lombard"). I also fixed a bad bug that we had in our free_irq() implementation. I have been testing with a 3com combo ethernet/modem card which seems to work just fine now, although there does seem to be some sort of a problem on the initial card insertion still.

Machine checks on accesses to non-existent I/O ports on powermacs. I changed the definitions of inb/w/l and outb/w/l so that they use a sync instruction after the load or store, instead of eieio. If the location doesn't respond and we get a machine check, it should occur at the sync instruction and we then use the existing exception handling mechanism that we use for get_user/put_user etc. to recover and keep going. An inb/w/l to a non-existent port will return -1 rather than crashing the system as before.

As part of this I added code to sort the exception table. Because we have so many sections (pmac, prep, chrp, apus, etc. as well as the usual init section and the main text section) the exception table gets out of order and it is necessary to sort it so that the binary search works correctly.

Copy speedups using cache prefetching. I found that on the G4, using the dcbt instruction to prefetch data into the cache in the inner loop of copy_to/from_user and copy_page gives very substantial speedups. For example, `cat largefile >/dev/null' used to go at around 140MB/s on my 450MHz G4 cube (assuming largefile fits into memory) and now it goes at around 400MB/s. :-) Interestingly, dcbt makes no difference at all on the G3 machines I tried. I presume it is a no-op on the G3.

The fixes are in the linuxppc_2_3 bk tree and in my rsync tree at ppc.samba.org::linux-pmac-devel. Cort or I will send some patches to Linus soon and hopefully they will go in.

Paul.

--
Paul Mackerras, Senior Open Source Researcher, Linuxcare, Inc. +61 2 6262 8990 tel, +61 2 6262 8991 fax [email protected], http://www.linuxcare.com.au/
Linuxcare. Support for the revolution.

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

#1 lore raw

Paul Mackerras <[email protected]> writes:

[...]

Quoted 9 lines

Copy speedups using cache prefetching. I found that on the G4, using the dcbt instruction to prefetch data into the cache in the inner loop of copy_to/from_user and copy_page gives very substantial speedups. For example, `cat largefile >/dev/null' used to go at around 140MB/s on my 450MHz G4 cube (assuming largefile fits into memory) and now it goes at around 400MB/s. :-) Interestingly, dcbt makes no difference at all on the G3 machines I tried. I presume it is a no-op on the G3.

It shouldn't be a no-op on the G3, although the cache touch instructions can be "turned off" globally by a bit in some HID register.

There is one more quirk concerning memory bandwidth of the G4:
prefetching operations (both dcbt and dst) seem to be treated more favourably by the bus interface than fetches generated by actual load instructions, i.e. you get higher bandwidth by using cache touch instructions even if the code consists of an endless sequence of, say, vector loads, which should easily consume all available bandwidth on their own.

I assume that the G4 does use pipelined, split transactions on the MPX bus for prefetches, but not for actual loads. Maybe this is a tradeoff between latency and throughput, or maybe it is somehow related to a known bug in the G4's implementation of the MPX protocol (namely, the number of outstanding transactions must be limited to four or five, instead of the specified six).

Holger

P.S.: BTW, is there a general consensus wether or not AltiVec
enhancements in the kernel would be a good thing or too much hassle, or of interest for too few people, etc.? I don't think that the currently available patched gcc is reliable enough yet, but one day it might be.

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

#2 lore raw
Quoted 2 lines · Holger Bettag

P.S.: BTW, is there a general consensus wether or not AltiVec
enhancements in the kernel would be a good thing.....

What kind of enhancements? I do a fair amount of audio/video processing on my G4 with the current gcc/Altivec tools. I found only one minor bug in the exception handler that I fixed a while back.

We have been discussing some of the vector load/store/touch as both enhancements to the kernel and glibc. It is a little more challenging in the kernel because we would have to then keep some of the vector context around for the kernel, but in a very constrained case we could probably get some speed ups with that.

	-- Dan

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

#3 lore raw
Quoted 11 lines · Dan Malek
Quoted 2 lines · Holger Bettag

P.S.: BTW, is there a general consensus wether or not AltiVec
enhancements in the kernel would be a good thing.....

What kind of enhancements? I do a fair amount of audio/video processing on my G4 with the current gcc/Altivec tools. I found only one minor bug in the exception handler that I fixed a while back.

Quoted 6 lines

We have been discussing some of the vector load/store/touch as both enhancements to the kernel and glibc. It is a little more challenging in the kernel because we would have to then keep some of the vector context around for the kernel, but in a very constrained case we could probably get some speed ups with that.

I know too little about the kernel to suggest specific tunings. I thought along the lines you mention, inserting a 'data stream touch' here and there for improved bus utilization, occasional use of AltiVec code where it tends to speed things up a lot, like doing checksums for software RAIDs or other fast I/O channels. Maybe 'generic' video acceleration of the OpenFirmware framebuffer device, or something like that. (Maybe I/O en-/decryption, if such functionality ever ends up in the kernel.)

I mainly wanted to know wether there are efforts underway to make the use of AltiVec in the kernel a no-brainer (like: "just pass -fvec and use the AltiVec-'macros'!"), or wether it will be only for wizards at the bleeding edge.

Holger

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

#4 lore raw
Quoted 1 line · Holger Bettag

I know too little about the kernel to suggest specific tunings.

Suggestions always make people think......

Quoted 4 lines

.... I
thought along the lines you mention, inserting a 'data stream touch' here and there for improved bus utilization, occasional use of AltiVec code where it tends to speed things up a lot,

The data stream touch is maybe useful in some very specific places. I have written user level performance tests to see where it is beneficial, and you have to be careful. Yes, it can speed things up when all of the bits line up just right, but you can also screw up with it as well :-). Oh, I use it, but it isn't a quick and generic solution.

Quoted 3 lines

I mainly wanted to know wether there are efforts underway... .... or wether it will be only for wizards at
the bleeding edge.

Oh, there are a few. Bleeding edge is a good description, but wizard is more like 'wizzing' (perhaps into the wind :-) in some cases....

I'm working on several user applications (audio, video, MPEG, etc) that utilize Altivec, so I'm getting a pretty good idea how to tune data streams and caches. Some of this will probably find it's way into the C library (and has already in some of the MPEG libraries) for performance enhancement. The challenge in the kernel is making the Altivec context available for the kernel. The Altivec is faster, but it comes at a higher set-up cost that you also have to consider. We'll get some in there. It is definitely hardware that will get utilized more and more.

	-- Dan

--

I like MMUs because I don't have a real life.

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