public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel•org>
To: Shannon Nelson <shannon.nelson@amd•com>
Cc: <netdev@vger•kernel.org>, <davem@davemloft•net>,
	<edumazet@google•com>, <pabeni@redhat•com>,
	<brett.creeley@amd•com>, <drivers@pensando•io>
Subject: Re: [PATCH net-next 4/8] ionic: add work item for missed-doorbell check
Date: Wed, 12 Jun 2024 18:19:00 -0700	[thread overview]
Message-ID: <20240612181900.4d9d18d0@kernel.org> (raw)
In-Reply-To: <20240610230706.34883-5-shannon.nelson@amd.com>

On Mon, 10 Jun 2024 16:07:02 -0700 Shannon Nelson wrote:
> +static void ionic_napi_schedule_do_softirq(struct napi_struct *napi)
> +{
> +	if (napi_schedule_prep(napi)) {
> +		local_bh_disable();
> +		__napi_schedule(napi);
> +		local_bh_enable();

No need to open code napi_schedule()

	local_bh_disable();
	napi_schedule(napi);
	local_bh_enable();

is a fairly well-established pattern

> +	}
> +}

> +static void ionic_doorbell_check_dwork(struct work_struct *work)
> +{
> +	struct ionic *ionic = container_of(work, struct ionic,
> +					   doorbell_check_dwork.work);
> +	struct ionic_lif *lif = ionic->lif;
> +
> +	if (test_bit(IONIC_LIF_F_FW_STOPPING, lif->state) ||
> +	    test_bit(IONIC_LIF_F_FW_RESET, lif->state))
> +		return;
> +
> +	mutex_lock(&lif->queue_lock);

This will deadlock under very inopportune circumstances, no?

The best way of implementing periodic checks using a workqueue is to
only cancel it sync from the .remove callback, before you free the
netdev. Otherwise cancel it non-sync or don't cancel at all, and once
it takes the lock double check the device is still actually running.

  reply	other threads:[~2024-06-13  1:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-10 23:06 [PATCH net-next 0/8] ionic: rework fix for doorbell miss Shannon Nelson
2024-06-10 23:06 ` [PATCH net-next 1/8] ionic: remove missed doorbell per-queue timer Shannon Nelson
2024-06-10 23:07 ` [PATCH net-next 2/8] ionic: Keep interrupt affinity up to date Shannon Nelson
2024-06-10 23:07 ` [PATCH net-next 3/8] ionic: add private workqueue per-device Shannon Nelson
2024-06-13  1:08   ` Jakub Kicinski
2024-06-13 20:38     ` Nelson, Shannon
2024-06-13 22:19       ` Jakub Kicinski
2024-06-13 22:40         ` Nelson, Shannon
2024-06-10 23:07 ` [PATCH net-next 4/8] ionic: add work item for missed-doorbell check Shannon Nelson
2024-06-13  1:19   ` Jakub Kicinski [this message]
2024-06-13 20:38     ` Nelson, Shannon
2024-06-14  1:26       ` Przemek Kitszel
2024-06-10 23:07 ` [PATCH net-next 5/8] ionic: add per-queue napi_schedule for doorbell check Shannon Nelson
2024-06-10 23:07 ` [PATCH net-next 6/8] ionic: check for queue deadline in doorbell_napi_work Shannon Nelson
2024-06-10 23:07 ` [PATCH net-next 7/8] ionic: Use an u16 for rx_copybreak Shannon Nelson
2024-06-15 21:20   ` David Laight
2024-06-16  1:28     ` Andrew Lunn
2024-06-16 10:27       ` David Laight
2024-06-17 16:24     ` Brett Creeley
2024-06-18  8:16       ` David Laight
2024-06-18 16:11         ` Brett Creeley
2024-06-10 23:07 ` [PATCH net-next 8/8] ionic: Only run the doorbell workaround for certain asic_type Shannon Nelson

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=20240612181900.4d9d18d0@kernel.org \
    --to=kuba@kernel$(echo .)org \
    --cc=brett.creeley@amd$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=drivers@pensando$(echo .)io \
    --cc=edumazet@google$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=pabeni@redhat$(echo .)com \
    --cc=shannon.nelson@amd$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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