Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp57259img; Wed, 20 Mar 2019 14:01:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqxqHvC3BC53aQSM7r9Hhpqo3shid8AuYvthcpRVkPg9Ki03fau94WzhmKCYZI6/mquzPwiw X-Received: by 2002:a17:902:20eb:: with SMTP id v40mr10535491plg.20.1553115681634; Wed, 20 Mar 2019 14:01:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553115681; cv=none; d=google.com; s=arc-20160816; b=CKpNPqZbmMWbiDbHGRXSfHJh1LT0kquDhxWlZfx7uUyNcYm5W+3THMtsK/QVPDGMPN YA1hAE+ecz28VrssfdOxw8+LNpHcRMSHx4YWgKxXg8V3xntJGj5osFGDF5ClDCRofsh7 vhJmFtBWj+2hXRvrDR6XcSxk6xcIpvdgJoiDjO7174/+A9TrtEFoWWWJSINFXUQmQ2q7 sSMCdG8jxCj7YBBFqUStGWvHNvevKIt7Hoe2d3svBsAsXq2HFZ3YVQs8gCqpqQnj0iL4 XNPJk/Iu/0zwYibrMTkYP3LeyoAlu6BfqaccMTNa8wjraE+pMtbn3/WJSGViQcqEzxWC u6qg== 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=Ij6DJHAqfryzjiSG/jxMhd1XKTG9GJ9L0fy61wU1Z5Q=; b=BOVRn6YBqNufUTPnKC04XqQDA9y/Iruy/5vFAexToiicXqAhfBlw1ThhpKtzqLD3bX SIg6pMszlc4oftyJI0AYpXVxsG81uZ/+uwC6utTYyYPKKfPIdK+h/HowqRNvUTn5lnoo koVVkWYB3No/M8dLP8fhYz1/lSYVPjTVLPnrlo7CrWGRBgR2n6JGMPDIlFty7gvRBlxh 4I8HiG3RfIaqDn1K1cwebSJcnZunfC1bc/ydNeic1xZdPM7eSQwZhbAIjsz7qpGqVftd NTQW/ChiP21FQS/BssU/+hOLHT9ElklzyT6xdAi3z8hdUgqHKNL9ejhcgcnB1icy2Cbz yBlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=hQHtw54b; 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 f89si2847169plb.20.2019.03.20.14.01.05; Wed, 20 Mar 2019 14:01:21 -0700 (PDT) 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=hQHtw54b; 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 S1727587AbfCTU5g (ORCPT + 99 others); Wed, 20 Mar 2019 16:57:36 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:42955 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726006AbfCTU5g (ORCPT ); Wed, 20 Mar 2019 16:57:36 -0400 Received: by mail-ot1-f67.google.com with SMTP id 103so3485289otd.9 for ; Wed, 20 Mar 2019 13:57:36 -0700 (PDT) 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=Ij6DJHAqfryzjiSG/jxMhd1XKTG9GJ9L0fy61wU1Z5Q=; b=hQHtw54bMsNq0UWUzqZi4Xepmmij8Jy+KDZGJeywwLNrPiqUxNyKDH9xKURLPj0fcE kgWIoCRrhrHXSjdOwmwJflndw0Hkzfn+dxWAhGaTjcdCUmKbGDvtLdps5Q5aNmZbyXWA 3qpCDijWEutH+VhB1H3M03XG0EqvBDiHqQf8KpW7PktJ/3m/DRFeEcos1F+gSTr3sIrB Ad673In69dbKt/dX6+IzUFlmsJQdelglLg+znKplUjCEwy5y+QlPtMSJmrjZ01yzykjv KzrcWmFeOoSmQMh+oZa/9G1ooH7YeUyBLCBcskKekprWtQU1d7nwTXUeH25dBf7R+wDa oxlQ== 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=Ij6DJHAqfryzjiSG/jxMhd1XKTG9GJ9L0fy61wU1Z5Q=; b=FjRaFzEqBWRlxIhjji4dxiDcpK/2cF/0TL3II/dwsTn3C2gmpzmO/gARrwhjw/LOxn WrimpRJKU1dyTvRyMz4CiZ3w99V22OEAQZCbgFNQpTbiGCe+fjB3kRNmVgS7eYRTbLZj 5ioS18s11duuHyNCIGnUebcQKNv1mZYxgqCf/25gka2qx7UiY1ruZQ+N3wPR336Z/7ix kFvfS7dwkET1AKisgZT9dnj0ANHeNnmbtJogsl+WmEq8N5XhyhJEzTCuJTIB4XEFH71h mMfespHTE0QDDR+LZK1fAXkgPoSrL2z8/k8vk32sx9hNiQvFhFOi9IkCFQ8Zu0NRxX9Z 9E7g== X-Gm-Message-State: APjAAAU74P6qiQlBxo4IC4OasHlMaXzstNCiniHjV79PYmpBWh0mury4 3o0zPmN1HTxGVvbPiTRi4XRlqjQw0soIFAQ8IEBxxDrj X-Received: by 2002:a9d:4d0b:: with SMTP id n11mr63266otf.98.1553115455713; Wed, 20 Mar 2019 13:57:35 -0700 (PDT) MIME-Version: 1.0 References: <20190228083522.8189-1-aneesh.kumar@linux.ibm.com> <20190228083522.8189-2-aneesh.kumar@linux.ibm.com> <87k1hc8iqa.fsf@linux.ibm.com> <871s3aqfup.fsf@linux.ibm.com> <87bm267ywc.fsf@linux.ibm.com> <878sxa7ys5.fsf@linux.ibm.com> In-Reply-To: From: Dan Williams Date: Wed, 20 Mar 2019 13:57:25 -0700 Message-ID: Subject: Re: [PATCH 2/2] mm/dax: Don't enable huge dax mapping by default To: "Aneesh Kumar K.V" Cc: Jan Kara , linux-nvdimm , Michael Ellerman , Linux Kernel Mailing List , Linux MM , Ross Zwisler , Andrew Morton , linuxppc-dev , "Kirill A . Shutemov" 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 Wed, Mar 20, 2019 at 8:34 AM Dan Williams wrote: > > On Wed, Mar 20, 2019 at 1:09 AM Aneesh Kumar K.V > wrote: > > > > Aneesh Kumar K.V writes: > > > > > Dan Williams writes: > > > > > >> > > >>> Now what will be page size used for mapping vmemmap? > > >> > > >> That's up to the architecture's vmemmap_populate() implementation. > > >> > > >>> Architectures > > >>> possibly will use PMD_SIZE mapping if supported for vmemmap. Now a > > >>> device-dax with struct page in the device will have pfn reserve area aligned > > >>> to PAGE_SIZE with the above example? We can't map that using > > >>> PMD_SIZE page size? > > >> > > >> IIUC, that's a different alignment. Currently that's handled by > > >> padding the reservation area up to a section (128MB on x86) boundary, > > >> but I'm working on patches to allow sub-section sized ranges to be > > >> mapped. > > > > > > I am missing something w.r.t code. The below code align that using nd_pfn->align > > > > > > if (nd_pfn->mode == PFN_MODE_PMEM) { > > > unsigned long memmap_size; > > > > > > /* > > > * vmemmap_populate_hugepages() allocates the memmap array in > > > * HPAGE_SIZE chunks. > > > */ > > > memmap_size = ALIGN(64 * npfns, HPAGE_SIZE); > > > offset = ALIGN(start + SZ_8K + memmap_size + dax_label_reserve, > > > nd_pfn->align) - start; > > > } > > > > > > IIUC that is finding the offset where to put vmemmap start. And that has > > > to be aligned to the page size with which we may end up mapping vmemmap > > > area right? > > Right, that's the physical offset of where the vmemmap ends, and the > memory to be mapped begins. > > > > Yes we find the npfns by aligning up using PAGES_PER_SECTION. But that > > > is to compute howmany pfns we should map for this pfn dev right? > > > > > > > Also i guess those 4K assumptions there is wrong? > > Yes, I think to support non-4K-PAGE_SIZE systems the 'pfn' metadata > needs to be revved and the PAGE_SIZE needs to be recorded in the > info-block. How often does a system change page-size. Is it fixed or do environment change it from one boot to the next? I'm thinking through the behavior of what do when the recorded PAGE_SIZE in the info-block does not match the current system page size. The simplest option is to just fail the device and require it to be reconfigured. Is that acceptable?