HFI1: adjust sdma_select_user_engine()

Conflicts:
	kernel/user_sdma.c
This commit is contained in:
Balazs Gerofi
2017-08-03 13:46:09 +09:00
parent b875b5186f
commit ec66229063
2 changed files with 20 additions and 5 deletions

View File

@@ -798,20 +798,28 @@ struct sdma_engine *sdma_select_engine_vl(
if (vl >= num_vls) { if (vl >= num_vls) {
#else #else
if (vl >= HFI1_MAX_VLS_SUPPORTED) { if (vl >= HFI1_MAX_VLS_SUPPORTED) {
#endif /* __HFI1_ORIG__ */ #endif /* __HFI1_ORIG__ */
rval = NULL; rval = NULL;
goto done; goto done;
} }
#ifdef __HFI1_ORIG__
rcu_read_lock(); rcu_read_lock();
m = rcu_dereference(dd->sdma_map); m = rcu_dereference(dd->sdma_map);
#else
m = (volatile struct sdma_vl_map *)dd->sdma_map;
#endif
if (unlikely(!m)) { if (unlikely(!m)) {
#ifdef __HFI1_ORIG__
rcu_read_unlock(); rcu_read_unlock();
#endif
return &dd->per_sdma[0]; return &dd->per_sdma[0];
} }
e = m->map[vl & m->mask]; e = m->map[vl & m->mask];
rval = e->sde[selector & e->mask]; rval = e->sde[selector & e->mask];
#ifdef __HFI1_ORIG__
rcu_read_unlock(); rcu_read_unlock();
#endif
done: done:
rval = !rval ? &dd->per_sdma[0] : rval; rval = !rval ? &dd->per_sdma[0] : rval;
@@ -881,6 +889,7 @@ static struct rhashtable_params sdma_rht_params = {
struct sdma_engine *sdma_select_user_engine(struct hfi1_devdata *dd, struct sdma_engine *sdma_select_user_engine(struct hfi1_devdata *dd,
u32 selector, u8 vl) u32 selector, u8 vl)
{ {
#ifdef __HFI1_ORIG__
struct sdma_rht_node *rht_node; struct sdma_rht_node *rht_node;
struct sdma_engine *sde = NULL; struct sdma_engine *sde = NULL;
const struct cpumask *current_mask = tsk_cpus_allowed(current); const struct cpumask *current_mask = tsk_cpus_allowed(current);
@@ -909,6 +918,7 @@ struct sdma_engine *sdma_select_user_engine(struct hfi1_devdata *dd,
return sde; return sde;
out: out:
#endif
return sdma_select_engine_vl(dd, selector, vl); return sdma_select_engine_vl(dd, selector, vl);
} }
@@ -3463,4 +3473,4 @@ void _sdma_engine_progress_schedule(
sde->progress_mask); sde->progress_mask);
} }
#endif /* __HFI1_ORIG__ */ #endif /* __HFI1_ORIG__ */

View File

@@ -758,8 +758,13 @@ int hfi1_user_sdma_process_request(void *private_data, struct iovec *iovec,
dlid = be16_to_cpu(req->hdr.lrh[1]); dlid = be16_to_cpu(req->hdr.lrh[1]);
selector = dlid_to_selector(dlid); selector = dlid_to_selector(dlid);
selector += uctxt->ctxt + fd->subctxt; selector += uctxt->ctxt + fd->subctxt;
/* TODO: sdma_select_user_engine check the rcu stuff */ /* TODO: check the rcu stuff */
//req->sde = sdma_select_user_engine(dd, selector, vl); /*
* XXX: didn't we conclude that we don't need to worry about RCU here?
* the mapping is created at driver initialization, the rest of the
* accesses are read-only
*/
req->sde = sdma_select_user_engine(dd, selector, vl);
if (!req->sde || !sdma_running(req->sde)) { if (!req->sde || !sdma_running(req->sde)) {
ret = -ECOMM; ret = -ECOMM;
@@ -1722,4 +1727,4 @@ static int sdma_rb_invalidate(void *arg, struct mmu_rb_node *mnode)
return 0; return 0;
} }
#endif /* __HFI1_ORIG__ */ #endif /* __HFI1_ORIG__ */