Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp840962ybv; Thu, 13 Feb 2020 10:28:35 -0800 (PST) X-Google-Smtp-Source: APXvYqznER7jbHJ05OUP8ZIeFS9D9uoUOB9v1xOVfIHsNISVruCqVErpzePDc8AIXskEbGWfImqN X-Received: by 2002:a9d:1928:: with SMTP id j40mr14533402ota.68.1581618515015; Thu, 13 Feb 2020 10:28:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581618515; cv=none; d=google.com; s=arc-20160816; b=Q8lGm9igKa13n3oX+BppYkR4J/Z1GdnBJYUQlW31v+IXz0BR44P1nPt99+Byz8ccJp PGL7pCK29GJ0/OdemAIl+SEtgahfexS6CR3zYza+W6i7w5UdBm374e9NcNuw48mEgMtU 9gkm6pznkZcM7NuoF7iJVSJ1KiSOQpPPzwTGKAtsNsEvYuqWEebyguCar7/kmKwvWQoZ hkUqWotZ0cJfeaMkBdnGiLCvTlFQCP+57nBngSLSlIqrzaQ8SUgC98lBKyB1rbPK7Gdj 0hHm9l8ZYKVymrkvTF2VqrtYv5w3RMCQdW5L6LSdoF6DRx/49PoJek4YoWfNvTTT4MIx b2OA== 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=HpDOVVwQMoKUWV1DWVonUPFvZBLp80J0wZPDxMAaRfY=; b=RJo8QcJCPZogUTLg19DNlhfYIEigYSn5A1triovD2eT5jQHqWPluueezmln0erKZN8 p9YSC6TJhdsPScLEnk1TUZBlMACLeEtR73Z0cYwJ6v4wAMWxbM96vOCMeYIqQCn0NX/X B8jjefUszBy4WjL16ZwfrAfCXXQekMxJ/h5grT7fg6nOdNsCqD9lIIqXdCeHKIwCu+za qoRS6gl/HLfs7f5uQALt2LdZKtwhEsKUKbnKOXAzYt4XQWCkw2xqIBPnU/pYPf2vl1PS icmYhMGYzb46cI7sMF6ZBQ2324H4WscadEw40XVvxsQSqnlrBHwIspfMr7IdQoQF/qb+ UCFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=rXaw+VQU; 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 22si1441469oin.34.2020.02.13.10.28.20; Thu, 13 Feb 2020 10:28:35 -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=rXaw+VQU; 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 S1727790AbgBMS1B (ORCPT + 99 others); Thu, 13 Feb 2020 13:27:01 -0500 Received: from mail-oi1-f194.google.com ([209.85.167.194]:34828 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727433AbgBMS1A (ORCPT ); Thu, 13 Feb 2020 13:27:00 -0500 Received: by mail-oi1-f194.google.com with SMTP id b18so6796484oie.2 for ; Thu, 13 Feb 2020 10:27:00 -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=HpDOVVwQMoKUWV1DWVonUPFvZBLp80J0wZPDxMAaRfY=; b=rXaw+VQU+BjuhG30DscKYH7MHhb9UTyRb7apt36HoQ8vdfEazZoV8TpMsYehOANm0i Ad49SZMMYnTxNsI7UYPu9i/7tKY+5XCh/fe8Z1IbV33TjJwh5imPo0ja1SnmDxIPKhfn q+yfBnL9eDiFLTnNzbTpbFj5XyBowu9DqukeqXcR2zJ2l+nDzbWibmPHahu0Rvx6B7gV LCizkUaCHYg1paEJYE6UMN3g7C1a9UI3LSbC0Pj+VY65RbvSvZZ46MAz9Lzu1ZR9HI0C k+JHaH7IVx36F/8pTOY+F3F7OSNAfYTrt+U8MtfhYkDEjbioFaldj1Q3VG7lIVd6c1/G sjUg== 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=HpDOVVwQMoKUWV1DWVonUPFvZBLp80J0wZPDxMAaRfY=; b=K1SR6CTrktaFtUvelEnmn9cXmBlQqWeAyIllBSLdaQpWtx3eTtqUUPFH9Gb2cS4BBy OkECQh/NUGx+gkdVLU/ef6Y63tbnUTEgT59l8GuPpxfB1Kl/tmmxsAXerxph3isHjSil fln0/dfIq/krjV3fzzKOR7WEOTdOG6DgYJSMGXdQ50349U5AH3+gy+fTDT6O2HFEiaEl 5A2OnxZS7fi4XfyTPhb6Sq0baiFbt6HzHIOVLBcx6VT1PZPhMnABRJWUimRxtfGnuAXf mJidgKYy75EY6uJTWqKqag9Itj2JoWPr3ISgQ/OSvSnlQtFzxBpyxvRYF5djhmJly4pA OM1g== X-Gm-Message-State: APjAAAUMajNiXQvEHlYlBQPTGhfHczpoVVKyD+et/vlRTOw3v1Ho91BR dLc5sj3d4cbSd3T9CDTwLTdXC8jGBoUwIbDoo5mq2kDXa/w= X-Received: by 2002:aca:4c9:: with SMTP id 192mr4016542oie.105.1581618420229; Thu, 13 Feb 2020 10:27:00 -0800 (PST) MIME-Version: 1.0 References: <158155489850.3343782.2687127373754434980.stgit@dwillia2-desk3.amr.corp.intel.com> <158155490379.3343782.10305190793306743949.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: From: Dan Williams Date: Thu, 13 Feb 2020 10:26:49 -0800 Message-ID: Subject: Re: [PATCH v2 1/4] mm/memremap_pages: Introduce memremap_compat_align() To: Jeff Moyer Cc: linux-nvdimm , "Aneesh Kumar K.V" , Benjamin Herrenschmidt , Paul Mackerras , Vishal L Verma , Linux Kernel Mailing List , linuxppc-dev 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 Thu, Feb 13, 2020 at 8:58 AM Jeff Moyer wrote: > > Dan Williams writes: > > > The "sub-section memory hotplug" facility allows memremap_pages() users > > like libnvdimm to compensate for hardware platforms like x86 that have a > > section size larger than their hardware memory mapping granularity. The > > compensation that sub-section support affords is being tolerant of > > physical memory resources shifting by units smaller (64MiB on x86) than > > the memory-hotplug section size (128 MiB). Where the platform > > physical-memory mapping granularity is limited by the number and > > capability of address-decode-registers in the memory controller. > > > > While the sub-section support allows memremap_pages() to operate on > > sub-section (2MiB) granularity, the Power architecture may still > > require 16MiB alignment on "!radix_enabled()" platforms. > > > > In order for libnvdimm to be able to detect and manage this per-arch > > limitation, introduce memremap_compat_align() as a common minimum > > alignment across all driver-facing memory-mapping interfaces, and let > > Power override it to 16MiB in the "!radix_enabled()" case. > > > > The assumption / requirement for 16MiB to be a viable > > memremap_compat_align() value is that Power does not have platforms > > where its equivalent of address-decode-registers never hardware remaps a > > persistent memory resource on smaller than 16MiB boundaries. Note that I > > tried my best to not add a new Kconfig symbol, but header include > > entanglements defeated the #ifndef memremap_compat_align design pattern > > and the need to export it defeats the __weak design pattern for arch > > overrides. > > > > Based on an initial patch by Aneesh. > > 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. */ > Second, I will take it at face value that the power architecture > requires a 16MB alignment, but it's not clear to me why mmu_linear_psize > was chosen to represent that. What's the relationship, there, and can > we please have a comment explaining it? Aneesh, can you help here?