Lines Matching +full:look +full:- +full:up
2 (How to avoid) Botching up ioctls
5 From: https://blog.ffwll.ch/2013/11/botching-up-ioctls.html
10 trying to come up with a unified interface to manage the execution units and
13 Which is nice, since there's no more insanity in the form of fake-generic, but
15 more potential to screw things up.
17 To avoid repeating all the same mistakes again I've written up some of the
19 only cover technicalities and not the big-picture issues like what the command
20 submission ioctl exactly should look like. Learning these lessons is probably
25 -------------
28 will need to add a 32-bit compat layer:
33 * Align everything to the natural size and use explicit padding. 32-bit
34 platforms don't necessarily align 64-bit values to 64-bit boundaries, but
35 64-bit platforms do. So we always need padding to the natural size to get
38 * Pad the entire struct to a multiple of 64-bits if the structure contains
39 64-bit types - the structure size will otherwise differ on 32-bit versus
40 64-bit. Having a different structure size hurts when passing arrays of
53 ------
55 With the joys of writing a compat layer avoided we can take a look at the basic
66 the structure. The drm core checks the passed-in size for each ioctl call
67 and zero-extends any mismatches between kernel and userspace. That helps,
78 structures, even if you never use them in an array - the padding the compiler
85 --------------------
89 error handling paths - GPUs will die eventually in the oddmost corner cases
111 how you handle ioctl restarting - e.g. drm has a tiny drmIoctl helper in its
119 still too tricky have a timeout or hangcheck safety net as a last-ditch
123 - it's way too easy to create a deadlock between your hangcheck code and
128 ----------------------------
139 will mismatch if you look close enough, but if performance measuring tools
141 get at the raw values of some clocks (e.g. through in-command-stream
156 always be extended - but users will surely hate you if their neat animations
163 * Have testcases for corner-cases, especially whether the return values for
164 already-completed events, successful waits and timed-out waits are all sane
169 ----------------------
171 A full-blown drm driver essentially implements a little OS, but specialized to
178 needs to be shared across processes - fd-passing over unix domain sockets
184 default pick a private per-fd namespace which forces any sharing to be done
185 explicitly. Only go with a more global per-device namespace if the objects
186 are truly device-unique. One counterexample in the drm modeset interfaces is
187 that the per-device modeset objects like connectors share a namespace with
198 as unique identifiers - it's how real files are told apart, too.
199 Unfortunately this requires a full-blown virtual filesystem in the kernel.
203 -------------------
207 * Think hard whether you really want a driver-private interface. Of course
208 it's much quicker to push a driver-private interface than engaging in
211 end, once the generic interface comes around you'll end up maintaining two
215 per-device settings, or for child objects with fairly static lifetimes (like
221 your driver proves popular and your hardware platforms long-lived then you'll