mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Manikanta Maddireddy <mmaddireddy@nvidia.com>
To: Jon Hunter <jonathanh@nvidia.com>,
	Dmitry Osipenko <digetx@gmail.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Laxman Dewangan <ldewangan@nvidia.com>,
	Wolfram Sang <wsa@the-dreams.de>, 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: Tue, 21 Apr 2020 18:09:05 +0530	[thread overview]
Message-ID: <2e99c2f0-4bba-2ea6-dada-3190c0303dcf@nvidia.com> (raw)
In-Reply-To: <8cd085e1-f9fd-6ec0-9f7a-d5463f176a63@nvidia.com>



On 21-Apr-20 3:19 PM, Jon Hunter wrote:
> Hi Dmitry,
>
> On 21/04/2020 01:32, Dmitry Osipenko wrote:
>> 21.04.2020 01:11, Dmitry Osipenko пишет:
>>> Hello Jon,
>>>
>>> 20.04.2020 22:53, Jon Hunter пишет:
>>>> Hi Dmitry,
>>>>
>>>> On 24/03/2020 19:12, Dmitry Osipenko wrote:
>>>>> Boot CPU0 always handle I2C interrupt and under some rare circumstances
>>>>> (like running KASAN + NFS root) it may stuck in uninterruptible state for
>>>>> a significant time. In this case we will get timeout if I2C transfer is
>>>>> running on a sibling CPU, despite of IRQ being raised. In order to handle
>>>>> this rare condition, the IRQ status needs to be checked after completion
>>>>> timeout.
>>>>>
>>>>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>>>>> ---
>>>>>  drivers/i2c/busses/i2c-tegra.c | 27 +++++++++++++++------------
>>>>>  1 file changed, 15 insertions(+), 12 deletions(-)
>>>>
>>>> I have noticed a regression on tegra30-cardhu-a04 when testing system
>>>> suspend. Git bisect is pointing to this commit and reverting it fixes
>>>> the problem. In the below console log I2C fails to resume ...
>>>>
>>> ...
>>>> [   60.690035] PM: Device 3000.pcie failed to resume noirq: error -16
>>> ...
>>>> [   60.696859] tegra-mc 7000f000.memory-controller: fdcdwr2: write @0x877e8400: EMEM address decode error (SMMU translation error [--S])
>>>>
>>>> [   60.708876] tegra-mc 7000f000.memory-controller: fdcdwr2: write @0x877e8400: Page fault (SMMU translation error [--S])
>>> This looks very wrong, the error tells that 3d hardware is active and
>>> doing something odd. Are you running some 3d tests?
> I am not running any GFX tests. However, I am not sure if the above is
> unrelated.
>
>>>> Have you seen this?
>>> No, I haven't seen that. I'm not using PCIE and it looks like it's the
>>> problem.
>>>
>>> Looking at the PCIE driver code, seems it's not syncing the RPM state on
>>> suspend/resume.
>>>
>>> Please try this change:
>>>
>>> --- >8 ---
>>> diff --git a/drivers/pci/controller/pci-tegra.c
>>> b/drivers/pci/controller/pci-tegra.c
>>> index 3e64ba6a36a8..b1fcbae4109c 100644
>>> --- a/drivers/pci/controller/pci-tegra.c
>>> +++ b/drivers/pci/controller/pci-tegra.c
>>> @@ -2870,8 +2870,8 @@ static int __maybe_unused
>>> tegra_pcie_pm_resume(struct device *dev)
>>>
>>>  static const struct dev_pm_ops tegra_pcie_pm_ops = {
>>>  	SET_RUNTIME_PM_OPS(tegra_pcie_pm_suspend, tegra_pcie_pm_resume, NULL)
>>> -	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(tegra_pcie_pm_suspend,
>>> -				      tegra_pcie_pm_resume)
>>> +	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
>>> +				      pm_runtime_force_resume)
>>>  };
>>>
>>>
>>>  static struct platform_driver tegra_pcie_driver = {
>>> --- >8 ---
>>>
>>> Secondly, I2C driver suspends on NOIRQ level, while APBDMA driver
>>> suspends on default level. This is also wrong, please try to apply this
>>> hunk as well:
>>>
>>> --- >8 ---
>>> diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
>>> index f6a2f42ffc51..e682ac86bd27 100644
>>> --- a/drivers/dma/tegra20-apb-dma.c
>>> +++ b/drivers/dma/tegra20-apb-dma.c
>>> @@ -1653,7 +1653,7 @@ static int __maybe_unused
>>> tegra_dma_dev_resume(struct device *dev)
>>>  static const struct dev_pm_ops tegra_dma_dev_pm_ops = {
>>>  	SET_RUNTIME_PM_OPS(tegra_dma_runtime_suspend, tegra_dma_runtime_resume,
>>>  			   NULL)
>>> -	SET_SYSTEM_SLEEP_PM_OPS(tegra_dma_dev_suspend, tegra_dma_dev_resume)
>>> +	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(tegra_dma_dev_suspend, tegra_dma_dev_resume)
>>>  };
>>>
>>>  static const struct of_device_id tegra_dma_of_match[] = {
>>> --- >8 ---
>>>
>> Although, I'm now having a second though about the APBDMA change... I'm
>> recalling that there are some complications in regards to PCIE driver
>> suspending, requiring it to be at NOIRQ level, but this should be wrong
>> because PCIE driver uses voltage regulator driver at NOIRQ level, while
>> regulator drivers suspend on default level. The current behavior of the
>> PCIE driver should be wrong, I think it needs to be moved to the default
>> suspend-resume level somehow.
> I can try the above, but I agree it would be best to avoid messing with
> the suspend levels if possible.
>
> I am adding Manikanta to get some feedback on why we moved the PCI
> suspend to the NOIRQ phase because it is not clear to me if we need to
> do this here.
>
> Manikanta, can you comment on whether we really need to suspend Tegra
> PCI during the noirq phase?

PCIe subsystem driver implemented noirq PM callbacks, it will save & restore
endpoint config space in these PM callbacks. PCIe controller should be
available during this time, so noirq PM callbacks are implemented in Tegra
PCIe driver.

file: drivers/pci/pci-driver.c
static const struct dev_pm_ops pci_dev_pm_ops = {
	...
        .suspend_noirq = pci_pm_suspend_noirq,
        .resume_noirq = pci_pm_resume_noirq,
        ...
};

Thanks,
Manikanta

>  	
> Cheers
> Jon
>


  reply	other threads:[~2020-04-21 12:40 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 [this message]
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
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=2e99c2f0-4bba-2ea6-dada-3190c0303dcf@nvidia.com \
    --to=mmaddireddy@nvidia.com \
    --cc=digetx@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=ldewangan@nvidia.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --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

Powered by JetHome