/* Save power and let other threads use the h/w. top may show * 100% but only because OS doesn't know we slowed the this * h/w thread while polling. We're letting other threads have * higher throughput on the core.
*/
cpu_pri_low();
while (getnn(cmdp->crb.csb, csb_v) == 0) {
++poll;
hwsync();
cpu_pri_low();
/* usleep(0) takes around 29000 ticks ~60 us. * 300000 is spinning for about 600 us then * start sleeping.
*/ if ((__ppc_get_timebase() - t) > USLEEP_TH) {
cpu_pri_default();
usleep(1);
}
if (poll > CSB_MAX_POLL) break;
/* Fault address from signal handler */ if (nx_fault_storage_address) {
cpu_pri_default(); return -EAGAIN;
}
}
cpu_pri_default();
/* hw has updated csb and output buffer */
hwsync();
/* Check CSB flags. */ if (getnn(cmdp->crb.csb, csb_v) == 0) {
fprintf(stderr, "CSB still not valid after %d polls.\n",
(int) poll);
prt_err("CSB still not valid after %d polls, giving up.\n",
(int) poll); return -ETIMEDOUT;
}
return 0;
}
staticint nxu_run_job(struct nx_gzip_crb_cpb_t *cmdp, void *handle)
{ int i, ret, retries; struct nx_handle *nxhandle = handle;
assert(handle != NULL);
i = 0;
retries = 5000; while (i++ < retries) {
hwsync();
vas_copy(&cmdp->crb, 0);
ret = vas_paste(nxhandle->paste_addr, 0);
hwsync();
NXPRT(fprintf(stderr, "Paste attempt %d/%d returns 0x%x\n",
i, retries, ret));
if ((ret == 2) || (ret == 3)) {
ret = nx_wait_for_csb(cmdp); if (!ret) { goto out;
} elseif (ret == -EAGAIN) { long x;
prt_err("Touching address %p, 0x%lx\n",
nx_fault_storage_address,
*(long *) nx_fault_storage_address);
x = *(long *) nx_fault_storage_address;
*(long *) nx_fault_storage_address = x;
nx_fault_storage_address = 0; continue;
} else {
prt_err("wait_for_csb() returns %d\n", ret); break;
}
} else { if (i < 10) { /* spin for few ticks */ #define SPIN_TH 500UL
uint64_t fail_spin;
/* * Fault in pages prior to NX job submission. wr=1 may be required to * touch writeable pages. System zero pages do not fault-in the page as * intended. Typically set wr=1 for NX target pages and set wr=0 for NX * source pages.
*/ int nxu_touch_pages(void *buf, long buf_len, long page_len, int wr)
{ char *begin = buf; char *end = (char *) buf + buf_len - 1; volatilechar t;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.