Interesting facts about AI_ADDRCONFIG

2012-07-14 Thread Zhihao Yuan
Hi, hackers:

FreeBSD's AI_ADDRCONFIG flag used by getaddrinfo(3) is regarded as broken:


https://wikispaces.psu.edu/display/ipv6/IPv6+programming#IPv6programming-AIADDRCONFIGflag

The short reason is that it still queries for both A and  even one
of them is not configured. The details are interesting:

In rfc2553, AI_ADDRCONFIG is described as:

- The AI_ADDRCONFIG flag specifies that a query for  records
should occur only if the node has at least one IPv6 source
address configured and a query for A records should occur only
if the node has at least one IPv4 source address configured.

Note that the description applies to getipnodebyname() actually, but
we can expect that it also applies to getaddrinfo().

And compare the above with the description from POSIX.1-2008:

If the AI_ADDRCONFIG flag is specified, IPv4 addresses shall be
returned only if an IPv4 address is configured on the local system,
and IPv6 addresses shall be returned only if an IPv6 address
is configured on the local system.

See the difference? POSIX does not care whether the addresses are
"queried"; it only says that it should be not returned. Hence, you can
query them first and filter them latter...

However, this is not the biggest problem. The main chaos is about
whether a loopback IP address can be considered "configured":

An embarrassing workaround by Mozilla:

https://mxr.mozilla.org/mozilla-central/source/nsprpub/pr/src/misc/prnetdb.c#2013

In 2003, rfc3493 responded the problem as:

 - If the AI_ADDRCONFIG flag is specified, IPv4 addresses shall be
   returned only if an IPv4 address is configured on the local system,
   and IPv6 addresses shall be returned only if an IPv6 address is
   configured on the local system.  The loopback address is not
   considered for this case as valid as a configured address.

  For example, when using the DNS, a query for  records should
  occur only if the node has at least one IPv6 address configured
  (other than IPv6 loopback) and a query for A records should occur
  only if the node has at least one IPv4 address configured (other
  than the IPv4 loopback).

Now I think things becomes clear:

  To support AI_ADDRCONFIG in a POSIX+RFC way, getaddrinfo(3) should
detect outbound address availability first, then query.

Let's go back to the code in FreeBSD:

  In lib/libc/net/getaddrinfo.c and lib/libc/net/name6.c ,
AI_ADDRCONFIG is implemented as "filter out the unsupported AFs in
kernel, then query". Obviously it's a misinterpretation of the word
"configured", and the implementation does not confirm with any
standards.

A better impl may be bind9's lwres_getipnodebyname() (in
contrib/bind9/lib/lwres/getipnode.c). It carefully uses ioctl(2) to
obtain the addr info on interfaces, then do query. I'm not sure
whether it handles the loopback problem, but it's much better then
what we have in libc.

So... What we going to do?

-- 
Zhihao Yuan, nickname lichray
The best way to predict the future is to invent it.
___
4BSD -- http://4bsd.biz/
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: FreeBSD 8.3

2012-07-14 Thread Bernhard Fröhlich
On Sa., 14. Jul. 2012 12:11:41 CEST, Mike Meyer  wrote:

> I just set up a system designed to handle lots of VBox VM's: a 6-core
> SandyBridge processor with 32GB of ram on a FreeBSD 8.3-STABLE host.
> 
> Unfortunately, once I got it set up, I found that VBox guest
> performance simply sucks. The *mouse* isn't responsive. Linux guests
> see lots of "CPU Locked" errors.

Does the VM use multiple vCPUs? Does reducing to one vcpu help? I have seen a 
lot of instabilities and problems in the past when using more than one vcpu. 
Where is that cpu locked reported? You could also try to build the vbox port 
with debug option enabled and look at VBox.log which gives probably useful 
information in case there are soft errors that cause the slowdown or if some of 
the vt-x features were incorrectly detected and vbox had to fallback to the 
recompiler (=slow).

> Googling turns up lots of problems with VBox on SandyBridge: Mac's
> running on 64 bit kernels have this problem - running on 32 bit
> kernels helps. Turning off Intel's SpeedStep has been reported to
> help. Turning off VT-X in the guest - if it's a 32-bit guest -
> helps. The last one is the only one that actually helped me.

Just to be sure which vbox version are we talking about? You could try 
emulators/virtualbox-ose-legacy to verify if it is a regression of 4.1.x.

> I was wondering if anyone here had run into and solved similar
> problems? Or if they were running a similar system, and didn't run
> into that problem? Especially anyone running 9.0 instead of 8.X

I've not heard about that before so it wasn't reported at least.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: FreeBSD 8.3

2012-07-14 Thread Wojciech Puchar

