From patchwork Wed Aug 9 06:53:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13347472 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D3E3EB64DD for ; Wed, 9 Aug 2023 06:49:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231302AbjHIGt0 (ORCPT ); Wed, 9 Aug 2023 02:49:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231287AbjHIGtZ (ORCPT ); Wed, 9 Aug 2023 02:49:25 -0400 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on061b.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1e::61b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4732A1BF7 for ; Tue, 8 Aug 2023 23:49:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JBG08YDq3URoxBbYYaQ/nhpdU8YgztQ0uRakbH+32tMKEDPMKJ1PmXHiFBv0J2upHlP9bu0CGupWF7JXt0PS2knHehoZwgHdIgQOMFH9fAm5YMDyScGQ8t2c9g3cZsMPCwztYa/6y2XGQTkrQeCHneJ0io1AaZZWmOEscg3WaYucRrwRSoVCB5RtGGKl3DjxJfY5MhEV2rcfJKevdbU/slw47KqpdaHQstyHN2imlTs5jQIzXUR6vjxw41tueg2UEU+GCb2r1X4vVY1WC2hoBkwb9e6OfSuU3ED7wnjVFDHAlF9i1gXCrEbqcK6bM3bdyZrrMVnd9GgLoQFxQpyoUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mcc8HqfjDses8hNqV4H+NiRdDwiz9GrIrj6xk29+Qwk=; b=b7nW8JtBWVvs3Hneh51wh7rwY+ID3KtKFpdUF/sTaMNPn2YT1jYomHfibMDDOoQ5UYiyZ7NUCKl124LtiIVe6BOVUaFbD78opPnMotjiSPkZRwmG6GMp8HYq2mie20txvMvKhtL92pag2+5k21RuM46B+d0GctLw603nNRzNZxtX0WtQwux0tLedXhWHLcMVXNcnssBJqneBSLrvBviEiilrF2fZ0H0HHI/CiG79eKs8rioqDgoxQHV7Q8XpVTncvMQvf5FrmQ4DqQwpxDA8LTDLf8HpA/7k6WdoXpt9cfduhBgi4Xf+QCTDDVv7lo2d1HHNueur5yzUETh4iU/EDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mcc8HqfjDses8hNqV4H+NiRdDwiz9GrIrj6xk29+Qwk=; b=SL+jbQTLysmw2ckZfaz+jnIYvEvZa7lgOeutPkCDeHpmNuMCcfK7KDr0Ep+Ko72HWdu0YMD9I/JPQVDJjFixH6le4LjcPkFlo5HlTeIw+4AbqKtBxMIwyclph+Ys5MO+W3co4RIzk7hKEdiGv1nPRCvgnl9U0dC6C9tqouJmUpc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB7PR04MB4505.eurprd04.prod.outlook.com (2603:10a6:5:39::26) by PAWPR04MB9936.eurprd04.prod.outlook.com (2603:10a6:102:38b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.27; Wed, 9 Aug 2023 06:49:20 +0000 Received: from DB7PR04MB4505.eurprd04.prod.outlook.com ([fe80::85e5:acf6:574d:a2a1]) by DB7PR04MB4505.eurprd04.prod.outlook.com ([fe80::85e5:acf6:574d:a2a1%4]) with mapi id 15.20.6652.028; Wed, 9 Aug 2023 06:49:20 +0000 From: Xu Yang To: stern@rowland.harvard.edu Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, jun.li@nxp.com Subject: [PATCH] usb: host: ehci-sched: try to turn on io watchdog as long as periodic_count > 0 Date: Wed, 9 Aug 2023 14:53:27 +0800 Message-Id: <20230809065327.952368-1-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SI1PR02CA0044.apcprd02.prod.outlook.com (2603:1096:4:1f6::6) To DB7PR04MB4505.eurprd04.prod.outlook.com (2603:10a6:5:39::26) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR04MB4505:EE_|PAWPR04MB9936:EE_ X-MS-Office365-Filtering-Correlation-Id: 1d87daad-1b5d-466c-a554-08db98a4c1e4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rQeB74hIw62hlqLFt0uTb1OcQZ6099l0wSQ6cWkLzxz0WdqRY7bks+02eR+GMUyG3oE3dR/34ZgTEgVjUHNmLee8SVY5aE1ySK7wMuQIz53cVcTR/wOVseaguUbXnvvzmgi5pn9umsTj223utEu0fPUxt8cYkHWYGf66mWoZn65HJzb2HlktSK2dt19456q9RepaVQe85TlT/EM20T4lCkn5M/ch+kssjJH8zTzqJTduAGsXp2XFOUtJEKqJu3tYbr5orT6o9RC9SHqPRmOUAq0J/7/p113amlEuuCS/fXZ9xKSonD8EfzdwftIVUeBTPxLnbUZaRYU2REbKS21soGYmjeikOxJG7lrwBLZckRY0BfM0FykYjrX+PQ2Vz0B4CXhGVg70sm4/shje2AnSRLU5/smc/HzeaNx2Xmb0FEXetJ7KkyszDzNtG802KNu/OSOz5KS42v7UAT/O6vlUbh2XwtkY+VIocS/MqRph/n39KA1kT9qk4SbgwEJC24RzNFzsH8Kuv+9WIuy/6hQwtLKw/lyXqjq88Ut/jK0cwyLt33uYsxJ2gtya8TRjfPPs1AKu4BlLtd3/Z8/Co7u0MnFisbNrnKeGW/s2d7Z0+PWKHj0+njGhRFBNYtJKe65a X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR04MB4505.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(376002)(366004)(346002)(39860400002)(136003)(396003)(1800799006)(451199021)(186006)(8676002)(5660300002)(8936002)(4326008)(316002)(41300700001)(83380400001)(86362001)(2906002)(6916009)(6512007)(6486002)(1076003)(6506007)(26005)(36756003)(2616005)(52116002)(66946007)(66556008)(66476007)(478600001)(38350700002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LIPTJJ3Chz/3EUEXPaicxTQ6KJ1mZX+VUde8KX6fiLskSoGygLvmTFXoJwGXoeaRTuG+LMdc7rB/kfEI3kE54Qhx6eVa16o4UEGKOLlAIziTrzdG4ZAjvOiS9eeqIhSC6ENGW0vo4LA6m9A3AgW/Ln8F3b8oOUXxaDSpq+diIDhC7xo7qgsReBlaXtUQx2nZYLnXNqM8qindfBrp0lM+au39EwrvWaT64xxUmM72j6ZZ5u4X7pAoxHqdVQVetIDtutjWLosrnXl3rIoVBxG4ccMrHIyMmpE4cIhPPv5l+/qJzTBkd4SiRbIje4mb7miyeU33vlfFo0roEsP1o0Swtxy+x2LjyqROXVg/YtiI7XkdNIDJBleGP0C28VICZ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SLWCUQbBzfw1YwCUY8pJU/i0pX6PfAZWd5nx+R3MmOx50mikEYAGiyC1+XWKKhIX6dtO8u13QiBIKMnB4IeYJP9uEv6cHcozTad2gHVlnG13IqlqUb3CSoCcOqeFIU5rBy4L4HZj6o7i X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d87daad-1b5d-466c-a554-08db98a4c1e4 X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB4505.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2023 06:49:20.1301 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: czB//ub1OgxpuFR0ujtPCfuwFdgPFz5CbS50KUgGsqyxT8orVSKJn2K3M8Gh+2Z0DOmc7xH1cWU8L4E2Cd7gPA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9936 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org If initially isoc_count = 0, periodic_count > 0 and the io watchdog is not started (e.g. just timed out), then the io watchdog may not run after submitting isoc urbs and enable_periodic(). The isoc urbs may not complete forever if the controller had already stopped periodic schedule. This will try to call turn_on_io_watchdog() for each enable_periodic() to ensure the io watchdog functions properly. Signed-off-by: Xu Yang Reviewed-by: Alan Stern --- drivers/usb/host/ehci-sched.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index bd542b6fc46b..7e834587e7de 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c @@ -490,13 +490,14 @@ static int tt_no_collision( static void enable_periodic(struct ehci_hcd *ehci) { if (ehci->periodic_count++) - return; + goto out; /* Stop waiting to turn off the periodic schedule */ ehci->enabled_hrtimer_events &= ~BIT(EHCI_HRTIMER_DISABLE_PERIODIC); /* Don't start the schedule until PSS is 0 */ ehci_poll_PSS(ehci); +out: turn_on_io_watchdog(ehci); }