From nobody Fri Apr 11 21:26:22 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4ZZ8rH2j0xz5shtv; Fri, 11 Apr 2025 21:26:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZZ8rH1L2Pz3tQy; Fri, 11 Apr 2025 21:26:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1744406783; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YTO9YJh1CuWOjMzr9x4ykWX9XiegV4+emcw4j19ltKc=; b=fP50qAQZyKYnCJKUVHx0gp8G/jHJQr1/oz4m1BFVvq3hLS/9YRFN48822mz0cdDSCQZLu1 9kdrMdbZQJy3jm5t4VhBykrn3iI4CNXbFUHZRi6P/9989FSpL1+vmvF8TzHRLv/ACneKM7 Y4XmKtPUJDNPu6dFBEReKCVvbxqzKPuNuIqlAbzfJ/6fCfCdduQx2Coa7Vi4RIzkQHUyLq FMMP91LFhFeep1gjMr3J4iXiFhnvFcRj1LlL3VthMn44IZGyiMyJbxzPuvtIUZyX/apeBI WAmmSJ+zFAvUy4CWBtgLzkM2R/aD/bDAKWqG7wTBD7ZBD2Zovh2qjOTI3pqrTA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1744406783; a=rsa-sha256; cv=none; b=iEH3erg96SqQ0tpF4egMWsQcYhoNH9f0LX1zTQ2fVdLaSprnqbDFvhd1ClXQuOXn+GVyiB HTR9zPbKZtSO3szbGG7HhTAS2O8ruDXsyYYyP4yOM0mcS+tkpngIfCGHrsX8pq7+4Q06fP eszZfPniygN6IYNCXuHV1E0rbKvFHjwTgZDrDK8OBQo0U9rDdS0RTxHawmiF5wwFJNyfXe yfYM8pyAQQyhmkRk59u+HoUf+p24tk0igdtM4oB/rYcCNMEjRJu5LNCtp535PFH6haYe9O xpWqN+uqg5W9WCMoD3JUVbmMAqxk2hGUJgubrzlTS6fGz2HZFDuw7pgdQkbPiw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1744406783; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YTO9YJh1CuWOjMzr9x4ykWX9XiegV4+emcw4j19ltKc=; b=CAuUFSEyMTz58/n5SJoJQlMeJHgj2jZpI2Emd6uTDjiRe0mC93en08N8mlpIQG9tVNm8mW BjQVisaCBcxAx/PojHN1OVmMFc4cEOfhF/43azPOOOQONK22Svt6zg2usfb2BZI7LnOIvq Bms2luZd5gS/eZt1nXkTpJIeFA7ZGlfLS9hM65aHjUTHA4DXjdqBr1lAXa8XVcBLC999Jg r5ZzHUIOrAHaV/68Wx+IG1XJAgXReHC4wDBCpEh7M1o1a7nI5/iZkE6f4eePPPhnW0dm9R nCh0a3xtspdMkTbMNjDCnYar+ReulhG79V5AgKKeq5dHhuzYRj1OX9/5hTCzMg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4ZZ8rH0ShszqFN; Fri, 11 Apr 2025 21:26:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 53BLQNVv078308; Fri, 11 Apr 2025 21:26:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 53BLQMhI078305; Fri, 11 Apr 2025 21:26:22 GMT (envelope-from git) Date: Fri, 11 Apr 2025 21:26:22 GMT Message-Id: <202504112126.53BLQMhI078305@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 560708cbb046 - main - LinuxKPI: 802.11: adjust vif->bss_conf.chanctx_conf to rcu accessors List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 560708cbb0468bf1fd1834f4894a1326e88ff10e Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=560708cbb0468bf1fd1834f4894a1326e88ff10e commit 560708cbb0468bf1fd1834f4894a1326e88ff10e Author: Bjoern A. Zeeb AuthorDate: 2025-04-08 19:25:03 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-04-11 21:26:05 +0000 LinuxKPI: 802.11: adjust vif->bss_conf.chanctx_conf to rcu accessors Adjust the init and lkpi_sta_scan_to_auth() chanctx_conf accesses to use rcu functions as needed. linuxkpi_ieee80211_iterate_chan_contexts() which is ieee80211_iter_chan_contexts_atomic() needs further work to get rid of the vif locks by keeping all chanctx_conf on a list in lhw. This will be done in a follow-up commit. Sponsored by: The FreeBSD Foundation PR: 280546 MFC after: 3 days Tested by: Oleksandr Kryvulia (shuriku shurik.kiev.ua) Tested by: Oleg Nauman (oleg.nauman gmail.com) [rtw88] Differential Revision: https://reviews.freebsd.org/D49734 --- sys/compat/linuxkpi/common/src/linux_80211.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index b5da3282d249..891714fb75db 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -1845,8 +1845,9 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int wiphy_lock(hw->wiphy); /* Add chanctx (or if exists, change it). */ - if (vif->bss_conf.chanctx_conf != NULL) { - chanctx_conf = vif->bss_conf.chanctx_conf; + chanctx_conf = rcu_dereference_protected(vif->bss_conf.chanctx_conf, + lockdep_is_held(&hw->wiphy->mtx)); + if (chanctx_conf != NULL) { lchanctx = CHANCTX_CONF_TO_LCHANCTX(chanctx_conf); IMPROVE("diff changes for changed, working on live copy, rcu"); } else { @@ -1921,7 +1922,7 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int bss_changed |= lkpi_update_dtim_tsf(vif, ni, vap, __func__, __LINE__); error = 0; - if (vif->bss_conf.chanctx_conf != NULL) { + if (vif->bss_conf.chanctx_conf == chanctx_conf) { changed = IEEE80211_CHANCTX_CHANGE_MIN_WIDTH; changed |= IEEE80211_CHANCTX_CHANGE_RADAR; changed |= IEEE80211_CHANCTX_CHANGE_RX_CHAINS; @@ -1942,7 +1943,7 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int goto out; } - vif->bss_conf.chanctx_conf = chanctx_conf; + rcu_assign_pointer(vif->bss_conf.chanctx_conf, chanctx_conf); /* Assign vif chanctx. */ if (error == 0) @@ -1954,7 +1955,7 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int ic_printf(vap->iv_ic, "%s:%d: mo_assign_vif_chanctx " "failed: %d\n", __func__, __LINE__, error); lkpi_80211_mo_remove_chanctx(hw, chanctx_conf); - vif->bss_conf.chanctx_conf = NULL; + rcu_assign_pointer(vif->bss_conf.chanctx_conf, NULL); lchanctx = CHANCTX_CONF_TO_LCHANCTX(chanctx_conf); free(lchanctx, M_LKPI80211); goto out; @@ -3473,7 +3474,7 @@ lkpi_ic_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], /* XXX-BZ hardcoded for now! */ #if 1 - vif->bss_conf.chanctx_conf = NULL; + RCU_INIT_POINTER(vif->bss_conf.chanctx_conf, NULL); vif->bss_conf.vif = vif; /* vap->iv_myaddr is not set until net80211::vap_setup or vap_attach. */ IEEE80211_ADDR_COPY(vif->bss_conf.addr, mac); @@ -5969,7 +5970,7 @@ linuxkpi_ieee80211_iterate_chan_contexts(struct ieee80211_hw *hw, TAILQ_FOREACH(lvif, &lhw->lvif_head, lvif_entry) { vif = LVIF_TO_VIF(lvif); - if (vif->bss_conf.chanctx_conf == NULL) + if (vif->bss_conf.chanctx_conf == NULL) /* XXX-BZ; FIXME see IMPROVE above. */ continue; lchanctx = CHANCTX_CONF_TO_LCHANCTX(vif->bss_conf.chanctx_conf);