i would rather bet on linux addon kernel modules you have to install.


Are you talking about the guest additions? They're already installed
(on a VM that was running on an older Core 2 CPU). Performance sucks.


something must be wrong with linux interacting with virtualbox.

Won't help you as i never used linux on it, and actually at all for long 
time.


In windows you have to install "guest additions" without this it is 
plain terrible.


I haven't managed to get through an install on a 64-bit windows system


Windows 7 64-bit installs fine. FreeBSD 8.3, vbox 4.0.12


sandy bridge?


Yes, I'm sure that every guest OS I've tried on a 64 bit guest
sucks. I'm busy recreating 32-bit versions of the 64-bit guests where
I can.


maybe. i didn't do very detailed tests. and don't use 64-bit guest in 
production.



problems with latency you describe


Could you send me the system settings (VT-X, PAE, etc.) you used for
this?
Everything that is possible enable in BIOS, FreeBSD/amd64 8.3-stable 
(like month old or so), virtualbox 4.0.12


no fancy tricks, custom kernel but nothing special.

If you need more ask on priv.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: FreeBSD 8.3

2012-07-14 Thread Warren Block

On Sat, 14 Jul 2012, Warren Block wrote:

In a VM with stock settings (Linux 64-bit), Ubuntu 12.04 LTS Desktop Live CD 
works okay, installed also seems to work okay.  The mouse is a little draggy 
but usable, like using a wireless mouse.  kern.hz is set to 100 on the host 
(9-stable, er 9.1-BETA1, amd64).  This is without guest additions.  Trying 
the VirtualBox menu "install guest additions" made it crash.


The only mouse problem I saw was the mouse pointer disappearing when over 
some preferences icons.


Switched to XUbuntu because the menus were irritating in plain Ubuntu. 
No serious problems there either, and at least the package manager is 
locatable.

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: FreeBSD 8.3

2012-07-14 Thread Doug Barton
For the OP, make sure you have the latest BIOS. I had a similar problem
with vt-x and it was solved by a later BIOS upgrade.

hth,

Doug

-- 

Change is hard.



___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: FreeBSD 8.3

2012-07-14 Thread Adam Vande More
On Sat, Jul 14, 2012 at 2:27 PM, Mike Meyer  wrote:
>
> 64-bit Ubuntu LTS 12.04. I moved a VM from the previous system, where
> it worked fine (same build of FreeBSD, same build of VirtualBox). The
> OS seems to be irrelevant. Windows XP and 7 and mumble all have this
> problem, *if* I have VT-X enabled in VirtualBox. If I disable VT-X,
> the ones I have tested so far worked fine. I'm still getting 32-bit
> builds of some of them, as you can't turn VT-X off in a 64-bit guest.


If possible, set VM to single cpu.  Also not sure how you migrated
machines.  Occasionally the VM export/import functionality has
produced silliness.  Try creating new VM from scratch then attaching
existing VM disk(s) to it.



-- 
Adam Vande More
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: FreeBSD 8.3

2012-07-14 Thread Warren Block

On Sat, 14 Jul 2012, Mike Meyer wrote:


On Sat, 14 Jul 2012 13:13:50 -0600 (MDT)
Warren Block  wrote:

On Sat, 14 Jul 2012, Mike Meyer wrote:
Can you give a specific Linux version that has problems?  I'm willing to
download and test it on this i5/9-stable/amd64 system.  Haven't noticed
any problems, but I only occasionally boot Ubuntu in a VM for a little
bit.


64-bit Ubuntu LTS 12.04. I moved a VM from the previous system, where
it worked fine (same build of FreeBSD, same build of VirtualBox). The
OS seems to be irrelevant. Windows XP and 7 and mumble all have this
problem, *if* I have VT-X enabled in VirtualBox. If I disable VT-X,
the ones I have tested so far worked fine. I'm still getting 32-bit
builds of some of them, as you can't turn VT-X off in a 64-bit guest.


In a VM with stock settings (Linux 64-bit), Ubuntu 12.04 LTS Desktop 
Live CD works okay, installed also seems to work okay.  The mouse is a 
little draggy but usable, like using a wireless mouse.  kern.hz is set 
to 100 on the host (9-stable, er 9.1-BETA1, amd64).  This is without 
guest additions.  Trying the VirtualBox menu "install guest additions" 
made it crash.


The only mouse problem I saw was the mouse pointer disappearing when 
over some preferences icons.

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: FreeBSD 8.3

2012-07-14 Thread Mike Meyer
On Sat, 14 Jul 2012 13:13:50 -0600 (MDT)
Warren Block  wrote:
> On Sat, 14 Jul 2012, Mike Meyer wrote:
> Can you give a specific Linux version that has problems?  I'm willing to 
> download and test it on this i5/9-stable/amd64 system.  Haven't noticed 
> any problems, but I only occasionally boot Ubuntu in a VM for a little 
> bit.

