Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1950862lqg; Mon, 4 Mar 2024 08:27:34 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUSwuj31Odz2UjPlIns0Y/jLlSQVZTN6BMQuShcOM3OKF2G/Yzl1JrW99joIH6PnZwj+g2c3C/ZZu1tmFEZBQ+5g3Ex03h4pnPp3Qnczw== X-Google-Smtp-Source: AGHT+IEUBHOcJPdJgMU0SWNMcqbhUDgDt0GQL9Cj7AlGSlajw54dqsSSrUsdCN8NIyQ+H86FITMZ X-Received: by 2002:aa7:cc02:0:b0:566:16e4:b6b3 with SMTP id q2-20020aa7cc02000000b0056616e4b6b3mr6462055edt.36.1709569654165; Mon, 04 Mar 2024 08:27:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709569654; cv=pass; d=google.com; s=arc-20160816; b=lzLh1cxAc6+1HWcjc1zE0CquWPItD9pzDAP0g7lBMLMF+rgS0aT2ris3y9QMw3TYMh TVRl4BWVyymohhZWiN5nQu8AgoOgBuprv3acrkrHTUeUpruCt/cNPiGryv7s8st9/EWT QWGbn3RAtv3ScBbUjud40H+bGJVjf5dF8AfGXvJ2RuSIV1uMfw0c2SPDRi879GtPK8C3 HImv0erdCn9WB1HWsP4Wgo1t32EygNSNrf3a0BGdjsHSnoHY8OFRqHh7TaUshVyxyqwf uZVkaYyJi6fQwBOiTmr4PuyobE0quT/KJwSBqGCufK1qyhwBs59dVgbqmsbP6W7jK0W3 jcng== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=M6XNRoo+ItlgCCymMkNNDCpnNuSZmKQcvP3m8cEgSac=; fh=0cnBFKc8yVTWC/rel350GJgF/q/C7GeD0u/yyc0MmPQ=; b=HYIveyA3nZXWVBERcLOQJ8GmpO5do4gIFJ9uc6BDZpzfwwHiGhZyLMjg9ZZPy94+JT aMVvqPfar7VCVeTQ1SpB3Oy4oY92COdR0Y3I8/HrZXx90YUpHJ+ZhOsXUwehYsudZrgN vGyEYpKbI/I60mBAQPNHxSrWX55QXt/WHYaFzOnulANCmTBFO09ijzUAqwD/MlFsmuUQ KnFiOLE229Y4F1CnjNSdM7v9ZrhucwVT9L3YJWcRrdvtgYPS6COQFfCp4epJ7jVvRSPR X+VAECLqXhsV93b+vJf3UrNB/trptDaK3MhTzU5n6fBQSPgzhbXsNxFbxw7+QaoDZDz6 vv1w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p1re9V+k; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-90935-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90935-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id i19-20020a05640242d300b005643bb8fa4asi4324188edc.152.2024.03.04.08.27.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 08:27:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90935-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p1re9V+k; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-90935-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90935-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 am.mirrors.kernel.org (Postfix) with ESMTPS id E08061F22F23 for ; Mon, 4 Mar 2024 16:27:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 392CF4C635; Mon, 4 Mar 2024 16:27:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="p1re9V+k" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 6224B482E2; Mon, 4 Mar 2024 16:27:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709569647; cv=none; b=SUEWiS+f1qgGx43mkAMIfWImFKUoroFAUkk4rwXDf2uW7lcEdar8TvS88Eg7M3hV7gFltmKaLEBBB9E/VUiis3glcsF5n1ay475Irvz7cgejc0LZcAVWXP5qEIr9QQR20d3C0tknLaWtLs6stPbzZelr5WXydxWC3Lp/CfToO+4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709569647; c=relaxed/simple; bh=2Jb1vJn/xYd7ULjthjMCdzuXihA6/Atrjilwen7AQxA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gOnC1NVtA8EGizvkCjcaefpJvCXMH2gkQ0oGptbPE4wKP2MrYz7eB4JytYLt30AL93gh7N4lkxAifejVUM/I6acHA5lWsKhnaooGKpBdHkRw9r67q8xikgZWlPV3b56TRA1tdcPcT4MZEyoz8CyOCS5od2z4XnuqT05ZTn1pcjE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=p1re9V+k; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E20CC433F1; Mon, 4 Mar 2024 16:27:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709569647; bh=2Jb1vJn/xYd7ULjthjMCdzuXihA6/Atrjilwen7AQxA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=p1re9V+kLVa6vGXJr3cQ/AT+HPrCsQDzi+BnkaaLsI+cie6mitgKvdT5y0Rw8UozW 3yIJwOCzVhXDC6amqPHXPdBWMRTzPF6KAFTH/FVd3G8RQMs/X/MY/zoXI7/ASuW7j/ 9NPris8PYQIVlK0AojJKd7PavJvU25wsmgkBr1sbO6oG17Zd4+qtpwEjcxiEw8vxHp QvVyjgK7KkVyj3IHHhVQTdsy4khskiUgz3HcX+66mxQTBfmcV7Dvyg17SUYmYtGh9p qS/GUqUxCINUHv7Ds5CJZ0R7VVncTQOrmXpJFxIkQT17dWMoIH/Du31AlK3H7EBcB6 1FyUiki1hCupw== Date: Mon, 4 Mar 2024 16:27:22 +0000 From: Mark Brown To: Marc Zyngier Cc: Oliver Upton , James Morse , Suzuki K Poulose , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] KVM: arm64: Reuse struct cpu_fp_state to track the guest FP state Message-ID: <607a10e4-6678-4148-9d5e-ec030b742207@sirena.org.uk> References: <20240229-kvm-arm64-group-fp-data-v2-0-276de0d550e8@kernel.org> <20240229-kvm-arm64-group-fp-data-v2-2-276de0d550e8@kernel.org> <86y1b027mc.wl-maz@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="D3tctJlyH4cuFut5" Content-Disposition: inline In-Reply-To: <86y1b027mc.wl-maz@kernel.org> X-Cookie: He who hesitates is last. --D3tctJlyH4cuFut5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Mar 02, 2024 at 11:30:51AM +0000, Marc Zyngier wrote: > Mark Brown wrote: > > At present we store the various bits of floating point state individual= ly > > in struct kvm_vcpu_arch and construct a struct cpu_fp_state to share wi= th > > the host each time we exit the guest. Let's simplify this a little by > > having a struct cpu_fp_state in the struct kvm_vcpu_arch and initialisi= ng > > this while initialising the guest. > This structure is only useful to the physical CPU we run on, and does > not capture anything that is related to the guest state. Why should it > live in the vcpu structure, duplicating things we already have? You were previously complaining that we were having to bind too much floating point state each time we bind a guest to a CPU, the goal here is to address this concern by filling in the structure at startup and then reusing it. As noted in the commit log given that this state includes system registers there are difficulties in trying to rearrange things so everything is in a single structure, I'm not sure that having to special case the FP registers would be a win there. =20 > This is just making things even more opaque. > If you need to add such a structure so that you can know what to > save/restore on context switch, then attach it to the per-CPU data > structure we already have. I'm having a hard time understanding what you're thinking of here, this is mainly about addressing whatever it is that's concering you but I'm not sure I have a good handle on what that is other than just a general concern that there's a lot of FP state which needs binding. If we put something in the per-CPU state without reorganising the data a lot it'll look very similar to the code you were complaining about, the current code is doing roughly what you suggest already. Personally I'm not overly concerned about the current state of the world and find it to be a reasonable tradeoff given what's going on, this is trying to address your feedback. --D3tctJlyH4cuFut5 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmXl9mkACgkQJNaLcl1U h9BioAf+NfHQfn/tMxiACNNhF5eYbNjv53vdlckqwV5LSBzV/wXC/CjhKz/UJnaZ 1ewtyJ0dKGVdKWefX3V/gIl1tq1lpM6PBEVG2LrFIYj6NzF1cYn9LH0pFN+Icaey cgZ9xPNOa2jImOVghBSxsedQ91CmJR2Z/Ye2IGU9ud+h1gs46/hhccE/PYhuggh/ /kt/GJVoSqJJncqUyBB/ETKSHgiJbJmiklNSg1RRAEKdd8zH62QABVlVeLf2XW+P hJ3dN2GPJkqFae1ir9QLLD2eDb3iuFvsXr9PKmw8SN7ntOVyLq1JuLyG4mUeVAiM qPGyqumFxtUakf5YFtKb8b7yea5vaA== =1Ccq -----END PGP SIGNATURE----- --D3tctJlyH4cuFut5--