[etherlab-users] Beginner: kernel Oops fault after modification of example "mini.c"

Gustav Nicolay Meilby Nobel GNO at CABINPLANT.COM
Thu Apr 23 12:32:39 CEST 2020


Hi Richard.

Thanks for the fast replay.
Yes I have an el1008 and a el2008 connected to the master (CX5130) through the terminal bus, and I am able to see both with "ethercat" command tool.



Best regards

Cabinplant A/S

Gustav Nicolay Meilby Nobel
Automation Engineer

5683 Haarby
Denmark
T:
E-mail: mailto:GNO at CABINPLANT.COM
Internet: http://www.cabinplant.com

Meet us at:
Exhibition list: http://www.cabinplant.com/exhibitions

Cabinplant register the personal data found in the emails we have received.
You can read more about our privacy policy https://www.cabinplant.com/about-us/privacy-and-cookie-statement/.



-----Original Message-----
From: Richard Hacker [mailto:ha at igh.de]
Sent: 23. april 2020 11:45
To: Gustav Nicolay Meilby Nobel; etherlab-users at etherlab.org
Subject: Re: [etherlab-users] Beginner: kernel Oops fault after modification of example "mini.c"

Hi Gustav

You do have a slave attached, do you? I sometimes ran into segfaults like this with the ccat driver when there are no attached slaves.

Mit freundlichem Gruß

Richard Hacker

--
------------------------------------------------------------------------

Richard Hacker M.Sc.
richard.hacker at igh.de
Tel.: +49 201 / 36014-16

Ingenieurgemeinschaft IgH
Gesellschaft für Ingenieurleistungen mbH Heinz-Bäcker-Str. 34
D-45356 Essen

Amtsgericht Essen HRB 11500
USt-Id.-Nr.: DE 174 626 722
Geschäftsführung:
- Dr.-Ing. Siegfried Rotthäuser
- Dr. Sven Beermann, Prokurist
Tel.: +49 201 / 360-14-0
http://www.igh.de

------------------------------------------------------------------------

