From patchwork Thu Jun 23 11:30:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dennis Chen X-Patchwork-Id: 9194857 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 A375B6075C for ; Thu, 23 Jun 2016 11:31:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93BA12844E for ; Thu, 23 Jun 2016 11:31:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8802328450; Thu, 23 Jun 2016 11:31:39 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB5882844E for ; Thu, 23 Jun 2016 11:31:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751547AbcFWLbh (ORCPT ); Thu, 23 Jun 2016 07:31:37 -0400 Received: from eu-smtp-delivery-143.mimecast.com ([207.82.80.143]:36919 "EHLO eu-smtp-delivery-143.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751425AbcFWLbf convert rfc822-to-8bit (ORCPT ); Thu, 23 Jun 2016 07:31:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=J5gdeuUNWemuo4HqLQwjRMNlWBz9WC6jNv5KbKwRodA=; b=YQDAAHvqVg/ohadfaW+pUL6FxRJeX0aCGysB/duaZ3RQ/CDhJF8dkJ67BunViG76wAapVsID+2Ivr/evk9zO5m3QPIfZwfi8ZRRHG1+uPPFnU3CF+4Q1Ja5z44xCwJW+WzmtS1toKShSZqzNFgc4fT5pN+ourpuBgHmbluQEB+A= Received: from emea01-db3-obe.outbound.protection.outlook.com (mail-db3lrp0082.outbound.protection.outlook.com [213.199.154.82]) (Using TLS) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-72-7d9sXvwdOcyu2ENmBtsSOA-1; Thu, 23 Jun 2016 12:31:32 +0100 Received: from AM3PR08CA0049.eurprd08.prod.outlook.com (10.163.23.145) by AM4PR08MB1234.eurprd08.prod.outlook.com (10.167.92.136) with Microsoft SMTP Server (TLS) id 15.1.523.12; Thu, 23 Jun 2016 11:31:30 +0000 Received: from DB3FFO11FD040.protection.gbl (2a01:111:f400:7e04::135) by AM3PR08CA0049.outlook.office365.com (2a01:111:e400:8854::17) with Microsoft SMTP Server (TLS) id 15.1.523.12 via Frontend Transport; Thu, 23 Jun 2016 11:31:30 +0000 Received: from nebula.arm.com (217.140.96.140) by DB3FFO11FD040.mail.protection.outlook.com (10.47.217.71) with Microsoft SMTP Server (TLS) id 15.1.517.7 via Frontend Transport; Thu, 23 Jun 2016 11:31:30 +0000 Received: from dennis-ws.asiapac.arm.com (10.1.2.79) by mail.arm.com (10.1.106.66) with Microsoft SMTP Server id 14.3.294.0; Thu, 23 Jun 2016 12:31:27 +0100 From: Dennis Chen To: CC: , Dennis Chen , Catalin Marinas , Steve Capper , "Ard Biesheuvel" , Will Deacon , Mark Rutland , "Rafael J . Wysocki" , Matt Fleming , , , Subject: [PATCH 1/2] mm: memblock Add some new functions to address the mem limit issue Date: Thu, 23 Jun 2016 19:30:14 +0800 Message-ID: <1466681415-8058-1-git-send-email-dennis.chen@arm.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:217.140.96.140; IPV:CAL; SCL:-1; CTRY:GB; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(438002)(189002)(199003)(7846002)(7696003)(77096005)(11100500001)(4326007)(2906002)(47776003)(106466001)(5003600100003)(229853001)(2351001)(356003)(246002)(8676002)(5003940100001)(92566002)(104016004)(86362001)(36756003)(8936002)(48376002)(87936001)(110136002)(33646002)(50226002)(50986999)(19580405001)(19580395003)(26826002)(586003)(6806005)(50466002)(305945005)(189998001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR08MB1234; H:nebula.arm.com; FPR:; SPF:Pass; PTR:fw-tnat.cambridge.arm.com; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DB3FFO11FD040; 1:O805yshy+lQJUoX4foLouebfN5Xlczru+YChaLmQyC/ekAdJFYJhWKFuznx4zKlQFalwd3099aJRGMU/SFXJvRb+ZV9PE7H9xepLcDr2tgpubGjejcKO8+ahKjeWjeHs0xKZfj8HvpXYmHTCzqknggR+K/+OXucEg5uMnLUDXBUbiF5xKBPc1Fj4cQPM+FG6TRhpREdOiUQXMmDIZae9qS0W0ZZ6cmZFEq1RQUJ4KtVax/gEsAYHrCr+GFH7dqzlZkdII7zdcDaSRZZBcW1waGPgYKUW7VDMKPVe59MJt9yR4x5uhq2wgvtlOUSlNiJN3nH35xANJBN2JDs3ZyFa8ao9JOl9llq2pR4ZTmhjpjikqB+/WreIUS2kXAk9wFbbV9WjR4FRdScWjWUhSYz4HJADHycwMxgF0gx9t9FQ5JZw93ELfSXdICZQzD/ZYxs1YoU4vY07Y/GqmCvn7jHMVsZ3i/id2AGaXlYlp8N6LBH1Zh4DcYo4zJXOssXxHVPXLj8c5MIjGwK1e11mPfUIX4Mv6T7yMm3lFnhjM4M3aVkLEn7lxo4P3tECoTL0lgAvrSUm1MbMKSoMTIJyAuChjHU6BuHEM3eDxFqkkQqciIw= X-MS-Office365-Filtering-Correlation-Id: 78b14b42-0729-4863-3f3d-08d39b59ec2e X-Microsoft-Exchange-Diagnostics: 1; AM4PR08MB1234; 2:fxK23X/cudMGQjiMdlZDqlMo1y7cA1ql4J3IJon5rpJxn8EnoBsz1T4dhVfnzXtFsAyMKD/cuOdpTU5/MaGTk2AqAtWvX0XC6Bo1EVxtN5rfs7EeD4B18oehlEGticpQ9rhQE3SZYcnTL1D4KD9kC4nbAfAGhVZoO7og4eENH4onxt/pHTsgYaUOg10h/21R; 3:6NgQ1BkxluMT9sTfj9Jtw93cxGNTsWUlbAto3x4ELSvx9UthKyOyM0Wk5MoafCJkc9ivt2UfLXuKx4dtJ+G+/JDRRo6/jtRhQCI4GtX82PjIV90oyg7GALlf1xSmeiYXbK1CGL4h8YyBeoz1nAXmpc7weMsXf1hoMQOxmRlKR7jESit0qkQqPrMOR/2P7sFm65s11WTYD8FQgiX2OJFrH4h6ikbeMXYJOk67QmWjbNkaHiSgieOtpUehZPbV6RgVDy2pEVeluDJoLZ/gwcEMSQ== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:AM4PR08MB1234; X-Microsoft-Exchange-Diagnostics: 1; AM4PR08MB1234; 25:m6XL47/jtkBFWN0AtilmxWyD/Mj+k5u3sANby1jII/JN8crgYzPKmfme/l2Pw5afm2J8pIaXIfj/iZHrMRS1kTftPm9qop5pBPRg4J2VYHZRP1HcMJhOL1AHrPlM+3f0HSxLvO6iB+anUhS1frI7rSDbErxv8rpYazBBkF5Cu/CvvfUj6n3c6+9iuyOPYHgoBbnd+kgz3F9EbvUAnJkM8R7zLUdMHz8ROGjID5GkycXykfXprurpHz3n+x/jICCKy7Im7bq2QQ+viF30/A7ohoMLENqyzJ0GzUexJJqBa5OuzM/00gfo2Effqh10nCyK4wux8yO89YhKbWQVIaJdyOd9lZV/3TnLAuSiuWXYxe8axSPofUCFJV4xGmVPNFEo3Pjn3KEzzqEUdJSwd7f5/Eodzjj6kYSjstpuakRXoIaJIDwlZY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JhLjlgn5yhgUJJcuiRPtdZhdAN8DB/ZQyW9Jh/PSAhKPW4+rP32CtUv7GZdWIWVqbCaRuNs3qqkGjpUl1RMCr+PO/7f3Lj98kwYgZb2/dXCFUsZV5yvv94JmphE/OEuoNj02NO0k+OfEw1FzJv06X+b4C8N8VLCYHTf2EVMHwyua7b8xMmrweLhE5GcaW5vvdg5g X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917)(9452136761055)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13023025)(13024025)(13013025)(13020025)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:AM4PR08MB1234; BCL:0; PCL:0; RULEID:; SRVR:AM4PR08MB1234; X-Forefront-PRVS: 098291215C X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM4PR08MB1234; 23:xjRV63nJSyPza6quDGhZoMbipx3BxSA1nHzz97vuB?= =?us-ascii?Q?4SGQ7ppf9uTMWIsVQr8jpXDdujY6cpHY9pBuWhyP/ESW0Ildix7rp4eFFw3X?= =?us-ascii?Q?2q9V8rmd0Bkr+0U9yMc61L9v/+JYuxt7mrkcMzAxStCwbEbDsSjiiHw4xj/C?= =?us-ascii?Q?Nl9AkRthXSugtOq5w7QbQ0xH2aySIJb8H8Zr+qq/rwgPxlgvnZggfXbHHcaA?= =?us-ascii?Q?8jMcEZpNYoifNM/qudOrVqGNwXnkL9AKQDsDkdJwhOWk8xpxPvEgsAes2ZTL?= =?us-ascii?Q?hm6xIOuv018JBZHyyprThCyJlVjDrl1Jqn4/sCsz8bMTXYlUdQMY/B3iIlRc?= =?us-ascii?Q?X9FHnlmFY5S0ZaVUo3ReXqm5nWLw5habJHXvjd3yj8EM2gu8BvLBFQdvjuCg?= =?us-ascii?Q?Xvx3JAfEyUXVV0N8VHtD/z64TrmHmIi/MzPRyQMPcGLhLjLgHttU2QMLwAGa?= =?us-ascii?Q?7dkpoPSK3OJB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5:Jm/mo9824mYwYKJUX4z1YBS0c0ubdNDjQyHWdD8zYpfEnpagthSm8j3lYeng8E0ks9xJ6hZkeEbnkLQRhLZWbyxP6EdcuZBlk835THJl8q4yW2+9cJuQ/4r89MUXRsGZBpr3X6n88P2zMFPP0zESNg==; 24:hJZJ/0vuYC2Mpb2OYSFP6qsoPND3FphpYnqydC7GUsnFQFnUzAGFcoqwQSwdg/r2tQvHRuDSgtA4nuHtTMFl64LmxBAPLLeAHCX3DQ2MCBo=; 7:Ri4z1lck1vvyWc9apN8Tvv+mVZg02rQ6Z9oYbVyHrbsSfy9tbPNXIMlvC/SlyaByOKrxcY+bn0a8OhYE+L1toAwHIHJ1on6IqMdwHh42IilpnsL2FjpZyppeEjuoFZlAK5ptG7rXBpxUk+Nq55Zxt0//pamUM3oBMdEspRpPYwpl3UU1sq7U/uu8tE8FTJYi7sV6+qkfIsvdvzfXpQ6qF8oKDyrAQExwHysO/N+wV+vH07zbnC1+7Air5BOYh8g8/PX3tkv2Yo0QozusaNHa5Q== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM4PR08MB1234; 20:2PfmT3QlVVZN7pAh88NwDTz7j4JdlT6nnlrccV5oeCN4Nqy1kf/X0ET5pRA4lyLEt8pAzgH4Zgar1i+O0GUM9I2TCTe8zrQgn5N4YLxli1xSmTk9sity/gsAH3HUTZRked5zOJKkTJZ6fXGWDvYh7zxTyJ7OXQIQH/Ua8xtO1Fk= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2016 11:31:30.3724 (UTC) X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[217.140.96.140]; Helo=[nebula.arm.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR08MB1234 X-MC-Unique: 7d9sXvwdOcyu2ENmBtsSOA-1 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Two major changes in this patch: [1] Add memblock_mem_limit_mark_nomap(phys_addr_t limit) function to mark memblock regions above the @limit as NOMAP region, which will be used to address the observed 'mem=x' kernel parameter issue. [2] Add 'size' and 'flag' debug output in the memblock debugfs. The '/sys/kernel/debug/memblock/memory' output looks like before: 0: 0x0000008000000000..0x0000008001e7ffff 1: 0x0000008001e80000..0x00000083ff184fff 2: 0x00000083ff185000..0x00000083ff1c2fff 3: 0x00000083ff1c3000..0x00000083ff222fff 4: 0x00000083ff223000..0x00000083ffe42fff 5: 0x00000083ffe43000..0x00000083ffffffff With this patch applied: 0: 0x0000008000000000..0x0000008001e7ffff 0x0000000001e80000 0x4 1: 0x0000008001e80000..0x00000083ff184fff 0x00000003fd305000 0x0 2: 0x00000083ff185000..0x00000083ff1c2fff 0x000000000003e000 0x4 3: 0x00000083ff1c3000..0x00000083ff222fff 0x0000000000060000 0x0 4: 0x00000083ff223000..0x00000083ffe42fff 0x0000000000c20000 0x4 5: 0x00000083ffe43000..0x00000083ffffffff 0x00000000001bd000 0x0 Signed-off-by: Dennis Chen Cc: Catalin Marinas Cc: Steve Capper Cc: Ard Biesheuvel Cc: Will Deacon Cc: Mark Rutland Cc: Rafael J. Wysocki Cc: Matt Fleming Cc: linux-mm@kvack.org Cc: linux-acpi@vger.kernel.org Cc: linux-efi@vger.kernel.org --- include/linux/memblock.h | 2 ++ mm/memblock.c | 50 ++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/include/linux/memblock.h b/include/linux/memblock.h index 6c14b61..5e069c8 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -92,6 +92,7 @@ int memblock_mark_hotplug(phys_addr_t base, phys_addr_t size); int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size); int memblock_mark_mirror(phys_addr_t base, phys_addr_t size); int memblock_mark_nomap(phys_addr_t base, phys_addr_t size); +int memblock_clear_nomap(phys_addr_t base, phys_addr_t size); ulong choose_memblock_flags(void); /* Low level functions */ @@ -332,6 +333,7 @@ phys_addr_t memblock_mem_size(unsigned long limit_pfn); phys_addr_t memblock_start_of_DRAM(void); phys_addr_t memblock_end_of_DRAM(void); void memblock_enforce_memory_limit(phys_addr_t memory_limit); +void memblock_mem_limit_mark_nomap(phys_addr_t limit); bool memblock_is_memory(phys_addr_t addr); int memblock_is_map_memory(phys_addr_t addr); int memblock_is_region_memory(phys_addr_t base, phys_addr_t size); diff --git a/mm/memblock.c b/mm/memblock.c index ca09915..60930ac 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -814,6 +814,18 @@ int __init_memblock memblock_mark_nomap(phys_addr_t base, phys_addr_t size) } /** + * memblock_clear_nomap - Clear flag MEMBLOCK_NOMAP for a specified region. + * @base: the base phys addr of the region + * @size: the size of the region + * + * Return 0 on success, -errno on failure. + */ +int __init_memblock memblock_clear_nomap(phys_addr_t base, phys_addr_t size) +{ + return memblock_setclr_flag(base, size, 0, MEMBLOCK_NOMAP); +} + +/** * __next_reserved_mem_region - next function for for_each_reserved_region() * @idx: pointer to u64 loop variable * @out_start: ptr to phys_addr_t for start address of the region, can be %NULL @@ -1465,14 +1477,11 @@ phys_addr_t __init_memblock memblock_end_of_DRAM(void) return (memblock.memory.regions[idx].base + memblock.memory.regions[idx].size); } -void __init memblock_enforce_memory_limit(phys_addr_t limit) +static phys_addr_t __find_max_addr(phys_addr_t limit) { phys_addr_t max_addr = (phys_addr_t)ULLONG_MAX; struct memblock_region *r; - if (!limit) - return; - /* find out max address */ for_each_memblock(memory, r) { if (limit <= r->size) { @@ -1482,6 +1491,18 @@ void __init memblock_enforce_memory_limit(phys_addr_t limit) limit -= r->size; } + return max_addr; +} + +void __init memblock_enforce_memory_limit(phys_addr_t limit) +{ + phys_addr_t max_addr; + + if (!limit) + return; + + max_addr = __find_max_addr(limit); + /* truncate both memory and reserved regions */ memblock_remove_range(&memblock.memory, max_addr, (phys_addr_t)ULLONG_MAX); @@ -1489,6 +1510,17 @@ void __init memblock_enforce_memory_limit(phys_addr_t limit) (phys_addr_t)ULLONG_MAX); } +void __init memblock_mem_limit_mark_nomap(phys_addr_t limit) +{ + phys_addr_t max_addr; + + if (!limit) + return; + + max_addr = __find_max_addr(limit); + memblock_mark_nomap(max_addr, (phys_addr_t)ULLONG_MAX); +} + static int __init_memblock memblock_search(struct memblock_type *type, phys_addr_t addr) { unsigned int left = 0, right = type->cnt; @@ -1677,13 +1709,15 @@ static int memblock_debug_show(struct seq_file *m, void *private) reg = &type->regions[i]; seq_printf(m, "%4d: ", i); if (sizeof(phys_addr_t) == 4) - seq_printf(m, "0x%08lx..0x%08lx\n", + seq_printf(m, "0x%08lx..0x%08lx 0x%08lx 0x%lx\n", (unsigned long)reg->base, - (unsigned long)(reg->base + reg->size - 1)); + (unsigned long)(reg->base + reg->size - 1), + (unsigned long)reg->size, reg->flags); else - seq_printf(m, "0x%016llx..0x%016llx\n", + seq_printf(m, "0x%016llx..0x%016llx 0x%016llx 0x%lx\n", (unsigned long long)reg->base, - (unsigned long long)(reg->base + reg->size - 1)); + (unsigned long long)(reg->base + reg->size - 1), + (unsigned long long)reg->size, reg->flags); } return 0;