* UIO Devices and user processes @ 2015-10-05 23:07 Kenneth Adam Miller 2015-10-06 5:21 ` Greg KH 0 siblings, 1 reply; 14+ messages in thread From: Kenneth Adam Miller @ 2015-10-05 23:07 UTC (permalink / raw) To: kernelnewbies So, I'm reading about UIO devices and user processes for mapping memory into userland, and basically I have just a couple questions: What happens when a userland processes has allocated some resource from a driver that is facilitating UIO, but then subsequently crashes? I'd like to know that the driver can (or how you would enable such) recover the resources so that the next user process can acquire them, instead of them being lost. We have a specific region of memory that we'd like to allocate to a process, and we'd like effectively all new and delete or malloc and free operations to be done against this target area. We'd like to not have to use placement new in C++-just transparently for the requesting user process to receive chunks from a specific real region of memory. Thanks in advance. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20151005/e12b07d7/attachment.html ^ permalink raw reply [flat|nested] 14+ messages in thread
* UIO Devices and user processes 2015-10-05 23:07 UIO Devices and user processes Kenneth Adam Miller @ 2015-10-06 5:21 ` Greg KH 2015-10-06 13:26 ` Kenneth Adam Miller 0 siblings, 1 reply; 14+ messages in thread From: Greg KH @ 2015-10-06 5:21 UTC (permalink / raw) To: kernelnewbies On Mon, Oct 05, 2015 at 07:07:51PM -0400, Kenneth Adam Miller wrote: > So, I'm reading about UIO devices and user processes for mapping memory into > userland, and basically I have just a couple questions: > > What happens when a userland processes has allocated some resource from a > driver that is facilitating UIO, but then subsequently crashes? I'd like to > know that the driver can (or how you would enable such) recover the resources > so that the next user process can acquire them, instead of them being lost. Have you tried this? All of your resources should be freed properly, if not, let the uio maintainers know. thanks, greg k-h ^ permalink raw reply [flat|nested] 14+ messages in thread
* UIO Devices and user processes 2015-10-06 5:21 ` Greg KH @ 2015-10-06 13:26 ` Kenneth Adam Miller 2015-10-06 13:57 ` Greg KH 2015-10-06 13:58 ` Yann Droneaud 0 siblings, 2 replies; 14+ messages in thread From: Kenneth Adam Miller @ 2015-10-06 13:26 UTC (permalink / raw) To: kernelnewbies No, I didn't try it. I just wanted to ask before I got started. Thanks that answers everything. Any body know about the issue of assigning a process a region of physical memory to use for it's malloc and free? I'd like to just have the process call through to a UIO driver with an ioctl, and then once that's done it gets all it's memory from a specific region. On Tue, Oct 6, 2015 at 1:21 AM, Greg KH <greg@kroah.com> wrote: > On Mon, Oct 05, 2015 at 07:07:51PM -0400, Kenneth Adam Miller wrote: > > So, I'm reading about UIO devices and user processes for mapping memory > into > > userland, and basically I have just a couple questions: > > > > What happens when a userland processes has allocated some resource from a > > driver that is facilitating UIO, but then subsequently crashes? I'd like > to > > know that the driver can (or how you would enable such) recover the > resources > > so that the next user process can acquire them, instead of them being > lost. > > Have you tried this? All of your resources should be freed properly, if > not, let the uio maintainers know. > > thanks, > > greg k-h > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20151006/9390c5df/attachment.html ^ permalink raw reply [flat|nested] 14+ messages in thread
* UIO Devices and user processes 2015-10-06 13:26 ` Kenneth Adam Miller @ 2015-10-06 13:57 ` Greg KH 2015-10-06 14:03 ` Kenneth Adam Miller 2015-10-06 13:58 ` Yann Droneaud 1 sibling, 1 reply; 14+ messages in thread From: Greg KH @ 2015-10-06 13:57 UTC (permalink / raw) To: kernelnewbies On Tue, Oct 06, 2015 at 09:26:23AM -0400, Kenneth Adam Miller wrote: > No, I didn't try it. I just wanted to ask before I got started. Thanks that > answers everything. > > Any body know about the issue of assigning a process a region of physical > memory to use for it's malloc and free? I'd like to just have the process call > through to a UIO driver with an ioctl, and then once that's done it gets all > it's memory from a specific region. UIO drivers do not support ioctl, why would you need/want that? What's wrong with just using the correct mmap/munmap logic that UIO userspace drivers use today? thanks, greg k-h ^ permalink raw reply [flat|nested] 14+ messages in thread
* UIO Devices and user processes 2015-10-06 13:57 ` Greg KH @ 2015-10-06 14:03 ` Kenneth Adam Miller 0 siblings, 0 replies; 14+ messages in thread From: Kenneth Adam Miller @ 2015-10-06 14:03 UTC (permalink / raw) To: kernelnewbies On Tue, Oct 6, 2015 at 9:57 AM, Greg KH <greg@kroah.com> wrote: > On Tue, Oct 06, 2015 at 09:26:23AM -0400, Kenneth Adam Miller wrote: > > No, I didn't try it. I just wanted to ask before I got started. Thanks > that > > answers everything. > > > > Any body know about the issue of assigning a process a region of physical > > memory to use for it's malloc and free? I'd like to just have the > process call > > through to a UIO driver with an ioctl, and then once that's done it gets > all > > it's memory from a specific region. > > UIO drivers do not support ioctl, why would you need/want that? What's > wrong with just using the correct mmap/munmap logic that UIO userspace > drivers use today? > > Oops, well what I wrote is the result of me doing this for the first time. Let me respond to the previous email, and in the process of doing that, you'll see what my understanding is. I don't actually need ioctl specifically, I just need to be able to have the mmap userland call to resolve specifically to what this specific driver supports. > thanks, > > greg k-h > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20151006/3bef3fdf/attachment.html ^ permalink raw reply [flat|nested] 14+ messages in thread
* UIO Devices and user processes 2015-10-06 13:26 ` Kenneth Adam Miller 2015-10-06 13:57 ` Greg KH @ 2015-10-06 13:58 ` Yann Droneaud 2015-10-06 14:13 ` Kenneth Adam Miller 1 sibling, 1 reply; 14+ messages in thread From: Yann Droneaud @ 2015-10-06 13:58 UTC (permalink / raw) To: kernelnewbies Le mardi 06 octobre 2015 ? 09:26 -0400, Kenneth Adam Miller a ?crit : > Any body know about the issue of assigning a process a region of > physical memory to use for it's malloc and free? I'd like to just > have the process call through to a UIO driver with an ioctl, and then > once that's done it gets all it's memory from a specific region. > You mean CONFIG_UIO_DMEM_GENIRQ (drivers/uio/uio_dmem_genirq.c) See: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=0a0c3b5a24bd802b1ebbf99e0b01296647b8199b http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=b533a83008c3fb4983c1213276790cacd39b518f https://www.kernel.org/doc/htmldocs/uio-howto/using-uio_dmem_genirq.html PS: please don't top post reply as it makes it difficult to parse the discussion. > On Tue, Oct 6, 2015 at 1:21 AM, Greg KH <greg@kroah.com> wrote: > > On Mon, Oct 05, 2015 at 07:07:51PM -0400, Kenneth Adam Miller > > wrote: > > > So, I'm reading about UIO devices and user processes for mapping > > memory into > > > userland, and basically I have just a couple questions: > > > > > > What happens when a userland processes has allocated some > > resource from a > > > driver that is facilitating UIO, but then subsequently crashes? > > I'd like to > > > know that the driver can (or how you would enable such) recover > > the resources > > > so that the next user process can acquire them, instead of them > > being lost. > > > > Have you tried this? All of your resources should be freed > > properly, if > > not, let the uio maintainers know. > > > > thanks, > > Regards. -- Yann Droneaud OPTEYA ^ permalink raw reply [flat|nested] 14+ messages in thread
* UIO Devices and user processes 2015-10-06 13:58 ` Yann Droneaud @ 2015-10-06 14:13 ` Kenneth Adam Miller 2015-10-06 14:32 ` Yann Droneaud 0 siblings, 1 reply; 14+ messages in thread From: Kenneth Adam Miller @ 2015-10-06 14:13 UTC (permalink / raw) To: kernelnewbies On Tue, Oct 6, 2015 at 9:58 AM, Yann Droneaud <ydroneaud@opteya.com> wrote: > Le mardi 06 octobre 2015 ? 09:26 -0400, Kenneth Adam Miller a ?crit : > > > Any body know about the issue of assigning a process a region of > > physical memory to use for it's malloc and free? I'd like to just > > have the process call through to a UIO driver with an ioctl, and then > > once that's done it gets all it's memory from a specific region. > > > > You mean CONFIG_UIO_DMEM_GENIRQ (drivers/uio/uio_dmem_genirq.c) > > See: > > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=0a0c3b5a24bd802b1ebbf99e0b01296647b8199b > > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=b533a83008c3fb4983c1213276790cacd39b518f > https://www.kernel.org/doc/htmldocs/uio-howto/using-uio_dmem_genirq.html > > > 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: 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. 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. Is that wrong? Or is it that mmap already does the latter? > PS: please don't top post reply as it makes it difficult to parse the > discussion. > > > > On Tue, Oct 6, 2015 at 1:21 AM, Greg KH <greg@kroah.com> wrote: > > > On Mon, Oct 05, 2015 at 07:07:51PM -0400, Kenneth Adam Miller > > > wrote: > > > > So, I'm reading about UIO devices and user processes for mapping > > > memory into > > > > userland, and basically I have just a couple questions: > > > > > > > > What happens when a userland processes has allocated some > > > resource from a > > > > driver that is facilitating UIO, but then subsequently crashes? > > > I'd like to > > > > know that the driver can (or how you would enable such) recover > > > the resources > > > > so that the next user process can acquire them, instead of them > > > being lost. > > > > > > Have you tried this? All of your resources should be freed > > > properly, if > > > not, let the uio maintainers know. > > > > > > thanks, > > > > > Regards. > > -- > Yann Droneaud > OPTEYA > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20151006/7ea13123/attachment-0001.html ^ permalink raw reply [flat|nested] 14+ messages in thread
* UIO Devices and user processes 2015-10-06 14:13 ` Kenneth Adam Miller @ 2015-10-06 14:32 ` Yann Droneaud 2015-10-06 14:41 ` Kenneth Adam Miller 0 siblings, 1 reply; 14+ messages in thread From: Yann Droneaud @ 2015-10-06 14:32 UTC (permalink / raw) To: kernelnewbies Le mardi 06 octobre 2015 ? 10:13 -0400, Kenneth Adam Miller a ?crit : > > > On Tue, Oct 6, 2015 at 9:58 AM, Yann Droneaud <ydroneaud@opteya.com> > wrote: > > Le mardi 06 octobre 2015 ? 09:26 -0400, Kenneth Adam Miller a ?crit > > : > > > > > Any body know about the issue of assigning a process a region of > > > physical memory to use for it's malloc and free? I'd like to just > > > have the process call through to a UIO driver with an ioctl, and > > then > > > once that's done it gets all it's memory from a specific region. > > > > > > > You mean CONFIG_UIO_DMEM_GENIRQ (drivers/uio/uio_dmem_genirq.c) > > > > See: > > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/comm > > it/?id=0a0c3b5a24bd802b1ebbf99e0b01296647b8199b > > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/comm > > it/?id=b533a83008c3fb4983c1213276790cacd39b518f > > https://www.kernel.org/doc/htmldocs/uio-howto/using-uio_dmem_genirq > > .html > > > > > 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: > > 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. > You have to write your own custom allocator using the mmap()'ed memory your retrieved from UIO. > 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. > > Is that wrong? Or is it that mmap already does the latter? It's likely wrong. glibc's malloc() using brk() and mmap() to allocate anonymous pages. Tricking this implementation to use another mean to retrieve memory is left to the reader. Anyway, are you sure you want any random calls to malloc() (from glibc itself or any other linked-in libraries) to eat UIO allocated buffers ? I don't think so: such physically contiguous, cache coherent buffers are premium ressources, you don't want to distribute them gratuitously. Regards. -- Yann Droneaud OPTEYA ^ permalink raw reply [flat|nested] 14+ messages in thread
* UIO Devices and user processes 2015-10-06 14:32 ` Yann Droneaud @ 2015-10-06 14:41 ` Kenneth Adam Miller 2015-10-06 14:46 ` Kenneth Adam Miller 0 siblings, 1 reply; 14+ messages in thread From: Kenneth Adam Miller @ 2015-10-06 14:41 UTC (permalink / raw) To: kernelnewbies On Tue, Oct 6, 2015 at 10:32 AM, Yann Droneaud <ydroneaud@opteya.com> wrote: > Le mardi 06 octobre 2015 ? 10:13 -0400, Kenneth Adam Miller a ?crit : > > > > > > On Tue, Oct 6, 2015 at 9:58 AM, Yann Droneaud <ydroneaud@opteya.com> > > wrote: > > > Le mardi 06 octobre 2015 ? 09:26 -0400, Kenneth Adam Miller a ?crit > > > : > > > > > > > Any body know about the issue of assigning a process a region of > > > > physical memory to use for it's malloc and free? I'd like to just > > > > have the process call through to a UIO driver with an ioctl, and > > > then > > > > once that's done it gets all it's memory from a specific region. > > > > > > > > > > You mean CONFIG_UIO_DMEM_GENIRQ (drivers/uio/uio_dmem_genirq.c) > > > > > > See: > > > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/comm > > > it/?id=0a0c3b5a24bd802b1ebbf99e0b01296647b8199b > > > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/comm > > > it/?id=b533a83008c3fb4983c1213276790cacd39b518f > > > https://www.kernel.org/doc/htmldocs/uio-howto/using-uio_dmem_genirq > > > .html > > > > > > > > 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: > > > > 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. > > > > You have to write your own custom allocator using the mmap()'ed memory > your retrieved from UIO. > I know about C++'s placement new. But I'd prefer to not have to write my userland code in such a way-I want my userland code to remain agnostic of where it gets the memory from. I just want to put a small prologue in my main, and then have the rest of the program oblivious to the change. > > > 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. > > > > Is that wrong? Or is it that mmap already does the latter? > > It's likely wrong. glibc's malloc() using brk() and mmap() to allocate > anonymous pages. Tricking this implementation to use another mean to > retrieve memory is left to the reader. > > > Anyway, are you sure you want any random calls to malloc() (from glibc > itself or any other linked-in libraries) to eat UIO allocated buffers ? > I don't think so: such physically contiguous, cache coherent buffers > are premium ressources, you don't want to distribute them gratuitously. > > Yes - we have a hard limit on memory for our processes, and if they try to use more than what we mmap to them, they die, and we're more than fine with that. In fact, that's part of our use case and model, we've planned to allocate just 5 or so processes on our behemoth machine with gigabytes of memory. So they aren't so premium to us. > Regards. > > -- > Yann Droneaud > OPTEYA > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20151006/57133f44/attachment.html ^ permalink raw reply [flat|nested] 14+ messages in thread
* UIO Devices and user processes 2015-10-06 14:41 ` Kenneth Adam Miller @ 2015-10-06 14:46 ` Kenneth Adam Miller 2015-10-06 15:04 ` Yann Droneaud 2015-10-07 17:02 ` Greg KH 0 siblings, 2 replies; 14+ messages in thread From: Kenneth Adam Miller @ 2015-10-06 14:46 UTC (permalink / raw) To: kernelnewbies Let me be more precise in general to the overall original question: I want a userland process that I designate to only use a specific hard coded region physical of memory for it's heap. A UIO driver is the means by which I've gone about seeking to achieve this. On Tue, Oct 6, 2015 at 10:41 AM, Kenneth Adam Miller < kennethadammiller@gmail.com> wrote: > > On Tue, Oct 6, 2015 at 10:32 AM, Yann Droneaud <ydroneaud@opteya.com> > wrote: > >> Le mardi 06 octobre 2015 ? 10:13 -0400, Kenneth Adam Miller a ?crit : >> > >> > >> > On Tue, Oct 6, 2015 at 9:58 AM, Yann Droneaud <ydroneaud@opteya.com> >> > wrote: >> > > Le mardi 06 octobre 2015 ? 09:26 -0400, Kenneth Adam Miller a ?crit >> > > : >> > > >> > > > Any body know about the issue of assigning a process a region of >> > > > physical memory to use for it's malloc and free? I'd like to just >> > > > have the process call through to a UIO driver with an ioctl, and >> > > then >> > > > once that's done it gets all it's memory from a specific region. >> > > > >> > > >> > > You mean CONFIG_UIO_DMEM_GENIRQ (drivers/uio/uio_dmem_genirq.c) >> > > >> > > See: >> > > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/comm >> > > it/?id=0a0c3b5a24bd802b1ebbf99e0b01296647b8199b >> > > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/comm >> > > it/?id=b533a83008c3fb4983c1213276790cacd39b518f >> > > https://www.kernel.org/doc/htmldocs/uio-howto/using-uio_dmem_genirq >> > > .html >> > > >> > > >> > 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: >> > >> > 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. >> > >> >> You have to write your own custom allocator using the mmap()'ed memory >> your retrieved from UIO. >> > > I know about C++'s placement new. But I'd prefer to not have to write my > userland code in such a way-I want my userland code to remain agnostic of > where it gets the memory from. I just want to put a small prologue in my > main, and then have the rest of the program oblivious to the change. > > >> >> > 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. >> > >> > Is that wrong? Or is it that mmap already does the latter? >> >> It's likely wrong. glibc's malloc() using brk() and mmap() to allocate >> anonymous pages. Tricking this implementation to use another mean to >> retrieve memory is left to the reader. >> >> > > > >> Anyway, are you sure you want any random calls to malloc() (from glibc >> itself or any other linked-in libraries) to eat UIO allocated buffers ? >> I don't think so: such physically contiguous, cache coherent buffers >> are premium ressources, you don't want to distribute them gratuitously. >> >> > Yes - we have a hard limit on memory for our processes, and if they try to > use more than what we mmap to them, they die, and we're more than fine with > that. In fact, that's part of our use case and model, we've planned to > allocate just 5 or so processes on our behemoth machine with gigabytes of > memory. So they aren't so premium to us. > > >> Regards. >> >> -- >> Yann Droneaud >> OPTEYA >> >> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20151006/dc0d7c73/attachment.html ^ permalink raw reply [flat|nested] 14+ messages in thread
* UIO Devices and user processes 2015-10-06 14:46 ` Kenneth Adam Miller @ 2015-10-06 15:04 ` Yann Droneaud 2015-10-06 15:10 ` Kenneth Adam Miller 2015-10-07 17:02 ` Greg KH 1 sibling, 1 reply; 14+ messages in thread From: Yann Droneaud @ 2015-10-06 15:04 UTC (permalink / raw) To: kernelnewbies Hi, Le mardi 06 octobre 2015 ? 10:46 -0400, Kenneth Adam Miller a ?crit : > Let me be more precise in general to the overall original question: > > I want a userland process that I designate to only use a specific > hard coded region physical of memory for it's heap. A UIO driver is > the means by which I've gone about seeking to achieve this. > You want brk() and mmap(..., MAP_ANONYMOUS, ...) to allocate pages from a contigous physical memory region. You don't give the reason for such requirement. Without a proper reason it's difficult to understand what's your trying to achieve. I can only propose you to use something like CONFIG_MMU=n, but as it's a system wide choice with multiple drawbacks, I don't think it's something you want to investigate into. Regards. -- Yann Droneaud OPTEYA ^ permalink raw reply [flat|nested] 14+ messages in thread
* UIO Devices and user processes 2015-10-06 15:04 ` Yann Droneaud @ 2015-10-06 15:10 ` Kenneth Adam Miller 0 siblings, 0 replies; 14+ messages in thread From: Kenneth Adam Miller @ 2015-10-06 15:10 UTC (permalink / raw) To: kernelnewbies On Tue, Oct 6, 2015 at 11:04 AM, Yann Droneaud <ydroneaud@opteya.com> wrote: > Hi, > > Le mardi 06 octobre 2015 ? 10:46 -0400, Kenneth Adam Miller a ?crit : > > Let me be more precise in general to the overall original question: > > > > I want a userland process that I designate to only use a specific > > hard coded region physical of memory for it's heap. A UIO driver is > > the means by which I've gone about seeking to achieve this. > > > > You want brk() and mmap(..., MAP_ANONYMOUS, ...) to allocate pages > from a contigous physical memory region. > > You don't give the reason for such requirement. Without a proper reason > it's difficult to understand what's your trying to achieve. > > I can only propose you to use something like CONFIG_MMU=n, but as it's > a system wide choice with multiple drawbacks, I don't think it's > something you want to investigate into. > > At our workplace, we are using separation kernel and software fault isolation technologies to trap process capabilities down to specific limitations. With these technologies, we can basically trigger the failure of a process if it tries to violate the sandbox. A process subverting the kernel doesn't make a difference because our enforcement mechanisms preside beneath even that. I can't say much else about why, but using a UIO approach is very attractive to us because we can then develop our IRM in userland, and have actual writes and operations mapped to the address they need to be. Right now that is not the case for our legacy software. > Regards. > > -- > Yann Droneaud > OPTEYA > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20151006/95fb0b3c/attachment.html ^ permalink raw reply [flat|nested] 14+ messages in thread
* UIO Devices and user processes 2015-10-06 14:46 ` Kenneth Adam Miller 2015-10-06 15:04 ` Yann Droneaud @ 2015-10-07 17:02 ` Greg KH 2015-10-07 18:10 ` Kenneth Adam Miller 1 sibling, 1 reply; 14+ messages in thread From: Greg KH @ 2015-10-07 17:02 UTC (permalink / raw) To: kernelnewbies On Tue, Oct 06, 2015 at 10:46:49AM -0400, Kenneth Adam Miller wrote: > Let me be more precise in general to the overall original question: > > I want a userland process that I designate to only use a specific hard coded > region physical of memory for it's heap. A UIO driver is the means by which > I've gone about seeking to achieve this.? Use LD_PRELOAD to hook into your custom library that handles the allocation to this special portion of memory that you grabbed from the hardware using the UIO kernel interface instead of the "normal" libc allocator, and you will be fine. But you will have to write a custom allocator, there's no other way around that. The kernel gives you the ability to do this today, no kernel changes needed, it's all "just" userspace code you will have to do on your own. Best of luck, that's going to be some "fun" work :) greg k-h ^ permalink raw reply [flat|nested] 14+ messages in thread
* UIO Devices and user processes 2015-10-07 17:02 ` Greg KH @ 2015-10-07 18:10 ` Kenneth Adam Miller 0 siblings, 0 replies; 14+ messages in thread From: Kenneth Adam Miller @ 2015-10-07 18:10 UTC (permalink / raw) To: kernelnewbies Well I don't think I'll have to write a custom allocator. Existing allocators allow you to have placement allocation, or rather more precisely, manage sub-buffers within a static buffer. By this I mean that the sub buffer is treated as though it were an existing slab given to the process by the OS, but instead of actually servicing it with new and free, you place a table in it that acts just like the table that libc manages and coalesces during regular management with typical use. In any case, I think I don't have to do this because it's just a regular consumer producer issue, and I can use ring buffers for that. On Wed, Oct 7, 2015 at 1:02 PM, Greg KH <greg@kroah.com> wrote: > On Tue, Oct 06, 2015 at 10:46:49AM -0400, Kenneth Adam Miller wrote: > > Let me be more precise in general to the overall original question: > > > > I want a userland process that I designate to only use a specific hard > coded > > region physical of memory for it's heap. A UIO driver is the means by > which > > I've gone about seeking to achieve this. > > Use LD_PRELOAD to hook into your custom library that handles the > allocation to this special portion of memory that you grabbed from the > hardware using the UIO kernel interface instead of the "normal" libc > allocator, and you will be fine. But you will have to write a custom > allocator, there's no other way around that. > > The kernel gives you the ability to do this today, no kernel changes > needed, it's all "just" userspace code you will have to do on your own. > > Best of luck, that's going to be some "fun" work :) > > greg k-h > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20151007/953b323e/attachment.html ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2015-10-07 18:10 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-10-05 23:07 UIO Devices and user processes Kenneth Adam Miller 2015-10-06 5:21 ` Greg KH 2015-10-06 13:26 ` Kenneth Adam Miller 2015-10-06 13:57 ` Greg KH 2015-10-06 14:03 ` Kenneth Adam Miller 2015-10-06 13:58 ` Yann Droneaud 2015-10-06 14:13 ` Kenneth Adam Miller 2015-10-06 14:32 ` Yann Droneaud 2015-10-06 14:41 ` Kenneth Adam Miller 2015-10-06 14:46 ` Kenneth Adam Miller 2015-10-06 15:04 ` Yann Droneaud 2015-10-06 15:10 ` Kenneth Adam Miller 2015-10-07 17:02 ` Greg KH 2015-10-07 18:10 ` Kenneth Adam Miller
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).