Bug 1369964 - bhyve+ssh: cannot obtain CPU freq: No such file or directory
Summary: bhyve+ssh: cannot obtain CPU freq: No such file or directory
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: x86_64
OS: FreeBSD
unspecified
unspecified
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-08-24 21:55 UTC by Khramov Anton
Modified: 2022-03-17 17:26 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2022-03-17 17:26:23 UTC
Embargoed:


Attachments (Terms of Use)
dmesg log (5.15 KB, text/plain)
2016-08-26 19:45 UTC, Khramov Anton
no flags Details
proposed patch, v1 (637 bytes, patch)
2016-08-30 14:57 UTC, Roman Bogorodskiy
no flags Details | Diff

Description Khramov Anton 2016-08-24 21:55:30 UTC
Description of problem:

virt-manager 1.4.0 (latest master branch)

Try to connect to libvirt which runs inside FreeBSD and you'll get this message:

Error polling connection 'bhyve+ssh://root@freebsd1/system': cannot obtain CPU freq: No such file or directory

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/engine.py", line 385, in _handle_tick_queue
    conn.tick_from_engine(**kwargs)
  File "/usr/share/virt-manager/virtManager/connection.py", line 1319, in tick_from_engine
    raise e  # pylint: disable=raising-bad-type
libvirtError: cannot obtain CPU freq: No such file or directory


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:

show error message

Expected results:

it should work

Additional info:

I'm trying to boot VMs on top of FreeBSD (and I use them to run FreeBSD VM) using my scripts:

https://github.com/kayrus/scripts

you can actually try to use them for test puproses.

Comment 1 Khramov Anton 2016-08-24 22:00:25 UTC
Correct error message:

Error polling connection 'bhyve+ssh://root@freebsd1/system': cannot obtain CPU freq: No such file or directory

Traceback (most recent call last):
  File "/home/kay/git/my/virt-manager/virtManager/engine.py", line 385, in _handle_tick_queue
    conn.tick_from_engine(**kwargs)
  File "/home/kay/git/my/virt-manager/virtManager/connection.py", line 1431, in tick_from_engine
    raise e  # pylint: disable=raising-bad-type
libvirtError: cannot obtain CPU freq: No such file or directory

Comment 2 Roman Bogorodskiy 2016-08-26 13:20:18 UTC
Hi Anton,

Can you show output of the following command on the host libvirtd is running:

sysctl dev.cpu.0.freq

If this fails (I assume it will), could you check if you have "device cpufreq" in your current kernel configuration?

Comment 3 Khramov Anton 2016-08-26 18:10:35 UTC
I'm not quite familiar with freebsd, but here is the output of kldstat:

kldstat -v | grep cpu
                102 cpu/ichss
                478 legacy/cpu
                461 cpu/p4tcc
                460 cpu/hwpstate
                459 cpu/est
                458 cpu/powernow
                36 cpu/acpi_throttle
                375 cpu/cpufreq
                23 acpi/cpu
                32 cpu/acpi_perf

As I mentioned before, I use official qcow2 freebsd image

Comment 4 Roman Bogorodskiy 2016-08-26 19:02:29 UTC
Sorry for the confusion, I mean the host FreeBSD you run libvirt on, not the VM.

Also, could you please send output of "sysctl dev.cpu.0.freq" on the host as I mentioned before?

And one more thing that could be helpful: could you attach dmesg (/var/run/dmesg.boot on the host)?

Comment 5 Khramov Anton 2016-08-26 19:45:37 UTC
Created attachment 1194456 [details]
dmesg log

I use nested virtualization. For test purposes I run FreeBSD host inside KVM. `sysctl dev.cpu.0.freq` returns error. dmesg is attached.

Comment 6 Roman Bogorodskiy 2016-08-26 20:41:54 UTC
(In reply to Khramov Anton from comment #5)
> Created attachment 1194456 [details]
> dmesg log
> 
> I use nested virtualization. For test purposes I run FreeBSD host inside
> KVM. `sysctl dev.cpu.0.freq` returns error. dmesg is attached.

That's very interesting. I'm not sure why cpufreq is not showing CPU frequency in this case, maybe it needs some additional cpu features exposed to l1 guest? Unfortunately, I have no experience neither in nested virtualization FreeBSD setups nor in cpufreq(4) debugging.

The first thing I'd do though is probably add debug.cpufreq.verbose="1" to /boot/loader.conf to see if it maybe prints something reasonable and ask on some FreeBSD list (freebsd-virtualization@ maybe?) if that's some known problem.

There are few workarounds possible though:

 - Use "virsh" directly, cpu freq is not an essential feature and you'll be able to move forward. Actually, that's the way I would recommend because bhyve support in virt-manager is still not quite complete (i.e. it's alright at showing information, but creating new VMs requires manual configuration and knowledge of certain specifics, e.g. by default it tries to use ide disks that are not supported by bhyve etc).
 - Stub it out in libvirt or virt-manager (this is a bad solution, but I don't know what your goals are)

In the meantime, I'll try to see if I can get nested kvm/bhyve setup myself.

Comment 7 Roman Bogorodskiy 2016-08-30 14:57:30 UTC
Created attachment 1195953 [details]
proposed patch, v1

Attached a patch that could possibly fix this issue. I'll be able to properly test that tomorrow.

Comment 8 Roman Bogorodskiy 2016-08-31 05:18:08 UTC
It looks like this approach works for my FreeBSD VM in KVM (not nested virt though).

https://www.redhat.com/archives/libvir-list/2016-August/msg01310.htmlhttps://www.redhat.com/archives/libvir-list/2016-August/msg01310.html

Comment 9 Khramov Anton 2016-08-31 05:44:04 UTC
Thanks, Roman. Will try your fix soon and let you know.

Comment 10 Roman Bogorodskiy 2016-09-05 15:44:02 UTC
(In reply to Khramov Anton from comment #9)
> Thanks, Roman. Will try your fix soon and let you know.

Hi Anton, any luck with that?

Comment 11 Khramov Anton 2016-09-06 05:45:31 UTC
Hi Roman, I just tested the sysctl hw.clockrate and it worked. I didn't have enough time to compile the libvirt.

Comment 12 Roman Bogorodskiy 2016-09-06 15:31:41 UTC
(In reply to Khramov Anton from comment #11)
> Hi Roman, I just tested the sysctl hw.clockrate and it worked. I didn't have
> enough time to compile the libvirt.

Great, thanks, I've pushed the fix to master.

If you're interested, I can create a patch for the port (that's currently @ 2.2.0) if it makes things easier.


Note You need to log in before you can comment on or make changes to this bug.