Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2523155lqb; Tue, 28 May 2024 02:32:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU8VoUNsWWqJrjKkyMDmJbLhctcLWVcgh5wDcXmHZ66WEmroDuKZOe+Hg9NM38gHzOex7yF/XpWrQiBmoZLVCIXHjnpyBh+ctivvHNFHQ== X-Google-Smtp-Source: AGHT+IE7kja0fn7hh2aHBbZb7wELAFRxJz5Hx62dcH+/CJeauTdxxXk7feX9bEvFXTzvVG7sSxeK X-Received: by 2002:a05:6a21:789c:b0:1af:86da:3f7 with SMTP id adf61e73a8af0-1b212ced305mr14397000637.4.1716888754779; Tue, 28 May 2024 02:32:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716888754; cv=pass; d=google.com; s=arc-20160816; b=vCzUhuu8gYXhO6QHn1iW/pnWF/CiECaskOUu6FIUInnQU1/ZsjLv3FccBRmPHHpj8m kBSyqOj6cBAu7fawSmWqcoLwD0bBWQ4J82+CwmuYaBbROMRvdE9yjlOe0oA+ykG7WNdt LcWPozz8V6loPKeRmkTijmGMDROgoRrYVljSMbMUEIV82UgG1NDMPtwTsR7Ct3n2dZGD Rb0rBjiKSbVEi8/Mt7VIVdtQFjvvOyqFs4K70xIPGSQsu9FfGU13wlOQtOuDln7s4Jm/ gOlA4L0ENR6IqujMC33IkBOhrEbX7d/OTIKS4o9T+ERo7eZuO8yYSb/R61G0VyC30oct LX9Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=1MkSEDJwrWNIPR0bchm1t68CwLKFDFfr/6JApuMvURM=; fh=59TbtjdH/fkFo7hkO1mFMrBITxmjA6TtBfMnav9UYLE=; b=R25u7rrBCO/ZbTg7/9Fq3XbVpZZfeELl6V/N6fFRQ583ioEJPijfIGqrEQBkYCPLhA e1mm4UAZcDag7ZGz565OFt6vFbJ4UCydgp8OeE7qqsKy0c5DTFiijz1zOzBsO7w7qJpK TdBFYrqzYJLWg4rk8anP4leNwsi4daB48eRqzE2xq9bqvixeJjuiiT2lgmHT7fFrHk5I 6B81DOozyVsmOhhaR0YPIsdDVnoSkgmDqSFExshBIit/EAuHXzOG+ta8f5x3hrUfU8Yy 9pOREENJwpQegPwSKo+z6jhMnRyNrpvWuZIkuWDiyHza3OK2qiFqvLEXHyr4jJVgAHHR Hkig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=fc3tSgkx; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-wireless+bounces-8182-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8182-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f8fc36e607si7674169b3a.94.2024.05.28.02.32.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 02:32:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-8182-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=fc3tSgkx; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-wireless+bounces-8182-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8182-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E9895B23302 for ; Tue, 28 May 2024 09:31:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 72E42158A0F; Tue, 28 May 2024 09:31:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="fc3tSgkx" X-Original-To: linux-wireless@vger.kernel.org Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BCB0515885F for ; Tue, 28 May 2024 09:31:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716888681; cv=none; b=cnr9VTEHQeiqueLgXdg30A1o77PJKRNQdA4sV60N64AGOTDAXb2Z9yjAn8yRmqIIVvUKTHk+YRqyc8HfiGfgz08NSs8dvk/a6wzQbG/gaOqMqrSDPUAQwx0CvaF2ghIKJ3GgG/6eEyhgeBUliaugG27UA8rvxrbzRH+kK/f61n0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716888681; c=relaxed/simple; bh=jfFX90uZOymu9T8b0XnhNHmoMFCMd1+uiHn8SXAv3+c=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=BSzgCATX0SEbhRQFzl7DdwlKxBru4h1LkNN5EB8gZvH+xBRo5uQbZ35jvLlAqYCBUP6CYWi0MCCNk8Yes+eV1FC8GNdL1fRG+0PaS6jL7B7qM/1EpnRHeDIjkgR5J9efhlrclgeY5bTdj67d1IjSMkSd+UA1s1LHL3XRihJrH74= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=fc3tSgkx; arc=none smtp.client-ip=217.70.183.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 98484C000C; Tue, 28 May 2024 09:31:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1716888676; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1MkSEDJwrWNIPR0bchm1t68CwLKFDFfr/6JApuMvURM=; b=fc3tSgkxInE+1aS3Bl7WGkHvPjXSRPg4LrNbrrr+vmxItszOJ0/i4VIPZjkXmgKS1zpdO1 piqS71ZMoGizJFriwZ46VsJhEW/WRXqg0J8FZ8XB+Y6KTmGn4kYWjVF4AIJ6+7ssiCB3ra eSOhYYHNQagTWgtXFjMgPofFcLT0tU+w6x6Kp2CSEs6ILuMURWnUhvQ54ie7234dqJ2baW Gvhnlm7zL594KAxqueCjkW/4hMcNZW0IQ6/Zx85P/OokE1Fde8lpjvF7Ifena+12ykr9hY iBT8QhaNdv18rS8GpLzhlm4H4K+6LhhUGGAQH/EmLOwVxwcQpmKlNoXxyE/Dkw== Message-ID: <0a9c592d-7db3-454e-a83f-901b1865b414@bootlin.com> Date: Tue, 28 May 2024 11:31:16 +0200 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [bug report] wifi: wilc1000: convert list management to RCU To: Dan Carpenter Cc: linux-wireless@vger.kernel.org, Kalle Valo , "Ajay.Kathat" , Thomas Petazzoni References: <3b46ec7c-baee-49fd-b760-3bc12fb12eaf@moroto.mountain> Content-Language: en-US From: =?UTF-8?Q?Alexis_Lothor=C3=A9?= In-Reply-To: <3b46ec7c-baee-49fd-b760-3bc12fb12eaf@moroto.mountain> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-GND-Sasl: alexis.lothore@bootlin.com Hello, On 5/9/24 15:24, Dan Carpenter wrote: > Hello Alexis Lothoré, > > Commit f236464f1db7 ("wifi: wilc1000: convert list management to > RCU") from Apr 10, 2024 (linux-next), leads to the following Smatch > static checker warning: > > drivers/net/wireless/microchip/wilc1000/mon.c:236 wilc_wfi_init_mon_interface() > warn: sleeping in atomic context My bad for the extensive delay to fix this. I have been in fact scratching my head quite a lot around it. Adding Kalle and Ajay to keep them updated, and possibly to get opinions. This issue is indeed due to my recent series converting back SRCU to RCU in wilc driver (submitted because at this time, there was no obvious reason nor documentation about why SRCU was needed). By checking further the consequence, I find in fact three issues, and I suspect those to be the original reason for SRCU usage in the driver instead of classical RCU. All of them are reproducible with runtime checkers enabled regarding RCU and sleeps in atomic sections, either by triggering some heavy traffic for the first one, or raising an access points for the two others: - one issue is in wilc_wfi_init_mon_interface (the initial warning raised by Dan). This one: - parses the vif list (under RCU) to perform some checks, possibly canceling the interface registration - then registers the monitoring interface (has sleeping calls, especially a register_netdevice call) - then if registration is successful, updates appropriate vif to flag it as monitoring interface (then leave RCU section) I have a hotfix for this, but not a very satisfying one, which consists in splitting the RCU section into two (first and third points), but additionally using the vif list lock to make sure vif list has not been altered in-between. IMHO this kind of fix just make things worse in the driver, just to tame RCU. - one issue is in wilc_wlan_txq_filter_dup_tcp_ack (the second warning raised by Dan), which calls wait_for_completion_timeout while being in RCU critical read. The issue can be properly fixed by just counting the number of packets to be dropped inside the critical section, then effectively applying the multiple wait_for_completion_timeout _after_ the RCU section. - finally, there is an issue in set_channel ops (cfg80211.c), which fetches the first vif (under RCU), and then uses this vif to send appropriate channel configuration command (which sleeps at some point). Since used vif here comes from the vif list, I don't think it is safe to leave earlier RCU section (vif pointer needs to remain valid until command is sent to chip). Because of the second point which would bring a not-so-clean fix, and the third one for which I still don't have a proper fix, I am considering to submit a revert for my RCU conversion series, to come back to SRCU. I don´t know if those issues do or do not make SRCU usage more legitimate, but at least I feel like really fixing it need slightly larger rework. I will still search for better options, but if I do not find any, I will submit the revert. Thanks, Alexis -- Alexis Lothoré, Bootlin Embedded Linux and Kernel engineering https://bootlin.com