linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* BUG: scheduling while atomic:
@ 2011-10-05 11:24 smitha.vanga
  2011-10-05 16:05 ` David Laight
  2011-10-05 17:43 ` BUG: " Scott Wood
  0 siblings, 2 replies; 11+ messages in thread
From: smitha.vanga @ 2011-10-05 11:24 UTC (permalink / raw)
  To: scottwood; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 2371 bytes --]

Hi Scoot,

 When my  ISR gets exeuted I get a below BUG. Could let me what I am doing wrong in the ISR?


 BUG: scheduling while atomic: IRQ-20/0x0fff0000/108
Call Trace:
[C3AEFEC0] [C0007CCC]  (unreliable)
[C3AEFEF0] [C0017F10]
[C3AEFF00] [C0268818]
[C3AEFF50] [C0017F44]
[C3AEFF60] [C0018044]
[C3AEFF70] [C0046A90]
[C3AEFF90] [C0046D90]
[C3AEFFC0] [C0032AFC]
[C3AEFFF0] [C000F5AC]


Below is the code :
My ISR

irqreturn_t cpld_irq_handler(int irq, void * dev_id, struct pt_regs *regs)

{

wake_up(&cpld_intr_wait);

atomic_inc(&cpld_intr_data); /* incrementing this will indicate the poll() that the interrupt is occured */

return 0;

}

DRIVER_INIT
static int __init gpio_init(void)
{
        int ret = 0;
        int virq;


    atomic_set(&cpld_intr_data, 0);                     /* initialize the Interrupt indicator */
    init_waitqueue_head(&cpld_intr_wait);               /* Initialize the wait queue */

    virq = irq_create_mapping(NULL, CPLD1_INTERRUPT);


   if ((ret = request_irq(virq,cpld_irq_handler, 0, GPIO_CHAR_PATH, NULL))!=0)
   {
      printk(KERN_ERR "gpio_init: Could not grab IRQ line for CPLD ret = %d\n",ret);
          goto err1;
   }


        if((s_nGPIOMajor = register_chrdev(MPC8247_DEVICE_MAJOR_NUM, GPIO_CHAR_PATH, &gpio_fops))<0)
        {
                GPIO_DBG2("GPIO_DRIVER  : unable to get major %d\n", s_nGPIOMajor);
                return s_nGPIOMajor;

        }else{
                GPIO_DBG2("GPIO_DRIVER  : major = %x\n", s_nGPIOMajor );
        }

        return 0;

}

Thanks in Advance

Regards,
Smitha

Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. 

www.wipro.com

[-- Attachment #2: Type: text/html, Size: 5576 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: scheduling while atomic:
  2011-10-05 11:24 BUG: scheduling while atomic: smitha.vanga
@ 2011-10-05 16:05 ` David Laight
  2011-10-05 17:43 ` BUG: " Scott Wood
  1 sibling, 0 replies; 11+ messages in thread
From: David Laight @ 2011-10-05 16:05 UTC (permalink / raw)
  To: smitha.vanga, scottwood; +Cc: linuxppc-dev

Not entirely relevant to the error you are seeing,
but your ISR is:

>	irqreturn_t cpld_irq_handler(int irq, void * dev_id, struct
pt_regs *regs)
>	{
>		wake_up(&cpld_intr_wait);
>		atomic_inc(&cpld_intr_data); /* incrementing this will
indicate the poll() that the interrupt is occured */
>		return 0;
>	}

You need to set 'cpld_intr_data' before clling wake_up() otherwise
the sleeping process might run on another cpu before the data item
changes.

You also don't need to use the 'atomic' functions.
Writing to a 'volatile' data item is sufficent.
You don't want to count interrupts, just mark they have happened.

Maybe your problem it that the ISR doesn't do anything to
cause the hardware to drop its IRQ.

	David

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: BUG: scheduling while atomic:
  2011-10-05 11:24 BUG: scheduling while atomic: smitha.vanga
  2011-10-05 16:05 ` David Laight
@ 2011-10-05 17:43 ` Scott Wood
  2011-10-08 12:51   ` smitha.vanga
  2011-10-14  4:14   ` I2c-cpm drievr not working smitha.vanga
  1 sibling, 2 replies; 11+ messages in thread
From: Scott Wood @ 2011-10-05 17:43 UTC (permalink / raw)
  To: smitha.vanga; +Cc: linuxppc-dev

On 10/05/2011 06:24 AM, smitha.vanga@wipro.com wrote:
> Hi Scoot,
> 
>  When my  ISR gets exeuted I get a below BUG. Could let me what I am
> doing wrong in the ISR?
>  
>  
>  BUG: scheduling while atomic: IRQ-20/0x0fff0000/108
> Call Trace:
> [C3AEFEC0] [C0007CCC]  (unreliable)
> [C3AEFEF0] [C0017F10]
> [C3AEFF00] [C0268818]
> [C3AEFF50] [C0017F44]
> [C3AEFF60] [C0018044]
> [C3AEFF70] [C0046A90]
> [C3AEFF90] [C0046D90]
> [C3AEFFC0] [C0032AFC]
> [C3AEFFF0] [C000F5AC]

This trace is useless without debugging symbols from your kernel image.
Please enable kallsyms.

> Below is the code :
> *My ISR*
> 
> irqreturn_t cpld_irq_handler(int irq, void * dev_id, struct pt_regs *regs)
> 
> {
> 
> wake_up(&cpld_intr_wait);
> 
> atomic_inc(&cpld_intr_data); /* incrementing this will indicate the
> poll() that the interrupt is occured */

None of this should schedule when run in interrupt context.

The only thing that comes to mind is possibly wake_up(), if you're
running the RT patch but somehow the interrupt isn't in a thread.

> return 0;

Not related, but return IRQ_HANDLED;

-Scott

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: BUG: scheduling while atomic:
  2011-10-05 17:43 ` BUG: " Scott Wood
@ 2011-10-08 12:51   ` smitha.vanga
  2011-10-14  4:14   ` I2c-cpm drievr not working smitha.vanga
  1 sibling, 0 replies; 11+ messages in thread
From: smitha.vanga @ 2011-10-08 12:51 UTC (permalink / raw)
  To: scottwood; +Cc: linuxppc-dev

 
Hi Scott,

Below are the logs when I enable the kallsyms.
Any suggestion.


sh-3.1# I am in cpld_irq_handler
end cpld_irq_handler
BUG: scheduling while atomic: IRQ-20/0x0fff0000/108
Call Trace:
[C3B13EC0] [C0007DD0] show_stack+0x3c/0x194 (unreliable)
[C3B13EF0] [C0017F70] __schedule_bug+0x34/0x44
[C3B13F00] [C0269E38] schedule+0x31c/0x35c
[C3B13F50] [C0017FA4] __cond_resched+0x24/0x50
[C3B13F60] [C00180A4] cond_resched_hardirq_context+0x8c/0xfc
[C3B13F70] [C0047FBC] thread_simple_irq+0x78/0xc4
[C3B13F90] [C00482BC] do_irqd+0x2b4/0x32c
[C3B13FC0] [C0032BAC] kthread+0xc0/0xfc
[C3B13FF0] [C000F60C] original_kernel_thread+0x44/0x60



Regards,
Smitha
Please do not print this email unless it is absolutely necessary. =0A=
=0A=
The information contained in this electronic message and any attachments to=
 this message are intended for the exclusive use of the addressee(s) and may=
 contain proprietary, confidential or privileged information. If you are not=
 the intended recipient, you should not disseminate, distribute or copy this=
 e-mail. Please notify the sender immediately and destroy all copies of this=
 message and any attachments. =0A=
=0A=
WARNING: Computer viruses can be transmitted via email. The recipient should=
 check this email and any attachments for the presence of viruses. The compa=
ny accepts no liability for any damage caused by any virus transmitted by th=
is email. =0A=
=0A=
www.wipro.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* I2c-cpm drievr not working
  2011-10-05 17:43 ` BUG: " Scott Wood
  2011-10-08 12:51   ` smitha.vanga
@ 2011-10-14  4:14   ` smitha.vanga
  2011-10-14  5:42     ` Bhushan Bharat-R65777
  1 sibling, 1 reply; 11+ messages in thread
From: smitha.vanga @ 2011-10-14  4:14 UTC (permalink / raw)
  To: scottwood; +Cc: linuxppc-dev

 
Hi Scott,

I am using the i2c-cpm driver to read and write to a LM75 sensor. The 
int i2c_master_send(struct i2c_client *client,const char *buf ,int count) fu=
nction is not successful.
Could you let me know what may be the issue. Below are the traces.

DS75_DRIVER : Open
DS75_DRIVER : Device Open Successful!
DS75_DRIVER  : ioctl TEMP_READ cmd 1
In i2c_master_send enter-------
In i2c_master_send enter [2]-------
In i2c_master_send msg.addr=3Dc031
In i2c_master_send 1 client->addr =3D0
In i2c_master_send 2
In i2c_master_send 3
In i2c_master_send 4
--- enter i2c_transfer
i2c_transfer_entry
*********** cpm_i2c_xfer
***********cpm_i2c_parse_message
***********cpm_i2c_check_message
*********** else
 rv =3D1
In i2c_master_send 5
 i2c_master_recv client.addr=3D0
--- enter i2c_transfer
i2c_transfer_entry
*********** cpm_i2c_xfer
***********cpm_i2c_parse_message
i2c_adapter i2c-0: I2C transfer: timeout
*********** cpm_i2c_xfer out_err
***********cpm_i2c_force_close
 rv =3Dffffff87
DS75_DRIVER  : Error reading from I2C 

Regards,
Smitha
Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to=
 this message are intended for the exclusive use of the addressee(s) and may=
 contain proprietary, confidential or privileged information. If you are not=
 the intended recipient, you should not disseminate, distribute or copy this=
 e-mail. Please notify the sender immediately and destroy all copies of this=
 message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should=
 check this email and any attachments for the presence of viruses. The compa=
ny accepts no liability for any damage caused by any virus transmitted by th=
is email. 

www.wipro.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: I2c-cpm drievr not working
  2011-10-14  4:14   ` I2c-cpm drievr not working smitha.vanga
@ 2011-10-14  5:42     ` Bhushan Bharat-R65777
  2011-10-14 10:02       ` I2c-cpm driver " smitha.vanga
  0 siblings, 1 reply; 11+ messages in thread
From: Bhushan Bharat-R65777 @ 2011-10-14  5:42 UTC (permalink / raw)
  To: smitha.vanga@wipro.com, Wood Scott-B07421; +Cc: linuxppc-dev@lists.ozlabs.org



> -----Original Message-----
> From: linuxppc-dev-bounces+bharat.bhushan=3Dfreescale.com@lists.ozlabs.or=
g
> [mailto:linuxppc-dev-
> bounces+bharat.bhushan=3Dfreescale.com@lists.ozlabs.org] On Behalf Of
> smitha.vanga@wipro.com
> Sent: Friday, October 14, 2011 9:45 AM
> To: Wood Scott-B07421
> Cc: linuxppc-dev@lists.ozlabs.org
> Subject: I2c-cpm drievr not working
>=20
>=20
> Hi Scott,
>=20
> I am using the i2c-cpm driver to read and write to a LM75 sensor. The int
> i2c_master_send(struct i2c_client *client,const char *buf ,int count)
> function is not successful.
> Could you let me know what may be the issue. Below are the traces.
>=20
> DS75_DRIVER : Open
> DS75_DRIVER : Device Open Successful!
> DS75_DRIVER  : ioctl TEMP_READ cmd 1
> In i2c_master_send enter-------
> In i2c_master_send enter [2]-------
> In i2c_master_send msg.addr=3Dc031
> In i2c_master_send 1 client->addr =3D0
> In i2c_master_send 2
> In i2c_master_send 3
> In i2c_master_send 4
> --- enter i2c_transfer

I am a bit confused that i2c_transfer() is called after i2c_master_send is =
entered 4 times. Should not this be called every time ?

> i2c_transfer_entry
> *********** cpm_i2c_xfer
> ***********cpm_i2c_parse_message
> ***********cpm_i2c_check_message
> *********** else
>  rv =3D1
> In i2c_master_send 5
>  i2c_master_recv client.addr=3D0
> --- enter i2c_transfer

This time it is called on first shot.

Do you think you need to define I2C_CHIP_ERRATA ?

Thanks
-Bharat

> i2c_transfer_entry
> *********** cpm_i2c_xfer
> ***********cpm_i2c_parse_message
> i2c_adapter i2c-0: I2C transfer: timeout
> *********** cpm_i2c_xfer out_err
> ***********cpm_i2c_force_close
>  rv =3Dffffff87
> DS75_DRIVER  : Error reading from I2C
>=20
> Regards,
> Smitha
> Please do not print this email unless it is absolutely necessary.
>=20
> The information contained in this electronic message and any attachments
> to this message are intended for the exclusive use of the addressee(s)
> and may contain proprietary, confidential or privileged information. If
> you are not the intended recipient, you should not disseminate,
> distribute or copy this e-mail. Please notify the sender immediately and
> destroy all copies of this message and any attachments.
>=20
> WARNING: Computer viruses can be transmitted via email. The recipient
> should check this email and any attachments for the presence of viruses.
> The company accepts no liability for any damage caused by any virus
> transmitted by this email.
>=20
> www.wipro.com
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: I2c-cpm driver not working
  2011-10-14  5:42     ` Bhushan Bharat-R65777
@ 2011-10-14 10:02       ` smitha.vanga
  2011-10-17  3:58         ` Bhushan Bharat-R65777
  0 siblings, 1 reply; 11+ messages in thread
From: smitha.vanga @ 2011-10-14 10:02 UTC (permalink / raw)
  To: R65777, B07421; +Cc: linuxppc-dev


 Hi ,


I see that the i2c_master_send works but when I do a i2c_master_recv returns=
 with a error code -121.

What should be the i2c-base address be configured for the i2c-cpm driver for=
 mpc9247 . Also

When I pass the interrupt for this driver as 1 , I see the registered interr=
upt number as 10 in /proc/interrupts why is it like this?

Regards,
Smitha
Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to=
 this message are intended for the exclusive use of the addressee(s) and may=
 contain proprietary, confidential or privileged information. If you are not=
 the intended recipient, you should not disseminate, distribute or copy this=
 e-mail. Please notify the sender immediately and destroy all copies of this=
 message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should=
 check this email and any attachments for the presence of viruses. The compa=
ny accepts no liability for any damage caused by any virus transmitted by th=
is email. 

www.wipro.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: I2c-cpm driver not working
  2011-10-14 10:02       ` I2c-cpm driver " smitha.vanga
@ 2011-10-17  3:58         ` Bhushan Bharat-R65777
  2011-10-17  8:17           ` smitha.vanga
  0 siblings, 1 reply; 11+ messages in thread
From: Bhushan Bharat-R65777 @ 2011-10-17  3:58 UTC (permalink / raw)
  To: smitha.vanga@wipro.com, Wood Scott-B07421; +Cc: linuxppc-dev@lists.ozlabs.org

Hi Smitha,

Can you provide the device tree information for i2c node?

Thanks
-Bharat

> -----Original Message-----
> From: smitha.vanga@wipro.com [mailto:smitha.vanga@wipro.com]
> Sent: Friday, October 14, 2011 3:33 PM
> To: Bhushan Bharat-R65777; Wood Scott-B07421
> Cc: linuxppc-dev@lists.ozlabs.org
> Subject: RE: I2c-cpm driver not working
>=20
>=20
>  Hi ,
>=20
>=20
> I see that the i2c_master_send works but when I do a i2c_master_recv
> returns with a error code -121.
>=20
> What should be the i2c-base address be configured for the i2c-cpm driver
> for mpc9247 . Also
>=20
> When I pass the interrupt for this driver as 1 , I see the registered
> interrupt number as 10 in /proc/interrupts why is it like this?
>=20
> Regards,
> Smitha
> Please do not print this email unless it is absolutely necessary.
>=20
> The information contained in this electronic message and any attachments
> to this message are intended for the exclusive use of the addressee(s)
> and may contain proprietary, confidential or privileged information. If
> you are not the intended recipient, you should not disseminate,
> distribute or copy this e-mail. Please notify the sender immediately and
> destroy all copies of this message and any attachments.
>=20
> WARNING: Computer viruses can be transmitted via email. The recipient
> should check this email and any attachments for the presence of viruses.
> The company accepts no liability for any damage caused by any virus
> transmitted by this email.
>=20
> www.wipro.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: I2c-cpm driver not working
  2011-10-17  3:58         ` Bhushan Bharat-R65777
@ 2011-10-17  8:17           ` smitha.vanga
  2011-10-18  4:05             ` Bhushan Bharat-R65777
  0 siblings, 1 reply; 11+ messages in thread
From: smitha.vanga @ 2011-10-17  8:17 UTC (permalink / raw)
  To: R65777, B07421; +Cc: linuxppc-dev

 
Hi Bhusan,

Below is i2c node in the device tree.

i2c@11860 {
				compatible =3D "fsl-i2c-cpm";
				device_type =3D "i2c";
	  			reg =3D <11860 20 8afc 2>;
				interrupts =3D <1 8>;
				interrupt-parent =3D <10c00>;
				#address-cells =3D <1>;
				#size-cells =3D <0>;
				cell-index =3D <0>;
				fsl,cpm-command =3D <29600000>;

				
			};


Regards,
Smitha
Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to=
 this message are intended for the exclusive use of the addressee(s) and may=
 contain proprietary, confidential or privileged information. If you are not=
 the intended recipient, you should not disseminate, distribute or copy this=
 e-mail. Please notify the sender immediately and destroy all copies of this=
 message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should=
 check this email and any attachments for the presence of viruses. The compa=
ny accepts no liability for any damage caused by any virus transmitted by th=
is email. 

www.wipro.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: I2c-cpm driver not working
  2011-10-17  8:17           ` smitha.vanga
@ 2011-10-18  4:05             ` Bhushan Bharat-R65777
  2011-10-18  8:05               ` IRQ2 and IRQ 3 smitha.vanga
  0 siblings, 1 reply; 11+ messages in thread
From: Bhushan Bharat-R65777 @ 2011-10-18  4:05 UTC (permalink / raw)
  To: smitha.vanga@wipro.com, Wood Scott-B07421; +Cc: linuxppc-dev@lists.ozlabs.org



> -----Original Message-----
> From: linuxppc-dev-bounces+bharat.bhushan=3Dfreescale.com@lists.ozlabs.or=
g
> [mailto:linuxppc-dev-
> bounces+bharat.bhushan=3Dfreescale.com@lists.ozlabs.org] On Behalf Of
> smitha.vanga@wipro.com
> Sent: Monday, October 17, 2011 1:48 PM
> To: Bhushan Bharat-R65777; Wood Scott-B07421
> Cc: linuxppc-dev@lists.ozlabs.org
> Subject: RE: I2c-cpm driver not working
>=20
>=20
> Hi Bhusan,
>=20
> Below is i2c node in the device tree.
>=20
> i2c@11860 {
> 				compatible =3D "fsl-i2c-cpm";
> 				device_type =3D "i2c";
> 	  			reg =3D <11860 20 8afc 2>;
> 				interrupts =3D <1 8>;
> 				interrupt-parent =3D <10c00>;
> 				#address-cells =3D <1>;
> 				#size-cells =3D <0>;
> 				cell-index =3D <0>;
> 				fsl,cpm-command =3D <29600000>;
>=20
>=20
> 			};
>=20

This looks ok to me, I hope you provides proper reg, interrupt number, pola=
rity and sense (as per you mpc9247 specification)?

Thanks
-Bharat

>=20
> Regards,
> Smitha
> Please do not print this email unless it is absolutely necessary.
>=20
> The information contained in this electronic message and any attachments
> to this message are intended for the exclusive use of the addressee(s)
> and may contain proprietary, confidential or privileged information. If
> you are not the intended recipient, you should not disseminate,
> distribute or copy this e-mail. Please notify the sender immediately and
> destroy all copies of this message and any attachments.
>=20
> WARNING: Computer viruses can be transmitted via email. The recipient
> should check this email and any attachments for the presence of viruses.
> The company accepts no liability for any damage caused by any virus
> transmitted by this email.
>=20
> www.wipro.com
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply	[flat|nested] 11+ messages in thread

* IRQ2 and IRQ 3
  2011-10-18  4:05             ` Bhushan Bharat-R65777
@ 2011-10-18  8:05               ` smitha.vanga
  0 siblings, 0 replies; 11+ messages in thread
From: smitha.vanga @ 2011-10-18  8:05 UTC (permalink / raw)
  To: B07421; +Cc: linuxppc-dev

 
Hi ,

I want to use IRQ2 and IRQ3 in my driver. How do I add them in the device tr=
ee file.

Regard,
Smitha

Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to=
 this message are intended for the exclusive use of the addressee(s) and may=
 contain proprietary, confidential or privileged information. If you are not=
 the intended recipient, you should not disseminate, distribute or copy this=
 e-mail. Please notify the sender immediately and destroy all copies of this=
 message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should=
 check this email and any attachments for the presence of viruses. The compa=
ny accepts no liability for any damage caused by any virus transmitted by th=
is email. 

www.wipro.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-10-18  8:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-05 11:24 BUG: scheduling while atomic: smitha.vanga
2011-10-05 16:05 ` David Laight
2011-10-05 17:43 ` BUG: " Scott Wood
2011-10-08 12:51   ` smitha.vanga
2011-10-14  4:14   ` I2c-cpm drievr not working smitha.vanga
2011-10-14  5:42     ` Bhushan Bharat-R65777
2011-10-14 10:02       ` I2c-cpm driver " smitha.vanga
2011-10-17  3:58         ` Bhushan Bharat-R65777
2011-10-17  8:17           ` smitha.vanga
2011-10-18  4:05             ` Bhushan Bharat-R65777
2011-10-18  8:05               ` IRQ2 and IRQ 3 smitha.vanga

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).