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=-0.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 46557C3F68F for ; Fri, 14 Feb 2020 20:59:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1195322314 for ; Fri, 14 Feb 2020 20:59:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MwPOXPqs" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388084AbgBNU7S (ORCPT ); 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