From nobody Sat Sep 17 18:39:35 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MVKVY3GZpz4c2Sx for ; Sat, 17 Sep 2022 18:39:49 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-vs1-xe2a.google.com (mail-vs1-xe2a.google.com [IPv6:2607:f8b0:4864:20::e2a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MVKVX64MZz3k3M for ; Sat, 17 Sep 2022 18:39:48 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-vs1-xe2a.google.com with SMTP id k2so25978407vsk.8 for ; Sat, 17 Sep 2022 11:39:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=90lP0iqPTpjORyKxxFPG7xSYGMoAMaksRIQ2M0Tc/ho=; b=qTyzfAlkfNa+2oFWYiKKPFuPbVq+OMPdUd5MzDVM/z+aAd8SfThWKD4YMnPulK+pTM Iz7I6eKVnmPZavtEwQOYATcK3lvEb/IWfQrfejG9B8samIIoHOtPMrJ7+YN+dlnP8DQw AolDswDHqpvmykNMXBy6LEGBxvPyG2wWmC52tqcrtO8AJucdd1o1CN1J8sAIMCJ5j/pU 06cGudmaP6y/wG9thpCC45zL34yl6FXO2LfIeM0fL/Ooite8Drbu7/9Hs+lVeq9dEJqE jxMWkWcFX5/j6sBfqDKYERddsqWlQfOOMK15Y5i4BVDyVcne0Y8c5J6dja6G5BX5m5Nv 3vxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=90lP0iqPTpjORyKxxFPG7xSYGMoAMaksRIQ2M0Tc/ho=; b=QCygMNr2Zht5V0gf1SASNgwKP5YQzKb8Vp20ns4BKK+81/v8QRYrJrbA5I1mY57VM/ lkV/qGOOZY+q4tuRpXj1ZW9adG/JNr++vbwT9Ou1xBN9mW8tKE6wg/9KiE2bZo9KBrLY E7lMZZ73VkxXdjgJUjoxvk1wC2ahcgX8sJGBdH0RNSHxLcmgnBlIcU+FTtnzBPnozwY7 vgPyt8Pc8JCBB0/cqrxDv/uvg4VvG/HY0YBT65ow8PjRWLbX1eXScqUJEcJCIJpyPVkN PikWosJb60yNdgwCHwDnlMut2XS47KNcjOdfZ3W1dAUpjJs966/ut/uS8Y89tDd7ZQT9 Cxaw== X-Gm-Message-State: ACrzQf2AHkX2qOAuYBNjiAlJ+sLB0kNiKBAK07uzkkG4PVHOpQkvY/j0 S8NzsvdhcrwTJGJ0A3BC1Ob+c/j+vPFNQN7DEpSUmQ== X-Google-Smtp-Source: AMsMyM6xOS4oGdBdwYurr71Rr6pzwWNXAWOYxVg1vg2Dd7pbLOWc24RzpUFonG2Xmqi5O5eGHRcP0ApS6NhHjJtgfGM= X-Received: by 2002:a67:b209:0:b0:397:1b01:4223 with SMTP id b9-20020a67b209000000b003971b014223mr3989822vsf.67.1663439987379; Sat, 17 Sep 2022 11:39:47 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <202209161554.28GFs4aA086609@gitrepo.freebsd.org> <20220917190108.2b56bb39@FreeBSD.org> In-Reply-To: <20220917190108.2b56bb39@FreeBSD.org> From: Warner Losh Date: Sat, 17 Sep 2022 12:39:35 -0600 Message-ID: Subject: Re: git: 9758dd3de1cd - main - stand: Allocate bootinfo rather than have it be static To: =?UTF-8?Q?T=C4=B3l_Coosemans?= Cc: Warner Losh , src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="0000000000008daaae05e8e3cd10" X-Rspamd-Queue-Id: 4MVKVX64MZz3k3M X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20210112.gappssmtp.com header.s=20210112 header.b=qTyzfAlk; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::e2a) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-2.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998]; NEURAL_HAM_SHORT(-0.99)[-0.992]; NEURAL_HAM_LONG(-0.99)[-0.991]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20210112.gappssmtp.com:s=20210112]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::e2a:from]; MLMMJ_DEST(0.00)[dev-commits-src-all@freebsd.org]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MIME_TRACE(0.00)[0:+,1:+,2:~]; R_SPF_NA(0.00)[no SPF record]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; TO_DN_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20210112.gappssmtp.com:+]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; RCPT_COUNT_FIVE(0.00)[5]; DMARC_NA(0.00)[bsdimp.com]; RCVD_COUNT_TWO(0.00)[2] X-ThisMailContainsUnwantedMimeParts: N --0000000000008daaae05e8e3cd10 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Sep 17, 2022, 11:01 AM T=C4=B3l Coosemans wrote: > On Fri, 16 Sep 2022 15:54:04 GMT Warner Losh wrote: > > The branch main has been updated by imp: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3D9758dd3de1cddc8271be8dd6fee6928= 6c5c86535 > > > > commit 9758dd3de1cddc8271be8dd6fee69286c5c86535 > > Author: Warner Losh > > AuthorDate: 2022-09-16 15:09:41 +0000 > > Commit: Warner Losh > > CommitDate: 2022-09-16 15:18:57 +0000 > > > > stand: Allocate bootinfo rather than have it be static > > > > This saves 80 bytes (the new bootinfo structure was 84 bytes, and a > > pointer is 4 bytes). The bi_load32 code is the same size. > > > > Sponsored by: Netflix > > Reviewed by: tsoome > > Differential Revision: https://reviews.freebsd.org/D36575 > > --- > > stand/i386/libi386/bootinfo32.c | 29 +++++++++++++++-------------- > > 1 file changed, 15 insertions(+), 14 deletions(-) > > > > diff --git a/stand/i386/libi386/bootinfo32.c > b/stand/i386/libi386/bootinfo32.c > > index 372bced917d6..37a797289f2b 100644 > > --- a/stand/i386/libi386/bootinfo32.c > > +++ b/stand/i386/libi386/bootinfo32.c > > @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); > > #include "geliboot.h" > > #endif > > > > -static struct bootinfo bi; > > +static struct bootinfo *bi; > > > > /* > > * Load the information expected by an i386 kernel. > > @@ -91,11 +91,12 @@ bi_load32(char *args, int *howtop, int *bootdevp, > vm_offset_t *bip, vm_offset_t > > /* XXX - use a default bootdev of 0. Is this ok??? */ > > bootdevnr =3D 0; > > > > + bi =3D calloc(sizeof(*bi), 1); > > switch(rootdev->dd.d_dev->dv_type) { > > case DEVT_CD: > > case DEVT_DISK: > > /* pass in the BIOS device number of the current disk */ > > - bi.bi_bios_dev =3D bd_unit2bios(rootdev); > > + bi->bi_bios_dev =3D bd_unit2bios(rootdev); > > bootdevnr =3D bd_getdev(rootdev); > > break; > > > > @@ -172,22 +173,22 @@ bi_load32(char *args, int *howtop, int *bootdevp, > vm_offset_t *bip, vm_offset_t > > /* legacy bootinfo structure */ > > kernelname =3D getenv("kernelname"); > > i386_getdev(NULL, kernelname, &kernelpath); > > - bi.bi_version =3D BOOTINFO_VERSION; > > - bi.bi_size =3D sizeof(bi); > > - bi.bi_memsizes_valid =3D 1; > > - bi.bi_basemem =3D bios_basemem / 1024; > > - bi.bi_extmem =3D bios_extmem / 1024; > > - bi.bi_envp =3D envp; > > - bi.bi_modulep =3D *modulep; > > - bi.bi_kernend =3D kernend; > > - bi.bi_kernelname =3D VTOP(kernelpath); > > - bi.bi_symtab =3D ssym; /* XXX this is only the primary kerne= l > symtab */ > > - bi.bi_esymtab =3D esym; > > + bi->bi_version =3D BOOTINFO_VERSION; > > + bi->bi_size =3D sizeof(bi); > > sizeof(*bi) here and maybe make bi a function variable? > Damn. I even looked for those... :( Warner > + bi->bi_memsizes_valid =3D 1; > > + bi->bi_basemem =3D bios_basemem / 1024; > > + bi->bi_extmem =3D bios_extmem / 1024; > > + bi->bi_envp =3D envp; > > + bi->bi_modulep =3D *modulep; > > + bi->bi_kernend =3D kernend; > > + bi->bi_kernelname =3D VTOP(kernelpath); > > + bi->bi_symtab =3D ssym; /* XXX this is only the primary kern= el > symtab */ > > + bi->bi_esymtab =3D esym; > > > > /* legacy boot arguments */ > > *howtop =3D howto | RB_BOOTINFO; > > *bootdevp =3D bootdevnr; > > - *bip =3D VTOP(&bi); > > + *bip =3D VTOP(bi); > > > > return(0); > > } > > --0000000000008daaae05e8e3cd10 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Sat, Sep 17, 2022, 11:01 AM T=C4=B3l Coosemans <= tijl@freebsd.org> wrote:
On Fri, 16 Sep 2022 15:54:04 GMT Warner Lo= sh <imp@FreeBSD.org> wrote:
> The branch main has been updated by imp:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=3D9758dd3de1cddc8271be8dd6fee692= 86c5c86535
>
> commit 9758dd3de1cddc8271be8dd6fee69286c5c86535
> Author:=C2=A0 =C2=A0 =C2=A0Warner Losh <imp@FreeBSD.org>
> AuthorDate: 2022-09-16 15:09:41 +0000
> Commit:=C2=A0 =C2=A0 =C2=A0Warner Losh <imp@FreeBSD.org>
> CommitDate: 2022-09-16 15:18:57 +0000
>
>=C2=A0 =C2=A0 =C2=A0stand: Allocate bootinfo rather than have it be sta= tic
>=C2=A0 =C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0This saves 80 bytes (the new bootinfo structure was= 84 bytes, and a
>=C2=A0 =C2=A0 =C2=A0pointer is 4 bytes). The bi_load32 code is the same= size.
>=C2=A0 =C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0Sponsored by:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0Netflix
>=C2=A0 =C2=A0 =C2=A0Reviewed by:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 tsoome
>=C2=A0 =C2=A0 =C2=A0Differential Revision:=C2=A0 ht= tps://reviews.freebsd.org/D36575
> ---
>=C2=A0 stand/i386/libi386/bootinfo32.c | 29 +++++++++++++++------------= --
>=C2=A0 1 file changed, 15 insertions(+), 14 deletions(-)
>
> diff --git a/stand/i386/libi386/bootinfo32.c b/stand/i386/libi386/boot= info32.c
> index 372bced917d6..37a797289f2b 100644
> --- a/stand/i386/libi386/bootinfo32.c
> +++ b/stand/i386/libi386/bootinfo32.c
> @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$");
>=C2=A0 #include "geliboot.h"
>=C2=A0 #endif
>=C2=A0
> -static struct bootinfo=C2=A0 bi;
> +static struct bootinfo=C2=A0 *bi;
>=C2=A0
>=C2=A0 /*
>=C2=A0 =C2=A0* Load the information expected by an i386 kernel.
> @@ -91,11 +91,12 @@ bi_load32(char *args, int *howtop, int *bootdevp, = vm_offset_t *bip, vm_offset_t
>=C2=A0 =C2=A0 =C2=A0 /* XXX - use a default bootdev of 0.=C2=A0 Is this= ok??? */
>=C2=A0 =C2=A0 =C2=A0 bootdevnr =3D 0;
>=C2=A0
> +=C2=A0 =C2=A0 bi =3D calloc(sizeof(*bi), 1);
>=C2=A0 =C2=A0 =C2=A0 switch(rootdev->dd.d_dev->dv_type) {
>=C2=A0 =C2=A0 =C2=A0 case DEVT_CD:
>=C2=A0 =C2=A0 =C2=A0 case DEVT_DISK:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0/* pass in the BIOS device number of the cur= rent disk */
> -=C2=A0 =C2=A0 =C2=A0bi.bi_bios_dev =3D bd_unit2bios(rootdev);
> +=C2=A0 =C2=A0 =C2=A0bi->bi_bios_dev =3D bd_unit2bios(rootdev);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0bootdevnr =3D bd_getdev(rootdev);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0break;
>=C2=A0
> @@ -172,22 +173,22 @@ bi_load32(char *args, int *howtop, int *bootdevp= , vm_offset_t *bip, vm_offset_t
>=C2=A0 =C2=A0 =C2=A0 /* legacy bootinfo structure */
>=C2=A0 =C2=A0 =C2=A0 kernelname =3D getenv("kernelname");
>=C2=A0 =C2=A0 =C2=A0 i386_getdev(NULL, kernelname, &kernelpath); > -=C2=A0 =C2=A0 bi.bi_version =3D BOOTINFO_VERSION;
> -=C2=A0 =C2=A0 bi.bi_size =3D sizeof(bi);
> -=C2=A0 =C2=A0 bi.bi_memsizes_valid =3D 1;
> -=C2=A0 =C2=A0 bi.bi_basemem =3D bios_basemem / 1024;
> -=C2=A0 =C2=A0 bi.bi_extmem =3D bios_extmem / 1024;
> -=C2=A0 =C2=A0 bi.bi_envp =3D envp;
> -=C2=A0 =C2=A0 bi.bi_modulep =3D *modulep;
> -=C2=A0 =C2=A0 bi.bi_kernend =3D kernend;
> -=C2=A0 =C2=A0 bi.bi_kernelname =3D VTOP(kernelpath);
> -=C2=A0 =C2=A0 bi.bi_symtab =3D ssym;=C2=A0 =C2=A0 =C2=A0 =C2=A0/* XXX= this is only the primary kernel symtab */
> -=C2=A0 =C2=A0 bi.bi_esymtab =3D esym;
> +=C2=A0 =C2=A0 bi->bi_version =3D BOOTINFO_VERSION;
> +=C2=A0 =C2=A0 bi->bi_size =3D sizeof(bi);

sizeof(*bi) here and maybe make bi a function variable?

Damn. I even looked = for those... :(

Warner= =C2=A0

> +=C2=A0 =C2=A0 bi->bi_memsizes_valid =3D 1;
> +=C2=A0 =C2=A0 bi->bi_basemem =3D bios_basemem / 1024;
> +=C2=A0 =C2=A0 bi->bi_extmem =3D bios_extmem / 1024;
> +=C2=A0 =C2=A0 bi->bi_envp =3D envp;
> +=C2=A0 =C2=A0 bi->bi_modulep =3D *modulep;
> +=C2=A0 =C2=A0 bi->bi_kernend =3D kernend;
> +=C2=A0 =C2=A0 bi->bi_kernelname =3D VTOP(kernelpath);
> +=C2=A0 =C2=A0 bi->bi_symtab =3D ssym;=C2=A0 =C2=A0 =C2=A0 =C2=A0/*= XXX this is only the primary kernel symtab */
> +=C2=A0 =C2=A0 bi->bi_esymtab =3D esym;
>=C2=A0
>=C2=A0 =C2=A0 =C2=A0 /* legacy boot arguments */
>=C2=A0 =C2=A0 =C2=A0 *howtop =3D howto | RB_BOOTINFO;
>=C2=A0 =C2=A0 =C2=A0 *bootdevp =3D bootdevnr;
> -=C2=A0 =C2=A0 *bip =3D VTOP(&bi);
> +=C2=A0 =C2=A0 *bip =3D VTOP(bi);
>=C2=A0
>=C2=A0 =C2=A0 =C2=A0 return(0);
>=C2=A0 }

--0000000000008daaae05e8e3cd10--