Page MenuHomeFreeBSD

Move KTRUSERRET() from userret() to ast()
Needs ReviewPublic

Authored by trasz on Fri, Sep 11, 10:40 AM.



Move KTRUSERRET() from userret() to ast(). It's a really long
detour - it writes ktrace entries to the filesystem - so the
overhead of ast() won't make any difference.

Diff Detail

rS FreeBSD src repository
Lint OK
No Unit Test Coverage
Build Status
Buildable 33505
Build 30776: arc lint + arc unit

Event Timeline

trasz created this revision.Fri, Sep 11, 10:40 AM
trasz requested review of this revision.Fri, Sep 11, 10:40 AM
kib added a comment.Fri, Sep 11, 6:57 PM

Please flush existing accepted reviews before adding more things touching the same place.

kib added inline comments.Tue, Sep 29, 1:08 PM

Idea is that we do not return to userspace with ktrace records not flushed. But look at the lines 280-283. It generates new ktrace record. At best, this would set ASTPENDING again.


This function accesses userspace pages and might generate KTR.


This function also generates ktrsig records.

trasz added inline comments.Wed, Sep 30, 3:03 PM

Good point. I'm kind of split about this. On one hand your you're of course right, we should flush the records before returning. On the other hand, the current code didn't do that. On yet another... limb, the current code didn't trigger AST. Perhaps it could be split into two patches, first moving this in a minimally intrusive way (ie the current patch), and subsequent patch moving it more to the end of ast()?

I'm exactly 50/50 about this, so if you prefer it to move the call to KTRUSERRET() more to the end of ast(), I'll happily do that.

kib added a comment.Wed, Sep 30, 7:07 PM

I am sure that if you move ktrace records processing to AST, then the same change should ensure that we do not create new unprocessed (not written while in the handler) records while handling AST. Simplest form is to move the ktruserret to the end. More involved change would call ktruserret both at the start of AST and at the end as well. First call clears as much as possible immediately to lower mem pressure, and the call at end clears everything that was generated by AST processing.