From patchwork Fri Aug 23 19:13:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 13775747 Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) (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 42893191499 for ; Fri, 23 Aug 2024 19:13:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724440439; cv=none; b=mVMQHmJBTEY1SbdPQMjeMz04bxf7gQqEySZXd9FqIjxHyZM/elWftpyY9Y7OM+989nAAM/5KSxWp7m1KKuRzhw7SBVONSYV8wlHBjznRhno40Det8dDfATpZVX41V59tJIQVyFN57e9FJzboTTfO4I01w35CQEHwDLT6WGsu/GI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724440439; c=relaxed/simple; bh=h6MmzQZ+Q4pIa1u5FgXSfED7FfGxALfn2toMjPtt/mA=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=SFJJkcQDPmOSTmNEdpD+DG4s4xM6eAPb+b80FPsxFx/rdCEdCR0WBYum/KJGM1hpIGPgngps75DL2yN3TCBaIac7DJYLdNcpovSh957a2JL6arIuZAYFkn3mt0BSZN/+LXV0/kE6ewaDqU+J7dq/5CNEjyKAgRPl/wAXhJWboME= 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=jVodPhAl; arc=none smtp.client-ip=209.85.210.201 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="jVodPhAl" Received: by mail-pf1-f201.google.com with SMTP id d2e1a72fcca58-7142fc79985so2390311b3a.2 for ; Fri, 23 Aug 2024 12:13:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1724440437; x=1725045237; 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=3t1dUkJeUSV+3qq06ORSFrmDhowUhY/J12I+j1i5R8M=; b=jVodPhAlR5iQOVcRx2uo3L7MPzA6ddJYki4qJbps94/gahtcuM30ymTUUoex3iP6qD nBpKVSV4KFNIYBU2Rc/VSB01GnVxJmOpcvnwSnaCCQSWf2EsKo+oOWa6xG/CZSpz/XTR GG3ztCdNvmDQPamw+1rfMxPS7Gbi17l+PgBXmVZUISA9yxR1W4keI5sgxMgqKS7vtyxQ 0uhZeHP8DlfQxOUqu9ux8FEF8hJm5Ge9JgGOSbJD9B/bUvMEtKHZjnyDq77MqG4cFGYL cQ8nJak+Wi+iEkQVbZvuat8EWWh4fxgJKwGIM4BlVb2DiORGWFMA0aHiP72b2wOEsTBb ypTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724440437; x=1725045237; 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=3t1dUkJeUSV+3qq06ORSFrmDhowUhY/J12I+j1i5R8M=; b=XQnMchsX671Vs7U6YGm+jMe1YAjLEMYUXtTiC3Si8f3qc6DORQYtSy32YwgoNPiQRm myJo1rRvCFlBlfvJhfORX6fvfASkazqAylRhQRSkxNuG/tP9wkdRZDbo+YJI0DmIkovh CXBCtHvBoNBGO5wUKSic/NCmY3REwsNKMzaY2avey5sRtI0DCY2V5YqF/84O07O9/1/n Y5Hw1abboK4SPva+XDKM3GIii+51CfawI2mqONRdCOQB/RQueEO1EVsjYKVXRwHd+zh9 l62a7ywP20RBbwYlIKkzHHUD9onAj7SAO9Ef12rbeBTtqDlyWaFp9GocaCPWbu6ZDQ6q vKGA== X-Gm-Message-State: AOJu0YxX2JvNASXuwUqqrNCvw2TqJ63NkTFlsf6fKnCAyagUIfibrYgW oqMdj4SgY6NR7Ghjy/MThTqg20MH3W7SuL6OjmWt3cBo6I7PaCqy+1AFq0Oa/c7uL7UpOC5X2JD iHA== X-Google-Smtp-Source: AGHT+IFa4eVeYlZTkeZeaU1ds/tSY8A2mDkMlBOpXGWUY58qHdlifZGblM42xWXi0Geg7QTcr7Dcw35OvLE= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6a00:6013:b0:70d:3548:bb59 with SMTP id d2e1a72fcca58-71445abd3d4mr15310b3a.4.1724440437097; Fri, 23 Aug 2024 12:13:57 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 23 Aug 2024 12:13:52 -0700 Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.46.0.295.g3b9ea8a38a-goog Message-ID: <20240823191354.4141950-1-seanjc@google.com> Subject: [PATCH 0/2] KVM: Coalesced IO cleanup and test From: Sean Christopherson To: Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Ilias Stamatis , Marc Zyngier , Oliver Upton , Anup Patel , Sean Christopherson , Paul Durrant Add a regression test for the bug fixed by commit 92f6d4130497 ("KVM: Fix coalesced_mmio_has_room() to avoid premature userspace exit"), and then do additional clean up on the offending KVM code. I wrote the test mainly so that I was confident I actually understood Ilias' fix. This applies on the aforementioned commit, which is sitting in kvm-x86/generic. Fully tested on x86 and arm64, compile tested on RISC-V. Sean Christopherson (2): KVM: selftests: Add a test for coalesced MMIO (and PIO on x86) KVM: Clean up coalesced MMIO ring full check tools/testing/selftests/kvm/Makefile | 3 + .../testing/selftests/kvm/coalesced_io_test.c | 202 ++++++++++++++++++ .../testing/selftests/kvm/include/kvm_util.h | 26 +++ virt/kvm/coalesced_mmio.c | 29 +-- 4 files changed, 239 insertions(+), 21 deletions(-) create mode 100644 tools/testing/selftests/kvm/coalesced_io_test.c base-commit: 728d17c2cb8cc5f9ac899173d0e9a67fb8887622