From 5f973ab51e4df39c2f4204ddeb82c714ea4990f5 Mon Sep 17 00:00:00 2001 From: Balazs Gerofi Date: Mon, 24 Oct 2016 20:32:52 +0900 Subject: [PATCH] IKC2: adjust master channel message queue size dynamically Determine master channel's message queue size based on the number of LWK CPUs so that all cores can communicate simultaneously during syscall channel initialization. --- arch/x86/kernel/mikc.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/arch/x86/kernel/mikc.c b/arch/x86/kernel/mikc.c index 410d2f02..8b68ae6e 100644 --- a/arch/x86/kernel/mikc.c +++ b/arch/x86/kernel/mikc.c @@ -16,6 +16,7 @@ #include #include +extern int num_processors; extern void arch_set_mikc_queue(void *r, void *w); ihk_ikc_ph_t arch_master_channel_packet_handler; @@ -23,17 +24,23 @@ int ihk_mc_ikc_init_first_local(struct ihk_ikc_channel_desc *channel, ihk_ikc_ph_t packet_handler) { struct ihk_ikc_queue_head *rq, *wq; + size_t mikc_queue_pages; ihk_ikc_system_init(NULL); memset(channel, 0, sizeof(struct ihk_ikc_channel_desc)); - /* Place both sides in this side */ - rq = ihk_mc_alloc_pages(1, IHK_MC_AP_CRITICAL); - wq = ihk_mc_alloc_pages(1, IHK_MC_AP_CRITICAL); + mikc_queue_pages = ((num_processors * MASTER_IKCQ_PKTSIZE) + + (PAGE_SIZE - 1)) / PAGE_SIZE; - ihk_ikc_init_queue(rq, 0, 0, PAGE_SIZE, MASTER_IKCQ_PKTSIZE); - ihk_ikc_init_queue(wq, 0, 0, PAGE_SIZE, MASTER_IKCQ_PKTSIZE); + /* Place both sides in this side */ + rq = ihk_mc_alloc_pages(mikc_queue_pages, IHK_MC_AP_CRITICAL); + wq = ihk_mc_alloc_pages(mikc_queue_pages, IHK_MC_AP_CRITICAL); + + ihk_ikc_init_queue(rq, 0, 0, + mikc_queue_pages * PAGE_SIZE, MASTER_IKCQ_PKTSIZE); + ihk_ikc_init_queue(wq, 0, 0, + mikc_queue_pages * PAGE_SIZE, MASTER_IKCQ_PKTSIZE); arch_master_channel_packet_handler = packet_handler;