test: uti: add tofu examples

Change-Id: I1c55c872d125201e60b4fe744af74106e1c5d3a4
This commit is contained in:
Masamichi Takagi
2021-02-17 17:11:24 +09:00
parent 32afa80718
commit 90895cfb1f
11 changed files with 3925 additions and 0 deletions

View File

@ -3185,6 +3185,15 @@ mcexec_uti_attr(ihk_os_t os, struct uti_attr_desc __user *_desc)
kattr = phys_to_virt(desc.phys_attr);
{
int i;
pr_info("%s: flag: %lx\n", __func__, (unsigned long)kattr->attr.flags);
for (i = 0; i < UTI_MAX_NUMA_DOMAINS; i+= 64) {
kprintf("%s: numa_set[%d]: %lx\n", __func__, i, (unsigned long)kattr->attr.numa_set[i / 64]);
}
}
/* Find caller cpu for later resolution of subgroups */
list_for_each_entry(cpu_topo, &ud->cpu_topology_list, chain) {
if (cpu_topo->mckernel_cpu_id == kattr->parent_cpuid) {

112
test/uti/tofu/README Normal file
View File

@ -0,0 +1,112 @@
実行手順
========
初回実行時、tofu get通信する両方のードでtofuサブネットを設定する。
ソース一式をビルドしたときに生成される ctrl を使用する。
sudo ./ctrl <NX> <NY> <NZ> <SX> <SY> <SZ> <LX> <LY> <LZ>
tofu_perf プログラムの実行は受信側("-r"オプションを付加した方)を先にする。
"do_recv: Measure the reaction delay, Ready" メッセージを確認したあと、
送信側 ("-r"オプションを付加しない方) を実行する。
"-r"オプション以外は、受信側/送信側で同じ値を指定する。
コマンド例
==========
init.shに例を示す。以下、init.shの内容を説明する。
以下のコマンドでcgroupsを設定する。
sudo bash -c 'echo "0,1,12-59" > /sys/fs/cgroup/cpuset/system.slice/cpuset.cpus'
sudo bash -c 'echo "0-7" > /sys/fs/cgroup/cpuset/system.slice/cpuset.mems'
if [ ! -e /sys/fs/cgroup/cpu/mckrt ]; then
mkdir /sys/fs/cgroup/cpu/mckrt
echo 950000 > /sys/fs/cgroup/cpu/mckrt/cpu.rt_runtime_us
fi
sudo bash -c "echo $PPID > /sys/fs/cgroup/cpu/mckrt/tasks"
第2の計算ードprogress threadでtofu getするで次のコマンドを実行する。
sudo ./ctrl 1 1 1 0 0 0 1 1 1
sudo <mckernel>/bin/mcexec --enable-uti ./uti_perf -a 0,0,0,0,0,0 -r -f 1 -n 1 -l $((4*1024*1024)) -v
...
do_recv: Measure the reaction delay, Ready
"do_recv: Measure the reaction delay, Ready" を確認したあと、
第1の計算ード第2の計算ードに受信を指示するで次のコマンドを実行する。
sudo ./ctrl 1 1 1 0 0 0 1 1 1
sudo ./uti_perf -a 0,0,0,1,0,0 -f 1 -n 1 -l $((4*1024*1024)) -v
オプション
==========
(1) ctrl <NX> <NY> <NZ> <SX> <SY> <SZ> <LX> <LY> <LZ>
tofuサブネットを設定する。
サブネットの意味は以下のとおり。
N: 各軸のシステムサイズ (132)
S: サブネット内での先頭座標(0N-1)
L: サブネット内でのノード数(0N)、0を指定するとネットワーク分割なし
例えば、tofu座標が 0,0,0,0,0,0 と 0,0,0,1,0,0 の場合は次のように指定する。
sudo ./ctrl 1 1 1 0 0 0 1 1 1
(2) uti_perf
progress threadを用いたtofu get通信速度を計測する。
オプションは以下のとおり。
-a <x>,<y>,<z>,<a>,<b>,<c>
送信/受信相手のtofu座標を指定する。
-d <delay>, --d1=<delay>
progress threadの反応遅延測定時、プロトコル遅延として用いる時間を
10ns単位で指定する。
-t none, --thread=none
progress threadを生成せずに tofu get通信を実行する。
-r
プログラムを受信モードで実行する。未指定時は送信モードになる。
-f <num>
生成するプロセス数を指定する。 (148、既定値は1)
2以上の場合、tofu get通信を行うのは1プロセスのみで
ほかはprogress threadの生成のみを行う。
-n <num>
反応遅延またはプロトコル遅延の測定回数を指定する。 (既定値は10)
-l <length>
tofu get通信するデータサイズ(byte)を指定する。
(64 byte 16*1024*1024 - 256 byte、既定値は 16*1024*1024 - 256 byte)
-v
デバッグ出力を有効にする。
--sendusleep=<us>
送信モードで測定毎に us (usec) だけ待ち合わせる。
--sendfifo
送信モードでプロセスのスケジューリングポリシーを SCHED_FIFOにする。
--dummymode1
tofu get通信を行わない progress threadを測定完了まで sleepさせる。
--thrprio=<prio>
progress threadの優先度を指定する。 (-20 19、既定値は10)
--thrfifo
progress threadのスケジューリングポリシーを SCHED_FIFOにする。
--protocol
プロトコル遅延を測定する。
"-f 1 -t none" オプション指定と同じ。
--ctrlretry=<num>
tofu get通信フラグやスレッド間フラグの確認をリトライする回数を指定する。
(既定値は10)
--recvusleep=<us>
progress threadの受信完了を確認する間隔 (usec) を指定する。 (既定値は0)

View File

@ -0,0 +1,236 @@
/* tof_test.h COPYRIGHT FUJITSU LIMITED 2021 */
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <stdint.h>
#include <unistd.h>
#include <time.h>
#include "tof_uapi.h"
#define ST_RDWR 0x0
#define ST_RDONLY 0x1
#define ST_LPG 0x2
#define mb() asm volatile("dmb ish" ::: "memory")
static inline void BRK(void) {asm volatile ("brk #0");}
#define TOF_EXIT() (printf("ERROR:errorno=%d:line%d\n", errno, __LINE__),fflush(stdout),BRK(),exit(1))
#define TOF_NG(str, ...) printf("TOF_NG ##### line%d "str"\n", __LINE__, ##__VA_ARGS__);
#define TOF_OK(str, ...) printf("TOF_OK ##### line%d "str"\n", __LINE__, ##__VA_ARGS__);
#define MMAP(len) ({\
void *buf; \
buf = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_POPULATE, -1, 0); \
if(buf == MAP_FAILED){TOF_EXIT();} /* printf("mmap(%d)=%p\n", len, buf); */ buf;})
#define PROGRESS() (printf("PROGRESS:%d\n", __LINE__))
#define MALLOC(len) ({\
void *buf; \
buf = malloc(len); \
if(buf == NULL){ \
TOF_EXIT(); \
} \
buf;})
#define IOCTL(fd, id, req) ({ \
int res; \
res = ioctl(fd, id, req); \
if(res != 0){ \
TOF_EXIT(); \
} \
res;})
enum {
TOF_ICC_TOQ_NOP,
TOF_ICC_TOQ_PUT,
TOF_ICC_TOQ_WRITE_PIGGYBACK_BUFFER,
TOF_ICC_TOQ_PUT_PIGGYBACK,
TOF_ICC_TOQ_GET,
TOF_ICC_TOQ_GETL,
TOF_ICC_TOQ_ATOMIC_READ_MODIFY_WRITE = 0xe,
TOF_ICC_TOQ_TRANSMIT_RAW_PACKET1 = 0x10,
TOF_ICC_TOQ_TRANSMIT_RAW_PACKET2,
TOF_ICC_TOQ_TRANSMIT_SYSTEM_PACKET1,
TOF_ICC_TOQ_TRANSMIT_SYSTEM_PACKET2,
TOF_ICC_TOQ_NCOMMANDS,
};
enum {
TOF_ICC_MRQ_ATOMIC_READ_MODIFY_WRITE_HALFWAY_NOTICE = 0x1,
TOF_ICC_MRQ_ATOMIC_READ_MODIFY_WRITE_NOTICE,
TOF_ICC_MRQ_ATOMIC_READ_MODIFY_WRITE_REMOTE_ERROR,
TOF_ICC_MRQ_PUT_HALFWAY_NOTICE,
TOF_ICC_MRQ_PUT_LAST_HALFWAY_NOTICE,
TOF_ICC_MRQ_GET_HALFWAY_NOTICE,
TOF_ICC_MRQ_GET_LAST_HALFWAY_NOTICE,
TOF_ICC_MRQ_PUT_NOTICE,
TOF_ICC_MRQ_PUT_LAST_NOTICE,
TOF_ICC_MRQ_GET_NOTICE,
TOF_ICC_MRQ_GET_LAST_NOTICE,
TOF_ICC_MRQ_PUT_REMOTE_ERROR,
TOF_ICC_MRQ_PUT_LAST_REMOTE_ERROR,
TOF_ICC_MRQ_GET_REMOTE_ERROR,
TOF_ICC_MRQ_GET_LAST_REMOTE_ERROR,
TOF_ICC_MRQ_NCOMMANDS,
};
struct tof_icc_cq_stag_offset {
uint64_t offset:40;
uint64_t stag:18;
uint64_t cqid:6;
};
struct tof_icc_toq_common_header1 {
uint8_t interrupt:1;
uint8_t res1:4;
uint8_t source_type:2;
uint8_t flip:1;
uint8_t command;
union {
uint8_t mtu;
struct {
uint8_t res:4;
uint8_t op:4;
} armw;
} mtuop;
uint8_t sps:4;
uint8_t pa:1;
uint8_t pb:2;
uint8_t pc:1;
uint8_t rx;
uint8_t ry;
uint8_t rz;
uint8_t ra:1;
uint8_t rb:2;
uint8_t rc:1;
uint8_t res3:1;
uint8_t ri:3;
};
struct tof_icc_toq_common_header2 {
uint8_t gap;
uint8_t s:1;
uint8_t r:1;
uint8_t q:1;
uint8_t p:1;
uint8_t res1:1;
uint8_t j:1;
uint8_t res2:2;
uint16_t edata;
union{
struct {
uint32_t length:24;
uint32_t res:8;
} normal;
struct {
uint32_t length:6;
uint32_t res:26;
} piggyback;
} len;
};
struct tof_icc_toq_put {
struct tof_icc_toq_common_header1 head1;
struct tof_icc_toq_common_header2 head2;
struct tof_icc_cq_stag_offset remote;
struct tof_icc_cq_stag_offset local;
};
struct tof_icc_toq_get {
struct tof_icc_toq_common_header1 head1;
struct tof_icc_toq_common_header2 head2;
struct tof_icc_cq_stag_offset remote;
struct tof_icc_cq_stag_offset local;
};
struct tof_icc_tcq_descriptor {
uint8_t res1:5;
uint8_t counter_unmatch:1;
uint8_t res2:1;
uint8_t flip:1;
uint8_t rcode;
uint8_t res3[2];
union{
struct {
uint32_t length:24;
uint32_t res:8;
} normal;
struct {
uint32_t length:6;
uint32_t res:26;
} piggyback;
} len;
};
struct tof_icc_mrq_common_header1 {
uint8_t res1:7;
uint8_t flip:1;
uint8_t id;
uint8_t rcode;
uint8_t res2:4;
uint8_t pa:1;
uint8_t pb:2;
uint8_t pc:1;
uint8_t x;
uint8_t y;
uint8_t z;
uint8_t a:1;
uint8_t b:2;
uint8_t c:1;
uint8_t res3:1;
uint8_t i:3;
};
struct tof_icc_mrq_common_header2 {
uint8_t res1;
uint8_t res2:4;
uint8_t initial:1;
uint8_t res3:3;
uint16_t edata;
union {
struct {
uint32_t length:11;
uint32_t res:21;
} normal;
struct {
uint32_t op:4;
uint32_t res:28;
} armw;
} lenop;
};
struct tof_icc_mrq_descriptor {
struct tof_icc_mrq_common_header1 head1;
struct tof_icc_mrq_common_header2 head2;
struct tof_icc_cq_stag_offset cso1;
struct tof_icc_cq_stag_offset cso2;
};
static inline void get_position(struct tof_addr *addr){
int fd;
char buf[256];
ssize_t res;
fd = open("/proc/tofu/position", O_RDWR);
if(fd < 0){
TOF_EXIT();
}
res = read(fd, buf, 256);
if(res <= 0){
TOF_EXIT();
}
buf[res] = '0';
if(sscanf(buf, "%d %d %d %d %d %d", &addr->x, &addr->y, &addr->z, &addr->a, &addr->b, &addr->c) != 6){
TOF_EXIT();
}
close(fd);
}
static inline uint64_t get_timestamp(void){
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return (uint64_t)ts.tv_sec * 1000000 + (uint64_t)ts.tv_nsec / 1000;
}

View File

@ -0,0 +1,345 @@
/* tof_uapi.h COPYRIGHT FUJITSU LIMITED 2021 */
#ifndef _TOF_UAPI_H_
#define _TOF_UAPI_H_
#ifdef __KERNEL__
#include <linux/types.h>
#else
#include <stdint.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#endif
enum tof_sig_errno_cq {
TOF_TOQ_DIRECT_DESCRIPTOR_EXCEPTION,
TOF_TOQ_SOURCE_TYPE_EXCEPTION,
TOF_MRQ_OVERFLOW,
};
enum tof_sig_errno_bg {
TOF_NODE_ADDRESS_UNMATCH,
TOF_BSEQ_UNMATCH,
TOF_SIGNAL_STATE_ERROR,
TOF_ERROR_SYNCHRONIZATION_ACKNOWLEDGE,
};
#define TOF_UAPI_VERSION 0x2a00
struct tof_init_cq {
uint16_t version;
uint8_t session_mode;
uint8_t toq_size;
uint8_t mrq_size;
uint8_t num_stag;
uint8_t tcq_cinj;
uint8_t mrq_cinj;
void *toq_mem;
void *tcq_mem;
void *mrq_mem;
};
struct tof_alloc_stag {
uint32_t flags;
int stag;
uint64_t offset;
void *va;
uint64_t len;
};
struct tof_free_stags {
uint16_t num;
int *stags;
};
struct tof_addr {
uint8_t pa;
uint8_t pb;
uint8_t pc;
uint8_t x;
uint8_t y;
uint8_t z;
uint8_t a;
uint8_t b;
uint8_t c;
};
struct tof_set_bg {
int tni;
int gate;
int source_lgate;
struct tof_addr source_raddr;
int source_rtni;
int source_rgate;
int dest_lgate;
struct tof_addr dest_raddr;
int dest_rtni;
int dest_rgate;
};
struct tof_enable_bch {
void *addr;
int bseq;
int num;
struct tof_set_bg *bgs;
};
struct tof_set_subnet {
int res0;
int res1;
uint8_t nx;
uint8_t sx;
uint8_t lx;
uint8_t ny;
uint8_t sy;
uint8_t ly;
uint8_t nz;
uint8_t sz;
uint8_t lz;
};
struct tof_reg_user {
uid_t uid;
uint32_t gpid;
struct tof_set_subnet subnet;
uint64_t *cqmask;
uint64_t *bgmask;
};
struct tof_notify_linkdown {
int num;
struct {
uint8_t x;
uint8_t y;
uint8_t z;
uint8_t a;
uint8_t b;
uint8_t c;
uint16_t ports;
} *items;
};
struct tof_get_port_stat {
int port_no;
uint64_t mask;
uint64_t pa[31];
};
struct tof_get_cq_stat {
int tni;
int cqid;
uint64_t txbyte;
uint64_t rxbyte;
};
struct tof_load_register {
uint64_t pa;
uint64_t len;
void *buf;
};
struct tof_load_resource {
uint64_t rsc_id;
uint64_t offset;
uint64_t len;
void *buf;
};
union tof_trans_table_bitfield {
struct {
uint64_t start:36;
uint64_t len:27;
uint64_t ps_code:1;
} bits;
uint64_t atomic;
};
struct tof_trans_table {
union tof_trans_table_bitfield steering;
union tof_trans_table_bitfield mbpt;
};
void tof_utofu_set_linkdown_callback(void (*callback)(int, const void *));
void tof_utofu_unset_linkdown_callback(void);
#define TOF_MMAP_CQ_REGISTER 0
#ifdef __KERNEL__
#define TOF_MMAP_CQ_TRANSTABLE (PAGE_SIZE)
#else
#define TOF_MMAP_CQ_TRANSTABLE (sysconf(_SC_PAGESIZE))
#endif
#define TOF_MMAP_BCH_REGISTER 0
#define TOF_MMAP_XB_STQ 0
#define TOF_ST_RDWR 0x0
#define TOF_ST_RDONLY 0x1
#define TOF_ST_LPG 0x2
#define TOF_STAG_TRANS_PS_CODE_64KB 0
#define TOF_STAG_TRANS_PS_CODE_2MB 1
#define TOF_IOC_MAGIC 'd'
#define TOF_IOCTL_INIT_CQ _IOWR(TOF_IOC_MAGIC, 0, long)
#define TOF_IOCTL_ALLOC_STAG _IOWR(TOF_IOC_MAGIC, 1, long)
#define TOF_IOCTL_FREE_STAGS _IOWR(TOF_IOC_MAGIC, 2, long)
#define TOF_IOCTL_ENABLE_BCH _IOWR(TOF_IOC_MAGIC, 3, long)
#define TOF_IOCTL_DISABLE_BCH _IOWR(TOF_IOC_MAGIC, 4, long)
#define TOF_IOCTL_SET_RT_SIGNAL _IOWR(TOF_IOC_MAGIC, 5, long)
#define TOF_IOCTL_SET_SUBNET _IOWR(TOF_IOC_MAGIC, 6, long)
#define TOF_IOCTL_REG_USER _IOWR(TOF_IOC_MAGIC, 7, long)
#define TOF_IOCTL_NOTIFY_LINKDOWN _IOWR(TOF_IOC_MAGIC, 8, long)
#define TOF_IOCTL_GET_PORT_STAT _IOWR(TOF_IOC_MAGIC, 9, long)
#define TOF_IOCTL_GET_CQ_STAT _IOWR(TOF_IOC_MAGIC, 10, long)
#define TOF_IOCTL_LOAD_REGISTER _IOWR(TOF_IOC_MAGIC, 11, long)
#define TOF_IOCTL_LOAD_RESOURCE _IOWR(TOF_IOC_MAGIC, 12, long)
#ifndef __KERNEL__
#define TOF_INIT_CQ TOF_IOCTL_INIT_CQ
#define TOF_ALLOC_STAG TOF_IOCTL_ALLOC_STAG
#define TOF_FREE_STAGS TOF_IOCTL_FREE_STAGS
#define TOF_ENABLE_BCH TOF_IOCTL_ENABLE_BCH
#define TOF_DISABLE_BCH TOF_IOCTL_DISABLE_BCH
#define TOF_SET_RT_SIGNAL TOF_IOCTL_SET_RT_SIGNAL
#define TOF_SET_SUBNET TOF_IOCTL_SET_SUBNET
#define TOF_REG_USER TOF_IOCTL_REG_USER
#define TOF_NOTIFY_LINKDOWN TOF_IOCTL_NOTIFY_LINKDOWN
#define TOF_GET_PORT_STAT TOF_IOCTL_GET_PORT_STAT
#define TOF_GET_CQ_STAT TOF_IOCTL_GET_CQ_STAT
#define TOF_LOAD_REGISTER TOF_IOCTL_LOAD_REGIST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RQ3,
TOF_RSC_TNI5_MRQ4, TOF_RSC_TNI5_MRQ5, TOF_RSC_TNI5_MRQ6, TOF_RSC_TNI5_MRQ7,
TOF_RSC_TNI5_MRQ8, TOF_RSC_TNI5_MRQ9, TOF_RSC_TNI5_MRQ10, TOF_RSC_TNI5_MRQ11,
/* PBQ (216 - 221) */
TOF_RSC_TNI0_PBQ, TOF_RSC_TNI1_PBQ, TOF_RSC_TNI2_PBQ, TOF_RSC_TNI3_PBQ,
TOF_RSC_TNI4_PBQ, TOF_RSC_TNI5_PBQ,
/* PRQ (222 - 227) */
TOF_RSC_TNI0_PRQ, TOF_RSC_TNI1_PRQ, TOF_RSC_TNI2_PRQ, TOF_RSC_TNI3_PRQ,
TOF_RSC_TNI4_PRQ, TOF_RSC_TNI5_PRQ,
/* STEERINGTABLE (228 - 299) */
TOF_RSC_TNI0_STEERINGTABLE0, TOF_RSC_TNI0_STEERINGTABLE1, TOF_RSC_TNI0_STEERINGTABLE2,
TOF_RSC_TNI0_STEERINGTABLE3, TOF_RSC_TNI0_STEERINGTABLE4, TOF_RSC_TNI0_STEERINGTABLE5,
TOF_RSC_TNI0_STEERINGTABLE6, TOF_RSC_TNI0_STEERINGTABLE7, TOF_RSC_TNI0_STEERINGTABLE8,
TOF_RSC_TNI0_STEERINGTABLE9, TOF_RSC_TNI0_STEERINGTABLE10, TOF_RSC_TNI0_STEERINGTABLE11,
TOF_RSC_TNI1_STEERINGTABLE0, TOF_RSC_TNI1_STEERINGTABLE1, TOF_RSC_TNI1_STEERINGTABLE2,
TOF_RSC_TNI1_STEERINGTABLE3, TOF_RSC_TNI1_STEERINGTABLE4, TOF_RSC_TNI1_STEERINGTABLE5,
TOF_RSC_TNI1_STEERINGTABLE6, TOF_RSC_TNI1_STEERINGTABLE7, TOF_RSC_TNI1_STEERINGTABLE8,
TOF_RSC_TNI1_STEERINGTABLE9, TOF_RSC_TNI1_STEERINGTABLE10, TOF_RSC_TNI1_STEERINGTABLE11,
TOF_RSC_TNI2_STEERINGTABLE0, TOF_RSC_TNI2_STEERINGTABLE1, TOF_RSC_TNI2_STEERINGTABLE2,
TOF_RSC_TNI2_STEERINGTABLE3, TOF_RSC_TNI2_STEERINGTABLE4, TOF_RSC_TNI2_STEERINGTABLE5,
TOF_RSC_TNI2_STEERINGTABLE6, TOF_RSC_TNI2_STEERINGTABLE7, TOF_RSC_TNI2_STEERINGTABLE8,
TOF_RSC_TNI2_STEERINGTABLE9, TOF_RSC_TNI2_STEERINGTABLE10, TOF_RSC_TNI2_STEERINGTABLE11,
TOF_RSC_TNI3_STEERINGTABLE0, TOF_RSC_TNI3_STEERINGTABLE1, TOF_RSC_TNI3_STEERINGTABLE2,
TOF_RSC_TNI3_STEERINGTABLE3, TOF_RSC_TNI3_STEERINGTABLE4, TOF_RSC_TNI3_STEERINGTABLE5,
TOF_RSC_TNI3_STEERINGTABLE6, TOF_RSC_TNI3_STEERINGTABLE7, TOF_RSC_TNI3_STEERINGTABLE8,
TOF_RSC_TNI3_STEERINGTABLE9, TOF_RSC_TNI3_STEERINGTABLE10, TOF_RSC_TNI3_STEERINGTABLE11,
TOF_RSC_TNI4_STEERINGTABLE0, TOF_RSC_TNI4_STEERINGTABLE1, TOF_RSC_TNI4_STEERINGTABLE2,
TOF_RSC_TNI4_STEERINGTABLE3, TOF_RSC_TNI4_STEERINGTABLE4, TOF_RSC_TNI4_STEERINGTABLE5,
TOF_RSC_TNI4_STEERINGTABLE6, TOF_RSC_TNI4_STEERINGTABLE7, TOF_RSC_TNI4_STEERINGTABLE8,
TOF_RSC_TNI4_STEERINGTABLE9, TOF_RSC_TNI4_STEERINGTABLE10, TOF_RSC_TNI4_STEERINGTABLE11,
TOF_RSC_TNI5_STEERINGTABLE3, TOF_RSC_TNI5_STEERINGTABLE4, TOF_RSC_TNI5_STEERINGTABLE5,
TOF_RSC_TNI5_STEERINGTABLE6, TOF_RSC_TNI5_STEERINGTABLE7, TOF_RSC_TNI5_STEERINGTABLE8,
TOF_RSC_TNI5_STEERINGTABLE9, TOF_RSC_TNI5_STEERINGTABLE10, TOF_RSC_TNI5_STEERINGTABLE11,
/* MBTABLE (300 - 371) */
TOF_RSC_TNI0_MBTABLE0, TOF_RSC_TNI0_MBTABLE1, TOF_RSC_TNI0_MBTABLE2,
TOF_RSC_TNI0_MBTABLE3, TOF_RSC_TNI0_MBTABLE4, TOF_RSC_TNI0_MBTABLE5,
TOF_RSC_TNI0_MBTABLE6, TOF_RSC_TNI0_MBTABLE7, TOF_RSC_TNI0_MBTABLE8,
TOF_RSC_TNI0_MBTABLE9, TOF_RSC_TNI0_MBTABLE10, TOF_RSC_TNI0_MBTABLE11,
TOF_RSC_TNI1_MBTABLE0, TOF_RSC_TNI1_MBTABLE1, TOF_RSC_TNI1_MBTABLE2,
TOF_RSC_TNI1_MBTABLE3, TOF_RSC_TNI1_MBTABLE4, TOF_RSC_TNI1_MBTABLE5,
TOF_RSC_TNI1_MBTABLE6, TOF_RSC_TNI1_MBTABLE7, TOF_RSC_TNI1_MBTABLE8,
TOF_RSC_TNI1_MBTABLE9, TOF_RSC_TNI1_MBTABLE10, TOF_RSC_TNI1_MBTABLE11,
TOF_RSC_TNI2_MBTABLE0, TOF_RSC_TNI2_MBTABLE1, TOF_RSC_TNI2_MBTABLE2,
TOF_RSC_TNI2_MBTABLE3, TOF_RSC_TNI2_MBTABLE4, TOF_RSC_TNI2_MBTABLE5,
TOF_RSC_TNI2_MBTABLE6, TOF_RSC_TNI2_MBTABLE7, TOF_RSC_TNI2_MBTABLE8,
TOF_RSC_TNI2_MBTABLE9, TOF_RSC_TNI2_MBTABLE10, TOF_RSC_TNI2_MBTABLE11,
TOF_RSC_TNI3_MBTABLE0, TOF_RSC_TNI3_MBTABLE1, TOF_RSC_TNI3_MBTABLE2,
TOF_RSC_TNI3_MBTABLE3, TOF_RSC_TNI3_MBTABLE4, TOF_RSC_TNI3_MBTABLE5,
TOF_RSC_TNI3_MBTABLE6, TOF_RSC_TNI3_MBTABLE7, TOF_RSC_TNI3_MBTABLE8,
TOF_RSC_TNI3_MBTABLE9, TOF_RSC_TNI3_MBTABLE10, TOF_RSC_TNI3_MBTABLE11,
TOF_RSC_TNI4_MBTABLE0, TOF_RSC_TNI4_MBTABLE1, TOF_RSC_TNI4_MBTABLE2,
TOF_RSC_TNI4_MBTABLE3, TOF_RSC_TNI4_MBTABLE4, TOF_RSC_TNI4_MBTABLE5,
TOF_RSC_TNI4_MBTABLE6, TOF_RSC_TNI4_MBTABLE7, TOF_RSC_TNI4_MBTABLE8,
TOF_RSC_TNI4_MBTABLE9, TOF_RSC_TNI4_MBTABLE10, TOF_RSC_TNI4_MBTABLE11,
TOF_RSC_TNI5_MBTABLE0, TOF_RSC_TNI5_MBTABLE1, TOF_RSC_TNI5_MBTABLE2,
TOF_RSC_TNI5_MBTABLE3, TOF_RSC_TNI5_MBTABLE4, TOF_RSC_TNI5_MBTABLE5,
TOF_RSC_TNI5_MBTABLE6, TOF_RSC_TNI5_MBTABLE7, TOF_RSC_TNI5_MBTABLE8,
TOF_RSC_TNI5_MBTABLE9, TOF_RSC_TNI5_MBTABLE10, TOF_RSC_TNI5_MBTABLE11,
TOF_RSC_NUM /* 372 */
};
#define TOF_RSC_TOQ(TNI, CQID) (TOF_RSC_TNI0_TOQ0 + (TNI * 12) + CQID)
#define TOF_RSC_TCQ(TNI, CQID) (TOF_RSC_TNI0_TCQ0 + (TNI * 12) + CQID)
#define TOF_RSC_MRQ(TNI, CQID) (TOF_RSC_TNI0_MRQ0 + (TNI * 12) + CQID)
#define TOF_RSC_PBQ(TNI) (TOF_RSC_TNI0_PBQ + TNI)
#define TOF_RSC_PRQ(TNI) (TOF_RSC_TNI0_PRQ + TNI)
#define TOF_RSC_STT(TNI, CQID) (TOF_RSC_TNI0_STEERINGTABLE0 + (TNI * 12) + CQID)
#define TOF_RSC_MBT(TNI, CQID) (TOF_RSC_TNI0_MBTABLE0 + (TNI * 12) + CQID)
#endif
/* vim: set noet ts=8 sw=8 sts=0 tw=0 : */

