kernel_fpu_begin and spinlocks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

In order to do fast crypto, people like to use vector instructions,
which make use of the FPU registers. Typically things resemble this
pattern:

kernel_fpu_begin();
encrypt();
kernel_fpu_end();

If there are multiple things to encrypt, one pattern is:

for (thing) {
  kernel_fpu_begin();
  encrypt(thing);
  kernel_fpu_end();
}

But it turns out this is slow, so instead it's better to:

kernel_fpu_begin();
for (thing)
  encrypt(thing);
kernel_fpu_end();

However, what if that innerloop has some spinlocks?

kernel_fpu_begin();
for (thing) {
  encrypt(thing);
  spin_lock(queue_lock);
  add_to_queue(queue, thing);
  spin_unlock(queue_lock);
}
kernel_fpu_end();

On normal kernels, that's certainly okay. But on rt kernels, spinlocks
call schedule(), and kernel_fpu_begin() explicitly disables
preemption, so everything explodes.

I'm wondering if -rt has any ideas about not having a strict
preemption requirement for kernel_fpu_begin/end, so that the ordinary
pattern can work on -rt kernels without exploding.

Regards,
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux