int main(int argc, char *argv[]) { parse_opts(argc, argv); setup_msr(); setup_drm(); setup_modeset(); setup_vblank_interval(); setup_alarm(); printf("Test name:\t%s\n", opts.test_name); unset_mode(); set_mode(); setup_idle(); if (opts.do_page_flip) page_flip_test(); if (opts.do_draw) draw_test(); if (opts.do_draw_and_flip) draw_and_flip_test(); teardown_modeset(); teardown_drm(); teardown_msr(); return 0; }
int ompi_mtl_portals4_flowctl_add_procs(size_t me, size_t npeers, struct ompi_proc_t **procs) { int i; /* if epoch isn't 0, that means setup trees has been called, which means that this add_procs is a dynamic process, which we don't support */ if (ompi_mtl_portals4.flowctl.epoch_counter != -1) { return OMPI_ERR_NOT_SUPPORTED; } ompi_mtl_portals4.flowctl.epoch_counter = 0; ompi_mtl_portals4.flowctl.num_procs = npeers; if (0 == me) ompi_mtl_portals4.flowctl.i_am_root = true; else ompi_mtl_portals4.flowctl.i_am_root = false; if (ompi_mtl_portals4.use_logical) { ompi_mtl_portals4.flowctl.root.rank = 0; if (false == ompi_mtl_portals4.flowctl.i_am_root) { ompi_mtl_portals4.flowctl.parent.rank = (me - 1) / 2; } ompi_mtl_portals4.flowctl.me.rank = me; } else { ompi_mtl_portals4.flowctl.root = *((ptl_process_t*) procs[0]->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PORTALS4]); if (false == ompi_mtl_portals4.flowctl.i_am_root) { ompi_mtl_portals4.flowctl.parent = *((ptl_process_t*) procs[(me - 1) / 2]->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PORTALS4]); } ompi_mtl_portals4.flowctl.me = *((ptl_process_t*) procs[me]->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PORTALS4]); } for (i = 0 ; i < 2 ; ++i) { size_t tmp = (2 * me) + i + 1; if (tmp < npeers) { ompi_mtl_portals4.flowctl.num_children++; if (ompi_mtl_portals4.use_logical) ompi_mtl_portals4.flowctl.children[i].rank = tmp; else ompi_mtl_portals4.flowctl.children[i] = *((ptl_process_t*) procs[tmp]->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PORTALS4]); } } return setup_alarm(ompi_mtl_portals4.flowctl.epoch_counter); }
/*! * @brief This function will be called by the Scheduler. It takes the battery number as input, and returns a binary message as output. * @param battery_number the battery number * @return a binary message that contains the battery level, from 0x0 to 0xE */ unsigned char get_battery_level(int battery_number) { /* get the percentage from the battery*/ uint16_t percentage = get_percentage(battery_number); if (battery_number == FIRST_BATTERY) { /* send the percentage to the alarm */ setup_alarm(percentage); /* send the percentage to the leds*/ display_percentage(percentage); } /* the new bin msg protocol needs to be negotiated with Scheduler*/ // uint8_t binMsg = make_msg(batteryNumber, percentage); unsigned char bin_msg = translate_level(percentage); return bin_msg; }
static i32 hwt64_create_alarm(cc_hndl hndl, struct u64_val *expires, enum cc_hw_timer_mode mode) { u32 intr_mask; i32 rv = -1; struct hw_rtc64 *rtc = (struct hw_rtc64*) hndl; intr_mask = dsbl_irqc(); if(rtc && (false == rtc->has_alarm)) { rv = setup_alarm(rtc, expires); } enbl_irqc(intr_mask); return rv; }
static i32 hwt64_update_alarm(cc_hndl hndl, struct u64_val *expires) { u32 intr_mask; i32 rv = -1; struct hw_rtc64 *rtc = (struct hw_rtc64*) hndl; intr_mask = dsbl_irqc(); if(rtc && (true == rtc->has_alarm)) { rv = setup_alarm(rtc, expires); } enbl_irqc(intr_mask); return rv; }
static void run_child(void) { struct sockaddr_in sin; int rc = 0; listen_socket = socket(PF_INET, SOCK_STREAM, 0); if (listen_socket < 0) { printf("# socket: %s\n", strerror(errno)); rc = -1; } if (!rc) { bzero(&sin, sizeof(sin)); sin.sin_len = sizeof(sin); sin.sin_family = AF_INET; sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); sin.sin_port = htons(TEST_PORT); if (bind(listen_socket, (struct sockaddr *)&sin, sizeof(sin)) < 0) { printf("# bind: %s\n", strerror(errno)); rc = -1; } } if (!rc && listen(listen_socket, -1) < 0) { printf("# listen: %s\n", strerror(errno)); rc = -1; } if (!rc) { accept_socket = accept(listen_socket, NULL, NULL); setup_alarm(TEST_SECONDS); if (receive_test() != 0) rc = -1; } cancel_alarm(); if (accept_socket > 0) close(accept_socket); if (listen_socket > 0) close(listen_socket); _exit(rc); }
int main(int argc, char **argv) { char *devname = DEFAULT_DEVICE; unsigned seconds = 0; char *suspend = DEFAULT_MODE; int t; int fd; time_t alarm = 0; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); progname = basename(argv[0]); while ((t = getopt_long(argc, argv, "ahd:lm:s:t:uVv", long_options, NULL)) != EOF) { switch (t) { case 'a': /* CM_AUTO is default */ break; case 'd': devname = strdup(optarg); break; case 'l': clock_mode = CM_LOCAL; break; /* what system power mode to use? for now handle only * standardized mode names; eventually when systems * define their own state names, parse * /sys/power/state. * * "on" is used just to test the RTC alarm mechanism, * bypassing all the wakeup-from-sleep infrastructure. */ case 'm': if (strcmp(optarg, "standby") == 0 || strcmp(optarg, "mem") == 0 || strcmp(optarg, "disk") == 0 || strcmp(optarg, "on") == 0 || strcmp(optarg, "no") == 0 ) { suspend = strdup(optarg); break; } fprintf(stderr, _("%s: unrecognized suspend state '%s'\n"), progname, optarg); usage(EXIT_FAILURE); /* alarm time, seconds-to-sleep (relative) */ case 's': t = atoi(optarg); if (t < 0) { fprintf(stderr, _("%s: illegal interval %s seconds\n"), progname, optarg); usage(EXIT_FAILURE); } seconds = t; break; /* alarm time, time_t (absolute, seconds since * 1/1 1970 UTC) */ case 't': t = atoi(optarg); if (t < 0) { fprintf(stderr, _("%s: illegal time_t value %s\n"), progname, optarg); usage(EXIT_FAILURE); } alarm = t; break; case 'u': clock_mode = CM_UTC; break; case 'v': verbose++; break; case 'V': printf(_("%s: version %s\n"), progname, VERSION_STRING); exit(EXIT_SUCCESS); case 'h': usage(EXIT_SUCCESS); default: usage(EXIT_FAILURE); } } if (clock_mode == CM_AUTO) { if (read_clock_mode() < 0) { printf(_("%s: assuming RTC uses UTC ...\n"), progname); clock_mode = CM_UTC; } } if (verbose) printf(clock_mode == CM_UTC ? _("Using UTC time.\n") : _("Using local time.\n")); if (!alarm && !seconds) { fprintf(stderr, _("%s: must provide wake time\n"), progname); usage(EXIT_FAILURE); } /* when devname doesn't start with /dev, append it */ if (strncmp(devname, "/dev/", strlen("/dev/")) != 0) { char *new_devname; new_devname = malloc(strlen(devname) + strlen("/dev/") + 1); if (!new_devname) { perror(_("malloc() failed")); exit(EXIT_FAILURE); } strcpy(new_devname, "/dev/"); strcat(new_devname, devname); free(devname); devname = new_devname; } if (strcmp(suspend, "on") != 0 && strcmp(suspend, "no") != 0 && !is_wakeup_enabled(devname)) { fprintf(stderr, _("%s: %s not enabled for wakeup events\n"), progname, devname); exit(EXIT_FAILURE); } /* this RTC must exist and (if we'll sleep) be wakeup-enabled */ fd = open(devname, O_RDONLY); if (fd < 0) { perror(devname); exit(EXIT_FAILURE); } /* relative or absolute alarm time, normalized to time_t */ if (get_basetimes(fd) < 0) exit(EXIT_FAILURE); if (verbose) printf(_("alarm %ld, sys_time %ld, rtc_time %ld, seconds %u\n"), alarm, sys_time, rtc_time, seconds); if (alarm) { if (alarm < sys_time) { fprintf(stderr, _("%s: time doesn't go backward to %s\n"), progname, ctime(&alarm)); exit(EXIT_FAILURE); } alarm += sys_time - rtc_time; } else alarm = rtc_time + seconds + 1; if (setup_alarm(fd, &alarm) < 0) exit(EXIT_FAILURE); printf(_("%s: wakeup from \"%s\" using %s at %s\n"), progname, suspend, devname, ctime(&alarm)); fflush(stdout); usleep(10 * 1000); if (strcmp(suspend, "no") == 0) exit(EXIT_SUCCESS); else if (strcmp(suspend, "on") != 0) { sync(); suspend_system(suspend); } else { unsigned long data; do { t = read(fd, &data, sizeof data); if (t < 0) { perror(_("rtc read")); break; } if (verbose) printf("... %s: %03lx\n", devname, data); } while (!(data & RTC_AF)); } if (ioctl(fd, RTC_AIE_OFF, 0) < 0) perror(_("disable rtc alarm interrupt")); close(fd); exit(EXIT_SUCCESS); }
int rtcwake_main(int argc UNUSED_PARAM, char **argv) { time_t rtc_time; unsigned opt; const char *rtcname = NULL; const char *suspend; const char *opt_seconds; const char *opt_time; time_t sys_time; time_t alarm_time = 0; unsigned seconds = 0; int utc = -1; int fd; #if ENABLE_LONG_OPTS static const char rtcwake_longopts[] ALIGN1 = "auto\0" No_argument "a" "local\0" No_argument "l" "utc\0" No_argument "u" "device\0" Required_argument "d" "mode\0" Required_argument "m" "seconds\0" Required_argument "s" "time\0" Required_argument "t" ; applet_long_options = rtcwake_longopts; #endif opt = getopt32(argv, "alud:m:s:t:", &rtcname, &suspend, &opt_seconds, &opt_time); /* this is the default if (opt & RTCWAKE_OPT_AUTO) utc = -1; */ if (opt & (RTCWAKE_OPT_UTC | RTCWAKE_OPT_LOCAL)) utc = opt & RTCWAKE_OPT_UTC; if (!(opt & RTCWAKE_OPT_SUSPEND_MODE)) suspend = DEFAULT_MODE; if (opt & RTCWAKE_OPT_SECONDS) /* alarm time, seconds-to-sleep (relative) */ seconds = xatoi(opt_seconds); if (opt & RTCWAKE_OPT_TIME) /* alarm time, time_t (absolute, seconds since 1/1 1970 UTC) */ alarm_time = xatol(opt_time); if (!alarm_time && !seconds) bb_error_msg_and_die("must provide wake time"); if (utc == -1) utc = rtc_adjtime_is_utc(); /* the rtcname is relative to /dev */ xchdir("/dev"); /* this RTC must exist and (if we'll sleep) be wakeup-enabled */ fd = rtc_xopen(&rtcname, O_RDONLY); if (strcmp(suspend, "on") && !may_wakeup(rtcname)) bb_error_msg_and_die("%s not enabled for wakeup events", rtcname); /* relative or absolute alarm time, normalized to time_t */ sys_time = time(NULL); { struct tm tm_time; rtc_read_tm(&tm_time, fd); rtc_time = rtc_tm2time(&tm_time, utc); } if (alarm_time) { if (alarm_time < sys_time) bb_error_msg_and_die("time doesn't go backward to %s", ctime(&alarm_time)); alarm_time += sys_time - rtc_time; } else alarm_time = rtc_time + seconds + 1; setup_alarm(fd, &alarm_time, rtc_time); sync(); printf("wakeup from \"%s\" at %s", suspend, ctime(&alarm_time)); fflush_all(); usleep(10 * 1000); if (strcmp(suspend, "on")) xopen_xwrite_close(SYS_POWER_PATH, suspend); else { /* "fake" suspend ... we'll do the delay ourselves */ unsigned long data; do { ssize_t ret = safe_read(fd, &data, sizeof(data)); if (ret < 0) { bb_perror_msg("rtc read"); break; } } while (!(data & RTC_AF)); } xioctl(fd, RTC_AIE_OFF, 0); if (ENABLE_FEATURE_CLEAN_UP) close(fd); return EXIT_SUCCESS; }
int rtcwake_main(int argc UNUSED_PARAM, char **argv) { unsigned opt; const char *rtcname = NULL; const char *suspend = "standby"; const char *opt_seconds; const char *opt_time; time_t rtc_time; time_t sys_time; time_t alarm_time = alarm_time; unsigned seconds = seconds; /* for compiler */ int utc = -1; int fd; #if ENABLE_LONG_OPTS static const char rtcwake_longopts[] ALIGN1 = "auto\0" No_argument "a" "local\0" No_argument "l" "utc\0" No_argument "u" "device\0" Required_argument "d" "mode\0" Required_argument "m" "seconds\0" Required_argument "s" "time\0" Required_argument "t" ; #endif opt = getopt32long(argv, /* Must have -s or -t, exclusive */ "^alud:m:s:t:" "\0" "s:t:s--t:t--s", rtcwake_longopts, &rtcname, &suspend, &opt_seconds, &opt_time); /* this is the default if (opt & RTCWAKE_OPT_AUTO) utc = -1; */ if (opt & (RTCWAKE_OPT_UTC | RTCWAKE_OPT_LOCAL)) utc = opt & RTCWAKE_OPT_UTC; if (opt & RTCWAKE_OPT_SECONDS) { /* alarm time, seconds-to-sleep (relative) */ seconds = xatou(opt_seconds); } else { /* RTCWAKE_OPT_TIME */ /* alarm time, time_t (absolute, seconds since 1/1 1970 UTC) */ if (sizeof(alarm_time) <= sizeof(long)) alarm_time = xatol(opt_time); else alarm_time = xatoll(opt_time); } if (utc == -1) utc = rtc_adjtime_is_utc(); /* the rtcname is relative to /dev */ xchdir("/dev"); /* this RTC must exist and (if we'll sleep) be wakeup-enabled */ fd = rtc_xopen(&rtcname, O_RDONLY); if (strcmp(suspend, "on") != 0) if (!may_wakeup(rtcname)) bb_error_msg_and_die("%s not enabled for wakeup events", rtcname); /* relative or absolute alarm time, normalized to time_t */ sys_time = time(NULL); { struct tm tm_time; rtc_read_tm(&tm_time, fd); rtc_time = rtc_tm2time(&tm_time, utc); } if (opt & RTCWAKE_OPT_TIME) { /* Correct for RTC<->system clock difference */ alarm_time += rtc_time - sys_time; if (alarm_time < rtc_time) /* * Compat message text. * I'd say "RTC time is already ahead of ..." instead. */ bb_error_msg_and_die("time doesn't go backward to %s", ctime(&alarm_time)); } else alarm_time = rtc_time + seconds + 1; setup_alarm(fd, &alarm_time, rtc_time); sync(); #if 0 /*debug*/ printf("sys_time: %s", ctime(&sys_time)); printf("rtc_time: %s", ctime(&rtc_time)); #endif printf("wakeup from \"%s\" at %s", suspend, ctime(&alarm_time)); fflush_all(); usleep(10 * 1000); if (strcmp(suspend, "on") != 0) xopen_xwrite_close(SYS_POWER_PATH, suspend); else { /* "fake" suspend ... we'll do the delay ourselves */ unsigned long data; do { ssize_t ret = safe_read(fd, &data, sizeof(data)); if (ret < 0) { bb_perror_msg("rtc read"); break; } } while (!(data & RTC_AF)); } xioctl(fd, RTC_AIE_OFF, 0); if (ENABLE_FEATURE_CLEAN_UP) close(fd); return EXIT_SUCCESS; }
int main(int argc, char **argv) { struct rtcwake_control ctl = { .mode_str = "suspend", /* default mode */ .adjfile = _PATH_ADJTIME, .clock_mode = CM_AUTO }; char *devname = DEFAULT_RTC_DEVICE; unsigned seconds = 0; int suspend = SYSFS_MODE; int rc = EXIT_SUCCESS; int t; int fd; time_t alarm = 0; enum { OPT_DATE = CHAR_MAX + 1, OPT_LIST }; static const struct option long_options[] = { {"adjfile", required_argument, 0, 'A'}, {"auto", no_argument, 0, 'a'}, {"dry-run", no_argument, 0, 'n'}, {"local", no_argument, 0, 'l'}, {"utc", no_argument, 0, 'u'}, {"verbose", no_argument, 0, 'v'}, {"version", no_argument, 0, 'V'}, {"help", no_argument, 0, 'h'}, {"mode", required_argument, 0, 'm'}, {"device", required_argument, 0, 'd'}, {"seconds", required_argument, 0, 's'}, {"time", required_argument, 0, 't'}, {"date", required_argument, 0, OPT_DATE}, {"list-modes", no_argument, 0, OPT_LIST}, {0, 0, 0, 0 } }; static const ul_excl_t excl[] = { { 'a', 'l', 'u' }, { 's', 't', OPT_DATE }, }; int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); atexit(close_stdout); while ((t = getopt_long(argc, argv, "A:ahd:lm:ns:t:uVv", long_options, NULL)) != EOF) { err_exclusive_options(t, long_options, excl, excl_st); switch (t) { case 'A': /* for better compatibility with hwclock */ ctl.adjfile = optarg; break; case 'a': ctl.clock_mode = CM_AUTO; break; case 'd': devname = optarg; break; case 'l': ctl.clock_mode = CM_LOCAL; break; case OPT_LIST: list_modes(&ctl); return EXIT_SUCCESS; case 'm': if ((suspend = get_rtc_mode(&ctl, optarg)) < 0) errx(EXIT_FAILURE, _("unrecognized suspend state '%s'"), optarg); ctl.mode_str = optarg; break; case 'n': ctl.dryrun = 1; break; case 's': /* alarm time, seconds-to-sleep (relative) */ seconds = strtou32_or_err(optarg, _("invalid seconds argument")); break; case 't': /* alarm time, time_t (absolute, seconds since epoch) */ alarm = strtou32_or_err(optarg, _("invalid time argument")); break; case OPT_DATE: { /* alarm time, see timestamp format from manual */ usec_t p; if (parse_timestamp(optarg, &p) < 0) errx(EXIT_FAILURE, _("invalid time value \"%s\""), optarg); alarm = (time_t) (p / 1000000); break; } case 'u': ctl.clock_mode = CM_UTC; break; case 'v': ctl.verbose = 1; break; case 'V': printf(UTIL_LINUX_VERSION); exit(EXIT_SUCCESS); case 'h': usage(stdout); default: usage(stderr); } } if (ctl.clock_mode == CM_AUTO) { if (read_clock_mode(&ctl) < 0) { printf(_("%s: assuming RTC uses UTC ...\n"), program_invocation_short_name); ctl.clock_mode = CM_UTC; } } if (ctl.verbose) printf("%s", ctl.clock_mode == CM_UTC ? _("Using UTC time.\n") : _("Using local time.\n")); if (!alarm && !seconds && suspend != DISABLE_MODE && suspend != SHOW_MODE) errx(EXIT_FAILURE, _("must provide wake time (see --seconds, --time and --date options)")); /* device must exist and (if we'll sleep) be wakeup-enabled */ fd = open_dev_rtc(devname); if (suspend != ON_MODE && suspend != NO_MODE && !is_wakeup_enabled(devname)) errx(EXIT_FAILURE, _("%s not enabled for wakeup events"), devname); /* relative or absolute alarm time, normalized to time_t */ if (get_basetimes(&ctl, fd) < 0) exit(EXIT_FAILURE); if (ctl.verbose) printf(_("alarm %ld, sys_time %ld, rtc_time %ld, seconds %u\n"), alarm, ctl.sys_time, ctl.rtc_time, seconds); if (suspend != DISABLE_MODE && suspend != SHOW_MODE) { /* perform alarm setup when the show or disable modes are not set */ if (alarm) { if (alarm < ctl.sys_time) errx(EXIT_FAILURE, _("time doesn't go backward to %s"), ctime(&alarm)); alarm += ctl.sys_time - ctl.rtc_time; } else alarm = ctl.rtc_time + seconds + 1; if (setup_alarm(&ctl, fd, &alarm) < 0) exit(EXIT_FAILURE); if (suspend == NO_MODE || suspend == ON_MODE) printf(_("%s: wakeup using %s at %s"), program_invocation_short_name, devname, ctime(&alarm)); else printf(_("%s: wakeup from \"%s\" using %s at %s"), program_invocation_short_name, ctl.mode_str, devname, ctime(&alarm)); fflush(stdout); xusleep(10 * 1000); } switch (suspend) { case NO_MODE: if (ctl.verbose) printf(_("suspend mode: no; leaving\n")); ctl.dryrun = 1; /* to skip disabling alarm at the end */ break; case OFF_MODE: { char *arg[5]; int i = 0; if (ctl.verbose) printf(_("suspend mode: off; executing %s\n"), _PATH_SHUTDOWN); arg[i++] = _PATH_SHUTDOWN; arg[i++] = "-h"; arg[i++] = "-P"; arg[i++] = "now"; arg[i] = NULL; if (!ctl.dryrun) { execv(arg[0], arg); warn(_("failed to execute %s"), _PATH_SHUTDOWN); rc = EXIT_FAILURE; } break; } case ON_MODE: { unsigned long data; if (ctl.verbose) printf(_("suspend mode: on; reading rtc\n")); if (!ctl.dryrun) { do { t = read(fd, &data, sizeof data); if (t < 0) { warn(_("rtc read failed")); break; } if (ctl.verbose) printf("... %s: %03lx\n", devname, data); } while (!(data & RTC_AF)); } break; } case DISABLE_MODE: /* just break, alarm gets disabled in the end */ if (ctl.verbose) printf(_("suspend mode: disable; disabling alarm\n")); break; case SHOW_MODE: if (ctl.verbose) printf(_("suspend mode: show; printing alarm info\n")); if (print_alarm(&ctl, fd)) rc = EXIT_FAILURE; ctl.dryrun = 1; /* don't really disable alarm in the end, just show */ break; default: if (ctl.verbose) printf(_("suspend mode: %s; suspending system\n"), ctl.mode_str); sync(); suspend_system(&ctl); } if (!ctl.dryrun) { struct rtc_wkalrm wake; if (ioctl(fd, RTC_WKALM_RD, &wake) < 0) { warn(_("read rtc alarm failed")); rc = EXIT_FAILURE; } else { wake.enabled = 0; if (ioctl(fd, RTC_WKALM_SET, &wake) < 0) { warn(_("disable rtc alarm interrupt failed")); rc = EXIT_FAILURE; } } } close(fd); return rc; }
static int start_recover(void) { int ret; int64_t epoch_counter; ompi_mtl_portals4.flowctl.flowctl_active = true; epoch_counter = opal_atomic_add_64(&ompi_mtl_portals4.flowctl.epoch_counter, 1); opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "Entering flowctl_start_recover %ld", epoch_counter); /* re-arm trigger/alarm for next time */ ret = setup_alarm(epoch_counter); if (OMPI_SUCCESS != ret) { opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d setup_alarm failed: %d\n", __FILE__, __LINE__, ret); return ret; } /* setup barrier tree for getting us out of flow control */ ret = setup_barrier(epoch_counter); if (OMPI_SUCCESS != ret) { opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d setup_barrier failed: %d\n", __FILE__, __LINE__, ret); return ret; } /* drain all pending sends */ while (ompi_mtl_portals4.flowctl.send_slots != ompi_mtl_portals4.flowctl.max_send_slots) { opal_progress(); } /* drain event queue */ while (0 != ompi_mtl_portals4_progress()) { ; } /* check short block active count */ ret = ompi_mtl_portals4_recv_short_link(1); if (OMPI_SUCCESS != ret) { opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: recv_short_link failed: %d", __FILE__, __LINE__, ret); } /* reorder the pending sends by operation count */ ret = opal_list_sort(&ompi_mtl_portals4.flowctl.pending_sends, seqnum_compare); if (OMPI_SUCCESS != ret) { opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d opal_list_sort failed: %d\n", __FILE__, __LINE__, ret); return ret; } /* drain event queue again, just to make sure */ while (0 != ompi_mtl_portals4_progress()) { ; } /* send barrier entry message */ ret = PtlPut(ompi_mtl_portals4.zero_md_h, 0, 0, PTL_NO_ACK_REQ, ompi_mtl_portals4.flowctl.me, ompi_mtl_portals4.flowctl_idx, MTL_PORTALS4_FLOWCTL_FANIN, 0, NULL, 0); if (OPAL_UNLIKELY(PTL_OK != ret)) { opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlPut failed: %d\n", __FILE__, __LINE__, ret); goto error; } /* recovery complete when fan-out event arrives, async event, so we're done now */ ret = OMPI_SUCCESS; error: OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "Exiting flowctl_start_recover %ld", epoch_counter)); return ret; }