From patchwork Thu Jul 27 02:36:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 794171 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="NHjX4Et2"; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3xHx1l1NnJz9s72; Thu, 27 Jul 2017 12:36:27 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1daYez-0008Sv-1n; Thu, 27 Jul 2017 02:36:21 +0000 Received: from mail-pg0-f66.google.com ([74.125.83.66]) by huckleberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1daYer-0008QY-0V for kernel-team@lists.ubuntu.com; Thu, 27 Jul 2017 02:36:13 +0000 Received: by mail-pg0-f66.google.com with SMTP id y129so19037809pgy.3 for ; Wed, 26 Jul 2017 19:36:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=w+uzJui5inNhoLtmy1aD3Avz2n9KA5SUSdb/RnJN2Ak=; b=NHjX4Et2K7l30+VxXzjd01/dEGRSv7f06WEKUXtr2NTJLwif+ZdMy5Pi4aS/N/PQrT B52RhiWnpjmToA71wxNi7jniynLYZxaOzSSPhO9dM8YjxzPaDU4hWe3007MsZXgkoa88 dF5DG68qIBszZYMuUCBsnyoeHQ2TVtUHBlvCrokdprh33ivYOG0miTMeU59oSzkLZsAn HFV2iP2nDF8AmUzxrwfQhC3nyjENEbKQvkQjReMyJkmAH9d97fzQ2MN257/lRIptVYL/ xi/Vy8M0vZQcNhfhvlZJG9nzQ+82fRqJ/t7nNsUcFN58k1vxunPaG73U94n0FKCPxBf1 R1KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=w+uzJui5inNhoLtmy1aD3Avz2n9KA5SUSdb/RnJN2Ak=; b=Bw9PgnnuFAh5/8nYeel0ldhXQ4OcR3TCOsK+oscmaDvyzf17IpgNdPnHUoN9TZhpR/ NjXAhakeJqP9WivUmPa7Pa3726UykeS2DyfLTwpezKJ20Oi5NermwlnjjGboS0iYyYWG QT9kKm2Dc971xSaKEWUyrSsQVM3TrZYJP2oDbZDahkZVb9f+aQ4ldoHlijF3yhs4PfBD D97j9UFgwKpTUVmcDZYPf+i8wipSoq+ZLwHcv65c0Ne7h1W8ur4pp2qbsChR6fzKGPhN OXLiaDJ1qoo1kHCR/Ld7svMC1f0xmdBsSOLNBOT+9wq04pLGrRKF77/LyEEHHO2Ib1yw zU3A== X-Gm-Message-State: AIVw113+7CHQ8n9Ad4M4zRktildQChb85NioF0qNNCKnWPuEgtQ3F0L/ 6XRO6ojLwRApc6X7B04= X-Received: by 10.98.166.131 with SMTP id r3mr2724419pfl.120.1501122971008; Wed, 26 Jul 2017 19:36:11 -0700 (PDT) Received: from localhost (220-135-118-142.HINET-IP.hinet.net. [220.135.118.142]) by smtp.gmail.com with ESMTPSA id a82sm29337849pfc.120.2017.07.26.19.36.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Jul 2017 19:36:10 -0700 (PDT) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH] UBUNTU: SAUCE: Bluetooth: Make request workqueue freezable Date: Thu, 27 Jul 2017 10:36:05 +0800 Message-Id: <1501122965-6811-2-git-send-email-acelan.kao@canonical.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501122965-6811-1-git-send-email-acelan.kao@canonical.com> References: <1501122965-6811-1-git-send-email-acelan.kao@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: Laura Abbott BugLink: http://bugs.launchpad.net/bugs/1706833 We've received a number of reports of warnings when coming out of suspend with certain bluetooth firmware configurations: WARNING: CPU: 3 PID: 3280 at drivers/base/firmware_class.c:1126 _request_firmware+0x558/0x810() Modules linked in: ccm ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 xt_conntrack ebtable_nat ebtable_broute bridge stp llc ebtable_filter ebtables ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw ip6table_filter ip6_tables iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_security iptable_raw binfmt_misc bnep intel_rapl iosf_mbi arc4 x86_pkg_temp_thermal snd_hda_codec_hdmi coretemp kvm_intel joydev snd_hda_codec_realtek iwldvm snd_hda_codec_generic kvm iTCO_wdt mac80211 iTCO_vendor_support snd_hda_intel snd_hda_controller snd_hda_codec crct10dif_pclmul snd_hwdep crc32_pclmul snd_seq crc32c_intel ghash_clmulni_intel uvcvideo snd_seq_device iwlwifi btusb videobuf2_vmalloc snd_pcm videobuf2_core serio_raw bluetooth cfg80211 videobuf2_memops sdhci_pci v4l2_common videodev thinkpad_acpi sdhci i2c_i801 lpc_ich mfd_core wacom mmc_core media snd_timer tpm_tis hid_logitech_hidpp wmi tpm rfkill snd mei_me mei shpchp soundcore nfsd auth_rpcgss nfs_acl lockd grace sunrpc i915 i2c_algo_bit drm_kms_helper e1000e drm hid_logitech_dj ptp pps_core video CPU: 3 PID: 3280 Comm: kworker/u17:0 Not tainted 3.19.3-200.fc21.x86_64 Hardware name: LENOVO 343522U/343522U, BIOS GCET96WW (2.56 ) 10/22/2013 Workqueue: hci0 hci_power_on [bluetooth] 0000000000000000 0000000089944328 ffff88040acffb78 ffffffff8176e215 0000000000000000 0000000000000000 ffff88040acffbb8 ffffffff8109bc1a 0000000000000000 ffff88040acffcd0 00000000fffffff5 ffff8804076bac40 Call Trace: [] dump_stack+0x45/0x57 [] warn_slowpath_common+0x8a/0xc0 [] warn_slowpath_null+0x1a/0x20 [] _request_firmware+0x558/0x810 [] request_firmware+0x35/0x50 [] btusb_setup_bcm_patchram+0x86/0x590 [btusb] [] ? rpm_idle+0xd6/0x230 [] hci_dev_do_open+0xe1/0xa90 [bluetooth] [] ? ttwu_do_activate.constprop.90+0x5d/0x70 [] hci_power_on+0x40/0x200 [bluetooth] [] process_one_work+0x14c/0x3f0 [] worker_thread+0x53/0x470 [] ? rescuer_thread+0x300/0x300 [] kthread+0xd8/0xf0 [] ? kthread_create_on_node+0x1b0/0x1b0 [] ret_from_fork+0x58/0x90 [] ? kthread_create_on_node+0x1b0/0x1b0 This occurs after every resume. When resuming, the bluetooth stack calls hci_register_dev, allocates a new workqueue, and immediately schedules the power_on on the newly created workqueue. Since the new workqueue is not freezable, the work runs immediately and triggers the warning since resume is still happening and usermodehelper has not yet been re-enabled. Fix this by making the request workqueue freezable. This ensures the work will not run until unfreezing occurs and usermodehelper is re-enabled. Signed-off-by: Laura Abbott Signed-off-by: AceLan Kao Acked-by: Stefan Bader Acked-by: Kleber Sacilotto de Souza --- net/bluetooth/hci_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index eea796c..780a76c 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -3365,7 +3365,7 @@ int hci_register_dev(struct hci_dev *hdev) } hdev->req_workqueue = alloc_workqueue("%s", WQ_HIGHPRI | WQ_UNBOUND | - WQ_MEM_RECLAIM, 1, hdev->name); + WQ_MEM_RECLAIM | WQ_FREEZABLE, 1, hdev->name); if (!hdev->req_workqueue) { destroy_workqueue(hdev->workqueue); error = -ENOMEM;