All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: PROBLEM: Evdev epoll_wait Lag
       [not found] <99GfWMtkpJutp6wuEhYJ3aIfNVfE_fr3TVPeQWsr9QSvNMgTk23Aml6WYEucd6D3qkmeIFbunUu6a6g0VNppEKIYrz7w43fzGyl3BUXVkDQ=@protonmail.com>
@ 2021-10-09  3:19 ` dmitry.torokhov
  2021-10-09  4:31   ` Ryan McClue
  0 siblings, 1 reply; 3+ messages in thread
From: dmitry.torokhov @ 2021-10-09  3:19 UTC (permalink / raw)
  To: Ryan McClue; +Cc: linux-input

Hi,

On Fri, Oct 08, 2021 at 11:29:51PM +0000, Ryan McClue wrote:
> Hi there,
> 
> PROBLEM:
> 
> I'm on a laptop, with 2 connected keyboards (built-in and USB).
> When I hit keys on each keyboard simultaneously in a program like firefox,
> gnome-terminal etc. stalling/lag occurs.
> It only happens for keyboards it seems as moving an external mouse and trackpad
> together causes no issues.
> 
> TO REPRODUCE:
> To investigate the problem I wrote a simple C file
> (see attached 'evdev-lag.c', compile with $(gcc evdev-lag.c -o evdev-lag))
> The program finds keyboard devices under /dev/input/event and uses epoll to
> poll them for input via the evdev interface.
> 
> If I start entering keys on one keyboard and then switch to the other, the
> program stalls briefly.
> If I simultaneously enter keys on each keyboard the program stalls indefinitely
> until I stop entering keys.

I do not observe stalls but did you mean to essentially busy-loop in
your program? epoll_wait with 0 timeout causes it return immediately,
you want to use -1 if you want to wait indefinitely or give it a real
timeout.

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PROBLEM: Evdev epoll_wait Lag
  2021-10-09  3:19 ` PROBLEM: Evdev epoll_wait Lag dmitry.torokhov
@ 2021-10-09  4:31   ` Ryan McClue
  2021-10-10 22:01     ` Ryan McClue
  0 siblings, 1 reply; 3+ messages in thread
From: Ryan McClue @ 2021-10-09  4:31 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input

I want the epoll_wait to return immediately if no data, so I believe the timeout of 0 is correct.
I'm using an adapted version of this loop for a hobby program. However, every time I open it up in a debugger (or just normally) htop shows CPU usage for the process is ~97% and the CPU fan becomes very loud.
Like I said, I'm experiencing stalls from a fresh install of Ubuntu in all native applications like gnome-terminal, firefox, gedit, vi etc.
I don't understand what is going on or how to go about debugging it.

--
Ryan McClue, Sydney

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Saturday, October 9th, 2021 at 2:19 PM, dmitry.torokhov@gmail.com <dmitry.torokhov@gmail.com> wrote:

> Hi,
>
> On Fri, Oct 08, 2021 at 11:29:51PM +0000, Ryan McClue wrote:
>
> > Hi there,
> >
> > PROBLEM:
> >
> > I'm on a laptop, with 2 connected keyboards (built-in and USB).
> >
> > When I hit keys on each keyboard simultaneously in a program like firefox,
> >
> > gnome-terminal etc. stalling/lag occurs.
> >
> > It only happens for keyboards it seems as moving an external mouse and trackpad
> >
> > together causes no issues.
> >
> > TO REPRODUCE:
> >
> > To investigate the problem I wrote a simple C file
> >
> > (see attached 'evdev-lag.c', compile with $(gcc evdev-lag.c -o evdev-lag))
> >
> > The program finds keyboard devices under /dev/input/event and uses epoll to
> >
> > poll them for input via the evdev interface.
> >
> > If I start entering keys on one keyboard and then switch to the other, the
> >
> > program stalls briefly.
> >
> > If I simultaneously enter keys on each keyboard the program stalls indefinitely
> >
> > until I stop entering keys.
>
> I do not observe stalls but did you mean to essentially busy-loop in
>
> your program? epoll_wait with 0 timeout causes it return immediately,
>
> you want to use -1 if you want to wait indefinitely or give it a real
>
> timeout.
>
> Thanks.
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PROBLEM: Evdev epoll_wait Lag
  2021-10-09  4:31   ` Ryan McClue
@ 2021-10-10 22:01     ` Ryan McClue
  0 siblings, 0 replies; 3+ messages in thread
From: Ryan McClue @ 2021-10-10 22:01 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input

I think this may be an issue with xorg, as running in a virtual terminal I don't get any stalling.
What is your environment you tested it on?

--
Ryan McClue, Sydney

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Saturday, October 9th, 2021 at 3:31 PM, Ryan McClue <re.mcclue@protonmail.com> wrote:

> I want the epoll_wait to return immediately if no data, so I believe the timeout of 0 is correct.
>
> I'm using an adapted version of this loop for a hobby program. However, every time I open it up in a debugger (or just normally) htop shows CPU usage for the process is ~97% and the CPU fan becomes very loud.
>
> Like I said, I'm experiencing stalls from a fresh install of Ubuntu in all native applications like gnome-terminal, firefox, gedit, vi etc.
>
> I don't understand what is going on or how to go about debugging it.
>
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Ryan McClue, Sydney
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
>
> On Saturday, October 9th, 2021 at 2:19 PM, dmitry.torokhov@gmail.com dmitry.torokhov@gmail.com wrote:
>
> > Hi,
> >
> > On Fri, Oct 08, 2021 at 11:29:51PM +0000, Ryan McClue wrote:
> >
> > > Hi there,
> > >
> > > PROBLEM:
> > >
> > > I'm on a laptop, with 2 connected keyboards (built-in and USB).
> > >
> > > When I hit keys on each keyboard simultaneously in a program like firefox,
> > >
> > > gnome-terminal etc. stalling/lag occurs.
> > >
> > > It only happens for keyboards it seems as moving an external mouse and trackpad
> > >
> > > together causes no issues.
> > >
> > > TO REPRODUCE:
> > >
> > > To investigate the problem I wrote a simple C file
> > >
> > > (see attached 'evdev-lag.c', compile with $(gcc evdev-lag.c -o evdev-lag))
> > >
> > > The program finds keyboard devices under /dev/input/event and uses epoll to
> > >
> > > poll them for input via the evdev interface.
> > >
> > > If I start entering keys on one keyboard and then switch to the other, the
> > >
> > > program stalls briefly.
> > >
> > > If I simultaneously enter keys on each keyboard the program stalls indefinitely
> > >
> > > until I stop entering keys.
> >
> > I do not observe stalls but did you mean to essentially busy-loop in
> >
> > your program? epoll_wait with 0 timeout causes it return immediately,
> >
> > you want to use -1 if you want to wait indefinitely or give it a real
> >
> > timeout.
> >
> > Thanks.
> >
> > Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-10 22:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <99GfWMtkpJutp6wuEhYJ3aIfNVfE_fr3TVPeQWsr9QSvNMgTk23Aml6WYEucd6D3qkmeIFbunUu6a6g0VNppEKIYrz7w43fzGyl3BUXVkDQ=@protonmail.com>
2021-10-09  3:19 ` PROBLEM: Evdev epoll_wait Lag dmitry.torokhov
2021-10-09  4:31   ` Ryan McClue
2021-10-10 22:01     ` Ryan McClue

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.