From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [PATCH 10/20] powerpc/dma-noncoherent: don't disable irqs over kmap_atomic Date: Wed, 22 Aug 2018 09:02:41 +0200 Message-ID: <20180822070241.GD19284@lst.de> References: <20180730163824.10064-1-hch@lst.de> <20180730163824.10064-11-hch@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Benjamin Herrenschmidt Cc: Fenghua Yu , Tony Luck , linux-ia64-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Konrad Rzeszutek Wilk , Michael Ellerman , linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, Paul Mackerras , Robin Murphy , Christoph Hellwig List-Id: iommu@lists.linux-foundation.org On Thu, Aug 09, 2018 at 10:27:46AM +1000, Benjamin Herrenschmidt wrote: > On Mon, 2018-07-30 at 18:38 +0200, Christoph Hellwig wrote: > > The requirement to disable local irqs over kmap_atomic is long gone, > > so remove those calls. > > Really ? I'm trying to verify that and getting lost in a mess of macros > from hell in the per-cpu stuff but if you look at our implementation > of kmap_atomic_prot(), all it does is a preempt_disable(), and then > it uses kmap_atomic_idx_push(): > > int idx = __this_cpu_inc_return(__kmap_atomic_idx) - 1; > > Note the use of __this_cpu_inc_return(), not this_cpu_inc_return(), > ie this is the non-interrupt safe version... Looks like the powerpc variant indeed isn't save. I did look a bit more through the code and history, and it seems like we remove the need to disable irqs when called from process context a while ago, but we still require disabling irqs when called from irq context. Given that this code can also be called from irq context we'll have to keep the local_irq_save.