mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jon Hunter <jonathanh@nvidia.com>
To: Dmitry Osipenko <digetx@gmail.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Laxman Dewangan <ldewangan@nvidia.com>,
	"Wolfram Sang" <wsa@the-dreams.de>,
	Manikanta Maddireddy <mmaddireddy@nvidia.com>,
	Vidya Sagar <vidyas@nvidia.com>
Cc: <linux-i2c@vger.kernel.org>, <linux-tegra@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] i2c: tegra: Better handle case where CPU0 is busy for a long time
Date: Fri, 24 Apr 2020 08:10:26 +0100	[thread overview]
Message-ID: <fd1ca178-1ea3-851f-20a6-10bf00453ce3@nvidia.com> (raw)
In-Reply-To: <f8fb1f7f-2497-033e-ff2c-c86c6caa9706@gmail.com>


On 23/04/2020 17:33, Dmitry Osipenko wrote:
> 23.04.2020 13:56, Jon Hunter пишет:
>>
>> On 22/04/2020 15:07, Dmitry Osipenko wrote:
>>
>> ...
>>
>>>> So I think that part of the problem already existed prior to these
>>>> patches. Without your patches I see ...
>>>>
>>>> [   59.543528] tegra-i2c 7000d000.i2c: i2c transfer timed out
>>>
>>> Does this I2C timeout happen with my patches? Could you please post full
>>> logs of an older and the recent kernel versions?
>>
>> I believe that it does, but I need to check.
>>
>>>> [   59.549036] vdd_sata,avdd_plle: failed to disable
>>>>
>>>> [   59.553778] Failed to disable avdd-plle: -110
>>>>
>>>> [   59.558150] tegra-pcie 3000.pcie: failed to disable regulators: -110
>>>>
>>>>
>>>> However, now with your patches the i2c is failing to resume and this
>>>> breaks system suspend completely for Tegra30. So far this is the only
>>>> board that appears to break.
>>>>
>>>> So the above issue needs to be fixed and I will chat to Thierry about this.
>>>
>>> Okay
>>
>> So I have been looking at this some more and this starting to all look a
>> bit of a mess :-(
>>
>> Firstly, the Tegra PCI driver suspends late (noirq) as we know. The PCI
>> driver will warn if it cannot disable the regulators when suspending but
>> does not actually fail suspend. So this warning is just indicating that
>> we were unable to disable the regulators.
>>
>> Now I don't see that we can ever disable the PCI regulators currently
>> when entering suspend because ...
>>
>> 1. We are in the noirq phase and so we will not get the completion
>>    interrupt for the I2C transfer. I know that you recently added the
>>    atomic I2C transfer support, but we can get the regulator framework
>>    to use this (I have not looked in much detail so far).
> 
> That's not good :) I didn't realize that *all* interrupts of every
> device are disabled before .noirq is invoked. It appeared to me that the
> IRQs disabling and .noirq invocation is performed for the drivers one
> after another, but now I see that it's not true.
> 
> https://elixir.bootlin.com/linux/v5.7-rc2/source/drivers/base/power/main.c#L1446
> 
>> 2. Even if the regulator framework supported atomic I2C transfers, we
>>    also have the problem that the I2C controller could be runtime-
>>    suspended and pm_runtime_get_sync() will not work during during this
>>    phase to resume it correctly. This is a problem that needs to be
>>    fixed indeed!
> 
> Could you please clarify why pm_runtime_get_sync() can't be used by the
> I2C driver's in NOIRQ phase?

Yes take a look at commit 1e2ef05bb8cf ("PM: Limit race conditions
between runtime PM and system sleep (v2)").

>> 3. Then we also have the possible dependency on the DMA driver that is
>>    suspended during the noirq phase.
> 
> Yes, this is correct.
> 
> Again, some regulator drivers may do something on suspend too, although
> looks like the current upstream Tegra devices are not affected by this
> potential problem.
> 
>> It could be argued that if the PCI regulators are never turned off
>> (currently) then we should not even bother and this will likely resolve
>> this for now. However, really we should try to fix that correctly.
> 
> Yes, keeping PCI regulators always-enabled should be a good immediate
> solution.

I was thinking about that, and I am not sure it is. I don't think that
the failure to send the I2C command should break suspend.

> Also, the RPM's system suspend/resume needs to fixed for the pci-tegra
> driver, like I already suggested before.

Yes but I don't think that is the cause of the issue in this particular
case.

>> What I still don't understand is why your patch breaks resume. Even if
>> the I2C transfer fails, and is deemed harmless by the client driver, we
>> should still be able to suspend and resume correctly.
> 
> If DMA is getting synchronized after DMA driver being suspended, then it
> could be a problem.

So I confirmed that DMA is not the issue in this case. I tested this by
ensuring that DMA is never used. However, it is a potential problem
indeed.

> Could you please try to apply this hunk and see if it makes any
> difference (I'll probably make it as proper patch):

Per my tests, I don't believe that it will as disabling DMA does not
resolve the problem.

> It also could be that there is more than the suspend ordering problem,
> but for now it is hard to tell without having a detailed log which
> includes I2C/DMA/RPM traces.

I have taken a look and I don't see any issues with ordering. I2C is
suspended after PCI. This did not change.

Cheers
Jon

-- 
nvpublic

  reply	other threads:[~2020-04-24  7:10 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-24 19:12 [PATCH v2 0/2] NVIDIA Tegra I2C synchronization correction Dmitry Osipenko
2020-03-24 19:12 ` [PATCH v2 1/2] i2c: tegra: Better handle case where CPU0 is busy for a long time Dmitry Osipenko
2020-04-15 16:31   ` Wolfram Sang
2020-04-20 19:53   ` Jon Hunter
2020-04-20 22:11     ` Dmitry Osipenko
2020-04-21  0:32       ` Dmitry Osipenko
2020-04-21  9:49         ` Jon Hunter
2020-04-21 12:39           ` Manikanta Maddireddy
2020-04-21 13:08             ` Jon Hunter
2020-04-21 13:49               ` Manikanta Maddireddy
2020-04-21 13:25           ` Dmitry Osipenko
2020-04-21 14:40             ` Jon Hunter
2020-04-21 15:08               ` Dmitry Osipenko
2020-04-21 19:42                 ` Jon Hunter
2020-04-22 13:40                   ` Dmitry Osipenko
2020-04-22 13:59                     ` Jon Hunter
2020-04-22 14:07                       ` Dmitry Osipenko
2020-04-23 10:56                         ` Jon Hunter
2020-04-23 16:33                           ` Dmitry Osipenko
2020-04-24  7:10                             ` Jon Hunter [this message]
2020-04-24 14:45                               ` Dmitry Osipenko
2020-04-24 15:19                                 ` Jon Hunter
2020-04-27  7:48                                   ` Thierry Reding
2020-04-27  8:44                                     ` Wolfram Sang
2020-04-27  9:07                                       ` Dmitry Osipenko
2020-04-27 10:35                                         ` Wolfram Sang
2020-04-27 10:50                                           ` Thierry Reding
2020-04-27 15:32                                             ` Thierry Reding
2020-04-27 16:02                                               ` Dmitry Osipenko
2020-04-27 10:49                                         ` Thierry Reding
2020-04-27  9:52                                     ` Dmitry Osipenko
2020-04-27 10:38                                       ` Wolfram Sang
2020-04-27 13:15                                         ` Dmitry Osipenko
2020-04-27 14:19                                           ` Thierry Reding
2020-04-27 15:31                                             ` Wolfram Sang
2020-05-02 14:40                                               ` Dmitry Osipenko
2020-05-02 14:43                                                 ` Wolfram Sang
2020-05-04 15:42                                                 ` Thierry Reding
2020-05-04 20:55                                                   ` Dmitry Osipenko
2020-04-27 11:00                                       ` Thierry Reding
2020-04-27 14:21                                         ` Dmitry Osipenko
2020-04-27 15:12                                           ` Thierry Reding
2020-04-27 15:18                                             ` Dmitry Osipenko
2020-04-28  8:01                                               ` Jon Hunter
2020-04-28 12:37                                                 ` Dmitry Osipenko
2020-04-29  8:14                                               ` Thierry Reding
2020-04-29  8:55                                                 ` Thierry Reding
2020-04-29 12:35                                                   ` Dmitry Osipenko
2020-04-29 13:57                                                     ` Jon Hunter
2020-04-29 14:46                                                       ` Dmitry Osipenko
2020-04-29 16:24                                                         ` Thierry Reding
2020-04-29 17:02                                                           ` Dmitry Osipenko
2020-04-29 16:30                                                     ` Thierry Reding
2020-04-29 16:54                                                       ` Dmitry Osipenko
2020-04-29 17:34                                                         ` Dmitry Osipenko
2020-04-27 12:46                           ` Dmitry Osipenko
2020-04-27 14:13                             ` Dmitry Osipenko
2020-04-27 14:45                               ` Dmitry Osipenko
2020-04-27 15:38                                 ` Dmitry Osipenko
2020-04-28  8:02                                   ` Jon Hunter
2020-04-28 23:12                                     ` Dmitry Osipenko
2020-04-21 15:18               ` Dmitry Osipenko
2020-04-21 15:34                 ` Jon Hunter
2020-04-21 19:07                   ` Dmitry Osipenko
2020-04-28 13:43     ` Dmitry Osipenko
2020-03-24 19:12 ` [PATCH v2 2/2] i2c: tegra: Synchronize DMA before termination Dmitry Osipenko
2020-04-15 16:31   ` Wolfram Sang
2020-04-15 11:45 ` [PATCH v2 0/2] NVIDIA Tegra I2C synchronization correction Wolfram Sang
2020-04-15 14:14   ` Dmitry Osipenko
2020-04-15 16:23     ` 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=fd1ca178-1ea3-851f-20a6-10bf00453ce3@nvidia.com \
    --to=jonathanh@nvidia.com \
    --cc=digetx@gmail.com \
    --cc=ldewangan@nvidia.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mmaddireddy@nvidia.com \
    --cc=thierry.reding@gmail.com \
    --cc=vidyas@nvidia.com \
    --cc=wsa@the-dreams.de \
    /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®