linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 01/25] mm: Add kfd_process pointer to mm_struct
       [not found] <1405603773-32688-1-git-send-email-oded.gabbay@amd.com>
@ 2014-07-17 13:57 ` Oded Gabbay
  2014-07-17 14:12   ` Jerome Glisse
  0 siblings, 1 reply; 3+ messages in thread
From: Oded Gabbay @ 2014-07-17 13:57 UTC (permalink / raw)
  To: David Airlie, Jerome Glisse, Alex Deucher, Andrew Morton
  Cc: John Bridgman, Joerg Roedel, Andrew Lewycky, Christian König,
	Michel Dänzer, Ben Goz, Alexey Skidanov, Evgeny Pinchuk,
	Oded Gabbay, Kirill A. Shutemov, Rik van Riel, Peter Zijlstra,
	Mel Gorman, Joonsoo Kim, Jérôme Glisse, linux-kernel,
	linux-mm

Forgot to add mm mailing list. Sorry.

This patch enables the amdkfd driver to retrieve the kfd_process
object from the process's mm_struct. This is needed because kfd_process
lifespan is bound to the process's mm_struct lifespan.

When amdkfd is notified about an mm_struct tear-down, it checks if the
kfd_process pointer is valid. If so, it releases the kfd_process object
and all relevant resources.

In v3 of the patchset I will update the binding to match the final discussions
on [PATCH 1/8] mmput: use notifier chain to call subsystem exit handler.
In the meantime, I'm going to try and see if I can drop the kfd_process
in mm_struct and remove the use of the new notification chain in mmput.
Instead, I will try to use the mmu release notifier.

Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
---
  include/linux/mm_types.h | 14 ++++++++++++++
  1 file changed, 14 insertions(+)

diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 678097c..ff71496 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -20,6 +20,10 @@
  struct hmm;
  #endif
  +#if defined(CONFIG_HSA_RADEON) || defined(CONFIG_HSA_RADEON_MODULE)
+struct kfd_process;
+#endif
+
  #ifndef AT_VECTOR_SIZE_ARCH
  #define AT_VECTOR_SIZE_ARCH 0
  #endif
@@ -439,6 +443,16 @@ struct mm_struct {
  	 */
  	struct hmm *hmm;
  #endif
+#if defined(CONFIG_HSA_RADEON) || defined(CONFIG_HSA_RADEON_MODULE)
+	/*
+	 * kfd always register an mmu_notifier we rely on mmu notifier to keep
+	 * refcount on mm struct as well as forbiding registering kfd on a
+	 * dying mm
+	 *
+	 * This field is set with mmap_sem old in write mode.
+	 */
+	struct kfd_process *kfd_process;
+#endif
  #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS
  	pgtable_t pmd_huge_pte; /* protected by page_table_lock */
  #endif
-- 
1.9.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH v2 01/25] mm: Add kfd_process pointer to mm_struct
  2014-07-17 13:57 ` [PATCH v2 01/25] mm: Add kfd_process pointer to mm_struct Oded Gabbay
@ 2014-07-17 14:12   ` Jerome Glisse
  2014-07-17 14:15     ` Oded Gabbay
  0 siblings, 1 reply; 3+ messages in thread
From: Jerome Glisse @ 2014-07-17 14:12 UTC (permalink / raw)
  To: Oded Gabbay
  Cc: David Airlie, Alex Deucher, Andrew Morton, John Bridgman,
	Joerg Roedel, Andrew Lewycky, Christian König,
	Michel Dänzer, Ben Goz, Alexey Skidanov, Evgeny Pinchuk,
	Kirill A. Shutemov, Rik van Riel, Peter Zijlstra, Mel Gorman,
	Joonsoo Kim, Jérôme Glisse, linux-kernel, linux-mm

On Thu, Jul 17, 2014 at 04:57:58PM +0300, Oded Gabbay wrote:
> Forgot to add mm mailing list. Sorry.
> 
> This patch enables the amdkfd driver to retrieve the kfd_process
> object from the process's mm_struct. This is needed because kfd_process
> lifespan is bound to the process's mm_struct lifespan.
> 
> When amdkfd is notified about an mm_struct tear-down, it checks if the
> kfd_process pointer is valid. If so, it releases the kfd_process object
> and all relevant resources.
> 
> In v3 of the patchset I will update the binding to match the final discussions
> on [PATCH 1/8] mmput: use notifier chain to call subsystem exit handler.
> In the meantime, I'm going to try and see if I can drop the kfd_process
> in mm_struct and remove the use of the new notification chain in mmput.
> Instead, I will try to use the mmu release notifier.

So the mmput notifier chain will not happen. I did a patch with call_srcu
and adding couple more helper to mmu_notifier. I will send that today for
review.

That being said, adding a device driver specific to mm_struct will most
likely be a big no. I am myself gonna remove hmm from mm_struct as people
are reluctant to see such change.

Cheers,
Jerome


> 
> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
> ---
>  include/linux/mm_types.h | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> index 678097c..ff71496 100644
> --- a/include/linux/mm_types.h
> +++ b/include/linux/mm_types.h
> @@ -20,6 +20,10 @@
>  struct hmm;
>  #endif
>  +#if defined(CONFIG_HSA_RADEON) || defined(CONFIG_HSA_RADEON_MODULE)
> +struct kfd_process;
> +#endif
> +
>  #ifndef AT_VECTOR_SIZE_ARCH
>  #define AT_VECTOR_SIZE_ARCH 0
>  #endif
> @@ -439,6 +443,16 @@ struct mm_struct {
>  	 */
>  	struct hmm *hmm;
>  #endif
> +#if defined(CONFIG_HSA_RADEON) || defined(CONFIG_HSA_RADEON_MODULE)
> +	/*
> +	 * kfd always register an mmu_notifier we rely on mmu notifier to keep
> +	 * refcount on mm struct as well as forbiding registering kfd on a
> +	 * dying mm
> +	 *
> +	 * This field is set with mmap_sem old in write mode.
> +	 */
> +	struct kfd_process *kfd_process;
> +#endif
>  #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS
>  	pgtable_t pmd_huge_pte; /* protected by page_table_lock */
>  #endif
> -- 
> 1.9.1
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH v2 01/25] mm: Add kfd_process pointer to mm_struct
  2014-07-17 14:12   ` Jerome Glisse
