Page MenuHomeFreeBSD
Feed Advanced Search

Sep 27 2024

christos added inline comments to D46811: vmm.4: Add ppt device detach example.
Sep 27 2024, 11:05 AM
christos requested review of D46811: vmm.4: Add ppt device detach example.
Sep 27 2024, 10:52 AM

Sep 22 2024

christos requested review of D46749: sound: Move global variable initialization to sound_modevent().
Sep 22 2024, 3:32 PM
christos updated the diff for D46700: sound: Introduce global driver lock.

Get rid of locking inside sysctl_hw_snd_default_unit().

Sep 22 2024, 3:21 PM
christos updated the diff for D46700: sound: Introduce global driver lock.

Lock only around uses of devclass_get_maxunit(). Will write a separate patches
to 1) add assertions around reads of global variables, 2) remove
initializations from feeder.c.

Sep 22 2024, 3:16 PM

Sep 21 2024

christos updated the diff for D46715: snd_dummy: Drain callout during detach.

Use callout_drain().

Sep 21 2024, 3:13 PM
christos retitled D46715: snd_dummy: Drain callout during detach from snd_dummy: Cancel callout during detach to snd_dummy: Drain callout during detach.
Sep 21 2024, 3:13 PM
christos added a comment to D46715: snd_dummy: Drain callout during detach.

callout_drain perhaps?

callout_drain() will wait for the callout to finish, instead of stopping it immediately. Is there an advantage to using this?

Yes, it ensures that the callout won't be running while dummy_detach() runs concurrently. This patch makes the use-after-free harder to hit, but doesn't fix it completely.

Sep 21 2024, 12:56 PM
christos added a comment to D46715: snd_dummy: Drain callout during detach.

callout_drain perhaps?

Sep 21 2024, 11:08 AM

Sep 20 2024

christos requested review of D46715: snd_dummy: Drain callout during detach.
Sep 20 2024, 2:57 PM
christos added inline comments to D46700: sound: Introduce global driver lock.
Sep 20 2024, 10:27 AM

Sep 19 2024

christos added a reviewer for D46700: sound: Introduce global driver lock: imp.
Sep 19 2024, 1:51 PM
christos updated the diff for D46700: sound: Introduce global driver lock.

Extend previous patch.

Sep 19 2024, 1:51 PM
christos retitled D46700: sound: Introduce global driver lock from sound: Replace CTLFLAG_NEEDGIANT with CTLFLAG_MPSAFE to sound: Use bus_topo_lock() where needed.
Sep 19 2024, 1:50 PM
christos abandoned D46698: sound: Retire PCM_GIANT.

Abandoning after in-person discussion with Mark.

Sep 19 2024, 1:15 PM
christos added a comment to D46698: sound: Retire PCM_GIANT.

We already lock the softc using PCM_[UN]LOCK() so there is no reason to use Giant anymore.

There is other state that might be synchronized by Giant: global variables, the list of pcm drivers. For instance, code which references pcm_devclass should be locked with bus_topo_lock() (which is just Giant under the hood).

Sep 19 2024, 1:04 PM
christos requested review of D46700: sound: Introduce global driver lock.
Sep 19 2024, 11:39 AM
christos added inline comments to D46698: sound: Retire PCM_GIANT.
Sep 19 2024, 11:18 AM
christos requested review of D46698: sound: Retire PCM_GIANT.
Sep 19 2024, 11:00 AM

Sep 16 2024

christos added a comment to D46418: mididump(1): Initial revision.

I didn't see any more problems while testing. Would be nice to have a MIDI example file for testing that exercises all types of MIDI messages. mididump file.midi works BTW, but I think it's more of a feature than a bug.

Sep 16 2024, 10:53 AM
christos added inline comments to D46680: sound: Use unr(9) to produce unique channel unit numbers.
Sep 16 2024, 10:47 AM
christos added a comment to D46520: sound: Retire SND_MAXVCHANS.

Another consequence of "unlimited" vchans is that when setting a high value like sysctl dev.pcm.0.rec.vchans=100000, this keeps the sysctl process thread in the kernel for several minutes, and I wasn't able to kill it. That's because we preallocate the vchans directly in this sysctl. The same happens when you reduce the number of vchans again afterwards, for deallocation.

I don't see any security issue here as only root can set this sysctl. But I suppose it's more than just a nuisance. It blocks other sysctl requests, and if someone does sysctl fuzzing it may leave the fuzzer hanging for a very long time. @olce, what do you think?

That would be an example of what I mention in the last paragraph of the commit message. :)

IMHO, these are not the same thing. My machine was actually capable of creating 100000 vchans (I didn't try to use them). The problem is that setting sysctl dev.pcm.0.rec.vchans=100000 runs in kernel for more than 5 minutes. That's at least non-customary for sysctls. And it blocks other sysctl requests while running. This can happen inadvertently, and as discussed before there is reason for people to increase this sysctl. People make mistakes, or they'll just overdo it because they are unaware of the consequences.

Which is why I would like to know the opinion of @markj, @emaste or @olce first.

Sep 16 2024, 9:34 AM
christos added a comment to D46522: sound: Retire SND_MAXHWCHAN.

Bump.

Sep 16 2024, 8:48 AM
christos abandoned D46550: sound: Make sure chn_init() produces unique unit numbers.

Go with D46680

Sep 16 2024, 8:48 AM
christos added inline comments to D46680: sound: Use unr(9) to produce unique channel unit numbers.
Sep 16 2024, 8:47 AM

Sep 15 2024

christos updated the diff for D46680: sound: Use unr(9) to produce unique channel unit numbers.

chn_getunr(): Use __assert_unreachable() instead of returning NULL.

Sep 15 2024, 9:52 PM
christos added inline comments to D46680: sound: Use unr(9) to produce unique channel unit numbers.
Sep 15 2024, 9:44 PM
christos added inline comments to D46680: sound: Use unr(9) to produce unique channel unit numbers.
Sep 15 2024, 7:04 PM
christos added a comment to D46550: sound: Make sure chn_init() produces unique unit numbers.

An alternative approach using unr(9). Works with both ascending and descending order: https://reviews.freebsd.org/D46680

Sep 15 2024, 6:39 PM
christos requested review of D46680: sound: Use unr(9) to produce unique channel unit numbers.
Sep 15 2024, 6:39 PM
christos added a comment to D46550: sound: Make sure chn_init() produces unique unit numbers.

So, making this work when the list is sorted in descending order is quite more involved... The only viable solution I can think of is the following: 1) change from SLIST to TAILQ so that we can have TAILQ_FOREACH_REVERSE(), 2) introduce a CHN_FOREACH_REVERSE() macro, 3) store the sort type (i.e ascending or descending) in snddev_info, 4) check this sort type in chn_init(), and if it's ascending order, do what the patch does already, otherwise use CHN_FOREACH_REVERSE() instead instead of CHN_FOREACH(), so that the same code can keep working.

Sep 15 2024, 5:52 PM
christos added a comment to D46550: sound: Make sure chn_init() produces unique unit numbers.

This only works when the vchans per type are sorted by unit, in ascending order, right? Aren't the vchans sorted in descending order?

VCHANs are also sorted in ascending order in the channel list stored in snddev_info since vchan_create() calls pcm_chn_add(), which in turn calls CHN_INSERT_SORT_ASCEND(). The descending sort happens in the children list of pcm_channel.

Sep 15 2024, 2:58 PM
christos added a comment to D46550: sound: Make sure chn_init() produces unique unit numbers.

This only works when the vchans per type are sorted by unit, in ascending order, right? Aren't the vchans sorted in descending order?

Sep 15 2024, 2:18 PM
christos updated the diff for D46549: sound: Sort channels by unit number as well.

Fix.

Sep 15 2024, 2:05 PM
christos added a comment to D46548: sound: Simplify pcm_chnalloc() and fix infinite loop bug.

I think the endless loop was caused by goto vchan_alloc;: It skips the retry check, successfully calls vchan_setnew() with unchanged values, and then loops back through goto retry_chnalloc;. There's nothing else in there that would change and break the loop.

That endless loop would be triggered when the vchan_num < c->unit condition is met. I'd expect that to happen before spawning vchan X + 1 though.

Sep 15 2024, 12:03 PM

Sep 14 2024

christos updated the diff for D46418: mididump(1): Initial revision.

Introduce -t option to print "Timing Clock" messages on-demand, in order to
declutter output.

Sep 14 2024, 5:04 PM
christos added a comment to D46418: mididump(1): Initial revision.

For real devices there's a "Timing clock" message coming at a certain frequency, too much noise to see the other MIDI messages. Maybe we could collect them and print them together, or add a flag to enable or disable printing them?

Sep 14 2024, 4:41 PM
christos added a comment to D46520: sound: Retire SND_MAXVCHANS.

