I am having a problem with rejected duplicate shares, which is weird, because there is no way that could happen:
wr_lock(&cgpu->qlock);
HASH_ITER(hh, cgpu->queued_work, work, tmp) {
if ( !work->stale && !(work->tv_work_start.tv_sec) ) {
cgtime(&work->tv_work_start);
wr_unlock(&cgpu->qlock);
return work;
}
1. Iteration is inside a wr_lock
2. Once accepted the work is marked as used/started again inside the lock
3. The whole function is called inside a thread private lock and no other thread is calling that function at all
4. Adding a job to the queue is also done under the same private lock
but still there are duplicates returned from different chips (if the same chip that may be just delayed chip scanning and work reuse), which points to the same work being returned in two consecutive calls or sending a work to the wrong chip.
Any pointers how to debug this?
Is the (struct work) job_id unique enough to identify that or subid (any driver as example?) should be used instead?