Previously the use of fpu_ctx relied on the callers to only have one
outstanding crypto operation per session, this was violated by IPsec..
This means that the same fpu_ctx could be in use by multiple threads
at the same time... We now have a fpu context per CPU and aquire a
mutex for the current cpu... As we lock the mutex, this can safely
handle thread migration to another cpu after the lock is aquired..
Details
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Except the pause() thing, the patch looks good.
sys/crypto/aesni/aesni.c | ||
---|---|---|
142 ↗ | (On Diff #6756) | This line should not be committed. |
154 ↗ | (On Diff #6756) | sizeof(*ctx_mtx) is both style-required and easier to read. |
161 ↗ | (On Diff #6756) | Note that top (and ddb etc) only has 5 symbols for the wchan. |
201 ↗ | (On Diff #6756) | What is this ? |
499 ↗ | (On Diff #6756) | Spaces should be put around '|'. |
sys/crypto/aesni/aesni.c | ||
---|---|---|
509 ↗ | (On Diff #6756) | You jump into an if block? Do you have to do this this way? |
Apart the pause its OK.
sys/crypto/aesni/aesni.c | ||
---|---|---|
201 ↗ | (On Diff #6756) | Yeah the pause is really wierd here i did the same comment on offline review. |
sys/crypto/aesni/aesni.c | ||
---|---|---|
154 ↗ | (On Diff #6756) | I prefer to do without, and I have good style reasons to do so. You cannot do sizeof type, it will generate a compile error... The lack of parens shows to me that I am using a variable which, IMO, is the correct usage, and denotes in my head if I see parens to examine the statement more closely that the size may not match the variable, and I have to go upto the variable declaration to validate it... |
161 ↗ | (On Diff #6756) | well, 6 it looks like.. should I shorted aesni to ani? |
201 ↗ | (On Diff #6756) | The issue laid out: This should be fixed in the crypto framework, the ability to lock out new sessions with a _drain routine... The routine simply aquires the CRYPTO_DRIVER lock, and releases it, ensuring that all code is out of _newsession. I'll work on that next. |
509 ↗ | (On Diff #6756) | I could do the ugly: 508 But then the pattern of if(!kt) would be broken to match with the above... also, I'm jumping from one if (!kt) block to another if (!kt) block, so IMO less bad, and keeps the code more logical/uniform.. |
the pause has been removed in rS285297, it was unneeded because another lock by the crypto driver prevented it. I have also documented this in the man page.