From: Niklas Cassel <Niklas.Cassel@wdc.com>
To: Kishon Vijay Abraham I <kvijayab@amd.com>
Cc: "Niklas Cassel" <nks@flawful.org>,
"Bjorn Helgaas" <helgaas@kernel.org>,
"Jingoo Han" <jingoohan1@gmail.com>,
"Gustavo Pimentel" <gustavo.pimentel@synopsys.com>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Rob Herring" <robh@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>
Subject: Re: [PATCH v2] PCI: dwc: endpoint: Fix dw_pcie_ep_raise_msix_irq() alignment support
Date: Tue, 9 Jan 2024 12:52:24 +0000 [thread overview]
Message-ID: <ZZ1Bh4pnxTVcVGly@x1-carbon> (raw)
In-Reply-To: <9b6360d7-8880-f522-b368-3ca3b1694cd3@amd.com>
On Wed, Jan 03, 2024 at 11:33:35AM +0530, Kishon Vijay Abraham I wrote:
> Hi Niklas,
Hello Kishon!
> > > I assume dw_pcie_ep_map_addr(), writel(), dw_pcie_ep_unmap_addr() have
> > > to happen atomically so nobody else uses that piece of the ATU while
> > > we're doing this? There's no mutex here, so I guess we must know this
> > > is atomic already because of something else?
> >
> > Most devices have multiple iATUs (so multiple iATU indexes).
> >
> > pcie-designware-ep.c:dw_pcie_ep_outbound_atu()
> > uses find_first_zero_bit() to make sure that a specific iATU (index)
> > is not reused for something else:
> > https://github.com/torvalds/linux/blob/v6.7-rc7/drivers/pci/controller/dwc/pcie-designware-ep.c#L208
> >
> > A specific iATU (index) is then freed by dw_pcie_ep_unmap_addr(),
> > which does a clear_bit() for that iATU (index).
> >
> > It is a bit scary that there is no mutex or anything, since
> > find_first_zero_bit() is _not_ atomic, so if we have concurrent calls
> > to dw_pcie_ep_map_addr(), things might break, but that is a separate
> > issue.
>
> There cannot be concurrent calls to dw_pcie_ep_map_addr() in the current
> code path as pci_epc_raise_irq(), pci_epc_map_addr() and
> pci_epc_unmap_addr() which invokes dw_pcie_ep_map_addr() takes EPC lock in
> pci-epc-core.
I must have overlooked the mutex in pci-epc-core.
Thank you for clearing that up.
Kind regards,
Niklas
next prev parent reply other threads:[~2024-01-09 12:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-28 13:22 [PATCH v2] PCI: dwc: endpoint: Fix dw_pcie_ep_raise_msix_irq() alignment support Niklas Cassel
2023-11-28 16:21 ` Manivannan Sadhasivam
2023-12-14 9:59 ` Niklas Cassel
2023-12-18 1:17 ` Krzysztof Wilczyński
2023-12-18 1:12 ` Krzysztof Wilczyński
2023-12-26 22:17 ` Bjorn Helgaas
2023-12-27 11:57 ` Niklas Cassel
2023-12-27 13:03 ` Bjorn Helgaas
2024-01-02 16:48 ` Manivannan Sadhasivam
2024-01-02 10:25 ` Kishon Vijay Abraham I
2024-01-03 6:03 ` Kishon Vijay Abraham I
2024-01-09 12:52 ` Niklas Cassel [this message]
2024-01-02 15:54 ` Manivannan Sadhasivam
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=ZZ1Bh4pnxTVcVGly@x1-carbon \
--to=niklas.cassel@wdc.com \
--cc=bhelgaas@google.com \
--cc=gustavo.pimentel@synopsys.com \
--cc=helgaas@kernel.org \
--cc=jingoohan1@gmail.com \
--cc=kishon@kernel.org \
--cc=kvijayab@amd.com \
--cc=kw@linux.com \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=nks@flawful.org \
--cc=robh@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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.