On Tue, Dec 12, 2017 at 7:32 PM, Andreas Färber <afaerber@suse.de> wrote:
Hi Roger,
Am 30.11.2017 um 10:59 schrieb Roger Oberholtzer:
We have written a minimal kernel interrupt handler for the Raspberry Pi 3. It is running the current 64-bit Tumbleweed kernel. I am curious about the rate of interrupts that we might be able to capture.
The ISR does little other than run when a raising edge interrupt happens. We are looking at /proc/interrupts to see how many interrupts have happened.
We see that at around 23 kHz we begin to loose interrupts. The system is not doing anything else.
Does that seem reasonable? I have not seen any good discussion of this. I think it is rather low. I am guessing that the issue is how the Linux kernel responds to interrupts. The housework in setting things up so that the interrupt can run must be the resource hog.
Opinions? Suggestions?
I don't see anything openSUSE-specific in here, so I'd suggest to ask on upstream linux-rpi-kernel list about any performance expectations.
Personally I haven't had any success using GPIO interrupts on my rpi3, but that may be a matter of the device/driver (SX1276) I tried it with.
Can you share any more details on DT overlay or driver init you're using to set up the interrupt? What's your interrupt source?
GPIO pin 17. In our driver, we get interrupts on this line at up to 23 kHz. Then we start to miss some. We look at /proc/interrupts to see how many have occurred. The driver is absolute minimum while we test the interrupt speed we might obtain: #include <linux/kernel.h> #include <linux/module.h> #include <linux/interrupt.h> #include <linux/gpio.h> #define ANTS_NUM_GPIOS 1 #define ANTS_GPIO 475 static struct gpio ants_gpio = {ANTS_GPIO, GPIOF_IN, "RST ANTS"}; static struct gpio_desc *ants_gpiod; static int ants_irq = -1; static irqreturn_t ants_handle_irq(int irq, void *not_used) { return(IRQ_HANDLED); } static int __init ants_init(void) { int ret = 0; ret = gpio_request_one(ants_gpio.gpio, ants_gpio.flags, ants_gpio.label); if (ret) { printk(KERN_ERR "ANTS - GPIO request failed: %d\n", ret); goto no_gpio; } ants_gpiod = gpio_to_desc(ants_gpio.gpio); #if 0 /* Documentation/gpio/consumer.txt seems to say that this has to be done * before the descriptor can be used, but I am sceptical: */ gpio_free(ants_gpio.gpio); #endif ret = gpiod_to_irq(ants_gpiod); if (ret < 0) { printk(KERN_ERR "ANTS - No IRQ available for GPIO #%d: %d\n", ants_gpio.gpio, ret); goto no_irq; } ants_irq = ret; ret = request_irq(ants_irq, ants_handle_irq, (IRQF_TRIGGER_RISING), "ants", NULL); if (ret) { printk(KERN_ERR "ANTS - IRQ (#%d) request failed: %d\n", ants_irq, ret); goto no_irq; } printk(KERN_INFO "ANTS - Using IRQ: %d\n", ants_irq); return(0); no_irq: gpio_free(ants_gpio.gpio); no_gpio: return(ret); } static void __exit ants_exit(void) { free_irq(ants_irq, NULL); gpio_free(ants_gpio.gpio); } module_init(ants_init); module_exit(ants_exit); MODULE_AUTHOR("Ramboll RST"); MODULE_DESCRIPTION("RST distance module"); MODULE_LICENSE("GPL"); -- Roger Oberholtzer -- To unsubscribe, e-mail: opensuse-arm+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-arm+owner@opensuse.org