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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 188EFECAAA1 for ; Mon, 31 Oct 2022 18:43:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9BEB16B0073; Mon, 31 Oct 2022 14:43:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 96D6E80007; Mon, 31 Oct 2022 14:43:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8345F6B0075; Mon, 31 Oct 2022 14:43:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 765716B0073 for ; Mon, 31 Oct 2022 14:43:50 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 3910DC0628 for ; Mon, 31 Oct 2022 18:43:50 +0000 (UTC) X-FDA: 80082118620.29.AFDAE86 Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) by imf27.hostedemail.com (Postfix) with ESMTP id C9ED84000B for ; Mon, 31 Oct 2022 18:43:49 +0000 (UTC) Received: by mail-qv1-f54.google.com with SMTP id x15so8908582qvp.1 for ; Mon, 31 Oct 2022 11:43:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=8MDdMqA+PAi+rQcUxT63VD0K16N9GGR3HYYtFDBfMVw=; b=V0yzX02di+ioCTECBa6GTI2Q+vwFsP75Wt6XTY6EnmXPW1DMzdm0BCHuKjAhCWzlfM WwSfx5JDtb8a0MFQPuzlsARO9UpOj3xl5wOOdGbv4bC49+cuF78Jkn12MMDF5g8WnwX5 xk0LYCe3V9j5PLRsdB0b4mdqqENjXZVS1hLAM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8MDdMqA+PAi+rQcUxT63VD0K16N9GGR3HYYtFDBfMVw=; b=8BNQpM4H0FKTfe2VPEnIK8nTTzL0aPxIyy1Ez0CuvnYCDGUVm0VcqJNiEeVOEVCqRm g1KCg53w4ATS+rK9ZkTOmqq4hYEbCQ2/orKO03bwFI6cKRfugNamtX9UlTL4zAoMWtd1 AjaiexN0fofdXYcSwYoi+wG9dE8VcgvQ2dxrkT+7YRRXpvJuwwjzDzBpM4tvbygcPnE7 zlO155LcSx5gtawnzejvzVhKQOLXY64zmBXcAHM3WrKJKfIWAM7NfJ5yokP6EVI87ZRV RJwYeHZST2cdDRhCAPRMCyQONyO/iycXwY2JTbOCAnn5pWXw73g1JBz20MHYrB91mmbb H5gw== X-Gm-Message-State: ACrzQf3w4gQXcBBcdmW75ilDs4xGgu+9rUrWlJLARGx7xZMB3Bvru0/H C+2loVtCDO4H8t1krAQJSIOEAke+R/19mg== X-Google-Smtp-Source: AMsMyM61KeFYgd4AYCVMnDtX0QB6mDmv57SUEDPfB7nDT9Uph7tuaWWzBagA+ueE942432MFPi+ISg== X-Received: by 2002:ad4:5fcd:0:b0:4bb:f8f2:1ebf with SMTP id jq13-20020ad45fcd000000b004bbf8f21ebfmr4922748qvb.66.1667241828743; Mon, 31 Oct 2022 11:43:48 -0700 (PDT) Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com. [209.85.128.180]) by smtp.gmail.com with ESMTPSA id dm45-20020a05620a1d6d00b006e8f8ca8287sm5203880qkb.120.2022.10.31.11.43.47 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 Oct 2022 11:43:47 -0700 (PDT) Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-36cbcda2157so116010167b3.11 for ; Mon, 31 Oct 2022 11:43:47 -0700 (PDT) X-Received: by 2002:a81:555:0:b0:36b:2d71:5861 with SMTP id 82-20020a810555000000b0036b2d715861mr14445929ywf.340.1667241827170; Mon, 31 Oct 2022 11:43:47 -0700 (PDT) MIME-Version: 1.0 References: <47678198-C502-47E1-B7C8-8A12352CDA95@gmail.com> <140B437E-B994-45B7-8DAC-E9B66885BEEF@gmail.com> In-Reply-To: From: Linus Torvalds Date: Mon, 31 Oct 2022 11:43:30 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: mm: delay rmap removal until after TLB flush To: Peter Zijlstra , Will Deacon , Aneesh Kumar , Nick Piggin , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle Cc: Nadav Amit , Jann Horn , John Hubbard , X86 ML , Matthew Wilcox , Andrew Morton , kernel list , Linux-MM , Andrea Arcangeli , "Kirill A . Shutemov" , Joerg Roedel , Uros Bizjak , Alistair Popple , linux-arch Content-Type: text/plain; charset="UTF-8" ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=V0yzX02d; spf=pass (imf27.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.219.54 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667241829; a=rsa-sha256; cv=none; b=NM4tPiNQ7tyv3aFJRrSAB9WAU/P/zziKHfcfCQmi66YdIPOpPrjCNzaSZ8ISfIip7MWWWw cDo2INnLofymSPCDSO+IkfyfNM62bxUAu3jZ1kgl4oOIXwJtrVLggfvGmSrumHWGkExj23 ZkaIfbhScKaT4IeJfLnaUJLh66a+3TA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667241829; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=8MDdMqA+PAi+rQcUxT63VD0K16N9GGR3HYYtFDBfMVw=; b=HpDEuqK06AlYeMbh7Pr9XL0i5uQr/RbLqdPD4E3qAabA+kpV/gyKyRHewXmlcSU/2baW2I IHcT0U2+cSBP4V8b3ap/7QmVC63NJyiHEGzpVFL8+wp0ZJi6gSsyoo38MTK58cJ8wrgsW1 ne2XLqAR9w+/f6NzGfGgBOImMXkopr0= X-Rspam-User: X-Rspamd-Queue-Id: C9ED84000B Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=V0yzX02d; spf=pass (imf27.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.219.54 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none X-Stat-Signature: j8ncq51hj1gugwk7tm4y8oaz3z4xi3cr X-Rspamd-Server: rspam10 X-HE-Tag: 1667241829-529048 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: Updated subject line, and here's the link to the original discussion for new people: https://lore.kernel.org/all/B88D3073-440A-41C7-95F4-895D3F657EF2@gmail.com/ On Mon, Oct 31, 2022 at 10:28 AM Linus Torvalds wrote: > > Ok. At that point we no longer have the pte or the virtual address, so > it's not going to be exactly the same debug output. > > But I think it ends up being fairly natural to do > > VM_WARN_ON_ONCE_PAGE(page_mapcount(page) < 0, page); > > instead, and I've fixed that last patch up to do that. Ok, so I've got a fixed set of patches based on the feedback from PeterZ, and also tried to do the s390 updates for this blindly, and pushed them out into a git branch: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?h=mmu_gather-race-fix If people really want to see the patches in email again, I can do that, but most of you already have, and the changes are either trivial fixes or the s390 updates. For the s390 people that I've now added to the participant list maybe the git tree is fine - and the fundamental explanation of the problem is in that top-most commit (with the three preceding commits being prep-work). Or that link to the thread about this all. That top-most commit is also where I tried to fix things up for s390 that uses its own non-gathering TLB flush due to CONFIG_MMU_GATHER_NO_GATHER. NOTE NOTE NOTE! Unlike my regular git branch, this one may end up rebased etc for further comments and fixes. So don't consider that stable, it's still more of an RFC branch. At a minimum I'll update it with Ack's etc, assuming I get those, and my s390 changes are entirely untested and probably won't work. As far as I can tell, s390 doesn't actually *have* the problem that causes this change, because of its synchronous TLB flush, but it obviously needs to deal with the change of rmap zapping logic. Also added a few people who are explicitly listed as being mmu_gather maintainers. Maybe people saw the discussion on the linux-mm list, but let's make it explicit. Do people have any objections to this approach, or other suggestions? I do *not* consider this critical, so it's a "queue for 6.2" issue for me. It probably makes most sense to queue in the -MM tree (after the thing is acked and people agree), but I can keep that branch alive too and just deal with it all myself as well. Anybody? Linus