From patchwork Thu Feb 15 01:00:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 20407 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp90006dyb; Wed, 14 Feb 2024 17:01:34 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX0lywNPgj6PylKN1Yo8314YE89zFpWOOGLN1Ck5WUi7QG+JRXxW7yo892+iAJrioy31bhJ38pff8c87SOGP6qwThPxhA== X-Google-Smtp-Source: AGHT+IEMrl7lhEuwVU1HhUcG4b6GTDHGwXzs/Y0TyVgoNHlRTwtFK4mFR2lNm3JHsZHzbCnnJy+J X-Received: by 2002:a05:6102:18c2:b0:46e:c364:423b with SMTP id jj2-20020a05610218c200b0046ec364423bmr487626vsb.16.1707958894602; Wed, 14 Feb 2024 17:01:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707958894; cv=pass; d=google.com; s=arc-20160816; b=YULbjcDN8Pn/+37vs0XeNGxRtBRoiIAkHK/I/hV7OVetZpn7xaiE6J9PjwElKf/G50 UGfDqI3i/ySEg1sdjU9KQSLBmbx25XSu8C4w3jxu82fShPCamnH/Fp7/zzw4YbJvPnkA u01njsVTtOwi9O6+0LyFRKGn9Sg+waSrkXEIj9RYx/2KbtF4MCK/R6/708HSa3bTDIGD Ijxm7HiF5Eh/jcQV8oFeF0lN4CpzPa5QRkYQX1PHnz+i/93slAMXDELPFqmB2yO4H7lD f5EH9H64KuVGRU51BhqV4aoWb59Pc/6Rlw+URK16OPqrxUR2CXv4R+31q8Boh2FJyntk mB+Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:reply-to:dkim-signature; bh=4YwMoxpPdGIXr65qlRk5ePgKg8TaGLQF6RmLNsWlQrs=; fh=PIBJf9zX2bTHGJL7aPiXKlT+aDLYKWFq9Pq+ZKUupGA=; b=kfyEuyLkb04xSQeGvQ1s987UdRBl3X3NAiC/EepCmwQugcYs2Wj2Bnzd8fGA7Kzw8q Kh/Jzq56sioiTkE5w5HQ2eHGFZQ4CHk5MWuGW13I+VaCiMJysPqoA9oFaaV7l3W2fpEt /x/CCQxSG5oRUuOlgR47q7vzyyvk1J5up9prVrCyORGswmLvV3u03yolmEcoaEUUrXE5 ZLQJoN+dcAXhEHKYuWVhYAzo6TJ8PXERKPO6VNsvTj3J6Z3+0tkfU1QBkPJOjmdaujIR 4glmkEEx8yGo+XqFwzpYDrijF0WScCrObtiQYcaSLZCZy2uKCGjFC/r/GhRarzso3kev 7h4Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=lAr9KvXK; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-66206-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66206-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id j31-20020a0561023e1f00b0046d353d3953si23760vsv.448.2024.02.14.17.01.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 17:01:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66206-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=lAr9KvXK; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-66206-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66206-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 516321C29116 for ; Thu, 15 Feb 2024 01:00:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 68D223FEF; Thu, 15 Feb 2024 01:00:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="lAr9KvXK" Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77EA7818 for ; Thu, 15 Feb 2024 01:00:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707958810; cv=none; b=SdkkjVcnJGR41saMsfOddYio46smgVKV4eBg34TU6B1iLeZNvy/jDYwcPwHur1WE4YtIpuZjOVGTHuk1xTS2IdNvOUH1cFNkqpUw0faq1VYBqlpIFsvoBSd4kZqN08r9TT5aJmNeIbW3YGne/PeYZ+SEm+29xStYxtB4nu7TNeQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707958810; c=relaxed/simple; bh=7ekzgG3CaaN8Upth91WUvnRta1oqNcnH4L+iJ4pODBU=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=LT+EkxH4DWfZxOlt6xw3iXx4pdAthNn/LWQjNyxpWkEFGQybwa2ot0Tieq1W/S/04d8aasavJP3IkcJ882rOdsTUz3Jops/W7dZGLUtXqGWiETNgFHexTmP/GVJxsfqmtFBonbssB0IqwH9eV1zPqzPvj734/vjryGVTzIyy+I0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=lAr9KvXK; arc=none smtp.client-ip=209.85.210.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-6e0a461e125so360216b3a.3 for ; Wed, 14 Feb 2024 17:00:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707958809; x=1708563609; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:reply-to:from:to:cc :subject:date:message-id:reply-to; bh=4YwMoxpPdGIXr65qlRk5ePgKg8TaGLQF6RmLNsWlQrs=; b=lAr9KvXKWB7GQoTN8FeQY/M1Md6EJeMV2WRkbAxuURGsWqX6CZNXwiwPEwXsdmtFqN MwXzsPp6wCndeaSZMf6Bbu+HjPzFBStYfeagqXXtlFo2jngSLctujL1Mc6YzLM2QBykX d0rt4jLY1rGCNpC8SuMAzqLQ0mhvPRWtL1L6Ijei4ScAi9+pfiMk1mFIswKHjjp6K/pv rkwsyD6yGheSJqDJ4+Afve/Tj7senUTa20iNW7dLjBVHWFmKnGGTGyWBWBhmzPaDWm3n fxS23O1L2FWf8y92204hlP9LTUiS23Gja9/nsPbfQYbO67ClEu/nQZzRMCw7eghuWzQZ ZQJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707958809; x=1708563609; h=cc:to:from:subject:message-id:mime-version:date:reply-to :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4YwMoxpPdGIXr65qlRk5ePgKg8TaGLQF6RmLNsWlQrs=; b=wh/intIP2f/qn0LnP2WNC94qjhOYUbVHj3XFx33UUvOC6Q8Qr6pHbLgAnpcidV3rWT z7K0NfthmIuj/OpPpvltcu0dgWQ3SCohAIIuZCIt4jOZlwp/5PRIc8b681sR4ot1kKqT 0EKP+Ju0ZWsjYIuVnO97m7be5gXqGc/VU5S7YoLv/sKNTI20sVCgfM74igZ//pEsBlAC Xy9SqUuCvtpyEErVcMoEtA5+yliDN4IQXNZ8wrpwnutAXULt7wIg6uiI7BPbADqhj3if dbAb3NbjuYbhGkasyiB91f8fkVnJ1TnpCk1E0XDdFjALTn06OV2rpBZ3/vV+O5CA01s/ c0iw== X-Forwarded-Encrypted: i=1; AJvYcCWaXn7Mv/Sh1HJeV6pCUuqeT6RFjQJt9esrjj1j5/YoYM3v65s7uFUC+IlhZUo/x5ye8EPBo3DUtgSYvKdoNH9sE4VjUtDPbKaQalC+ X-Gm-Message-State: AOJu0Yw6OucjUBR/cNUYe+4eDVVPec9oJJxNbTbO0rOCOpamAwSwlb6n r+YeiYz1LzVIR85ZrP3XZSjj97rR8RFkvs3chT7BSvQ7X7QsjXkvyvnUVMQ4TXcwW4bWZOCxxlr Tpw== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6a00:4f8f:b0:6e0:e2f8:cf40 with SMTP id ld15-20020a056a004f8f00b006e0e2f8cf40mr40419pfb.0.1707958808772; Wed, 14 Feb 2024 17:00:08 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 14 Feb 2024 17:00:02 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog Message-ID: <20240215010004.1456078-1-seanjc@google.com> Subject: [PATCH 0/2] KVM: x86: Fix dirty logging of emulated atomics From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, David Matlack , Pasha Tatashin , Michael Krebs X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790924705516656341 X-GMAIL-MSGID: 1790924705516656341 Fix a bug in KVM's emulator where the target page of an atomic write isn't marked dirty, and enhance the dirty_log_test selftest to serve as a regression test by conditionally doing forced emulation of guest writes. Note, the selftest depends on several patches that are sitting in `kvm-x86 pmu`, so I'll likely take the selftest through that branch (eww). Sean Christopherson (2): KVM: x86: Mark target gfn of emulated atomic instruction as dirty KVM: selftests: Test forced instruction emulation in dirty log test (x86 only) arch/x86/kvm/x86.c | 10 ++++++ tools/testing/selftests/kvm/dirty_log_test.c | 36 ++++++++++++++++++-- 2 files changed, 43 insertions(+), 3 deletions(-) base-commit: 7455665a3521aa7b56245c0a2810f748adc5fdd4