-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FreeBSD: Use a statement expression to implement SET_ERROR() #16284
Conversation
This way we can avoid making assumptions about the SDT probe implementation. No functional change intended. Signed-off-by: Mark Johnston <[email protected]>
This way we can avoid making assumptions about the SDT probe implementation. No functional change intended. This was submitted upstream as openzfs/zfs#16284
This way we can avoid making assumptions about the SDT probe implementation. No functional change intended. This was submitted upstream as openzfs/zfs#16284 MFC after: 1 week
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why SET_ERROR() ended up different different, but ZFS uses DTRACE_PROBE1() macro in plenty of places. I am not sure what is the difference from SDT_PROBE1(), but unification would probably be good.
The difference is just that SDT_* makes you define a probe's argument types in advance, while DTRACE_PROBE* does everything in one statement. So, DTRACE_PROBE* is more useful for ad-hoc tracing, while SDT_* lets you collect probe definitions and argument types in one place. It is a bit of an odd difference. It occurs also partly because DTRACE_PROBE* comes from illumos, while SDT_* is a FreeBSD interface. At some point we (FreeBSD) should try to unify them, but it is not much of a priority for me at the moment. From my POV, using SDT_* for SET_ERROR() makes some sense, since this macro is used frequently. If it was replaced with DTRACE_PROBE*, we'd just end up bloating zfs.ko a bit with redundant probe definitions. |
This way we can avoid making assumptions about the SDT probe implementation. No functional change intended. Signed-off-by: Mark Johnston <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Allan Jude <[email protected]> Reviewed-by: Rob Norris <[email protected]> Reviewed-by: Tino Reichardt <[email protected]> Reviewed-by: Tony Hutter <[email protected]>
…#16284) This way we can avoid making assumptions about the SDT probe implementation. No functional change intended. Signed-off-by: Mark Johnston <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Allan Jude <[email protected]> Reviewed-by: Rob Norris <[email protected]> Reviewed-by: Tino Reichardt <[email protected]> Reviewed-by: Tony Hutter <[email protected]>
This way we can avoid making assumptions about the SDT probe implementation. No functional change intended. This was submitted upstream as openzfs/zfs#16284 MFC after: 1 week
Use a statement expression to implement SET_ERROR().
Motivation and Context
The current implementation makes assumptions about how SDT_PROBE* is implemented on FreeBSD. These assumptions will become false after a forthcoming FreeBSD kernel change.
Description
SET_ERROR() can be implemented using a statement expression in a way that avoids making assumptions about SDT internals. OpenZFS uses statement expressions elsewhere in the kernel module, so I presume that doing so here is allowed.
How Has This Been Tested?
Interactively, using
dtrace -n 'sdt:::set-error {printf("%d", args[0]); stack();}'
and using a kernel debugger to validate dtrace's output.Types of changes
Checklist:
Signed-off-by
.