lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
 <TY3PR01MB11346A7B16CB3267F1A57302B86DBA@TY3PR01MB11346.jpnprd01.prod.outlook.com>
Date: Mon, 1 Dec 2025 17:56:59 +0000
From: Biju Das <biju.das.jz@...renesas.com>
To: geert <geert@...ux-m68k.org>
CC: Uwe Kleine-König <ukleinek@...nel.org>, biju.das.au
	<biju.das.au@...il.com>, Philipp Zabel <p.zabel@...gutronix.de>,
	"linux-pwm@...r.kernel.org" <linux-pwm@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Geert
 Uytterhoeven <geert+renesas@...der.be>, Prabhakar Mahadev Lad
	<prabhakar.mahadev-lad.rj@...renesas.com>,
	"linux-renesas-soc@...r.kernel.org" <linux-renesas-soc@...r.kernel.org>,
	"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>
Subject: RE: [PATCH v3 6/8] pwm: rzg2l-gpt: Add suspend/resume support

Hi Geert,

> -----Original Message-----
> From: Geert Uytterhoeven <geert@...ux-m68k.org>
> Sent: 01 December 2025 16:04
> Subject: Re: [PATCH v3 6/8] pwm: rzg2l-gpt: Add suspend/resume support
> 
> Hi Biju,
> 
> On Mon, 1 Dec 2025 at 16:50, Biju Das <biju.das.jz@...renesas.com> wrote:
> > > From: Uwe Kleine-König <ukleinek@...nel.org> On Mon, Dec 01, 2025 at
> > > 03:04:08PM +0000, Biju Das wrote:
> > > > You mean to avoid unbalance between suspend()/resume(), we should
> > > > not do error handling in resume()??
> > >
> > > Consider the following resume function:
> > >
> > >       static int myresume(...)
> > >       {
> > >               ret = enable_some_resource(...);
> > >               if (ret)
> > >                       return ret;
> > >
> > >               ret = enable_some_other_resource(...)
> > >               if (ret) {
> > >                       disable_some_resource();
> > >                       return ret;
> > >
> > >               }
> > >
> > >               return 0;
> > >       }
> > >
> > > If disable_some_resource() can fail it might happen that the first
> > > call to myresume() is left with some_resource enabled and
> > > some_other_resource disabled (i.e. if both
> > > enable_some_other_resource() and
> > > disable_some_resource() fail). Now if the resume is retried
> > > some_resource is enabled a second time without being tracked and a
> > > later suspend (or remove) won't bring the enable count to 0 and thus leak a resource.
> >
> > OK, what about for making balanced usage count for suspend()/resume()
> > to avoid resource like below
> >
> > static int myresume(...)
> > {
> >         ret = enable_some_resource(...);
> >         ret |= enable_some_other_resource(...);
> >
> >         return ret;
> > }
> >
> > static int mysuspend(...)
> > {
> >         disable_some_resource(...);
> >         disable_some_other_resource(...)
> 
> What do you do when one of the disabling fails? See also
> https://lore.kernel.org/CAMuHMdWDGpqdhCsA0MJqoL1JAiyVR-TA2YqDe+-S9Xf6c5O-gA@mail.gmail.com


OK in mysuspend()

Case 1)
If I just return error without calling myresume(), I get kernel crash due to synchronous external abort [1]

Case 2)
If I just return error with calling myresume(), Then instead of power saving, it is consuming power which is not good.
The system will never enter into suspend state and you will keep draining the battery[2].

Case 3)
  No error handling in suspend. The device will enter into suspend state and save power[3]

Which one you will select for a product that requires Low PM support?


[1]
[   36.688050]  __wake_up_klogd+0xf8/0x100 (P)
[   36.692321]  bust_spinlocks+0x4c/0x60
[   36.696065]  die+0xd8/0x15c
[   36.698925]  arm64_notify_die+0xb4/0xcc
[   36.702831]  do_sea+0x7c/0xc0
[   36.705877]  do_mem_abort+0x40/0x90
[   36.709445]  el1_abort+0x44/0x68
[   36.712748]  el1h_64_sync_handler+0x50/0xac
[   36.717009]  el1h_64_sync+0x6c/0x70
[   36.720561]  rzg2l_gpt_write_waveform+0x188/0x378 [pwm_rzg2l_gpt] (P)
[   36.727081]  __pwm_apply+0xec/0x220
[   36.730637]  pwm_apply_might_sleep+0x48/0xb8
[   36.734972]  pwm_class_resume_npwm+0x68/0x114
[   36.739396]  pwm_class_resume+0x14/0x20
[   36.743297]  device_resume+0xc8/0x1c4
[   36.747024]  dpm_resume+0x184/0x200
[   36.750577]  dpm_resume_end+0x18/0x34
[   36.754304]  suspend_devices_and_enter+0x540/0x590
[   36.759164]  pm_suspend+0x194/0x1c0


[2]
root@...rc-rzg3e:~# /pwm-pm-test.sh
16
pwmchip0

