All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: "Stoidner, Christoph" <c.stoidner@arvero.de>,
	"xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai] Using Preempt RT with I-Pipe/Xenomai
Date: Mon, 26 May 2014 13:08:05 +0200	[thread overview]
Message-ID: <53832095.10901@xenomai.org> (raw)
In-Reply-To: <6b0caf4dfe7d407988717a23fb855097@EX132MBOX1B.de2.local>

On 05/25/2014 09:59 PM, Stoidner, Christoph wrote:
> Hi at all,
>
> I need some sort of real time behaviour in secondary domain, so I am trying to merge Preempt RT patch with I-Pipe/Xenomai. Since Preempt RT as well as I-Pipe doing some specific changes to kernel's spinlock handling (mostly in  "include/linux/spinlock.h") this becomes a bit of tricky. The challenge seems to combine Preemp RT's "rt_spin_lock" with I-Pipe's "ipipe_spinlock".
>
> My first approach was to instrument I-Pipe's "PICK_SPINLOCK" macros with Preempt RT's "rt_spin_lock" calls. In detail that means I have added calls of rt_spin_lock to all PICK_SPINLOCK macros for each spinlock type  that is not an I-Pipe spinlock. However I am not sure if that is the best solution and if it is correct for all situations.
>
> Has someone experiences how to merge these spinlocks or what to consider at all when using Preempt RT with I-Pipe/Xenomai?
>

Fixing up ipipe_lock.h to switch the regular locks (i.e. neither 
ipipe/raw) to the sleeping rt_ spinlock variant is pretty much all you 
should have to do these days.

My last experience merging I-pipe+preempt-rt dates back to kernel 2.6.x, 
so a few more conflicts might have popped up since then though. This 
said, I did not see any showstopper in recent kernels that would prevent 
such combo from working.

e.g.:

+#ifdef PREEMPT_RT
+ #define __regular_spin_lock_irqsave(lock, flags)		\
+	do { rt_spin_lock(std_spinlock(lock)); flags = 0; } while (0) /* can't 
discard flags */
+#else
+#define __regular_spin_lock_irqsave(lock, flags)		\
+	__real_raw_spin_lock_irqsave(&std_spinlock(lock)->rlock, flags)
+#endif

#define PICK_SPINLOCK_IRQSAVE(lock, flags)				\
	do {								\
		if (ipipe_spinlock_p(lock))				\
			(flags) = __ipipe_spin_lock_irqsave(ipipe_spinlock(lock)); \
		else if (std_spinlock_raw_p(lock))				\
			__real_raw_spin_lock_irqsave(std_spinlock_raw(lock), flags); \
		else if (std_spinlock_p(lock))				\
-			__real_raw_spin_lock_irqsave(&std_spinlock(lock)->rlock, flags); \
+			__regular_spin_lock_irqsave(lock, flags); \
		else __bad_lock_type();					\
	} while (0)

and so on for all other helpers defining a preempt-rt specific variant.

-- 
Philippe.


  reply	other threads:[~2014-05-26 11:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-25 19:59 [Xenomai] Using Preempt RT with I-Pipe/Xenomai Stoidner, Christoph
2014-05-26 11:08 ` Philippe Gerum [this message]
2014-05-26 14:11   ` Stoidner, Christoph
2015-10-27  5:43   ` Vasudev Kamath
2015-10-27  6:16     ` Vasudev Kamath
2015-10-27 11:07       ` Vasudev Kamath

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=53832095.10901@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=c.stoidner@arvero.de \
    --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.