Il 09/08/2016 00:21, Luca dariz ha scritto:
> Il 30/07/2016 03:47, Olaf Buddenhagen ha scritto:
>> On Fri, Jul 29, 2016 at 06:30:09PM +0000, Luca wrote:
>>> I need a way to translate logical addresses to physical,
>> Is this for DMA or something along these lines? If so, the interface for
>> allocating "contiguous memory" that was added for the purpose of DDE
>> should work here as well I'd presume.
>> (I didn't like how the original interface was designed specifically, and
>> I don't know whether in has been improved since -- but regardless, it
>> should get the job done...)
>> If it doesn't cut it, or this is about something else entirely, could
>> you elaborate please?
> The contiguous memory allocation interface is not enough. I mean, at
> least in the virtio ld driver, there are some addresses that must be
> translated which are not allocated with vm_allocate_contiguous. However
> I did not investigate in detail why this is needed.

I investigated a bit more, and it seems that these addresses correspond
to buffers in the netbsd block cache, so this is the reason for not
being allocated with vm_allocate_contiguous().. Also these buffers are
used to read and write data. I think the virtio driver uses DMA however
I can read and write to the underlying device apparently without problems..

Here's a simple test to show what I'm doing:

uint8_t *buf=malloc(size);
memset(buf, 0x5a, size);
fd = rump_sys_open(("/dev/ld0d", RUMP_O_RDWR);
rump_sys_write(fd, buf, size);
rump_sys_lseek(fd, 0, SEEK_SET);
memset(buf, 0, size);
rump_sys_read(fd, buf, size);
... check that I read the same that I wrote ...

Could it be that I'm just lucky to not have a page boundary in the
middle of a block cache buffer? I'd expect to see some hole reading back
the data..


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to