* [Xenomai-core] [PATCH] hal: Ensure atomicity of rthal_local_irq_disabled
@ 2009-11-09 23:35 Jan Kiszka
2009-11-10 0:34 ` Gilles Chanteperdrix
0 siblings, 1 reply; 10+ messages in thread
From: Jan Kiszka @ 2009-11-09 23:35 UTC (permalink / raw)
To: Philippe Gerum; +Cc: xenomai-core
[-- Attachment #1: Type: text/plain, Size: 1468 bytes --]
[Patch is now also available in 'for-upstream']
ipipe_test_pipeline_from is not atomic /wrt reading the current cpu
number (or an offset for the per-cpu area) and actually reading the
virtualized interrupt state. Work around this by disabling hard IRQs
while accessing this service.
This fixes false-positives of RTDM driver debug checks.
Signed-off-by: Jan Kiszka <jan.kiszka@domain.hid>
---
include/asm-generic/hal.h | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/include/asm-generic/hal.h b/include/asm-generic/hal.h
index 97c549e..3095b85 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(__flags); \
+ __ret = ipipe_test_pipeline_from(&rthal_domain); \
+ local_irq_restore_hw(__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)
--
1.6.0.2
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Xenomai-core] [PATCH] hal: Ensure atomicity of rthal_local_irq_disabled
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
0 siblings, 2 replies; 10+ messages in thread
From: Gilles Chanteperdrix @ 2009-11-10 0:34 UTC (permalink / raw)
To: Jan Kiszka; +Cc: xenomai-core
Jan Kiszka wrote:
> [Patch is now also available in 'for-upstream']
>
> ipipe_test_pipeline_from is not atomic /wrt reading the current cpu
> number (or an offset for the per-cpu area) and actually reading the
> virtualized interrupt state. Work around this by disabling hard IRQs
> while accessing this service.
>
> This fixes false-positives of RTDM driver debug checks.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@domain.hid>
> ---
> include/asm-generic/hal.h | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/include/asm-generic/hal.h b/include/asm-generic/hal.h
> index 97c549e..3095b85 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(__flags); \
> + __ret = ipipe_test_pipeline_from(&rthal_domain); \
> + local_irq_restore_hw(__flags); \
> + __ret; \
> +})
Maybe we can avoid that on UP systems?
--
Gilles.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Xenomai-core] [PATCH] hal: Ensure atomicity of rthal_local_irq_disabled
2009-11-10 0:34 ` Gilles Chanteperdrix
@ 2009-11-10 7:54 ` Jan Kiszka
2009-11-10 10:28 ` Philippe Gerum
1 sibling, 0 replies; 10+ messages in thread
From: Jan Kiszka @ 2009-11-10 7:54 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: xenomai-core
[-- Attachment #1: Type: text/plain, Size: 3042 bytes --]
Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
>> [Patch is now also available in 'for-upstream']
>>
>> ipipe_test_pipeline_from is not atomic /wrt reading the current cpu
>> number (or an offset for the per-cpu area) and actually reading the
>> virtualized interrupt state. Work around this by disabling hard IRQs
>> while accessing this service.
>>
>> This fixes false-positives of RTDM driver debug checks.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@domain.hid>
>> ---
>> include/asm-generic/hal.h | 9 ++++++++-
>> 1 files changed, 8 insertions(+), 1 deletions(-)
>>
>> diff --git a/include/asm-generic/hal.h b/include/asm-generic/hal.h
>> index 97c549e..3095b85 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(__flags); \
>> + __ret = ipipe_test_pipeline_from(&rthal_domain); \
>> + local_irq_restore_hw(__flags); \
>> + __ret; \
>> +})
>
> Maybe we can avoid that on UP systems?
>
Yep, update pushed.
Jan
---
[PATCH] hal: Ensure atomicity of rthal_local_irq_disabled
ipipe_test_pipeline_from is not atomic /wrt reading the current cpu
number (or an offset for the per-cpu area) and actually reading the
virtualized interrupt state. Work around this by disabling hard IRQs
while accessing this service.
This fixes false-positives of RTDM driver debug checks.
Signed-off-by: Jan Kiszka <jan.kiszka@domain.hid>
---
include/asm-generic/hal.h | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/include/asm-generic/hal.h b/include/asm-generic/hal.h
index 97c549e..9b5b058 100644
--- a/include/asm-generic/hal.h
+++ b/include/asm-generic/hal.h
@@ -117,7 +117,18 @@ 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)
+#ifdef CONFIG_SMP
+#define rthal_local_irq_disabled() \
+({ \
+ unsigned long __flags, __ret; \
+ local_irq_save_hw(__flags); \
+ __ret = ipipe_test_pipeline_from(&rthal_domain); \
+ local_irq_restore_hw(__flags); \
+ __ret; \
+})
+#else /* !CONFIG_SMP */
#define rthal_local_irq_disabled() ipipe_test_pipeline_from(&rthal_domain)
+#endif /* !CONFIG_SMP */
#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)
--
1.6.0.2
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Xenomai-core] [PATCH] hal: Ensure atomicity of rthal_local_irq_disabled
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
1 sibling, 2 replies; 10+ messages in thread
From: Philippe Gerum @ 2009-11-10 10:28 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: Jan Kiszka, xenomai-core
On Tue, 2009-11-10 at 01:34 +0100, Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
> > [Patch is now also available in 'for-upstream']
> >
> > ipipe_test_pipeline_from is not atomic /wrt reading the current cpu
> > number (or an offset for the per-cpu area) and actually reading the
> > virtualized interrupt state. Work around this by disabling hard IRQs
> > while accessing this service.
> >
> > This fixes false-positives of RTDM driver debug checks.
> >
> > Signed-off-by: Jan Kiszka <jan.kiszka@domain.hid>
> > ---
> > include/asm-generic/hal.h | 9 ++++++++-
> > 1 files changed, 8 insertions(+), 1 deletions(-)
> >
> > diff --git a/include/asm-generic/hal.h b/include/asm-generic/hal.h
> > index 97c549e..3095b85 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(__flags); \
> > + __ret = ipipe_test_pipeline_from(&rthal_domain); \
> > + local_irq_restore_hw(__flags); \
> > + __ret; \
> > +})
>
> Maybe we can avoid that on UP systems?
>
Yes, we should rather use local_irq_save/restore_hw_smp().
--
Philippe.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Xenomai-core] [PATCH] hal: Ensure atomicity of rthal_local_irq_disabled
2009-11-10 10:28 ` Philippe Gerum
@ 2009-11-10 10:37 ` Philippe Gerum
2009-11-10 10:43 ` Jan Kiszka
1 sibling, 0 replies; 10+ messages in thread
From: Philippe Gerum @ 2009-11-10 10:37 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: Jan Kiszka, xenomai-core
On Tue, 2009-11-10 at 11:28 +0100, Philippe Gerum wrote:
> On Tue, 2009-11-10 at 01:34 +0100, Gilles Chanteperdrix wrote:
> > Jan Kiszka wrote:
> > > [Patch is now also available in 'for-upstream']
> > >
> > > ipipe_test_pipeline_from is not atomic /wrt reading the current cpu
> > > number (or an offset for the per-cpu area) and actually reading the
> > > virtualized interrupt state. Work around this by disabling hard IRQs
> > > while accessing this service.
> > >
> > > This fixes false-positives of RTDM driver debug checks.
> > >
> > > Signed-off-by: Jan Kiszka <jan.kiszka@domain.hid>
> > > ---
> > > include/asm-generic/hal.h | 9 ++++++++-
> > > 1 files changed, 8 insertions(+), 1 deletions(-)
> > >
> > > diff --git a/include/asm-generic/hal.h b/include/asm-generic/hal.h
> > > index 97c549e..3095b85 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(__flags); \
> > > + __ret = ipipe_test_pipeline_from(&rthal_domain); \
> > > + local_irq_restore_hw(__flags); \
> > > + __ret; \
> > > +})
> >
> > Maybe we can avoid that on UP systems?
> >
>
> Yes, we should rather use local_irq_save/restore_hw_smp().
>
>
NOTE: we would need to define defaults for those though, since they are
not available with legacy releases of the pipeline patch.
--
Philippe.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Xenomai-core] [PATCH] hal: Ensure atomicity of rthal_local_irq_disabled
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
1 sibling, 1 reply; 10+ messages in thread
From: Jan Kiszka @ 2009-11-10 10:43 UTC (permalink / raw)
To: Philippe Gerum; +Cc: xenomai-core
Philippe Gerum wrote:
> On Tue, 2009-11-10 at 01:34 +0100, Gilles Chanteperdrix wrote:
>> Jan Kiszka wrote:
>>> [Patch is now also available in 'for-upstream']
>>>
>>> ipipe_test_pipeline_from is not atomic /wrt reading the current cpu
>>> number (or an offset for the per-cpu area) and actually reading the
>>> virtualized interrupt state. Work around this by disabling hard IRQs
>>> while accessing this service.
>>>
>>> This fixes false-positives of RTDM driver debug checks.
>>>
>>> Signed-off-by: Jan Kiszka <jan.kiszka@domain.hid>
>>> ---
>>> include/asm-generic/hal.h | 9 ++++++++-
>>> 1 files changed, 8 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/include/asm-generic/hal.h b/include/asm-generic/hal.h
>>> index 97c549e..3095b85 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(__flags); \
>>> + __ret = ipipe_test_pipeline_from(&rthal_domain); \
>>> + local_irq_restore_hw(__flags); \
>>> + __ret; \
>>> +})
>> Maybe we can avoid that on UP systems?
>>
>
> Yes, we should rather use local_irq_save/restore_hw_smp().
>
Oh, *_hw_smp is new, isn't it? Do we need to wrap it for older I-pipes?
Jan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Xenomai-core] [PATCH] hal: Ensure atomicity of rthal_local_irq_disabled
2009-11-10 10:43 ` Jan Kiszka
@ 2009-11-10 10:55 ` Philippe Gerum
2009-11-10 11:33 ` Jan Kiszka
0 siblings, 1 reply; 10+ messages in thread
From: Philippe Gerum @ 2009-11-10 10:55 UTC (permalink / raw)
To: Jan Kiszka; +Cc: xenomai-core
On Tue, 2009-11-10 at 11:43 +0100, Jan Kiszka wrote:
> Philippe Gerum wrote:
> > On Tue, 2009-11-10 at 01:34 +0100, Gilles Chanteperdrix wrote:
> >> Jan Kiszka wrote:
> >>> [Patch is now also available in 'for-upstream']
> >>>
> >>> ipipe_test_pipeline_from is not atomic /wrt reading the current cpu
> >>> number (or an offset for the per-cpu area) and actually reading the
> >>> virtualized interrupt state. Work around this by disabling hard IRQs
> >>> while accessing this service.
> >>>
> >>> This fixes false-positives of RTDM driver debug checks.
> >>>
> >>> Signed-off-by: Jan Kiszka <jan.kiszka@domain.hid>
> >>> ---
> >>> include/asm-generic/hal.h | 9 ++++++++-
> >>> 1 files changed, 8 insertions(+), 1 deletions(-)
> >>>
> >>> diff --git a/include/asm-generic/hal.h b/include/asm-generic/hal.h
> >>> index 97c549e..3095b85 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(__flags); \
> >>> + __ret = ipipe_test_pipeline_from(&rthal_domain); \
> >>> + local_irq_restore_hw(__flags); \
> >>> + __ret; \
> >>> +})
> >> Maybe we can avoid that on UP systems?
> >>
> >
> > Yes, we should rather use local_irq_save/restore_hw_smp().
> >
>
> 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.
>
> Jan
--
Philippe.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Xenomai-core] [PATCH] hal: Ensure atomicity of rthal_local_irq_disabled
2009-11-10 10:55 ` Philippe Gerum
@ 2009-11-10 11:33 ` Jan Kiszka
2009-11-10 13:26 ` Philippe Gerum
0 siblings, 1 reply; 10+ messages in thread
From: Jan Kiszka @ 2009-11-10 11:33 UTC (permalink / raw)
To: Philippe Gerum; +Cc: xenomai-core
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 */
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Xenomai-core] [PATCH] hal: Ensure atomicity of rthal_local_irq_disabled
2009-11-10 11:33 ` Jan Kiszka
@ 2009-11-10 13:26 ` Philippe Gerum
2009-11-10 13:31 ` Jan Kiszka
0 siblings, 1 reply; 10+ messages in thread
From: Philippe Gerum @ 2009-11-10 13:26 UTC (permalink / raw)
To: Jan Kiszka; +Cc: xenomai-core
On Tue, 2009-11-10 at 12:33 +0100, Jan Kiszka wrote:
> 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?
>
Better move it to asm-generic/hal.h like other i-pipe related
conditionals.
> 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 */
>
--
Philippe.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Xenomai-core] [PATCH] hal: Ensure atomicity of rthal_local_irq_disabled
2009-11-10 13:26 ` Philippe Gerum
@ 2009-11-10 13:31 ` Jan Kiszka
0 siblings, 0 replies; 10+ messages in thread
From: Jan Kiszka @ 2009-11-10 13:31 UTC (permalink / raw)
To: Philippe Gerum; +Cc: xenomai-core
Philippe Gerum wrote:
> On Tue, 2009-11-10 at 12:33 +0100, Jan Kiszka wrote:
>> 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?
>>
>
> Better move it to asm-generic/hal.h like other i-pipe related
> conditionals.
OK, pushed a corresponding version.
Jan
--
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2009-11-10 13:31 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2009-11-10 13:26 ` Philippe Gerum
2009-11-10 13:31 ` Jan Kiszka
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.