2010-10-19 09:59:22 oops with rmmod of simple-gpio module
Prasanth Rajagopal (INDIA)
Message: 94735
I have just created a module project in eclipse & copied the contents of /drivers/char/simple-gpio.c to it. After inserting the module in the target running Linux, I try to remove it, but end up in Kernel OOps message as below. The code is a direct copy of the original driver. I am using uClinux-dist-2009R1.1-RC4. Any hints? I would also be happy to know how the OOps message was diagnosed (whoever replies).
- Prasanth.
>>>>>>>>.
root:/> cd root
root:~> ls
root:~> ls
simple_gpio_modified_driver.ko
root:~> insmod ./simple_gpio_modified_driver.ko
simple-gpio: now handling 160 GPIOs: 0 - 159
root:~> rmmod ./simple_gpio_modified_driver.ko
Instruction fetch misaligned address violation
- Attempted misaligned instruction cache fetch.
Kernel OOPS in progress
Deferred Exception context
CURRENT PROCESS:
COMM=rmmod PID=547
CPU = 0
TEXT = 0x03180000-0x031cd564 DATA = 0x003ac564-0x003afdcc
BSS = 0x003afdcc-0x00340000 USER-STACK = 0x0035fe90
return address: [0x000ca558]; contents of:
0x000ca530: 098b e52a 002e 0c42 181e ad52 0c42 181b
0x000ca540: 3045 300f 0062 e52a 0045 0c42 1807 ad52
0x000ca550: 0c42 1804 3045 300f [0062] e52a 0029 0c42
0x000ca560: 1821 ac92 0c42 181e 6c66 3045 300f 0127
ADSP-BF548-0.2 525(MHz CCLK) 131(MHz SCLK) (mpu off)
Linux version 2.6.28.10-ADI-2009R1.1
Built with gcc version 4.1.2 (ADI svn)
SEQUENCER STATUS: Not tainted
SEQSTAT: 0000002a IPEND: 8030 SYSCFG: 0006
EXCAUSE : 0x2a
interrupts disabled
physical IVG5 asserted : <0xffa00c20> { _evt_ivhw + 0x0 }
physical IVG15 asserted : <0xffa00eb0> { _evt_system_call + 0x0 }
logical irq 6 mapped : <0xffa00350> { _timer_interrupt + 0x0 }
logical irq 14 mapped : <0x001193cc> { _bfin_rtc_interrupt + 0x0 }
logical irq 48 mapped : <0x000c99e8> { _bfin_serial_rx_int + 0x0 }
logical irq 49 mapped : <0x000c9974> { _bfin_serial_tx_int + 0x0 }
logical irq 52 mapped : <0x0011c3d0> { _bfin_twi_interrupt_entry + 0x0 }
logical irq 53 mapped : <0x0011c3d0> { _bfin_twi_interrupt_entry + 0x0 }
logical irq 68 mapped : <0x000ee674> { _bfin_ata_interrupt + 0x0 }
logical irq 74 mapped : <0x000fce08> { _bf5xx_nand_dma_irq + 0x0 }
logical irq 76 mapped : <0x0011798c> { _bfin_kpad_isr + 0x0 }
logical irq 82 mapped : <0x00112510> { _blackfin_interrupt + 0x0 }
logical irq 85 mapped : <0x0011510c> { _dma_controller_irq + 0x0 }
logical irq 175 mapped : <0x000d1ac0> { _smsc911x_irqhandler + 0x0 }
RETE: <0x00000000> /* Maybe null pointer? */
RETN: <0x00361d68> /* kernel dynamic memory */
RETX: <0x00000480> /* Maybe fixed code section */
RETS: <0x000ca5a0> { _dev_uevent + 0xc4 }
PC : <0x000ca558> { _dev_uevent + 0x7c }
DCPLB_FAULT_ADDR: <0x03111374> /* kernel dynamic memory */
ICPLB_FAULT_ADDR: <0x000ca558> { _dev_uevent + 0x7c }
PROCESSOR STATE:
R0 : 002d4e00 R1 : 0031e000 R2 : 00000007 R3 : fffffffc
R4 : 0311e498 R5 : 001dd98c R6 : 00000000 R7 : 0031e000
P0 : 0031e0f1 P1 : 0031e010 P2 : 656c706d P3 : 00231ce4
P4 : 002d4e68 P5 : 002d4e00 FP : 00000001 SP : 00361c8c
LB0: 000af988 LT0: 000af988 LC0: 00000000
LB1: 000aeeae LT1: 000aeea2 LC1: 00000000
B0 : 00000000 L0 : 00000000 M0 : 00000000 I0 : 00000001
B1 : 00000000 L1 : 00000000 M1 : 00000000 I1 : 0021c164
B2 : 00000000 L2 : 00000000 M2 : 00000000 I2 : ffffffff
B3 : 00000000 L3 : 00000000 M3 : 00000000 I3 : ffffffff
A0.w: 00000002 A0.x: 00000000 A1.w: 00000002 A1.x: 00000000
USP : 0035fc30 ASTAT: 00002000
Hardware Trace:
0 Target : <0x00004d54> { _trap_c + 0x0 }
Source : <0xffa0067e> { _exception_to_level5 + 0xba }
1 Target : <0xffa005c4> { _exception_to_level5 + 0x0 }
Source : <0xffa00474> { _bfin_return_from_exception + 0x18 }
2 Target : <0xffa0045c> { _bfin_return_from_exception + 0x0 }
Source : <0xffa00510> { _ex_trap_c + 0x6c }
3 Target : <0xffa004a4> { _ex_trap_c + 0x0 }
Source : <0xffa0074a> { _trap + 0x5a }
4 Target : <0xffa006f0> { _trap + 0x0 }
Source : <0x000ca556> { _dev_uevent + 0x7a } 0x300f
5 Target : <0x000ca546> { _dev_uevent + 0x6a }
Source : <0x000ca576> { _dev_uevent + 0x9a } JUMP.S
6 Target : <0x000ca574> { _dev_uevent + 0x98 }
Source : <0x000ca538> { _dev_uevent + 0x5c } IF !CC JUMP
7 Target : <0x000ca532> { _dev_uevent + 0x56 }
Source : <0x000ca520> { _dev_uevent + 0x44 } IF !CC JUMP
8 Target : <0x000ca51a> { _dev_uevent + 0x3e }
Source : <0x000ca504> { _dev_uevent + 0x28 } IF !CC JUMP
9 Target : <0x000ca4fe> { _dev_uevent + 0x22 }
Source : <0x000ca5a0> { _dev_uevent + 0xc4 } JUMP.S
10 Target : <0x000ca5a0> { _dev_uevent + 0xc4 }
Source : <0x000ab8ae> { _add_uevent_var + 0x6a } RTS
11 Target : <0x000ab880> { _add_uevent_var + 0x3c }
Source : <0x000af09c> { _vsnprintf + 0x7c } RTS
12 Target : <0x000af08e> { _vsnprintf + 0x6e }
Source : <0x000af2ae> { _vsnprintf + 0x28e } JUMP.S
13 Target : <0x000af2aa> { _vsnprintf + 0x28a }
Source : <0x000af20a> { _vsnprintf + 0x1ea } IF CC JUMP
14 Target : <0x000af208> { _vsnprintf + 0x1e8 }
Source : <0x000af08c> { _vsnprintf + 0x6c } IF CC JUMP
15 Target : <0x000af06c> { _vsnprintf + 0x4c }
Source : <0x000af2a8> { _vsnprintf + 0x288 } JUMP.S
Kernel Stack
Stack info:
SP: [0x00361d0c] <0x00361d0c> /* kernel dynamic memory */
FP: (0x00361d70)
Memory from 0x00361d00 to 00362000
00361d00: 00000000 00000000 00000000 [ffffffff] ffffffff 0021c164 00000001 0035
fc30
00361d20: 00000001 002d4e00 002d4e68 00231ce4 656c706d 0031e010 0031e0f1 0031
e000
00361d40: 00000000 001dd98c 0311e498 fffffffc 00000007 0031e000 002d4e00 002d
4e00
00361d60: 0031e0f1 00000006 00361d88 00361d88 (00000000)<000aba24> 03df7da0 0000
0000
00361d80: 0311f0a8 <0006d1d4> 0311e498 00361d8c 00361d8c 03111360 0031e000 03da
1d00
00361da0: 002d4e00 000cabc8 0311f0a8 <000cab82> 03da1d00 002d4e00 000cabc8 002d
4e68
00361dc0: 0022534c 0000009f 0000004c 00000000 03d874b0 <0006e4c4><000cabbc> 0022
58e0
00361de0: 032af400 002d4e00 00000000 <000cabe4> 002258e0 <000cabee><000cabf4> 002d
4e00
00361e00: 0022534c 0311eee0 00231f4c 000ca108 <0311e27e> 00000000 <00022a7c> 0fb0
0000
00361e20: 002253f8 0035fc3c <000cc5d8> 0022534c 0311eee0 00231f4c 002253f8 0000
00ac
00361e40: 00000002 00000068 00000001 001df0a4 <000cc676> 0022534c 0311eee0 <000c
bb34>
00361e60: 0311ef7c 0311eee0 <000cbb3a> 0311ef7c 0311eee0 00000000 ffffe000 <0311
e470>
00361e80: 0311ef7c 00000000 <00027b2e> 0311ef7c 00000081 003f9940 00000000 0000
0073
00361ea0: 00000000 706d6973 675f656c 5f6f6970 69646f6d 64656966 6972645f 0072
6576
00361ec0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 0000
0000
00361ee0: 0311ef7c 00000880 00361eec 00000000 ffa00880 000279d0 00000081 0000
0000
00361f00: ffffe000 00000002 0000004c 0031c188 003f9cb8 0000fffe 00000002 0000
004c
00361f20: 00000002 0320c5d4 00008000 00000000 00000000 00362000 0320c5d4 0320
c5d4
00361f40:<0318a93c> ffa00f14 02003025 0313d7cf 0313e361 0313d7ce 0313e354 0000
0000
00361f60: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 0000
0000
00361f80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 0000
0000
00361fa0: 00000000 00000000 00000000 003f9940 0035ffe6 0035fc30 0035fc3c 003a
d9d8
00361fc0: 0035fc54 003f9940 0031c408 0320c5c8 00000081 00000880 000001ad 0000
0002
00361fe0: 0000004c 00000002 0035fc6f 00000880 0035fc54 0035fc54 00000081 0000
0006
Return addresses in stack:
frame 1 : <0x000aba24> { _kobject_uevent_env + 0x13c }
address : <0x0006d1d4> { _sysfs_hash_and_remove + 0x34 }
address : <0x000cab82> { _device_del + 0xf6 }
address : <0x0006e4c4> { _sysfs_addrm_finish + 0x38 }
address : <0x000cabbc> { _device_unregister + 0xc }
address : <0x000cabe4> { _device_destroy + 0x1c }
address : <0x000cabee> { _device_destroy + 0x26 }
address : <0x000cabf4> { _device_destroy + 0x2c }
address : <0x0311e27e> { :simple_gpio_modified_driver:_simple_gpio_remove + 0x3a
}
address : <0x00022a7c> { _blocking_notifier_call_chain + 0x10 }
address : <0x000cc5d8> { ___device_release_driver + 0x54 }
address : <0x000cc676> { _driver_detach + 0x72 }
address : <0x000cbb34> { _bus_remove_driver + 0x64 }
address : <0x000cbb3a> { _bus_remove_driver + 0x6a }
address : <0x0311e470> { :simple_gpio_modified_driver:_simple_gpio_exit + 0x18 }
address : <0x00027b2e> { _sys_delete_module + 0x15e }
address : <0x0318a93c> [ /bin/busybox + 0xa93c ]
Modules linked in: simple_gpio_modified_driver(-) hid_zpff hid_tmff ff_memless
Kernel panic - not syncing: Kernel exception
QuoteReplyEditDelete
2010-10-19 14:24:15 Re: oops with rmmod of simple-gpio module
Mike Frysinger (UNITED STATES)
Message: 94737
simple_gpio is dead. use the gpio-sysfs code as documented in the wiki.
docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:gpio-sysfs
QuoteReplyEditDelete
2010-10-21 12:39:08 Re: oops with rmmod of simple-gpio module
Prasanth Rajagopal (INDIA)
Message: 94813
Thanks.
Another question:
If I were to have a GPIO interrupt enabled for BF548 Push Button PB2 (on Kit), I should basically just call the request_irq with the flags, and this will do the initialization of gpio input, edge, triggered interrupt, along with the mapping of isr. But the below code doesnt give me falling/rising interrupt when I look in /proc/interrupts, after the insmod.
ret = request_irq( IRQ_PB2 , my_irq_handler, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, GPIO_DEV, NULL);
if (ret) {
printk(KERN_WARNING "IRQ %d is not free.\n", IRQ_PB2);
return ret;
}
I dont get the above warning for PB2 usage, and I can see my IRQ listed in /proc/interrupts.
I know the PB2 interrupt works, because it works with VDSP & I have written a modified simple-gpio program that detects the level of PB2 upon a press.
Tried a search and saw these (tried some code changes as in 2nd thread, though I could not find a technical difference)
blackfin.uclinux.org/gf/project/uclinux-dist/forum/?action=ForumBrowse&forum_id=39&thread_id=38097&_forum_action=ForumMessageBrowse
blackfin.uclinux.org/gf/project/uclinux-dist/forum/?action=ForumBrowse&forum_id=39&thread_id=26430&_forum_action=ForumMessageBrowse
The BF54x has these PINT configuration, unlike the older ones like BF533. I am not sure about that here.
Is there anything else I can look at, for the error? Any thoughts?
- Prasanth.
QuoteReplyEditDelete
2010-10-21 17:44:39 Re: oops with rmmod of simple-gpio module
Mike Frysinger (UNITED STATES)
Message: 94825
the default PINT assignments in the kernel should allow full access to port A and B gpios
look at the gpio-keys driver for handling things like push buttons:
docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:gpio-keys
QuoteReplyEditDelete
2010-10-22 12:30:10 Re: oops with rmmod of simple-gpio module
Prasanth Rajagopal (INDIA)
Message: 94883
Thanks, the gpio-keys was a good reference. PB2 interrupt assertion works if I have the gpio-key module running. But I couldnt find any mistake in my approach, after looking at that code also, unless there is something serious I am missing.
Here is the code (I dont think I need gpio_direction_input or gpio_to_irq, and irq_request should be sufficient, but having or not having those function calls didnt make a difference):
#include <linux/module.h>
#include <asm/gpio.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("GPIO Module");
MODULE_AUTHOR("Prasanth");
int irq;
#define GPIO_DEV "PB2 EVENT CHECK"
static irqreturn_t gpio_irq_handler(int irq, void *dev_id);
static __init int sample_module_init(void)
{
int ret;
printk("\nInside PB2 EVENT CHECK Module Init\n");
ret = gpio_request(GPIO_PB2, GPIO_DEV);
if (ret) {
printk("\nPB2 EVENT CHECK: unable to request GPIO_PB2\n");
return ret;
}
printk("\nGPIO granted\n");
ret = gpio_direction_input(GPIO_PB2);
if (ret) {
printk("\nPB2 EVENT CHECK: unable to to set GPIO_PB2 as input\n");
return ret;
}
printk("\nGPIO Direction set as input\n");
irq = gpio_to_irq(GPIO_PB2);
ret = request_irq( irq , gpio_irq_handler, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
GPIO_DEV, NULL);
if (ret) {
printk(KERN_WARNING "\nPB2 EVENT CHECK: IRQ %s is not free.\n", GPIO_DEV);
return ret;
}
printk("\nEdge triggered IRQ registered\n");
return 0;
}
static irqreturn_t gpio_irq_handler(int irq, void *dev_id)
{
printk("\ngpio_irq_handler\n");
return IRQ_HANDLED;
}
static __exit void sample_module_exit(void)
{
printk("\nInside Module PB2 EVENT CHECK Exit\n");
free_irq(irq,NULL);
gpio_free(GPIO_PB2);
}
module_init(sample_module_init);
module_exit(sample_module_exit);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
And the output::::
root:~> insmod simple_gpio_modified_driver.ko
Inside PB2 EVENT CHECK Module Init
GPIO granted
GPIO Direction set as input
bfin-gpio: GPIO 18 is already reserved by PB2 EVENT CHECK! (Documentation/blackfi
n/bfin-gpio-notes.txt)
Edge triggered IRQ registered
root:~> cat /proc/interrupts
6: 24790 CORE Blackfin CoreTimer
14: 1 INTN rtc-bfin
48: 95 INTN BFIN_UART_RX
49: 1768 INTN BFIN_UART_TX
root:~> insmod simple_gpio_modified_driver.ko
Inside PB2 EVENT CHECK Module Init
GPIO granted
GPIO Direction set as input
bfin-gpio: GPIO 18 is already reserved by PB2 EVENT CHECK! (Documentation/blackfi
n/bfin-gpio-notes.txt)
Edge triggered IRQ registered
root:~> cat /proc/interrupts
6: 34535 CORE Blackfin CoreTimer
14: 1 INTN rtc-bfin
48: 143 INTN BFIN_UART_RX
49: 3395 INTN BFIN_UART_TX
52: 0 INTN i2c-bfin-twi
53: 0 INTN i2c-bfin-twi
68: 3 INTN pata-bf54x
74: 0 INTN BF5XX NFC driver
76: 0 INTN bf54x-keys
82: 1 INTN musb_hdrc.0
85: 0 INTN musb_hdrc.0
121: 0 GPIO PB2 EVENT CHECK
175: 104 GPIO smsc911x
NMI: 0 CORE Non Maskable Interrupt
Err: 0
root:~> cat /proc/gpio
GPIO_16: i2c-bfin-twi Peripheral
GPIO_17: i2c-bfin-twi Peripheral
GPIO_18: gpio-irq121 * GPIO INPUT
Any thoughts?
QuoteReplyEditDelete
2010-10-22 12:41:28 Re: oops with rmmod of simple-gpio module
Prasanth Rajagopal (INDIA)
Message: 94885
Copied something two times. The output is actually (cat /proc/interrupts is after pressing the button):
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
root:~> insmod simple_gpio_modified_driver.ko
Inside PB2 EVENT CHECK Module Init
GPIO granted
GPIO Direction set as input
bfin-gpio: GPIO 18 is already reserved by PB2 EVENT CHECK! (Documentation/blackfi
n/bfin-gpio-notes.txt)
Edge triggered IRQ registered
root:~> cat /proc/interrupts
6: 34535 CORE Blackfin CoreTimer
14: 1 INTN rtc-bfin
48: 143 INTN BFIN_UART_RX
49: 3395 INTN BFIN_UART_TX
52: 0 INTN i2c-bfin-twi
53: 0 INTN i2c-bfin-twi
68: 3 INTN pata-bf54x
74: 0 INTN BF5XX NFC driver
76: 0 INTN bf54x-keys
82: 1 INTN musb_hdrc.0
85: 0 INTN musb_hdrc.0
121: 0 GPIO PB2 EVENT CHECK
175: 104 GPIO smsc911x
NMI: 0 CORE Non Maskable Interrupt
Err: 0
root:~> cat /proc/gpio
GPIO_16: i2c-bfin-twi Peripheral
GPIO_17: i2c-bfin-twi Peripheral
GPIO_18: gpio-irq121 * GPIO INPUT
QuoteReplyEditDelete
2010-10-24 03:13:43 Re: oops with rmmod of simple-gpio module
Prasanth Rajagopal (INDIA)
Message: 94908
Mike,
Is there anything you would like me to debug? I thought my module was the simplest for the purpose.
Thanks
Prasanth,
QuoteReplyEditDelete
2010-10-24 11:36:17 Re: oops with rmmod of simple-gpio module
Mike Frysinger (UNITED STATES)
Message: 94973
you have a known working module which you can trim down to find out why yours doesnt work