Received: from cczrelay01.in2p3.fr (cczrelay01.in2p3.fr [134.158.66.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B3225A65 for ; Mon, 19 Sep 2022 09:41:01 +0000 (UTC) Received: from [192.168.0.114] (mdb35-1_migr-88-125-107-19.fbx.proxad.net [88.125.107.19] (may be forged)) (authenticated bits=0) by cczrelay01.in2p3.fr (8.14.4/8.14.4) with ESMTP id 28J9ev6N007686 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO) for ; Mon, 19 Sep 2022 11:40:58 +0200 Date: Mon, 19 Sep 2022 11:40:52 +0200 From: Emmanuel Pacaud Subject: How to debug realtime interrupt latency To: xenomai@lists.linux.dev Message-Id: <4WAGIR.N142QYZSDNER1@lapp.in2p3.fr> X-Mailer: geary/40.0 Precedence: bulk X-Mailing-List: xenomai@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Hi, Let me introduce myself and what I'm working on. I'm a software engineer working on the real time acquisition and control system of the Virgo interferometer: https://en.wikipedia.org/wiki/Virgo_interferometer . This system is currently based on RTAI 5.2, which allows us to implement control loop up to 50 kHz. Data are exchanged using optical links of in-house PCIe boards. These boards are synchronized using a distributed clock. Each iteration of the control loop is triggered by an interrupt generated by the PCIe board. From the interrupt handler, we are calling a list of computational functions running in user space. I'm currently evaluating Xenomai 3 as a replacement of RTAI 5.2. The first step consist in measuring the interrupt latency. During our tests, one of our machines shown bigger worst case latencies than the RTAI 5.2 based platform running on the same hardware, or even than the same Xenomai 3.1 based platform running on a different hardware. That is why I'm looking for advice on how to debug interrupt latency. Here is my 3 setups: CentOS 7 + Linux 4.14.111 + RTAI 5.2 on Dell PowerEdge R630 Intel(R) Xeon(R) CPU E5-2623 v3 @ 3.00GHz CentOS 7 + Linux 4.14.111 + Xenomai 3.1 on Dell PowerEdge R630 Intel(R) Xeon(R) CPU E5-2623 v3 @ 3.00GHz CentOS 7 + Linux 4.14.111 + Xenomai 3.1 on DELL PowerEdge T740 Intel(R) Xeon(R) Gold 5222 CPU @ 3.80GHz Except for the kernel, all the systems run the same OS (NFS mounted root file system). The interrupt latency measurements are in this figure: http://emmanuel.pacaud.free.fr/partage/interrupt-latencies.png All the systems have irqaffinity=0 and isolcpus=1,2,3. The affinity of the real time interrupt is set to 1. The real time interrupt is installed using rt_request_irq/rt_assign_irq on RTAI, and xnintr_init/xnintr_affinity on Xenomai. The interrupt latency is measured using the in-house PCIe board (a time register is latched when the board emit an interrupt, and a current time register is read at the beginning of the interrupt handler). What would explain the latency distribution on the DELL R630 + Xenomai compared to RTAI on the same machine, or to itself on the other machine ? Does Xenomai perform some other tasks before the real time interrupt handler is called ? Is there a way in Xenomai to measure the interrupt latency from the moment the kernel is awaken by an interrupt signal and the moment Xenomai calls the installed interrupt handler ? Thanks, Emmanuel.