mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2.6] serialization of kernelcapi work
@ 2004-03-18 10:53 Armin Schindler
  2004-03-18 20:18 ` Andrew Morton
  0 siblings, 1 reply; 8+ messages in thread
From: Armin Schindler @ 2004-03-18 10:53 UTC (permalink / raw)
  To: Linux Kernel Mailinglist; +Cc: Linus Torvalds, Andrew Morten

Hi all,

the ISDN kernelcapi function recv_handler() is triggered by
schedule_work() and dispatches the CAPI messages to the applications.

Since a workqueue function may run on another CPU at the same time,
reordering of CAPI messages may occur.

For serialization I suggest a mutex semaphore in recv_handler(),
patch is appended (yet untested).

Is there a better way to do user-context work serialized ?

Armin


--- linux/drivers/isdn/capi/kcapi.c	16 Mar 2004 08:01:47 -0000
+++ linux/drivers/isdn/capi/kcapi.c	18 Mar 2004 10:41:38 -0000
@@ -70,6 +70,7 @@
 static struct sk_buff_head recv_queue;

 static struct work_struct tq_recv_notify;
+static DECLARE_MUTEX(recv_handler_lock);

 /* -------- controller ref counting -------------------------------------- */

@@ -242,6 +243,8 @@
 	struct sk_buff *skb;
 	struct capi20_appl *ap;

+	down(&recv_handler_lock);
+
 	while ((skb = skb_dequeue(&recv_queue)) != 0) {
 		ap = get_capi_appl_by_nr(CAPIMSG_APPID(skb->data));
 		if (!ap) {
@@ -257,6 +260,8 @@
 			ap->nrecvctlpkt++;
 		ap->recv_message(ap, skb);
 	}
+
+	up(&recv_handler_lock);
 }

 void capi_ctr_handle_message(struct capi_ctr * card, u16 appl, struct sk_buff *skb)



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-03-20 22:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-18 10:53 [PATCH 2.6] serialization of kernelcapi work Armin Schindler
2004-03-18 20:18 ` Andrew Morton
2004-03-18 20:37   ` Armin Schindler
2004-03-20 10:53   ` Armin Schindler
2004-03-20 19:14     ` Andrew Morton
2004-03-20 20:15       ` Armin Schindler
2004-03-20 21:05         ` Andrew Morton
2004-03-20 22:20           ` Armin Schindler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®