Page MenuHomeFreeBSD

Simplify UIO_SYSSPACE and UIO_NOCOPY paths in uiomove
ClosedPublic

Authored by gallatin on Jul 5 2017, 1:16 PM.
Tags
None
Referenced Files
F132995540: D11489.id.diff
Tue, Oct 21, 10:12 PM
F132995539: D11489.id30491.diff
Tue, Oct 21, 10:12 PM
F132995537: D11489.id30448.diff
Tue, Oct 21, 10:12 PM
F132995536: D11489.id30438.diff
Tue, Oct 21, 10:12 PM
Unknown Object (File)
Tue, Oct 21, 10:30 AM
Unknown Object (File)
Thu, Sep 25, 3:50 AM
Unknown Object (File)
Sep 22 2025, 4:56 PM
Unknown Object (File)
Aug 30 2025, 1:28 AM
Subscribers

Details

Summary

Uiomove can only block when the segflag is UIO_USERSPACE,
otherwise we end up just doing a bcopy (or nothing) and
moving cursors. So only emit witness warnings and
set deadlock thread flags in the UIO_USERSPACE case.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 10321
Build 10735: arc lint + arc unit

Event Timeline

sys/kern/subr_uio.c
221

This re-enables witness warning for nofault case. I do not think this is correct.

Simplest fix is to move the warning into else part of the if (nofault) statement below.

223

I wonder if we can remove this flag already. Probably not until all buffer cache consumers, like cd9660 and other filesystems, are fixed to use vn_io_fault().

224

nofault is now silently ignored for kernel space. Might be, assert that nofault implies UIO_USERSPACE.

sys/kern/subr_uio.c
221

UIO_USERSPACE path calls maybe_yield() no matter what nofault is set to. I had assumed that required the witness warning. Is this assumption incorrect?

223

I was wondering about this. In a quick search, I could not find any callers of uiomove_nofault(), and uiomove_faultflag() is static, I thought I must be missing something.

sys/kern/subr_uio.c
221

Yield only causes thread to leave CPU, the thread does not become non-schedulable. In other words, yield call does not put thread into sleep or blocked state.

223

I am talking about TDP_DEADLKTREAT, not about _nofault() stuff.

gallatin added inline comments.
sys/kern/subr_uio.c
221

Thanks. Done.

223

Ah, my mistake.

But is there a use to the nofault stuff? It seems like it should be removed if it is not used.

This revision is now accepted and ready to land.Jul 5 2017, 5:08 PM
sys/kern/subr_uio.c
223

The nofault facility AKA TDP_NOFAULTING is actively used.

Perhaps the uiomove_nofault() way of entering the nofault thread state became unused due to circumstances and code changes. I do not think that it should be removed now, because the interface itself is potentially useful and can become utilized again in tree.

sys/kern/subr_uio.c
223

OK. To be clear, I meant the uiomove_nofault() entry point, not TDP_NOFAULTING. If you feel it should be preserved, I'm fine with that. Thanks for the quick feedback!

This revision was automatically updated to reflect the committed changes.