mcctrl_get_per_thread_data: Un-inline
Change-Id: I881db244ca551b3ca232918cb0b4245776f17295 Fujitsu: POSTK_DEBUG_ARCH_DEP_56
This commit is contained in:
@ -453,40 +453,8 @@ void mcctrl_put_per_proc_data(struct mcctrl_per_proc_data *ppd);
|
|||||||
int mcctrl_add_per_thread_data(struct mcctrl_per_proc_data *ppd, void *data);
|
int mcctrl_add_per_thread_data(struct mcctrl_per_proc_data *ppd, void *data);
|
||||||
void mcctrl_put_per_thread_data_unsafe(struct mcctrl_per_thread_data *ptd);
|
void mcctrl_put_per_thread_data_unsafe(struct mcctrl_per_thread_data *ptd);
|
||||||
void mcctrl_put_per_thread_data(struct mcctrl_per_thread_data* ptd);
|
void mcctrl_put_per_thread_data(struct mcctrl_per_thread_data* ptd);
|
||||||
#ifdef POSTK_DEBUG_ARCH_DEP_56 /* Strange how to use inline declaration fix. */
|
struct mcctrl_per_thread_data *mcctrl_get_per_thread_data(struct mcctrl_per_proc_data *ppd,
|
||||||
static inline struct mcctrl_per_thread_data *mcctrl_get_per_thread_data(struct mcctrl_per_proc_data *ppd,
|
struct task_struct *task);
|
||||||
struct task_struct *task)
|
|
||||||
{
|
|
||||||
struct mcctrl_per_thread_data *ptd_iter, *ptd = NULL;
|
|
||||||
int hash = (((uint64_t)task >> 4) & MCCTRL_PER_THREAD_DATA_HASH_MASK);
|
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
/* Check if data for this thread exists */
|
|
||||||
write_lock_irqsave(&ppd->per_thread_data_hash_lock[hash], flags);
|
|
||||||
|
|
||||||
list_for_each_entry(ptd_iter, &ppd->per_thread_data_hash[hash], hash) {
|
|
||||||
if (ptd_iter->task == task) {
|
|
||||||
ptd = ptd_iter;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ptd) {
|
|
||||||
if (atomic_read(&ptd->refcount) <= 0) {
|
|
||||||
printk("%s: ERROR: use-after-free detected (%d)", __FUNCTION__, atomic_read(&ptd->refcount));
|
|
||||||
ptd = NULL;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
atomic_inc(&ptd->refcount);
|
|
||||||
}
|
|
||||||
|
|
||||||
out:
|
|
||||||
write_unlock_irqrestore(&ppd->per_thread_data_hash_lock[hash], flags);
|
|
||||||
return ptd;
|
|
||||||
}
|
|
||||||
#else /* POSTK_DEBUG_ARCH_DEP_56 */
|
|
||||||
inline struct mcctrl_per_thread_data *mcctrl_get_per_thread_data(struct mcctrl_per_proc_data *ppd, struct task_struct *task);
|
|
||||||
#endif /* POSTK_DEBUG_ARCH_DEP_56 */
|
|
||||||
int mcctrl_clear_pte_range(uintptr_t start, uintptr_t len);
|
int mcctrl_clear_pte_range(uintptr_t start, uintptr_t len);
|
||||||
|
|
||||||
void __return_syscall(ihk_os_t os, struct ikc_scd_packet *packet,
|
void __return_syscall(ihk_os_t os, struct ikc_scd_packet *packet,
|
||||||
|
|||||||
@ -178,8 +178,8 @@ int mcctrl_add_per_thread_data(struct mcctrl_per_proc_data *ppd, void *data)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef POSTK_DEBUG_ARCH_DEP_56 /* Strange how to use inline declaration fix. */
|
struct mcctrl_per_thread_data *mcctrl_get_per_thread_data(struct mcctrl_per_proc_data *ppd,
|
||||||
struct mcctrl_per_thread_data *mcctrl_get_per_thread_data(struct mcctrl_per_proc_data *ppd, struct task_struct *task)
|
struct task_struct *task)
|
||||||
{
|
{
|
||||||
struct mcctrl_per_thread_data *ptd_iter, *ptd = NULL;
|
struct mcctrl_per_thread_data *ptd_iter, *ptd = NULL;
|
||||||
int hash = (((uint64_t)task >> 4) & MCCTRL_PER_THREAD_DATA_HASH_MASK);
|
int hash = (((uint64_t)task >> 4) & MCCTRL_PER_THREAD_DATA_HASH_MASK);
|
||||||
@ -208,7 +208,6 @@ struct mcctrl_per_thread_data *mcctrl_get_per_thread_data(struct mcctrl_per_proc
|
|||||||
read_unlock_irqrestore(&ppd->per_thread_data_hash_lock[hash], flags);
|
read_unlock_irqrestore(&ppd->per_thread_data_hash_lock[hash], flags);
|
||||||
return ptd;
|
return ptd;
|
||||||
}
|
}
|
||||||
#endif /* !POSTK_DEBUG_ARCH_DEP_56 */
|
|
||||||
|
|
||||||
static int __notify_syscall_requester(ihk_os_t os, struct ikc_scd_packet *packet,
|
static int __notify_syscall_requester(ihk_os_t os, struct ikc_scd_packet *packet,
|
||||||
struct syscall_response *res)
|
struct syscall_response *res)
|
||||||
|
|||||||
Reference in New Issue
Block a user