From patchwork Mon Jan 15 12:56:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 19036 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp1708192dyc; Mon, 15 Jan 2024 05:42:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IGcZW3na4D7HdTfka/V8jJGvzLu65/rG1y4MQJvEz1uGf4srmAQb7dnLtevXhC1m+PsFet4 X-Received: by 2002:a17:902:dac3:b0:1d3:993b:3af4 with SMTP id q3-20020a170902dac300b001d3993b3af4mr7286941plx.52.1705326125105; Mon, 15 Jan 2024 05:42:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705326125; cv=none; d=google.com; s=arc-20160816; b=SECpNYZcjhaEfF5feg7dIuqtnavemuE5n47eCuAwF6Jgcce/8bPAbSAxGYLfhIfU8V kWFQypbXDqeQc4kmWhT6dfe/wlNIkjqdaGX3c+q27AQyrXbZ5jidv7hEDiakdec79hl/ ON14+o2u5K2qY5AaGjNiz3S7q7jdsn9G1GzmCpGWUrEfMfkiuAswJZ6vPZOgubzctAVU mKbX5mJa4yeUDh+w6VsCWoRpP9Ut6uR7nn3sGY9z/+p50Uf2mQEmhawu7OWRVItkPPSJ B60buPLe4J9N+6yyuXFIEBnakTKyxcXFZqbjcwTybhzkltz4cjh3tOuh2U7pCLuzOqD9 nKPg== 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:to:from :dkim-signature; bh=NGz8qcxOM7EVgEWKAbNKsPiLOwrCtQw4O+B/FkvZxzw=; fh=aAPqvXm40pY9772UiBOljEePwtz/3Q0zIOpw238tj3M=; b=Y1dE5NqkZj14BeGteb6BQ38w+yJ0SN3UnT4SbKq0vDMjopIWTpuoP9mqR8d0WkUoHR CE+FizwGK96wDJi8lJsA+yzOvuJsHzF02EFHcUJCYBpRKxT4/Q5mUVvPxPoGmXtsqtD+ 3GY2ph94LMqCWtOAj9GaGQtsJJxgaMkLved0qUi1TOeNMzI7YthICgc1/6eYkLH+Eubt BhxaJDHpwmgzHioTX2d0WlxkkLeEJxHUS/iG5YEOyVvqOxR/Gy6gxFbYozje1RdZXDXd ikklAlZmTyoMWH6zV2qD4gC/7M3Otl0Mbv8G0RsJirnISWU5FZw4YuhVPUHwYoFN9WAg hTTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=IsBcCu7B; spf=pass (google.com: domain of linux-kernel+bounces-26042-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26042-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id kj11-20020a17090306cb00b001d433130553si7810478plb.251.2024.01.15.05.42.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 05:42:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26042-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=IsBcCu7B; spf=pass (google.com: domain of linux-kernel+bounces-26042-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26042-ouuuleilei=gmail.com@vger.kernel.org" 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 7D2A7B21306 for ; Mon, 15 Jan 2024 13:40:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3CF3B18021; Mon, 15 Jan 2024 13:38:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xen.org header.i=@xen.org header.b="IsBcCu7B" Received: from mail.xenproject.org (mail.xenproject.org [104.130.215.37]) (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 6CDB717C63; Mon, 15 Jan 2024 13:38:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xen.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date: Subject:To:From; bh=NGz8qcxOM7EVgEWKAbNKsPiLOwrCtQw4O+B/FkvZxzw=; b=IsBcCu7B0 NnP0YAOH73/jBV7BP7Iq9ILAZyrzh1DUpNSxneroBGPmzaZf6KqVAilaM0E3DFTaYvF23+WyGSPcB vTreYUWQskhl56HGD202ytYE3YrB/8cr4pkabFWqi9JQZXdgyAskNkj6bUs5OnOYp97waGek1X7sM oxoYtbIY=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rPMX0-0002iu-4U; Mon, 15 Jan 2024 12:57:34 +0000 Received: from 54-240-197-231.amazon.com ([54.240.197.231] helo=REM-PW02S00X.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rPMWz-0002kM-OK; Mon, 15 Jan 2024 12:57:33 +0000 From: Paul Durrant To: Paolo Bonzini , Jonathan Corbet , Sean Christopherson , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , David Woodhouse , Paul Durrant , Shuah Khan , kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v12 00/20] KVM: xen: update shared_info and vcpu_info handling Date: Mon, 15 Jan 2024 12:56:47 +0000 Message-Id: <20240115125707.1183-1-paul@xen.org> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788164047099826679 X-GMAIL-MSGID: 1788164047099826679 From: Paul Durrant This series has one small fix to what was in v11 [1]: * KVM: xen: re-initialize shared_info if guest (32/64-bit) mode is set The v11 patch failed to set the return code of the ioctl if the mode was not actually changed, leading to a spurious failure. This version of the series also contains a new bug-fix to the pfncache code from David Woodhouse. [1] https://lore.kernel.org/kvm/20231219161109.1318-1-paul@xen.org/ David Woodhouse (1): KVM: pfncache: rework __kvm_gpc_refresh() to fix locking issues Paul Durrant (19): KVM: pfncache: Add a map helper function KVM: pfncache: remove unnecessary exports KVM: xen: mark guest pages dirty with the pfncache lock held KVM: pfncache: add a mark-dirty helper KVM: pfncache: remove KVM_GUEST_USES_PFN usage KVM: pfncache: stop open-coding offset_in_page() KVM: pfncache: include page offset in uhva and use it consistently KVM: pfncache: allow a cache to be activated with a fixed (userspace) HVA KVM: xen: separate initialization of shared_info cache and content KVM: xen: re-initialize shared_info if guest (32/64-bit) mode is set KVM: xen: allow shared_info to be mapped by fixed HVA KVM: xen: allow vcpu_info to be mapped by fixed HVA KVM: selftests / xen: map shared_info using HVA rather than GFN KVM: selftests / xen: re-map vcpu_info using HVA rather than GPA KVM: xen: advertize the KVM_XEN_HVM_CONFIG_SHARED_INFO_HVA capability KVM: xen: split up kvm_xen_set_evtchn_fast() KVM: xen: don't block on pfncache locks in kvm_xen_set_evtchn_fast() KVM: pfncache: check the need for invalidation under read lock first KVM: xen: allow vcpu_info content to be 'safely' copied Documentation/virt/kvm/api.rst | 53 ++- arch/x86/kvm/x86.c | 7 +- arch/x86/kvm/xen.c | 356 +++++++++++------- include/linux/kvm_host.h | 40 +- include/linux/kvm_types.h | 8 - include/uapi/linux/kvm.h | 9 +- .../selftests/kvm/x86_64/xen_shinfo_test.c | 59 ++- virt/kvm/pfncache.c | 340 +++++++++-------- 8 files changed, 535 insertions(+), 337 deletions(-) base-commit: 1c6d984f523f67ecfad1083bb04c55d91977bb15