Page MenuHomeFreeBSD

christos (Christos Margiolis)
User

Projects

User Details

User Since
Jul 2 2021, 4:03 PM (228 w, 5 d)

Recent Activity

Today

christos added a comment to D43399: enable VCHIQ HDMI AUDIO 64 bits BCM2835, BCM2711 Raspberry Pi 4B; correct minor compile errors. bcm2835_audio.c.

Please rebase all relevant patches, including this one, on top of main, stack them properly, and also re-generate and update the diffs with full context: https://wiki.freebsd.org/Phabricator#Create_a_Revision_via_Web_Interface

Wed, Nov 19, 4:04 PM · arm64, ARM
christos added a comment to D53749: sound examples: Add mmap example.

The Makefile needs to be updated to install mmap.c.

Wed, Nov 19, 2:21 PM
christos added a comment to D53736: sound: Simplify logic in dsp_io_ops().

Bump.

Wed, Nov 19, 12:52 PM
christos committed rG282015e7a07d: sound examples: Extend and clean up (authored by meka_tilda.center).
sound examples: Extend and clean up
Wed, Nov 19, 9:59 AM
christos committed rGcff21ddcb756: sound: Remove KOBJMETHOD_END re-definitions (authored by christos).
sound: Remove KOBJMETHOD_END re-definitions
Wed, Nov 19, 9:59 AM

Yesterday

