[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240612181900.4d9d18d0@kernel.org>
Date: Wed, 12 Jun 2024 18:19:00 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Shannon Nelson <shannon.nelson@....com>
Cc: <netdev@...r.kernel.org>, <davem@...emloft.net>, <edumazet@...gle.com>,
<pabeni@...hat.com>, <brett.creeley@....com>, <drivers@...sando.io>
Subject: Re: [PATCH net-next 4/8] ionic: add work item for missed-doorbell
check
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.
Powered by blists - more mailing lists