lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20231004185127.GH51282@unreal>
Date:   Wed, 4 Oct 2023 21:51:27 +0300
From:   Leon Romanovsky <leon@...nel.org>
To:     Niklas Schnelle <schnelle@...ux.ibm.com>
Cc:     Joerg Roedel <joro@...tes.org>, Saeed Mahameed <saeedm@...dia.com>,
        Jason Gunthorpe <jgg@...pe.ca>,
        Matthew Rosato <mjrosato@...ux.ibm.com>,
        Robin Murphy <robin.murphy@....com>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, Shay Drory <shayd@...dia.com>,
        Moshe Shemesh <moshe@...dia.com>,
        Heiko Carstens <hca@...ux.ibm.com>,
        Alexander Gordeev <agordeev@...ux.ibm.com>,
        linux-s390@...r.kernel.org, netdev@...r.kernel.org,
        linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net v2] net/mlx5: fix calling mlx5_cmd_init() before DMA
 mask is set

On Wed, Oct 04, 2023 at 02:40:49PM +0200, Niklas Schnelle wrote:
> On Sat, 2023-09-30 at 10:36 +0300, Leon Romanovsky wrote:
> > On Fri, Sep 29, 2023 at 02:15:49PM +0200, 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().
> > > 
> > > Link: https://lore.kernel.org/linux-iommu/cfc9e9128ed5571d2e36421e347301057662a09e.camel@linux.ibm.com/
> > > Fixes: 06cd555f73ca ("net/mlx5: split mlx5_cmd_init() to probe and reload routines")
> > > Signed-off-by: Niklas Schnelle <schnelle@...ux.ibm.com>
> > > ---
> > > Note: I ran into this while testing the linked series for converting
> > > s390x to use dma-iommu. The existing s390x specific DMA API
> > > implementation doesn't respect DMA masks and is thus not affected
> > > despite of course also only supporting DMA addresses above 4 GiB.
> > > ---
> > > Changes in v2:
> > > - Instead of moving the whole mlx5_pci_init() only move the
> > >   set_dma_caps() call so as to keep pci_enable_device() after the FW
> > >   command interface initialization (Leon)
> > > - Link to v1: https://lore.kernel.org/r/20230928-mlx5_init_fix-v1-1-79749d45ce60@linux.ibm.com
> > > ---
> > >  drivers/net/ethernet/mellanox/mlx5/core/main.c | 18 +++++++++---------
> > >  1 file changed, 9 insertions(+), 9 deletions(-)
> > > 
> > 
> > Thanks,
> > Reviewed-by: Leon Romanovsky <leonro@...dia.com>
> 
> Thank you for the review. Assuming the mlx5 tree is included in linux-
> next I think it would be easiest if this goes via that tree thereby
> unbreaking linux-next for s390. Or do you prefer Joerg to take this via
> the IOMMU tree or even some other tree?

Strictly speaking this is net patch, netdev maintainers should pick it.
We use mlx5 tree [1] for *-next material.

Thanks

[1] https://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux.git/

> 
> Thanks,
> Niklas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