<environment> I'm authoring a (GPL) driver for a custom 3D network card. </environment>
on calling some polling functions from within a workqueue, I'm getting lockups... sysrq-p got it clear I have a workqueue thread down into schedule_timeout().
is considered polite to call schedule ? is in_softirq() capable to diff workqueue/normal case ?
static int __apedev_hdrring_poll_end_dma(ApeDev* apedev, struct ApeHdrRing* ring)
{
int ret = 0;
int counter;
APE_BUG_ON(0 == ring);
APE_BUG_ON(0 == apedev); // here I poll on the rwbuf memory content till dma is done
ndelay(5*HZPCI);
APEDEV_COUNTER_INC(apedev, hdrring_poll_ndelay_cnt);
counter = 0;
while(1) {
if(0 != __apedev_hdrring_check_magic(apedev, ring))
break;
counter++; ndelay(20*HZPCI); if(0 == counter % 512) { APEDEV_COUNTER_INC(apedev, hdrring_poll_ndelay_cnt); ndelay(50*HZPCI); } if(counter==2048*16) { // time past is 2048*16/512*50HZPCI PDEBUG("counter overflows 2048*16, delaying 1 jiffy\n");
set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(MAX(HZ/100,1)); //<----
counter = 0; APEDEV_COUNTER_INC(apedev, hdrring_poll_resched_cnt); } if(signal_pending(current)) { PERROR("GOT SIGNAL!!!\n"); //apedev_v3_dump_regs(apedev); ret = -EINTR; goto err; } } err: return ret; }
// fast path
static inline int apedev_hdrring_poll_end_dma(ApeDev* apedev, struct ApeHdrRing* ring)
{
int ret = 0;
int retcode;
APE_BUG_ON(0 == ring);
APE_BUG_ON(0 == apedev); retcode = __apedev_hdrring_check_magic(apedev, ring);
if(retcode < 0) {
PERROR("error in check_magic\n");
ret = retcode;
// exit with true...
} else if(ret==0) {
ret = __apedev_hdrring_poll_end_dma(apedev, ring);
PDEBUG("ret=%d\n", ret);
}
return ret;
}
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/