Re: [RFC] An idea for general kernel post-processing automation in FreeBSD

From: Kyle Evans <kevans_at_freebsd.org>
Date: Wed, 24 May 2023 14:25:24 UTC
On Wed, May 24, 2023 at 4:47 AM Hans Petter Selasky <hps@selasky.org> wrote:
>
> >> IMO sorting at runtime is a minor feature by itself, too. I mentioned
> >> in one of the reviews somewhere, we have in the past have had bugs due
> >> to poor specification of sysinit order within a subsystem -- I'm
> >> recalling a specific one that wasn't even that long ago, maybe three
> >> or four years, that manu@ had hit because he did or didn't include
> >> some device in his config that ended up shifting link order of other
> >> objects and reversing two sysinits into an order that wasn't actually
> >> functional.
> >   Yes this problem was a pain to debug (I mean just to understand the
> > actual problem), and iirc it was never solved, I only had the issue on
> > one machine that I don't use anymore and the problem went away and
> > re-apears from time to time when sysinits where added.
> >
> >> We can still add some bits to test that (preferably a
> >> tunable to reverse order within a subsystem rather than having to
> >> re-link the kernel) even with sorting at link-time, but it sure does
> >> look a lot less fragile if we have to sort it anyways and we just
> >> reverse one criteria.
>
> I think if you could just diff two plaintext files, listing all the
> constructors in the correct order, that would be of great help when
> problems arise in this area. You cannot always rely on having a console
> during bringup.
>

Maybe? That's making a lot of assumptions about the failure mode of a
black box, and sysinit ordering is probably the last thing I'd expect
for 95+% of fail-to-boot scenarios. My point was really just that it
does come up sometimes, and it'd be really useful to be able to
quickly and easily test a different ordering in CI (+ reproduce the
different ordering outside of CI).

>
> At the mention of manu@, I remember how difficult it was to bringup the
> graphics driver code and kernel modules which are common among FreeBSD
> desktop users. What do you do, if all you have is a black screen, and
> you need to debug something?
>

I'm sorry, but staring at a list of 1000+ ordered sysinits isn't going
to help you any more than staring at a list of 1000+ unordered
sysinits in debugging anything when you don't have a console and thus,
very little direction to start debugging in.

Thanks,

Kyle Evans