From patchwork Tue Jul 24 13:23:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10542165 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BACDB112B for ; Tue, 24 Jul 2018 13:23:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA2B2206AF for ; Tue, 24 Jul 2018 13:23:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E04828735; Tue, 24 Jul 2018 13:23:34 +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 28B67206AF for ; Tue, 24 Jul 2018 13:23:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BBEE56B0266; Tue, 24 Jul 2018 09:23:32 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B1D406B026B; Tue, 24 Jul 2018 09:23:32 -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 883EC6B0269; Tue, 24 Jul 2018 09:23:32 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-oi0-f72.google.com (mail-oi0-f72.google.com [209.85.218.72]) by kanga.kvack.org (Postfix) with ESMTP id 5609C6B0010 for ; Tue, 24 Jul 2018 09:23:32 -0400 (EDT) Received: by mail-oi0-f72.google.com with SMTP id m197-v6so4111848oig.18 for ; Tue, 24 Jul 2018 06:23:32 -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:from:to:cc :subject:date:in-reply-to:references:message-id; bh=VRmszCwepa+G4FpXfgOB6b4YNbgQbGcShxhbNGlhvac=; b=NBlbmRwRJKgpwvOVNpmczhOP4uvqyFqLwwWR/GYQoaYSPdGrjkBW75HHKiyp0D+F5j 3T7ezP9L2ztwcZnHWgRRzw4Yz0yZT3tZPQSABPzrXeGrKl9VYm/lQ2WGU0o5Fd8engM2 bAcwEHJrMgbQvTPAksG2rVBWoyStFO1g8Dpz2Vbleh77QAJB4WxSFrqitqcMQihtRqmd ZrfTSuSjEF2yY27bamXAUjwEXBYVbPeGmsvt+mInaR87XYv8quMcXUp8SDH4ayRWIqa+ mkMaAmlqfGQN4/DZWegXqWZMqoYMLC2RydIITyRVArHqx11rz2zSLL+sDYvDnYMD34ak oQgg== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) smtp.mailfrom=rppt@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com X-Gm-Message-State: AOUpUlGqCz8ZwmGr/Vvr/f+yZwEzFHS+6SnuUJI9g8Os9XM0oo3BrF2s YPfiIBRsojw2539yaDLpG9/Kz77LPZVNosvLssqj6lEPtRiQerdd25+stXpNAjMhgkzvjeCyLzI MFU+FzEmZIlsNKZDeVj2v0KM4//DdDWTzolR8fmiH2VmyTCKS0PeXazjWX3QA4Ag= X-Received: by 2002:aca:6b51:: with SMTP id g78-v6mr3403027oic.290.1532438612060; Tue, 24 Jul 2018 06:23:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe/ptn8xxIUDImvvuGyYRnrk3YDE1hrgV4oLvvy+KjCu/nAMYNeRq2S5h9yXpIwv+iuHr7U X-Received: by 2002:aca:6b51:: with SMTP id g78-v6mr3402985oic.290.1532438611460; Tue, 24 Jul 2018 06:23:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532438611; cv=none; d=google.com; s=arc-20160816; b=og4GQ6dHoGnCUSqxKVnYZHGic6ZQnqkaF84BCyyH9uuvG5/DLTMryzI4rOcw9owE4q ETdfdVhY4ZNDQwqpszSkh4Sxw1okbtXH5ziEH+Oqjvavkp+QpdrVJMSw2F/NmlrWqgCF kLIXFzJ4q3z+AaSW8fBP7a8Sk819l1843yyZ8fiM8qxO6Zzva1EYC9WVSj5TF7rrbVCx WRBHTDyv7s6A0OIhSEgChUG65mA4ekWpUsXZBPfHze9GQJUlOuOuHdOsWwFDdvzPKqll PeF+rWHCbXM8zHdKbgC2Sniy303oM/fnUGo1uMFOlxCJOCr6zRFy9NhQKroJoUsbos5q 7+2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:references:in-reply-to:date:subject:cc:to:from :arc-authentication-results; bh=VRmszCwepa+G4FpXfgOB6b4YNbgQbGcShxhbNGlhvac=; b=pjZ5bvXbVYddEAqQbvoYN7L6gD7hBYWGzwI6IfnouCigZq9Wr6wayTF8ai0dN4Yuee aT+FFSmNC7UD4x7Bbc7XLlqm00IoR/Dcwo4vym6ldf4b1pjcu0te+rRPHOrbso2LX20w dj/ba0IYbcYcW+PzUxVZALpet2bRcnTDe2lcK36qa3lv31nnhPggXKv3PdCQgGDiruj0 6ouNKuBdwgUhlcwuJOcfDS52xH65e1hhCuUHTcNKJ7zL35FLvu2OpU3bWdzEmfQa/T7k OfH7nAq8DuxV46Txqqe4DR5Xla/TosgQJDigW4O2P7L0tzFXsNbhMFoB89I1dvSivjqK NOaA== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) smtp.mailfrom=rppt@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com. [148.163.156.1]) by mx.google.com with ESMTPS id e125-v6si7483836oif.165.2018.07.24.06.23.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jul 2018 06:23:31 -0700 (PDT) Received-SPF: neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) client-ip=148.163.156.1; Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) smtp.mailfrom=rppt@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6ODIleN008490 for ; Tue, 24 Jul 2018 09:23:30 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ke3r5uyb2-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 24 Jul 2018 09:23:30 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 24 Jul 2018 14:23:28 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 24 Jul 2018 14:23:25 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w6ODNOED34013316 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 24 Jul 2018 13:23:24 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EEEBFAE055; Tue, 24 Jul 2018 16:23:32 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6A30BAE056; Tue, 24 Jul 2018 16:23:31 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.8.56]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 24 Jul 2018 16:23:31 +0100 (BST) Received: by rapoport-lnx (sSMTP sendmail emulation); Tue, 24 Jul 2018 16:23:21 +0300 From: Mike Rapoport To: Jeff Dike , Richard Weinberger Cc: Michal Hocko , linux-um@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mike Rapoport Subject: [PATCH 2/2] um: switch to NO_BOOTMEM Date: Tue, 24 Jul 2018 16:23:14 +0300 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532438594-4530-1-git-send-email-rppt@linux.vnet.ibm.com> References: <1532438594-4530-1-git-send-email-rppt@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18072413-0020-0000-0000-000002AA79AC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18072413-0021-0000-0000-000020F70C25 Message-Id: <1532438594-4530-3-git-send-email-rppt@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-07-24_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=884 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807240141 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 Replace bootmem initialization with memblock_add and memblock_reserve calls and explicit initialization of {min,max}_low_pfn. Signed-off-by: Mike Rapoport --- arch/um/Kconfig.common | 2 ++ arch/um/kernel/physmem.c | 20 +++++++++----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common index 07f84c8..1487957 100644 --- a/arch/um/Kconfig.common +++ b/arch/um/Kconfig.common @@ -8,6 +8,8 @@ config UML select HAVE_UID16 select HAVE_FUTEX_CMPXCHG if FUTEX select HAVE_DEBUG_KMEMLEAK + select HAVE_MEMBLOCK + select NO_BOOTMEM select GENERIC_IRQ_SHOW select GENERIC_CPU_DEVICES select GENERIC_CLOCKEVENTS diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c index 0eaec0e..296a91a 100644 --- a/arch/um/kernel/physmem.c +++ b/arch/um/kernel/physmem.c @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -80,23 +81,18 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end, unsigned long len, unsigned long long highmem) { unsigned long reserve = reserve_end - start; - unsigned long pfn = PFN_UP(__pa(reserve_end)); - unsigned long delta = (len - reserve) >> PAGE_SHIFT; - unsigned long offset, bootmap_size; - long map_size; + long map_size = len - reserve; int err; - offset = reserve_end - start; - map_size = len - offset; if(map_size <= 0) { os_warn("Too few physical memory! Needed=%lu, given=%lu\n", - offset, len); + reserve, len); exit(1); } physmem_fd = create_mem_file(len + highmem); - err = os_map_memory((void *) reserve_end, physmem_fd, offset, + err = os_map_memory((void *) reserve_end, physmem_fd, reserve, map_size, 1, 1, 1); if (err < 0) { os_warn("setup_physmem - mapping %ld bytes of memory at 0x%p " @@ -113,9 +109,11 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end, os_write_file(physmem_fd, __syscall_stub_start, PAGE_SIZE); os_fsync_file(physmem_fd); - bootmap_size = init_bootmem(pfn, pfn + delta); - free_bootmem(__pa(reserve_end) + bootmap_size, - len - bootmap_size - reserve); + memblock_add(__pa(start), len + highmem); + memblock_reserve(__pa(start), reserve); + + min_low_pfn = PFN_UP(__pa(reserve_end)); + max_low_pfn = min_low_pfn + (map_size >> PAGE_SHIFT); } int phys_mapping(unsigned long phys, unsigned long long *offset_out)