You can never call the following routines while holding a spinlock, as they may sleep. This also means you need to be in user context.
Accesses to userspace:
copy_from_user()
copy_to_user()
get_user()
put_user()
kmalloc(GFP_KERNEL)
down_interruptible()
and
down()
There is a down_trylock()
which can be
used inside interrupt context, as it will not sleep.
up()
will also never sleep.
printk()
can be called in
any context, interestingly enough.