2.6.21-rc7: BUG: sleeping function called from invalid context at net/core/sock.c:1523
Subsystems (4)
I got this on resume; it looks like a Bluetooth and/or USB problem.
PM: Removing info for No Bus:hci0
BUG: sleeping function called from invalid context at net/core/sock.c:1523
in_atomic():1, irqs_disabled():0
1 lock held by khubd/180:
#0: (old_style_rw_init#2){-.-?}, at: [<f88c5816>] hci_sock_dev_event+0x42/0xc5 [bluetooth]
[<c01091b5>] show_trace_log_lvl+0x1a/0x30
[<c010980c>] show_trace+0x12/0x14
[<c01098cb>] dump_stack+0x16/0x18
[<c0124191>] __might_sleep+0xe5/0xeb
[<c0309ece>] lock_sock_nested+0x1d/0xc4
[<f88c587b>] hci_sock_dev_event+0xa7/0xc5 [bluetooth]
[<c037c8d2>] notifier_call_chain+0x20/0x3c
[<c037c915>] atomic_notifier_call_chain+0x27/0x50
[<f88c1a55>] hci_notify+0x12/0x14 [bluetooth]
[<f88c2626>] hci_unregister_dev+0x4c/0x65 [bluetooth]
[<f89f5d38>] hci_usb_disconnect+0x42/0x6f [hci_usb]
[<c02d7e49>] usb_unbind_interface+0x33/0x69
[<c028f3fa>] __device_release_driver+0x74/0x90
[<c028f870>] device_release_driver+0x33/0x4b
[<c028ee0f>] bus_remove_device+0x73/0x82
[<c028d412>] device_del+0x169/0x1cf
[<c02d5c00>] usb_disable_device+0x62/0xc2
[<c02d2807>] usb_disconnect+0x95/0x114
[<c02d34d8>] hub_thread+0x2e2/0x99b
[<c013c8f7>] kthread+0xb5/0xe2
[<c0108d97>] kernel_thread_helper+0x7/0x10
=======================PM: Removing info for usb:4-1:1.0
The machine came up anyway, without apparent problems.
J
CONFIG_X86_32=yCONFIG_GENERIC_TIME=y CONFIG_CLOCKSOURCE_WATCHDOG=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y CONFIG_LOCKDEP_SUPPORT=y CONFIG_STACKTRACE_SUPPORT=y CONFIG_SEMAPHORE_SLEEPERS=yCONFIG_X86=yCONFIG_MMU=yCONFIG_ZONE_DMA=yCONFIG_GENERIC_ISA_DMA=yCONFIG_GENERIC_IOMAP=yCONFIG_GENERIC_BUG=yCONFIG_GENERIC_HWEIGHT=y CONFIG_ARCH_MAY_HAVE_PC_FDC=yCONFIG_DMI=y CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" CONFIG_EXPERIMENTAL=yCONFIG_LOCK_KERNEL=yCONFIG_INIT_ENV_ARG_LIMIT=32 CONFIG_LOCALVERSION="-paravirt"CONFIG_SWAP=yCONFIG_SYSVIPC=yCONFIG_SYSVIPC_SYSCTL=yCONFIG_POSIX_MQUEUE=yCONFIG_BSD_PROCESS_ACCT=yCONFIG_TASKSTATS=yCONFIG_TASK_DELAY_ACCT=yCONFIG_SYSFS_DEPRECATED=yCONFIG_RELAY=yCONFIG_BLK_DEV_INITRD=yCONFIG_INITRAMFS_SOURCE="" CONFIG_CC_OPTIMIZE_FOR_SIZE=yCONFIG_SYSCTL=yCONFIG_UID16=yCONFIG_SYSCTL_SYSCALL=yCONFIG_KALLSYMS=yCONFIG_KALLSYMS_ALL=yCONFIG_KALLSYMS_EXTRA_PASS=yCONFIG_HOTPLUG=yCONFIG_PRINTK=yCONFIG_BUG=yCONFIG_ELF_CORE=yCONFIG_BASE_FULL=yCONFIG_FUTEX=yCONFIG_EPOLL=yCONFIG_SHMEM=yCONFIG_SLAB=yCONFIG_VM_EVENT_COUNTERS=yCONFIG_RT_MUTEXES=yCONFIG_BASE_SMALL=0CONFIG_MODULES=yCONFIG_MODULE_UNLOAD=yCONFIG_MODVERSIONS=y CONFIG_MODULE_SRCVERSION_ALL=yCONFIG_KMOD=yCONFIG_STOP_MACHINE=yCONFIG_BLOCK=yCONFIG_IOSCHED_NOOP=yCONFIG_IOSCHED_AS=yCONFIG_IOSCHED_DEADLINE=yCONFIG_IOSCHED_CFQ=yCONFIG_DEFAULT_CFQ=yCONFIG_DEFAULT_IOSCHED="cfq"CONFIG_TICK_ONESHOT=yCONFIG_NO_HZ=yCONFIG_HIGH_RES_TIMERS=yCONFIG_SMP=yCONFIG_X86_PC=yCONFIG_PARAVIRT=yCONFIG_XEN=yCONFIG_VMI=yCONFIG_MPENTIUMM=yCONFIG_X86_CMPXCHG=yCONFIG_X86_L1_CACHE_SHIFT=6 CONFIG_RWSEM_XCHGADD_ALGORITHM=y CONFIG_GENERIC_CALIBRATE_DELAY=y CONFIG_X86_WP_WORKS_OK=yCONFIG_X86_INVLPG=yCONFIG_X86_BSWAP=yCONFIG_X86_POPAD_OK=yCONFIG_X86_CMPXCHG64=yCONFIG_X86_GOOD_APIC=yCONFIG_X86_INTEL_USERCOPY=y CONFIG_X86_USE_PPRO_CHECKSUM=yCONFIG_X86_TSC=yCONFIG_HPET_TIMER=yCONFIG_NR_CPUS=8CONFIG_SCHED_MC=yCONFIG_PREEMPT=yCONFIG_PREEMPT_BKL=yCONFIG_RENICE_X=yCONFIG_X86_LOCAL_APIC=yCONFIG_X86_IO_APIC=yCONFIG_X86_MCE=yCONFIG_X86_MCE_P4THERMAL=yCONFIG_VM86=yCONFIG_X86_CPUID=mCONFIG_EDD=mCONFIG_HIGHMEM64G=yCONFIG_PAGE_OFFSET=0xC0000000CONFIG_HIGHMEM=yCONFIG_X86_PAE=yCONFIG_ARCH_FLATMEM_ENABLE=y CONFIG_ARCH_SPARSEMEM_ENABLE=y CONFIG_ARCH_SELECT_MEMORY_MODEL=y CONFIG_ARCH_POPULATES_NODE_MAP=y CONFIG_SELECT_MEMORY_MODEL=y CONFIG_FLATMEM_MANUAL=yCONFIG_FLATMEM=yCONFIG_FLAT_NODE_MEM_MAP=y CONFIG_SPARSEMEM_STATIC=y CONFIG_SPLIT_PTLOCK_CPUS=4 CONFIG_RESOURCES_64BIT=yCONFIG_ZONE_DMA_FLAG=1CONFIG_HIGHPTE=yCONFIG_MATH_EMULATION=yCONFIG_MTRR=yCONFIG_IRQBALANCE=yCONFIG_HZ_250=yCONFIG_HZ=250CONFIG_PHYSICAL_START=0x100000 CONFIG_PHYSICAL_ALIGN=0x100000 CONFIG_HOTPLUG_CPU=yCONFIG_COMPAT_VDSO=y CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=yCONFIG_PM=yCONFIG_PM_DEBUG=yCONFIG_DISABLE_CONSOLE_SUSPEND=y CONFIG_SOFTWARE_SUSPEND=y CONFIG_PM_STD_PARTITION=""CONFIG_SUSPEND_SMP=yCONFIG_ACPI=yCONFIG_ACPI_SLEEP=yCONFIG_ACPI_SLEEP_PROC_FS=y CONFIG_ACPI_SLEEP_PROC_SLEEP=y CONFIG_ACPI_PROCFS=yCONFIG_ACPI_AC=yCONFIG_ACPI_BATTERY=yCONFIG_ACPI_BUTTON=yCONFIG_ACPI_VIDEO=mCONFIG_ACPI_FAN=yCONFIG_ACPI_DOCK=yCONFIG_ACPI_BAY=yCONFIG_ACPI_PROCESSOR=yCONFIG_ACPI_HOTPLUG_CPU=yCONFIG_ACPI_THERMAL=yCONFIG_ACPI_IBM=mCONFIG_ACPI_IBM_BAY=y CONFIG_ACPI_BLACKLIST_YEAR=1999CONFIG_ACPI_EC=yCONFIG_ACPI_POWER=yCONFIG_ACPI_SYSTEM=yCONFIG_X86_PM_TIMER=yCONFIG_ACPI_CONTAINER=yCONFIG_CPU_FREQ=yCONFIG_CPU_FREQ_TABLE=y CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y CONFIG_CPU_FREQ_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_GOV_POWERSAVE=y CONFIG_CPU_FREQ_GOV_USERSPACE=y CONFIG_CPU_FREQ_GOV_ONDEMAND=y CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y CONFIG_X86_ACPI_CPUFREQ=yCONFIG_PCI=yCONFIG_PCI_GOANY=yCONFIG_PCI_BIOS=yCONFIG_PCI_DIRECT=yCONFIG_PCI_MMCONFIG=yCONFIG_PCIEPORTBUS=yCONFIG_HOTPLUG_PCI_PCIE=yCONFIG_PCIEAER=yCONFIG_PCI_MSI=yCONFIG_HT_IRQ=yCONFIG_ISA_DMA_API=yCONFIG_PCCARD=yCONFIG_PCMCIA=yCONFIG_PCMCIA_LOAD_CIS=yCONFIG_PCMCIA_IOCTL=yCONFIG_CARDBUS=yCONFIG_YENTA=yCONFIG_YENTA_O2=yCONFIG_YENTA_RICOH=yCONFIG_YENTA_TI=yCONFIG_YENTA_ENE_TUNE=yCONFIG_YENTA_TOSHIBA=yCONFIG_PCCARD_NONSTATIC=yCONFIG_HOTPLUG_PCI=yCONFIG_HOTPLUG_PCI_ACPI=y CONFIG_HOTPLUG_PCI_ACPI_IBM=yCONFIG_BINFMT_ELF=yCONFIG_BINFMT_MISC=yCONFIG_NET=yCONFIG_PACKET=yCONFIG_PACKET_MMAP=yCONFIG_UNIX=yCONFIG_XFRM=yCONFIG_XFRM_USER=yCONFIG_NET_KEY=mCONFIG_INET=yCONFIG_IP_MULTICAST=yCONFIG_IP_FIB_HASH=yCONFIG_NET_IPIP=mCONFIG_NET_IPGRE=mCONFIG_NET_IPGRE_BROADCAST=yCONFIG_IP_MROUTE=yCONFIG_IP_PIMSM_V1=yCONFIG_IP_PIMSM_V2=yCONFIG_SYN_COOKIES=yCONFIG_INET_AH=mCONFIG_INET_ESP=mCONFIG_INET_IPCOMP=mCONFIG_INET_XFRM_TUNNEL=mCONFIG_INET_TUNNEL=m CONFIG_INET_XFRM_MODE_TRANSPORT=m CONFIG_INET_XFRM_MODE_TUNNEL=mCONFIG_INET_DIAG=mCONFIG_INET_TCP_DIAG=mCONFIG_TCP_CONG_CUBIC=y CONFIG_DEFAULT_TCP_CONG="cubic"CONFIG_IP_VS=mCONFIG_IP_VS_TAB_BITS=12CONFIG_IP_VS_PROTO_TCP=yCONFIG_IP_VS_PROTO_UDP=yCONFIG_IP_VS_PROTO_ESP=yCONFIG_IP_VS_PROTO_AH=yCONFIG_IP_VS_RR=mCONFIG_IP_VS_WRR=mCONFIG_IP_VS_LC=mCONFIG_IP_VS_WLC=mCONFIG_IP_VS_LBLC=mCONFIG_IP_VS_LBLCR=mCONFIG_IP_VS_DH=mCONFIG_IP_VS_SH=mCONFIG_IP_VS_SED=mCONFIG_IP_VS_NQ=mCONFIG_IP_VS_FTP=mCONFIG_NETFILTER=yCONFIG_BRIDGE_NETFILTER=y CONFIG_NF_CONNTRACK_ENABLED=m CONFIG_NF_CONNTRACK_SUPPORT=y CONFIG_NF_CONNTRACK=mCONFIG_NF_CONNTRACK_FTP=m CONFIG_NETFILTER_XTABLES=m CONFIG_NETFILTER_XT_MATCH_STATE=m CONFIG_NF_CONNTRACK_IPV4=m CONFIG_NF_CONNTRACK_PROC_COMPAT=y CONFIG_IP_NF_IPTABLES=m CONFIG_IP_NF_MATCH_IPRANGE=m CONFIG_IP_NF_MATCH_TOS=m CONFIG_IP_NF_MATCH_RECENT=m CONFIG_IP_NF_MATCH_ECN=mCONFIG_IP_NF_MATCH_AH=mCONFIG_IP_NF_MATCH_TTL=m CONFIG_IP_NF_MATCH_OWNER=m CONFIG_IP_NF_MATCH_ADDRTYPE=m CONFIG_IP_NF_FILTER=mCONFIG_IP_NF_TARGET_REJECT=m CONFIG_IP_NF_TARGET_LOG=m CONFIG_IP_NF_TARGET_ULOG=mCONFIG_NF_NAT=mCONFIG_NF_NAT_NEEDED=y CONFIG_IP_NF_TARGET_MASQUERADE=m CONFIG_NF_NAT_FTP=mCONFIG_BRIDGE=mCONFIG_VLAN_8021Q=mCONFIG_LLC=mCONFIG_BT=mCONFIG_BT_L2CAP=mCONFIG_BT_SCO=mCONFIG_BT_RFCOMM=mCONFIG_BT_RFCOMM_TTY=yCONFIG_BT_BNEP=mCONFIG_BT_BNEP_MC_FILTER=y CONFIG_BT_BNEP_PROTO_FILTER=yCONFIG_BT_HIDP=mCONFIG_BT_HCIUSB=mCONFIG_BT_HCIUSB_SCO=yCONFIG_BT_HCIUART=mCONFIG_BT_HCIUART_H4=yCONFIG_BT_HCIUART_BCSP=yCONFIG_BT_HCIBCM203X=mCONFIG_BT_HCIBPA10X=mCONFIG_BT_HCIBFUSB=mCONFIG_BT_HCIDTL1=mCONFIG_BT_HCIBT3C=mCONFIG_BT_HCIBLUECARD=mCONFIG_BT_HCIBTUART=mCONFIG_BT_HCIVHCI=mCONFIG_IEEE80211=mCONFIG_IEEE80211_CRYPT_WEP=m CONFIG_IEEE80211_CRYPT_CCMP=m CONFIG_WIRELESS_EXT=yCONFIG_STANDALONE=y CONFIG_PREVENT_FIRMWARE_BUILD=yCONFIG_FW_LOADER=yCONFIG_PARPORT=mCONFIG_PARPORT_PC=mCONFIG_PARPORT_SERIAL=mCONFIG_PARPORT_PC_FIFO=y CONFIG_PARPORT_PC_SUPERIO=y CONFIG_PARPORT_PC_PCMCIA=mCONFIG_PARPORT_1284=yCONFIG_PARPORT_NOT_PC=yCONFIG_PNP=yCONFIG_PNPACPI=yCONFIG_BLK_DEV_LOOP=mCONFIG_BLK_DEV_RAM=yCONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=16384 CONFIG_BLK_DEV_RAM_BLOCKSIZE=4096 CONFIG_CDROM_PKTCDVD=m CONFIG_CDROM_PKTCDVD_BUFFERS=8 CONFIG_XEN_BLKDEV_FRONTEND=yCONFIG_IDE=yCONFIG_BLK_DEV_IDE=yCONFIG_BLK_DEV_IDEDISK=yCONFIG_IDE_GENERIC=yCONFIG_BLK_DEV_IDEPCI=yCONFIG_BLK_DEV_GENERIC=yCONFIG_SCSI=yCONFIG_SCSI_NETLINK=yCONFIG_SCSI_PROC_FS=yCONFIG_BLK_DEV_SD=yCONFIG_BLK_DEV_SR=mCONFIG_BLK_DEV_SR_VENDOR=yCONFIG_CHR_DEV_SG=mCONFIG_SCSI_MULTI_LUN=yCONFIG_SCSI_CONSTANTS=yCONFIG_SCSI_LOGGING=yCONFIG_SCSI_SPI_ATTRS=mCONFIG_SCSI_FC_ATTRS=mCONFIG_SCSI_ISCSI_ATTRS=mCONFIG_SCSI_SAS_ATTRS=mCONFIG_ATA=yCONFIG_SATA_AHCI=yCONFIG_SATA_INTEL_COMBINED=yCONFIG_SATA_ACPI=yCONFIG_MD=yCONFIG_BLK_DEV_DM=mCONFIG_DM_SNAPSHOT=mCONFIG_IEEE1394=m CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y CONFIG_IEEE1394_CONFIG_ROM_IP1394=y CONFIG_IEEE1394_OHCI1394=m CONFIG_IEEE1394_VIDEO1394=mCONFIG_IEEE1394_SBP2=mCONFIG_IEEE1394_ETH1394=mCONFIG_IEEE1394_DV1394=mCONFIG_IEEE1394_RAWIO=mCONFIG_NETDEVICES=yCONFIG_DUMMY=mCONFIG_BONDING=mCONFIG_TUN=mCONFIG_NET_ETHERNET=yCONFIG_MII=yCONFIG_NET_PCI=yCONFIG_PCNET32=yCONFIG_NE2K_PCI=yCONFIG_8139TOO=yCONFIG_8139TOO_PIO=yCONFIG_E1000=mCONFIG_E1000_NAPI=yCONFIG_NET_RADIO=yCONFIG_NET_WIRELESS_RTNETLINK=y CONFIG_NET_WIRELESS=yCONFIG_XEN_NETDEV_FRONTEND=yCONFIG_PPP=mCONFIG_PPP_MULTILINK=yCONFIG_PPP_FILTER=yCONFIG_PPP_ASYNC=mCONFIG_PPP_SYNC_TTY=mCONFIG_PPP_DEFLATE=mCONFIG_PPP_BSDCOMP=mCONFIG_SLHC=mCONFIG_INPUT=yCONFIG_INPUT_FF_MEMLESS=yCONFIG_INPUT_MOUSEDEV=y CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 CONFIG_INPUT_JOYDEV=mCONFIG_INPUT_EVDEV=yCONFIG_INPUT_KEYBOARD=yCONFIG_KEYBOARD_ATKBD=yCONFIG_INPUT_MOUSE=yCONFIG_MOUSE_PS2=yCONFIG_INPUT_JOYSTICK=yCONFIG_INPUT_MISC=yCONFIG_INPUT_PCSPKR=mCONFIG_INPUT_WISTRON_BTNS=mCONFIG_INPUT_UINPUT=mCONFIG_SERIO=yCONFIG_SERIO_I8042=yCONFIG_SERIO_SERPORT=yCONFIG_SERIO_LIBPS2=yCONFIG_SERIO_RAW=mCONFIG_VT=yCONFIG_VT_CONSOLE=yCONFIG_HW_CONSOLE=yCONFIG_VT_HW_CONSOLE_BINDING=y CONFIG_SERIAL_NONSTANDARD=yCONFIG_SERIAL_8250=yCONFIG_SERIAL_8250_CONSOLE=y CONFIG_SERIAL_8250_PCI=yCONFIG_SERIAL_8250_PNP=y CONFIG_SERIAL_8250_NR_UARTS=4 CONFIG_SERIAL_8250_RUNTIME_UARTS=4 CONFIG_SERIAL_CORE=yCONFIG_SERIAL_CORE_CONSOLE=yCONFIG_UNIX98_PTYS=yCONFIG_PRINTER=mCONFIG_LP_CONSOLE=yCONFIG_PPDEV=mCONFIG_HVC_DRIVER=yCONFIG_HW_RANDOM=yCONFIG_HW_RANDOM_INTEL=mCONFIG_NVRAM=yCONFIG_RTC=mCONFIG_GEN_RTC=mCONFIG_GEN_RTC_X=yCONFIG_AGP=yCONFIG_AGP_INTEL=yCONFIG_DRM=mCONFIG_DRM_I810=mCONFIG_DRM_I830=mCONFIG_DRM_I915=mCONFIG_HPET=yCONFIG_HPET_RTC_IRQ=yCONFIG_HPET_MMAP=yCONFIG_HANGCHECK_TIMER=mCONFIG_TCG_TPM=mCONFIG_TCG_ATMEL=mCONFIG_VIDEO_DEV=mCONFIG_VIDEO_V4L1=yCONFIG_VIDEO_V4L1_COMPAT=yCONFIG_VIDEO_V4L2=y CONFIG_VIDEO_HELPER_CHIPS_AUTO=y CONFIG_BACKLIGHT_LCD_SUPPORT=y CONFIG_BACKLIGHT_CLASS_DEVICE=y CONFIG_LCD_CLASS_DEVICE=mCONFIG_FB=yCONFIG_FB_CFB_FILLRECT=yCONFIG_FB_CFB_COPYAREA=yCONFIG_FB_CFB_IMAGEBLIT=yCONFIG_FB_MODE_HELPERS=yCONFIG_FB_TILEBLITTING=yCONFIG_FB_VGA16=mCONFIG_FB_VESA=yCONFIG_FB_I810=mCONFIG_FB_I810_GTF=yCONFIG_FB_INTEL=mCONFIG_FB_INTEL_DEBUG=yCONFIG_VGA_CONSOLE=y CONFIG_VGACON_SOFT_SCROLLBACK=y CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=64 CONFIG_VIDEO_SELECT=yCONFIG_DUMMY_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y CONFIG_FONT_8x8=y
CONFIG_FONT_8x16=yCONFIG_LOGO=yCONFIG_LOGO_LINUX_CLUT224=yCONFIG_SOUND=mCONFIG_SND=mCONFIG_SND_TIMER=mCONFIG_SND_PCM=mCONFIG_SND_RAWMIDI=mCONFIG_SND_SEQUENCER=mCONFIG_SND_SEQ_DUMMY=mCONFIG_SND_OSSEMUL=yCONFIG_SND_MIXER_OSS=mCONFIG_SND_PCM_OSS=mCONFIG_SND_PCM_OSS_PLUGINS=y CONFIG_SND_SEQUENCER_OSS=yCONFIG_SND_RTCTIMER=m CONFIG_SND_SEQ_RTCTIMER_DEFAULT=y CONFIG_SND_DYNAMIC_MINORS=y CONFIG_SND_VERBOSE_PROCFS=y CONFIG_SND_MPU401_UART=mCONFIG_SND_AC97_CODEC=mCONFIG_SND_DUMMY=mCONFIG_SND_VIRMIDI=mCONFIG_SND_MTPAV=mCONFIG_SND_MPU401=mCONFIG_SND_HDA_INTEL=mCONFIG_SND_INTEL8X0=mCONFIG_SND_INTEL8X0M=m CONFIG_SND_AC97_POWER_SAVE=yCONFIG_AC97_BUS=mCONFIG_HID=yCONFIG_USB_ARCH_HAS_HCD=y CONFIG_USB_ARCH_HAS_OHCI=y CONFIG_USB_ARCH_HAS_EHCI=yCONFIG_USB=yCONFIG_USB_DEVICEFS=yCONFIG_USB_EHCI_HCD=m CONFIG_USB_EHCI_ROOT_HUB_TT=y CONFIG_USB_UHCI_HCD=mCONFIG_USB_ACM=mCONFIG_USB_PRINTER=mCONFIG_USB_STORAGE=mCONFIG_USB_STORAGE_DATAFAB=y CONFIG_USB_STORAGE_FREECOM=y CONFIG_USB_STORAGE_DPCM=y CONFIG_USB_STORAGE_USBAT=y CONFIG_USB_STORAGE_SDDR09=y CONFIG_USB_STORAGE_SDDR55=y CONFIG_USB_STORAGE_JUMPSHOT=y CONFIG_USB_STORAGE_ALAUDA=yCONFIG_USB_LIBUSUAL=yCONFIG_USB_HID=yCONFIG_HID_FF=yCONFIG_HID_PID=yCONFIG_LOGITECH_FF=yCONFIG_THRUSTMASTER_FF=yCONFIG_USB_HIDDEV=yCONFIG_USB_AIPTEK=mCONFIG_USB_WACOM=mCONFIG_USB_ACECAD=mCONFIG_USB_KBTAB=mCONFIG_USB_POWERMATE=mCONFIG_USB_TOUCHSCREEN=m CONFIG_USB_TOUCHSCREEN_EGALAX=y CONFIG_USB_TOUCHSCREEN_PANJIT=y CONFIG_USB_TOUCHSCREEN_3M=y CONFIG_USB_TOUCHSCREEN_ITM=y CONFIG_USB_TOUCHSCREEN_ETURBO=y CONFIG_USB_TOUCHSCREEN_GUNZE=y CONFIG_USB_TOUCHSCREEN_DMC_TSC10=y CONFIG_USB_XPAD=mCONFIG_USB_ATI_REMOTE=mCONFIG_USB_ATI_REMOTE2=m CONFIG_USB_KEYSPAN_REMOTE=m CONFIG_USB_APPLETOUCH=mCONFIG_USB_MDC800=mCONFIG_USB_MICROTEK=mCONFIG_USB_CATC=mCONFIG_USB_KAWETH=mCONFIG_USB_PEGASUS=mCONFIG_USB_RTL8150=mCONFIG_USB_USBNET_MII=mCONFIG_USB_USBNET=mCONFIG_USB_NET_AX8817X=mCONFIG_USB_NET_CDCETHER=mCONFIG_USB_NET_GL620A=mCONFIG_USB_NET_NET1080=mCONFIG_USB_NET_PLUSB=mCONFIG_USB_NET_RNDIS_HOST=m CONFIG_USB_NET_CDC_SUBSET=mCONFIG_USB_ALI_M5632=yCONFIG_USB_AN2720=yCONFIG_USB_BELKIN=yCONFIG_USB_ARMLINUX=yCONFIG_USB_EPSON2888=yCONFIG_USB_NET_ZAURUS=mCONFIG_USB_MON=yCONFIG_USB_USS720=mCONFIG_USB_SERIAL=mCONFIG_USB_SERIAL_GENERIC=y CONFIG_USB_SERIAL_AIRPRIME=m CONFIG_USB_SERIAL_ARK3116=m CONFIG_USB_SERIAL_BELKIN=m CONFIG_USB_SERIAL_WHITEHEAT=m CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m CONFIG_USB_SERIAL_CP2101=m CONFIG_USB_SERIAL_CYPRESS_M8=m CONFIG_USB_SERIAL_EMPEG=m CONFIG_USB_SERIAL_FTDI_SIO=m CONFIG_USB_SERIAL_FUNSOFT=m CONFIG_USB_SERIAL_VISOR=mCONFIG_USB_SERIAL_IPAQ=mCONFIG_USB_SERIAL_IR=m CONFIG_USB_SERIAL_EDGEPORT=m CONFIG_USB_SERIAL_EDGEPORT_TI=m CONFIG_USB_SERIAL_GARMIN=mCONFIG_USB_SERIAL_IPW=m CONFIG_USB_SERIAL_KEYSPAN_PDA=m CONFIG_USB_SERIAL_KEYSPAN=m CONFIG_USB_SERIAL_KEYSPAN_MPR=y CONFIG_USB_SERIAL_KEYSPAN_USA28=y CONFIG_USB_SERIAL_KEYSPAN_USA28X=y CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y CONFIG_USB_SERIAL_KEYSPAN_USA19=y CONFIG_USB_SERIAL_KEYSPAN_USA18X=y CONFIG_USB_SERIAL_KEYSPAN_USA19W=y CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y CONFIG_USB_SERIAL_KEYSPAN_USA49W=y CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y CONFIG_USB_SERIAL_KLSI=m CONFIG_USB_SERIAL_KOBIL_SCT=m CONFIG_USB_SERIAL_MCT_U232=m CONFIG_USB_SERIAL_NAVMAN=m CONFIG_USB_SERIAL_PL2303=m CONFIG_USB_SERIAL_HP4X=mCONFIG_USB_SERIAL_SAFE=m CONFIG_USB_SERIAL_SAFE_PADDED=y CONFIG_USB_SERIAL_SIERRAWIRELESS=m CONFIG_USB_SERIAL_TI=m CONFIG_USB_SERIAL_CYBERJACK=m CONFIG_USB_SERIAL_XIRCOM=m CONFIG_USB_SERIAL_OPTION=m CONFIG_USB_SERIAL_OMNINET=mCONFIG_USB_EZUSB=yCONFIG_USB_EMI62=mCONFIG_USB_EMI26=mCONFIG_USB_AUERSWALD=mCONFIG_USB_RIO500=mCONFIG_USB_LEGOTOWER=mCONFIG_USB_LCD=mCONFIG_USB_LED=mCONFIG_USB_IDMOUSE=mCONFIG_USB_APPLEDISPLAY=mCONFIG_USB_SISUSBVGA=mCONFIG_USB_SISUSBVGA_CON=yCONFIG_USB_LD=mCONFIG_USB_TEST=mCONFIG_MMC=mCONFIG_MMC_BLOCK=mCONFIG_MMC_SDHCI=mCONFIG_RTC_LIB=mCONFIG_RTC_CLASS=mCONFIG_RTC_INTF_SYSFS=mCONFIG_RTC_INTF_PROC=mCONFIG_RTC_INTF_DEV=m CONFIG_RTC_INTF_DEV_UIE_EMUL=y CONFIG_RTC_DRV_CMOS=mCONFIG_RTC_DRV_DS1553=mCONFIG_RTC_DRV_DS1742=mCONFIG_RTC_DRV_V3020=mCONFIG_KVM=mCONFIG_KVM_INTEL=mCONFIG_EXT3_FS=yCONFIG_EXT3_FS_XATTR=yCONFIG_EXT3_FS_POSIX_ACL=y CONFIG_EXT3_FS_SECURITY=yCONFIG_JBD=yCONFIG_FS_MBCACHE=yCONFIG_FS_POSIX_ACL=yCONFIG_INOTIFY=yCONFIG_INOTIFY_USER=yCONFIG_DNOTIFY=yCONFIG_AUTOFS4_FS=mCONFIG_ISO9660_FS=yCONFIG_JOLIET=yCONFIG_ZISOFS=yCONFIG_UDF_FS=mCONFIG_UDF_NLS=yCONFIG_FAT_FS=mCONFIG_MSDOS_FS=mCONFIG_VFAT_FS=mCONFIG_FAT_DEFAULT_CODEPAGE=437 CONFIG_FAT_DEFAULT_IOCHARSET="ascii" CONFIG_NTFS_FS=mCONFIG_PROC_FS=yCONFIG_PROC_KCORE=yCONFIG_PROC_SYSCTL=yCONFIG_SYSFS=yCONFIG_TMPFS=yCONFIG_RAMFS=yCONFIG_CONFIGFS_FS=mCONFIG_HFSPLUS_FS=mCONFIG_SQUASHFS=y CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 CONFIG_NFS_FS=yCONFIG_NFS_V3=yCONFIG_NFS_V3_ACL=yCONFIG_NFS_V4=yCONFIG_NFS_DIRECTIO=yCONFIG_NFSD=mCONFIG_NFSD_V2_ACL=yCONFIG_NFSD_V3=yCONFIG_NFSD_V3_ACL=yCONFIG_NFSD_V4=yCONFIG_NFSD_TCP=yCONFIG_LOCKD=yCONFIG_LOCKD_V4=yCONFIG_EXPORTFS=mCONFIG_NFS_ACL_SUPPORT=yCONFIG_NFS_COMMON=yCONFIG_SUNRPC=yCONFIG_SUNRPC_GSS=yCONFIG_RPCSEC_GSS_KRB5=y CONFIG_PARTITION_ADVANCED=yCONFIG_MAC_PARTITION=yCONFIG_MSDOS_PARTITION=yCONFIG_LDM_PARTITION=yCONFIG_NLS=yCONFIG_NLS_DEFAULT="utf8" CONFIG_NLS_CODEPAGE_437=y CONFIG_NLS_CODEPAGE_737=m CONFIG_NLS_CODEPAGE_775=m CONFIG_NLS_CODEPAGE_850=m CONFIG_NLS_CODEPAGE_852=m CONFIG_NLS_CODEPAGE_855=m CONFIG_NLS_CODEPAGE_857=m CONFIG_NLS_CODEPAGE_860=m CONFIG_NLS_CODEPAGE_861=m CONFIG_NLS_CODEPAGE_862=m CONFIG_NLS_CODEPAGE_863=m CONFIG_NLS_CODEPAGE_864=m CONFIG_NLS_CODEPAGE_865=m CONFIG_NLS_CODEPAGE_866=m CONFIG_NLS_CODEPAGE_869=m CONFIG_NLS_CODEPAGE_936=m CONFIG_NLS_CODEPAGE_950=m CONFIG_NLS_CODEPAGE_932=m CONFIG_NLS_CODEPAGE_949=m CONFIG_NLS_CODEPAGE_874=mCONFIG_NLS_ISO8859_8=mCONFIG_NLS_CODEPAGE_1250=m CONFIG_NLS_CODEPAGE_1251=mCONFIG_NLS_ASCII=yCONFIG_NLS_ISO8859_1=mCONFIG_NLS_ISO8859_2=mCONFIG_NLS_ISO8859_3=mCONFIG_NLS_ISO8859_4=mCONFIG_NLS_ISO8859_5=mCONFIG_NLS_ISO8859_6=mCONFIG_NLS_ISO8859_7=mCONFIG_NLS_ISO8859_9=mCONFIG_NLS_ISO8859_13=mCONFIG_NLS_ISO8859_14=mCONFIG_NLS_ISO8859_15=mCONFIG_NLS_KOI8_R=mCONFIG_NLS_KOI8_U=mCONFIG_NLS_UTF8=mCONFIG_PROFILING=yCONFIG_OPROFILE=mCONFIG_KPROBES=yCONFIG_TRACE_IRQFLAGS_SUPPORT=y CONFIG_ENABLE_MUST_CHECK=yCONFIG_MAGIC_SYSRQ=yCONFIG_DEBUG_FS=yCONFIG_DEBUG_KERNEL=yCONFIG_LOG_BUF_SHIFT=17CONFIG_DETECT_SOFTLOCKUP=yCONFIG_SCHEDSTATS=yCONFIG_TIMER_STATS=yCONFIG_DEBUG_PREEMPT=yCONFIG_DEBUG_RT_MUTEXES=yCONFIG_DEBUG_PI_LIST=yCONFIG_DEBUG_SPINLOCK=yCONFIG_DEBUG_MUTEXES=yCONFIG_DEBUG_LOCK_ALLOC=yCONFIG_PROVE_LOCKING=yCONFIG_LOCKDEP=yCONFIG_TRACE_IRQFLAGS=y CONFIG_DEBUG_SPINLOCK_SLEEP=yCONFIG_STACKTRACE=yCONFIG_DEBUG_BUGVERBOSE=yCONFIG_DEBUG_INFO=yCONFIG_DEBUG_VM=yCONFIG_FRAME_POINTER=yCONFIG_EARLY_PRINTK=yCONFIG_DEBUG_STACKOVERFLOW=y CONFIG_DEBUG_STACK_USAGE=yCONFIG_DEBUG_RODATA=yCONFIG_4KSTACKS=yCONFIG_X86_FIND_SMP_CONFIG=yCONFIG_X86_MPPARSE=yCONFIG_DOUBLEFAULT=yCONFIG_KEYS=yCONFIG_SECURITY=yCONFIG_SECURITY_NETWORK=y CONFIG_SECURITY_NETWORK_XFRM=y CONFIG_SECURITY_CAPABILITIES=yCONFIG_CRYPTO=yCONFIG_CRYPTO_ALGAPI=yCONFIG_CRYPTO_BLKCIPHER=yCONFIG_CRYPTO_HASH=yCONFIG_CRYPTO_MANAGER=yCONFIG_CRYPTO_HMAC=yCONFIG_CRYPTO_NULL=mCONFIG_CRYPTO_MD4=mCONFIG_CRYPTO_MD5=yCONFIG_CRYPTO_SHA1=yCONFIG_CRYPTO_SHA256=mCONFIG_CRYPTO_SHA512=mCONFIG_CRYPTO_WP512=mCONFIG_CRYPTO_TGR192=mCONFIG_CRYPTO_ECB=mCONFIG_CRYPTO_CBC=yCONFIG_CRYPTO_PCBC=mCONFIG_CRYPTO_DES=yCONFIG_CRYPTO_BLOWFISH=mCONFIG_CRYPTO_TWOFISH=m CONFIG_CRYPTO_TWOFISH_COMMON=m CONFIG_CRYPTO_SERPENT=mCONFIG_CRYPTO_AES=mCONFIG_CRYPTO_AES_586=mCONFIG_CRYPTO_CAST5=mCONFIG_CRYPTO_CAST6=mCONFIG_CRYPTO_TEA=mCONFIG_CRYPTO_ARC4=mCONFIG_CRYPTO_KHAZAD=mCONFIG_CRYPTO_ANUBIS=mCONFIG_CRYPTO_DEFLATE=m CONFIG_CRYPTO_MICHAEL_MIC=mCONFIG_CRYPTO_CRC32C=mCONFIG_BITREVERSE=yCONFIG_CRC_CCITT=mCONFIG_CRC16=mCONFIG_CRC32=yCONFIG_LIBCRC32C=mCONFIG_ZLIB_INFLATE=yCONFIG_ZLIB_DEFLATE=mCONFIG_PLIST=yCONFIG_HAS_IOMEM=yCONFIG_HAS_IOPORT=yCONFIG_GENERIC_HARDIRQS=y CONFIG_GENERIC_IRQ_PROBE=y CONFIG_GENERIC_PENDING_IRQ=yCONFIG_X86_SMP=yCONFIG_X86_HT=yCONFIG_X86_BIOS_REBOOT=yCONFIG_X86_TRAMPOLINE=yCONFIG_KTIME_SCALAR=y
Quoted 28 lines · Jeremy Fitzhardinge
I got this on resume; it looks like a Bluetooth and/or USB problem.
PM: Removing info for No Bus:hci0BUG: sleeping function called from invalid context at net/core/sock.c:1523 in_atomic():1, irqs_disabled():0 1 lock held by khubd/180: #0: (old_style_rw_init#2){-.-?}, at: [<f88c5816>] hci_sock_dev_event+0x42/0xc5 [bluetooth] [<c01091b5>] show_trace_log_lvl+0x1a/0x30 [<c010980c>] show_trace+0x12/0x14 [<c01098cb>] dump_stack+0x16/0x18 [<c0124191>] __might_sleep+0xe5/0xeb [<c0309ece>] lock_sock_nested+0x1d/0xc4 [<f88c587b>] hci_sock_dev_event+0xa7/0xc5 [bluetooth] [<c037c8d2>] notifier_call_chain+0x20/0x3c [<c037c915>] atomic_notifier_call_chain+0x27/0x50 [<f88c1a55>] hci_notify+0x12/0x14 [bluetooth] [<f88c2626>] hci_unregister_dev+0x4c/0x65 [bluetooth] [<f89f5d38>] hci_usb_disconnect+0x42/0x6f [hci_usb] [<c02d7e49>] usb_unbind_interface+0x33/0x69 [<c028f3fa>] __device_release_driver+0x74/0x90 [<c028f870>] device_release_driver+0x33/0x4b [<c028ee0f>] bus_remove_device+0x73/0x82 [<c028d412>] device_del+0x169/0x1cf [<c02d5c00>] usb_disable_device+0x62/0xc2 [<c02d2807>] usb_disconnect+0x95/0x114 [<c02d34d8>] hub_thread+0x2e2/0x99b [<c013c8f7>] kthread+0xb5/0xe2 [<c0108d97>] kernel_thread_helper+0x7/0x10 =======================
Quoted 1 line
PM: Removing info for usb:4-1:1.0
OK, this probably started happening since b40df5743. Before that commit, hci_sock_dev_event() used bh_lock_sock() to lock the corresponding struct sock. This was obviously buggy - not deadlock safe against l2cap_connect_cfm() from softirq context.
This however introduced another problem - hci_sock_dev_event() is now obviously being triggered (for HCI_DEV_UNREG event, when suspending) in atomic context with preemption disabled. This is what lock_sock_nested() complains about, as it is allowed to sleep inside __lock_sock(), waiting for the lock owner.
Hmm, *sigh*. I guess the patch below fixes the problem, but it is a masterpiece in the field of ugliness. And I am not sure whether it is completely correct either. Are there any immediate ideas for better solution with respect to how struct sock locking works?
net/bluetooth/hci_sock.c +8 -2
@@ -656,7 +656,10 @@ static int hci_sock_dev_event(struct notifier_block *this, unsigned long event,/* Detach sockets from device */ read_lock (&hci_sk_list.lock);sk_for_each (sk, node, &hci_sk_list.head) { -lock_sock (sk); +if (in_atomic ()) +bh_lock_sock (sk); +else +lock_sock (sk);if (hci_pi (sk)->hdev == hdev) {hci_pi (sk)->hdev =NULL ; sk->sk_err =EPIPE ;
@@ -665,7 +668,10 @@ static int hci_sock_dev_event(struct notifier_block *this, unsigned long event,hci_dev_put (hdev); } -release_sock (sk); +if (in_atomic ()) +bh_unlock_sock (sk); +else +release_sock (sk); }read_unlock (&hci_sk_list.lock); }
Quoted 5 lines · Jiri Kosina
Hmm, *sigh*. I guess the patch below fixes the problem, but it is a masterpiece in the field of ugliness. And I am not sure whether it is completely correct either. Are there any immediate ideas for better solution with respect to how struct sock locking works?
Please cc such patches to netdev. Thanks.
net/bluetooth/hci_sock.c static int hci_sock_dev_event(struct notifier_block *this, unsigned long event, · line 662
Quoted 13 lines
net/bluetooth/hci_sock.c +4
-1@@ -656,7 +656,10 @@ static int hci_sock_dev_event(struct notifier_block *this, unsigned long event,/* Detach sockets from device */ read_lock (&hci_sk_list.lock);sk_for_each (sk, node, &hci_sk_list.head) { -lock_sock (sk); +if (in_atomic ()) +bh_lock_sock (sk); +else +lock_sock (sk);
This doesn't do what you think it does. bh_lock_sock can still succeed even with lock_sock held by someone else.
Does this need to occur immediately when an event occurs? If not I'd suggest moving this into a workqueue.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtQuoted 5 lines · Herbert Xu
Quoted 4 lines
Hmm, *sigh*. I guess the patch below fixes the problem, but it is a masterpiece in the field of ugliness. And I am not sure whether it is completely correct either. Are there any immediate ideas for better solution with respect to how struct sock locking works?
Please cc such patches to netdev. Thanks.
Hi Herbert,
well it's pretty much bluetooth-specific, and bluez-devel was CCed, but OK.
Quoted 8 lines
Quoted 8 lines
net/bluetooth/hci_sock.c +0
-0@@ -656,7 +656,10 @@ static int hci_sock_dev_event(struct notifier_block *this, unsigned long event,/* Detach sockets from device */ read_lock (&hci_sk_list.lock);sk_for_each (sk, node, &hci_sk_list.head) {
Quoted 8 lines
net/bluetooth/hci_sock.c static int hci_sock_dev_event(struct notifier_block *this, unsigned long event, · line 662
Quoted 5 lines
net/bluetooth/hci_sock.c +4
-1-lock_sock (sk); +if (in_atomic ()) +bh_lock_sock (sk); +else +lock_sock (sk);This doesn't do what you think it does.
bh_lock_sockcan still succeed even withlock_sockheld by someone else.
I know, this was precisely the reason why I converted the bh_lock_sock() to lock_sock() here some time ago (as it was racy with l2cap_connect_cfm()).
Quoted 2 lines
Does this need to occur immediately when an event occurs? If not I'd suggest moving this into a workqueue.
Will have to check whether this will be processed properly in time when going to suspend.
Thanks,
Signature · 1 line
Jiri Kosina
Quoted 4 lines · Jiri Kosina
Quoted 4 lines
BUG: sleeping function called from invalid context at net/core/sock.c:1523in_atomic():1, irqs_disabled():0
1 lock held by khubd/180:
#0: (old_style_rw_init#2){-.-?}, at: [<f88c5816>]hci_sock_dev_event+0x42/0xc5[bluetooth]
[...]
Quoted 8 lines
OK, this probably started happening since
b40df5743. Before that commit,hci_sock_dev_event()usedbh_lock_sock()to lock the corresponding struct sock. This was obviously buggy - not deadlock safe againstl2cap_connect_cfm()from softirq context. This however introduced another problem -hci_sock_dev_event()is now obviously being triggered (forHCI_DEV_UNREGevent, when suspending) in atomic context with preemption disabled. This is whatlock_sock_nested()complains about, as it is allowed to sleep inside__lock_sock(), waiting for the lock owner.
I guess the patch below is a proper fix. Marcel, does this look okay to you?
From: Jiri Kosina <[email protected]>
Bluetooth: postpone hci_dev unregistration
Commit b40df57 substituted bh_lock_sock() in hci_sock_dev_event() for lock_sock() when unregistering HCI device, in order to prevent deadlock against locking in l2cap_connect_cfm() from softirq context.
This however introduces another problem - hci_sock_dev_event() for HCI_DEV_UNREG can also be triggered in atomic context, in which calling lock_sock() is not safe as it could sleep.
This patch moves the detaching of sockets from hci_device into workqueue, so that lock_sock() can be used safely. This requires movement of deallocation of hci_dev - deallocating device just after hci_unregister_dev() would be too soon, as it could happen before the workqueue has been run.
--- drivers/bluetooth/bfusb.c | 2 - drivers/bluetooth/bluecard_cs.c | 2 - drivers/bluetooth/bpa10x.c | 2 - drivers/bluetooth/bt3c_cs.c | 2 - drivers/bluetooth/btuart_cs.c | 2 - drivers/bluetooth/dtl1_cs.c | 2 - drivers/bluetooth/hci_ldisc.c | 1 - drivers/bluetooth/hci_usb.c | 2 - drivers/bluetooth/hci_vhci.c | 2 - include/net/bluetooth/hci_core.h | 3 ++ net/bluetooth/hci_core.c | 9 +++++++ net/bluetooth/hci_sock.c | 44 ++++++++++++++++++++----------------- 12 files changed, 36 insertions(+), 37 deletions(-)
drivers/bluetooth/bfusb.c +0 -2
@@ -762,8 +762,6 @@ static void bfusb_disconnect(struct usb_if (hci_unregister_dev (hdev) <0 )BT_ERR ("Can't unregister HCI device %s" , hdev->name); - -hci_free_dev (hdev); }static struct usb_driver bfusb_driver = {
drivers/bluetooth/bluecard_cs.c +0 -2
@@ -851,8 +851,6 @@ static int bluecard_close(bluecard_info_if (hci_unregister_dev (hdev) <0 )BT_ERR ("Can't unregister HCI device %s" , hdev->name); -hci_free_dev (hdev); -return 0 ; }
drivers/bluetooth/bpa10x.c +0 -2
@@ -613,8 +613,6 @@ static void bpa10x_disconnect(struct usbif (hci_unregister_dev (hdev) <0 )BT_ERR ("Can't unregister HCI device %s" , hdev->name); - -hci_free_dev (hdev); }static struct usb_driver bpa10x_driver = {
drivers/bluetooth/bt3c_cs.c +0 -2
@@ -640,8 +640,6 @@ static int bt3c_close(bt3c_info_t *info)if (hci_unregister_dev (hdev) <0 )BT_ERR ("Can't unregister HCI device %s" , hdev->name); -hci_free_dev (hdev); -return 0 ; }
drivers/bluetooth/btuart_cs.c +0 -2
@@ -570,8 +570,6 @@ static int btuart_close(btuart_info_t *iif (hci_unregister_dev (hdev) <0 )BT_ERR ("Can't unregister HCI device %s" , hdev->name); -hci_free_dev (hdev); -return 0 ; }
drivers/bluetooth/dtl1_cs.c +0 -2
@@ -552,8 +552,6 @@ static int dtl1_close(dtl1_info_t *info)if (hci_unregister_dev (hdev) <0 )BT_ERR ("Can't unregister HCI device %s" , hdev->name); -hci_free_dev (hdev); -return 0 ; }
drivers/bluetooth/hci_ldisc.c +0 -1
@@ -312,7 +312,6 @@ static void hci_uart_tty_close(struct ttif (test_and_clear_bit (HCI_UART_PROTO_SET , &hu->flags)) { hu->proto->close (hu);hci_unregister_dev (hdev); -hci_free_dev (hdev); } } }
drivers/bluetooth/hci_usb.c +0 -2
@@ -1069,8 +1069,6 @@ static void hci_usb_disconnect(struct usif (hci_unregister_dev (hdev) <0 )BT_ERR ("Can't unregister HCI device %s" , hdev->name); - -hci_free_dev (hdev); }static int hci_usb_suspend (struct usb_interface *intf,pm_message_t message)
drivers/bluetooth/hci_vhci.c +0 -2
@@ -308,8 +308,6 @@ static int vhci_release(struct inode *inBT_ERR ("Can't unregister HCI device %s" , hdev->name); } -hci_free_dev (hdev); - file->private_data =NULL ;return 0 ;
include/net/bluetooth/hci_core.h +3 -0
@@ -132,6 +132,8 @@ struct hci_dev {struct module *owner; +struct work_struct hci_dev_unreg_work; +int (*open)(struct hci_dev *hdev);int (*close)(struct hci_dev *hdev);int (*flush)(struct hci_dev *hdev);
@@ -622,6 +624,7 @@ void hci_si_event(struct hci_dev *hdev,/* ----- HCI Sockets ----- */ void hci_send_to_sock (struct hci_dev *hdev,struct sk_buff *skb); +void hci_sock_detach (struct hci_dev *hdev);/* HCI info for socket */ #define hci_pi (sk) ((struct hci_pinfo *) sk)
net/bluetooth/hci_core.c +9 -0
@@ -795,6 +795,14 @@ int hci_get_dev_info(void __user *arg)return err; } +void hci_dev_unreg (struct work_struct *work) +{ +struct hci_dev *hdev = + container_of(work, struct hci_dev, hci_dev_unreg_work); +hci_sock_detach (hdev); +hci_free_dev (hdev); +} +/* ---- Interface to HCI drivers ---- */ /* Alloc HCI device */
@@ -807,6 +815,7 @@ struct hci_dev *hci_alloc_dev(void)return NULL ;skb_queue_head_init (&hdev->driver_init); +INIT_WORK (&hdev->hci_dev_unreg_work, hci_dev_unreg);return hdev; }
net/bluetooth/hci_sock.c +24 -20
56 lines not on this page · raw message
Hi Jiri,
Quoted 6 lines · Jiri Kosina
Quoted 4 lines · Jiri Kosina
Quoted 4 lines
BUG: sleeping function called from invalid context at net/core/sock.c:1523in_atomic():1, irqs_disabled():0
1 lock held by khubd/180:
#0: (old_style_rw_init#2){-.-?}, at: [<f88c5816>]hci_sock_dev_event+0x42/0xc5[bluetooth]
Quoted 7 lines
[...]
Quoted 6 lines
OK, this probably started happening since
b40df5743. Before that commit,hci_sock_dev_event()usedbh_lock_sock()to lock the corresponding struct sock. This was obviously buggy - not deadlock safe againstl2cap_connect_cfm()from softirq context. This however introduced another problem -hci_sock_dev_event()is now obviously being triggered (forHCI_DEV_UNREGevent, when suspending) in atomic context with
I saw that hci_sock_dev_event() is _always_ triggered in atomic context. It's the callout for hci_notifier which is defined as an atomic notifier chain (hence executed in an RCU read section -- and sleeping inside that would be illegal).
Quoted 8 lines
Quoted 2 lines
preemption disabled. This is what
lock_sock_nested()complains about, as it is allowed to sleep inside__lock_sock(), waiting for the lock owner.[...]
Bluetooth: postponehci_devunregistrationCommit b40df57 substituted
bh_lock_sock()inhci_sock_dev_event()forlock_sock()when unregistering HCI device, in order to prevent deadlock against locking inl2cap_connect_cfm()from softirq context.
Isn't this a problem faced by other places in the kernel already (where simply using bh_lock_sock() would potentially deadlock with another thread? I wonder what's the "recommended" (or one that's generally used) way to handle such a case.
Quoted 2 lines
This however introduces another problem -
hci_sock_dev_event()forHCI_DEV_UNREGcan also be triggered in atomic context, in which calling
Actually, I remember going over the hci_sock_dev_event() calling codepath (in reverse) quite exhaustively, and did not find a legitimate reason why anybody would want it to be atomic. hci_notify() has six call sites, and all are sleep-capable, IMO. In the case of hci_unregister_dev(), for example, what's happening is as follows:
__device_release_driver (can sleep)usb_unbind_interface (-"-)hci_usb_disconnect [hci_usb] (can sleep *[1])hci_unregister_dev [bluetooth] (-"-)hci_notify [bluetooth] (-"-)atomic_notifier_call_chain (contains RCU read section)notifier_call_chain (therefore, CANNOT SLEEP [2])hci_sock_dev_event [bluetooth] (-"-)lock_sock_nested (MIGHT SLEEP *BUG*)__might_sleep
[1] This is the first problem point. However, I didn't find any reason why this particular driver's .disconnect() couldn't sleep. In fact, a comment in include/linux/usb.h:811 says:
"The probe() and disconnect() methods are called in a context where they can sleep, but they should avoid abusing the privilege. Most work to connect to a device should be done when the device is opened, and undone at the last close. The disconnect code needs to address concurrency issues with respect to open() and close() methods, as well as forcing all pending I/O requests to complete (by unlinking them as necessary, and blocking until the unlinks complete)."
I'm assuming the comment is not obsolete, of course, but although the first sentence says .disconnect() shouldn't abuse the privilege to sleep, the last sentence makes it quite evident that we are _allowed_ to do so anyway, and that is how things are (with the hci_usb driver, at least, I didn't check the .remove() or .disconnect() functions of other USB drivers, however).
[2] This is a bogus (and unnecessary) can-sleep-to-cannot-sleep transition point, IMO. I had copied Alan Stern in another thread a few days back, and he wasn't sure why hci_notifier was classified as an atomic notifier chain (when that classification happened with the new notifier chains API). I had submitted a patch that merely changed 4 lines in net/bluetooth/hci_core.c to convert hci_notifier to a blocking notifier chain, but couldn't test as I own no bluetooth hardware myself.
So do we ever really _need_ hci_sock_dev_event() to run in atomic context at all?
Quoted 4 lines
lock_sock()is not safe as it could sleep.This patch moves the detaching of sockets from
hci_deviceinto workqueue, so thatlock_sock()can be used safely. This requires movement of
I did a workqueue conversion myself, but ran into the following problem:
In the scheduled work function we have:
net/bluetooth/hci_sock.c void hci_send_to_sock(struct hci_dev *hd · line 152
Quoted 3 lines
net/bluetooth/hci_sock.c +3
-0+read_lock (&hci_sk_list.lock); +sk_for_each (sk, node, &hci_sk_list.head) { +lock_sock (sk);
This would still be illegal, we can't sleep while holding an rwlock (hci_sk_list.lock above). Converting hci_sk_list.lock to an rwsem is _even_ more problematic, because hci_send_to_sock() just *cannot* sleep.
Quoted 3 lines
deallocation of
hci_dev- deallocating device just afterhci_unregister_dev()would be too soon, as it could happen before the workqueue has been run.
Suggest a better solution for this: just introduce a flush_scheduled_work() after hci_unregister_dev() but before hci_free_dev() in all those places. Less disruptive that way.
So this is quite an interesting problem indeed, but I can't help wondering that this must be faced elsewhere in the kernel (other users of lock_sock) too. CC'ing netdev@, for any ideas.
(later)
I Googled a bit to see if this problem was faced elsewhere in the kernel too. Saw the following commit by Ingo Molnar (9883a13c72dbf8c518814b6091019643cdb34429):
- lock_sock(sock->sk);
+ local_bh_disable();
+ bh_lock_sock_nested(sock->sk);
rc = selinux_netlbl_socket_setsid(sock, sksec->sid);
- release_sock(sock->sk);
+ bh_unlock_sock(sock->sk);
+ local_bh_enable();
Is it _really_ *this* simple?
Satyam
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Quoted 12 lines · Satyam Sharma
[1] This is the first problem point. However, I didn't find any reason why this particular driver's .disconnect() couldn't sleep. In fact, a comment in
include/linux/usb.h:811says:"The
probe()anddisconnect()methods are called in a context where they can sleep, but they should avoid abusing the privilege. Most work to connect to a device should be done when the device is opened, and undone at the last close. The disconnect code needs to address concurrency issues with respect toopen()andclose()methods, as well as forcing all pending I/O requests to complete (by unlinking them as necessary, and blocking until the unlinks complete)."
Quoted 6 lines
I'm assuming the comment is not obsolete, of course, but although the first sentence says .disconnect() shouldn't abuse the privilege to sleep, the last sentence makes it quite evident that we are _allowed_ to do so anyway, and that is how things are (with the
hci_usbdriver, at least, I didn't check the .remove() or .disconnect() functions of other USB drivers, however).
Yes, this is true, you are running in thread context for .disconnect of usb drivers, so you can sleep if you need to, but you will block all other device's disconnect and probe functions while you do. So, it's good to try to not abuse this if possible.
thanks,
greg k-h
Quoted 11 lines · Satyam Sharma
(later)
I Googled a bit to see if this problem was faced elsewhere in the kernel too. Saw the following commit by Ingo Molnar (9883a13c72dbf8c518814b6091019643cdb34429):(quoted diff) +2
-1- lock_sock(sock->sk); + local_bh_disable(); + bh_lock_sock_nested(sock->sk);rc = selinux_netlbl_socket_setsid(sock, sksec->sid);(quoted diff) +2
-1- release_sock(sock->sk); + bh_unlock_sock(sock->sk); + local_bh_enable();
Quoted 1 line
Is it _really_ *this* simple?
Hi Satyam,
actually this *seems* to be proper solution also for our case, thanks for pointing this out. I will think about it once again, do some more tests with this locking scheme, and will let you know.
Thanks,
Signature · 1 line
Jiri Kosina
Hi Jiri,
Quoted 13 lines · Jiri Kosina
Quoted 11 lines · Satyam Sharma
(later)
I Googled a bit to see if this problem was faced elsewhere in the kernel too. Saw the following commit by Ingo Molnar (9883a13c72dbf8c518814b6091019643cdb34429):(quoted diff) +4
-2- lock_sock(sock->sk); + local_bh_disable(); + bh_lock_sock_nested(sock->sk); rc = selinux_netlbl_socket_setsid(sock, sksec->sid); - release_sock(sock->sk); + bh_unlock_sock(sock->sk); + local_bh_enable();Quoted 1 line
Is it _really_ *this* simple?
Quoted 4 lines
[...]
actually this *seems* to be proper solution also for our case, thanks for pointing this out. I will think about it once again, do some more tests with this locking scheme, and will let you know.
Yes, I can almost confirm that this (open-coding of spin_lock_bh, effectively) is the proper solution (Rusty's unreliable guide to kernel-locking needs to be next to every developer's keyboard :-) I also came across this idiom in other places in the networking code so it seems to be pretty much the standard way. I wish I owned bluetooth hardware, could've tested this for you myself.
Thanks,
Satyam
Marcel Holtmann
maintainerHi Satayam,
Quoted 17 lines
Quoted 12 lines
Quoted 11 lines
(later)
I Googled a bit to see if this problem was faced elsewhere in the kernel too. Saw the following commit by Ingo Molnar (9883a13c72dbf8c518814b6091019643cdb34429):(quoted diff) +4
-2- lock_sock(sock->sk); + local_bh_disable(); + bh_lock_sock_nested(sock->sk); rc = selinux_netlbl_socket_setsid(sock, sksec->sid); - release_sock(sock->sk); + bh_unlock_sock(sock->sk); + local_bh_enable();Quoted 1 line
Is it _really_ *this* simple?
Quoted 4 lines
[...]
actually this *seems* to be proper solution also for our case, thanks for pointing this out. I will think about it once again, do some more tests with this locking scheme, and will let you know.
Quoted 6 lines
Yes, I can almost confirm that this (open-coding of
spin_lock_bh, effectively) is the proper solution (Rusty's unreliable guide to kernel-locking needs to be next to every developer's keyboard :-) I also came across this idiom in other places in the networking code so it seems to be pretty much the standard way. I wish I owned bluetooth hardware, could've tested this for you myself.
does this mean we should revert previous changes to the locking or only apply this on top of it?
Regards
Marcel
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Hi Marcel,
Quoted 26 lines · Marcel Holtmann
Hi Satayam,
Quoted 17 lines
Quoted 12 lines
Quoted 11 lines
(later)
I Googled a bit to see if this problem was faced elsewhere in the kernel too. Saw the following commit by Ingo Molnar (9883a13c72dbf8c518814b6091019643cdb34429):(quoted diff) +4
-2- lock_sock(sock->sk); + local_bh_disable(); + bh_lock_sock_nested(sock->sk); rc = selinux_netlbl_socket_setsid(sock, sksec->sid); - release_sock(sock->sk); + bh_unlock_sock(sock->sk); + local_bh_enable();Quoted 1 line
Is it _really_ *this* simple?
Quoted 4 lines
[...]
actually this *seems* to be proper solution also for our case, thanks for pointing this out. I will think about it once again, do some more tests with this locking scheme, and will let you know.Quoted 6 lines
Yes, I can almost confirm that this (open-coding of
spin_lock_bh, effectively) is the proper solution (Rusty's unreliable guide to kernel-locking needs to be next to every developer's keyboard :-) I also came across this idiom in other places in the networking code so it seems to be pretty much the standard way. I wish I owned bluetooth hardware, could've tested this for you myself.
Quoted 2 lines
does this mean we should revert previous changes to the locking or only apply this on top of it?
I've fixed a simple patch on top of 2.6.22-rc1 below.
net/bluetooth/hci_sock.c +0 -0
@@ -665,7 +665,8 @@ static int hci_sock_dev_event(struct not
/* Detach sockets from device */
read_lock(&hci_sk_list.lock);
sk_for_each(sk, node, &hci_sk_list.head) {
- lock_sock(sk);
+ local_bh_disable();
+ bh_lock_sock_nested(sk);
if (hci_pi(sk)->hdev == hdev) {
hci_pi(sk)->hdev = NULL;
sk->sk_err = EPIPE;@@ -674,6 +675,8 @@ static int hci_sock_dev_event(struct not
hci_dev_put(hdev); } + bh_unlock_sock(sk); + local_bh_enable(); release_sock(sk); } read_unlock(&hci_sk_list.lock);
Quoted 26 lines · Satyam Sharma
Hi Marcel,
[...]Quoted 24 lines
Quoted 23 lines
Quoted 12 lines
Quoted 11 lines
(later)
I Googled a bit to see if this problem was faced elsewhere in the kernel too. Saw the following commit by Ingo Molnar (9883a13c72dbf8c518814b6091019643cdb34429):(quoted diff) +4
-2- lock_sock(sock->sk); + local_bh_disable(); + bh_lock_sock_nested(sock->sk); rc = selinux_netlbl_socket_setsid(sock, sksec->sid); - release_sock(sock->sk); + bh_unlock_sock(sock->sk); + local_bh_enable();Quoted 1 line
Is it _really_ *this* simple?
Quoted 4 lines
[...]
actually this *seems* to be proper solution also for our case, thanks for pointing this out. I will think about it once again, do some more tests with this locking scheme, and will let you know.Yes, I can almost confirm that this (open-coding of
spin_lock_bh, effectively) is the proper solution (Rusty's unreliable guide to kernel-locking needs to be next to every developer's keyboard :-) I also came across this idiom in other places in the networking code so it seems to be pretty much the standard way. I wish I owned bluetooth hardware, could've tested this for you myself.
Quoted 4 lines
Quoted 2 lines
does this mean we should revert previous changes to the locking or only apply this on top of it?
I've fixed a simple patch on top of 2.6.22-rc1 below.
Eek, please ignore previous one. This one's correct.
net/bluetooth/hci_sock.c +0 -0
@@ -665,7 +665,8 @@ static int hci_sock_dev_event(struct not
/* Detach sockets from device */
read_lock(&hci_sk_list.lock);
sk_for_each(sk, node, &hci_sk_list.head) {
- lock_sock(sk);
+ local_bh_disable();
+ bh_lock_sock_nested(sk);
if (hci_pi(sk)->hdev == hdev) {
hci_pi(sk)->hdev = NULL;
sk->sk_err = EPIPE;@@ -674,7 +675,8 @@ static int hci_sock_dev_event(struct not
hci_dev_put(hdev); } - release_sock(sk); + bh_unlock_sock(sk); + local_bh_enable(); } read_unlock(&hci_sk_list.lock); }
Marcel Holtmann
maintainerHi Satyam,
Quoted 47 lines
Quoted 24 lines
Quoted 24 lines
Quoted 23 lines
Quoted 12 lines
Quoted 11 lines
(later)
I Googled a bit to see if this problem was faced elsewhere in the kernel too. Saw the following commit by Ingo Molnar (9883a13c72dbf8c518814b6091019643cdb34429):(quoted diff) +4
-2- lock_sock(sock->sk); + local_bh_disable(); + bh_lock_sock_nested(sock->sk); rc = selinux_netlbl_socket_setsid(sock, sksec->sid); - release_sock(sock->sk); + bh_unlock_sock(sock->sk); + local_bh_enable();Quoted 1 line
Is it _really_ *this* simple?
Quoted 4 lines
[...]
actually this *seems* to be proper solution also for our case, thanks for pointing this out. I will think about it once again, do some more tests with this locking scheme, and will let you know.Yes, I can almost confirm that this (open-coding of
spin_lock_bh, effectively) is the proper solution (Rusty's unreliable guide to kernel-locking needs to be next to every developer's keyboard :-) I also came across this idiom in other places in the networking code so it seems to be pretty much the standard way. I wish I owned bluetooth hardware, could've tested this for you myself.Quoted 4 lines
Quoted 2 lines
does this mean we should revert previous changes to the locking or only apply this on top of it?
I've fixed a simple patch on top of 2.6.22-rc1 below.
Eek, please ignore previous one. This one's correct.
Signed-off-by Satyam Sharma <[email protected]>diff -ruNp
a/net/bluetooth/hci_sock.cb/net/bluetooth/hci_sock.cnet/bluetooth/hci_sock.c +2
-1@@ -665,7 +665,8 @@ static int hci_sock_dev_event(struct not/* Detach sockets from device */ read_lock (&hci_sk_list.lock);sk_for_each (sk, node, &hci_sk_list.head) { -lock_sock (sk); +local_bh_disable (); +bh_lock_sock_nested (sk);if (hci_pi (sk)->hdev == hdev) {hci_pi (sk)->hdev =NULL ; sk->sk_err =EPIPE ;
net/bluetooth/hci_sock.c static int hci_sock_dev_event(struct not · line 682
Quoted 9 lines
net/bluetooth/hci_sock.c +2
-1@@ -674,7 +675,8 @@ static int hci_sock_dev_event(struct nothci_dev_put (hdev); } -release_sock (sk); +bh_unlock_sock (sk); +local_bh_enable (); }read_unlock (&hci_sk_list.lock); }
since Jiri has a good test case for it, I leave it to him for testing. If he confirms that this fixes the locking issues, then this is
Regards
Marcel
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Quoted 3 lines · Marcel Holtmann
since Jiri has a good test case for it, I leave it to him for testing. If he confirms that this fixes the locking issues, then this is
Signed-off-by Marcel Holtmann <[email protected]>
I will verify later this evening and will let you know. I am however pretty convinced now that this is the right fix.
Thanks,
Signature · 1 line
Jiri Kosina
Quoted 5 lines · Jiri Kosina
Quoted 3 lines
since Jiri has a good test case for it, I leave it to him for testing. If he confirms that this fixes the locking issues, then this is
Signed-off-by Marcel Holtmann <[email protected]>I will verify later this evening and will let you know. I am however pretty convinced now that this is the right fix.
Satyam,
I have just verified that this locking scheme is indeed correct. So you can add
if you wish to, and submit the patch to Andrew.
Thanks,
Signature · 1 line
Jiri Kosina
David Miller
maintainerFrom: Jiri Kosina <[email protected]>
Date: Thu, 17 May 2007 01:03:55 +0200 (CEST)
Quoted 8 lines · Jiri Kosina
Quoted 6 lines
Quoted 4 lines
since Jiri has a good test case for it, I leave it to him for testing. If he confirms that this fixes the locking issues, then this is
Signed-off-by Marcel Holtmann <[email protected]>I will verify later this evening and will let you know. I am however pretty convinced now that this is the right fix.
Quoted 8 lines
Satyam,
I have just verified that this locking scheme is indeed correct. So you can add
Signed-off-by Jiri Kosina <[email protected]>if you wish to, and submit the patch to Andrew.
I guess I don't get sent networking patches any more? :-)
Quoted 8 lines · David Miller
Quoted 6 lines
I have just verified that this locking scheme is indeed correct. So you can add
Signed-off-by Jiri Kosina <[email protected]>if you wish to, and submit the patch to Andrew.
I guess I don't get sent networking patches any more? :-)
Well, this is bluetooth-specific, but it seemed to me that Marcel wasn't going to send pull requests to Linus any time soon, therefore I thought going through akpm is a thing to do.
Honestly, I really don't care through which tree this goes in, so sorry if any offence was caused here :)
Signature · 1 line
Jiri Kosina
Marcel Holtmann
maintainerHi Jiri,
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
I have just verified that this locking scheme is indeed correct. So you can add
Signed-off-by Jiri Kosina <[email protected]>
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
if you wish to, and submit the patch to Andrew.
I guess I don't get sent networking patches any more? :-)
Well, this is bluetooth-specific, but it seemed to me that Marcel wasn't going to send pull requests to Linus any time soon, therefore I thought going through akpm is a thing to do.
actually everything net/ related goes to Dave first. No exception. This includes the Bluetooth subsystem. I even send drivers/bluetooth/ through Dave before they go to Linus.
Quoted 2 lines
Honestly, I really don't care through which tree this goes in, so sorry if any offence was caused here :)
Having these small ones passed through Andrew is only a convenience since he is really good in picking them up and make sure that they get merged by Linus.
Regards
Marcel