Implement paging on the pci arbiter

2020-08-26 Thread Joan Lledó
Hi,

I'm doing a research on how to allow arbiter clients to map bar regions
into their spaces. It seems to me the approach should be:

1.- Make the arbiter implement paging
2.- Expect clients to mmap() the region files the arbiter generates

Sounds that correct for you?

I'm a bit confused with libpager, the reference manual seems to be obsolete:

https://www.gnu.org/software/hurd/doc/hurd_5.html#SEC32

From this document I assumed I should create a pager for each region
file, call page_demuxer from the arbiter's demuxer and implement
callback functions. But it seems pager_demuxer() is not defined anymore
and servers use pager_start_workers() which I'm not sure what's for.

Is there more recent documentation about libpager?



signature.asc
Description: OpenPGP digital signature


Re: PCI arbiter crash on last qemu image

2020-08-26 Thread Damien Zammit
Hi,

On 23/8/20 8:47 pm, Joan Lledó wrote:
> http://git.savannah.gnu.org/cgit/hurd/hurd.git/log/?h=jlledom-pciaccess-map

Thanks for doing this, I tried it locally and fixed two bugs in my libpciaccess 
patches:

diff --git a/src/x86_pci.c b/src/x86_pci.c
index 1614729..1e70f35 100644
--- a/src/x86_pci.c
+++ b/src/x86_pci.c
@@ -275,6 +275,7 @@ map_dev_mem(void **dest, size_t mem_offset, size_t 
mem_size, int write)
return errno;
 }
 
+close(memfd);
 return 0;
 #endif
 }
@@ -505,7 +506,7 @@ pci_nfuncs(struct pci_device *dev, uint8_t *nfuncs)
 static error_t
 pci_device_x86_read_rom(struct pci_device *dev, void *buffer)
 {
-void *bios;
+void *bios = NULL;
 struct pci_device_private *d = (struct pci_device_private *)dev;
 
 int err;


> Also in map_dev_mem(), it seems to be some problem when mapping the rom.
> I tried to read the rom with hexdump:
> 
> hexdump -Cn 16 /servers/bus/pci//00/03/0/rom

This command now works (every time).

> In pci_device_x86_read_rom() the memory is mapped and unmapped for each
> read. I wonder if it's correct to unmap with munmap() something mapped
> with vm_map()

I think it's okay to munmap memory mapped with vm_map
but I forgot to initialise the rom memory pointer to NULL.

See http://git.zammit.org/libpciaccess.git/log/?h=rumpdisk-upstream again for 
updated branch.
If you think everything is okay with this, I will squash the last patch and 
submit patches upstream.

Thanks,
Damien



doc libpager

2020-08-26 Thread gfleury
Hi Joan,

I can not reply in your thread "Implement paging on the pci arbiter" because i 
suscribed right now. hope you this links!

This doc talk about libpager.

https://www.freesoft.org/software/hurd/building.pdf 
(https://www.freesoft.org/software/hurd/building.pdf) 
https://github.com/BrentBaccala/hurd (https://github.com/BrentBaccala/hurd)


Re: Implement paging on the pci arbiter

2020-08-26 Thread Samuel Thibault
Hello,

Joan Lledó, le mer. 26 août 2020 10:24:49 +0200, a ecrit:
> I'm doing a research on how to allow arbiter clients to map bar regions
> into their spaces. It seems to me the approach should be:
> 
> 1.- Make the arbiter implement paging
> 2.- Expect clients to mmap() the region files the arbiter generates
> 
> Sounds that correct for you?
> 
> I'm a bit confused with libpager,

I'm unsure if libpager will be useful actually, since all you need is
to pass on a memory object clamped to the target physical memory. See
gnumach's support for proxy memory object, which possibly is just
enough.

Samuel



Re: doc libpager

2020-08-26 Thread Joan Lledó
Hi,

thanks for your help, I'll take a look :)

El 26/8/20 a les 16:23, gfle...@disroot.org ha escrit:
> 
> Hi Joan,
> 
> I can not reply in your thread "Implement paging on the pci arbiter"
> because i suscribed right now. hope you this links!
> 
> This doc talk about libpager.
> 
> https://www.freesoft.org/software/hurd/building.pdf
> https://github.com/BrentBaccala/hurd
> 



Re: PCI arbiter crash on last qemu image

2020-08-26 Thread Joan Lledó
Hi,

El 26/8/20 a les 11:13, Damien Zammit ha escrit:
> If you think everything is okay with this, I will squash the last patch and 
> submit patches upstream.

Yes it's OK for me



Re: Implement paging on the pci arbiter

2020-08-26 Thread Samuel Thibault
Joan Lledó, le mer. 26 août 2020 10:24:49 +0200, a ecrit:
> From this document I assumed I should create a pager for each region
> file, call page_demuxer from the arbiter's demuxer and implement
> callback functions. But it seems pager_demuxer() is not defined anymore

?
libpager/demuxer.c:pager_demuxer (struct pager_requests *requests,

> and servers use pager_start_workers() which I'm not sure what's for.

It's just a way to manage several threads to handle RPCs. See how it
creates a thread than calls service_paging_requests that runs
pager_demuxer.

Samuel