1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502
|
From: Roland Fehrenbacher <rf@q-leap.de>
Date: Wed, 14 May 2025 10:41:07 +0000
Subject: Fix 32-bit build failures and subsequent type errors after OFI
update.
Adjusted (dropped conflicting man page fixes) patch from MR
https://salsa.debian.org/hpc-team/libfabric/-/merge_requests/4
This patch adjusts various ofi_* functions and structures so that all
pointer-to-integer or integer-to-pointer casts match the expected size_t*
or uintptr_t types on 32-bit architectures, resolving FTBFS errors
(e.g., in ofi_cma.h, ofi_mem.h, etc.). It also corrects a series of type
mismatches and compilation issues introduced by the recent OFI update.
Author: Gonzalo Silvalde Blanco <gonzalo.silvalde@gmail.com>
Origin: other, https://bugs.debian.org/1102068
Bug-Debian: https://bugs.debian.org/1102068
---
include/ofi_atom.h | 8 +-
include/ofi_cma.h | 11 +-
include/ofi_mem.h | 4 +-
include/ofi_mr.h | 2 +-
prov/hook/hook_hmem/src/hook_hmem.c | 2 +-
prov/hook/trace/src/hook_trace.c | 118 ++++++------
prov/lnx/include/lnx.h | 2 +-
prov/lnx/src/lnx_av.c | 2 +-
prov/lnx/src/lnx_domain.c | 2 +-
prov/lnx/src/lnx_ep.c | 2 +-
prov/mrail/src/mrail_cq.c | 4 +-
prov/mrail/src/mrail_domain.c | 8 +-
prov/mrail/src/mrail_ep.c | 6 +-
prov/mrail/src/mrail_rma.c | 4 +-
prov/rxd/src/rxd_av.c | 6 +-
prov/rxd/src/rxd_cq.c | 4 +-
prov/rxm/src/rxm_cq.c | 9 +-
prov/rxm/src/rxm_domain.c | 2 +-
prov/rxm/src/rxm_hmem.c | 4 +-
prov/shm/src/smr.h | 5 +-
prov/shm/src/smr_progress.c | 8 +-
prov/shm/src/smr_rma.c | 2 +-
prov/sm2/src/sm2.h | 2 +-
prov/sm2/src/sm2_coordination.c | 4 +-
prov/sm2/src/sm2_ep.c | 5 +-
prov/sm2/src/sm2_progress.c | 10 +-
prov/tcp/src/xnet_domain.c | 2 +-
prov/tcp/src/xnet_ep.c | 4 +-
prov/tcp/src/xnet_progress.c | 2 +-
prov/usnic/src/usdf_av.c | 2 +-
prov/usnic/src/usdf_dgram.c | 8 +-
prov/usnic/src/usnic_direct/kcompat_priv.h | 2 +-
prov/usnic/src/usnic_direct/usd_ib_cmd.c | 4 +-
prov/usnic/src/usnic_direct/usd_mem.c | 6 +-
prov/usnic/src/usnic_direct/usd_poll.c | 2 +-
prov/usnic/src/usnic_direct/usd_post.c | 4 +-
prov/usnic/src/usnic_direct/usd_post.h | 2 +-
prov/usnic/src/usnic_direct/usd_queues.c | 22 +--
prov/util/src/uffd_mem_monitor.c | 8 +-
prov/util/src/util_av.c | 4 +-
prov/verbs/src/verbs_init.c | 282 +++++++++++++++--------------
prov/verbs/src/verbs_mr.c | 8 +-
src/common.c | 2 +-
src/hmem.c | 6 +-
src/hmem_ipc_cache.c | 2 +-
45 files changed, 327 insertions(+), 281 deletions(-)
diff --git a/include/ofi_atom.h b/include/ofi_atom.h
index 016d168..145bb10 100644
--- a/include/ofi_atom.h
+++ b/include/ofi_atom.h
@@ -73,10 +73,10 @@ typedef atomic_long ofi_atomic_int64_t;
#endif
#define OFI_ATOMIC_DEFINE(radix) \
- typedef struct { \
- ofi_atomic_int##radix##_t val; \
- ATOMIC_DEF_INIT; \
- } ofi_atomic##radix##_t; \
+ typedef struct { \
+ ofi_atomic_int##radix##_t val __attribute__((aligned((radix)/8))); \
+ ATOMIC_DEF_INIT; \
+ } ofi_atomic##radix##_t; \
\
static inline \
int##radix##_t ofi_atomic_inc##radix(ofi_atomic##radix##_t *atomic) \
diff --git a/include/ofi_cma.h b/include/ofi_cma.h
index ade1b74..c464dc3 100644
--- a/include/ofi_cma.h
+++ b/include/ofi_cma.h
@@ -64,8 +64,15 @@ static inline int cma_copy(struct iovec *local, unsigned long local_cnt,
if (!total)
return FI_SUCCESS;
- ofi_consume_iov(local, &local_cnt, (size_t) ret);
- ofi_consume_iov(remote, &remote_cnt, (size_t) ret);
+ size_t local_size = local_cnt;
+ size_t remote_size = remote_cnt;
+
+ ofi_consume_iov(local, &local_size, (size_t)ret);
+ ofi_consume_iov(remote, &remote_size, (size_t)ret);
+
+ local_cnt = local_size;
+ remote_cnt = remote_size;
+
}
}
diff --git a/include/ofi_mem.h b/include/ofi_mem.h
index 7463a02..7b0f91d 100644
--- a/include/ofi_mem.h
+++ b/include/ofi_mem.h
@@ -278,9 +278,9 @@ static inline void smr_freestack_init(struct smr_freestack *fs, size_t elem_coun
fs->entry_base_offset =
((char*) &fs->entry_next[0] - (char*) fs) +
fs->size * sizeof(fs->top);
- next_aligned_addr = ofi_get_aligned_size((( (uint64_t) fs) +
+ next_aligned_addr = ofi_get_aligned_size((( (uintptr_t) fs) +
fs->entry_base_offset), SMR_ALIGN_BOUNDARY);
- fs->entry_base_offset = next_aligned_addr - ((uint64_t) fs);
+ fs->entry_base_offset = next_aligned_addr - ((uintptr_t) fs);
for (i = elem_count - 1; i >= 0; i--)
smr_freestack_push_by_index(fs, i);
}
diff --git a/include/ofi_mr.h b/include/ofi_mr.h
index b0556ee..ea6d88e 100644
--- a/include/ofi_mr.h
+++ b/include/ofi_mr.h
@@ -346,7 +346,7 @@ void ofi_mr_get_iov_from_dmabuf(struct iovec *iov,
for (i = 0; i < count; i++) {
iov[i].iov_base = (void *) (
- (uintptr_t) dmabuf[i].base_addr + dmabuf[i].offset);
+ (char *) dmabuf[i].base_addr + dmabuf[i].offset);
iov[i].iov_len = dmabuf[i].len;
}
}
diff --git a/prov/hook/hook_hmem/src/hook_hmem.c b/prov/hook/hook_hmem/src/hook_hmem.c
index 44daa4f..1ddf236 100644
--- a/prov/hook/hook_hmem/src/hook_hmem.c
+++ b/prov/hook/hook_hmem/src/hook_hmem.c
@@ -81,7 +81,7 @@ static int hook_hmem_add_region(struct hook_hmem_domain *domain,
attr.access = FI_SEND | FI_RECV | FI_READ | FI_WRITE |
FI_REMOTE_READ | FI_REMOTE_WRITE;
attr.offset = 0;
- attr.requested_key = (uint64_t) *hmem_desc;
+ attr.requested_key = (uintptr_t) *hmem_desc;
attr.iface = iface;
attr.device.reserved = device;
diff --git a/prov/hook/trace/src/hook_trace.c b/prov/hook/trace/src/hook_trace.c
index b5cdce4..9dc3531 100644
--- a/prov/hook/trace/src/hook_trace.c
+++ b/prov/hook/trace/src/hook_trace.c
@@ -33,6 +33,8 @@
#include "ofi_prov.h"
#include "ofi_iov.h"
#include <config.h>
+#include <inttypes.h>
+
#include <rdma/fi_profile.h>
struct hook_trace_ep {
@@ -201,16 +203,16 @@ static void hook_trace_prof_init(void *context)
#define IOV_LEN(iov, count) ofi_total_iov_len(iov, count)
#define MSG_DATA(data, flags) (flags & FI_REMOTE_CQ_DATA ? data : 0)
-#define TRACE_CM(ret, fabric, ep, flags) \
- if (!(ret)) { \
- if ((flags)) \
- FI_TRACE((fabric)->hprov, FI_LOG_EP_CTRL, \
- "ep/pep %p flags 0x%lx\n", \
- (void *)(ep), (uint64_t)(flags)); \
- else \
- FI_TRACE((fabric)->hprov, FI_LOG_EP_CTRL, \
- "ep/pep %p\n", (void *)(ep)); \
- }
+#define TRACE_CM(ret, fabric, ep, flags) \
+ if (!(ret)) { \
+ if ((flags)) \
+ FI_TRACE((fabric)->hprov, FI_LOG_EP_CTRL, \
+ "ep/pep %p flags 0x%" PRIx64 "\n", \
+ (void *)(ep), (uint64_t)(flags)); \
+ else \
+ FI_TRACE((fabric)->hprov, FI_LOG_EP_CTRL, \
+ "ep/pep %p\n", (void *)(ep)); \
+ }
#define TRACE_CM_ADDR(ret, fabric, addr) \
if (!(ret)) { \
@@ -219,38 +221,48 @@ static void hook_trace_prof_init(void *context)
}
#define TRACE_EP_MSG(ret, ep, buf, len, addr, data, flags, context) \
- if (!(ret)) { \
- FI_TRACE((ep)->domain->fabric->hprov, FI_LOG_EP_DATA, \
- "buf %p len %zu addr %zu data %lu " \
- "flags 0x%zx ctx %p\n", \
- buf, len, addr, (uint64_t)data, \
- (uint64_t)flags, context); \
- }
+ if (!(ret)) { \
+ FI_TRACE((ep)->domain->fabric->hprov, FI_LOG_EP_DATA, \
+ "buf %p len %zu addr %" PRIuPTR " data %" PRIu64 \
+ " flags 0x%" PRIxPTR " ctx %p\n", \
+ (void *)(buf), (size_t)(len), \
+ (uintptr_t)(addr), (uint64_t)(data), \
+ (uintptr_t)(flags), (void *)(context)); \
+ }
#define TRACE_EP_RMA(ret, ep, buf, len, addr, raddr, data, flags, key, context) \
- if (!(ret)) { \
- FI_TRACE((ep)->domain->fabric->hprov, FI_LOG_EP_DATA, \
- "buf %p len %zu addr %zu raddr %lu data %lu " \
- "flags 0x%zx key 0x%zx ctx %p\n", \
- buf, len, addr, (uint64_t)raddr, (uint64_t)data, \
- (uint64_t)flags, (uint64_t)key, context); \
- }
+ if (!(ret)) { \
+ FI_TRACE((ep)->domain->fabric->hprov, FI_LOG_EP_DATA, \
+ "buf %p len %zu addr %" PRIuPTR \
+ " raddr %" PRIu64 " data %" PRIu64 \
+ " flags 0x%" PRIxPTR " key 0x%" PRIxPTR " ctx %p\n", \
+ (void *)(buf), (size_t)(len), \
+ (uintptr_t)(addr), (uint64_t)(raddr), (uint64_t)(data), \
+ (uintptr_t)(flags), (uintptr_t)(key), \
+ (void *)(context)); \
+ }
#define TRACE_EP_TAGGED(ret, ep, buf, len, addr, data, flags, tag, ignore, context) \
- if (!(ret)) { \
- FI_TRACE((ep)->domain->fabric->hprov, FI_LOG_EP_DATA, \
- "buf %p len %zu addr %zu data %lu " \
- "flags 0x%zx tag 0x%lx ignore 0x%zx ctx %p\n", \
- buf, len, addr, (uint64_t)data, (uint64_t)flags, \
- (uint64_t)tag, (uint64_t)ignore, context); \
- }
+ if (!(ret)) { \
+ FI_TRACE((ep)->domain->fabric->hprov, FI_LOG_EP_DATA, \
+ "buf %p len %zu addr %" PRIuPTR " data %" PRIu64 \
+ " flags 0x%" PRIxPTR " tag 0x%" PRIxPTR \
+ " ignore 0x%" PRIxPTR " ctx %p\n", \
+ (void *)(buf), (size_t)(len), (uintptr_t)(addr), \
+ (uint64_t)(data), (uintptr_t)(flags), \
+ (uintptr_t)(tag), (uintptr_t)(ignore), \
+ (void *)(context)); \
+ }
#define TRACE_MR_ATTR(ret, buf, size, dom, mr, len, flags, attr) \
- if (!(ret)) { \
- FI_TRACE(dom->fabric->hprov, FI_LOG_DOMAIN, \
- "mr %p len %lu flags 0x%lx\n%s", mr, (len), (flags), \
- fi_tostr_r(buf, size, (void *)attr, FI_TYPE_MR_ATTR)); \
- }
+ if (!(ret)) { \
+ FI_TRACE((dom)->fabric->hprov, FI_LOG_DOMAIN, \
+ "mr %p len %zu flags 0x%" PRIx64 "\n%s", \
+ (void *)(mr), (size_t)(len), \
+ (uint64_t)(flags), \
+ fi_tostr_r((buf), (size), (void *)(attr), \
+ FI_TYPE_MR_ATTR)); \
+ }
#define TRACE_ENDPOINT(buf, len, dom, name, ep, context, info) \
do { \
@@ -300,12 +312,12 @@ trace_cq_msg_entry(const struct fi_provider *prov, const char *func,
for (i = 0; i < count; i++) {
if (entry[i].flags & FI_RECV) {
fi_log(prov, FI_LOG_TRACE, FI_LOG_CQ, func, line,
- "ctx %p flags 0x%lx len %zu\n",
- entry[i].op_context, entry[i].flags, entry[i].len);
+ "ctx %p flags 0x%" PRIx64 "len %zu\n",
+ entry[i].op_context, (uint64_t)entry[i].flags, entry[i].len);
} else {
fi_log(prov, FI_LOG_TRACE, FI_LOG_CQ, func, line,
- "ctx %p flags 0x%lx\n",
- entry[i].op_context, entry[i].flags);
+ "ctx %p flags 0x%" PRIx64 "\n",
+ entry[i].op_context, (uint64_t)entry[i].flags);
}
}
}
@@ -320,14 +332,14 @@ trace_cq_data_entry(const struct fi_provider *prov, const char *func,
for (i = 0; i < count; i++) {
if (entry[i].flags & FI_RECV) {
fi_log(prov, FI_LOG_TRACE, FI_LOG_CQ, func, line,
- "ctx %p flags 0x%lx len %zu buf %p, data %lu\n",
- entry[i].op_context, entry[i].flags,
+ "ctx %p flags 0x%" PRIx64 "len %zu buf %p, data %" PRIu64 "\n",
+ entry[i].op_context, (uint64_t)entry[i].flags,
entry[i].len, entry[i].buf,
- (entry[i].flags & FI_REMOTE_CQ_DATA) ? entry[i].data : 0);
+ (entry[i].flags & FI_REMOTE_CQ_DATA) ? (uint64_t)entry[i].data : 0);
} else {
fi_log(prov, FI_LOG_TRACE, FI_LOG_CQ, func, line,
- "ctx %p flags 0x%lx\n",
- entry[i].op_context, entry[i].flags);
+ "ctx %p flags 0x%" PRIx64 "\n",
+ entry[i].op_context, (uint64_t)entry[i].flags);
}
}
}
@@ -342,15 +354,15 @@ trace_cq_tagged_entry(const struct fi_provider *prov, const char *func,
for (i = 0; i < count; i++) {
if (entry[i].flags & FI_RECV) {
fi_log(prov, FI_LOG_TRACE, FI_LOG_CQ, func, line,
- "ctx %p flags 0x%lx len %zu buf %p, data %lu tag 0x%lx\n",
- entry[i].op_context, entry[i].flags,
+ "ctx %p flags 0x%" PRIx64 "len %zu buf %p, data %" PRIu64 " tag 0x%" PRIx64 "\n",
+ entry[i].op_context, (uint64_t)entry[i].flags,
entry[i].len, entry[i].buf,
- (entry[i].flags & FI_REMOTE_CQ_DATA) ? entry[i].data : 0,
- entry[i].tag);
+ (uint64_t)(entry[i].flags & FI_REMOTE_CQ_DATA) ? entry[i].data : 0,
+ (uint64_t)entry[i].tag);
} else {
fi_log(prov, FI_LOG_TRACE, FI_LOG_CQ, func, line,
- "ctx %p flags 0x%lx\n",
- entry[i].op_context, entry[i].flags);
+ "ctx %p flags 0x%" PRIx64 "\n",
+ entry[i].op_context, (uint64_t)entry[i].flags);
}
}
}
@@ -387,7 +399,7 @@ trace_cq_err(struct hook_cq *cq, const char *func, int line,
if (entry->flags & FI_RECV) {
fi_log(cq->domain->fabric->hprov, FI_LOG_TRACE, FI_LOG_CQ,
func, line,
- "ctx %p flags 0x%lx, len %zu buf %p data %lu tag 0x%lx "
+ "ctx %p flags 0x%" PRIx64 ", len %zu buf %p data %" PRIu64 " tag 0x%" PRIx64 " "
"olen %zu err %d (%s) prov_errno %d (%s)\n",
entry->op_context, entry->flags, entry->len, entry->buf,
entry->data, entry->tag, entry->olen,
@@ -396,7 +408,7 @@ trace_cq_err(struct hook_cq *cq, const char *func, int line,
} else {
fi_log(cq->domain->fabric->hprov, FI_LOG_TRACE, FI_LOG_CQ,
func, line,
- "ctx %p flags 0x%lx, data %lu tag 0x%lx "
+ "ctx %p flags 0x%" PRIx64 ", data %" PRIu64 " tag 0x%" PRIx64 " "
"olen %zu err %d (%s) prov_errno %d (%s)\n",
entry->op_context, entry->flags,
entry->data, entry->tag, entry->olen,
diff --git a/prov/lnx/include/lnx.h b/prov/lnx/include/lnx.h
index 3d65068..a3f6bfc 100644
--- a/prov/lnx/include/lnx.h
+++ b/prov/lnx/include/lnx.h
@@ -358,7 +358,7 @@ int lnx_create_mr(const struct iovec *iov, fi_addr_t addr,
rc = ofi_mr_cache_search(&lnx_dom->ld_mr_cache, &info, mre);
if (rc) {
- ofi_hmem_dev_unregister(attr.iface, (uint64_t)attr.hmem_data);
+ ofi_hmem_dev_unregister(attr.iface, (uintptr_t)attr.hmem_data);
return rc;
}
diff --git a/prov/lnx/src/lnx_av.c b/prov/lnx/src/lnx_av.c
index 60a26f1..f7c912f 100644
--- a/prov/lnx/src/lnx_av.c
+++ b/prov/lnx/src/lnx_av.c
@@ -74,7 +74,7 @@ lnx_av_lookup_addr(struct lnx_peer_table *peer_tbl, fi_addr_t addr)
if (!entry)
FI_WARN(&lnx_prov, FI_LOG_CORE,
- "Invalid fi_addr %#lx\n", addr);
+ "Invalid fi_addr %#" PRIx64 "\n", addr);
return entry;
}
diff --git a/prov/lnx/src/lnx_domain.c b/prov/lnx/src/lnx_domain.c
index f1b055f..1119ee5 100644
--- a/prov/lnx/src/lnx_domain.c
+++ b/prov/lnx/src/lnx_domain.c
@@ -497,7 +497,7 @@ static void lnx_addr_del_region(struct ofi_mr_cache *cache,
{
struct ofi_mr *mr = (struct ofi_mr *)entry->data;
- ofi_hmem_dev_unregister(mr->iface, (uint64_t) mr->hmem_data);
+ ofi_hmem_dev_unregister(mr->iface, (uintptr_t) mr->hmem_data);
}
/*
diff --git a/prov/lnx/src/lnx_ep.c b/prov/lnx/src/lnx_ep.c
index 6590a60..05ffc7d 100644
--- a/prov/lnx/src/lnx_ep.c
+++ b/prov/lnx/src/lnx_ep.c
@@ -901,7 +901,7 @@ static void lnx_close_ep_ctx(struct local_prov_ep *ep, size_t fclass)
rc = fi_close(&ep_ctx[i]->fid);
if (rc)
FI_WARN(&lnx_prov, FI_LOG_CORE,
- "Failed to close ep context %lu with %d\n",
+ "Failed to close ep context %zu with %d\n",
fclass, rc);
}
}
diff --git a/prov/mrail/src/mrail_cq.c b/prov/mrail/src/mrail_cq.c
index aab24b5..9f29f7f 100644
--- a/prov/mrail/src/mrail_cq.c
+++ b/prov/mrail/src/mrail_cq.c
@@ -145,7 +145,7 @@ static int mrail_cq_process_rndv_req(struct fi_cq_tagged_entry *comp,
mrail_pkt = (struct mrail_pkt *)comp->buf;
rndv_hdr = (struct mrail_rndv_hdr *)&mrail_pkt[1];
rndv_req = (struct mrail_rndv_req *)&rndv_hdr[1];
- recv->rndv.context = (void *)rndv_hdr->context;
+ recv->rndv.context = (void *)(uintptr_t)rndv_hdr->context;
recv->rndv.flags = comp->flags & FI_REMOTE_CQ_DATA;
recv->rndv.len = rndv_req->len;
recv->rndv.tag = mrail_pkt->hdr.tag;
@@ -204,7 +204,7 @@ static int mrail_cq_process_rndv_ack(struct fi_cq_tagged_entry *comp)
mrail_pkt = (struct mrail_pkt *)comp->buf;
rndv_hdr = (struct mrail_rndv_hdr *)&mrail_pkt[1];
- tx_buf = (struct mrail_tx_buf *)rndv_hdr->context;
+ tx_buf = (struct mrail_tx_buf *)(uintptr_t)rndv_hdr->context;
ret = mrail_cq_write_send_comp(tx_buf->ep->util_ep.tx_cq, tx_buf);
if (ret)
retv = ret;
diff --git a/prov/mrail/src/mrail_domain.c b/prov/mrail/src/mrail_domain.c
index 82537b2..cadb865 100644
--- a/prov/mrail/src/mrail_domain.c
+++ b/prov/mrail/src/mrail_domain.c
@@ -68,7 +68,7 @@ static int mrail_domain_map_raw(struct mrail_domain *mrail_domain,
memcpy(mr_map, map->raw_key, map->key_size);
- *(map->key) = (uint64_t)mr_map;
+ *(map->key) = (uintptr_t)mr_map;
return 0;
}
@@ -196,7 +196,7 @@ static int mrail_mr_reg(struct fid *domain_fid, const void *buf, size_t len,
}
mrail_mr->rails[rail].base_addr =
(fi->domain_attr->mr_mode & FI_MR_VIRT_ADDR) ?
- (uint64_t)buf : 0;
+ (uintptr_t)buf : 0;
}
mrail_mr->mr_fid.fid.fclass = FI_CLASS_MR;
@@ -247,7 +247,7 @@ static int mrail_mr_regv(struct fid *domain_fid, const struct iovec *iov,
}
mrail_mr->rails[rail].base_addr =
(fi->domain_attr->mr_mode & FI_MR_VIRT_ADDR) ?
- (uint64_t)iov[0].iov_base : 0;
+ (uintptr_t)iov[0].iov_base : 0;
}
mrail_mr->mr_fid.fid.fclass = FI_CLASS_MR;
@@ -295,7 +295,7 @@ static int mrail_mr_regattr(struct fid *domain_fid, const struct fi_mr_attr *att
}
mrail_mr->rails[rail].base_addr =
(fi->domain_attr->mr_mode & FI_MR_VIRT_ADDR) ?
- (uint64_t)attr->mr_iov[0].iov_base : 0;
+ (uintptr_t)attr->mr_iov[0].iov_base : 0;
}
mrail_mr->mr_fid.fid.fclass = FI_CLASS_MR;
diff --git a/prov/mrail/src/mrail_ep.c b/prov/mrail/src/mrail_ep.c
index 49b2636..d6cd8cb 100644
--- a/prov/mrail/src/mrail_ep.c
+++ b/prov/mrail/src/mrail_ep.c
@@ -363,7 +363,7 @@ int mrail_send_rndv_ack_blocking(struct mrail_ep *mrail_ep,
tx_buf->hdr.protocol = MRAIL_PROTO_RNDV;
tx_buf->hdr.protocol_cmd = MRAIL_RNDV_ACK;
- tx_buf->rndv_hdr.context = (uint64_t)context;
+ tx_buf->rndv_hdr.context = (uintptr_t)context;
iov_dest.iov_base = &tx_buf->hdr;
iov_dest.iov_len = rndv_pkt_size;
@@ -415,7 +415,7 @@ mrail_prepare_rndv_req(struct mrail_ep *mrail_ep, struct mrail_tx_buf *tx_buf,
tx_buf->hdr.protocol = MRAIL_PROTO_RNDV;
tx_buf->hdr.protocol_cmd = MRAIL_RNDV_REQ;
- tx_buf->rndv_hdr.context = (uint64_t)tx_buf;
+ tx_buf->rndv_hdr.context = (uintptr_t)tx_buf;
tx_buf->rndv_req = NULL;
if (!desc || !desc[0]) {
@@ -463,7 +463,7 @@ mrail_prepare_rndv_req(struct mrail_ep *mrail_ep, struct mrail_tx_buf *tx_buf,
assert(!ret);
offset += key_size;
}
- tx_buf->rndv_req->rma_iov[i].addr = (uint64_t)iov[i].iov_base;
+ tx_buf->rndv_req->rma_iov[i].addr = (uintptr_t)iov[i].iov_base;
tx_buf->rndv_req->rma_iov[i].len = iov[i].iov_len;
tx_buf->rndv_req->rma_iov[i].key = key_size; /* otherwise unused */
}
diff --git a/prov/mrail/src/mrail_rma.c b/prov/mrail/src/mrail_rma.c
index 4a3e003..9a20b57 100644
--- a/prov/mrail/src/mrail_rma.c
+++ b/prov/mrail/src/mrail_rma.c
@@ -52,7 +52,7 @@ static void mrail_subreq_to_rail(struct mrail_subreq *subreq, uint32_t rail,
}
for (i = 0; i < subreq->rma_iov_count; ++i) {
- mr_map = (struct mrail_addr_key *)subreq->rma_iov[i].key;
+ mr_map = (struct mrail_addr_key *)(uintptr_t)subreq->rma_iov[i].key;
//TODO: add base address from mrail_addr_key
out_rma_iovs[i].addr = subreq->rma_iov[i].addr;
out_rma_iovs[i].len = subreq->rma_iov[i].len;
@@ -391,7 +391,7 @@ static ssize_t mrail_ep_inject_write(struct fid_ep *ep_fid, const void *buf,
ssize_t ret;
mrail_ep = container_of(ep_fid, struct mrail_ep, util_ep.ep_fid.fid);
- mr_map = (struct mrail_addr_key *) key;
+ mr_map = (struct mrail_addr_key *)(uintptr_t) key;
rail = mrail_get_tx_rail_rr(mrail_ep);
ret = fi_inject_write(mrail_ep->rails[rail].ep, buf, len,
diff --git a/prov/rxd/src/rxd_av.c b/prov/rxd/src/rxd_av.c
index 646bec0..541e0a5 100644
--- a/prov/rxd/src/rxd_av.c
+++ b/prov/rxd/src/rxd_av.c
@@ -175,7 +175,7 @@ int rxd_av_insert_dg_addr(struct rxd_av *av, const void *addr,
goto nomem;
}
- ret = ofi_rbmap_insert(&av->rbmap, (void *)addr, (void *)(*rxd_addr),
+ ret = ofi_rbmap_insert(&av->rbmap, (void *)addr, (void *)(uintptr_t)(*rxd_addr),
NULL);
if (ret) {
assert(ret != -FI_EALREADY);
@@ -219,7 +219,7 @@ static int rxd_av_insert(struct fid_av *av_fid, const void *addr, size_t count,
for (; i < count; i++, addr = (uint8_t *) addr + av->dg_addrlen) {
node = ofi_rbmap_find(&av->rbmap, (void *) addr);
if (node) {
- rxd_addr = (fi_addr_t) node->data;
+ rxd_addr = (fi_addr_t)(uintptr_t) node->data;
} else {
ret = rxd_av_insert_dg_addr(av, addr, &rxd_addr,
flags, sync_err ?
@@ -357,7 +357,7 @@ static int rxd_av_close(struct fid *fid)
return ret;
while ((node = ofi_rbmap_get_root(&av->rbmap))) {
- rxd_addr = (fi_addr_t) node->data;
+ rxd_addr = (fi_addr_t)(uintptr_t) node->data;
dg_addr = (intptr_t)ofi_idx_lookup(&av->rxdaddr_dg_idx,
(int) rxd_addr);
diff --git a/prov/rxd/src/rxd_cq.c b/prov/rxd/src/rxd_cq.c
index 1d35fb8..0439924 100644
--- a/prov/rxd/src/rxd_cq.c
+++ b/prov/rxd/src/rxd_cq.c
@@ -432,7 +432,7 @@ static void rxd_handle_rts(struct rxd_ep *ep, struct rxd_pkt_entry *pkt_entry)
node = ofi_rbmap_find(&rxd_av->rbmap, pkt->source);
if (node) {
- rxd_addr = (fi_addr_t) node->data;
+ rxd_addr = (fi_addr_t)(uintptr_t) node->data;
} else {
ret = rxd_av_insert_dg_addr(rxd_av, (void *) pkt->source,
&rxd_addr, 0, NULL);
@@ -558,7 +558,7 @@ static int rxd_verify_iov(struct rxd_ep *ep, struct ofi_rma_iov *rma,
ret = ofi_mr_verify(&util_domain->mr_map, rma[i].len,
(uintptr_t *)(&rma[i].addr), rma[i].key,
ofi_rx_mr_reg_flags(type, 0));
- iov[i].iov_base = (void *) rma[i].addr;
+ iov[i].iov_base = (void *)(uintptr_t) rma[i].addr;
iov[i].iov_len = rma[i].len;
if (ret) {
FI_WARN(&rxd_prov, FI_LOG_EP_CTRL, "could not verify MR\n");
diff --git a/prov/rxm/src/rxm_cq.c b/prov/rxm/src/rxm_cq.c
index 51206dd..c28a131 100644
--- a/prov/rxm/src/rxm_cq.c
+++ b/prov/rxm/src/rxm_cq.c
@@ -1238,7 +1238,7 @@ static ssize_t rxm_handle_atomic_req(struct rxm_ep *rxm_ep,
atomic_op));
if (ret) {
FI_WARN(&rxm_prov, FI_LOG_EP_DATA,
- "Atomic RMA MR verify error %ld\n", ret);
+ "Atomic RMA MR verify error %zd\n", ret);
return rxm_atomic_send_resp(rxm_ep, rx_buf, resp_buf, 0,
(uint32_t) -FI_EACCES);
}
@@ -1256,8 +1256,9 @@ static ssize_t rxm_handle_atomic_req(struct rxm_ep *rxm_ep,
void *src_buf = req_hdr->data + offset;
void *cmp_buf = req_hdr->data + len + offset;
void *res_buf = resp_hdr->data + offset;
- void *dst_buf = (void *) req_hdr->rma_ioc[i].addr;
-
+ void *dst_buf;
+ uintptr_t addr = (uintptr_t) req_hdr->rma_ioc[i].addr;
+ dst_buf = (void *) addr;
if (mr->iface != FI_HMEM_SYSTEM) {
ret = rxm_do_device_mem_atomic(mr, op, dst_buf, src_buf,
cmp_buf, res_buf,
@@ -1265,7 +1266,7 @@ static ssize_t rxm_handle_atomic_req(struct rxm_ep *rxm_ep,
atomic_op, amo_op_size);
if (ret) {
FI_WARN(&rxm_prov, FI_LOG_EP_DATA,
- "Atomic operation failed %ld\n", ret);
+ "Atomic operation failed %zd\n", ret);
return rxm_atomic_send_resp(rxm_ep, rx_buf,
resp_buf, 0,
diff --git a/prov/rxm/src/rxm_domain.c b/prov/rxm/src/rxm_domain.c
index 9fcadf5..115a667 100644
--- a/prov/rxm/src/rxm_domain.c
+++ b/prov/rxm/src/rxm_domain.c
@@ -470,7 +470,7 @@ static int rxm_mr_close(fid_t fid)
if (rxm_mr->hmem_handle) {
ofi_hmem_dev_unregister(rxm_mr->iface,
- (uint64_t) rxm_mr->hmem_handle);
+ (uintptr_t) rxm_mr->hmem_handle);
}
ret = fi_close(&rxm_mr->msg_mr->fid);
diff --git a/prov/rxm/src/rxm_hmem.c b/prov/rxm/src/rxm_hmem.c
index 5a52021..8d5fe57 100644
--- a/prov/rxm/src/rxm_hmem.c
+++ b/prov/rxm/src/rxm_hmem.c
@@ -62,11 +62,11 @@ ssize_t rxm_copy_hmem(void *desc, char *host_buf, void *dev_buf, size_t size,
* to ofi_hmem regular copy */
if (dir == OFI_COPY_IOV_TO_BUF) {
ofi_hmem_dev_reg_copy_from_hmem(
- iface, (uint64_t) hmem_handle, host_buf,
+ iface, (uintptr_t) hmem_handle, host_buf,
dev_buf, size);
} else {
ofi_hmem_dev_reg_copy_to_hmem(iface,
- (uint64_t) hmem_handle,
+ (uintptr_t) hmem_handle,
dev_buf, host_buf, size);
}
return FI_SUCCESS;
diff --git a/prov/shm/src/smr.h b/prov/shm/src/smr.h
index efd8b32..c5ce086 100644
--- a/prov/shm/src/smr.h
+++ b/prov/shm/src/smr.h
@@ -39,6 +39,7 @@
#include <pthread.h>
#include <stdint.h>
#include <stddef.h>
+#include <inttypes.h>
#include <rdma/fabric.h>
#include <rdma/fi_atomic.h>
@@ -246,8 +247,8 @@ struct smr_ep {
static inline int smr_mmap_name(char *shm_name, const char *ep_name,
uint64_t msg_id)
{
- return snprintf(shm_name, SMR_NAME_MAX - 1, "%s_%ld",
- ep_name, msg_id);
+ return snprintf(shm_name, SMR_NAME_MAX - 1, "%s_%" PRIu64,
+ ep_name, (uint64_t)msg_id);
}
int smr_endpoint(struct fid_domain *domain, struct fi_info *info,
diff --git a/prov/shm/src/smr_progress.c b/prov/shm/src/smr_progress.c
index 6568d69..5149bd3 100644
--- a/prov/shm/src/smr_progress.c
+++ b/prov/shm/src/smr_progress.c
@@ -218,7 +218,7 @@ static void smr_progress_resp(struct smr_ep *ep)
if (resp->status == SMR_STATUS_BUSY)
break;
- pending = (struct smr_tx_entry *) resp->msg_id;
+ pending = (struct smr_tx_entry *)(uintptr_t) resp->msg_id;
if (smr_progress_resp_entry(ep, resp, pending, &resp->status))
break;
@@ -1061,7 +1061,7 @@ static int smr_progress_cmd_rma(struct smr_ep *ep, struct smr_cmd *cmd,
if (ret)
break;
- iov[iov_count].iov_base = (void *) rma_cmd->rma.rma_iov[iov_count].addr;
+ iov[iov_count].iov_base = (void *)(uintptr_t) rma_cmd->rma.rma_iov[iov_count].addr;
iov[iov_count].iov_len = rma_cmd->rma.rma_iov[iov_count].len;
}
ofi_genlock_unlock(&domain->util_domain.lock);
@@ -1112,7 +1112,7 @@ static int smr_progress_cmd_rma(struct smr_ep *ep, struct smr_cmd *cmd,
smr_rx_cq_flags(0, cmd->msg.hdr.op_flags),
0, -err);
} else {
- ret = smr_complete_rx(ep, (void *) cmd->msg.hdr.msg_id,
+ ret = smr_complete_rx(ep, (void *)(uintptr_t) cmd->msg.hdr.msg_id,
cmd->msg.hdr.op, smr_rx_cq_flags(0,
cmd->msg.hdr.op_flags), total_len,
iov_count ? iov[0].iov_base : NULL,
@@ -1155,7 +1155,7 @@ static int smr_progress_cmd_atomic(struct smr_ep *ep, struct smr_cmd *cmd,
if (ret)
break;
- ioc[ioc_count].addr = (void *) rma_cmd->rma.rma_ioc[ioc_count].addr;
+ ioc[ioc_count].addr = (void *)(uintptr_t) rma_cmd->rma.rma_ioc[ioc_count].addr;
ioc[ioc_count].count = rma_cmd->rma.rma_ioc[ioc_count].count;
}
ofi_genlock_unlock(&domain->util_domain.lock);
diff --git a/prov/shm/src/smr_rma.c b/prov/shm/src/smr_rma.c
index feeae75..3bf4897 100644
--- a/prov/shm/src/smr_rma.c
+++ b/prov/shm/src/smr_rma.c
@@ -74,7 +74,7 @@ static ssize_t smr_rma_fast(struct smr_ep *ep, struct smr_region *peer_smr,
memcpy(vma_iovec, iov, sizeof(*iov) * iov_count);
for (i = 0; i < rma_count; i++) {
- rma_iovec[i].iov_base = (void *) rma_iov[i].addr;
+ rma_iovec[i].iov_base = (void *)(uintptr_t) rma_iov[i].addr;
rma_iovec[i].iov_len = rma_iov[i].len;
}
diff --git a/prov/sm2/src/sm2.h b/prov/sm2/src/sm2.h
index 0d00d67..d7573f3 100644
--- a/prov/sm2/src/sm2.h
+++ b/prov/sm2/src/sm2.h
@@ -242,7 +242,7 @@ static inline void sm2_generic_format(struct sm2_xfer_entry *xfer_entry,
xfer_entry->hdr.tag = tag;
xfer_entry->hdr.sender_gid = self_gid;
xfer_entry->hdr.cq_data = cq_data;
- xfer_entry->hdr.context = (uint64_t) context;
+ xfer_entry->hdr.context = (uintptr_t) context;
}
struct sm2_xfer_ctx {
diff --git a/prov/sm2/src/sm2_coordination.c b/prov/sm2/src/sm2_coordination.c
index cd247e4..abb3282 100644
--- a/prov/sm2/src/sm2_coordination.c
+++ b/prov/sm2/src/sm2_coordination.c
@@ -563,8 +563,8 @@ static void *sm2_mmap_shrink_to_size(struct sm2_mmap *map, size_t shrink_size)
if (map->base == MAP_FAILED) {
FI_WARN(&sm2_prov, FI_LOG_AV,
"Failed to remap when decreasing the map size. "
- "st.st_size=%ld shrink_size=%ld\n",
- st.st_size, shrink_size);
+ "st.st_size=%jd shrink_size=%zu\n",
+ (intmax_t)st.st_size, shrink_size);
map->base = NULL;
}
map->size = shrink_size;
diff --git a/prov/sm2/src/sm2_ep.c b/prov/sm2/src/sm2_ep.c
index c220ab4..ddb4990 100644
--- a/prov/sm2/src/sm2_ep.c
+++ b/prov/sm2/src/sm2_ep.c
@@ -253,6 +253,7 @@ static ssize_t sm2_format_ipc(struct sm2_xfer_entry *xfer_entry, void *ptr,
{
void *base;
ssize_t ret;
+ size_t tmp_base_length;
struct ipc_info *ipc_info = (struct ipc_info *) xfer_entry->user_data;
xfer_entry->hdr.proto = sm2_proto_ipc;
@@ -261,10 +262,12 @@ static ssize_t sm2_format_ipc(struct sm2_xfer_entry *xfer_entry, void *ptr,
ipc_info->device = device;
ret = ofi_hmem_get_base_addr(ipc_info->iface, ptr, len, &base,
- &ipc_info->base_length);
+ &tmp_base_length);
if (ret)
return ret;
+ ipc_info->base_length = (uint64_t)tmp_base_length;
+
ret = ofi_hmem_get_handle(ipc_info->iface, base, ipc_info->base_length,
(void **) &ipc_info->ipc_handle);
if (ret)
diff --git a/prov/sm2/src/sm2_progress.c b/prov/sm2/src/sm2_progress.c
index fa3b2f1..2ca8962 100644
--- a/prov/sm2/src/sm2_progress.c
+++ b/prov/sm2/src/sm2_progress.c
@@ -52,6 +52,7 @@ static int sm2_cma_send_ipc_handle(struct sm2_ep *ep,
struct sm2_cma_data *cma_data =
((struct sm2_cma_data *) xfer_entry->user_data);
struct ipc_info *ipc_info;
+ size_t tmp_base_length;
void *device_ptr, *base;
int ret;
@@ -73,7 +74,7 @@ static int sm2_cma_send_ipc_handle(struct sm2_ep *ep,
ret = ofi_hmem_get_base_addr(ipc_info->iface, device_ptr,
xfer_entry->hdr.size, &base,
- &ipc_info->base_length);
+ &tmp_base_length);
if (ret) {
FI_WARN(&sm2_prov, FI_LOG_EP_CTRL,
"Failed to get device memory base address. Error code: "
@@ -81,6 +82,7 @@ static int sm2_cma_send_ipc_handle(struct sm2_ep *ep,
ret);
return ret;
}
+ ipc_info->base_length = (uint64_t)tmp_base_length;
ret = ofi_hmem_get_handle(ipc_info->iface, base, ipc_info->base_length,
(void **) &ipc_info->ipc_handle);
@@ -462,7 +464,7 @@ sm2_progress_cma_host_to_dev(struct sm2_ep *ep,
return;
}
- ret = sm2_complete_tx(ep, (void *) xfer_entry->hdr.context,
+ ret = sm2_complete_tx(ep, (void *)(uintptr_t) xfer_entry->hdr.context,
xfer_entry->hdr.op, xfer_entry->hdr.op_flags);
if (ret) {
@@ -673,7 +675,7 @@ static int sm2_progress_atomic(struct sm2_ep *ep,
if (ret)
break;
- ioc[i].addr = (void *) ioc_ptr->addr;
+ ioc[i].addr = (void *)(uintptr_t) ioc_ptr->addr;
ioc[i].count = ioc_ptr->count;
}
@@ -741,7 +743,7 @@ static inline void sm2_progress_return(struct sm2_ep *ep,
}
if (xfer_entry->hdr.proto_flags & SM2_GENERATE_COMPLETION) {
- ret = sm2_complete_tx(ep, (void *) xfer_entry->hdr.context,
+ ret = sm2_complete_tx(ep, (void *)(uintptr_t) xfer_entry->hdr.context,
xfer_entry->hdr.op,
xfer_entry->hdr.op_flags);
if (ret)
diff --git a/prov/tcp/src/xnet_domain.c b/prov/tcp/src/xnet_domain.c
index d178748..54357a7 100644
--- a/prov/tcp/src/xnet_domain.c
+++ b/prov/tcp/src/xnet_domain.c
@@ -196,7 +196,7 @@ xnet_mplex_mr_regattr(struct fid *fid, const struct fi_mr_attr *attr,
ret = xnet_mr_regattr(item->fid, attr, flags, &sub_mr_fid);
if (ret) {
FI_WARN(&xnet_prov, FI_LOG_MR,
- "Failed to reg mr (%ld) from subdomain (%p)\n",
+ "Failed to reg mr (%" PRIu64 ") from subdomain (%p)\n",
mr->key, item->fid);
xnet_subdomains_mr_close(domain, mr->key);
diff --git a/prov/tcp/src/xnet_ep.c b/prov/tcp/src/xnet_ep.c
index 0ff5723..cd0f9e7 100644
--- a/prov/tcp/src/xnet_ep.c
+++ b/prov/tcp/src/xnet_ep.c
@@ -96,8 +96,8 @@ void xnet_hdr_trace(struct xnet_ep *ep, struct xnet_base_hdr *hdr)
dir = (hdr == &ep->cur_rx.hdr.base_hdr) ? "Rx" : "Tx";
- FI_TRACE(&xnet_prov, FI_LOG_EP_DATA, "%s op:%s tag:0x%zx flags:0x%x "
- "op_data:0x%x hdr_size:%d data_size:%zu\n", dir,
+ FI_TRACE(&xnet_prov, FI_LOG_EP_DATA, "%s op:%s tag:0x%" PRIx64 " flags:0x%x "
+ "op_data:0x%x hdr_size:%d data_size:%" PRIu64 "\n", dir,
xnet_op_str(hdr->op), tag, hdr->flags, hdr->op_data,
hdr->hdr_size, hdr->size - hdr->hdr_size);
}
diff --git a/prov/tcp/src/xnet_progress.c b/prov/tcp/src/xnet_progress.c
index aa76968..0cb5218 100644
--- a/prov/tcp/src/xnet_progress.c
+++ b/prov/tcp/src/xnet_progress.c
@@ -1330,7 +1330,7 @@ static void xnet_progress_cqe(struct xnet_progress *progress,
struct xnet_pep *pep;
assert(xnet_io_uring);
- sockctx = (struct ofi_sockctx *) cqe->user_data;
+ sockctx = (struct ofi_sockctx *)(uintptr_t) cqe->user_data;
assert(sockctx);
assert(sockctx->uring_sqe_inuse);
if (!(cqe ->flags & IORING_CQE_F_MORE))
diff --git a/prov/usnic/src/usdf_av.c b/prov/usnic/src/usdf_av.c
index 39b9e12..940160f 100644
--- a/prov/usnic/src/usdf_av.c
+++ b/prov/usnic/src/usdf_av.c
@@ -481,7 +481,7 @@ usdf_am_insert_sync(struct fid_av *fav, const void *addr, size_t count,
u_dest->ds_dest.ds_udp.u_hdr.uh_ip.frag_off |=
htons(IP_DF);
dest->ds_dest = *u_dest;
- fi_addr[i] = (fi_addr_t)dest;
+ fi_addr[i] = (fi_addr_t)(uintptr_t)dest;
LIST_INSERT_HEAD(&av->av_addresses, dest,
ds_addresses_entry);
++ret_count;
diff --git a/prov/usnic/src/usdf_dgram.c b/prov/usnic/src/usdf_dgram.c
index 905d94b..5b350a3 100644
--- a/prov/usnic/src/usdf_dgram.c
+++ b/prov/usnic/src/usdf_dgram.c
@@ -198,7 +198,7 @@ usdf_dgram_recvmsg(struct fid_ep *fep, const struct fi_msg *msg, uint64_t flags)
rq->urq_context[index] = msg->context;
hdr_ptr = ((uint8_t *)ep->e.dg.ep_hdr_buf) +
(index * USDF_HDR_BUF_ENTRY);
- rq_enet_desc_enc(desc, (dma_addr_t) hdr_ptr,
+ rq_enet_desc_enc(desc, (dma_addr_t)(uintptr_t) hdr_ptr,
RQ_ENET_TYPE_ONLY_SOP, sizeof(struct usd_udp_hdr));
ep->e.dg.ep_hdr_ptr[index] = (struct usd_udp_hdr *) hdr_ptr;
@@ -208,7 +208,7 @@ usdf_dgram_recvmsg(struct fid_ep *fep, const struct fi_msg *msg, uint64_t flags)
for (i = 0; i < msg->iov_count; ++i) {
rq->urq_context[index] = msg->context;
- rq_enet_desc_enc(desc, (dma_addr_t) iovp[i].iov_base,
+ rq_enet_desc_enc(desc, (dma_addr_t)(uintptr_t) iovp[i].iov_base,
RQ_ENET_TYPE_NOT_SOP, iovp[i].iov_len);
ep->e.dg.ep_hdr_ptr[index] = (struct usd_udp_hdr *) hdr_ptr;
@@ -552,7 +552,7 @@ usdf_dgram_prefix_recvmsg(struct fid_ep *fep, const struct fi_msg *msg, uint64_t
rq->urq_context[index] = msg->context;
hdr_ptr = ((uint8_t *)iovp[0].iov_base) +
(USDF_HDR_BUF_ENTRY - sizeof(struct usd_udp_hdr));
- rq_enet_desc_enc(desc, (dma_addr_t) hdr_ptr,
+ rq_enet_desc_enc(desc, (dma_addr_t)(uintptr_t) hdr_ptr,
RQ_ENET_TYPE_ONLY_SOP,
iovp[0].iov_len -
(USDF_HDR_BUF_ENTRY - sizeof(struct usd_udp_hdr)));
@@ -564,7 +564,7 @@ usdf_dgram_prefix_recvmsg(struct fid_ep *fep, const struct fi_msg *msg, uint64_t
for (i = 1; i < msg->iov_count; ++i) {
rq->urq_context[index] = msg->context;
- rq_enet_desc_enc(desc, (dma_addr_t) iovp[i].iov_base,
+ rq_enet_desc_enc(desc, (dma_addr_t)(uintptr_t) iovp[i].iov_base,
RQ_ENET_TYPE_NOT_SOP, iovp[i].iov_len);
ep->e.dg.ep_hdr_ptr[index] = (struct usd_udp_hdr *) hdr_ptr;
diff --git a/prov/usnic/src/usnic_direct/kcompat_priv.h b/prov/usnic/src/usnic_direct/kcompat_priv.h
index 01a7b2e..8218c86 100644
--- a/prov/usnic/src/usnic_direct/kcompat_priv.h
+++ b/prov/usnic/src/usnic_direct/kcompat_priv.h
@@ -63,7 +63,7 @@ static inline void *pci_alloc_consistent(struct pci_dev *hwdev,
ret = usd_alloc_mr((struct usd_device *) hwdev, size, &va);
if (ret == 0) {
- *dma_handle = (dma_addr_t) va;
+ *dma_handle = (dma_addr_t)(uintptr_t) va;
return va;
} else {
return NULL;
diff --git a/prov/usnic/src/usnic_direct/usd_ib_cmd.c b/prov/usnic/src/usnic_direct/usd_ib_cmd.c
index a0b7903..1505d5a 100644
--- a/prov/usnic/src/usnic_direct/usd_ib_cmd.c
+++ b/prov/usnic/src/usnic_direct/usd_ib_cmd.c
@@ -489,11 +489,11 @@ usd_ib_cmd_create_cq(
sched_getaffinity(getpid(),
CPU_ALLOC_SIZE(sysconf(_SC_NPROCESSORS_ONLN)),
affinity_mask) == 0) {
- cmd.usnic_cmd.cur.affinity_mask_ptr = (u64)affinity_mask;
+ cmd.usnic_cmd.cur.affinity_mask_ptr = (uint64_t)(uintptr_t)affinity_mask;
cmd.usnic_cmd.cur.affinity_mask_len =
CPU_ALLOC_SIZE(sysconf(_SC_NPROCESSORS_ONLN));
} else {
- cmd.usnic_cmd.cur.affinity_mask_ptr = (u64)NULL;
+ cmd.usnic_cmd.cur.affinity_mask_ptr = (uint64_t) 0;
cmd.usnic_cmd.cur.affinity_mask_len = 0;
}
} else {
diff --git a/prov/usnic/src/usnic_direct/usd_mem.c b/prov/usnic/src/usnic_direct/usd_mem.c
index 486e8f8..5d5d327 100644
--- a/prov/usnic/src/usnic_direct/usd_mem.c
+++ b/prov/usnic/src/usnic_direct/usd_mem.c
@@ -131,7 +131,7 @@ usd_alloc_mr(
base_addr = mmap(NULL, true_size, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (base_addr == NULL || base_addr == MAP_FAILED) {
- usd_err("Failed to mmap region of size %lu\n", true_size);
+ usd_err("Failed to mmap region of size %zu\n", true_size);
return -errno;
}
mr = base_addr;
@@ -155,7 +155,7 @@ usd_alloc_mr(
*/
ret = madvise(vaddr, madv_size, MADV_DONTFORK);
if (ret != 0) {
- usd_err("Failed to disable child's access to memory %p size %lu\n",
+ usd_err("Failed to disable child's access to memory %p size %zu\n",
vaddr, size);
ret = errno;
goto err_unmap;
@@ -163,7 +163,7 @@ usd_alloc_mr(
ret = usd_ib_cmd_reg_mr(dev, vaddr, size, mr);
if (ret != 0) {
- usd_err("Failed to register memory region %p, size %lu\n",
+ usd_err("Failed to register memory region %p, size %zu\n",
vaddr, size);
goto err_madvise;
}
diff --git a/prov/usnic/src/usnic_direct/usd_poll.c b/prov/usnic/src/usnic_direct/usd_poll.c
index 0ce9008..a5c8486 100644
--- a/prov/usnic/src/usnic_direct/usd_poll.c
+++ b/prov/usnic/src/usnic_direct/usd_poll.c
@@ -71,7 +71,7 @@ find_rx_lengths(
} while (type == RQ_ENET_TYPE_NOT_SOP);
*posted_len_o = rcvbuf_len;
- *len_in_pkt_o = ntohs(((struct usd_udp_hdr *)bus_addr)->uh_ip.tot_len) +
+ *len_in_pkt_o = ntohs(((struct usd_udp_hdr *)(uintptr_t)bus_addr)->uh_ip.tot_len) +
sizeof(struct ether_header);
}
diff --git a/prov/usnic/src/usnic_direct/usd_post.c b/prov/usnic/src/usnic_direct/usd_post.c
index e1e1b30..bc92389 100644
--- a/prov/usnic/src/usnic_direct/usd_post.c
+++ b/prov/usnic/src/usnic_direct/usd_post.c
@@ -90,7 +90,7 @@ usd_post_recv(
while (recv_list != NULL) {
iovp = recv_list->urd_iov;
rq->urq_context[index] = recv_list->urd_context;
- rq_enet_desc_enc(desc, (dma_addr_t) iovp[0].iov_base,
+ rq_enet_desc_enc(desc, (dma_addr_t)(uintptr_t) iovp[0].iov_base,
RQ_ENET_TYPE_ONLY_SOP, iovp[0].iov_len);
count++;
@@ -100,7 +100,7 @@ usd_post_recv(
for (i = 1; i < recv_list->urd_iov_cnt; ++i) {
rq->urq_context[index] = recv_list->urd_context;
- rq_enet_desc_enc(desc, (dma_addr_t) iovp[i].iov_base,
+ rq_enet_desc_enc(desc, (dma_addr_t)(uintptr_t) iovp[i].iov_base,
RQ_ENET_TYPE_NOT_SOP, iovp[i].iov_len);
count++;
diff --git a/prov/usnic/src/usnic_direct/usd_post.h b/prov/usnic/src/usnic_direct/usd_post.h
index a7bc5b5..529f281 100644
--- a/prov/usnic/src/usnic_direct/usd_post.h
+++ b/prov/usnic/src/usnic_direct/usd_post.h
@@ -73,7 +73,7 @@ _usd_post_send_one(
vlan_tag_insert, vlan_tag, loopback);
wmb();
- wr = vnic_cached_posted_index((dma_addr_t)packet, length, index);
+ wr = vnic_cached_posted_index((dma_addr_t)(uintptr_t)packet, length, index);
iowrite64(wr, &vwq->ctrl->posted_index);
wq->uwq_next_desc = (struct wq_enet_desc *)
diff --git a/prov/usnic/src/usnic_direct/usd_queues.c b/prov/usnic/src/usnic_direct/usd_queues.c
index 9ceabef..49ffb14 100644
--- a/prov/usnic/src/usnic_direct/usd_queues.c
+++ b/prov/usnic/src/usnic_direct/usd_queues.c
@@ -119,8 +119,8 @@ usd_map_one_res(struct usd_device *dev, struct usd_vf *vf,
iomap->vaddr = mmap64(NULL, iomap->len, PROT_READ + PROT_WRITE,
MAP_SHARED, dev->ud_ctx->ucx_ib_dev_fd, offset);
if (iomap->vaddr == MAP_FAILED) {
- usd_err("Failed to map res type %d, bus_addr 0x%lx, len 0x%lx\n",
- barres->type, iomap->bus_addr, iomap->len);
+ usd_err("Failed to map res type %d, bus_addr 0x%llx, len 0x%llx\n",
+ barres->type, (unsigned long long)iomap->bus_addr, (unsigned long long)iomap->len);
return -errno;
}
vnic_dev_upd_res_vaddr(vf->vf_vdev, iomap);
@@ -426,7 +426,7 @@ usd_create_wq_ud(
if (ret != 0)
return ret;
- ret = usd_vnic_wq_init(wq, qp->uq_vf, (uint64_t)wq->uwq_desc_ring);
+ ret = usd_vnic_wq_init(wq, qp->uq_vf, (uint64_t)(uintptr_t)wq->uwq_desc_ring);
if (ret != 0)
goto out;
@@ -473,9 +473,9 @@ usd_create_wq_pio(
pio_paddr = qp->uq_attrs.uqa_pio_paddr;
/* 512-byte alignment must match */
- if ((((uint64_t)pio_vaddr ^ pio_paddr) & 511) != 0) {
- fprintf(stderr, "Alignment mismatch, %p vs 0x%lx, cannot do PIO\n",
- pio_vaddr, pio_paddr);
+ if ((((uintptr_t)pio_vaddr ^ pio_paddr) & 511) != 0) {
+ fprintf(stderr, "Alignment mismatch, %p vs 0x%llx, cannot do PIO\n",
+ pio_vaddr, (unsigned long long)pio_paddr);
return -ENXIO;
}
@@ -490,8 +490,8 @@ usd_create_wq_pio(
wq = &qp->uq_wq;
ring_size = wq->uwq_num_entries * sizeof(struct wq_enet_desc);
ring_size += 64 - sizeof(struct wq_enet_desc);
- wq->pio_v_wq_addr = (void *)ivaddr;
- wq->pio_p_wq_addr = pio_paddr + ivaddr - (uint64_t)pio_vaddr;
+ wq->pio_v_wq_addr = (void *)(uintptr_t)ivaddr;
+ wq->pio_p_wq_addr = pio_paddr + ivaddr - (uint64_t)(uintptr_t)pio_vaddr;
ivaddr += ring_size;
/* round up to 64 bytes */
@@ -503,8 +503,8 @@ usd_create_wq_pio(
return ret;
/* packet buffer */
- wq->pio_v_pkt_buf = (void *)ivaddr;
- wq->pio_p_pkt_buf = pio_paddr + ivaddr - (uint64_t)pio_vaddr;
+ wq->pio_v_pkt_buf = (void *)(uintptr_t)ivaddr;
+ wq->pio_p_pkt_buf = pio_paddr + ivaddr - (uint64_t)(uintptr_t)pio_vaddr;
ivaddr += ((uint64_t) wq->uwq_num_entries) * 256;
used_size = ivaddr - (uintptr_t)pio_vaddr;
@@ -613,7 +613,7 @@ usd_create_rq(struct usd_qp_impl *qp)
if (ret != 0)
return ret;
- ret = usd_vnic_rq_init(rq, qp->uq_vf, (uint64_t)rq->urq_desc_ring);
+ ret = usd_vnic_rq_init(rq, qp->uq_vf, (uint64_t)(uintptr_t)rq->urq_desc_ring);
if (ret != 0)
goto out;
diff --git a/prov/util/src/uffd_mem_monitor.c b/prov/util/src/uffd_mem_monitor.c
index 7172e1e..4c79c3c 100644
--- a/prov/util/src/uffd_mem_monitor.c
+++ b/prov/util/src/uffd_mem_monitor.c
@@ -178,12 +178,12 @@ static void ofi_uffd_pagefault_handler(struct uffd_msg *msg)
if (flags != UFFD_PAGEFAULT_FLAG_WRITE) {
#if HAVE_UFFD_THREAD_ID
FI_WARN(&core_prov, FI_LOG_MR,
- "UFFD pagefault with unrecognized flags: %lu, address %p, thread %u\n",
- flags, address, ptid);
+ "UFFD pagefault with unrecognized flags: %" PRIu64 ", address %p, thread %u\n",
+ (uint64_t)flags, address, ptid);
#else
FI_WARN(&core_prov, FI_LOG_MR,
- "UFFD pagefault with unrecognized flags: %lu, address %p\n",
- flags, address);
+ "UFFD pagefault with unrecognized flags: %" PRIu64 ", address %p\n",
+ (uint64_t)flags, address);
#endif
/* The faulting thread is halted at this point. In
* theory we could wake it up with UFFDIO_WAKE. In
diff --git a/prov/util/src/util_av.c b/prov/util/src/util_av.c
index 68e16ae..1406af2 100644
--- a/prov/util/src/util_av.c
+++ b/prov/util/src/util_av.c
@@ -293,7 +293,7 @@ int ofi_av_insert_addr_at(struct util_av *av, const void *addr, fi_addr_t fi_add
memcpy(entry->data, addr, av->addrlen);
ofi_atomic_initialize32(&entry->use_cnt, 1);
HASH_ADD(hh, av->hash, data, av->addrlen, entry);
- FI_INFO(av->prov, FI_LOG_AV, "fi_addr: %" PRIu64 "\n",
+ FI_INFO(av->prov, FI_LOG_AV, "fi_addr: %zu\n",
ofi_buf_index(entry));
return 0;
}
@@ -324,7 +324,7 @@ int ofi_av_insert_addr(struct util_av *av, const void *addr, fi_addr_t *fi_addr)
memcpy(entry->data, addr, av->addrlen);
ofi_atomic_initialize32(&entry->use_cnt, 1);
HASH_ADD(hh, av->hash, data, av->addrlen, entry);
- FI_INFO(av->prov, FI_LOG_AV, "fi_addr: %" PRIu64 "\n",
+ FI_INFO(av->prov, FI_LOG_AV, "fi_addr: %zu\n",
ofi_buf_index(entry));
}
return 0;
diff --git a/prov/verbs/src/verbs_init.c b/prov/verbs/src/verbs_init.c
index 103904c..5bceb35 100644
--- a/prov/verbs/src/verbs_init.c
+++ b/prov/verbs/src/verbs_init.c
@@ -369,13 +369,14 @@ static int vrb_param_define(const char *param_name, const char *param_str,
switch (type) {
case FI_PARAM_STRING:
if (*(char **)param_default != NULL) {
- param_default_sz =
- MIN(strlen(*(char **)param_default),
- 254);
- strncpy(param_default_str, *(char **)param_default,
- param_default_sz);
- param_default_str[param_default_sz + 1] = '\0';
- }
+ const char *src = *(char **)param_default;
+ snprintf(param_default_str,
+ sizeof(param_default_str),
+ "%.*s",
+ (int)(sizeof(param_default_str) - 1),
+ src);
+ param_default_sz = strlen(param_default_str);
+ }
break;
case FI_PARAM_INT:
case FI_PARAM_BOOL:
@@ -634,137 +635,152 @@ static int vrb_get_param_str(const char *param_name,
return 0;
}
-int vrb_read_params(void)
+static int vrb_read_param_bool(const char *name, const char *desc, int *field)
{
- /* Common parameters */
- if (vrb_get_param_int("tx_size", "Default maximum tx context size",
- &vrb_gl_data.def_tx_size) ||
- (vrb_gl_data.def_tx_size < 0)) {
- VRB_WARN(FI_LOG_CORE, "Invalid value of tx_size\n");
- return -FI_EINVAL;
- }
- if (vrb_get_param_int("rx_size", "Default maximum rx context size",
- &vrb_gl_data.def_rx_size) ||
- (vrb_gl_data.def_rx_size < 0)) {
- VRB_WARN(FI_LOG_CORE, "Invalid value of rx_size\n");
- return -FI_EINVAL;
- }
- if (vrb_get_param_int("tx_iov_limit", "Default maximum tx iov_limit",
- &vrb_gl_data.def_tx_iov_limit) ||
- (vrb_gl_data.def_tx_iov_limit < 0)) {
- VRB_WARN(FI_LOG_CORE, "Invalid value of tx_iov_limit\n");
- return -FI_EINVAL;
- }
- if (vrb_get_param_int("rx_iov_limit", "Default maximum rx iov_limit",
- &vrb_gl_data.def_rx_iov_limit) ||
- (vrb_gl_data.def_rx_iov_limit < 0)) {
- VRB_WARN(FI_LOG_CORE, "Invalid value of rx_iov_limit\n");
- return -FI_EINVAL;
- }
- if (vrb_get_param_int("inline_size", "Maximum inline size for the "
- "verbs device. Actual inline size returned may "
- "be different depending on device capability. "
- "This value will be returned by fi_info as the "
- "inject size for the application to use. Set to "
- "0 for the maximum device inline size to be "
- "used. (default: 256).",
- &vrb_gl_data.def_inline_size) ||
- (vrb_gl_data.def_inline_size < 0)) {
- VRB_WARN(FI_LOG_CORE, "Invalid value of inline_size\n");
- return -FI_EINVAL;
- }
- if (vrb_get_param_int("min_rnr_timer", "Set min_rnr_timer QP "
- "attribute (0 - 31)",
- &vrb_gl_data.min_rnr_timer) ||
- ((vrb_gl_data.min_rnr_timer < 0) ||
- (vrb_gl_data.min_rnr_timer > 31))) {
- VRB_WARN(FI_LOG_CORE, "Invalid value of min_rnr_timer\n");
- return -FI_EINVAL;
- }
-
- if (vrb_get_param_bool("use_odp", "Enable on-demand paging memory "
- "registrations, if supported. This is "
- "currently required to register DAX file system "
- "mmapped memory.", &vrb_gl_data.use_odp)) {
- VRB_WARN(FI_LOG_CORE, "Invalid value of use_odp\n");
- return -FI_EINVAL;
- }
-
- if (vrb_get_param_bool("prefer_xrc", "Order XRC transport fi_infos "
- "ahead of RC. Default orders RC first. This "
- "setting must usually be combined with setting "
- "FI_OFI_RXM_USE_SRX. See fi_verbs.7 man page.",
- &vrb_gl_data.msg.prefer_xrc)) {
- VRB_WARN(FI_LOG_CORE, "Invalid value of prefer_xrc\n");
- return -FI_EINVAL;
- }
-
- if (vrb_get_param_str("xrcd_filename", "A file to "
- "associate with the XRC domain.",
- &vrb_gl_data.msg.xrcd_filename)) {
- VRB_WARN(FI_LOG_CORE, "Invalid value of xrcd_filename\n");
- return -FI_EINVAL;
- }
- if (vrb_get_param_int("cqread_bunch_size", "The number of entries to "
- "be read from the verbs completion queue at a time",
- &vrb_gl_data.cqread_bunch_size) ||
- (vrb_gl_data.cqread_bunch_size <= 0)) {
- VRB_WARN(FI_LOG_CORE, "Invalid value of cqread_bunch_size\n");
- return -FI_EINVAL;
- }
- if (vrb_get_param_int("gid_idx", "Set which gid index to use "
- "attribute (0 - 255)", &vrb_gl_data.gid_idx) ||
- (vrb_gl_data.gid_idx < 0 || vrb_gl_data.gid_idx > 255)) {
- VRB_WARN(FI_LOG_CORE, "Invalid value of gid index\n");
- return -FI_EINVAL;
- }
+ int tmp = *field;
+ int ret;
- if (vrb_get_param_str("device_name", "The prefix or the full name of the "
- "verbs device to use", &vrb_gl_data.device_name)) {
- VRB_WARN(FI_LOG_CORE, "Invalid value of device_name\n");
- return -FI_EINVAL;
- }
+ ret = vrb_get_param_bool(name, desc, &tmp);
+ if (ret)
+ return ret;
- if (vrb_gl_data.dmabuf_support) {
- if (vrb_get_param_bool("use_dmabuf", "Enable dmabuf based memory "
- "registrations, if supported. Yes by default.",
- (int *)&vrb_gl_data.dmabuf_support)) {
- VRB_WARN(FI_LOG_CORE, "Invalid value of use_dmabuf\n");
- return -FI_EINVAL;
- }
- }
- VRB_INFO(FI_LOG_CORE, "dmabuf support is %s\n",
- vrb_gl_data.dmabuf_support ? "enabled" : "disabled");
-
- /* MSG-specific parameter */
- if (vrb_get_param_str("iface", "The prefix or the full name of the "
- "network interface associated with the verbs "
- "device", &vrb_gl_data.iface)) {
- VRB_WARN(FI_LOG_CORE, "Invalid value of iface\n");
- return -FI_EINVAL;
- }
+ if (tmp != 0 && tmp != 1)
+ return -FI_EINVAL;
- /* DGRAM-specific parameters */
- if (getenv("OMPI_COMM_WORLD_RANK") || getenv("PMI_RANK"))
- vrb_gl_data.dgram.use_name_server = 0;
- if (vrb_get_param_bool("dgram_use_name_server", "The option that "
- "enables/disables OFI Name Server thread used "
- "to resolve IP-addresses to provider specific "
- "addresses. If MPI is used, the NS is disabled "
- "by default.", &vrb_gl_data.dgram.use_name_server)) {
- VRB_WARN(FI_LOG_CORE, "Invalid dgram_use_name_server\n");
- return -FI_EINVAL;
- }
- if (vrb_get_param_int("dgram_name_server_port", "The port on which "
- "the name server thread listens incoming "
- "requests.", &vrb_gl_data.dgram.name_server_port) ||
- (vrb_gl_data.dgram.name_server_port < 0 ||
- vrb_gl_data.dgram.name_server_port > 65535)) {
- VRB_WARN(FI_LOG_CORE, "Invalid dgram_name_server_port\n");
- return -FI_EINVAL;
- }
+ *field = tmp;
+ return 0;
+}
- return FI_SUCCESS;
+int vrb_read_params(void)
+{
+ /* Common parameters */
+ if (vrb_get_param_int("tx_size", "Default maximum tx context size",
+ &vrb_gl_data.def_tx_size) ||
+ vrb_gl_data.def_tx_size < 0) {
+ VRB_WARN(FI_LOG_CORE, "Invalid value of tx_size\n");
+ return -FI_EINVAL;
+ }
+
+ if (vrb_get_param_int("rx_size", "Default maximum rx context size",
+ &vrb_gl_data.def_rx_size) ||
+ vrb_gl_data.def_rx_size < 0) {
+ VRB_WARN(FI_LOG_CORE, "Invalid value of rx_size\n");
+ return -FI_EINVAL;
+ }
+
+ if (vrb_get_param_int("tx_iov_limit", "Default maximum tx iov_limit",
+ &vrb_gl_data.def_tx_iov_limit) ||
+ vrb_gl_data.def_tx_iov_limit < 0) {
+ VRB_WARN(FI_LOG_CORE, "Invalid value of tx_iov_limit\n");
+ return -FI_EINVAL;
+ }
+
+ if (vrb_get_param_int("rx_iov_limit", "Default maximum rx iov_limit",
+ &vrb_gl_data.def_rx_iov_limit) ||
+ vrb_gl_data.def_rx_iov_limit < 0) {
+ VRB_WARN(FI_LOG_CORE, "Invalid value of rx_iov_limit\n");
+ return -FI_EINVAL;
+ }
+
+ if (vrb_get_param_int("inline_size",
+ "Maximum inline size for the verbs device…",
+ &vrb_gl_data.def_inline_size) ||
+ vrb_gl_data.def_inline_size < 0) {
+ VRB_WARN(FI_LOG_CORE, "Invalid value of inline_size\n");
+ return -FI_EINVAL;
+ }
+
+ if (vrb_get_param_int("min_rnr_timer", "Set min_rnr_timer QP attribute (0 - 31)",
+ &vrb_gl_data.min_rnr_timer) ||
+ vrb_gl_data.min_rnr_timer < 0 ||
+ vrb_gl_data.min_rnr_timer > 31) {
+ VRB_WARN(FI_LOG_CORE, "Invalid value of min_rnr_timer\n");
+ return -FI_EINVAL;
+ }
+
+ if (vrb_read_param_bool("use_odp",
+ "Enable on-demand paging memory registrations…",
+ &vrb_gl_data.use_odp)) {
+ VRB_WARN(FI_LOG_CORE, "Invalid value of use_odp\n");
+ return -FI_EINVAL;
+ }
+
+ if (vrb_read_param_bool("prefer_xrc",
+ "Order XRC transport fi_infos ahead of RC…",
+ &vrb_gl_data.msg.prefer_xrc)) {
+ VRB_WARN(FI_LOG_CORE, "Invalid value of prefer_xrc\n");
+ return -FI_EINVAL;
+ }
+
+ if (vrb_get_param_str("xrcd_filename", "A file to associate with the XRC domain",
+ &vrb_gl_data.msg.xrcd_filename)) {
+ VRB_WARN(FI_LOG_CORE, "Invalid value of xrcd_filename\n");
+ return -FI_EINVAL;
+ }
+
+ if (vrb_get_param_int("cqread_bunch_size",
+ "The number of entries to read from the verbs CQ at a time",
+ &vrb_gl_data.cqread_bunch_size) ||
+ vrb_gl_data.cqread_bunch_size <= 0) {
+ VRB_WARN(FI_LOG_CORE, "Invalid value of cqread_bunch_size\n");
+ return -FI_EINVAL;
+ }
+
+ if (vrb_get_param_int("gid_idx", "Set which gid index to use (0 - 255)",
+ &vrb_gl_data.gid_idx) ||
+ vrb_gl_data.gid_idx < 0 ||
+ vrb_gl_data.gid_idx > 255) {
+ VRB_WARN(FI_LOG_CORE, "Invalid value of gid_idx\n");
+ return -FI_EINVAL;
+ }
+
+ if (vrb_get_param_str("device_name",
+ "The prefix or full name of the verbs device to use",
+ &vrb_gl_data.device_name)) {
+ VRB_WARN(FI_LOG_CORE, "Invalid value of device_name\n");
+ return -FI_EINVAL;
+ }
+
+ if (vrb_gl_data.dmabuf_support) {
+ if (vrb_read_param_bool("use_dmabuf",
+ "Enable dmabuf based memory registrations, if supported",
+ (int *)&vrb_gl_data.dmabuf_support)) {
+ VRB_WARN(FI_LOG_CORE, "Invalid value of use_dmabuf\n");
+ return -FI_EINVAL;
+ }
+ }
+ VRB_INFO(FI_LOG_CORE, "dmabuf support is %s\n",
+ vrb_gl_data.dmabuf_support ? "enabled" : "disabled");
+
+ /* MSG-specific parameter */
+ if (vrb_get_param_str("iface",
+ "Network interface prefix or full name",
+ &vrb_gl_data.iface)) {
+ VRB_WARN(FI_LOG_CORE, "Invalid value of iface\n");
+ return -FI_EINVAL;
+ }
+
+ /* DGRAM-specific parameters */
+ if (getenv("OMPI_COMM_WORLD_RANK") || getenv("PMI_RANK"))
+ vrb_gl_data.dgram.use_name_server = 0;
+
+ if (vrb_read_param_bool("dgram_use_name_server",
+ "Enable/disable OFI Name Server thread",
+ &vrb_gl_data.dgram.use_name_server)) {
+ VRB_WARN(FI_LOG_CORE, "Invalid dgram_use_name_server\n");
+ return -FI_EINVAL;
+ }
+
+ if (vrb_get_param_int("dgram_name_server_port",
+ "Port for name server thread",
+ &vrb_gl_data.dgram.name_server_port) ||
+ vrb_gl_data.dgram.name_server_port < 0 ||
+ vrb_gl_data.dgram.name_server_port > 65535) {
+ VRB_WARN(FI_LOG_CORE, "Invalid dgram_name_server_port\n");
+ return -FI_EINVAL;
+ }
+
+ return FI_SUCCESS;
}
static void verbs_devs_free(void)
diff --git a/prov/verbs/src/verbs_mr.c b/prov/verbs/src/verbs_mr.c
index 47ccf9d..5abf451 100644
--- a/prov/verbs/src/verbs_mr.c
+++ b/prov/verbs/src/verbs_mr.c
@@ -84,8 +84,12 @@ static struct ibv_mr *vrb_reg_hmem_dmabuf(enum fi_hmem_iface iface,
if (err)
goto failover;
- mr = ibv_reg_dmabuf_mr(pd, offset, len, (uint64_t)buf/* iova */,
- fd, vrb_access);
+ {
+ uintptr_t buf_addr = (uintptr_t)buf;
+ uint64_t iova = (uint64_t)buf_addr;
+ mr = ibv_reg_dmabuf_mr(pd, offset, len, iova,
+ fd, vrb_access);
+ }
if (!mr && failover_policy[iface] == TRY &&
vrb_gl_data.peer_mem_support) {
saved_errno = errno;
diff --git a/src/common.c b/src/common.c
index 5d1a009..072d1c0 100644
--- a/src/common.c
+++ b/src/common.c
@@ -444,7 +444,7 @@ sa_sin6:
*((uint64_t *)addr + 2), *((uint64_t *)addr + 3));
break;
case FI_ADDR_OPX:
- size = snprintf(buf, *len, "fi_addr_opx://%016lx", *(uint64_t *)addr);
+ size = snprintf(buf, *len, "fi_addr_opx://%016" PRIx64, *(uint64_t *)addr);
break;
case FI_ADDR_MLX:
size = snprintf(buf, *len, "fi_addr_mlx://%p", addr);
diff --git a/src/hmem.c b/src/hmem.c
index 7c3fa57..934c73a 100644
--- a/src/hmem.c
+++ b/src/hmem.c
@@ -100,7 +100,7 @@ static int ofi_hmem_no_dev_reg_copy_from_hmem(uint64_t handle, void *dest,
static int ofi_hmem_system_dev_register(const void *addr, size_t size,
uint64_t *handle)
{
- *handle = (uint64_t) addr;
+ *handle = (uint64_t)(uintptr_t) addr;
return FI_SUCCESS;
}
@@ -450,11 +450,11 @@ static ssize_t ofi_copy_mr_iov(struct ofi_mr **mr, const struct iovec *iov,
if (hmem_flags & OFI_HMEM_DATA_DEV_REG_HANDLE) {
if (dir == OFI_COPY_BUF_TO_IOV)
ofi_hmem_dev_reg_copy_to_hmem(
- hmem_iface, (uint64_t) hmem_data,
+ hmem_iface, (uint64_t)(uintptr_t) hmem_data,
hmem_buf, (char *) buf + done, len);
else
ofi_hmem_dev_reg_copy_from_hmem(
- hmem_iface, (uint64_t) hmem_data,
+ hmem_iface, (uint64_t)(uintptr_t) hmem_data,
(char *) buf + done, hmem_buf, len);
ret = FI_SUCCESS;
} else if (dir == OFI_COPY_BUF_TO_IOV)
diff --git a/src/hmem_ipc_cache.c b/src/hmem_ipc_cache.c
index 39bc61f..74158be 100644
--- a/src/hmem_ipc_cache.c
+++ b/src/hmem_ipc_cache.c
@@ -65,7 +65,7 @@ static int ipc_cache_add_region(struct ofi_mr_cache *cache, struct ofi_mr_entry
}
if (ret) {
FI_WARN(&core_prov, FI_LOG_CORE,
- "Failed to open hmem handle, addr: %p, len: %lu\n",
+ "Failed to open hmem handle, addr: %p, len: %zu\n",
entry->info.iov.iov_base, entry->info.iov.iov_len);
}
return ret;
|