Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2173755ybv; Fri, 14 Feb 2020 13:00:50 -0800 (PST) X-Google-Smtp-Source: APXvYqyDIMgFIxqj8XylZr+cvQrJjAadD7I411es8L3aOWeKk+LfLOco6U5OvPqWCOYffEaWa3oC X-Received: by 2002:a9d:6e05:: with SMTP id e5mr3858291otr.46.1581714050288; Fri, 14 Feb 2020 13:00:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581714050; cv=none; d=google.com; s=arc-20160816; b=wLkSGzJbErnPg9Xu4kfefXHVBLxx1V/beZ3Rz/TsTH0QkRiBUTmYLNkbuoMITEYbYT TntpZRPmk9FKTVpdL9EtOR19Kzr5XTTdgeYll1TbEzyAnWcSHFXTVZ6JTO4YSLG0AQQy hIAyx0AhcckqvQe/iCrvuErEzFH/sicpYEH1hHV3MdhU/fz+nPVX7vk3I4PMAFxNNIFd /gBo4XIE52Lq/7bA85BN/2RMOV2n00tOvWdlOh4v1YIqQpWMXuq5Gl7LGIb0DjJi6dYT zJq6rDLZ/O+n1kVqQGERb5cp4ylb9BJI32io5ewhUFnM+5RCSpY3hhkwlRz1melYMz9D 7kSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id:date :references:subject:cc:to:from:dkim-signature; bh=xlGrvI1xaS/R+PG6hF0vkvw8F7V03CIoauMXv5nvLHg=; b=cf6LWfuEzNIqumn1eJ371P1UT/n+E90Q5vhWohBMBbYbmxbzMrDZYFy/NhoQr9ZpSY DqZMXxiJIVgf/aTfKOFZrZMsa4z9R/v7SS09mIuno8keCwLJr4Plp/491vLtmSikEj03 cUIldrbGS6DrVQqz9LA13M0fUluHyy4rC1QhX2OBllQkhzc/OsElYPTyWCs6gahkfgcH qlVEy+IMUY6ej6neFakI55bVLJahdMa7sEMx+QYVpUlLo5tpzlqj4qLyseLj7OQ7MYIE eZ/Znz3ru0Hq6FEO/qu+InujFjkdGFZNCE23PEIRCb3BMraDdNE+TQOHoHZUHZ4pFzaB wkwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MwPOXPqs; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d3si2980249oia.236.2020.02.14.13.00.36; Fri, 14 Feb 2020 13:00:50 -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=@redhat.com header.s=mimecast20190719 header.b=MwPOXPqs; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387585AbgBNU7S (ORCPT + 99 others); Fri, 14 Feb 2020 15:59:18 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:43710 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726191AbgBNU7S (ORCPT ); Fri, 14 Feb 2020 15:59:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581713957; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=xlGrvI1xaS/R+PG6hF0vkvw8F7V03CIoauMXv5nvLHg=; b=MwPOXPqspMVHF3nvjOggH+o338KiNVKPuTbnp0hJnNXSFAznMWXCHkQUmO238IAP9E17dj WnukqwIS4qU7FZx4R/SQwRI7OI5dkZy9e4DI4yORCkeFtGdNWxnsbgRfNhXx33ZgHzgU2V umalY155zfM3tLm03rWIpDrFUkPjIP8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-115-GvUqMV_VNn-dvokEBCfy1w-1; Fri, 14 Feb 2020 15:59:13 -0500 X-MC-Unique: GvUqMV_VNn-dvokEBCfy1w-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2F188100550E; Fri, 14 Feb 2020 20:59:11 +0000 (UTC) Received: from segfault.boston.devel.redhat.com (segfault.boston.devel.redhat.com [10.19.60.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EA2628AC42; Fri, 14 Feb 2020 20:59:09 +0000 (UTC) From: Jeff Moyer To: Dan Williams Cc: linux-nvdimm , "Aneesh Kumar K.V" , Benjamin Herrenschmidt , Paul Mackerras , Vishal L Verma , Linux Kernel Mailing List , linuxppc-dev Subject: Re: [PATCH v2 1/4] mm/memremap_pages: Introduce memremap_compat_align() References: <158155489850.3343782.2687127373754434980.stgit@dwillia2-desk3.amr.corp.intel.com> <158155490379.3343782.10305190793306743949.stgit@dwillia2-desk3.amr.corp.intel.com> X-PGP-KeyID: 1F78E1B4 X-PGP-CertKey: F6FE 280D 8293 F72C 65FD 5A58 1FF8 A7CA 1F78 E1B4 Date: Fri, 14 Feb 2020 15:59:08 -0500 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dan Williams writes: > On Thu, Feb 13, 2020 at 8:58 AM Jeff Moyer wrote: >> I have just a couple of questions. >> >> First, can you please add a comment above the generic implementation of >> memremap_compat_align describing its purpose, and why a platform might >> want to override it? > > Sure, how about: > > /* > * The memremap() and memremap_pages() interfaces are alternately used > * to map persistent memory namespaces. These interfaces place different > * constraints on the alignment and size of the mapping (namespace). > * memremap() can map individual PAGE_SIZE pages. memremap_pages() can > * only map subsections (2MB), and at least one architecture (PowerPC) > * the minimum mapping granularity of memremap_pages() is 16MB. > * > * The role of memremap_compat_align() is to communicate the minimum > * arch supported alignment of a namespace such that it can freely > * switch modes without violating the arch constraint. Namely, do not > * allow a namespace to be PAGE_SIZE aligned since that namespace may be > * reconfigured into a mode that requires SUBSECTION_SIZE alignment. > */ Well, if we modify the x86 variant to be PAGE_SIZE, I think that text won't work. How about: /* * memremap_compat_align should return the minimum alignment for * mapping memory via memremap() and memremap_pages(). For x86, this * is the system PAGE_SIZE. Other architectures may impose different * restrictions, as is seen on powerpc where the minimum alignment is * tied to the linear mapping page size. * * When creating persistent memory namespaces, the alignment is forced * to the least common denominator (MEMREMAP_COMPAT_ALIGN_MAX, * currently 16MB). However, older kernels did not enforce this * behavior, so we allow mapping namespaces with smaller alignments, * so long as the platform supports it. See nvdimm_namespace_common_probe. */ -Jeff