Page MenuHomeFreeBSD
Feed Advanced Search

Dec 5 2024

dev_submerge.ch added a comment to D47917: sound: Allocate vchans on-demand.

Some notes:

  • I would like a different name than hw.snd.maxautovchans since the functionality is different now. Maybe hw.snd.vchans? That would break compatibility though. In any case, I will add a RELNOTES entry when it's time to commit.
Dec 5 2024, 2:08 AM

Dec 3 2024

dev_submerge.ch added a comment to D47868: sound: Clean up pcm/ includes.

I have to admit the centralization through sound.h goes against my intuition - usually I would only include what is needed, where it's actually used. While this change reduces the number of includes, it makes it even harder to see the dependencies and layers in the sound module. But that's just my opinion, I suppose @markj and @emaste may be the better judges in this case.

While I kind of agree, I notice that some of the includes are simply repeated over and over, so IMHO it's better to just have them in one place. After all, we include pcm/sound.h everywhere anyway. Regarding dependencies and layering, I intentionally excluded pcm/sndstat.c-specific includes since they are not needed anywhere else, as well the foo_if.h ones, which I kept/moved to their respective header files.

Dec 3 2024, 1:11 PM
dev_submerge.ch added a comment to D47868: sound: Clean up pcm/ includes.

I have to admit the centralization through sound.h goes against my intuition - usually I would only include what is needed, where it's actually used. While this change reduces the number of includes, it makes it even harder to see the dependencies and layers in the sound module. But that's just my opinion, I suppose @markj and @emaste may be the better judges in this case.

Dec 3 2024, 12:40 PM

Nov 28 2024

dev_submerge.ch accepted D47780: sound: Do not access cv_waiters.
Nov 28 2024, 9:57 AM

Nov 27 2024

dev_submerge.ch added a comment to D47736: sound: Dissolve pcm/intpcm.h.

If we do further work on the conversion functions, we may want to unit test them. Is that possible when we integrate them in feeder_format.c? I suppose a separate header would be easier, less extra dependencies?

Perhaps it could be useful, but I think it's better to first decide on the design and then implement the new header. I would like to somehow avoid the macro magic. :)

Nov 27 2024, 4:58 PM
dev_submerge.ch accepted D47737: sound: Merge pcm/matrix_map.h with pcm/matrix.h.
Nov 27 2024, 11:24 AM
dev_submerge.ch added a comment to D47736: sound: Dissolve pcm/intpcm.h.

If we do further work on the conversion functions, we may want to unit test them. Is that possible when we integrate them in feeder_format.c? I suppose a separate header would be easier, less extra dependencies?

Nov 27 2024, 11:22 AM
dev_submerge.ch accepted D47734: sound: Remove unused code from pcm/g711.h.
Nov 27 2024, 11:12 AM
dev_submerge.ch accepted D47733: sound: Remove dead code from pcm/.

I'm fine with the removal. Although it would be interesting to know more about some of the disabled code, it's probably not worth the effort to examine thoroughly.

Nov 27 2024, 11:05 AM

Nov 26 2024

dev_submerge.ch updated the diff for D47412: snd_hdspe(4): Add sysctls to select analog signal levels..

Switch input level flags according to test findings by @br. Setting "LowGain"
on the input level should now match the signal level of "HighGain" outputs.

Nov 26 2024, 1:25 PM

Nov 25 2024

dev_submerge.ch added a comment to D47412: snd_hdspe(4): Add sysctls to select analog signal levels..

Also I suspect the input signal levels to be backwards now, please report your findings. The recorded signal should be loudest for "-10dBV" and quietest with "LowGain".

Nov 25 2024, 2:37 PM
dev_submerge.ch added a comment to D47412: snd_hdspe(4): Add sysctls to select analog signal levels..
In D47412#1088444, @br wrote:

I'm now able to set -10dBV and +4dBu, but could not set HighGain. So I guess there is an off-by-one error somewhere...

Nov 25 2024, 2:25 PM
dev_submerge.ch updated the diff for D47412: snd_hdspe(4): Add sysctls to select analog signal levels..

Fix condition to set the signal level in the settings register on change
requests, it checked the control register by mistake. This was a leftover from
the hdsp.c code that was copied here, sorry about that.

Nov 25 2024, 1:54 PM

Nov 24 2024

dev_submerge.ch accepted D47461: sound: Fix chn_trigger() and vchan_trigger() races.
Nov 24 2024, 8:21 PM
dev_submerge.ch added a comment to D47461: sound: Fix chn_trigger() and vchan_trigger() races.

LGTM - seems also easier to reason about the code now, at least to me.

Nov 24 2024, 8:02 PM
dev_submerge.ch accepted D47462: sound: Fix hot-unload panics.
Nov 24 2024, 7:46 PM

Nov 21 2024

dev_submerge.ch added inline comments to D47462: sound: Fix hot-unload panics.
Nov 21 2024, 9:41 PM
dev_submerge.ch added a comment to D47459: snd_dummy: Fix callout(9) races.

On a related note, shouldn't dummy_chan_io() only reschedule itself when one of the channels is running? Whereas we indiscriminately stop the callout for both channels if one of them is stopped, even if the other would be still running? Or maybe I have a misconception about the callout handling.

Nov 21 2024, 9:14 PM

Nov 20 2024

dev_submerge.ch added a comment to D47412: snd_hdspe(4): Add sysctls to select analog signal levels..
In D47412#1086254, @br wrote:

