Skip to contentSkip to conversation

power: use EXPORT_SYMBOL() to export symbol

PATCH In review Dongbum Kim 2 participants 3 messages Aug 20 – Aug 28

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

PATCH 1/1 power: use EXPORT_SYMBOL() to export symbol

Add EXPORT_SYMBOL() to mark freeze_timeout_msecs symbol as visible.

freeze_timeout_msecs defines the timeout for try_to_freeze_tasks. If tasks cannot be frozen within this timeout, try_to_freeze_tasks fails, and causes suspend or hibernation to fail.

For example, a device driver may need to perform certain operations during the freezing phase. In some cases, these operations can take longer than freeze_timeout_msecs to complete. To allow such drivers to limit their work appropriately and transition to the frozen state before the timeout expires, export freeze_timeout_msecs so that it can be referenced by other kernel components.

---
 kernel/power/process.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/power/process.c +2 -0
index dc0dfc349f22..5ddfd645b522 100644
@@ -25,6 +25,8 @@
  */
 unsigned int __read_mostly freeze_timeout_msecs = 20 * MSEC_PER_SEC;
 
+EXPORT_SYMBOL(freeze_timeout_msecs);
+
 static int try_to_freeze_tasks(bool user_only)
 {
 	const char *what = user_only ? "user space processes" :
Signature · 1 line
2.43.0
#1 lore raw
Quoted 7 lines · Dongbum Kim

Add EXPORT_SYMBOL() to mark freeze_timeout_msecs symbol as visible.

freeze_timeout_msecs defines the timeout for try_to_freeze_tasks. If tasks cannot be frozen within this timeout, try_to_freeze_tasks fails, and causes suspend or hibernation to fail.

For example, a device driver may need to perform certain operations

I think you really should know that:

a) exports without users are a complete no-go, and sending them is considered a major offence
b) even with users, exporting data (variables) is generally a bad idea
c) non-GPL exports for new functionality are almost always a bad idea

if not please take this up with your corporate and technical leadership to ensure the Linux training standards at LG are up to date.

#2 lore raw
Quoted 1 line · Christoph Hellwig

...

Hello,

Thanks for the feedback.
I agree that exporting freeze_timeout_msecs variable is not right way.

The real issue is that the driver thread cannot be frozen until timeout expired for try_to_freeze_tasks. I think freeze_timeout_msecs value is necessary for all module, including non-GPL modules, to prevent to fail try_to_freeze_tasks.

I will reconsider the approach.

Thanks,
Dongbum.