From patchwork Fri Feb 25 11:24:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 12760127 X-Patchwork-Delegate: johannes@sipsolutions.net 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 16E4FC43219 for ; Fri, 25 Feb 2022 11:25:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240185AbiBYLZ4 (ORCPT ); Fri, 25 Feb 2022 06:25:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240134AbiBYLZu (ORCPT ); Fri, 25 Feb 2022 06:25:50 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2068.outbound.protection.outlook.com [40.107.243.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD75E22322E; Fri, 25 Feb 2022 03:25:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NeeTMdjKTn6bPGX08tc3dYcgi9kEPaWayW/jgqAI0UbXRBe7erf07JqGT2mG5wIUuB0mcCpQ1qvPvZVSAvflBo8BwdtpHpwd5nPCTzOqvlQrf4/+mE0WbrRZm1FYRdBKR0ak7XvGs9YT0uoX4HqI9IbywDnKV8YUxMg7DVn8VhQp+tIOLiybTTO1oH6O2j88mtxWDxEXRQn/HZQdeA3swpkx5bQMUbB8XQW0AaK7QinSU9jEAlmjJRSbgf73BnUrIGQfdhhpT7PqvegtHr8q9F2U2LY1FRA5S4ZshoX9l3VYFW6RFyTk8GwACLMOCRJesFm/ufKDMwqkwng/bDewTg== 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=+wETx1RzKZhiyXs6XkuVCaiMw7ryaf3FENz497+pcUc=; b=d1Uc+59hesBx0Hie44MCA20z2mXYmUxh3Ue0O/E1MToAB5PP42Uha90yLCJoSQARV98FhEfE1SWNx/mS506AGc5K7mQDTD6HZeDpo0itPiMFs7bQz8V/HgUWrTYg6dqbYc3Ht8nP1NUx/dnT+7b4k3klZS3F9f3kFa+/k8O8TkJuI7H0Pnr8b1w6d3oFkDAwp7Gklx7IjMBGzSe5QWu8f1Im0A/2R8zRNmPN/G9SadSsUSOXVt+3xVC64m3fNm3UnyGLDIsSpp/WAE2QqAVRj8qbNgX9Fv+B7LNImFGkqWQRm7HZaoolYDVYjRhvlTUEJDyPEhMmbY0nrHTmc16MIg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+wETx1RzKZhiyXs6XkuVCaiMw7ryaf3FENz497+pcUc=; b=MuhxZMdbJM05Ltn8/MkejffnNimowOWYeXj5HbCF8NEN74ehSRPz46OQE3EzTd/y2Vvxbz8Q6HaAP8h8r9EAgIa3LX+hDgdrPZL1fYPnS40xDUhSuFZa6m94de7Ok85L9us4ZcJqYqJMi+p3lS39tGMNgn6hfcAgCq0TiX79xl4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=silabs.com; Received: from PH0PR11MB5657.namprd11.prod.outlook.com (2603:10b6:510:ee::19) by BN6PR11MB1428.namprd11.prod.outlook.com (2603:10b6:405:a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.24; Fri, 25 Feb 2022 11:24:52 +0000 Received: from PH0PR11MB5657.namprd11.prod.outlook.com ([fe80::dd2e:8a4e:fc77:1e66]) by PH0PR11MB5657.namprd11.prod.outlook.com ([fe80::dd2e:8a4e:fc77:1e66%5]) with mapi id 15.20.5017.023; Fri, 25 Feb 2022 11:24:52 +0000 From: Jerome Pouiller To: linux-wireless@vger.kernel.org, Kalle Valo Cc: devel@driverdev.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , =?utf-8?b?SsOpcsO0bWUgUG91?= =?utf-8?b?aWxsZXI=?= Subject: [PATCH 09/10] staging: wfx: ensure HIF request has been sent before polling Date: Fri, 25 Feb 2022 12:24:04 +0100 Message-Id: <20220225112405.355599-10-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220225112405.355599-1-Jerome.Pouiller@silabs.com> References: <20220225112405.355599-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PR3P189CA0052.EURP189.PROD.OUTLOOK.COM (2603:10a6:102:53::27) To PH0PR11MB5657.namprd11.prod.outlook.com (2603:10b6:510:ee::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1486d1e9-6050-4246-0475-08d9f85170bc X-MS-TrafficTypeDiagnostic: BN6PR11MB1428:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vj/BIq0uLHmBl2hKBTrGmj9AmH2tmwp9fzRQG5/9wj6wlfA4zQ+oU12MEh8DGx2aMT4c+xlys8ieQ0XRSlcLrAWfX4NzX8jJb0CSNDLREEO6nu6M7CurnkctOzcKi2cH5vqzKUm+V1eQMxSySrc9Gc7omVU+kyIMa1KWnZ/abUM1CjmLxTtD3EjvwvDpjHMGeL0VOL5SQVWeejJsrp6cxhyFRwFb3J2sNd+kAhHrWUG/uJwwHPxDIcLNssvl0lowWFkx7HKiZOZD3YWruuuV+fpbz81YCPwSZMTI7n59BIUFgJXuJ7h3t9DA6QjsvAeWfHYvBQQxlyvL9oyThLUme1wGe94/t/ChC/fNJLjQP+Di1EWYwUf6Y7dpOnQmm6wO3WY0ACisxI/p71yIeYiK19HQ1PNGA9romVL4gbne+yalddJI6oDJCbOFCc8WwU6Lu0vZuw1G0GXnen238CvbxPXDSKjhC5IlZwz/1pMZmDovGYCPzRtpD2O1GVLCYwR3iNKTAW2L9xP/PLZ39ct8H8WUswGpB+O13dNTSUsIwPT+9QcCNaSYEBS62IoKt3zH/DUYp3XVkL9F8Ut2aC6psihOzr9FiI03mUS9MHvgyT23Rf8HjNNXrxdoRvukpbCO1Zr6sdE8XHhrPsC3mru6+hXAhfeo1LEpX8u4ivbx+AyPRiEK6BFh8V0YAs9mAmLZODai41oG3rQ4TY1wRm2SIw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5657.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(2616005)(36756003)(66574015)(107886003)(83380400001)(6506007)(6512007)(8676002)(26005)(8936002)(2906002)(38350700002)(186003)(5660300002)(38100700002)(1076003)(508600001)(54906003)(66946007)(66556008)(6486002)(66476007)(52116002)(6916009)(86362001)(4326008)(316002)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?54cnj8cJ2L6+GM3mhJp+1Mn81HVl?= =?utf-8?q?pngwamB0HSyHmZVjgK0IzD5upw530qTqAkPsw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lep4UOUkCZbW2wpIGYJJ0U?= =?utf-8?q?lhl2hS6NLm3McgA4JhS5wDXpu4UkmKX3i7LVrAaZad8/4GsPRhYpu1/5JtKX4ZGl5?= =?utf-8?q?YQw9irFYhA5LYIaBuH72lQsDb6NF+CyN/OwRf5+yBEW/s2k5a+onTRwgBPu5VD8PP?= =?utf-8?q?gkdBtrriutTBzZkuT5wH3cKqtm6SxHWeUldln5NCUs2cx3R4aX/Z8l3TM7pEy44cB?= =?utf-8?q?CFrJVllwMPFNKWVoDvhUKGJtOEOUkKJXcH0nyTDAbxtiRIuLIOh31Pm8D6pTFJUb0?= =?utf-8?q?yipRSC7I0HT648nJNuTHIzkRDS+hNGTFmTw89t+c/E7dPo7iT97oETpGObhIJpNpd?= =?utf-8?q?QZZGrRQkeCKj5tJdSnR+pyntEOBKF0OzSJ8NecV+0Y3qtKjYOVIZ4smkJupUUTOo5?= =?utf-8?q?kXtkLappR7FSjqPfyLmrocRXE1Tc4RZ5sESIpTgQRvTXQeViRMSIr1AxIjZcgWpJA?= =?utf-8?q?LZRjt+1+Q3frBzaHDGQrFCDBme7B/ET9Zefd58swwaCo9pAFKz1vhUSQrM7TKrnbR?= =?utf-8?q?Ubc+v5rvMI5mALVXRmgYx7GxFYVMmgrvrSYJ+/pEbFx1ZA0FXfwJCunLIS1kIf8FS?= =?utf-8?q?azrZDQEWW37gaq67sx0PuCpSXvOBXq+5q1O7NKQl/DIfER61Acaz7pc=3D?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1486d1e9-6050-4246-0475-08d9f85170bc X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5657.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2022 11:24:51.8451 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tXiYJhqspmp0srUILO1L9mn5mND768RdzNQDk4ruklTqdL7WtkdjmSdlSwit5aAgHCl5zQuSQRq3PZlRyduSGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1428 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller wfx_bh_request_tx() send HIF request asynchronously through bh_work(). Then the caller will run wfx_bh_poll_irq() to poll the answer. However it useless to burn CPU cycles for the polling while the request has yet been sent. Worse, wfx_bh_poll_irq() may get the CPU and prevent wfx_bh_request_tx() to run. This problem has been observed on mono core architecture. This first exchange is correct: kworker/u2:1-24 [000] .... : io_read32: CONTROL: 00003000 kworker/u2:1-24 [000] .... : io_read32: CONTROL: 00003000 kworker/u2:1-24 [000] .... : io_read32: CONTROL: 00003004 kworker/u2:1-24 [000] .... : io_read32: CONTROL: 00003004 kworker/0:1H-40 [000] .... : io_read: QUEUE: 08 00 09 0c 00 00 00 00 3a 7b 00 30 (12 bytes) kworker/0:1H-40 [000] .... : piggyback: CONTROL: 00003000 kworker/0:1H-40 [000] .... : hif_recv: 0:2:CNF_CONFIGURATION: 00 00 00 00 (8 bytes) kworker/0:1H-40 [000] .... : io_read32: CONFIG: 03010200 kworker/0:1H-40 [000] .... : bh_stats: IND/REQ/CNF: 0/ 0/ 1, REQ in progress: 0, WUP: release ... while the following is not: kworker/u2:1-24 [000] .... : io_read32: CONTROL: 00003000 kworker/u2:1-24 [000] .... : io_read32: CONTROL: 00003000 kworker/u2:1-24 [000] .... : io_read32: CONTROL: 00003000 [...loop until timeout...] wfx-sdio mmc0:0001:1: time out while polling control register Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/bh.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c index 4c6ba9c342a6..bcea9d5b119c 100644 --- a/drivers/staging/wfx/bh.c +++ b/drivers/staging/wfx/bh.c @@ -295,6 +295,7 @@ void wfx_bh_poll_irq(struct wfx_dev *wdev) u32 reg; WARN(!wdev->poll_irq, "unexpected IRQ polling can mask IRQ"); + flush_workqueue(system_highpri_wq); start = ktime_get(); for (;;) { wfx_control_reg_read(wdev, ®);