From owner-freebsd-current@freebsd.org Sun Jul 22 15:45:19 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 785FE104E908 for ; Sun, 22 Jul 2018 15:45:19 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id E302E791FC for ; Sun, 22 Jul 2018 15:45:18 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 9C71F104E907; Sun, 22 Jul 2018 15:45:18 +0000 (UTC) Delivered-To: current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78440104E906 for ; Sun, 22 Jul 2018 15:45:18 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 006E7791F7; Sun, 22 Jul 2018 15:45:17 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w6MFj5hJ062534 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 22 Jul 2018 18:45:08 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w6MFj5hJ062534 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w6MFj5x9062533; Sun, 22 Jul 2018 18:45:05 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 22 Jul 2018 18:45:05 +0300 From: Konstantin Belousov To: Li-Wen Hsu Cc: current@FreeBSD.org, br@freebsd.org Subject: Re: FreeBSD-head-riscv64-build - Build #9623 (r336573) - Failure Message-ID: <20180722154505.GE65334@kib.kiev.ua> References: <941706773.1.1532139392496.JavaMail.jenkins@jenkins.ci.freebsd.org> <20180721231832.GC65334@kib.kiev.ua> <20180722010116.GA13419@freefall.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180722010116.GA13419@freefall.freebsd.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jul 2018 15:45:19 -0000 On Sun, Jul 22, 2018 at 01:01:16AM +0000, Li-Wen Hsu wrote: > On Sun, Jul 22, 2018 at 02:18:32 +0300, Konstantin Belousov wrote: > > On Sat, Jul 21, 2018 at 02:16:17AM +0000, jenkins-admin@FreeBSD.org wrote: > > > --- lib/ofed/libmlx5__L --- > > > In file included from /workspace/src/contrib/ofed/libmlx5/mlx5.h:44:0, > > > from /workspace/src/contrib/ofed/libmlx5/buf.c:42: > > > /workspace/obj/workspace/src/riscv.riscv64/tmp/usr/include/infiniband/udma_barrier.h:108:2: error: #error No architecture specific memory barrier defines found! > > > #error No architecture specific memory barrier defines found! > > > ^~~~~ > > > > The patch below should be enough to fix the build, modulo the syntax > > errors which I cannot check. The reason is that it seems riscv is not > > cross-buildable from stable/11 host: > > --- includes_subdir_include/rpcsvc --- > > RPCGEN_CPP=cpp\ -target\ riscv64-unknown-freebsd12.0\ --sysroot=/usr/home/konstantinb/build/bsd/DEV/obj/usr/home/konstantinb/build/bsd/DEV/src/riscv.riscv64/tmp\ -B/usr/local rpcgen -C -h -DWANT_NFS3 /usr/home/konstantinb/build/bsd/DEV/src/include/rpcsvc/klm_prot.x -o klm_prot.h > > --- key_prot.h --- > > error: unknown target triple 'riscv64-unknown-freebsd12.0', please use -triple or -arch > > *** [key_prot.h] Error code 1 > > > > make[4]: stopped in /usr/home/konstantinb/build/bsd/DEV/src/include/rpcsvc > > > > So if somebody who care about riscv and can build the world could > > confirm the fix, I will commit it. > > > > diff --git a/contrib/ofed/include/udma_barrier.h b/contrib/ofed/include/udma_barrier.h > > index 71d264f8dce..6709d4433a7 100644 > > --- a/contrib/ofed/include/udma_barrier.h > > +++ b/contrib/ofed/include/udma_barrier.h > > @@ -104,6 +104,10 @@ > > #include > > #include > > #define udma_to_device_barrier() dmb() > > +#elif defined(__riscv__) > > +#include > > +#include > > +#define udma_to_device_barrier() fence() > > #else > > #error No architecture specific memory barrier defines found! > > #endif > > Thanks for looking into this. Attached patch is slightly modified. > RISC-V is using __riscv and there are few more atomic macros need to be > defined. Well, the arch(7) manpage documents __riscv__. Compilers typically provide both __XXX__ and __XXX, while FreeBSD traditionally uses the __XXX__ form. With that change, I think that your patch should go in regardless of the second issue below. > > However this seems not enough, there are some c++ errors which may take > longer to fix: > > In file included from /usr/home/lwhsu/freebsd-src/contrib/ofed/librdmacm/cma.h:43:0, > from /usr/home/lwhsu/freebsd-src/contrib/ofed/librdmacm/acm.c:42: > /usr/home/lwhsu/freebsd-src/contrib/ofed/librdmacm/cma.h: In function 'fastlock_init': > /usr/home/lwhsu/freebsd-src/contrib/ofed/librdmacm/cma.h:60:2: error: invalid initializer > atomic_store(&lock->cnt, 0); > ^ > In file included from /usr/home/lwhsu/freebsd-src/contrib/ofed/librdmacm/acm.c:42:0: > /usr/home/lwhsu/freebsd-src/contrib/ofed/librdmacm/cma.h: In function 'fastlock_acquire': > /usr/home/lwhsu/freebsd-src/contrib/ofed/librdmacm/cma.h:68:2: error: operand type 'struct *' is incompatible with argument 1 of '__atomic_fetch_add' > if (atomic_fetch_add(&lock->cnt, 1) > 0) > ^~ > /usr/home/lwhsu/freebsd-src/contrib/ofed/librdmacm/cma.h: In function 'fastlock_release': > /usr/home/lwhsu/freebsd-src/contrib/ofed/librdmacm/cma.h:73:2: error: operand type 'struct *' is incompatible with argument 1 of '__atomic_fetch_sub' > if (atomic_fetch_sub(&lock->cnt, 1) > 1) > ^~ > *** [acm.o] Error code 1 > > make[6]: stopped in /usr/home/lwhsu/freebsd-src/lib/ofed/librdmacm I will look at this later, but it seems that linuxkpi is not ported. I will disable OFED on RISC-V. > > > BTW, stable/11 should be fine to cross-build riscv64, this job uses > 11.2-RELEASE and riscv64-xtoolchain-gcc package, with > CROSS_TOOLCHAIN=riscv64-gcc defined. > > > Best, > Li-Wen > > -- > Li-Wen Hsu > https://lwhsu.org > Index: contrib/ofed/include/udma_barrier.h > =================================================================== > --- contrib/ofed/include/udma_barrier.h (revision 336593) > +++ contrib/ofed/include/udma_barrier.h (working copy) > @@ -104,6 +104,10 @@ > #include > #include > #define udma_to_device_barrier() dmb() > +#elif defined(__riscv) > +#include > +#include > +#define udma_to_device_barrier() fence() > #else > #error No architecture specific memory barrier defines found! > #endif > @@ -140,6 +144,8 @@ > #define udma_from_device_barrier() mips_sync() > #elif defined(__arm__) > #define udma_from_device_barrier() dmb() > +#elif defined(__riscv) > +#define udma_from_device_barrier() fence() > #else > #error No architecture specific memory barrier defines found! > #endif > @@ -208,6 +214,8 @@ > #define mmio_flush_writes() mips_sync() > #elif defined(__arm__) > #define mmio_flush_writes() dmb() > +#elif defined(__riscv) > +#define mmio_flush_writes() fence() > #else > #error No architecture specific memory barrier defines found! > #endif