<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi, David,</p>
    <p>Thanks a lot for your helpful reply.<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On Fri, Sep 30, 2022 at 22:20, David
      Marchand wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAJFAV8wGOqWjuW1HZfWmtUMt3w3J=94ZZpF3VZRqk9zM9C_O4A@mail.gmail.com">
      <pre wrap="">On Fri, Sep 30, 2022 at 12:05 PM zhoumin <a class="moz-txt-link-rfc2396E" href="mailto:zhoumin@loongson.cn"><zhoumin@loongson.cn></a> wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">On Fri, Sep 30, 2022 at 16:13, David Marchand wrote:
</pre>
        <blockquote type="cite">
          <pre wrap="">On Fri, Sep 30, 2022 at 10:02 AM Min Zhou <a class="moz-txt-link-rfc2396E" href="mailto:zhoumin@loongson.cn"><zhoumin@loongson.cn></a> wrote:
</pre>
          <blockquote type="cite">
            <pre wrap="">The online documents of LoongArch architecture are here:
     <a class="moz-txt-link-freetext" href="https://loongson.github.io/LoongArch-Documentation/README-EN.html">https://loongson.github.io/LoongArch-Documentation/README-EN.html</a>

The latest build tools for LoongArch (binary) can be downloaded from:
     <a class="moz-txt-link-freetext" href="https://github.com/loongson/build-tools">https://github.com/loongson/build-tools</a>
</pre>
          </blockquote>
          <pre wrap="">Could you confirm which sources have been used to generate it? and
instructions to compile it?
</pre>
        </blockquote>
        <pre wrap="">Only the cross compiler [1] is required. The instructions can be found in
the new added file cross_build_dpdk_for_loongarch.rst. I had added the
CI job for cross compiling DPDK for LoongArch in patch v7 7/7. The CI job
can run successfully if without the GCC warning caused by vhost.
</pre>
      </blockquote>
      <pre wrap="">- Sorry, but those instructions are not useful.

Is this architecture support in upstream gcc not functional?

Maybe I missed the information.. I spent some time at the different
links in the docs and in github, but I always end up with a set of
headers, or binaries, and no reference to the exact sources that were
used.
I have limited trust in binaries uploaded somewhere in github.
I don't want to spend more time on this.

