All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: sashiko-reviews@lists.linux.dev
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH 15/18] thunderbolt: Rework tunnel credit allocation
Date: Fri, 20 Nov 2026 07:54:35 +0100	[thread overview]
Message-ID: <20261120065435.GG229695@black.igk.intel.com> (raw)
In-Reply-To: <sashiko-outbox-223717@kernel.org>

Hi,

On Thu, Nov 19, 2026 at 05:43:22PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Low] thunderbolt: data race on port->credit_pool in
>   port_credits_show()
> --
> 
> commit c28526c3bb35bc796324ed492685bd1fa66796c3
> Author: Mika Westerberg (Intel) <westeri@kernel.org>
> 
> thunderbolt: Rework tunnel credit allocation
> 
> This commit reworks lane adapter tunnel credit allocation to use per-port
> credit pools with minimum protocol reservations and on-demand allocation
> from a common pool, and exposes pool usage in debugfs.
> 
> > diff --git a/drivers/thunderbolt/debugfs.c b/drivers/thunderbolt/debugfs.c
> > index 0d9f41a0f2cdc..eac6d564bf185 100644
> > --- a/drivers/thunderbolt/debugfs.c
> > +++ b/drivers/thunderbolt/debugfs.c
> > @@ -2488,6 +2488,32 @@ static int port_sb_regs_show(struct seq_file *s, void *not_used)
> >  }
> >  DEBUGFS_ATTR_RW(port_sb_regs);
> >  
> > +static void credits_show(const struct tb_port *port, struct seq_file *s)
> > +{
> > +	int i;
> > +
> > +	seq_puts(s, "# pool used total\n");
> > +
> > +	for (i = 0; i < USB4_CREDIT_NUM_POOLS; i++) {
> > +		const struct usb4_credit_pool *pool = &port->credit_pool[i];
> > +
> > +		seq_printf(s, "%s %u %u\n", usb4_credit_pool_name(pool),
> > +			   usb4_credit_pool_used(pool),
> > +			   usb4_credit_pool_total(pool));
> > +	}
> > +}
> > +
> > +static int port_credits_show(struct seq_file *s, void *not_used)
> > +{
> > +	const struct tb_port *port = s->private;
> > +
> > +	scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &port->sw->tb->lock)
> > +		credits_show(port, s);
> > +
> > +	return 0;
> > +}
> 
> [Severity: Low]
> Can port_credits_show() race with usb4_port_update_credit_pools() on
> port->credit_pool?

Yes it can but that's intentional. This is just for debugging so the
always accurate numbers don't matter.

  reply	other threads:[~2026-11-20  6:54 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 17:12 [PATCH 00/18] thunderbolt: Add support for shared buffering Mika Westerberg
2026-11-19 17:12 ` [PATCH 01/18] thunderbolt: Avoid leaking of DMA tunnel after XDomain removal Mika Westerberg
2026-11-19 17:32   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 02/18] thunderbolt: Tear down DMA tunnels on every " Mika Westerberg
2026-11-19 17:34   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 03/18] thunderbolt: Delay re-pairing DP IN/OUT if DPRX negotiation fails Mika Westerberg
2026-11-19 17:26   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 04/18] thunderbolt: Call DP tunnel activation callback with tb->lock held Mika Westerberg
2026-11-19 17:28   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 05/18] thunderbolt: Re-apply Alpine/Titan Ridge flow on resume Mika Westerberg
2026-11-19 17:35   ` sashiko-bot
2026-11-20  6:33     ` Mika Westerberg
2026-11-19 17:12 ` [PATCH 06/18] thunderbolt: Return -ESHUTDOWN when control channel is not running Mika Westerberg
2026-11-19 17:25   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 07/18] thunderbolt: Add usb4_port_hotplug_disable() Mika Westerberg
2026-11-19 17:22   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 08/18] thunderbolt: Move tb_plug_events_active() before tb_switch_reset_host() Mika Westerberg
2026-11-19 17:25   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 09/18] thunderbolt: Add tb_port_state_is_up() Mika Westerberg
2026-11-19 17:22   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 10/18] thunderbolt: Split host router port reset into a separate function Mika Westerberg
2026-11-19 17:22   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 11/18] thunderbolt: Reset topology after suspend-to-disk Mika Westerberg
2026-11-19 17:44   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 12/18] thunderbolt: Drop tunnel discovery without HopID allocation Mika Westerberg
2026-11-19 17:26   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 13/18] thunderbolt: Always take domain lock when tb_tunnel_put() is called Mika Westerberg
2026-11-19 17:34   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 14/18] thunderbolt: Assign domain to the routers in KUnit tests Mika Westerberg
2026-11-19 17:26   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 15/18] thunderbolt: Rework tunnel credit allocation Mika Westerberg
2026-11-19 17:43   ` sashiko-bot
2026-11-20  6:54     ` Mika Westerberg [this message]
2026-11-19 17:12 ` [PATCH 16/18] thunderbolt: Add support for shared flow control Mika Westerberg
2026-11-19 17:34   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 17/18] thunderbolt: Use restricted shared flow control for DMA tunnels on intra-domain links Mika Westerberg
2026-11-19 17:32   ` sashiko-bot
2026-11-19 17:12 ` [PATCH 18/18] thunderbolt: Add KUnit tests for shared buffering Mika Westerberg
2026-11-19 17:28   ` sashiko-bot

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=20261120065435.GG229695@black.igk.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 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.