All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] runqemu: add user mode (SLIRP) support to x86 QEMU targets
@ 2016-10-26 17:05 Todor Minchev
  2016-11-24 10:29 ` Robert Yang
  0 siblings, 1 reply; 8+ messages in thread
From: Todor Minchev @ 2016-10-26 17:05 UTC (permalink / raw)
  To: openembedded-core

Using 'slirp' as a command line option to runqemu will start QEMU
with user mode networking instead of creating tun/tap devices.
SLIRP does not require root access. By default port 2222 on the
host will be mapped to port 22 in the guest. The default port
mapping can be overwritten with the QB_SLIRP_OPT variable e.g.

QB_SLIRP_OPT = "-net nic,model=e1000 -net user,hostfwd=tcp::2222-:22"

Signed-off-by: Todor Minchev <todor.minchev@linux.intel.com>
---
 meta/conf/machine/include/qemuboot-x86.inc | 1 +
 scripts/runqemu                            | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/conf/machine/include/qemuboot-x86.inc b/meta/conf/machine/include/qemuboot-x86.inc
index 06ac983..0870294 100644
--- a/meta/conf/machine/include/qemuboot-x86.inc
+++ b/meta/conf/machine/include/qemuboot-x86.inc
@@ -13,3 +13,4 @@ QB_AUDIO_OPT = "-soundhw ac97,es1370"
 QB_KERNEL_CMDLINE_APPEND = "vga=0 uvesafb.mode_option=640x480-32 oprofile.timer=1 uvesafb.task_timeout=-1"
 # Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy
 QB_OPT_APPEND = "-vga vmware -show-cursor -usb -usbdevice tablet -device virtio-rng-pci"
+QB_SLIRP_OPT = "-net nic,model=e1000 -net user,hostfwd=tcp::2222-:22"
diff --git a/scripts/runqemu b/scripts/runqemu
index dbe17ab..6952f32 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -542,7 +542,8 @@ class BaseConfig(object):
     def check_and_set(self):
         """Check configs sanity and set when needed"""
         self.validate_paths()
-        check_tun()
+        if not self.slirp_enabled:
+            check_tun()
         # Check audio
         if self.audio_enabled:
             if not self.get('QB_AUDIO_DRV'):
-- 
2.10.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] runqemu: add user mode (SLIRP) support to x86 QEMU targets
  2016-10-26 17:05 [PATCH 1/1] runqemu: add user mode (SLIRP) support to x86 QEMU targets Todor Minchev
@ 2016-11-24 10:29 ` Robert Yang
  0 siblings, 0 replies; 8+ messages in thread
From: Robert Yang @ 2016-11-24 10:29 UTC (permalink / raw)
  To: Todor Minchev, openembedded-core


Hi Todor,

On 10/27/2016 01:05 AM, Todor Minchev wrote:
> Using 'slirp' as a command line option to runqemu will start QEMU
> with user mode networking instead of creating tun/tap devices.
> SLIRP does not require root access. By default port 2222 on the
> host will be mapped to port 22 in the guest. The default port
> mapping can be overwritten with the QB_SLIRP_OPT variable e.g.
>
> QB_SLIRP_OPT = "-net nic,model=e1000 -net user,hostfwd=tcp::2222-:22"
>
> Signed-off-by: Todor Minchev <todor.minchev@linux.intel.com>
> ---
>  meta/conf/machine/include/qemuboot-x86.inc | 1 +
>  scripts/runqemu                            | 3 ++-
>  2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/meta/conf/machine/include/qemuboot-x86.inc b/meta/conf/machine/include/qemuboot-x86.inc
> index 06ac983..0870294 100644
> --- a/meta/conf/machine/include/qemuboot-x86.inc
> +++ b/meta/conf/machine/include/qemuboot-x86.inc
> @@ -13,3 +13,4 @@ QB_AUDIO_OPT = "-soundhw ac97,es1370"
>  QB_KERNEL_CMDLINE_APPEND = "vga=0 uvesafb.mode_option=640x480-32 oprofile.timer=1 uvesafb.task_timeout=-1"
>  # Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy
>  QB_OPT_APPEND = "-vga vmware -show-cursor -usb -usbdevice tablet -device virtio-rng-pci"
> +QB_SLIRP_OPT = "-net nic,model=e1000 -net user,hostfwd=tcp::2222-:22"

