Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp397709ybt; Fri, 10 Jul 2020 02:42:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGrz47B5WePrFIY5dfawtO8wqF/7VcpjNJ4PdJsN3fJhan2iMZYiqarDT2W8xHxp+jgQID X-Received: by 2002:a05:6402:202e:: with SMTP id ay14mr76435906edb.233.1594374172600; Fri, 10 Jul 2020 02:42:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594374172; cv=none; d=google.com; s=arc-20160816; b=ALfFfEurTa7nw84jNwhrVGv/Lhu1oQhMY66afidY4fnzQsOyOsFWjdHLDd9mndV04o QpjotyLzAc3vjpVM1SWfauE9mWddhjfmIfImSSK2ZKLMK8LH31qJ9WohPCbMhDSLx8X5 fWAi9+KPWU/UywbJNzqxfEAufNcmtdljN85UimmRRRwD7Cj5yPYyf1NtODjSeKLJrdxQ 1DbnLXUggzXl/4l8tnrCIiVC14/4sma07CrMa2Z/VEnPKpQ+6qMvsj6AnHpLEGOJcnF+ fTrMPa/PosHglamTqbR3uQzwai+18P3ELGgHoArd0tGFOMeOUIeI8PmMoia7hw+BUpww 16Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ZjyAASXArgWq7Bdptru/76m4wkYaBPhc/UpB8fdqxik=; b=IvdGPcGQRrKHxRHV03u961Qtt9G4wvRz6yFgRubDLqh5vwDqoJ0NyI/KSX069UZNcK Oz10eL/xKN46qO1/V3iCbUaYanNKbRcM7Qfg1Gjr7u189FJJwAIVMW50yLTX64hW/udM DylK17MmmpD6zV/Aqrl025U4ZxBz+bQ1zYu2tK+TYIVS5VS8lWRV/OtDb3r7WDRLqro0 iTHyR2v+Md1uWa8Cb9dFAUvycaLqeXDp+SSgQZ/xQsCdcxyFZkFau7R/fMWjKdWGhtjs EKBzC4fPyKVIGD3f6ftOflGV/8YKhiLWtwIatDw71A54nPt6EXRVxKDEt8csJf2+j1tE YNow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=zA0m11Wb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x70si4204266ede.405.2020.07.10.02.42.28; Fri, 10 Jul 2020 02:42:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=zA0m11Wb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726773AbgGJJmR (ORCPT + 99 others); Fri, 10 Jul 2020 05:42:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726560AbgGJJmR (ORCPT ); Fri, 10 Jul 2020 05:42:17 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E930BC08C5CE; Fri, 10 Jul 2020 02:42:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ZjyAASXArgWq7Bdptru/76m4wkYaBPhc/UpB8fdqxik=; b=zA0m11Wbj0k3n0yOG9UmwXpKUJ V17bvo/1zKlsCPwQNKiZI/RjBUNXZkUNWu9dvgin0QAOptrpEHiKCR4/IpSlfVuUvwky/9TEbfIqF o9/aLWSBXIFmpR9byGbnDCEeW84gtfWVMHMKx9HA7wmjEzghv5VZAOE6heMECAbZjly10rSBK4Rw/ xx11ZaN+4V9LRQu7I55jib6FRuZ7VBF4mmzoR0vHkKzdNQGxcdLJ8Vynn4NPnLiXRk2znsjGK50BT pB7+kPXU0eTO3snr3WCNcbkhlk7YwAm86/gqK+Z8pClP1S14vHWsZCaxWzQpLVs3JP2meGj2CuWD6 d+9rH4iQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtpXf-0003av-46; Fri, 10 Jul 2020 09:42:03 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id A8922301179; Fri, 10 Jul 2020 11:42:01 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 944062B5130F2; Fri, 10 Jul 2020 11:42:01 +0200 (CEST) Date: Fri, 10 Jul 2020 11:42:01 +0200 From: Peter Zijlstra To: Nicholas Piggin Cc: linux-arch@vger.kernel.org, x86@kernel.org, Mathieu Desnoyers , Arnd Bergmann , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, Anton Blanchard Subject: Re: [RFC PATCH 4/7] x86: use exit_lazy_tlb rather than membarrier_mm_sync_core_before_usermode Message-ID: <20200710094201.GZ4800@hirez.programming.kicks-ass.net> References: <20200710015646.2020871-1-npiggin@gmail.com> <20200710015646.2020871-5-npiggin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200710015646.2020871-5-npiggin@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 10, 2020 at 11:56:43AM +1000, Nicholas Piggin wrote: > And get rid of the generic sync_core_before_usermode facility. > > This helper is the wrong way around I think. The idea that membarrier > state requires a core sync before returning to user is the easy one > that does not need hiding behind membarrier calls. The gap in core > synchronization due to x86's sysret/sysexit and lazy tlb mode, is the > tricky detail that is better put in x86 lazy tlb code. > > Consider if an arch did not synchronize core in switch_mm either, then > membarrier_mm_sync_core_before_usermode would be in the wrong place > but arch specific mmu context functions would still be the right place. > There is also a exit_lazy_tlb case that is not covered by this call, which > could be a bugs (kthread use mm the membarrier process's mm then context > switch back to the process without switching mm or lazy mm switch). > > This makes lazy tlb code a bit more modular. Hurmph, I know I've been staring at this at some point. I think I meant to have a TIF to force the IRET path in the case of MEMBAR_SYNC_CORE. But I was discouraged by amluto.