39
test/uti/tofu/init.sh Executable file
View File

@ -0,0 +1,39 @@
#!/usr/bin/bash
SCRIPT_PATH=$(readlink -m "${BASH_SOURCE[0]}")
TEST_HOME="${SCRIPT_PATH%/*/*/*}"
# stop TCS
sudo systemctl stop pxkrm-plugin-mckernel krm-iptables
sudo systemctl stop pxmonitor_pre.service pxmonitor_slaved.service pxnrd.service pxeventd.service pxpled.service paclmgr_notice.service pxkrm.service pxpwrd.service
sudo systemctl stop FJSVxosmck FJSVxoshpcpwr-plugin-mckernel pxpwrm_perm_mck.service
sudo rm -f /dev/shm/rml*
while true; do
sudo systemctl status pxkrm-plugin-mckernel krm-iptables pxmonitor_slaved pxnrd pxpled paclmgr_notice pxkrm pxpwrd FJSVxosmck FJSVxoshpcpwr-plugin-mckernel pxpwrm_perm_mck | awk '/Active/ {print $2}' | grep -w active
(( $? != 0 )) && break
done
# mcstop
if [[ "$1" == "mck" ]]; then
MCREBOOT=0
. $TEST_HOME/common.sh
fi
# cgroup
sudo bash -c 'echo "0,1,12-59" > /sys/fs/cgroup/cpuset/system.slice/cpuset.cpus'
sudo bash -c 'echo "0-7" > /sys/fs/cgroup/cpuset/system.slice/cpuset.mems'
if [ ! -e /sys/fs/cgroup/cpu/mckrt ]; then
sudo mkdir /sys/fs/cgroup/cpu/mckrt
sudo bash -c 'echo 950000 > /sys/fs/cgroup/cpu/mckrt/cpu.rt_runtime_us'
fi
grandma=$(ps xao pid,ppid|awk '$1 == "'$PPID'" {print $2}')
sudo bash -c "echo $grandma > /sys/fs/cgroup/cpu/mckrt/tasks"
# tofu
sudo ./ctrl 1 1 1 0 0 0 1 1 1
if [[ "$1" == "mck" ]]; then
mcreboot
fi

