mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: david.daney@cavium.com
Cc: linux-mips@linux-mips.org, ralf@linux-mips.org,
	james.hogan@mips.com, netdev@vger.kernel.org, robh+dt@kernel.org,
	mark.rutland@arm.com, linux-kernel@vger.kernel.org,
	steven.hill@cavium.com, devicetree@vger.kernel.org,
	andrew@lunn.ch, f.fainelli@gmail.com, pombredanne@nexb.com,
	cmunoz@cavium.com
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@cavium.com>

From: David Daney <david.daney@cavium.com>
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.

  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
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@davemloft.net \
    --cc=andrew@lunn.ch \
    --cc=cmunoz@cavium.com \
    --cc=david.daney@cavium.com \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=james.hogan@mips.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=mark.rutland@arm.com \
    --cc=netdev@vger.kernel.org \
    --cc=pombredanne@nexb.com \
    --cc=ralf@linux-mips.org \
    --cc=robh+dt@kernel.org \
    --cc=steven.hill@cavium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®