[dahdi-commits] sruffell: linux/trunk r6572 - in /linux/trunk/drivers/dahdi: voicebus/ wctdm2...

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Thu May 7 14:42:03 CDT 2009


Author: sruffell
Date: Thu May  7 14:42:00 2009
New Revision: 6572

URL: http://svn.asterisk.org/svn-view/dahdi?view=rev&rev=6572
Log:
voicebus: Create workqueue for each vpmadt032 instance.

Depending on the system latency, the deferred work for the vpmadt032 can take
up to 200ms.  This change allows each vpmadt032 to use its own workqueue, and
not the global system workqueue.  This prevents vpm operations from blocking
the main system workqueue for extended periods.

This restores the behavior to the way it was before the common vpmadt032 code
was moved out of the wctdm24xxp and wcte12xp drivers.

DAHDI-260

voicebus-squash:  Adding the wq name.

Modified:
    linux/trunk/drivers/dahdi/voicebus/GpakCust.c
    linux/trunk/drivers/dahdi/voicebus/GpakCust.h
    linux/trunk/drivers/dahdi/wctdm24xxp/base.c
    linux/trunk/drivers/dahdi/wcte12xp/base.c

Modified: linux/trunk/drivers/dahdi/voicebus/GpakCust.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/trunk/drivers/dahdi/voicebus/GpakCust.c?view=diff&rev=6572&r1=6571&r2=6572
==============================================================================
--- linux/trunk/drivers/dahdi/voicebus/GpakCust.c (original)
+++ linux/trunk/drivers/dahdi/voicebus/GpakCust.c Thu May  7 14:42:00 2009
@@ -340,7 +340,7 @@
 		 * parameters to a work queue so the caller can continue to
 		 * proceed with setting up the call.
 		 */
-		schedule_work(&vpm->work);
+		queue_work(vpm->wq, &vpm->work);
 	}
 }
 int vpmadt032_echocan_create(struct vpmadt032 *vpm, int channo,
@@ -381,15 +381,26 @@
 }
 EXPORT_SYMBOL(vpmadt032_echocan_free);
 
-struct vpmadt032 *vpmadt032_alloc(struct vpmadt032_options *options)
+struct vpmadt032 *
+vpmadt032_alloc(struct vpmadt032_options *options, const char *board_name)
 {
 	struct vpmadt032 *vpm;
 	int i;
+	const char *suffix = "-vpm";
+	size_t length;
+
 	might_sleep();
 
-	vpm = kzalloc(sizeof(*vpm), GFP_KERNEL);
-	if (!vpm)
+	length = strlen(board_name) + strlen(suffix) + 1;
+
+	/* Add a little extra to store the wq_name. */
+	vpm = kzalloc(sizeof(*vpm) + length, GFP_KERNEL);
+	if (!vpm) {
 		return NULL;
+	}
+
+	strcpy(vpm->wq_name, board_name);
+	strcat(vpm->wq_name, suffix);
 
 	/* Init our vpmadt032 struct */
 	memcpy(&vpm->options, options, sizeof(*options));
@@ -401,6 +412,16 @@
 	vpm->curpage = 0x80;
 	vpm->dspid = -1;
 
+	/* Do not use the global workqueue for processing these events.  Some of
+	 * the operations can take 100s of ms, most of that time spent sleeping.
+	 * On single CPU systems, this unduly serializes operations accross
+	 * multiple vpmadt032 instances. */
+	vpm->wq = create_singlethread_workqueue(vpm->wq_name);
+	if (!vpm->wq) {
+		kfree(vpm);
+		return NULL;
+	}
+
 	/* Place this structure in the ifaces array so that the DspId from the
 	 * Gpak Library can be used to locate it. */
 	write_lock(&ifacelock);
@@ -434,6 +455,8 @@
 	gpakPingDspStat_t pingstatus;
 
 	BUG_ON(!vpm->setchanconfig_from_state);
+	BUG_ON(!vpm->wq);
+
 	might_sleep();
 
 	if (vpm->options.debug & DEBUG_ECHOCAN)
@@ -530,6 +553,9 @@
 	LIST_HEAD(local_list);
 
 	BUG_ON(!vpm);
+	BUG_ON(!vpm->wq);
+
+	destroy_workqueue(vpm->wq);
 
 	/* Move all the commands onto the local list protected by the locks */
 	spin_lock_irqsave(&vpm->list_lock, flags);

Modified: linux/trunk/drivers/dahdi/voicebus/GpakCust.h
URL: http://svn.asterisk.org/svn-view/dahdi/linux/trunk/drivers/dahdi/voicebus/GpakCust.h?view=diff&rev=6572&r1=6571&r2=6572
==============================================================================
--- linux/trunk/drivers/dahdi/voicebus/GpakCust.h (original)
+++ linux/trunk/drivers/dahdi/voicebus/GpakCust.h Thu May  7 14:42:00 2009
@@ -107,6 +107,7 @@
 	void *context;
 	const struct dahdi_span *span;
 	struct work_struct work;
+	struct workqueue_struct *wq;
 	int dspid;
 	struct semaphore sem;
 	unsigned long control;
@@ -124,6 +125,8 @@
 	unsigned char curtone[MAX_CHANNELS_PER_SPAN];
 	struct vpmadt032_options options;
 	void (*setchanconfig_from_state)(struct vpmadt032 *vpm, int channel, struct GpakChannelConfig *chanconfig);
+	/* This must be last */
+	char wq_name[0];
 };
 
 struct voicebus;
@@ -134,7 +137,8 @@
 
 char vpmadt032tone_to_zaptone(GpakToneCodes_t tone);
 int vpmadt032_init(struct vpmadt032 *vpm, struct voicebus *vb);
-struct vpmadt032 *vpmadt032_alloc(struct vpmadt032_options *options);
+struct vpmadt032 *vpmadt032_alloc(struct vpmadt032_options *options,
+					const char *board_name);
 void vpmadt032_free(struct vpmadt032 *vpm);
 int vpmadt032_echocan_create(struct vpmadt032 *vpm, int channo,
 	struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p);

Modified: linux/trunk/drivers/dahdi/wctdm24xxp/base.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/trunk/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=6572&r1=6571&r2=6572
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/base.c Thu May  7 14:42:00 2009
@@ -3597,9 +3597,10 @@
 		options.vpmnlpthresh = vpmnlpthresh;
 		options.vpmnlpmaxsupp = vpmnlpmaxsupp;
 
-		if (!(wc->vpmadt032=vpmadt032_alloc(&options))) {
+		wc->vpmadt032 = vpmadt032_alloc(&options, wc->board_name);
+		if (!wc->vpmadt032)
 			return -ENOMEM;
-		}
+
 		wc->vpmadt032->setchanconfig_from_state = setchanconfig_from_state;
 		wc->vpmadt032->context = wc;
 		wc->vpmadt032->span = &wc->span;

Modified: linux/trunk/drivers/dahdi/wcte12xp/base.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/trunk/drivers/dahdi/wcte12xp/base.c?view=diff&rev=6572&r1=6571&r2=6572
==============================================================================
--- linux/trunk/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/trunk/drivers/dahdi/wcte12xp/base.c Thu May  7 14:42:00 2009
@@ -1385,7 +1385,7 @@
 		options.vpmnlpthresh = vpmnlpthresh;
 		options.vpmnlpmaxsupp = vpmnlpmaxsupp;
 
-		wc->vpmadt032 = vpmadt032_alloc(&options);
+		wc->vpmadt032 = vpmadt032_alloc(&options, wc->name);
 		if (!wc->vpmadt032)
 			return -ENOMEM;
 




More information about the dahdi-commits mailing list