This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Re: [ECOS] RE : [ECOS] Is JFFS2 thread-safe?
- From: David Woodhouse <dwmw2 at infradead dot org>
- To: Vincent Catros <Vincent dot Catros at elios-informatique dot fr>
- Cc: ecos-patches at sources dot redhat dot com
- Date: Fri, 28 Nov 2003 11:27:57 +0000
- Subject: Re: [ECOS] RE : [ECOS] Is JFFS2 thread-safe?
- References: <000001c3b4c7$023894e0$7407a8c0@figuier> <1070018075.10048.29.camel@hades.cambridge.redhat.com>
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