This is a clever solution for the maxautovchans sysctl. There's some aftermath though. With lots of channels and sysctl hw.snd.verbose=2, sndstat_prepare_pcm() does some memory allocation in sbuf_printf() while holding a lock:

uma_zalloc_debug: zone "malloc-65536" with the following non-sleepable locks held:
exclusive sleep mutex pcm0:virtual_record:dsp0.vr216 (pcm virtual record channel) r = 0 (0xfffff800015a8460) locked @ /usr/src/sys/dev/sound/pcm/sndstat.c:1261
stack backtrace:
#0 0xffffffff80bc423c at witness_debugger+0x6c
#1 0xffffffff80bc5433 at witness_warn+0x403
#2 0xffffffff80ef2e44 at uma_zalloc_debug+0x34
#3 0xffffffff80ef2967 at uma_zalloc_arg+0x27
#4 0xffffffff80b21e8d at malloc+0x7d
#5 0xffffffff80bac3eb at sbuf_extend+0x7b
#6 0xffffffff80bac9aa at sbuf_put_byte+0xda
#7 0xffffffff80ba6318 at kvprintf+0xe68
#8 0xffffffff80bac7ed at sbuf_vprintf+0x6d
#9 0xffffffff80bac89f at sbuf_printf+0x3f
#10 0xffffffff808df4b4 at sndstat_read+0x7c4
#11 0xffffffff809d8fd4 at devfs_read_f+0xe4
#12 0xffffffff80bc8f40 at dofileread+0x80
#13 0xffffffff80bc8ac7 at sys_read+0xb7
#14 0xffffffff810779e8 at amd64_syscall+0x158
#15 0xffffffff81049c3b at fast_syscall_common+0xf8

I think we fixed a similar case for the nvlist sndstat interface.

Sep 14 2024, 4:35 PM

Sep 6 2024

christos retitled D46560: sound: Re-arrange vchan_setnew() initial checks and improve errno values from sound: Re-arrange initial checks and improve errno values to sound: Re-arrange vchan_setnew() initial checks and improve errno values.
Sep 6 2024, 10:54 AM
christos requested review of D46560: sound: Re-arrange vchan_setnew() initial checks and improve errno values.
Sep 6 2024, 10:54 AM

Sep 5 2024

christos added inline comments to D46520: sound: Retire SND_MAXVCHANS.
Sep 5 2024, 8:35 PM
christos updated the diff for D46520: sound: Retire SND_MAXVCHANS.

Remove snd_maxautovchans checks in sysctl_dev_pcm_vchans() and vchan_setnew()
to preserve previous behavior. This way we can still disable VCHANs globally
through hw.snd.maxautovchans and enable them on demand through
dev.pcm.X.[play|rec].vchans.

Sep 5 2024, 8:33 PM
christos updated the diff for D46548: sound: Simplify pcm_chnalloc() and fix infinite loop bug.

Handle vchan_setnew() error case.

Sep 5 2024, 8:09 PM
christos added inline comments to D46521: sound: Get rid of pnum and max variables in chn_init().
Sep 5 2024, 8:03 PM
christos requested review of D46550: sound: Make sure chn_init() produces unique unit numbers.
Sep 5 2024, 8:01 PM
christos requested review of D46549: sound: Sort channels by unit number as well.
Sep 5 2024, 8:00 PM
christos requested review of D46548: sound: Simplify pcm_chnalloc() and fix infinite loop bug.
Sep 5 2024, 8:00 PM
christos added a comment to D46520: sound: Retire SND_MAXVCHANS.

This will break some use cases, e.g. turning off vchans by default through sysctl hw.snd.maxautovchans=0 and then turning it on for some specific device with sysctl dev.pcm.0.play.vchans=32. While that's also achievable the other way round, we're definitely going to break some people's workflows.

This can indeed break. However, I think it makes more intuitive sense to set dev.pcm.X.[play|rec].vchans to 0 to disable VCHANs, than hw.snd.maxautovchans. I know you said "by default", but still, that's just my humble opinion :)

I'm fine with that opinion. Problem is, it's far easier to set hw.snd.maxautovchans=0 than going for the individual pcm devices in both directions. And it's suggested for exactly this purpose by sound(4):

[...]

Therefore people are currently using it, and it's not a good idea to silently break their workflow.

Sep 5 2024, 5:24 PM
christos requested review of D46545: sound: Remove KASSERT from vchan_setnew().
Sep 5 2024, 5:03 PM
christos updated the diff for D46418: mididump(1): Initial revision.

Read 2 bytes (instead of 3) in case byte1 in SysEx is 0.

