From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 DDD8734F24A for ; Tue, 12 May 2026 12:17:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778588269; cv=none; b=qahRqnNAu6x/vJaVqVWrCPN6G5N2X2JjHyRQUUnr0hIdbGJ2mITbONrLpJxoJP71zQ/idvO6wZhhLLdcu+DOvSHuXX/MSxnndsWPVNCoZiiNBdD1dNbZa6/3UlDunyQzPoImQSl9SmTSFCjmvCztoG93cg62kh6VTq42+cZJHJ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778588269; c=relaxed/simple; bh=8Nu3OZDOmbKNKiTWVhoCSpKDi6flE6D28VO36QUz+ro=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WF8ea4vPgmxrTN2WYL7CYoJf3G4tpkwwUPYLG5Wks2gqXsAYn+Bl7+lGu0tDI+HftuFyF1bAesIqPRNMzKtHmG67eB2EXIK+3lRD2VI0E5F6GwOfU3lZd6Qw+o4gjWrQgzat6PLVdnrPU0rTv6rnkXGLvCLqHtpVL5XQaQ9qrm8= 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=Vx9NwDNw; arc=none smtp.client-ip=198.175.65.21 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="Vx9NwDNw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778588268; x=1810124268; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8Nu3OZDOmbKNKiTWVhoCSpKDi6flE6D28VO36QUz+ro=; b=Vx9NwDNwv5MeiUlvP/q/UUVHpQrzy+BEQ6KLE/VAHTZv2FPljC7qs3+3 dHVs0m/WSUkS9HkCwM41e/F3rYiRyWzrtMn2GgJ+0jaDFKzNC47TUK12w U6m/iEJJ+diAgwbvJx1jhdxylEOs9aYPXNe6am5qwJSxJvS1Cly99rubP 6GCWKLHG4YeuJuRLWdBIjIHiHi/yLzbM206YPNq7dyefBlPjFOf7n7OU1 C8TVUrO/wFVUAPsN2+VIE76wzWUghkUE8F/sdQZgYqnimtv1QX3Ml0MOy T7JfKcPVmayLA7QpxINqdLhMaMY9MjfzGtwd1D6N3v0oGH08rmyR8UJFb Q==; X-CSE-ConnectionGUID: 0AuGTd+tRPG8sYXKfKeQ5A== X-CSE-MsgGUID: ih80do2URkaaHZhQ8DeQXQ== X-IronPort-AV: E=McAfee;i="6800,10657,11783"; a="79389481" X-IronPort-AV: E=Sophos;i="6.23,230,1770624000"; d="scan'208";a="79389481" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2026 05:17:48 -0700 X-CSE-ConnectionGUID: 0t/VBKKHSkeoGg8Wf7LuTQ== X-CSE-MsgGUID: nJWyVGpGTpmiAlqcyxH6Jw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,230,1770624000"; d="scan'208";a="241756124" Received: from amilburn-desk.amilburn-desk (HELO ahunter6-desk) ([10.245.245.121]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2026 05:17:46 -0700 From: Adrian Hunter To: alexandre.belloni@bootlin.com Cc: Frank.Li@nxp.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/8] i3c: master: Make hot-join workqueue freezable to block hot-join during suspend Date: Tue, 12 May 2026 15:17:25 +0300 Message-ID: <20260512121732.406009-2-adrian.hunter@intel.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260512121732.406009-1-adrian.hunter@intel.com> References: <20260512121732.406009-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. Signed-off-by: Adrian Hunter --- 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