All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] swiotlb: Fix type of max_slot
@ 2021-03-02 17:21 ` Kunihiko Hayashi
  0 siblings, 0 replies; 6+ messages in thread
From: Kunihiko Hayashi @ 2021-03-02 17:21 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Christoph Hellwig, Marek Szyprowski,
	Robin Murphy, Jianxiong Gao
  Cc: iommu, linux-kernel, Kunihiko Hayashi

After the refactoring phase, the type of max_slot has changed from unsigned
long to unsigned int. The return type of the function get_max_slots() and
the 4th argument type of iommu_is_span_boundary() are different from the
type of max_slot. Finally, asserts BUG_ON in iommu_is_span_boundary().

Cc: Christoph Hellwig <hch@lst.de>
Fixes: 567d877f9a7d ("swiotlb: refactor swiotlb_tbl_map_single")
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
---
 kernel/dma/swiotlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index 369e4c3..c10e855 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -534,7 +534,7 @@ static int find_slots(struct device *dev, phys_addr_t orig_addr,
 	unsigned long boundary_mask = dma_get_seg_boundary(dev);
 	dma_addr_t tbl_dma_addr =
 		phys_to_dma_unencrypted(dev, io_tlb_start) & boundary_mask;
-	unsigned int max_slots = get_max_slots(boundary_mask);
+	unsigned long max_slots = get_max_slots(boundary_mask);
 	unsigned int iotlb_align_mask =
 		dma_get_min_align_mask(dev) & ~(IO_TLB_SIZE - 1);
 	unsigned int nslots = nr_slots(alloc_size), stride;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] swiotlb: Fix type of max_slot
@ 2021-03-02 17:21 ` Kunihiko Hayashi
  0 siblings, 0 replies; 6+ messages in thread
From: Kunihiko Hayashi @ 2021-03-02 17:21 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Christoph Hellwig, Marek Szyprowski,
	Robin Murphy, Jianxiong Gao
  Cc: iommu, linux-kernel, Kunihiko Hayashi

After the refactoring phase, the type of max_slot has changed from unsigned
long to unsigned int. The return type of the function get_max_slots() and
the 4th argument type of iommu_is_span_boundary() are different from the
type of max_slot. Finally, asserts BUG_ON in iommu_is_span_boundary().

Cc: Christoph Hellwig <hch@lst.de>
Fixes: 567d877f9a7d ("swiotlb: refactor swiotlb_tbl_map_single")
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
---
 kernel/dma/swiotlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index 369e4c3..c10e855 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -534,7 +534,7 @@ static int find_slots(struct device *dev, phys_addr_t orig_addr,
 	unsigned long boundary_mask = dma_get_seg_boundary(dev);
 	dma_addr_t tbl_dma_addr =
 		phys_to_dma_unencrypted(dev, io_tlb_start) & boundary_mask;
-	unsigned int max_slots = get_max_slots(boundary_mask);
+	unsigned long max_slots = get_max_slots(boundary_mask);
 	unsigned int iotlb_align_mask =
 		dma_get_min_align_mask(dev) & ~(IO_TLB_SIZE - 1);
 	unsigned int nslots = nr_slots(alloc_size), stride;
-- 
2.7.4

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] swiotlb: Fix type of max_slot
  2021-03-02 17:21 ` Kunihiko Hayashi
@ 2021-03-02 20:20   ` Konrad Rzeszutek Wilk
  -1 siblings, 0 replies; 6+ messages in thread
From: Konrad Rzeszutek Wilk @ 2021-03-02 20:20 UTC (permalink / raw)
  To: Kunihiko Hayashi, Christoph Hellwig, Marek Szyprowski,
	Robin Murphy, Jianxiong Gao
  Cc: iommu, linux-kernel

On 3/2/21 12:21 PM, Kunihiko Hayashi wrote:
> After the refactoring phase, the type of max_slot has changed from unsigned
> long to unsigned int. The return type of the function get_max_slots() and
> the 4th argument type of iommu_is_span_boundary() are different from the
> type of max_slot. Finally, asserts BUG_ON in iommu_is_span_boundary().
> 
> Cc: Christoph Hellwig <hch@lst.de>
> Fixes: 567d877f9a7d ("swiotlb: refactor swiotlb_tbl_map_single")
> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

I think this is all good. Looking at Linus's master I see:


537         unsigned long max_slots = get_max_slots(boundary_mask);

?

> ---
>   kernel/dma/swiotlb.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
> index 369e4c3..c10e855 100644
> --- a/kernel/dma/swiotlb.c
> +++ b/kernel/dma/swiotlb.c
> @@ -534,7 +534,7 @@ static int find_slots(struct device *dev, phys_addr_t orig_addr,
>   	unsigned long boundary_mask = dma_get_seg_boundary(dev);
>   	dma_addr_t tbl_dma_addr =
>   		phys_to_dma_unencrypted(dev, io_tlb_start) & boundary_mask;
> -	unsigned int max_slots = get_max_slots(boundary_mask);
> +	unsigned long max_slots = get_max_slots(boundary_mask);
>   	unsigned int iotlb_align_mask =
>   		dma_get_min_align_mask(dev) & ~(IO_TLB_SIZE - 1);
>   	unsigned int nslots = nr_slots(alloc_size), stride;
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] swiotlb: Fix type of max_slot
@ 2021-03-02 20:20   ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 6+ messages in thread
From: Konrad Rzeszutek Wilk @ 2021-03-02 20:20 UTC (permalink / raw)
  To: Kunihiko Hayashi, Christoph Hellwig, Marek Szyprowski,
	Robin Murphy, Jianxiong Gao
  Cc: iommu, linux-kernel

On 3/2/21 12:21 PM, Kunihiko Hayashi wrote:
> After the refactoring phase, the type of max_slot has changed from unsigned
> long to unsigned int. The return type of the function get_max_slots() and
> the 4th argument type of iommu_is_span_boundary() are different from the
> type of max_slot. Finally, asserts BUG_ON in iommu_is_span_boundary().
> 
> Cc: Christoph Hellwig <hch@lst.de>
> Fixes: 567d877f9a7d ("swiotlb: refactor swiotlb_tbl_map_single")
> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

I think this is all good. Looking at Linus's master I see:


537         unsigned long max_slots = get_max_slots(boundary_mask);

?

> ---
>   kernel/dma/swiotlb.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
> index 369e4c3..c10e855 100644
> --- a/kernel/dma/swiotlb.c
> +++ b/kernel/dma/swiotlb.c
> @@ -534,7 +534,7 @@ static int find_slots(struct device *dev, phys_addr_t orig_addr,
>   	unsigned long boundary_mask = dma_get_seg_boundary(dev);
>   	dma_addr_t tbl_dma_addr =
>   		phys_to_dma_unencrypted(dev, io_tlb_start) & boundary_mask;
> -	unsigned int max_slots = get_max_slots(boundary_mask);
> +	unsigned long max_slots = get_max_slots(boundary_mask);
>   	unsigned int iotlb_align_mask =
>   		dma_get_min_align_mask(dev) & ~(IO_TLB_SIZE - 1);
>   	unsigned int nslots = nr_slots(alloc_size), stride;
> 

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] swiotlb: Fix type of max_slot
  2021-03-02 20:20   ` Konrad Rzeszutek Wilk
@ 2021-03-03  4:33     ` Kunihiko Hayashi
  -1 siblings, 0 replies; 6+ messages in thread
From: Kunihiko Hayashi @ 2021-03-03  4:33 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: Christoph Hellwig, Marek Szyprowski, Robin Murphy, Jianxiong Gao,
	iommu, linux-kernel

On Tue, 2 Mar 2021 15:20:08 -0500
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:

> On 3/2/21 12:21 PM, Kunihiko Hayashi wrote:
> > After the refactoring phase, the type of max_slot has changed from unsigned
> > long to unsigned int. The return type of the function get_max_slots() and
> > the 4th argument type of iommu_is_span_boundary() are different from the
> > type of max_slot. Finally, asserts BUG_ON in iommu_is_span_boundary().
> > > Cc: Christoph Hellwig <hch@lst.de>
> > Fixes: 567d877f9a7d ("swiotlb: refactor swiotlb_tbl_map_single")
> > Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> 
> I think this is all good. Looking at Linus's master I see:
> 
> 
> 537         unsigned long max_slots = get_max_slots(boundary_mask);
> 
> ?

Thanks for the information, and sorry for that.

I found it in next-20210226:
567d877f9a7d ("swiotlb: refactor swiotlb_tbl_map_single")

And it has already fixed in next-20210301:
26a7e094783d ("swiotlb: refactor swiotlb_tbl_map_single")

$ git diff 567d877f9a7d..26a7e094783d
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index 381c24e..6962cb4 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -496,7 +496,7 @@ static int find_slots(struct device *dev, size_t alloc_size)
        unsigned long boundary_mask = dma_get_seg_boundary(dev);
        dma_addr_t tbl_dma_addr =
                phys_to_dma_unencrypted(dev, io_tlb_start) & boundary_mask;
-       unsigned int max_slots = get_max_slots(boundary_mask);
+       unsigned long max_slots = get_max_slots(boundary_mask);
        unsigned int nslots = nr_slots(alloc_size), stride = 1;
        unsigned int index, wrap, count = 0, i;
        unsigned long flags;

Thank you,

---
Best Regards,
Kunihiko Hayashi


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] swiotlb: Fix type of max_slot
@ 2021-03-03  4:33     ` Kunihiko Hayashi
  0 siblings, 0 replies; 6+ messages in thread
From: Kunihiko Hayashi @ 2021-03-03  4:33 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: linux-kernel, iommu, Robin Murphy, Christoph Hellwig, Jianxiong Gao

On Tue, 2 Mar 2021 15:20:08 -0500
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:

> On 3/2/21 12:21 PM, Kunihiko Hayashi wrote:
> > After the refactoring phase, the type of max_slot has changed from unsigned
> > long to unsigned int. The return type of the function get_max_slots() and
> > the 4th argument type of iommu_is_span_boundary() are different from the
> > type of max_slot. Finally, asserts BUG_ON in iommu_is_span_boundary().
> > > Cc: Christoph Hellwig <hch@lst.de>
> > Fixes: 567d877f9a7d ("swiotlb: refactor swiotlb_tbl_map_single")
> > Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> 
> I think this is all good. Looking at Linus's master I see:
> 
> 
> 537         unsigned long max_slots = get_max_slots(boundary_mask);
> 
> ?

Thanks for the information, and sorry for that.

I found it in next-20210226:
567d877f9a7d ("swiotlb: refactor swiotlb_tbl_map_single")

And it has already fixed in next-20210301:
26a7e094783d ("swiotlb: refactor swiotlb_tbl_map_single")

$ git diff 567d877f9a7d..26a7e094783d
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index 381c24e..6962cb4 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -496,7 +496,7 @@ static int find_slots(struct device *dev, size_t alloc_size)
        unsigned long boundary_mask = dma_get_seg_boundary(dev);
        dma_addr_t tbl_dma_addr =
                phys_to_dma_unencrypted(dev, io_tlb_start) & boundary_mask;
-       unsigned int max_slots = get_max_slots(boundary_mask);
+       unsigned long max_slots = get_max_slots(boundary_mask);
        unsigned int nslots = nr_slots(alloc_size), stride = 1;
        unsigned int index, wrap, count = 0, i;
        unsigned long flags;

Thank you,

---
Best Regards,
Kunihiko Hayashi

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-03-03 11:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-02 17:21 [PATCH] swiotlb: Fix type of max_slot Kunihiko Hayashi
2021-03-02 17:21 ` Kunihiko Hayashi
2021-03-02 20:20 ` Konrad Rzeszutek Wilk
2021-03-02 20:20   ` Konrad Rzeszutek Wilk
2021-03-03  4:33   ` Kunihiko Hayashi
2021-03-03  4:33     ` Kunihiko Hayashi

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.