Messages in this thread | | | Date | Wed, 29 Mar 2000 08:24:02 +0000 | From | Andrew Morton <> | Subject | Re: SMP with linux |
| |
"Kneemeyer, Ralf" wrote: > > Hi, > > can anyone give me some information what I'd have to do, > to make a linux device-driver SMP secure.
A networking driver, I assume?
I have not been able to find a magic answer to this either. I suggest you spend a few hours reading source in drivers/net/ - there are some inconsistencies in there so you will need to scan a number of them.
Read Documentation/spinlocks.txt, then read it again. Once you understand where it is safe to use spin_lock(), move on..
Go to http://jungla.dit.upm.es/~jmseyas/linux/kernel/hackers-docs.html and follow the "Network Buffers And Memory Management" link to Alan's skbuff tutorial.
Go to Rusty's place and read the Kernel Locking HOWTO: http://netfilter.kernelnotes.org/unreliable-guides/index.html
Read davem's note about the new netcore<-> driver interface http://www.uwsg.indiana.edu/hypermail/linux/kernel/0002.1/0408.html
Read Jamal's doc on the same thing: http://www.uwsg.indiana.edu/hypermail/linux/kernel/0001.0/0229.html
> Can I use skbuffs ( and their functions ) in a SMP > environment ?
I've been wondering that :-)
The skbuff interface has two classes of function: those which manipulate lists of skbuffs and those which manipulate the internals of a single skbuff.
The list manipulation functions are safe to use within either process or interrupt context (I'd avoid using the __skb_* functions). But you probably won't need to use these.
The functions which manipulate skb internals are not race-protected wrt each other. You will be OK using these as long as your code is SMP-safe wrt itself and you don't violate the ownership rules: once you've passed a packet up through the netif layer you don't own it any more. Once you receive an skbuff from the higher layers you wholly own it (and must free it).
The netcore<->driver interface and Linux interrupt handling also provides some serialisation guarantees. Your hard_start_xmit() method won't be reentered. Your ISR won't be reentered.
> Are there some related documents in the web ? >
That's all I have.
-- -akpm-
- 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/
| |