From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753556AbdGSOUE (ORCPT ); Wed, 19 Jul 2017 10:20:04 -0400 Received: from foss.arm.com ([217.140.101.70]:40484 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752955AbdGSOUB (ORCPT ); Wed, 19 Jul 2017 10:20:01 -0400 Subject: Re: [PATCH 0/3] simulated interrupts To: Thomas Gleixner , Bartosz Golaszewski References: <1500466814-32679-1-git-send-email-brgl@bgdev.pl> Cc: Linus Walleij , Jonathan Corbet , Bamvor Jian Zhang , Jonathan Cameron , Lars-Peter Clausen , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-doc@vger.kernel.org From: Marc Zyngier Organization: ARM Ltd Message-ID: <7c98e6b0-3dbd-52f7-79d5-4ec64bf8a66e@arm.com> Date: Wed, 19 Jul 2017 15:19:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/07/17 14:58, Thomas Gleixner wrote: > On Wed, 19 Jul 2017, Bartosz Golaszewski wrote: > >> 2017-07-19 14:25 GMT+02:00 Thomas Gleixner : >>> On Wed, 19 Jul 2017, Bartosz Golaszewski wrote: >>> >>>> Some frameworks (e.g. iio, gpiolib) use irq_work to implement simulated >>>> interrupts that can be 'fired' from process context when needed and >>>> requested just like normal interrupts. This is useful for testing and >>>> development purposes. >>>> >>>> Currently this code is reimplemented by every user. This series >>>> proposes to add a new set of functions that can be used by drivers >>>> that want to simulate interrupts without having to duplicate any >>>> boilerplate code. >>>> >>>> The first patch adds a simple irq simulator framework. The second >>>> extends it with resource management. The third uses the new >>>> functionality in the gpio-mockup testing driver. >>>> >>>> NOTE: The next candidate for using this API would be iio-dummy-evgen. >>> >>> I like the general idea - have not looked at the code yet. Just a quick >>> question: How many copies/variants of this scheme do we have in tree? >>> >>> Thanks, >>> >>> tglx >> >> Currently there are two: iio and gpiolib basically duplicate the same >> code in their respective testing drivers. I only used irq_sim in >> gpio-mockup in this series as an example and to see if there's any >> interest in merging it before spending time on iio-dummy-evgen. > > Yes, I think so. Consolidation is always a good thing and simulation is > useful for developing or validating code. Indeed, that's pretty interesting. On a slightly tangential subject, there is another aspect that I thought of implementing for a while, but always ended up just relying on a quick hack: forcing the injection of an actual interrupt. A number of interrupt controllers have the ability to make an interrupt pending, for it to be handled as if a device had actually triggered it. In my case, it has proved to be incredibly useful when debugging the interrupt controller itself, and also things that mess with interrupts in a creative way (like KVM) while relying on a particular interrupt controller. What I had in mind was something like: echo 1 >/proc/irq/9/trigger (or the corresponding /sys/kernel/debug/irq/irqs/ interface if we want to make sure that this is really not for production use...). If there is any interest, I'll try to whip something up. Thanks, M. -- Jazz is not dead. It just smells funny...