Re: Odd timeout behavior

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

 



On 4/11/20 5:00 PM, Hrvoje Zeba wrote:
> Hi,
> 
> I've been looking at timeouts and found a case I can't wrap my head around.
> 
> Basically, If you submit OPs in a certain order, timeout fires before
> time elapses where I wouldn't expect it to. The order is as follows:
> 
> poll(listen_socket, POLLIN) <- this never fires
> nop(async)
> timeout(1s, count=X)
> 
> If you set X to anything but 0xffffffff/(unsigned)-1, the timeout does
> not fire (at least not immediately). This is expected apart from maybe
> setting X=1 which would potentially allow the timeout to fire if nop
> executes after the timeout is setup.
> 
> If you set it to 0xffffffff, it will always fire (at least on my
> machine). Test program I'm using is attached.
> 
> The funny thing is that, if you remove the poll, timeout will not fire.
> 
> I'm using Linus' tree (v5.6-12604-gab6f762f0f53).
> 
> Could anybody shine a bit of light here?

Thinking about this, I think the mistake here is using the SQ side for
the timeouts. Let's say you queue up N requests that are waiting, like
the poll. Then you arm a timeout, it'll now be at N + count before it
fires. We really should be using the CQ side for the timeouts.

Adding Pavel and Yi Zhang.

-- 
Jens Axboe




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux