Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2456195rbb; Wed, 28 Feb 2024 02:18:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWoLfOTp8q2paeYGe6NIuJ0IlXQTOaiHePrxa6fGRMjKf58BftH32g6Wy2atLSqk3dIRQzb/pcrcBsYJRsjJpk764BDgLurnzeXwRG8DQ== X-Google-Smtp-Source: AGHT+IEN3L0/3RH1iHNirLX+j2J1tfLQDFvhe4brg1ONdRlm3PE80Km36GiNNUiEbZZifNGvdrtJ X-Received: by 2002:a17:90a:730b:b0:29a:bdee:bc69 with SMTP id m11-20020a17090a730b00b0029abdeebc69mr2658260pjk.8.1709115531864; Wed, 28 Feb 2024 02:18:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709115531; cv=pass; d=google.com; s=arc-20160816; b=xbt+BroSdO4IxufQSuZBXhqVzXDrEbZVy0e2YszyssWDpepMtHIHIGu6yRPCVU5LxH Q8JO3HUQkH3qFmfPddk+OHw/X5ovHVbUNXhAokVnM2ZfWx4G2AsBGrkLPRfaNqO0rPaR zZbftvc2ft+AmsqE/x1277NTKx5WMed6y2DDIAS2suWG6XPSOJEy0c2v/yLkAzMtkwIt BV+GqcAcQ8LLzxzuoRAaYP9Cuk9/MW3DbzV9EK3BTcQ6oyAOZXxSuK8f2NsUAO4LLd5b eyQy0t5u0UoM3uflRaE4u85HHCPgNtaagM6QCLTgz2zLGekycY+hLwWeK6hDGWly9feV EbLA== ARC-Message-Signature: i=2; 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=iFcTu4vWXsmQv14zHnSYq8RhqP6dIPyBbIRKHjBzM90=; fh=g5Cow6OuIakVpuXVBF5ZX8XYeT6H+v/9YFSb9jK60ps=; b=eWA5+8Iuz5IU1f1IAaUyNw7/QYX+RFRLPO3X/v/RbQMJ3xHgVljzy1R3jBBuj+SgDg cOeUzyRWLd2GDBSquBUdG0g1iwUiMvMDXz3oIgVb1UBdGDMFDIAM5KC9/sG1ltXMPD9O Rp3f+PW4WYV/Ir2fMON5no8DqVsen1Ke3lcCFYnEXao2otg6/4P3IWzFokup1DTm7rw/ 4VRpBglovPGqL31xN1WzjaRpIXwGvmGzGfT7qUdYQeCpWh+9/Vb7DB9ENWvPlFvfkU/C sDqu59hIoGt9H5DPIfu0ct1ekJlWGM6mnMxAM6GYSsfmvSJ2IBzHGgF04Yfwb3A8RGg/ Jvog==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="LG8R525/"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-84822-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84822-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id sj16-20020a17090b2d9000b0029a9c2a22c0si1111958pjb.61.2024.02.28.02.18.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 02:18:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84822-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="LG8R525/"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-84822-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84822-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 2F1ED288B32 for ; Wed, 28 Feb 2024 10:18:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C38594D5B0; Wed, 28 Feb 2024 10:18:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LG8R525/" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 72C1E482FE for ; Wed, 28 Feb 2024 10:18:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709115526; cv=none; b=cN8CiAzwzTANMex0NyNoS9ThzcPm3bnSO7PVzHvWsUHciWMHwik+pZlmcaYOWD4RPvByR+ywBlM/9gJAxtTCyw6teQR5JopbuPNAsXfWhiiTmiMeQ5nLgtrzoAur+6kQvcLok9KmhHRCW6HRnUF4HCIwS//xp7YsZ9M0YuZMYhc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709115526; c=relaxed/simple; bh=5nMH6rhMv/5mgGZqAP+nH6ZKn9Su5tHGv21eiWmAMG0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=n0VCtGYzNqivukBb9p5+0r77ITd7ETvL36BOkX5RY1TAVG8++zTOINKGUy/xNeyiYvvLMQ9vyZ7fkDh2QjUtOUyRkhU6pTJTeY2J1sIzmSpYzYUtekVdqQmNENVJHRJgWse8Qu4iPqH3Yaw1YK6v4Gj7coxiBkRUujOkyBB/Xps= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=LG8R525/; arc=none smtp.client-ip=170.10.129.124 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=1709115523; 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=iFcTu4vWXsmQv14zHnSYq8RhqP6dIPyBbIRKHjBzM90=; b=LG8R525/o3Vy+pT5xQqtVKQ/C8SE8/ytbYoUJOhjk6ZlzCz+SFrCSwkagyBRXWhBNgt9go k1iuN6EFhgG11F0UFVt4dawq53hnSEKGiMtALu9V3A9lMnihruuLF2bEIvCdoW71KObmKI imESXjQ06Mv42A7mhsqk6TQ33deChmA= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-173-FP8xKnhlP221lR6BnYgJXQ-1; Wed, 28 Feb 2024 05:18:39 -0500 X-MC-Unique: FP8xKnhlP221lR6BnYgJXQ-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 5ED8B3C11A06; Wed, 28 Feb 2024 10:18:39 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.226.93]) by smtp.corp.redhat.com (Postfix) with ESMTP id 268818177; Wed, 28 Feb 2024 10:18:38 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson Cc: Li RongQing , linux-kernel@vger.kernel.org Subject: [PATCH 0/3] KVM: x86: Fix KVM_FEATURE_PV_UNHALT update logic Date: Wed, 28 Feb 2024 11:18:34 +0100 Message-ID: <20240228101837.93642-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 Guest hangs in specific configurations (KVM_X86_DISABLE_EXITS_HLT) are reported and the issue was bisected to commit ee3a5f9e3d9b ("KVM: x86: Do runtime CPUID update before updating vcpu->arch.cpuid_entries") which, of course, carries "No functional change intended" blurb. Turns out, moving __kvm_update_cpuid_runtime() earlier in kvm_set_cpuid() to tweak the incoming CPUID data before checking it wasn't innocent as KVM_FEATURE_PV_UNHALT reset logic relies on cached KVM CPUID base which gets updated later. I was not able to reproduce the issue with QEMU myself so I wrote a selftest to show the problem. Vitaly Kuznetsov (3): KVM: x86: Introduce __kvm_get_hypervisor_cpuid() helper KVM: x86: Use actual kvm_cpuid.base for clearing KVM_FEATURE_PV_UNHALT KVM: selftests: Check that KVM_FEATURE_PV_UNHALT is cleared with KVM_X86_DISABLE_EXITS_HLT arch/x86/kvm/cpuid.c | 42 ++++++++++++------- .../selftests/kvm/x86_64/kvm_pv_test.c | 42 +++++++++++++++++++ 2 files changed, 68 insertions(+), 16 deletions(-) base-commit: 0cbca1bf44a0b8666c91ce3438f235c6fe70fbf1 -- 2.43.0