All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Stefan Wahren <wahrenst@gmx.net>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Lino Sanfilippo <LinoSanfilippo@gmx.de>,
	Florian Fainelli <f.fainelli@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V3 01/14 next] qca_spi: Improve SPI thread creation
Date: Thu, 25 Jan 2024 18:36:39 -0800	[thread overview]
Message-ID: <20240125183639.585ec73f@kernel.org> (raw)
In-Reply-To: <20240124223211.4687-2-wahrenst@gmx.net>

On Wed, 24 Jan 2024 23:31:58 +0100 Stefan Wahren wrote:
> The qca_spi driver create/stop the SPI kernel thread in case
> of netdev_open/close. This isn't optimal because there is no
> need for such an expensive operation.
> 
> So improve this by moving create/stop of the SPI kernel into
> the init/uninit ops. The open/close ops could just
> 'park/unpark' the SPI kernel thread.

What's the concern? I don't think that creating a thread is all
expensive. And we shouldn't have a thread sitting around when
the interface isn't use. I mean - if you ask me what's better
a small chance that the creation will fail at open or having
a parked and unused thread when device is down - I'd pick
the former.. But I may well be missing the point.

> @@ -825,6 +813,7 @@ static int
>  qcaspi_netdev_init(struct net_device *dev)
>  {
>  	struct qcaspi *qca = netdev_priv(dev);
> +	struct task_struct *thread;
> 
>  	dev->mtu = QCAFRM_MAX_MTU;
>  	dev->type = ARPHRD_ETHER;
> @@ -848,6 +837,15 @@ qcaspi_netdev_init(struct net_device *dev)
>  		return -ENOBUFS;
>  	}
> 
> +	thread = kthread_create(qcaspi_spi_thread, qca, "%s", dev->name);
> +	if (IS_ERR(thread)) {
> +		netdev_err(dev, "%s: unable to start kernel thread.\n",
> +			   QCASPI_DRV_NAME);
> +		return PTR_ERR(thread);

I'm 90% sure this leaks resources on failure, too.

Rest of the series LGTM!

  reply	other threads:[~2024-01-26  2:36 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-24 22:31 [PATCH V3 00/14 next] qca_spi: collection of improvements Stefan Wahren
2024-01-24 22:31 ` [PATCH V3 01/14 next] qca_spi: Improve SPI thread creation Stefan Wahren
2024-01-26  2:36   ` Jakub Kicinski [this message]
2024-01-28 19:52     ` Stefan Wahren
2024-01-24 22:31 ` [PATCH V3 02/14 next] qca_spi: Improve SPI IRQ handling Stefan Wahren
2024-01-24 22:32 ` [PATCH V3 03/14 next] qca_spi: Avoid skb_copy_expand in TX path Stefan Wahren
2024-01-24 22:32 ` [PATCH V3 04/14 next] qca_7k_common: Drop unnecessary function description Stefan Wahren
2024-01-24 22:32 ` [PATCH V3 05/14 next] qca_7k_common: Drop unused len from qcafrm_handle Stefan Wahren
2024-01-24 22:32 ` [PATCH V3 06/14 next] qca_spi: Add QCASPI prefix to ring defines Stefan Wahren
2024-01-24 22:32 ` [PATCH V3 07/14 next] qca_spi: Introduce QCASPI_RX_MAX_FRAMES Stefan Wahren
2024-01-24 22:32 ` [PATCH V3 08/14 next] qca_spi: Improve calculation of RX buffer size Stefan Wahren
2024-01-24 22:32 ` [PATCH V3 09/14 next] qca_spi: Log expected signature in error case Stefan Wahren
2024-01-24 22:32 ` [PATCH V3 10/14 next] qca_spi: Adjust log of SPI_REG_RDBUF_BYTE_AVA Stefan Wahren
2024-01-24 22:32 ` [PATCH V3 11/14 next] qca_7k: Replace BSD boilerplate with SPDX Stefan Wahren
2024-01-24 22:32 ` [PATCH V3 12/14 next] qca_7k: Replace old mail address Stefan Wahren
2024-01-24 22:32 ` [PATCH V3 13/14 next] mailmap: add entry for Stefan Wahren Stefan Wahren
2024-01-24 22:32 ` [PATCH V3 14/14 next] MAINTAINERS: add entry for qca7k driver(s) Stefan Wahren

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=20240125183639.585ec73f@kernel.org \
    --to=kuba@kernel.org \
    --cc=LinoSanfilippo@gmx.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=wahrenst@gmx.net \
    /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.