2019-01-29 16:50:24

by Tony Lindgren

[permalink] [raw]
Subject: New underflow of regulator enable count warnings in v5.0-rc1

Hi,

Looks like commit 5451781dadf8 ("regulator: core: Only count load for
enabled consumers") started showing new warnings with v5.0-rc cycle:

regulator-dummy: Underflow of regulator enable count

I'm seeing this at least with my pwm-vibra test case:

# rumble-test /dev/input/by-path/platform-vibrator-event 0xffff
pwm-vibrator vibrator: vibrator supply vcc not found, using dummy regulator
input: pwm-vibrator as /devices/platform/vibrator/input/input4
regulator-dummy: Underflow of regulator enable count
Upload rumble effect... id=0
regulator-dummy: Underflow of regulator enable count

Are these bogus warnings for dummy regulator or do we have
real unpaired regulator calls or somewhere?

Regards,

Tony


2019-01-29 17:03:57

by Mark Brown

[permalink] [raw]
Subject: Re: New underflow of regulator enable count warnings in v5.0-rc1

On Tue, Jan 29, 2019 at 08:48:13AM -0800, Tony Lindgren wrote:

> regulator-dummy: Underflow of regulator enable count

> Are these bogus warnings for dummy regulator or do we have
> real unpaired regulator calls or somewhere?

Given that this is a new warning my first guess would be that it's
legitimate...


Attachments:
(No filename) (318.00 B)
signature.asc (499.00 B)
Download all attachments

2019-01-29 17:05:47

by Doug Anderson

[permalink] [raw]
Subject: Re: New underflow of regulator enable count warnings in v5.0-rc1

Hi,

On Tue, Jan 29, 2019 at 8:48 AM Tony Lindgren <[email protected]> wrote:
>
> Hi,
>
> Looks like commit 5451781dadf8 ("regulator: core: Only count load for
> enabled consumers") started showing new warnings with v5.0-rc cycle:
>
> regulator-dummy: Underflow of regulator enable count
>
> I'm seeing this at least with my pwm-vibra test case:
>
> # rumble-test /dev/input/by-path/platform-vibrator-event 0xffff
> pwm-vibrator vibrator: vibrator supply vcc not found, using dummy regulator
> input: pwm-vibrator as /devices/platform/vibrator/input/input4
> regulator-dummy: Underflow of regulator enable count
> Upload rumble effect... id=0
> regulator-dummy: Underflow of regulator enable count
>
> Are these bogus warnings for dummy regulator or do we have
> real unpaired regulator calls or somewhere?

My first guess is that there's a real unpaired regulator call somewhere.

I actually meant to include this in the commit message, but I'm an
idiot and I used "--" to break up the parts of the commit message
which confused git when Mark applied it. Sigh. For the full commit
message, see:

https://lkml.kernel.org/r/[email protected]

In that message I said:

> - We can (and will) spit errors out for code that used to be invalid
> but was never caught before. Specifically if someone leaves a
> regulator enabled and calls regulator_put() we'll yell. We'll also
> yell if a single consumer calls more disables than enables.

Looking quickly at 'pwm-vibra.c' it wouldn't surprise me at all if you
call regulator_disable() more times than regulator_enable(). If
that's true it should be fixed.

-Doug

2019-01-29 17:13:29

by Tony Lindgren

[permalink] [raw]
Subject: Re: New underflow of regulator enable count warnings in v5.0-rc1

* Doug Anderson <[email protected]> [190129 17:05]:
> Hi,
>
> On Tue, Jan 29, 2019 at 8:48 AM Tony Lindgren <[email protected]> wrote:
> >
> > Hi,
> >
> > Looks like commit 5451781dadf8 ("regulator: core: Only count load for
> > enabled consumers") started showing new warnings with v5.0-rc cycle:
> >
> > regulator-dummy: Underflow of regulator enable count
> >
> > I'm seeing this at least with my pwm-vibra test case:
> >
> > # rumble-test /dev/input/by-path/platform-vibrator-event 0xffff
> > pwm-vibrator vibrator: vibrator supply vcc not found, using dummy regulator
> > input: pwm-vibrator as /devices/platform/vibrator/input/input4
> > regulator-dummy: Underflow of regulator enable count
> > Upload rumble effect... id=0
> > regulator-dummy: Underflow of regulator enable count
> >
> > Are these bogus warnings for dummy regulator or do we have
> > real unpaired regulator calls or somewhere?
>
> My first guess is that there's a real unpaired regulator call somewhere.
>
> I actually meant to include this in the commit message, but I'm an
> idiot and I used "--" to break up the parts of the commit message
> which confused git when Mark applied it. Sigh. For the full commit
> message, see:
>
> https://lkml.kernel.org/r/[email protected]

Oh I see, thanks for the link :)

> In that message I said:
>
> > - We can (and will) spit errors out for code that used to be invalid
> > but was never caught before. Specifically if someone leaves a
> > regulator enabled and calls regulator_put() we'll yell. We'll also
> > yell if a single consumer calls more disables than enables.
>
> Looking quickly at 'pwm-vibra.c' it wouldn't surprise me at all if you
> call regulator_disable() more times than regulator_enable(). If
> that's true it should be fixed.

OK. Let's see if Sebastian spots where pwm_vibrator_start()
and pwm_vibrator_stop() might get called multiple times
or something similar.

Regards,

Tony

2019-01-29 17:16:41

by Mark Brown

[permalink] [raw]
Subject: Re: New underflow of regulator enable count warnings in v5.0-rc1

On Tue, Jan 29, 2019 at 09:11:51AM -0800, Tony Lindgren wrote:

> OK. Let's see if Sebastian spots where pwm_vibrator_start()
> and pwm_vibrator_stop() might get called multiple times
> or something similar.

Given that nobody has noticed that the driver stops working entirely
it's possible that the pattern is something like:


pwm_vibrator_start()
pwm_vibrator_stop()
pwm_vibrator_stop()
pwm_vibrator_start()

so it's a temporary underflow that gets corrected (or it could be that
not many people are using mainline kernels on these systems). On your
system it's the dummy driver but presumably some other users have it
connected to actual regulators.


Attachments:
(No filename) (691.00 B)
signature.asc (499.00 B)
Download all attachments

2019-01-29 17:19:22

by Tony Lindgren

[permalink] [raw]
Subject: Re: New underflow of regulator enable count warnings in v5.0-rc1

* Mark Brown <[email protected]> [190129 17:15]:
> On Tue, Jan 29, 2019 at 09:11:51AM -0800, Tony Lindgren wrote:
>
> > OK. Let's see if Sebastian spots where pwm_vibrator_start()
> > and pwm_vibrator_stop() might get called multiple times
> > or something similar.
>
> Given that nobody has noticed that the driver stops working entirely
> it's possible that the pattern is something like:
>
>
> pwm_vibrator_start()
> pwm_vibrator_stop()
> pwm_vibrator_stop()
> pwm_vibrator_start()
>
> so it's a temporary underflow that gets corrected (or it could be that
> not many people are using mainline kernels on these systems). On your
> system it's the dummy driver but presumably some other users have it
> connected to actual regulators.

