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: 7597941 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2687C9F1C2 for ; Wed, 11 Nov 2015 21:46:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4825520592 for ; Wed, 11 Nov 2015 21:46:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6059C205B9 for ; Wed, 11 Nov 2015 21:46:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752654AbbKKVqI (ORCPT ); Wed, 11 Nov 2015 16:46:08 -0500 Received: from mail-wm0-f48.google.com ([74.125.82.48]:37946 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752424AbbKKVqH (ORCPT ); Wed, 11 Nov 2015 16:46:07 -0500 Received: by wmec201 with SMTP id c201so65479262wme.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=k8lWYYouNAzTF312FmQB5gjUrqSOs88SuPZIwggJ8D6yQ/euISFrvxpQolN6DiFx7S RM8vnTJ5jUXFeeVqXw2jLPoBxc2PRDqy3BC5+xUwOu/yr61q0Q2lgsoz4RdgBXDw9L5H oG1IaYX11hdcL42IJuUtX4OGJ19IzBGWntI2KqshFD2Liw5DBkvq4cnaSY315k2yx+eF k4dXae4P9zB2SwN0Md5F+jTNcae6QYh0ZZTvZHxFwCvNUwavzcBj5Sm4Rpx+t38jIB+Y r75lPJzQlLQDxfYwroIUFr5OzOFyAFaOu7hd6TZLbOBxBQpXbJMOjUOkGyHZWjvjyErf yR7Q== X-Gm-Message-State: ALoCoQk6030pIKJ2Kerjlfkgn6fLgPO3LPv+Ex2IYcsiG08s1RItFjgrT/dqS04vNM3gs8Qf3/Li 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" Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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. --- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;