From owner-freebsd-virtualization@freebsd.org Fri Jul 31 16:50:49 2020 Return-Path: Delivered-To: freebsd-virtualization@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6C6A237D123 for ; Fri, 31 Jul 2020 16:50:49 +0000 (UTC) (envelope-from chuck@tuffli.net) Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) (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 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BJCvr3dKlz3SJh for ; Fri, 31 Jul 2020 16:50:48 +0000 (UTC) (envelope-from chuck@tuffli.net) Received: by mail-ej1-x62a.google.com with SMTP id o18so32041998eje.7 for ; Fri, 31 Jul 2020 09:50:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuffli-net.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to:cc; bh=+qESgYCyMy3TT1hg3loGvl3Ibkqw6kzLqMrA6GwxId0=; b=kdk7a6KNJPcG0eQvBQU90YtDo/omU+Ku9xJZ2Aef3TmPpVAUjeBg2nK0ejd2xcfGRM 3CPFMElzjabo95Ar0Ce3IuJ4GHyxTMuGlwwxSjwCidw+Gz1a8DYAaMHIJQL+NW3wWgQP SvtPHguUXRokKyrvP0oNBynZVC8/AGIJgZhE4eQy96EaUgjoF48OtnYmUfSF4UH9Jha8 sgLAs2xymCatlrKiGp9IPUK/2Xdq2S1J2W8uGTlcebfR+KyZPSUvwH0w0WzAD2jx6qMP QyJ+3ldbrO0r7i4LmpbgBlyMT/rZUhMZgkKdyXhyZu6Y9bSy90TGMdgHyNOlGj4MbHjL YCmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=+qESgYCyMy3TT1hg3loGvl3Ibkqw6kzLqMrA6GwxId0=; b=QIR8KtWbdxtaaw74ApteTPYl4SfvC6YNpXC8agIuiC4zL1Wjbs/pEzkpqV/T7bRn53 WzjfRtwHlp4IgrQpvMD9umxji5XCn8Pxuy+EQ7kf/Cw4IzA3ih8pQld3WRAAMaEsQFJ9 AoLE+YWo1cgWqy3wKRsCR9T6HYg+CCM2bPkpFJU3PVXkyC1wizpoA1M56mjDUXt5izxx ISf9nFpkjvzbBQU56K5LnZFaZErJUA2OYh7I3gwn0r91EagtMg/jPG2dTzD/AR/jG5fS Pfsv7diZwgIhZYnrDC398dv2Q/b82UB6CsiHR5w0NROspuxtxQthS7RY8BZPNtat10i0 fP9g== X-Gm-Message-State: AOAM531GRjFOudMZYG2ssL8vmhwxG8Jn6b0BCz2yiHVxRmubp65ZsT9m hntuiv92nRA4Otkum1gY3MYSKz39K6M6W442XqZChgjaUzE= X-Google-Smtp-Source: ABdhPJzQlVeNYI3FQE2KqAhYLWQnK3c8v81bt50PLbhrUReP0PGzCkz0BPqFZhTimGe6eE/cGSPAmUpTpvE+6/goGYk= X-Received: by 2002:a17:906:b6d0:: with SMTP id ec16mr4915149ejb.94.1596214246778; Fri, 31 Jul 2020 09:50:46 -0700 (PDT) MIME-Version: 1.0 From: Chuck Tuffli Date: Fri, 31 Jul 2020 09:50:36 -0700 Message-ID: Subject: To: John Baldwin , grehan@freebsd.org Cc: freebsd-virtualization@freebsd.org X-Rspamd-Queue-Id: 4BJCvr3dKlz3SJh X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=tuffli-net.20150623.gappssmtp.com header.s=20150623 header.b=kdk7a6KN; dmarc=none; spf=permerror (mx1.freebsd.org: domain of chuck@tuffli.net uses mechanism not recognized by this client) smtp.mailfrom=chuck@tuffli.net X-Spamd-Result: default: False [-2.40 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.97)[-0.975]; R_DKIM_ALLOW(-0.20)[tuffli-net.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-0.98)[-0.982]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-virtualization@freebsd.org]; DMARC_NA(0.00)[tuffli.net]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[tuffli-net.20150623.gappssmtp.com:+]; R_SPF_PERMFAIL(0.00)[empty SPF record]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::62a:from]; NEURAL_HAM_SHORT(-1.14)[-1.143]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; EMPTY_SUBJECT(1.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2020 16:50:49 -0000 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