Page MenuHomeFreeBSD

Move td_softdep_cleanup() from userret() to ast()
ClosedPublic

Authored by trasz on Wed, Sep 9, 3:24 PM.

Details

Summary

Move td_softdep_cleanup() from userret() to ast(); it's infrequent
at best. The schedule_cleanup() function already sets TDF_ASTPENDING.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

trasz created this revision.Wed, Sep 9, 3:24 PM
trasz requested review of this revision.Wed, Sep 9, 3:24 PM
kib added inline comments.Wed, Sep 9, 3:50 PM
sys/kern/subr_trap.c
198 ↗(On Diff #76814)

Leave the assert there.

trasz added inline comments.Wed, Sep 9, 4:36 PM
sys/kern/subr_trap.c
198 ↗(On Diff #76814)

Wouldn't it trip at the first possibility due to ast() being called from the syscall enter assembly code some time after userret() returns?

kib added inline comments.Thu, Sep 10, 2:45 PM
sys/kern/subr_trap.c
198 ↗(On Diff #76814)

I do not understand what are you saying there.

The assert can be triggered if userret() is executed before ast is handled, or if ast() 'forgot' to handle requested su cleanup. I do not believe that the first case is possible.

Or rather, if userret() triggers that, there is a bug in your patch.

trasz added inline comments.Thu, Sep 10, 8:29 PM
sys/kern/subr_trap.c
198 ↗(On Diff #76814)

Erm, are you sure about it? My understanding is that (eg) amd64_syscall() calls syscallret(), syscallret() calls userret(), and then amd64_syscall() returns; ast() gets only called afterwards.

kib accepted this revision.Thu, Sep 10, 10:55 PM
kib added inline comments.
sys/kern/subr_trap.c
198 ↗(On Diff #76814)

Yes you are right. I would say that this should be fixed, but actually your series of the patches makes it not matter at all.

This revision is now accepted and ready to land.Thu, Sep 10, 10:55 PM
mckusick accepted this revision.Sat, Sep 12, 6:14 AM

This change looks reasonable to me as at least for amd64 every path out of the kernel appears to check TDF_ASTPENDING and calls ast() if set.