From: Niklas Schnelle <schnelle@linux.ibm.com>
To: Saeed Mahameed <saeed@kernel.org>
Cc: Saeed Mahameed <saeedm@nvidia.com>,
Leon Romanovsky <leon@kernel.org>, Jason Gunthorpe <jgg@ziepe.ca>,
Matthew Rosato <mjrosato@linux.ibm.com>,
Joerg Roedel <joro@8bytes.org>,
Robin Murphy <robin.murphy@arm.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Shay Drory <shayd@nvidia.com>, Moshe Shemesh <moshe@nvidia.com>,
Heiko Carstens <hca@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
linux-s390@vger.kernel.org, netdev@vger.kernel.org,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
Jacob Keller <jacob.e.keller@intel.com>
Subject: Re: [PATCH net v3] net/mlx5: fix calling mlx5_cmd_init() before DMA mask is set
Date: Thu, 12 Oct 2023 12:53:38 +0200 [thread overview]
Message-ID: <5e7ec86d690ec5337052742ca75ad2ade23f291e.camel@linux.ibm.com> (raw)
In-Reply-To: <ZSbvxeLKS8zHltdg@x130>
On Wed, 2023-10-11 at 11:56 -0700, Saeed Mahameed wrote:
> On 11 Oct 11:20, Saeed Mahameed wrote:
> > On 11 Oct 09:57, Niklas Schnelle wrote:
> > > Since commit 06cd555f73ca ("net/mlx5: split mlx5_cmd_init() to probe and
> > > reload routines") mlx5_cmd_init() is called in mlx5_mdev_init() which is
> > > called in probe_one() before mlx5_pci_init(). This is a problem because
> > > mlx5_pci_init() is where the DMA and coherent mask is set but
> > > mlx5_cmd_init() already does a dma_alloc_coherent(). Thus a DMA
> > > allocation is done during probe before the correct mask is set. This
> > > causes probe to fail initialization of the cmdif SW structs on s390x
> > > after that is converted to the common dma-iommu code. This is because on
> > > s390x DMA addresses below 4 GiB are reserved on current machines and
> > > unlike the old s390x specific DMA API implementation common code
> > > enforces DMA masks.
> > >
> > > Fix this by moving set_dma_caps() out of mlx5_pci_init() and into
> > > probe_one() before mlx5_mdev_init(). To match the overall naming scheme
> > > rename it to mlx5_dma_init().
> >
> > How about we just call mlx5_pci_init() before mlx5_mdev_init(), instead of
> > breaking it apart ?
>
> I just posted this RFC patch [1]:
This patch works to solve the problem as well.
>
> I am working in very limited conditions these days, and I don't have strong
> opinion on which approach to take, Leon, Niklas, please advise.
>
> The three possible solutions:
>
> 1) mlx5_pci_init() before mlx5_mdev_init(), I don't think enabling pci
> before initializing cmd dma would be a problem.
>
> 2) This patch.
>
> 3) Shay's patch from the link below:
> [1] https://patchwork.kernel.org/project/netdevbpf/patch/20231011184511.19818-1-saeed@kernel.org/
>
> Thanks,
> Saeed.
My first gut feeling was option 1) but I'm just as happy with 2) or 3).
For me option 2 is the least invasive but not by much.
For me the important thing is what Jason also said yesterday. We need
to merge something now to unbreak linux-next on s390x and to make sure
we don't end up with a broken v6.7-rc1. This is already hampering our
CI tests with linux-next. So let's do whatever can be merged the
quickest and then feel free to do any refactoring ideas that this
discussion might have spawned on top of that. My guess for this
criteria would be 2).
Thanks,
Niklas
next prev parent reply other threads:[~2023-10-12 10:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-11 7:57 [PATCH net v3] net/mlx5: fix calling mlx5_cmd_init() before DMA mask is set Niklas Schnelle
2023-10-11 18:20 ` Saeed Mahameed
2023-10-11 18:56 ` Saeed Mahameed
2023-10-12 10:53 ` Niklas Schnelle [this message]
2023-10-12 11:39 ` Niklas Schnelle
2023-10-12 16:55 ` Saeed Mahameed
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=5e7ec86d690ec5337052742ca75ad2ade23f291e.camel@linux.ibm.com \
--to=schnelle@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hca@linux.ibm.com \
--cc=jacob.e.keller@intel.com \
--cc=jgg@ziepe.ca \
--cc=joro@8bytes.org \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mjrosato@linux.ibm.com \
--cc=moshe@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robin.murphy@arm.com \
--cc=saeed@kernel.org \
--cc=saeedm@nvidia.com \
--cc=shayd@nvidia.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).