@ 2014-07-17 14:15     ` Oded Gabbay
  0 siblings, 0 replies; 3+ messages in thread
From: Oded Gabbay @ 2014-07-17 14:15 UTC (permalink / raw)
  To: Jerome Glisse
  Cc: David Airlie, Alex Deucher, Andrew Morton, John Bridgman,
	Joerg Roedel, Andrew Lewycky, Christian König,
	Michel Dänzer, Ben Goz, Alexey Skidanov, Evgeny Pinchuk,
	Kirill A. Shutemov, Rik van Riel, Peter Zijlstra, Mel Gorman,
	Joonsoo Kim, Jérôme Glisse, linux-kernel, linux-mm

On 17/07/14 17:12, Jerome Glisse wrote:
> On Thu, Jul 17, 2014 at 04:57:58PM +0300, Oded Gabbay wrote:
>> Forgot to add mm mailing list. Sorry.
>>
>> This patch enables the amdkfd driver to retrieve the kfd_process
>> object from the process's mm_struct. This is needed because kfd_process
>> lifespan is bound to the process's mm_struct lifespan.
>>
>> When amdkfd is notified about an mm_struct tear-down, it checks if the
>> kfd_process pointer is valid. If so, it releases the kfd_process object
>> and all relevant resources.
>>
>> In v3 of the patchset I will update the binding to match the final discussions
>> on [PATCH 1/8] mmput: use notifier chain to call subsystem exit handler.
>> In the meantime, I'm going to try and see if I can drop the kfd_process
>> in mm_struct and remove the use of the new notification chain in mmput.
>> Instead, I will try to use the mmu release notifier.
>
> So the mmput notifier chain will not happen. I did a patch with call_srcu
> and adding couple more helper to mmu_notifier. I will send that today for
> review.
>
> That being said, adding a device driver specific to mm_struct will most
> likely be a big no. I am myself gonna remove hmm from mm_struct as people
> are reluctant to see such change.
>
> Cheers,
> Jérôme
>
Yes, I followed that email thread and you can see that in the commit message I 
referred to it (saying that in v3 of the patchset I'm also going to use 
mmu_notifier). I will take your patch once you publish it and use it to change 
amdkfd behavior.

	Oded
>
>>
>> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
>> ---
>>   include/linux/mm_types.h | 14 ++++++++++++++
>>   1 file changed, 14 insertions(+)
>>
>> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
>> index 678097c..ff71496 100644
>> --- a/include/linux/mm_types.h
>> +++ b/include/linux/mm_types.h
>> @@ -20,6 +20,10 @@
>>   struct hmm;
>>   #endif
>>   +#if defined(CONFIG_HSA_RADEON) || defined(CONFIG_HSA_RADEON_MODULE)
>> +struct kfd_process;
>> +#endif
>> +
>>   #ifndef AT_VECTOR_SIZE_ARCH
>>   #define AT_VECTOR_SIZE_ARCH 0
>>   #endif
>> @@ -439,6 +443,16 @@ struct mm_struct {
>>   	 */
>>   	struct hmm *hmm;
>>   #endif
>> +#if defined(CONFIG_HSA_RADEON) || defined(CONFIG_HSA_RADEON_MODULE)
>> +	/*
>> +	 * kfd always register an mmu_notifier we rely on mmu notifier to keep
>> +	 * refcount on mm struct as well as forbiding registering kfd on a
>> +	 * dying mm
>> +	 *
>> +	 * This field is set with mmap_sem old in write mode.
>> +	 */
>> +	struct kfd_process *kfd_process;
>> +#endif
>>   #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS
>>   	pgtable_t pmd_huge_pte; /* protected by page_table_lock */
>>   #endif
>> --
>> 1.9.1
>>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2014-07-17 14:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1405603773-32688-1-git-send-email-oded.gabbay@amd.com>
2014-07-17 13:57 ` [PATCH v2 01/25] mm: Add kfd_process pointer to mm_struct Oded Gabbay
2014-07-17 14:12   ` Jerome Glisse
2014-07-17 14:15     ` Oded Gabbay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).