Skip to contentSkip to conversation

thunderbolt: Fix a logic error in wake on connect

PATCH Applied Mario Limonciello 5 participants 12 messages Apr 11, 2025 – Jul 15, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thunderbolt: Fix a logic error in wake on connect

From: Mario Limonciello <[email protected]>

commit a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports") introduced a sysfs file to control wake up policy for a given USB4 port that defaulted to disabled.

However when testing commit 4bfeea6ec1c02 ("thunderbolt: Use wake on connect and disconnect over suspend") I found that it was working even without making changes to the power/wakeup file (which defaults to disabled). This is because of a logic error doing a bitwise or of the wake-on-connect flag with device_may_wakeup() which should have been a logical AND.

Adjust the logic so that policy is only applied when wakeup is actually enabled.

Fixes a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports")
---
 drivers/thunderbolt/usb4.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thunderbolt/usb4.c +2 -2
index e51d01671d8e7..3e96f1afd4268 100644
@@ -440,10 +440,10 @@ int usb4_switch_set_wake(struct tb_switch *sw, unsigned int flags)
 			bool configured = val & PORT_CS_19_PC;
 			usb4 = port->usb4;
 
-			if (((flags & TB_WAKE_ON_CONNECT) |
+			if (((flags & TB_WAKE_ON_CONNECT) &&
 			      device_may_wakeup(&usb4->dev)) && !configured)
 				val |= PORT_CS_19_WOC;
-			if (((flags & TB_WAKE_ON_DISCONNECT) |
+			if (((flags & TB_WAKE_ON_DISCONNECT) &&
 			      device_may_wakeup(&usb4->dev)) && configured)
 				val |= PORT_CS_19_WOD;
 			if ((flags & TB_WAKE_ON_USB4) && configured)
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 13 lines · Mario Limonciello

From: Mario Limonciello <[email protected]>

commit a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports") introduced a sysfs file to control wake up policy for a given USB4 port that defaulted to disabled.

However when testing commit 4bfeea6ec1c02 ("thunderbolt: Use wake on connect and disconnect over suspend") I found that it was working even without making changes to the power/wakeup file (which defaults to disabled). This is because of a logic error doing a bitwise or of the wake-on-connect flag with device_may_wakeup() which should have been a logical AND.

Quoted 8 lines

Adjust the logic so that policy is only applied when wakeup is actually enabled.

Fixes a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports")
---
 drivers/thunderbolt/usb4.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.

You are receiving this message because of the following common error(s) as indicated below:

- You have marked a patch with a "Fixes:" tag for a commit that is in an older released kernel, yet you do not have a cc: stable line in the signed-off-by area at all, which means that the patch will not be applied to any older kernel releases. To properly fix this, please follow the documented rules in the Documentation/process/stable-kernel-rules.rst file for how to resolve this.

If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.

thanks,

greg k-h's patch email bot

#2 lore raw
In reply to Mario Limonciello
Quoted 13 lines · Mario Limonciello

From: Mario Limonciello <[email protected]>

commit a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports") introduced a sysfs file to control wake up policy for a given USB4 port that defaulted to disabled.

However when testing commit 4bfeea6ec1c02 ("thunderbolt: Use wake on connect and disconnect over suspend") I found that it was working even without making changes to the power/wakeup file (which defaults to disabled). This is because of a logic error doing a bitwise or of the wake-on-connect flag with device_may_wakeup() which should have been a logical AND.

Quoted 5 lines

Adjust the logic so that policy is only applied when wakeup is actually enabled.

Fixes a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports")

I guess the offending commit was never even tested :(

Applied to thunderbolt.git/next thanks!

#3 lore raw
Quoted 14 lines · Mika Westerberg
Quoted 13 lines · Mario Limonciello

From: Mario Limonciello <[email protected]>

commit a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports") introduced a sysfs file to control wake up policy for a given USB4 port that defaulted to disabled.

However when testing commit 4bfeea6ec1c02 ("thunderbolt: Use wake on connect and disconnect over suspend") I found that it was working even without making changes to the power/wakeup file (which defaults to disabled). This is because of a logic error doing a bitwise or of the wake-on-connect flag with device_may_wakeup() which should have been a logical AND.

Quoted 8 lines
Quoted 5 lines

Adjust the logic so that policy is only applied when wakeup is actually enabled.

Fixes a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports")

I guess the offending commit was never even tested :(

Yeah that is my only explanation too. So now this begs the question do we do the 3rd step that we set all the ports to 'enabled' by default?

Quoted 1 line

Applied to thunderbolt.git/next thanks!

Thanks!

#4 lore raw
Quoted 18 lines · Mario Limonciello
Quoted 17 lines · Mika Westerberg
Quoted 16 lines · Mario Limonciello

From: Mario Limonciello <[email protected]>

commit a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports") introduced a sysfs file to control wake up policy for a given USB4 port that defaulted to disabled.

However when testing commit 4bfeea6ec1c02 ("thunderbolt: Use wake on connect and disconnect over suspend") I found that it was working even without making changes to the power/wakeup file (which defaults to disabled). This is because of a logic error doing a bitwise or of the wake-on-connect flag with device_may_wakeup() which should have been a logical AND.

Adjust the logic so that policy is only applied when wakeup is actually enabled.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Fixes a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports")

I guess the offending commit was never even tested :(

Yeah that is my only explanation too. So now this begs the question do we do the 3rd step that we set all the ports to 'enabled' by default?

No we don't. That needs the userspace that can do dark resume and we cannot assume it by default.

#5 lore raw
In reply to Mario Limonciello
Quoted 13 lines · Mario Limonciello

From: Mario Limonciello <[email protected]>

commit a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports") introduced a sysfs file to control wake up policy for a given USB4 port that defaulted to disabled.

However when testing commit 4bfeea6ec1c02 ("thunderbolt: Use wake on connect and disconnect over suspend") I found that it was working even without making changes to the power/wakeup file (which defaults to disabled). This is because of a logic error doing a bitwise or of the wake-on-connect flag with device_may_wakeup() which should have been a logical AND.

Quoted 5 lines

Adjust the logic so that policy is only applied when wakeup is actually enabled.

Fixes a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports")

Hi! There have been a couple of reports of a Thunderbolt regression in recent stable kernels, and one reporter has now bisected it to this change:

• https://bugzilla.kernel.org/show_bug.cgi?id=220284
• https://github.com/NixOS/nixpkgs/issues/420730

Both reporters are CCed, and say it starts working after the module is reloaded.

(for regzbot)

Quoted 24 lines
---
 drivers/thunderbolt/usb4.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thunderbolt/usb4.c +2 -3
index e51d01671d8e7..3e96f1afd4268 100644
@@ -440,10 +440,10 @@ int usb4_switch_set_wake(struct tb_switch *sw, unsigned int flags)
 			bool configured = val & PORT_CS_19_PC;
 			usb4 = port->usb4;
 
-			if (((flags & TB_WAKE_ON_CONNECT) |
+			if (((flags & TB_WAKE_ON_CONNECT) &&
 			      device_may_wakeup(&usb4->dev)) && !configured)
 				val |= PORT_CS_19_WOC;
-			if (((flags & TB_WAKE_ON_DISCONNECT) |
+			if (((flags & TB_WAKE_ON_DISCONNECT) &&
 			      device_may_wakeup(&usb4->dev)) && configured)
 				val |= PORT_CS_19_WOD;
 			if ((flags & TB_WAKE_ON_USB4) && configured)
--

2.43.0

#6 lore raw
Quoted 24 lines · Alyssa Ross
Quoted 13 lines · Mario Limonciello

From: Mario Limonciello <[email protected]>

commit a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports") introduced a sysfs file to control wake up policy for a given USB4 port that defaulted to disabled.

However when testing commit 4bfeea6ec1c02 ("thunderbolt: Use wake on connect and disconnect over suspend") I found that it was working even without making changes to the power/wakeup file (which defaults to disabled). This is because of a logic error doing a bitwise or of the wake-on-connect flag with device_may_wakeup() which should have been a logical AND.

Quoted 5 lines

Adjust the logic so that policy is only applied when wakeup is actually enabled.

Fixes a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports")

Hi! There have been a couple of reports of a Thunderbolt regression in recent stable kernels, and one reporter has now bisected it to this change:

Quoted 8 lines

• https://bugzilla.kernel.org/show_bug.cgi?id=220284
• https://github.com/NixOS/nixpkgs/issues/420730

Both reporters are CCed, and say it starts working after the module is reloaded.

(for regzbot)

Apparently[1] fixed by the first linked patch below, which is currently in the Thunderbolt tree waiting to be pulled into the USB tree.

#regzbot monitor: https://lore.kernel.org/linux-usb/[email protected]/
#regzbot monitor: https://lore.kernel.org/linux-usb/[email protected]/

[1]: https://github.com/NixOS/nixpkgs/issues/420730#issuecomment-3018563631

maintainer
#11 lore raw
In reply to Mario Limonciello

[ Sasha's backport helper bot ]

Hi,

Summary of potential issues:
❌ Build failures detected
⚠️ Found matching upstream commit but patch is missing proper reference to it

Found matching upstream commit: 1a760d10ded372d113a0410c42be246315bbc2ff

WARNING: Author mismatch between patch and found commit:
Backport author: Mario Limonciello<[email protected]> Commit author: Mario Limonciello<[email protected]>

Note: The patch differs from the upstream commit:
---

1:  1a760d10ded37 < -:  ------------- thunderbolt: Fix a logic error in wake on connect
-:  ------------- > 1:  e60eb441596d1 Linux 6.15.4

---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.15.y       |  Success    |  Success   |
| stable/linux-6.12.y       |  Success    |  Success   |
| stable/linux-6.6.y        |  Success    |  Success   |
| stable/linux-6.1.y        |  Success    |  Success   |
| stable/linux-5.15.y       |  Success    |  Success   |
| stable/linux-5.10.y       |  Success    |  Success   |
| stable/linux-5.4.y        |  Success    |  Failed    |

Build Errors:
Build error for stable/linux-5.4.y:

    arch/x86/entry/entry_64.o: warning: objtool: .entry.text+0x1e1: stack state mismatch: cfa1=7+56 cfa2=7+40
    arch/x86/kvm/vmx/vmenter.o: warning: objtool: __vmx_vcpu_run()+0x12a: return with modified stack frame
    In file included from ./include/linux/list.h:9,
                     from ./include/linux/kobject.h:19,
                     from ./include/linux/of.h:17,
                     from ./include/linux/clk-provider.h:9,
                     from drivers/clk/qcom/clk-rpmh.c:6:
    drivers/clk/qcom/clk-rpmh.c: In function 'clk_rpmh_bcm_send_cmd':
    ./include/linux/kernel.h:843:43: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
      843 |                 (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
          |                                           ^~
    ./include/linux/kernel.h:857:18: note: in expansion of macro '__typecheck'
      857 |                 (__typecheck(x, y) && __no_side_effects(x, y))
          |                  ^~~~~~~~~~~
    ./include/linux/kernel.h:867:31: note: in expansion of macro '__safe_cmp'
      867 |         __builtin_choose_expr(__safe_cmp(x, y), \
          |                               ^~~~~~~~~~
    ./include/linux/kernel.h:876:25: note: in expansion of macro '__careful_cmp'
      876 | #define min(x, y)       __careful_cmp(x, y, <)
          |                         ^~~~~~~~~~~~~
    drivers/clk/qcom/clk-rpmh.c:273:21: note: in expansion of macro 'min'
      273 |         cmd_state = min(cmd_state, BCM_TCS_CMD_VOTE_MASK);
          |                     ^~~
    fs/xfs/libxfs/xfs_inode_fork.c: In function 'xfs_ifork_verify_attr':
    fs/xfs/libxfs/xfs_inode_fork.c:735:13: warning: the comparison will always evaluate as 'true' for the address of 'i_df' will never be NULL [-Waddress]
      735 |         if (!XFS_IFORK_PTR(ip, XFS_ATTR_FORK))
          |             ^
    In file included from fs/xfs/libxfs/xfs_inode_fork.c:14:
    ./fs/xfs/xfs_inode.h:38:33: note: 'i_df' declared here
       38 |         struct xfs_ifork        i_df;           /* data fork */
          |                                 ^~~~
    drivers/gpu/drm/i915/display/intel_dp.c: In function 'intel_dp_mode_valid':
    drivers/gpu/drm/i915/display/intel_dp.c:639:33: warning: 'drm_dp_dsc_sink_max_slice_count' reading 16 bytes from a region of size 0 [-Wstringop-overread]
      639 |                                 drm_dp_dsc_sink_max_slice_count(intel_dp->dsc_dpcd,
          |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      640 |                                                                 true);
          |                                                                 ~~~~~
    drivers/gpu/drm/i915/display/intel_dp.c:639:33: note: referencing argument 1 of type 'const u8[16]' {aka 'const unsigned char[16]'}
    In file included from drivers/gpu/drm/i915/display/intel_dp.c:39:
    ./include/drm/drm_dp_helper.h:1174:4: note: in a call to function 'drm_dp_dsc_sink_max_slice_count'
     1174 | u8 drm_dp_dsc_sink_max_slice_count(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE],
          |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/net/dsa/microchip/ksz9477.c: In function 'ksz9477_reset_switch':
    drivers/net/dsa/microchip/ksz9477.c:198:12: warning: unused variable 'data8' [-Wunused-variable]
      198 |         u8 data8;
          |            ^~~~~
    drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c: In function 'vmw_execbuf_process':
    drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c:3834:25: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     3834 |                         struct seqno_waiter_rm_context *ctx =
          |                         ^~~~~~
    In file included from ./include/linux/bitops.h:5,
                     from ./include/linux/kernel.h:12,
                     from ./include/linux/list.h:9,
                     from ./include/linux/module.h:9,
                     from drivers/net/ethernet/qlogic/qed/qed_debug.c:6:
    drivers/net/ethernet/qlogic/qed/qed_debug.c: In function 'qed_grc_dump_addr_range':
    ./include/linux/bits.h:8:33: warning: overflow in conversion from 'long unsigned int' to 'u8' {aka 'unsigned char'} changes value from '(long unsigned int)((int)vf_id << 8 | 128)' to '128' [-Woverflow]
        8 | #define BIT(nr)                 (UL(1) << (nr))
          |                                 ^
    drivers/net/ethernet/qlogic/qed/qed_debug.c:2572:31: note: in expansion of macro 'BIT'
     2572 |                         fid = BIT(PXP_PRETEND_CONCRETE_FID_VFVALID_SHIFT) |
          |                               ^~~
    drivers/gpu/drm/nouveau/dispnv50/wndw.c:628:1: warning: conflicting types for 'nv50_wndw_new_' due to enum/integer mismatch; have 'int(const struct nv50_wndw_func *, struct drm_device *, enum drm_plane_type,  const char *, int,  const u32 *, u32,  enum nv50_disp_interlock_type,  u32,  struct nv50_wndw **)' {aka 'int(const struct nv50_wndw_func *, struct drm_device *, enum drm_plane_type,  const char *, int,  const unsigned int *, unsigned int,  enum nv50_disp_interlock_type,  unsigned int,  struct nv50_wndw **)'} [-Wenum-int-mismatch]
      628 | nv50_wndw_new_(const struct nv50_wndw_func *func, struct drm_device *dev,
          | ^~~~~~~~~~~~~~
    In file included from drivers/gpu/drm/nouveau/dispnv50/wndw.c:22:
    drivers/gpu/drm/nouveau/dispnv50/wndw.h:39:5: note: previous declaration of 'nv50_wndw_new_' with type 'int(const struct nv50_wndw_func *, struct drm_device *, enum drm_plane_type,  const char *, int,  const u32 *, enum nv50_disp_interlock_type,  u32,  u32,  struct nv50_wndw **)' {aka 'int(const struct nv50_wndw_func *, struct drm_device *, enum drm_plane_type,  const char *, int,  const unsigned int *, enum nv50_disp_interlock_type,  unsigned int,  unsigned int,  struct nv50_wndw **)'}
       39 | int nv50_wndw_new_(const struct nv50_wndw_func *, struct drm_device *,
          |     ^~~~~~~~~~~~~~
    client_loop: send disconnect: Broken pipe
#7 lore raw
In reply to Alyssa Ross
Quoted 35 lines · Alyssa Ross
Quoted 24 lines · Alyssa Ross
Quoted 13 lines · Mario Limonciello

From: Mario Limonciello <[email protected]>

commit a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports") introduced a sysfs file to control wake up policy for a given USB4 port that defaulted to disabled.

However when testing commit 4bfeea6ec1c02 ("thunderbolt: Use wake on connect and disconnect over suspend") I found that it was working even without making changes to the power/wakeup file (which defaults to disabled). This is because of a logic error doing a bitwise or of the wake-on-connect flag with device_may_wakeup() which should have been a logical AND.

Quoted 5 lines

Adjust the logic so that policy is only applied when wakeup is actually enabled.

Fixes a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports")

Hi! There have been a couple of reports of a Thunderbolt regression in recent stable kernels, and one reporter has now bisected it to this change:

Quoted 8 lines

• https://bugzilla.kernel.org/show_bug.cgi?id=220284
• https://github.com/NixOS/nixpkgs/issues/420730

Both reporters are CCed, and say it starts working after the module is reloaded.

(for regzbot)

Quoted 7 lines

Apparently[1] fixed by the first linked patch below, which is currently in the Thunderbolt tree waiting to be pulled into the USB tree.

#regzbot monitor: https://lore.kernel.org/linux-usb/[email protected]/
#regzbot monitor: https://lore.kernel.org/linux-usb/[email protected]/

[1]: https://github.com/NixOS/nixpkgs/issues/420730#issuecomment-3018563631

Hey Greg,

Can you pick up the pull request from Mika from a week and a half ago with this fix for the next 6.16-rc?

https://lore.kernel.org/linux-usb/[email protected]/

Thanks,

#8 lore raw
Quoted 42 lines · Mario Limonciello
Quoted 41 lines · Alyssa Ross
Quoted 24 lines · Alyssa Ross
Quoted 13 lines · Mario Limonciello

From: Mario Limonciello <[email protected]>

commit a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports") introduced a sysfs file to control wake up policy for a given USB4 port that defaulted to disabled.

However when testing commit 4bfeea6ec1c02 ("thunderbolt: Use wake on connect and disconnect over suspend") I found that it was working even without making changes to the power/wakeup file (which defaults to disabled). This is because of a logic error doing a bitwise or of the wake-on-connect flag with device_may_wakeup() which should have been a logical AND.

Quoted 5 lines

Adjust the logic so that policy is only applied when wakeup is actually enabled.

Fixes a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports")

Hi! There have been a couple of reports of a Thunderbolt regression in recent stable kernels, and one reporter has now bisected it to this change:

Quoted 8 lines

• https://bugzilla.kernel.org/show_bug.cgi?id=220284
• https://github.com/NixOS/nixpkgs/issues/420730

Both reporters are CCed, and say it starts working after the module is reloaded.

(for regzbot)

Apparently[1] fixed by the first linked patch below, which is currently in the Thunderbolt tree waiting to be pulled into the USB tree.

#regzbot monitor: https://lore.kernel.org/linux-usb/[email protected]/
#regzbot monitor: https://lore.kernel.org/linux-usb/[email protected]/

Quoted 8 lines
Quoted 1 line

[1]: https://github.com/NixOS/nixpkgs/issues/420730#issuecomment-3018563631

Hey Greg,

Can you pick up the pull request from Mika from a week and a half ago with this fix for the next 6.16-rc?

https://lore.kernel.org/linux-usb/[email protected]/

Yes, I was waiting for this last round to go to Linus as the pull request was made against a newer version of Linus's tree than I currently had in my "for linus" branch. I'll go get to that later today.

thanks,

greg k-h

#9 lore raw
Quoted 52 lines · Greg Kroah-Hartman
Quoted 42 lines · Mario Limonciello
Quoted 41 lines · Alyssa Ross
Quoted 24 lines · Alyssa Ross
Quoted 13 lines · Mario Limonciello

From: Mario Limonciello <[email protected]>

commit a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports") introduced a sysfs file to control wake up policy for a given USB4 port that defaulted to disabled.

However when testing commit 4bfeea6ec1c02 ("thunderbolt: Use wake on connect and disconnect over suspend") I found that it was working even without making changes to the power/wakeup file (which defaults to disabled). This is because of a logic error doing a bitwise or of the wake-on-connect flag with device_may_wakeup() which should have been a logical AND.

Quoted 5 lines

Adjust the logic so that policy is only applied when wakeup is actually enabled.

Fixes a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports")

Hi! There have been a couple of reports of a Thunderbolt regression in recent stable kernels, and one reporter has now bisected it to this change:

Quoted 8 lines

• https://bugzilla.kernel.org/show_bug.cgi?id=220284
• https://github.com/NixOS/nixpkgs/issues/420730

Both reporters are CCed, and say it starts working after the module is reloaded.

(for regzbot)

Apparently[1] fixed by the first linked patch below, which is currently in the Thunderbolt tree waiting to be pulled into the USB tree.

#regzbot monitor: https://lore.kernel.org/linux-usb/[email protected]/
#regzbot monitor: https://lore.kernel.org/linux-usb/[email protected]/

Quoted 8 lines
Quoted 1 line

[1]: https://github.com/NixOS/nixpkgs/issues/420730#issuecomment-3018563631

Hey Greg,

Can you pick up the pull request from Mika from a week and a half ago with this fix for the next 6.16-rc?

https://lore.kernel.org/linux-usb/[email protected]/

Quoted 9 lines

Yes, I was waiting for this last round to go to Linus as the pull request was made against a newer version of Linus's tree than I currently had in my "for linus" branch. I'll go get to that later today.

thanks,

greg k-h

Greg,

Sorry to be a bugger, but I was surprised I didn't see this come in -rc6 this week, and I went and double checked your "usb-linus" branch [1] and didn't see it there.

Thanks,

[1] https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/log/?h=usb-linus

#10 lore raw
Quoted 65 lines · Mario Limonciello
Quoted 52 lines · Greg Kroah-Hartman
Quoted 42 lines · Mario Limonciello
Quoted 41 lines · Alyssa Ross
Quoted 24 lines · Alyssa Ross
Quoted 13 lines · Mario Limonciello

From: Mario Limonciello <[email protected]>

commit a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports") introduced a sysfs file to control wake up policy for a given USB4 port that defaulted to disabled.

However when testing commit 4bfeea6ec1c02 ("thunderbolt: Use wake on connect and disconnect over suspend") I found that it was working even without making changes to the power/wakeup file (which defaults to disabled). This is because of a logic error doing a bitwise or of the wake-on-connect flag with device_may_wakeup() which should have been a logical AND.

Quoted 5 lines

Adjust the logic so that policy is only applied when wakeup is actually enabled.

Fixes a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports")

Hi! There have been a couple of reports of a Thunderbolt regression in recent stable kernels, and one reporter has now bisected it to this change:

Quoted 8 lines

• https://bugzilla.kernel.org/show_bug.cgi?id=220284
• https://github.com/NixOS/nixpkgs/issues/420730

Both reporters are CCed, and say it starts working after the module is reloaded.

(for regzbot)

Apparently[1] fixed by the first linked patch below, which is currently in the Thunderbolt tree waiting to be pulled into the USB tree.

#regzbot monitor: https://lore.kernel.org/linux-usb/[email protected]/
#regzbot monitor: https://lore.kernel.org/linux-usb/[email protected]/

Quoted 8 lines
Quoted 1 line

[1]: https://github.com/NixOS/nixpkgs/issues/420730#issuecomment-3018563631

Hey Greg,

Can you pick up the pull request from Mika from a week and a half ago with this fix for the next 6.16-rc?

https://lore.kernel.org/linux-usb/[email protected]/

Quoted 9 lines

Yes, I was waiting for this last round to go to Linus as the pull request was made against a newer version of Linus's tree than I currently had in my "for linus" branch. I'll go get to that later today.

thanks,

greg k-h

Greg,

Quoted 7 lines

Sorry to be a bugger, but I was surprised I didn't see this come in -rc6 this week, and I went and double checked your "usb-linus" branch [1] and didn't see it there.

Thanks,

[1] https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/log/?h=usb-linus

It's in there:

$ git lg main..usb-linus
*   cd0f8649d0e1 - (HEAD -> usb-linus, origin/usb-linus, kroah.org/usb-linus, work-linus) Merge tag 'usb-serial-6.16-rc6' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-linus (6 days ago) <Greg Kroah-Hartman>
|\  
| * 08f49cdb71f3 - USB: serial: option: add Foxconn T99W640 (3 weeks ago) <Slark Xiao>
* 3014168731b7 - usb: gadget: configfs: Fix OOB read on empty string write (6 days ago) <Xinyu Liu>
* 67a59f82196c - usb: musb: fix gadget state on disconnect (8 days ago) <Drew Hamilton>
* 9fccced2d25b - Merge tag 'thunderbolt-for-v6.16-rc4' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-linus (8 days ago) <Greg Kroah-Hartman>
* 2cdde91c14ec - thunderbolt: Fix bit masking in tb_dp_port_set_hops() (3 weeks ago) <Alok Tiwari>
* 58d71d4242ce - thunderbolt: Fix wake on connect at runtime (3 weeks ago) <Mario Limonciello>

I'll get this to Linus for the next -rc.

thanks,

greg k-h