christos committed rGd1a627f39a33: sound: Retire unused feeder_printchain() (authored by christos).
sound: Retire unused feeder_printchain()
Tue, Nov 18, 12:58 AM
christos committed rGea9d875a6477: virtual_oss(8): Improve hw.snd.basename_clone handling (authored by christos).
virtual_oss(8): Improve hw.snd.basename_clone handling
Tue, Nov 18, 12:53 AM
christos committed rG4804bb0d4588: virtual_oss(8): Use kldload(2) instead of system(3) (authored by christos).
virtual_oss(8): Use kldload(2) instead of system(3)
Tue, Nov 18, 12:53 AM
christos committed rG29e5f29fc0c9: rc: virtual_oss: Use required_modules instead of load_kld (authored by christos).
rc: virtual_oss: Use required_modules instead of load_kld
Tue, Nov 18, 12:53 AM
christos committed rG8517a76e34b6: sound: Retire DSP_DEFAULT_SPEED (authored by christos).
sound: Retire DSP_DEFAULT_SPEED
Tue, Nov 18, 12:53 AM
christos committed rGb4c210f241b3: sound: Retire unused SCF_SYNTH (authored by christos).
sound: Retire unused SCF_SYNTH
Tue, Nov 18, 12:53 AM
christos committed rGae879f73a03f: sound: Retire feeder_register_root() (authored by christos).
sound: Retire feeder_register_root()
Tue, Nov 18, 12:53 AM
christos committed rGad348a08586f: sound: Remove unnecessary initializations in feeder_create() (authored by christos).
sound: Remove unnecessary initializations in feeder_create()
Tue, Nov 18, 12:53 AM
christos committed rGf709b2b59d44: sound: Retire pcm_feederdesc->type (authored by christos).
sound: Retire pcm_feederdesc->type
Tue, Nov 18, 12:53 AM
christos committed rGae3cd550d257: sound: Retire feeder_class->desc (authored by christos).
sound: Retire feeder_class->desc
Tue, Nov 18, 12:53 AM
christos committed rG3305f6e6317c: sound: Retire feeder_class->data (authored by christos).
sound: Retire feeder_class->data
Tue, Nov 18, 12:53 AM
christos committed rG5dd90538ba4d: sound: Simplify feeder_getclass() (authored by christos).
sound: Simplify feeder_getclass()
Tue, Nov 18, 12:53 AM
christos committed rG2acd16ce68be: sound: Retire feedertab_entry (authored by christos).
sound: Retire feedertab_entry
Tue, Nov 18, 12:53 AM
christos committed rG0a566f2fe96b: sound: Simplify pcm_feederdesc initialization (authored by christos).
sound: Simplify pcm_feederdesc initialization
Tue, Nov 18, 12:53 AM
christos committed rGc0657096dbf6: sound: Retire unused pcm_feederdesc->flags (authored by christos).
sound: Retire unused pcm_feederdesc->flags
Tue, Nov 18, 12:53 AM
christos committed rGebe59a72abf7: sound: Retire MAXFEEDERS and feedercnt (authored by christos).
sound: Retire MAXFEEDERS and feedercnt
Tue, Nov 18, 12:53 AM
christos committed rG1619adaf77ad: sound: Remove unnecessary pcm/vchan.h include from pcm/feeder.c (authored by christos).
sound: Remove unnecessary pcm/vchan.h include from pcm/feeder.c
Tue, Nov 18, 12:52 AM
christos committed rG0c61ba36895a: sound: Retire unused {pcm_feederdesc,feedertab_entry}->idx (authored by christos).
sound: Retire unused {pcm_feederdesc,feedertab_entry}->idx
Tue, Nov 18, 12:52 AM
christos committed rGaa214f899a40: sound: Add to pcm/buffer.* copyright (authored by christos).
sound: Add to pcm/buffer.* copyright
Tue, Nov 18, 12:52 AM
christos committed rG1d9f05bd46bc: sound: Get rid of useless sndbuf getters and setters (authored by christos).
sound: Get rid of useless sndbuf getters and setters
Tue, Nov 18, 12:52 AM
christos committed rG7ed840e33127: sound: Remove redundant sndbuf_free() in chn_kill() (authored by christos).
sound: Remove redundant sndbuf_free() in chn_kill()
Tue, Nov 18, 12:52 AM
christos committed rGd5024179b8dd: sound: Simplify sndbuf_clear() loop (authored by christos).
sound: Simplify sndbuf_clear() loop
Tue, Nov 18, 12:52 AM
christos committed rG418c7be1760d: sound: Retire unused sndbuf_getflags() and sndbuf_setflags() (authored by christos).
sound: Retire unused sndbuf_getflags() and sndbuf_setflags()
Tue, Nov 18, 12:52 AM
christos committed rG6bb6be4eef58: sound: Retire unused sndbuf_dump() (authored by christos).
sound: Retire unused sndbuf_dump()
Tue, Nov 18, 12:52 AM
christos committed rG155f24992674: sound: Re-arrange sndbuf_create() arguments (authored by christos).
sound: Re-arrange sndbuf_create() arguments
Tue, Nov 18, 12:52 AM
christos committed rG7ac082ff1ad9: sound: Define SNDBUF_F_MANAGED as 0x00000001 (authored by christos).
sound: Define SNDBUF_F_MANAGED as 0x00000001
Tue, Nov 18, 12:52 AM
christos committed rGaabcb5d35b47: sound: Retire snd_dbuf->dev (authored by christos).
sound: Retire snd_dbuf->dev
Tue, Nov 18, 12:52 AM
christos committed rG65c1264625e3: sound: Retire unused snd_dbuf->dir (authored by christos).
sound: Retire unused snd_dbuf->dir
Tue, Nov 18, 12:52 AM
christos committed rG16dc00a5cf58: sound tests: Test polling (authored by christos).
sound tests: Test polling
Tue, Nov 18, 12:52 AM
christos committed rGc58e41d899a7: sound: Clarify userland/vchan relationship in sndstat feeder chain (authored by christos).
sound: Clarify userland/vchan relationship in sndstat feeder chain
Tue, Nov 18, 12:52 AM
christos committed rGf7fe9f04c396: sound: Add kqueue support (authored by christos).
sound: Add kqueue support
Tue, Nov 18, 12:52 AM

Mon, Nov 17

christos added a comment to D53749: sound examples: Add mmap example.

This is an initial quick review, as I haven't had a chance to properly test it yet.

