[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240627084122.125e9122@kernel.org>
Date: Thu, 27 Jun 2024 08:41:22 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Petr Machata <petrm@...dia.com>
Cc: <davem@...emloft.net>, <netdev@...r.kernel.org>, <edumazet@...gle.com>,
<pabeni@...hat.com>, <willemdebruijn.kernel@...il.com>,
<przemyslaw.kitszel@...el.com>, <leitao@...ian.org>
Subject: Re: [RFC net-next 1/2] selftests: drv-net: add ability to schedule
cleanup with defer()
On Thu, 27 Jun 2024 09:37:50 +0200 Petr Machata wrote:
> > I was wondering if we're better off throwing the exception from
> > remove() or silently ignoring (what is probably an error in the
> > test code). I went with the former intentionally, but happy to
> > change.
>
> Hmm, right, it would throw. Therefore second exec() would as well. Good.
> But that means that exec() should first cancel, then exec, otherwise
> second exec invocation would actually exec the cleanup a second time
> before bailing out.
Good point, that sounds safer.
> >> This shouldn't exec if self.executed.
> >>
> >> But I actually wonder if we need two flags at all. Whether the defer
> >> entry is resolved through exec(), cancel() or __exit__(), it's "done".
> >> It could be left in the queue, in which case the "done" flag is going to
> >> disable future exec requests. Or it can just be dropped from the queue
> >> when done, in which case we don't even need the "done" flag as such.
> >
> > If you recall there's a rss_ctx test case which removes contexts out of
> > order. The flags are basically for that test. We run the .exec() to
> > remove a context, and then we can check
> >
> > if thing.queued:
> > .. code for context that's alive ..
> > else:
> > .. code for dead context ..
>
> That test already has its own flags to track which was removed, can't it
> use those? My preference is always to keep an API as minimal as possible
> and the flags, if any, would ideally be private. I don't think defer
> objects should keep track of whether the user has already invoked them
> or not, that's their user's business to know.
Ack, will delete it then.
Powered by blists - more mailing lists