IKC: allocate Linux channel table dynamically

This commit is contained in:
Balazs Gerofi
2017-02-10 19:26:50 +09:00
parent 65dc3440cb
commit 4b964b8e0d
2 changed files with 19 additions and 5 deletions

View File

@ -41,10 +41,8 @@
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0) #define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
#endif #endif
/* Comment: McKernel側でのikc2linux(送信channel)の管理 /* Linux channel table, indexec by Linux CPU id */
nr_cpu_ids が利用できない? static struct ihk_ikc_channel_desc **ikc2linuxs = NULL;
配置場所の再考が必要?*/
static struct ihk_ikc_channel_desc *ikc2linuxs[512];
void check_mapping_for_proc(struct thread *thread, unsigned long addr) void check_mapping_for_proc(struct thread *thread, unsigned long addr)
{ {
@ -686,7 +684,22 @@ static int dummy_packet_handler(struct ihk_ikc_channel_desc *c,
void init_host_ikc2linux(int linux_cpu) void init_host_ikc2linux(int linux_cpu)
{ {
struct ihk_ikc_connect_param param; struct ihk_ikc_connect_param param;
struct ihk_ikc_channel_desc *c = ikc2linuxs[linux_cpu]; struct ihk_ikc_channel_desc *c;
/* Main thread allocates channel pointer table */
if (!ikc2linuxs) {
ikc2linuxs = kmalloc(sizeof(*ikc2linuxs) *
ihk_mc_get_nr_linux_cores(), IHK_MC_AP_NOWAIT);
if (!ikc2linuxs) {
kprintf("%s: error: allocating Linux channels\n", __FUNCTION__);
panic("");
}
memset(ikc2linuxs, 0, sizeof(*ikc2linuxs) *
ihk_mc_get_nr_linux_cores());
}
c = ikc2linuxs[linux_cpu];
if (!c) { if (!c) {
param.port = 503; param.port = 503;

View File

@ -60,6 +60,7 @@ int ihk_mc_get_processor_id(void);
int ihk_mc_get_hardware_processor_id(void); int ihk_mc_get_hardware_processor_id(void);
int ihk_mc_get_numa_id(void); int ihk_mc_get_numa_id(void);
int ihk_mc_get_nr_cores(); int ihk_mc_get_nr_cores();
int ihk_mc_get_nr_linux_cores();
int ihk_mc_get_core(int id, unsigned long *linux_core_id, unsigned long *apic_id, int ihk_mc_get_core(int id, unsigned long *linux_core_id, unsigned long *apic_id,
int *numa_id); int *numa_id);
int ihk_mc_get_apicid(int linux_core_id); int ihk_mc_get_apicid(int linux_core_id);