[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH gnumach] Add vm_pages_phys
From: |
Samuel Thibault |
Subject: |
Re: [PATCH gnumach] Add vm_pages_phys |
Date: |
Wed, 31 Jan 2024 12:44:02 +0100 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Sergey Bugaev, le mer. 31 janv. 2024 14:05:18 +0300, a ecrit:
> On Tue, Jan 30, 2024 at 9:45 PM Samuel Thibault <samuel.thibault@gnu.org>
> wrote:
> > > > +kern_return_t vm_pages_phys(
> > > > + host_t host,
> > > > + vm_map_t map,
> > > > + vm_address_t address,
> > > > + vm_size_t size,
> > >
> > > This is supposed to be a number of pages rather than VM region size,
> > > right?
> >
> > No, I followed the same principle as the vm_allocate etc. calls.
> >
> > In the function itself, count = atop(size).
>
> Ack, indeed, I was looking at the wrong thing.
>
> > > You're supposed to allocate your own buffer in this case, something like
> > > this:
> >
> > Ok, done so, thanks!
>
> I see you used kmem_alloc_pageable() over kmem_alloc() that I
> suggested. Why is that?
Because I have seen it used so in other places,
notably host_ipc_marequest_info, host_slab_info,
host_virtual_physical_table_info
> My understanding is the point of kmem_alloc()
> is to be used in cases like this, when you don't want the routine
> itself to fault while holding locks on VM objects/maps.
That's quite subtle. Is that documented somewhere?
Samuel