Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp348019rdd; Tue, 9 Jan 2024 06:11:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IGdUgKnjQaJ/sVDbWYr0KUd9uFHA3XyLCumC9MSxVn4IXV+DmFuJlJ12EfFN7UHpeB6jO7C X-Received: by 2002:a19:6705:0:b0:50e:b298:9e0f with SMTP id b5-20020a196705000000b0050eb2989e0fmr2384012lfc.42.1704809498546; Tue, 09 Jan 2024 06:11:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704809498; cv=none; d=google.com; s=arc-20160816; b=pFRXHl7C5jBEQFHNMpuAMLApGU/+yYATWe+sjnOBwBAfWxLeP75jG7lPNDtKZJxeJN tHqj24obpr0gUWJ4mgYPKLCYcZ85NiNX+STE0BbXinpi1CJtoRHTTraSSWP4niFQUv7F gNyXYhpXRUViicIs9vshnBruiCcgcvCuy0JHYYzKCAvMJTiRxY/K15ZdnAu18ZJzPngR lVIRRjbQYK2pWBnRR4YJwf9TVpUNvnAwLvznVBrIR+YIXrgS1+sPqkXrrY4U9AXlRGTU nVH9dh8PVr3d229pUYGAC10s0IeBJWjifvF7Cu2Exuo+hLAjyIOaTOsGeIZFl0bDPjyx hoHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=ejfyzVTHu6M3v7OH/x0XnUikfCuEW8k/0GRBV0I9rkQ=; fh=56b0f9amB/d14Cru5+rTzdvRVvg1qsHx+cb1CsaZSXE=; b=onLUd4bFhTZODSOn+Fy3ZATJwXuiQbW075by1Dq2ijuZxhbjFOaBRBm3hVDgOtYswp g7FoAXAF612LpqdMEEXuUvn4PK6EStVKNeI+oAIYRJzoLgDBXGetTj9/htxSyTvft/2r b73PZo/5VxKjZ3oRofjhDgpeTswqXOuSP+jzUiQ3cF1TmV2+d74F8dQZjMsAwCUPOI4F EQupgK+nKSEi2z8EusKpH8K0osn7hdqQCY5kVVx5Uk1x/wg/5IMWjwEJKeVxVKRu5Pgd 6nkJTtJwD63nnyYnDQs6+LL2+QgerFRDUTHaHx+MzHbc6b08OCFigsw1Ofibhn5NuH3N QOxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EUZavRBJ; spf=pass (google.com: domain of linux-kernel+bounces-20957-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20957-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id w5-20020a1709064a0500b00a2af3149695si846410eju.837.2024.01.09.06.11.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 06:11:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20957-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EUZavRBJ; spf=pass (google.com: domain of linux-kernel+bounces-20957-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20957-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 447641F24B01 for ; Tue, 9 Jan 2024 14:11:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 040AB39ACD; Tue, 9 Jan 2024 14:11:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="EUZavRBJ" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC27E39AC1 for ; Tue, 9 Jan 2024 14:11:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704809486; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ejfyzVTHu6M3v7OH/x0XnUikfCuEW8k/0GRBV0I9rkQ=; b=EUZavRBJWujMPw6x9Zu4mMeHRTxQcw+UKHrKIeaCwyCW8qMVR+nmhE+CVyiQSVvwhEXVci 1i7ScbtuL4OwYdQjzK6vXot6i7cf2OZTGMptSlFGjwiXmTAGH3DRnTaY+5DBPmNpWcdnqS 3Y8QWklyt+LCkLNvNaZx+I5fFrsjjMs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-356-8uN3QetKPrOKezU4fBJbUw-1; Tue, 09 Jan 2024 09:11:23 -0500 X-MC-Unique: 8uN3QetKPrOKezU4fBJbUw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4A8F6862FD8; Tue, 9 Jan 2024 14:11:23 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.226.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F8B651E3; Tue, 9 Jan 2024 14:11:22 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson Cc: Oliver Upton , linux-kernel@vger.kernel.org Subject: [PATCH 0/5] KVM: selftests: Fix clocksource requirements in tests Date: Tue, 9 Jan 2024 15:11:16 +0100 Message-ID: <20240109141121.1619463-1-vkuznets@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 It was discovered that 'hyperv_clock' fails miserably when the system is using an unsupported (by KVM) clocksource, e.g. 'kvm-clock'. The root cause of the failure is that 'hyperv_clock' doesn't actually check which clocksource is currently in use. Other tests (kvm_clock_test, vmx_nested_tsc_scaling_test) have the required check but each test does it on its own. Generalize clocksource checking infrastructure, make all three clocksource dependent tests run with 'tsc' and 'hyperv_clocksource_tsc_page', and skip gracefully when run in an unsupported configuration. The last patch of the series is a loosely related minor nitpick for KVM code itself. Vitaly Kuznetsov (5): KVM: selftests: Generalize check_clocksource() from kvm_clock_test KVM: selftests: Use generic sys_clocksource_is_tsc() in vmx_nested_tsc_scaling_test KVM: selftests: Run clocksource dependent tests with hyperv_clocksource_tsc_page too KVM: selftests: Make hyperv_clock require TSC based system clocksource KVM: x86: Make gtod_is_based_on_tsc() return 'bool' arch/x86/kvm/x86.c | 2 +- .../testing/selftests/kvm/include/test_util.h | 2 + .../selftests/kvm/include/x86_64/processor.h | 2 + tools/testing/selftests/kvm/lib/test_util.c | 25 ++++++++++++ .../selftests/kvm/lib/x86_64/processor.c | 15 ++++++++ .../selftests/kvm/x86_64/hyperv_clock.c | 1 + .../selftests/kvm/x86_64/kvm_clock_test.c | 38 +------------------ .../kvm/x86_64/vmx_nested_tsc_scaling_test.c | 19 +--------- 8 files changed, 48 insertions(+), 56 deletions(-) base-commit: 7f26fea9bc085290e3731501f4f8fc5b82b9d615 -- 2.43.0