2007-10-30 20:25:50

by Andrey Borzenkov

[permalink] [raw]
Subject: [2.6.24-rc1 regression] AC adapter state does not change after resume

I suspect new ACPI AC adapter code but have to add some printk's to be sure.

To reproduce - plug in AC cord, suspend, unplug, resume - kpowersave and sysfs
still show AC adapter online. Or other way round.

-andrey


Attachments:
(No filename) (217.00 B)
signature.asc (189.00 B)
This is a digitally signed message part.
Download all attachments

2007-10-30 20:37:19

by Alexey Starikovskiy

[permalink] [raw]
Subject: Re: [2.6.24-rc1 regression] AC adapter state does not change after resume

Andrey Borzenkov wrote:
> I suspect new ACPI AC adapter code but have to add some printk's to be sure.
>
> To reproduce - plug in AC cord, suspend, unplug, resume - kpowersave and sysfs
> still show AC adapter online. Or other way round.
>
> -andrey
The only change to drivers/acpi/ac.c after .23 was d5b4a3d0efa36de31b86d5677dad6c36cb8735d7.
Don't see how it could lead to less messages from AC.

Regards,
Alex.

2007-10-30 21:08:37

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [2.6.24-rc1 regression] AC adapter state does not change after resume

On Tuesday, 30 October 2007 21:24, Andrey Borzenkov wrote:
> I suspect new ACPI AC adapter code but have to add some printk's to be sure.
>
> To reproduce - plug in AC cord, suspend, unplug, resume - kpowersave and sysfs
> still show AC adapter online. Or other way round.

Is this a resume from RAM or from disk?

Does 2.6.23 work correctly?

Rafael

2007-10-30 21:09:56

by Alexey Starikovskiy

[permalink] [raw]
Subject: Re: [2.6.24-rc1 regression] AC adapter state does not change after resume

Andrey Borzenkov wrote:
> I suspect new ACPI AC adapter code but have to add some printk's to be sure.
>
> To reproduce - plug in AC cord, suspend, unplug, resume - kpowersave and sysfs
> still show AC adapter online. Or other way round.
>
> -andrey
Please check if this patch helps.

Regards,
Alex.


Attachments:
update_ac_state_on_sysfs_read.patch (642.00 B)

2007-10-31 04:09:23

by Andrey Borzenkov

[permalink] [raw]
Subject: Re: [2.6.24-rc1 regression] AC adapter state does not change after resume

On Wednesday 31 October 2007, Alexey Starikovskiy wrote:
> Andrey Borzenkov wrote:
> > I suspect new ACPI AC adapter code but have to add some printk's to be
> > sure.
> >
> > To reproduce - plug in AC cord, suspend, unplug, resume - kpowersave and
> > sysfs still show AC adapter online. Or other way round.
> >
> > -andrey
>
> Please check if this patch helps.
>

It does not even compile :)

On serious note (after adding forward declaration) - patch half works. It does
make "online" return true value (which confirms that underlying ACPI works
correctly) but HAL still does not notice it.

The problem is, with power_supply interface HAL does not use polling, it
relies on CHANGE event. This event is apparently never generated if AC
adapter state changes on resume. So the obvious fix is to compare AC state
before and after suspend in ->resume function and generate synthetic CHANGE
event if something has changed.

This will also make superfluous polling redundant.


Attachments:
(No filename) (980.00 B)
signature.asc (189.00 B)
This is a digitally signed message part.
Download all attachments

2007-10-31 04:20:24

by Andrey Borzenkov

[permalink] [raw]
Subject: Re: [2.6.24-rc1 regression] AC adapter state does not change after resume

On Wednesday 31 October 2007, Rafael J. Wysocki wrote:
> On Tuesday, 30 October 2007 21:24, Andrey Borzenkov wrote:
> > I suspect new ACPI AC adapter code but have to add some printk's to be
> > sure.
> >
> > To reproduce - plug in AC cord, suspend, unplug, resume - kpowersave and
> > sysfs still show AC adapter online. Or other way round.
>
> Is this a resume from RAM or from disk?
>

RAM

> Does 2.6.23 work correctly?
>

yes


Attachments:
(No filename) (431.00 B)
signature.asc (189.00 B)
This is a digitally signed message part.
Download all attachments

2007-10-31 06:27:49

by Alexey Starikovskiy

[permalink] [raw]
Subject: Re: [2.6.24-rc1 regression] AC adapter state does not change after resume

Andrey Borzenkov wrote:
> On Wednesday 31 October 2007, Alexey Starikovskiy wrote:
>> Andrey Borzenkov wrote:
>>> I suspect new ACPI AC adapter code but have to add some printk's to be
>>> sure.
>>>
>>> To reproduce - plug in AC cord, suspend, unplug, resume - kpowersave and
>>> sysfs still show AC adapter online. Or other way round.
>>>
>>> -andrey
>> Please check if this patch helps.
>>
>
> It does not even compile :)
>
> On serious note (after adding forward declaration) - patch half works. It does
> make "online" return true value (which confirms that underlying ACPI works
> correctly) but HAL still does not notice it.
>
> The problem is, with power_supply interface HAL does not use polling, it
> relies on CHANGE event. This event is apparently never generated if AC
> adapter state changes on resume. So the obvious fix is to compare AC state
> before and after suspend in ->resume function and generate synthetic CHANGE
> event if something has changed.
>
> This will also make superfluous polling redundant.
Ok, here. This one compiles :)

Regards,
Alex.


Attachments:
update_ac_state_on_sysfs_read.patch (1.53 kB)

2007-11-01 18:44:32

by Andrey Borzenkov

[permalink] [raw]
Subject: Re: [2.6.24-rc1 regression] AC adapter state does not change after resume

On Wednesday 31 October 2007, Alexey Starikovskiy wrote:
> Andrey Borzenkov wrote:
> > On Wednesday 31 October 2007, Alexey Starikovskiy wrote:
> >> Andrey Borzenkov wrote:
> >>> I suspect new ACPI AC adapter code but have to add some printk's to be
> >>> sure.
> >>>
> >>> To reproduce - plug in AC cord, suspend, unplug, resume - kpowersave
> >>> and sysfs still show AC adapter online. Or other way round.
> >>>
> >>> -andrey
> >>
> >> Please check if this patch helps.
> >
> > It does not even compile :)
> >
> > On serious note (after adding forward declaration) - patch half works. It
> > does make "online" return true value (which confirms that underlying ACPI
> > works correctly) but HAL still does not notice it.
> >
> > The problem is, with power_supply interface HAL does not use polling, it
> > relies on CHANGE event. This event is apparently never generated if AC
> > adapter state changes on resume. So the obvious fix is to compare AC
> > state before and after suspend in ->resume function and generate
> > synthetic CHANGE event if something has changed.
> >
> > This will also make superfluous polling redundant.
>
> Ok, here. This one compiles :)
>

For HAL regression:

Tested-by: Andrey Borzenkov <[email protected]>

But the patch is incomplete. This synthetic event should be the same as if OS
were running; i.e. you should send both other events as well. As is you just
create latent bug to be hit by some netlink consumer sooner or later.


Attachments:
(No filename) (1.43 kB)
signature.asc (189.00 B)
This is a digitally signed message part.
Download all attachments