Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Jul 2020 09:54:42 -0700
From:      Chuck Tuffli <chuck@tuffli.net>
To:        John Baldwin <jhb@freebsd.org>, grehan@freebsd.org, freebsd-virtualization@freebsd.org
Subject:   bhyve guest illegal instruction
Message-ID:  <CAM0tzX3EO1Z_x%2B_jPuLQ3fVTtZjWC6wYCFHaN-OY%2BLKbj8VH6Q@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
(apologies for the resend, this time with a Subject)

John / Peter

I'm running an application in a Linux guest under bhyve that is core
dumping because of an Illegal instruction. Running a simplified case in gdb
shows:
$ gdb -q rdtscp
Reading symbols from rdtscp...done.
(gdb) run
Starting program: /home/tuffli/rdtscp

Program received signal SIGILL, Illegal instruction.
main (argc=1, argv=0x7fffffffeae8) at rdtscp.c:12
12 time1 = __builtin_ia32_rdtscp(&dummy);
(gdb) l
7       main(int argc, char *argv[])
8       {
9                uint64_t time1, time2;
10              uint32_t dummy;
11
12              time1 = __builtin_ia32_rdtscp(&dummy);
13              usleep(1000);
14              time2 = __builtin_ia32_rdtscp(&dummy);
15
16              printf("time delta %lu\n", time2 - time1);
17
18              return (EXIT_SUCCESS);
19      }

This same program works on the FreeBSD 12-stable machine hosting the VM as
well as another bare-metal Linux host. Poking around in the vmm code, I
found
                        /*
                         * Hide rdtscp/ia32_tsc_aux until we know how
                         * to deal with them.
                         */
                        regs[3] &= ~AMDID_RDTSCP;
                        break;
in sys/amd64/vmm/x86.c which I _think_ is relevant because lscpu doesn't
show the rdtscp flag. If this is the root cause, what would need to be done
to implement this?

--chuck



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAM0tzX3EO1Z_x%2B_jPuLQ3fVTtZjWC6wYCFHaN-OY%2BLKbj8VH6Q>