From patchwork Fri Aug 3 19:58:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10555479 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 0E81813B4 for ; Fri, 3 Aug 2018 19:59:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F28232C12E for ; Fri, 3 Aug 2018 19:59:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4EDC2C1DE; Fri, 3 Aug 2018 19:59:41 +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 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 52FBE2C165 for ; Fri, 3 Aug 2018 19:59:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E4A936B026B; Fri, 3 Aug 2018 15:59:24 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E214C6B026C; Fri, 3 Aug 2018 15:59:24 -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 CBFFD6B026E; Fri, 3 Aug 2018 15:59:24 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by kanga.kvack.org (Postfix) with ESMTP id 65D996B026B for ; Fri, 3 Aug 2018 15:59:24 -0400 (EDT) Received: by mail-ed1-f71.google.com with SMTP id i26-v6so2132815edr.4 for ; Fri, 03 Aug 2018 12:59:24 -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=IMPy9pOsazrrg8v4JRpYZ4Lz2nM+DpeFlUKz+Vm2FoU=; b=DMw5LnwTU5BvqQcOc/s09Nb8Y+A63CwNOCuJ1l9XouSTzF56eq+VXZCsPrwq6LpVEb X6HbjeKX30Js6d/QPy9lfAE0Du7rQdt6f67lNEy4dUDnTgh/qy58Jedq0tUQcuEavStf P0S0sVIZuJnhgOSvlWzxIgowakgq9UGcSrxtwH5TC0iGj2tnuPkiLQIxIuZerxxNR6gm Is3rPCwNr3t1Jg+xFcqjCqIGbCUQoU3a4GVhCFHCpJ0ztNOoGg0h8AXhCMZCE1RS4Z2T rQgFYxRM7hhpy37bU3sXAdSe/GFjfUyHjJ/Xa5Mihv6Ec1LXKOHwRlb2Kt7Q4ZlwrJyf 8Bag== 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: AOUpUlEdoU/TLC5jAbAlsIDJ/lM0MfoLVhjT7FeWGIz9v6st6D9bscR6 1QV63dz2lmzkhGIOnisnM7xMBfd0Zj0mekbdpnievWQ4cD8SxMOlB+pFg7LP22Fkw2sUuURDgma H4QiFANsn5sM+tmqlij160/VSmVBwBMbFgp/on6FKPw794pWHEGgfV4Rbi3arC0Q= X-Received: by 2002:a50:c9c3:: with SMTP id c3-v6mr9148971edi.56.1533326363883; Fri, 03 Aug 2018 12:59:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeyJkcVbw+K1wIaVOEuR8vFTkQ/rdV+5H7djLGi+/+Tmd3Of5yIi2j138/rKRnkwJRMnP7j X-Received: by 2002:a50:c9c3:: with SMTP id c3-v6mr9148948edi.56.1533326362964; Fri, 03 Aug 2018 12:59:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533326362; cv=none; d=google.com; s=arc-20160816; b=oi0UVgviFn1wSqRrSbTBpS8MV9hmWMbnb6zdAJMBTVy+47cjS3rGoj4Eo4gD8N4MBi ue663RpjwQ94fJHGLJRMSpifTwvlYziDtGC8eVhjKj0uGbKwL3ch0SIkkq9tPgooOzUq 9lscRxkhlHQ+jVvnYWiYDz5quJx88EQzfhnle/JQ3ERlWkwHzj97MDMGyEHZJYTLVWz2 7VHwXYKiaGhP/Sl+GzaLSUhr0S6IruFMg6Zpf43r2w4OT71PNV7CEi/VRwC9+TXvztwB gZfVr1IvlI2/0SSo2IuXj+H4AXGacecwdv93tVwWsNLfUabib9l135XWD+c2fK1wmFg9 D9ZA== 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=IMPy9pOsazrrg8v4JRpYZ4Lz2nM+DpeFlUKz+Vm2FoU=; b=rdyPzrb7XNGhHMeMY+uxceoPCFNVXeIRKNW9FVkdZUCMxOVgz7qe0sBnpUZZ3MMAPA Rh1jTzDfR9UQ8Bz7YoCPWPJGcVICHP1B4OxMOfQGGtix5niNC/udETitrS7wnTwyC+vC F4kQC8M0UD7CvrFl81Kk6qvLNdmUhvaIQRqb4jo2t021c/8LKjF814JY4lvPGUlTy0a0 pRKKjYH+1GAjC9gfOK59dQBW8PQt4/BIufXJsZvbIzt8f1tzJzx+Lnbgcznsl+8efzLe sGaqw0Aa88jTzSVU3blJOi02EAx99c9EcMcam7aPHXZlD+pi/6jqxkWKGgfvOoUUZkHu fMdw== 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 h9-v6si5039667edl.176.2018.08.03.12.59.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Aug 2018 12:59:22 -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 (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w73Jx6a0071981 for ; Fri, 3 Aug 2018 15:59:20 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kmtce73ex-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 03 Aug 2018 15:59:20 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 3 Aug 2018 20:59:18 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 3 Aug 2018 20:59:14 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w73JxDcR44564712 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 3 Aug 2018 19:59:13 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9B15C4C044; Fri, 3 Aug 2018 22:59:24 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 282684C040; Fri, 3 Aug 2018 22:59:22 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.204.91]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 3 Aug 2018 22:59:22 +0100 (BST) Received: by rapoport-lnx (sSMTP sendmail emulation); Fri, 03 Aug 2018 22:59:10 +0300 From: Mike Rapoport To: Andrew Morton Cc: Richard Kuo , Ley Foon Tan , Richard Weinberger , Guan Xuetao , Michal Hocko , linux-hexagon@vger.kernel.org, nios2-dev@lists.rocketboards.org, linux-um@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mike Rapoport Subject: [PATCH 6/7] um: switch to NO_BOOTMEM Date: Fri, 3 Aug 2018 22:58:49 +0300 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533326330-31677-1-git-send-email-rppt@linux.vnet.ibm.com> References: <1533326330-31677-1-git-send-email-rppt@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18080319-0008-0000-0000-0000025C97E1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18080319-0009-0000-0000-000021C33DD2 Message-Id: <1533326330-31677-7-git-send-email-rppt@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-08-03_08:,, 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=799 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808030216 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 Acked-by: Richard Weinberger --- 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)