Mon, Nov 17, 4:28 PM
christos committed rG5f624d923db0: snd_hda: Patch Lenovo V15 (authored by christos).
snd_hda: Patch Lenovo V15
Mon, Nov 17, 4:10 PM

Sat, Nov 15

christos added a comment to D53736: sound: Simplify logic in dsp_io_ops().
In D53736#1227777, @kib wrote:
In D53736#1227774, @kib wrote:
In D53736#1227693, @kib wrote:

What is channel->pid? Where is it got assigned?

From the commit message:

channel->pid (as well as channel->comm) is always assigned in dsp_chn_alloc().

I will correct the message to say pcm_channel->pid, which is the actual struct's name.

This is not what I am asking about. Why do you need to save the pid, and how do you use it?

Both the pid and process name are mostly cosmetic, and are used in sndctl(8), /dev/sndstat and in some OSSv4 structures. It is just so that the user can easily tell which channel(s) belong to which processes.

So for instance, sharing the open file after fork, or passing it over unix domain socket, cause only a cosmetic issues, right?

Sat, Nov 15, 2:13 PM
christos added a comment to D53736: sound: Simplify logic in dsp_io_ops().
In D53736#1227774, @kib wrote:
In D53736#1227693, @kib wrote:

What is channel->pid? Where is it got assigned?

From the commit message:

channel->pid (as well as channel->comm) is always assigned in dsp_chn_alloc().

I will correct the message to say pcm_channel->pid, which is the actual struct's name.

This is not what I am asking about. Why do you need to save the pid, and how do you use it?

Sat, Nov 15, 1:25 PM
christos added a comment to D53736: sound: Simplify logic in dsp_io_ops().
In D53736#1227693, @kib wrote:

What is channel->pid? Where is it got assigned?

Sat, Nov 15, 11:37 AM

Thu, Nov 13

christos added a comment to D53666: sound: Fix KASSERT panics in chn_read() and chn_write().
In D53666#1226867, @kib wrote:
  1. Calling close(2) on the device: I'm not sure about this one. Is it possible that close(2) and read(2)/write(2) can run concurrently?

Yes, close(2) and io syscalls can be run in parallel. But the file is only closed (as in d_close for devfs, or cdevpriv destroy) when the file ref count goes to zero. Since both read(2) and close(2) take the reference, effectively the file deallocation occurs by the syscall that fdrop() it the last.

Thu, Nov 13, 2:52 PM
christos added a comment to D53666: sound: Fix KASSERT panics in chn_read() and chn_write().
In D53666#1226813, @kib wrote:

The buffer is allocated with with M_ZERO and a specific size by the device drivers when a channel is created.

Ok. Can channel deallocated while unlocked?

