Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp737476ybf; Sat, 29 Feb 2020 14:48:58 -0800 (PST) X-Google-Smtp-Source: APXvYqyxKr8OYuobKMyn6jwOdF2L4vO7rEcVVR/Qs/WW+Z7AWJ3bVbC2cktwhv/G5zJRGwifCCRT X-Received: by 2002:a05:6808:4c2:: with SMTP id a2mr7030424oie.118.1583016538657; Sat, 29 Feb 2020 14:48:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583016538; cv=none; d=google.com; s=arc-20160816; b=l9h2XXvpdvdFoUCI/9SqaoO/rn6blRd4FvNhMxrzkbzxw8z7DDNW2ULuiJrchRp2Gx e9w10L02Kb8LH+uwJoPtfbX/Bl5IIsqClriReXBJGTS0RD2Qym94jqDACpeii9EyuAZh PlQUgXp/BFw0F7bRRcqnbw56MqRjKQ3aTC/EoBzoid9AYGNSEmjqMgGbpRjcqIVoeYjh DbvEIZW0qAnxhyro5NJs7h2BVkVCP7paEoB/kHMBeESXaqSO8d29nQDW3eWBKho0SF8W Id7LpKU8zTV/DfcO58SCFmeJ9pEO+D2GToKDUHh9b1DaoYNJBhLLmLLIPJ1LWx3c/HyA fCiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=8rTAnPPQPQ2zDwIh6KNULPqO4A3SBF/aTaf3+a0KIRA=; b=VtD0gXU1RGk9UJ3QHyo5li0Ase+xBtYJVpo0w+6uA+xIApwXx85Wb9CqzHoYx60Hsl w0i1educsbX2gSL0hbDAPz3rU11oxcikVBg4t8FwtMdWKPEDogJl367K93qoH1RhHZ3T dMRPpqSC86Mr7jxzPqrgWbn84u5CDYVRhWMceU2I0pfNC9MyUMMOKAaaxAWp29qyOV1J vrmupv2WZikhpwFa7o6air1hXZt9C+kCRUXcibxygu4PmbM/Daj/3b5F99Zo5Irqb4rt /OQisU/HLpVR1oTV8vB1Jb2rytxibO1hhYEMLbek02rq11LgEZH3KPbcGcq+yQGLl+xw E8OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=09+H6QEX; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d6si4201388oic.190.2020.02.29.14.48.47; Sat, 29 Feb 2020 14:48:58 -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=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=09+H6QEX; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727518AbgB2Wr7 (ORCPT + 99 others); Sat, 29 Feb 2020 17:47:59 -0500 Received: from mail-ot1-f68.google.com ([209.85.210.68]:36267 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727170AbgB2Wr6 (ORCPT ); Sat, 29 Feb 2020 17:47:58 -0500 Received: by mail-ot1-f68.google.com with SMTP id j14so1859527otq.3 for ; Sat, 29 Feb 2020 14:47:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8rTAnPPQPQ2zDwIh6KNULPqO4A3SBF/aTaf3+a0KIRA=; b=09+H6QEX0IFkK+L3p4GHO6Y0ATs+adHreQcu1bdLJyN+n2Vgctq6CmsN235zfYz7cz Zjowwp86NseHUm8hZsO+r0jOlHoaSUrXGunU/rqFwsJ1s7n5AN8EwU8Ta7ZV68MEDMoy cYFY629qtjE7k7S8TFWxiMwDorJu8ZM8TrjzCM6bvmFSocUCibA7lH7EUmIS6yLAffHg Ym9Ff+mKB4LVR21VHWSFek6dY5HD72PiWKRZfpQCH7KVSONiX3j+r8BDKOrr5WjC/edI 3j/m/eKnMAevYsWQnEm1mQYYcl4k+knJqW8Hze1OVUGbNTe30vZzkPj3LXSahhmiaB5B dHBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8rTAnPPQPQ2zDwIh6KNULPqO4A3SBF/aTaf3+a0KIRA=; b=Tq3Rwz8EFXjbx8VJ4dxweup6SnE2RqvhMPVO+3xSej6mMdwTOSAuMonR+Gkrpv7HTh LGaI20lH5CBVAOMDmchtsj33kSzawQsiNEd083vo/HBsR/K4w4uHZb/MDd2tQi5koO1D n9NytHoeAcvM78UwAm+tVs5BtRl3DFKs4UBTDCnxBUu8mkQ7aXwpYS8r04WmvNV/RzHp O4bh0bkiihlff63IrHEEWz4u8GHCZIU9Q4DBH/V1D2E4JRi7yWS13AxsMzTTcfVoY5gC zQPyL1N5y44yEe1TvduPwKQ2ml/jZlAgl3KV8YH2QfcUS9gWorDhbLddu/sYvkpOD6Vi f62A== X-Gm-Message-State: APjAAAVKVcGUzwS8NnY5UaZcfpDUbHNaN5aWiCa6hunrh0Q0GZ0uGg7B 5kVF8B1N921cNKDJzxKSUK5+9S5IE2K9eKPZ0XS3Yg== X-Received: by 2002:a9d:5d09:: with SMTP id b9mr8013603oti.207.1583016478029; Sat, 29 Feb 2020 14:47:58 -0800 (PST) MIME-Version: 1.0 References: <20200221182503.28317-1-logang@deltatee.com> <20200221182503.28317-8-logang@deltatee.com> In-Reply-To: <20200221182503.28317-8-logang@deltatee.com> From: Dan Williams Date: Sat, 29 Feb 2020 14:47:47 -0800 Message-ID: Subject: Re: [PATCH v3 7/7] mm/memremap: Set caching mode for PCI P2PDMA memory to WC To: Logan Gunthorpe Cc: Linux Kernel Mailing List , Linux ARM , linux-ia64@vger.kernel.org, linuxppc-dev , linux-s390 , Linux-sh , platform-driver-x86@vger.kernel.org, Linux MM , 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 , Jason Gunthorpe Content-Type: text/plain; charset="UTF-8" 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 10:25 AM Logan Gunthorpe wrote: > > PCI BAR IO memory should never be mapped as WB, however prior to this > the PAT bits were set WB and it was typically overridden by MTRR > registers set by the firmware. > > Set PCI P2PDMA memory to be WC (writecombining) as the only current > user (the NVMe CMB) was originally mapped WC before the P2PDMA code > replaced the mapping with devm_memremap_pages(). Will the change to UC regress this existing use case? > > Future use-cases may need to generalize this by adding flags to > select the caching type, as some P2PDMA cases will not want WC. > However, those use-cases are not upstream yet and this can be changed > when they arrive. > > Cc: Dan Williams > Cc: Christoph Hellwig > Cc: Jason Gunthorpe > Signed-off-by: Logan Gunthorpe > --- > mm/memremap.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/mm/memremap.c b/mm/memremap.c > index 06742372a203..8d141c3e3364 100644 > --- a/mm/memremap.c > +++ b/mm/memremap.c > @@ -190,7 +190,10 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid) > } > break; > case MEMORY_DEVICE_DEVDAX: > + need_devmap_managed = false; > + break; > case MEMORY_DEVICE_PCI_P2PDMA: > + params.pgprot = pgprot_writecombine(params.pgprot); Approach looks good to me, modulo Jason's comment that this should be UC. Upcoming DAX changes will want to pass this via pgmap, but as you say this can wait for this changes to arrive. After change to UC: Reviewed-by: Dan Williams