Yeah that makes sense.

Regards,

Tony

2019-01-29 17:20:15

by Sebastian Reichel

[permalink] [raw]
Subject: Re: New underflow of regulator enable count warnings in v5.0-rc1

Hi,

On Tue, Jan 29, 2019 at 08:48:13AM -0800, Tony Lindgren wrote:
> Looks like commit 5451781dadf8 ("regulator: core: Only count load for
> enabled consumers") started showing new warnings with v5.0-rc cycle:
>
> regulator-dummy: Underflow of regulator enable count
>
> I'm seeing this at least with my pwm-vibra test case:
>
> # rumble-test /dev/input/by-path/platform-vibrator-event 0xffff
> pwm-vibrator vibrator: vibrator supply vcc not found, using dummy regulator
> input: pwm-vibrator as /devices/platform/vibrator/input/input4
> regulator-dummy: Underflow of regulator enable count
> Upload rumble effect... id=0
> regulator-dummy: Underflow of regulator enable count
>
> Are these bogus warnings for dummy regulator or do we have
> real unpaired regulator calls or somewhere?

There are real unpaired regulator calls in the pwm-vibrator driver,
that I did not notice when I wrote the driver :(. Good news is, that
Paweł Chmiel and Jonathan Bakker are already working on fixing my mess:

https://lore.kernel.org/patchwork/patch/1032759/

On Droid 4 it's a dummy regulator, since I did not know what
regulator is being used to supply the vibrator. Probably directly
from the battery.

-- Sebastian


Attachments:
(No filename) (1.21 kB)
signature.asc (849.00 B)
Download all attachments

2019-01-29 17:29:08

by Tony Lindgren

[permalink] [raw]
Subject: Re: New underflow of regulator enable count warnings in v5.0-rc1

* Sebastian Reichel <[email protected]> [190129 17:18]:
> Hi,
>
> On Tue, Jan 29, 2019 at 08:48:13AM -0800, Tony Lindgren wrote:
> > Looks like commit 5451781dadf8 ("regulator: core: Only count load for
> > enabled consumers") started showing new warnings with v5.0-rc cycle:
> >
> > regulator-dummy: Underflow of regulator enable count
> >
> > I'm seeing this at least with my pwm-vibra test case:
> >
> > # rumble-test /dev/input/by-path/platform-vibrator-event 0xffff
> > pwm-vibrator vibrator: vibrator supply vcc not found, using dummy regulator
> > input: pwm-vibrator as /devices/platform/vibrator/input/input4
> > regulator-dummy: Underflow of regulator enable count
> > Upload rumble effect... id=0
> > regulator-dummy: Underflow of regulator enable count
> >
> > Are these bogus warnings for dummy regulator or do we have
> > real unpaired regulator calls or somewhere?
>
> There are real unpaired regulator calls in the pwm-vibrator driver,
> that I did not notice when I wrote the driver :(. Good news is, that
> Paweł Chmiel and Jonathan Bakker are already working on fixing my mess:
>
> https://lore.kernel.org/patchwork/patch/1032759/

OK good to hear.

> On Droid 4 it's a dummy regulator, since I did not know what
> regulator is being used to supply the vibrator. Probably directly
> from the battery.

Yeah no idea.. Hmm maybe it's actually using the VVIB on the pmic?

Regards,

Tony