All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Christoph Hellwig <hch@lst.de>, Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Tony Luck <tony.luck@intel.com>,
	Fenghua Yu <fenghua.yu@intel.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Robin Murphy <robin.murphy@arm.com>,
	linuxppc-dev@lists.ozlabs.org, iommu@lists.linux-foundation.org,
	linux-ia64@vger.kernel.org
Subject: Re: [PATCH 10/20] powerpc/dma-noncoherent: don't disable irqs over kmap_atomic
Date: Wed, 22 Aug 2018 07:02:41 +0000	[thread overview]
Message-ID: <20180822070241.GD19284@lst.de> (raw)
In-Reply-To: <bfa22816fee0759cfee28705b427be3586c7d2e3.camel@kernel.crashing.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.

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
To: Benjamin Herrenschmidt
	<benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
Cc: Fenghua Yu <fenghua.yu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Tony Luck <tony.luck-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	linux-ia64-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Konrad Rzeszutek Wilk
	<konrad.wilk-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>,
	Michael Ellerman <mpe-Gsx/Oe8HsFggBc27wqDAHg@public.gmane.org>,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	Paul Mackerras <paulus-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>,
	Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>,
	Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
Subject: Re: [PATCH 10/20] powerpc/dma-noncoherent: don't disable irqs over kmap_atomic
Date: Wed, 22 Aug 2018 09:02:41 +0200	[thread overview]
Message-ID: <20180822070241.GD19284@lst.de> (raw)
In-Reply-To: <bfa22816fee0759cfee28705b427be3586c7d2e3.camel-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.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.

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Christoph Hellwig <hch@lst.de>, Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Tony Luck <tony.luck@intel.com>,
	Fenghua Yu <fenghua.yu@intel.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Robin Murphy <robin.murphy@arm.com>,
	linuxppc-dev@lists.ozlabs.org, iommu@lists.linux-foundation.org,
	linux-ia64@vger.kernel.org
Subject: Re: [PATCH 10/20] powerpc/dma-noncoherent: don't disable irqs over kmap_atomic
Date: Wed, 22 Aug 2018 09:02:41 +0200	[thread overview]
Message-ID: <20180822070241.GD19284@lst.de> (raw)
In-Reply-To: <bfa22816fee0759cfee28705b427be3586c7d2e3.camel@kernel.crashing.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.

  reply	other threads:[~2018-08-22  7:02 UTC|newest]

Thread overview: 156+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-30 16:38 use generic DMA mapping code in powerpc Christoph Hellwig
2018-07-30 16:38 ` Christoph Hellwig
2018-07-30 16:38 ` Christoph Hellwig
2018-07-30 16:38 ` [PATCH 01/20] kernel/dma/direct: take DMA offset into account in dma_direct_supported Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-08-08 23:44   ` Benjamin Herrenschmidt
2018-08-08 23:44     ` Benjamin Herrenschmidt
2018-08-08 23:44     ` Benjamin Herrenschmidt
2018-08-22  6:53     ` Christoph Hellwig
2018-08-22  6:53       ` Christoph Hellwig
2018-08-22  6:53       ` Christoph Hellwig
2018-08-22 23:59       ` Benjamin Herrenschmidt
2018-08-22 23:59         ` Benjamin Herrenschmidt
2018-08-22 23:59         ` Benjamin Herrenschmidt
2018-08-23  5:24         ` Christoph Hellwig
2018-08-23  5:24           ` Christoph Hellwig
2018-08-23  5:24           ` Christoph Hellwig
2018-08-23  5:24           ` Benjamin Herrenschmidt
2018-08-23  5:24             ` Benjamin Herrenschmidt
2018-08-23  5:24             ` Benjamin Herrenschmidt
2018-07-30 16:38 ` [PATCH 02/20] kernel/dma/direct: refine dma_direct_alloc zone selection Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-08-08 23:54   ` Benjamin Herrenschmidt
2018-08-08 23:54     ` Benjamin Herrenschmidt
2018-08-08 23:54     ` Benjamin Herrenschmidt
2018-08-22  6:58     ` Christoph Hellwig
2018-08-22  6:58       ` Christoph Hellwig
2018-08-22  6:58       ` Christoph Hellwig
2018-08-23  0:01       ` Benjamin Herrenschmidt
2018-08-23  0:01         ` Benjamin Herrenschmidt
2018-08-23  0:01         ` Benjamin Herrenschmidt
2018-08-23  5:26         ` Christoph Hellwig
2018-08-23  5:26           ` Christoph Hellwig
2018-08-23  5:26           ` Christoph Hellwig
2018-07-30 16:38 ` [PATCH 03/20] dma-mapping: make the get_required_mask method available unconditionally Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38 ` [PATCH 04/20] ia64: remove get_required_mask implementation Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38 ` [PATCH 05/20] swiotlb: allow the architecture to provide a get_required_mask hook Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-08-27 16:06   ` Konrad Rzeszutek Wilk
2018-08-27 16:06     ` Konrad Rzeszutek Wilk
2018-08-27 16:06     ` Konrad Rzeszutek Wilk
2018-07-30 16:38 ` [PATCH 06/20] dma-noncoherent: add an optional arch hook for ->get_required_mask Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38 ` [PATCH 07/20] powerpc/dma: remove the unused ARCH_HAS_DMA_MMAP_COHERENT define Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-08-08 23:56   ` Benjamin Herrenschmidt
2018-08-08 23:56     ` Benjamin Herrenschmidt
2018-08-08 23:56     ` Benjamin Herrenschmidt
2018-07-30 16:38 ` [PATCH 08/20] powerpc/dma: remove the unused dma_nommu_ops export Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-31 12:16   ` Christoph Hellwig
2018-07-31 12:16     ` Christoph Hellwig
2018-07-31 12:16     ` Christoph Hellwig
2018-08-09  0:01     ` Benjamin Herrenschmidt
2018-08-09  0:01       ` Benjamin Herrenschmidt
2018-08-09  0:01       ` Benjamin Herrenschmidt
2018-08-22  6:45       ` Christoph Hellwig
2018-08-22  6:45         ` Christoph Hellwig
2018-08-22  6:45         ` Christoph Hellwig
2018-08-22 23:50         ` Benjamin Herrenschmidt
2018-08-22 23:50           ` Benjamin Herrenschmidt
2018-08-22 23:50           ` Benjamin Herrenschmidt
2018-07-30 16:38 ` [PATCH 09/20] powerpc/dma: remove the unused ISA_DMA_THRESHOLD export Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-08-09  0:14   ` Benjamin Herrenschmidt
2018-08-09  0:14     ` Benjamin Herrenschmidt
2018-08-09  0:14     ` Benjamin Herrenschmidt
2018-07-30 16:38 ` [PATCH 10/20] powerpc/dma-noncoherent: don't disable irqs over kmap_atomic Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-08-09  0:27   ` Benjamin Herrenschmidt
2018-08-09  0:27     ` Benjamin Herrenschmidt
2018-08-09  0:27     ` Benjamin Herrenschmidt
2018-08-22  7:02     ` Christoph Hellwig [this message]
2018-08-22  7:02       ` Christoph Hellwig
2018-08-22  7:02       ` Christoph Hellwig
2018-08-22 23:45       ` Benjamin Herrenschmidt
2018-08-22 23:45         ` Benjamin Herrenschmidt
2018-08-22 23:45         ` Benjamin Herrenschmidt
2018-07-30 16:38 ` [PATCH 11/20] powerpc/dma: split the two __dma_alloc_coherent implementations Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-08-09  0:40   ` Benjamin Herrenschmidt
2018-08-09  0:40     ` Benjamin Herrenschmidt
2018-08-09  0:40     ` Benjamin Herrenschmidt
2018-07-30 16:38 ` [PATCH 12/20] powerpc/dma: use phys_to_dma instead of get_dma_offset Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-08-09  0:43   ` Benjamin Herrenschmidt
2018-08-09  0:43     ` Benjamin Herrenschmidt
2018-08-09  0:43     ` Benjamin Herrenschmidt
2018-07-30 16:38 ` [PATCH 13/20] powerpc/dma: remove get_dma_offset Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-08-09  0:45   ` Benjamin Herrenschmidt
2018-08-09  0:45     ` Benjamin Herrenschmidt
2018-08-09  0:45     ` Benjamin Herrenschmidt
2018-07-30 16:38 ` [PATCH 14/20] powerpc/dma: replace dma_nommu_dma_supported with dma_direct_supported Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-08-09  0:49   ` Benjamin Herrenschmidt
2018-08-09  0:49     ` Benjamin Herrenschmidt
2018-08-09  0:49     ` Benjamin Herrenschmidt
2018-07-30 16:38 ` [PATCH 15/20] powerpc/dma: remove the unused unmap_page and unmap_sg methods Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-08-09  0:49   ` Benjamin Herrenschmidt
2018-08-09  0:49     ` Benjamin Herrenschmidt
2018-08-09  0:49     ` Benjamin Herrenschmidt
2018-07-30 16:38 ` [PATCH 16/20] powerpc/dma: use dma_direct_{alloc,free} Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-08-09  0:52   ` Benjamin Herrenschmidt
2018-08-09  0:52     ` Benjamin Herrenschmidt
2018-08-09  0:52     ` Benjamin Herrenschmidt
2018-08-27  8:51     ` Scott Wood
2018-08-27  8:51       ` Scott Wood
2018-08-27  8:51       ` Scott Wood
2018-07-30 16:38 ` [PATCH 17/20] powerpc/dma-swiotlb: use generic swiotlb_dma_ops Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-08-09  0:54   ` Benjamin Herrenschmidt
2018-08-09  0:54     ` Benjamin Herrenschmidt
2018-08-09  0:54     ` Benjamin Herrenschmidt
2018-08-09  1:57     ` Benjamin Herrenschmidt
2018-08-09  1:57       ` Benjamin Herrenschmidt
2018-08-09  1:57       ` Benjamin Herrenschmidt
2018-08-22  7:04       ` Christoph Hellwig
2018-08-22  7:04         ` Christoph Hellwig
2018-08-22  7:04         ` Christoph Hellwig
2018-07-30 16:38 ` [PATCH 18/20] powerpc/dma-noncoherent: use generic dma_noncoherent_ops Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-08-09  1:00   ` Benjamin Herrenschmidt
2018-08-09  1:00     ` Benjamin Herrenschmidt
2018-08-09  1:00     ` Benjamin Herrenschmidt
2018-07-30 16:38 ` [PATCH 19/20] powerpc/dma: use the generic dma-direct map_page and map_sg routines Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38 ` [PATCH 20/20] powerpc/dma: remove dma_nommu_mmap_coherent Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-07-30 16:38   ` Christoph Hellwig
2018-08-09  1:05   ` Benjamin Herrenschmidt
2018-08-09  1:05     ` Benjamin Herrenschmidt
2018-08-09  1:05     ` Benjamin Herrenschmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180822070241.GD19284@lst.de \
    --to=hch@lst.de \
    --cc=benh@kernel.crashing.org \
    --cc=fenghua.yu@intel.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=robin.murphy@arm.com \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.