Message ID | 20231006175715.105517-1-dongli.zhang@oracle.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp504426vqo; Fri, 6 Oct 2023 11:01:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFgHHCRtK5TQghFRZmTSUZzpnVZTlZtPeFNfe+9SszjVIRe04zoPOr2qL62Xz5vGn9Vutxm X-Received: by 2002:a17:902:b698:b0:1c8:791c:d797 with SMTP id c24-20020a170902b69800b001c8791cd797mr7040670pls.56.1696615317522; Fri, 06 Oct 2023 11:01:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696615317; cv=pass; d=google.com; s=arc-20160816; b=zgECKU7EDd6aiQivCsffxbGPOJje0qvMvDr2t97PH5VWPVsfOEVDb1jnhfHLoE+1Ug bycnvvl/x057PwKxS8E9J1v8OIj2C83KGDp4m3jeVkVtDE7pIij4JkwKoYLaXGa12Oln kqZHUr+wpwtDdq8Uw1FV6xRy8/KDCAfIQc2rDCSs0Ay42ArVOu+i6jTHwZHiccTiLXdf vN9nzjNX6KTb+iIZHRiguVzPsWMG1FmAfF4PmlHdkt72uolXUIcxKop79HXDdnoeA+1K +vgb7FMfPZbZOJOMxePITUGfOIL4fwRtzv1xUdj7w+XVr/tJ33pBtDkSN2dIzvmXgA9a 2sHw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=/czMuQ6hMH4QeiZ7lcsz7mKC95Cguxk3rp7VNIM5q+4=; fh=1pQTCW8KXRFmRwMJs1tnFFSqIG1+9XaU+13fEzLY7l4=; b=T9i/qJu2J6Ak+v+k89oph3Sv52V6YEUDzonjlkIYV3WWTCkDu/fwQIB1DPiAnQuj6b 4+mE5YWdxpJpq5v4x+KkmnJJ9L1e+5b6AoPHQ7SVWYqn9MM98NoXRFDx8Bp3zFU3AY6e kN+buXUk1EETK75Wxu09ekVkKz+Mshl+iOwPvCEwyEKS5pBBOj0PpCVlzZu9vIslC9To lMY9yJx7BeBS6CpoBb6we55AirwS3zLi8zJDrDsEqQK9WlJqZsKGSltOs6oee004dWTx ZPXIjWgcJmjoQLGVtNkuNsf+sALTAVcVHdr85TdCRofL9UhLm2ApRg2tCoGWoAxnkiwp ScWA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=wclL4SkS; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Zx5155He; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id a14-20020a17090a8c0e00b0027681e3a57fsi6267571pjo.162.2023.10.06.11.01.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 11:01:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=wclL4SkS; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Zx5155He; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id E6B2085E454F; Fri, 6 Oct 2023 11:01:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233093AbjJFSBa (ORCPT <rfc822;ezelljr.billy@gmail.com> + 18 others); Fri, 6 Oct 2023 14:01:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233005AbjJFSB1 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 6 Oct 2023 14:01:27 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EE1BB6; Fri, 6 Oct 2023 11:01:25 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 396Cbt2I006021; Fri, 6 Oct 2023 18:01:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=/czMuQ6hMH4QeiZ7lcsz7mKC95Cguxk3rp7VNIM5q+4=; b=wclL4SkSsoC7NxmqsIXvjn+BWT5/GZs84FZ9eTZkyKcqL20CiKkG7FZ25YSgG1KmQn18 ksHKfTAPQAZ3xlXWh3PXkezqj4A0Z8Qv89etF+rs9GdBcsMwUqXvf6ZruUgOHXIokzoA 4gSdfT4ispkkT4rHrnDBNM46ZeZ9mseeUow6LZcNhlyJll8QBeu9l/oZDd4K7/0du5on wL/laGqpM6DwLY6jCWCngYyVe6pPWJE1Bdt/3qFJtyLLfJUI6fBpyq2XtBHp6KoQzr5S VVXpflKSJw2B+QXuXJoMV1qDdfS6c47NHOKBD0VU0oylD4rC4aTBw5aWxY3F4lUIOmEc Ow== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3teb9umgyn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 06 Oct 2023 18:01:13 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 396HQugC002971; Fri, 6 Oct 2023 18:01:13 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3tea4ay08d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 06 Oct 2023 18:01:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W8LlU9J1sdg3lmw0H3d55TgbP/mW0feK5khfJxcoeiSAsdvNj7HvCNItSCXd2fqzFmwcSXqSmSC8kAk3cJxAXk6ZRvrFTAYExmBPM6r+QQVMA8alxY/Y2gvhU+caf6tXkPXX5aaEsAl9aP7nf+74XgbuN7FJkO6FEdWoS04wVu9d/wqxO+JZSItKVp6wASOJwyoTJJum4eFwObvBwuBdP0ocLsxqr6F0bNydkrI3tKDjdp0E6Upga3eOgfZ9JQD9tlJKIOXOZ29bs/r8cq6S2MTQhjccrLfeZC2tBVrwjbb22SlC93K3WFcSqiARpErYvyrF5ErSq6I/BVoY87++Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/czMuQ6hMH4QeiZ7lcsz7mKC95Cguxk3rp7VNIM5q+4=; b=j8HmvmvZb/gsxa/badCT2d0rpA5EZzrvv1Tgr1i9CSy9ypWRnmY4Ju7oQylm0She+hihIlyw7xxmSD2Poc5BFfevNhBaqgpkkZaKGRMbFtvN/YWtk7FmmY/V+DwdRPwDUbXM/TQd7PcNOdXBNfvYmsVGWDBTehZYSsEZm7c9upP2R3GJ4GJGAT/IL9XG6Ob5aHO7Y11VHMGIGZOn/yR7ETsuxbnRcnLP3O3HIn6sRx4GMafWLEsrpiPNvJ/r96+JGDy68fmKWrjRdKlbefWq8W9RgPIw4zafH0mha6eS+AT+ijYN+VJMUk7TbjFWCSUQO40Fmwmx02aC6OO+gMSsow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/czMuQ6hMH4QeiZ7lcsz7mKC95Cguxk3rp7VNIM5q+4=; b=Zx5155HeMl1Vlr+YJAXLg+WycQvc/uT03iiWdaxTNcdjKfkQRqfwgpujvjtCplFm0XWcV8G/c7hxiNMgoi68kr3VOhoCU1g4SflzsLJPCYT3TwoOZ/TKyJYHsux7GSQNf3JVjNH8OfrVasa7a6uDwXZ1w/KSXlbC7S69saMghw4= Received: from BYAPR10MB2663.namprd10.prod.outlook.com (2603:10b6:a02:a9::20) by DM4PR10MB6744.namprd10.prod.outlook.com (2603:10b6:8:10c::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.33; Fri, 6 Oct 2023 18:01:09 +0000 Received: from BYAPR10MB2663.namprd10.prod.outlook.com ([fe80::7e3d:f3b3:7964:87c3]) by BYAPR10MB2663.namprd10.prod.outlook.com ([fe80::7e3d:f3b3:7964:87c3%7]) with mapi id 15.20.6838.033; Fri, 6 Oct 2023 18:01:09 +0000 From: Dongli Zhang <dongli.zhang@oracle.com> To: kvm@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: linux-kernel@vger.kernel.org, pbonzini@redhat.com, shuah@kernel.org, seanjc@google.com, dwmw2@infradead.org, joe.jin@oracle.com Subject: [PATCH 1/1] selftests: KVM: add test to print boottime wallclock Date: Fri, 6 Oct 2023 10:57:15 -0700 Message-Id: <20231006175715.105517-1-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.34.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BL1PR13CA0127.namprd13.prod.outlook.com (2603:10b6:208:2bb::12) To BYAPR10MB2663.namprd10.prod.outlook.com (2603:10b6:a02:a9::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB2663:EE_|DM4PR10MB6744:EE_ X-MS-Office365-Filtering-Correlation-Id: 3bb5fd13-860a-408f-c843-08dbc696383a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7Z0j8or03luT5Kk367Ae7aINVJHiZtqXrBMGcXJZlEcaeGF/fxEysrPoCYubOxR1yRAn9a6K9KARNmVxJ+vkJtfz0Yn/Fex11MJFlCDXEXVvh+jseSzoihndKwbKyjJR3nRkX3yHG1YUNUXytpbNjGohmSnIQVpVhS3g8rYhkdDumPSow1zhX/YCJUCbt6OgrG5w8+EFUqZ6lui3AuJNb6FX9TKrEmz2AmEl5oce4MiWiWI9xo2ViSQMPS59McCiUAVLtKsn+cRqr9i37nhrNff87cBNsHH4eKYcfWsmAHlskYUg5iQMWzb0AmeakkeTE8eHXK1WdNfqE8nKd+dcimxBi8E26/oZ02q916hSLeDnKtVzFFDbgnSFTDswsQd4IGyGpja7At7gd53xx5g7QQEEtqSy56y1tw9y9KRtczyAxd+vgTh/hiIqgHHmHFNlPHH8SuqxxRcEnlCnFsWwoF3Us/dQIv0dw/RbVhqvXyGupVHFuU0LTDkl5T+ZpJ9GIqLlJKbrUaYQBluBlwOKa05W0kbOWQPGuec3LlFshWY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB2663.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(136003)(366004)(39860400002)(346002)(376002)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(2906002)(6512007)(107886003)(83380400001)(2616005)(1076003)(26005)(38100700002)(8936002)(4326008)(8676002)(41300700001)(478600001)(36756003)(966005)(6486002)(66556008)(66476007)(66946007)(86362001)(316002)(6666004)(6506007)(44832011)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XHh61IZM76hONpI9Ajplqt2Jzecc+EuaOAMoHBegaGAKp+ZZbUD9YOJC2dDMtR74D3Han4rIvFtVme0Wml7EWYsFYY4nZQf8NevJDv7deOdd1DuZvGQQ6sBJ4E9JrRsq6WMpHFKWzJ+ZnUQy57+g1Zhv2C7eVx/xCX9COTARX9BHOWf1SQvGNQMoOUNsgG6ThQznewYGYddw+zY53XRw7AEd8s4odQjRCyUWFbuAlhMtxNC+MyByCiCn8C4BfEctJc6+ITuIIaC0nkcMZJgWIuVD9reTORCpr/GZENsZY+a/uSNTSZRcWGknnH4x/JZGYcLXjb8eC/RfypWynBKuBpGBpX3X/DjFS9NIZVlpuuwki7RQmEqW937EDymMn1FAFbIz8EvrQxNy/uNyK2GfUjDnwxHGamtYZxsqNdSVErFzA5YiJOuGm7rjXZesk4rWqIWi+vr5hp/L3uJRKdO0geSW0GBBN8eWfWhJjun8nOeFSPfxDYrqS5CbUB1YFjwN9NYlayywozl8GgUONyKGx2dgmnIIkfcoN/9Hz86mXvC7YSw4szk9lhN/6OTBq6gsU2YaIVYXT2s3lAXXKlmsd6g+8/FFBd36Cb9zddO2iR0EbwSTgmox2rOgaQYZXZAeX95Is+PQaKXAHVOF2hawAzugu7ZqAZKXVWmHk/nwepglFVaAm3UL13/pHYEej6IBBwnc1jC3OtfEUQH4S6PU4Rz5XIuwmefCsw9QXvevaer0OgbppVt/SVfWUwb3Ss7me+4AYD8d5Lzq21w0M34+FLkIJl7MXshrAIz1riV9WSuIb5YhiVtQ5Cp5ObOVuGAxPXYjEXfkwYxSqNutzLxKYuuDIilx3jeI4x48CK4P8R/hMIG/dCYQKaYIFTSCbNvv1ALgzap9XFGexkS7/q2fBXMwzwq7t8iL6/VRPtl0dm/dOuXc+u+Y6RV3vcgW2EB3WZG2djIU+dI2rUL2Bn9YSikxf4cZ/6bLRxVSxmyApguPPgfIeZgXWCkhk6Ku0M2VMqn+WvNK7btk8e9B5+jXs5wHxSbySpi55m4vj7tbIwmAdjIq/VP430sITdLFTnyqx9OL0YzatEVeYArruzpDNwhZ0Lcdh1p6Ng+IMnKhObHbhaUIzzAq09nJ6zf4F8SktxF/+gulWjVaTUv/BszZZQ99s0yjb3SWLybTl1G1AkBUe+gA3oVvvzOpkmZfDKpq60haGDTh1dkGZvWAaQ87DfSuyxra5BkYsL0+aOreOyyOccyvN4Fo7CTcLu5SgAIS/umtf/fRjfY2A96HZPBL2+zw9mzkYh36pJdojvnaXMF7z29noIHB3w5OedEWCCo2/FHMe/74P4eu9dDzDAJlzUySOoNTWdR96lbj+srJjX4FbjpQ9FbZ/5LZJdqncOdg182AV+mQ/O40EbHRiNRunBUGmoCZPzuuMvJDO15SmvgaeQ25FeWPtv8WP0X7UHaiQFHbUddKJcDtKpNe+XZ6xGDns2C22X/S2j+HMCQHlzr78HuPXA7OeViN0UYH7wCGL3un7uoUz36QSokYTaEJbL9SJUHvzO2guyRoU6IRiZPSFArRxJTdS1DTg75yHqIp X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: erj5bWSbA//afUHRWZVXt5j7YlRllnjT1w99Z4SdLfg8fYyJZnCDjukO27FwWQOQdGRiMw8uk3JDBPZJuph0a8sqYt+Z93LXFXJGJU86ISWPpKVVjVJPhyuGUvfYuoQeuz5WEl2VNTZGiYHLAR96Wr/GghVvHnnQxIzAIuPnUiLo4Mwr+79FWWu5GpD0qH/2wbB+n/0PrJ0Lvy/btd2xKX9gcFzXxOER0Fk/B6xGlQykN6NTCsHZAfl6yG4sRTkzFb4K+ibrYSu/n9C+Mzbq7SCH2NG/Xzxp9X5C4WMK61Nlj5aGyglgirAczPV5a1e9HYP/GGLSktsdracDxpwpEivDkcKTEkH8HWBn34LEJVM5Qa8DsXcBGD4vdyzJR4fjKBHkyN9NEL8LoOP8uIXRCKhTQT791NWoy24m93NIbORgy0QA50gvKGLzObjin4zSdAGc0CIBpwvoC5MJwz9SuS24BiMcdyD/Pa6u0V6Yx2I/T+7usBKh5albwWecNKyoY3G6egmY6PGJWViIEs0BZP2anPl4XZzzrMmlHboY3YbNU8Vi97XXc8IMtIeyu6Sn536oHqBKM5ZBqoi5fJIyxvi+XYESwHwrBdWwbG+/3GwyP+zcyqlSJwDRBt//WdmpkEP0/Al1lM+OL7Q3GbP/ITr8AUMPT1p8H3TkibNeMl2aGMBL2OB7rKw4ksmCyQSgA1EEzbyG08QuMDm7OKnVuAG4P+NzNeQKGLoszV2+O/JHLNAYkJei4tRHDfVpr1bBshG8m9EWoAoAlfNlypuZxWmIAMmjLOUxKdKadmdK6x0UaZloQwpQCeJ0lcDrWAL5ITjKQ5vcmdIdrTM6CKxWOoc9H8RMsPidmu3a/9DRPlMJl9Z7euFUX+AozbEa8sB6 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3bb5fd13-860a-408f-c843-08dbc696383a X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB2663.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2023 18:01:09.7092 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: h6VWGu/OTIsBI8bkW23O0HLTELEZTrUY2WvL0aK/DeJCPLB7bGbZvPD4PQx6wxPYCBbqdqOnMInduR7KNCv/4A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6744 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-06_14,2023-10-06_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310060135 X-Proofpoint-ORIG-GUID: ZQm88UL7-tVL_eX2O8iPIJvQ12gyZUW1 X-Proofpoint-GUID: ZQm88UL7-tVL_eX2O8iPIJvQ12gyZUW1 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 06 Oct 2023 11:01:46 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779030103082786202 X-GMAIL-MSGID: 1779030103082786202 |
Series |
[1/1] selftests: KVM: add test to print boottime wallclock
|
|
Commit Message
Dongli Zhang
Oct. 6, 2023, 5:57 p.m. UTC
As inspired by the discussion in [1], the boottime wallclock may drift due
to the fact that the masterclock (or host monotonic clock) and kvmclock are
calculated based on the algorithms in different domains.
This is to introduce a testcase to print the boottime wallclock
periodically to help diagnose the wallclock drift issue in the future.
The idea is to wrmsr the MSR_KVM_WALL_CLOCK_NEW, and read the boottime
wallclock nanoseconds immediately.
References:
[1] https://lore.kernel.org/all/20231001111313.77586-1-nsaenz@amazon.com
Cc: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
---
tools/testing/selftests/kvm/Makefile | 3 +-
.../selftests/kvm/x86_64/boottime_wallclock.c | 100 ++++++++++++++++++
2 files changed, 102 insertions(+), 1 deletion(-)
create mode 100644 tools/testing/selftests/kvm/x86_64/boottime_wallclock.c
Comments
У пт, 2023-10-06 у 10:57 -0700, Dongli Zhang пише: > As inspired by the discussion in [1], the boottime wallclock may drift due > to the fact that the masterclock (or host monotonic clock) and kvmclock are > calculated based on the algorithms in different domains. > > This is to introduce a testcase to print the boottime wallclock > periodically to help diagnose the wallclock drift issue in the future. > > The idea is to wrmsr the MSR_KVM_WALL_CLOCK_NEW, and read the boottime > wallclock nanoseconds immediately. > > References: > [1] https://lore.kernel.org/all/20231001111313.77586-1-nsaenz@amazon.com > > Cc: David Woodhouse <dwmw@amazon.co.uk> > Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com> > --- > tools/testing/selftests/kvm/Makefile | 3 +- > .../selftests/kvm/x86_64/boottime_wallclock.c | 100 ++++++++++++++++++ > 2 files changed, 102 insertions(+), 1 deletion(-) > create mode 100644 tools/testing/selftests/kvm/x86_64/boottime_wallclock.c > > diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile > index a3bb36fb3cfc..fea05b0118de 100644 > --- a/tools/testing/selftests/kvm/Makefile > +++ b/tools/testing/selftests/kvm/Makefile > @@ -60,7 +60,8 @@ LIBKVM_riscv += lib/riscv/ucall.c > TEST_PROGS_x86_64 += x86_64/nx_huge_pages_test.sh > > # Compiled test targets > -TEST_GEN_PROGS_x86_64 = x86_64/cpuid_test > +TEST_GEN_PROGS_x86_64 = x86_64/boottime_wallclock > +TEST_GEN_PROGS_x86_64 += x86_64/cpuid_test > TEST_GEN_PROGS_x86_64 += x86_64/cr4_cpuid_sync_test > TEST_GEN_PROGS_x86_64 += x86_64/dirty_log_page_splitting_test > TEST_GEN_PROGS_x86_64 += x86_64/get_msr_index_features > diff --git a/tools/testing/selftests/kvm/x86_64/boottime_wallclock.c b/tools/testing/selftests/kvm/x86_64/boottime_wallclock.c > new file mode 100644 > index 000000000000..cc48c9b19920 > --- /dev/null > +++ b/tools/testing/selftests/kvm/x86_64/boottime_wallclock.c > @@ -0,0 +1,100 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +/* > + * Copyright (C) 2023 Oracle and/or its affiliates. > + */ > + > +#include <asm/kvm_para.h> > +#include <asm/pvclock-abi.h> > + > +#include "kvm_util.h" > +#include "processor.h" > + > +static int period = 10; > + > +#define GUEST_SYNC_WALLCLOCK(__stage, __val) \ > + GUEST_SYNC_ARGS(__stage, __val, 0, 0, 0) > + > +static void guest_main(vm_paddr_t wc_pa, struct pvclock_wall_clock *wc) > +{ > + uint64_t wallclock; > + > + while (true) { > + wrmsr(MSR_KVM_WALL_CLOCK_NEW, wc_pa); > + > + wallclock = wc->sec * NSEC_PER_SEC + wc->nsec; > + > + GUEST_SYNC_WALLCLOCK(0, wallclock); Won't this fill the output very fast? Do you think it will be worth it to wait some time (e.g 1 second or at least 1/10 of a second) between each print? > + } > +} > + > +static void handle_sync(struct ucall *uc) > +{ > + uint64_t wallclock; > + > + wallclock = uc->args[2]; > + > + pr_info("Boottime wallclock value: %"PRIu64" ns\n", wallclock); > +} > + > +static void handle_abort(struct ucall *uc) > +{ > + REPORT_GUEST_ASSERT(*uc); > +} > + > +static void enter_guest(struct kvm_vcpu *vcpu) > +{ > + struct ucall uc; > + > + while (true) { > + vcpu_run(vcpu); > + > + TEST_ASSERT_KVM_EXIT_REASON(vcpu, KVM_EXIT_IO); > + > + switch (get_ucall(vcpu, &uc)) { > + case UCALL_SYNC: > + handle_sync(&uc); > + break; > + case UCALL_ABORT: > + handle_abort(&uc); > + return; > + default: > + TEST_ASSERT(0, "unhandled ucall: %ld\n", uc.cmd); > + return; > + } > + > + sleep(period); > + } > +} > + > +int main(int argc, char *argv[]) > +{ > + struct kvm_vcpu *vcpu; > + struct kvm_vm *vm; > + vm_vaddr_t wc_gva; > + vm_paddr_t wc_gpa; > + int opt; > + > + while ((opt = getopt(argc, argv, "p:h")) != -1) { > + switch (opt) { > + case 'p': > + period = atoi_positive("The period (seconds)", optarg); > + break; > + case 'h': > + default: > + pr_info("usage: %s [-p period (seconds)]\n", argv[0]); > + exit(1); > + } > + } > + > + pr_info("Capture boottime wallclock every %d seconds.\n", period); > + pr_info("Stop with Ctrl + c.\n\n"); > + > + vm = vm_create_with_one_vcpu(&vcpu, guest_main); > + > + wc_gva = vm_vaddr_alloc(vm, getpagesize(), 0x10000); > + wc_gpa = addr_gva2gpa(vm, wc_gva); > + vcpu_args_set(vcpu, 2, wc_gpa, wc_gva); > + > + enter_guest(vcpu); > + kvm_vm_free(vm); > +} Best regards, Maxim Levitsky
Hi Maxim, On 10/10/23 09:13, Maxim Levitsky wrote: > У пт, 2023-10-06 у 10:57 -0700, Dongli Zhang пише: >> As inspired by the discussion in [1], the boottime wallclock may drift due >> to the fact that the masterclock (or host monotonic clock) and kvmclock are >> calculated based on the algorithms in different domains. >> >> This is to introduce a testcase to print the boottime wallclock >> periodically to help diagnose the wallclock drift issue in the future. >> >> The idea is to wrmsr the MSR_KVM_WALL_CLOCK_NEW, and read the boottime >> wallclock nanoseconds immediately. >> >> References: >> [1] https://urldefense.com/v3/__https://lore.kernel.org/all/20231001111313.77586-1-nsaenz@amazon.com__;!!ACWV5N9M2RV99hQ!MOnoujF4PlfvZ3SUuyXgIpJC5mWiE5uLUsNW6AWgirGXcObN5uil_fnthRVcYaPA0N2uoNyLChBogHC7ZS6t$ >> >> Cc: David Woodhouse <dwmw@amazon.co.uk> >> Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com> >> --- >> tools/testing/selftests/kvm/Makefile | 3 +- >> .../selftests/kvm/x86_64/boottime_wallclock.c | 100 ++++++++++++++++++ >> 2 files changed, 102 insertions(+), 1 deletion(-) >> create mode 100644 tools/testing/selftests/kvm/x86_64/boottime_wallclock.c >> >> diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile >> index a3bb36fb3cfc..fea05b0118de 100644 >> --- a/tools/testing/selftests/kvm/Makefile >> +++ b/tools/testing/selftests/kvm/Makefile >> @@ -60,7 +60,8 @@ LIBKVM_riscv += lib/riscv/ucall.c >> TEST_PROGS_x86_64 += x86_64/nx_huge_pages_test.sh >> >> # Compiled test targets >> -TEST_GEN_PROGS_x86_64 = x86_64/cpuid_test >> +TEST_GEN_PROGS_x86_64 = x86_64/boottime_wallclock >> +TEST_GEN_PROGS_x86_64 += x86_64/cpuid_test >> TEST_GEN_PROGS_x86_64 += x86_64/cr4_cpuid_sync_test >> TEST_GEN_PROGS_x86_64 += x86_64/dirty_log_page_splitting_test >> TEST_GEN_PROGS_x86_64 += x86_64/get_msr_index_features >> diff --git a/tools/testing/selftests/kvm/x86_64/boottime_wallclock.c b/tools/testing/selftests/kvm/x86_64/boottime_wallclock.c >> new file mode 100644 >> index 000000000000..cc48c9b19920 >> --- /dev/null >> +++ b/tools/testing/selftests/kvm/x86_64/boottime_wallclock.c >> @@ -0,0 +1,100 @@ >> +// SPDX-License-Identifier: GPL-2.0-only >> +/* >> + * Copyright (C) 2023 Oracle and/or its affiliates. >> + */ >> + >> +#include <asm/kvm_para.h> >> +#include <asm/pvclock-abi.h> >> + >> +#include "kvm_util.h" >> +#include "processor.h" >> + >> +static int period = 10; >> + >> +#define GUEST_SYNC_WALLCLOCK(__stage, __val) \ >> + GUEST_SYNC_ARGS(__stage, __val, 0, 0, 0) >> + >> +static void guest_main(vm_paddr_t wc_pa, struct pvclock_wall_clock *wc) >> +{ >> + uint64_t wallclock; >> + >> + while (true) { >> + wrmsr(MSR_KVM_WALL_CLOCK_NEW, wc_pa); >> + >> + wallclock = wc->sec * NSEC_PER_SEC + wc->nsec; >> + >> + GUEST_SYNC_WALLCLOCK(0, wallclock); > > Won't this fill the output very fast? > Do you think it will be worth it to wait some time (e.g 1 second or at least 1/10 of a second) > between each print? The wait time is controlled by the VMM side (of selftest) as in below. In the while loop at VMM side, it sleeps for a period (configurable argument), until it runs into the guest again. Therefore, the user can decide the frequency to print the boottime wallclock. +static void enter_guest(struct kvm_vcpu *vcpu) +{ + struct ucall uc; + + while (true) { + vcpu_run(vcpu); -----------> to schedule guest vcpu here + + TEST_ASSERT_KVM_EXIT_REASON(vcpu, KVM_EXIT_IO); + + switch (get_ucall(vcpu, &uc)) { + case UCALL_SYNC: + handle_sync(&uc); + break; + case UCALL_ABORT: + handle_abort(&uc); + return; + default: + TEST_ASSERT(0, "unhandled ucall: %ld\n", uc.cmd); + return; + } + + sleep(period); ------------> sleep here + } +} Thank you very much! Dongli Zhang > >> + } >> +} >> + >> +static void handle_sync(struct ucall *uc) >> +{ >> + uint64_t wallclock; >> + >> + wallclock = uc->args[2]; >> + >> + pr_info("Boottime wallclock value: %"PRIu64" ns\n", wallclock); >> +} >> + >> +static void handle_abort(struct ucall *uc) >> +{ >> + REPORT_GUEST_ASSERT(*uc); >> +} >> + >> +static void enter_guest(struct kvm_vcpu *vcpu) >> +{ >> + struct ucall uc; >> + >> + while (true) { >> + vcpu_run(vcpu); >> + >> + TEST_ASSERT_KVM_EXIT_REASON(vcpu, KVM_EXIT_IO); >> + >> + switch (get_ucall(vcpu, &uc)) { >> + case UCALL_SYNC: >> + handle_sync(&uc); >> + break; >> + case UCALL_ABORT: >> + handle_abort(&uc); >> + return; >> + default: >> + TEST_ASSERT(0, "unhandled ucall: %ld\n", uc.cmd); >> + return; >> + } >> + >> + sleep(period); >> + } >> +} >> + >> +int main(int argc, char *argv[]) >> +{ >> + struct kvm_vcpu *vcpu; >> + struct kvm_vm *vm; >> + vm_vaddr_t wc_gva; >> + vm_paddr_t wc_gpa; >> + int opt; >> + >> + while ((opt = getopt(argc, argv, "p:h")) != -1) { >> + switch (opt) { >> + case 'p': >> + period = atoi_positive("The period (seconds)", optarg); >> + break; >> + case 'h': >> + default: >> + pr_info("usage: %s [-p period (seconds)]\n", argv[0]); >> + exit(1); >> + } >> + } >> + >> + pr_info("Capture boottime wallclock every %d seconds.\n", period); >> + pr_info("Stop with Ctrl + c.\n\n"); >> + >> + vm = vm_create_with_one_vcpu(&vcpu, guest_main); >> + >> + wc_gva = vm_vaddr_alloc(vm, getpagesize(), 0x10000); >> + wc_gpa = addr_gva2gpa(vm, wc_gva); >> + vcpu_args_set(vcpu, 2, wc_gpa, wc_gva); >> + >> + enter_guest(vcpu); >> + kvm_vm_free(vm); >> +} > > > Best regards, > Maxim Levitsky > >
У вт, 2023-10-10 у 09:31 -0700, Dongli Zhang пише: > Hi Maxim, > > On 10/10/23 09:13, Maxim Levitsky wrote: > > У пт, 2023-10-06 у 10:57 -0700, Dongli Zhang пише: > > > As inspired by the discussion in [1], the boottime wallclock may drift due > > > to the fact that the masterclock (or host monotonic clock) and kvmclock are > > > calculated based on the algorithms in different domains. > > > > > > This is to introduce a testcase to print the boottime wallclock > > > periodically to help diagnose the wallclock drift issue in the future. > > > > > > The idea is to wrmsr the MSR_KVM_WALL_CLOCK_NEW, and read the boottime > > > wallclock nanoseconds immediately. > > > > > > References: > > > [1] https://urldefense.com/v3/__https://lore.kernel.org/all/20231001111313.77586-1-nsaenz@amazon.com__;!!ACWV5N9M2RV99hQ!MOnoujF4PlfvZ3SUuyXgIpJC5mWiE5uLUsNW6AWgirGXcObN5uil_fnthRVcYaPA0N2uoNyLChBogHC7ZS6t$ > > > > > > Cc: David Woodhouse <dwmw@amazon.co.uk> > > > Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com> > > > --- > > > tools/testing/selftests/kvm/Makefile | 3 +- > > > .../selftests/kvm/x86_64/boottime_wallclock.c | 100 ++++++++++++++++++ > > > 2 files changed, 102 insertions(+), 1 deletion(-) > > > create mode 100644 tools/testing/selftests/kvm/x86_64/boottime_wallclock.c > > > > > > diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile > > > index a3bb36fb3cfc..fea05b0118de 100644 > > > --- a/tools/testing/selftests/kvm/Makefile > > > +++ b/tools/testing/selftests/kvm/Makefile > > > @@ -60,7 +60,8 @@ LIBKVM_riscv += lib/riscv/ucall.c > > > TEST_PROGS_x86_64 += x86_64/nx_huge_pages_test.sh > > > > > > # Compiled test targets > > > -TEST_GEN_PROGS_x86_64 = x86_64/cpuid_test > > > +TEST_GEN_PROGS_x86_64 = x86_64/boottime_wallclock > > > +TEST_GEN_PROGS_x86_64 += x86_64/cpuid_test > > > TEST_GEN_PROGS_x86_64 += x86_64/cr4_cpuid_sync_test > > > TEST_GEN_PROGS_x86_64 += x86_64/dirty_log_page_splitting_test > > > TEST_GEN_PROGS_x86_64 += x86_64/get_msr_index_features > > > diff --git a/tools/testing/selftests/kvm/x86_64/boottime_wallclock.c b/tools/testing/selftests/kvm/x86_64/boottime_wallclock.c > > > new file mode 100644 > > > index 000000000000..cc48c9b19920 > > > --- /dev/null > > > +++ b/tools/testing/selftests/kvm/x86_64/boottime_wallclock.c > > > @@ -0,0 +1,100 @@ > > > +// SPDX-License-Identifier: GPL-2.0-only > > > +/* > > > + * Copyright (C) 2023 Oracle and/or its affiliates. > > > + */ > > > + > > > +#include <asm/kvm_para.h> > > > +#include <asm/pvclock-abi.h> > > > + > > > +#include "kvm_util.h" > > > +#include "processor.h" > > > + > > > +static int period = 10; > > > + > > > +#define GUEST_SYNC_WALLCLOCK(__stage, __val) \ > > > + GUEST_SYNC_ARGS(__stage, __val, 0, 0, 0) > > > + > > > +static void guest_main(vm_paddr_t wc_pa, struct pvclock_wall_clock *wc) > > > +{ > > > + uint64_t wallclock; > > > + > > > + while (true) { > > > + wrmsr(MSR_KVM_WALL_CLOCK_NEW, wc_pa); > > > + > > > + wallclock = wc->sec * NSEC_PER_SEC + wc->nsec; > > > + > > > + GUEST_SYNC_WALLCLOCK(0, wallclock); > > > > Won't this fill the output very fast? > > Do you think it will be worth it to wait some time (e.g 1 second or at least 1/10 of a second) > > between each print? > > The wait time is controlled by the VMM side (of selftest) as in below. > > In the while loop at VMM side, it sleeps for a period (configurable argument), > until it runs into the guest again. > > Therefore, the user can decide the frequency to print the boottime wallclock. Sorry about this, I haven't noticed this code! Best regards, Maxim Levitsky > > +static void enter_guest(struct kvm_vcpu *vcpu) > +{ > + struct ucall uc; > + > + while (true) { > + vcpu_run(vcpu); -----------> to schedule guest vcpu here > + > + TEST_ASSERT_KVM_EXIT_REASON(vcpu, KVM_EXIT_IO); > + > + switch (get_ucall(vcpu, &uc)) { > + case UCALL_SYNC: > + handle_sync(&uc); > + break; > + case UCALL_ABORT: > + handle_abort(&uc); > + return; > + default: > + TEST_ASSERT(0, "unhandled ucall: %ld\n", uc.cmd); > + return; > + } > + > + sleep(period); ------------> sleep here > + } > +} > > Thank you very much! > > Dongli Zhang > > > > + } > > > +} > > > + > > > +static void handle_sync(struct ucall *uc) > > > +{ > > > + uint64_t wallclock; > > > + > > > + wallclock = uc->args[2]; > > > + > > > + pr_info("Boottime wallclock value: %"PRIu64" ns\n", wallclock); > > > +} > > > + > > > +static void handle_abort(struct ucall *uc) > > > +{ > > > + REPORT_GUEST_ASSERT(*uc); > > > +} > > > + > > > +static void enter_guest(struct kvm_vcpu *vcpu) > > > +{ > > > + struct ucall uc; > > > + > > > + while (true) { > > > + vcpu_run(vcpu); > > > + > > > + TEST_ASSERT_KVM_EXIT_REASON(vcpu, KVM_EXIT_IO); > > > + > > > + switch (get_ucall(vcpu, &uc)) { > > > + case UCALL_SYNC: > > > + handle_sync(&uc); > > > + break; > > > + case UCALL_ABORT: > > > + handle_abort(&uc); > > > + return; > > > + default: > > > + TEST_ASSERT(0, "unhandled ucall: %ld\n", uc.cmd); > > > + return; > > > + } > > > + > > > + sleep(period); > > > + } > > > +} > > > + > > > +int main(int argc, char *argv[]) > > > +{ > > > + struct kvm_vcpu *vcpu; > > > + struct kvm_vm *vm; > > > + vm_vaddr_t wc_gva; > > > + vm_paddr_t wc_gpa; > > > + int opt; > > > + > > > + while ((opt = getopt(argc, argv, "p:h")) != -1) { > > > + switch (opt) { > > > + case 'p': > > > + period = atoi_positive("The period (seconds)", optarg); > > > + break; > > > + case 'h': > > > + default: > > > + pr_info("usage: %s [-p period (seconds)]\n", argv[0]); > > > + exit(1); > > > + } > > > + } > > > + > > > + pr_info("Capture boottime wallclock every %d seconds.\n", period); > > > + pr_info("Stop with Ctrl + c.\n\n"); > > > + > > > + vm = vm_create_with_one_vcpu(&vcpu, guest_main); > > > + > > > + wc_gva = vm_vaddr_alloc(vm, getpagesize(), 0x10000); > > > + wc_gpa = addr_gva2gpa(vm, wc_gva); > > > + vcpu_args_set(vcpu, 2, wc_gpa, wc_gva); > > > + > > > + enter_guest(vcpu); > > > + kvm_vm_free(vm); > > > +} > > > > Best regards, > > Maxim Levitsky > > > >
On Fri, Oct 06, 2023, Dongli Zhang wrote: > As inspired by the discussion in [1], the boottime wallclock may drift due > to the fact that the masterclock (or host monotonic clock) and kvmclock are > calculated based on the algorithms in different domains. > > This is to introduce a testcase to print the boottime wallclock > periodically to help diagnose the wallclock drift issue in the future. > > The idea is to wrmsr the MSR_KVM_WALL_CLOCK_NEW, and read the boottime > wallclock nanoseconds immediately. This doesn't actually test anything of interest though. IIUC, it requires a human looking at the output for it to provide any value. And it requires a manual cancelation, which makes it even less suitable for selftests. I like the idea, e.g. I bet there are more utilities that could be written that utilize the selftests infrastructure, just not sure what to do with this (assuming it can't be massaged into an actual test).
On Wed, Oct 18, 2023 at 12:51:55PM -0700, Sean Christopherson wrote: > On Fri, Oct 06, 2023, Dongli Zhang wrote: > > As inspired by the discussion in [1], the boottime wallclock may drift due > > to the fact that the masterclock (or host monotonic clock) and kvmclock are > > calculated based on the algorithms in different domains. > > > > This is to introduce a testcase to print the boottime wallclock > > periodically to help diagnose the wallclock drift issue in the future. > > > > The idea is to wrmsr the MSR_KVM_WALL_CLOCK_NEW, and read the boottime > > wallclock nanoseconds immediately. > > This doesn't actually test anything of interest though. IIUC, it requires a human > looking at the output for it to provide any value. And it requires a manual > cancelation, which makes it even less suitable for selftests. > > I like the idea, e.g. I bet there are more utilities that could be written that > utilize the selftests infrastructure, just not sure what to do with this (assuming > it can't be massaged into an actual test). Yes, there's definitely code overlap between selftests and [debug/test] utilities. For example, I snuck a utility into [1]. For that one, without any command line parameters it runs as a typical test. Given command line input, it behaves as a utility (which developers may use for additional platform-specific testing). It seems like we need a way to build and organize these types of things separately, i.e. a utility should probably be in tools/$DIR not tools/testing/selftests/$DIR. For [1], I don't have much of an excuse for not just splitting the two functionalities into two files, but, for KVM selftests, we'd need to find a way to share the framework. [1] https://lore.kernel.org/all/20231011135610.122850-14-ajones@ventanamicro.com/ Thanks, drew
Hi Sean and Andrew, On 10/18/23 23:51, Andrew Jones wrote: > On Wed, Oct 18, 2023 at 12:51:55PM -0700, Sean Christopherson wrote: >> On Fri, Oct 06, 2023, Dongli Zhang wrote: >>> As inspired by the discussion in [1], the boottime wallclock may drift due >>> to the fact that the masterclock (or host monotonic clock) and kvmclock are >>> calculated based on the algorithms in different domains. >>> >>> This is to introduce a testcase to print the boottime wallclock >>> periodically to help diagnose the wallclock drift issue in the future. >>> >>> The idea is to wrmsr the MSR_KVM_WALL_CLOCK_NEW, and read the boottime >>> wallclock nanoseconds immediately. >> >> This doesn't actually test anything of interest though. IIUC, it requires a human >> looking at the output for it to provide any value. And it requires a manual >> cancelation, which makes it even less suitable for selftests. >> >> I like the idea, e.g. I bet there are more utilities that could be written that >> utilize the selftests infrastructure, just not sure what to do with this (assuming >> it can't be massaged into an actual test). Thank you very much for the suggestion. Would that work if I turn it into a test: 1. Capture boottime_wallclock_01. 2. Wait for 10-second by default (configurable, e.g., max 60-second) 3. Capture boottime_wallclock_02. 4. Report error if drift. I have another pvclock vCPU hotplug test with the same flow. Thank you very much! Dongli Zhang > > Yes, there's definitely code overlap between selftests and [debug/test] > utilities. For example, I snuck a utility into [1]. For that one, without > any command line parameters it runs as a typical test. Given command line > input, it behaves as a utility (which developers may use for additional > platform-specific testing). It seems like we need a way to build and > organize these types of things separately, i.e. a utility should probably > be in tools/$DIR not tools/testing/selftests/$DIR. For [1], I don't have > much of an excuse for not just splitting the two functionalities into two > files, but, for KVM selftests, we'd need to find a way to share the > framework. > > [1] https://urldefense.com/v3/__https://lore.kernel.org/all/20231011135610.122850-14-ajones@ventanamicro.com/__;!!ACWV5N9M2RV99hQ!LuJ92LOR4jVJfhj8M0J9MUqP7520s259wSzAdAL1cV0zNrzVB2W0F_5gpEVX_SoHeKuivIt-VIVB6jaN5EuIKA$ > > Thanks, > drew
On Fri, 2023-10-20 at 07:39 -0700, Dongli Zhang wrote: > > 1. Capture boottime_wallclock_01. > 2. Wait for 10-second by default (configurable, e.g., max 60-second) > 3. Capture boottime_wallclock_02. > 4. Report error if drift. > > > I have another pvclock vCPU hotplug test with the same flow. Wallclock, or CLOCK_TAI? You'll going to get the odd one-second jump with the former.
On Fri, Oct 20, 2023, Dongli Zhang wrote: > Hi Sean and Andrew, > > On 10/18/23 23:51, Andrew Jones wrote: > > On Wed, Oct 18, 2023 at 12:51:55PM -0700, Sean Christopherson wrote: > >> On Fri, Oct 06, 2023, Dongli Zhang wrote: > >>> As inspired by the discussion in [1], the boottime wallclock may drift due > >>> to the fact that the masterclock (or host monotonic clock) and kvmclock are > >>> calculated based on the algorithms in different domains. > >>> > >>> This is to introduce a testcase to print the boottime wallclock > >>> periodically to help diagnose the wallclock drift issue in the future. > >>> > >>> The idea is to wrmsr the MSR_KVM_WALL_CLOCK_NEW, and read the boottime > >>> wallclock nanoseconds immediately. > >> > >> This doesn't actually test anything of interest though. IIUC, it requires a human > >> looking at the output for it to provide any value. And it requires a manual > >> cancelation, which makes it even less suitable for selftests. > >> > >> I like the idea, e.g. I bet there are more utilities that could be written that > >> utilize the selftests infrastructure, just not sure what to do with this (assuming > >> it can't be massaged into an actual test). > > Thank you very much for the suggestion. > > Would that work if I turn it into a test: > > 1. Capture boottime_wallclock_01. > 2. Wait for 10-second by default (configurable, e.g., max 60-second) > 3. Capture boottime_wallclock_02. > 4. Report error if drift. Rather than pick an arbitrary time of 10 seconds, deliberately introduce a plausible bug in KVM (or re-introduce a previous bug) and see how low you can push the wait time while still reliably detecting the unwanted drift. Then add a reasonable buffer to give the test some margin for error. Given the drift that David reported with the xen_shinfo test, I assume/hope that a 10 second runtime would be overkill. I would also differentiate between total runtime and the periodic check time, e.g. to allow checking for drift every N (milli)seconds while having a total runtime of M seconds. Then there's no need to set an upper bound, e.g. the user could set the test to run in the background for multiple hours without having to worry about the test being useless if it's canceled early.
diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile index a3bb36fb3cfc..fea05b0118de 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile @@ -60,7 +60,8 @@ LIBKVM_riscv += lib/riscv/ucall.c TEST_PROGS_x86_64 += x86_64/nx_huge_pages_test.sh # Compiled test targets -TEST_GEN_PROGS_x86_64 = x86_64/cpuid_test +TEST_GEN_PROGS_x86_64 = x86_64/boottime_wallclock +TEST_GEN_PROGS_x86_64 += x86_64/cpuid_test TEST_GEN_PROGS_x86_64 += x86_64/cr4_cpuid_sync_test TEST_GEN_PROGS_x86_64 += x86_64/dirty_log_page_splitting_test TEST_GEN_PROGS_x86_64 += x86_64/get_msr_index_features diff --git a/tools/testing/selftests/kvm/x86_64/boottime_wallclock.c b/tools/testing/selftests/kvm/x86_64/boottime_wallclock.c new file mode 100644 index 000000000000..cc48c9b19920 --- /dev/null +++ b/tools/testing/selftests/kvm/x86_64/boottime_wallclock.c @@ -0,0 +1,100 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2023 Oracle and/or its affiliates. + */ + +#include <asm/kvm_para.h> +#include <asm/pvclock-abi.h> + +#include "kvm_util.h" +#include "processor.h" + +static int period = 10; + +#define GUEST_SYNC_WALLCLOCK(__stage, __val) \ + GUEST_SYNC_ARGS(__stage, __val, 0, 0, 0) + +static void guest_main(vm_paddr_t wc_pa, struct pvclock_wall_clock *wc) +{ + uint64_t wallclock; + + while (true) { + wrmsr(MSR_KVM_WALL_CLOCK_NEW, wc_pa); + + wallclock = wc->sec * NSEC_PER_SEC + wc->nsec; + + GUEST_SYNC_WALLCLOCK(0, wallclock); + } +} + +static void handle_sync(struct ucall *uc) +{ + uint64_t wallclock; + + wallclock = uc->args[2]; + + pr_info("Boottime wallclock value: %"PRIu64" ns\n", wallclock); +} + +static void handle_abort(struct ucall *uc) +{ + REPORT_GUEST_ASSERT(*uc); +} + +static void enter_guest(struct kvm_vcpu *vcpu) +{ + struct ucall uc; + + while (true) { + vcpu_run(vcpu); + + TEST_ASSERT_KVM_EXIT_REASON(vcpu, KVM_EXIT_IO); + + switch (get_ucall(vcpu, &uc)) { + case UCALL_SYNC: + handle_sync(&uc); + break; + case UCALL_ABORT: + handle_abort(&uc); + return; + default: + TEST_ASSERT(0, "unhandled ucall: %ld\n", uc.cmd); + return; + } + + sleep(period); + } +} + +int main(int argc, char *argv[]) +{ + struct kvm_vcpu *vcpu; + struct kvm_vm *vm; + vm_vaddr_t wc_gva; + vm_paddr_t wc_gpa; + int opt; + + while ((opt = getopt(argc, argv, "p:h")) != -1) { + switch (opt) { + case 'p': + period = atoi_positive("The period (seconds)", optarg); + break; + case 'h': + default: + pr_info("usage: %s [-p period (seconds)]\n", argv[0]); + exit(1); + } + } + + pr_info("Capture boottime wallclock every %d seconds.\n", period); + pr_info("Stop with Ctrl + c.\n\n"); + + vm = vm_create_with_one_vcpu(&vcpu, guest_main); + + wc_gva = vm_vaddr_alloc(vm, getpagesize(), 0x10000); + wc_gpa = addr_gva2gpa(vm, wc_gva); + vcpu_args_set(vcpu, 2, wc_gpa, wc_gva); + + enter_guest(vcpu); + kvm_vm_free(vm); +}