All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Paul Janzen <pcj@xenomai.sez.to>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] real-time guarantee issues on xenomai 2.6.2.1
Date: Tue, 09 Sep 2014 23:05:33 +0200	[thread overview]
Message-ID: <540F6B9D.3020109@xenomai.org> (raw)
In-Reply-To: <oq38d2ncql.fsf@merlin.sez.to>

On 08/11/2014 07:43 PM, Paul Janzen wrote:
> Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> 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.


  reply	other threads:[~2014-09-09 21:05 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AE39D2A4-ECC3-481B-AF3B-8A67FA23D2BF@tuebingen.mpg.de>
     [not found] ` <44BE6908-E639-421F-B556-E7B3871402CF@gmail.com>
2014-08-07 16:57   ` [Xenomai] real-time guarantee issues on xenomai 2.6.2.1 Alexander Herzog
2014-08-07 17:22     ` Gilles Chanteperdrix
2014-08-07 18:25       ` Philippe Gerum
2014-08-07 18:28         ` Gilles Chanteperdrix
2014-08-07 18:45           ` Philippe Gerum
2014-08-07 18:47       ` Paul Janzen
2014-08-07 19:01         ` Philippe Gerum
2014-08-07 19:16           ` Ludovic Righetti
2014-08-07 19:26             ` Philippe Gerum
2014-08-07 19:35               ` Ludovic Righetti
2014-08-07 19:44                 ` Philippe Gerum
2014-08-07 19:56                   ` Gilles Chanteperdrix
2014-08-08  6:59                     ` Philippe Gerum
2014-08-08 12:05                       ` Gilles Chanteperdrix
2014-08-07 20:47                   ` Ludovic Righetti
2014-08-08  7:15                     ` Philippe Gerum
2014-08-08 17:21                       ` Paul Janzen
2014-08-08 17:25                         ` Philippe Gerum
2014-08-08 18:27                           ` Paul Janzen
2014-08-10 15:56                             ` Gilles Chanteperdrix
2014-08-11 16:54                               ` Paul Janzen
2014-08-11 17:25                                 ` Gilles Chanteperdrix
2014-08-11 17:43                                   ` Paul Janzen
2014-09-09 21:05                                     ` Gilles Chanteperdrix [this message]
2014-09-10 17:12                                       ` Nicholas Rotella
2014-08-11 23:25                       ` Ludovic Righetti
2014-08-07 19:26         ` Gilles Chanteperdrix
2014-03-04 19:55 Alexander Herzog
2014-03-05  8:02 ` Gilles Chanteperdrix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=540F6B9D.3020109@xenomai.org \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=pcj@xenomai.sez.to \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.