View File

@ -0,0 +1,20 @@
# Makefile COPYRIGHT FUJITSU LIMITED 2021
CC = gcc
INC = -I../include -I/home/users/ea01/ea0105/aarch64/usr/include
LDFLAGS = -lpthread -L/home/users/ea01/ea0105/aarch64/usr/lib -luti -Wl,-rpath -Wl,/home/users/ea01/ea0105/aarch64/usr/lib
# CFLAGS = -g -Wall
CFLAGS = -g
all: uti_perf ctrl
ctrl: ctrl.c
$(CC) $(INC) $(LDFLAGS) $(CFLAGS) -o $@ $^
uti_perf: uti_perf.c
$(CC) $(INC) $(LDFLAGS) $(CFLAGS) -o $@ $^
.PHONY: clean
clean:
$(RM) -f uti_perf ctrl

View File

@ -0,0 +1,74 @@
/* ctrl COPYRIGHT FUJITSU LIMITED 2021 */
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include "tof_uapi.h"
#include "tof_test.h"
int main(int argc, char *argv[]){
int ctl_fd;
int res;
struct tof_addr laddr;
struct tof_reg_user req;
uint64_t cqmask[6] = {0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff};
uint64_t bgmask[6] = {0xfffffffffff,0xfffffffffff,0xfffffffffff,
0xfffffffffff,0xfffffffffff,0xfffffffffff};
if(argc != 1 && argc != 10){
printf("usage: %s <NX> <NY> <NZ> <SX> <SY> <SZ> <LX> <LY> <LZ>\n", argv[0]);
printf(" ex. %s 1 1 12 0 0 8 1 1 4\n", argv[0]);
exit(1);
}
get_position(&laddr);
/* REG_USER*/
req.uid = 0; /// root?
req.gpid = 23456;
req.subnet.nx = laddr.x+1;
req.subnet.ny = laddr.y+1;
req.subnet.nz = laddr.z+1;
req.subnet.sx = laddr.x;
req.subnet.sy = laddr.y;
req.subnet.sz = laddr.z;
req.subnet.lx = 1;
req.subnet.ly = 1;
req.subnet.lz = 1;
req.cqmask = (uint64_t *)&cqmask;
req.bgmask = (uint64_t *)&bgmask;
if(argc == 10){
req.subnet.nx = strtol(argv[1], NULL, 10);
req.subnet.ny = strtol(argv[2], NULL, 10);
req.subnet.nz = strtol(argv[3], NULL, 10);
req.subnet.sx = strtol(argv[4], NULL, 10);
req.subnet.sy = strtol(argv[5], NULL, 10);
req.subnet.sz = strtol(argv[6], NULL, 10);
req.subnet.lx = strtol(argv[7], NULL, 10);
req.subnet.ly = strtol(argv[8], NULL, 10);
req.subnet.lz = strtol(argv[9], NULL, 10);
}
ctl_fd = open("/proc/tofu/dev/control", O_CLOEXEC);
if(ctl_fd < 0){
TOF_EXIT();
}
/*
res = ioctl(ctl_fd, TOF_IOCTL_SET_SUBNET, &req.subnet);
if(res != 0){
TOF_EXIT();
}
*/
res = ioctl(ctl_fd, TOF_IOCTL_REG_USER, &req);
if(res != 0){
TOF_EXIT();
}
printf("subnet= %d %d %d %d %d %d %d %d %d\n",
req.subnet.nx, req.subnet.ny, req.subnet.nz,
req.subnet.sx, req.subnet.sy, req.subnet.sz,
req.subnet.lx, req.subnet.ly, req.subnet.lz);
printf("success:L%d\n", __LINE__);
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
# Makefile COPYRIGHT FUJITSU LIMITED 2021
CC = gcc
INC = -I../include
LDFLAGS = -lpthread
# CFLAGS = -g -Wall
CFLAGS = -g
all: uti_perf ctrl
ctrl: ctrl.c
$(CC) $(INC) $(LDFLAGS) $(CFLAGS) -o $@ $^
uti_perf: uti_perf.c
$(CC) $(INC) $(LDFLAGS) $(CFLAGS) -o $@ $^
.PHONY: clean
clean:
$(RM) -f uti_perf ctrl

View File

@ -0,0 +1,74 @@
/* ctrl COPYRIGHT FUJITSU LIMITED 2021 */
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include "tof_uapi.h"
#include "tof_test.h"
int main(int argc, char *argv[]){
int ctl_fd;
int res;
struct tof_addr laddr;
struct tof_reg_user req;
uint64_t cqmask[6] = {0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff};
uint64_t bgmask[6] = {0xfffffffffff,0xfffffffffff,0xfffffffffff,
0xfffffffffff,0xfffffffffff,0xfffffffffff};
if(argc != 1 && argc != 10){
printf("usage: %s <NX> <NY> <NZ> <SX> <SY> <SZ> <LX> <LY> <LZ>\n", argv[0]);
printf(" ex. %s 1 1 12 0 0 8 1 1 4\n", argv[0]);
exit(1);
}
get_position(&laddr);
/* REG_USER*/
req.uid = 0; /// root?
req.gpid = 23456;
req.subnet.nx = laddr.x+1;
req.subnet.ny = laddr.y+1;
req.subnet.nz = laddr.z+1;
req.subnet.sx = laddr.x;
req.subnet.sy = laddr.y;
req.subnet.sz = laddr.z;
req.subnet.lx = 1;
req.subnet.ly = 1;
req.subnet.lz = 1;
req.cqmask = (uint64_t *)&cqmask;
req.bgmask = (uint64_t *)&bgmask;
if(argc == 10){
req.subnet.nx = strtol(argv[1], NULL, 10);
req.subnet.ny = strtol(argv[2], NULL, 10);
req.subnet.nz = strtol(argv[3], NULL, 10);
req.subnet.sx = strtol(argv[4], NULL, 10);
req.subnet.sy = strtol(argv[5], NULL, 10);
req.subnet.sz = strtol(argv[6], NULL, 10);
req.subnet.lx = strtol(argv[7], NULL, 10);
req.subnet.ly = strtol(argv[8], NULL, 10);
req.subnet.lz = strtol(argv[9], NULL, 10);
}
ctl_fd = open("/proc/tofu/dev/control", O_CLOEXEC);
if(ctl_fd < 0){
TOF_EXIT();
}
/*
res = ioctl(ctl_fd, TOF_IOCTL_SET_SUBNET, &req.subnet);
if(res != 0){
TOF_EXIT();
}
*/
res = ioctl(ctl_fd, TOF_IOCTL_REG_USER, &req);
if(res != 0){
TOF_EXIT();
}
printf("subnet= %d %d %d %d %d %d %d %d %d\n",
req.subnet.nx, req.subnet.ny, req.subnet.nz,
req.subnet.sx, req.subnet.sy, req.subnet.sz,
req.subnet.lx, req.subnet.ly, req.subnet.lz);
printf("success:L%d\n", __LINE__);
return 0;
}

File diff suppressed because it is too large Load Diff