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 mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08DD2C433F5 for ; Thu, 3 Mar 2022 17:29:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 439A843399; Thu, 3 Mar 2022 12:29:43 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@kernel.org Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yGY2PPShGPzO; Thu, 3 Mar 2022 12:29:42 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 3578443482; Thu, 3 Mar 2022 12:29:42 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 47B5543399 for ; Thu, 3 Mar 2022 12:29:41 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0I8hhNZUEXiW for ; Thu, 3 Mar 2022 12:29:40 -0500 (EST) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id E0E8A4291D for ; Thu, 3 Mar 2022 12:29:39 -0500 (EST) 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 ams.source.kernel.org (Postfix) with ESMTPS id 3F8FDB82650; Thu, 3 Mar 2022 17:29:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE2B9C004E1; Thu, 3 Mar 2022 17:29:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646328576; bh=FOw+85uwmyeCg5YFO8PbTlTtboPnRTZQlSAakLzXseA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=RBGiaT51hagwMp8oY91hK6Cz8Vxfbmh7xb6MBZf9kRQZkun+DuA9cTcePc7EY6LvM /pH1fOlPU+biHohqNGjvovDaI2QmwtG/ZSRzCT8FG8EteWh4F358xVG3kP5vdyj7U2 TkxIBm8WQhzjwx+UcD/BFDW/aMNOoV23VRvw6tMG5NRUIr/uSVDqgSIdGYgJ/EsISU TBa+cT/GaLLOclth+gbqvkcu+YMNiKYp5xlPGtN4oxJ1i0gec6jdOt9Y10Tcw+Z8rq APbNdFTkV4Zp4aPA8FL2cPqZ6+Hz2aeKx0uUwsoPjsfQInLDmEo1fqzd+x0pb6u5l3 01C/F0rtLgZ4w== 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 1nPpGf-00C14D-UP; Thu, 03 Mar 2022 17:29:34 +0000 Date: Thu, 03 Mar 2022 17:29:33 +0000 Message-ID: <87r17j0wsi.wl-maz@kernel.org> From: Marc Zyngier To: Kalesh Singh Subject: Re: [PATCH v4 2/8] KVM: arm64: Introduce pkvm_alloc_private_va_range() In-Reply-To: References: <20220225033548.1912117-1-kaleshsingh@google.com> <20220225033548.1912117-3-kaleshsingh@google.com> <87v8ww6bl0.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") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: kaleshsingh@google.com, will@kernel.org, qperret@google.com, tabba@google.com, surenb@google.com, kernel-team@android.com, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, mark.rutland@arm.com, broonie@kernel.org, mhiramat@kernel.org, pcc@google.com, madvenka@linux.microsoft.com, ascull@google.com, pbonzini@redhat.com, ardb@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Cc: "moderated list:ARM64 PORT \(AARCH64 ARCHITECTURE\)" , Will Deacon , Peter Collingbourne , "Cc: Android Kernel" , LKML , kvmarm , "Madhavan T. Venkataraman" , Mark Brown , Masami Hiramatsu , Catalin Marinas , Paolo Bonzini , Suren Baghdasaryan X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu Hi Kalesh, On Wed, 02 Mar 2022 17:24:53 +0000, Kalesh Singh wrote: > > On Tue, Mar 1, 2022 at 11:46 PM Marc Zyngier wrote: > > > > On Fri, 25 Feb 2022 03:34:47 +0000, > > Kalesh Singh wrote: > > > > > > pkvm_hyp_alloc_private_va_range() can be used to reserve private VA ranges > > > in the pKVM nVHE hypervisor (). Also update __pkvm_create_private_mapping() > > > to allow specifying an alignment for the private VA mapping. > > > > > > These will be used to implement stack guard pages for pKVM nVHE hypervisor > > > (in a subsequent patch in the series). > > > > > > Credits to Quentin Perret for the idea of moving > > > private VA allocation out of __pkvm_create_private_mapping() > > > > > > Signed-off-by: Kalesh Singh > > > --- > > > > > > Changes in v4: > > > - Handle null ptr in pkvm_alloc_private_va_range() and replace > > > IS_ERR_OR_NULL checks in callers with IS_ERR checks, per Fuad > > > - Fix kernel-doc comments format, per Fuad > > > - Format __pkvm_create_private_mapping() prototype args (< 80 col), per Fuad > > > > > > Changes in v3: > > > - Handle null ptr in IS_ERR_OR_NULL checks, per Mark > > > > > > Changes in v2: > > > - Allow specifying an alignment for the private VA allocations, per Marc > > > > I probably badly expressed my earlier concern. > > > > Yes, an alignment is necessary. But how often do we want an alignment > > that isn't naturally aligned to the size of the allocation (i.e. the > > power of 2 >= the size of the allocation)? This is what the rest of > > the kernel does (get_order() and co), and I thing we should follow > > this. > > Hi Marc, > > Thanks for clarifying. I think making the alignment implicitly based > on the size here will create unnecessary holes where PAGE_SIZE > alignment would be ok and potentially overflow the private VA space > earlier. Is it not a concern? I don't think we should worry too much about this. Even when building the kernel with a very small VA space (commonly 39 bits), we still have a quarter of that reserved for private EL2 mappings. That's pretty big. We will use a bit more of the memory that is set aside for EL2 page tables, but this shouldn't be a problem either. Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm