kernel race conditions / device driver question

From: Guido Viehoff (viehoff@xmailer.cs.uni-bonn.de)
Date: Sun Mar 26 2000 - 07:43:52 EST


Hello,

fellow student and myself implemented a "Bandwidth Manager (BM)" in
2.2.10 kernel by replacing ip_output by BM.
BM collects incoming amount of bytes and some other statistics and
limits bytes forwarded to ip_output. (Fellow student is using linux
QoS and tc tool from Alexey Kuznetosv to limit outgoing packets.)
Calculation of limits is done in user space, communication by module
device driver.
It runs, but crashes soon (some seconds up to max. some minutes)
with segmentation fault, reboot or freeze.
We use a 100ms timer in kernel to forward queued skb packets, update
send statistics. We did't consider race conditions among BM timer
(possibble deleting unused queues), device driver (delete queues or
read them) and BM handling packets before queue/send them.

1) Can we use set_bit/clear_bit for BM data structures access control?
   (Can I tell device driver just to wait for access? What about BM
   getting new packet to send, waiting possible? (can another packet
   to send arrive while waiting for set_bit and mange to set it ?)

2) Device driver gets an ioctl (Type: 0x54, DIR: 0, NR: 1, Size:0)
   every time reading/writing. Found 'T' in ioctl-number.txt for
   ioctl, is this for open device (_IOC_DIR = 0, no matter if read
   or write to device)? If calling device-ioctl from user, we get
   theright ioctl_cmd in kernel.

3) Found some "kmem_grow: Called nonatomically from int - size-32"
   in /var/log/messages? Are we doing something nasty using
   ourr = (struct ring*) kmalloc(sizeof(struct ring), GFP_KERNEL); ?

I'd greatly appreciate hints and help

Guido

-
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 : Fri Mar 31 2000 - 21:00:17 EST