Skip to contentSkip to conversation

Writing to UDD driver through mapped memory cause secondary mode switch

Xenomai MINIER Bertrand 2 participants 3 messages Dec 14, 2017 – Jan 30, 2018

lore
Share & tools
lore
#0 lore raw

Hi,

I implemented an UDD driver for a SOC IP on my Xilinx Ultrascale ZCU102 board. The arch is arm64 so I'm using Xenomai from the next branch.

When I try to write to the memory mapped from the user space side, Xenomai switches to secondary mode.

I activated the SIGDEBUG and attached an handler to point the origin and the reason of this secondary mode switch. The result of sigdebug_reason(siginfo) is SIGDEBUG_MIGRATE_FAULT.

I'm using mmap with the following attributes:
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fpgaMemfd, 0);

The file descriptor is opened with O_RDWR flag.

What is strange is that memory write effectively works but the SIGDEBUG_MIGRATE_FAULT is triggered. Reading the physical driver memory with devmem returns the written value.

Does anyone would have any idea about the origin of the issue ?

Thanks,

Bertrand Minier

This e-mail and any accompanying attachments are confidential. If you are not the intended recipient, you must not review, disclose, copy, distribute or use this e-mail; please delete it from your system and notify the sender immediately.

#1 lore raw

Sorry to bring back an old thread but I just noticed this. Did you
solve your issue? Did you use the documentation in this file for
help? https://git.xenomai.org/xenomai-3.git/tree/include/cobalt/kernel/rtdm/udd.h?id=f4a54b173db71a182d9826852a94b20f6095b411

-Greg

Quoted 29 lines · MINIER Bertrand

Hi,

I implemented an UDD driver for a SOC IP on my Xilinx Ultrascale ZCU102 board. The arch is arm64 so I'm using Xenomai from the next branch.

When I try to write to the memory mapped from the user space side, Xenomai switches to secondary mode.

I activated the SIGDEBUG and attached an handler to point the origin and the reason of this secondary mode switch. The result of sigdebug_reason(siginfo) is SIGDEBUG_MIGRATE_FAULT.

I'm using mmap with the following attributes:
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fpgaMemfd, 0);

The file descriptor is opened with O_RDWR flag.

What is strange is that memory write effectively works but the SIGDEBUG_MIGRATE_FAULT is triggered. Reading the physical driver memory with devmem returns the written value.

Does anyone would have any idea about the origin of the issue ?

Thanks,

Bertrand Minier

This e-mail and any accompanying attachments are confidential. If you are not the intended recipient, you must not review, disclose, copy, distribute or use this e-mail; please delete it from your system and notify the sender immediately.
_______________________________________________
Xenomai mailing list
[email protected]
https://xenomai.org/mailman/listinfo/xenomai

#2 lore raw

Hello Greg,

I didn't succeed to solve this issue.
The switch to secondary mode only happen on the first write to the memory mapped area. As far as I understood, the secondary mode switch is caused by a page fault. I workaround it by doing a dummy write just after the mmap() call, which anyway trigger a switch to secondary mode.
After this first dummy write, my rt thread doesn't switch anymore to secondary mode.

I used the documentation you point but I didn't found any help for this issue.

Best regards,

Bertrand

-----Message d'origine-----
De : Greg Gallagher [mailto:[email protected]]
Envoyé : vendredi 26 janvier 2018 21:43
À : MINIER Bertrand
Cc : [email protected]
Objet : Re: [Xenomai] Writing to UDD driver through mapped memory cause secondary mode switch

Sorry to bring back an old thread but I just noticed this. Did you solve your issue? Did you use the documentation in this file for help? https://git.xenomai.org/xenomai-3.git/tree/include/cobalt/kernel/rtdm/udd.h?id=f4a54b173db71a182d9826852a94b20f6095b411

-Greg

Quoted 21 lines · MINIER Bertrand

Hi,

I implemented an UDD driver for a SOC IP on my Xilinx Ultrascale ZCU102 board. The arch is arm64 so I'm using Xenomai from the next branch.

When I try to write to the memory mapped from the user space side, Xenomai switches to secondary mode.

I activated the SIGDEBUG and attached an handler to point the origin and the reason of this secondary mode switch. The result of sigdebug_reason(siginfo) is SIGDEBUG_MIGRATE_FAULT.

I'm using mmap with the following attributes:
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fpgaMemfd, 0);

The file descriptor is opened with O_RDWR flag.

What is strange is that memory write effectively works but the SIGDEBUG_MIGRATE_FAULT is triggered. Reading the physical driver memory with devmem returns the written value.

Does anyone would have any idea about the origin of the issue ?

Thanks,

Quoted 8 lines

Bertrand Minier

This e-mail and any accompanying attachments are confidential. If you are not the intended recipient, you must not review, disclose, copy, distribute or use this e-mail; please delete it from your system and notify the sender immediately.
_______________________________________________
Xenomai mailing list
[email protected]
https://xenomai.org/mailman/listinfo/xenomai

This e-mail and any accompanying attachments are confidential. If you are not the intended recipient, you must not review, disclose, copy, distribute or use this e-mail; please delete it from your system and notify the sender immediately.