Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1350588ybf; Thu, 27 Feb 2020 09:17:33 -0800 (PST) X-Google-Smtp-Source: APXvYqyXGDe4KX37gs6z3d9NULMXNrS35wh96jgzLuvgv7g5h73ymRpkDw9lVi8FPjWVIFjB6UOW X-Received: by 2002:aca:4306:: with SMTP id q6mr81991oia.54.1582823853582; Thu, 27 Feb 2020 09:17:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582823853; cv=none; d=google.com; s=arc-20160816; b=A4l7C8/2y24S3YovWIXSEJa/e0S9oqHR9zfA6124047LEfHn8PCW9TAULaa7lJeZkD SSh7fYdNsMwwgMmJrfHn5fBXjnb7qN8d/KBWwTP+/SlbRXUkP6NyjYe9IIreBLiZ69yt fLhoGKrST8CEyV+U840Hr/D3XKFDAaF1mKzxdP000MoXVLPbr3z0rpwrOFipHo41dIGj SiFW1EajOR3juPZWh59DsK2ffCbKWMHo2AICNFz3oX1XRqOt43LOjiubZEXYCa1PHu2M 4EkpFZu+Mao0+GX52LtaxI6TLSTJTHb7UIQsipdIs480eT5jP6SmvuU5h5UeRtgFDceU 5LCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ARo9Rla66Kxeu/Z2V78mx/ehDWu077QNPWdzDFxfOJY=; b=rtzui74JznG6Sk4s7tzHZB3u6CTBFd4Bft947ZsBlBzjvWuCUm5VCDN67vInKiMPgj hwoYNaXgzmlW3rzKnVKyQcgCC0Jz+U1V55eC3dBHa/bGCTjHHbi3UmeRUHKEm5VO7hgw y+PRd0x1Sn5tjOAUTduf3CQW6wcN0t/RfaSzal7qesEqhGpm2u+BtSjoqInKorc8aD0z 9fGHCpEgzp6nvBAcjOb5XZM6uLJv8Uyn+vFsOo6QLoZVbqVRNdiUbeE9C1ajjjrExK9x tWq+27wgpeD3hKuMVl88H2AjT4BtFw4rpnb8U0np+1yCwdSOU5vGx816mE9BrxLCm/xK /8lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=dth2WWWZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i23si1879778oto.206.2020.02.27.09.17.20; Thu, 27 Feb 2020 09:17:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=dth2WWWZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729686AbgB0RRH (ORCPT + 99 others); Thu, 27 Feb 2020 12:17:07 -0500 Received: from mail-qv1-f66.google.com ([209.85.219.66]:42302 "EHLO mail-qv1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728413AbgB0RRH (ORCPT ); Thu, 27 Feb 2020 12:17:07 -0500 Received: by mail-qv1-f66.google.com with SMTP id dc14so1892219qvb.9 for ; Thu, 27 Feb 2020 09:17:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ARo9Rla66Kxeu/Z2V78mx/ehDWu077QNPWdzDFxfOJY=; b=dth2WWWZKp9HGsnWrcnEGnyDwu2blK8iDXb8vLMtoeR2VaMJ3fz37+cGHyNAha/rWV dK1sGTg22oiYuz24KPwTF2AS2YzOdqQyu6b+TiUBCYZk9V0zbua+mDMo3YTMUSvN9nIT EMJKHUaXkpfsveCsIHveNriBa6Vtjb0vFsMy7lGIqEqrtAiZ99Xs/sQZQxUbkx1mzgHf AVJsII2Jxg233IpQwYAVVL3i04SYIDZ8pS2nl8aTFh1Sh2y4snmhOeu+kOn7LsejaKvN 5rYQfvFElRSnuNIftRZI411+PoKrYCAMkJ59tu4Fy8L8tWs1KfJP0Uu0uqOwYZUWVb/k btJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ARo9Rla66Kxeu/Z2V78mx/ehDWu077QNPWdzDFxfOJY=; b=Y0KUmDuTR9TinLNUUblHpXuHR/oLWg0OA345236fJ/AMGjgvKQ0X7mRn1kJMbZp+J1 leq3jRTdm12dAY+A2xXyvzo8z+tkYgbTmbWMcY6TG3fEJ72pAiaimKeDH3f/EQhJ/ngW 8oSPsR7gYji6cO3Cpod6Jy/u6Q2RE0wr0xUsaGi5r4LZ2imHfA8JfDR6JqvE5xrOnJme 9sRb63X5tDpjIQS2tosemiW/LUxvepyk0n6rJVPbNRnf/a5APznqgo/IMHpjh6nDfahJ 39ncDEq/LGrCWdxdqSp+UMCi0MG8Tx1KN/SfkENrhXxmh/ofwGGt2l3SlQN6qoKEVWC2 0w2Q== X-Gm-Message-State: APjAAAWjqC6x3qCIZ9FhUKyS9alkoPgF6jIzgAQJVFTmVf+8DFI+7PWh 3EWCYhaEO0YR1ACCyZ9iM+QrKw== X-Received: by 2002:ad4:5429:: with SMTP id g9mr757799qvt.134.1582823826213; Thu, 27 Feb 2020 09:17:06 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-68-57-212.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.57.212]) by smtp.gmail.com with ESMTPSA id x14sm3375572qkf.99.2020.02.27.09.17.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Feb 2020 09:17:05 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1j7MmW-0003YD-SC; Thu, 27 Feb 2020 13:17:04 -0400 Date: Thu, 27 Feb 2020 13:17:04 -0400 From: Jason Gunthorpe To: Logan Gunthorpe Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-mm@kvack.org, Dan Williams , Michal Hocko , David Hildenbrand , Andrew Morton , Christoph Hellwig , Catalin Marinas , Will Deacon , Benjamin Herrenschmidt , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Eric Badger Subject: Re: [PATCH v3 0/7] Allow setting caching mode in arch_add_memory() for P2PDMA Message-ID: <20200227171704.GK31668@ziepe.ca> References: <20200221182503.28317-1-logang@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200221182503.28317-1-logang@deltatee.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 21, 2020 at 11:24:56AM -0700, Logan Gunthorpe wrote: > Hi, > > This is v3 of the patchset which cleans up a number of minor issues > from the feedback of v2 and rebases onto v5.6-rc2. Additional feedback > is welcome. > > Thanks, > > Logan > > -- > > Changes in v3: > * Rebased onto v5.6-rc2 > * Rename mhp_modifiers to mhp_params per David with an updated kernel > doc per Dan > * Drop support for s390 per David seeing it does not support > ZONE_DEVICE yet and there was a potential problem with huge pages. > * Added WARN_ON_ONCE in cases where arches recieve non PAGE_KERNEL > parameters > * Collected David and Micheal's Reviewed-By and Acked-by Tags > > Changes in v2: > * Rebased onto v5.5-rc5 > * Renamed mhp_restrictions to mhp_modifiers and added the pgprot field > to that structure instead of using an argument for > arch_add_memory(). > * Add patch to drop the unused flags field in mhp_restrictions > > A git branch is available here: > > https://github.com/sbates130272/linux-p2pmem remap_pages_cache_v3 > > -- > > Currently, the page tables created using memremap_pages() are always > created with the PAGE_KERNEL cacheing mode. However, the P2PDMA code > is creating pages for PCI BAR memory which should never be accessed > through the cache and instead use either WC or UC. This still works in > most cases, on x86, because the MTRR registers typically override the > caching settings in the page tables for all of the IO memory to be > UC-. However, this tends not to work so well on other arches or > some rare x86 machines that have firmware which does not setup the > MTRR registers in this way. > > Instead of this, this series proposes a change to arch_add_memory() > to take the pgprot required by the mapping which allows us to > explicitly set pagetable entries for P2PDMA memory to WC. Is there a particular reason why WC was selected here? I thought for the p2pdma cases there was no kernel user that touched the memory? I definitely forsee devices where we want UC instead. Even so, the whole idea looks like the right direction to me. Jason