64-bit Ubuntu LTS 12.04. I moved a VM from the previous system, where
it worked fine (same build of FreeBSD, same build of VirtualBox). The
OS seems to be irrelevant. Windows XP and 7 and mumble all have this
problem, *if* I have VT-X enabled in VirtualBox. If I disable VT-X,
the ones I have tested so far worked fine. I'm still getting 32-bit
builds of some of them, as you can't turn VT-X off in a 64-bit guest.

Thanks,
 http://www.mired.org/
Independent Software developer/SCM consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: FreeBSD 8.3

2012-07-14 Thread Warren Block

On Sat, 14 Jul 2012, Mike Meyer wrote:


I just set up a system designed to handle lots of VBox VM's: a 6-core
SandyBridge processor with 32GB of ram on a FreeBSD 8.3-STABLE host.

Unfortunately, once I got it set up, I found that VBox guest
performance simply sucks. The *mouse* isn't responsive. Linux guests
see lots of "CPU Locked" errors.


Can you give a specific Linux version that has problems?  I'm willing to 
download and test it on this i5/9-stable/amd64 system.  Haven't noticed 
any problems, but I only occasionally boot Ubuntu in a VM for a little 
bit.

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: FreeBSD 8.3

2012-07-14 Thread Mike Meyer
On Sat, 14 Jul 2012 20:27:11 +0200 (CEST)
Wojciech Puchar  wrote:
> > would have asked about that. My problem is sucky virtualbox
> > performance, on any guest that has VT-X emulation enabled (which means
> > all 64 bit guests).
> i would rather bet on linux addon kernel modules you have to install.

Are you talking about the guest additions? They're already installed
(on a VM that was running on an older Core 2 CPU). Performance sucks.

> In windows you have to install "guest additions" without this it is plain 
> terrible.

I haven't managed to get through an install on a 64-bit windows system
yet to try that. However, that Linux doesn't
Linux, or for the 32-bit

> >> Windows runs great (as for windows of course) under VBox.
> > Not for me. *Every* 64-bit guest OS has sucky performance. Linux,
> Are you sure with two level pagetables featured in modern CPUs including 
> sandy bridge?

Yes, I'm sure that every guest OS I've tried on a 64 bit guest
sucks. I'm busy recreating 32-bit versions of the 64-bit guests where
I can.

> > Are you only running 32-bit guests? Are you running on 9.x or 8.x?
> for production - yes (6 instances of windows XP). Virtualbox does never 
> make main workload for me, it is just addon. On FreeBSD 8.3.

Could you tell me if they all have VT-X disabled?

> But i've tried Windows 7 64-bit and it worked fine. didn't see any 
> problems with latency you describe

Could you send me the system settings (VT-X, PAE, etc.) you used for
this?

Thanks,
 http://www.mired.org/
Independent Software developer/SCM consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: FreeBSD 8.3

2012-07-14 Thread Wojciech Puchar

Wojciech Puchar  wrote:


CPU: Intel(R) Xeon(R) CPU E31220 @ 3.10GHz (3100.03-MHz K8-class CPU)


If that the one normally listed as E3-1220? If so, it's a Sandy Bridge

yes.


processor. If not, then I have not idea what it is.


so it is. it have working AES-NI.

I am such a kind of person that i am completely not on-time with 
marketing, namings, etc..


I just asked what CPUs will support AES-NI which is important for me (geli 
speedup) and got that in Dell Server ;)



Virtualbox works great with windoze on that machine.


FreeBSD have linux emulation. i think you should use it instead of VBox if
you need to run linux environments under FreeBSD.


Yes, it does. And I use it when I can. However, there are applications
that it won't run, because of missing kernel features. And of course,
it does absolutely not good at all if you need to run something other
than Linux.



would have asked about that. My problem is sucky virtualbox
performance, on any guest that has VT-X emulation enabled (which means
all 64 bit guests).


i would rather bet on linux addon kernel modules you have to install.

In windows you have to install "guest additions" without this it is plain 
terrible.



Windows runs great (as for windows of course) under VBox.


Not for me. *Every* 64-bit guest OS has sucky performance. Linux,


Are you sure with two level pagetables featured in modern CPUs including 
sandy bridge?



Are you only running 32-bit guests? Are you running on 9.x or 8.x?


for production - yes (6 instances of windows XP). Virtualbox does never 
make main workload for me, it is just addon. On FreeBSD 8.3.


But i've tried Windows 7 64-bit and it worked fine. didn't see any 
problems with latency you describe

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: FreeBSD 8.3

