From: Jacob Keller <jacob.e.keller@intel.com>
To: "Nelson, Shannon" <shannon.nelson@amd.com>,
<netdev@vger.kernel.org>, <davem@davemloft.net>,
<kuba@kernel.org>, <edumazet@google.com>, <pabeni@redhat.com>,
<andrew+netdev@lunn.ch>
Cc: <brett.creeley@amd.com>
Subject: Re: [PATCH net 2/3] ionic: no double destroy workqueue
Date: Wed, 11 Dec 2024 11:23:03 -0800 [thread overview]
Message-ID: <230d76ef-5ca8-400d-8f59-406292025da3@intel.com> (raw)
In-Reply-To: <a8faf111-281a-450e-b595-ba35a7ccc66d@amd.com>
On 12/10/2024 1:44 PM, Nelson, Shannon wrote:
> On 12/10/2024 1:02 PM, Jacob Keller wrote:
>> On 12/10/2024 9:48 AM, Shannon Nelson wrote:
>>> There are some FW error handling paths that can cause us to
>>> try to destroy the workqueue more than once, so let's be sure
>>> we're checking for that.
>>>
>>> The case where this popped up was in an AER event where the
>>> handlers got called in such a way that ionic_reset_prepare()
>>> and thus ionic_dev_teardown() got called twice in a row.
>>> The second time through the workqueue was already destroyed,
>>> and destroy_workqueue() choked on the bad wq pointer.
>>>
>>> We didn't hit this in AER handler testing before because at
>>> that time we weren't using a private workqueue. Later we
>>> replaced the use of the system workqueue with our own private
>>> workqueue but hadn't rerun the AER handler testing since then.
>>>
>>> Fixes: 9e25450da700 ("ionic: add private workqueue per-device")
>>> Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
>>> ---
>>> drivers/net/ethernet/pensando/ionic/ionic_dev.c | 5 ++++-
>>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.c b/drivers/net/ethernet/pensando/ionic/ionic_dev.c
>>> index 9e42d599840d..57edcde9e6f8 100644
>>> --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.c
>>> +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.c
>>> @@ -277,7 +277,10 @@ void ionic_dev_teardown(struct ionic *ionic)
>>> idev->phy_cmb_pages = 0;
>>> idev->cmb_npages = 0;
>>>
>>> - destroy_workqueue(ionic->wq);
>>> + if (ionic->wq) {
>>> + destroy_workqueue(ionic->wq);
>>> + ionic->wq = NULL;
>>> + }
>>
>> This seems like you still could race if two threads call
>> ionic_dev_teardown twice. Is that not possible due to some other
>> synchronization mechanism?
>
> Good question. Thanks for looking at this and the other patches.
>
> This is not a race thing so much as an already-been-here thing. This
> function is only called by the probe, remove, and reset_prepare threads,
> all driven as PCI calls. I'm reasonably sure that they won't be called
> my simultaneous threads, so we just need to be sure that we don't break
> if reset_prepare and remove get called one after the other because some
> PCI bus element got removed by surprise.
>
> sln
Ok. This is all serialized by the device/PCI layer then?
Makes sense.
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
>
>
>>
>> Thanks,
>> Jake
>>
>>> mutex_destroy(&idev->cmb_inuse_lock);
>>> }
>>>
>>
>
next prev parent reply other threads:[~2024-12-11 19:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-10 17:48 [PATCH net 0/3] ionic: minor code fixes Shannon Nelson
2024-12-10 17:48 ` [PATCH net 1/3] ionic: Fix netdev notifier unregister on failure Shannon Nelson
2024-12-10 20:59 ` Jacob Keller
2024-12-12 4:28 ` Jakub Kicinski
2024-12-12 17:47 ` Nelson, Shannon
2024-12-10 17:48 ` [PATCH net 2/3] ionic: no double destroy workqueue Shannon Nelson
2024-12-10 21:02 ` Jacob Keller
2024-12-10 21:44 ` Nelson, Shannon
2024-12-11 19:23 ` Jacob Keller [this message]
2024-12-10 17:48 ` [PATCH net 3/3] ionic: use ee->offset when returning sprom data Shannon Nelson
2024-12-10 21:03 ` Jacob Keller
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=230d76ef-5ca8-400d-8f59-406292025da3@intel.com \
--to=jacob.e.keller@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=brett.creeley@amd.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shannon.nelson@amd.com \
/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.