From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: fy15309206903@gmail.com
Cc: Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>,
Paolo Abeni <pabeni@redhat.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Mika Westerberg <westeri@kernel.org>,
Yehezkel Bernat <YehezkelShB@gmail.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org,
Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: Re: [PATCH net v2 1/2] net: thunderbolt: Release the Rx HopID that was handed out on mismatch
Date: Mon, 10 Aug 2026 21:56:16 +0300 [thread overview]
Message-ID: <anoe0LCeiR9NIz2o@ashevche-desk.local> (raw)
In-Reply-To: <20260810-b4-tbnet-hopid-v2-1-0eee557e75df@gmail.com>
On Mon, Aug 10, 2026 at 09:39:14AM +0000, Fan Ye via B4 Relay wrote:
> tbnet_connected_work() asks for a specific input HopID and treats getting
> a different one as a failure:
>
> ret = tb_xdomain_alloc_in_hopid(net->xd, net->remote_transmit_path);
> if (ret != net->remote_transmit_path) {
> netdev_err(net->dev, "failed to allocate Rx HopID\n");
> return;
> }
No need to cite the code, we all able to see it well from the source tree.
> That call ends in ida_alloc_range(&xd->in_hopids, hopid,
> xd->local_max_hopid, GFP_KERNEL), which allocates the lowest free id at
> or above the one asked for. When the
> wanted HopID is already taken it does not fail - it succeeds with the next
> one - so this path returns with an id allocated and no reference to it
> left anywhere. It stays allocated for the rest of the XDomain connection.
>
> Forcing the branch by occupying the wanted HopID first shows the returned
> id is a live allocation, not an error code:
>
> LEAKPROBE squat=8 requested=8 local_max_hopid=27
> LEAKPROBE real alloc ret=9
> thunderbolt-net 0-1.0 thunderbolt0: failed to allocate Rx HopID
>
> Release the id when it is not the one we wanted, matching what the error
> unwind at the end of the function already does for the expected id.
General hint: do not blindly copy'n'paste the Dostoevsky saga from AI. Squeeze
it and show (by rephrasing) that you also understand what's going on there.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-08-10 18:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-10 9:39 [PATCH net v2 0/2] net: thunderbolt: two fixes for the failed bring-up path Fan Ye via B4 Relay
2026-08-10 9:39 ` [PATCH net v2 1/2] net: thunderbolt: Release the Rx HopID that was handed out on mismatch Fan Ye via B4 Relay
2026-08-10 18:56 ` Andy Shevchenko [this message]
2026-08-10 9:39 ` [PATCH net v2 2/2] net: thunderbolt: Mark the connection down when bringing it up fails Fan Ye via B4 Relay
2026-08-10 18:57 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=anoe0LCeiR9NIz2o@ashevche-desk.local \
--to=andriy.shevchenko@linux.intel.com \
--cc=YehezkelShB@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fy15309206903@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=westeri@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox