Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3529188ioo; Mon, 30 May 2022 04:16:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLqLnvIFU770PQ+xcOyzGvqdC5rekjcBA0pygjCnSfZ9meFJ7pWqRL4kNacdftt9nciv0V X-Received: by 2002:a17:907:1c0e:b0:6ff:c46:c310 with SMTP id nc14-20020a1709071c0e00b006ff0c46c310mr22778439ejc.610.1653909403916; Mon, 30 May 2022 04:16:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653909403; cv=none; d=google.com; s=arc-20160816; b=Noz2CA9tnHvKg8tLoupUHx6lPKVHrDODSULrRtH2r7aVNV9JbBgntVupMyJtvcmGjK QsOPnMyrD5gvfEf2tpQSqq+PO/AoY+Zj8Zw6AOtA/PIlkiG4LRNB7ABxH9yrxvn3ft6C NlIYABISpKJf8ziuU7s0i+LuwqCRTaDOoHbU9RpGUu2KYmaZLIzOw0PFhh9fmwG4umZV ih+cVWdcC03WHEtB0FFOz86Yv8I0OO4B0I5pQ5+6nqO9kGsG2KN5wZh5vbe4ACc59gw1 ggdrXRwN70cRpHaeeIn2JPwDZgmHg6V1pD9I8e7aYtn2kZD8Uh7x0Qp+sVtATry8jnBw g9Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=fJP9Taq6/hvom0srRJtoM8C8v16kUJCBlP7GL2PsyUM=; b=H/MzOxb/kpAcBBEBVfYmHBnqZaKD+IJGqZ/mYSetBUgvWV3pdazgEW7zD0wANu3vRa l7HmDQfy1+qd0pY+uaN2OX8nJ5dyzL4T/w0bHFLYHL3hBy0nrHxNgHGvesrZeC29Z0Yk jhhRgGpKufyXt6V/EiBZeRXhC1lAcLlCtLzQ5K9luSefZDSdr933SYqqAEXzbReKwyEm Hf2L635r88Il4TqsQ8diWPb6FZhMMssIJ+YSe/iBoPA9lBdX4ULg2LhGzSIwfUheRRAu 6cdS3mfmW+2+dPoPBzo9esaXxGKrf5lzOajdRgMH3ScHrYGXcVc6T+Qr1S0Mf0gWgW/o 9D7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jx24-20020a170906ca5800b006f43b684908si10209987ejb.31.2022.05.30.04.16.26; Mon, 30 May 2022 04:16:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235181AbiE3KQp (ORCPT + 67 others); Mon, 30 May 2022 06:16:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234721AbiE3KQo (ORCPT ); Mon, 30 May 2022 06:16:44 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 660DEBE17 for ; Mon, 30 May 2022 03:16:43 -0700 (PDT) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nvcRv-0003fA-BD; Mon, 30 May 2022 12:16:35 +0200 Received: from sha by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1nvcRu-0001E5-MC; Mon, 30 May 2022 12:16:34 +0200 Date: Mon, 30 May 2022 12:16:34 +0200 From: Sascha Hauer To: Kalle Valo Cc: Ping-Ke Shih , Hans Ulli Kroll , Martin Blumenstingl , netdev@vger.kernel.org, linux-wireless@vger.kernel.org, Yan-Hsuan Chuang , linux-kernel@vger.kernel.org, Neo Jou , kernel@pengutronix.de, Johannes Berg Subject: Re: [PATCH 00/10] RTW88: Add support for USB variants Message-ID: <20220530101634.GJ1615@pengutronix.de> References: <20220518082318.3898514-1-s.hauer@pengutronix.de> <87fskrv0cm.fsf@kernel.org> <20220530095232.GI1615@pengutronix.de> <87a6azpc4i.fsf@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87a6azpc4i.fsf@kernel.org> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Mon, May 30, 2022 at 01:07:25PM +0300, Kalle Valo wrote: > Sascha Hauer writes: > > > On Mon, May 30, 2022 at 12:25:13PM +0300, Kalle Valo wrote: > >> Sascha Hauer writes: > >> > >> > Another problem to address is that the driver uses > >> > ieee80211_iterate_stations_atomic() and > >> > ieee80211_iterate_active_interfaces_atomic() and does register accesses > >> > in the iterator. This doesn't work with USB, so iteration is done in two > >> > steps now: The ieee80211_iterate_*_atomic() functions are only used to > >> > collect the stations/interfaces on a list which is then iterated over > >> > non-atomically in the second step. The implementation for this is > >> > basically the one suggested by Ping-Ke here: > >> > > >> > https://lore.kernel.org/lkml/423f474e15c948eda4db5bc9a50fd391@realtek.com/ > >> > >> Isn't this racy? What guarantees that vifs are not deleted after > >> ieee80211_iterate_active_interfaces_atomic() call? > > > > The driver mutex &rtwdev->mutex is acquired during the whole > > collection/iteration process. For deleting an interface > > ieee80211_ops::remove_interface would have to be called, right? > > That would acquire &rtwdev->mutex as well, so I think this should be > > safe. > > Can you add a comment to the code explaining this? Sure. > And > lockdep_assert_held() is a good way to guarantee that the mutex is > really held. Yes, Ping-Ke already pointed that out. Will add in the next round. Sascha -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |