From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <540F6B9D.3020109@xenomai.org> Date: Tue, 09 Sep 2014 23:05:33 +0200 From: Gilles Chanteperdrix MIME-Version: 1.0 References: <44BE6908-E639-421F-B556-E7B3871402CF@gmail.com> <67B7E374-C4D2-4F83-BA40-B289B15867B9@tuebingen.mpg.de> <53E3B5E3.3090006@xenomai.org> <53E3CD23.5040909@xenomai.org> <53E3D084.2000506@tuebingen.mpg.de> <53E3D2FF.5000407@xenomai.org> <53E3D50D.7060701@tuebingen.mpg.de> <53E3D712.3070801@xenomai.org> <53E47905.5070402@xenomai.org> <53E5081C.8050807@xenomai.org> <53E7964B.6080200@xenomai.org> <53E8FC9C.90508@xenomai.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Xenomai] real-time guarantee issues on xenomai 2.6.2.1 List-Id: Discussions about the Xenomai project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paul Janzen Cc: xenomai@xenomai.org On 08/11/2014 07:43 PM, Paul Janzen wrote: > Gilles Chanteperdrix writes: > >> What about combining the 2, like: >> >> } else { >> xnarch_memory_barrier(); >> cpu_relax(); >> } > > No, this does not help either. Could you try the following patch? diff --git a/include/asm-generic/bits/pod.h b/include/asm-generic/bits/pod.h index a6be0dc..cfb0c71 100644 --- a/include/asm-generic/bits/pod.h +++ b/include/asm-generic/bits/pod.h @@ -248,6 +248,7 @@ void __xnlock_spin(xnlock_t *lock /*, */ XNLOCK_DBG_CONTEXT_ARGS) cpu_relax(); xnlock_dbg_spinning(lock, cpu, &spin_limit /*, */ XNLOCK_DBG_PASS_CONTEXT); + xnarch_memory_barrier(); } while(atomic_read(&lock->owner) != ~0); } EXPORT_SYMBOL_GPL(__xnlock_spin); diff --git a/include/asm-generic/system.h b/include/asm-generic/system.h index 25bd83f..7a8c4d0 100644 --- a/include/asm-generic/system.h +++ b/include/asm-generic/system.h @@ -378,6 +378,8 @@ static inline void xnlock_put(xnlock_t *lock) xnarch_memory_barrier(); atomic_set(&lock->owner, ~0); + + xnarch_memory_barrier(); } static inline spl_t diff --git a/ksrc/nucleus/vfile.c b/ksrc/nucleus/vfile.c index c8e0363..066c12f 100644 --- a/ksrc/nucleus/vfile.c +++ b/ksrc/nucleus/vfile.c @@ -279,6 +279,15 @@ redo: data += vfile->datasz; it->nrdata++; } +#ifdef CONFIG_SMP + { + /* Leave some time for other cpus to get the lock */ + xnticks_t wakeup = xnarch_get_cpu_tsc(); + wakeup += xnarch_ns_to_tsc(1000); + while ((xnsticks_t)(xnarch_get_cpu_tsc() - wakeup) < 0) + cpu_relax(); + } +#endif } if (ret < 0) { -- Gilles.