Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp442723rdg; Thu, 12 Oct 2023 09:56:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGw67wn9f+tCM+D/qN+2YxLkznJvBsoOnzBL2HFaSvOEpBb7jIS5MkUwfy/y2mX68qR3hGa X-Received: by 2002:a05:6a00:23d4:b0:690:28d0:b7cf with SMTP id g20-20020a056a0023d400b0069028d0b7cfmr25169201pfc.16.1697129768325; Thu, 12 Oct 2023 09:56:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697129768; cv=none; d=google.com; s=arc-20160816; b=C4yDGppl3wMozTG7QzpPS+Q1NXEqmjkHgCLy3Stfr7DTVIozx+LP/9l4OcUNsDOkxq 5mwoSRykQ1wtVRT/oqmXETIW4onQd2q5E553CWG3DMTawaSBGd0FJnosxZVU2WpL+sXW 5sPrU69+We+90mjSrbe1rdn7xLXqeq/qOc4frDTbVrBjegXuFP+jmthrEXpPR2Brmv3J 98sr7/ow6ILKvEHZM4Rcwy1d0kFqy5KUIMU3BLsqx7E4FLE2OKfWalvEEe7PGiEsBPZ7 5PNeQLbE8tvEIZ1WmSxP8UIkU+6qL/YAGKnF6pPupYCRnOHoHe8YK8/ZVwyIXb5VSDFu VF3A== 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=Zvq8V/HgXHywRpjNruagdGANXGM6O/UrOT/e97M1WS8=; fh=Hf94CPEcQq76M2ch+b8La29OPrSUi0Ui1S7VhMQk0Sw=; b=gfeQlvV4V9rUdigayS4GUB8yE2ghHcBoynbsijWG+nOzoUiw4+Ax5L2GWRY3OpbZxC CwPxCStgMS0dxT9mQr1aXN3FrlkHIRzNxaWW8EFzfqztJ7+j5/kmWbZoDRIsMQu16hg0 4FFQ9SDQYu5sE+ETtvjy+isV/Gouvlx6tNM35HBYtS8uLAjFq5VifMDhVR/UJokLR7N+ ZSEKextYQcrlPofDA2fGCHBeY3xcuqMO54YGjWzYaLt1Vepybzk2d8QgbWGMYdioSj35 GBSb6r2v+Wlj8ul7lTk5tVYml4cHH0NNQZIjVHehKFYy1XGy/GcFvJiLDCq3XbGHoCwu 8BsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KWlJSI0P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id k3-20020a654643000000b00577448019b5si2540808pgr.276.2023.10.12.09.56.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 09:56:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KWlJSI0P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id 250358074065; Thu, 12 Oct 2023 09:55:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378664AbjJLQzT (ORCPT + 99 others); Thu, 12 Oct 2023 12:55:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233290AbjJLQzS (ORCPT ); Thu, 12 Oct 2023 12:55:18 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A106C6; Thu, 12 Oct 2023 09:55:16 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BEB6C433C8; Thu, 12 Oct 2023 16:55:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697129716; bh=O8UY1DvSBTTGnjJ9XccnIy1wMqCD+BqiH+/36Y/1MZE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KWlJSI0PM5XU1MvuMXMhSDW/+KG+gbxWbms9N1wWVEH1VHrp+PFFEtMNA1F7TmINm Vir1kvxAz3S+1cc+zoO7leMpyyRGnmRGzjtRhw9QTRvJ0KMNE9sN7RqKLK/wjOTbR0 ze0K4mY+siE80ZYGdCFyj5fcVc/tER/4FQYJnm/LG1IE2JmtmB+L+EDdD93plmDbOT du6vLsLK2S6IIEku5xngpqCJKauULlg/U/LFlNjHCOu+HtyXVzlxkE8IsVY2wZMe+8 rDhYakUxcDXcf05AQGHpAX84l3Xa/U9F0OGH/13wuCux+RljgfU1sGrqIQXBBtZFdg w+oZslObnrF3g== Date: Thu, 12 Oct 2023 09:55:14 -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> <5e7ec86d690ec5337052742ca75ad2ade23f291e.camel@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=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Thu, 12 Oct 2023 09:55:36 -0700 (PDT) On 12 Oct 13:39, Niklas Schnelle wrote: >On Thu, 2023-10-12 at 12:53 +0200, Niklas Schnelle wrote: >> 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 >> > >Looking closer at the patch from Shay I do like that it changes the >order in the disable/tear down path too. So since that also fixes a PPC >issue I guess that may indeed be the best solution if we can get it >merged quickly. I'll comment with my Tested-by there too. > Ack, will take Shay's patch then, Will add your Test-by and Reviewed-by. >Thanks, >Niklas