From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 DD5EC3F86ED for ; Mon, 18 May 2026 11:55:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779105341; cv=none; b=RxnayF8TbqUlcjlQYsaHFxC991aSattA/kEwmZN16st0QFvFByL1NQ+JQIFIxdoXiSI6ZMiqr3rTeB7zSlSjMG6kT6DToTf+/xHh+lSYWqsr4DR4jTVeIuYS22xucRgcxNmL4it+mUmYM2rjX4iocNtLdRAn7ewzmMAJe8XFAWw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779105341; c=relaxed/simple; bh=RdMb05f8g6qUnk2QWuCC2x0h1RsjtSC/GCFb+mBaJ9k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EkuhaTjU4gXHpDtUICVrRx58qL4oPiign+0tY0kg+QXoZ1b9wBvoe+AkaJtmcEJ8WZ7v/ePk2J0Tm2oEbLCcFbbvsNucyYY6vDh6MyduxcFGxHAHpkQALD+vjauxsCybcolbgFCdj3lFPkU2gR24aj1PBeXpWcscGKdwqBA7/1A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=kIb/S9Uc; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="kIb/S9Uc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1779105339; x=1810641339; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RdMb05f8g6qUnk2QWuCC2x0h1RsjtSC/GCFb+mBaJ9k=; b=kIb/S9UcMp1C78vO1oUpGp7doB9BWMoAPSOzadJp8zWkgMlDjFzRvcOe CN3QyoRKbJjZczjxsZ7iOmdirKuKmuHZLguKDak1NsoGfx7zHpWOproKV 04I2TIcx/E3qUL29nMrSIvWwFKZZv7/Z7noT7FBPNrxiMmOEi6cA/chht qkB5kwViI/e8Rn2RGDlXU3IkmzIQrtsl5vwbIwdpdgWEB1+6r+prlyQSJ kI50g41CGAoHRv0G++UaCKO9jW4zrMgNRuKz13wasor9dSIDOA0OTwzXs sywxW1IweNKsTmq9XmhAt0Fd2NzM1SeT8oL3X54RGkvCs/CiR8vmWxZat g==; X-CSE-ConnectionGUID: LiDuUYfER5iVWDD2KalEIQ== X-CSE-MsgGUID: xcs7w51ZRqW0h2Ky3bnwZw== X-IronPort-AV: E=McAfee;i="6800,10657,11789"; a="91347033" X-IronPort-AV: E=Sophos;i="6.23,241,1770624000"; d="scan'208";a="91347033" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 04:55:38 -0700 X-CSE-ConnectionGUID: vcQ/X60GRLSRbhWc3FVr/g== X-CSE-MsgGUID: EPyR1eKkTaGUxJllwyj+dg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,241,1770624000"; d="scan'208";a="239663398" Received: from egrumbac-mobl6.ger.corp.intel.com (HELO ahunter6-desk) ([10.245.245.220]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 04:55:37 -0700 From: Adrian Hunter To: alexandre.belloni@bootlin.com Cc: Frank.Li@nxp.com, david.nystrom@est.tech, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 1/8] i3c: master: Make hot-join workqueue freezable to block hot-join during suspend Date: Mon, 18 May 2026 14:55:12 +0300 Message-ID: <20260518115520.98335-2-adrian.hunter@intel.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260518115520.98335-1-adrian.hunter@intel.com> References: <20260518115520.98335-1-adrian.hunter@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Content-Transfer-Encoding: 8bit The I3C master workqueue (master->wq) is used to defer work that needs thread context and the bus maintenance lock, most notably Hot Join processing (which calls i3c_master_do_daa() to assign dynamic addresses to newly joined devices). Currently the workqueue keeps running across system suspend, which can race with the suspend path: - do_daa() may execute after the controller has been suspended, issuing bus transactions on a powered-down or otherwise unusable controller. - New I3C devices can be enumerated and added to the bus mid-suspend, registering driver model objects at a point where the I3C subsystem and its consumers are not prepared to handle them. Mark the workqueue WQ_FREEZABLE so its workers are frozen for the duration of system suspend/hibernate and resumed afterwards. This naturally defers any pending or newly queued Hot Join work until the system (and the controller) is fully resumed, closing both races without adding explicit suspend/resume synchronization in the master drivers. Update the kerneldoc for struct i3c_master_controller::wq to reflect that the workqueue is freezable. Fixes: 3a379bbcea0af ("i3c: Add core I3C infrastructure") Signed-off-by: Adrian Hunter Reviewed-by: Frank Li --- Changes in V2: Add Fixes tag Add Frank's Rev'd by drivers/i3c/master.c | 2 +- include/linux/i3c/master.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 5cd4e5da2233..ab11e2d79aab 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -3079,7 +3079,7 @@ int i3c_master_register(struct i3c_master_controller *master, if (ret) goto err_put_dev; - master->wq = alloc_workqueue("%s", WQ_PERCPU, 0, dev_name(parent)); + master->wq = alloc_workqueue("%s", WQ_PERCPU | WQ_FREEZABLE, 0, dev_name(parent)); if (!master->wq) { ret = -ENOMEM; goto err_put_dev; diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h index 592b646f6134..e6112e5f6608 100644 --- a/include/linux/i3c/master.h +++ b/include/linux/i3c/master.h @@ -515,7 +515,7 @@ struct i3c_master_controller_ops { * @boardinfo.i2c: list of I2C boardinfo objects * @boardinfo: board-level information attached to devices connected on the bus * @bus: I3C bus exposed by this master - * @wq: workqueue which can be used by master + * @wq: freezable workqueue which can be used by master * drivers if they need to postpone operations that need to take place * in a thread context. Typical examples are Hot Join processing which * requires taking the bus lock in maintenance, which in turn, can only -- 2.51.0