2

Hi,

I have a driver code which is supposed to work on certain packets received on the interface.The driver uses spin_lock_irqsave to manage parallel such requests before giving it to the hardware.

To work on the packet, it requires some context information provided by a kernel module which I am writing. There could be multiple context information managed using a hlist protected by rcu. Now, when the packet arrives this module should look up for the context information using packet signature inside rcu_read_lock() and then give the packet and the found context to the driver.

Now, I have read that the kernel thread/module should not block/sleep inside rcu_read_lock(), how should I manage this.

Any help is appreciated?

CodeQ
  • 319
  • 1
  • 3
  • 13
  • 2
    It is OK to use spinlocks inside RCU read-side sections. Mutexes and other "speepable" stuff are not allowed, of course. This is similar to the rules for interrupt handlers, etc. – Eugene Mar 18 '14 at 08:31
  • is it because, spin lock will not sleep and spin until the lock is available? – CodeQ Mar 18 '14 at 10:03
  • 1
    AFAIK, yes. It will not yield the current CPU to any other task. – Eugene Mar 18 '14 at 12:54

0 Answers0