[uml-user] UML <-> host communication

2015-10-12 Thread Ricardo Nunes
Hi. I'm trying to create a 2 way communication channel between a kernel
driver in UML with a process at the host.

What's the best way to do it? I started by trying to create a pipe ath the
host, share in hostfs but I can't get any communication (write on pipe in
UML, nothing appears in host).

Plus, I'm using os_open_file kind of functions (shared/os.h) but it always
return me error -2 (bad file path). I thought that it could be because the
kernel module was loaded before the hostfs is mounted but the same error
happens if I insmod it after boot.

What are the alternatives here? I wanted a low latency type of
communication, minimum overhead since it will be a lot of communications os
5-10 bytes each time.

Thanks
--
___
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user


Re: [uml-user] UML <-> host communication

2015-10-12 Thread Balaco Baco
Interesting idea! :)

But why not using "real" network connections? If you keep a connection
open, you will have no "big" overhead besides openning it the first time
(or reopenning, if eventually needed). You will be able to choose the
format of each message contents, as desired. And the communication can
be redirected to whatever you need, both in the UML or the host system.

You wrote about low latency, but gave no estimatives you expect. What
would be it? And what have you discarded using with this constraint?

-- 
  Balaco



On Mon, Oct 12, 2015, at 11:46, Ricardo Nunes wrote:
> Hi. I'm trying to create a 2 way communication channel between a kernel
> driver in UML with a process at the host.
> 
> What's the best way to do it? I started by trying to create a pipe ath
> the
> host, share in hostfs but I can't get any communication (write on pipe in
> UML, nothing appears in host).
> 
> Plus, I'm using os_open_file kind of functions (shared/os.h) but it
> always
> return me error -2 (bad file path). I thought that it could be because
> the
> kernel module was loaded before the hostfs is mounted but the same error
> happens if I insmod it after boot.
> 
> What are the alternatives here? I wanted a low latency type of
> communication, minimum overhead since it will be a lot of communications
> os
> 5-10 bytes each time.
> 
> Thanks
> --
> ___
> User-mode-linux-user mailing list
> User-mode-linux-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

-- 
http://www.fastmail.com - Accessible with your email software
  or over the web


--
___
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user


Re: [uml-user] UML <-> host communication

2015-10-12 Thread Ricardo Nunes
Right now I'm just finding for a way to make it work, so slow
communications will also be acceptable for now. This is for device
emulation, so a lot of memory reads and writes. Better slower then non
existent.

If I use a tuntap, a socket or something like that, what API can I use to
communicate straight from the kernel to the host?

I just tried to implement netpoll sockets
, but it doesn't seem to be
supported inside UML.

2015-10-12 16:50 GMT+01:00 Balaco Baco :

> Interesting idea! :)
>
> But why not using "real" network connections? If you keep a connection
> open, you will have no "big" overhead besides openning it the first time
> (or reopenning, if eventually needed). You will be able to choose the
> format of each message contents, as desired. And the communication can
> be redirected to whatever you need, both in the UML or the host system.
>
> You wrote about low latency, but gave no estimatives you expect. What
> would be it? And what have you discarded using with this constraint?
>
> --
>   Balaco
>
>
>
> On Mon, Oct 12, 2015, at 11:46, Ricardo Nunes wrote:
> > Hi. I'm trying to create a 2 way communication channel between a kernel
> > driver in UML with a process at the host.
> >
> > What's the best way to do it? I started by trying to create a pipe ath
> > the
> > host, share in hostfs but I can't get any communication (write on pipe in
> > UML, nothing appears in host).
> >
> > Plus, I'm using os_open_file kind of functions (shared/os.h) but it
> > always
> > return me error -2 (bad file path). I thought that it could be because
> > the
> > kernel module was loaded before the hostfs is mounted but the same error
> > happens if I insmod it after boot.
> >
> > What are the alternatives here? I wanted a low latency type of
> > communication, minimum overhead since it will be a lot of communications
> > os
> > 5-10 bytes each time.
> >
> > Thanks
> >
> --
> > ___
> > User-mode-linux-user mailing list
> > User-mode-linux-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user
>
> --
> http://www.fastmail.com - Accessible with your email software
>   or over the web
>
>
>
> --
> ___
> User-mode-linux-user mailing list
> User-mode-linux-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user
>
--
___
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user


Re: [uml-user] UML <-> host communication

2015-10-12 Thread Richard Weinberger
On Mon, Oct 12, 2015 at 6:21 PM, Ricardo Nunes
 wrote:
> Right now I'm just finding for a way to make it work, so slow communications
> will also be acceptable for now. This is for device emulation, so a lot of
> memory reads and writes. Better slower then non existent.
>
> If I use a tuntap, a socket or something like that, what API can I use to
> communicate straight from the kernel to the host?
>
> I just tried to implement netpoll sockets, but it doesn't seem to be
> supported inside UML.

What is missing?

Anyway, you can create a debugfs file within UML which opens a fd on
the host side and wrapps
this fd into a file visible to UML guest processes.

-- 
Thanks,
//richard

--
___
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user