From nobody Wed Jul 19 01:44:24 2023 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 4R5JXN3nnJz4nJCk for ; Wed, 19 Jul 2023 01:44:36 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) (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 4R5JXN1wjXz4Lc4 for ; Wed, 19 Jul 2023 01:44:36 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-52166c7f77cso7533479a12.2 for ; Tue, 18 Jul 2023 18:44:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20221208.gappssmtp.com; s=20221208; t=1689731074; x=1692323074; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=uCY2iLvxJQ7R7H/8GFV90s6FgishoJFgEqh1Nq6fVbE=; b=HKtCtM8+pVKXGW8VaKBZQ2K3ztN3g7Zo0ajNfuvqpwzjYi4haCPciFzY/+2XVa7lpq kAM0nNQEjsLgoNkpIb4GPaGIGQ+t4ATr94fOv3hC+YVJ/UPkdfAfVMxYKy6Zhz2DERmB 7Px1AFJ/a+g6pSCohfZ+2V3QFPoWhLUGH3rfIwL/I2bkuRwfWdPIdhtS8Vhc+XBxvYTW zVUpHePZY2I/lLHg5VwOZZ5IOZZRHdDuuKuWwxHCVtqM+uPpAHhupO9Zb9uhM7tQj9r3 19WdBgGrpH9lAHBr7JYvaTr1pqqBdyf36ezXUA2TsL4VJ9OlbiZL15fCrhw7myKpG+F/ qLKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689731074; x=1692323074; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uCY2iLvxJQ7R7H/8GFV90s6FgishoJFgEqh1Nq6fVbE=; b=YAyZBQVcPEpBAGNh43PlW4Sa0yu3Phzbzbvxws94e0m/5gSv768EoqyBXa/2iWwmEZ OdsxhNL3l0VDB1c7Y1/MOVFbuzoYAnC8SavCiU5r17nIIoVgWrln0g7jpBuvzENSjJge wHMdVmQhMpJdpTwJR39AEkJg/dx6PEaqcPt6Ikl+H9mIcqspXKXm590ALLbouWH7zJ+k Y5bw+O31V/RNZ3Vs2eMEApZ+JNqCCFPhUSmCCJlAHUheQ+MCZj/wlpTqftWr/ZX8tsAW TLgvHgrRbcOumfq/o6GUmJDNKikaIJGz73L8flnshyil7zHNJdBxSfRymcCOiKSzHhAL O2kg== X-Gm-Message-State: ABy/qLYTL0s7r/kqxEbn5Da3uX7Qqtsyr1H2sf2L3u+ZYE0KKnlhy8ip 9Ut0oZSx8bYpleA1Ne1bFcfE7ehepivuVcNdlvHdHL4oK359M9r/8o4HNg== X-Google-Smtp-Source: APBJJlELcwSAQd3/BAKFlfR4Cj376T9WCdz7RpIMk6mjUjFirDRrZAANAnt4gk+4E4RugJg2NumPM/lH5pJBhYP2/p4= X-Received: by 2002:a05:6402:1849:b0:51e:3bb0:aa4e with SMTP id v9-20020a056402184900b0051e3bb0aa4emr1200144edy.15.1689731074471; Tue, 18 Jul 2023 18:44:34 -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: <202307190120.36J1K1mQ011397@gitrepo.freebsd.org> In-Reply-To: <202307190120.36J1K1mQ011397@gitrepo.freebsd.org> From: Warner Losh Date: Tue, 18 Jul 2023 19:44:24 -0600 Message-ID: Subject: Re: git: c5312bd79e66 - main - cam: Move bus_dmamap_load_ccb into cam.c. To: John Baldwin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="00000000000075cc400600cd2ca2" X-Rspamd-Queue-Id: 4R5JXN1wjXz4Lc4 X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated --00000000000075cc400600cd2ca2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable As predicted in the review, this is broken: -- command output -- linking kernel.full ld: error: undefined symbol: bus_dmamap_load_ccb >>> referenced by nvme_qpair.c:1209 (/usr/home/imp/git/freebsd/src/sys/dev/nvme/nvme_qpair.c:1209) >>> nvme_qpair.o:(_nvme_qpair_submit_request) _ from using sys/amd64/conf/EX include MINIMAL device nvme device nvd This has to be in the header file. The MODULE_DEPENDS stuff doesn't pull anything in for the static kernel case. Please, lets' do this in the header with a static inline like I suggested to get around this issue. Warner On Tue, Jul 18, 2023 at 7:20=E2=80=AFPM John Baldwin wrot= e: > The branch main has been updated by jhb: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3Dc5312bd79e66ce8ef50655ce7f3eca0= 6d6b6e24f > > commit c5312bd79e66ce8ef50655ce7f3eca06d6b6e24f > Author: John Baldwin > AuthorDate: 2023-07-19 01:19:27 +0000 > Commit: John Baldwin > CommitDate: 2023-07-19 01:19:27 +0000 > > cam: Move bus_dmamap_load_ccb into cam.c. > > This routine is specific to CAM and no longer assumes any internal > bus_dma knowledge as it is simple wrapper around bus_dmamap_load_mem. > > Fixes: 60381fd1ee86 memdesc: Retire MEMDESC_CCB. > Reviewed by: kib > Differential Revision: https://reviews.freebsd.org/D41058 > --- > sys/cam/cam.c | 20 ++++++++++++++++++++ > sys/kern/subr_bus_dma.c | 19 ------------------- > 2 files changed, 20 insertions(+), 19 deletions(-) > > diff --git a/sys/cam/cam.c b/sys/cam/cam.c > index ce7dc81b3495..7d9d8602d009 100644 > --- a/sys/cam/cam.c > +++ b/sys/cam/cam.c > @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); > > #ifdef _KERNEL > #include > +#include > #include > #include > > @@ -642,4 +643,23 @@ memdesc_ccb(union ccb *ccb) > panic("%s: flags 0x%X unimplemented", __func__, > ccb_h->flags); > } > } > + > +int > +bus_dmamap_load_ccb(bus_dma_tag_t dmat, bus_dmamap_t map, union ccb *ccb= , > + bus_dmamap_callback_t *callback, void *callback_arg, > + int flags) > +{ > + struct ccb_hdr *ccb_h; > + struct memdesc mem; > + > + ccb_h =3D &ccb->ccb_h; > + if ((ccb_h->flags & CAM_DIR_MASK) =3D=3D CAM_DIR_NONE) { > + callback(callback_arg, NULL, 0, 0); > + return (0); > + } > + > + mem =3D memdesc_ccb(ccb); > + return (bus_dmamap_load_mem(dmat, map, &mem, callback, > callback_arg, > + flags)); > +} > #endif > diff --git a/sys/kern/subr_bus_dma.c b/sys/kern/subr_bus_dma.c > index da7a2ee4cdc9..683b41d0047c 100644 > --- a/sys/kern/subr_bus_dma.c > +++ b/sys/kern/subr_bus_dma.c > @@ -449,25 +449,6 @@ bus_dmamap_load_uio(bus_dma_tag_t dmat, bus_dmamap_t > map, struct uio *uio, > return (error); > } > > -int > -bus_dmamap_load_ccb(bus_dma_tag_t dmat, bus_dmamap_t map, union ccb *ccb= , > - bus_dmamap_callback_t *callback, void *callback_arg, > - int flags) > -{ > - struct ccb_hdr *ccb_h; > - struct memdesc mem; > - > - ccb_h =3D &ccb->ccb_h; > - if ((ccb_h->flags & CAM_DIR_MASK) =3D=3D CAM_DIR_NONE) { > - callback(callback_arg, NULL, 0, 0); > - return (0); > - } > - > - mem =3D memdesc_ccb(ccb); > - return (bus_dmamap_load_mem(dmat, map, &mem, callback, > callback_arg, > - flags)); > -} > - > int > bus_dmamap_load_bio(bus_dma_tag_t dmat, bus_dmamap_t map, struct bio *bi= o, > bus_dmamap_callback_t *callback, void *callback_arg, > --00000000000075cc400600cd2ca2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
As predicted in the review, this is = broken:

-- command output --
linking kernel.ful= l
ld: error: undefined symbol: bus_dmamap_load_ccb
>>> refer= enced by nvme_qpair.c:1209 (/usr/home/imp/git/freebsd/src/sys/dev/nvme/nvme= _qpair.c:1209)
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 nvme_qpair.o:(_nvme_qpair_submit_request)
_
from using = sys/amd64/conf/EX
include MINIMAL
device nvme
device nvd

This has to= be in the header file. The MODULE_DEPENDS stuff doesn't pull anything = in for the
static kernel case.

Please, lets' do = this in the header with a static inline like I suggested to get around this= issue.

= Warner

On Tue, Jul 18, 2023 at 7:20=E2=80=AFPM John Bal= dwin <jhb@freebsd.org> wrote:<= br>
The branch main = has been updated by jhb:

URL: https://cgit.= FreeBSD.org/src/commit/?id=3Dc5312bd79e66ce8ef50655ce7f3eca06d6b6e24f
commit c5312bd79e66ce8ef50655ce7f3eca06d6b6e24f
Author:=C2=A0 =C2=A0 =C2=A0John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-07-19 01:19:27 +0000
Commit:=C2=A0 =C2=A0 =C2=A0John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-07-19 01:19:27 +0000

=C2=A0 =C2=A0 cam: Move bus_dmamap_load_ccb into cam.c.

=C2=A0 =C2=A0 This routine is specific to CAM and no longer assumes any int= ernal
=C2=A0 =C2=A0 bus_dma knowledge as it is simple wrapper around bus_dmamap_l= oad_mem.

=C2=A0 =C2=A0 Fixes:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 60381fd1ee86 memdesc= : Retire MEMDESC_CCB.
=C2=A0 =C2=A0 Reviewed by:=C2=A0 =C2=A0 kib
=C2=A0 =C2=A0 Differential Revision:=C2=A0 https://reviews.freebsd= .org/D41058
---
=C2=A0sys/cam/cam.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 20 ++++++++++= ++++++++++
=C2=A0sys/kern/subr_bus_dma.c | 19 -------------------
=C2=A02 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/sys/cam/cam.c b/sys/cam/cam.c
index ce7dc81b3495..7d9d8602d009 100644
--- a/sys/cam/cam.c
+++ b/sys/cam/cam.c
@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");

=C2=A0#ifdef _KERNEL
=C2=A0#include <sys/libkern.h>
+#include <machine/bus.h>
=C2=A0#include <cam/cam_queue.h>
=C2=A0#include <cam/cam_xpt.h>

@@ -642,4 +643,23 @@ memdesc_ccb(union ccb *ccb)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 panic("%s: fla= gs 0x%X unimplemented", __func__, ccb_h->flags);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0}
+
+int
+bus_dmamap_load_ccb(bus_dma_tag_t dmat, bus_dmamap_t map, union ccb *ccb,<= br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0bus_d= mamap_callback_t *callback, void *callback_arg,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0int f= lags)
+{
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct ccb_hdr *ccb_h;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct memdesc mem;
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ccb_h =3D &ccb->ccb_h;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if ((ccb_h->flags & CAM_DIR_MASK) =3D=3D= CAM_DIR_NONE) {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0callback(callback_a= rg, NULL, 0, 0);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return (0);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0mem =3D memdesc_ccb(ccb);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return (bus_dmamap_load_mem(dmat, map, &mem= , callback, callback_arg,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0flags));
+}
=C2=A0#endif
diff --git a/sys/kern/subr_bus_dma.c b/sys/kern/subr_bus_dma.c
index da7a2ee4cdc9..683b41d0047c 100644
--- a/sys/kern/subr_bus_dma.c
+++ b/sys/kern/subr_bus_dma.c
@@ -449,25 +449,6 @@ bus_dmamap_load_uio(bus_dma_tag_t dmat, bus_dmamap_t m= ap, struct uio *uio,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return (error);
=C2=A0}

-int
-bus_dmamap_load_ccb(bus_dma_tag_t dmat, bus_dmamap_t map, union ccb *ccb,<= br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0bus_d= mamap_callback_t *callback, void *callback_arg,
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0int f= lags)
-{
-=C2=A0 =C2=A0 =C2=A0 =C2=A0struct ccb_hdr *ccb_h;
-=C2=A0 =C2=A0 =C2=A0 =C2=A0struct memdesc mem;
-
-=C2=A0 =C2=A0 =C2=A0 =C2=A0ccb_h =3D &ccb->ccb_h;
-=C2=A0 =C2=A0 =C2=A0 =C2=A0if ((ccb_h->flags & CAM_DIR_MASK) =3D=3D= CAM_DIR_NONE) {
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0callback(callback_a= rg, NULL, 0, 0);
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return (0);
-=C2=A0 =C2=A0 =C2=A0 =C2=A0}
-
-=C2=A0 =C2=A0 =C2=A0 =C2=A0mem =3D memdesc_ccb(ccb);
-=C2=A0 =C2=A0 =C2=A0 =C2=A0return (bus_dmamap_load_mem(dmat, map, &mem= , callback, callback_arg,
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0flags));
-}
-
=C2=A0int
=C2=A0bus_dmamap_load_bio(bus_dma_tag_t dmat, bus_dmamap_t map, struct bio = *bio,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bus_d= mamap_callback_t *callback, void *callback_arg,
--00000000000075cc400600cd2ca2--