From patchwork Wed Nov 11 21:16:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boaz Harrosh X-Patchwork-Id: 7597861 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 73AF7C05CA for ; Wed, 11 Nov 2015 21:16:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A360020656 for ; Wed, 11 Nov 2015 21:16:57 +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 C532A2060F for ; Wed, 11 Nov 2015 21:16:56 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id AAE601A2078; Wed, 11 Nov 2015 13:16:56 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mail-wm0-x22e.google.com (mail-wm0-x22e.google.com [IPv6:2a00:1450:400c:c09::22e]) (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 ED8761A2078 for ; Wed, 11 Nov 2015 13:16:54 -0800 (PST) Received: by wmww144 with SMTP id w144so175908758wmw.1 for ; Wed, 11 Nov 2015 13:16:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plexistor_com.20150623.gappssmtp.com; s=20150623; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=MwTa934TrjiU++N9TZdbIXwOX4J2O/w/sN+mre0SF6k=; b=ZjoauLJMbF7jcTRShWEL01VxQQFvrU/eH/VeB0m6bbY/SglgOkvd2MYiroZMtvfjwG +pZnZ2jRoqnYoziJ5j0vZY8SOqCjW3+0XWAEtj+xL9wTPmKBOYyjKuDMMPnuQe+eCQDK 1nuLb2v3yhGbVrkdd1+igqDhR+FCmGR7bA6jQspDnxSZqErAW8sxF8Elp58Emz9wX95m RYla3TDeynNL5ExxApB2b2sGc6q/n6SPGdzYOjgqURLUXTRM/Pkagje/q2AtyR8kTyEj V80iKWP+lyrAZA2jSM95mmTxx0cQRLfz/bHMoy/Sr1+ji/5e6EClAp7rHQJ/MIGeENE2 wbAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:content-type:content-transfer-encoding; bh=MwTa934TrjiU++N9TZdbIXwOX4J2O/w/sN+mre0SF6k=; b=BfgJOQrK98QmkDi33UF6IFzWzpb0eLPfiCl/laK3TYuh2ERvh7YvXtr+hdrk4lS+x2 mIUsibggVcbqv8ACYFcBbXgUJ2Sde1JujPgYsg/Jz08OXUIiDhtGZ3YLaA8g3fY0f09Z s8W1XpWP5FBVkdcFWN7Y1LodTnsDgnlnOD1GzZfHbRTS49uL+7KjfvnOVYyzbxLcXk5c 2iE0iyT5QbcYrPNU6tFz+GoGHPiXPH+qpxz65pEo9Voe+d0+JT+ClhECucfX74IfiYED v1hT+DtRHbyd1BjfhWFWkrcgtB8GgGVAO5y1teUtFGUq04i9XBunsuo8C7qXQXeYBdI9 W/5g== X-Gm-Message-State: ALoCoQmHlOjsZZew2AdiEXBE9Vmch8V4AOXtbakZnB89AesjYMHxJuKa+qAGqGJV4CFpeRTu2zNl X-Received: by 10.28.20.139 with SMTP id 133mr43440113wmu.36.1447276612831; Wed, 11 Nov 2015 13:16:52 -0800 (PST) Received: from [10.0.0.5] ([207.232.55.62]) by smtp.googlemail.com with ESMTPSA id u205sm2085865wmb.12.2015.11.11.13.16.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Nov 2015 13:16:52 -0800 (PST) Message-ID: <5643B043.3010103@plexistor.com> Date: Wed, 11 Nov 2015 23:16:51 +0200 From: Boaz Harrosh User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Dan Williams Subject: [RFC 1/1] memremap: devm_memremap_pages has wrong nid 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 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. This is on top of v4.3. I will please need the final fix for Stable@ Thanks Signed-off-by: Boaz Harrosh --- kernel/memremap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel/memremap.c b/kernel/memremap.c index 9d6b555..9409e23 100644 --- a/kernel/memremap.c +++ b/kernel/memremap.c @@ -183,9 +183,7 @@ void *devm_memremap_pages(struct device *dev, struct resource *res) memcpy(&page_map->res, res, sizeof(*res)); - nid = dev_to_node(dev); - if (nid < 0) - nid = 0; + nid = memory_add_physaddr_to_nid(res->start); error = arch_add_memory(nid, res->start, resource_size(res), true); if (error) {