Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp2238838rwb; Thu, 27 Jul 2023 04:30:16 -0700 (PDT) X-Google-Smtp-Source: APBJJlHh42gi5l0QL7Kvqtuj4Exv4OKpzWe0O3bDy9Tts/IYgbRNn3yhm0OatsVr9RvczdmctdB0 X-Received: by 2002:a05:6512:3085:b0:4fd:f7e7:24fd with SMTP id z5-20020a056512308500b004fdf7e724fdmr1774897lfd.64.1690457416428; Thu, 27 Jul 2023 04:30:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690457416; cv=none; d=google.com; s=arc-20160816; b=eW9n2ejWWuiBpO4zlZamZUCYbBxbQS446WsQsuXDD51z080xpMu+ACr3v8qx2fmRY6 sXj6DXh/L20MFuIddkV6Mf8/5gt5pIWf8cogfJT4CY4R6q+iBuYeOsF0FfyGEgLuxIZt E03XJj/XhYE/WdJuD6fMNGd3+LAvtLGt9JMbcRviCzooRBX/7JSBx0HFcscFRDHQl2zf KDb6OVT3ujxUvHoxieM32oV2ATxdGVXeC7CdX48RtvFDrepDKdtpqHy8Hy6Rg4NUokZn gH8/5AVbwZsuYvYYUx/GrzJPglbE6luKArBbui89gHzl7QPlMKUa8A2FCm4gyxQWP7ah cnYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=59Vz6aBAVPnE14nkLWacAMVTOaBsvDLBYG/bCAECkfg=; fh=OcemPTDAL5Bi7V6B11JB5Z4EzIBo5fZZLy7iVlrQXxk=; b=h1Tz72SdF1Cqq1aosvMj1Y7NkrGAubeQRES2MRY7IqinaTsOLmBoBL4OUi5bBXuqPb cm2aiyKF6EJqgvBsrsXPVSSEu7ffaG1pOH7grksA3XD0Z2qB0dvQkTViXokDyWaqjhKj eLHfCeuFHo5sh4JNc64ST6O9Qtayv3lq0UdP+R1NmrnkVg4NVVla37APHPJoBlyZGREY B1DPZoe5uknDWSeXdehoJ/YDHwm7H2VzF8TzFxL0Pg11ZU7E+oZwj5ozkldC0HL+y5fS Jo+T8oWrfasPkEC4jfGOOegXn56B8lRZ+0E746pF8fBnWklyUtonTuzLUmVK4UklJQOz CvdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jPiusiKe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v11-20020a1709060b4b00b00997c7157a02si876278ejg.821.2023.07.27.04.29.51; Thu, 27 Jul 2023 04:30:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jPiusiKe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232815AbjG0KxH (ORCPT + 99 others); Thu, 27 Jul 2023 06:53:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229801AbjG0KxF (ORCPT ); Thu, 27 Jul 2023 06:53:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E6A0B4; Thu, 27 Jul 2023 03:53:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A524C61E17; Thu, 27 Jul 2023 10:53:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DC10C433C7; Thu, 27 Jul 2023 10:53:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690455183; bh=Kf3PoZcaGR2gkOy5bI0LwvtY2SC896CCkSXbSLWkFBc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=jPiusiKewOUry6ypAvPniDaxOhUSPXIOCXtTsmNNz+/7gz1EFs7E8kzftW2B4RaoB cjQ1HUyrhUcWgfrvkf+Vxpa/PRNM1vtXi8BIA8Hn9EXNo/cR3/WvZaW+dQM8fHLZmZ VVCwZmVHCM7nJ80nDfcS+mKecRzQlNH/Yl8WEHhsCulky2Ia7ezh8YBkfb2O22fY1m opNlycFD/nAxb6Qb8w9vsszetxEoy9mV2HE2PvX457L+jGtKCOeEklSA4wdsTxf0oT bSgbizad+4N4QYmI8SK9TxqZ/GFtZs53ijAxdu4PdAOOm/xLWZ+fFl4HLASo9h7uiF qBZ5GfHonID0A== Received: from [104.132.45.102] (helo=wait-a-minute.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 1qOyc8-00HKTs-J2; Thu, 27 Jul 2023 11:53:00 +0100 Date: Thu, 27 Jul 2023 11:53:00 +0100 Message-ID: <87sf99r5gz.wl-maz@kernel.org> From: Marc Zyngier To: Raghavendra Rao Ananta Cc: Oliver Upton , James Morse , Suzuki K Poulose , Paolo Bonzini , Sean Christopherson , Huacai Chen , Zenghui Yu , Anup Patel , Atish Patra , Jing Zhang , Reiji Watanabe , Colton Lewis , David Matlack , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-mips@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Gavin Shan , Shaoqin Huang Subject: Re: [PATCH v7 05/12] KVM: Move kvm_arch_flush_remote_tlbs_memslot() to common code In-Reply-To: <20230722022251.3446223-6-rananta@google.com> References: <20230722022251.3446223-1-rananta@google.com> <20230722022251.3446223-6-rananta@google.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 (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: 104.132.45.102 X-SA-Exim-Rcpt-To: rananta@google.com, oliver.upton@linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, pbonzini@redhat.com, seanjc@google.com, chenhuacai@kernel.org, yuzenghui@huawei.com, anup@brainfault.org, atishp@atishpatra.org, jingzhangos@google.com, reijiw@google.com, coltonlewis@google.com, dmatlack@google.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-mips@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, gshan@redhat.com, shahuang@redhat.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 22 Jul 2023 03:22:44 +0100, Raghavendra Rao Ananta wrote: > > From: David Matlack > > Move kvm_arch_flush_remote_tlbs_memslot() to common code and drop > "arch_" from the name. kvm_arch_flush_remote_tlbs_memslot() is just a > range-based TLB invalidation where the range is defined by the memslot. > Now that kvm_flush_remote_tlbs_range() can be called from common code we > can just use that and drop a bunch of duplicate code from the arch > directories. > > Note this adds a lockdep assertion for slots_lock being held when > calling kvm_flush_remote_tlbs_memslot(), which was previously only > asserted on x86. MIPS has calls to kvm_flush_remote_tlbs_memslot(), > but they all hold the slots_lock, so the lockdep assertion continues to > hold true. > > Also drop the CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT ifdef gating > kvm_flush_remote_tlbs_memslot(), since it is no longer necessary. > > Signed-off-by: David Matlack > Signed-off-by: Raghavendra Rao Ananta > Reviewed-by: Gavin Shan > Reviewed-by: Shaoqin Huang > --- > arch/arm64/kvm/arm.c | 6 ------ > arch/mips/kvm/mips.c | 10 ++-------- > arch/riscv/kvm/mmu.c | 6 ------ > arch/x86/kvm/mmu/mmu.c | 16 +--------------- > arch/x86/kvm/x86.c | 2 +- > include/linux/kvm_host.h | 7 +++---- > virt/kvm/kvm_main.c | 18 ++++++++++++++++-- > 7 files changed, 23 insertions(+), 42 deletions(-) > [...] > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index 804470fccac7..58213cc4b9b9 100644 > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -379,6 +379,20 @@ void kvm_flush_remote_tlbs_range(struct kvm *kvm, gfn_t gfn, u64 pages) > kvm_flush_remote_tlbs(kvm); > } > > +void kvm_flush_remote_tlbs_memslot(struct kvm *kvm, > + const struct kvm_memory_slot *memslot) > +{ > + /* > + * All current use cases for flushing the TLBs for a specific memslot > + * related to dirty logging, and many do the TLB flush out of mmu_lock. I appreciate this is a copy paste of an existing comment, but I can't parse it. My command of the English language is notoriously approximate, but it feels that something is missing in the first sentence, such as a verb. M. -- Without deviation from the norm, progress is not possible.