It will causes errors when multiple qemus are running:

qemu-system-x86_64: -net user,hostfwd=tcp::2222-:22: could not set up host 
forwarding rule 'tcp::2222-:22'
qemu-system-x86_64: -net user,hostfwd=tcp::2222-:22: Device 'user' could not be 
initialized

This because the port are used by another qemu. I will move these
code into runqemu, and check whether the port is available, add 1 if not
until find a usable port. Default to forward 22, and user can add other
ports.

// Robert

> diff --git a/scripts/runqemu b/scripts/runqemu
> index dbe17ab..6952f32 100755
> --- a/scripts/runqemu
> +++ b/scripts/runqemu
> @@ -542,7 +542,8 @@ class BaseConfig(object):
>      def check_and_set(self):
>          """Check configs sanity and set when needed"""
>          self.validate_paths()
> -        check_tun()
> +        if not self.slirp_enabled:
> +            check_tun()
>          # Check audio
>          if self.audio_enabled:
>              if not self.get('QB_AUDIO_DRV'):
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] runqemu: add user mode (SLIRP) support to x86 QEMU targets
  2016-10-25 17:49       ` Brian Avery
@ 2016-10-25 18:09         ` Mark Hatle
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Hatle @ 2016-10-25 18:09 UTC (permalink / raw)
  To: Brian Avery; +Cc: yocto, Todor Minchev

On 10/25/16 12:49 PM, Brian Avery wrote:
> Hi, 
> 
> This doesn't default to slirp, it just allows it as an option.

Ok..  I misunderstood what it was trying to do then.  That sounds fine.

> In particular, on CROPS containers on Windows 10 and Mac OSX  the hypervisor is
> *not* a linux kernel. This means that the only way we can run qemu in the
> container for testing/debugging is to run it in slirp mode .since there is no
> tun/tap device or driver.
> 
> So, given that we 
> 1) are not defaulting to slirp and are merely enabling it
> 2) need slirp mode to be able to run in a CROPS container setting
> 
> I think this makes sense.

Agreed.

