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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 448C2C004D4 for ; Thu, 19 Jan 2023 15:49:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231462AbjASPs6 (ORCPT ); Thu, 19 Jan 2023 10:48:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231374AbjASPsH (ORCPT ); Thu, 19 Jan 2023 10:48:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 562018456A; Thu, 19 Jan 2023 07:47:25 -0800 (PST) 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 1634261C7A; Thu, 19 Jan 2023 15:47:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53C79C433EF; Thu, 19 Jan 2023 15:47:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674143238; bh=nf+TfbsdsLnbBMpPQU+Z3CHp7yhDIe+N4TFfsC327dE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=mIDiP/LEUSddUG+KRv1yAHu1BUHOcJf5M45Lxdfh8NIAt/S6eM6oLGvGD64SiUpzz BB8F1EHeU1B03bQq6YHQoGV9eSCZI9Kx5bSkitzyUP6bx0Wqu8E2OWjxQp4pUB+s2j XNiXWjp4gZfZ0QUsZc0ZqQLxYi4571K4rxYR2KZu2YLvrjYYXHWUkdS12ua25fO6dT y++3ODurgU4GCy4fMCG7KuAaVn1ryefJ4zyeqRFdE+axpZHhBgOnSH38xyxHNrs3QG 79aNESccMbt3pLIidpMCqMyVcb0ldk3xlLr4tpR/1nMpd05UPIP//QJ9OIwd3dwzEh uvHrQSDkULlaw== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pIX8G-0038Ks-1Y; Thu, 19 Jan 2023 15:47:16 +0000 Date: Thu, 19 Jan 2023 15:47:15 +0000 Message-ID: <86v8l2msqk.wl-maz@kernel.org> From: Marc Zyngier To: Gavin Shan Cc: Oliver Upton , kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, pbonzini@redhat.com, corbet@lwn.net, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, ricarkol@google.com, eric.auger@redhat.com, yuzhe@nfschina.com, renzhengeek@gmail.com, ardb@kernel.org, peterx@redhat.com, seanjc@google.com, shan.gavin@gmail.com Subject: Re: [PATCH 1/4] KVM: arm64: Allow saving vgic3 LPI pending status in no running vcpu context In-Reply-To: <0626e135-5d6b-8d09-ccd1-068e42a052f6@redhat.com> References: <20230116040405.260935-1-gshan@redhat.com> <20230116040405.260935-2-gshan@redhat.com> <0626e135-5d6b-8d09-ccd1-068e42a052f6@redhat.com> 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/28.2 (aarch64-unknown-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: gshan@redhat.com, oliver.upton@linux.dev, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, pbonzini@redhat.com, corbet@lwn.net, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, ricarkol@google.com, eric.auger@redhat.com, yuzhe@nfschina.com, renzhengeek@gmail.com, ardb@kernel.org, peterx@redhat.com, seanjc@google.com, shan.gavin@gmail.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 19 Jan 2023 01:11:44 +0000, Gavin Shan wrote: > > I will have vgic_write_guest_lock() in v2. Note that those 3 paths can't be > running in parallel since one switch is shared by them. Alternatively, we > extend struct vgic_dist::save_tables_in_progress from 'bool' to 'unsigned long'. > Several bit is defined for each site as below. In this way, the 3 paths can be > running in parallel: > > unsigned long struct vgic_dist::save_tables_in_progress > > #define VGIC_DIST_SAVE_ITS_ITE 0 /* ITS Translation Entry */ > #define VGIC_DIST_SAVE_ITS_DTE 1 /* ITS Device Table Entry */ > #define VGIC_DIST_SAVE_ITS_CTE 2 /* ITS Collection Table Entry */ > #define VGIC_DIST_SAVE_ITS_CT 3 /* ITS Collection Table */ > #define VGIC_DIST_SAVE_VGIC3_LPI 4 /* VGIC3 LPI Pending Status */ > #define VGIC_DIST_SAVE_VGIC3_PENDING_TABLE 5 /* VGIC3 Pending Table */ > > The drawback is the calls are limited to 64. If those 3 paths can't be running > in parallel, we needn't the extension at all. It should all be completely sequential. KVM_DEV_ARM_ITS_SAVE_TABLES runs in a context where everything is locked, and so is VGIC_DIST_SAVE_VGIC3_PENDING_TABLE. M. -- Without deviation from the norm, progress is not possible.