question: spinlocks and userspace.

Tigran Aivazian (tigran@sco.COM)
Wed, 10 Nov 1999 08:59:01 +0000 (GMT)


Hi,

No, the question is not whether I can access userspace while holding a
spinlock :)

The question is, if I have a piece of code like this:

walk through some linked list {
for each element take a bit thereof and append to supplied user buf
}

If I wished to protect the linked list with a spinlock I need to redesign
the loop and the only way I can think of is to temporarily store those
elements in kernel buffer and then copy the lot to userspace. But as the
size of the acumulated buffers is not known in advance the whole thing is
not as trivial as it should be.

However, I know that you guys always come up with extremely brilliant
ideas nobody else can think of. Therefore, any suggestions for a better
design?

(in particular, I was thinking about qm_modules() that copies module->name
to user buffer one at a time and I wanted to protect module_list with a rw
spinlock, taking read_lock in this case).

Regards,
Tigran.

-
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/