From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98449C2FB for ; Mon, 20 Jan 2025 17:56:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=96.67.55.147 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737395821; cv=none; b=tpaW4yGFr4bmAFBcJBoF6es0llzV+7G5OVAkTY0DCeLTuw+MgqAOIXhkXoisn2UDHuAr+3rzlvFm+DzkAs6J4b7OogpQip72qo67lUeOt2rPBckueXO2Th+/kRhz6gdvi8iRoWP8a1zeKGo8AE1btv3arDRhL4wyuGRVcmDIONY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737395821; c=relaxed/simple; bh=/yL7qF6MNKpD8NBZeFR0jN/fiXXTzQlXYxXMk7jYexo=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=YdBZxSk2/4Pl0yNKMUeN/N6LQrwo8ZgUbcdbnznrMyrp2+ziWMNlgK0QSIBUFYn6FaUkPSOv6LcgskugK+OsWjue1fPUVWxdqfbaW/dG/5fYM6bbY+kTDN0cn56D8QGhin0ABmxkwEC6prrSQVUrM1XqqAGLQPtvm87/U2muqf8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=surriel.com; spf=pass smtp.mailfrom=shelob.surriel.com; arc=none smtp.client-ip=96.67.55.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=surriel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=shelob.surriel.com Received: from fangorn.home.surriel.com ([10.0.13.7]) by shelob.surriel.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.97.1) (envelope-from ) id 1tZw0z-00000000273-0TGr; Mon, 20 Jan 2025 12:56:45 -0500 Message-ID: <11fcbbbb545576a1bfa54839cf87a72faf5603ab.camel@surriel.com> Subject: Re: [PATCH v5 10/12] x86,tlb: do targeted broadcast flushing from tlbbatch code From: Rik van Riel To: Nadav Amit Cc: the arch/x86 maintainers , Linux Kernel Mailing List , Borislav Petkov , peterz@infradead.org, Dave Hansen , zhengqi.arch@bytedance.com, thomas.lendacky@amd.com, kernel-team@meta.com, "open list:MEMORY MANAGEMENT" , Andrew Morton , jannh@google.com, mhklinux@outlook.com, andrew.cooper3@citrix.com Date: Mon, 20 Jan 2025 12:56:45 -0500 In-Reply-To: <5F51AFA6-EA48-42BF-8E24-10FAAAA7BE4B@gmail.com> References: <20250116023127.1531583-1-riel@surriel.com> <20250116023127.1531583-11-riel@surriel.com> <13bc0c49-09a4-434e-bd35-1ea50be38e25@gmail.com> <4dcf2b4ecaede883e2c7f6af3db58a4f6afaf4ad.camel@surriel.com> <2975f6a4-58ef-4499-b177-4b73ead4c670@gmail.com> <2c93b3f17e658483e3ea03ca3f0a717668fd117d.camel@surriel.com> <11d9f41a-eae3-43a1-90bc-eb5c69020002@gmail.com> <5F51AFA6-EA48-42BF-8E24-10FAAAA7BE4B@gmail.com> Autocrypt: addr=riel@surriel.com; prefer-encrypt=mutual; keydata=mQENBFIt3aUBCADCK0LicyCYyMa0E1lodCDUBf6G+6C5UXKG1jEYwQu49cc/gUBTTk33A eo2hjn4JinVaPF3zfZprnKMEGGv4dHvEOCPWiNhlz5RtqH3SKJllq2dpeMS9RqbMvDA36rlJIIo47 Z/nl6IA8MDhSqyqdnTY8z7LnQHqq16jAqwo7Ll9qALXz4yG1ZdSCmo80VPetBZZPw7WMjo+1hByv/ lvdFnLfiQ52tayuuC1r9x2qZ/SYWd2M4p/f5CLmvG9UcnkbYFsKWz8bwOBWKg1PQcaYHLx06sHGdY dIDaeVvkIfMFw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xjTC1bGtZyuvyQPcXclap11Ogib6rQywGYu6/Mnkbd6hbyY3wpdyQii/cas2S44N cQj8HkGv91JLVE24/Wt0gITPCH3rLVJJDGQxprHTVDs1t1RAbsbp0XTksZPCNWDGYIBo2aHDwErhI omYQ0Xluo1WBtH/UmHgirHvclsou1Ks9jyTxiPyUKRfae7GNOFiX99+ZlB27P3t8CjtSO831Ij0Ip QrfooZ21YVlUKw0Wy6Ll8EyefyrEYSh8KTm8dQj4O7xxvdg865TLeLpho5PwDRF+/mR3qi8CdGbkE c4pYZQO8UDXUN4S+pe0aTeTqlYw8rRHWF9TnvtpcNzZw== Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.1 (3.54.1-1.fc41) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: riel@surriel.com On Mon, 2025-01-20 at 19:50 +0200, Nadav Amit wrote: > [ Thanks for your patience. ] >=20 > > On 20 Jan 2025, at 19:11, Rik van Riel wrote: > >=20 > > On Mon, 2025-01-20 at 19:09 +0200, Nadav Amit wrote: > >=20 > > This is the page reclaim code. > >=20 > > The process that has those other pages mapped might be > > running on other CPUs simultaneously with the page > > reclaim code. > >=20 > > Even if we were invalidating one of our own pages this > > way, there could be other threads in the same process, > > running while we are in the page reclaim code. >=20 >=20 >=20 > Of course, but there is nothing new here. Let me see where we lose > each other by first stating the goal, what you propose, and what I > suggest. >=20 > We are issuing invlpgb and we need to ensure tlbsync on the same core > that initiated invlpgb before arch_tlbbatch_flush() finishes. That=E2=80= =99s > all that matters for our discussion (correct me if I miss something). >=20 > You solved it by disabling migration and running tlbsync at the end. >=20 > I suggest *not* to disable migration, to keep running tlbsync at the > arch_tlbbatch_flush() as you do, and if context-switch happens after > arch_tlbbatch_add_pending() and before arch_tlbbatch_flush(), to run > tlbsync during the context switch. >=20 How would you keep track of CPUs where the tlbsync has NOT happened before arch_tlbbatch_flush()? That part seems to be missing still. --=20 All Rights Reversed.