mcctrl: convert send_signal to mcctrl_ihk_send_wait
Change-Id: Ibd2fc834444d83341a96579f0c9c22080a53e8fa
This commit is contained in:
@ -476,25 +476,33 @@ out:
|
|||||||
|
|
||||||
static DECLARE_WAIT_QUEUE_HEAD(signalq);
|
static DECLARE_WAIT_QUEUE_HEAD(signalq);
|
||||||
|
|
||||||
|
struct mcctrl_signal_desc {
|
||||||
|
struct mcctrl_signal msig;
|
||||||
|
struct mcctrl_wakeup_desc wakeup;
|
||||||
|
void *addrs[1];
|
||||||
|
};
|
||||||
|
|
||||||
static long mcexec_send_signal(ihk_os_t os, struct signal_desc *sigparam)
|
static long mcexec_send_signal(ihk_os_t os, struct signal_desc *sigparam)
|
||||||
{
|
{
|
||||||
struct ikc_scd_packet isp;
|
struct ikc_scd_packet isp;
|
||||||
struct mcctrl_channel *c;
|
struct mcctrl_channel *c;
|
||||||
struct mcctrl_usrdata *usrdata = ihk_host_os_get_usrdata(os);
|
struct mcctrl_usrdata *usrdata = ihk_host_os_get_usrdata(os);
|
||||||
struct signal_desc sig;
|
struct signal_desc sig;
|
||||||
struct mcctrl_signal msig[2];
|
struct mcctrl_signal_desc *desc;
|
||||||
struct mcctrl_signal *msigp;
|
struct mcctrl_signal *msigp;
|
||||||
int rc;
|
int rc, do_free;
|
||||||
|
|
||||||
if (copy_from_user(&sig, sigparam, sizeof(struct signal_desc))) {
|
if (copy_from_user(&sig, sigparam, sizeof(struct signal_desc))) {
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
msigp = msig;
|
desc = kmalloc(sizeof(*desc), GFP_KERNEL);
|
||||||
if(((unsigned long)msig & 0xfffffffffffff000L) !=
|
if (!desc) {
|
||||||
((unsigned long)(msig + 1) & 0xfffffffffffff000L))
|
return -ENOMEM;
|
||||||
msigp++;
|
}
|
||||||
memset(msigp, '\0', sizeof msig);
|
|
||||||
|
msigp = &desc->msig;
|
||||||
|
memset(msigp, '\0', sizeof(*msigp));
|
||||||
msigp->sig = sig.sig;
|
msigp->sig = sig.sig;
|
||||||
msigp->pid = sig.pid;
|
msigp->pid = sig.pid;
|
||||||
msigp->tid = sig.tid;
|
msigp->tid = sig.tid;
|
||||||
@ -506,25 +514,19 @@ static long mcexec_send_signal(ihk_os_t os, struct signal_desc *sigparam)
|
|||||||
isp.pid = sig.pid;
|
isp.pid = sig.pid;
|
||||||
isp.arg = virt_to_phys(msigp);
|
isp.arg = virt_to_phys(msigp);
|
||||||
|
|
||||||
if ((rc = mcctrl_ikc_send(os, sig.cpu, &isp)) < 0) {
|
rc = mcctrl_ikc_send_wait(os, sig.cpu, &isp, 0, &desc->wakeup,
|
||||||
|
&do_free, 1, desc);
|
||||||
|
if (rc < 0) {
|
||||||
printk("mcexec_send_signal: mcctrl_ikc_send ret=%d\n", rc);
|
printk("mcexec_send_signal: mcctrl_ikc_send ret=%d\n", rc);
|
||||||
|
if (do_free)
|
||||||
|
kfree(desc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
wait_event_interruptible(signalq, msigp->cond != 0);
|
|
||||||
|
|
||||||
|
kfree(desc);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
sig_done(unsigned long arg, int err)
|
|
||||||
{
|
|
||||||
struct mcctrl_signal *msigp;
|
|
||||||
|
|
||||||
msigp = phys_to_virt(arg);
|
|
||||||
msigp->cond = 1;
|
|
||||||
wake_up_interruptible(&signalq);
|
|
||||||
}
|
|
||||||
|
|
||||||
static long mcexec_get_cpu(ihk_os_t os)
|
static long mcexec_get_cpu(ihk_os_t os)
|
||||||
{
|
{
|
||||||
struct ihk_cpu_info *info;
|
struct ihk_cpu_info *info;
|
||||||
|
|||||||
@ -106,6 +106,7 @@ int mcctrl_ikc_send_wait(ihk_os_t os, int cpu, struct ikc_scd_packet *pisp,
|
|||||||
int alloc_desc = (desc == NULL);
|
int alloc_desc = (desc == NULL);
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
if (free_addrs_count)
|
||||||
*do_frees = 1;
|
*do_frees = 1;
|
||||||
if (alloc_desc)
|
if (alloc_desc)
|
||||||
desc = kmalloc(sizeof(struct mcctrl_wakeup_desc) +
|
desc = kmalloc(sizeof(struct mcctrl_wakeup_desc) +
|
||||||
@ -153,6 +154,7 @@ int mcctrl_ikc_send_wait(ihk_os_t os, int cpu, struct ikc_scd_packet *pisp,
|
|||||||
spin_lock_irqsave(&usrdata->wakeup_descs_lock, flags);
|
spin_lock_irqsave(&usrdata->wakeup_descs_lock, flags);
|
||||||
list_add(&desc->chain, &usrdata->wakeup_descs_list);
|
list_add(&desc->chain, &usrdata->wakeup_descs_list);
|
||||||
spin_unlock_irqrestore(&usrdata->wakeup_descs_lock, flags);
|
spin_unlock_irqrestore(&usrdata->wakeup_descs_lock, flags);
|
||||||
|
if (free_addrs_count)
|
||||||
*do_frees = 0;
|
*do_frees = 0;
|
||||||
return ret < 0 ? ret : -ETIME;
|
return ret < 0 ? ret : -ETIME;
|
||||||
}
|
}
|
||||||
@ -179,6 +181,7 @@ static int syscall_packet_handler(struct ihk_ikc_channel_desc *c,
|
|||||||
|
|
||||||
case SCD_MSG_PREPARE_PROCESS_ACKED:
|
case SCD_MSG_PREPARE_PROCESS_ACKED:
|
||||||
case SCD_MSG_PERF_ACK:
|
case SCD_MSG_PERF_ACK:
|
||||||
|
case SCD_MSG_SEND_SIGNAL_ACK:
|
||||||
mcctrl_wakeup_cb(__os, pisp);
|
mcctrl_wakeup_cb(__os, pisp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -190,9 +193,6 @@ static int syscall_packet_handler(struct ihk_ikc_channel_desc *c,
|
|||||||
procfs_answer(usrdata, pisp->pid);
|
procfs_answer(usrdata, pisp->pid);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCD_MSG_SEND_SIGNAL:
|
|
||||||
sig_done(pisp->arg, pisp->err);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCD_MSG_SYSFS_REQ_CREATE:
|
case SCD_MSG_SYSFS_REQ_CREATE:
|
||||||
case SCD_MSG_SYSFS_REQ_MKDIR:
|
case SCD_MSG_SYSFS_REQ_MKDIR:
|
||||||
|
|||||||
@ -55,7 +55,8 @@
|
|||||||
#define SCD_MSG_INIT_CHANNEL_ACKED 0x6
|
#define SCD_MSG_INIT_CHANNEL_ACKED 0x6
|
||||||
|
|
||||||
#define SCD_MSG_SYSCALL_ONESIDE 0x4
|
#define SCD_MSG_SYSCALL_ONESIDE 0x4
|
||||||
#define SCD_MSG_SEND_SIGNAL 0x8
|
#define SCD_MSG_SEND_SIGNAL 0x7
|
||||||
|
#define SCD_MSG_SEND_SIGNAL_ACK 0x8
|
||||||
#define SCD_MSG_CLEANUP_PROCESS 0x9
|
#define SCD_MSG_CLEANUP_PROCESS 0x9
|
||||||
#define SCD_MSG_GET_VDSO_INFO 0xa
|
#define SCD_MSG_GET_VDSO_INFO 0xa
|
||||||
|
|
||||||
|
|||||||
@ -655,10 +655,11 @@ static int syscall_packet_handler(struct ihk_ikc_channel_desc *c,
|
|||||||
memcpy(&info, sp, sizeof(struct mcctrl_signal));
|
memcpy(&info, sp, sizeof(struct mcctrl_signal));
|
||||||
ihk_mc_unmap_virtual(sp, 1, 0);
|
ihk_mc_unmap_virtual(sp, 1, 0);
|
||||||
ihk_mc_unmap_memory(NULL, pp, sizeof(struct mcctrl_signal));
|
ihk_mc_unmap_memory(NULL, pp, sizeof(struct mcctrl_signal));
|
||||||
pckt.msg = SCD_MSG_SEND_SIGNAL;
|
pckt.msg = SCD_MSG_SEND_SIGNAL_ACK;
|
||||||
pckt.err = 0;
|
pckt.err = 0;
|
||||||
pckt.ref = packet->ref;
|
pckt.ref = packet->ref;
|
||||||
pckt.arg = packet->arg;
|
pckt.arg = packet->arg;
|
||||||
|
pckt.reply = packet->reply;
|
||||||
syscall_channel_send(resp_channel, &pckt);
|
syscall_channel_send(resp_channel, &pckt);
|
||||||
|
|
||||||
rc = do_kill(NULL, info.pid, info.tid, info.sig, &info.info, 0);
|
rc = do_kill(NULL, info.pid, info.tid, info.sig, &info.info, 0);
|
||||||
|
|||||||
@ -37,7 +37,8 @@
|
|||||||
#define SCD_MSG_INIT_CHANNEL_ACKED 0x6
|
#define SCD_MSG_INIT_CHANNEL_ACKED 0x6
|
||||||
|
|
||||||
#define SCD_MSG_SYSCALL_ONESIDE 0x4
|
#define SCD_MSG_SYSCALL_ONESIDE 0x4
|
||||||
#define SCD_MSG_SEND_SIGNAL 0x8
|
#define SCD_MSG_SEND_SIGNAL 0x7
|
||||||
|
#define SCD_MSG_SEND_SIGNAL_ACK 0x8
|
||||||
#define SCD_MSG_CLEANUP_PROCESS 0x9
|
#define SCD_MSG_CLEANUP_PROCESS 0x9
|
||||||
#define SCD_MSG_GET_VDSO_INFO 0xa
|
#define SCD_MSG_GET_VDSO_INFO 0xa
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user