Red Hat Bugzilla – Bug 501314
No beep when running xen kernel
Last modified: 2014-09-30 19:44:14 EDT
When booting the xen kernel (kernel-xen-2.6.18-128.1.1.el5), he no longer get any warning beeps. It did work fine with the corresponding regular kernel (kernel-2.6.18-128.1.1.el5).
Note that customer is talking about the beep sound from the builtin speaker, not the sound/audio system. The one that gets rung by the shell when something goes wrong, or which we hear when running xkbbell. When running the xen kernel, xkbbell does not generate any sound, but otherwise appears to exit normally. The pcspkr module IS loaded. The problem is elsewhere. Regular sound/audio system is working fine.
I searched a bit on this and found that a bug has been submitted for Fedora without any resolution. https://bugzilla.redhat.com/show_bug.cgi?id=230900
I searched upstream and found a patch which I though might help resolve this issue.
I compiled a test kernel with the above patch and tested, but unfortunately didn't see this issue resolved by the above patch.
How to reproduce:
It's very easy to reproduce.
- Boot a system to 5.3 stock kernel. Hook up a keyboard physically and run "backspace" on a terminal window or run xkbbell in gnome-terminal. You would hear the beep sound.
- Boot the same system to 5.3 xen kernel and test. There wouldn't be any beep sound.
This bug was fixed in kernel 2.6.18-137, where beep device was added. So this bug can be closed.
Since these seems to have been fixed by the ALSA update, going to close this as a DUP of that. If this continues to be a problem after 5.4 is released, feel free to reopen.
*** This bug has been marked as a duplicate of bug 483594 ***
Reopening, didn't help...
I reproduced the problem using the following two kernels:
- speaker works from dom0: 2.6.18-226.el5
- speaker doesn't work from dom0: 2.6.18-226.el5xen
It seems that the current RHEL5 xen hypervisor doesn't allow direct access to the PC speaker. construct_dom0() in "arch/x86/domain_build.c" does the following:
/* Interval Timer (PIT). */
rc |= ioports_deny_access(dom0, 0x40, 0x43);
/* PIT Channel 2 / PC Speaker Control. */
rc |= ioports_deny_access(dom0, 0x61, 0x61);
Furthermore, it only seems to *emulate* the PIT and the PC speaker; it never touches real speaker hardware. See:
- guest_io_write() in "xen/arch/x86/traps.c",
- pv_pit_handler() in "xen/arch/x86/hvm/i8254.c",
- handle_speaker_io() -||-,
- speaker_ioport_write() -||-,
- pit_set_gate() -||-.
I found two mailing list messages / patches that allow dom0 to access the PC speaker of the host:
- The first is "allow Dom0 to drive PC speaker" from Jan Beulich .
- The second has the same subject , and it seems to be a cleaned up version of the previous patch. This one was committed to xen-unstable , c/s 15882:9dd580b8b056.
There are some deeper differences between the patches. For example, the committed version doesn't seem to provide direct access to port 0x42.
I'm assigning this to myself. I'll try to backport and test  unless I'm told otherwise.
For the patch to have any effect, I believe it will be important *not* to start the hypervisor with "clocksource=pit". (Without the parameter it should usually work as if with "clocksource=hpet".)
Veaceslav, does the customer still care?
Backported of cs 15882:9dd580b8b056 from xen-unstable.hg
Created attachment 497739 [details]
Allows Dom0 to use PC speaker.
For this to work, Xen shouldn't be booted with a 'clocksource=pit'.
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release. Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products. This request is not yet committed for inclusion in an Update
Patch(es) available in kernel-2.6.18-264.el5
You can download this test kernel (or newer) from http://people.redhat.com/jwilson/el5
Detailed testing feedback is always welcomed.
tried with kernel-2.6.18-262.el5, no beep when run 'echo -e "\007"', verified with kernel-2.6.18-264.el5, there is beep sound when run 'echo -e "\007"'.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.