Re: [Basics] spinlocks & copy_to_user

From: Alan Cox (alan@lxorguk.ukuu.org.uk)
Date: Tue Feb 08 2000 - 16:14:26 EST


> I need to copy information from a kernel memory buffer to a user memory
> buffer. copy_to_user() is the obvious answer. However, the kernel
> buffer can be modified at interrupt time (interrupt handler); to protect
> this, I'm using a spin_lock_irqsave(). But copy_to_user() can sleep.
> Correct me if I'm wrong, but access_ok() does not appear to worry about
> the possibility of a fault, just permissions.

Correct

> I could copy from the kernel buffer to another kernel buffer with irq's
> disabled, then copy_to_user() from the new buffer, but I was hoping to
> avoid the additional copy.

Is it possible to keep two buffers and modify one in the IRQ handler then
flip them with the user copies - ie is this a flow of data or a control
structure in a fixed format ?

Alan

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Feb 15 2000 - 21:00:14 EST