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 X-Spam-Level: X-Spam-Status: No, score=-7.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7872C48BE6 for ; Thu, 17 Jun 2021 00:32:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 67522613CD for ; Thu, 17 Jun 2021 00:32:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 67522613CD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BA3FA6B0070; Wed, 16 Jun 2021 20:32:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B7B3A6B0071; Wed, 16 Jun 2021 20:32:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A1AFD6B0072; Wed, 16 Jun 2021 20:32:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0161.hostedemail.com [216.40.44.161]) by kanga.kvack.org (Postfix) with ESMTP id 6E45C6B0070 for ; Wed, 16 Jun 2021 20:32:15 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 001BB181AEF07 for ; Thu, 17 Jun 2021 00:32:14 +0000 (UTC) X-FDA: 78261339030.14.4991B11 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by imf15.hostedemail.com (Postfix) with ESMTP id E7D4BA0001A9 for ; Thu, 17 Jun 2021 00:32:09 +0000 (UTC) Received: by mail-pl1-f179.google.com with SMTP id x19so2021775pln.2 for ; Wed, 16 Jun 2021 17:32:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=HlMAqLQxn6v+mWiiXUxQu/TdTnXdtQ7st+0tT7u1DFY=; b=HVWMTemgMHeY2VUSfacljFjPg0M/GfrzQ13PNudHzyQrFDqeFmIy0VAmJxC7l8I/g0 DeNyxGemOr+cDh12p/+Dh4jUz7l2idGLs8ZDWPkbrikWSusJvIXHnqKcfbEaghaJJys+ IeJKhqR4/wRm5zCPrHxuKBffIwHtxftuOHRObLBpC+t7iGj1N24SRKkl0Z2R8z5abEe4 WLtd2ZjY3PSM3i/5h/D7tnLwC+sw6HYRw3/bHOcx20fahWLsXDxxaciUV7/OA88KOFox IMAdtoi74gW3r1QdDtjVOhb9r+BKDjhVtyXBO6M3zUpVhULVKIVTkLvFoLijMl2/iTNY 2kcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=HlMAqLQxn6v+mWiiXUxQu/TdTnXdtQ7st+0tT7u1DFY=; b=CQsgDVWn8p+6/ZppyLnqicWbkEZuiQCHyX8Kk1PF7QA0WXDGEdvljYDKNCVktItG56 g2gg9omEh5bJnHawJSEWo8kPK4kvaSW5F4RGprQO54bvjP7ROzWgRG5arJsie7dol5uQ 8ZFYSg37BHqF7R5NgEdeVCmbiV5LNpRjsUAWiQT+/oiAYSioVcPkqjeeeKzdLXbcm54b xNaMMHp0oal017MJAU9Fw/OBkFciwgKiO3P69jV5zHOOSaod4Uzms3u3nBaSW+ibsnFW BbL77rtOEdvSn3jCAyiaPYHORJZrpZ+c7ZJXAxfluqvvjsHDRd4z1l6rn5o44uCwMhRm KWyw== X-Gm-Message-State: AOAM530pdh5z0FtIX0CAn8OuIiWM53T1JGg6XZiNgygwjCxFJj+yQZr9 ZMJnsvNvK4rwZXLh6UDPjJs= X-Google-Smtp-Source: ABdhPJw1j+Sf3Rs1tAp4YIYmoABCfc/HdBFsODjUCrmIAPsu6DNBYVbsuoUQtu23Ubyav+KRXU0yLg== X-Received: by 2002:a17:90a:c08f:: with SMTP id o15mr13401437pjs.166.1623889933645; Wed, 16 Jun 2021 17:32:13 -0700 (PDT) Received: from localhost (60-242-147-73.tpgi.com.au. [60.242.147.73]) by smtp.gmail.com with ESMTPSA id s21sm3362607pgo.42.2021.06.16.17.32.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jun 2021 17:32:13 -0700 (PDT) Date: Thu, 17 Jun 2021 10:32:07 +1000 From: Nicholas Piggin Subject: Re: [PATCH v4 2/4] lazy tlb: allow lazy tlb mm refcounting to be configurable To: Andrew Morton , Andy Lutomirski Cc: Anton Blanchard , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, Randy Dunlap , Rik van Riel , Linus Torvalds References: <20210605014216.446867-1-npiggin@gmail.com> <20210605014216.446867-3-npiggin@gmail.com> <8ac1d420-b861-f586-bacf-8c3949e9b5c4@kernel.org> <1623629185.fxzl5xdab6.astroid@bobo.none> <02e16a2f-2f58-b4f2-d335-065e007bcea2@kernel.org> <1623643443.b9twp3txmw.astroid@bobo.none> <1623645385.u2cqbcn3co.astroid@bobo.none> <1623647326.0np4yc0lo0.astroid@bobo.none> <1623715482.4lskm3cx10.astroid@bobo.none> <3b9eb877-5d1e-d565-5577-575229d18b6e@kernel.org> <1623803360.zd3fo9zm1z.astroid@bobo.none> In-Reply-To: <1623803360.zd3fo9zm1z.astroid@bobo.none> MIME-Version: 1.0 Message-Id: <1623887812.eoi29y243g.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: E7D4BA0001A9 Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=HVWMTemg; spf=pass (imf15.hostedemail.com: domain of npiggin@gmail.com designates 209.85.214.179 as permitted sender) smtp.mailfrom=npiggin@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Stat-Signature: z4yhpd9rjq5i6ppg1ujg4f6n5ass8z3t X-HE-Tag: 1623889929-848643 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Excerpts from Nicholas Piggin's message of June 16, 2021 11:02 am: > Excerpts from Andy Lutomirski's message of June 16, 2021 10:14 am: >> akpm, please drop this series until it's fixed. It's a core change to >> better support arch usecases, but it's unnecessarily fragile, and there >> is already an arch maintainer pointing out that it's inadequate to >> robustly support arch usecases. There is no reason to merge it in its >> present state. Just to make sure I'm not doing anything stupid or fragile for other=20 archs, I had a closer look at a few. sparc32 is the only one I have a=20 SMP capable qemu and initramfs at hand for, took about 5 minutes to=20 convert after fixing 2 other sparc32/mm bugs (patches on linux-sparc), one of them found by the DEBUG_VM code my series added. It seems to work=20 fine, with what little stressing my qemu setup can muster. Simple. Robust. Pretty mechanical conversion follows the documented=20 reciple. Re-uses every single line of code I added outside=20 arch/powerpc/. Requires no elaborate dances. alpha and arm64 are both 4-liners by the looks, sparc64 might reqiure a=20 bit of actual code but doesn't look too hard. So I'm satisfied the code added outside arch/powerpc/ is not some=20 fragile powerpc specific hack. I don't know if other archs will use=20 it, but they easily can use it[*]. And we can make changes to help x86 whenever its needed -- I already=20 posted patch 1/n for configuring out lazy tlb and active_mm from core=20 code rebased on top of mmotm so the series is not preventing such=20 changes. Hopefully this allays some concerns. [*] I do think mmgrab_lazy_tlb is a nice change that self-documents the=20 active_mm refcounting, so I will try to get all the arch code=20 converted to use it over the next few releases, even if they never switch to use lazy tlb shootdown. Thanks, Nick --- arch/sparc/Kconfig | 1 + arch/sparc/kernel/leon_smp.c | 2 +- arch/sparc/kernel/smp_64.c | 2 +- arch/sparc/kernel/sun4d_smp.c | 2 +- arch/sparc/kernel/sun4m_smp.c | 2 +- arch/sparc/kernel/traps_32.c | 2 +- arch/sparc/kernel/traps_64.c | 2 +- 7 files changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 164a5254c91c..db9954af57a2 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -58,6 +58,7 @@ config SPARC32 select GENERIC_ATOMIC64 select CLZ_TAB select HAVE_UID16 + select MMU_LAZY_TLB_SHOOTDOWN select OLD_SIGACTION =20 config SPARC64 diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c index 1eed26d423fb..d00460788048 100644 --- a/arch/sparc/kernel/leon_smp.c +++ b/arch/sparc/kernel/leon_smp.c @@ -92,7 +92,7 @@ void leon_cpu_pre_online(void *arg) : "memory" /* paranoid */); =20 /* Attach to the address space of init_task. */ - mmgrab(&init_mm); + mmgrab_lazy_tlb(&init_mm); current->active_mm =3D &init_mm; =20 while (!cpumask_test_cpu(cpuid, &smp_commenced_mask)) diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c index e38d8bf454e8..19aa12991f2b 100644 --- a/arch/sparc/kernel/smp_64.c +++ b/arch/sparc/kernel/smp_64.c @@ -127,7 +127,7 @@ void smp_callin(void) current_thread_info()->new_child =3D 0; =20 /* Attach to the address space of init_task. */ - mmgrab(&init_mm); + mmgrab_lazy_tlb(&init_mm); current->active_mm =3D &init_mm; =20 /* inform the notifiers about the new cpu */ diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c index ff30f03beb7c..a6f392dcfeaf 100644 --- a/arch/sparc/kernel/sun4d_smp.c +++ b/arch/sparc/kernel/sun4d_smp.c @@ -94,7 +94,7 @@ void sun4d_cpu_pre_online(void *arg) show_leds(cpuid); =20 /* Attach to the address space of init_task. */ - mmgrab(&init_mm); + mmgrab_lazy_tlb(&init_mm); current->active_mm =3D &init_mm; =20 local_ops->cache_all(); diff --git a/arch/sparc/kernel/sun4m_smp.c b/arch/sparc/kernel/sun4m_smp.c index 228a6527082d..0ee77f066c9e 100644 --- a/arch/sparc/kernel/sun4m_smp.c +++ b/arch/sparc/kernel/sun4m_smp.c @@ -60,7 +60,7 @@ void sun4m_cpu_pre_online(void *arg) : "memory" /* paranoid */); =20 /* Attach to the address space of init_task. */ - mmgrab(&init_mm); + mmgrab_lazy_tlb(&init_mm); current->active_mm =3D &init_mm; =20 while (!cpumask_test_cpu(cpuid, &smp_commenced_mask)) diff --git a/arch/sparc/kernel/traps_32.c b/arch/sparc/kernel/traps_32.c index 247a0d9683b2..a3186bb30109 100644 --- a/arch/sparc/kernel/traps_32.c +++ b/arch/sparc/kernel/traps_32.c @@ -387,7 +387,7 @@ void trap_init(void) thread_info_offsets_are_bolixed_pete(); =20 /* Attach to the address space of init_task. */ - mmgrab(&init_mm); + mmgrab_lazy_tlb(&init_mm); current->active_mm =3D &init_mm; =20 /* NOTE: Other cpus have this done as they are started diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c index a850dccd78ea..b6e46732fa69 100644 --- a/arch/sparc/kernel/traps_64.c +++ b/arch/sparc/kernel/traps_64.c @@ -2929,6 +2929,6 @@ void __init trap_init(void) /* Attach to the address space of init_task. On SMP we * do this in smp.c:smp_callin for other cpus. */ - mmgrab(&init_mm); + mmgrab_lazy_tlb(&init_mm); current->active_mm =3D &init_mm; } --=20 2.23.0