From: Thierry Reding <thierry.reding@gmail.com>
To: Christoph Hellwig <hch@lst.de>
Cc: iommu@lists.linux-foundation.org,
"Linus Torvalds" <torvalds@linux-foundation.org>,
"Jesper Dangaard Brouer" <brouer@redhat.com>,
"Tariq Toukan" <tariqt@mellanox.com>,
"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
"Toke Høiland-Jørgensen" <toke@toke.dk>,
"Robin Murphy" <robin.murphy@arm.com>,
"Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>,
"Tony Luck" <tony.luck@intel.com>,
"Fenghua Yu" <fenghua.yu@intel.com>,
"Marek Szyprowski" <m.szyprowski@samsung.com>,
"Keith Busch" <keith.busch@intel.com>,
"Jonathan Derrick" <jonathan.derrick@intel.com>,
linux-pci@vger.kernel.org, linux-ia64@vger.kernel.org,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 15/15] dma-mapping: bypass indirect calls for dma-direct
Date: Thu, 20 Dec 2018 16:44:18 +0000 [thread overview]
Message-ID: <20181220164418.GA18777@ulmo> (raw)
In-Reply-To: <20181207190720.18517-16-hch@lst.de>
[-- Attachment #1: Type: text/plain, Size: 2029 bytes --]
On Fri, Dec 07, 2018 at 11:07:20AM -0800, Christoph Hellwig wrote:
[...]
> diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c
> index 0b18cfbdde95..fc84c81029d9 100644
> --- a/kernel/dma/mapping.c
> +++ b/kernel/dma/mapping.c
[...]
> @@ -397,9 +404,9 @@ int dma_supported(struct device *dev, u64 mask)
> {
> const struct dma_map_ops *ops = get_dma_ops(dev);
>
> - if (!ops)
> - return 0;
> - if (!ops->dma_supported)
> + if (dma_is_direct(ops))
> + return dma_direct_supported(dev, mask);
> + if (ops->dma_supported)
> return 1;
> return ops->dma_supported(dev, mask);
> }
Hi Christoph,
This hunk causes a crash on boot for me. It looks like a ! got lost in
the rework here. The following patch fixes the crash for me and restores
the logic of the op->dma_supported check.
Feel free to squash this patch into the above if you prefer that.
Thierry
--- >8 ---
From c502b29ab01fa857e81c78cd574d4d22d7d20e09 Mon Sep 17 00:00:00 2001
From: Thierry Reding <treding@nvidia.com>
Date: Thu, 20 Dec 2018 17:35:47 +0100
Subject: [PATCH] dma-mapping: Fix inverted logic in dma_supported()
The cleanup in commit 356da6d0cde3 ("dma-mapping: bypass indirect calls
for dma-direct") accidentally inverted the logic in the check for the
presence of a ->dma_supported() callback. Switch this back to the way it
was to prevent a crash on boot.
Fixes: 356da6d0cde3 ("dma-mapping: bypass indirect calls for dma-direct")
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
kernel/dma/mapping.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c
index fc84c81029d9..d7c34d2d1ba5 100644
--- a/kernel/dma/mapping.c
+++ b/kernel/dma/mapping.c
@@ -406,7 +406,7 @@ int dma_supported(struct device *dev, u64 mask)
if (dma_is_direct(ops))
return dma_direct_supported(dev, mask);
- if (ops->dma_supported)
+ if (!ops->dma_supported)
return 1;
return ops->dma_supported(dev, mask);
}
--
2.19.1
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Christoph Hellwig <hch@lst.de>
Cc: iommu@lists.linux-foundation.org,
"Linus Torvalds" <torvalds@linux-foundation.org>,
"Jesper Dangaard Brouer" <brouer@redhat.com>,
"Tariq Toukan" <tariqt@mellanox.com>,
"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
"Toke Høiland-Jørgensen" <toke@toke.dk>,
"Robin Murphy" <robin.murphy@arm.com>,
"Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>,
"Tony Luck" <tony.luck@intel.com>,
"Fenghua Yu" <fenghua.yu@intel.com>,
"Marek Szyprowski" <m.szyprowski@samsung.com>,
"Keith Busch" <keith.busch@intel.com>,
"Jonathan Derrick" <jonathan.derrick@intel.com>,
linux-pci@vger.kernel.org, linux-ia64@vger.kernel.org,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 15/15] dma-mapping: bypass indirect calls for dma-direct
Date: Thu, 20 Dec 2018 17:44:18 +0100 [thread overview]
Message-ID: <20181220164418.GA18777@ulmo> (raw)
In-Reply-To: <20181207190720.18517-16-hch@lst.de>
[-- Attachment #1: Type: text/plain, Size: 2029 bytes --]
On Fri, Dec 07, 2018 at 11:07:20AM -0800, Christoph Hellwig wrote:
[...]
> diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c
> index 0b18cfbdde95..fc84c81029d9 100644
> --- a/kernel/dma/mapping.c
> +++ b/kernel/dma/mapping.c
[...]
> @@ -397,9 +404,9 @@ int dma_supported(struct device *dev, u64 mask)
> {
> const struct dma_map_ops *ops = get_dma_ops(dev);
>
> - if (!ops)
> - return 0;
> - if (!ops->dma_supported)
> + if (dma_is_direct(ops))
> + return dma_direct_supported(dev, mask);
> + if (ops->dma_supported)
> return 1;
> return ops->dma_supported(dev, mask);
> }
Hi Christoph,
This hunk causes a crash on boot for me. It looks like a ! got lost in
the rework here. The following patch fixes the crash for me and restores
the logic of the op->dma_supported check.
Feel free to squash this patch into the above if you prefer that.
Thierry
--- >8 ---
From c502b29ab01fa857e81c78cd574d4d22d7d20e09 Mon Sep 17 00:00:00 2001
From: Thierry Reding <treding@nvidia.com>
Date: Thu, 20 Dec 2018 17:35:47 +0100
Subject: [PATCH] dma-mapping: Fix inverted logic in dma_supported()
The cleanup in commit 356da6d0cde3 ("dma-mapping: bypass indirect calls
for dma-direct") accidentally inverted the logic in the check for the
presence of a ->dma_supported() callback. Switch this back to the way it
was to prevent a crash on boot.
Fixes: 356da6d0cde3 ("dma-mapping: bypass indirect calls for dma-direct")
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
kernel/dma/mapping.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c
index fc84c81029d9..d7c34d2d1ba5 100644
--- a/kernel/dma/mapping.c
+++ b/kernel/dma/mapping.c
@@ -406,7 +406,7 @@ int dma_supported(struct device *dev, u64 mask)
if (dma_is_direct(ops))
return dma_direct_supported(dev, mask);
- if (ops->dma_supported)
+ if (!ops->dma_supported)
return 1;
return ops->dma_supported(dev, mask);
}
--
2.19.1
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2018-12-20 16:44 UTC|newest]
Thread overview: 99+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-07 19:07 [RFC] avoid indirect calls for DMA direct mappings v2 Christoph Hellwig
2018-12-07 19:07 ` Christoph Hellwig
2018-12-07 19:07 ` Christoph Hellwig
2018-12-07 19:07 ` [PATCH 01/15] swiotlb: remove SWIOTLB_MAP_ERROR Christoph Hellwig
2018-12-07 19:07 ` Christoph Hellwig
2018-12-07 19:07 ` Christoph Hellwig
2018-12-07 19:07 ` [PATCH 02/15] swiotlb: remove dma_mark_clean Christoph Hellwig
2018-12-07 19:07 ` Christoph Hellwig
2018-12-07 19:07 ` Christoph Hellwig
2019-01-02 21:53 ` Tony Luck
2019-01-02 21:53 ` Tony Luck
2019-01-03 7:23 ` Christoph Hellwig
2019-01-03 7:23 ` Christoph Hellwig
2019-01-03 7:23 ` Christoph Hellwig
2019-01-03 17:35 ` Tony Luck
2019-01-03 17:35 ` Tony Luck
2019-01-03 17:35 ` Tony Luck
2019-01-04 8:09 ` Christoph Hellwig
2019-01-04 8:09 ` Christoph Hellwig
2019-01-04 8:09 ` Christoph Hellwig
2018-12-07 19:07 ` [PATCH 03/15] dma-direct: improve addressability error reporting Christoph Hellwig
2018-12-07 19:07 ` Christoph Hellwig
2018-12-07 19:07 ` Christoph Hellwig
2018-12-07 19:07 ` [PATCH 04/15] dma-direct: use dma_direct_map_page to implement dma_direct_map_sg Christoph Hellwig
2018-12-07 19:07 ` Christoph Hellwig
2018-12-07 19:07 ` Christoph Hellwig
2018-12-07 19:07 ` [PATCH 05/15] dma-direct: merge swiotlb_dma_ops into the dma_direct code Christoph Hellwig
2018-12-07 19:07 ` Christoph Hellwig
2018-12-07 19:07 ` Christoph Hellwig
2018-12-07 19:07 ` [PATCH 06/15] dma-mapping: simplify the dma_sync_single_range_for_{cpu,device} implementation Christoph Hellwig
2018-12-07 19:07 ` Christoph Hellwig
2018-12-07 19:07 ` [PATCH 06/15] dma-mapping: simplify the dma_sync_single_range_for_{cpu, device} implementation Christoph Hellwig
2018-12-07 19:07 ` [PATCH 07/15] dma-mapping: merge dma_unmap_page_attrs and dma_unmap_single_attrs Christoph Hellwig
2018-12-07 19:07 ` Christoph Hellwig
2018-12-07 19:07 ` [PATCH 08/15] dma-mapping: move dma_get_required_mask to kernel/dma Christoph Hellwig
2018-12-07 19:07 ` Christoph Hellwig
2018-12-07 19:07 ` [PATCH 09/15] dma-mapping: move various slow path functions out of line Christoph Hellwig
2018-12-07 19:07 ` Christoph Hellwig
2018-12-07 19:07 ` [PATCH 10/15] dma-mapping: move dma_cache_sync " Christoph Hellwig
2018-12-07 19:07 ` Christoph Hellwig
2018-12-07 19:07 ` [PATCH 11/15] dma-mapping: always build the direct mapping code Christoph Hellwig
2018-12-07 19:07 ` Christoph Hellwig
2018-12-07 19:07 ` [PATCH 12/15] dma-mapping: factor out dummy DMA ops Christoph Hellwig
2018-12-07 19:07 ` Christoph Hellwig
2018-12-07 19:07 ` [PATCH 13/15] ACPI / scan: Refactor _CCA enforcement Christoph Hellwig
2018-12-07 19:07 ` Christoph Hellwig
2018-12-14 21:15 ` Bjorn Helgaas
2018-12-14 21:15 ` Bjorn Helgaas
2018-12-07 19:07 ` [PATCH 14/15] vmd: use the proper dma_* APIs instead of direct methods calls Christoph Hellwig
2018-12-07 19:07 ` Christoph Hellwig
2018-12-14 21:17 ` Bjorn Helgaas
2018-12-14 21:17 ` Bjorn Helgaas
2018-12-14 21:34 ` Derrick, Jonathan
2018-12-14 21:34 ` Derrick, Jonathan
2018-12-07 19:07 ` [PATCH 15/15] dma-mapping: bypass indirect calls for dma-direct Christoph Hellwig
2018-12-07 19:07 ` Christoph Hellwig
2018-12-14 14:11 ` Marek Szyprowski
2018-12-14 14:11 ` Marek Szyprowski
2018-12-14 14:24 ` Christoph Hellwig
2018-12-14 14:24 ` Christoph Hellwig
2018-12-14 14:32 ` Marek Szyprowski
2018-12-14 14:32 ` Marek Szyprowski
2018-12-15 17:46 ` [15/15] " Guenter Roeck
2018-12-15 17:46 ` Guenter Roeck
2018-12-16 9:02 ` Christoph Hellwig
2018-12-16 9:02 ` Christoph Hellwig
2018-12-16 9:02 ` Christoph Hellwig
2018-12-18 20:34 ` Guillaume Tucker
2018-12-18 20:34 ` Guillaume Tucker
2018-12-18 20:34 ` Guillaume Tucker
2018-12-18 20:34 ` Guillaume Tucker
2018-12-18 20:42 ` Robin Murphy
2018-12-18 20:42 ` Robin Murphy
2018-12-18 20:42 ` Robin Murphy
2018-12-19 6:42 ` Christoph Hellwig
2018-12-19 6:42 ` Christoph Hellwig
2018-12-19 6:42 ` Christoph Hellwig
2018-12-19 6:42 ` Christoph Hellwig
2018-12-20 16:44 ` Thierry Reding [this message]
2018-12-20 16:44 ` [PATCH 15/15] " Thierry Reding
2018-12-20 16:46 ` Christoph Hellwig
2018-12-20 16:46 ` Christoph Hellwig
2018-12-08 16:06 ` [RFC] avoid indirect calls for DMA direct mappings v2 Jesper Dangaard Brouer
2018-12-08 16:06 ` Jesper Dangaard Brouer
2018-12-08 16:50 ` Christoph Hellwig
2018-12-08 16:50 ` Christoph Hellwig
2018-12-10 21:51 ` Luck, Tony
2018-12-10 21:51 ` Luck, Tony
2018-12-11 6:51 ` Christoph Hellwig
2018-12-11 6:51 ` Christoph Hellwig
2018-12-11 16:42 ` Luck, Tony
2018-12-11 16:42 ` Luck, Tony
2018-12-11 17:13 ` Luck, Tony
2018-12-11 17:13 ` Luck, Tony
2018-12-11 17:15 ` Christoph Hellwig
2018-12-11 17:15 ` Christoph Hellwig
2018-12-11 17:15 ` Christoph Hellwig
2018-12-13 20:08 ` Christoph Hellwig
2018-12-13 20:08 ` Christoph Hellwig
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=20181220164418.GA18777@ulmo \
--to=thierry.reding@gmail.com \
--cc=brouer@redhat.com \
--cc=fenghua.yu@intel.com \
--cc=hch@lst.de \
--cc=ilias.apalodimas@linaro.org \
--cc=iommu@lists.linux-foundation.org \
--cc=jonathan.derrick@intel.com \
--cc=keith.busch@intel.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=robin.murphy@arm.com \
--cc=tariqt@mellanox.com \
--cc=toke@toke.dk \
--cc=tony.luck@intel.com \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
/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.