From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: matt@genesi-usa.com
Cc: 'linuxppc-dev list' <linuxppc-dev@ozlabs.org>,
'Paul Mackerras' <paulus@samba.org>
Subject: RE: AltiVec in the kernel
Date: Tue, 18 Jul 2006 14:39:13 -0400 [thread overview]
Message-ID: <1153247953.5905.63.camel@localhost.localdomain> (raw)
In-Reply-To: <005701c6aa7c$632a48e0$99dfdfdf@bakuhatsu.net>
> I don't think people investigate it too much because the first
> thing they hit is lack of documentation, and then "well we don't
> really recommend it". I think this makes Linux the worst OS a
> developer would want to run on a G4 and G5, then? :D
It's not recommended for the same reason the FPU isn't used in the
kernel and x86 doesn't use SSE / MMX there neither except in a few
places where it does make sense like the RAID code. It's possible that
it might be interesting to do it for some of the crypto modules as well
and we certainly welcome any patch using altivec to improve some other
aspect of the kernel provided that it does indeed... improve
performances :)
Part of the problem is the cost of enabling/disabling it and
saving/restoring the vector registers that get clobbered when using it.
Essentially, the kernel entry only saves and restores GPRs. Not FPRs,
not VRs. This is done to keep the cost of kernel entry low. Which means
that at any given point in time, the altivec and FPU units contain
whatever context last used by userland. If the kernel wants to use it
for it's own, in thus needs to flush that context to the thread struct
(which also means that the unit will be disabled on the way back to
userland and re-faulted in when used again). That's what
enable_kernel_altivec() does (and the similar enable_kernel_fp()). This
cannot happen at interrupt time though and you shouldn't be holding
locks thus it may be a problem with some of the crypto stuffs as I think
they can be used in some weird code path. It's also important that no
scheduling happen until you are done with the unit, which is why you
have to disable preemption, since otherwise, the unit could be re-used
by userland behind your back.
Another alternative which can work at interrupt time, but requires a bit
of assembly hackery, is to manually enable MSR:VEC (if not already set)
and save and restore all the altivec registers modified by the code.
Ben.
next prev parent reply other threads:[~2006-07-18 18:39 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-18 12:48 AltiVec in the kernel Matt Sealey
2006-07-18 13:53 ` Kumar Gala
2006-07-18 15:10 ` Matt Sealey
2006-07-18 17:56 ` Paul Mackerras
2006-07-19 18:10 ` Linas Vepstas
2006-07-19 18:19 ` Paul Mackerras
2006-07-19 18:38 ` Johannes Berg
2006-07-19 18:57 ` Linas Vepstas
2006-07-20 12:31 ` Matt Sealey
2006-07-20 13:23 ` Kumar Gala
2006-07-20 13:33 ` Matt Sealey
2006-07-20 17:42 ` Linas Vepstas
2006-07-20 18:47 ` Brian D. Carlstrom
2006-07-20 19:05 ` Olof Johansson
2006-07-20 21:56 ` Brian D. Carlstrom
2006-07-20 22:39 ` Daniel Ostrow
2006-07-21 6:35 ` Olof Johansson
2006-07-21 14:42 ` Matt Sealey
2006-07-21 16:51 ` Linas Vepstas
2006-07-21 18:08 ` Matt Sealey
2006-07-22 3:09 ` Segher Boessenkool
2006-07-23 13:28 ` Matt Sealey
2006-07-23 21:37 ` Benjamin Herrenschmidt
2006-07-21 18:46 ` Brian D. Carlstrom
2006-07-21 21:30 ` Hollis Blanchard
2006-07-21 22:21 ` Peter Bergner
2006-07-18 18:39 ` Benjamin Herrenschmidt [this message]
2006-07-18 17:43 ` Paul Mackerras
-- strict thread matches above, loose matches on Subject: below --
2009-12-11 11:45 Simon Richter
2009-12-11 15:49 ` Arnd Bergmann
2009-12-16 22:11 ` Sebastian Andrzej Siewior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1153247953.5905.63.camel@localhost.localdomain \
--to=benh@kernel.crashing.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=matt@genesi-usa.com \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).