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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 BC47AEB64DA for ; Wed, 19 Jul 2023 05:06:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=u/8WHf9yh6iEwZnOCWzJF5ICzxjlIugda2zlGrUXOxo=; b=Nk0E7mKqrokgtd bAK88pllxla+wPvHvrVuw5a5B0sPgGLOVjn/bmLxJ/+bfBxuDWg/xzKlP9fVEBNzObd9kAFvnyH4Z Gy4KzkDVAeA8XpC1/RKgYPh51r/qrKGo6oiNxbvchT5ieRH5ZQMKpFqCTGb3+0gyvNbQhZPjWSGot GdyThyh8xn+PYWlT9hh7cqawTVL+HLnSGl1iEDMGsIMhI2I15DMLnP4d9EXxPuAAjLl5/1z0mQ8zu ZjsG+tM8pPWU1RXqSF49o0+Sc85nqBVBC79nqBzkkCZO0kbdJCw5rECw7OUIwaUINmldI3anlidNc 9zX349QXfuxrDZ80Zrkw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qLzOc-0059Hz-2C; Wed, 19 Jul 2023 05:06:42 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qLzOb-0059Ha-0a for linux-arm-kernel@bombadil.infradead.org; Wed, 19 Jul 2023 05:06:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=cRD9blNIxHluSUPOIYULRJbi8uFOds7uOEZDc3kDErE=; b=lxAuutPZYa/1YUOLP/l5UQIl5O rhOs7wA3aJ4gbefJjaaL/CWgh+H4OTbkKUuQk+CnTaDhhRBOq0d38MFNcC/q9y7hbN8MKtnZBsHVc K6QTV9mHpOSbldgmLg9cqK1PnW1lb/qE+zwiS7dWBeJ5Ebkq+A57R5yVjRxVC8anvsKfTdDFu9H0U l4BHkzb/euM6Mq1EYMyxDKw2s7BzR6aMOB8d/iBfIUqYkOQCPSkCpilGh/ASDhgKfs4lviPlvGB16 QiWlf1umfULmrS84YB0WAuAZ3I/B1wrfV5asSlyjzaft+8ptS4IrGmsIA15PzLsVrBwpqFZikVDMX pcIr/hOA==; Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qLoxn-00BrQW-1M for linux-arm-kernel@lists.infradead.org; Tue, 18 Jul 2023 17:58:21 +0000 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1b9e93a538dso33410155ad.3 for ; Tue, 18 Jul 2023 10:58:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1689703035; x=1692295035; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=cRD9blNIxHluSUPOIYULRJbi8uFOds7uOEZDc3kDErE=; b=mMpImavfY2ADOOfTsM0dULPAztPWwAkAxaN5EBRdgTONlUbuDv0bc/jnql1JEnUeOO bda5Tj4uvdDQ4B+NJ/gmvkMeUhOrHdA5CxK42FliEYPeTWhjOiI8i0+G+nUodHSTQx/g HanMLQr/dHe8w7iHPBOx35pnzrQWodjmfukbs1BbseIHXHWTRnEizqCumzGYhUaGm+dQ jRxPO5RqjGL1hwX87TamgliuO3lsmronneNDvHaIucdFlccgiBcVHg4FAmdI6hkUO0Ji 3UXm13B3+3pT+2iToWzn8Ie1OvrVbaXYWR6AEsbzg//AwTK48dHUa2cpqzFIrDJGPtWZ 5PWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689703035; x=1692295035; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=cRD9blNIxHluSUPOIYULRJbi8uFOds7uOEZDc3kDErE=; b=MIg7V7ZNAU1xJQ5JBBLRgnYlFoJuzMO2oUtK9s30u0bxb/2bstsyAkK7VREcr2AhG0 ++lw0yFwEqBeSC8j9Oi/D8N0koMIxP32B63mnMSb91VG4acAtEz2y83qQPfN7AVlQRf8 sonb0QTgRJSBk9RXuEfRJlFCu4ZQGuArd5DMnNGu2+uLq/Sx42aJ6LNI+s9C3YBCZ3bp hYDhh0ELjDbQLNpJKtG0lePo4jsyemR4wnKYZsj0mK1kdpH4LhMKvcdiwooURYrNukYG TwjiSVuSTjB4v1qQ4j+GA7laxwhFHIJfJEr/cQK4ir+eEsaNHi8JZ1wPUO9HCz/LMLEr MoKw== X-Gm-Message-State: ABy/qLa5hZsDW/nEX+ttd744fvjN7waPWjm3H81E4Ta3It5NDoT8BuF1 77DlNbH7jpf5NPZjqhaY4pcVCw== X-Google-Smtp-Source: APBJJlH/DFdDcamBY608z6if+lXRDqfUJnrs4w53GX7UPxfbPo+Y0+UeHJe6ZmJVTzN0SvAK3Kq8RA== X-Received: by 2002:a17:902:e549:b0:1b8:aef2:773e with SMTP id n9-20020a170902e54900b001b8aef2773emr17009609plf.46.1689703034916; Tue, 18 Jul 2023 10:57:14 -0700 (PDT) Received: from ziepe.ca ([206.223.160.26]) by smtp.gmail.com with ESMTPSA id iw10-20020a170903044a00b001b89612dc7dsm2167740plb.142.2023.07.18.10.57.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jul 2023 10:57:13 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1qLowi-002aex-Bi; Tue, 18 Jul 2023 14:57:12 -0300 Date: Tue, 18 Jul 2023 14:57:12 -0300 From: Jason Gunthorpe To: Alistair Popple Cc: akpm@linux-foundation.org, ajd@linux.ibm.com, catalin.marinas@arm.com, fbarrat@linux.ibm.com, iommu@lists.linux.dev, jhubbard@nvidia.com, kevin.tian@intel.com, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au, nicolinc@nvidia.com, npiggin@gmail.com, robin.murphy@arm.com, seanjc@google.com, will@kernel.org, x86@kernel.org, zhi.wang.linux@gmail.com Subject: Re: [PATCH 1/4] mm_notifiers: Rename invalidate_range notifier Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230718_185819_651717_3D64B371 X-CRM114-Status: GOOD ( 24.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jul 18, 2023 at 05:56:15PM +1000, Alistair Popple wrote: > diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h > index b466172..48c81b9 100644 > --- a/include/asm-generic/tlb.h > +++ b/include/asm-generic/tlb.h > @@ -456,7 +456,7 @@ static inline void tlb_flush_mmu_tlbonly(struct mmu_gather *tlb) > return; > > tlb_flush(tlb); > - mmu_notifier_invalidate_range(tlb->mm, tlb->start, tlb->end); > + mmu_notifier_invalidate_secondary_tlbs(tlb->mm, tlb->start, tlb->end); > __tlb_reset_range(tlb); Does this compile? I don't see "mmu_notifier_invalidate_secondary_tlbs" ? Maybe we don't need to rename this function since you pretty much remove it in the next patches? > diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c > index 50c0dde..34c5a84 100644 > --- a/mm/mmu_notifier.c > +++ b/mm/mmu_notifier.c > @@ -207,7 +207,7 @@ mmu_interval_read_begin(struct mmu_interval_notifier *interval_sub) > * spin_lock > * seq = ++subscriptions->invalidate_seq > * spin_unlock > - * op->invalidate_range(): > + * op->invalidate_secondary_tlbs(): The later patch should delete this stuff from the comment too, we no longer guarantee this relationship? > @@ -560,23 +560,23 @@ mn_hlist_invalidate_end(struct mmu_notifier_subscriptions *subscriptions, > hlist_for_each_entry_rcu(subscription, &subscriptions->list, hlist, > srcu_read_lock_held(&srcu)) { > /* > - * Call invalidate_range here too to avoid the need for the > - * subsystem of having to register an invalidate_range_end > - * call-back when there is invalidate_range already. Usually a > - * subsystem registers either invalidate_range_start()/end() or > - * invalidate_range(), so this will be no additional overhead > - * (besides the pointer check). > + * Subsystems should register either invalidate_secondary_tlbs() > + * or invalidate_range_start()/end() callbacks. > * > - * We skip call to invalidate_range() if we know it is safe ie > - * call site use mmu_notifier_invalidate_range_only_end() which > - * is safe to do when we know that a call to invalidate_range() > - * already happen under page table lock. > + * We call invalidate_secondary_tlbs() here so that subsystems > + * can use larger range based invalidations. In some cases > + * though invalidate_secondary_tlbs() needs to be called while > + * holding the page table lock. In that case call sites use > + * mmu_notifier_invalidate_range_only_end() and we know it is > + * safe to skip secondary TLB invalidation as it will have > + * already been done. > */ > - if (!only_end && subscription->ops->invalidate_range) > - subscription->ops->invalidate_range(subscription, > - range->mm, > - range->start, > - range->end); > + if (!only_end && subscription->ops->invalidate_secondary_tlbs) > + subscription->ops->invalidate_secondary_tlbs( More doesn't compile, and the comment has the same issue.. But I think the approach in this series looks fine, it is so much cleaner after we remove all the cruft in patch 4, just look at the diffstat.. Jason _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel