From: Jiajia Liu <liujiajia@kylinos.cn>
To: "Korenblit, Miriam Rachel" <miriam.rachel.korenblit@intel.com>
Cc: "Berg, Benjamin" <benjamin.berg@intel.com>,
"Berg, Johannes" <johannes.berg@intel.com>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] wifi: iwlwifi: use unique thermal zone type
Date: Wed, 15 Jul 2026 09:31:40 +0800 [thread overview]
Message-ID: <albi_EA_RuiEQ8kK@nature> (raw)
In-Reply-To: <DS0PR11MB7880D6838D23BBE2A821FF1BA3F92@DS0PR11MB7880.namprd11.prod.outlook.com>
On Tue, Jul 14, 2026 at 06:58:40PM +0000, Korenblit, Miriam Rachel wrote:
>
>
> > -----Original Message-----
> > From: Jiajia Liu <liujiajia@kylinos.cn>
> > Sent: Thursday, March 12, 2026 3:41 AM
> > To: Korenblit, Miriam Rachel <miriam.rachel.korenblit@intel.com>; Berg,
> > Benjamin <benjamin.berg@intel.com>; Berg, Johannes
> > <johannes.berg@intel.com>; linux-wireless@vger.kernel.org; linux-
> > kernel@vger.kernel.org
> > Cc: Jiajia Liu <liujiajia@kylinos.cn>
> > Subject: [PATCH] wifi: iwlwifi: use unique thermal zone type
> >
> > Unloading iwlmld or iwlmvm can trigger hung task when two devices using
> > iwlmvm and iwlmld respectively on one setup. Their thermal zones have the
> > same type and share the same hwmon device created by the first zone. The
> > second zone indirectly holds the first zone through hwmon and prevents the first
> > zone from unregistering.
> > Tested with AX211 (8086:7af0) and BE200 (8086:272b).
> >
> > INFO: task modprobe:5295 blocked for more than 120 seconds.
> > Not tainted 7.0.0-rc2-up1 #2
> > Call Trace:
> > __schedule+0x4df/0xfd0
> > schedule+0x27/0xd0
> > schedule_timeout+0xbd/0x100
> > __wait_for_common+0x97/0x1b0
> > ? __pfx_schedule_timeout+0x10/0x10
> > thermal_zone_device_unregister+0x173/0x1c0
> > iwl_mld_thermal_exit+0xbb/0xd0 [iwlmld]
> > iwl_op_mode_mld_stop+0x37/0x120 [iwlmld]
> > iwl_opmode_deregister+0xc0/0x160 [iwlwifi]
> > __do_sys_delete_module+0x1b5/0x320
> >
> > Signed-off-by: Jiajia Liu <liujiajia@kylinos.cn>
> > ---
> > drivers/net/wireless/intel/iwlwifi/iwl-utils.c | 10 ++++++++++
> > drivers/net/wireless/intel/iwlwifi/iwl-utils.h | 4 ++++
> > drivers/net/wireless/intel/iwlwifi/mld/thermal.c | 4 ++--
> > drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 6 ++++--
> > 4 files changed, 20 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-utils.c
> > b/drivers/net/wireless/intel/iwlwifi/iwl-utils.c
> > index d503544fda40..fe5fa5e59664 100644
> > --- a/drivers/net/wireless/intel/iwlwifi/iwl-utils.c
> > +++ b/drivers/net/wireless/intel/iwlwifi/iwl-utils.c
> > @@ -193,3 +193,13 @@ s8 iwl_average_neg_dbm(const u8 *neg_dbm_values,
> > u8 len)
> > return clamp(average_magnitude - i, -128, 0); }
> > IWL_EXPORT_SYMBOL(iwl_average_neg_dbm);
> > +
> > +#ifdef CONFIG_THERMAL
> > +u8 iwl_thermal_zone_get_id(void)
> > +{
> > + static atomic_t counter = ATOMIC_INIT(0);
> > +
> > + return atomic_inc_return(&counter) & 0xFF; }
> > +IWL_EXPORT_SYMBOL(iwl_thermal_zone_get_id);
> > +#endif
> > diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-utils.h
> > b/drivers/net/wireless/intel/iwlwifi/iwl-utils.h
> > index 5172035e4d26..84a4543fd290 100644
> > --- a/drivers/net/wireless/intel/iwlwifi/iwl-utils.h
> > +++ b/drivers/net/wireless/intel/iwlwifi/iwl-utils.h
> > @@ -55,4 +55,8 @@ u32 iwl_find_ie_offset(u8 *beacon, u8 eid, u32 frame_size)
> >
> > s8 iwl_average_neg_dbm(const u8 *neg_dbm_values, u8 len);
> >
> > +#ifdef CONFIG_THERMAL
> > +u8 iwl_thermal_zone_get_id(void);
> > +#endif
> > +
> > #endif /* __iwl_utils_h__ */
> > diff --git a/drivers/net/wireless/intel/iwlwifi/mld/thermal.c
> > b/drivers/net/wireless/intel/iwlwifi/mld/thermal.c
> > index f8a8c35066be..500028a4dbd3 100644
> > --- a/drivers/net/wireless/intel/iwlwifi/mld/thermal.c
> > +++ b/drivers/net/wireless/intel/iwlwifi/mld/thermal.c
> > @@ -5,6 +5,7 @@
> > #ifdef CONFIG_THERMAL
> > #include <linux/sort.h>
> > #include <linux/thermal.h>
> > +#include "iwl-utils.h"
> > #endif
> >
> > #include "fw/api/phy.h"
> > @@ -243,7 +244,6 @@ static void iwl_mld_thermal_zone_register(struct
> > iwl_mld *mld) {
> > int ret;
> > char name[16];
> > - static atomic_t counter = ATOMIC_INIT(0);
> > struct thermal_trip trips[IWL_MAX_DTS_TRIPS] = {
> > [0 ... IWL_MAX_DTS_TRIPS - 1] = {
> > .temperature = THERMAL_TEMP_INVALID, @@ -254,7
> > +254,7 @@ static void iwl_mld_thermal_zone_register(struct iwl_mld *mld)
> >
> > BUILD_BUG_ON(ARRAY_SIZE(name) >= THERMAL_NAME_LENGTH);
> >
> > - sprintf(name, "iwlwifi_%u", atomic_inc_return(&counter) & 0xFF);
> Any reason not to have iwlmld (and iwlmvm in mvm) instead of a shared counter?
I was not sure if it would break user space.
This issue is fixed by thermal hwmon at
https://lore.kernel.org/linux-pm/6017595.DvuYhMxLoT@rafael.j.wysocki/
with commit d6323469bcfb ("thermal: hwmon: Register a hwmon device for each thermal zone") in v7.2-rc1.
>
> > + sprintf(name, "iwlwifi_%u", iwl_thermal_zone_get_id());
> > mld->tzone =
> > thermal_zone_device_register_with_trips(name, trips,
> > IWL_MAX_DTS_TRIPS,
> > diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
> > b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
> > index 53bab21ebae2..ea8e616174db 100644
> > --- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
> > +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
> > @@ -7,6 +7,9 @@
> > #include <linux/sort.h>
> >
> > #include "mvm.h"
> > +#ifdef CONFIG_THERMAL
> > +#include "iwl-utils.h"
> > +#endif
> >
> > #define IWL_MVM_NUM_CTDP_STEPS 20
> > #define IWL_MVM_MIN_CTDP_BUDGET_MW 150
> > @@ -652,7 +655,6 @@ static void iwl_mvm_thermal_zone_register(struct
> > iwl_mvm *mvm) {
> > int i, ret;
> > char name[16];
> > - static atomic_t counter = ATOMIC_INIT(0);
> >
> > if (!iwl_mvm_is_tt_in_fw(mvm)) {
> > mvm->tz_device.tzone = NULL;
> > @@ -662,7 +664,7 @@ static void iwl_mvm_thermal_zone_register(struct
> > iwl_mvm *mvm)
> >
> > BUILD_BUG_ON(ARRAY_SIZE(name) >= THERMAL_NAME_LENGTH);
> >
> > - sprintf(name, "iwlwifi_%u", atomic_inc_return(&counter) & 0xFF);
> > + sprintf(name, "iwlwifi_%u", iwl_thermal_zone_get_id());
> > /*
> > * 0 is a valid temperature,
> > * so initialize the array with S16_MIN which invalid temperature
> > --
> > 2.53.0
>
prev parent reply other threads:[~2026-07-15 1:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-12 1:40 Jiajia Liu
2026-07-14 18:58 ` Korenblit, Miriam Rachel
2026-07-15 1:31 ` Jiajia Liu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=albi_EA_RuiEQ8kK@nature \
--to=liujiajia@kylinos.cn \
--cc=benjamin.berg@intel.com \
--cc=johannes.berg@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=miriam.rachel.korenblit@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome