Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Printk hangs when interrupted
PostPosted: Tue Apr 15, 2008 10:58 am 
Offline

Joined: Tue Apr 15, 2008 10:29 am
Posts: 1
Dear forum

I have a bit problematic issue in my hands. First some background info:
- Atmel AT91RM9200
- Linux 2.4.21-rmk1

I have two kernel modules who are not dependent of each other. I can rmmod or insmod either. It seems that spi interrupt occuring in middle of another module's printk causes the system to hang. Some explaining follows:

The first module is for sending traffic over spi by dma. The effective code involved of the problem is:

Code:
static void spi_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
  unsigned int status;

  status = (at91c_base_spi->SPI_SR & at91c_base_spi->SPI_IMR);
  if (status & AT91C_SPI_TDRE)  // DMA Tx interrupt
  {
    at91c_base_spi->SPI_TPR = virt_to_bus(&tx_dummy.data);
    at91c_base_spi->SPI_TCP = FRAME_FIXED_SIZE;
return;


The interrupt handler is cut down a bit for debugging purposes, but it does all the essential. It loads dma's Tx pointer register and counter register to keep the interrupts occuring.

Now the other module, completely independent, has an ioctl handler. It is also cut down for debugging:
Code:
static int fop_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
{
  unsigned long flags;

  // spin_lock_irqsave(&test_lock, flags);
  printk(".");
  // spin_unlock_irqrestore(&test_lock, flags);
  return -ENOENT;


The interesting part is the hang doesn't happen if I
- uncomment the spin lock statements, preventing interrupts,
- comment out the printk,
- change printk level so that the text doesn't output to the console,
- modify the spi module to not generate interrupts by leaving the Tx registers unloaded,
- or rmmod the spi module.

To test this, I have an application continuously calling the ioctl() for this driver. I'm rather confused since the problem is narrowed down to so small code region.

The hang seems to happen in the linux scheduler loop (or how do you call it) so that nothing happens, except interrupts keep flowing. But console doesn't take keystrokes and applications stop all activity.

Thanks in advance for advice!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: