proposal: require ivar accessors to succeed

Andriy Gapon avg at FreeBSD.org
Wed May 29 10:06:13 UTC 2019


On 27/05/2019 08:44, Andriy Gapon wrote:
> 
> __BUS_ACCESSOR() macro is used to define accessors to bus IVAR variables.
> Unfortunately, accessors defined in such a fashion completely ignore return
> values of BUS_READ_IVAR() and BUS_WRITE_IVAR() method calls.  There is no way to
> see if a call is successful.  Typically, this should not be a problem as a
> device driver targets a specific bus (sometimes, buses) and it should know what
> IVARs the bus has.  So, the driver should make only those IVAR calls that are
> supposed to always succeed on the bus.
> But sometimes things can go wrong as with everything else.
> 
> So, I am proposing to add some code to __BUS_ACCESSOR to verify the success.
> For example, we can panic when a call fails.  The checks could be under
> INVARIANTS or under DIAGNOSTICS or under a new kernel option.
> A less drastic option is to print a warning message on an error.
> 
> This is mostly intended to help driver writers and maintainers.
> 
> Opinions, suggestions, etc are welcome.
> Thank you.
> 

I've create a review request for this suggestion: https://reviews.freebsd.org/D20458
Please join in if you are interested.

-- 
Andriy Gapon


More information about the freebsd-arch mailing list