Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2863719rdb; Fri, 22 Sep 2023 10:17:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHKnWd5uX1rRGt1YauMnIb7w0WqsJ14DjEHRV8m0ncgXy1weBGJLITQbQnJEttVDlwwkwTe X-Received: by 2002:a05:6a20:748b:b0:15e:927:aadc with SMTP id p11-20020a056a20748b00b0015e0927aadcmr193739pzd.16.1695403077990; Fri, 22 Sep 2023 10:17:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695403077; cv=none; d=google.com; s=arc-20160816; b=b8bmGaV2HZU1S0S8Vndhzz6jEq79q7qn8S266xJiaRnsas7o5w415vhQs3cj8N/0pp 74bRNjDMff4iYvTWPTvOukAzcuDzadv656HRDPIZMyCtYfGzqKmEhBehX054uR9xy8Dn BQ2ga/0EmXU9toMt6hB3PvTRC61GmTIi+LzXvG9OhVwF01kZ+iFZLaJT7GVWGZcVVF06 jGaUMl9SgNS4TzAqWMZTCKA7F9q0OtGhiJ7+tPbKGq2VGTp+fsYHdTU/mJv0dXCrjT+f uG6faneexU4eIE8qkRA5LW5ybFm+lt//VXXyklQAc8u5OFEOU43yjCKR4arm9BzpnUIV sF2Q== 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:cc:to:content-language:subject:reply-to :user-agent:mime-version:date:message-id:from:dkim-signature; bh=1pk390ChrTCsthcK4uf4cQzmUvgXyIclFIFBle0EOe4=; fh=AXcSX4o2mtdt8GJZGyzIYQ5pO+J8PmGawny2wCmzj40=; b=DnhpGeuJJnoEq4NQ7svOjQKvLTICI1lAQnlZJR55+Fc2XV0S/RGhw7DhN0+PI424aX rL8blza6ZE7lBFAGFi+E0NcWS7lY+DgZTmoygZfAd0b9cN8CPdKg3/v/NhbaxoFuJpoe EgueYqwV8z3J1F75n1GGjqlfiEmMqWnGprC+Q2awAOUwLgP3dJe2NFS2CpUM5fwLOdP1 QpjEXqQeim3STR4iWhjWnui1G2SyDEM27DSbDgmvDvUvSPe0Q94oNIL8acyNCy/htZSd F3hw9+ehPcuZulCBuD8j9qGcZ22qywiJDUH0Pyhc4H4XlTzolWCKR1rSUtnd9lJ6wOxK idRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TApFWPOz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id g2-20020a17090a128200b00273ede74018si4190998pja.187.2023.09.22.10.17.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 10:17:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TApFWPOz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 75C4982BD318; Fri, 22 Sep 2023 08:50:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232021AbjIVPuD (ORCPT + 99 others); Fri, 22 Sep 2023 11:50:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232735AbjIVPuA (ORCPT ); Fri, 22 Sep 2023 11:50:00 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFB59199; Fri, 22 Sep 2023 08:49:52 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-404314388ceso26035905e9.2; Fri, 22 Sep 2023 08:49:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695397791; x=1696002591; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:organization:references:cc:to :content-language:subject:reply-to:user-agent:mime-version:date :message-id:from:from:to:cc:subject:date:message-id:reply-to; bh=1pk390ChrTCsthcK4uf4cQzmUvgXyIclFIFBle0EOe4=; b=TApFWPOz7fabs3bGMCfGU0A8oMvWDM+ofSqSUcOPdTYhdG/rtTm5dDaxY2GFr7yTNH 3VwvRS35hqSZjLHCzocjmYMllZsfTJZ02ts/DbuCfKoGrHzeW7jEGfMWFw/I45UnS96d oVlmXdy+czyAQ8StdMXvXE0w7moTLjFl7W0NYHiB4n0gmzmHXtBAvtJo9aJXmzBNdXJa cSLImh4iPRHANmrUne9ltq79yiqHWOTfsqFi6U9jKt8TRCynrGyVbp9Q8xrTFFdwpY6j DLMXfhQmTLIV5fnBa5EVQyMD3KA/EmAMmLmR+MyNBZtG8HHyj7UQ9egEUij69m5P5AK0 QqwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695397791; x=1696002591; h=content-transfer-encoding:in-reply-to:organization:references:cc: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=1pk390ChrTCsthcK4uf4cQzmUvgXyIclFIFBle0EOe4=; b=cjo6K24oY/VwK5HlrK+GjQfskx7U4pkICV2CjIsR/0w18EUqDd3rhqUwZ5bp6evetN MEwyE/X7V6y5i7S+bqnKlfYqmK/HwozdqMIgOCw81yiESjM0pr2I7/ylU/JmYvv+K689 OTc1yIwbSCTrGOuAwn7FfLGHt9thazyO6+NENhNeK7qemuVjOPViN0BVEh3TTPocLMTg V/dkVxbieGIlZi3LCgDUtbYPlvsOU3lK1P/XzewDVR0pMhMZAheBMr2QFCzIsIw2IR5y qAav4oK0c5NQ+LELMUG13vuUjrAeDil59koI8blCZ5mOzaQ+sMqOPc4C8is35MFJkV71 u+Jg== X-Gm-Message-State: AOJu0YzXVHPduXmb9KYgk/l8wHYzosfl+fL/kZE9M5JFmBtFX4I6qgtd +gcH2gCda8ipx0TYrarIp9k= X-Received: by 2002:a05:6000:118a:b0:31f:eed7:2fd9 with SMTP id g10-20020a056000118a00b0031feed72fd9mr43577wrx.57.1695397790991; Fri, 22 Sep 2023 08:49:50 -0700 (PDT) Received: from [192.168.4.149] (54-240-197-226.amazon.com. [54.240.197.226]) by smtp.gmail.com with ESMTPSA id p2-20020a5d68c2000000b0031431fb40fasm4755076wrw.89.2023.09.22.08.49.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 22 Sep 2023 08:49:50 -0700 (PDT) From: Paul Durrant X-Google-Original-From: Paul Durrant Message-ID: <34457a97-516f-4122-a9d7-920eb3b3c2e0@xen.org> Date: Fri, 22 Sep 2023 16:49:49 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Reply-To: paul@xen.org Subject: Re: [PATCH v5 07/10] KVM: xen: allow vcpu_info to be mapped by fixed HVA Content-Language: en-US To: David Woodhouse , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Paul Durrant , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , x86@kernel.org References: <20230922150009.3319-1-paul@xen.org> <20230922150009.3319-8-paul@xen.org> <8f61e1618f23e975f30e552c09787c5f82ee89f3.camel@infradead.org> Organization: Xen Project In-Reply-To: <8f61e1618f23e975f30e552c09787c5f82ee89f3.camel@infradead.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Fri, 22 Sep 2023 08:50:05 -0700 (PDT) On 22/09/2023 16:44, David Woodhouse wrote: > On Fri, 2023-09-22 at 15:00 +0000, Paul Durrant wrote: >> From: Paul Durrant >> >> If the guest does not explicitly set the GPA of vcpu_info structure in >> memory then, for guests with 32 vCPUs or fewer, the vcpu_info embedded >> in the shared_info page may be used. As described in a previous commit, >> the shared_info page is an overlay at a fixed HVA within the VMM, so in >> this case it also more optimal to activate the vcpu_info cache with a >> fixed HVA to avoid unnecessary invalidation if the guest memory layout >> is modified. >> >> Signed-off-by: Paul Durrant > > But it should *only* be defined as an HVA in the case where it's the > one in the shinfo. Otherwise, it's defined by its GPA. > > Which almost makes me want to see a sanity check that it precisely > equals &shinfo->vcpu_info[vcpu->arch.xen.vcpu_id]. > > Which brings me back around the circle again to wonder why we don't > just *default* to it.... you hate me, don't you? > > Your previous set of patches did that, and it did end requiring that > the VMM restore both VCPU_INFO and VCPU_ID for each vCPU *before* > restoring the SHARED_INFO_HVA on resume, but wasn't that OK? > No. It was painful and overly complex, with too many corner cases that were making my brain hurt. Given the pain of the last week, leaving the default handling in the VMM is preferable. It means I don't need to impose rules about attribute ordering and hence get caught by needing one thread to wait for another inside the VMM. It's better and more robust this way. Paul