> -Brian
> an intel employee
>  
> 
> On Mon, Oct 24, 2016 at 5:16 PM, Mark Hatle <mark.hatle@windriver.com
> <mailto:mark.hatle@windriver.com>> wrote:
> 
>     On 10/24/16 6:46 PM, Todor Minchev wrote:
>     > On Mon, 2016-10-24 at 18:15 -0500, Mark Hatle wrote:
>     >> On 10/24/16 5:19 PM, Todor Minchev wrote:
>     >>> Using 'slirp' as a command line option to runqemu will start QEMU
>     >>> with user mode networking instead of creating tun/tap devices.
>     >>> SLIRP does not require root access. By default port 2222 on the
>     >>> host will be mapped to port 22 in the guest. The default port
>     >>> mapping can be overwritten with the QB_SLIRP_OPT variable e.g.
>     >>>
>     >>> QB_SLIRP_OPT = "-net nic,model=e1000 -net user,hostfwd=tcp::2222-:22"
>     >>
>     >> In the past patches like this have been rejected for performance and other
>     >> reasons.
>     >
>     > Performance is not ideal with SLIRP, but should be sufficient for basic
>     > ssh access to the guest. Could you please elaborate on the other reasons
>     > why having this is a bad idea?
> 
>     You'd have to go back in the archives.  Performance was the main reason I
>     remember being discussed at the time.
> 
>     I don't remember the others, and as I said, I'm not a fan of requiring root, but
>     the community decided sudo approach was better as long as there was a way to
>     avoid it.
> 
>     Changing the default will likely require email to the oe-core list and/or
>     oe-architecture list...
> 
>     >> While I don't particularly like requiring sudo access for runqemu,
>     >> adding the 'slirp' option will allow someone w/o root/sudo to be able to run it.
>     >
>     > The goal was to be able to run a QEMU image and provide basic networking
>     > without requiring root access. Is there any reason why running runqemu
>     > w/o root/sudo access should be discouraged?
> 
>     As long as you can pass in slirp (and it's not the default) then I believe your
>     requirement and the community direction is preserved.
> 
>     >> Otherwise, if there is something you can do to make slirp work better (when
>     >> enabled), that is more likely to be accepted.
>     >
>     > Similar SLIRP support has been already accepted for qemuarm64 with
>     > commit 9b0a94cb
> 
>     Support for slirp is good, it's defaulting to slirp that has been rejected in
>     the past by the community.
> 
>     > --Todor
>     >
>     > Intel Open Source Technology Center
>     >
>     >> --Mark
>     >>
>     >>> Signed-off-by: Todor Minchev <todor.minchev@linux.intel.com
>     <mailto:todor.minchev@linux.intel.com>>
>     >>> ---
>     >>>  meta/conf/machine/include/qemuboot-x86.inc | 1 +
>     >>>  scripts/runqemu                            | 3 ++-
>     >>>  2 files changed, 3 insertions(+), 1 deletion(-)
>     >>>
>     >>> diff --git a/meta/conf/machine/include/qemuboot-x86.inc
>     b/meta/conf/machine/include/qemuboot-x86.inc
>     >>> index 06ac983..0870294 100644
>     >>> --- a/meta/conf/machine/include/qemuboot-x86.inc
>     >>> +++ b/meta/conf/machine/include/qemuboot-x86.inc
>     >>> @@ -13,3 +13,4 @@ QB_AUDIO_OPT = "-soundhw ac97,es1370"
>     >>>  QB_KERNEL_CMDLINE_APPEND = "vga=0 uvesafb.mode_option=640x480-32
>     oprofile.timer=1 uvesafb.task_timeout=-1"
>     >>>  # Add the 'virtio-rng-pci' device otherwise the guest may run out of
>     entropy
>     >>>  QB_OPT_APPEND = "-vga vmware -show-cursor -usb -usbdevice tablet
>     -device virtio-rng-pci"
>     >>> +QB_SLIRP_OPT = "-net nic,model=e1000 -net user,hostfwd=tcp::2222-:22"
>     >>> diff --git a/scripts/runqemu b/scripts/runqemu
>     >>> index dbe17ab..6952f32 100755
>     >>> --- a/scripts/runqemu
>     >>> +++ b/scripts/runqemu
>     >>> @@ -542,7 +542,8 @@ class BaseConfig(object):
>     >>>      def check_and_set(self):
>     >>>          """Check configs sanity and set when needed"""
>     >>>          self.validate_paths()
>     >>> -        check_tun()
>     >>> +        if not self.slirp_enabled:
>     >>> +            check_tun()
>     >>>          # Check audio
>     >>>          if self.audio_enabled:
>     >>>              if not self.get('QB_AUDIO_DRV'):
>     >>>
>     >>
>     >
>     >
> 
>     --
>     _______________________________________________
>     yocto mailing list
>     yocto@yoctoproject.org <mailto:yocto@yoctoproject.org>
>     https://lists.yoctoproject.org/listinfo/yocto
>     <https://lists.yoctoproject.org/listinfo/yocto>
> 
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] runqemu: add user mode (SLIRP) support to x86 QEMU targets
  2016-10-25  0:16     ` Mark Hatle
@ 2016-10-25 17:49       ` Brian Avery
  2016-10-25 18:09         ` Mark Hatle
  0 siblings, 1 reply; 8+ messages in thread
From: Brian Avery @ 2016-10-25 17:49 UTC (permalink / raw)
  To: Mark Hatle; +Cc: yocto, Todor Minchev

[-- Attachment #1: Type: text/plain, Size: 4603 bytes --]

Hi,

This doesn't default to slirp, it just allows it as an option.

In particular, on CROPS containers on Windows 10 and Mac OSX  the
hypervisor is *not* a linux kernel. This means that the only way we can run
qemu in the container for testing/debugging is to run it in slirp mode
.since there is no tun/tap device or driver.

So, given that we
1) are not defaulting to slirp and are merely enabling it
2) need slirp mode to be able to run in a CROPS container setting

I think this makes sense.

-Brian
an intel employee


On Mon, Oct 24, 2016 at 5:16 PM, Mark Hatle <mark.hatle@windriver.com>
wrote:

> On 10/24/16 6:46 PM, Todor Minchev wrote:
> > On Mon, 2016-10-24 at 18:15 -0500, Mark Hatle wrote:
> >> On 10/24/16 5:19 PM, Todor Minchev wrote:
> >>> Using 'slirp' as a command line option to runqemu will start QEMU
> >>> with user mode networking instead of creating tun/tap devices.
> >>> SLIRP does not require root access. By default port 2222 on the
> >>> host will be mapped to port 22 in the guest. The default port
> >>> mapping can be overwritten with the QB_SLIRP_OPT variable e.g.
> >>>
> >>> QB_SLIRP_OPT = "-net nic,model=e1000 -net user,hostfwd=tcp::2222-:22"
> >>
> >> In the past patches like this have been rejected for performance and
> other
> >> reasons.
> >
> > Performance is not ideal with SLIRP, but should be sufficient for basic
> > ssh access to the guest. Could you please elaborate on the other reasons
> > why having this is a bad idea?
>
> You'd have to go back in the archives.  Performance was the main reason I
> remember being discussed at the time.
>
> I don't remember the others, and as I said, I'm not a fan of requiring
> root, but
> the community decided sudo approach was better as long as there was a way
> to
> avoid it.
>
> Changing the default will likely require email to the oe-core list and/or
> oe-architecture list...
>
> >> While I don't particularly like requiring sudo access for runqemu,
> >> adding the 'slirp' option will allow someone w/o root/sudo to be able
> to run it.
> >
> > The goal was to be able to run a QEMU image and provide basic networking
> > without requiring root access. Is there any reason why running runqemu
> > w/o root/sudo access should be discouraged?
>
> As long as you can pass in slirp (and it's not the default) then I believe
> your
> requirement and the community direction is preserved.
>
> >> Otherwise, if there is something you can do to make slirp work better
> (when
> >> enabled), that is more likely to be accepted.
> >
> > Similar SLIRP support has been already accepted for qemuarm64 with
> > commit 9b0a94cb
>
> Support for slirp is good, it's defaulting to slirp that has been rejected
> in
> the past by the community.
>
> > --Todor
> >
> > Intel Open Source Technology Center
> >
> >> --Mark
> >>
> >>> Signed-off-by: Todor Minchev <todor.minchev@linux.intel.com>
> >>> ---
> >>>  meta/conf/machine/include/qemuboot-x86.inc | 1 +
> >>>  scripts/runqemu                            | 3 ++-
> >>>  2 files changed, 3 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/meta/conf/machine/include/qemuboot-x86.inc
> b/meta/conf/machine/include/qemuboot-x86.inc
> >>> index 06ac983..0870294 100644
> >>> --- a/meta/conf/machine/include/qemuboot-x86.inc
> >>> +++ b/meta/conf/machine/include/qemuboot-x86.inc
> >>> @@ -13,3 +13,4 @@ QB_AUDIO_OPT = "-soundhw ac97,es1370"
> >>>  QB_KERNEL_CMDLINE_APPEND = "vga=0 uvesafb.mode_option=640x480-32
> oprofile.timer=1 uvesafb.task_timeout=-1"
> >>>  # Add the 'virtio-rng-pci' device otherwise the guest may run out of
> entropy
> >>>  QB_OPT_APPEND = "-vga vmware -show-cursor -usb -usbdevice tablet
> -device virtio-rng-pci"
> >>> +QB_SLIRP_OPT = "-net nic,model=e1000 -net user,hostfwd=tcp::2222-:22"
> >>> diff --git a/scripts/runqemu b/scripts/runqemu
> >>> index dbe17ab..6952f32 100755
> >>> --- a/scripts/runqemu
> >>> +++ b/scripts/runqemu
> >>> @@ -542,7 +542,8 @@ class BaseConfig(object):
> >>>      def check_and_set(self):
> >>>          """Check configs sanity and set when needed"""
> >>>          self.validate_paths()
> >>> -        check_tun()
> >>> +        if not self.slirp_enabled:
> >>> +            check_tun()
> >>>          # Check audio
> >>>          if self.audio_enabled:
> >>>              if not self.get('QB_AUDIO_DRV'):
> >>>
> >>
> >
> >
>
> --
> _______________________________________________
> yocto mailing list
> yocto@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
>

[-- Attachment #2: Type: text/html, Size: 6210 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] runqemu: add user mode (SLIRP) support to x86 QEMU targets
  2016-10-24 23:46   ` Todor Minchev