2012-07-14 Thread Jason Hellenthal


On Sat, Jul 14, 2012 at 06:11:41AM -0400, Mike Meyer wrote:
> I just set up a system designed to handle lots of VBox VM's: a 6-core
> SandyBridge processor with 32GB of ram on a FreeBSD 8.3-STABLE host.
> 
> Unfortunately, once I got it set up, I found that VBox guest
> performance simply sucks. The *mouse* isn't responsive. Linux guests
> see lots of "CPU Locked" errors.

Try booting the linux VBox with HZ=100. This should greatly improve your
performance.

> 
> Googling turns up lots of problems with VBox on SandyBridge: Mac's
> running on 64 bit kernels have this problem - running on 32 bit
> kernels helps. Turning off Intel's SpeedStep has been reported to
> help. Turning off VT-X in the guest - if it's a 32-bit guest -
> helps. The last one is the only one that actually helped me.
> 
> I was wondering if anyone here had run into and solved similar
> problems? Or if they were running a similar system, and didn't run
> into that problem? Especially anyone running 9.0 instead of 8.X!
> 
> 
> 
>Thanks,
> 
> -- 
> Mike Meyerhttp://www.mired.org/
> Independent Software developer/SCM consultant, email for more information.
> 
> O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
> ___
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

-- 

 - (2^(N-1))
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: FreeBSD 8.3

2012-07-14 Thread Mike Meyer
On Sat, 14 Jul 2012 19:56:22 +0200 (CEST)
Wojciech Puchar  wrote:

> CPU: Intel(R) Xeon(R) CPU E31220 @ 3.10GHz (3100.03-MHz K8-class CPU)

If that the one normally listed as E3-1220? If so, it's a Sandy Bridge
processor. If not, then I have not idea what it is.

> > Unfortunately, once I got it set up, I found that VBox guest
> > performance simply sucks. The *mouse* isn't responsive. Linux guests
> > see lots of "CPU Locked" errors.
> FreeBSD have linux emulation. i think you should use it instead of VBox if 
> you need to run linux environments under FreeBSD.

Yes, it does. And I use it when I can. However, there are applications
that it won't run, because of missing kernel features. And of course,
it does absolutely not good at all if you need to run something other
than Linux.

Sucky Linux emulation performance is not my problem. If it were, I
would have asked about that. My problem is sucky virtualbox
performance, on any guest that has VT-X emulation enabled (which means
all 64 bit guests).

> Windows runs great (as for windows of course) under VBox.

Not for me. *Every* 64-bit guest OS has sucky performance. Linux,
Windows, and others. The only one that reports any problems is Linux -
it reports the "CPU Locked" errors. The others just suck. If I cut the
memory size down and create 32-bit guests, they all seem to run
OK. But I want to run systems for which there aren't 32-bit
distributions.

Are you only running 32-bit guests? Are you running on 9.x or 8.x?

   Thanx,
http://www.mired.org/
Independent Software developer/SCM consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: FreeBSD 8.3

2012-07-14 Thread Wojciech Puchar

SandyBridge processor with 32GB of ram on a FreeBSD 8.3-STABLE host.


i am using virtualbox but no linux guest, only windows.


the newest CPU i have is
CPU: Intel(R) Xeon(R) CPU E31220 @ 3.10GHz (3100.03-MHz K8-class CPU)


Unfortunately, once I got it set up, I found that VBox guest
performance simply sucks. The *mouse* isn't responsive. Linux guests
see lots of "CPU Locked" errors.


FreeBSD have linux emulation. i think you should use it instead of VBox if 
you need to run linux environments under FreeBSD.


jails are your friend too.

Windows runs great (as for windows of course) under VBox.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


FreeBSD 8.3

2012-07-14 Thread Mike Meyer
I just set up a system designed to handle lots of VBox VM's: a 6-core
SandyBridge processor with 32GB of ram on a FreeBSD 8.3-STABLE host.

Unfortunately, once I got it set up, I found that VBox guest
performance simply sucks. The *mouse* isn't responsive. Linux guests
see lots of "CPU Locked" errors.

Googling turns up lots of problems with VBox on SandyBridge: Mac's
running on 64 bit kernels have this problem - running on 32 bit
kernels helps. Turning off Intel's SpeedStep has been reported to
help. Turning off VT-X in the guest - if it's a 32-bit guest -
helps. The last one is the only one that actually helped me.

I was wondering if anyone here had run into and solved similar
problems? Or if they were running a similar system, and didn't run
into that problem? Especially anyone running 9.0 instead of 8.X!



   Thanks,
http://www.mired.org/
Independent Software developer/SCM consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"