stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Mark Jonas <mark.jonas@de.bosch.com>
Cc: stable@vger.kernel.org, Wolfram Sang <wsa@the-dreams.de>,
	Kjetil Aamodt <kjetilaamodt@gmail.com>,
	Wang Xin <xin.wang7@cn.bosch.com>,
	Leo Ruan <tingquan.ruan@cn.bosch.com>,
	Bartosz Golaszewski <brgl@bgdev.pl>
Subject: Re: [PATCH 4.19] commit 9a9e295e7c5c0409c020088b0ae017e6c2b7df6e upstream.
Date: Mon, 1 Jul 2019 17:40:36 +0200	[thread overview]
Message-ID: <20190701154036.GA7360@kroah.com> (raw)
In-Reply-To: <20190626151416.10997-1-mark.jonas@de.bosch.com>

On Wed, Jun 26, 2019 at 05:14:16PM +0200, Mark Jonas wrote:
> From: Wang Xin <xin.wang7@cn.bosch.com>
> 
> eeprom: at24: fix unexpected timeout under high load
> 
> Within at24_loop_until_timeout the timestamp used for timeout checking
> is recorded after the I2C transfer and sleep_range(). Under high CPU
> load either the execution time for I2C transfer or sleep_range() could
> actually be larger than the timeout value. Worst case the I2C transfer
> is only tried once because the loop will exit due to the timeout
> although the EEPROM is now ready.
> 
> To fix this issue the timestamp is recorded at the beginning of each
> iteration. That is, before I2C transfer and sleep. Then the timeout
> is actually checked against the timestamp of the previous iteration.
> This makes sure that even if the timeout is reached, there is still one
> more chance to try the I2C transfer in case the EEPROM is ready.
> 
> Example:
> 
> If you have a system which combines high CPU load with repeated EEPROM
> writes you will run into the following scenario.
> 
>  - System makes a successful regmap_bulk_write() to EEPROM.
>  - System wants to perform another write to EEPROM but EEPROM is still
>    busy with the last write.
>  - Because of high CPU load the usleep_range() will sleep more than
>    25 ms (at24_write_timeout).
>  - Within the over-long sleeping the EEPROM finished the previous write
>    operation and is ready again.
>  - at24_loop_until_timeout() will detect timeout and won't try to write.
> 
> Cc: <stable@vger.kernel.org> # 4.19.x

This and the 4.14.y version now queued up, thanks!

greg k-h

      reply	other threads:[~2019-07-01 15:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-26 15:14 [PATCH 4.19] commit 9a9e295e7c5c0409c020088b0ae017e6c2b7df6e upstream Mark Jonas
2019-07-01 15:40 ` Greg KH [this message]

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=20190701154036.GA7360@kroah.com \
    --to=greg@kroah.com \
    --cc=brgl@bgdev.pl \
    --cc=kjetilaamodt@gmail.com \
    --cc=mark.jonas@de.bosch.com \
    --cc=stable@vger.kernel.org \
    --cc=tingquan.ruan@cn.bosch.com \
    --cc=wsa@the-dreams.de \
    --cc=xin.wang7@cn.bosch.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;
as well as URLs for NNTP newsgroup(s).