On 2020-04-23 11:00, Gustav Nicolay Meilby Nobel wrote:
> Hej all.
>
> I have recently run into a problem when I try to run a modified
> version of the mini example code from the ethercat master.
>
> After I insert the module the dmesg reads as follow:
>
> [  199.144403] ec_mini: module verification failed: signature and/or
> required key missing - tainting kernel
>
> [  199.144434] ec_mini: no symbol version for ecrt_request_master
>
> [  199.145007] ec_mini: Starting...
>
> [  199.145012] EtherCAT: Requesting master 0...
>
> [  199.145017] EtherCAT: Successfully requested master 0.
>
> [  199.145019] ec_mini: Registering domain...
>
> [  199.145024] ec_mini: Configuring PDOs...
>
> [  199.145056] BUG: unable to handle kernel NULL pointer dereference
> at
> 00000008
>
> [  199.145080] IP: [<f8716501>] ecrt_slave_config_pdos+0x11/0x1f0
> [ec_master]
>
> [  199.145084] *pdpt = 000000002c0bf001 *pde = 0000000000000000
>
> [  199.145085]
>
> [  199.145088] Oops: 0000 [#1] PREEMPT SMP
>
> [  199.145132] Modules linked in: ec_mini(OE+) nls_iso8859_1
> usb_storage
> ec_generic(O) ec_ccat_netdev(O) ec_master(O) ccat_update(O)
> ccat_systemtime(O) ccat_sram(O) ccat_gpio(O) snd_hda_codec_hdmi
> intel_rapl intel_powerclamp i915 coretemp kvm_intel kvm drm_kms_helper
> irqbypass snd_hda_intel crc32_pclmul snd_hda_codec aesni_intel
> aes_i586 drm xts snd_hda_core lrw ablk_helper cryptd snd_hwdep snd_pcm
> joydev serio_raw lpc_ich ccat(O) snd_timer snd shpchp fb_sys_fops
> syscopyarea soundcore sysfillrect sysimgblt autofs4 video mac_hid lp
> parport igb hid_generic usbhid hid i2c_algo_bit ptp pps_core ahci
> libahci sdhci_pci sdhci [last unloaded: ccat_netdev]
>
> [  199.145137] CPU: 1 PID: 1740 Comm: insmod Tainted: G           OE
> 4.9.219-rt142 #1
>
> [  199.145139] Hardware name: Beckhoff Automation GmbH & Co. KG
> CX5130-0120/CX51x0, BIOS CX51x0 - 0.51 01/04/2017
>
> [  199.145141] task: ed22db40 task.stack: ec04e000
>
> [  199.145144] EIP: 0060:[<f8716501>] EFLAGS: 00010296 CPU: 1
>
> [  199.145163] EIP is at ecrt_slave_config_pdos+0x11/0x1f0 [ec_master]
>
> [  199.145165] EAX: 00000000 EBX: 00000000 ECX: f858e000 EDX: ffffffff
>
> [  199.145167] ESI: f8557000 EDI: ebc37180 EBP: ec04fdb0 ESP: ec04fd6c
>
> [  199.145169]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
>
> [  199.145172] CR0: 80050033 CR2: 00000008 CR3: 2c0e4fa0 CR4: 001006f0
>
> [  199.145173] Stack:
>
> [  199.145181]  00000001 00000001 00000000 c10bfe2a 00000000 f8557000
> ebc37180 ec04fda8
>
> [  199.145187]  ffffffff f858e0d4 00000001 00000008 f858e0d4 00000000
> 00000000 f8557000
>
> [  199.145194]  ebc37180 ec04fdc4 f855711f f858d278 03f03052 00000000
> ec04fe34 c1002228
>
> [  199.145195] Call Trace:
>
> [  199.145204]  [<c10bfe2a>] ? up+0x2a/0x40
>
> [  199.145207]  [<f8557000>] ? 0xf8557000
>
> [  199.145211]  [<f8557000>] ? 0xf8557000
>
> [  199.145217]  [<f855711f>] init_module+0x11f/0x1000 [ec_mini]
>
> [  199.145223]  [<c1002228>] do_one_initcall+0x38/0x150
>
> [  199.145228]  [<c109a507>] ? migrate_enable+0x1b7/0x330
>
> [  199.145234]  [<c117fee9>] ? free_hot_cold_page+0x329/0x380
>
> [  199.145237]  [<c1195c05>] ? kvfree+0x45/0x50
>
> [  199.145241]  [<c11b7810>] ? __vunmap+0x70/0xc0
>
> [  199.145244]  [<c1176ad5>] ? do_init_module+0x24/0x1e2
>
> [  199.145247]  [<c1176ad5>] ? do_init_module+0x24/0x1e2
>
> [  199.145251]  [<c1176b04>] do_init_module+0x53/0x1e2
>
> [  199.145256]  [<c11037e3>] load_module+0x20c3/0x26e0
>
> [  199.145262]  [<c11ec5bb>] ? kernel_read_file+0x1fb/0x250
>
> [  199.145267]  [<c1103fa2>] SyS_finit_module+0x82/0xd0
>
> [  199.145273]  [<c10035c9>] do_fast_syscall_32+0x99/0x150
>
> [  199.145278]  [<c179be93>] sysenter_past_esp+0x40/0x6a
>
> [  199.145333] Code: f8 89 44 24 04 e8 f6 01 a6 c8 b8 ea ff ff ff e9
> 67 ff ff ff 8d b6 00 00 00 00 55 89 e5 57 56 53 83 ec 38 3e 8d 74 26
> 00 89
> 45 f0 <8b> 40 08 89 55 dc 89 4d ec 8b b0 bc 13 00 00 85 f6 0f 85 8a 01
>
> [  199.145352] EIP: [<f8716501>]
>
> [  199.145353] ecrt_slave_config_pdos+0x11/0x1f0 [ec_master]
>
> [  199.145354]  SS:ESP 0068:ec04fd6c
>
> [  199.145355] CR2: 0000000000000008
>
> [  199.150603] ---[ end trace 0000000000000002 ]---
>
> As far as I can see it has something to do with my pdo configuration,
> as it loads fine when I don’t use the modification, of course the pdo
> config is wrong in that case but it runs further before it stops.
>
> For reference my pdo config is attached:
>
> #define AnaInSlavePos  0, 1
>
> #define DigOutSlavePos 0, 2
>
> #define Beckhoff_EL1008 0x00000002, 0x03f03052
>
> #define Beckhoff_EL2008 0x00000002, 0x07d83052
>
> // offsets for PDO entries
>
> static unsigned int off_dig_in;
>
> static unsigned int off_dig_out;
>
> const static ec_pdo_entry_reg_t domain1_regs[] = {
>
>      {AnaInSlavePos,  Beckhoff_EL1008, 0x1000, 1, &off_dig_in},
>
>      {DigOutSlavePos, Beckhoff_EL2008, 0x0f00, 2, &off_dig_out},
>
> };
>
> static unsigned int counter = 0;
>
> static unsigned int blink = 0;
>
> /*********************************************************************
> ********/
>
> #if CONFIGURE_PDOS
>
> /* Master 0, Slave 0, "EL1008"
>
> * Vendor ID:       0x00000002
>
> * Product code:    0x03f03052
>
> * Revision number: 0x00110000
>
> */
>
> static ec_pdo_entry_info_t slave_0_pdo_entries[] ={
>
>      {0x6000, 0x01, 1}, /* Input */
>
>      {0x6010, 0x01, 1}, /* Input */
>
>      {0x6020, 0x01, 1}, /* Input */
>
>      {0x6030, 0x01, 1}, /* Input */
>
>      {0x6040, 0x01, 1}, /* Input */
>
>      {0x6050, 0x01, 1}, /* Input */
>
>      {0x6060, 0x01, 1}, /* Input */
>
>      {0x6070, 0x01, 1}, /* Input */
>
> };
>
> static ec_pdo_info_t slave_0_pdos[] = {
>
>      {0x1a00, 1, slave_0_pdo_entries + 0}, /* Channel 1 */
>
>      {0x1a01, 1, slave_0_pdo_entries + 1}, /* Channel 2 */
>
>      {0x1a02, 1, slave_0_pdo_entries + 2}, /* Channel 3 */
>
>      {0x1a03, 1, slave_0_pdo_entries + 3}, /* Channel 4 */
>
>      {0x1a04, 1, slave_0_pdo_entries + 4}, /* Channel 5 */
>
>      {0x1a05, 1, slave_0_pdo_entries + 5}, /* Channel 6 */
>
>      {0x1a06, 1, slave_0_pdo_entries + 6}, /* Channel 7 */
>
>      {0x1a07, 1, slave_0_pdo_entries + 7}, /* Channel 8 */
>
> };
>
> static ec_sync_info_t slave_0_syncs[] = {
>
>      {0, EC_DIR_INPUT, 8, slave_0_pdos + 0, EC_WD_DISABLE},
>
> {0xff}
>
> };
>
> /* Master 0, Slave 1, "EL2008"
>
> * Vendor ID:       0x00000002
>
> * Product code:    0x07d83052
>
> * Revision number: 0x00120000
>
> */
>
> static ec_pdo_entry_info_t slave_1_pdo_entries[] = {
>
>      {0x7000, 0x01, 1}, /* Output */
>
>      {0x7010, 0x01, 1}, /* Output */
>
>      {0x7020, 0x01, 1}, /* Output */
>
>      {0x7030, 0x01, 1}, /* Output */
>
>      {0x7040, 0x01, 1}, /* Output */
>
>      {0x7050, 0x01, 1}, /* Output */
>
>      {0x7060, 0x01, 1}, /* Output */
>
>      {0x7070, 0x01, 1}, /* Output */
>
> };
>
> static ec_pdo_info_t slave_1_pdos[] = {
>
>      {0x1600, 1, slave_1_pdo_entries + 0}, /* Channel 1 */
>
>      {0x1601, 1, slave_1_pdo_entries + 1}, /* Channel 2 */
>
>      {0x1602, 1, slave_1_pdo_entries + 2}, /* Channel 3 */
>
>      {0x1603, 1, slave_1_pdo_entries + 3}, /* Channel 4 */
>
>      {0x1604, 1, slave_1_pdo_entries + 4}, /* Channel 5 */
>
>      {0x1605, 1, slave_1_pdo_entries + 5}, /* Channel 6 */
>
>      {0x1606, 1, slave_1_pdo_entries + 6}, /* Channel 7 */
>
>      {0x1607, 1, slave_1_pdo_entries + 7}, /* Channel 8 */
>
> };
>
> static ec_sync_info_t slave_1_syncs[] = {
>
>      {0, EC_DIR_OUTPUT, 8, slave_1_pdos + 0, EC_WD_ENABLE},
>
>      {0xff}
>
> };
>
> So my question is am I doing something wrong in the pdo configuration
> or do I need to install another kernel?
>
> Best regards
>
> <http://www.cabinplant.com>
>
> Gustav Nicolay MeilbyNobel
> Automation Engineer
>
> 5683Haarby
> Denmark
> T:
> E-mail: GNO at CABINPLANT.COM <mailto:GNO at CABINPLANT.COM>
> Internet: www.cabinplant.com <http://www.cabinplant.com>
>
> Meet us at:
> Exhibition list: www.cabinplant.com/exhibitions
> <http://www.cabinplant.com/exhibitions>
>
> Cabinplant register the personal data found in the emails we have received.
> You can read more about our privacy policy here
> <https://www.cabinplant.com/about-us/privacy-and-cookie-statement/>.
>
>
>
> _______________________________________________
> etherlab-users mailing list
> etherlab-users at etherlab.org
> http://lists.etherlab.org/mailman/listinfo/etherlab-users
>


More information about the Etherlab-users mailing list