On the "-10dbV" problem I could suggest to rename this to "minus10dbv" (and "plus4dbu as well).

Nov 20 2024, 2:17 PM
dev_submerge.ch updated the diff for D47412: snd_hdspe(4): Add sysctls to select analog signal levels..

Fix the signal level flags which were backwards, with the loudest setting (high
gain) resulting in a quiet signal and vice versa.

Nov 20 2024, 1:59 PM

Nov 19 2024

dev_submerge.ch added inline comments to D47665: sound: Add initial sanity check in pcm_unregister().
Nov 19 2024, 1:28 PM
dev_submerge.ch accepted D47664: sound: Remove unused CHN_F_SILENCE.
Nov 19 2024, 1:27 PM
dev_submerge.ch added a comment to D47639: beep(1): Use AFMT_FLOAT.

The reason this program exists is to provide a console beep (^G) in the absence of a PC speaker (with a bit more plumbing). At the end of the day even for that use performance isn't really going to matter -- but also the docs recommend against using AFMT_FLOAT.

I can see that this is useful for testing the kernel support, though.

I am aware that they do advise against using AFMT_FLOAT, however the whole program does everything in AFMT_FLOAT, so it seems quite counter-intuitive to me that we convert to AFMT_S32_LE just before the write(2), when we now have support for AFMT_FLOAT.

Nov 19 2024, 1:19 AM
dev_submerge.ch added inline comments to D47638: sound: Implement AFMT_FLOAT support.
Nov 19 2024, 12:43 AM

Nov 17 2024

dev_submerge.ch added a comment to D47638: sound: Implement AFMT_FLOAT support.

Very welcome, thanks for tackling this @christos. Please note that there are sound cards supporting float format, and I intend to experiment with that some time in the future (probably needs bitperfect for now).

Nov 17 2024, 2:38 PM

Nov 16 2024

dev_submerge.ch accepted D47559: sound: Remove CHN_F_SLEEPING.
Nov 16 2024, 7:47 PM
dev_submerge.ch added a comment to D47462: sound: Fix hot-unload panics.

The refactored implementation of pcm_killchans() relies on the SD_F_REGISTERED flag (unset) to prevent addition of new channels, right? Should we make this explicit via assert or a comment?

While it wouldn't do any harm to assert that !PCM_REGISTERED, I do not really think it's necessary, since pcm_killchans() is only called from pcm_unregister() once we clear the flag.

Nov 16 2024, 7:38 PM
dev_submerge.ch added inline comments to D47461: sound: Fix chn_trigger() and vchan_trigger() races.
Nov 16 2024, 7:24 PM

Nov 14 2024

dev_submerge.ch accepted D47463: sound: Remove PCM_DETACHING(), SD_F_DETACHING and SD_F_DYING.
Nov 14 2024, 8:52 PM
dev_submerge.ch added a comment to D47462: sound: Fix hot-unload panics.

The refactored implementation of pcm_killchans() relies on the SD_F_REGISTERED flag (unset) to prevent addition of new channels, right? Should we make this explicit via assert or a comment?

Nov 14 2024, 8:48 PM
dev_submerge.ch added inline comments to D47461: sound: Fix chn_trigger() and vchan_trigger() races.
Nov 14 2024, 8:22 PM
dev_submerge.ch accepted D47459: snd_dummy: Fix callout(9) races.
Nov 14 2024, 6:34 PM

Nov 7 2024

dev_submerge.ch added a comment to D47325: sound: Make device registration more intuitive.

Yeah, sorry, I forgot about the out-of-tree modules too. The most important ones are probably HDMI audio devices from graphics modules (intel, radeon, amd, nvidia). What are the CURRENT pkg builds based on?

Nov 7 2024, 6:29 PM

Nov 6 2024

dev_submerge.ch added a comment to D47462: sound: Fix hot-unload panics.

@dev_submerge.ch Can you also test whether this patch along with all the other patches applied (D47459, D47460, D47461, D47463) fix the hot-unload (or any other) panics?

Nov 6 2024, 4:22 PM

Nov 3 2024

dev_submerge.ch added a comment to D47412: snd_hdspe(4): Add sysctls to select analog signal levels..
In D47412#1081377, @br wrote:

Great work, thanks!

I managed to switch phone level to +4dBU and then to HighGain, but could not switch back to -10dBV which was default

0 pie:/home/br %sudo sysctl dev.hdspe.0.phones_level=+4dbU
dev.hdspe.0.phones_level: -10dBV -> +4dBu

0 pie:/home/br %sudo sysctl dev.hdspe.0.phones_level=HighGain
dev.hdspe.0.phones_level: +4dBu -> HighGain

0 pie:/home/br %sudo sysctl dev.hdspe.0.phones_level=+4dBU
dev.hdspe.0.phones_level: HighGain -> +4dBu

Fail:
0 pie:/home/br %sudo sysctl dev.hdspe.0.phones_level=-10dBV
dev.hdspe.0.phones_level: +4dBu -> +4dBu
Nov 3 2024, 6:49 PM
dev_submerge.ch updated the diff for D47412: snd_hdspe(4): Add sysctls to select analog signal levels..

Fixed a typo in the man page.

Nov 3 2024, 2:29 PM
dev_submerge.ch added a comment to D47412: snd_hdspe(4): Add sysctls to select analog signal levels..

@br: This is the equivalent of D47330 for HDSPe AIO, as promised. Could you test it on real hardware (see test plan)? Please check that the default levels are safe, they should always be the most quiet.

Nov 3 2024, 2:25 PM
dev_submerge.ch updated the test plan for D47412: snd_hdspe(4): Add sysctls to select analog signal levels..
Nov 3 2024, 2:16 PM
dev_submerge.ch requested review of D47412: snd_hdspe(4): Add sysctls to select analog signal levels..
Nov 3 2024, 2:11 PM

Oct 31 2024

dev_submerge.ch accepted D47360: sound: Remove unused pcm_channel->data fields.
Oct 31 2024, 7:29 PM

Oct 30 2024

dev_submerge.ch accepted D47325: sound: Make device registration more intuitive.

Not in scope for this patch, but pcm_addchan() may return an error and I wonder whether / how the drivers should handle this error case?

Oct 30 2024, 10:18 AM
dev_submerge.ch accepted D47324: sound: Remove early SD_F_SIMPLEX and SD_F_AUTOVCHAN assignments.
Oct 30 2024, 9:47 AM
dev_submerge.ch accepted D47323: sound: Move sndstat_register() call to pcm_setstatus().
Oct 30 2024, 9:39 AM
dev_submerge.ch accepted D47322: sound: Move sysctl and /dev/dspX creation to pcm_setstatus().
Oct 30 2024, 9:39 AM
dev_submerge.ch accepted D47280: sound: Retire pcm_veto_load.
Oct 30 2024, 9:38 AM

Oct 29 2024

dev_submerge.ch added a comment to D47325: sound: Make device registration more intuitive.

Update arm drivers as well.

Oct 29 2024, 5:20 PM
dev_submerge.ch added a comment to D47325: sound: Make device registration more intuitive.

What about the sound drivers under sys/arm? They seem to still reference pcm_setstatus(), did I miss something?

Oct 29 2024, 4:50 PM
dev_submerge.ch added a comment to D47330: snd_hdsp(4): Add sysctls to select analog signal levels..

@br: If this patch is ok, I'll also adapt it to the HDSPe AIO in snd_hdspe(4) for you to test. Looks like it uses a different register though.

Oct 29 2024, 3:06 PM
dev_submerge.ch updated the test plan for D47330: snd_hdsp(4): Add sysctls to select analog signal levels..
Oct 29 2024, 3:02 PM
dev_submerge.ch requested review of D47330: snd_hdsp(4): Add sysctls to select analog signal levels..
Oct 29 2024, 2:32 PM

Oct 24 2024

dev_submerge.ch accepted D47269: sound: Retire channel refcount.
Oct 24 2024, 5:37 PM
dev_submerge.ch accepted D47268: sound: Remove redundant refcount checks in vchan_setnew().
Oct 24 2024, 5:36 PM
dev_submerge.ch accepted D47199: sound: Untangle dsp_cdevs[] and dsp_unit2name() confusion.
Oct 24 2024, 11:25 AM
dev_submerge.ch added a comment to D47199: sound: Untangle dsp_cdevs[] and dsp_unit2name() confusion.

So is the patch good to go?

Oct 24 2024, 10:58 AM

Oct 23 2024

dev_submerge.ch added a comment to D47199: sound: Untangle dsp_cdevs[] and dsp_unit2name() confusion.

@emaste: Thanks for the clarification on style(9)'s FALLTHROUGH part.

Oct 23 2024, 12:38 AM

Oct 22 2024

dev_submerge.ch added inline comments to D47199: sound: Untangle dsp_cdevs[] and dsp_unit2name() confusion.
Oct 22 2024, 2:55 PM
dev_submerge.ch added inline comments to D47199: sound: Untangle dsp_cdevs[] and dsp_unit2name() confusion.
Oct 22 2024, 2:21 PM
dev_submerge.ch added inline comments to D47199: sound: Untangle dsp_cdevs[] and dsp_unit2name() confusion.
Oct 22 2024, 2:13 PM
dev_submerge.ch accepted D47195: sound: Call DSP_REGISTERED before PCM_DETACHING.
Oct 22 2024, 11:28 AM
dev_submerge.ch accepted D47198: sound: Change PCMDIR_* numbering.
Oct 22 2024, 11:26 AM
dev_submerge.ch added inline comments to D47199: sound: Untangle dsp_cdevs[] and dsp_unit2name() confusion.
Oct 22 2024, 11:25 AM

Oct 20 2024

dev_submerge.ch added a comment to D47199: sound: Untangle dsp_cdevs[] and dsp_unit2name() confusion.

This simplifies the code quite a bit, nice! Some nitpicks in the inline comments.

Oct 20 2024, 9:13 PM
dev_submerge.ch added inline comments to D47195: sound: Call DSP_REGISTERED before PCM_DETACHING.
Oct 20 2024, 8:02 PM
dev_submerge.ch added a comment to D47198: sound: Change PCMDIR_* numbering.

Could this be turned into an enum, to facilitate compiler checks in switch() statements? Or is there a policy on using enums in src? I see them far less often than I would expect.

Oct 20 2024, 7:22 PM
dev_submerge.ch accepted D47196: sound: Use DSP_REGISTERED in dsp_clone().
Oct 20 2024, 7:08 PM

Oct 18 2024

dev_submerge.ch added inline comments to D46418: mididump(1): Initial revision.
Oct 18 2024, 6:57 PM

Oct 17 2024

dev_submerge.ch accepted D46836: sound: Shorten channel names.

The "name" field was meant as a descriptive label before, now it's a copy of an internal identifier that looks like a device path but isn't. It's not obvious to me whether you want to unify it with dsp_unit2name() everywhere or not. And without knowing all uses it's hard to tell whether that's a good idea.

I think we are missing the point a bit. The only change this patch brings is that it omits redundant information; the label is still equally descriptive. I do not get what the point of contention is exactly...

Oct 17 2024, 1:56 PM

Oct 16 2024

dev_submerge.ch added a comment to D46836: sound: Shorten channel names.
  1. What is the intended meaning of the "name" field? It was sort of descriptive before, but now you're tying it to the device path.

As mentioned before, the meaning remains exactly the same.

Oct 16 2024, 7:52 PM

Oct 14 2024

dev_submerge.ch added a comment to D46836: sound: Shorten channel names.

I don't care too much about the device names, but I think we should conceptually separate them from what we display to the end user. As a future goal we may want to have something more elaborate in the OSS audio info name field, e.g. dsp.virtual_play.1 <Dummy Audio Device>.

I agree with printing something more elaborate, although I'd prefer a different naming scheme than this one. But we can discuss it in the future. :-)

You are changing the content of the name field here. We have to assess where and what it is used for. As I try to explain, the different use cases may demand different formatting and content, thus I want to know what we cater to here.

From a quick GitHub search on SNDCTL_ENGINEINFO (which is what will populate oss_audioinfo with the channel name), what I see is that this field is not used much, and where it is used, it's not only for printing it later on, so there shouldn't be any problem. Note that up until e07f9178502b, SNDCTL_AUDIOINFO and SNDCTL_ENGINEINFO were the same thing, so I think that if there was a breakage to happen by changing the name field, we'd have run into trouble already. Also, the change I'm proposing includes the same information in the channel's name, just with less redundancy.

Oct 14 2024, 12:13 PM

Oct 13 2024

dev_submerge.ch added a comment to D46847: sound: Fix hot-unload page fault.

I just put your reproduce code into a shell script. Setup is a bhyve VM, 4 cores, pcm0 is a passthrough USB audio interface, script operates on pcm1 which is snd_dummy as in your example.

I tried this exact scenario, but still cannot reproduce the panic after multiple times of running the script. Is there some non-default configuration you're using?

Oct 13 2024, 7:10 PM
dev_submerge.ch accepted D46857: sound: Improve /dev/sndstat channel info readability.

I suppose I'll never get used to 8-width indents ;-)
Anyway, for me this is good to go, thanks!

Oct 13 2024, 6:54 PM

Oct 4 2024

dev_submerge.ch added a comment to D46946: snd_hdspe(4): Addendum to AO4S-192 and AI4S-192 support..

@br: I'll leave it up to you whether you want to squash this together with D46409 or make them separate commits.

Oct 4 2024, 6:10 PM
dev_submerge.ch added a comment to D46409: hdspe: AO4S/AI4S support.
In D46409#1069049, @br wrote:

{F97460426}

This would be my proposed fix for the unified pcm device mode, plus some man page amendments.

@br, could you have a look and integrate this patch with yours if you agree with it? It's a git patch, apply with git am and then squash. Since I cannot test it without the hardware, could you please also try to enable the unified pcm mode?

we could just commit the patches for different cards separately so preserve authors of patches. I can test unified PCB but not very soon

Oct 4 2024, 6:06 PM
dev_submerge.ch requested review of D46946: snd_hdspe(4): Addendum to AO4S-192 and AI4S-192 support..
Oct 4 2024, 6:04 PM
dev_submerge.ch added a comment to D46836: sound: Shorten channel names.

I don't care too much about the device names, but I think we should conceptually separate them from what we display to the end user. As a future goal we may want to have something more elaborate in the OSS audio info name field, e.g. dsp.virtual_play.1 <Dummy Audio Device>.

I agree with printing something more elaborate, although I'd prefer a different naming scheme than this one. But we can discuss it in the future. :-)

Oct 4 2024, 2:15 PM
dev_submerge.ch added a comment to D46857: sound: Improve /dev/sndstat channel info readability.

I'd prefer a smaller indent, maybe 2 spaces instead of the 8 space standard tabs, also for the first indent level. As is, the lines regularly exceed 80 character screen width and break the visual indent with the overflow.
But this is already an improvement, thanks!

The 80 characters will be easily exceeded by the feeder lines even with 2 spaces for all indent levels. I do not really have a big objection to using 2-space indentation, but I do think the 1-tab one looks cleaner.

Oct 4 2024, 2:05 PM
dev_submerge.ch added a comment to D46847: sound: Fix hot-unload page fault.

Interesting. What do you do exactly to reproduce those? Also what is the configuration you're using?

Oct 4 2024, 1:56 PM
dev_submerge.ch added a comment to D46836: sound: Shorten channel names.

I don't care too much about the device names, but I think we should conceptually separate them from what we display to the end user. As a future goal we may want to have something more elaborate in the OSS audio info name field, e.g. dsp.virtual_play.1 <Dummy Audio Device>. And for /dev/sndstat we could also add the "play", "record" and "virtual" in the buffer printing there, without changing the device names.

Oct 4 2024, 1:07 AM
dev_submerge.ch accepted D46845: sound: Use M_WAITOK where possible.
Oct 4 2024, 12:36 AM
dev_submerge.ch accepted D46857: sound: Improve /dev/sndstat channel info readability.

I'd prefer a smaller indent, maybe 2 spaces instead of the 8 space standard tabs, also for the first indent level. As is, the lines regularly exceed 80 character screen width and break the visual indent with the overflow.
But this is already an improvement, thanks!

Oct 4 2024, 12:33 AM
dev_submerge.ch added a comment to D46847: sound: Fix hot-unload page fault.

Unfortunately, I get a slightly different panic with this patch installed:

Oct 4 2024, 12:13 AM

Oct 3 2024

dev_submerge.ch added a comment to D46847: sound: Fix hot-unload page fault.

For the records, I consistently get a different panic when reproducing this (without the patch):

Oct 3 2024, 11:47 PM

Sep 29 2024

dev_submerge.ch added a comment to D46836: sound: Shorten channel names.

If I'm not mistaken, this name field corresponds to the name entry in the SNDCTL_AUDIOINFO ioctl. OSSv4 defines it as follows:

Sep 29 2024, 5:33 PM
dev_submerge.ch accepted D46846: sound: Do not check for NULL if sbuf is allocated with SBUF_AUTOEXTEND.
Sep 29 2024, 4:43 PM
dev_submerge.ch added a comment to D46845: sound: Use M_WAITOK where possible.

LGTM, I suppose this is save when called through SYSINIT?

Sep 29 2024, 4:33 PM
dev_submerge.ch accepted D46844: sound: Do not cast return value of malloc(9).
Sep 29 2024, 4:25 PM
dev_submerge.ch added a comment to D46836: sound: Shorten channel names.

This makes sysctl hw.snd.verbose=2; cat /dev/sndstat harder to read, and we lose the ability to grep for play, record and virtual there. Also I think this is shown verbatim in GUIs like VLC, do we expect normal users to understand the subtle notion of [v]p|r?

Sep 29 2024, 4:20 PM
dev_submerge.ch accepted D46835: sound: Simplify channel creation and deletion process.
Sep 29 2024, 3:49 PM
dev_submerge.ch accepted D46834: sound: Remove useless newspd check in sysctl_dev_pcm_vchanrate().
Sep 29 2024, 3:08 PM
dev_submerge.ch accepted D46833: sound: Simplify vchan_create() error paths.
Sep 29 2024, 2:47 PM
dev_submerge.ch accepted D46821: sound: Move root feeder initialization to separate function.
Sep 29 2024, 2:40 PM
dev_submerge.ch added a comment to D46409: hdspe: AO4S/AI4S support.

This would be my proposed fix for the unified pcm device mode, plus some man page amendments.

Sep 29 2024, 12:47 PM

Sep 28 2024

dev_submerge.ch added a comment to D46409: hdspe: AO4S/AI4S support.
In D46409#1063484, @br wrote:

I will write the HDSP equivalent and add the missing unified pcm device part there, for comparison. Hopefully this weekend.

I don't have recording equipment to check but I assume yes.
sounds good

Sep 28 2024, 6:37 PM
dev_submerge.ch added a comment to D46837: snd_hdsp(4): Support AO4S-192 and AI4S-192 extension boards..

This implements extension board support for snd_hdsp(4), similar to D46409 for snd_hdspe(4).

Sep 28 2024, 6:28 PM
dev_submerge.ch updated the test plan for D46837: snd_hdsp(4): Support AO4S-192 and AI4S-192 extension boards..
Sep 28 2024, 6:24 PM
dev_submerge.ch requested review of D46837: snd_hdsp(4): Support AO4S-192 and AI4S-192 extension boards..
Sep 28 2024, 6:20 PM
dev_submerge.ch accepted D46715: snd_dummy: Drain callout during detach.
Sep 28 2024, 4:37 PM
dev_submerge.ch accepted D46680: sound: Use unr(9) to produce unique channel unit numbers.

@dev_submerge.ch Any comments? As I mention in the commit message, wanting to sort in descending order (and as a result, breaking the mechanism proposed in D46550) is highly unlikely, but I think it's good to be on the safe side.

Using existing KPI is a plus, but the *_unr() is quite complex. It introduces another mutex and additional allocations in our case. Regarding the issue discussed in D46520, this makes the runtime implications non-obvious. We'll have to test that. Also this change trades the list order requirement in for the complexity of an additional unr allocation that we must not leak.

I am aware of this. The main rationale is to make the code more fail-proof. That being said, I am not totally against simply adding a warning comment in pcm_chn_add() and just going with the initial approach, as well as the assumption that the list will always be sorted in ascending order.

Sep 28 2024, 4:37 PM

Sep 24 2024

dev_submerge.ch added a comment to D46680: sound: Use unr(9) to produce unique channel unit numbers.

@dev_submerge.ch Any comments? As I mention in the commit message, wanting to sort in descending order (and as a result, breaking the mechanism proposed in D46550) is highly unlikely, but I think it's good to be on the safe side.

Sep 24 2024, 4:03 PM
dev_submerge.ch added a comment to D46520: sound: Retire SND_MAXVCHANS.

I suspect the traversal of the channel list to have an impact. If we traverse it for every allocation, and the list getting longer, we get O(N^2) for N allocations. That should be easy to prove by doing a benchmark of allocations with few vchans and compare that to situations with 1'000, 10'000 and 100'000 preallocated vchans.

Sep 24 2024, 1:22 PM