From patchwork Tue Mar 7 00:55:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Matlack X-Patchwork-Id: 13162564 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 096F0C64EC4 for ; Tue, 7 Mar 2023 00:55:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229667AbjCGAzz (ORCPT ); Mon, 6 Mar 2023 19:55:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229609AbjCGAzx (ORCPT ); Mon, 6 Mar 2023 19:55:53 -0500 Received: from mail-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 090D34D625 for ; Mon, 6 Mar 2023 16:55:53 -0800 (PST) Received: by mail-pf1-x44a.google.com with SMTP id z19-20020a056a001d9300b005d8fe305d8bso6398198pfw.22 for ; Mon, 06 Mar 2023 16:55:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1678150552; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=ZwyOZObRLYb6tuk6PR7L2PNoNFObpjWwxfEZdLgVaPA=; b=dwJkE5pk0hfUG61DLaX2Y06PM4FQTc+Y4cdw51qunbNLfZhdqAHO7Fyu2C6o+XPlOI aESNyE6UJFFjj/+KFfh/f4+3LQ27fCyvSZdnPnndyV8AKLBoK2DUiqo/Hw9IruUouUvM ed5bEFe367h5UeMc21PhHDC/KSDfQ/zF5tT4h6L24iHS7BNsVJn8cUsC4t1Fx3f7OGfZ qUDgHxRcPWwa1p1EKnQFvSXGedVjTy4diSdd1wKWQpLcXo3w799e91PWWXLI2JRJec6B D4rCW2ASpqMwJj2Y2iipWRWzON81qX/91e7Ag9E1MPERzj46aMjsl31RWLSne2jTSWUm Y+4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678150552; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZwyOZObRLYb6tuk6PR7L2PNoNFObpjWwxfEZdLgVaPA=; b=4kwj782qs2Aab/+vvQGTd1JvKwWkAFZEOKIkNLVS1NtdRDaCKg9S8WdzQji6CeCsIw X6w60gQmQi+cyochBBEXwSyb0Stmdv1vWzJ+LV3vXyYuoqfVwO1Rx6a4zCIops19wwDh QaHW7oPi0DD1kLhGMgfucgfnbIcR6NdOGJ7AYdsFH4MvoxdiWDhAroFVPYI8ZhSF/Grt 3XyPwYgQkKwh8/P02E3RPoSB0yxHRuiXxQyxTgk0n8pRrsi1Bq4kSTr2E9zEvlty4FYE aWyZeHhtSXQa0xtQAMoVCJeqRJkmasqvdK6fKbhMnWJu5a8THf1HzA9ZyfnaUUkbRh1E X/qA== X-Gm-Message-State: AO0yUKXw+tEz6mgAhpclZG+3qw9jX7Vzrdl0WRl2mcN0vl9O4PWYOvwy 8BpRuAuzhGmXrY2gddwaynqwZ6r/ZQB8ag== X-Google-Smtp-Source: AK7set8ZFaD5p31RQ9fgHeWlLtsjRWac0liLl8RdRdq54x2PW4vkp8f8v29azpwh3z4OgYrTnWn72WKrv5bn0g== X-Received: from dmatlack-n2d-128.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:1309]) (user=dmatlack job=sendgmr) by 2002:a17:903:2606:b0:199:56f2:3fc4 with SMTP id jd6-20020a170903260600b0019956f23fc4mr5104205plb.8.1678150552522; Mon, 06 Mar 2023 16:55:52 -0800 (PST) Date: Mon, 6 Mar 2023 16:55:46 -0800 In-Reply-To: <20230307005547.607353-1-dmatlack@google.com> Mime-Version: 1.0 References: <20230307005547.607353-1-dmatlack@google.com> X-Mailer: git-send-email 2.40.0.rc0.216.gc4246ad0f0-goog Message-ID: <20230307005547.607353-2-dmatlack@google.com> Subject: [kvm-unit-tests PATCH 1/2] x86: Run the tsc test with -cpu max From: David Matlack To: Paolo Bonzini Cc: kvm@vger.kernel.org, David Matlack Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Run the tsc test with -cpu max to enable RDPID testing. The current configuration (-cpu kvm64,+rdtscp) does not include RDPID even if the host supports. In effect, test_rdpid() never runs. Use max instead of adding +rdpid to the existing configuration to avoid this biting someone in the future if they add a test for a new feature. Fixes: 10631a5bebd8 ("x86: tsc: add rdpid test") Signed-off-by: David Matlack --- x86/unittests.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x86/unittests.cfg b/x86/unittests.cfg index f324e32d60ef..c4eaa8ef9bab 100644 --- a/x86/unittests.cfg +++ b/x86/unittests.cfg @@ -247,7 +247,7 @@ extra_params = -cpu Opteron_G1,vendor=AuthenticAMD [tsc] file = tsc.flat -extra_params = -cpu kvm64,+rdtscp +extra_params = -cpu max [tsc_adjust] file = tsc_adjust.flat From patchwork Tue Mar 7 00:55:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Matlack X-Patchwork-Id: 13162565 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C1EAC61DA4 for ; Tue, 7 Mar 2023 00:56:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229725AbjCGA4A (ORCPT ); Mon, 6 Mar 2023 19:56:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229669AbjCGAz6 (ORCPT ); Mon, 6 Mar 2023 19:55:58 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E72A5D88D for ; Mon, 6 Mar 2023 16:55:55 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id l24-20020a25b318000000b007eba3f8e3baso12171599ybj.4 for ; Mon, 06 Mar 2023 16:55:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1678150554; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=2YcCZvGg7geMfj1VGWaT5nq1sgh1HoUun6qGGNv1Ghw=; b=iK1I+L9k4sLfdj/yydU1+EAfbCY26tEmAqfUg1ToBsz/ahqhuiz6+Apo6VOfBjOFou qRDpsntLI3X/tAl34niMkBTom88xUTQyQmNqhxa4RvecxLYJAuA7BzeZ8YwDPn2YWbwL lEYLEWZde3xpylFVtVUhAxI+Xu1SOCrKlPreMNYKb9Fi2Y4Xtj+EOTPBXeSUzDF8FxRI g/duR+Kp9kvzhmKUvdEq+T4mfI/Hyk97fLiqNhJYcfB8P07EJQBz0yXerJG02dR9XwaW F+AZBwVGSSu0o+edtDywkfSSbsCEcWeH+TP2R4+KR/vR6pAoqG0Ck6rx3RYVFZhPPMWB CdVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678150554; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2YcCZvGg7geMfj1VGWaT5nq1sgh1HoUun6qGGNv1Ghw=; b=fW7mk8213MUv5kauIWj1whwoimQ3FsfZH2qB4mCzdBHGWrrdfbbdQennuTmoNfO+/e xzpb30HIQ8mElEW0bkuBei2VmAsvwgeDP8Q/YooeSZ3DtMxbpmIYlc2n8r2dOR0G5K98 ZRQj5/a3PBMbMnJ48JsZuDOwgBPX5hD8jaY2oNtHG4rtHQdeHDaEdz5Ac07itnyZVkz8 ykzIHv+GD6S0QS0wIFHIk3V+aC6B8q0XTqE2R04eMiQ+GxGdRG7aDnZi18JeknveEhHS d/hUMWupeDEvZfwLKeNyHKQ+0qUrmTLlRe5hY5hYVH4KxYxaQXvyQiKoWYs1K7r15HhF Dvjg== X-Gm-Message-State: AO0yUKUj8K2FyPdUd1uinzO1dFq2ZfvrVTk26+26GZFjVqaDW1LZqV4l 5RJ+POznXrRVFtxub6CCz/qy2ShfMVQ7Hg== X-Google-Smtp-Source: AK7set8QmIFT7s4wTBLb4xpg4mQtFCuNCY67TSY3h6Gs7svqIpLXgm3/ngEpVOeeCEqT4YkoIedTNRujnV+oFA== X-Received: from dmatlack-n2d-128.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:1309]) (user=dmatlack job=sendgmr) by 2002:a5b:1cb:0:b0:aa2:475c:2982 with SMTP id f11-20020a5b01cb000000b00aa2475c2982mr5938573ybp.1.1678150554320; Mon, 06 Mar 2023 16:55:54 -0800 (PST) Date: Mon, 6 Mar 2023 16:55:47 -0800 In-Reply-To: <20230307005547.607353-1-dmatlack@google.com> Mime-Version: 1.0 References: <20230307005547.607353-1-dmatlack@google.com> X-Mailer: git-send-email 2.40.0.rc0.216.gc4246ad0f0-goog Message-ID: <20230307005547.607353-3-dmatlack@google.com> Subject: [kvm-unit-tests PATCH 2/2] x86: Mark RDPID asm volatile to avoid dropping instructions From: David Matlack To: Paolo Bonzini Cc: kvm@vger.kernel.org, David Matlack , Greg Thelen Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Mark the asm statement that generates the RDPID instruction volatile. The compiler within its rights to drop subsequent RDPID asm statements (after the first) since the inputs never change. This fixes the tsc test on hardware that supports rdpid when built with the latest Clang compiler. Fixes: 10631a5bebd8 ("x86: tsc: add rdpid test") Reported-by: Greg Thelen Suggested-by: Greg Thelen Signed-off-by: David Matlack Reviewed-by: Jim Mattson --- x86/tsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x86/tsc.c b/x86/tsc.c index bc403fc78461..b3bb120291ec 100644 --- a/x86/tsc.c +++ b/x86/tsc.c @@ -24,7 +24,7 @@ static void test_rdpid(u64 aux) u32 eax; wrmsr(MSR_TSC_AUX, aux); - asm (".byte 0xf3, 0x0f, 0xc7, 0xf8" : "=a" (eax)); + asm volatile (".byte 0xf3, 0x0f, 0xc7, 0xf8" : "=a" (eax)); report(eax == aux, "Test rdpid %%eax %" PRId64, aux); }