Re: Problems with bhyve's kgdb support and loadable modules

2014-05-04 Thread Michael Berman


On 5/3/14, 8:01 PM, "Peter Grehan"  wrote:

>Hi Kurt,
>
>> Is there any reasonable tutorial for using kgdb with the
>> bvmdebug kernel option?
>
>  Not really (https://wiki.freebsd.org/BHyVe/gdb)
>
>  In any event, 9.2 doesn't have bvmdebug, though it would be a simple
>backport. It's also not strictly required - you can use the serial port
>same as on h/w; see below.
>
>> A couple of folks I know have run into issues trying to
>> debug a FreeBSD stable/9 kernel from their bhyve
>> hosting machine (running stable/10).
>>
>> In particular, the loadable modules that are in use in
>> the stable/9 kernel are being "troublesome" to get to
>> the point where source-level debugging actually works.
>>
>> Even a pointer to a couple of "worked" examples might be
>> useful.
>>
>> I've read this:
>> http://people.freebsd.org/~jhb/papers/bsdcan/2008/article/node4.html
>> but not all the techniques in there appear to work properly.
>
>  I tried to repro this with some success from a host running CURRENT.
>
>  Firstly, I installed a 9.2 VM, with source. I edited GENERIC and added
>options DDB and GDB, and reinstalled the kernel.
>
>  The disk was then copied, and mdconfig'd/mounted on the host to
>provide access to the just-buit 9.2 kernel syms and sources.
>
>  com2 was set up as a debug port by dropping to the bhyveload prompt and
>
>hint.uart.1.flags="0x80"
>
>  (this could also have been done in the guest's /boot/loader.conf)
>
>  com2 was then set up in the bhyve command line to point to an nmdm
>device
>
>   -l com2,/dev/nmdm0A
>
>  The guest probed uart1 as a debug port:
>
>uart1: <16550 or compatible> port 0x2f8-0x2ff irq 3 flags 0x80 on acpi0
>ioapic0: routing intpin 3 (ISA IRQ 3) to lapic 0 vector 64
>uart1: fast interrupt
>uart1: debug port (9600,n,8,1)
>
>  After booting, I loaded the the tap device in the guest to provide a
>kld for kgdb to examine:
>
>root@fbsd9-2:~ # kldload if_tap
>root@fbsd9-2:~ # kldstat
>Id Refs AddressSize Name
>  13 0x8020 15f92d8  kernel
>  21 0x81a12000 59e9 if_tap.ko
>
>  Now time to try kgdb:
>
>root@fbsd9-2:~ # sysctl debug.kdb.enter=1
>debug.kdb.enter: 0KDB: enter: sysctl debug.kdb.enter
>[ thread pid 577 tid 100054 ]
>Stopped at  kdb_enter+0x3b: movq$0,0xaf0362(%rip)
>db> gdb
>(ctrl-c will return control to ddb)
>Switching to gdb back-end
>Switching to gdb back-end
>
>  In another window, cd'd to the mounted copy of the 9.2 disk:
>
>kgdb -r /dev/nmdm0B kernel.debug
>...
>This GDB was configured as "amd64-marcel-freebsd"...Switching to remote
>protocol
>kdb_enter (why=0x80fbf671 "sysctl", msg=0x80 of bounds>) at ../../../kern/subr_kdb.c:441
>441kdb_why = KDB_WHY_UNSET;
>
>(kgdb)
>
>  After some experimentation, I found the way to get the correct symbols
>for the kld was to manually specify it:
>
>(kgdb) add-kld /mnt/boot/kernel/if_tap.ko
>add symbol table from file "/mnt/boot/kernel/if_tap.ko.symbols" at
>   .text_addr = 0x81a12000
>   .rodata.str1.8_addr = 0x81a13b50
>   .rodata.str1.1_addr = 0x81a13ddb
>   set_sysinit_set_addr = 0x81a13f68
>   set_modmetadata_set_addr = 0x81a13f80
>   set_sysctl_set_addr = 0x81a13f90
>   set_sysuninit_set_addr = 0x81a13fc0
>   .data_addr = 0x81a13fe0
>   .bss_addr = 0x81a14620
>(y or n) y
>
>  However, 'info sharedlibrary' didn't seem to reflect this:
>
>(kgdb) info sharedlibrary
> FromTo  Syms Read   Shared Object Library
>0x81a12000  0x81a13c04  No
>/boot/kernel/if_tap.ko.symbols
>
>  Might have been a bug there, since I was able to successfully set
>breakpoints in if_tap routines and have them trigger.
>
>  I did have some trouble getting the source path set up correctly, but
>never fully investigated that: seems like gdb is quite rich in that area
>and it should be possible to get sorted.
>
>later,
>
>Peter.

I¹ve had good results with gdb a few of different ways, first as Peter
described, but also using a .gdbinit file to set the substitute-path.

For example:
set substitute-path /usr/home/michael/src /usr/src

Another nice thing about the bhyve diskdev is that you can mount it,
here¹s a Bourne shell script snippet:
md=`sudo mdconfig -a -t vnode -f $diskdev`
sudo mkdir -p /mnt/ts_guest
sudo fsck -y -t ufs /dev/${md}p2
sudo mount -t ufs /dev/${md}p2 /mnt/ts_guest


This means that with some careful gimmicks one can mount the guest such
that its source tree is at a useful place.

Depending on how/when you do this, I recommend a read only mount ;-)


Michael

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


Re: Clock in bhyve

2014-03-17 Thread Michael Berman

In my humble experience, the clock inside a VM can jump badly enough that
NTP complains and exits.
You¹ll need to configure NTP to be very forgiving.   VMware does a lot of
work in its tools/driver to avoid this.

Michael

On 3/15/14, 4:35 PM, "Neel Natu"  wrote:

>Hi Andrea,
>
>On Sat, Mar 15, 2014 at 11:14 AM, Andrea Brancatelli
> wrote:
>>
>>
>> Hello everybody.
>>
>> I have a stupid question for you :)
>>
>> Is the clock in bhyve virtual or just a hook the host?
>>
>> I mean, should I run ntpd inside the VMs as I would do, let's say, with
>> VMWare, or is it enough to run it on the host?
>
>You should also run it inside the guest.
>
>best
>Neel
>
>> --
>>
>> Andrea Brancatelli
>>
>>
>> ___
>> freebsd-virtualization@freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
>> To unsubscribe, send any mail to
>>"freebsd-virtualization-unsubscr...@freebsd.org"
>___
>freebsd-virtualization@freebsd.org mailing list
>http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
>To unsubscribe, send any mail to
>"freebsd-virtualization-unsubscr...@freebsd.org"

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


