All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: Philippe Gerum <rpm@xenomai.org>
Cc: xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] [PATCH] hal: Ensure atomicity of rthal_local_irq_disabled
Date: Tue, 10 Nov 2009 12:33:04 +0100	[thread overview]
Message-ID: <4AF94F70.9060602@domain.hid> (raw)
In-Reply-To: <1257850543.2210.494.camel@domain.hid>

Philippe Gerum wrote:
> On Tue, 2009-11-10 at 11:43 +0100, Jan Kiszka wrote:
[...]
>> Oh, *_hw_smp is new, isn't it? Do we need to wrap it for older I-pipes?
> 
> Yes, it was introduced to solve the SMP migration issue actually, so we
> need a wrapper. The advantage of having that wrapper instead of going
> for inlined #ifdef CONFIG_SMP is that I could simply get rid of that
> wrapper in 3.x, since all legacy pipeline patches would be deprecated
> there anyway.

Something like this, or where to put the wrapper?

Jan

---

diff --git a/include/asm-generic/hal.h b/include/asm-generic/hal.h
index 97c549e..a8bc5ec 100644
--- a/include/asm-generic/hal.h
+++ b/include/asm-generic/hal.h
@@ -117,7 +117,14 @@ typedef spinlock_t rthal_spinlock_t;
 #endif /* !CONFIG_XENO_OPT_PIPELINE_HEAD */
 #define rthal_local_irq_flags(x)	((x) = ipipe_test_pipeline_from(&rthal_domain) & 1)
 #define rthal_local_irq_test()		ipipe_test_pipeline_from(&rthal_domain)
-#define rthal_local_irq_disabled()	ipipe_test_pipeline_from(&rthal_domain)
+#define rthal_local_irq_disabled()				\
+({								\
+	unsigned long __flags, __ret;				\
+	local_irq_save_hw_smp(__flags);				\
+	__ret = ipipe_test_pipeline_from(&rthal_domain);	\
+	local_irq_restore_hw_smp(__flags);			\
+	__ret;							\
+})
 #define rthal_stage_irq_enable(dom)	ipipe_unstall_pipeline_from(dom)
 #define rthal_local_irq_save_hw(x)	local_irq_save_hw(x)
 #define rthal_local_irq_restore_hw(x)	local_irq_restore_hw(x)
diff --git a/include/asm-generic/wrappers.h b/include/asm-generic/wrappers.h
index 1cfd60c..c175ea4 100644
--- a/include/asm-generic/wrappers.h
+++ b/include/asm-generic/wrappers.h
@@ -555,4 +555,16 @@ static inline void wrap_proc_dir_entry_owner(struct proc_dir_entry *entry)
 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) */
 #endif /* CONFIG_PROC_FS */
 
+#include <linux/ipipe.h>
+
+#ifndef local_irq_save_hw_smp
+#ifdef CONFIG_SMP
+#define local_irq_save_hw_smp(flags)	local_irq_save_hw(flags)
+#define local_irq_restore_hw_smp(flags)	local_irq_restore_hw(flags)
+#else /* !CONFIG_SMP */
+#define local_irq_save_hw_smp(flags)	do { (void)(flags); } while (0)
+#define local_irq_restore_hw_smp(flags)	do { } while (0)
+#endif /* !CONFIG_SMP */
+#endif /* !local_irq_save_hw_smp */
+
 #endif /* _XENO_ASM_GENERIC_WRAPPERS_H */



  reply	other threads:[~2009-11-10 11:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-09 23:35 [Xenomai-core] [PATCH] hal: Ensure atomicity of rthal_local_irq_disabled Jan Kiszka
2009-11-10  0:34 ` Gilles Chanteperdrix
2009-11-10  7:54   ` Jan Kiszka
2009-11-10 10:28   ` Philippe Gerum
2009-11-10 10:37     ` Philippe Gerum
2009-11-10 10:43     ` Jan Kiszka
2009-11-10 10:55       ` Philippe Gerum
2009-11-10 11:33         ` Jan Kiszka [this message]
2009-11-10 13:26           ` Philippe Gerum
2009-11-10 13:31             ` Jan Kiszka

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=4AF94F70.9060602@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=rpm@xenomai.org \
    --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.