Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp482331img; Thu, 28 Feb 2019 02:59:09 -0800 (PST) X-Google-Smtp-Source: AHgI3Ibf0tKnIy4Vvbgkbc40GkAQzRFVaCmkuAsnlO3SfrJ6eBkRLrBOXHXMmCU4nSOUIhA9qcCF X-Received: by 2002:a63:5b43:: with SMTP id l3mr7792284pgm.298.1551351549062; Thu, 28 Feb 2019 02:59:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551351549; cv=none; d=google.com; s=arc-20160816; b=WZFIykq8qVM20agQHuNyFjclKbgldri5HJvCSqC7cE6LYIOveONRKc/t3LK/Y90B07 TAQ0daJ6m/C6iRX8aumrJ2TOJ3uxl9GLhGEiEjxNVJ6Pq9jTVhPvRd0XYYd1I5A5bxFz 5GTwUho1L5sJVDJdqUL4ebiCTuOEcpMMUVy4LwVASN7v9LAF3YpoEsgiudUUElJ0UrTh yxx+nlVbIyB5ZcqP+MeSge9TagRk+lpgkQnCW5Wb7Pf/ranLxAZxb47Zi9LT74VIEvyZ tS9Tjng1F8J61kc2GDOg2vypJEvuYRK5MUYigkOWi8vU4T5FYXMlbWDLt8fzV2k29KHb Tjdg== 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=Oge1v0CI7B6i3pkVqnC/QfefhOu5L2twbcqoTGVhkCQ=; b=aj+TW4mmzIzqaBqS718BRU+JEkd6HGxmh0XPmy0QVoTG3c7NX8BMLAHNLs0sjSBwPV Gx64Qz/DFxEixGFnq2PGMwp4XKSUxcwW0QxGL0P23UZLHIcCWr1kF9GVY4zZoP5tISoD uJQz6VYuTVBMrpu6fuCCVotnAD9dkEQHQ0ZIj2YRbGv705isQYndbetx1tqyMbdwMNal hEMUv94A2plAbj0ArPPN1ORhW5goHXmsEUQgIdaErixlIXluKXQJCzOenIsGtTqLnxez 8fs/nvvWibmMHAhIKab9LDxcWlDu36fWoovqruPrg59g89W8juOGaUo52da/YCwsQdNN 70bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=EhzMZZr+; 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 7si4139263pla.217.2019.02.28.02.58.53; Thu, 28 Feb 2019 02:59:09 -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=EhzMZZr+; 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 S1731055AbfB1HyF (ORCPT + 99 others); Thu, 28 Feb 2019 02:54:05 -0500 Received: from mail-oi1-f196.google.com ([209.85.167.196]:37238 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730888AbfB1HyE (ORCPT ); Thu, 28 Feb 2019 02:54:04 -0500 Received: by mail-oi1-f196.google.com with SMTP id w66so15769287oia.4 for ; Wed, 27 Feb 2019 23:54:04 -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=Oge1v0CI7B6i3pkVqnC/QfefhOu5L2twbcqoTGVhkCQ=; b=EhzMZZr+sRfu5A8F4nCspWxurM7GYsUuit+M4eikNppiCN/FWZEg/OF2ZVRFUMf7Sm wzzbepq/XbXWubVw6VHXPdLE74Z4AEiqKZ5KsekOmYyYUUFPVlsqLgNJtZWjvI6/n7YU Xsh+BicS3fJnhOH8z8dWI20m0CauIc70eq0w0NUbdKeOIzovGSA546Ig//TY6MXLpOTX jr613YEjvSXUnJAG3sOsYnRvyj0B5T6Xj0V6A8SM12RY5MsMLvrUETkZmJ9bPdxaIsqS aVStzMCiTkjyVcpqYeAhNZEbo1VkW3Td7LQvioIiHqE8HHUN4U77ohdlQo8PWQttszpD 1+LA== 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=Oge1v0CI7B6i3pkVqnC/QfefhOu5L2twbcqoTGVhkCQ=; b=P09SsAzjA+ldot6L5pUNOJ0q2t5lzzt2WannrkXT2clxc9dS6gdgLlvtihqAXgS2yf mvcNmGmyz2bPFTzlEulBtfxzGzTh9oOjz5ziFgqzVkGYnBK5Hi33v7HAkuV4xrrtNIFZ Nw94izi1W4HG9ACF1Zk6II2ESlFurGlTWcXPFyGpXInaSDLFRBYAB3X/8B27DM6IvcxX D3ML03LS+8UF1Y1HqZtXcKu5R8l8Va9GYxGbx+d5Kw5Qq82yHFj73+olomyZIuwortdj /86QQEnCx3Ji5/ETOJIl1jXBnOd2oHdNNl1NWMdXIWTVFhbUnUmjt9QEC7C+OIqEhSLV Z2og== X-Gm-Message-State: AHQUAuYdvvDioFGcZFc+ZVBxw03MetEXYHYIox5N5g4Okm9ke/AdwQEA 4Ogx8bHScjhBMDjlD7CuTnGEGiBYu43jPF1igAswpA== X-Received: by 2002:aca:4a10:: with SMTP id x16mr2100135oia.73.1551340443762; Wed, 27 Feb 2019 23:54:03 -0800 (PST) MIME-Version: 1.0 References: <20190225185727.BCBD768C@viggo.jf.intel.com> In-Reply-To: <20190225185727.BCBD768C@viggo.jf.intel.com> From: Dan Williams Date: Wed, 27 Feb 2019 23:53:52 -0800 Message-ID: Subject: Re: [PATCH 0/5] [v5] Allow persistent memory to be used like normal RAM To: Dave Hansen Cc: Linux Kernel Mailing List , Dave Jiang , Ross Zwisler , Vishal L Verma , Tom Lendacky , Andrew Morton , Michal Hocko , linux-nvdimm , Linux MM , "Huang, Ying" , Fengguang Wu , Borislav Petkov , Bjorn Helgaas , Yaowei Bai , Takashi Iwai , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Keith Busch , Stephen Rothwell , Juergen Gross 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 [ add Stephen and Juergen ] On Mon, Feb 25, 2019 at 11:02 AM Dave Hansen wrote: > > This is a relatively small delta from v4. The review comments seem > to be settling down, so it seems like we should start thinking about > how this might get merged. Are there any objections to taking it in > via the nvdimm tree? > > Dan Williams, our intrepid nvdimm maintainer has said he would > appreciate acks on these from relevant folks before merging them. > Reviews/acks on any in the series would be welcome, but the last > two especially are lacking any non-Intel acks: > > mm/resource: let walk_system_ram_range() search child resources > dax: "Hotplug" persistent memory for use like normal RAM I've gone ahead and added this to the libnvdimm-for-next branch for wider exposure. Acks of course still welcome. Stephen, this collides with commit 357b4da50a62 "x86: respect memory size limiting via mem= parameter" in current -next. Here's my resolution for reference, basically just add the max_mem_size statement to Dave's rework. Holler if this causes any other problems. diff --cc mm/memory_hotplug.c index a9d5787044e1,b37f3a5c4833..c4f59ac21014 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@@ -102,28 -99,21 +102,24 @@@ u64 max_mem_size = U64_MAX /* add this memory to iomem resource */ static struct resource *register_memory_resource(u64 start, u64 size) { - struct resource *res, *conflict; + struct resource *res; + unsigned long flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY; + char *resource_name = "System RAM"; + if (start + size > max_mem_size) + return ERR_PTR(-E2BIG); + - res = kzalloc(sizeof(struct resource), GFP_KERNEL); - if (!res) - return ERR_PTR(-ENOMEM); - - res->name = "System RAM"; - res->start = start; - res->end = start + size - 1; - res->flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY; - conflict = request_resource_conflict(&iomem_resource, res); - if (conflict) { - if (conflict->desc == IORES_DESC_DEVICE_PRIVATE_MEMORY) { - pr_debug("Device unaddressable memory block " - "memory hotplug at %#010llx !\n", - (unsigned long long)start); - } - pr_debug("System RAM resource %pR cannot be added\n", res); - kfree(res); + /* + * Request ownership of the new memory range. This might be + * a child of an existing resource that was present but + * not marked as busy. + */ + res = __request_region(&iomem_resource, start, size, + resource_name, flags); + + if (!res) { + pr_debug("Unable to reserve System RAM region: %016llx->%016llx\n", + start, start + size); return ERR_PTR(-EEXIST); } return res;