Linux-i2c Archive on lore.kernel.org
 help / color / Atom feed
From: "Marek Behún" <kabel@kernel.org>
To: Gregory CLEMENT <gregory.clement@bootlin.com>
Cc: Wolfram Sang <wsa@kernel.org>,
	linux-i2c@vger.kernel.org, Samuel Holland <samuel@sholland.org>,
	Ondrej Jirman <megous@megous.com>
Subject: Re: [PATCH] i2c: mv64xxx: Fix random system lock caused by runtime PM
Date: Wed, 14 Apr 2021 16:29:08 +0200
Message-ID: <20210414162908.5034257a@thinkpad> (raw)
In-Reply-To: <87mtu1atcd.fsf@BL-laptop>

On Wed, 14 Apr 2021 15:28:18 +0200
Gregory CLEMENT <gregory.clement@bootlin.com> wrote:

> > On Thu, Apr 08, 2021 at 04:00:00AM +0200, Marek Behún wrote:  
> >> I noticed a weird bug with this driver on Marvell CN9130 Customer
> >> Reference Board.
> >> 
> >> Sometime after boot, the system locks with the following message:
> >>  [104.071363] i2c i2c-0: mv64xxx: I2C bus locked, block: 1, time_left: 0
> >> 
> >> The system does not respond afterwards, only warns about RCU stalls.
> >> 
> >> This first appeared with commit e5c02cf54154 ("i2c: mv64xxx: Add runtime
> >> PM support").
> >> 
> >> With further experimentation I discovered that adding a delay into
> >> mv64xxx_i2c_hw_init() fixes this issue. This function is called before
> >> every xfer, due to how runtime PM works in this driver. It seems that in
> >> order to work correctly, a delay is needed after the bus is reset in
> >> this function.  
> 
> Marek,
> 
> As you mentioned it was related to reset and the issue occurred with the
> support of runtime PM. Did you try to add the delay only in the function
> mv64xxx_i2c_runtime_resume(), just after the mv64xxx_i2c_hw_init() call ?
> 

I did indeed discover this when I added this delay into the resume
function. In fact I discovered this when I added printf()s into suspend
and resume when debugging. The problem disappeared with these printf()s
(UART is slow so printf() counted as the necessary delay it seems).

I then moved the delay into the hw_init() function because that is what
made sense to me, that the delay is necessary after the reset, not only
when resuming, but always. We just did not notice because a xfer was
never done immediately after reset before the PM patch. (But maybe I am
wrong, maybe it is not needed in the reset. It just makes the most
sense to me...)

Marek

  reply index

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-08  2:00 Marek Behún
2021-04-10 16:47 ` Marek Behún
2021-04-13 19:58 ` Wolfram Sang
2021-04-14 13:28   ` Gregory CLEMENT
2021-04-14 14:29     ` Marek Behún [this message]
2021-04-14 13:42   ` Samuel Holland
2021-04-15 20:13 ` Wolfram Sang

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=20210414162908.5034257a@thinkpad \
    --to=kabel@kernel.org \
    --cc=gregory.clement@bootlin.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=megous@megous.com \
    --cc=samuel@sholland.org \
    --cc=wsa@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

Linux-i2c Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-i2c/0 linux-i2c/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-i2c linux-i2c/ https://lore.kernel.org/linux-i2c \
		linux-i2c@vger.kernel.org
	public-inbox-index linux-i2c

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-i2c


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git