Skip to contentSkip to conversation

AltiVec in the kernel

DISCUSSION Simon Richter 3 participants 3 messages Dec 11, 2009 – Dec 16, 2009

lore
Share & tools
lore
#0 lore raw

Hi,

since there has been a thread on allowing the use of a coprocessor in the kernel already: I am wondering if it'd make sense to use AltiVec for AES in dm-crypt, and how difficult it would be to implement that.

I'm using a PegasosII which has a G4 running at 1 GHz; I get around 3 MB/s throughput when accessing harddisks. I think that could be improved.

If I understand correctly, the actual encryption work runs in a kernel thread, which is scheduled normally, so it ought to be possible to enable AltiVec for that thread; am I missing something here?

Simon

#1 lore raw
Quoted 6 lines · Simon Richter

Hi,

since there has been a thread on allowing the use of a coprocessor in the kernel already: I am wondering if it'd make sense to use AltiVec for AES in dm-crypt, and how difficult it would be to implement that.

Quoted 7 lines

I'm using a PegasosII which has a G4 running at 1 GHz; I get around 3 MB/s throughput when accessing harddisks. I think that could be improved.

If I understand correctly, the actual encryption work runs in a kernel thread, which is scheduled normally, so it ought to be possible to enable AltiVec for that thread; am I missing something here?

Sebastian Siewior has implemented this some time ago:

http://old.nabble.com/-RFC-0-3--Experiments-with-AES-AltiVec,-part-2-tc10034255.html

You can try the old patches on your machine to see if they are any good there.

	Arnd <><
#2 lore raw
Quoted 7 lines · * Arnd Bergmann | 2009-12-11 16:49:25 [+0100]:
Quoted 6 lines · Simon Richter

Hi,

since there has been a thread on allowing the use of a coprocessor in the kernel already: I am wondering if it'd make sense to use AltiVec for AES in dm-crypt, and how difficult it would be to implement that.

Quoted 7 lines
Quoted 7 lines

I'm using a PegasosII which has a G4 running at 1 GHz; I get around 3 MB/s throughput when accessing harddisks. I think that could be improved.

If I understand correctly, the actual encryption work runs in a kernel thread, which is scheduled normally, so it ought to be possible to enable AltiVec for that thread; am I missing something here?

dm-crypt is async these days so the patches Arnd mentioned could be used actually :) I've never tested them with dm-crypt but it should work. Back then I had around 20MiB/sec encryption and around 15 MiB/sec for decryption on 4KiB page on a PS3 [0]. This was pure testing, no subsystem was involved. dm-crypt will feed multiple 512 byte requests. And according [1] 512 bytes are aren't slow :) However [2] says that that AltiVec was always slower than the generic implementation. Maybe PS3's AltiVec unit was slower than the average one because everyone was focuesed on the SPUs. Maybe not and you get similar results.

Quoted 6 lines

Sebastian Siewior has implemented this some time ago:

http://old.nabble.com/-RFC-0-3--Experiments-with-AES-AltiVec,-part-2-tc10034255.html

You can try the old patches on your machine to see if they are any good there.

Ah you remember :)

[0] http://diploma-thesis.siewior.net/html/diplomarbeitch4.html#x12-46002r2
[1] http://diploma-thesis.siewior.net/html/diplomarbeitch4.html#x12-46004r4
[2] http://diploma-thesis.siewior.net/html/diplomarbeitch4.html#x12-47017r5

Quoted 2 lines
	Arnd <><

Sebastian