Re: [PATCH 1/2] powerpc: export thread-tidr interfaces

From: Frederic Barrat
Date: Wed Jan 17 2018 - 01:45:54 EST


Hi,


diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 2010e4c..f20c1ad 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1560,6 +1560,7 @@ void clear_thread_tidr(struct task_struct *t)
free_thread_tidr(t->thread.tidr);
t->thread.tidr = 0;
}
+EXPORT_SYMBOL_GPL(clear_thread_tidr);

Isn't it dangerous to export clear_thread_tidr()? Other modules may also have assigned the TIDR by calling set_thread_tidr(), so clearing it could potentially break those other modules. My understanding is that once the TIDR is assigned, there's no safe way to reclaim it other than the thread exiting. Or we would need some kind of reference counter.


void arch_release_task_struct(struct task_struct *t)
{
@@ -1592,6 +1593,7 @@ int set_thread_tidr(struct task_struct *t)

return 0;
}
+EXPORT_SYMBOL_GPL(set_thread_tidr);


FYI, there's a capi patch we hope to merge soon which is also doing this:
http://patchwork.ozlabs.org/patch/858935/

Fred