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
F101850266: D11489.diff
Mon, Nov 4, 4:29 PM
Unknown Object (File)
Sep 22 2024, 8:04 AM
Unknown Object (File)
Sep 19 2024, 7:19 AM
Unknown Object (File)
Sep 10 2024, 10:52 PM
Unknown Object (File)
Sep 8 2024, 2:43 PM
Unknown Object (File)
Sep 8 2024, 1:50 PM
Unknown Object (File)
Sep 8 2024, 1:49 PM
Unknown Object (File)
Sep 4 2024, 11:07 PM
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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/kern/subr_uio.c
221 ↗(On Diff #30438)

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 ↗(On Diff #30438)

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 ↗(On Diff #30438)

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

sys/kern/subr_uio.c
221 ↗(On Diff #30438)

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 ↗(On Diff #30438)

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 ↗(On Diff #30438)

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 ↗(On Diff #30438)

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

gallatin added inline comments.
sys/kern/subr_uio.c
221 ↗(On Diff #30438)

Thanks. Done.

223 ↗(On Diff #30438)

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 ↗(On Diff #30438)

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 ↗(On Diff #30438)

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.