@ 2016-10-25  0:16     ` Mark Hatle
  2016-10-25 17:49       ` Brian Avery
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Hatle @ 2016-10-25  0:16 UTC (permalink / raw)
  To: Todor Minchev; +Cc: yocto

On 10/24/16 6:46 PM, Todor Minchev wrote:
> On Mon, 2016-10-24 at 18:15 -0500, Mark Hatle wrote:
>> On 10/24/16 5:19 PM, Todor Minchev wrote:
>>> Using 'slirp' as a command line option to runqemu will start QEMU
>>> with user mode networking instead of creating tun/tap devices.
>>> SLIRP does not require root access. By default port 2222 on the
>>> host will be mapped to port 22 in the guest. The default port
>>> mapping can be overwritten with the QB_SLIRP_OPT variable e.g.
>>>
>>> QB_SLIRP_OPT = "-net nic,model=e1000 -net user,hostfwd=tcp::2222-:22"
>>
>> In the past patches like this have been rejected for performance and other
>> reasons.  
> 
> Performance is not ideal with SLIRP, but should be sufficient for basic
> ssh access to the guest. Could you please elaborate on the other reasons
> why having this is a bad idea?

You'd have to go back in the archives.  Performance was the main reason I
remember being discussed at the time.

I don't remember the others, and as I said, I'm not a fan of requiring root, but
the community decided sudo approach was better as long as there was a way to
avoid it.

