Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp999429rdf; Wed, 22 Nov 2023 02:58:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IGl/4hNxNlVWbQTxEZGpCYpCqSRK2BYyfSzr/miC63eSFheVKlLd73IV+VigE4sKJ3RzlH3 X-Received: by 2002:a05:6808:4286:b0:3af:6595:e53 with SMTP id dq6-20020a056808428600b003af65950e53mr2050222oib.13.1700650692908; Wed, 22 Nov 2023 02:58:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700650692; cv=none; d=google.com; s=arc-20160816; b=AdmArpS0hjyZg04E3Y7VnRLeld30A3TvI7qkb8WQVgqQ2FcAxx4UJOwpaExh5yVgkM iE9QxLBkgZan/bqL8vsMfythFIiHLe3T/NNFP1Ptu5rzodp04UCrQszc22vHSxLMA66s gnXkiNsF1KAsXXw6He/8J/XTsq5MyHzUrnzB4t0mrAKhm0735+SXDhhNY3mBuJ/K0nDh ca6iwHuV/PFFOkOEe/VnlnqJjjzxDrMfTFGbqSlFLi99OdzbqILnwCXayCtUq2mRyJ5I Wa0zbhCuiq6oM+Tn0cCVEFhl2M5XbyFuNAeswPR+7rASs8+0FB6RwOOE13VcEiKSwQEv ucww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:references:to:content-language:subject:reply-to :user-agent:mime-version:date:message-id:from:dkim-signature; bh=PDj4B8tTKHknHxb5LSqmGL6/2c2RSafLpktnB37g/4s=; fh=1kot/E5G32+jyKnfvYn77eM9gm4irioNETK7mqQrhes=; b=U7kBBbf8NZ7sFxQ4H1L7QXAigjTZioqXjK88mswcS33hcen8+WhJwxqtSFX7JRsMVG hWhylAR57Ugam3SL6i+A0FAVJbZ5OF2rf4qqIJk5mVDi4h8UUEibmubJw3Zu/5+Dp8AV DcO+0r4xa/F67sZ1fa7jGrlE0zC9Of5X5+POQc8W9g4THuQFiEhgavm/5J+tYs38Y7G1 S0ml9RPt61RC43BCf/tjfickgiLWzCXji/tmH0WwENuvf6zf+pafCWsb50OYQJXjVqEe pZmp4v7CwZfmy7lhpgQVgEX2/c9AZTzw4el+iu3A3JX0A2NHtaNg4i2gk3wf+qnvLt0R AcVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="HL/0JAtj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id x13-20020a056a00188d00b0068fe0f46f27si13059447pfh.171.2023.11.22.02.58.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 02:58:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="HL/0JAtj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 55D97802D51B; Wed, 22 Nov 2023 02:56:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235118AbjKVKzy (ORCPT + 99 others); Wed, 22 Nov 2023 05:55:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234991AbjKVKzl (ORCPT ); Wed, 22 Nov 2023 05:55:41 -0500 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C9F19E; Wed, 22 Nov 2023 02:55:35 -0800 (PST) Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2c87adce180so45605041fa.0; Wed, 22 Nov 2023 02:55:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700650534; x=1701255334; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:organization:references:to :content-language:subject:reply-to:user-agent:mime-version:date :message-id:from:from:to:cc:subject:date:message-id:reply-to; bh=PDj4B8tTKHknHxb5LSqmGL6/2c2RSafLpktnB37g/4s=; b=HL/0JAtjo0yLGYjma9U8XwcOXHuL18Hd+WHL33V99kWnb0DiY+Wh3t54xsmr9c24fW 5gTZx06IPFaJpeD6XgMYZ0wkxz4MbMzPoxnfrGrHV0wwDNTxfuVKLxkckM4PG6uEiS2R 6oCHwDuUtEsEBhETdaRKULM9R/AteByH8RtMYKU5UHMiIzEb8uDNIkhtTVf79dR51wVX AVa0HYCU3HKgNIQKHy7NRy7fzbhRIJseQ7o8d2UcwpXo60CH+RVrTO9Au3ihGs2a3OBP wiae3kzTqgnH7AE/JLeUt2Qyv+XmDBoOaMjN7w++b06/CB+1jlmrwcfGl2upXFnl+iPV BIlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700650534; x=1701255334; h=content-transfer-encoding:in-reply-to:organization:references:to :content-language:subject:reply-to:user-agent:mime-version:date :message-id:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=PDj4B8tTKHknHxb5LSqmGL6/2c2RSafLpktnB37g/4s=; b=Ucw2q2j//mzMO479Do0SyOgS6XtdQSpk2EfTXa0A9OvKVNeceoLRitGK9jwQCKIAkk 9lHO3Rk+9QAr8X251FKYjtjA/uz5lUgMveiHCoRV0NYXMcx24f0bGEjBBLTxTXsXe0TK +8D+E5UgsFSo2iZSO08x3xjfqHxbfvVJWoFSfiFgb/cRf4N8z7tNgz1kGNjy8fIxNvf4 i4JCzS8a7SpnMBYf/igeiWfbuenUsl9z6OEkGsjJXDtXTjDx2KXAiU7Al0tufangwVGn P99fWlmHldTFKH2jOwyS9Epj/843qI1ep/6alniofj4sp0DdAEiXOhKQh5s6qr6J3aJm w9rg== X-Gm-Message-State: AOJu0YwRD2wTLjI+QuJ3SqpsX82WSPELotr2iLnHVgCuktW85pWXY1Lz KQ+V13h94oHSjAuM/rLmCzg= X-Received: by 2002:a2e:8e68:0:b0:2c6:ed5e:bbf0 with SMTP id t8-20020a2e8e68000000b002c6ed5ebbf0mr1251662ljk.34.1700650533262; Wed, 22 Nov 2023 02:55:33 -0800 (PST) Received: from [10.95.134.92] (54-240-197-234.amazon.com. [54.240.197.234]) by smtp.gmail.com with ESMTPSA id v9-20020a05600c444900b0040836519dd9sm1835991wmn.25.2023.11.22.02.55.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Nov 2023 02:55:32 -0800 (PST) From: Paul Durrant X-Google-Original-From: Paul Durrant Message-ID: <94697586-7600-420d-a91b-2829019dab7c@xen.org> Date: Wed, 22 Nov 2023 10:55:30 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Reply-To: paul@xen.org Subject: Re: [PATCH v8 15/15] KVM: xen: allow vcpu_info content to be 'safely' copied Content-Language: en-US To: David Woodhouse , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , kvm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231121180223.12484-1-paul@xen.org> <20231121180223.12484-16-paul@xen.org> <4a76b7dc9055485d9e2592b395e60221dc349abf.camel@infradead.org> <7c7238a9c8b0dc6bc865407ba804a651cdfdb044.camel@infradead.org> Organization: Xen Project In-Reply-To: <7c7238a9c8b0dc6bc865407ba804a651cdfdb044.camel@infradead.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 22 Nov 2023 02:56:14 -0800 (PST) On 22/11/2023 10:39, David Woodhouse wrote: > On Tue, 2023-11-21 at 22:53 +0000, David Woodhouse wrote: >> On Tue, 2023-11-21 at 18:02 +0000, Paul Durrant wrote: >>> From: Paul Durrant >>> >>> If the guest sets an explicit vcpu_info GPA then, for any of the first 32 >>> vCPUs, the content of the default vcpu_info in the shared_info page must be >>> copied into the new location. Because this copy may race with event >>> delivery (which updates the 'evtchn_pending_sel' field in vcpu_info) there >>> needs to be a way to defer that until the copy is complete. >>> Happily there is already a shadow of 'evtchn_pending_sel' in kvm_vcpu_xen >>> that is used in atomic context if the vcpu_info PFN cache has been >>> invalidated so that the update of vcpu_info can be deferred until the >>> cache can be refreshed (on vCPU thread's the way back into guest context). >>> >>> Also use this shadow if the vcpu_info cache has been *deactivated*, so that >>> the VMM can safely copy the vcpu_info content and then re-activate the >>> cache with the new GPA. To do this, stop considering an inactive vcpu_info >>> cache as a hard error in kvm_xen_set_evtchn_fast(). >>> >>> Signed-off-by: Paul Durrant >>> Reviewed-by: David Woodhouse >> >> Wait, didn't we realise that this leaves the bits set in the shadow >> evtchn_pending_sel that get lost on migration? >> Indeed we did not, but that's not something that *this* patch, or even this series, is dealing with. We also know that setting the 'width' of shared_info has some issues, but again, can we keep that for other patches? The series is at v9 and has already suffered a fair amount of scope-creep. Paul