Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2010745rwb; Thu, 29 Sep 2022 05:15:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5uoB/tf1ml2Fxdjsce3figKP0hFLrfajGQVPk5/Yuxa1NKGqMOK6Hpkl8o+bv/cGc/aypb X-Received: by 2002:a17:906:1e08:b0:73d:c724:4876 with SMTP id g8-20020a1709061e0800b0073dc7244876mr2492569ejj.62.1664453724143; Thu, 29 Sep 2022 05:15:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664453724; cv=none; d=google.com; s=arc-20160816; b=X7bsJWn8zkHUOfvpcj5AtPKdqrE9y9G6lD+DBI3uNZhJiUVW36tq15RrRbf2+9mkBZ Y2UEtSs2RTSUIH+z8sRfz+bXajD/thUU0QoemjXChb42Nl92KaD6982mlq6jJaZrgoIr hlCc4dU2VODs8IMRJ9UYFN2lfbZZW8FU/TQ/ZtSEKC756RNR8y7G6QeXEjD7XVOmq/p1 yFoZwWnggzwhM5rAA1lEJ0IxUM8CrWAJ7S9hUk+Bsch5i5cLHlYFbFZubadxWQGqZ55e yBoi2Wt6H8jRLEJRoGN7YLURuSzsYz3nsbSvqHWDxKQX9QzhxyJ2fBC1cAuEyzjqfdBd C/IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=F+ZA4YsZskSHzxqaf3CkatgmWagHR2RePd/JsUtyf0I=; b=TUOPFssXqHB8IWCBDEMV8473Du1ALYot8HrdnqkSeev6WIuMs47wk5w0zlq/mmHT/X 3+tCqQPH4dBo7nS2b3aEUf8sR0Mi05JVFh7/Er/VL8dALfoT7rM3gCQySE0Wj3kxleA2 HM/0CDFHW27i9H+Y7P4sutOaMo6PbaIaMbdxWWXl8I98iUoie75LJ/Tjhsgxc6t3xcPk euWP3KYC4FhCq9YeRRlKGFM35Y3Wyn1LPg6V7iOUjYZxPSeamVPGfwXDPWnO9QJD91UG pV/qv3RUbO3ljjtPesY7CIdvTCPA4RWHY5aNiUfPdrilqDHrQBlv99aTgSY4WU6aji65 XQ8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WH9SOjOm; 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 de8-20020a1709069bc800b007781bc042a2si6227181ejc.646.2022.09.29.05.14.57; Thu, 29 Sep 2022 05:15:24 -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=WH9SOjOm; 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 S235345AbiI2Lmv (ORCPT + 99 others); Thu, 29 Sep 2022 07:42:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233190AbiI2Lmu (ORCPT ); Thu, 29 Sep 2022 07:42:50 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD71414FE0B for ; Thu, 29 Sep 2022 04:42:48 -0700 (PDT) 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 sin.source.kernel.org (Postfix) with ESMTPS id 081CACE2185 for ; Thu, 29 Sep 2022 11:42:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08A19C433C1 for ; Thu, 29 Sep 2022 11:42:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664451765; bh=R8C++G9yVjwgvqMjhqRqKMSuZQfilkNzr6uk/kuxuGo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=WH9SOjOmqxgO/Nwf83BfzJWn5pkQQfwFvgx65m+fn9DJDuAcKYQlmTm+C9b/mTtGa 8IbSW0gag5BPck7AsAk066x0N0zBmt6LtVh/ZEFVkkdG80vv3nT0JptzWmr0oa9gTB VD9glJMAcl3uz8Wo66wCjItA04eH3/3MnbP4aWfH1RFKpY9zhQBxkNntPOrbdeY/0H HE6+Wum5r/yAcTKiP8w4aBYb/bZ7Rh49CHnAFbHhPIaA9eWe5dQ71MftDCv9dkAzJm lXkR8CCI+TdXH/Mpmx0fYFjwq/luE+jfNxP6mqkfMmfU/V6gIkGo9n1xFJAnJ79xLt ii18tkDND6oVQ== Received: by mail-vs1-f50.google.com with SMTP id j123so1203827vsc.3 for ; Thu, 29 Sep 2022 04:42:44 -0700 (PDT) X-Gm-Message-State: ACrzQf3B3nYgBJ6Q/ntO7lsBAIsRBtrOeSzddbRZDUMvCCzowadT3s9+ y3qFgY78xOZNDWBOhaSUhNTfUt30hmDmkyPGVn4= X-Received: by 2002:a05:6102:1481:b0:39a:67f5:3096 with SMTP id d1-20020a056102148100b0039a67f53096mr989910vsv.70.1664451763903; Thu, 29 Sep 2022 04:42:43 -0700 (PDT) MIME-Version: 1.0 References: <20220929112318.32393-1-zhengqi.arch@bytedance.com> <20220929112318.32393-3-zhengqi.arch@bytedance.com> In-Reply-To: <20220929112318.32393-3-zhengqi.arch@bytedance.com> From: Huacai Chen Date: Thu, 29 Sep 2022 19:42:32 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 2/2] LoongArch: update local TLB if PTE entry exists To: Qi Zheng Cc: akpm@linux-foundation.org, maobibo@loongson.cn, chenhuacai@loongson.cn, songmuchun@bytedance.com, david@redhat.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, loongarch@lists.linux.dev, chris@zankel.net, jcmvbkbc@gmail.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Hi, all, Should this patch go via mm tree or loongarch tree? If via mm tree, then Acked-by: Huacai Chen On Thu, Sep 29, 2022 at 7:23 PM Qi Zheng wrote: > > Currently, the implementation of update_mmu_tlb() is empty if > __HAVE_ARCH_UPDATE_MMU_TLB is not defined. Then if two threads > concurrently fault at the same page, the second thread that did > not win the race will give up and do nothing. In the LoongArch > architecture, this second thread will trigger another fault, > and only updates its local TLB. > > Instead of triggering another fault, it's better to implement > update_mmu_tlb() to directly update the local TLB of the second > thread. Just do it. > > Suggested-by: Bibo Mao > Signed-off-by: Qi Zheng > --- > arch/loongarch/include/asm/pgtable.h | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/loongarch/include/asm/pgtable.h b/arch/loongarch/include/asm/pgtable.h > index 8ea57e2f0e04..946704bee599 100644 > --- a/arch/loongarch/include/asm/pgtable.h > +++ b/arch/loongarch/include/asm/pgtable.h > @@ -412,6 +412,9 @@ static inline void update_mmu_cache(struct vm_area_struct *vma, > __update_tlb(vma, address, ptep); > } > > +#define __HAVE_ARCH_UPDATE_MMU_TLB > +#define update_mmu_tlb update_mmu_cache > + > static inline void update_mmu_cache_pmd(struct vm_area_struct *vma, > unsigned long address, pmd_t *pmdp) > { > -- > 2.20.1 > >