Re: gpiolib gpio_chrdev_release duration is about 30 ms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



------------------------------------------
#define GPIOS_NUM 8
static char* gpio_names[GPIOS_NUM] = {"IO0", "IO1", "IO2", "IO3", "WR", "CS", "OE", "ADD_EN"};
................
gpio_init() {

    int i;
    for (i = 0; i < GPIOS_NUM; ++i) {
        syslog(LOG_INFO,"%s %d",__FUNCTION__,__LINE__);
        gpio_lines[i] = gpiod_line_find(gpio_names[i]);
        syslog(LOG_INFO,"%s %d",__FUNCTION__,__LINE__);
    }
}
-------------------------------------------
I used syslog/printk to measure time.
syslog in example shows about 300ms on each gpiod_line_find call.
17.07.2020 16:37, Linus Walleij пишет:
Hi Maxim,

On Fri, Jul 17, 2020 at 2:56 PM Maxim Kochetkov <fido_max@xxxxxxxx> wrote:

I'm using libgpiod in userspace.
I have 6 gpiochip's on my board.
gpiod_line_find takes about 300ms to find GPIO line.

gpiod_line_find calls gpiod_foreach_chip
then gpiod_chip_iter_next
then gpiod_chip_close then close(chip->fd)
then we are going to kernel gpiolib gpio_chrdev_release
then atomic_notifier_chain_unregister
then synchronize_rcu()

synchronize_rcu takes about 30 ms (6*30ms=280ms)

I tried to remove synchronize_rcu from atomic_notifier_chain_unregister
and gpiod_line_find takes about 2ms now.

Interesting! Can you provide some context? Are you just testing because
curious or do you need to meet a design objective?

Did you use ftrace or similar instrumentation to drill down and find
where time is spent?

Yours,
Linus Walleij




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux