Page MenuHomeFreeBSD

dev_submerge.ch (Florian Walpen)
User

Projects

User does not belong to any projects.

User Details

User Since
Nov 25 2021, 6:20 PM (128 w, 7 h)

Recent Activity

Yesterday

dev_submerge.ch accepted D45135: sound: Remove nmix variable from mixer_oss_mixerinfo().

mixer_get_nmixers() returns the oss_sysinfo->nummixers, which, in 277615's case at least, is 5, but we have 8 sound cards, just 3 of them do not have a mixer. So now in mixer(8) we are looping from 0 to 5 and we start opening from /dev/mixer0 to /dev/mixer4, and this is why we're failing to open /dev/mixer0 as his error message reports.

I think a solution can be to get the number of sound cards (i.e oss_sysinfo->numcards) as opposed to the number of mixers, loop through them and if we fail to open a mixer, continue to the next one without printing any error/warning. I can add a mixer_get_ncards() routine to do this.

Thu, May 9, 5:47 PM
dev_submerge.ch accepted D45138: sound: Rename oss_audioinfo->real_device to oss_audioinfo->legacy_device.
Thu, May 9, 4:27 PM
dev_submerge.ch accepted D45137: sound: Add missing oss_mixerinfo devnode and legacy_device fields.
Thu, May 9, 4:15 PM
dev_submerge.ch accepted D45136: sound: Fix oss_sysinfo->numcards.
Thu, May 9, 4:03 PM
dev_submerge.ch added a comment to D45135: sound: Remove nmix variable from mixer_oss_mixerinfo().

Maybe unrelated to this particular piece of code, but I did some tests with two USB sound cards. When I remove the first one (pcm0), the mixer application reveals some flaws:

Thu, May 9, 3:59 PM
dev_submerge.ch added a comment to D45112: snd_hdsp(4): RME HDSP 9632 and HDSP 9652 sound card driver..

@br does hdsp_running() look correct now? I did some brief tests, seems to work.

Thu, May 9, 2:51 PM
dev_submerge.ch updated the diff for D45112: snd_hdsp(4): RME HDSP 9632 and HDSP 9652 sound card driver..

Address the issues reported by Li-Wen Hsu and Ruslan Bukin.

Thu, May 9, 2:47 PM

Wed, May 8

dev_submerge.ch added inline comments to D45112: snd_hdsp(4): RME HDSP 9632 and HDSP 9652 sound card driver..
Wed, May 8, 12:34 PM

Tue, May 7

dev_submerge.ch added a comment to D45112: snd_hdsp(4): RME HDSP 9632 and HDSP 9652 sound card driver..

For those not familiar with snd_hdspe(4), it may be best to compare this with the hdspe.h, hdspe.c and hdspe-pcm.c files in the same directory (sys/dev/sound/pci).

Tue, May 7, 1:40 PM
dev_submerge.ch requested review of D45112: snd_hdsp(4): RME HDSP 9632 and HDSP 9652 sound card driver..
Tue, May 7, 1:00 PM

Mon, May 6

dev_submerge.ch added inline comments to D45013: sound: Remove unused dsp_cdevs[] fields and devices.
Mon, May 6, 4:48 PM
dev_submerge.ch accepted D45095: sound: Remove unused "num" argument from chn_init() and related callers.

Looks good to me, but I cannot compile and test it. Patch doesn't apply here locally because I'm missing previous commits. Time to get that stuff merged ;-)

Mon, May 6, 4:42 PM
dev_submerge.ch accepted D45013: sound: Remove unused dsp_cdevs[] fields and devices.

Ok for me except for the style, see inline comment. Having separate pcm devices for AC3, SPDIF etc may not be appropriate, but we should probably find a way to integrate these settings into the mixer or a future user space audioctl tool.

Mon, May 6, 4:37 PM
dev_submerge.ch accepted D44993: sound: Merge pcm_chn_create() and chn_init().
Mon, May 6, 4:23 PM

Sat, May 4

dev_submerge.ch added a comment to D45013: sound: Remove unused dsp_cdevs[] fields and devices.

Some of the types (SND_DEV_AUDIO, SND_DEV_DSP16, SND_DEV_DSPHW_CD) in sound.h are unused now, I think. Should we get rid of them or mark them deprecated?

Sat, May 4, 11:38 PM

Wed, May 1

dev_submerge.ch added a comment to D45013: sound: Remove unused dsp_cdevs[] fields and devices.

No objection. Do you think we should also remove the OSSv4 aliases?

Wed, May 1, 9:23 PM
dev_submerge.ch added a comment to D45013: sound: Remove unused dsp_cdevs[] fields and devices.

I don't think there's a lot of value in keeping the aliases, if we don't also keep the behaviour -- i.e., if some application does expect to open /dev/dspW and send 16-bit samples without doing any other configuration it's not going to work as expected.

True, but if we delete them the program will just exit, which I don't know if it's any better. I am not very keen on keeping those aliases either however, so I am open to suggestions.

Wed, May 1, 4:54 PM
dev_submerge.ch added inline comments to D44993: sound: Merge pcm_chn_create() and chn_init().
Wed, May 1, 3:50 PM
dev_submerge.ch added a comment to D44993: sound: Merge pcm_chn_create() and chn_init().

@dev_submerge.ch If there's nothing else that needs fixing I think we can go ahead with it.

Wed, May 1, 12:00 AM

Tue, Apr 30

dev_submerge.ch added a comment to D45013: sound: Remove unused dsp_cdevs[] fields and devices.

how does e.g. /dev/dspW map to 16-bit now?

It doesn't since e8c0d15a64fa, and in fact, I just realized that accessing them doesn't work, as is expected. What we can do is:

  1. Make them /dev/dsp aliases, like the OSS-compat devices.
  2. Remove them.

I am more inclined to do the former, just in case there's a program that uses /dev/dspW, /dev/audio or /dev/dspcd. @dev_submerge.ch what do you think?

Tue, Apr 30, 11:55 PM
dev_submerge.ch accepted D45015: sound: Move vchan-related code to pcm/vchan.*.

What is this diff based on? I can't apply it on any branch I have.

I forgot to stack the patches, but it is diffed against the previous ones. I thought it wasn't needed, but I can diff against main and reupload if you want.

Tue, Apr 30, 11:31 PM
dev_submerge.ch added a comment to D45015: sound: Move vchan-related code to pcm/vchan.*.

What is this diff based on? I can't apply it on any branch I have.

Tue, Apr 30, 11:17 PM
dev_submerge.ch accepted D45013: sound: Remove unused dsp_cdevs[] fields and devices.
Tue, Apr 30, 10:47 PM
dev_submerge.ch accepted D44996: sound: Remove hw.snd.version and SND_DRV_VERSION.
Tue, Apr 30, 10:46 PM

Mon, Apr 29

dev_submerge.ch added inline comments to D44996: sound: Remove hw.snd.version and SND_DRV_VERSION.
Mon, Apr 29, 1:37 PM
dev_submerge.ch added inline comments to D44993: sound: Merge pcm_chn_create() and chn_init().
Mon, Apr 29, 1:15 PM

Sun, Apr 28

dev_submerge.ch accepted D44912: sound: Retire unit.*.

Did some testing, works fine for me.

Sun, Apr 28, 7:15 PM
dev_submerge.ch added a comment to D44923: sound: Fix panic caused by sleeping-channel destruction during asynchronous detach.

@dev_submerge.ch So, both setting CHN_F_DEAD in the non-sleeping case, and implementing chn_shutdown() and calling it from pcm_unregister() and pcm_killchans() (see below) work fine. Do you think it's better to just with the latter?

Sun, Apr 28, 3:52 PM
dev_submerge.ch added a comment to D44923: sound: Fix panic caused by sleeping-channel destruction during asynchronous detach.

Actually, my guess is that it would have had some merit to set CHN_F_DEAD unconditionally, early on in pcm_unregister(), beneath waking up sleeping threads. That would mean some code duplication, yes, but less interference from userspace and sleep waiting afterwards. But I don't have a case to back that up.

Sun, Apr 28, 2:44 PM
dev_submerge.ch added inline comments to D44923: sound: Fix panic caused by sleeping-channel destruction during asynchronous detach.
Sun, Apr 28, 12:49 PM

Fri, Apr 26

dev_submerge.ch added a comment to D44978: snd_hdspe(4): Recognize newer firmware's PCI vendor id..
In D44978#1025409, @br wrote:

@br: I was surprised that after a firmware update of my HDSPe RayDAT card it wasn't recognized anymore on FreeBSD. Turns out RME changed the PCI vendor id to their own instead of the Xilinx one.

Could you please check that your HDSPe AIO card is still recognized with this patch? Would be nice to have this fixed in upcoming 14.1-RELEASE, thus the short-term MFC.

Let me check. BTW should this work for HDSPe AIO Pro? I don't have it but I'm curious

Fri, Apr 26, 11:03 PM
dev_submerge.ch added a comment to D44978: snd_hdspe(4): Recognize newer firmware's PCI vendor id..

@br: I was surprised that after a firmware update of my HDSPe RayDAT card it wasn't recognized anymore on FreeBSD. Turns out RME changed the PCI vendor id to their own instead of the Xilinx one.

Fri, Apr 26, 8:57 PM
dev_submerge.ch requested review of D44978: snd_hdspe(4): Recognize newer firmware's PCI vendor id..
Fri, Apr 26, 8:47 PM

Wed, Apr 24

dev_submerge.ch added inline comments to D44912: sound: Retire unit.*.
Wed, Apr 24, 12:20 AM

Tue, Apr 23

dev_submerge.ch added inline comments to D44912: sound: Retire unit.*.
Tue, Apr 23, 11:14 PM

Apr 6 2024

dev_submerge.ch added a comment to D44570: sound: Implement SNDCTL_SETNAME.

Hacked it into the sosso test executable to exercise this ioctl, I'm still not convinced of its utility. This lets every application of all users set the device description globally. I think it's useful on a system level (mixer or similar tool), but I'd be wary to use it in an application. For the purposes mentioned in OSSv4, something like virtual_oss can set the description of the pcm devices it creates in a different way.

Apr 6 2024, 12:12 PM

Apr 1 2024

dev_submerge.ch accepted D44571: sound: Move sndstat_prepare_pcm() to pcm/sndstat.c and remove sndstat_entry->handler.
Apr 1 2024, 2:20 PM

Mar 31 2024

dev_submerge.ch added a comment to D44570: sound: Implement SNDCTL_SETNAME.

Do you have a particular interest in this ioctl? I didn't find any software using it on github, just example code from the 4Front OSS docs. Maybe it's a good opportunity to add an OSS API test executable now? Otherwise I have to hack it into sosso or something to run it.

Mar 31 2024, 2:44 PM
dev_submerge.ch accepted D43545: sound: Implement asynchronous device detach.

Did another test drive with all patches together, works fine now. Sorry for the long "test cycle", I really have to get a USB expansion card for bhyve passthrough, so I don't have to reboot into CURRENT all the time.

Mar 31 2024, 1:57 PM

Mar 29 2024

dev_submerge.ch accepted D44411: sound: Get rid of snd_clone and use DEVFS_CDEVPRIV(9).

"Good news", I can reproduce the lock order reversal on the main branch, without this patch - it's not related to the changes here. How should we proceed with that?

Mar 29 2024, 4:51 PM
dev_submerge.ch added a comment to D44546: sound: Make verbose sndstat output more readable.

So, the patch will break this, but I think OBS has to be patched anyway...

It's not just OBS, it was just the first match that I recognized. GitHub turns up 1.8k instances of "/dev/sndstat": https://github.com/search?q=%2Fdev%2Fsndstat&type=code
Of course some (lots?) of these won't apply (e.g. old unused Linux OSS functionality) but this will definitely take some work and coordination.

Mar 29 2024, 2:42 PM

Mar 28 2024

dev_submerge.ch added a comment to D44546: sound: Make verbose sndstat output more readable.

This is definitely more readable, but my main concern would be that this form of output is quite lengthy and not very grep-friendly. Imagine 8 pcm devices with 4 channels each (when idle). Ideally, we could easily grep for the whole output of a single device, or check which output is used by an application (cat /dev/sndstat | grep mpv). Would be handy for both personal use and bug reports from users. Or maybe we can integrate these selective queries into a user space tool?

Mar 28 2024, 2:16 PM
dev_submerge.ch added a comment to D44411: sound: Get rid of snd_clone and use DEVFS_CDEVPRIV(9).

The mmap'ed tests worked fine in general, but I hit the following while starting two instances simultaneously:

lock order reversal:
 1st 0xfffff8012e17e0a0 pcm7:virtual:dsp7.vr0 (pcm virtual record channel, sleep mutex) @ /usr/src/sys/dev/sound/pcm/dsp.c:2617
 2nd 0xfffff8012e17e120 pcm7 (sound cdev, sleep mutex) @ /usr/src/sys/dev/sound/pcm/channel.c:2214
lock order sound cdev -> pcm virtual record channel established at:
#0 0xffffffff80bc7b7a at witness_checkorder+0x2fa
#1 0xffffffff80b2d200 at __mtx_lock_flags+0x90
#2 0xffffffff808e6b7d at sound_oss_sysinfo+0x1ed
#3 0xffffffff808cf810 at dsp_ioctl+0x960
#4 0xffffffff809db8f2 at devfs_ioctl+0xd2
#5 0xffffffff80c63092 at vn_ioctl+0xc2
#6 0xffffffff809dbfce at devfs_ioctl_f+0x1e
#7 0xffffffff80bce186 at kern_ioctl+0x286
#8 0xffffffff80bcde93 at sys_ioctl+0x143
#9 0xffffffff8105b473 at amd64_syscall+0x153
#10 0xffffffff8102d10b at fast_syscall_common+0xf8
lock order pcm virtual record channel -> sound cdev attempted at:
#0 0xffffffff80bc83e3 at witness_checkorder+0xb63
#1 0xffffffff80b2d200 at __mtx_lock_flags+0x90
#2 0xffffffff808c949a at chn_trigger+0x26a
#3 0xffffffff808e9c6c at vchan_trigger+0x12c
#4 0xffffffff808c9321 at chn_trigger+0xf1
#5 0xffffffff808d5acb at dsp_oss_syncstart+0x1bb
#6 0xffffffff808d0b40 at dsp_ioctl+0x1c90
#7 0xffffffff809db8f2 at devfs_ioctl+0xd2
#8 0xffffffff80c63092 at vn_ioctl+0xc2
#9 0xffffffff809dbfce at devfs_ioctl_f+0x1e
#10 0xffffffff80bce186 at kern_ioctl+0x286
#11 0xffffffff80bcde93 at sys_ioctl+0x143
#12 0xffffffff8105b473 at amd64_syscall+0x153
#13 0xffffffff8102d10b at fast_syscall_common+0xf8

I was able to reproduce this a second time, with some "luck" in timing.

Didn't investigate yet, I want to do some more testing first.

Can you share the exact commands you ran to get this?

Mar 28 2024, 1:12 PM

Mar 27 2024

dev_submerge.ch added a comment to D44411: sound: Get rid of snd_clone and use DEVFS_CDEVPRIV(9).

The mmap'ed tests worked fine in general, but I hit the following while starting two instances simultaneously:

lock order reversal:
 1st 0xfffff8012e17e0a0 pcm7:virtual:dsp7.vr0 (pcm virtual record channel, sleep mutex) @ /usr/src/sys/dev/sound/pcm/dsp.c:2617
 2nd 0xfffff8012e17e120 pcm7 (sound cdev, sleep mutex) @ /usr/src/sys/dev/sound/pcm/channel.c:2214
lock order sound cdev -> pcm virtual record channel established at:
#0 0xffffffff80bc7b7a at witness_checkorder+0x2fa
#1 0xffffffff80b2d200 at __mtx_lock_flags+0x90
#2 0xffffffff808e6b7d at sound_oss_sysinfo+0x1ed
#3 0xffffffff808cf810 at dsp_ioctl+0x960
#4 0xffffffff809db8f2 at devfs_ioctl+0xd2
#5 0xffffffff80c63092 at vn_ioctl+0xc2
#6 0xffffffff809dbfce at devfs_ioctl_f+0x1e
#7 0xffffffff80bce186 at kern_ioctl+0x286
#8 0xffffffff80bcde93 at sys_ioctl+0x143
#9 0xffffffff8105b473 at amd64_syscall+0x153
#10 0xffffffff8102d10b at fast_syscall_common+0xf8
lock order pcm virtual record channel -> sound cdev attempted at:
#0 0xffffffff80bc83e3 at witness_checkorder+0xb63
#1 0xffffffff80b2d200 at __mtx_lock_flags+0x90
#2 0xffffffff808c949a at chn_trigger+0x26a
#3 0xffffffff808e9c6c at vchan_trigger+0x12c
#4 0xffffffff808c9321 at chn_trigger+0xf1
#5 0xffffffff808d5acb at dsp_oss_syncstart+0x1bb
#6 0xffffffff808d0b40 at dsp_ioctl+0x1c90
#7 0xffffffff809db8f2 at devfs_ioctl+0xd2
#8 0xffffffff80c63092 at vn_ioctl+0xc2
#9 0xffffffff809dbfce at devfs_ioctl_f+0x1e
#10 0xffffffff80bce186 at kern_ioctl+0x286
#11 0xffffffff80bcde93 at sys_ioctl+0x143
#12 0xffffffff8105b473 at amd64_syscall+0x153
#13 0xffffffff8102d10b at fast_syscall_common+0xf8

I was able to reproduce this a second time, with some "luck" in timing.

Mar 27 2024, 11:36 PM
dev_submerge.ch added a comment to D44411: sound: Get rid of snd_clone and use DEVFS_CDEVPRIV(9).

My first round of tests was all good, no regressions so far. I still have to test mmap'ed operation, probably tomorrow.

Mar 27 2024, 4:54 PM

Mar 21 2024

dev_submerge.ch added a comment to D44411: sound: Get rid of snd_clone and use DEVFS_CDEVPRIV(9).

@dev_submerge.ch Also do you think setting the format SND_FORMAT(AFMT_U8, 1, 0) and the rate to DSP_DEFAULT_SPEED in dsp_open() is correct? They get overriden by the VCHAN settings anyway.

Mar 21 2024, 4:08 AM

Mar 19 2024

dev_submerge.ch added a comment to D44411: sound: Get rid of snd_clone and use DEVFS_CDEVPRIV(9).

@dev_submerge.ch Does this patch build on your machine?

Mar 19 2024, 11:02 PM

Mar 16 2024

dev_submerge.ch added a comment to D44084: snd_hdspe(4): Only buffer_copy() audio data once..
In D44084#1010276, @br wrote:

I'm still testing this, but I haven't found any problems in the last few days. It's hard to tell whether this approach is robust against missed interrupts, because I never encountered any.

Ruslan, does the calculation of position and length look reasonable to you? We have to store the playback writing position extra because we don't set it in the sndbuf structure.

looks ok to me, I have been testing this for about a week -- no issues

Mar 16 2024, 1:02 AM

Feb 26 2024

dev_submerge.ch added a comment to D44084: snd_hdspe(4): Only buffer_copy() audio data once..

I'm still testing this, but I haven't found any problems in the last few days. It's hard to tell whether this approach is robust against missed interrupts, because I never encountered any.

Feb 26 2024, 1:17 AM
dev_submerge.ch added a comment to D44051: snd_uaudio(4): Fix sample rate selection after 42fdcd9fd917..

I mean that it'd be more helpful to have a more descriptive message than " Implement sample rate selection in a more robust way".

Feb 26 2024, 1:00 AM
dev_submerge.ch requested review of D44084: snd_hdspe(4): Only buffer_copy() audio data once..
Feb 26 2024, 12:49 AM
dev_submerge.ch updated the summary of D44051: snd_uaudio(4): Fix sample rate selection after 42fdcd9fd917..
Feb 26 2024, 12:46 AM

Feb 25 2024

dev_submerge.ch added a comment to D44051: snd_uaudio(4): Fix sample rate selection after 42fdcd9fd917..

LGTM. The only thing I'd point out is that it would be better to have a brief description of the code in the commit message.

Feb 25 2024, 11:27 PM
dev_submerge.ch added inline comments to D43996: pcm.4: Fix lint warnings.
Feb 25 2024, 11:17 PM

Feb 24 2024

dev_submerge.ch added a comment to D44051: snd_uaudio(4): Fix sample rate selection after 42fdcd9fd917..

This passed some manual tests, setting hw.usb.uaudio.default_rate to different values, re-plug the uaudio device and try various sample rates (vchans disabled).

Feb 24 2024, 1:10 PM
dev_submerge.ch requested review of D44051: snd_uaudio(4): Fix sample rate selection after 42fdcd9fd917..
Feb 24 2024, 12:45 PM

Feb 17 2024

dev_submerge.ch updated the diff for D43798: snd_hdspe(4): Optional unified pcm device..

Correct man page regarding number of channels for HDSPe AIO cards.

Feb 17 2024, 7:39 PM
dev_submerge.ch added a comment to D43798: snd_hdspe(4): Optional unified pcm device..
In D43798#1002381, @br wrote:

This was tested with a HDSPe RayDAT. @br, could you at least test the analog outputs of the AIO? You probably need audio/jack or audio/virtual_oss to handle that many channels. Just ask me if you need help with the setup.

I have set hw.hdspe.unified_pcm=1 and tested playback mono (s32le:1.0) and stereo on Line output

help needed with jackit config to test this properly!

Feb 17 2024, 12:48 AM

Feb 14 2024

dev_submerge.ch added a comment to D43835: sched_setscheduler(2): Fix realtime privilege check.

Thanks for the article, Olivier - now that I know the extent of your project, I suspect it won't be MFC'd?
If that's the case it may be worth to get this minimal fix in right now, and MFC it to STABLE. The earlier this issue is fixed in all supported releases, the less workarounds in ports.

Feb 14 2024, 11:52 AM

Feb 13 2024

dev_submerge.ch added a comment to D43835: sched_setscheduler(2): Fix realtime privilege check.

The PRIV_SCHED_SETPOLICY and PRIV_SCHED_SET privileges are inconsistent with some other places and can be circumvented. Additionally, I don't think they serve any real security purposes (beyond what PRIV_SCHED_RTPRIO and PRIV_SCHED_IDPRIO can provide).

Feb 13 2024, 5:18 PM

Feb 11 2024

dev_submerge.ch added a comment to D43835: sched_setscheduler(2): Fix realtime privilege check.

Taken here from PR 276962.

Feb 11 2024, 3:47 PM
dev_submerge.ch requested review of D43835: sched_setscheduler(2): Fix realtime privilege check.
Feb 11 2024, 3:08 PM

Feb 10 2024

dev_submerge.ch accepted D43812: mixer(3): Do not hardcode "/dev/mixer".
Feb 10 2024, 5:02 PM
dev_submerge.ch accepted D43809: mixer(8): Use new mixer if we change the default unit.

Definitely an improvement, the previous behavior was confusing.

Feb 10 2024, 5:02 PM
dev_submerge.ch accepted D43796: mixer(8): Improve mute and recsrc controls.
Feb 10 2024, 12:34 AM
dev_submerge.ch accepted D43795: mixer.8: Fix wrong sentence.
Feb 10 2024, 12:32 AM
dev_submerge.ch accepted D43794: mixer(8): Allow full PCM device names as input for the -d option.
Feb 10 2024, 12:32 AM
dev_submerge.ch accepted D43793: mixer(8): Improve error messsages and warnings.
Feb 10 2024, 12:29 AM

Feb 9 2024

dev_submerge.ch accepted D43649: snd_uaudio.4: document sysctls.
Feb 9 2024, 11:17 PM
dev_submerge.ch added a comment to D43649: snd_uaudio.4: document sysctls.

One last thing, sorry for the mess of inline comments.

Feb 9 2024, 7:15 PM
dev_submerge.ch added a comment to D43793: mixer(8): Improve error messsages and warnings.

Just some random testing, with no pcm devices I get:

# mixer -a
mixer: mixer_get_nmixers(): No error: 0
# mixer
mixer: mixer_open((null)): No error: 0

This case could be handled with a less cryptic message.

Feb 9 2024, 7:01 PM
dev_submerge.ch added a comment to D43798: snd_hdspe(4): Optional unified pcm device..

This was tested with a HDSPe RayDAT. @br, could you at least test the analog outputs of the AIO? You probably need audio/jack or audio/virtual_oss to handle that many channels. Just ask me if you need help with the setup.

Feb 9 2024, 2:22 AM
dev_submerge.ch added a comment to D43649: snd_uaudio.4: document sysctls.

Ok, hopefully last round of comments from my side :-)

Feb 9 2024, 2:05 AM
dev_submerge.ch requested review of D43798: snd_hdspe(4): Optional unified pcm device..
Feb 9 2024, 12:17 AM

Feb 7 2024

dev_submerge.ch added inline comments to D43649: snd_uaudio.4: document sysctls.
Feb 7 2024, 8:05 PM

Feb 6 2024

dev_submerge.ch added a comment to D43767: snd_uaudio: skip duplicate configurations.

Integrated into D43679. The parameter iteration shouldn't produce duplicate entries anymore.

Feb 6 2024, 11:52 PM
dev_submerge.ch updated the diff for D43679: snd_uaudio(4): Fix config detection with defaults set..

Moved the special treatment of USB 1.1 devices up to where the USB bus speed is
queried. This should clarify the intent to only detect more than 4 channels if
the default_channels is set to a higher value.

Feb 6 2024, 11:44 PM
dev_submerge.ch added a comment to D43649: snd_uaudio.4: document sysctls.

Sorry this took some time, but here is a list of info I'd want to have in the man page if I was an end user.
Be specific about when these settings are helpful. We don't want users to set them unnecessarily, due to possible side effects on other uaudio devices.

Feb 6 2024, 3:24 PM
dev_submerge.ch added a comment to D43767: snd_uaudio: skip duplicate configurations.

The only case here is a duplicate sample rate, right?

For my device yeah, but I'm not sure if more sophisticated devices would print configs with multiple different channels or bits, which is why I added a check for channels and bits as well.

I'm uneasy to do this in the descriptor loop (why?).
I think it's much simpler and less invasive to integrate this with the changes in D43679. Would that be ok for you? I'll update it anyway today.

We could add an inner loop in uaudio_chan_fill_info() indeed. The reason I did it in the descriptor loop was so that we only check against valid values (the loop is placed after we've made sure the rate/channel/bit config is supported), whereas in uaudio_chan_fill_info() we'd get check against non-supported values as well.

That being said, even if we move the loop in uaudio_chan_fill_info(), I think it's better to have 2 separate patches as these patches are not directly related.

Feb 6 2024, 12:27 PM
dev_submerge.ch accepted D43766: snd_uaudio: mark selected configurations.

Not opposed to this, just note that it may be of limited value. The sample rate can effectively change at runtime, see uaudio_chan_set_param_speed().

Yeap, but that's still better than the current out-of-context dump, which requires one to have read the code to understand which config is selected. After all, this is printed during attach so it's expected that this reflects the state of the device during attach, and not runtime.

Feb 6 2024, 12:21 PM
dev_submerge.ch added a comment to D43767: snd_uaudio: skip duplicate configurations.

The only case here is a duplicate sample rate, right? I'm uneasy to do this in the descriptor loop (why?).

Feb 6 2024, 11:54 AM
dev_submerge.ch added a comment to D43766: snd_uaudio: mark selected configurations.

Not opposed to this, just note that it may be of limited value. The sample rate can effectively change at runtime, see uaudio_chan_set_param_speed().

Feb 6 2024, 11:47 AM

Feb 4 2024

dev_submerge.ch added inline comments to D43679: snd_uaudio(4): Fix config detection with defaults set..
Feb 4 2024, 3:28 PM
dev_submerge.ch added a comment to D43679: snd_uaudio(4): Fix config detection with defaults set..

An example: My RME BabyFace has a 10 in 12 out channel configuration, and a 2 in 2 out channel configuration. Let's say I want to use the 2 in 2 out configuration because most audio applications cannot cope with 12 channels, and I can't route everything through Jack. I also have an SPL Crimson, 6 in 6 out. And I have a Focusrite Scarlett 18 in 20 out.

Current implementation: If I set default_channels=2, only the BabyFace is detected. I can set default_channels=6, and then I get both the BabyFace and the Crimson. But no way to use the Scarlett at the same time.

My proposal: I can set default_channels=2, and get all of them detected correctly. Caveat: Any other uaudio device with a 2 channel configuration will have that configuration selected.

We may need to make these sysctls per-device instead of global. I can take care of this if we agree to go ahead with it.

Feb 4 2024, 3:08 PM
dev_submerge.ch added a comment to D43679: snd_uaudio(4): Fix config detection with defaults set..

If the defaults can only take values between a certain range (i.e channels can be up to 64 and bits up to 32), and this patch also allows the driver to detect configs with higher values than the default, why don't we just start from the maximum value for both channels and bits instead of doing this hack, since we know that the default_*s are going to fall into those ranges anyway? Since in the iteration we try all possible combinations, we know that one of the configurations will end up being what the user would have defined using the defaults. This way we might not even need those controls at all. Also, following the same logic, do we need default_rate if the driver will only create channels for supported rates?

Correct me if I am missing something here, but I don't see where else those tunable values are used except in uaudio_chan_fill_info() which seems to search for and create configs for all supported channel/bits/rate combinations, and just includes a case where it tests if the user-supplied value is supported.

Feb 4 2024, 1:52 AM

Jan 31 2024

dev_submerge.ch added a comment to D43649: snd_uaudio.4: document sysctls.

Have a look at D43679 - that should make documentation of default_bits and default_channels easier.

Jan 31 2024, 4:23 PM
dev_submerge.ch added a comment to D43679: snd_uaudio(4): Fix config detection with defaults set..

Not very elegant, but the whole iteration method here is somewhat crude. The default_rate sysctl already acts like a default, and does not prevent other sample rates from the list. Leave it unchanged.

Jan 31 2024, 4:14 PM
dev_submerge.ch requested review of D43679: snd_uaudio(4): Fix config detection with defaults set..
Jan 31 2024, 3:50 PM
dev_submerge.ch added a comment to D43545: sound: Implement asynchronous device detach.

As communicated in private, the latest update to this change fixes all kernel panics and witness complaints.

Jan 31 2024, 3:33 PM

Jan 30 2024

dev_submerge.ch added a comment to D43649: snd_uaudio.4: document sysctls.

Now that I think about it, the "default_" prefix is kind of misleading. These variables act like a ceiling value, so maybe we should rename them to "max_"? snd_uaudio configures the channels, rate and bits by searching in descending order either from the default_ value or the maximum defined in the source code.

I think the default_ sysctl knobs would be more useful (and easier to document) if they actually acted like defaults. Would it be an option to improve the implementation in that way and handle them separately from the buffer_ms case?

Can you elaborate on what you mean by "separately"?

Jan 30 2024, 5:19 PM
dev_submerge.ch added a comment to D43649: snd_uaudio.4: document sysctls.

Now that I think about it, the "default_" prefix is kind of misleading. These variables act like a ceiling value, so maybe we should rename them to "max_"? snd_uaudio configures the channels, rate and bits by searching in descending order either from the default_ value or the maximum defined in the source code.

Jan 30 2024, 4:52 PM
dev_submerge.ch added a comment to D43545: sound: Implement asynchronous device detach.

Unfortunately I still get the kernel panic when I pull the USB plug, see inline comments.

Jan 30 2024, 2:50 PM
dev_submerge.ch added a comment to D43545: sound: Implement asynchronous device detach.

The case without pulling the plug first: When I stop Jack, there's no kernel panic now, but I get the following messages:

Jan 30 13:59:09 current kernel: exclusive sleep mutex clone lock (clone manager) r = 0 (0xfffff8011ac4d2e0) locked @ /usr/src/sys/dev/sound/clone.c:390
Jan 30 13:59:09 current kernel: stack backtrace:
Jan 30 13:59:09 current kernel: #0 0xffffffff80bc7c15 at witness_debugger+0x65
Jan 30 13:59:09 current kernel: #1 0xffffffff80bc8d79 at witness_warn+0x3e9
Jan 30 13:59:09 current kernel: #2 0xffffffff80adf0fe at destroy_dev+0x1e
Jan 30 13:59:09 current kernel: #3 0xffffffff80885823 at snd_clone_gc+0x223
Jan 30 13:59:09 current kernel: #4 0xffffffff80885b82 at snd_clone_unref+0x52
Jan 30 13:59:09 current kernel: #5 0xffffffff808cf44b at dsp_close+0x73b
Jan 30 13:59:09 current kernel: #6 0xffffffff809db9bf at devfs_close+0x48f
Jan 30 13:59:09 current kernel: #7 0xffffffff8112e002 at VOP_CLOSE_APV+0x32
Jan 30 13:59:09 current kernel: #8 0xffffffff80c640a0 at vn_close1+0x100
Jan 30 13:59:09 current kernel: #9 0xffffffff80c626af at vn_closefile+0x3f
Jan 30 13:59:09 current kernel: #10 0xffffffff809dc37b at devfs_close_f+0x2b
Jan 30 13:59:09 current kernel: #11 0xffffffff80aece5b at _fdrop+0x1b
Jan 30 13:59:09 current kernel: #12 0xffffffff80af06c3 at closef+0x1e3
Jan 30 13:59:09 current kernel: #13 0xffffffff80af45e6 at closefp_impl+0x76
Jan 30 13:59:09 current kernel: #14 0xffffffff81058463 at amd64_syscall+0x153
Jan 30 13:59:09 current kernel: #15 0xffffffff8102ab1b at fast_syscall_common+0xf8
Jan 30 2024, 2:39 PM
dev_submerge.ch added a comment to D41942: snd_uaudio(4): Adapt buffer length to buffer_ms tunable..

Interesting. I just tested, and if I boot my machine while interface is on, kld_list and buffer_ms together do the trick. I mean, jack_iodelay reports exactly same latency as if I loaded the module, set buffer_ms and then turned on the interface. Maybe my interface is slow to respond initially, so sysctl has time to kick in?

Jan 30 2024, 3:11 AM · multimedia
dev_submerge.ch added a comment to D43649: snd_uaudio.4: document sysctls.

Thanks for picking this up, @christos.

Jan 30 2024, 2:18 AM

Jan 29 2024

dev_submerge.ch requested review of D43659: snd_hdspe(4): Per device sysctl for sample rate..
Jan 29 2024, 11:48 PM

Jan 28 2024

dev_submerge.ch added a comment to D43545: sound: Implement asynchronous device detach.

FYI, if I disable vchans on the device, the mutex clone kernel panic also occurs when I just stop Jack as usual. Without forcing a device detach by pulling the USB plug. It seems like the mutex owner assertions in snd_clone_wakeup() are violated even without running the pcm_unregister() code first. Hope this helps.

Jan 28 2024, 11:40 PM
dev_submerge.ch added a comment to D41942: snd_uaudio(4): Adapt buffer length to buffer_ms tunable..

@christos: Thanks! Since @mav didn't participate here, would someone else be so kind to commit this? Unless there's other issues that weren't brought up yet.

Jan 28 2024, 3:51 PM · multimedia

Jan 27 2024

dev_submerge.ch added a comment to D43527: snd_hdspe(4): Per device sysctl for period..

Could you commit it if there are no other issues? Thank you!

Jan 27 2024, 2:17 PM
dev_submerge.ch added a comment to D41942: snd_uaudio(4): Adapt buffer length to buffer_ms tunable..

I didn't answer about re-plugging. No, the interface is always connected and I don't touch the cables.

Jan 27 2024, 2:02 PM · multimedia