Sep 5 2024, 4:35 PM
christos added a comment to D46521: sound: Get rid of pnum and max variables in chn_init().

Any comment related to the patch?

Sep 5 2024, 4:25 PM

Sep 4 2024

christos added inline comments to D46521: sound: Get rid of pnum and max variables in chn_init().
Sep 4 2024, 2:22 PM
christos added a comment to D46520: sound: Retire SND_MAXVCHANS.

We're changing semantics of hw.snd.maxautovchans here. Currently it's possible to override maxautovchans via the per pcm device vchans sysctl, with this patch it becomes a hard limit.

Sep 4 2024, 1:52 PM

Sep 3 2024

christos requested review of D46522: sound: Retire SND_MAXHWCHAN.
Sep 3 2024, 3:53 PM
christos updated the diff for D46520: sound: Retire SND_MAXVCHANS.

Update and depend on D46521.

Sep 3 2024, 3:53 PM
christos requested review of D46521: sound: Get rid of pnum and max variables in chn_init().
Sep 3 2024, 3:52 PM
christos added a comment to D46520: sound: Retire SND_MAXVCHANS.

I will also add a RELNOTES entry when I commit it.

Sep 3 2024, 3:26 PM
christos requested review of D46520: sound: Retire SND_MAXVCHANS.
Sep 3 2024, 3:26 PM
christos updated the diff for D46418: mididump(1): Initial revision.

Fix SysEx handling. In the case of 3-byte VendorID, I am not sure if we should
read 3 _additional_ bytes (what the patch does), or 2.

Sep 3 2024, 1:39 PM
christos added inline comments to D46418: mididump(1): Initial revision.
Sep 3 2024, 1:23 PM
christos added inline comments to D46418: mididump(1): Initial revision.
Sep 3 2024, 1:22 PM
christos added inline comments to D46418: mididump(1): Initial revision.
Sep 3 2024, 12:59 PM

Sep 2 2024

christos updated the diff for D46418: mididump(1): Initial revision.
  • read(2) on-demand. Introduce read_byte() function.
  • Get rid of EVENT_MASK.
Sep 2 2024, 4:17 PM
christos added inline comments to D46418: mididump(1): Initial revision.
Sep 2 2024, 4:15 PM

Sep 1 2024

christos committed rGb8aeb7101724: mixer(8) tests: Fix cleanup routine (authored by olivier).
mixer(8) tests: Fix cleanup routine
Sep 1 2024, 1:31 PM

Aug 31 2024

christos committed rGe9a30c90d31e: ObsoleteFiles.inc: Fix examples path (authored by christos).
ObsoleteFiles.inc: Fix examples path
Aug 31 2024, 4:37 PM

Aug 30 2024

christos added a comment to D35772: beep(1): Add support for rendering text and numbers as audio..

I am interested to take/continue this feature. Are others already working?

Aug 30 2024, 8:00 PM
christos added a comment to D35776: vtspeakd(1): Initial version of console speaker daemon..

I am interested to take/continue this feature. Are others already working?

Aug 30 2024, 8:00 PM
christos closed D46491: mixer(8) tests: Fix cleanup routine.
Aug 30 2024, 5:25 PM
christos committed rG080c85127e3f: mixer(8) tests: Fix cleanup routine (authored by olivier).
mixer(8) tests: Fix cleanup routine
Aug 30 2024, 5:25 PM
christos retitled D46491: mixer(8) tests: Fix cleanup routine from Fix cleanup step when no mixer nor snd_dummy to mixer(8) tests: Fix cleanup routine.
Aug 30 2024, 5:19 PM
christos accepted D46491: mixer(8) tests: Fix cleanup routine.

LGTM. I will commit the patch and add you as the author, as it needs some style(9) fix as well. Thanks!

Aug 30 2024, 5:18 PM

Aug 26 2024

