Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932379AbcCIM2P (ORCPT ); Wed, 9 Mar 2016 07:28:15 -0500 Received: from mail-bl2on0079.outbound.protection.outlook.com ([65.55.169.79]:1664 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751932AbcCIM2C (ORCPT ); Wed, 9 Mar 2016 07:28:02 -0500 Authentication-Results: huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=none action=none header.from=caviumnetworks.com; Date: Wed, 9 Mar 2016 13:27:44 +0100 From: Robert Richter To: Hanjun Guo CC: "Rafael J. Wysocki" , Will Deacon , Catalin Marinas , , , , Ganapatrao Kulkarni , Lorenzo Pieralisi , Shannon Zhao , Steve Capper , Mark Rutland , Hanjun Guo Subject: Re: [PATCH v3 08/12] arm64, numa: rework numa_add_memblk() Message-ID: <20160309122744.GD1535@rric.localdomain> References: <1453541967-3744-1-git-send-email-guohanjun@huawei.com> <1453541967-3744-9-git-send-email-guohanjun@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1453541967-3744-9-git-send-email-guohanjun@huawei.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Originating-IP: [92.224.194.64] X-ClientProxiedBy: VI1PR06CA0034.eurprd06.prod.outlook.com (25.162.116.172) To BLUPR0701MB1602.namprd07.prod.outlook.com (25.163.84.151) X-Microsoft-Exchange-Diagnostics: 1;BLUPR0701MB1602;2:0hf6qrG19UcR2TXKEZpYIpw/3LfKi4Mc0JuETl/2wjobxp3UJ/p2gcitTIqXRKUikbRZtJ6IRgw//ew+rGAkhEVsuk75OZBtbLlblQXgnOZE7asQmBsyDRffdKOlUKcxc4xQ1tKxEwWmTm8nBzsdxQ==;3:h02v6A5D78N2IlKz7XB/MFNl6+hll+5G70muMBux0SqMDmsz2QWS7MuVA/IdXxwkAbkp4f/hB5oAJZjYJx90I7YVZ2722M9ElsFJ8yPUkuBIl74BKgrVKg0n42F1Jrt8;25:zyaRIuXLOmQenPZivkSuRibHLy1L8Y3sv+yVcv4EshgKgQyDAdxHzU8TQg6MXyGjMmpPMOiAJrWuVgA/cTt19djsxrKwiqMkE2ACX5YMPJckWaY0CQuT/cQ1Z9txN5DUNOSlioBkwjJhHC9zLK9LC+cv/eOatepR1+KJRPinarEvwqTrvqTN6kf2oVV/nJKjBwd6N1Xezuci15N2Lfstk+Hwa5u/peASGduwbSI4hcYqNZXd39i9ytXmUaGROhPyBTZyjrPpToFiOu68lcvydkaX04t7KbJ60S8whQ5KEU+Rk//AT1yFHwJfGrVkJBSZlwnOIuwSXC/JPlrYvdR3Uw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0701MB1602; X-MS-Office365-Filtering-Correlation-Id: 3554d5bc-b13e-4a37-a25c-08d348163f65 X-Microsoft-Exchange-Diagnostics: 1;BLUPR0701MB1602;20:lAho98ptZjsWmT3ScmXUDlV1Cl88hqbfmjMzqOqeVtnkThD1t0HtSfsVnJ1KOeWpn8GjRfcZFOE74AAW5zWM78MNuTgRADxTedTP4lni2nQqBO9UayQNcllLJ0RN/Ems7xNTZoWDo19nZ3E/8xa9npx2vYHD6pO4GEbrqcH4GfItI49pJzkEVWzQt8dD7nPIr8yFX7Y1mo8Dn8IdImDWYE4OVsfnC9OoDDnsJGqiRld/jwsZlOjD4gs6hR2trbaioSMkAInA8dmU4FaLhzSA/wecqcCczvzV0alryKYzGz2bs3Epq4aUcBfhdxxlTkBJCf+n0uFBLjtsofIBkj+GBYdGPwgrfyiYsDpUWeLjnsIo56ENy547bfrznPI2NOxHRT0vI9iPDeCT4mRO7COlTlpHsxMrWfO6rgQrMPGZKE0WixZeduLmOH0AQSJXoXbJebOIwHZpJ+Ez/T0TK+J/xdUzKSZxWChoCZYheFY0zmIpefh9yjd7Ssz+Rt4b5zF/grJLUxJkkY6xZQggrKTSwZe4HhFIQY/4dFib0V3VTtFW6VVn0mlUSHXRQfkjAath2X0Jwq4ERi2GVSNgxXS8WQsjSu6IclJgXeE3d9YJZ/Y= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001);SRVR:BLUPR0701MB1602;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0701MB1602; X-Microsoft-Exchange-Diagnostics: 1;BLUPR0701MB1602;4:lQGLSBZO6Jzq5IqJQIFgAZpNrVpIVjNVFCU+QWk1EUFCbs/yabNuLVYJIFUJ1wbU4h1zIaZhmDK1RXFZMXs9lV/I2S4B3u2aU1I22wea6O0fvsGc0qWUJLdv04iO3RQKhM7gs5Ts17NSe1uf3jhaauj0xzWKhNAC8uaEohT3Fab01rExcmaCECE4eISrLrEgTAohdP1iRJMt4PVDE0xBMTM0+3VdLeptC85xVYVOf6byuEz5mEja1qhbIDrt23z9Nd/qPHbkdFGEU9k5x2msp07a4nqU2uGvNK+924NvTjGcIzgiY8aCopz2MVBai52UM1Aby6KnVtvv0ailUbuRSGcBRy/TYs9HSzVSo6V2vW4NpCS0cBvhLtrFCQ8QKE5O X-Forefront-PRVS: 0876988AF0 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(24454002)(97756001)(5008740100001)(86362001)(76176999)(50986999)(83506001)(54356999)(47776003)(5004730100002)(66066001)(19580395003)(19580405001)(1096002)(81166005)(6116002)(3846002)(4001350100001)(110136002)(77096005)(46406003)(2950100001)(1076002)(23726003)(50466002)(2906002)(92566002)(42186005)(4326007)(33656002)(586003)(189998001);DIR:OUT;SFP:1101;SCL:1;SRVR:BLUPR0701MB1602;H:rric.localdomain;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BLUPR0701MB1602;23:oI4M103O+gw34URudZD1yttN7NwjsHbEQUWNCZ7FRj18ZILetax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DNWsftqne/2daabuGut3cS8IPS2As+04yaBp8oLwZtKogs7ab8Ym+eB+kEK9+5NZif5VAKOyDbSfb8Jm+7666yUzG5l4= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2016 12:27:55.8070 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1602 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2568 Lines: 80 On 23.01.16 17:39:23, Hanjun Guo wrote: > From: Hanjun Guo > > Rework numa_add_memblk() to update the parameter "u64 size" > to "u64 end", this will make it consistent with x86 and > can simplify the code later. > > Updates for arch/arm64/mm/numa.c should squash to core NUMA > patches from Ganapat. > > Signed-off-by: Hanjun Guo > --- > arch/arm64/kernel/acpi_numa.c | 2 +- > arch/arm64/kernel/of_numa.c | 2 +- > arch/arm64/mm/numa.c | 12 ++++++------ > 3 files changed, 8 insertions(+), 8 deletions(-) > diff --git a/arch/arm64/kernel/of_numa.c b/arch/arm64/kernel/of_numa.c > index 2f9e34b..aa6f3a3 100644 > --- a/arch/arm64/kernel/of_numa.c > +++ b/arch/arm64/kernel/of_numa.c > @@ -168,7 +168,7 @@ static int __init early_init_parse_memory_node(unsigned long node) > pr_debug("NUMA-DT: base = %llx , node = %u\n", > base, nid); > > - if (numa_add_memblk(nid, base, size) < 0) > + if (numa_add_memblk(nid, base, base + size) < 0) > return -EINVAL; > } > > diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c > index e974995..2b04b8a 100644 > --- a/arch/arm64/mm/numa.c > +++ b/arch/arm64/mm/numa.c > @@ -137,25 +137,25 @@ void numa_store_cpu_info(unsigned int cpu) > * numa_add_memblk - Set node id to memblk > * @nid: NUMA node ID of the new memblk > * @start: Start address of the new memblk > - * @size: Size of the new memblk > + * @end: End address of the new memblk Apart from my earlier comment, this is not exactly correct and may cause confussion. The implementation here defines: size == end - start which is different to struct resource, where: resource_size(res) == res->end - res->start + 1 Thus, @end here is the first address outside of memblk. This is one more argument for keeping @size here. -Robert > * > * RETURNS: > * 0 on success, -errno on failure. > */ > -int __init numa_add_memblk(int nid, u64 start, u64 size) > +int __init numa_add_memblk(int nid, u64 start, u64 end) > { > int ret; > > - ret = memblock_set_node(start, size, &memblock.memory, nid); > + ret = memblock_set_node(start, (end - start), &memblock.memory, nid); > if (ret < 0) { > pr_err("NUMA: memblock [0x%llx - 0x%llx] failed to add on node %d\n", > - start, (start + size - 1), nid); > + start, (end - 1), nid); > return ret; > } > > node_set(nid, numa_nodes_parsed); > pr_info("NUMA: Adding memblock [0x%llx - 0x%llx] on node %d\n", > - start, (start + size - 1), nid); > + start, (end - 1), nid); > return ret; > }