Changing the default will likely require email to the oe-core list and/or
oe-architecture list...

>> While I don't particularly like requiring sudo access for runqemu,
>> adding the 'slirp' option will allow someone w/o root/sudo to be able to run it.
> 
> The goal was to be able to run a QEMU image and provide basic networking
> without requiring root access. Is there any reason why running runqemu
> w/o root/sudo access should be discouraged?   

As long as you can pass in slirp (and it's not the default) then I believe your
requirement and the community direction is preserved.

>> Otherwise, if there is something you can do to make slirp work better (when
>> enabled), that is more likely to be accepted.
> 
> Similar SLIRP support has been already accepted for qemuarm64 with
> commit 9b0a94cb

Support for slirp is good, it's defaulting to slirp that has been rejected in
the past by the community.

> --Todor
> 
> Intel Open Source Technology Center
> 
>> --Mark
>>
>>> Signed-off-by: Todor Minchev <todor.minchev@linux.intel.com>
>>> ---
>>>  meta/conf/machine/include/qemuboot-x86.inc | 1 +
>>>  scripts/runqemu                            | 3 ++-
>>>  2 files changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/meta/conf/machine/include/qemuboot-x86.inc b/meta/conf/machine/include/qemuboot-x86.inc
>>> index 06ac983..0870294 100644
>>> --- a/meta/conf/machine/include/qemuboot-x86.inc
>>> +++ b/meta/conf/machine/include/qemuboot-x86.inc
>>> @@ -13,3 +13,4 @@ QB_AUDIO_OPT = "-soundhw ac97,es1370"
>>>  QB_KERNEL_CMDLINE_APPEND = "vga=0 uvesafb.mode_option=640x480-32 oprofile.timer=1 uvesafb.task_timeout=-1"
>>>  # Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy
>>>  QB_OPT_APPEND = "-vga vmware -show-cursor -usb -usbdevice tablet -device virtio-rng-pci"
>>> +QB_SLIRP_OPT = "-net nic,model=e1000 -net user,hostfwd=tcp::2222-:22"
>>> diff --git a/scripts/runqemu b/scripts/runqemu
>>> index dbe17ab..6952f32 100755
>>> --- a/scripts/runqemu
>>> +++ b/scripts/runqemu
>>> @@ -542,7 +542,8 @@ class BaseConfig(object):
>>>      def check_and_set(self):
>>>          """Check configs sanity and set when needed"""
>>>          self.validate_paths()
>>> -        check_tun()
>>> +        if not self.slirp_enabled:
>>> +            check_tun()
>>>          # Check audio
>>>          if self.audio_enabled:
>>>              if not self.get('QB_AUDIO_DRV'):
>>>
>>
> 
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] runqemu: add user mode (SLIRP) support to x86 QEMU targets
  2016-10-24 23:15 ` Mark Hatle
@ 2016-10-24 23:46   ` Todor Minchev
  2016-10-25  0:16     ` Mark Hatle
  0 siblings, 1 reply; 8+ messages in thread
From: Todor Minchev @ 2016-10-24 23:46 UTC (permalink / raw)
  To: Mark Hatle; +Cc: yocto

On Mon, 2016-10-24 at 18:15 -0500, Mark Hatle wrote:
> On 10/24/16 5:19 PM, Todor Minchev wrote:
> > Using 'slirp' as a command line option to runqemu will start QEMU
> > with user mode networking instead of creating tun/tap devices.
> > SLIRP does not require root access. By default port 2222 on the
> > host will be mapped to port 22 in the guest. The default port
> > mapping can be overwritten with the QB_SLIRP_OPT variable e.g.
> > 
> > QB_SLIRP_OPT = "-net nic,model=e1000 -net user,hostfwd=tcp::2222-:22"
> 
> In the past patches like this have been rejected for performance and other
> reasons.  

Performance is not ideal with SLIRP, but should be sufficient for basic
ssh access to the guest. Could you please elaborate on the other reasons
why having this is a bad idea?

> While I don't particularly like requiring sudo access for runqemu,
> adding the 'slirp' option will allow someone w/o root/sudo to be able to run it.

The goal was to be able to run a QEMU image and provide basic networking
without requiring root access. Is there any reason why running runqemu
w/o root/sudo access should be discouraged?   

> Otherwise, if there is something you can do to make slirp work better (when
> enabled), that is more likely to be accepted.

Similar SLIRP support has been already accepted for qemuarm64 with
commit 9b0a94cb

--Todor

Intel Open Source Technology Center

> --Mark
> 
> > Signed-off-by: Todor Minchev <todor.minchev@linux.intel.com>
> > ---
> >  meta/conf/machine/include/qemuboot-x86.inc | 1 +
> >  scripts/runqemu                            | 3 ++-
> >  2 files changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/meta/conf/machine/include/qemuboot-x86.inc b/meta/conf/machine/include/qemuboot-x86.inc
> > index 06ac983..0870294 100644
> > --- a/meta/conf/machine/include/qemuboot-x86.inc
> > +++ b/meta/conf/machine/include/qemuboot-x86.inc
> > @@ -13,3 +13,4 @@ QB_AUDIO_OPT = "-soundhw ac97,es1370"
> >  QB_KERNEL_CMDLINE_APPEND = "vga=0 uvesafb.mode_option=640x480-32 oprofile.timer=1 uvesafb.task_timeout=-1"
> >  # Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy
> >  QB_OPT_APPEND = "-vga vmware -show-cursor -usb -usbdevice tablet -device virtio-rng-pci"
> > +QB_SLIRP_OPT = "-net nic,model=e1000 -net user,hostfwd=tcp::2222-:22"
> > diff --git a/scripts/runqemu b/scripts/runqemu
> > index dbe17ab..6952f32 100755
> > --- a/scripts/runqemu
> > +++ b/scripts/runqemu
> > @@ -542,7 +542,8 @@ class BaseConfig(object):
> >      def check_and_set(self):
> >          """Check configs sanity and set when needed"""
> >          self.validate_paths()
> > -        check_tun()
> > +        if not self.slirp_enabled:
> > +            check_tun()
> >          # Check audio
> >          if self.audio_enabled:
> >              if not self.get('QB_AUDIO_DRV'):
> > 
> 




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] runqemu: add user mode (SLIRP) support to x86 QEMU targets
  2016-10-24 22:19 Todor Minchev
@ 2016-10-24 23:15 ` Mark Hatle
  2016-10-24 23:46   ` Todor Minchev
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Hatle @ 2016-10-24 23:15 UTC (permalink / raw)
  To: Todor Minchev, yocto

On 10/24/16 5:19 PM, Todor Minchev wrote:
> Using 'slirp' as a command line option to runqemu will start QEMU
> with user mode networking instead of creating tun/tap devices.
> SLIRP does not require root access. By default port 2222 on the
> host will be mapped to port 22 in the guest. The default port
> mapping can be overwritten with the QB_SLIRP_OPT variable e.g.
> 
> QB_SLIRP_OPT = "-net nic,model=e1000 -net user,hostfwd=tcp::2222-:22"

In the past patches like this have been rejected for performance and other
reasons.  While I don't particularly like requiring sudo access for runqemu,
adding the 'slirp' option will allow someone w/o root/sudo to be able to run it.

Otherwise, if there is something you can do to make slirp work better (when
enabled), that is more likely to be accepted.

--Mark

> Signed-off-by: Todor Minchev <todor.minchev@linux.intel.com>
> ---
>  meta/conf/machine/include/qemuboot-x86.inc | 1 +
>  scripts/runqemu                            | 3 ++-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/conf/machine/include/qemuboot-x86.inc b/meta/conf/machine/include/qemuboot-x86.inc
> index 06ac983..0870294 100644
> --- a/meta/conf/machine/include/qemuboot-x86.inc
> +++ b/meta/conf/machine/include/qemuboot-x86.inc
> @@ -13,3 +13,4 @@ QB_AUDIO_OPT = "-soundhw ac97,es1370"
>  QB_KERNEL_CMDLINE_APPEND = "vga=0 uvesafb.mode_option=640x480-32 oprofile.timer=1 uvesafb.task_timeout=-1"
>  # Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy
>  QB_OPT_APPEND = "-vga vmware -show-cursor -usb -usbdevice tablet -device virtio-rng-pci"
> +QB_SLIRP_OPT = "-net nic,model=e1000 -net user,hostfwd=tcp::2222-:22"
> diff --git a/scripts/runqemu b/scripts/runqemu
> index dbe17ab..6952f32 100755
> --- a/scripts/runqemu
> +++ b/scripts/runqemu
> @@ -542,7 +542,8 @@ class BaseConfig(object):
>      def check_and_set(self):
>          """Check configs sanity and set when needed"""
>          self.validate_paths()
> -        check_tun()
> +        if not self.slirp_enabled:
> +            check_tun()
>          # Check audio
>          if self.audio_enabled:
>              if not self.get('QB_AUDIO_DRV'):
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/1] runqemu: add user mode (SLIRP) support to x86 QEMU targets
@ 2016-10-24 22:19 Todor Minchev
  2016-10-24 23:15 ` Mark Hatle
  0 siblings, 1 reply; 8+ messages in thread