Re: BHyVe - ESXi comparison

2014-01-28 Thread Michael Berman
parsec and stresslinux may be of interest.

On 1/28/14, 7:02 AM, "Andrea Brancatelli"  wrote:

>I'd have to find a different workload (compiling a port under linux makes
>no sense), but that something I was already thinking about.
>
>Anybody has any idea about that? It must be something that get's done the
>same way (so for example if we are compiling it has to be gcc vs. gcc, but
>gcc is not the same on the two platforms)...
>
>I don't know...? Any benchmarking suite? But I don't want to benchmark the
>OS that is in the middle...
>
>
>
>On Tue, Jan 28, 2014 at 3:57 PM, Lars Engels  wrote:
>
>> Am 2014-01-28 13:21, schrieb Andrea Brancatelli:
>>
>>> Fixed, thanks.
>>>
>>>
>> Could you also compare two instances of Linux inside bhyve and VMware?
>>
>> ___
>> freebsd-virtualization@freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
>> To unsubscribe, send any mail to "freebsd-virtualization-
>> unsubscr...@freebsd.org"
>>
>
>
>
>-- 
>
>
>
>
>*Andrea BrancatelliSchema 31 S.r.l. - Socio UnicoResponsabile ITROMA -
>FIRENZE - PALERMO ITALYTel: +39. 06.98.358.472*
>
>*Cell: +39 331.2488468Fax: +39. 055.71.880.466Società del Gruppo SC31
>ITALIA*
>___
>freebsd-virtualization@freebsd.org mailing list
>http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
>To unsubscribe, send any mail to
>"freebsd-virtualization-unsubscr...@freebsd.org"

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


Re: break to debugger in bhyve

2013-12-16 Thread Michael Berman

Yes, thank you. I had this in my sysctl.conf.
It seems that my problem was in use of ssh in my environment.
³~~^B² finally did the trick.
I¹ve also moved it to boot/loader.conf as this sets it a little earlier in
the boot sequence.

It is still unreliable for me, but it may be my environent.

On 12/16/13, 5:03 PM, "Neel Natu"  wrote:

