netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: liu.xiang6@zte.com.cn
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	liuxiang1999@gmail.com
Subject: Re: [PATCH v2] net: davicom: dm9000: Avoid spinlock recursion during dm9000_timeout routine
Date: Wed, 07 Jun 2017 14:38:44 -0400 (EDT)	[thread overview]
Message-ID: <20170607.143844.682492319776197931.davem@davemloft.net> (raw)
In-Reply-To: <1496758626-2726-1-git-send-email-liu.xiang6@zte.com.cn>

From: Liu Xiang <liu.xiang6@zte.com.cn>
Date: Tue,  6 Jun 2017 22:17:06 +0800

> On the DM9000B, dm9000_phy_write() is called after the main spinlock
> is held, during the dm9000_timeout() routine. Spinlock recursion
> occurs because the main spinlock is requested again in
> dm9000_phy_write(). So spinlock should be avoided in phy operation
> during the dm9000_timeout() routine.
> 
> ---
> v2:
>    dm9000_phy_write_reg is extracted from dm9000_phy_write, with no lock,
>    do the real phy operation.

I told you during your first submission that this is racy.

Conditional locking in multithreaded driver almost never works
properly.

Once we enter the timeout, another asynchronous thread of control (an
interrupt, timer, whatever) can try to do a PHY operation and skip the
locking because the timeout boolean is set.

That's not right.

You will need to find a more correct solution to this locking problem.

Thanks.

  reply	other threads:[~2017-06-07 18:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-06 14:17 [PATCH v2] net: davicom: dm9000: Avoid spinlock recursion during dm9000_timeout routine Liu Xiang
2017-06-07 18:38 ` David Miller [this message]
2017-07-15  8:56   ` xiang fei

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=20170607.143844.682492319776197931.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liu.xiang6@zte.com.cn \
    --cc=liuxiang1999@gmail.com \
    --cc=netdev@vger.kernel.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).