Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp1022029rdg; Wed, 11 Oct 2023 11:57:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHzFw+VgqOnCqPqPJx4zid4bhknha1gvZ3e75eKbjdEPjYBrDPeUzLcIkfbhKo8+5KU483n X-Received: by 2002:a17:90b:1e02:b0:27d:775:56d9 with SMTP id pg2-20020a17090b1e0200b0027d077556d9mr2161174pjb.15.1697050626508; Wed, 11 Oct 2023 11:57:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697050626; cv=none; d=google.com; s=arc-20160816; b=uKv611mVdS5gOI5Gt6vnh/aHYUBsDcVAhQ3v7mlN9abOXsmaWYywjPAAiw1n++TP7H g17N4Vbi/ziy6E5bxnuRL6qvON143bcruJLO4C0qx9Jg++KcAvA9Tod/royaX0edJYvu Pi4Gb+N645DAhg+XGHS3TSyHkzw7tyr6gbeBRk0eLW/AuJbqLWJHCoAmvdCfmixV2m89 pNLKOzI3FRxZiwFL1OenxevEZBqlESq2ducE4uK4WrhjtnGQxfF108AzFlhAZebPzH4+ 0FFBAEtBpyWRhExp4twr/UJNCdlxl7nzAWSBu6KEruJsV5/2xETDpEQ7x9n8i0gHeZuU e7yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=p5Aqye/cIt07/FsEkeTy4ySuRidXLXrlLwhsHjfE6s8=; fh=Hf94CPEcQq76M2ch+b8La29OPrSUi0Ui1S7VhMQk0Sw=; b=JydANC9vMZMFkXBzeje0/Pl7WlCXZQnEvtQul8UfcM33Y8R/J+sW4lWgGgWUJNauc5 voyB93od15nUGVS2oDOtrwg18S+Io2h0YhaS7bZ4iTGeC/U8BU82dJcPBx7RAsqThf/c /jM3Ox8PbISomtZhILtFbUgBaxxMImFveFjyhTENoP7eWeTjHGAizkUdWlHEqA+1Pkta uzt8fTzu/Ljr3IRFZum6SmhLarO/BOhClSlz9u8Nv2vpMWuFTyAOlQV+bBKnxB/DT3r3 kS7pQkW05PoqLgNrwzo10fRdls7iVWkRP/SeltDlGnVHBTrT5X8vabfCsKqVbU6dm0vL Om4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ig89jjbS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id 24-20020a17090a035800b00277453e82fesi432241pjf.87.2023.10.11.11.57.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 11:57:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ig89jjbS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 52F638128039; Wed, 11 Oct 2023 11:57:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235181AbjJKS41 (ORCPT + 99 others); Wed, 11 Oct 2023 14:56:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235163AbjJKS4Y (ORCPT ); Wed, 11 Oct 2023 14:56:24 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15EB2123; Wed, 11 Oct 2023 11:56:06 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D25EC433C8; Wed, 11 Oct 2023 18:56:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697050566; bh=p5Aqye/cIt07/FsEkeTy4ySuRidXLXrlLwhsHjfE6s8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ig89jjbS+S/Y6rn7rilEv05EonKQ7QJVCBTnsmEEOd7KF50WQrJX/EqqLg0EEFD33 Q1Vc/EkXLs8+j7JhixfAG9Id5XBPsvgxzxElbJbn43ToUMcibkSl1HlhwZb2N+hrwY NNQZesN3ux5oYyQyIZ6pdd7kEbs4Eu0yNP0ZmQHwX9Q7KpWN37IyAMcqvEqc+NwE9Q N7S7T30w1DDWI9TSFFSEO13RR5WHL5KhuZr2tFah2IZM8sssuNL1XbgEqMTQ6lpV7E hcALxsrieoUdmLTjKbXeLxTO2HaDe58/NmhvWcSwNnSx7iLVL1wnJwadfUIQ5NRZu0 doYihVvW1stuQ== Date: Wed, 11 Oct 2023 11:56:05 -0700 From: Saeed Mahameed To: Niklas Schnelle Cc: Saeed Mahameed , Leon Romanovsky , Jason Gunthorpe , Matthew Rosato , Joerg Roedel , Robin Murphy , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shay Drory , Moshe Shemesh , Heiko Carstens , Alexander Gordeev , linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Jacob Keller Subject: Re: [PATCH net v3] net/mlx5: fix calling mlx5_cmd_init() before DMA mask is set Message-ID: References: <20231011-mlx5_init_fix-v3-1-787ffb9183c6@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 11 Oct 2023 11:57:03 -0700 (PDT) X-Spam-Level: ** 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]: 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.