<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 6, 2015 at 9:58 AM, Yann Droneaud <span dir="ltr"><<a href="mailto:ydroneaud@opteya.com" target="_blank">ydroneaud@opteya.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Le mardi 06 octobre 2015 à 09:26 -0400, Kenneth Adam Miller a écrit :<br>
<br>
> Any body know about the issue of assigning a process a region of<br>
> physical memory to use for it's malloc and free? I'd like to just<br>
> have the process call through to a UIO driver with an ioctl, and then<br>
> once that's done it gets all it's memory from a specific region.<br>
><br>
<br>
</span>You mean CONFIG_UIO_DMEM_GENIRQ (drivers/uio/uio_dmem_genirq.c)<br>
<br>
See:<br>
<a href="http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=0a0c3b5a24bd802b1ebbf99e0b01296647b8199b" rel="noreferrer" target="_blank">http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=0a0c3b5a24bd802b1ebbf99e0b01296647b8199b</a><br>
<a href="http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=b533a83008c3fb4983c1213276790cacd39b518f" rel="noreferrer" target="_blank">http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=b533a83008c3fb4983c1213276790cacd39b518f</a><br>
<a href="https://www.kernel.org/doc/htmldocs/uio-howto/using-uio_dmem_genirq.html" rel="noreferrer" target="_blank">https://www.kernel.org/doc/htmldocs/uio-howto/using-uio_dmem_genirq.html</a><br>
<br>
<br></blockquote><div><br></div><div>Well I don't think that does exactly what I would like, although I've got that on my machine and I've been compiling it and learning from it. Here's my understanding of the process of the way mmap works:</div><div><br></div><div>Mmap is called from userland and it maps a region of memory of a certain size according to the parameters given to it, and the return value it has is the address at which the block requested starts, if it was successful (which I'm not addressing the unsuccessful case here for brevity). The userland process now has only a pointer to a region of space, as if they had allocated something with new or malloc. Further calls to new or malloc don't mean that the pointers returned will preside within the new mmap'd chunk, they are just separate regions also mapped into the process. </div><div><br></div><div>What I would like is a region of memory that, once mapped to a process, further calls to new/malloc return pointers that preside within this chunk. Calls to new/malloc and delete/free only edit the process's internal table, which is fine. </div><div><br></div><div>Is that wrong? Or is it that mmap already does the latter?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
PS: please don't top post reply as it makes it difficult to parse the<br>
discussion.<br>
<span class=""><br>
<br>
> On Tue, Oct 6, 2015 at 1:21 AM, Greg KH <<a href="mailto:greg@kroah.com">greg@kroah.com</a>> wrote:<br>
> > On Mon, Oct 05, 2015 at 07:07:51PM -0400, Kenneth Adam Miller<br>
> > wrote:<br>
> > > So, I'm reading about UIO devices and user processes for mapping<br>
> > memory into<br>
> > > userland, and basically I have just a couple questions:<br>
> > ><br>
> > > What happens when a userland processes has allocated some<br>
> > resource from a<br>
> > > driver that is facilitating UIO, but then subsequently crashes?<br>
> > I'd like to<br>
> > > know that the driver can (or how you would enable such) recover<br>
> > the resources<br>
> > > so that the next user process can acquire them, instead of them<br>
> > being lost.<br>
> ><br>
> > Have you tried this? All of your resources should be freed<br>
> > properly, if<br>
> > not, let the uio maintainers know.<br>
> ><br>
> > thanks,<br>
> ><br>
<br>
</span>Regards.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Yann Droneaud<br>
OPTEYA<br>
<br>
</font></span></blockquote></div><br></div></div>