* [PATCH 0/2] um: switch to NO_BOOTMEM
@ 2018-07-24 13:23 Mike Rapoport
2018-07-24 13:23 ` [PATCH 1/2] um: setup_physmem: stop using global variables Mike Rapoport
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Mike Rapoport @ 2018-07-24 13:23 UTC (permalink / raw)
To: Jeff Dike, Richard Weinberger
Cc: Michal Hocko, linux-um, linux-mm, linux-kernel, Mike Rapoport
Hi,
These patches convert UML to use NO_BOOTMEM.
Tested on x86-64.
Mike Rapoport (2):
um: setup_physmem: stop using global variables
um: switch to NO_BOOTMEM
arch/um/Kconfig.common | 2 ++
arch/um/kernel/physmem.c | 22 ++++++++++------------
2 files changed, 12 insertions(+), 12 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] um: setup_physmem: stop using global variables
2018-07-24 13:23 [PATCH 0/2] um: switch to NO_BOOTMEM Mike Rapoport
@ 2018-07-24 13:23 ` Mike Rapoport
2018-07-24 13:23 ` [PATCH 2/2] um: switch to NO_BOOTMEM Mike Rapoport
2018-07-31 13:38 ` [PATCH 0/2] " Mike Rapoport
2 siblings, 0 replies; 6+ messages in thread
From: Mike Rapoport @ 2018-07-24 13:23 UTC (permalink / raw)
To: Jeff Dike, Richard Weinberger
Cc: Michal Hocko, linux-um, linux-mm, linux-kernel, Mike Rapoport
The setup_physmem() function receives uml_physmem and uml_reserved as
parameters and still used these global variables. Replace such usage with
local variables.
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
---
arch/um/kernel/physmem.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c
index f02596e..0eaec0e 100644
--- a/arch/um/kernel/physmem.c
+++ b/arch/um/kernel/physmem.c
@@ -86,7 +86,7 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end,
long map_size;
int err;
- offset = uml_reserved - uml_physmem;
+ offset = reserve_end - start;
map_size = len - offset;
if(map_size <= 0) {
os_warn("Too few physical memory! Needed=%lu, given=%lu\n",
@@ -96,12 +96,12 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end,
physmem_fd = create_mem_file(len + highmem);
- err = os_map_memory((void *) uml_reserved, physmem_fd, offset,
+ err = os_map_memory((void *) reserve_end, physmem_fd, offset,
map_size, 1, 1, 1);
if (err < 0) {
os_warn("setup_physmem - mapping %ld bytes of memory at 0x%p "
"failed - errno = %d\n", map_size,
- (void *) uml_reserved, err);
+ (void *) reserve_end, err);
exit(1);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] um: switch to NO_BOOTMEM
2018-07-24 13:23 [PATCH 0/2] um: switch to NO_BOOTMEM Mike Rapoport
2018-07-24 13:23 ` [PATCH 1/2] um: setup_physmem: stop using global variables Mike Rapoport
@ 2018-07-24 13:23 ` Mike Rapoport
2018-07-31 13:38 ` [PATCH 0/2] " Mike Rapoport
2 siblings, 0 replies; 6+ messages in thread
From: Mike Rapoport @ 2018-07-24 13:23 UTC (permalink / raw)
To: Jeff Dike, Richard Weinberger
Cc: Michal Hocko, linux-um, linux-mm, linux-kernel, Mike Rapoport
Replace bootmem initialization with memblock_add and memblock_reserve calls
and explicit initialization of {min,max}_low_pfn.
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
---
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 <linux/module.h>
#include <linux/bootmem.h>
+#include <linux/memblock.h>
#include <linux/mm.h>
#include <linux/pfn.h>
#include <asm/page.h>
@@ -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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] um: switch to NO_BOOTMEM
2018-07-24 13:23 [PATCH 0/2] um: switch to NO_BOOTMEM Mike Rapoport
2018-07-24 13:23 ` [PATCH 1/2] um: setup_physmem: stop using global variables Mike Rapoport
2018-07-24 13:23 ` [PATCH 2/2] um: switch to NO_BOOTMEM Mike Rapoport
@ 2018-07-31 13:38 ` Mike Rapoport
2018-07-31 19:03 ` Richard Weinberger
2 siblings, 1 reply; 6+ messages in thread
From: Mike Rapoport @ 2018-07-31 13:38 UTC (permalink / raw)
To: Jeff Dike, Richard Weinberger
Cc: Michal Hocko, linux-um, linux-mm, linux-kernel
Any comments on this?
On Tue, Jul 24, 2018 at 04:23:12PM +0300, Mike Rapoport wrote:
> Hi,
>
> These patches convert UML to use NO_BOOTMEM.
> Tested on x86-64.
>
> Mike Rapoport (2):
> um: setup_physmem: stop using global variables
> um: switch to NO_BOOTMEM
>
> arch/um/Kconfig.common | 2 ++
> arch/um/kernel/physmem.c | 22 ++++++++++------------
> 2 files changed, 12 insertions(+), 12 deletions(-)
>
> --
> 2.7.4
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] um: switch to NO_BOOTMEM
2018-07-31 13:38 ` [PATCH 0/2] " Mike Rapoport
@ 2018-07-31 19:03 ` Richard Weinberger
2018-08-01 12:41 ` Mike Rapoport
0 siblings, 1 reply; 6+ messages in thread
From: Richard Weinberger @ 2018-07-31 19:03 UTC (permalink / raw)
To: Mike Rapoport; +Cc: Jeff Dike, Michal Hocko, linux-um, linux-mm, linux-kernel
Am Dienstag, 31. Juli 2018, 15:38:27 CEST schrieb Mike Rapoport:
> Any comments on this?
>
> On Tue, Jul 24, 2018 at 04:23:12PM +0300, Mike Rapoport wrote:
> > Hi,
> >
> > These patches convert UML to use NO_BOOTMEM.
> > Tested on x86-64.
> >
> > Mike Rapoport (2):
> > um: setup_physmem: stop using global variables
> > um: switch to NO_BOOTMEM
> >
> > arch/um/Kconfig.common | 2 ++
> > arch/um/kernel/physmem.c | 22 ++++++++++------------
> > 2 files changed, 12 insertions(+), 12 deletions(-)
Acked-by: Richard Weinberger <richard@nod.at>
Thanks,
//richard
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] um: switch to NO_BOOTMEM
2018-07-31 19:03 ` Richard Weinberger
@ 2018-08-01 12:41 ` Mike Rapoport
0 siblings, 0 replies; 6+ messages in thread
From: Mike Rapoport @ 2018-08-01 12:41 UTC (permalink / raw)
To: Richard Weinberger
Cc: Jeff Dike, Michal Hocko, linux-um, linux-mm, linux-kernel
Hi Richard,
On Tue, Jul 31, 2018 at 09:03:35PM +0200, Richard Weinberger wrote:
> Am Dienstag, 31. Juli 2018, 15:38:27 CEST schrieb Mike Rapoport:
> > Any comments on this?
> >
> > On Tue, Jul 24, 2018 at 04:23:12PM +0300, Mike Rapoport wrote:
> > > Hi,
> > >
> > > These patches convert UML to use NO_BOOTMEM.
> > > Tested on x86-64.
> > >
> > > Mike Rapoport (2):
> > > um: setup_physmem: stop using global variables
> > > um: switch to NO_BOOTMEM
> > >
> > > arch/um/Kconfig.common | 2 ++
> > > arch/um/kernel/physmem.c | 22 ++++++++++------------
> > > 2 files changed, 12 insertions(+), 12 deletions(-)
>
> Acked-by: Richard Weinberger <richard@nod.at>
Thanks!
Can you please merge this through the uml tree?
> Thanks,
> //richard
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-08-01 12:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-24 13:23 [PATCH 0/2] um: switch to NO_BOOTMEM Mike Rapoport
2018-07-24 13:23 ` [PATCH 1/2] um: setup_physmem: stop using global variables Mike Rapoport
2018-07-24 13:23 ` [PATCH 2/2] um: switch to NO_BOOTMEM Mike Rapoport
2018-07-31 13:38 ` [PATCH 0/2] " Mike Rapoport
2018-07-31 19:03 ` Richard Weinberger
2018-08-01 12:41 ` Mike Rapoport
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).