Thu, Nov 13, 2:38 PM
christos committed rGb19e61f223a1: sound: Retire SND_DIAGNOSTIC PCM locking macros (authored by christos).
sound: Retire SND_DIAGNOSTIC PCM locking macros
Thu, Nov 13, 2:37 PM
christos closed D53735: sound: Retire SND_DIAGNOSTIC PCM locking macros.
Thu, Nov 13, 2:37 PM
christos committed rGfa7bc9830766: sound: Do not use double pointer in dsp_io_ops() (authored by christos).
sound: Do not use double pointer in dsp_io_ops()
Thu, Nov 13, 2:37 PM
christos closed D53734: sound: Do not use double pointer in dsp_io_ops().
Thu, Nov 13, 2:37 PM
christos closed D53733: sound: Remove unnecessary uio checks in dsp_io_ops().
Thu, Nov 13, 2:36 PM
christos committed rG6b5431941c10: sound: Remove unnecessary uio checks in dsp_io_ops() (authored by christos).
sound: Remove unnecessary uio checks in dsp_io_ops()
Thu, Nov 13, 2:36 PM
christos requested review of D53736: sound: Simplify logic in dsp_io_ops().
Thu, Nov 13, 2:34 PM
christos requested review of D53735: sound: Retire SND_DIAGNOSTIC PCM locking macros.
Thu, Nov 13, 2:11 PM
christos added inline comments to D53734: sound: Do not use double pointer in dsp_io_ops().
Thu, Nov 13, 1:56 PM
christos requested review of D53734: sound: Do not use double pointer in dsp_io_ops().
Thu, Nov 13, 1:46 PM
christos committed rG1fe7bfd6c701: sound: Retire OLDPCM_IOCTL (authored by christos).
sound: Retire OLDPCM_IOCTL
Thu, Nov 13, 1:34 PM
christos committed rG15d77c1fdcb1: sound: Move mixer->modify_counter to more appropriate place (authored by christos).
sound: Move mixer->modify_counter to more appropriate place
Thu, Nov 13, 1:34 PM
christos requested review of D53733: sound: Remove unnecessary uio checks in dsp_io_ops().
Thu, Nov 13, 1:32 PM
christos committed rGb55adf9b261b: sound: Retire unused mixer functions (authored by christos).
sound: Retire unused mixer functions
Thu, Nov 13, 12:54 PM
christos committed rG634e578ac7b0: cuse: Fix cdevpriv bugs in cuse_client_open() (authored by christos).
cuse: Fix cdevpriv bugs in cuse_client_open()
Thu, Nov 13, 12:11 PM
christos closed D53708: cuse: Fix cdevpriv bugs in cuse_client_open().
Thu, Nov 13, 12:11 PM
christos committed rGe4b31985b54b: sound: Remove dead midi code (authored by christos).
sound: Remove dead midi code
Thu, Nov 13, 12:11 PM
christos added a comment to D53666: sound: Fix KASSERT panics in chn_read() and chn_write().
In D53666#1226622, @kib wrote:
In D53666#1226612, @kib wrote:
In D53666#1226600, @kib wrote:

I have no knowledge of the dev/sound code. After the channel unlock, what guarantees the validity of the buffer that uiomove() operates on?

What do you mean by validity?

I mean that uiomove() operates on kernel memory that is supposed to be in correct state for it.

As I said, I do not know the dev/sound code. But your note about parallel thread manipulating the channel after unlock (which is expectedly allowed) raises the question what manipulations can be done while uiomove() needs to access the channel buffer in parallel.

It doesn't really matter, whatever we write here will get processed further down the line by sound(4), and eventually go to the sound card's output. We just need to ensure that writes (and reads) happen at the correct buffer locations. Also, the parallel writing scenario I explain is really only a consideration in testing environments, as was the case now with stress2. In real world use-cases, usually a channel is operated on by a single thread.

It doesn't matter what happens usually, since we discussing the correctness of the kernel code. For instance, could this result in reading of uninitialized kernel memory (exposing its previous content)?

Thu, Nov 13, 10:47 AM

Wed, Nov 12

christos added a comment to D53666: sound: Fix KASSERT panics in chn_read() and chn_write().
In D53666#1226612, @kib wrote:
In D53666#1226600, @kib wrote:

I have no knowledge of the dev/sound code. After the channel unlock, what guarantees the validity of the buffer that uiomove() operates on?

What do you mean by validity?

I mean that uiomove() operates on kernel memory that is supposed to be in correct state for it.

As I said, I do not know the dev/sound code. But your note about parallel thread manipulating the channel after unlock (which is expectedly allowed) raises the question what manipulations can be done while uiomove() needs to access the channel buffer in parallel.

Wed, Nov 12, 11:40 PM
christos added a comment to D53666: sound: Fix KASSERT panics in chn_read() and chn_write().
In D53666#1226600, @kib wrote:

I have no knowledge of the dev/sound code. After the channel unlock, what guarantees the validity of the buffer that uiomove() operates on?

Wed, Nov 12, 11:30 PM
christos updated the diff for D53708: cuse: Fix cdevpriv bugs in cuse_client_open().

Address kib's comments.

Wed, Nov 12, 11:28 PM
christos updated the diff for D53614: sound tests: Test hot-unload.

Clean up. Finalized on my part.

Wed, Nov 12, 8:32 PM
christos closed D53696: sound: Remove KOBJMETHOD_END re-definitions.
Wed, Nov 12, 8:31 PM
christos committed rG4c05ff1d5ad2: sound: Remove KOBJMETHOD_END re-definitions (authored by christos).
sound: Remove KOBJMETHOD_END re-definitions
Wed, Nov 12, 8:31 PM
christos added a comment to D53666: sound: Fix KASSERT panics in chn_read() and chn_write().
In D53666#1226459, @pho wrote:

Do what I explained in the last message. stress2 has finished after 30 minutes
without panicking. I've yet to test chn_read() though.

@pho, can you also test please?

I ran the write(2) tests for 30 minutes followed by some corresponding read(2) tests.
LGTM

Wed, Nov 12, 8:28 PM
christos committed rG6a569666868b: sound examples: Extend and clean up (authored by meka_tilda.center).
sound examples: Extend and clean up
Wed, Nov 12, 8:18 PM
christos closed D53353: sound examples: Extend and clean up.
Wed, Nov 12, 8:17 PM
christos accepted D53353: sound examples: Extend and clean up.

I tested simple, select and poll on the real hardware. As that machine is not running CURRENT, I can't test kqueue. @christos, do you have any means on testing it on real hardware? I tried to test it in bhyve with -s 6,hda,play=/dev/dsp,rec=/dev/dsp but none of the examples work properly that way.

Wed, Nov 12, 8:11 PM
christos requested review of D53708: cuse: Fix cdevpriv bugs in cuse_client_open().
Wed, Nov 12, 2:16 PM
christos updated the diff for D53666: sound: Fix KASSERT panics in chn_read() and chn_write().

Do what I explained in the last message. stress2 has finished after 30 minutes
without panicking. I've yet to test chn_read() though.

Wed, Nov 12, 1:05 PM
christos updated the summary of D53666: sound: Fix KASSERT panics in chn_read() and chn_write().
Wed, Nov 12, 1:04 PM
christos added a comment to D53666: sound: Fix KASSERT panics in chn_read() and chn_write().

After some pen and paper debugging, it seems that my current approach does solve most cases, but there is still one case that can reproduce the panic, albeit quite rare. You need to run stress2 usually for about ~20 minutes with enough workload to hit the race. Suppose the following scenario: the buffer has a size of 4 bytes, and we have two threads: (A) and (B).
In the first iteration, thread (A) wants to write 2 bytes, while the buffer is empty, BUT the pointer (sndbuf_getfreeptr()) is at the end (i.e., buf[3]). In the first iteration of the loop, because of the way we calculate t, we'll end up writing only 1 byte, so after sz -= t, sz will be 1, and so we'll need one more iteration in the inner loop, to write the remaining 1 byte. Now we're at the end of the first loop, thread (A) unlocks the channel, it has written 1 byte, it needs to write 1 more, and the buffer is left with 3 empty slots. Now thread (B) picks up the lock, and it wants to write 3 (or more) bytes. Eventually it writes the 3 bytes, and it leaves the buffer with 0 free slots. By the time thread (A) picks up the lock again, and continues with the second iteration of the inner loop, it will try to write the last byte, but sndbuf_acquire() will panic because there is no free space anymore. I'm pretty sure this is what is going on.

Wed, Nov 12, 12:26 PM
christos added a comment to D53353: sound examples: Extend and clean up.

I already fixed those as well as share/examples/Makefile, I just want to check if everything is working, and that has to wait for my day job to finish.

Wed, Nov 12, 11:52 AM
christos added a comment to D53353: sound examples: Extend and clean up.

I can actually fix those last comments myself, no need to waste your time for this. Just let me know if tests worked fine on your machine. :-)

Wed, Nov 12, 11:48 AM

Tue, Nov 11

christos requested review of D53696: sound: Remove KOBJMETHOD_END re-definitions.
Tue, Nov 11, 7:42 PM
christos added a comment to D53353: sound examples: Extend and clean up.