What I ask for, is clear instructions how to get the toolchain
sources, and how to generate this toolchain.
</pre>
    </blockquote>
    <br>
    I'm Sorry, I misunderstood the 'instructions' you said. The process
    of<br>
    making the toolchain is a little complicated. So I made a script
    used to<br>
    generate the toolchain from source codes. The content of the script
    is<br>
    as follows:<br>
    <br>
    #!/bin/bash<br>
    <br>
    # Prepare the working directories<br>
    export SYSDIR=/tmp/la_cross_tools<br>
    mkdir -pv ${SYSDIR}<br>
    mkdir -pv ${SYSDIR}/downloads<br>
    mkdir -pv ${SYSDIR}/build<br>
    install -dv ${SYSDIR}/cross-tools<br>
    install -dv ${SYSDIR}/sysroot<br>
    <br>
    set +h<br>
    umask 022<br>
    # Set the environment variables to be used next<br>
    export BUILDDIR="${SYSDIR}/build"<br>
    export DOWNLOADDIR="${SYSDIR}/downloads"<br>
    export LC_ALL=POSIX<br>
    export CROSS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut
    -d- -f2)/cross/")"<br>
    export CROSS_TARGET="loongarch64-unknown-linux-gnu"<br>
    export MABI="lp64d"<br>
    export BUILD64="-mabi=lp64d"<br>
    export PATH=${SYSDIR}/cross-tools/bin:/bin:/usr/bin<br>
    export JOBS=-j8<br>
    unset CFLAGS<br>
    unset CXXFLAGS<br>
    <br>
    # Download the source code archives<br>
    pushd $DOWNLOADDIR<br>
    wget <a class="moz-txt-link-freetext" href="https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.19.tar.gz">https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.19.tar.gz</a><br>
    wget <a class="moz-txt-link-freetext" href="https://ftp.gnu.org/gnu/gmp/gmp-6.2.1.tar.xz">https://ftp.gnu.org/gnu/gmp/gmp-6.2.1.tar.xz</a><br>
    wget <a class="moz-txt-link-freetext" href="https://www.mpfr.org/mpfr-4.1.0/mpfr-4.1.0.tar.xz">https://www.mpfr.org/mpfr-4.1.0/mpfr-4.1.0.tar.xz</a><br>
    wget <a class="moz-txt-link-freetext" href="https://ftp.gnu.org/gnu/mpc/mpc-1.2.1.tar.gz">https://ftp.gnu.org/gnu/mpc/mpc-1.2.1.tar.gz</a><br>
    wget <a class="moz-txt-link-freetext" href="https://ftp.gnu.org/gnu/libc/glibc-2.36.tar.xz">https://ftp.gnu.org/gnu/libc/glibc-2.36.tar.xz</a><br>
    popd<br>
    <br>
    # Make and install the linux header files<br>
    tar xvf ${DOWNLOADDIR}/linux-5.19.tar.gz -C ${BUILDDIR}<br>
    pushd ${BUILDDIR}/linux-5.19<br>
        make mrproper<br>
        make ARCH=loongarch INSTALL_HDR_PATH=dest headers_install<br>
        find dest/include -name '.*' -delete<br>
        mkdir -pv ${SYSDIR}/sysroot/usr/include<br>
        cp -rv dest/include/* ${SYSDIR}/sysroot/usr/include<br>
    popd<br>
    <br>
    # Prepare the binutils source code<br>
    git clone git://sourceware.org/git/binutils-gdb.git --depth 1<br>
    pushd binutils-gdb<br>
        git archive --format=tar.gz --prefix=binutils-2.38/ --output
    ../binutils-2.38.tar.gz "master"<br>
    popd<br>
    mv binutils-2.38.tar.gz ${DOWNLOADDIR}<br>
    <br>
    # Make and install the binutils files<br>
    tar xvf ${DOWNLOADDIR}/binutils-2.38.tar.gz -C ${BUILDDIR}<br>
    pushd ${BUILDDIR}/binutils-2.38<br>
        rm -rf gdb* libdecnumber readline sim<br>
        mkdir tools-build<br>
        pushd tools-build<br>
            CC=gcc AR=ar AS=as \<br>
            ../configure --prefix=${SYSDIR}/cross-tools
    --build=${CROSS_HOST} --host=${CROSS_HOST} \<br>
                         --target=${CROSS_TARGET}
    --with-sysroot=${SYSDIR}/sysroot --disable-nls \<br>
                         --disable-static --disable-werror
    --enable-64-bit-bfd<br>
            make configure-host ${JOBS}<br>
            make ${JOBS}<br>
            make install-strip<br>
            cp -v ../include/libiberty.h ${SYSDIR}/sysroot/usr/include<br>
        popd<br>
    popd<br>
    <br>
    # Make and install the gmp files used by GCC<br>
    tar xvf ${DOWNLOADDIR}/gmp-6.2.1.tar.xz -C ${BUILDDIR}<br>
    pushd ${BUILDDIR}/gmp-6.2.1<br>
        ./configure --prefix=${SYSDIR}/cross-tools --enable-cxx
    --disable-static<br>
        make ${JOBS}<br>
        make install<br>
    popd<br>
    <br>
    # Make and install the mpfr files used by GCC<br>
    tar xvf ${DOWNLOADDIR}/mpfr-4.1.0.tar.xz -C ${BUILDDIR}<br>
    pushd ${BUILDDIR}/mpfr-4.1.0<br>
        ./configure --prefix=${SYSDIR}/cross-tools --disable-static
    --with-gmp=${SYSDIR}/cross-tools<br>
        make ${JOBS}<br>
        make install<br>
    popd<br>
    <br>
    # Make and install the mpc files used by GCC<br>
    tar xvf ${DOWNLOADDIR}/mpc-1.2.1.tar.gz -C ${BUILDDIR}<br>
    pushd ${BUILDDIR}/mpc-1.2.1<br>
        ./configure --prefix=${SYSDIR}/cross-tools --disable-static
    --with-gmp=${SYSDIR}/cross-tools<br>
        make ${JOBS}<br>
        make install<br>
    popd<br>
    <br>
    # Prepare the gcc source code<br>
    git clone git://sourceware.org/git/gcc.git --depth 1<br>
    pushd gcc<br>
        git archive --format=tar.gz --prefix=gcc-13.0.0/ --output
    ../gcc-13.0.0.tar.gz "master"<br>
    popd<br>
    mv gcc-13.0.0.tar.gz ${DOWNLOADDIR}<br>
    <br>
    # Make and install the simplified GCC files<br>
    tar xvf ${DOWNLOADDIR}/gcc-13.0.0.tar.gz -C ${BUILDDIR}<br>
    pushd ${BUILDDIR}/gcc-13.0.0<br>
        mkdir tools-build<br>
        pushd tools-build<br>
            AR=ar LDFLAGS="-Wl,-rpath,${SYSDIR}/cross-tools/lib" \<br>
            ../configure --prefix=${SYSDIR}/cross-tools
    --build=${CROSS_HOST} --host=${CROSS_HOST} \<br>
                         --target=${CROSS_TARGET} --disable-nls \<br>
                         --with-mpfr=${SYSDIR}/cross-tools
    --with-gmp=${SYSDIR}/cross-tools \<br>
                         --with-mpc=${SYSDIR}/cross-tools \<br>
                         --with-newlib --disable-shared
    --with-sysroot=${SYSDIR}/sysroot \<br>
                         --disable-decimal-float --disable-libgomp
    --disable-libitm \<br>
                         --disable-libsanitizer --disable-libquadmath
    --disable-threads \<br>
                         --disable-target-zlib --with-system-zlib
    --enable-checking=release \<br>
                         --enable-default-pie \<br>
                         --enable-languages=c<br>
            make all-gcc all-target-libgcc ${JOBS}<br>
            make install-strip-gcc install-strip-target-libgcc<br>
        popd<br>
    popd<br>
    <br>
    # Make and install the glibc files<br>
    tar xvf ${DOWNLOADDIR}/glibc-2.36.tar.xz -C ${BUILDDIR}<br>
    pushd ${BUILDDIR}/glibc-2.36<br>
        sed -i <a class="moz-txt-link-rfc2396E" href="mailto:s@5.15.0@4.15.0@g">"s@5.15.0@4.15.0@g"</a>
    sysdeps/unix/sysv/linux/loongarch/configure{,.ac}<br>
        mkdir -v build-64<br>
        pushd build-64<br>
            BUILD_CC="gcc" CC="${CROSS_TARGET}-gcc ${BUILD64}" \<br>
            CXX="${CROSS_TARGET}-gcc ${BUILD64}" \<br>
            AR="${CROSS_TARGET}-ar" RANLIB="${CROSS_TARGET}-ranlib" \<br>
            ../configure --prefix=/usr --host=${CROSS_TARGET}
    --build=${CROSS_HOST} \<br>
                         --libdir=/usr/lib64
    --libexecdir=/usr/lib64/glibc \<br>
                         --with-binutils=${SYSDIR}/cross-tools/bin \<br>
                         --with-headers=${SYSDIR}/sysroot/usr/include \<br>
                         --enable-stack-protector=strong
    --enable-add-ons \<br>
                         --disable-werror libc_cv_slibdir=/usr/lib64 \<br>
                         --enable-kernel=4.15<br>
            make ${JOBS}<br>
            make DESTDIR=${SYSDIR}/sysroot install<br>
            cp -v ../nscd/nscd.conf ${SYSDIR}/sysroot/etc/nscd.conf<br>
            mkdir -pv ${SYSDIR}/sysroot/var/cache/nscd<br>
            install -v -Dm644 ../nscd/nscd.tmpfiles \<br>
                             
    ${SYSDIR}/sysroot/usr/lib/tmpfiles.d/nscd.conf<br>
            install -v -Dm644 ../nscd/nscd.service \<br>
                             
    ${SYSDIR}/sysroot/usr/lib/systemd/system/nscd.service<br>
        popd<br>
        mkdir -v build-locale<br>
        pushd build-locale<br>
            ../configure --prefix=/usr --libdir=/usr/lib64
    --libexecdir=/usr/lib64/glibc \<br>
                         --enable-stack-protector=strong
    --enable-add-ons \<br>
                         --disable-werror libc_cv_slibdir=/usr/lib64<br>
            make ${JOBS}<br>
            make DESTDIR=${SYSDIR}/sysroot localedata/install-locales<br>
        popd<br>
    popd<br>
    <br>
    # Make and install the complete GCC files<br>
    tar xvf ${DOWNLOADDIR}/gcc-13.0.0.tar.gz -C ${BUILDDIR}<br>
    pushd ${BUILDDIR}/gcc-13.0.0<br>
        mkdir tools-build-all<br>
        pushd tools-build-all<br>
            AR=ar LDFLAGS="-Wl,-rpath,${SYSDIR}/cross-tools/lib" \<br>
            ../configure --prefix=${SYSDIR}/cross-tools
    --build=${CROSS_HOST} \<br>
                         --host=${CROSS_HOST} --target=${CROSS_TARGET} \<br>
                         --with-sysroot=${SYSDIR}/sysroot
    --with-mpfr=${SYSDIR}/cross-tools \<br>
                         --with-gmp=${SYSDIR}/cross-tools
    --with-mpc=${SYSDIR}/cross-tools \<br>
                         --enable-__cxa_atexit --enable-threads=posix
    --with-system-zlib \<br>
                         --enable-libstdcxx-time
    --enable-checking=release \<br>
                         --enable-default-pie \<br>
                        
    --enable-languages=c,c++,fortran,objc,obj-c++,lto<br>
            make ${JOBS}<br>
            make install-strip<br>
        popd<br>
    popd<br>
    <br>
    I have tested the script on an x86 machine running CentOS 8 system.<br>
    I successfully used the toolchain generated by this script to cross<br>
    compiling DPDK for LoongArch. This script may take one hour to<br>
    complete, which depends on the speed of network and the performance<br>
    of machine used. This script requires at least 15G of disk space
    when<br>
    running.<br>
    <br>
    <blockquote type="cite"
cite="mid:CAJFAV8wGOqWjuW1HZfWmtUMt3w3J=94ZZpF3VZRqk9zM9C_O4A@mail.gmail.com">
      <pre wrap="">- About the vhost compilation issue, a fix in the same area of the
code is in progress.
It will take some time to get the fix.
I will postpone merging the last patch until the vhost fix is ready.
(I am rather confident all of this will be resolved by the time 22.11
is released).
</pre>
    </blockquote>
    <br>
    Thank you for your concern and efforts on this issue.<br>
    <br>
    <blockquote type="cite"
cite="mid:CAJFAV8wGOqWjuW1HZfWmtUMt3w3J=94ZZpF3VZRqk9zM9C_O4A@mail.gmail.com">
      <pre wrap="">
</pre>
      <blockquote type="cite">
        <blockquote type="cite">
          <blockquote type="cite">
            <pre wrap="">v7:
     - rebase the patchset on the main repository
     - add errno.h to rte_power_intrinsics.c according with
       commit 72b452c5f259
</pre>
          </blockquote>
          <pre wrap="">Thanks, I will look at this last revision.


There is still one aspect that is unclear to me.
How will the DPDK community make sure changes won't break this
architecture? (I mean, runtime checks, not only compilation)
IOW, what do you plan to hook to our CI to test patches submitted to
the mailing list?
</pre>
        </blockquote>
        <pre wrap="">We can send our machine to UNH lab, but it may take a long time.

GHA seems to be a good choice. However, I found that the codes of CI
runner of GHA [2] are arch-specific. So the CI runner currently cannot
run on
LoongArch machine.
</pre>
      </blockquote>
      <pre wrap="">I see.

The better solution is probably to go with "your" own CI so that that
LoongArch has runtime non regression (functional and performance)
tests.
See below.
</pre>
    </blockquote>
    <br>
    Yes, we had spent some time building our own CI system and made the
    CI<br>
    system working internally. Our CI system based on Jenkins and DTS.
    Every<br>
    time we submit patch to our internal DPDK repository, the Jenkins
    will be<br>
    triggered to call DTS for testing the patch. But we have only run
    less than<br>
    100 unit tests currently. More test cases will be added later.<br>
    <br>
    <blockquote type="cite"
cite="mid:CAJFAV8wGOqWjuW1HZfWmtUMt3w3J=94ZZpF3VZRqk9zM9C_O4A@mail.gmail.com">
      <pre wrap="">
</pre>
      <blockquote type="cite">
        <pre wrap="">Are there other CI clients which are not arch-specific and can be used
for DPDK?
We can provide machines accessible by the public network. These machines run
Loongnix-server system which was built based on the source rpms of CentOS 8.
We can deploy DPDK CI client on these machines.
</pre>
      </blockquote>
      <pre wrap="">There is no "DPDK CI client" per se.

The DPDK project has a distributed CI made of at least 3 CI entities.

Those CI test patches and post reports via mail: the ovsrobot, Intel
CI and UNH lab.
A CI retrieves patches from patchwork, a set of scripts is available
in <a class="moz-txt-link-freetext" href="https://git.dpdk.org/tools/dpdk-ci/">https://git.dpdk.org/tools/dpdk-ci/</a> (especially the poll-pw
script).
</pre>
    </blockquote>
    <br>
    This information is really very useful. Please forgive me for not
    taking<br>
    the time to study dpdk-ci. It sounds that dpdk-ci can help us to
    test<br>
    patches submitted to the mailing list for LoongArch.<br>
    <br>
    <blockquote type="cite"
cite="mid:CAJFAV8wGOqWjuW1HZfWmtUMt3w3J=94ZZpF3VZRqk9zM9C_O4A@mail.gmail.com">
      <pre wrap="">Then the way the patches are tested is something each CI handles on its side:
- the ovsrobot creates a branch per series under the ovsrobot/dpdk
github repository, and let GitHub action run (this is how your current
series has been tested in GHA),
- Intel CI have their own tool for which I have little detail,
- UNH lab have their infrastructure too, using some Jenkins iirc. They
provide a dashboard for reports
<a class="moz-txt-link-freetext" href="https://lab.dpdk.org/results/dashboard/">https://lab.dpdk.org/results/dashboard/</a> and to get all details and
logs.

The common point is that, at the end of testing a series, a test
report is sent to the (sender-restricted) test-report@ mailing list.
</pre>
    </blockquote>
    <br>
    This process doesn't seem very complicated. We can build a CI system
    to<br>
    retrieve patches from patchwork by dpdk-ci and compile, test them on<br>
    Loongnix system. After completing those jobs, we will generate the
    test<br>
    report and send it to the test-report@ mailing list. But my concern
    is which<br>
    set of test cases we need to run. Besides, can patchwork gather the
    test<br>
    reports we sent and show them on the patch details web page?<br>
    <br>
    <blockquote type="cite"
cite="mid:CAJFAV8wGOqWjuW1HZfWmtUMt3w3J=94ZZpF3VZRqk9zM9C_O4A@mail.gmail.com">
      <pre wrap="">Those reports could be done per patch, but given the amount of patches
on the dev@ mailing list, the consensus is to test the whole series
and report back against the last patch of a series.

All of this is gathered by patchwork (the details of how it is done
are not 100% clear to me, maybe Ali can confirm later if a
modification is required).
</pre>
    </blockquote>
    <br>
    Thank you for your consideration.<br>
    <br>
    <blockquote type="cite"
cite="mid:CAJFAV8wGOqWjuW1HZfWmtUMt3w3J=94ZZpF3VZRqk9zM9C_O4A@mail.gmail.com">
      <pre wrap="">If you look at your v7 series, you will see:
<a class="moz-txt-link-freetext" href="https://patchwork.dpdk.org/project/dpdk/list/?series=24929&state=%2A&archive=both">https://patchwork.dpdk.org/project/dpdk/list/?series=24929&state=%2A&archive=both</a>
- ovsrobot: ci/github-robot link
<a class="moz-txt-link-freetext" href="http://mails.dpdk.org/archives/test-report/2022-September/310836.html">http://mails.dpdk.org/archives/test-report/2022-September/310836.html</a>
- Intel CI: ci/Intel-* links, for example on the compilation test
<a class="moz-txt-link-freetext" href="http://mails.dpdk.org/archives/test-report/2022-September/310822.html">http://mails.dpdk.org/archives/test-report/2022-September/310822.html</a>
- UNH lab: all ci/iol-* links, for example on the compilation test
<a class="moz-txt-link-freetext" href="http://mails.dpdk.org/archives/test-report/2022-September/310834.html">http://mails.dpdk.org/archives/test-report/2022-September/310834.html</a>

So what LoongSoon could do is setup some Loongnix systems with a
similar infrastructure and provide (native?) compilation and runtime
test reports.
</pre>
    </blockquote>
    <br>
    Yes, we will build the CI system talked above on Loongnix systems to<br>
    provide compilation and runtime test reports for DPDK on LoongArch
    machine.<br>
    But It will take some time to set up this system and make it run
    stably.<br>
    We will get this done as soon as possible.<br>
     <br>
    <blockquote type="cite"
cite="mid:CAJFAV8wGOqWjuW1HZfWmtUMt3w3J=94ZZpF3VZRqk9zM9C_O4A@mail.gmail.com">
      <pre wrap="">I Cc'd a few people involved in all this.
And there is the ci@ mailing list where all CI people can discuss.
</pre>
    </blockquote>
    <br>
    Thanks a lot for all your help.<br>
    <br>
    <blockquote type="cite"
cite="mid:CAJFAV8wGOqWjuW1HZfWmtUMt3w3J=94ZZpF3VZRqk9zM9C_O4A@mail.gmail.com">
      <pre wrap="">
</pre>
    </blockquote>
    <br>
    --<br>
    Thanks,<br>
    Min Zhou<br>
  </body>
</html>