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=-3.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 682DCC432BE for ; Tue, 24 Aug 2021 00:36:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 07E67613A7 for ; Tue, 24 Aug 2021 00:36:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 07E67613A7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 463D68D0001; Mon, 23 Aug 2021 20:36:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 413116B0071; Mon, 23 Aug 2021 20:36:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 302868D0001; Mon, 23 Aug 2021 20:36:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0155.hostedemail.com [216.40.44.155]) by kanga.kvack.org (Postfix) with ESMTP id 134596B006C for ; Mon, 23 Aug 2021 20:36:26 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 8D37A8249980 for ; Tue, 24 Aug 2021 00:36:25 +0000 (UTC) X-FDA: 78508107930.13.F667BCB Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by imf03.hostedemail.com (Postfix) with ESMTP id C790530000A6 for ; Tue, 24 Aug 2021 00:36:24 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10085"; a="239349066" X-IronPort-AV: E=Sophos;i="5.84,346,1620716400"; d="scan'208";a="239349066" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2021 17:36:23 -0700 X-IronPort-AV: E=Sophos;i="5.84,346,1620716400"; d="scan'208";a="493206675" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.239.159.119]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2021 17:36:20 -0700 From: "Huang, Ying" To: Nadav Amit Cc: Linux-MM , Linux Kernel Mailing List , Mel Gorman , Andrea Arcangeli , Andrew Morton , Andy Lutomirski , Dave Hansen , Peter Zijlstra , "Thomas Gleixner" , Will Deacon , Yu Zhao , "x86@kernel.org" Subject: Re: [RFC 20/20] mm/rmap: avoid potential races References: <20210131001132.3368247-1-namit@vmware.com> <20210131001132.3368247-21-namit@vmware.com> <87zgt8y4aj.fsf@yhuang6-desk2.ccr.corp.intel.com> <3F1EF02A-6FD4-42BE-BD07-1C5AC97A515B@vmware.com> Date: Tue, 24 Aug 2021 08:36:18 +0800 In-Reply-To: <3F1EF02A-6FD4-42BE-BD07-1C5AC97A515B@vmware.com> (Nadav Amit's message of "Mon, 23 Aug 2021 15:50:22 +0000") Message-ID: <87v93vy8zh.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Authentication-Results: imf03.hostedemail.com; dkim=none; spf=none (imf03.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 192.55.52.88) smtp.mailfrom=ying.huang@intel.com; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=intel.com (policy=none) X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: C790530000A6 X-Stat-Signature: 9ccx47u4arox4fcgit63wt9kcj94cy3a X-HE-Tag: 1629765384-704963 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: Nadav Amit writes: >> On Aug 23, 2021, at 1:05 AM, Huang, Ying wrote: >>=20 >> Hi, Nadav, >>=20 >> Nadav Amit writes: >>=20 >>> From: Nadav Amit >>>=20 >>> flush_tlb_batched_pending() appears to have a theoretical race: >>> tlb_flush_batched is being cleared after the TLB flush, and if in >>> between another core calls set_tlb_ubc_flush_pending() and sets the >>> pending TLB flush indication, this indication might be lost. Holding the >>> page-table lock when SPLIT_LOCK is set cannot eliminate this race. >>=20 >> Recently, when I read the corresponding code, I find the exact same race >> too. Do you still think the race is possible at least in theory? If >> so, why hasn't your fix been merged? > > I think the race is possible. It didn=E2=80=99t get merged, IIRC, due to = some > addressable criticism and lack of enthusiasm from other people, and > my laziness/busy-ness. Got it! Thanks your information! >>> The current batched TLB invalidation scheme therefore does not seem >>> viable or easily repairable. >>=20 >> I have some idea to fix this without too much code. If necessary, I >> will send it out. > > Arguably, it would be preferable to have a small back-portable fix for > this issue specifically. Just try to ensure that you do not introduce > performance overheads. Any solution should be clear about its impact > on additional TLB flushes on the worst-case scenario and the number > of additional atomic operations that would be required. Sure. Will do that. Best Regards, Huang, Ying