Re: buildkernel is broken

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Thu, 07 Jul 2022 17:59:29 UTC
On 7 Jul 2022, at 19:00, Steve Kargl wrote:
> On Thu, Jul 07, 2022 at 10:37:40AM -0600, Warner Losh wrote:
>> On Thu, Jul 7, 2022 at 10:37 AM Steve Kargl <
>> sgk@troutmask.apl.washington.edu> wrote:
>>
>>> Thanks, but
>>>
>>> root[216] git cherry-pick -n 37f604b49d4a
>>> fatal: bad revision '37f604b49d4a'
>>> root[217] pwd
>>> /usr/src
>>
>>
>> git fetch maybe?
>>
>
> A cursory google search suggests that 'git fetch'
> works on repositories not single files.
>
> I did look at the diff associated with 37f604b49d4a.
> I am surprised that the commit that broke buildkernel
> for me was allowed to be committed.

It was posted for review in https://reviews.freebsd.org/D35716

I’ll also point out that this commit works just fine in nearly all of 
our kernel configs, because there are very few (only one powerpc config, 
as far as I can tell) that do not have VIMAGE.
Arguably we should have a non-VIMAGE kernel config around (probably for 
amd64) so it’s more likely we spot these issues prior to commit.
Arbitrary non-default kernel configs are more likely to see issues like 
this one. I don’t think that can be avoided.

> The fix in
> 37f604b49d4a seems rather questionable especially given
> that there is no comment about why the macro is expanded
> to a zero-trip loop.
>
I’m not sure how I could have been much more clear than this:

     VNET_FOREACH() is a LIST_FOREACH if VIMAGE is set, but empty if 
it's
     not. This means that users of the macro couldn't use 'continue' or
     'break' as one would expect of a loop.

I welcome suggestions on how to improve my future commit messages.

To rephrase it a bit: VNET_FOREACH() used to be very misleading, in that 
it was only a loop with options VIMAGE, and empty (so any code within 
would be its own block, and be executed exactly once, for the only vnet 
that exists without VIMAGE). That’s fine, unless you want to 
‘continue’ or ‘break’ the loop. That worked with VIMAGE (so the 
issue in the dummynet fix was not seen) but not without it.

Kristof