Re: hard_preempt_disable inconsistent

2022-04-18 Thread Yunjie Gu via Xenomai
Hi Greg,

Thanks for the prompt response. I haven't try the latest patch yet. I feel
it is the problem of my setup rather than the patch itself. The previous
point I made was incorrect. The hard_preempt_disable macro is a
statement-embedded expression supported by GNU so there is no problem at
all (I was not aware of this). That said, I still cannot figure out why my
compiler report errors on codes that seems absolutely fine. I attached my
errors and my patch here in case you would bother to take a look at it.

Regards,
Yunjie


On Tue, 19 Apr 2022 at 00:25, Greg Gallagher  wrote:

>
>
> On Mon, Apr 18, 2022 at 7:21 PM Yunjie Gu via Xenomai 
> wrote:
>
>> Hi All,
>>
>> I'm trying to use xenomai on linux 5.4. I previously used xenomai 3.0 on
>> linux 4.9 and xenomai 3.1 on linux 4.19 and both were fine. However when I
>> use xenomai 3.2.1 on linux 5.4 there are errors in compile. One of the
>> errors says
>> expected expression before ')' token (__flags) = hard_preempt_disable();
>> for the macro below in fpsimd.c:
>> #define get_cpu_fpsimd_context(__flags) \ do { \ (__flags) =
>> hard_preempt_disable(); \ __get_cpu_fpsimd_context(); \ } while (0)
>>
>> hard_preempt_disable is also a macro defined in preempt.h:
>> #define hard_preempt_disable() \ ({ \ unsigned long __flags__; \ __flags__
>> = hard_local_irq_save(); \ if (__ipipe_root_p) \ preempt_disable(); \
>> __flags__; \ })
>>
>> It is clear that hard_preempt_disable() should be a function-like macro
>> but
>> is actually not. It seems to me that there are inconsistencies in the
>> ipipe
>> patch I used. I used ipipe-core-5.4.72-arm64-0.patch. Anyone has a
>> suggestion on I can I resolve this issue?
>>
>> Best Regards,
>> Yunjie
>
>
> Have you tried the latest patch? The mainline release doesn’t have this
> issue. I’m about to release the next patch.
>
> -Greg
>
>>
>>
-- next part --
  CALLscripts/atomic/check-atomics.sh
  CALLscripts/checksyscalls.sh
  CHK include/generated/compile.h
make[1]: *** No rule to make target 'debian/canonical-certs.pem', needed by 
'certs/x509_certificate_list'. Stop.
make[1]: *** Waiting for unfinished jobs
Makefile:1652: recipe for target 'certs' failed
make: *** [certs] Error 2
make: *** Waiting for unfinished jobs
  CC  arch/arm64/kernel/fpsimd.o
  CC  arch/arm64/kernel/sys.o
arch/arm64/kernel/fpsimd.c: In function 'fpsimd_restore_current_state':
arch/arm64/kernel/fpsimd.c:174:11: error: expected expression before ')' token
  174 |   (__flags) = hard_preempt_disable(); \
  |   ^
arch/arm64/kernel/fpsimd.c:1212:2: note: in expansion of macro 
'get_cpu_fpsimd_context'
 1212 |  get_cpu_fpsimd_context();
  |  ^~
In file included from ./include/linux/bottom_half.h:5,
 from arch/arm64/kernel/fpsimd.c:11:
./include/linux/preempt.h:259:3: error: '__flags__' undeclared (first use in 
this function); did you mean 'vm_flags_t'?
  259 |   __flags__ = hard_local_irq_save(); \
  |   ^
arch/arm64/kernel/fpsimd.c:174:15: note: in expansion of macro 
'hard_preempt_disable'
  174 |   (__flags) = hard_preempt_disable(); \
  |   ^~~~
arch/arm64/kernel/fpsimd.c:1212:2: note: in expansion of macro 
'get_cpu_fpsimd_context'
 1212 |  get_cpu_fpsimd_context();
  |  ^~
./include/linux/preempt.h:259:3: note: each undeclared identifier is reported 
only once for each function it appears in
  259 |   __flags__ = hard_local_irq_save(); \
  |   ^
