ihk_ikc_recv: Record channel to packet for release

ihk_ikc_release_packet takes the channel and puts the packet into its
free-list.  This fix makes it easy and safe to identify the proper
channel.

Change-Id: I5584b1e8a3ed675c2f9d68f0b5ed331b909197f6
Fujitsu: POSTK_DEBUG_TEMP_FIX_89
This commit is contained in:
Masamichi Takagi
2018-10-19 18:07:26 +09:00
committed by Dominique Martinet
parent 10dc87dd3f
commit ae9a1f39df
7 changed files with 20 additions and 52 deletions

View File

@ -1120,11 +1120,7 @@ void mcctrl_put_per_proc_data(struct mcctrl_per_proc_data *ppd)
dprintk("%s: calling __return_syscall (hash),target pid=%d,tid=%d\n", __FUNCTION__, ppd->pid, packet->req.rtid);
__return_syscall(ppd->ud->os, packet, -ERESTARTSYS,
packet->req.rtid);
ihk_ikc_release_packet(
(struct ihk_ikc_free_packet *)packet,
(ppd->ud->ikc2linux[smp_processor_id()] ?
ppd->ud->ikc2linux[smp_processor_id()] :
ppd->ud->ikc2linux[0]));
ihk_ikc_release_packet((struct ihk_ikc_free_packet *)packet);
/* Note that uti ptd needs another put by mcexec_terminate_thread()
(see mcexec_syscall_wait()).
@ -1148,10 +1144,7 @@ void mcctrl_put_per_proc_data(struct mcctrl_per_proc_data *ppd)
* process is gone and the application should be terminated */
__return_syscall(ppd->ud->os, packet, -ERESTARTSYS,
packet->req.rtid);
ihk_ikc_release_packet((struct ihk_ikc_free_packet *)packet,
(ppd->ud->ikc2linux[smp_processor_id()] ?
ppd->ud->ikc2linux[smp_processor_id()] :
ppd->ud->ikc2linux[0]));
ihk_ikc_release_packet((struct ihk_ikc_free_packet *)packet);
}
ihk_ikc_spinlock_unlock(&ppd->wq_list_lock, flags);
@ -1176,10 +1169,7 @@ int mcexec_syscall(struct mcctrl_usrdata *ud, struct ikc_scd_packet *packet)
/* Handle requests that do not need the proxy process right now */
ret = __do_in_kernel_irq_syscall(ud->os, packet);
if (ret != -ENOSYS) {
ihk_ikc_release_packet((struct ihk_ikc_free_packet *)packet,
(ud->ikc2linux[smp_processor_id()] ?
ud->ikc2linux[smp_processor_id()] :
ud->ikc2linux[0]));
ihk_ikc_release_packet((struct ihk_ikc_free_packet *)packet);
return ret;
}
@ -1195,10 +1185,7 @@ int mcexec_syscall(struct mcctrl_usrdata *ud, struct ikc_scd_packet *packet)
* process is gone and the application should be terminated */
__return_syscall(ud->os, packet, -ERESTARTSYS,
packet->req.rtid);
ihk_ikc_release_packet((struct ihk_ikc_free_packet *)packet,
(ud->ikc2linux[smp_processor_id()] ?
ud->ikc2linux[smp_processor_id()] :
ud->ikc2linux[0]));
ihk_ikc_release_packet((struct ihk_ikc_free_packet *)packet);
return -1;
}
@ -1406,10 +1393,7 @@ retry_alloc:
task_tgid_vnr(current),
task_pid_vnr(current),
packet->req.number);
ihk_ikc_release_packet((struct ihk_ikc_free_packet *)packet,
(usrdata->ikc2linux[smp_processor_id()] ?
usrdata->ikc2linux[smp_processor_id()] :
usrdata->ikc2linux[0]));
ihk_ikc_release_packet((struct ihk_ikc_free_packet *)packet);
goto retry;
}
@ -1637,10 +1621,7 @@ long mcexec_ret_syscall(ihk_os_t os, struct syscall_ret_desc *__user arg)
error = 0;
out:
/* Free packet */
ihk_ikc_release_packet((struct ihk_ikc_free_packet *)packet,
(usrdata->ikc2linux[smp_processor_id()] ?
usrdata->ikc2linux[smp_processor_id()] :
usrdata->ikc2linux[0]));
ihk_ikc_release_packet((struct ihk_ikc_free_packet *)packet);
put_ppd_out:
/* Drop a reference for this function */
mcctrl_put_per_thread_data(ptd);
@ -2588,10 +2569,7 @@ static long mcexec_terminate_thread_unsafe(ihk_os_t os, int pid, int tid, long c
goto no_ptd;
}
__return_syscall(usrdata->os, packet, code, tid);
ihk_ikc_release_packet((struct ihk_ikc_free_packet *)packet,
(usrdata->ikc2linux[smp_processor_id()] ?
usrdata->ikc2linux[smp_processor_id()] :
usrdata->ikc2linux[0]));
ihk_ikc_release_packet((struct ihk_ikc_free_packet *)packet);
/* Drop reference for this function */
mcctrl_put_per_thread_data(ptd);

View File

@ -241,10 +241,7 @@ static int syscall_packet_handler(struct ihk_ikc_channel_desc *c,
* mcexec_ret_syscall(), for the rest, free it here.
*/
if (msg != SCD_MSG_SYSCALL_ONESIDE) {
ihk_ikc_release_packet((struct ihk_ikc_free_packet *)__packet,
(usrdata->ikc2linux[smp_processor_id()] ?
usrdata->ikc2linux[smp_processor_id()] :
usrdata->ikc2linux[0]));
ihk_ikc_release_packet((struct ihk_ikc_free_packet *)__packet);
}
return 0;
}
@ -253,7 +250,7 @@ static int dummy_packet_handler(struct ihk_ikc_channel_desc *c,
void *__packet, void *__os)
{
kprintf("%s: WARNING: packet received\n", __FUNCTION__);
ihk_ikc_release_packet((struct ihk_ikc_free_packet *)__packet, c);
ihk_ikc_release_packet((struct ihk_ikc_free_packet *)__packet);
return 0;
}

View File

@ -128,6 +128,7 @@ struct uti_futex_resp {
};
struct ikc_scd_packet {
struct ihk_ikc_packet_header header;
int msg;
int err;
void *reply;
@ -172,7 +173,7 @@ struct ikc_scd_packet {
int *spin_sleep; /* 1: waiting in linux_wait_event() 0: woken up by someone else */
} futex;
};
char padding[8];
/* char padding[8]; */ /* We want the size to be 128 bytes */
};

View File

@ -514,10 +514,7 @@ retry_alloc:
out:
/* Release packet sent from McKernel */
if (free_packet) {
ihk_ikc_release_packet((struct ihk_ikc_free_packet *)free_packet,
(usrdata->ikc2linux[smp_processor_id()] ?
usrdata->ikc2linux[smp_processor_id()] :
usrdata->ikc2linux[0]));
ihk_ikc_release_packet((struct ihk_ikc_free_packet *)free_packet);
}
ihk_device_unmap_virtual(ihk_os_to_dev(usrdata->os), resp, sizeof(*resp));
ihk_device_unmap_memory(ihk_os_to_dev(usrdata->os), phys, sizeof(*resp));
@ -744,10 +741,7 @@ retry_alloc:
out:
/* Release remote page-fault response packet */
if (free_packet) {
ihk_ikc_release_packet((struct ihk_ikc_free_packet *)free_packet,
(usrdata->ikc2linux[smp_processor_id()] ?
usrdata->ikc2linux[smp_processor_id()] :
usrdata->ikc2linux[0]));
ihk_ikc_release_packet((struct ihk_ikc_free_packet *)free_packet);
}
ihk_device_unmap_virtual(ihk_os_to_dev(usrdata->os), resp, sizeof(*resp));
@ -2297,7 +2291,6 @@ int __do_in_kernel_syscall(ihk_os_t os, struct ikc_scd_packet *packet)
struct syscall_request *sc = &packet->req;
int error;
long ret = -1;
struct mcctrl_usrdata *usrdata = ihk_host_os_get_usrdata(os);
dprintk("%s: system call: %lx\n", __FUNCTION__, sc->args[0]);
switch (sc->number) {
@ -2396,10 +2389,7 @@ sched_setparam_out:
}
__return_syscall(os, packet, ret, 0);
ihk_ikc_release_packet((struct ihk_ikc_free_packet *)packet,
(usrdata->ikc2linux[smp_processor_id()] ?
usrdata->ikc2linux[smp_processor_id()] :
usrdata->ikc2linux[0]));
ihk_ikc_release_packet((struct ihk_ikc_free_packet *)packet);
error = 0;
out: