From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 E0BC41B6CE3 for ; Thu, 2 Jan 2025 19:56:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735847794; cv=none; b=oJFnzpZj8VZYdP31nJmMgGOEq7foRsm61KcQsaTpnHx5HcVjk3jf6jYCuLw6klNOExDOoz7cpVv7coyAr5EsFyforj1cuZd/jC6TrRe49uz3NcDqH7uk3BcuR2lGmk3hzcD2yTEc7g1o0C44K+tdCsKpY9DraRUJ+04Zo+td3GY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735847794; c=relaxed/simple; bh=AtgPA5Av1+rA5pa/kgTSCAUFf3Hk8bi2BlZwrlyY9JA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=h2cDMrdqU/fXV/jLk6avswQ4MBlVvxk5xuWUuctTvITqTHoLPWhnGNPVAqWpi5gUjSck4ma8Rac/XLjJY42MOGj12ZDiaAvdA8V0GVXCVywt2LdgevX9ogdmBm9lN1JDERan6OB1TYo6YJHg6nwcPLgvFsiE4UgnhxfAhCSB8B4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=CP8uKjSn; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="CP8uKjSn" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=YI7wz0cq80u9NqXLkRIWQKPi+stWcYSsRkkPIyh2m/0=; b=CP8uKjSnh7SJq+Yo1ZuqKjpJV/ sLKCj1tghcfXdpfOj5PgblN58VMF+K+5yD+ffwVe59HbxLzPSh3uFhR9eyjFmh4XkLw6VHCrLNN+e M/DHQAHEsRFNFjOMKqDQSwZk5S2C5sMLJbR3eCJ6GWI7y5QFol1B6zWXdITuq/rmsqb5Moav0dFfQ oRfDnKPL1AFeJn88Y/NU/qnoeWC8N3Y5u7L5lZes9BUvBsjdHREg5Szssdo/7vwGjs7L8Lqah2FmI TuKfEhDZqaPrPz2kX6JKb4xQBszkwdV9oimwXZLqtb3iEwSYwpC4tSpWmkDccykKXiyHJdWWt7z1L ZmzRQIUg==; Received: from 77-249-17-89.cable.dynamic.v4.ziggo.nl ([77.249.17.89] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.98 #2 (Red Hat Linux)) id 1tTRIg-00000003MRa-2a7I; Thu, 02 Jan 2025 19:56:10 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id C07A13005D6; Thu, 2 Jan 2025 20:56:09 +0100 (CET) Date: Thu, 2 Jan 2025 20:56:09 +0100 From: Peter Zijlstra To: Rik van Riel Cc: Borislav Petkov , x86@kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, dave.hansen@linux.intel.com, luto@kernel.org, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, akpm@linux-foundation.org, nadav.amit@gmail.com, zhengqi.arch@bytedance.com, linux-mm@kvack.org Subject: Re: [PATCH 01/12] x86/mm: make MMU_GATHER_RCU_TABLE_FREE unconditional Message-ID: <20250102195609.GB7274@noisy.programming.kicks-ass.net> References: <20241230175550.4046587-1-riel@surriel.com> <20241230175550.4046587-2-riel@surriel.com> <20241230184118.GMZ3LpTn3dHvu_bq-p@fat_crate.local> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Tue, Dec 31, 2024 at 11:11:51AM -0500, Rik van Riel wrote: > On Mon, 2024-12-30 at 19:41 +0100, Borislav Petkov wrote: > > On Mon, Dec 30, 2024 at 12:53:02PM -0500, Rik van Riel wrote: > > > Currently x86 uses CONFIG_MMU_GATHER_TABLE_FREE when using > > > paravirt, and not when running on bare metal. > > > > > > There is no real good reason to do things differently for > > > each setup. Make them all the same. > > > > > > After this change, the synchronization between get_user_pages_fast > > > and page table freeing is handled by RCU, which prevents page > > > tables > > > from being reused for other data while get_user_pages_fast is > > > walking > > > them. > > > > I'd rather like to read here why this is not a problem anymore and > > why > > > >   48a8b97cfd80 ("x86/mm: Only use tlb_remove_table() for paravirt") > > > > is not relevant anymore. > > That would be a question for Peter :) Well, I've already answered why we need this in the previous thread but it wasn't preserved :-( Currently GUP-fast serializes against table-free by disabling interrupts, which in turn holds of the TLBI-IPIs. Since you're going to be doing broadcast TLBI -- without IPIs, this no longer works and we need other means of serializing GUP-fast vs table-free. MMU_GATHER_RCU_TABLE_FREE is that means. So where previously paravirt implementations of tlb_flush_multi might require this (because of virt optimizations that avoided the TLBI-IPI), this broadcast invalidate now very much requires this for native.