From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D9804C433EF for ; Fri, 7 Jan 2022 20:12:38 +0000 (UTC) Received: from localhost ([::1]:38790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5vbJ-0002Ko-MH for qemu-devel@archiver.kernel.org; Fri, 07 Jan 2022 15:12:37 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42218) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5uXp-0002h2-Dm for qemu-devel@nongnu.org; Fri, 07 Jan 2022 14:04:59 -0500 Received: from [2604:1380:4641:c500::1] (port=47960 helo=dfw.source.kernel.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5uXk-0000L1-Iw for qemu-devel@nongnu.org; Fri, 07 Jan 2022 14:04:54 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1DADB61FF0; Fri, 7 Jan 2022 19:04:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFF6FC36AF3; Fri, 7 Jan 2022 19:04:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641582290; bh=8YAA2g6Na70NFQk9OYCoG61rxL4WyW01KMd7dTW9UO8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=HFPw5SqU2Qrle6qgM0hUT8ydTvurD5V1inuaERw4YKcMqMX8cMjeO46BU4h2Lhw8F Nd3rU3rdqKXhGbQPqpiViWTXPK4+H/9lK4llL4HTRkzs6KpSHRHZvYl2U7pRAgRZE8 iTGpQNEsxTcj0en1bBal5Z44TM423Jgnho0c22HaRkeayryZJYW+5Q+W+Lz06iimm/ 0do/5QzTTrRaz62n8TsMShfwnlrd1//cvFk/ga0Rf9U32TRse+X4KMUtAXHvKTjFFV 7eHzx9qQGgP5XD+ScqqG6rJ9D7N4jZunO2xMQKPw9gACW4LSuNFHs0pj6JahG9FfoA EcDXIhKeNtrIA== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1n5uXg-00GdT6-O6; Fri, 07 Jan 2022 19:04:48 +0000 Date: Fri, 07 Jan 2022 19:04:48 +0000 Message-ID: <87v8yvtlin.wl-maz@kernel.org> From: Marc Zyngier To: Peter Maydell Subject: Re: [PATCH v3 3/5] hw/arm/virt: Honor highmem setting when computing the memory map In-Reply-To: References: <20211227211642.994461-1-maz@kernel.org> <20211227211642.994461-4-maz@kernel.org> <871r1kzhbp.wl-maz@kernel.org> <87y23rtnny.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: peter.maydell@linaro.org, eric.auger@redhat.com, qemu-devel@nongnu.org, drjones@redhat.com, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Host-Lookup-Failed: Reverse DNS lookup failed for 2604:1380:4641:c500::1 (failed) Received-SPF: pass client-ip=2604:1380:4641:c500::1; envelope-from=maz@kernel.org; helo=dfw.source.kernel.org X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.372, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jones , kvm@vger.kernel.org, qemu-devel@nongnu.org, eric.auger@redhat.com, kernel-team@android.com, kvmarm@lists.cs.columbia.edu Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Fri, 07 Jan 2022 18:48:16 +0000, Peter Maydell wrote: > > On Fri, 7 Jan 2022 at 18:18, Marc Zyngier wrote: > > This is a chicken and egg problem: you need the IPA size to compute > > the memory map, and you need the memory map to compute the IPA > > size. Fun, isn't it? > > > > At the moment, virt_set_memmap() doesn't know about the IPA space, > > generates a highest_gpa that may not work, and we end-up failing > > because the resulting VM type is out of bound. > > > > My solution to that is to feed the *maximum* IPA size to > > virt_set_memmap(), compute the memory map there, and then use > > highest_gpa to compute the actual IPA size that is used to create the > > VM. By knowing the IPA limit in virt_set_memmap(), I'm able to keep it > > in check and avoid generating an unusable memory map. > > Is there any reason not to just always create the VM with the > maximum supported IPA size, rather than trying to create it > with the smallest IPA size that will work? (ie skip the last > step of computing the IPA size to create the VM with) That gives KVM the opportunity to reduce the depth of the S2 page tables. On HW that supports a large PA space, there is a real advantage in keeping these shallow if at all possible. Thanks, M. -- Without deviation from the norm, progress is not possible.