arch/arm64/kernel/fpsimd.c:174:15: note: in expansion of macro 
'hard_preempt_disable'
  174 |   (__flags) = hard_preempt_disable(); \
  |   ^~~~
arch/arm64/kernel/fpsimd.c:1212:2: note: in expansion of macro 
'get_cpu_fpsimd_context'
 1212 |  get_cpu_fpsimd_context();
  |  ^~
In file included from ./arch/arm64/include/asm/irqflags.h:12,
 from ./include/linux/irqflags.h:16,
 from ./include/linux/spinlock.h:54,
 from ./include/linux/seqlock.h:36,
 from ./include/linux/time.h:6,
 from ./include/linux/compat.h:10,
 from arch/arm64/kernel/fpsimd.c:14:
./arch/arm64/include/asm/ipipe_hwirq.h:36:10: error: expected expression before 
')' token
   36 |  : "r" (x)   \
  |  ^
./arch/arm64/include/asm/ipipe_hwirq.h:134:35: note: in expansion of macro 
'hard_local_irq_restore_notrace'
  134 | #define hard_local_irq_restorehard_local_irq_restore_notrace
  |   ^~
./include/linux/preempt.h:269:4: note: in expansion of macro 
'hard_local_irq_restore'
  269 |hard_local_irq_restore(__flags__);  \

hard_preempt_disable inconsistent

2022-04-18 Thread Yunjie Gu via Xenomai
Hi All,

I'm trying to use xenomai on linux 5.4. I previously used xenomai 3.0 on
linux 4.9 and xenomai 3.1 on linux 4.19 and both were fine. However when I
use xenomai 3.2.1 on linux 5.4 there are errors in compile. One of the
errors says
expected expression before ')' token (__flags) = hard_preempt_disable();
for the macro below in fpsimd.c:
#define get_cpu_fpsimd_context(__flags) \ do { \ (__flags) =
hard_preempt_disable(); \ __get_cpu_fpsimd_context(); \ } while (0)

hard_preempt_disable is also a macro defined in preempt.h:
#define hard_preempt_disable() \ ({ \ unsigned long __flags__; \ __flags__
= hard_local_irq_save(); \ if (__ipipe_root_p) \ preempt_disable(); \
__flags__; \ })

It is clear that hard_preempt_disable() should be a function-like macro but
is actually not. It seems to me that there are inconsistencies in the ipipe
patch I used. I used ipipe-core-5.4.72-arm64-0.patch. Anyone has a
suggestion on I can I resolve this issue?

Best Regards,
Yunjie


pthread_cancel services not documented

2022-04-07 Thread Yunjie Gu via Xenomai
Hi All,

I'm trying to use xenomai with posix interface, and I found some
differences in the documentation for xenomai 2 and xenomai 3. In xenomai
2, pthread_cancel related services (including pthread_setcancelstate, .etc)
are clearly documented. In xenomai 3, however, only pthread_kill is
documented, but it seems other services are still there in source codes. My
guessing is that pthread_cancel related services are managed by the linux
rather than cobalt core and therefore were not explicitly documented in
xenomai 3, and we can use them in the same way as we do in linux. Can
anyone confirm this? See link below

https://xenomai.org/documentation/xenomai-2.6/html/api/group__posix__cancel.html

https://xenomai.org/documentation/xenomai-3/html/xeno3prm/group__cobalt__api__thread.html#gae1a96424296ef872696c7fb90a8ae9aa

Regards,
Yunjie


spi-bcm2835 for rtdm

2021-12-25 Thread Yunjie Gu via Xenomai
Hi Everyone,

I'm trying to use rtdm spi on raspberry pi, and I find something confusing.
I could see there are two spi-bcm2835.c files in the kernel source (after
xenomai patching), one with rtdm, and one native. But these two drivers use
the same .compatible = "brcm,bcm2835-spi", which means the device-tree
cannot distinguish them. Does this mean I have to manually disable the
native spi driver in Kconfig to avoid binding conflicts if I want to use
the rtdm one?

Best Regards,
Yunjie