>Hi Michael,
>
>On Sun, Dec 15, 2013 at 9:00 PM, Michael Berman
> wrote:
>>
>> Unfortunately, this does not seem to work with the bhyve /dev/console
>>device.
>>
>
>Works fine for me once I compile with the ALT_BREAK_TO_DEBUGGER config
>option.
>
>root@b2:~ # sysctl -a kern.conftxt | grep ALT_BREAK_TO_DEBUGGER
>options ALT_BREAK_TO_DEBUGGER
>root@b2:~ #
>root@b2:~ # KDB: enter: Break to debugger
>[ thread pid 11 tid 13 ]
>Stopped at  kdb_alt_break_internal+0x17f:   movq$0,kdb_why
>db>
>
>best
>Neel
>
>> Sent from my iPhone
>>
>>> On Dec 15, 2013, at 5:10 PM, "Julian Elischer" 
>>>wrote:
>>>
>>>> On 12/16/13, 8:27 AM, Michael Berman wrote:
>>>> I¹ve tried the various kernel and sysctl options, and it may be the
>>>>way I am starting bhyve but I can¹t seem to get a the FreeBSD guest to
>>>>enter the kernel debugger with a hotkey.
>>> it depends of course on which 'console' you are using,,  for serial
>>>console with /dev/nmdm you can use the ALT_BREAK_TO_DEBUGGER
>>> option so that {enter| {~} {^B} will drop you into the debugger.
>>> When I was doing this last I had the console on the first serial port
>>>and the debugger on the second.
>>> (that's why I wrote the nmdm node.)
>>>>
>>>> Michael
>>>>
>>>> ___
>>>> freebsd-virtualization@freebsd.org mailing list
>>>> http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
>>>> To unsubscribe, send any mail to
>>>>"freebsd-virtualization-unsubscr...@freebsd.org"
>>>
>> ___
>> freebsd-virtualization@freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
>> To unsubscribe, send any mail to
>>"freebsd-virtualization-unsubscr...@freebsd.org"

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


Re: break to debugger in bhyve

2013-12-15 Thread Michael Berman

Unfortunately, this does not seem to work with the bhyve /dev/console device. 

Sent from my iPhone

> On Dec 15, 2013, at 5:10 PM, "Julian Elischer"  wrote:
> 
>> On 12/16/13, 8:27 AM, Michael Berman wrote:
>> I’ve tried the various kernel and sysctl options, and it may be the way I am 
>> starting bhyve but I can’t seem to get a the FreeBSD guest to enter the 
>> kernel debugger with a hotkey.
> it depends of course on which 'console' you are using,,  for serial console 
> with /dev/nmdm you can use the ALT_BREAK_TO_DEBUGGER
> option so that {enter| {~} {^B} will drop you into the debugger.
> When I was doing this last I had the console on the first serial port and the 
> debugger on the second.
> (that's why I wrote the nmdm node.)
>> 
>> Michael
>> 
>> ___
>> freebsd-virtualization@freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
>> To unsubscribe, send any mail to 
>> "freebsd-virtualization-unsubscr...@freebsd.org"
> 
___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"


break to debugger in bhyve

2013-12-15 Thread Michael Berman

I’ve tried the various kernel and sysctl options, and it may be the way I am 
starting bhyve but I can’t seem to get a the FreeBSD guest to enter the kernel 
debugger with a hotkey.

Michael

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


Re: how is the MAC for tap(4) computed?

2013-11-04 Thread Michael Berman
Peter, lost the last part of your message ...

An alternative would be hashing the vm name with the host name and host MAC 
address.

Sent from my iPhone

> On Nov 4, 2013, at 6:26 AM, "Peter Grehan"  wrote:
> 
> Hi Aryeh,
> 
>> There seems to be a very high rate of MAC address collisions when tap is
>> running on different machines is there anyway to make the selection of
>> MAC more random
> 
> Do you mean, tap(4) when used with bhyve ? If so, bhyve calculates the MAC 
> address for adapters based on an md5 hash of the PCI slot/function and VM 
> name. If you use the same bhyve configuration on a different machine, the MAC 
> address will be the same.
> 
> If that's the problem, you may want to supply your own MAC address with the 
> "mac=" parameter on the command line e.g.
> 
> later,
> 
> Peter.
> 
> ___
> freebsd-virtualization@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
> To unsubscribe, send any mail to 
> "freebsd-virtualization-unsubscr...@freebsd.org"
___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"


Re: Best VM setup for FreeBSD

2013-06-06 Thread Michael Berman

I run multiple VMs using VMware Fusion. VMware has *nix support in their
Workstation product.

On 6/6/13 7:26 AM, "TJ"  wrote:

>
>I have been looking into VirtualBox.
>
>My biggest hurdle at the moment is getting multiple hosts on one machine
>and setting up the VRDE to use different ports.
>
>I have also tried qemu and was having vnc issues too.
>
>On 06/06/13 15:21, David P. Caldwell wrote:
>> I am using VirtualBox without incident, with a Windows 7 host.
>>
>> -- David Caldwell
>> http://www.davidpcaldwell.com/
>>
>> On Wed, Jun 5, 2013 at 10:20 AM, TJ  wrote:
>>> Hi guys,
>>> i am looking to setting up some virtual FreeBSD servers.
>>>
>>> I run a run a network that only has FreeBSD hosts and i want to setup
>>>a few
>>> test boxes but would be much easier if i could virtualise them.
>>>
>>> I know there is bhyve in CURRENT but it is still young and wanted
>>>something
>>> tried and true, the FreeBSD handbook suggest VirtualBox, but there are
>>>also
>>> things like qemu and xen.
>>>
>>> What is the best and easiest to manage?
>>>
>>> I have only ever used EXSi before but the ESXi client is not available
>>>for
>>> *nix so it makes managing a bit more difficult.
>>>
>>> Thanks
>>>
>>> ___
>>> freebsd-virtualization@freebsd.org mailing list
>>> http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
>>> To unsubscribe, send any mail to
>>> "freebsd-virtualization-unsubscr...@freebsd.org"
>> ___
>> freebsd-virtualization@freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
>> To unsubscribe, send any mail to
>>"freebsd-virtualization-unsubscr...@freebsd.org"
>
>___
>freebsd-virtualization@freebsd.org mailing list
>http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
>To unsubscribe, send any mail to
>"freebsd-virtualization-unsubscr...@freebsd.org"

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