From patchwork Mon Sep 14 04:52:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 11772819 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E392359D for ; Mon, 14 Sep 2020 04:52:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7F12521655 for ; Mon, 14 Sep 2020 04:52:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ejUmrq8I" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7F12521655 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 6E4FE6B0003; Mon, 14 Sep 2020 00:52:38 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 695F06B0037; Mon, 14 Sep 2020 00:52:38 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 583EB6B0055; Mon, 14 Sep 2020 00:52:38 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0152.hostedemail.com [216.40.44.152]) by kanga.kvack.org (Postfix) with ESMTP id 4226F6B0003 for ; Mon, 14 Sep 2020 00:52:38 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id EEF28180C2E4E for ; Mon, 14 Sep 2020 04:52:37 +0000 (UTC) X-FDA: 77260446354.24.test79_070fcda27105 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin24.hostedemail.com (Postfix) with ESMTP id BC1F3231A6 for ; Mon, 14 Sep 2020 04:52:37 +0000 (UTC) X-Spam-Summary: 1,0,0,cb2f31c29bf6e0b2,d41d8cd98f00b204,npiggin@gmail.com,,RULES_HIT:41:69:355:379:541:968:973:988:989:1260:1311:1314:1345:1437:1515:1534:1541:1711:1730:1747:1777:1792:1801:2393:2559:2562:2693:2911:3138:3139:3140:3141:3142:3165:3353:3865:3866:3867:3868:3871:3872:3873:3874:4250:4362:4425:4605:5007:6119:6120:6261:6653:7875:7901:7903:8660:9413:10004:11026:11232:11473:11658:11914:12043:12296:12297:12438:12517:12519:12679:12895:13069:13148:13161:13229:13230:13311:13357:13894:14096:14384:14394:14581:14687:14721:21080:21433:21444:21451:21627:21666:21939:21966:30012:30054:30056,0,RBL:209.85.215.196:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.50.0.100;04yfwfbcxghspxe1wmbnneo53cthfocb3ounckebxnikmmzbotf54cf5tmwiqzr.fwuge9q37wq1xteobr3bri5cezur5kkaiyzw7te9bibi5thxxrphrxo44jw5be6.g-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: test79_070fcda27105 X-Filterd-Recvd-Size: 4784 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Mon, 14 Sep 2020 04:52:37 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id d13so2311087pgl.6 for ; Sun, 13 Sep 2020 21:52:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8Q2Ibfk+nQZOW1cqQJ9txIYMhLv+gj4Sy6xqSd9DmWA=; b=ejUmrq8Iadf/nWh/k76D9SUjpOWREHXHs/sYszqAIcXvWn01J7LU9SavyNRh5tf3We lVdoabqUUuvksTLGvX+nfyOWpdUmbRFmMexlOsIelNCjlPaujuQQhoklVQMjIPZ2LN4U lmOAFYsu0p+t6RtwKv1lQhr5H2D9f3RXh/oZkyYldfDPLBwQ3N9LYwG76Y0w6emjqbaR THE69ZZ8qCk8byO69uE5yMU8a9cFyS6mbn5LAa5BGhVTRy0r/GDvtIr0lxOhOul8+7dI LwlWZgqot0gPmX0nHiFVt7KvA+rW4IJBUkcEAGNxRIrWg734wU3s8k22KSwfcP6FP16q 5PUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8Q2Ibfk+nQZOW1cqQJ9txIYMhLv+gj4Sy6xqSd9DmWA=; b=JwikDVdQrz+vgYDPT58ASFmUVikXnclb0Hieo8PPBkndccToOjPD+k7knPZGke05kN +OXE3PBSEIQXV5PgZu2IZoKDGV+tCsF2KbL3JAafZOSjQHOqXE/leYHXkEL6nYZ44/Di 2LM3ewgQd4k/plf080fIOTXMxFriKxdgxzny2Gb4mQPMwiZIFrTlXtj14pwZYPPXDauA lWkI+8CX6OUSqRqkyNQnuVofZmDl76eNlKV/sAdWq7rVz477RWtPOBCOO8b2g2HEp0Jc y8GL4H+TiKN58N4sPVjR73BU6hY3xd7E1yIWDNyzppMg1wZ00Z3LCv+eUX/l5Taz5LeY 9IXQ== X-Gm-Message-State: AOAM530jePE7SfFyqGvg8BCh8h04zCG+sDYPknFWUPznt+no0LSs9QjB zAyRV/HiuxlJeDYBg9j+Oehmj6/HRaY= X-Google-Smtp-Source: ABdhPJzFrz8mmf96fURpM3KuwwEgUYQJyVtYlAsIcvS5cLVagsaDZEbOGwmLwgd4u8HXatYEzUDalg== X-Received: by 2002:a63:524a:: with SMTP id s10mr3316432pgl.40.1600059156171; Sun, 13 Sep 2020 21:52:36 -0700 (PDT) Received: from bobo.ozlabs.ibm.com ([203.185.249.227]) by smtp.gmail.com with ESMTPSA id a13sm6945312pgq.41.2020.09.13.21.52.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Sep 2020 21:52:35 -0700 (PDT) From: Nicholas Piggin To: "linux-mm @ kvack . org" Cc: Nicholas Piggin , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org, "Aneesh Kumar K . V" , Andrew Morton , Jens Axboe , Peter Zijlstra , "David S . Miller" Subject: [PATCH v2 0/4] more mm switching vs TLB shootdown and lazy tlb fixes Date: Mon, 14 Sep 2020 14:52:15 +1000 Message-Id: <20200914045219.3736466-1-npiggin@gmail.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-Rspamd-Queue-Id: BC1F3231A6 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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: This is an attempt to fix a few different related issues around switching mm, TLB flushing, and lazy tlb mm handling. This will require all architectures to eventually move to disabling irqs over activate_mm, but it's possible we could add another arch call after irqs are re-enabled for those few which can't do their entire activation with irqs disabled. Testing so far indicates this has fixed a mm refcounting bug that powerpc was running into (via distro report and backport). I haven't had any real feedback on this series outside powerpc (and it doesn't really affect other archs), so I propose patches 1,2,4 go via the powerpc tree. There is no dependency between them and patch 3, I put it there only because it follows the history of the code (powerpc code was written using the sparc64 logic), but I guess they have to go via different arch trees. Dave, I'll leave patch 3 with you. Thanks, Nick Since v1: - Updates from Michael Ellerman's review comments. Nicholas Piggin (4): mm: fix exec activate_mm vs TLB shootdown and lazy tlb switching race powerpc: select ARCH_WANT_IRQS_OFF_ACTIVATE_MM sparc64: remove mm_cpumask clearing to fix kthread_use_mm race powerpc/64s/radix: Fix mm_cpumask trimming race vs kthread_use_mm arch/Kconfig | 7 +++ arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/mmu_context.h | 2 +- arch/powerpc/include/asm/tlb.h | 13 ------ arch/powerpc/mm/book3s64/radix_tlb.c | 23 ++++++--- arch/sparc/kernel/smp_64.c | 65 ++++++-------------------- fs/exec.c | 17 ++++++- 7 files changed, 54 insertions(+), 74 deletions(-)