This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ECOS] RE : [ECOS] Is JFFS2 thread-safe?


On Fri, 2003-11-28 at 11:14 +0000, David Woodhouse wrote:
> On Thu, 2003-11-27 at 10:15 +0100, Vincent Catros wrote:
> > If I understand, JFFS2 should be thread safe, but this has never been
> > tested since multual access is avoided by fileio layer when using
> > CYG_SYNCMODE_FILE_FILESYSTEM flag?
> 
> It's never been tested under eCos, although the same JFFS2-internal
> locking is well-tested under Linux.
> 
> If there are bugs, they are with the mapping from Linux locking
> primitives to eCos locking primitives. In particular, in the presence of
> preemptive scheduling I suspect that the spin_lock() primitive should be
> getting a scheduler lock. 

Index: compat/linux//current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/compat/linux/current/ChangeLog,v
retrieving revision 1.5
diff -u -p -r1.5 ChangeLog
--- compat/linux//current/ChangeLog	20 Nov 2003 08:24:58 -0000	1.5
+++ compat/linux//current/ChangeLog	28 Nov 2003 11:25:13 -0000
@@ -1,3 +1,8 @@
+2003-11-28  David Woodhouse  <dwmw2@infradead.org>
+
+	* include/linux/spinlock.h: Spinlocks should prevent preemption
+	if CYGPKG_KERNEL.
+	
 2003-11-12  Thomas Koeller <thomas.koeller@baslerweb.com>
 
         * cdl/linux.cdl:
Index: compat/linux//current/include/linux/spinlock.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/compat/linux/current/include/linux/spinlock.h,v
retrieving revision 1.1
diff -u -p -r1.1 spinlock.h
--- compat/linux//current/include/linux/spinlock.h	22 Jan 2003 01:10:41 -0000	1.1
+++ compat/linux//current/include/linux/spinlock.h	28 Nov 2003 11:25:13 -0000
@@ -1,13 +1,23 @@
 #ifndef __LINUX_SPINLOCK_H__
 #define __LINUX_SPINLOCK_H__
 
+#include <pkgconf/system.h>
 
 typedef struct { } spinlock_t;
 #define SPIN_LOCK_UNLOCKED (spinlock_t) { }
 #define spin_lock_init(lock) do{} while (0)
+
+#ifdef CYGPKG_KERNEL
+#include <cyg/kernel/kapi.h>
+#define spin_lock(lock) cyg_scheduler_lock()
+#define spin_unlock(lock) cyg_scheduler_unlock()
+#define spin_lock_bh(lock) cyg_scheduler_lock()
+#define spin_unlock_bh(lock) cyg_scheduler_unlock()
+#else
 #define spin_lock(lock) do{} while (0)
 #define spin_unlock(lock) do{} while (0)
 #define spin_lock_bh(lock) do{} while (0)
 #define spin_unlock_bh(lock) do{} while (0)
+#endif
 
 #endif /* __LINUX_SPINLOCK_H__ */


-- 
dwmw2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]