* workqueues and schedule()
@ 2005-02-16 16:02 Davide Rossetti
0 siblings, 0 replies; only message in thread
From: Davide Rossetti @ 2005-02-16 16:02 UTC (permalink / raw)
To: linux-kernel
<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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-02-16 16:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-16 16:02 workqueues and schedule() Davide Rossetti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®