[ppdev] sysfs warning on qemu boot
From: Joe Lawrence
Date: Wed Nov 09 2016 - 11:00:16 EST
Hi Sudip,
I hit a sysfs_warn_dup inside QEMU running 4.9.0-rc4 (I suspect earlier
versions as well, but this is the first upstream I've run in a while).
This warning looks like something the kernel test robot ran into a few
months ago:
http://marc.info/?t=147267773300003&r=1&w=2
I'm running CentOS7 inside QEMU with the following options:
qemu-system-x86_64 -smp 4 -m 8192 \
-drive file=centos7.qcow2,cache=none,if=virtio \
-usbdevice tablet -enable-kvm -monitor stdio \
-parallel /dev/null -redir tcp:2222::22 \
-serial file:serial.out
a kernel with these options:
% grep PARPORT .config
CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
CONFIG_PARPORT=m
CONFIG_PARPORT_PC=m
# CONFIG_PARPORT_SERIAL is not set
# CONFIG_PARPORT_PC_FIFO is not set
# CONFIG_PARPORT_PC_SUPERIO is not set
# CONFIG_PARPORT_GSC is not set
# CONFIG_PARPORT_AX88796 is not set
CONFIG_PARPORT_1284=y
# CONFIG_I2C_PARPORT is not set
# CONFIG_I2C_PARPORT_LIGHT is not set
and I see the following warning on boot:
ppdev: user-space parallel port driver
------------[ cut here ]------------
WARNING: CPU: 2 PID: 581 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x64/0x80
sysfs: cannot create duplicate filename '/devices/pnp0/00:04/ppdev/parport0'
Modules linked in: ppdev sg parport_pc(+) parport pcspkr i2c_piix4 ip_tables xfs libcrc32c sr_mod cdrom ata_generic pata_acpi cirrus drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ttm drm virtio_blk e1000 virtio_pci ata_piix virtio_ring i2c_core libata virtio serio_raw floppy dm_mirror dm_region_hash dm_log dm_mod
CPU: 2 PID: 581 Comm: systemd-udevd Not tainted 4.9.0-rc4+ #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.5.1 01/01/2011
ffffc900014c76f8 ffffffff81351b2f ffffc900014c7748 0000000000000000
ffffc900014c7738 ffffffff8108bab1 0000001f00001000 ffff8802280bc548
ffff88022c290c68 ffff880225c98398 ffff88022d834bd8 0000000006300000
Call Trace:
[<ffffffff81351b2f>] dump_stack+0x63/0x84
[<ffffffff8108bab1>] __warn+0xd1/0xf0
[<ffffffff8108bb2f>] warn_slowpath_fmt+0x5f/0x80
[<ffffffff812a3350>] ? kernfs_path_from_node+0x50/0x60
[<ffffffff812a6b44>] sysfs_warn_dup+0x64/0x80
[<ffffffff812a6c2e>] sysfs_create_dir_ns+0x7e/0x90
[<ffffffff81354ad2>] kobject_add_internal+0xa2/0x320
[<ffffffff8148ff33>] ? device_private_init+0x23/0x70
[<ffffffff81354f85>] kobject_add+0x75/0xd0
[<ffffffff816d8002>] ? mutex_lock+0x12/0x2f
[<ffffffff81490099>] device_add+0x119/0x610
[<ffffffff81490788>] device_create_groups_vargs+0xd8/0x100
[<ffffffffa0316090>] ? dead_read+0x10/0x10 [parport]
[<ffffffff81490821>] device_create+0x51/0x70
[<ffffffff811fd5a1>] ? kfree+0x121/0x170
[<ffffffff816ccf60>] ? klist_next+0x20/0xf0
[<ffffffffa03230b4>] pp_attach+0x34/0x40 [ppdev]
[<ffffffffa03160a7>] driver_check+0x17/0x20 [parport]
[<ffffffff814913e8>] bus_for_each_drv+0x68/0xb0
[<ffffffffa03162b9>] attach_driver_chain+0x59/0x60 [parport]
[<ffffffffa0316720>] parport_announce_port+0xc0/0x110 [parport]
[<ffffffffa032ae7c>] parport_pc_probe_port+0x70c/0xb20 [parport_pc]
[<ffffffff812a460a>] ? kernfs_activate+0x7a/0xe0
[<ffffffff8148f6cc>] ? _dev_info+0x6c/0x90
[<ffffffffa032bd95>] parport_pc_pnp_probe+0x145/0x1e0 [parport_pc]
[<ffffffffa032bc50>] ? sio_via_probe+0x430/0x430 [parport_pc]
[<ffffffff8140c8c1>] pnp_device_probe+0x61/0xc0
[<ffffffff814936e7>] driver_probe_device+0x227/0x440
[<ffffffff814939dd>] __driver_attach+0xdd/0xe0
[<ffffffff81493900>] ? driver_probe_device+0x440/0x440
[<ffffffff8149130c>] bus_for_each_dev+0x6c/0xc0
[<ffffffff81492fae>] driver_attach+0x1e/0x20
[<ffffffff814928c5>] bus_add_driver+0x45/0x270
[<ffffffff81494450>] driver_register+0x60/0xe0
[<ffffffff8140c710>] pnp_register_driver+0x20/0x30
[<ffffffffa0332398>] parport_pc_init+0x2b5/0xf1d [parport_pc]
[<ffffffffa03320e3>] ? parport_parse_param.constprop.15+0xe3/0xe3 [parport_pc]
[<ffffffff81002190>] do_one_initcall+0x50/0x190
[<ffffffff811958ce>] ? do_init_module+0x27/0x1f1
[<ffffffff811fc3bc>] ? kmem_cache_alloc_trace+0x16c/0x1b0
[<ffffffff81195907>] do_init_module+0x60/0x1f1
[<ffffffff81116e7b>] load_module+0x15ab/0x1aa0
[<ffffffff81113810>] ? __symbol_put+0x60/0x60
[<ffffffff812f7b1d>] ? ima_post_read_file+0x3d/0x80
[<ffffffff812d39eb>] ? security_kernel_post_read_file+0x6b/0x80
[<ffffffff81117586>] SYSC_finit_module+0xa6/0xf0
[<ffffffff811175ee>] SyS_finit_module+0xe/0x10
[<ffffffff816da837>] entry_SYSCALL_64_fastpath+0x1a/0xa9
---[ end trace 8304e3df5abed4a7 ]---
------------[ cut here ]------------
WARNING: CPU: 2 PID: 581 at lib/kobject.c:240 kobject_add_internal+0x2b5/0x320
kobject_add_internal failed for parport0 with -EEXIST, don't try to register things with the same name in the same directory.
Modules linked in: ppdev sg parport_pc(+) parport pcspkr i2c_piix4 ip_tables xfs libcrc32c sr_mod cdrom ata_generic pata_acpi cirrus drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ttm drm virtio_blk e1000 virtio_pci ata_piix virtio_ring i2c_core libata virtio serio_raw floppy dm_mirror dm_region_hash dm_log dm_mod
CPU: 2 PID: 581 Comm: systemd-udevd Tainted: G W 4.9.0-rc4+ #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.5.1 01/01/2011
ffffc900014c7748 ffffffff81351b2f ffffc900014c7798 0000000000000000
ffffc900014c7788 ffffffff8108bab1 000000f02c290c68 ffff880226a0afe8
ffff88022d834bd8 00000000ffffffef ffff88022d834bd8 0000000006300000
Call Trace:
[<ffffffff81351b2f>] dump_stack+0x63/0x84
[<ffffffff8108bab1>] __warn+0xd1/0xf0
[<ffffffff8108bb2f>] warn_slowpath_fmt+0x5f/0x80
[<ffffffff81354ce5>] kobject_add_internal+0x2b5/0x320
[<ffffffff8148ff33>] ? device_private_init+0x23/0x70
[<ffffffff81354f85>] kobject_add+0x75/0xd0
[<ffffffff816d8002>] ? mutex_lock+0x12/0x2f
[<ffffffff81490099>] device_add+0x119/0x610
[<ffffffff81490788>] device_create_groups_vargs+0xd8/0x100
[<ffffffffa0316090>] ? dead_read+0x10/0x10 [parport]
[<ffffffff81490821>] device_create+0x51/0x70
[<ffffffff811fd5a1>] ? kfree+0x121/0x170
[<ffffffff816ccf60>] ? klist_next+0x20/0xf0
[<ffffffffa03230b4>] pp_attach+0x34/0x40 [ppdev]
[<ffffffffa03160a7>] driver_check+0x17/0x20 [parport]
[<ffffffff814913e8>] bus_for_each_drv+0x68/0xb0
[<ffffffffa03162b9>] attach_driver_chain+0x59/0x60 [parport]
[<ffffffffa0316720>] parport_announce_port+0xc0/0x110 [parport]
[<ffffffffa032ae7c>] parport_pc_probe_port+0x70c/0xb20 [parport_pc]
[<ffffffff812a460a>] ? kernfs_activate+0x7a/0xe0
[<ffffffff8148f6cc>] ? _dev_info+0x6c/0x90
[<ffffffffa032bd95>] parport_pc_pnp_probe+0x145/0x1e0 [parport_pc]
[<ffffffffa032bc50>] ? sio_via_probe+0x430/0x430 [parport_pc]
[<ffffffff8140c8c1>] pnp_device_probe+0x61/0xc0
[<ffffffff814936e7>] driver_probe_device+0x227/0x440
[<ffffffff814939dd>] __driver_attach+0xdd/0xe0
[<ffffffff81493900>] ? driver_probe_device+0x440/0x440
[<ffffffff8149130c>] bus_for_each_dev+0x6c/0xc0
[<ffffffff81492fae>] driver_attach+0x1e/0x20
[<ffffffff814928c5>] bus_add_driver+0x45/0x270
[<ffffffff81494450>] driver_register+0x60/0xe0
[<ffffffff8140c710>] pnp_register_driver+0x20/0x30
[<ffffffffa0332398>] parport_pc_init+0x2b5/0xf1d [parport_pc]
[<ffffffffa03320e3>] ? parport_parse_param.constprop.15+0xe3/0xe3 [parport_pc]
[<ffffffff81002190>] do_one_initcall+0x50/0x190
[<ffffffff811958ce>] ? do_init_module+0x27/0x1f1
[<ffffffff811fc3bc>] ? kmem_cache_alloc_trace+0x16c/0x1b0
[<ffffffff81195907>] do_init_module+0x60/0x1f1
[<ffffffff81116e7b>] load_module+0x15ab/0x1aa0
[<ffffffff81113810>] ? __symbol_put+0x60/0x60
[<ffffffff812f7b1d>] ? ima_post_read_file+0x3d/0x80
[<ffffffff812d39eb>] ? security_kernel_post_read_file+0x6b/0x80
[<ffffffff81117586>] SYSC_finit_module+0xa6/0xf0
[<ffffffff811175ee>] SyS_finit_module+0xe/0x10
[<ffffffff816da837>] entry_SYSCALL_64_fastpath+0x1a/0xa9
---[ end trace 8304e3df5abed4a8 ]---
I can repeat the warnings by unloading and reloading the parallel port
drivers:
rmmod parport_pc ppdev parport
modprobe parport_pc
Instrumenting sysfs_create_dir_ns when adding
'/devices/pnp0/00:04/ppdev/parport0', I see one call from ppdev/parport
drivers:
entry_SYSCALL_64_fastpath
SyS_finit_module
SYSC_finit_module
load_module
do_init_module
do_one_initcall
ppdev_init [ppdev]
__parport_register_driver [parport]
bus_for_each_dev
port_check[parport]
pp_attach[ppdev]
device_create
device_create_groups_vargs
device_add
kobject_add
kobject_add_internal
sysfs_create_dir_ns
and then a follow up call to add the same sysfs directory via the
parport_pc driver:
entry_SYSCALL_64_fastpath
SyS_finit_module
SYSC_finit_module
load_module
do_init_module
do_one_initcall
parport_pc_init [parport_pc]
pnp_register_driver
driver_register
bus_add_driver
driver_attach
bus_for_each_dev
__driver_attach
driver_probe_device
pnp_device_probe
parport_pc_pnp_probe [parport_pc]
parport_pc_probe_port [parport_pc]
parport_announce_port [parport]
attach_driver_chain [parport]
bus_for_each_drv
driver_check [parport]
pp_attach[ppdev]
device_create
device_create_groups_vargs
device_add
kobject_add
kobject_add_internal
sysfs_create_dir_ns
This warning is readily reproducible in my current VM setup, so I can
test patches or further debugging if necessary.
Hope this helps,
-- Joe