Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spdk target exits when running on system without AVX 512 #159

Closed
seroyer opened this issue Jul 21, 2022 · 5 comments · Fixed by #160
Closed

spdk target exits when running on system without AVX 512 #159

seroyer opened this issue Jul 21, 2022 · 5 comments · Fixed by #160
Assignees
Labels
bug Something isn't working

Comments

@seroyer
Copy link
Contributor

seroyer commented Jul 21, 2022

$ docker run -it --rm --privileged -v /dev/hugepages:/dev/hugepages -v /dev/shm:/dev/shm -v /proc:/proc ghcr.io/opiproject/opi-spdk:main bash
[root@3c9db4b50106 ~]# sync; echo 1 > /proc/sys/vm/drop_caches  && \
            echo 1024 > /proc/sys/vm/nr_hugepages && \
            grep "" /sys/kernel/mm/hugepages/hugepages-*/nr_hugepages
/sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages:0
/sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages:1024
[root@3c9db4b50106 ~]# /usr/local/bin/spdk_tgt -m 0x1 -s 512 --no-pci
Illegal instruction (core dumped)

The VMs which we are using to build SPDK and push to GHCR have AVX512. So if you try to run the container on a system that does not have AVX 512, it will fail.

@seroyer seroyer added the bug Something isn't working label Jul 21, 2022
@mestery
Copy link
Contributor

mestery commented Jul 21, 2022

See here for how I proposed fixing this for p4-dpdk.

@mestery mestery self-assigned this Jul 21, 2022
@glimchb
Copy link
Member

glimchb commented Jul 21, 2022

for SPDK you can try

diff --git a/storage/Dockerfile b/storage/Dockerfile
index df7f06e..a836763 100644
--- a/storage/Dockerfile
+++ b/storage/Dockerfile
@@ -1,7 +1,7 @@
 FROM fedora:36 as build

 ARG TAG=v22.05
-ARG ARCH=native
+ARG ARCH=x86_64

 WORKDIR /root
 RUN dnf install -y git rpm-build diffutils procps-ng && dnf clean all
(END)

because

mk/spdk.common.mk-73-ifeq ($(TARGET_MACHINE),x86_64)
mk/spdk.common.mk:74:# Don't use AVX-512 instructions in SPDK code - it breaks Valgrind for
mk/spdk.common.mk-75-# some cases where compiler decides to hyper-optimize a relatively
mk/spdk.common.mk:76:# simple operation (like int-to-float converstion) using AVX-512
mk/spdk.common.mk:77:COMMON_CFLAGS += -mno-avx512f
mk/spdk.common.mk-78-endif

@mestery
Copy link
Contributor

mestery commented Jul 21, 2022

So folks are aware, the way to test this is as follows:

  • Push a PR with the fix.
  • The CI should build and push a container to GHCR
  • Locally modify the Dockerfile to use the PR image
  • Verify the fix

If all that works, we can merge this.

@mestery
Copy link
Contributor

mestery commented Jul 21, 2022

for SPDK you can try

diff --git a/storage/Dockerfile b/storage/Dockerfile
index df7f06e..a836763 100644
--- a/storage/Dockerfile
+++ b/storage/Dockerfile
@@ -1,7 +1,7 @@
 FROM fedora:36 as build

 ARG TAG=v22.05
-ARG ARCH=native
+ARG ARCH=x86_64

 WORKDIR /root
 RUN dnf install -y git rpm-build diffutils procps-ng && dnf clean all
(END)

because

mk/spdk.common.mk-73-ifeq ($(TARGET_MACHINE),x86_64)
mk/spdk.common.mk:74:# Don't use AVX-512 instructions in SPDK code - it breaks Valgrind for
mk/spdk.common.mk-75-# some cases where compiler decides to hyper-optimize a relatively
mk/spdk.common.mk:76:# simple operation (like int-to-float converstion) using AVX-512
mk/spdk.common.mk:77:COMMON_CFLAGS += -mno-avx512f
mk/spdk.common.mk-78-endif

Trying this now and following my instructions on verifying before we merge as above.

@mestery
Copy link
Contributor

mestery commented Jul 21, 2022

Verified the pushed container image and the tests pass locally on my laptop using a Virtualbox VM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants