From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 797EAC43461 for ; Fri, 11 Sep 2020 00:39:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3ECE3208FE for ; Fri, 11 Sep 2020 00:39:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725290AbgIKAjs (ORCPT ); Thu, 10 Sep 2020 20:39:48 -0400 Received: from kernel.crashing.org ([76.164.61.194]:33210 "EHLO kernel.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725280AbgIKAjs (ORCPT ); Thu, 10 Sep 2020 20:39:48 -0400 Received: from localhost (gate.crashing.org [63.228.1.57]) (authenticated bits=0) by kernel.crashing.org (8.14.7/8.14.7) with ESMTP id 08B0dHsf000993 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 10 Sep 2020 19:39:21 -0500 Message-ID: <3110e00a1f4df7b7359ba4f2b7f86a35aa47405e.camel@kernel.crashing.org> Subject: Re: [PATCH] arm64: Enable PCI write-combine resources under sysfs From: Benjamin Herrenschmidt To: Jason Gunthorpe Cc: Lorenzo Pieralisi , Clint Sbisa , linux-pci@vger.kernel.org, Bjorn Helgaas , linux-arm-kernel@lists.infradead.org, will@kernel.org, catalin.marinas@arm.com, Leon Romanovsky Date: Fri, 11 Sep 2020 10:39:16 +1000 In-Reply-To: <20200910232938.GJ904879@nvidia.com> References: <20200902142922.xc4x6m33unkzewuh@amazon.com> <20200902164702.GA30611@e121166-lin.cambridge.arm.com> <20200903110844.GB11284@e121166-lin.cambridge.arm.com> <28d333afc73bd854390f8c39691a735040ba5b39.camel@kernel.crashing.org> <20200910094600.GA22840@e121166-lin.cambridge.arm.com> <20200910123758.GC904879@nvidia.com> <20200910151721.GA25809@e121166-lin.cambridge.arm.com> <20200910171033.GG904879@nvidia.com> <44acc22377958a57c738f5139c5b5df2841c2544.camel@kernel.crashing.org> <20200910232938.GJ904879@nvidia.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Thu, 2020-09-10 at 20:29 -0300, Jason Gunthorpe wrote: > > Probably, at least on powerpc you will as well, that's the only way to > > get write combine. > > If I remove the PROT_READ in the user space mmap will it block it? No. powerpc at least doesn't have write-only mappings. > Read TLPs are not harmful but I suspect they would cause an > undesirable random performance anomaly. I suspect in practice you wont get them esp. if the code has barriers but ... it's allowed by the architecture. > > > Does it/could it "combine writes"? > > > > I assume so for ARM, definitely for powerpc. > > Various IBM PPC chips I know work, we do test that. > > > > > That's why I looped you in - that's what worries me about > > > > "enabling" > > > > arch_can_pci_mmap_wc() on arm64. If we enable it and we have perf > > > > regressions that's not OK. > > > > > > > > Or we *can* enable arch_can_pci_mmap_wc() but force the mellanox > > > > driver (or more broadly all drivers following this message push > > > > semantics) to use "something else" for WC detection. > > > > > > arch_can_pci_mmap_wc() really only controls the sysfs resource file > > > and it seems very unclear who in userspace uses that these days. > > > > dpdk under some circumstances afaik. > > And something gross for DMA then? Not sure dpdk is useful without > DMA. Why not use CONFIG_VFIO_NOIOMMU for such a non-secure thing? Clint, can you elaborate on the use case ? > > > vfio is now the right way to do that stuff. I don't see an obvious > > > way to get WC memory in VFIO though... > > > > Which would be a performance issue on a number of things I suppose... > > Almost nothing uses pci_iomap_wc(), so I'd be surpried if userspace > DPDK was an important user when an in-kernel driver for the same HW > doesn't use it? Hard to know how uses those files out there but I don't like arm not providing what pretty much all relevant archs do provide since the semantics afaik aren't that different. Yes, "write combine" isn't a good name.... The goal is to get WC but it comes with the whole package on several archs. We don't even have a reasonnable definition of the semantics of readl/writel on a WC mapping (hint: on powerpc the barriers in them will prevent WC even on a WC mapping) nor of what barriers might work and how on such a mapping. I tried a while ago and ... ugh. Cheers, Ben. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FF9DC43461 for ; Fri, 11 Sep 2020 00:41:07 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 22165208FE for ; Fri, 11 Sep 2020 00:41:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="1pz8ovG1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 22165208FE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Mime-Version:References:In-Reply-To:Date:To:From: Subject:Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wCF3F0rQxMOS2Mr+gPh8Fu9SzvblSsiTeXyFV26YeSQ=; b=1pz8ovG1/o7KGJzwph7nQfmAt tBJ+qYfMuf8XzFRaxMqqEJzUg2uFF+wrRBbZ9nCR5Cg6asbsjqSaPZOY5tTQbdd9wSsbOdfA9P6ip M5C4Oil2jOs3tWqGzQr85yIzaTagDQ4nWIv5/Bni/6Oq0pSQBu3UrlzQDvYqTR2sDInX7pw2bNIB4 oqVgJdIxyAUTwNm97Wuhp911F/8jDExDdHEQG/mERGX5xQoSEHEli6pFi85MfHrWIUohB41buKtN6 oJEK60OxhuTysCRPSnUcMbyxCzLYQ8AzSbBb81tRKDcoHkj7xlDtGtHt/MaMjMhCu2XgeF12QYiap zIP4ZaAPQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGX6Q-0006jZ-4T; Fri, 11 Sep 2020 00:39:46 +0000 Received: from kernel.crashing.org ([76.164.61.194]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGX6N-0006j4-5m for linux-arm-kernel@lists.infradead.org; Fri, 11 Sep 2020 00:39:44 +0000 Received: from localhost (gate.crashing.org [63.228.1.57]) (authenticated bits=0) by kernel.crashing.org (8.14.7/8.14.7) with ESMTP id 08B0dHsf000993 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 10 Sep 2020 19:39:21 -0500 Message-ID: <3110e00a1f4df7b7359ba4f2b7f86a35aa47405e.camel@kernel.crashing.org> Subject: Re: [PATCH] arm64: Enable PCI write-combine resources under sysfs From: Benjamin Herrenschmidt To: Jason Gunthorpe Date: Fri, 11 Sep 2020 10:39:16 +1000 In-Reply-To: <20200910232938.GJ904879@nvidia.com> References: <20200902142922.xc4x6m33unkzewuh@amazon.com> <20200902164702.GA30611@e121166-lin.cambridge.arm.com> <20200903110844.GB11284@e121166-lin.cambridge.arm.com> <28d333afc73bd854390f8c39691a735040ba5b39.camel@kernel.crashing.org> <20200910094600.GA22840@e121166-lin.cambridge.arm.com> <20200910123758.GC904879@nvidia.com> <20200910151721.GA25809@e121166-lin.cambridge.arm.com> <20200910171033.GG904879@nvidia.com> <44acc22377958a57c738f5139c5b5df2841c2544.camel@kernel.crashing.org> <20200910232938.GJ904879@nvidia.com> X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 Mime-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200910_203943_348399_3D9FF4D4 X-CRM114-Status: GOOD ( 23.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lorenzo Pieralisi , Leon Romanovsky , linux-pci@vger.kernel.org, Bjorn Helgaas , catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, Clint Sbisa Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 2020-09-10 at 20:29 -0300, Jason Gunthorpe wrote: > > Probably, at least on powerpc you will as well, that's the only way to > > get write combine. > > If I remove the PROT_READ in the user space mmap will it block it? No. powerpc at least doesn't have write-only mappings. > Read TLPs are not harmful but I suspect they would cause an > undesirable random performance anomaly. I suspect in practice you wont get them esp. if the code has barriers but ... it's allowed by the architecture. > > > Does it/could it "combine writes"? > > > > I assume so for ARM, definitely for powerpc. > > Various IBM PPC chips I know work, we do test that. > > > > > That's why I looped you in - that's what worries me about > > > > "enabling" > > > > arch_can_pci_mmap_wc() on arm64. If we enable it and we have perf > > > > regressions that's not OK. > > > > > > > > Or we *can* enable arch_can_pci_mmap_wc() but force the mellanox > > > > driver (or more broadly all drivers following this message push > > > > semantics) to use "something else" for WC detection. > > > > > > arch_can_pci_mmap_wc() really only controls the sysfs resource file > > > and it seems very unclear who in userspace uses that these days. > > > > dpdk under some circumstances afaik. > > And something gross for DMA then? Not sure dpdk is useful without > DMA. Why not use CONFIG_VFIO_NOIOMMU for such a non-secure thing? Clint, can you elaborate on the use case ? > > > vfio is now the right way to do that stuff. I don't see an obvious > > > way to get WC memory in VFIO though... > > > > Which would be a performance issue on a number of things I suppose... > > Almost nothing uses pci_iomap_wc(), so I'd be surpried if userspace > DPDK was an important user when an in-kernel driver for the same HW > doesn't use it? Hard to know how uses those files out there but I don't like arm not providing what pretty much all relevant archs do provide since the semantics afaik aren't that different. Yes, "write combine" isn't a good name.... The goal is to get WC but it comes with the whole package on several archs. We don't even have a reasonnable definition of the semantics of readl/writel on a WC mapping (hint: on powerpc the barriers in them will prevent WC even on a WC mapping) nor of what barriers might work and how on such a mapping. I tried a while ago and ... ugh. Cheers, Ben. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel