mcctrl: refactor prepare_image into new generic ikc send&wait
Many ikc messages expecting a reply use wait_event_interruptible incorrectly, freeing memory that could still be used on the other side. This commit implements a generic ikc send and wait helper that helps with memory management and ownership properly: - if the message succeeds and a reply comes back normally, the memory is freed by the caller as usual - if the wait fails (signal before the reply comes or timeout) then the memory is set as owner by ikc and will be free when the reply comes back later - if the reply never comes, the memory is freed at shutdown when destroying ikc channels Refs: #1076 Change-Id: I7f348d9029a6ad56ba9a50c836105ec39fa14943
This commit is contained in:
committed by
Masamichi Takagi
parent
ec202a1ca9
commit
b939ca9370
@ -597,14 +597,9 @@ static int syscall_packet_handler(struct ihk_ikc_channel_desc *c,
|
||||
|
||||
case SCD_MSG_PREPARE_PROCESS:
|
||||
|
||||
if((rc = process_msg_prepare_process(packet->arg)) == 0){
|
||||
pckt.msg = SCD_MSG_PREPARE_PROCESS_ACKED;
|
||||
pckt.err = 0;
|
||||
}
|
||||
else{
|
||||
pckt.msg = SCD_MSG_PREPARE_PROCESS_NACKED;
|
||||
pckt.err = rc;
|
||||
}
|
||||
pckt.err = process_msg_prepare_process(packet->arg);
|
||||
pckt.msg = SCD_MSG_PREPARE_PROCESS_ACKED;
|
||||
pckt.reply = packet->reply;
|
||||
pckt.ref = packet->ref;
|
||||
pckt.arg = packet->arg;
|
||||
syscall_channel_send(resp_channel, &pckt);
|
||||
|
||||
Reference in New Issue
Block a user