Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6972219imm; Tue, 24 Jul 2018 06:24:56 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdJ9KNcPOJE3HDdw4wptOMgOTNp6WlK0Q7AfgNM2tE396SVAcp3tTpRtcOrF14m2c34BBoy X-Received: by 2002:a17:902:e088:: with SMTP id cb8-v6mr2810611plb.189.1532438696330; Tue, 24 Jul 2018 06:24:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532438696; cv=none; d=google.com; s=arc-20160816; b=wNojY4ZGc9Op6c7/7mAp+dBraFIshFcJdqGYgf85dhR9moCSWxYMByvQi2yFGevyBc z5/VBiX/TSrkIoKaxFJiHa8lgzUKQf6KZtiBASlAsHVhAI+LSQwtqanmK6yDmHDnZfYY XUra1QWxCKvRbnbQe2N2UsbUk5LWQ4Z3BkkuSE3s9SFnnYLdj+7I3NSjKdMOazW5hI8f EFVe+/xm3ahnXGrW8yWgrkdubhF8IQ4KzU8l+7bMyL7oaNMu27Syn1xzHrB8fVboGY0D f9rohlCBA2cJ3/672tVTIkUpN0Mi8zfnKD44nwGwfILjjyxwmoQFHtgPUAKlIlM6xnnr syGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from:arc-authentication-results; bh=VRmszCwepa+G4FpXfgOB6b4YNbgQbGcShxhbNGlhvac=; b=iNXuU/QhI7r99ssxynG0VFH0nIKd0pBtzPkuv8O9H6rEY9pcSMiWeKGmC4G/0MnBYz fKsYxMJYbbwZ1roADQThW5XplvcSPQca1Np1+CZw7FamNoy37ieG2C5zzQpzK6HAgXQD GbvaYZEjjeMOWDx3ZtpRfclEYQJlRqM9fBeZ9z8TKV6SJzd5yjJ15uuNp9xVtc7QJXzx RwlgpKUuMA8ZM3cy4+Icr8g7RXwANPC5YXGU+0SFUt/MT2tq9BqJOxNrYgJIPiG5CAfZ 5xjZfrqUizMgBUuI0v0C2/+uEw0LtZR7bWn4QnBlvy2ov1ktjIgtOmqiw5lqZl05+9Mk GvFA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5-v6si7016059pll.89.2018.07.24.06.24.41; Tue, 24 Jul 2018 06:24:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388397AbeGXOaA (ORCPT + 99 others); Tue, 24 Jul 2018 10:30:00 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:44728 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388297AbeGXO37 (ORCPT ); Tue, 24 Jul 2018 10:29:59 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6ODIdbR127013 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 2ke41mjwjb-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=885 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807240141 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) -- 2.7.4