From patchwork Wed Nov 11 21:46:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 7597931 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 717AFBF90C for ; Wed, 11 Nov 2015 21:46:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 97FDD205B7 for ; Wed, 11 Nov 2015 21:46:09 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C306E20592 for ; Wed, 11 Nov 2015 21:46:08 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B78DC1A207D; Wed, 11 Nov 2015 13:46:08 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mail-wm0-x231.google.com (mail-wm0-x231.google.com [IPv6:2a00:1450:400c:c09::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6C4CE1A207D for ; Wed, 11 Nov 2015 13:46:07 -0800 (PST) Received: by wmvv187 with SMTP id v187so5130912wmv.1 for ; Wed, 11 Nov 2015 13:46:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel_com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=oxlh/PVEP0Z8rlkymCmlnJ+B8YFSwjhkXkmGHUOPHiI=; b=nK7ZJd2HOCFhIDjEEyFuIQYoFOHCZBLtXTA6W5KMZHM7zM9mmtdu0oDJrem/1DGOiv glnvFqlYE42Sa+iK9KeBFp/EhlvzPavQcwneQE+DmLCIpJwfWgghrD5Q4lOrUUcNbAdv wKFk0nZyDN56/gEnLa+04uroVLEDNTCg5GwF9a28mnPFZaF0/H8z+gZVAsEX31vu9SA8 hXSteV00262YKebpQ7eq+u1j6eOlaKmdtb75mctyHBez6ZXj0hZkW/9C04oEuHWMXs3d mlxuJGTatymVwCtWUBwNLyVwyjCqivCD0RPNnGTWHYlcOiz3QqfkY0ZtKJK53BCmVRgE 6i0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=oxlh/PVEP0Z8rlkymCmlnJ+B8YFSwjhkXkmGHUOPHiI=; b=eiozqrgaImuf62RdBg9x7/6a8FFWMGRFU2I+TH4cdbNJuLYztYQSexFg/WuZhIHk0d OMI2WeMDkfbU1lx+BOo+1miVvdOERdAPLVINv2p6odmVmoEYayIpokZlFITRoUUPad6k lDRmx/TX8bd/N6w8dbf4PODMBR5+KE4kusUN+ftqGsl97HdvakN8sqIM3waoeLTCSjrp D9gzQ5PIlpOt69KAC6yN6YMc1azWOedpjBJ7bRbTEicC1co8Hg6VY3gUrIahe2hghv5x dMPAJ6I7pHO8ahDA7B3LtN6vROK5ceH5zqmI6pyo1hq3lU4MWnyYPfrpq2FV7XD92pqE XGzg== X-Gm-Message-State: ALoCoQkXi0wUGwvaF9P4RXD8/mv5JEanp8mhitoIA6QpCYQx5BOLWvPORPl+BJZQDs7i0S6Ouz8V MIME-Version: 1.0 X-Received: by 10.28.213.212 with SMTP id m203mr40684437wmg.33.1447278365777; Wed, 11 Nov 2015 13:46:05 -0800 (PST) Received: by 10.27.88.130 with HTTP; Wed, 11 Nov 2015 13:46:05 -0800 (PST) In-Reply-To: <5643B043.3010103@plexistor.com> References: <5643B043.3010103@plexistor.com> Date: Wed, 11 Nov 2015 13:46:05 -0800 Message-ID: Subject: Re: [RFC 1/1] memremap: devm_memremap_pages has wrong nid From: Dan Williams To: Boaz Harrosh Cc: linux-fsdevel , "linux-nvdimm@lists.01.org" X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Nov 11, 2015 at 1:16 PM, Boaz Harrosh wrote: > > The pmem dev as received in devm_memremap_pages() does not have > its dev->numa_node properly initialized yet. > > What I see is that all pmem devices will call arch_add_memory > with nid==0 regardless of the real nid the memory is actually > on. Needless to say that after that all the NUMA page and zone > members (at page->flags) come out wrong. > > If I do the below code it will all work properly. > > RFC because probably we want to fix dev->numa_node before the > call to devm_memremap_pages. Let's just do that instead. I.e. in the case of NFIT numa node should already be set, and in the case of the memmap=ss!nn or e820-type-12 we can set the numa node like this: Thanks for pointing out memory_add_physaddr_to_nid(). I did not know that existed. diff --git a/drivers/nvdimm/e820.c b/drivers/nvdimm/e820.c index 8282db2ef99e..e40df8fedf73 100644 --- a/drivers/nvdimm/e820.c +++ b/drivers/nvdimm/e820.c @@ -48,7 +48,7 @@ static int e820_pmem_probe(struct platform_device *pdev) memset(&ndr_desc, 0, sizeof(ndr_desc)); ndr_desc.res = p; ndr_desc.attr_groups = e820_pmem_region_attribute_groups; - ndr_desc.numa_node = NUMA_NO_NODE; + ndr_desc.numa_node = memory_add_physaddr_to_nid(p->start); set_bit(ND_REGION_PAGEMAP, &ndr_desc.flags); if (!nvdimm_pmem_region_create(nvdimm_bus, &ndr_desc)) goto err;