Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 04 Mar 2026 18:39:40 +0000
From:      Unitrunker <unitrunker@unitrunker.net>
To:        Christos Margiolis <christos@freebsd.org>
Cc:        freebsd-multimedia@freebsd.org
Subject:   Re: cuse(3) cuse_wait_and_process thread safety
Message-ID:  <O6xsN77qp2qbzGLHJ2sk9zJjv2_9c45cEpB4JPv3enS-tCdka9dyy87RDvYZ7siuGQkNzuH6JG6TpSZ2XQ0yj6m2Cx4v7TI1Emkd6cHijRQ=@unitrunker.net>
In-Reply-To: <DGU7BRMO0NSM.1R59RB18HVL88@freebsd.org>
References:  <z4gb0FHta2RgVVOgb9R1aetw5B-mIlUajdokq7xGi4thxQVtsIcZkCTsL4o6WzZbgwx4qy6b4LQoc_mulgDaiPV2BvRL08z-tW-eZLipmdc=@unitrunker.net> <DGU7BRMO0NSM.1R59RB18HVL88@freebsd.org>

index | next in thread | previous in thread | raw e-mail

Hello Christos!

I am working on a POC to demonstrate the problem. While doing so I found a separate issue with readv. Bug is here:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=293489

Multiple threads make sense but one would want to partition the data so that packets inside the same stream are processed in-order.

My theory of a bug is based on two assumptions.

I am assuming the kernel module does not enforce one-stream per worker thread (which may be wrong but I've not seen such logic in the module).

For the POC, I created a simple cuse process and a test program that sends a burst of one byte writes to the cuse process. Inside the cuse process, each worker thread sleeps a random amount of time in between events. This requires multiple events to be queued (which I assume is possible). Another process reads the data. Any mis-ordering of bytes is proof of a bug.

Example: ABCDEFGH => ABCEDFGH

I'll drop a POC once I have it working. Of course, if I can't make it fail, that's a good thing.

Regards,
Rick

On Wednesday, March 4th, 2026 at 12:16 PM, Christos Margiolis <christos@freebsd.org> wrote:

> I'm the maintainer of virtual_oss. To be fair, I don't know what was
> HPS's (RIP) rationale for giving each device 4 threads, so I'm not sure
> how to answer this question. Have you run into the problem you described
> since you sent the email?
> 
> Christos




home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?O6xsN77qp2qbzGLHJ2sk9zJjv2_9c45cEpB4JPv3enS-tCdka9dyy87RDvYZ7siuGQkNzuH6JG6TpSZ2XQ0yj6m2Cx4v7TI1Emkd6cHijRQ=>