[   47.933956] kauditd_printk_skb: 5 callbacks suppressed
[   47.933972] audit: type=1334 audit(946684833.460:22): prog-id=18 op=UNLOAD
[   47.946017] audit: type=1334 audit(946684833.460:23): prog-id=17 op=UNLOAD
[   47.952894] audit: type=1334 audit(946684833.460:24): prog-id=16 op=UNLOAD
### Executing ST[   47.960409] PM: suspend entry (deep)
R ###
[   47.965220] Filesystems sync: 0.000 seconds
[   47.971883] Freezing user space processes
[   47.977739] Freezing user space processes completed (elapsed 0.001 seconds)
[   47.984772] OOM killer disabled.
[   47.988065] Freezing remaining freezable tasks
[   47.993681] Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
[   48.001143] printk: Suspending console(s) (use no_console_suspend to debug)
[   48.077166] renesas-gbeth 15c30000.ethernet end0: Link is Down
[   48.081846] pwm-rzg2l-gpt 13010000.pwm: PM: dpm_run_callback(): rzg2l_gpt_suspend [pwm_rzg2l_gpt] returns -110
[   48.081937] pwm-rzg2l-gpt 13010000.pwm: PM: failed to suspend: error -110
[   48.082157] PM: Some devices failed to suspend, or early wake event detected
[   48.091749] dwmac4: Master AXI performs any burst length
[   48.091829] renesas-gbeth 15c30000.ethernet end0: No Safety Features support found
[   48.091924] renesas-gbeth 15c30000.ethernet end0: IEEE 1588-2008 Advanced Timestamp supported
[   48.092073] renesas-gbeth 15c30000.ethernet end0: configuring for phy/rgmii-id link mode
[   48.100718] dwmac4: Master AXI performs any burst length
[   48.100791] renesas-gbeth 15c40000.ethernet end1: No Safety Features support found
[   48.100875] renesas-gbeth 15c40000.ethernet end1: IEEE 1588-2008 Advanced Timestamp supported
[   48.101016] renesas-gbeth 15c40000.ethernet end1: configuring for phy/rgmii-id link mode
[   48.149094] usb usb1: root hub lost power or was reset
[   48.149136] usb usb2: root hub lost power or was reset
[   48.361219] OOM killer enabled.
[   48.364360] Restarting tasks: Starting
[   48.369495] Restarting tasks: Done
[   48.372943] random: crng reseeded on system resumption
/pwm-pm-test.sh:[   48.381284] PM: suspend exit
 line 28: echo: write error: Connection timed out
[   51.084906] renesas-gbeth 15c30000.ethernet end0: Link is Up - 1Gbps/Full - flow control rx/tx

[3]

root@...rc-rzg3e:~# /pwm-pm-test.sh
16
pwmchip0

### Executing ST[   37.479425] PM: suspend entry (deep)
R ###
[   37.484608] Filesystems sync: 0.000 seconds
[   37.491401] Freezing user space processes
[   37.497447] Freezing user space processes completed (elapsed 0.006 seconds)
[   37.504433] OOM killer disabled.
[   37.507686] Freezing remaining freezable tasks
[   37.590923] Freezing remaining freezable tasks completed (elapsed 0.078 seconds)
[   37.598384] printk: Suspending console(s) (use no_console_suspend to debug)
NOTICE:  BL2: v2.10.5(release):2.10.5/rz_soc_dev-329-gb288fa6dd
NOTICE:  BL2: Built : 12:27:28, Nov 28 2025
NOTICE:  BL2: SYS_LSI_MODE: 0x13e06
NOTICE:  BL2: SYS_LSI_DEVID: 0x8679447
NOTICE:  BL2: SYS_LSI_PRR: 0x0
NOTICE:  BL2: Booting BL31
[   37.690878] renesas-gbeth 15c30000.ethernet end0: Link is Down
[   37.705986] Disabling non-boot CPUs ...
[   37.710845] psci: CPU3 killed (polled 0 ms)
[   37.717361] psci: CPU2 killed (polled 0 ms)
[   37.725595] psci: CPU1 killed (polled 4 ms)
[   37.728222] Enabling non-boot CPUs ...
[   37.728432] Detected VIPT I-cache on CPU1
[   37.728478] GICv3: CPU1: found redistributor 100 region 0:0x0000000014960000
[   37.728516] CPU1: Booted secondary processor 0x0000000100 [0x412fd050]
[   37.729355] CPU1 is up
[   37.729648] Detected VIPT I-cache on CPU2
[   37.729669] GICv3: CPU2: found redistributor 200 region 0:0x0000000014980000
[   37.729690] CPU2: Booted secondary processor 0x0000000200 [0x412fd050]
[   37.730268] CPU2 is up
[   37.730377] Detected VIPT I-cache on CPU3
[   37.730399] GICv3: CPU3: found redistributor 300 region 0:0x00000000149a0000
[   37.730420] CPU3: Booted secondary processor 0x0000000300 [0x412fd050]
[   37.731153] CPU3 is up
[   37.749385] dwmac4: Master AXI performs any burst length
[   37.749421] renesas-gbeth 15c30000.ethernet end0: No Safety Features support found
[   37.749462] renesas-gbeth 15c30000.ethernet end0: IEEE 1588-2008 Advanced Timestamp supported
[   37.749530] renesas-gbeth 15c30000.ethernet end0: configuring for phy/rgmii-id link mode
[   37.766503] dwmac4: Master AXI performs any burst length
[   37.766531] renesas-gbeth 15c40000.ethernet end1: No Safety Features support found
[   37.766561] renesas-gbeth 15c40000.ethernet end1: IEEE 1588-2008 Advanced Timestamp supported
[   37.766622] renesas-gbeth 15c40000.ethernet end1: configuring for phy/rgmii-id link mode
[   37.813464] usb usb1: root hub lost power or was reset
[   37.813472] usb usb2: root hub lost power or was reset
[   38.076433] OOM killer enabled.
[   38.079571] Restarting tasks: Starting
[   38.083776] Restarting tasks: Done
[   38.087255] random: crng reseeded on system resumption
[   38.092509] PM: suspend exit
root@...rc-rzg3e:~# [   40.337013] renesas-gbeth 15c30000.ethernet end0: Link is Up - 1Gbps/Full - flow control rx/tx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