[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081031202824.GA32720@ioremap.net>
Date: Fri, 31 Oct 2008 23:28:24 +0300
From: Evgeniy Polyakov <zbr@...emap.net>
To: "Lovich, Vitali" <vlovich@...lcomm.com>
Cc: Johann Baudy <johaahn@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH] Packet socket: mmapped IO: PACKET_TX_RING
On Fri, Oct 31, 2008 at 10:07:58AM -0700, Lovich, Vitali (vlovich@...lcomm.com) wrote:
> > > Also, you've got a potential threading issue - you're not protecting
> > > the frame index behind the spinlock.
> >
> > You are right, I think I will spin-lock outside the do_while loop.
> Can't do that I think - dev_queue_xmit sleeps AFAIK and you can't hold a spinlock when you sleep.
It does not and can be called from interrupt context, but interrupts
have to be turned on, since BH will be reenabled there.
>Can you explain why you need a spinlock though? I think you're trying to make it thread-safe if multiple threads make calls to send, correct? In this case, just change it to a semaphore, and protect the entire send call (well - at least in a safe enough way to make sure you're properly unlocking upon exit). Also, a better question is - is there any particular reason we need to support multiple threads calling send? Just stipulate that the behaviour is undefined when there are calls to send from different threads.
If there will be no synchronization you should very carefully call
udnerlying functions not to race against each other. For example
device queue should be locked.
--
Evgeniy Polyakov
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists