diff for duplicates of <20261023163717.040806106@linuxfoundation.org> diff --git a/a/1.txt b/N1/1.txt index 148afd7..005699f 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -1,64 +1,169 @@ -6.18-stable review patch. If anyone has any objections, please let me know. +7.2-stable review patch. If anyone has any objections, please let me know. ------------------ -From: Frank Sorenson <sorenson@redhat.com> +From: Abdurrahman Hussain <abdurrahman@nexthop.ai> -commit fe39cd9d48f2346605f3746e0cc19e89d5f373eb upstream. +commit d33373c565af9c8a28776af02bd20ba6e5724211 upstream. -If find_writable_file() returns null, cifs_file_flush will return -0 without issuing set_file_size, and the outer 'if (!rc)' block -will set i_size to 0 before telling the server to truncate. If -the cifs_open() then fails, the inode will have size 0, while -the server file is unchanged. +The devres conversion replaced manual pm_runtime_enable()/disable() with +devm_pm_runtime_set_active_enabled() and dropped the remove-time runtime +PM teardown. The managed release tears runtime PM down in the wrong +order: it calls pm_runtime_dont_use_autosuspend() before +pm_runtime_disable(), i.e. while runtime PM is still enabled, and devres +is LIFO so the devm_clk_get_enabled() release runs afterwards. -Move the netfs_resize_file() and cifs_setsize() into the 'if -(cfile)', so they only run after a successful set_file_size. +At remove(), pm_runtime_put_sync() leaves the device active with the +autosuspend timer armed. Clearing use_autosuspend then makes rpm_idle() +suspend immediately, and xiic_i2c_runtime_suspend() clk_disable()s the +clock. The later devm_clk_get_enabled() release clk_disable_unprepare()s +the already-disabled clock, so clk_core_disable() WARNs ("clkN already +disabled") on every teardown. -In the no-handle else branch, evict stale pages with -truncate_inode_pages before the O_TRUNC open to dispose of old -cache pages, and let the open response set the i_size. +Drop the managed helper and restore the non-managed runtime PM setup and +teardown, so runtime PM is enabled once in probe and disabled once in +remove and the clock enable count stays balanced. -Fixes: 110fee6b9bb5 ("smb: client: fix missing timestamp updates with O_TRUNC") -Cc: stable@vger.kernel.org -Signed-off-by: Frank Sorenson <sorenson@redhat.com> -Acked-by: David Howells <dhowells@redhat.com> -Signed-off-by: Paulo Alcantara <pc@manguebit.org> +Order the remove teardown so runtime PM is disabled before the usage +count is dropped: pm_runtime_disable() followed by pm_runtime_put_noidle() +instead of pm_runtime_put_sync(). Dropping the count first with autosuspend +still enabled arms the autosuspend timer, and a preemption before +pm_runtime_disable() lets it expire, suspend the device and clk_disable() +the clock, which the devm release then disables again - the same WARN. + +Restore the non-managed IRQ request as well. The probe error paths now +unwind runtime PM by hand via goto, and a devm-registered handler is only +freed later during devres unwind, so it would stay live across the manual +teardown (and across any future failing step added after it). Request the +IRQ with request_threaded_irq() and free it explicitly in the probe error +path and in remove. The probe error path also clears use_autosuspend, to +match the teardown in remove(). + +Fixes: 50c63491ff26 ("i2c: xiic: switch to devres managed APIs") +Signed-off-by: Abdurrahman Hussain <abdurrahman@nexthop.ai> +Cc: <stable@vger.kernel.org> # v7.1+ +Signed-off-by: Andi Shyti <andi.shyti@kernel.org> +Link: https://patch.msgid.link/20261014-i2c-xiic-restore-runtime-pm-teardown-v8-1-40668c270069@nexthop.ai Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- - fs/smb/client/file.c | 24 ++++++++++++++++++++---- - 1 file changed, 20 insertions(+), 4 deletions(-) + drivers/i2c/busses/i2c-xiic.c | 49 ++++++++++++++++++++++++++++------- + 1 file changed, 40 insertions(+), 9 deletions(-) ---- a/fs/smb/client/file.c -+++ b/fs/smb/client/file.c -@@ -1003,10 +1003,26 @@ static int cifs_do_truncate(const unsign - server = tcon->ses->server; - rc = server->ops->set_file_size(xid, tcon, - cfile, 0, false); -- } -- if (!rc) { -- netfs_resize_file(&cinode->netfs, 0, true); -- cifs_setsize(inode, 0); -+ if (!rc) { -+ inode_lock(inode); -+ filemap_invalidate_lock(inode->i_mapping); -+ netfs_resize_file(&cinode->netfs, 0, true); -+ cifs_setsize(inode, 0); -+ filemap_invalidate_unlock(inode->i_mapping); -+ inode_unlock(inode); -+ cifs_invalidate_cache(inode, 0); -+ } -+ } else { -+ /* -+ * No cached handle; evict stale pages so they can't -+ * be served after the file is later extended; let -+ * the server's O_TRUNC open response set the i_size -+ */ -+ inode_lock(inode); -+ filemap_invalidate_lock(inode->i_mapping); -+ truncate_inode_pages(inode->i_mapping, 0); -+ filemap_invalidate_unlock(inode->i_mapping); -+ inode_unlock(inode); - cifs_invalidate_cache(inode, 0); - } +diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c +index 5e397a7e63f6..ba560462d451 100644 +--- a/drivers/i2c/busses/i2c-xiic.c ++++ b/drivers/i2c/busses/i2c-xiic.c +@@ -67,6 +67,7 @@ enum i2c_scl_freq { + * @rx_pos: Position within current RX message + * @endianness: big/little-endian byte order + * @clk: Pointer to AXI4-lite input clock ++ * @irq: Interrupt number + * @state: See STATE_ + * @singlemaster: Indicates bus is single master + * @dynamic: Mode of controller +@@ -95,6 +96,7 @@ struct xiic_i2c { + int rx_pos; + enum xiic_endian endianness; + struct clk *clk; ++ int irq; + enum xilinx_i2c_state state; + bool singlemaster; + bool dynamic; +@@ -1506,9 +1508,17 @@ static int xiic_i2c_probe(struct platform_device *pdev) + + pm_runtime_set_autosuspend_delay(dev, XIIC_PM_TIMEOUT); + pm_runtime_use_autosuspend(dev); +- ret = devm_pm_runtime_set_active_enabled(dev); +- if (ret) ++ /* ++ * Enable runtime PM by hand: devm_pm_runtime_set_active_enabled() ++ * tears down in an order that races the devm-enabled clock release and ++ * makes clk_core_disable() WARN (see xiic_i2c_remove()). ++ */ ++ ret = pm_runtime_set_active(dev); ++ if (ret) { ++ pm_runtime_dont_use_autosuspend(dev); + return ret; ++ } ++ pm_runtime_enable(dev); + + /* SCL frequency configuration */ + i2c->input_clk = clk_get_rate(i2c->clk); +@@ -1517,10 +1527,15 @@ static int xiic_i2c_probe(struct platform_device *pdev) + if (ret || i2c->i2c_clk > I2C_MAX_FAST_MODE_PLUS_FREQ) + i2c->i2c_clk = 0; + +- ret = devm_request_threaded_irq(dev, irq, NULL, xiic_process, +- IRQF_ONESHOT, pdev->name, i2c); ++ /* ++ * Request the IRQ non-managed: later probe steps unwind manually via ++ * goto, so a devm handler could still be live after that teardown runs. ++ */ ++ i2c->irq = irq; ++ ret = request_threaded_irq(irq, NULL, xiic_process, IRQF_ONESHOT, ++ pdev->name, i2c); + if (ret) +- return ret; ++ goto err_pm_disable; + + i2c->singlemaster = device_property_read_bool(dev, "single-master"); + +@@ -1537,14 +1552,16 @@ static int xiic_i2c_probe(struct platform_device *pdev) + i2c->endianness = BIG; + + ret = xiic_reinit(i2c); +- if (ret) +- return dev_err_probe(dev, ret, "Cannot xiic_reinit\n"); ++ if (ret) { ++ dev_err_probe(dev, ret, "Cannot xiic_reinit\n"); ++ goto err_free_irq; ++ } + + /* add i2c adapter to i2c tree */ + ret = i2c_add_numbered_adapter(&i2c->adap); + if (ret) { + xiic_deinit(i2c); +- return ret; ++ goto err_free_irq; } + + if (pdata) { +@@ -1557,6 +1574,15 @@ static int xiic_i2c_probe(struct platform_device *pdev) + res, irq, i2c->i2c_clk); + + return 0; ++ ++err_free_irq: ++ free_irq(irq, i2c); ++err_pm_disable: ++ pm_runtime_disable(dev); ++ pm_runtime_set_suspended(dev); ++ pm_runtime_dont_use_autosuspend(dev); ++ ++ return ret; + } + + static void xiic_i2c_remove(struct platform_device *pdev) +@@ -1568,6 +1594,8 @@ static void xiic_i2c_remove(struct platform_device *pdev) + /* remove adapter & data */ + i2c_del_adapter(&i2c->adap); + ++ free_irq(i2c->irq, i2c); ++ + ret = pm_runtime_get_sync(dev); + if (ret < 0) + dev_warn(dev, "Failed to activate device for removal (%pe)\n", +@@ -1575,7 +1603,10 @@ static void xiic_i2c_remove(struct platform_device *pdev) + else + xiic_deinit(i2c); + +- pm_runtime_put_sync(dev); ++ pm_runtime_disable(dev); ++ pm_runtime_put_noidle(dev); ++ pm_runtime_set_suspended(dev); ++ pm_runtime_dont_use_autosuspend(dev); + } + + static const struct dev_pm_ops xiic_dev_pm_ops = { +-- +2.56.0 diff --git a/a/content_digest b/N1/content_digest index 37d4f23..71db64a 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1,78 +1,182 @@ - "ref\020261023163714.201276352@linuxfoundation.org\0" + "ref\020261023163713.816071858@linuxfoundation.org\0" "From\0Greg Kroah-Hartman <gregkh@linuxfoundation.org>\0" - "Subject\0[PATCH 6.18 120/193] cifs: dont update i_size in cifs_do_truncate without a cached handle\0" - "Date\0Fri, 23 Oct 2026 18:36:37 +0200\0" + "Subject\0[PATCH 7.2 138/242] i2c: xiic: restore non-managed runtime PM to fix clk WARN flood\0" + "Date\0Fri, 23 Oct 2026 18:39:40 +0200\0" "To\0stable@vger.kernel.org\0" "Cc\0Greg Kroah-Hartman <gregkh@linuxfoundation.org>" patches@lists.linux.dev - Frank Sorenson <sorenson@redhat.com> - David Howells <dhowells@redhat.com> - " Paulo Alcantara <pc@manguebit.org>\0" + Abdurrahman Hussain <abdurrahman@nexthop.ai> + " Andi Shyti <andi.shyti@kernel.org>\0" "\00:1\0" "b\0" - "6.18-stable review patch. If anyone has any objections, please let me know.\n" + "7.2-stable review patch. If anyone has any objections, please let me know.\n" "\n" "------------------\n" "\n" - "From: Frank Sorenson <sorenson@redhat.com>\n" + "From: Abdurrahman Hussain <abdurrahman@nexthop.ai>\n" "\n" - "commit fe39cd9d48f2346605f3746e0cc19e89d5f373eb upstream.\n" + "commit d33373c565af9c8a28776af02bd20ba6e5724211 upstream.\n" "\n" - "If find_writable_file() returns null, cifs_file_flush will return\n" - "0 without issuing set_file_size, and the outer 'if (!rc)' block\n" - "will set i_size to 0 before telling the server to truncate. If\n" - "the cifs_open() then fails, the inode will have size 0, while\n" - "the server file is unchanged.\n" + "The devres conversion replaced manual pm_runtime_enable()/disable() with\n" + "devm_pm_runtime_set_active_enabled() and dropped the remove-time runtime\n" + "PM teardown. The managed release tears runtime PM down in the wrong\n" + "order: it calls pm_runtime_dont_use_autosuspend() before\n" + "pm_runtime_disable(), i.e. while runtime PM is still enabled, and devres\n" + "is LIFO so the devm_clk_get_enabled() release runs afterwards.\n" "\n" - "Move the netfs_resize_file() and cifs_setsize() into the 'if\n" - "(cfile)', so they only run after a successful set_file_size.\n" + "At remove(), pm_runtime_put_sync() leaves the device active with the\n" + "autosuspend timer armed. Clearing use_autosuspend then makes rpm_idle()\n" + "suspend immediately, and xiic_i2c_runtime_suspend() clk_disable()s the\n" + "clock. The later devm_clk_get_enabled() release clk_disable_unprepare()s\n" + "the already-disabled clock, so clk_core_disable() WARNs (\"clkN already\n" + "disabled\") on every teardown.\n" "\n" - "In the no-handle else branch, evict stale pages with\n" - "truncate_inode_pages before the O_TRUNC open to dispose of old\n" - "cache pages, and let the open response set the i_size.\n" + "Drop the managed helper and restore the non-managed runtime PM setup and\n" + "teardown, so runtime PM is enabled once in probe and disabled once in\n" + "remove and the clock enable count stays balanced.\n" "\n" - "Fixes: 110fee6b9bb5 (\"smb: client: fix missing timestamp updates with O_TRUNC\")\n" - "Cc: stable@vger.kernel.org\n" - "Signed-off-by: Frank Sorenson <sorenson@redhat.com>\n" - "Acked-by: David Howells <dhowells@redhat.com>\n" - "Signed-off-by: Paulo Alcantara <pc@manguebit.org>\n" + "Order the remove teardown so runtime PM is disabled before the usage\n" + "count is dropped: pm_runtime_disable() followed by pm_runtime_put_noidle()\n" + "instead of pm_runtime_put_sync(). Dropping the count first with autosuspend\n" + "still enabled arms the autosuspend timer, and a preemption before\n" + "pm_runtime_disable() lets it expire, suspend the device and clk_disable()\n" + "the clock, which the devm release then disables again - the same WARN.\n" + "\n" + "Restore the non-managed IRQ request as well. The probe error paths now\n" + "unwind runtime PM by hand via goto, and a devm-registered handler is only\n" + "freed later during devres unwind, so it would stay live across the manual\n" + "teardown (and across any future failing step added after it). Request the\n" + "IRQ with request_threaded_irq() and free it explicitly in the probe error\n" + "path and in remove. The probe error path also clears use_autosuspend, to\n" + "match the teardown in remove().\n" + "\n" + "Fixes: 50c63491ff26 (\"i2c: xiic: switch to devres managed APIs\")\n" + "Signed-off-by: Abdurrahman Hussain <abdurrahman@nexthop.ai>\n" + "Cc: <stable@vger.kernel.org> # v7.1+\n" + "Signed-off-by: Andi Shyti <andi.shyti@kernel.org>\n" + "Link: https://patch.msgid.link/20261014-i2c-xiic-restore-runtime-pm-teardown-v8-1-40668c270069@nexthop.ai\n" "Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>\n" "---\n" - " fs/smb/client/file.c | 24 ++++++++++++++++++++----\n" - " 1 file changed, 20 insertions(+), 4 deletions(-)\n" + " drivers/i2c/busses/i2c-xiic.c | 49 ++++++++++++++++++++++++++++-------\n" + " 1 file changed, 40 insertions(+), 9 deletions(-)\n" "\n" - "--- a/fs/smb/client/file.c\n" - "+++ b/fs/smb/client/file.c\n" - "@@ -1003,10 +1003,26 @@ static int cifs_do_truncate(const unsign\n" - " \t\t\tserver = tcon->ses->server;\n" - " \t\t\trc = server->ops->set_file_size(xid, tcon,\n" - " \t\t\t\t\t\t\tcfile, 0, false);\n" - "-\t\t}\n" - "-\t\tif (!rc) {\n" - "-\t\t\tnetfs_resize_file(&cinode->netfs, 0, true);\n" - "-\t\t\tcifs_setsize(inode, 0);\n" - "+\t\t\tif (!rc) {\n" - "+\t\t\t\tinode_lock(inode);\n" - "+\t\t\t\tfilemap_invalidate_lock(inode->i_mapping);\n" - "+\t\t\t\tnetfs_resize_file(&cinode->netfs, 0, true);\n" - "+\t\t\t\tcifs_setsize(inode, 0);\n" - "+\t\t\t\tfilemap_invalidate_unlock(inode->i_mapping);\n" - "+\t\t\t\tinode_unlock(inode);\n" - "+\t\t\t\tcifs_invalidate_cache(inode, 0);\n" - "+\t\t\t}\n" - "+\t\t} else {\n" - "+\t\t\t/*\n" - "+\t\t\t * No cached handle; evict stale pages so they can't\n" - "+\t\t\t * be served after the file is later extended; let\n" - "+\t\t\t * the server's O_TRUNC open response set the i_size\n" - "+\t\t\t */\n" - "+\t\t\tinode_lock(inode);\n" - "+\t\t\tfilemap_invalidate_lock(inode->i_mapping);\n" - "+\t\t\ttruncate_inode_pages(inode->i_mapping, 0);\n" - "+\t\t\tfilemap_invalidate_unlock(inode->i_mapping);\n" - "+\t\t\tinode_unlock(inode);\n" - " \t\t\tcifs_invalidate_cache(inode, 0);\n" - " \t\t}\n" - " \t}" + "diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c\n" + "index 5e397a7e63f6..ba560462d451 100644\n" + "--- a/drivers/i2c/busses/i2c-xiic.c\n" + "+++ b/drivers/i2c/busses/i2c-xiic.c\n" + "@@ -67,6 +67,7 @@ enum i2c_scl_freq {\n" + " * @rx_pos: Position within current RX message\n" + " * @endianness: big/little-endian byte order\n" + " * @clk: Pointer to AXI4-lite input clock\n" + "+ * @irq: Interrupt number\n" + " * @state: See STATE_\n" + " * @singlemaster: Indicates bus is single master\n" + " * @dynamic: Mode of controller\n" + "@@ -95,6 +96,7 @@ struct xiic_i2c {\n" + " \tint rx_pos;\n" + " \tenum xiic_endian endianness;\n" + " \tstruct clk *clk;\n" + "+\tint irq;\n" + " \tenum xilinx_i2c_state state;\n" + " \tbool singlemaster;\n" + " \tbool dynamic;\n" + "@@ -1506,9 +1508,17 @@ static int xiic_i2c_probe(struct platform_device *pdev)\n" + " \n" + " \tpm_runtime_set_autosuspend_delay(dev, XIIC_PM_TIMEOUT);\n" + " \tpm_runtime_use_autosuspend(dev);\n" + "-\tret = devm_pm_runtime_set_active_enabled(dev);\n" + "-\tif (ret)\n" + "+\t/*\n" + "+\t * Enable runtime PM by hand: devm_pm_runtime_set_active_enabled()\n" + "+\t * tears down in an order that races the devm-enabled clock release and\n" + "+\t * makes clk_core_disable() WARN (see xiic_i2c_remove()).\n" + "+\t */\n" + "+\tret = pm_runtime_set_active(dev);\n" + "+\tif (ret) {\n" + "+\t\tpm_runtime_dont_use_autosuspend(dev);\n" + " \t\treturn ret;\n" + "+\t}\n" + "+\tpm_runtime_enable(dev);\n" + " \n" + " \t/* SCL frequency configuration */\n" + " \ti2c->input_clk = clk_get_rate(i2c->clk);\n" + "@@ -1517,10 +1527,15 @@ static int xiic_i2c_probe(struct platform_device *pdev)\n" + " \tif (ret || i2c->i2c_clk > I2C_MAX_FAST_MODE_PLUS_FREQ)\n" + " \t\ti2c->i2c_clk = 0;\n" + " \n" + "-\tret = devm_request_threaded_irq(dev, irq, NULL, xiic_process,\n" + "-\t\t\t\t\tIRQF_ONESHOT, pdev->name, i2c);\n" + "+\t/*\n" + "+\t * Request the IRQ non-managed: later probe steps unwind manually via\n" + "+\t * goto, so a devm handler could still be live after that teardown runs.\n" + "+\t */\n" + "+\ti2c->irq = irq;\n" + "+\tret = request_threaded_irq(irq, NULL, xiic_process, IRQF_ONESHOT,\n" + "+\t\t\t\t pdev->name, i2c);\n" + " \tif (ret)\n" + "-\t\treturn ret;\n" + "+\t\tgoto err_pm_disable;\n" + " \n" + " \ti2c->singlemaster = device_property_read_bool(dev, \"single-master\");\n" + " \n" + "@@ -1537,14 +1552,16 @@ static int xiic_i2c_probe(struct platform_device *pdev)\n" + " \t\ti2c->endianness = BIG;\n" + " \n" + " \tret = xiic_reinit(i2c);\n" + "-\tif (ret)\n" + "-\t\treturn dev_err_probe(dev, ret, \"Cannot xiic_reinit\\n\");\n" + "+\tif (ret) {\n" + "+\t\tdev_err_probe(dev, ret, \"Cannot xiic_reinit\\n\");\n" + "+\t\tgoto err_free_irq;\n" + "+\t}\n" + " \n" + " \t/* add i2c adapter to i2c tree */\n" + " \tret = i2c_add_numbered_adapter(&i2c->adap);\n" + " \tif (ret) {\n" + " \t\txiic_deinit(i2c);\n" + "-\t\treturn ret;\n" + "+\t\tgoto err_free_irq;\n" + " \t}\n" + " \n" + " \tif (pdata) {\n" + "@@ -1557,6 +1574,15 @@ static int xiic_i2c_probe(struct platform_device *pdev)\n" + " \t\tres, irq, i2c->i2c_clk);\n" + " \n" + " \treturn 0;\n" + "+\n" + "+err_free_irq:\n" + "+\tfree_irq(irq, i2c);\n" + "+err_pm_disable:\n" + "+\tpm_runtime_disable(dev);\n" + "+\tpm_runtime_set_suspended(dev);\n" + "+\tpm_runtime_dont_use_autosuspend(dev);\n" + "+\n" + "+\treturn ret;\n" + " }\n" + " \n" + " static void xiic_i2c_remove(struct platform_device *pdev)\n" + "@@ -1568,6 +1594,8 @@ static void xiic_i2c_remove(struct platform_device *pdev)\n" + " \t/* remove adapter & data */\n" + " \ti2c_del_adapter(&i2c->adap);\n" + " \n" + "+\tfree_irq(i2c->irq, i2c);\n" + "+\n" + " \tret = pm_runtime_get_sync(dev);\n" + " \tif (ret < 0)\n" + " \t\tdev_warn(dev, \"Failed to activate device for removal (%pe)\\n\",\n" + "@@ -1575,7 +1603,10 @@ static void xiic_i2c_remove(struct platform_device *pdev)\n" + " \telse\n" + " \t\txiic_deinit(i2c);\n" + " \n" + "-\tpm_runtime_put_sync(dev);\n" + "+\tpm_runtime_disable(dev);\n" + "+\tpm_runtime_put_noidle(dev);\n" + "+\tpm_runtime_set_suspended(dev);\n" + "+\tpm_runtime_dont_use_autosuspend(dev);\n" + " }\n" + " \n" + " static const struct dev_pm_ops xiic_dev_pm_ops = {\n" + "-- \n" + 2.56.0 -532688019c236961dbaa04f4f0bf0a7e3c1b879265650fdb045ef62ca5b456c8 +9876032c1531498673e1c66044be975790cd5a6290488c26a0601eca67c07b38
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox