[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <95933f509d1a91eb60b3de87219aa15ac969988c.camel@gmail.com>
Date: Tue, 17 Jan 2023 08:31:34 -0800
From: Alexander H Duyck <alexander.duyck@...il.com>
To: Willem de Bruijn <willemdebruijn.kernel@...il.com>,
netdev@...r.kernel.org
Cc: davem@...emloft.net, kuba@...nel.org, edumazet@...gle.com,
pabeni@...hat.com, Willem de Bruijn <willemb@...gle.com>
Subject: Re: [PATCH net] selftests/net: toeplitz: fix race on tpacket_v3
block close
On Mon, 2023-01-16 at 12:40 -0500, Willem de Bruijn wrote:
> From: Willem de Bruijn <willemb@...gle.com>
>
> Avoid race between process wakeup and tpacket_v3 block timeout.
>
> The test waits for cfg_timeout_msec for packets to arrive. Packets
> arrive in tpacket_v3 rings, which pass packets ("frames") to the
> process in batches ("blocks"). The sk waits for req3.tp_retire_blk_tov
> msec to release a block.
>
> Set the block timeout lower than the process waiting time, else
> the process may find that no block has been released by the time it
> scans the socket list. Convert to a ring of more than one, smaller,
> blocks with shorter timeouts. Blocks must be page aligned, so >= 64KB.
>
> Somewhat awkward while () notation dictated by checkpatch: no empty
> braces allowed, nor statement on the same line as the condition.
You might look at using a do/while approach rather than just a straight
while. I believe that is the pattern used at various points throughout
the kernel when you do nothing between the braces. I know we have
instances of "do {} while (0)" throughout the kernel so that might be a
way to go.
Powered by blists - more mailing lists