Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp1429994rdh; Fri, 24 Nov 2023 12:26:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IEsj1yilkMO0e9OUuhGchelTlGYrWQF4e9G0cUYJ3AhWogA8dI8pImRUmH/ctIZIzaUJuiv X-Received: by 2002:a05:6870:a2c9:b0:1f0:3b3f:8686 with SMTP id w9-20020a056870a2c900b001f03b3f8686mr4935627oak.54.1700857590884; Fri, 24 Nov 2023 12:26:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700857590; cv=none; d=google.com; s=arc-20160816; b=Vp2WANvxCnS7yfIPkCjDrABDLDlaJidn4FYwmbXXiMHGvbJVYxwOlJE2nHxFDoCtm5 jKWMbpHOf9BGNpZy5J3nWfN6oPUMh2B9/FW0yEeSb7q/sT6rNiIsPsauZLtSLyRl4Q/k x2nPXu02JeG977CotFtFR4uMG2dw9posHJ3YHH6sAJN8noIAE4AzWvtIBp0cwDo/9vZF nCVDhcOn65LjhbYBOFFQzG3Iap7BgBn3NcHN8gHJ+fZzw0hTVi5ATteIprL5oiEZ9MCX T5dy5YpucIL0YvORLWO+7PHz7193cpX0i+i6tk+234yCWdlBsJcTYqHkbvKwjd4a5drG bFHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=Po11Ep95UvgFUflOU1Vt0USquAkpuIpwn6DtrZlmULg=; fh=sihOL2us7/FE47MHiLH1P9F3Acgw8zeZYbXaRU3+RxY=; b=rQYKXM9hpRoL+gOPyVN1uMjvXuedFeKIoOkmBJherBrYSaINdJXz/QKOkXjeoUgGlw evAruKpkJcG0Pxe4QmzObtyprxorpxJrxAoz4y28BI1fV1EDkma92JGgWHjuxsGnt7ce VuSf6hMsFfK5ixtSDojrRJEa22hP1C/61g74wSUFP0PV3+RiC10yLvUk4bJHH5Ye4l9s Ho6/vDqPrZbQpReEO3INJDxieZagbiKJl2bPMI9TzwVUqI5nCckyYWDZPlVLU/ecv3oG b1sJaKNHvUxlylNnUU9lX/YGc3OzcWLP8JnzlteFcDpM4Bl/TJth60ZgOIJ1o+Y/fUQz pPKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth+bounces-207-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-207-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id bq15-20020a05622a1c0f00b0042395546610si2563663qtb.565.2023.11.24.12.26.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 12:26:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-207-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth+bounces-207-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-207-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9F6661C25061 for ; Fri, 24 Nov 2023 20:26:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 428873BB33; Fri, 24 Nov 2023 20:26:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=none X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail11.truemail.it (mail11.truemail.it [217.194.8.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5913E170B; Fri, 24 Nov 2023 12:26:19 -0800 (PST) Received: from francesco-nb.int.toradex.com (93-49-2-63.ip317.fastwebnet.it [93.49.2.63]) by mail11.truemail.it (Postfix) with ESMTPA id ACF4A20718; Fri, 24 Nov 2023 21:26:15 +0100 (CET) Date: Fri, 24 Nov 2023 21:26:11 +0100 From: Francesco Dolcini To: linux-bluetooth@vger.kernel.org, Luiz Augusto von Dentz Cc: Sherry Sun , Johan Hedberg , Neeraj Sanjay Kale , linux-kernel@vger.kernel.org, Marcel Holtmann , Marcel Ziswiler , Amitkumar Karwar , Ilpo =?iso-8859-1?Q?J=E4rvinen?= , Marcel Ziswiler Subject: Re: [PATCH v1 1/2] Bluetooth: btnxpuart: Fix btnxpuart_close Message-ID: References: <20231018145540.34014-1-marcel@ziswiler.com> <20231018145540.34014-2-marcel@ziswiler.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231018145540.34014-2-marcel@ziswiler.com> Hello all, On Wed, Oct 18, 2023 at 04:55:39PM +0200, Marcel Ziswiler wrote: > From: Marcel Ziswiler > > Unfortunately, btnxpuart_close() may trigger a BUG: scheduling while > atomic. Fix this by properly purging the transmit queue and freeing the > receive skb. > > Fixes: 689ca16e5232 ("Bluetooth: NXP: Add protocol support for NXP Bluetooth chipsets") > > Signed-off-by: Marcel Ziswiler > --- > This is the kernel trace this commit fixes: > [ 29.270685] BUG: scheduling while atomic: kworker/u3:0/55/0x00000002 I just hit this bug with 6.7-rc2, I think it would be worth to apply this fix. [ 70.443965] BUG: scheduling while atomic: kworker/u5:0/65/0x00000002 [ 70.450649] Modules linked in: 8021q garp mrp stp llc usb_f_ncm u_ether spidev mwifiex_sdio mwifiex snd_soc_simple_card snd_soc_simple_card_utils crct10dif_ce cfg80211 k3_j72xx_bandgap rti_wdt rtc_ti_k3 btnxpuart bluetooth ecdh_generic ecc snd_soc_davinci_mcasp sa2ul sha256_generic rfkill snd_soc_ti_udma libsha256 snd_soc_ti_edma authenc tidss snd_soc_ti_sdma omap_mailbox drm_dma_helper ti_ads1015 industrialio_triggered_buffer lontium_lt8912b snd_soc_wm8904 kfifo_buf lm75 at24 tps65219_pwrbutton ina2xx m_can_platform rtc_ds1307 tc358768 m_can display_connector spi_omap2_mcspi pwm_tiehrpwm can_dev drm_kms_helper libcomposite fuse drm backlight ipv6 [ 70.509384] CPU: 0 PID: 65 Comm: kworker/u5:0 Not tainted 6.7.0-rc2-00147-gf1a09972a45a #1 [ 70.517747] Hardware name: Toradex Verdin AM62 WB on Dahlia Board (DT) [ 70.524334] Workqueue: hci0 hci_power_on [bluetooth] [ 70.529870] Call trace: [ 70.532349] dump_backtrace+0x94/0xec [ 70.536103] show_stack+0x18/0x24 [ 70.539491] dump_stack_lvl+0x48/0x60 [ 70.543210] dump_stack+0x18/0x24 [ 70.546575] __schedule_bug+0x50/0x68 [ 70.550312] __schedule+0x7c4/0xa64 [ 70.553874] schedule+0x34/0xa0 [ 70.557083] schedule_timeout+0x180/0x25c [ 70.561151] wait_for_completion_timeout+0x80/0x15c [ 70.566101] ti_sci_set_device_state+0x164/0x22c [ 70.570790] ti_sci_cmd_get_device_exclusive+0x18/0x24 [ 70.575991] ti_sci_pd_power_on+0x28/0x48 [ 70.580073] _genpd_power_on+0x94/0x154 [ 70.583964] genpd_power_on.part.0+0xa4/0x174 [ 70.588383] genpd_runtime_resume+0x118/0x294 [ 70.592800] __rpm_callback+0x48/0x140 [ 70.596616] rpm_callback+0x6c/0x78 [ 70.600165] rpm_resume+0x3bc/0x59c [ 70.603714] __pm_runtime_resume+0x4c/0x90 [ 70.607870] omap8250_set_mctrl+0x2c/0xc0 [ 70.611954] serial8250_set_mctrl.part.0+0x18/0x34 [ 70.616801] serial8250_set_mctrl+0x18/0x28 [ 70.621038] uart_update_mctrl+0x58/0x78 [ 70.625024] uart_dtr_rts+0x108/0x118 [ 70.628750] tty_port_shutdown+0x88/0xd8 [ 70.632744] tty_port_close+0x50/0xac [ 70.636472] uart_close+0x28/0x80 [ 70.639850] ttyport_close+0x50/0x94 [ 70.643500] serdev_device_close+0x40/0x50 [ 70.647664] btnxpuart_close+0x24/0x84 [btnxpuart] [ 70.652553] hci_dev_open_sync+0x3f8/0x9dc [bluetooth] [ 70.658144] hci_dev_do_open+0x28/0x48 [bluetooth] [ 70.663377] hci_power_on+0x4c/0x2ac [bluetooth] [ 70.668441] process_scheduled_works+0x16c/0x28c [ 70.673135] worker_thread+0x16c/0x2e0 [ 70.676950] kthread+0x11c/0x128 [ 70.680247] ret_from_fork+0x10/0x20