Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp608015pxh; Tue, 9 Nov 2021 16:06:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJwFXoLkbamsnED4XaGsFvG/FgZS68N2ZP/pY3opl8JoMwMDJXeo5gUwzyM1nSvQJewwO3e1 X-Received: by 2002:a05:6e02:1402:: with SMTP id n2mr8285575ilo.208.1636502794535; Tue, 09 Nov 2021 16:06:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636502794; cv=none; d=google.com; s=arc-20160816; b=bLXnLkDA5uC0obcZ4j4rVejGM/kPFzzJ1OjNPoYwQx3mBnCsXNB98Sv0/bQLSVqWCK irh9i/Taoj3gxSo4er2/mgZunhxYsyKfna3v1jkh5iE4cyjGNmDvCVH1LSopmHjvSXeD LwkYFC9pMjppkP4CO1uqPw9mfgMzpMC7Ma13zvDLrbhZ09HrrPOTpW3aK5pfUPBNjwi+ 6RY+j3dKbhU0JXI4o+sZTu53FtRaBVsCJ2ztFqZAOJMBIM9Tt5Xu+S+76Sk4UR1fU2EG oV/mdRxVZAymMRxuki5GY/b3qB1+FoD0xh8NFuqK5HCUrs+04pEvrrLnv7wjzUQAYVnZ ccpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=lSfcP7eOVSw4c5jDibayrhPioukG4Weehmto05Q+vKQ=; b=nvTFjDUxMQUR7w+mL+td5zOmsGG8iBOpQFzZfK0jse0l4Latb990VgmGiR18BVX0cC +o/O4qtlsb/JljChfY0PTRrfKHYq8Vwgdz9QmJkSVg9qGY0MiTGWcr31515/oLHCKM6/ zQUZjRVhfaSJlRGmbXruiSXkCYKdM1wbAyNagouE01dvEFESVZWt5ROK7zp70aR/HZxa fBw2ZJy0u17FzCgk8nvuePJ9PUlTeyVC/CuE9JWEWHNdGIjpJrZql3qswUq/5uI59J0U bAETdOSJMN2rNvraJl/nQveTu/IS9y5PvgHMKGMDAESULeGtNqfJfqiAMcDg/EK4kKFJ m6Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=oaVasdPK; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s15si46491449jat.54.2021.11.09.16.06.18; Tue, 09 Nov 2021 16:06:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=oaVasdPK; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239958AbhKIQo1 (ORCPT + 99 others); Tue, 9 Nov 2021 11:44:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238286AbhKIQoX (ORCPT ); Tue, 9 Nov 2021 11:44:23 -0500 Received: from sipsolutions.net (unknown [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B47BFC0613B9 for ; Tue, 9 Nov 2021 08:41:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Content-Type:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-To:Resent-Cc: Resent-Message-ID:In-Reply-To:References; bh=lSfcP7eOVSw4c5jDibayrhPioukG4Weehmto05Q+vKQ=; t=1636476097; x=1637685697; b=oaVasdPKLZ/aOQ0xuzYKSyHY4p5SB0TQnfOwAMvJB2r8qBeLb6uGIsL4A14w7wW9eXAT3bMp/pW 4C6rWLjBHe2Vk/dgsTtLM1S5Qy/E4R2wernUksiurZCuFHgyAj4kZh4kdzWVFu5kcCGZzUz51Nt9H AGJCVj+4CK3Otdo3YtDuGikHwqWEAQqLORYmduNMKEHMRvAezq7sVXBgQHpJLB4mcTPh7HoKJz3Y4 bCX5Qp43HUAQsMQdZ7TjcKGwtiC9SkWFmTvnPeTMjI6MQlh3s0oWMLt+3oZhrtb1F2uoJQlfVWOIp Kzh2U+6DY45i92clfOaNNQ2LhLjZiSJgWPzw==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.95) (envelope-from ) id 1mkUBh-00D1dY-4o; Tue, 09 Nov 2021 17:41:33 +0100 From: Benjamin Berg To: linux-bluetooth@vger.kernel.org Cc: Benjamin Berg Subject: [PATCH 0/4] Cancel sync commands if a TX failure occurs Date: Tue, 9 Nov 2021 17:41:09 +0100 Message-Id: <20211109164113.65981-1-benjamin@sipsolutions.net> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org It was reported that userspace could hang for 10s after resuming due to btusb hitting the internal timeout when sending the firmware. In this case, the bluetooth dongle disappeared right after resume due to the thinkpad_acpi rfkill being blocked. This causes the USB device to disappear, however the bluetooth stack does not handle the corresponding ENODEV errors and instead waits for a timeout to happen. To avoid blocking everything for such a long time, the synchronous command has to finish immediately after an ENODEV error occurs. This requires further error handling, which this patchset adds by building on top of the existing cancellation infrastructure for synchronous commands. Note that this just adds basic error handling in order to quickly abort the initialization routine in case the device disappears at that time. Additional error handling such as calling hci_reset_dev might be sensible in some cases. Benjamin Berg (4): Bluetooth: Reset more state when cancelling a sync command Bluetooth: Add new hci_tx_error function Bluetooth: hci_core: Signal TX failure if sending a frame failed Bluetooth: btusb: Signal URB errors as TX failure drivers/bluetooth/btusb.c | 16 ++++++++++++---- include/net/bluetooth/hci_core.h | 1 + net/bluetooth/hci_core.c | 9 +++++++++ net/bluetooth/hci_request.c | 5 +++++ 4 files changed, 27 insertions(+), 4 deletions(-) -- 2.31.1