christos committed rG91b1e2a4a84b: sound examples: Delete stale ossinit.h file (authored by christos).
sound examples: Delete stale ossinit.h file
Aug 26 2024, 1:55 PM
christos committed rGf63d0c39d9d7: ObsoleteFiles.inc: Update after sound changes (authored by christos).
ObsoleteFiles.inc: Update after sound changes
Aug 26 2024, 1:55 PM
christos committed rG8156d8598f59: sound: Improve sndstat nvlist feederchain format (authored by christos).
sound: Improve sndstat nvlist feederchain format
Aug 26 2024, 1:55 PM
christos committed rGf060ed39805d: sound examples: Move MIDI example out of OSS directory (authored by christos).
sound examples: Move MIDI example out of OSS directory
Aug 26 2024, 1:55 PM
christos committed rGa59e4c405572: sound examples: Simplify audio example (authored by christos).
sound examples: Simplify audio example
Aug 26 2024, 1:55 PM
christos committed rG276d76adf984: sound examples: Simplify MIDI example (authored by christos).
sound examples: Simplify MIDI example
Aug 26 2024, 1:55 PM
christos committed rGcf9d2fb18433: mixer(8): Implement hot-swapping (authored by christos).
mixer(8): Implement hot-swapping
Aug 26 2024, 1:55 PM
christos committed rG6ab8b418dc10: sound tests: Add SNDSTIOC_ADD_USER_DEVS test (authored by christos).
sound tests: Add SNDSTIOC_ADD_USER_DEVS test
Aug 26 2024, 1:55 PM

Aug 24 2024

christos committed rG7ae4868a9a1a: sound examples: Delete stale ossinit.h file (authored by christos).
sound examples: Delete stale ossinit.h file
Aug 24 2024, 12:17 PM
christos committed rG0864dfe6299b: sound: Improve sndstat nvlist feederchain format (authored by christos).
sound: Improve sndstat nvlist feederchain format
Aug 24 2024, 12:10 PM
christos committed rGc3516c6533a1: ObsoleteFiles.inc: Update after sound changes (authored by christos).
ObsoleteFiles.inc: Update after sound changes
Aug 24 2024, 12:10 PM
christos committed rG6747b1a8218f: sound examples: Move MIDI example out of OSS directory (authored by christos).
sound examples: Move MIDI example out of OSS directory
Aug 24 2024, 12:09 PM
christos committed rG3decd659a788: sound examples: Simplify audio example (authored by christos).
sound examples: Simplify audio example
Aug 24 2024, 12:09 PM
christos committed rG0ca4d5d8209c: sound examples: Simplify MIDI example (authored by christos).
sound examples: Simplify MIDI example
Aug 24 2024, 12:09 PM
christos closed D46309: sound: Improve sndstat nvlist feederchain format.
Aug 24 2024, 12:09 PM
christos committed rG9aac27599aca: mixer(8): Implement hot-swapping (authored by christos).
mixer(8): Implement hot-swapping
Aug 24 2024, 12:09 PM
christos committed rG2668e76d6e76: sound tests: Add SNDSTIOC_ADD_USER_DEVS test (authored by christos).
sound tests: Add SNDSTIOC_ADD_USER_DEVS test
Aug 24 2024, 12:09 PM
christos closed D46308: sound examples: Move MIDI example out of OSS directory.
Aug 24 2024, 12:09 PM
christos closed D46307: sound examples: Simplify audio example.
Aug 24 2024, 12:09 PM
christos closed D46306: sound examples: Simplify MIDI example.
Aug 24 2024, 12:09 PM
christos closed D46253: mixer(8): Implement hot-swapping.
Aug 24 2024, 12:09 PM
christos closed D46228: sound tests: Add SNDSTIOC_ADD_USER_DEVS test.
Aug 24 2024, 12:09 PM

Aug 23 2024

christos abandoned D46377: sound: Fix SEQ_SYSEX() macro.

Alright, didn't know we could use just GitHub for this. Thank you. :)

Aug 23 2024, 7:38 PM
christos added a comment to D46377: sound: Fix SEQ_SYSEX() macro.

Bump.

Isn't this the same as the patch submitted by Ivan on github? https://github.com/freebsd/freebsd-src/pull/1374

If so, and you think the patch is reasonable, you can just approve it and we'll take care of landing it into src with the correct attribution etc..

Aug 23 2024, 5:40 PM
christos updated the diff for D46418: mididump(1): Initial revision.

Minor fix.

Aug 23 2024, 3:50 PM
christos updated the diff for D46418: mididump(1): Initial revision.
  • Add bound check for ctls[].
  • Use b2 instead of b1 for vendorid in SysEx.
Aug 23 2024, 3:47 PM
christos added inline comments to D46418: mididump(1): Initial revision.
Aug 23 2024, 3:34 PM
christos added a comment to D46418: mididump(1): Initial revision.

Inspired by aseqdump and OpenBSD's midicat, but more user-friendly (printing note names, frequencies, control names, ...), and also native so it does not require ALSA or any sound backend. In the future I would like to support MIDI 2.0 events as well, but I think for now we can roll with just MIDI 1.0.

Aug 23 2024, 3:28 PM