From: Todor Minchev @ 2016-10-24 22:19 UTC (permalink / raw)
  To: yocto; +Cc: Todor Minchev

Using 'slirp' as a command line option to runqemu will start QEMU
with user mode networking instead of creating tun/tap devices.
SLIRP does not require root access. By default port 2222 on the
host will be mapped to port 22 in the guest. The default port
mapping can be overwritten with the QB_SLIRP_OPT variable e.g.

QB_SLIRP_OPT = "-net nic,model=e1000 -net user,hostfwd=tcp::2222-:22"

Signed-off-by: Todor Minchev <todor.minchev@linux.intel.com>
---
 meta/conf/machine/include/qemuboot-x86.inc | 1 +
 scripts/runqemu                            | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/conf/machine/include/qemuboot-x86.inc b/meta/conf/machine/include/qemuboot-x86.inc
index 06ac983..0870294 100644
--- a/meta/conf/machine/include/qemuboot-x86.inc
+++ b/meta/conf/machine/include/qemuboot-x86.inc
@@ -13,3 +13,4 @@ QB_AUDIO_OPT = "-soundhw ac97,es1370"
 QB_KERNEL_CMDLINE_APPEND = "vga=0 uvesafb.mode_option=640x480-32 oprofile.timer=1 uvesafb.task_timeout=-1"
 # Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy
 QB_OPT_APPEND = "-vga vmware -show-cursor -usb -usbdevice tablet -device virtio-rng-pci"
+QB_SLIRP_OPT = "-net nic,model=e1000 -net user,hostfwd=tcp::2222-:22"
diff --git a/scripts/runqemu b/scripts/runqemu
index dbe17ab..6952f32 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -542,7 +542,8 @@ class BaseConfig(object):
     def check_and_set(self):
         """Check configs sanity and set when needed"""
         self.validate_paths()
-        check_tun()
+        if not self.slirp_enabled:
+            check_tun()
         # Check audio
         if self.audio_enabled:
             if not self.get('QB_AUDIO_DRV'):
-- 
2.10.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-11-24 10:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-26 17:05 [PATCH 1/1] runqemu: add user mode (SLIRP) support to x86 QEMU targets Todor Minchev
2016-11-24 10:29 ` Robert Yang
  -- strict thread matches above, loose matches on Subject: below --
2016-10-24 22:19 Todor Minchev
2016-10-24 23:15 ` Mark Hatle
2016-10-24 23:46   ` Todor Minchev
2016-10-25  0:16     ` Mark Hatle
2016-10-25 17:49       ` Brian Avery
2016-10-25 18:09         ` Mark Hatle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.