All of my inline comments are mostly grammar/typo fixes. If you tested the most recent code (especially simple.c) with the most recent changes, then we'll be good to go. I'll commit this once you address the last comments. Thanks a lot for this! :-)

Tue, Nov 11, 5:46 PM
christos abandoned D53528: sound: Get rid of useless sndbuf getters and setters.
Tue, Nov 11, 5:04 PM
christos committed rGeb95b990f8eb: sound tests: Fix format specified for kevent.data (authored by christos).
sound tests: Fix format specified for kevent.data
Tue, Nov 11, 1:23 PM
christos committed rG41f2ec3be93a: sound tests: Fix select(2) arguments (authored by christos).
sound tests: Fix select(2) arguments
Tue, Nov 11, 12:24 PM
christos closed D53617: virtual_oss(8): Use kldload(2) instead of system(3).
Tue, Nov 11, 12:14 PM
christos committed rGc24ca02c4c85: sound: Retire feedertab_entry (authored by christos).
sound: Retire feedertab_entry
Tue, Nov 11, 12:14 PM
christos closed D53616: rc: virtual_oss: Use required_modules instead of load_kld.
Tue, Nov 11, 12:14 PM
christos closed D53560: sound: Retire feeder_register_root().
Tue, Nov 11, 12:14 PM
christos closed D53557: sound: Retire pcm_feederdesc->type.
Tue, Nov 11, 12:13 PM
christos committed rGe5c0d7020f3d: virtual_oss(8): Improve hw.snd.basename_clone handling (authored by christos).
virtual_oss(8): Improve hw.snd.basename_clone handling
Tue, Nov 11, 12:09 PM
christos committed rG7bedc4634d89: virtual_oss(8): Use kldload(2) instead of system(3) (authored by christos).
virtual_oss(8): Use kldload(2) instead of system(3)
Tue, Nov 11, 12:09 PM
christos committed rGac2aa9e869a1: rc: virtual_oss: Use required_modules instead of load_kld (authored by christos).
rc: virtual_oss: Use required_modules instead of load_kld
Tue, Nov 11, 12:09 PM
christos committed rG7dc58828f494: sound: Retire unused SCF_SYNTH (authored by christos).
sound: Retire unused SCF_SYNTH
Tue, Nov 11, 12:09 PM
christos committed rG2ba68208390a: sound: Retire feeder_register_root() (authored by christos).
sound: Retire feeder_register_root()
Tue, Nov 11, 12:09 PM
christos committed rG16ae4c2398c8: sound: Retire DSP_DEFAULT_SPEED (authored by christos).
sound: Retire DSP_DEFAULT_SPEED
Tue, Nov 11, 12:09 PM
christos committed rGf4819a1b6c44: sound: Retire unused feeder_printchain() (authored by christos).
sound: Retire unused feeder_printchain()
Tue, Nov 11, 12:09 PM
christos committed rG92dcd20222a2: sound: Retire pcm_feederdesc->type (authored by christos).
sound: Retire pcm_feederdesc->type
Tue, Nov 11, 12:09 PM
christos committed rG699fd108c50c: sound: Remove unnecessary initializations in feeder_create() (authored by christos).
sound: Remove unnecessary initializations in feeder_create()
Tue, Nov 11, 12:09 PM
christos closed D53621: virtual_oss(8): Improve hw.snd.basename_clone handling.
Tue, Nov 11, 12:09 PM
christos committed rG91fcc0132d0b: sound: Retire feeder_class->desc (authored by christos).
sound: Retire feeder_class->desc
Tue, Nov 11, 12:09 PM
christos committed rG762f8e6f515a: sound: Retire feeder_class->data (authored by christos).
sound: Retire feeder_class->data
Tue, Nov 11, 12:09 PM
christos committed rG441a411853e4: sound: Simplify feeder_getclass() (authored by christos).
sound: Simplify feeder_getclass()
Tue, Nov 11, 12:09 PM