* [PATCH UPSTREAM] xen-swiotlb: fix the check condition for xen_swiotlb_free_coherent
@ 2018-05-17 18:45 Joe Jin
2018-05-17 19:10 ` Greg KH
2018-05-17 19:10 ` Greg KH
0 siblings, 2 replies; 6+ messages in thread
From: Joe Jin @ 2018-05-17 18:45 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk, John Sobecki, linux-kernel@vger.kernel.org,
xen-devel@lists.xenproject.org
Cc: ASHISH_B_SRIVASTAVA, stable
When run raidconfig from Dom0 we found that the Xen DMA heap is reduced,
but Dom Heap is increased by the same size. Tracing raidconfig we found
that the related ioctl() in megaraid_sas will call dma_alloc_coherent()
to apply memory. If the memory allocated by Dom0 is not in the DMA area,
it will exchange memory with Xen to meet the requiment. Later drivers
call dma_free_coherent() to free the memory, on xen_swiotlb_free_coherent()
the check condition (dev_addr + size - 1 <= dma_mask) is always false,
it prevents calling xen_destroy_contiguous_region() to return the memory
to the Xen DMA heap.
This issue introduced by commit 6810df88dcfc2 "xen-swiotlb: When doing
coherent alloc/dealloc check before swizzling the MFNs.".
Signed-off-by: Joe Jin <joe.jin@oracle.com>
Tested-by: John Sobecki <john.sobecki@oracle.com>
Reviewed-by: Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: stable@vger.kernel.org
---
drivers/xen/swiotlb-xen.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
index e1c60899fdbc..a6f9ba85dc4b 100644
--- a/drivers/xen/swiotlb-xen.c
+++ b/drivers/xen/swiotlb-xen.c
@@ -351,7 +351,7 @@ xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr,
* physical address */
phys = xen_bus_to_phys(dev_addr);
- if (((dev_addr + size - 1 > dma_mask)) ||
+ if (((dev_addr + size - 1 <= dma_mask)) ||
range_straddles_page_boundary(phys, size))
xen_destroy_contiguous_region(phys, order);
--
2.14.3 (Apple Git-98)
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH UPSTREAM] xen-swiotlb: fix the check condition for xen_swiotlb_free_coherent
@ 2018-05-17 18:45 Joe Jin
0 siblings, 0 replies; 6+ messages in thread
From: Joe Jin @ 2018-05-17 18:45 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk, John Sobecki, linux-kernel@vger.kernel.org,
xen-devel@lists.xenproject.org
Cc: stable, ASHISH_B_SRIVASTAVA
When run raidconfig from Dom0 we found that the Xen DMA heap is reduced,
but Dom Heap is increased by the same size. Tracing raidconfig we found
that the related ioctl() in megaraid_sas will call dma_alloc_coherent()
to apply memory. If the memory allocated by Dom0 is not in the DMA area,
it will exchange memory with Xen to meet the requiment. Later drivers
call dma_free_coherent() to free the memory, on xen_swiotlb_free_coherent()
the check condition (dev_addr + size - 1 <= dma_mask) is always false,
it prevents calling xen_destroy_contiguous_region() to return the memory
to the Xen DMA heap.
This issue introduced by commit 6810df88dcfc2 "xen-swiotlb: When doing
coherent alloc/dealloc check before swizzling the MFNs.".
Signed-off-by: Joe Jin <joe.jin@oracle.com>
Tested-by: John Sobecki <john.sobecki@oracle.com>
Reviewed-by: Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: stable@vger.kernel.org
---
drivers/xen/swiotlb-xen.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
index e1c60899fdbc..a6f9ba85dc4b 100644
--- a/drivers/xen/swiotlb-xen.c
+++ b/drivers/xen/swiotlb-xen.c
@@ -351,7 +351,7 @@ xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr,
* physical address */
phys = xen_bus_to_phys(dev_addr);
- if (((dev_addr + size - 1 > dma_mask)) ||
+ if (((dev_addr + size - 1 <= dma_mask)) ||
range_straddles_page_boundary(phys, size))
xen_destroy_contiguous_region(phys, order);
--
2.14.3 (Apple Git-98)
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH UPSTREAM] xen-swiotlb: fix the check condition for xen_swiotlb_free_coherent
2018-05-17 18:45 [PATCH UPSTREAM] xen-swiotlb: fix the check condition for xen_swiotlb_free_coherent Joe Jin
@ 2018-05-17 19:10 ` Greg KH
2018-05-17 19:10 ` Greg KH
1 sibling, 0 replies; 6+ messages in thread
From: Greg KH @ 2018-05-17 19:10 UTC (permalink / raw)
To: Joe Jin
Cc: John Sobecki, linux-kernel@vger.kernel.org, stable,
xen-devel@lists.xenproject.org, ASHISH_B_SRIVASTAVA
On Thu, May 17, 2018 at 11:45:57AM -0700, Joe Jin wrote:
> When run raidconfig from Dom0 we found that the Xen DMA heap is reduced,
> but Dom Heap is increased by the same size. Tracing raidconfig we found
> that the related ioctl() in megaraid_sas will call dma_alloc_coherent()
> to apply memory. If the memory allocated by Dom0 is not in the DMA area,
> it will exchange memory with Xen to meet the requiment. Later drivers
> call dma_free_coherent() to free the memory, on xen_swiotlb_free_coherent()
> the check condition (dev_addr + size - 1 <= dma_mask) is always false,
> it prevents calling xen_destroy_contiguous_region() to return the memory
> to the Xen DMA heap.
>
> This issue introduced by commit 6810df88dcfc2 "xen-swiotlb: When doing
> coherent alloc/dealloc check before swizzling the MFNs.".
>
> Signed-off-by: Joe Jin <joe.jin@oracle.com>
> Tested-by: John Sobecki <john.sobecki@oracle.com>
> Reviewed-by: Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: stable@vger.kernel.org
> ---
> drivers/xen/swiotlb-xen.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
What does "PATCH UPSTREAM" mean?
confused,
greg k-h
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH UPSTREAM] xen-swiotlb: fix the check condition for xen_swiotlb_free_coherent
2018-05-17 18:45 [PATCH UPSTREAM] xen-swiotlb: fix the check condition for xen_swiotlb_free_coherent Joe Jin
2018-05-17 19:10 ` Greg KH
@ 2018-05-17 19:10 ` Greg KH
2018-05-17 19:32 ` Joe Jin
2018-05-17 19:32 ` Joe Jin
1 sibling, 2 replies; 6+ messages in thread
From: Greg KH @ 2018-05-17 19:10 UTC (permalink / raw)
To: Joe Jin
Cc: Konrad Rzeszutek Wilk, John Sobecki, linux-kernel@vger.kernel.org,
xen-devel@lists.xenproject.org, ASHISH_B_SRIVASTAVA, stable
On Thu, May 17, 2018 at 11:45:57AM -0700, Joe Jin wrote:
> When run raidconfig from Dom0 we found that the Xen DMA heap is reduced,
> but Dom Heap is increased by the same size. Tracing raidconfig we found
> that the related ioctl() in megaraid_sas will call dma_alloc_coherent()
> to apply memory. If the memory allocated by Dom0 is not in the DMA area,
> it will exchange memory with Xen to meet the requiment. Later drivers
> call dma_free_coherent() to free the memory, on xen_swiotlb_free_coherent()
> the check condition (dev_addr + size - 1 <= dma_mask) is always false,
> it prevents calling xen_destroy_contiguous_region() to return the memory
> to the Xen DMA heap.
>
> This issue introduced by commit 6810df88dcfc2 "xen-swiotlb: When doing
> coherent alloc/dealloc check before swizzling the MFNs.".
>
> Signed-off-by: Joe Jin <joe.jin@oracle.com>
> Tested-by: John Sobecki <john.sobecki@oracle.com>
> Reviewed-by: Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: stable@vger.kernel.org
> ---
> drivers/xen/swiotlb-xen.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
What does "PATCH UPSTREAM" mean?
confused,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH UPSTREAM] xen-swiotlb: fix the check condition for xen_swiotlb_free_coherent
2018-05-17 19:10 ` Greg KH
2018-05-17 19:32 ` Joe Jin
@ 2018-05-17 19:32 ` Joe Jin
1 sibling, 0 replies; 6+ messages in thread
From: Joe Jin @ 2018-05-17 19:32 UTC (permalink / raw)
To: Greg KH
Cc: John Sobecki, linux-kernel@vger.kernel.org, stable,
xen-devel@lists.xenproject.org, ASHISH_B_SRIVASTAVA
On 5/17/18 12:10 PM, Greg KH wrote:
> On Thu, May 17, 2018 at 11:45:57AM -0700, Joe Jin wrote:
>> When run raidconfig from Dom0 we found that the Xen DMA heap is reduced,
>> but Dom Heap is increased by the same size. Tracing raidconfig we found
>> that the related ioctl() in megaraid_sas will call dma_alloc_coherent()
>> to apply memory. If the memory allocated by Dom0 is not in the DMA area,
>> it will exchange memory with Xen to meet the requiment. Later drivers
>> call dma_free_coherent() to free the memory, on xen_swiotlb_free_coherent()
>> the check condition (dev_addr + size - 1 <= dma_mask) is always false,
>> it prevents calling xen_destroy_contiguous_region() to return the memory
>> to the Xen DMA heap.
>>
>> This issue introduced by commit 6810df88dcfc2 "xen-swiotlb: When doing
>> coherent alloc/dealloc check before swizzling the MFNs.".
>>
>> Signed-off-by: Joe Jin <joe.jin@oracle.com>
>> Tested-by: John Sobecki <john.sobecki@oracle.com>
>> Reviewed-by: Rzeszutek Wilk <konrad.wilk@oracle.com>
>> Cc: stable@vger.kernel.org
>> ---
>> drivers/xen/swiotlb-xen.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> What does "PATCH UPSTREAM" mean?
Oops I forgot to remove UPSTREAM, the tag for internal review.
Sorry for this, will resend it without the tag.
Thanks,
Joe
>
> confused,
>
> greg k-h
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH UPSTREAM] xen-swiotlb: fix the check condition for xen_swiotlb_free_coherent
2018-05-17 19:10 ` Greg KH
@ 2018-05-17 19:32 ` Joe Jin
2018-05-17 19:32 ` Joe Jin
1 sibling, 0 replies; 6+ messages in thread
From: Joe Jin @ 2018-05-17 19:32 UTC (permalink / raw)
To: Greg KH
Cc: Konrad Rzeszutek Wilk, John Sobecki, linux-kernel@vger.kernel.org,
xen-devel@lists.xenproject.org, ASHISH_B_SRIVASTAVA, stable
On 5/17/18 12:10 PM, Greg KH wrote:
> On Thu, May 17, 2018 at 11:45:57AM -0700, Joe Jin wrote:
>> When run raidconfig from Dom0 we found that the Xen DMA heap is reduced,
>> but Dom Heap is increased by the same size. Tracing raidconfig we found
>> that the related ioctl() in megaraid_sas will call dma_alloc_coherent()
>> to apply memory. If the memory allocated by Dom0 is not in the DMA area,
>> it will exchange memory with Xen to meet the requiment. Later drivers
>> call dma_free_coherent() to free the memory, on xen_swiotlb_free_coherent()
>> the check condition (dev_addr + size - 1 <= dma_mask) is always false,
>> it prevents calling xen_destroy_contiguous_region() to return the memory
>> to the Xen DMA heap.
>>
>> This issue introduced by commit 6810df88dcfc2 "xen-swiotlb: When doing
>> coherent alloc/dealloc check before swizzling the MFNs.".
>>
>> Signed-off-by: Joe Jin <joe.jin@oracle.com>
>> Tested-by: John Sobecki <john.sobecki@oracle.com>
>> Reviewed-by: Rzeszutek Wilk <konrad.wilk@oracle.com>
>> Cc: stable@vger.kernel.org
>> ---
>> drivers/xen/swiotlb-xen.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> What does "PATCH UPSTREAM" mean?
Oops I forgot to remove UPSTREAM, the tag for internal review.
Sorry for this, will resend it without the tag.
Thanks,
Joe
>
> confused,
>
> greg k-h
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-05-17 19:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-17 18:45 [PATCH UPSTREAM] xen-swiotlb: fix the check condition for xen_swiotlb_free_coherent Joe Jin
2018-05-17 19:10 ` Greg KH
2018-05-17 19:10 ` Greg KH
2018-05-17 19:32 ` Joe Jin
2018-05-17 19:32 ` Joe Jin
-- strict thread matches above, loose matches on Subject: below --
2018-05-17 18:45 Joe Jin
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.