uti: futex: McKernel waker sends IPI to Linux waiter CPU
Change-Id: I6f725b3a6b1b26b9f553d8c58132c0c0a4416683
This commit is contained in:
@ -813,6 +813,7 @@ static int futex_wait(uint32_t __user *uaddr, int fshared,
|
|||||||
q->bitset = bitset;
|
q->bitset = bitset;
|
||||||
q->requeue_pi_key = NULL;
|
q->requeue_pi_key = NULL;
|
||||||
q->uti_futex_resp = uti_info->uti_futex_resp;
|
q->uti_futex_resp = uti_info->uti_futex_resp;
|
||||||
|
q->linux_cpu = ihk_ikc_get_processor_id();
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
/* Prepare to wait on uaddr. */
|
/* Prepare to wait on uaddr. */
|
||||||
|
|||||||
@ -140,6 +140,9 @@ struct futex_q {
|
|||||||
/* Used to wake-up a thread running on a Linux CPU */
|
/* Used to wake-up a thread running on a Linux CPU */
|
||||||
void *uti_futex_resp;
|
void *uti_futex_resp;
|
||||||
|
|
||||||
|
/* Used to send IPI directly to the waiter CPU */
|
||||||
|
int linux_cpu;
|
||||||
|
|
||||||
/* Used to wake-up a thread running on a McKernel from Linux */
|
/* Used to wake-up a thread running on a McKernel from Linux */
|
||||||
void *th_spin_sleep;
|
void *th_spin_sleep;
|
||||||
void *th_status;
|
void *th_status;
|
||||||
|
|||||||
@ -73,12 +73,15 @@
|
|||||||
#include <ihk/debug.h>
|
#include <ihk/debug.h>
|
||||||
#include <syscall.h>
|
#include <syscall.h>
|
||||||
#include <kmalloc.h>
|
#include <kmalloc.h>
|
||||||
|
#include <ikc/queue.h>
|
||||||
|
|
||||||
|
|
||||||
unsigned long ihk_mc_get_ns_per_tsc(void);
|
unsigned long ihk_mc_get_ns_per_tsc(void);
|
||||||
|
|
||||||
struct futex_hash_bucket *futex_queues;
|
struct futex_hash_bucket *futex_queues;
|
||||||
|
|
||||||
|
extern struct ihk_ikc_channel_desc **ikc2linuxs;
|
||||||
|
|
||||||
struct futex_hash_bucket *get_futex_queues(void)
|
struct futex_hash_bucket *get_futex_queues(void)
|
||||||
{
|
{
|
||||||
return futex_queues;
|
return futex_queues;
|
||||||
@ -238,11 +241,19 @@ static void wake_futex(struct futex_q *q)
|
|||||||
|
|
||||||
if (q->uti_futex_resp) {
|
if (q->uti_futex_resp) {
|
||||||
int rc;
|
int rc;
|
||||||
dkprintf("%s: waking up migrated-to-Linux thread (tid %d),uti_futex_resp=%p\n",
|
|
||||||
__func__, p->tid, q->uti_futex_resp);
|
|
||||||
|
|
||||||
struct ikc_scd_packet pckt;
|
struct ikc_scd_packet pckt;
|
||||||
struct ihk_ikc_channel_desc *resp_channel = cpu_local_var(ikc2linux);
|
struct ihk_ikc_channel_desc *resp_channel;
|
||||||
|
|
||||||
|
dkprintf("%s: waking up migrated-to-Linux thread (tid %d),uti_futex_resp=%p,linux_cpu: %d\n",
|
||||||
|
__func__, p->tid, q->uti_futex_resp, q->linux_cpu);
|
||||||
|
|
||||||
|
/* does this Linux CPU have a connected channel? */
|
||||||
|
if (ikc2linuxs[q->linux_cpu]) {
|
||||||
|
resp_channel = ikc2linuxs[q->linux_cpu];
|
||||||
|
} else {
|
||||||
|
resp_channel = cpu_local_var(ikc2linux);
|
||||||
|
}
|
||||||
|
|
||||||
pckt.msg = SCD_MSG_FUTEX_WAKE;
|
pckt.msg = SCD_MSG_FUTEX_WAKE;
|
||||||
pckt.futex.resp = q->uti_futex_resp;
|
pckt.futex.resp = q->uti_futex_resp;
|
||||||
pckt.futex.spin_sleep = &p->spin_sleep;
|
pckt.futex.spin_sleep = &p->spin_sleep;
|
||||||
|
|||||||
@ -43,7 +43,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Linux channel table, indexec by Linux CPU id */
|
/* Linux channel table, indexec by Linux CPU id */
|
||||||
static struct ihk_ikc_channel_desc **ikc2linuxs = NULL;
|
struct ihk_ikc_channel_desc **ikc2linuxs;
|
||||||
|
|
||||||
void check_mapping_for_proc(struct thread *thread, unsigned long addr)
|
void check_mapping_for_proc(struct thread *thread, unsigned long addr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -216,6 +216,9 @@ struct futex_q {
|
|||||||
/* Used to wake-up a thread running on a Linux CPU */
|
/* Used to wake-up a thread running on a Linux CPU */
|
||||||
void *uti_futex_resp;
|
void *uti_futex_resp;
|
||||||
|
|
||||||
|
/* Used to send IPI directly to the waiter CPU */
|
||||||
|
int linux_cpu;
|
||||||
|
|
||||||
/* Used to wake-up a thread running on a McKernel from Linux */
|
/* Used to wake-up a thread running on a McKernel from Linux */
|
||||||
void *th_spin_sleep;
|
void *th_spin_sleep;
|
||||||
void *th_status;
|
void *th_status;
|
||||||
|
|||||||
Reference in New Issue
Block a user