Jake Gibbons
2003-05-24 23:01:05 UTC
Thanks Scott. The files you sent did it. Wish now works fine with both my
openMosix 2.4.20 machines.
----- Begin x10_core.c diff
--- x10_core.c 2003-05-22 09:43:49.000000000 -0400
+++ ../new/x10_core.c 2003-05-24 18:28:37.000000000 -0400
@@ -1,7 +1,7 @@
/*
*
- * $Id: x10_core.c,v 1.40 2003/05/22 13:43:10 whiles Exp $
+ * $Id: x10_core.c,v 1.40 2003/05/22 13:43:10 whiles Exp whiles $
*
* Copyright (c) 2002 Scott Hiles
*
@@ -102,7 +102,7 @@
MODULE_PARM_DESC(control_major, "Major character device for communicating
with raw x10 transceiver (default=121)");
#endif //CONFIG_DEVFS_FS
-#define DRIVER_VERSION "$Id: x10_core.c,v 1.40 2003/05/22 13:43:10 whiles
Exp $"
+#define DRIVER_VERSION "$Id: x10_core.c,v 1.40 2003/05/22 13:43:10 whiles
Exp whiles $"
char *core_version=DRIVER_VERSION;
extern char *ldisc_version;
extern char *xcvr_version;
@@ -1296,7 +1296,8 @@
ret = -1;
break;
} // end of switch statement
- wake_up_interruptible(&x10io->statuschanged);
+ if (waitqueue_active(&x10io->statuschanged))
+ wake_up_interruptible(&x10io->statuschanged);
if (x10io->async_queue)
kill_fasync(&x10io->async_queue,SIGIO,POLL_IN);
} // end of if (fc >= 0)
@@ -1339,7 +1340,8 @@
x10io->log.data[x10io->log.end].fc = fc;
do_gettimeofday(&x10io->log.data[x10io->log.end].tv);
spin_unlock(&log_spinlock);
- wake_up_interruptible(&x10io->logchanged);
+ if (waitqueue_active(&x10io->logchanged))
+ wake_up_interruptible(&x10io->logchanged);
}
// copy the data from the log to the user buffer up to a max of len
@@ -1401,7 +1403,8 @@
for (j = 0; j < MAX_UNITS; j++)
updatestatus(hc,j,getstatus(hc,j,0),1);
spin_unlock(&spinlock_edata);
- wake_up_interruptible(&x10io->statuschanged);
+ if (waitqueue_active(&x10io->statuschanged))
+ wake_up_interruptible(&x10io->statuschanged);
}
// copy the data from the extended data to the user buffer up to a max of
len
----- End x10_core.c diff
----- Begin x10_xcvr_cm11a.c diff
--- x10_xcvr_cm11a.c 2003-02-10 14:34:39.000000000 -0500
+++ ../new/x10_xcvr_cm11a.c 2003-05-24 18:28:43.000000000 -0400
@@ -1,7 +1,7 @@
/*
*
- * $Id: x10_xcvr_cm11a.c,v 1.15 2003/02/10 19:34:23 whiles Exp $
+ * $Id: x10_xcvr_cm11a.c,v 1.15 2003/02/10 19:34:23 whiles Exp whiles $
*
* Copyright (c) 2002 Scott Hiles
*
@@ -78,7 +78,7 @@
#define DRIVER_DESC "Driver for HomeControl CM11A X10 Transciever"
#define DRIVER_AUTHOR "Scott Hiles - ***@sprintmail.com"
#define DRIVER_DEVICE "x10_cm11a"
-#define DRIVER_VERSION "$Id: x10_xcvr_cm11a.c,v 1.15 2003/02/10 19:34:23
whiles Exp $"
+#define DRIVER_VERSION "$Id: x10_xcvr_cm11a.c,v 1.15 2003/02/10 19:34:23
whiles Exp whiles $"
char *xcvr_version=DRIVER_VERSION;
static wait_queue_head_t ack;
@@ -111,6 +111,9 @@
0x0d, 0x0e, 0x0f, 0x09
};
+spinlock_t spinlock_ackstatus;
+spinlock_t receive_spinlock;
+
/* these are the required device dependent functions */
static void xcvr_receive(struct x10io_dev *dev, unsigned char c,
unsigned int flags);
@@ -132,6 +135,8 @@
int __init xcvr_init(void)
{
+ spin_lock_init(&spinlock_ackstatus);
+ spin_lock_init(&receive_spinlock);
xcvr.fakereceive = fakereceive;
x10io_register_device(&xcvr);
return 0;
@@ -282,12 +287,17 @@
static int updateresponse(unsigned char c)
{
- if (cm11a_response != 0xff) // we are not waiting for a response
+ spin_lock(&spinlock_ackstatus);
+ if (cm11a_response != 0xff){ // we are not waiting for a response
+ spin_unlock(&spinlock_ackstatus);
return 0;
+ }
dbg("received 0x%x",c);
cm11a_response = c;
ackstatus = 1;
- wake_up_interruptible(&ack);
+ if (waitqueue_active(&ack))
+ wake_up_interruptible(&ack);
+ spin_unlock(&spinlock_ackstatus);
return 1;
}
@@ -316,7 +326,6 @@
// we just ignore them for now, but we hve to read for them to avoid
confusing
// the decoder. Just receive the bytes and dump for now.
static int receivemacro = 0;
-spinlock_t receive_spinlock;
static void xcvr_receive(struct x10io_dev *dev,unsigned char c,unsigned int
flags)
{
----- End x10_xcvr_cm11a.c diff
_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
openMosix 2.4.20 machines.
Jake,
While I was waiting for my development system to finish disk checking I ran
through the cm11a stuff and added spinlocks to try to protect the SMP
entrancy
issues. Replace the files in your 1.6.3 code and recompile.
It has a high chance of behaving just the same as it did earlier so be
prepared for your system to crash. I am programming blind when it comes to
SMP machines. I don't have one to test on myself. I tested this out on my
development machine under 2.4.21-rc3 and it works just fine.
Scott
This did it.While I was waiting for my development system to finish disk checking I ran
through the cm11a stuff and added spinlocks to try to protect the SMP
entrancy
issues. Replace the files in your 1.6.3 code and recompile.
It has a high chance of behaving just the same as it did earlier so be
prepared for your system to crash. I am programming blind when it comes to
SMP machines. I don't have one to test on myself. I tested this out on my
development machine under 2.4.21-rc3 and it works just fine.
Scott
----- Begin x10_core.c diff
--- x10_core.c 2003-05-22 09:43:49.000000000 -0400
+++ ../new/x10_core.c 2003-05-24 18:28:37.000000000 -0400
@@ -1,7 +1,7 @@
/*
*
- * $Id: x10_core.c,v 1.40 2003/05/22 13:43:10 whiles Exp $
+ * $Id: x10_core.c,v 1.40 2003/05/22 13:43:10 whiles Exp whiles $
*
* Copyright (c) 2002 Scott Hiles
*
@@ -102,7 +102,7 @@
MODULE_PARM_DESC(control_major, "Major character device for communicating
with raw x10 transceiver (default=121)");
#endif //CONFIG_DEVFS_FS
-#define DRIVER_VERSION "$Id: x10_core.c,v 1.40 2003/05/22 13:43:10 whiles
Exp $"
+#define DRIVER_VERSION "$Id: x10_core.c,v 1.40 2003/05/22 13:43:10 whiles
Exp whiles $"
char *core_version=DRIVER_VERSION;
extern char *ldisc_version;
extern char *xcvr_version;
@@ -1296,7 +1296,8 @@
ret = -1;
break;
} // end of switch statement
- wake_up_interruptible(&x10io->statuschanged);
+ if (waitqueue_active(&x10io->statuschanged))
+ wake_up_interruptible(&x10io->statuschanged);
if (x10io->async_queue)
kill_fasync(&x10io->async_queue,SIGIO,POLL_IN);
} // end of if (fc >= 0)
@@ -1339,7 +1340,8 @@
x10io->log.data[x10io->log.end].fc = fc;
do_gettimeofday(&x10io->log.data[x10io->log.end].tv);
spin_unlock(&log_spinlock);
- wake_up_interruptible(&x10io->logchanged);
+ if (waitqueue_active(&x10io->logchanged))
+ wake_up_interruptible(&x10io->logchanged);
}
// copy the data from the log to the user buffer up to a max of len
@@ -1401,7 +1403,8 @@
for (j = 0; j < MAX_UNITS; j++)
updatestatus(hc,j,getstatus(hc,j,0),1);
spin_unlock(&spinlock_edata);
- wake_up_interruptible(&x10io->statuschanged);
+ if (waitqueue_active(&x10io->statuschanged))
+ wake_up_interruptible(&x10io->statuschanged);
}
// copy the data from the extended data to the user buffer up to a max of
len
----- End x10_core.c diff
----- Begin x10_xcvr_cm11a.c diff
--- x10_xcvr_cm11a.c 2003-02-10 14:34:39.000000000 -0500
+++ ../new/x10_xcvr_cm11a.c 2003-05-24 18:28:43.000000000 -0400
@@ -1,7 +1,7 @@
/*
*
- * $Id: x10_xcvr_cm11a.c,v 1.15 2003/02/10 19:34:23 whiles Exp $
+ * $Id: x10_xcvr_cm11a.c,v 1.15 2003/02/10 19:34:23 whiles Exp whiles $
*
* Copyright (c) 2002 Scott Hiles
*
@@ -78,7 +78,7 @@
#define DRIVER_DESC "Driver for HomeControl CM11A X10 Transciever"
#define DRIVER_AUTHOR "Scott Hiles - ***@sprintmail.com"
#define DRIVER_DEVICE "x10_cm11a"
-#define DRIVER_VERSION "$Id: x10_xcvr_cm11a.c,v 1.15 2003/02/10 19:34:23
whiles Exp $"
+#define DRIVER_VERSION "$Id: x10_xcvr_cm11a.c,v 1.15 2003/02/10 19:34:23
whiles Exp whiles $"
char *xcvr_version=DRIVER_VERSION;
static wait_queue_head_t ack;
@@ -111,6 +111,9 @@
0x0d, 0x0e, 0x0f, 0x09
};
+spinlock_t spinlock_ackstatus;
+spinlock_t receive_spinlock;
+
/* these are the required device dependent functions */
static void xcvr_receive(struct x10io_dev *dev, unsigned char c,
unsigned int flags);
@@ -132,6 +135,8 @@
int __init xcvr_init(void)
{
+ spin_lock_init(&spinlock_ackstatus);
+ spin_lock_init(&receive_spinlock);
xcvr.fakereceive = fakereceive;
x10io_register_device(&xcvr);
return 0;
@@ -282,12 +287,17 @@
static int updateresponse(unsigned char c)
{
- if (cm11a_response != 0xff) // we are not waiting for a response
+ spin_lock(&spinlock_ackstatus);
+ if (cm11a_response != 0xff){ // we are not waiting for a response
+ spin_unlock(&spinlock_ackstatus);
return 0;
+ }
dbg("received 0x%x",c);
cm11a_response = c;
ackstatus = 1;
- wake_up_interruptible(&ack);
+ if (waitqueue_active(&ack))
+ wake_up_interruptible(&ack);
+ spin_unlock(&spinlock_ackstatus);
return 1;
}
@@ -316,7 +326,6 @@
// we just ignore them for now, but we hve to read for them to avoid
confusing
// the decoder. Just receive the bytes and dump for now.
static int receivemacro = 0;
-spinlock_t receive_spinlock;
static void xcvr_receive(struct x10io_dev *dev,unsigned char c,unsigned int
flags)
{
----- End x10_xcvr_cm11a.c diff
_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail