Thread (60 messages) 60 messages, 9 authors, 2016-10-18

Re: [PATCH kernel 05/15] powerpc/iommu: Stop using @current in mm_iommu_xxx

flat view

From: Nicholas Piggin <hidden>
Date: 2016-08-09 06:04:58

On Tue, 9 Aug 2016 14:43:00 +1000
Balbir Singh [off-list ref] wrote:
On 03/08/16 18:40, Alexey Kardashevskiy wrote:
quoted
-long mm_iommu_get(unsigned long ua, unsigned long entries,
+long mm_iommu_get(struct mm_struct *mm, unsigned long ua, unsigned long entries,
 		struct mm_iommu_table_group_mem_t **pmem)
 {
 	struct mm_iommu_table_group_mem_t *mem;
 	long i, j, ret = 0, locked_entries = 0;
 	struct page *page = NULL;
 
-	if (!current || !current->mm)
-		return -ESRCH; /* process exited */  
VM_BUG_ON(mm == NULL)?
quoted
@@ -128,10 +129,17 @@ static long tce_iommu_register_pages(struct tce_container *container,
 			((vaddr + size) < vaddr))
 		return -EINVAL;
 
-	ret = mm_iommu_get(vaddr, entries, &mem);
+	if (!container->mm) {
+		if (!current->mm)
+			return -ESRCH; /* process exited */  
You may even want to check for PF_EXITING and ignore those tasks?

These are related to some of the questions I had about the patch.

But I think it makes sense just to take this approach as a minimal
bug fix without changing logic too much or adding BUG_ONs, and then
if we we can consider how iommu takes references to mm and uses it
(if anybody finds the time).

Thanks,
Nick
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help