From patchwork Tue Jul 3 21:00:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 10505219 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9A98B60325 for ; Tue, 3 Jul 2018 21:10:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89BAB28B0B for ; Tue, 3 Jul 2018 21:10:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D92828B12; Tue, 3 Jul 2018 21:10:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1903128B0B for ; Tue, 3 Jul 2018 21:10:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2091E6B0269; Tue, 3 Jul 2018 17:10:57 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 191EF6B026A; Tue, 3 Jul 2018 17:10:57 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0352F6B026B; Tue, 3 Jul 2018 17:10:56 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f199.google.com (mail-pf0-f199.google.com [209.85.192.199]) by kanga.kvack.org (Postfix) with ESMTP id AFD176B0269 for ; Tue, 3 Jul 2018 17:10:56 -0400 (EDT) Received: by mail-pf0-f199.google.com with SMTP id h14-v6so1596471pfi.19 for ; Tue, 03 Jul 2018 14:10:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:subject:from :to:cc:date:message-id:user-agent:mime-version :content-transfer-encoding; bh=OBc0yiD6Lo6hf1htUN6kgnCbcA9fKEe+KhTuoWSSgJg=; b=c++DgowzTqoP+Zl7w71pceq4BrJOlS0Nhr3Sd/Q4FD4SyIwOQ75v7u4ABK24t44Zyu 6RJvrJH0R/xcapO7l78prX6sksJx2saX2zAgkQiGX85BwYWTSIWWqQnjNK/U3fGUvqYy 1DLbbE1j3hUIUzcCNWvhDGV7IqbP0icLbwF/AZR5PVeq2F/ZgDdNprzvctg8ZEGyh3Ge aoKtrTB/DeJCy9Bgx0MmKVHoz9ckpvy6F5ubjyY9Jl+RLGrDeg0emSCU55ElFzGThdTJ 8jfeV59NvIvasedh4+e+wthXSG53dgj7QxHIeXvdzCxCnLdXX/l4Y1Y2WeHS5mB1X3Xh Lalg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.151 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: APt69E2jGZLCIijcJdu87NHY8m5JjRTsB7jyhXnvauFcvMoCWMJ6kCeb ByaRJDEDFpn8e89J9aX/yF4XnNPfko7Bdyc29FePqbmFnNDqe0qBt0qY93fDouVkL4xdzZMrE/z zziu6JbK4v+dU2IPr8/WJAQWvBBxVRqi5KIjLyjtrSw7bhKdMRsIqH9vtk2vILN8bDg== X-Received: by 2002:a63:647:: with SMTP id 68-v6mr27144716pgg.205.1530652256381; Tue, 03 Jul 2018 14:10:56 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI0iO/qoZnfQj27WKtUDhlN3vUDUdGdQY36xR6b8Pz2nYQSmG5WGI2hxzJ2K6o50+i8EPv3 X-Received: by 2002:a63:647:: with SMTP id 68-v6mr27144687pgg.205.1530652255508; Tue, 03 Jul 2018 14:10:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530652255; cv=none; d=google.com; s=arc-20160816; b=ODz6P9GvkyBBnYqfNu4q0bOrhwSe4f4r910V3WCCeNGsBECspA5qk493bnv9BunUGP Z10svc31clzBK+hJbwBTq6nqZ3luxWg71TqNYJoTqW0drMdWy0Ztqi4eEnpXVi5c/BAI bjwo8CRszNaoe4X8nMwEAicvp37mwcq1RJi/tAHRBLpgWqE2fof3yND3p0h1HqIxF3aJ DsyX00wMUyXzf1zC3u5HbXrPVbTxqqOU8wIb/D/GPaQP/8WXSpHhLEH8EAjKiSAH4ymt Az7BOcQZ4d4sMw8uDGRlfgQaSLsy0KVtsofW40jaF4a1kw5gMdkU1ujNPsB6g9+zNHiN t2vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:user-agent:message-id:date :cc:to:from:subject:arc-authentication-results; bh=OBc0yiD6Lo6hf1htUN6kgnCbcA9fKEe+KhTuoWSSgJg=; b=Ou2ADlP39lSZtOfkGS47qL7XajmD9F/NU+ojvAV0VrNCedZku6JTxKgxs9Utw6qCik LVQJoQivSHVDmApboGSvVyxmZbliuVVuJMLMhIMswW8omuQrmPYkZKKo3/CDuaZnNpVO WsGNT+K59fp/ZbW/OX3N9wYod+ePGSAix7f03rk557/ihcgUmfVa4pc6V/laSuoBCIZP 0WZ1wvcnvcVRulI2TwpzJsp1dqtmTEDinAmAPAolWwOiCZGteuaCTkS3BBho7tcF3+ls TThn3kCy17+hOhh+6nIE4NzAFgRP57OgOG63blt4oFIfAw+et2fZrB0OiVZjflWFiCzN sUsg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.151 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga17.intel.com (mga17.intel.com. [192.55.52.151]) by mx.google.com with ESMTPS id a1-v6si1893157plp.247.2018.07.03.14.10.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Jul 2018 14:10:55 -0700 (PDT) Received-SPF: pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.151 as permitted sender) client-ip=192.55.52.151; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.151 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jul 2018 14:10:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,305,1526367600"; d="scan'208";a="242390613" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by fmsmga005.fm.intel.com with ESMTP; 03 Jul 2018 14:10:54 -0700 Subject: [PATCH] x86/numa_emulation: Fix uniform size build failure From: Dan Williams To: mingo@kernel.org Cc: David Rientjes , Thomas Gleixner , Wei Yang , kbuild test robot , x86@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Tue, 03 Jul 2018 14:00:57 -0700 Message-ID: <153065162801.12250.4860144566061573514.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-2-gc94f MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP The calculation of a uniform numa-node size attempted to perform division with a 64-bit diviser leading to the following failure on 32-bit: arch/x86/mm/numa_emulation.o: In function `split_nodes_size_interleave_uniform': arch/x86/mm/numa_emulation.c:239: undefined reference to `__udivdi3' Convert the implementation to do the division in terms of pages and then shift the result back to an absolute physical address. Fixes: 93e738834fcc ("x86/numa_emulation: Introduce uniform split capability") Cc: David Rientjes Cc: Thomas Gleixner Cc: Wei Yang Reported-by: kbuild test robot Signed-off-by: Dan Williams --- Applies to tip/x86/cpu for 4.19. arch/x86/mm/numa_emulation.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c index 039db00541b7..cc7523e45926 100644 --- a/arch/x86/mm/numa_emulation.c +++ b/arch/x86/mm/numa_emulation.c @@ -198,6 +198,14 @@ static u64 __init find_end_of_node(u64 start, u64 max_addr, u64 size) return end; } +static u64 uniform_size(u64 max_addr, u64 base, int nr_nodes) +{ + unsigned long max_pfn = PHYS_PFN(max_addr); + unsigned long base_pfn = PHYS_PFN(base); + + return PFN_PHYS((max_pfn - base_pfn) / nr_nodes); +} + /* * Sets up fake nodes of `size' interleaved over physical nodes ranging from * `addr' to `max_addr'. @@ -236,7 +244,7 @@ static int __init split_nodes_size_interleave_uniform(struct numa_meminfo *ei, } if (uniform) { - min_size = (max_addr - addr) / nr_nodes; + min_size = uniform_size(max_addr, addr, nr_nodes); size = min_size; } else { /*