Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 May 2019 10:23:41 -0700
From:      Conrad Meyer <cem@freebsd.org>
To:        Andriy Gapon <avg@freebsd.org>
Cc:        freebsd-arch@freebsd.org
Subject:   Re: proposal: require ivar accessors to succeed
Message-ID:  <CAG6CVpXSqTiqZPbvVooPZF-yeMbQc=eX%2BVhFwywJw=K_A6RiVg@mail.gmail.com>
In-Reply-To: <2b2ab28f-45c5-1c28-f923-170d95c20c3d@FreeBSD.org>
References:  <2b2ab28f-45c5-1c28-f923-170d95c20c3d@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Seems like a good idea to me.

Best, Conrad

On Sun, May 26, 2019 at 10:45 PM Andriy Gapon <avg@freebsd.org> 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.
> --
> Andriy Gapon
> _______________________________________________
> freebsd-arch@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-arch
> To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpXSqTiqZPbvVooPZF-yeMbQc=eX%2BVhFwywJw=K_A6RiVg>