From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: Oliver Neukum <oneukum@suse.com>, ryder.lee@mediatek.com
Cc: jianjun.wang@mediatek.com, lpieralisi@kernel.org, kw@linux.com,
robh@kernel.org, bhelgaas@google.com, p.zabel@pengutronix.de,
matthias.bgg@gmail.com, linux-pci@vger.kernel.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] PCI: mediatek-gen3: Stop acquiring spinlocks in {suspend,resume}_noirq
Date: Thu, 8 Jun 2023 12:17:34 +0200 [thread overview]
Message-ID: <6d31e143-1b8f-21ba-8ffe-cee9cac324ea@collabora.com> (raw)
In-Reply-To: <479acc85-2349-d0ac-851c-f57b1bf6aa9e@suse.com>
Il 08/05/23 09:44, Oliver Neukum ha scritto:
> On 04.05.23 13:35, AngeloGioacchino Del Regno wrote:
>
> Hi,
>
> looking at your patch I am afraid there is an issue.
>
>> In mtk_pcie_suspend_noirq() and mtk_pcie_resume_noirq() we are,
>> respectively, disabling and enabling generation of interrupts and
>> then saving and restoring the enabled interrupts register: since
>> we're using noirq PM callbacks, that can be safely done without
>> holding any spin lock.
>
> Why? You can still race with another CPU in task context.
> That is if you say that you do not need locking to touch
> PCIE_INT_ENABLE_REG that is fine, but then why do you remove
> it from one place only?
> It is also touched in mtk_pcie_probe() at a minimum.
>
>
>> That was noticed because of, and solves, the following issue:
>>
>> <4>[ 74.185982] ========================================================
>> <4>[ 74.192629] WARNING: possible irq lock inversion dependency detected
>> <4>[ 74.199276] 6.3.0-next-20230428+ #51 Tainted: G W
>> <4>[ 74.205664] --------------------------------------------------------
>> <4>[ 74.212309] systemd-sleep/809 just changed the state of lock:
>> <4>[ 74.218347] ffff65a5c34c65a0 (&pcie->irq_lock){+...}-{2:2}, at:
>> mtk_pcie_resume+0x50/0xa8
>> <4>[ 74.226870] but this lock was taken by another, HARDIRQ-safe lock in the past:
>> <4>[ 74.234389] (&irq_desc_lock_class){-.-.}-{2:2}
>> <4>[ 74.234409]
>> <4>[ 74.234409]
>> <4>[ 74.234409] and interrupts could create inverse lock ordering between them.
>> <4>[ 74.234409]
>> <4>[ 74.251704]
>> <4>[ 74.251704] other info that might help us debug this:
>> <4>[ 74.258785] Possible interrupt unsafe locking scenario:
>> <4>[ 74.258785]
>> <4>[ 74.266126] CPU0 CPU1
>> <4>[ 74.270942] ---- ----
>> <4>[ 74.275758] lock(&pcie->irq_lock);
>
> Lock A
>
>> <4>[ 74.279627] local_irq_disable();
>
> strictly speaking irrelevant
>
>> <4>[ 74.285836] lock(&irq_desc_lock_class);
>
> lock B
>
>> <4>[ 74.292667] lock(&pcie->irq_lock);
>
> lock A
>
>> <4>[ 74.299061] <Interrupt>
>
> You do not need that interrupt.
>
>> <4>[ 74.301960] lock(&irq_desc_lock_class);
>
> lock B
>
>> <4>[ 74.306438]
>> <4>[ 74.306438] *** DEADLOCK ***
Sorry for the very late reply. I just noticed this.
I'm unsure, at this point, about how to solve this warning; ideas?
Thanks,
Angelo
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-06-08 10:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-04 11:35 [PATCH 0/2] MediaTek PCIe Gen3: Suspend fixes AngeloGioacchino Del Regno
2023-05-04 11:35 ` [PATCH 1/2] PCI: mediatek-gen3: Stop acquiring spinlocks in {suspend,resume}_noirq AngeloGioacchino Del Regno
[not found] ` <479acc85-2349-d0ac-851c-f57b1bf6aa9e@suse.com>
2023-06-08 10:17 ` AngeloGioacchino Del Regno [this message]
2023-06-08 17:15 ` Bjorn Helgaas
2023-06-09 7:29 ` AngeloGioacchino Del Regno
2023-05-04 11:35 ` [PATCH 2/2] PCI: mediatek-gen3: Assert MAC reset only if PHY reset also present AngeloGioacchino Del Regno
2023-12-28 15:00 ` Nícolas F. R. A. Prado
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=6d31e143-1b8f-21ba-8ffe-cee9cac324ea@collabora.com \
--to=angelogioacchino.delregno@collabora.com \
--cc=bhelgaas@google.com \
--cc=jianjun.wang@mediatek.com \
--cc=kw@linux.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=oneukum@suse.com \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=ryder.lee@mediatek.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