From: David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
To: david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org
Cc: linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org,
ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org,
james.hogan-8NJIiSa5LzA@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
mark.rutland-5wv7dgnIgG8@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
steven.hill-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
andrew-g2DYL2Zd6BY@public.gmane.org,
f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
pombredanne-od1rfyK75/E@public.gmane.org,
cmunoz-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org
Subject: Re: [PATCH v6 net-next,mips 6/7] netdev: octeon-ethernet: Add Cavium Octeon III support.
Date: Fri, 08 Dec 2017 14:29:31 -0500 (EST) [thread overview]
Message-ID: <20171208.142931.969279261124372071.davem@davemloft.net> (raw)
In-Reply-To: <20171208000934.6554-7-david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
From: David Daney <david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
Date: Thu, 7 Dec 2017 16:09:33 -0800
> +static void bgx_port_check_state(struct work_struct *work)
> +{
...
> + mutex_lock(&priv->lock);
> + if (priv->work_queued)
> + queue_delayed_work(check_state_wq, &priv->dwork, HZ);
> + mutex_unlock(&priv->lock);
> +}
...
> +int bgx_port_disable(struct net_device *netdev)
> +{
...
> + mutex_lock(&priv->lock);
> + if (priv->work_queued) {
> + cancel_delayed_work_sync(&priv->dwork);
> + priv->work_queued = false;
This can deadlock.
When you do a sync work cancel, it waits until all running work
instances finish. You have the priv->lock, so if
bgx_port_check_status() need to still take priv->lock to complete
then no further progress will be made.
I think it is pointless to use this weird work_queued boolean state.
Just unconditionally, and without locking, cancel the delayed work,
ragardless of whether it was actually used ever or not.
Thank you.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-12-08 19:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-08 0:09 [PATCH v6 net-next,mips 0/7] Cavium OCTEON-III network driver David Daney
2017-12-08 0:09 ` [PATCH v6 net-next,mips 1/7] dt-bindings: Add Cavium Octeon Common Ethernet Interface David Daney
2017-12-08 0:09 ` [PATCH v6 net-next,mips 2/7] MIPS: Octeon: Enable LMTDMA/LMTST operations David Daney
2017-12-08 0:09 ` [PATCH v6 net-next,mips 3/7] MIPS: Octeon: Automatically provision CVMSEG space David Daney
2017-12-08 0:09 ` [PATCH v6 net-next,mips 4/7] staging: octeon: Remove USE_ASYNC_IOBDMA macro David Daney
2017-12-08 0:09 ` [PATCH v6 net-next,mips 5/7] MIPS: Octeon: Add a global resource manager David Daney
2017-12-08 0:09 ` [PATCH v6 net-next,mips 6/7] netdev: octeon-ethernet: Add Cavium Octeon III support David Daney
[not found] ` <20171208000934.6554-7-david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
2017-12-08 19:29 ` David Miller [this message]
2017-12-08 0:09 ` [PATCH v6 net-next,mips 7/7] MAINTAINERS: Add entry for drivers/net/ethernet/cavium/octeon/octeon3-* David Daney
2017-12-08 8:11 ` [PATCH v6 net-next,mips 0/7] Cavium OCTEON-III network driver Philippe Ombredanne
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=20171208.142931.969279261124372071.davem@davemloft.net \
--to=davem-ft/pcqaiutieiz0/mpfg9q@public.gmane.org \
--cc=andrew-g2DYL2Zd6BY@public.gmane.org \
--cc=cmunoz-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org \
--cc=david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=james.hogan-8NJIiSa5LzA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=pombredanne-od1rfyK75/E@public.gmane.org \
--cc=ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=steven.hill-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).