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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8DC91C54798 for ; Tue, 5 Mar 2024 19:09:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:Message-ID:In-Reply-To: Subject:cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mCnSfqLj9SY8zaChWlNNW/P2Fqu564x/FYk1pwe1kAQ=; b=g6k2NzCIDlfRZVWoq2Y9TXreG2 mVvKFci+MPvuSCH72kb3Vk/WcndC2LJfJCKfYZcrJdqHl0+vgZLosvI6cIzGO9z0Vt1cGcFTs6sfc wjDRHF5764wKKR+C5l6txTgAmCFkanYv+vpWxZS4E7Vsq56O31/85sFlmwGL00NZcirsN7wxv2PN6 LX51Qi7pJdztrtu7SaRV4jnfINjBGkJmNWIMr/3fDkw9R+hifcTMI7oekET0ObEOiH23gcHoHPV68 IHR5xdFGSfy25nOwFeJHCgs7wocBm22LpzK0jwVd/NbTIQWA6U18lSMIafx7HLPE6BdPNxkSUrSCf p1mk8MDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rha9v-0000000Ey91-1hVP; Tue, 05 Mar 2024 19:09:03 +0000 Received: from gentwo.org ([62.72.0.81]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rha9s-0000000Ey82-18UH for linux-arm-kernel@lists.infradead.org; Tue, 05 Mar 2024 19:09:01 +0000 Received: by gentwo.org (Postfix, from userid 1003) id 7AD9240A91; Tue, 5 Mar 2024 11:08:57 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id 7A4A340A90; Tue, 5 Mar 2024 11:08:57 -0800 (PST) Date: Tue, 5 Mar 2024 11:08:57 -0800 (PST) From: "Christoph Lameter (Ampere)" To: Catalin Marinas cc: linux-arm-kernel@lists.infradead.org, "tokamoto@jp.fujitsu.com" , "qi.fuli@fujitsu.com" , Takao Indoh , Will Deacon , Jon Masters Subject: Re: [RFC 3/8] ARM64: Base TLB functions In-Reply-To: Message-ID: <0e57e9cb-687b-7ae5-c9dd-083df5402b7a@linux.com> References: <20231207035703.158053467@gentwo.org> <20231207035712.933420164@gentwo.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240305_110900_356695_D332DE6A X-CRM114-Status: GOOD ( 26.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 4 Mar 2024, Catalin Marinas wrote: > I don't think any of these patches made it to the list for some reason, > only the cover letter. I'll add some general comments below in case you > plan to repost. Correct. I believe I have fixed the isue but did not get around to repost the patchset. > > On Wed, Dec 06, 2023 at 07:57:06PM -0800, Christoph Lameter wrote: >> Add a series of TLB function that allow TLB flushing in a variety of >> ways depending on the mode encoded in enum tlb_state: >> >> TLB_BROADCOAST -> Use single TLBI propagated to all units via the mesh >> TLB_LOCAL -> Use TLBI that only perform local flushes >> TLB_IPI -> Use TLBIs that perform local flushes on multiple cpus >> TLB_NONE -> Suppress TLBI because there are no users of the address space > > TLB_IPI - I really don't want this on arm64, irrespective of the > performance improvement on specific hardware. IPIs need additional care > to avoid deadlocking, e.g. don't do a TLBI with interrupts disabled. I'd > rather not have to care about this. These are commonly used on other platforms in these paths. So I assumed it would be safe. > TLB_LOCAL and TLB_NONE - these are potentially useful _but_ they don't > take the SMMU with SVA into account (another potential issue below). The > mm_cpumask() does not track other non-CPU contexts but they do need the > broadcast TLBI. Hmm....I assume there is no way to determine if a TLB entry is in use by non-cpu contexts? There are MMU notifiers typically used for devices that require context outside of a cpu and that also flush the information. There are already callbacks in the ARM64 tlb flushing code to support MMU notifications. >> +static enum tlb_state tlbstat(struct cpumask *mask) >> +{ >> + unsigned int weight = cpumask_weight(mask); >> + bool present = cpumask_test_cpu(smp_processor_id(), mask); > > Is this guaranteed to be called in a non-preemptible context? My biggest > concern with the cpumask tracking is that the thread is migrated in the > middle of a TLB flush and it would wrongly assume that only a local TLBI > is needed. On arm64 we don't flush the TLBs on context switch. I don't > think we can solve this without additional locking around mm_cpumask() > or at least preemption disabling. This would mean that the scheduler moves the process while the kernel executes a tlb flush operation. TLB operations are related to page table modifications and those require to take a write lock on the mmap lock. This would prevent issues here. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel