<html><head></head><body><div style="color:#000; background-color:#fff; font-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px"><div id="yiv2279148208"><div id="yui_3_16_0_ym19_1_1500962438618_17609"><div style="color:#000;background-color:#fff;font-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px;" id="yui_3_16_0_ym19_1_1500962438618_17608"><div id="yiv2279148208"><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_12808"><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_12807" style="color:#000;background-color:#fff;font-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px;"><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_4562"><span id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_7757">Hi Björn,</span></div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_9385"><br clear="none"></div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_9385">></div><div dir="ltr" id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_9385">> <span id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_11141" style="">This depends on whether you are running in kernel mode or in user mode.</span><span id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_11142" style=""> </span></div><div dir="ltr" id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_9385"><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif"><br clear="none"></font></div><div dir="ltr" id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_9385"><font id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_11202" face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif">My program is running in the kernel mode.</font></div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_9471"><br clear="none"></div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14428"><br clear="none" id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14429"></div><div dir="ltr" id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14430"><span id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14431">This is the hardware: </span><a rel="noreferrer" shape="rect" class="yiv2279148208" id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14432" target="_blank" href="https://www.aim-online.com/products/hardware/mil-std-1553/ape1553-x.aspx">https://www.aim-online.com/products/hardware/mil-std-1553/ape1553-x.aspx</a></div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14441">It has a board support package which includes the driver and a library to access the hardware.</div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14441">All calls are made using the library. To access the device (under /dev/) via the library, the application</div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14441" dir="ltr">either needs to run as root or the permissions to the device has to be changed.</div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14441" dir="ltr"><br></div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14441" dir="ltr">Below is an excerpt from the BSP manual:</div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14441" dir="ltr"><img class="ymail-preserve-class inline-image-guid-e77171cf-8fa8-dc87-beac-8dad790d40f0 rte-inline-saved-image" src="cid:32ff5e08-3d7d-59f8-3b66-deb4e0a52914@yahoo.com" data-id="inline-image-guid-e77171cf-8fa8-dc87-beac-8dad790d40f0" alt="Inline image" style="width:100%;max-width:615px;max-height:221px;" id="yui_3_16_0_ym19_1_1500962438618_27876"><br><br></div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14441">Also, the programming manual suggests to use 2 separate functions to read/write from hardware.</div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14441">1. In case of accessing from interrupt handler function<br clear="none"></div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14498">2. In case of accessing normally from the program</div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_14498">This is what got me thinking if the interrupt runs in the process context or not.</div><div></div><div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_4563"> </div><div class="yiv2279148208signature" id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_9485">Warm Regards,<div id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_9486">Neil Patrao</div></div> <div class="yiv2279148208qtdSeparateBR" id="yiv2279148208yui_3_16_0_ym19_1_1500962438618_12806"><br clear="none"><br clear="none"></div><div class="yiv2279148208yqt2060475989" id="yiv2279148208yqt84005"></div></div></div></div><div class="yiv2279148208yqt6028553507" id="yiv2279148208yqt90006"><div id="yui_3_16_0_ym19_1_1500962438618_17625"> <div style="font-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px;" id="yui_3_16_0_ym19_1_1500962438618_17624"> <div style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif;font-size:16px;" id="yui_3_16_0_ym19_1_1500962438618_17623"> <div dir="ltr" id="yui_3_16_0_ym19_1_1500962438618_19172"><font size="2" face="Arial" id="yui_3_16_0_ym19_1_1500962438618_19171"> On Monday, 24 July 2017 3:58 PM, Björn Brandenburg <bbb@mpi-sws.org> wrote:<br clear="none"></font></div> <br clear="none"><br clear="none"> <div class="yiv2279148208y_msg_container" id="yui_3_16_0_ym19_1_1500962438618_17622"><div dir="ltr" id="yui_3_16_0_ym19_1_1500962438618_17621"><br clear="none">Hi Neil,<br clear="none"><br clear="none">> On 24. Jul 2017, at 15:42, Neil Patrao <<a rel="nofollow" shape="rect" ymailto="mailto:illusion.webs@ymail.com" target="_blank" href="mailto:illusion.webs@ymail.com" id="yui_3_16_0_ym19_1_1500962438618_24236">illusion.webs@ymail.com</a>> wrote:<br clear="none">> <br clear="none">> <br clear="none">> (2) implies: A PCIe board produces interrupts. The driver API let's me setup the interrupt handler. To set up the interrupt handler, I pass the pointer to my function so that when the interrupt occurs, my function executes.<br clear="none"><br clear="none">this sounds like a fairly involved driver. Is your process a regular Linux task? If yes, then your callback function most likely isn’t called directly by the interrupt. Rather, there needs to be some driver interface (e.g, a character device driver) that relays the information that an interrupt occurred from the kernel to userspace. <br clear="none"><br clear="none">Can you point us to a description of the device and its driver?<br clear="none"><br clear="none">> <br clear="none">> From what you said, I understand that my function does not run in the context of my RT process.<br clear="none"><br clear="none">This depends on whether you are running in kernel mode or in user mode. <br clear="none"><br clear="none">> <br clear="none">> In this case, is there a way to handle interrupts so that they run in RT mode? <br clear="none"><br clear="none">You can make ksoftirqd a LITMUS^RT real-time task. You can also force certain drivers to run as threads, which you can then also make into LITMUS^RT real-time tasks.<br clear="none"><br clear="none">> <br clear="none">> If not, does it mean that the interrupt handler function runs as a normal Linux process?<br clear="none"><br clear="none">No. Interrupt handlers do not run as processes in mainline Linux. <div class="yiv2279148208yqt5189326575" id="yiv2279148208yqtfd39008"><br clear="none"><br clear="none"><br clear="none">- Björn</div><br clear="none"><br clear="none">PS: Please keep the discussion on the list.<br clear="none"><br clear="none"><br clear="none"><br clear="none">_______________________________________________<br clear="none">litmus-dev mailing list<br clear="none"><a rel="nofollow" shape="rect" ymailto="mailto:litmus-dev@lists.litmus-rt.org" target="_blank" href="mailto:litmus-dev@lists.litmus-rt.org">litmus-dev@lists.litmus-rt.org</a><br clear="none"><a rel="nofollow" shape="rect" target="_blank" href="https://lists.litmus-rt.org/listinfo/litmus-dev">https://lists.litmus-rt.org/listinfo/litmus-dev</a><div class="yiv2279148208yqt5189326575" id="yiv2279148208yqtfd48475"><br clear="none"></div></div><br clear="none"><br clear="none"></div> </div> </div> </div></div></div></div></div></div></body></html>