From patchwork Thu Oct 12 19:55:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 1847763 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=jIePl0Dk; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=gandalf.ozlabs.org; envelope-from=srs0=fpab=f2=vger.kernel.org=sparclinux-owner@ozlabs.org; receiver=patchwork.ozlabs.org) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S60jp2w2rz1yqn for ; Fri, 13 Oct 2023 06:55:26 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4S60jn3fCVz4xQg for ; Fri, 13 Oct 2023 06:55:25 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4S60jn3RgXz4xQm; Fri, 13 Oct 2023 06:55:25 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=jIePl0Dk; dkim-atps=neutral Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=sparclinux-owner@vger.kernel.org; receiver=ozlabs.org) Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4S60jn3LWdz4xQg for ; Fri, 13 Oct 2023 06:55:25 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442527AbjJLTzZ (ORCPT ); Thu, 12 Oct 2023 15:55:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442316AbjJLTzY (ORCPT ); Thu, 12 Oct 2023 15:55:24 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 633D5B7 for ; Thu, 12 Oct 2023 12:55:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:Message-ID: Subject:To:From:Date:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:In-Reply-To:References; bh=RiC4LbDPsvm1R/hBxKAIvjDYl7LcGAsJmWP/V7VNH+o=; b=jIePl0DkLsVwMFydPLTuL2K4Kx wFd5BIbew8STEqAyXac6ItdamjwFZtQMzYE5fCMa4KeyrxGdQ0rre1qELgcyrPPY2r8ScIUVjfadi EORyS2LricGRBMF7HrpH00P94zh3FPFP5N9nmeoltMVdiiljA7wJOjduaZKgEYfKmpHuLGgVi2zws MmcCbTiXxmLdRqD4ihmgaJorGVC4cUNzZjbXKdx2qbKwtieFdtTW6hOyZUhZhs1gLU4LeHUKZkyEe G6Ssbjxq7Knh4O0qJKVEsUizq0jg968qX8mmLA4Iz90GtJ9TtTV5BqRMl7SL9at1f+iwNWpaXlsix CevzuGJw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qr1mD-001Bif-Qo for sparclinux@vger.kernel.org; Thu, 12 Oct 2023 19:55:21 +0000 Date: Thu, 12 Oct 2023 20:55:21 +0100 From: Matthew Wilcox To: sparclinux@vger.kernel.org Subject: [willy@infradead.org: [PATCH 2/2] sparc: Allow nesting of lazy MMU mode] Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE 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: sparclinux@vger.kernel.org Oops, wrong email address. ----- Forwarded message from "Matthew Wilcox (Oracle)" ----- Date: Thu, 12 Oct 2023 20:54:15 +0100 From: "Matthew Wilcox (Oracle)" To: linux-kernel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-sparc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Michael Ellerman , Erhard Furtner , David Woodhouse , Juergen Gross Subject: [PATCH 2/2] sparc: Allow nesting of lazy MMU mode X-Mailer: git-send-email 2.37.1 As noted in commit 49147beb0ccb ("x86/xen: allow nesting of same lazy mode"), we can now nest calls to arch_enter_lazy_mmu_mode(). Use ->active as a counter instead of a flag and only drain the batch when the counter hits 0. Signed-off-by: Matthew Wilcox (Oracle) Fixes: bcc6cc832573 ("mm: add default definition of set_ptes()") --- arch/sparc/mm/tlb.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c index b44d79d778c7..a82c7c32e47d 100644 --- a/arch/sparc/mm/tlb.c +++ b/arch/sparc/mm/tlb.c @@ -54,16 +54,15 @@ void arch_enter_lazy_mmu_mode(void) { struct tlb_batch *tb = this_cpu_ptr(&tlb_batch); - tb->active = 1; + tb->active++; } void arch_leave_lazy_mmu_mode(void) { struct tlb_batch *tb = this_cpu_ptr(&tlb_batch); - if (tb->tlb_nr) + if ((--tb->active == 0) && tb->tlb_nr) flush_tlb_pending(); - tb->active = 0; } static void tlb_batch_add_one(struct mm_struct *mm, unsigned long vaddr,