Kernel panic when unpluggin AC adaptor

2010-05-03 Thread David DEMELIER
Hi,

I just updated my 8.0-STABLE/amd64 today around 17h CEST, and it just
panics when I unplug my AC.  The current process = 11 (idle: cpu1) is
this related to the cpufreq and related stuff ?

It also says cannot dump. Device not defined or unavailable so I can't
give you more infos now.

King regards.

-- 
Demelier David
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-06-12 Thread David DEMELIER
2010/6/11 John Baldwin :
> On Friday 11 June 2010 6:27:48 am Giovanni Trematerra wrote:
>> On Thu, Jun 10, 2010 at 10:58 PM, Giovanni Trematerra
>>  wrote:
>> > On Tue, May 4, 2010 at 6:35 PM, David DEMELIER 
> wrote:
>> >> Good news ! It worked, check the picture here :
>> >>
>> >> http://img63.imageshack.us/img63/4244/dsc00361g.jpg
>> >>
>> >
>> > Into the file sys/dev/acpica/acpi_cpu.c at the end of acpi_cpu_notify
>> > (a per cpu notification handler), called when _CST objects changing,
>> > global cpu_cx_count is set to the greatest value of all sc->cpu_cx_count
>> > per-cpu variables. That could result in a panic as David reported,
>> > because that lets to invoke acpi_cpu_global_cx_lowest_sysctl from
>> > /etc/rc.d/power_profile, when AC adapter is unplugged,  with a value
>> > that not all the CPUs could handle in the acpi_cpu_idle.
>> > The patch also change global cpu_cx_lowest according to new value of
>> > global cpu_cx_count if needed.
>> >
>> > David Demelier made a great work to test every patch I sent him
>> > to identify the source of the problem.
>> >
>> > Please, let me know your comments and possibly commit the patch
>> > if you think is good enough.
>>
>> As jhb@ pointed me out in private with the previous patch a CPU could
>> never enter in the
>> lowest Cx-state even if it gained.
>> So I'd like to propose this new solution.
>> When hw.acpi.cpu.cx_lowest sysctl is set, the global handler in
>> sys/dev/acpi_cpu.c
>> will set the greatest sc->cpu_cx_lowest value supported by the CPU and
>> not the same
>> value for all CPUs.
>> Later, when CPU, possibly gain new Cx-states, the acpi_cpu_notify
>> handler will set
>> sc->cpu_cx_lowest accordingly with global cx_lowest and the Cx-states
>> supported by
>> the CPU.
>>
>> Now I think that /etc/rc.d/power_profile script has a problem but that
>> is a different story.
>> The script select the lowest_value only querying cx-states of the dev.cpu.0.
>> If different CPUs may have different Cx-states, the script should use
>> as lowest_value the
>> lowest value between all the CPUs.
>
> Yes.
>
>> Please, let me know your comments and possibly commit the patch
>> if you think is good enough.
>
> I think this is a good compromise for now.
>
> --
> John Baldwin
>

Thanks for Giovanni's patience and work, he made a lot of research to
solve this little problem :-).

Is there a chance that this patch appears in 8.1-RELEASE ?

Kind regards.

-- 
Demelier David
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-06-12 Thread Brandon Gooch
On Sat, Jun 12, 2010 at 12:19 PM, David DEMELIER
 wrote:
> 2010/6/11 John Baldwin :
>> On Friday 11 June 2010 6:27:48 am Giovanni Trematerra wrote:
>>> On Thu, Jun 10, 2010 at 10:58 PM, Giovanni Trematerra
>>>  wrote:
>>> > On Tue, May 4, 2010 at 6:35 PM, David DEMELIER 
>> wrote:
>>> >> Good news ! It worked, check the picture here :
>>> >>
>>> >> http://img63.imageshack.us/img63/4244/dsc00361g.jpg
>>> >>
>>> >
>>> > Into the file sys/dev/acpica/acpi_cpu.c at the end of acpi_cpu_notify
>>> > (a per cpu notification handler), called when _CST objects changing,
>>> > global cpu_cx_count is set to the greatest value of all sc->cpu_cx_count
>>> > per-cpu variables. That could result in a panic as David reported,
>>> > because that lets to invoke acpi_cpu_global_cx_lowest_sysctl from
>>> > /etc/rc.d/power_profile, when AC adapter is unplugged,  with a value
>>> > that not all the CPUs could handle in the acpi_cpu_idle.
>>> > The patch also change global cpu_cx_lowest according to new value of
>>> > global cpu_cx_count if needed.
>>> >
>>> > David Demelier made a great work to test every patch I sent him
>>> > to identify the source of the problem.
>>> >
>>> > Please, let me know your comments and possibly commit the patch
>>> > if you think is good enough.
>>>
>>> As jhb@ pointed me out in private with the previous patch a CPU could
>>> never enter in the
>>> lowest Cx-state even if it gained.
>>> So I'd like to propose this new solution.
>>> When hw.acpi.cpu.cx_lowest sysctl is set, the global handler in
>>> sys/dev/acpi_cpu.c
>>> will set the greatest sc->cpu_cx_lowest value supported by the CPU and
>>> not the same
>>> value for all CPUs.
>>> Later, when CPU, possibly gain new Cx-states, the acpi_cpu_notify
>>> handler will set
>>> sc->cpu_cx_lowest accordingly with global cx_lowest and the Cx-states
>>> supported by
>>> the CPU.
>>>
>>> Now I think that /etc/rc.d/power_profile script has a problem but that
>>> is a different story.
>>> The script select the lowest_value only querying cx-states of the dev.cpu.0.
>>> If different CPUs may have different Cx-states, the script should use
>>> as lowest_value the
>>> lowest value between all the CPUs.
>>
>> Yes.
>>
>>> Please, let me know your comments and possibly commit the patch
>>> if you think is good enough.
>>
>> I think this is a good compromise for now.
>>
>> --
>> John Baldwin
>>
>
> Thanks for Giovanni's patience and work, he made a lot of research to
> solve this little problem :-).
>
> Is there a chance that this patch appears in 8.1-RELEASE ?
>
> Kind regards.
>
> --
> Demelier David
>

Someone would have to discuss with the Release Engineering team, but
it would be cool :)

-Brandon
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-03 Thread David DEMELIER
2010/5/3 David DEMELIER :
> Hi,
>
> I just updated my 8.0-STABLE/amd64 today around 17h CEST, and it just
> panics when I unplug my AC.  The current process = 11 (idle: cpu1) is
> this related to the cpufreq and related stuff ?
>
> It also says cannot dump. Device not defined or unavailable so I can't
> give you more infos now.
>

I can confirm that :

#performance_cx_lowest="HIGH"
#performance_cpu_freq=${performance_cx_lowest}
#economy_cx_lowest="LOW"
#economy_cpu_freq=${economy_cx_lowest}

in rc.conf was the problem.

-- 
Demelier David
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-03 Thread Garrett Cooper
On Mon, May 3, 2010 at 2:57 PM, David DEMELIER  wrote:
> 2010/5/3 David DEMELIER :
>> Hi,
>>
>> I just updated my 8.0-STABLE/amd64 today around 17h CEST, and it just
>> panics when I unplug my AC.  The current process = 11 (idle: cpu1) is
>> this related to the cpufreq and related stuff ?
>>
>> It also says cannot dump. Device not defined or unavailable so I can't
>> give you more infos now.
>>
>
> I can confirm that :
>
> #performance_cx_lowest="HIGH"
> #performance_cpu_freq=${performance_cx_lowest}
> #economy_cx_lowest="LOW"
> #economy_cpu_freq=${economy_cx_lowest}
>
> in rc.conf was the problem.

Set dumpdev in /boot/loader.conf to your swap device, reboot, and
then try to reproduce the issue.
Cheers,
-Garrett
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-03 Thread Brandon Gooch
On Mon, May 3, 2010 at 4:57 PM, David DEMELIER  wrote:
> 2010/5/3 David DEMELIER :
>> Hi,
>>
>> I just updated my 8.0-STABLE/amd64 today around 17h CEST, and it just
>> panics when I unplug my AC.  The current process = 11 (idle: cpu1) is
>> this related to the cpufreq and related stuff ?
>>
>> It also says cannot dump. Device not defined or unavailable so I can't
>> give you more infos now.
>>
>
> I can confirm that :
>
> #performance_cx_lowest="HIGH"
> #performance_cpu_freq=${performance_cx_lowest}
> #economy_cx_lowest="LOW"
> #economy_cpu_freq=${economy_cx_lowest}
>
> in rc.conf was the problem.

Can you get a backtrace? I've been experiencing something strange
lately after applying optimization settings from:

http://wiki.freebsd.org/TuningPowerConsumption

I can't get a useful dump either, the machine is idle, and the
backtrace is strange to me:

db> show allpcpu

Current CPU: 0

cpuid= 0
dynamic pcpu= 0x692d00
curthread= 0xff0001507390: pid 11 "idle: cpu0"
curpcb   = 0xff839d40
fpcurthread  = none
idlethread   = 0xff0001507390: pid 11 "idle: cpu0"
curpmap = 0
tssp= 0x80840580
commontssp  = 0x80840580
rsp0= 0xff839d40
gs32p   = 0x8083f3b8
ldt = 0x8083f3f8
tss = 0x8083f3e8

cpuid= 1
dynamic pcpu= 0xff807f85ed00
curthread= 0xff0001507720: pid 11 "idle: cpu1"
curpcb   = 0xff834d40
fpcurthread  = none
idlethread   = 0xff0001507720: pid 11 "idle: cpu1"
curpmap = 0
tssp= 0x808405e8
commontssp  = 0x808405e8
rsp0= 0xff834d40
gs32p   = 0x8083f420
ldt = 0x8083f460
tss = 0x8083f450

db> bt

Tracing pid 11 tid 14 td 0xff0001507390
rman_get_bushandle() at rman_get_bushandle+0x1
sched_idletd() at sched_idletd+0x123
fork_exit() at fork_exit+0x118
fork_trampoline() at fork_trampoline+0xe
--- trap 0, rip = 0, rsp = 0xff839d30, rbp = 0 ---

-Brandon
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-03 Thread Jeremy Chadwick
On Mon, May 03, 2010 at 11:57:28PM +0200, David DEMELIER wrote:
> 2010/5/3 David DEMELIER :
> > Hi,
> >
> > I just updated my 8.0-STABLE/amd64 today around 17h CEST, and it just
> > panics when I unplug my AC.  The current process = 11 (idle: cpu1) is
> > this related to the cpufreq and related stuff ?
> >
> > It also says cannot dump. Device not defined or unavailable so I can't
> > give you more infos now.
> >
> 
> I can confirm that :
> 
> #performance_cx_lowest="HIGH"
> #performance_cpu_freq=${performance_cx_lowest}
> #economy_cx_lowest="LOW"
> #economy_cpu_freq=${economy_cx_lowest}
> 
> in rc.conf was the problem.

When these are commented out, can you provide the output from:

sysctl -a dev.cpu

Can you confirm whether or not powerd(8) is in use on this system when
it panics?  If so, does the problem go away if you disable powerd(8) but
leave in (uncommented) the above rc.conf settings?

-- 
| Jeremy Chadwick   j...@parodius.com |
| Parodius Networking   http://www.parodius.com/ |
| UNIX Systems Administrator  Mountain View, CA, USA |
| Making life hard for others since 1977.  PGP: 4BD6C0CB |

___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-04 Thread Jeremy Chadwick
On Tue, May 04, 2010 at 10:32:14AM +0200, David DEMELIER wrote:
> Since I added dumpdev="/dev/ad4s1b" in my /boot/loader.conf it does
> not panic anymore ...
> 
> I'm not lucky (or ?).

1) dumpdev="xxx" should go into /etc/rc.conf, not /boot/loader.conf.
Putting in in /boot/loader.conf will change/do nothing.  You should
probably be using 'dumpdev="auto"' anyway (it then uses whatever you
define as swap in /etc/fstab).

2) If you meant to say /etc/rc.conf instead of /boot/loader.conf,
setting dumpdev shouldn't fix your problem.  I think it's a red herring.

3) You sent the above to me directly; please keep the mailing list CC'd,
as others need to know what you've tried/done.  Thanks.

-- 
| Jeremy Chadwick   j...@parodius.com |
| Parodius Networking   http://www.parodius.com/ |
| UNIX Systems Administrator  Mountain View, CA, USA |
| Making life hard for others since 1977.  PGP: 4BD6C0CB |

___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-04 Thread David DEMELIER
2010/5/4 Jeremy Chadwick :
> On Tue, May 04, 2010 at 10:32:14AM +0200, David DEMELIER wrote:
>> Since I added dumpdev="/dev/ad4s1b" in my /boot/loader.conf it does
>> not panic anymore ...
>>
>> I'm not lucky (or ?).
>
> 1) dumpdev="xxx" should go into /etc/rc.conf, not /boot/loader.conf.
> Putting in in /boot/loader.conf will change/do nothing.  You should
> probably be using 'dumpdev="auto"' anyway (it then uses whatever you
> define as swap in /etc/fstab).
>
> 2) If you meant to say /etc/rc.conf instead of /boot/loader.conf,
> setting dumpdev shouldn't fix your problem.  I think it's a red herring.
>
> 3) You sent the above to me directly; please keep the mailing list CC'd,
> as others need to know what you've tried/done.  Thanks.
>

Yes I also added dumpdev="AUTO" in /etc/rc.conf at the beginning. That
was Garett who told me to add it to loader.conf.

$ sysctl dev.cpu
dev.cpu.0.%desc: ACPI CPU
dev.cpu.0.%driver: cpu
dev.cpu.0.%location: handle=\_PR_.CPU0
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%parent: acpi0
dev.cpu.0.freq: 2101
dev.cpu.0.freq_levels: 2101/35000 1837/30625 1600/23888 1400/20902
1200/15000 1050/13125 900/11250 750/9375 600/7500 450/5625 300/3750
150/1875
dev.cpu.0.cx_supported: C1/1 C2/57
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_usage: 100.00% 0.00% last 497us
dev.cpu.1.%desc: ACPI CPU
dev.cpu.1.%driver: cpu
dev.cpu.1.%location: handle=\_PR_.CPU1
dev.cpu.1.%pnpinfo: _HID=none _UID=0
dev.cpu.1.%parent: acpi0
dev.cpu.1.cx_supported: C1/1 C2/57
dev.cpu.1.cx_lowest: C1
dev.cpu.1.cx_usage: 100.00% 0.00% last 497us

(I used Cc: entry I hope it sends to all)

-- 
Demelier David
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-04 Thread Jeremy Chadwick
On Tue, May 04, 2010 at 10:41:18AM +0200, David DEMELIER wrote:
> 2010/5/4 Jeremy Chadwick :
> > On Tue, May 04, 2010 at 10:32:14AM +0200, David DEMELIER wrote:
> >> Since I added dumpdev="/dev/ad4s1b" in my /boot/loader.conf it does
> >> not panic anymore ...
> >>
> >> I'm not lucky (or ?).
> >
> > 1) dumpdev="xxx" should go into /etc/rc.conf, not /boot/loader.conf.
> > Putting in in /boot/loader.conf will change/do nothing.  You should
> > probably be using 'dumpdev="auto"' anyway (it then uses whatever you
> > define as swap in /etc/fstab).
> >
> > 2) If you meant to say /etc/rc.conf instead of /boot/loader.conf,
> > setting dumpdev shouldn't fix your problem.  I think it's a red herring.
> >
> > 3) You sent the above to me directly; please keep the mailing list CC'd,
> > as others need to know what you've tried/done.  Thanks.
> 
> Yes I also added dumpdev="AUTO" in /etc/rc.conf at the beginning. That
> was Garett who told me to add it to loader.conf.

I think he meant /etc/rc.conf.  That's okay -- mistakes happen.

All dumpdev="auto" will do is configure FreeBSD to automatically dump
all kernel memory to swap + reboot the system.  When FreeBSD next boots,
it will use savecore(8) to save the contents of swap to a series of
files in /var/crash for later debugging.

> $ sysctl dev.cpu
> dev.cpu.0.%desc: ACPI CPU
> dev.cpu.0.%driver: cpu
> dev.cpu.0.%location: handle=\_PR_.CPU0
> dev.cpu.0.%pnpinfo: _HID=none _UID=0
> dev.cpu.0.%parent: acpi0
> dev.cpu.0.freq: 2101
> dev.cpu.0.freq_levels: 2101/35000 1837/30625 1600/23888 1400/20902 1200/15000 
> 1050/13125 900/11250 750/9375 600/7500 450/5625 300/3750 150/1875
> dev.cpu.0.cx_supported: C1/1 C2/57
> dev.cpu.0.cx_lowest: C1
> dev.cpu.0.cx_usage: 100.00% 0.00% last 497us
> dev.cpu.1.%desc: ACPI CPU
> dev.cpu.1.%driver: cpu
> dev.cpu.1.%location: handle=\_PR_.CPU1
> dev.cpu.1.%pnpinfo: _HID=none _UID=0
> dev.cpu.1.%parent: acpi0
> dev.cpu.1.cx_supported: C1/1 C2/57
> dev.cpu.1.cx_lowest: C1
> dev.cpu.1.cx_usage: 100.00% 0.00% last 497us
> 
> (I used Cc: entry I hope it sends to all)

Can you confirm whether or not powerd(8) is in use on this system when
it panics?

If so, does the problem go away if you disable powerd(8) but leave in
(uncommented) the performance_* and economy_* rc.conf settings?

-- 
| Jeremy Chadwick   j...@parodius.com |
| Parodius Networking   http://www.parodius.com/ |
| UNIX Systems Administrator  Mountain View, CA, USA |
| Making life hard for others since 1977.  PGP: 4BD6C0CB |

___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-04 Thread David DEMELIER
I made a panic and it said Dumping 1176Mb but even after 5 minutes
there was no output. Usually you'll have something like Dumping
1176Mb: 1176 1040 960 ... etc ?

Here it's stays at Dumping 1176Mb: and no changes.

Cheers,
David.
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-04 Thread David DEMELIER
Good news ! It worked, check the picture here :

http://img63.imageshack.us/img63/4244/dsc00361g.jpg
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-04 Thread Kostik Belousov
On Tue, May 04, 2010 at 06:35:52PM +0200, David DEMELIER wrote:
> Good news ! It worked, check the picture here :
> 
> http://img63.imageshack.us/img63/4244/dsc00361g.jpg

Please try adding code fragment like this:
if (cx_next->p_lvlx == NULL)
printf("Going to panic.\n");
to  dev/acpi/acpi_cpu.c:acpi_cpu_idle() function, right before
CPU_GET_REG(cx_next->p_lvlx, 1);
line and see if it prints the message immediately before the panic.


pgpbiX1S7ryzj.pgp
Description: PGP signature


Re: Kernel panic when unpluggin AC adaptor

2010-05-04 Thread David DEMELIER
2010/5/4 Kostik Belousov :
> On Tue, May 04, 2010 at 06:35:52PM +0200, David DEMELIER wrote:
>> Good news ! It worked, check the picture here :
>>
>> http://img63.imageshack.us/img63/4244/dsc00361g.jpg
>
> Please try adding code fragment like this:
>        if (cx_next->p_lvlx == NULL)
>                printf("Going to panic.\n");
> to  dev/acpi/acpi_cpu.c:acpi_cpu_idle() function, right before
>    CPU_GET_REG(cx_next->p_lvlx, 1);
> line and see if it prints the message immediately before the panic.
>

Yes it does at the beginning of the kernel panic.

Cheers.

-- 
Demelier David
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-04 Thread Kostik Belousov
On Tue, May 04, 2010 at 10:27:23PM +0200, David DEMELIER wrote:
> 2010/5/4 Kostik Belousov :
> > On Tue, May 04, 2010 at 06:35:52PM +0200, David DEMELIER wrote:
> >> Good news ! It worked, check the picture here :
> >>
> >> http://img63.imageshack.us/img63/4244/dsc00361g.jpg
> >
> > Please try adding code fragment like this:
> >        if (cx_next->p_lvlx == NULL)
> >                printf("Going to panic.\n");
> > to  dev/acpi/acpi_cpu.c:acpi_cpu_idle() function, right before
> >    CPU_GET_REG(cx_next->p_lvlx, 1);
> > line and see if it prints the message immediately before the panic.
> >
> 
> Yes it does at the beginning of the kernel panic.

Ok, so the point of panic is found, it is NULL cx_next->p_lvlx resource.
With the data in hand, I recommend you to ask on acpi@ (added a Cc:)
about the cause and possible solution.


pgpcRRz7ax3jP.pgp
Description: PGP signature


Re: Kernel panic when unpluggin AC adaptor

2010-05-04 Thread Rui Paulo
On 4 May 2010, at 21:38, Kostik Belousov wrote:

> On Tue, May 04, 2010 at 10:27:23PM +0200, David DEMELIER wrote:
>> 2010/5/4 Kostik Belousov :
>>> On Tue, May 04, 2010 at 06:35:52PM +0200, David DEMELIER wrote:
 Good news ! It worked, check the picture here :
 
 http://img63.imageshack.us/img63/4244/dsc00361g.jpg
>>> 
>>> Please try adding code fragment like this:
>>>if (cx_next->p_lvlx == NULL)
>>>printf("Going to panic.\n");
>>> to  dev/acpi/acpi_cpu.c:acpi_cpu_idle() function, right before
>>>CPU_GET_REG(cx_next->p_lvlx, 1);
>>> line and see if it prints the message immediately before the panic.
>>> 
>> 
>> Yes it does at the beginning of the kernel panic.
> 
> Ok, so the point of panic is found, it is NULL cx_next->p_lvlx resource.
> With the data in hand, I recommend you to ask on acpi@ (added a Cc:)
> about the cause and possible solution.

I don't remember the details, but I've seen this before. Does your CPU Cx 
levels change when you plug/unplug the AC adapter?

Regards,
--
Rui Paulo


___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-05 Thread Demelier David
On Wed, May 05, 2010 at 01:19:45AM +0100, Rui Paulo wrote:
> On 4 May 2010, at 21:38, Kostik Belousov wrote:
> 
> > On Tue, May 04, 2010 at 10:27:23PM +0200, David DEMELIER wrote:
> >> 2010/5/4 Kostik Belousov :
> >>> On Tue, May 04, 2010 at 06:35:52PM +0200, David DEMELIER wrote:
>  Good news ! It worked, check the picture here :
>  
>  http://img63.imageshack.us/img63/4244/dsc00361g.jpg
> >>> 
> >>> Please try adding code fragment like this:
> >>>if (cx_next->p_lvlx == NULL)
> >>>printf("Going to panic.\n");
> >>> to  dev/acpi/acpi_cpu.c:acpi_cpu_idle() function, right before
> >>>CPU_GET_REG(cx_next->p_lvlx, 1);
> >>> line and see if it prints the message immediately before the panic.
> >>> 
> >> 
> >> Yes it does at the beginning of the kernel panic.
> > 
> > Ok, so the point of panic is found, it is NULL cx_next->p_lvlx resource.
> > With the data in hand, I recommend you to ask on acpi@ (added a Cc:)
> > about the cause and possible solution.
> 
> I don't remember the details, but I've seen this before. Does your CPU Cx 
> levels change when you plug/unplug the AC adapter?
> 

May  4 15:48:32 Melon power_profile: changed to 'economy'
May  4 15:48:35 Melon power_profile: changed to 'performance'

I think yes.

King regards.

-- 
Demelier David
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-05 Thread Rui Paulo

On 5 May 2010, at 08:40, Demelier David wrote:

> On Wed, May 05, 2010 at 01:19:45AM +0100, Rui Paulo wrote:
>> On 4 May 2010, at 21:38, Kostik Belousov wrote:
>> 
>>> On Tue, May 04, 2010 at 10:27:23PM +0200, David DEMELIER wrote:
 2010/5/4 Kostik Belousov :
> On Tue, May 04, 2010 at 06:35:52PM +0200, David DEMELIER wrote:
>> Good news ! It worked, check the picture here :
>> 
>> http://img63.imageshack.us/img63/4244/dsc00361g.jpg
> 
> Please try adding code fragment like this:
>   if (cx_next->p_lvlx == NULL)
>   printf("Going to panic.\n");
> to  dev/acpi/acpi_cpu.c:acpi_cpu_idle() function, right before
>   CPU_GET_REG(cx_next->p_lvlx, 1);
> line and see if it prints the message immediately before the panic.
> 
 
 Yes it does at the beginning of the kernel panic.
>>> 
>>> Ok, so the point of panic is found, it is NULL cx_next->p_lvlx resource.
>>> With the data in hand, I recommend you to ask on acpi@ (added a Cc:)
>>> about the cause and possible solution.
>> 
>> I don't remember the details, but I've seen this before. Does your CPU Cx 
>> levels change when you plug/unplug the AC adapter?
>> 
> 
> May  4 15:48:32 Melon power_profile: changed to 'economy'
> May  4 15:48:35 Melon power_profile: changed to 'performance'

I wasn't asking about the profiles. Show us the output of sysctl dev.cpu with 
and without the AC cord plugged in.

Regards,
--
Rui Paulo


___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-05 Thread Demelier David
On Wed, May 05, 2010 at 10:49:23AM +0100, Rui Paulo wrote:
> 
> On 5 May 2010, at 08:40, Demelier David wrote:
> 
> > On Wed, May 05, 2010 at 01:19:45AM +0100, Rui Paulo wrote:
> >> On 4 May 2010, at 21:38, Kostik Belousov wrote:
> >> 
> >>> On Tue, May 04, 2010 at 10:27:23PM +0200, David DEMELIER wrote:
>  2010/5/4 Kostik Belousov :
> > On Tue, May 04, 2010 at 06:35:52PM +0200, David DEMELIER wrote:
> >> Good news ! It worked, check the picture here :
> >> 
> >> http://img63.imageshack.us/img63/4244/dsc00361g.jpg
> > 
> > Please try adding code fragment like this:
> >   if (cx_next->p_lvlx == NULL)
> >   printf("Going to panic.\n");
> > to  dev/acpi/acpi_cpu.c:acpi_cpu_idle() function, right before
> >   CPU_GET_REG(cx_next->p_lvlx, 1);
> > line and see if it prints the message immediately before the panic.
> > 
>  
>  Yes it does at the beginning of the kernel panic.
> >>> 
> >>> Ok, so the point of panic is found, it is NULL cx_next->p_lvlx resource.
> >>> With the data in hand, I recommend you to ask on acpi@ (added a Cc:)
> >>> about the cause and possible solution.
> >> 
> >> I don't remember the details, but I've seen this before. Does your CPU Cx 
> >> levels change when you plug/unplug the AC adapter?
> >> 
> > 
> > May  4 15:48:32 Melon power_profile: changed to 'economy'
> > May  4 15:48:35 Melon power_profile: changed to 'performance'
> 
> I wasn't asking about the profiles. Show us the output of sysctl dev.cpu with 
> and without the AC cord plugged in.
> 

That is when I have ac unplugged :

$ sysctl dev.cpu
dev.cpu.0.%desc: ACPI CPU
dev.cpu.0.%driver: cpu
dev.cpu.0.%location: handle=\_PR_.CPU0
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%parent: acpi0
dev.cpu.0.freq: 1200
dev.cpu.0.freq_levels: 2101/35000 1837/30625 1600/23888 1400/20902 1200/15000
1050/13125 900/11250 750/9375 600/7500 450/5625 300/3750 150/1875
dev.cpu.0.cx_supported: C1/1 C2/57
dev.cpu.0.cx_lowest: C2
dev.cpu.0.cx_usage: 7.22% 92.77% last 2482us
dev.cpu.1.%desc: ACPI CPU
dev.cpu.1.%driver: cpu
dev.cpu.1.%location: handle=\_PR_.CPU1
dev.cpu.1.%pnpinfo: _HID=none _UID=0
dev.cpu.1.%parent: acpi0
dev.cpu.1.cx_supported: C1/1 C2/57
dev.cpu.1.cx_lowest: C2
dev.cpu.1.cx_usage: 5.55% 94.44% last 7724us

-- 
Demelier David
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-05 Thread Rui Paulo
Please try this patch:

Index: acpi_cpu.c
===
--- acpi_cpu.c  (revision 207322)
+++ acpi_cpu.c  (working copy)
@@ -997,12 +997,12 @@
 if (notify != ACPI_NOTIFY_CX_STATES)
return;
 
+ACPI_SERIAL_BEGIN(cpu);
 /* Update the list of Cx states. */
 acpi_cpu_cx_cst(sc);
 acpi_cpu_cx_list(sc);
 
 /* Update the new lowest useable Cx state for all CPUs. */
-ACPI_SERIAL_BEGIN(cpu);
 cpu_cx_count = 0;
 for (i = 0; i < cpu_ndevices; i++) {
isc = device_get_softc(cpu_devices[i]);


Regards,
--
Rui Paulo


___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-05 Thread Demelier David
On Wed, May 05, 2010 at 12:45:46PM +0100, Rui Paulo wrote:
> Please try this patch:
> 
> Index: acpi_cpu.c
> ===
> --- acpi_cpu.c(revision 207322)
> +++ acpi_cpu.c(working copy)
> @@ -997,12 +997,12 @@
>  if (notify != ACPI_NOTIFY_CX_STATES)
>   return;
>  
> +ACPI_SERIAL_BEGIN(cpu);
>  /* Update the list of Cx states. */
>  acpi_cpu_cx_cst(sc);
>  acpi_cpu_cx_list(sc);
>  
>  /* Update the new lowest useable Cx state for all CPUs. */
> -ACPI_SERIAL_BEGIN(cpu);
>  cpu_cx_count = 0;
>  for (i = 0; i < cpu_ndevices; i++) {
>   isc = device_get_softc(cpu_devices[i]);
> 

Tested, but exactly same panic an backtrace.

Cheers.

-- 
Demelier David
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-05 Thread Giovanni Trematerra
Would you be so kind to try to revert this patch?
I'm just guessing

You have to pass -R flag to patch program to apply the patch

=

--- head/sys/dev/acpica/acpi_acad.c 2009/06/05 18:44:36 193530
+++ head/sys/dev/acpica/acpi_acad.c 2009/09/30 17:07:49 197649
@@ -109,13 +109,14 @@
 ACPI_SERIAL_BEGIN(acad);
 if (newstatus != -1 && sc->status != newstatus) {
sc->status = newstatus;
+   ACPI_SERIAL_END(acad);
power_profile_set_state(newstatus ? POWER_PROFILE_PERFORMANCE :
POWER_PROFILE_ECONOMY);
ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
"%s Line\n", newstatus ? "On" : "Off");
acpi_UserNotify("ACAD", h, newstatus);
-}
-ACPI_SERIAL_END(acad);
+} else
+   ACPI_SERIAL_END(acad);
 }

 static void
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-07 Thread Demelier David
Le Vendredi 07 mai 2010 à 18:22 +0200, Giovanni Trematerra a écrit :
> On Fri, May 7, 2010 at 2:08 PM, Demelier David  
> wrote:
> > Hi,
> >I noticed that pluggin the AC adaptor when I boot without it does not
> >panic. It only panic when removing it.
> >
> >Maybe that could help ?
> >
> 
> Good to know. The problem lies somewhere when performance state change.
> In your case it happens when you remove AC adaptor. Let's hope someone on
> acpi@ ml comes up with a good idea.
> 

Okay so for the moment no change, I'll wait for someone with an idea
that could solve my problem. For me because the panic only happens when
changing profile from ac plugged -> ac unplugged (and not the reverse) I
would think it's a cpu related acpi issue.

David.

___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-07 Thread Jeremy Chadwick
On Fri, May 07, 2010 at 08:33:46PM +0200, Demelier David wrote:
> Le Vendredi 07 mai 2010 à 18:22 +0200, Giovanni Trematerra a écrit :
> > On Fri, May 7, 2010 at 2:08 PM, Demelier David  
> > wrote:
> > > Hi,
> > >I noticed that pluggin the AC adaptor when I boot without it does 
> > > not
> > >panic. It only panic when removing it.
> > >
> > >Maybe that could help ?
> > >
> > 
> > Good to know. The problem lies somewhere when performance state change.
> > In your case it happens when you remove AC adaptor. Let's hope someone on
> > acpi@ ml comes up with a good idea.
> > 
> 
> Okay so for the moment no change, I'll wait for someone with an idea
> that could solve my problem. For me because the panic only happens when
> changing profile from ac plugged -> ac unplugged (and not the reverse) I
> would think it's a cpu related acpi issue.

This is one of the reasons why I asked you to provide sysctl dev.cpu
output (which you did -- thanks!).  There's a known situation where CPUs
going into C3 (but not C1 or C2) state causes problems.  In your case
your CPUs only advertise up to C2, so you're unaffected by that issue.

-- 
| Jeremy Chadwick   j...@parodius.com |
| Parodius Networking   http://www.parodius.com/ |
| UNIX Systems Administrator  Mountain View, CA, USA |
| Making life hard for others since 1977.  PGP: 4BD6C0CB |

___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-11 Thread Giovanni Trematerra
On Fri, May 7, 2010 at 8:33 PM, Demelier David  wrote:
> Le Vendredi 07 mai 2010 à 18:22 +0200, Giovanni Trematerra a écrit :
>> On Fri, May 7, 2010 at 2:08 PM, Demelier David  
>> wrote:
>> > Hi,
>> >        I noticed that pluggin the AC adaptor when I boot without it does 
>> > not
>> >        panic. It only panic when removing it.
>> >
>> >        Maybe that could help ?
>> >
>>
>> Good to know. The problem lies somewhere when performance state change.
>> In your case it happens when you remove AC adaptor. Let's hope someone on
>> acpi@ ml comes up with a good idea.
>>
>
> Okay so for the moment no change, I'll wait for someone with an idea
> that could solve my problem. For me because the panic only happens when
> changing profile from ac plugged -> ac unplugged (and not the reverse) I
> would think it's a cpu related acpi issue.
>

I looked deeper and it seems to me that when you unplug the AC
adapter, acpi_cpu_notify calls acpi_cpu_cx_cst that try to allocate a
new cx_ptr->p_lvlx  via acpi_PkgGas.
If acpi_PkgGas set cx_ptr->p_lvlx to NULL for any reasons you'll have
the panic that you reported.
A solution would be to set acpi_cpu_hook to NULL so acpi_cpu_idle won't call it.
I need some time to have a patch because of the possible race between
acpi_cpu_notify and
acpi_cpu_idle during set acpi_cpu_hook to NULL.
if you have time and want panic your system you could try the attached
patch, just to be
sure that we catch it.

Thanks

--
Gianni
Index: sys/dev/acpica/acpi_cpu.c
===
--- sys/dev/acpica/acpi_cpu.c   (revision 207947)
+++ sys/dev/acpica/acpi_cpu.c   (working copy)
@@ -609,7 +609,9 @@ acpi_cpu_generic_cx_probe(struct acpi_cpu_softc *s
cx_ptr->trans_lat = AcpiGbl_FADT.C2Latency;
cx_ptr++;
sc->cpu_cx_count++;
-   }
+   } else
+   panic("%s: Cannot allocate resource %d for C3 state", __func__, 
+   cx_ptr->res_type);
 }
 if (sc->cpu_p_blk_len < 6)
return;
@@ -625,7 +627,9 @@ acpi_cpu_generic_cx_probe(struct acpi_cpu_softc *s
cx_ptr->trans_lat = AcpiGbl_FADT.C3Latency;
cx_ptr++;
sc->cpu_cx_count++;
-   }
+   } else
+   panic("%s: Cannot allocate resource %d for C3 state", __func__, 
+   cx_ptr->res_type);
 }
 }
 
@@ -732,7 +736,8 @@ acpi_cpu_cx_cst(struct acpi_cpu_softc *sc)
 cx_ptr->trans_lat));
cx_ptr++;
sc->cpu_cx_count++;
-   }
+   } else
+   panic("Got it! acpi_PkgGas set p_lvlx to NULL");
 }
 AcpiOsFree(buf.Pointer);
 
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"

Re: Kernel panic when unpluggin AC adaptor

2010-05-12 Thread David DEMELIER
Hi, I tested your patch and it didn't panic. I checked the dev.cpu
sysctl nodes to see if the CPU freq is changing or not.

I unplugged the cable :
mark...@melon ~ $ sysctl dev.cpu
dev.cpu.0.%desc: ACPI CPU
dev.cpu.0.%driver: cpu
dev.cpu.0.%location: handle=\_PR_.CPU0
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%parent: acpi0
dev.cpu.0.freq: 450
dev.cpu.0.freq_levels: 2101/35000 1837/30625 1600/23888 1400/20902
1200/15000 1050/13125 900/11250 750/9375 600/7500 450/5625 300/3750
150/1875
dev.cpu.0.cx_supported: C1/1 C2/1 C3/162
dev.cpu.0.cx_lowest: C3
dev.cpu.0.cx_usage: 0.00% 99.99% 0.00% last 131us
dev.cpu.1.%desc: ACPI CPU
dev.cpu.1.%driver: cpu
dev.cpu.1.%location: handle=\_PR_.CPU1
dev.cpu.1.%pnpinfo: _HID=none _UID=0
dev.cpu.1.%parent: acpi0
dev.cpu.1.cx_supported: C1/1 C2/1 C3/162
dev.cpu.1.cx_lowest: C3
dev.cpu.1.cx_usage: 0.00% 99.99% 0.00% last 260us

I plugged the cable :

mark...@melon ~ $ sysctl dev.cpu
dev.cpu.0.%desc: ACPI CPU
dev.cpu.0.%driver: cpu
dev.cpu.0.%location: handle=\_PR_.CPU0
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%parent: acpi0
dev.cpu.0.freq: 2101
dev.cpu.0.freq_levels: 2101/35000 1837/30625 1600/23888 1400/20902
1200/15000 1050/13125 900/11250 750/9375 600/7500 450/5625 300/3750
150/1875
dev.cpu.0.cx_supported: C1/1 C2/57
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_usage: 100.00% 0.00% last 497us
dev.cpu.1.%desc: ACPI CPU
dev.cpu.1.%driver: cpu
dev.cpu.1.%location: handle=\_PR_.CPU1
dev.cpu.1.%pnpinfo: _HID=none _UID=0
dev.cpu.1.%parent: acpi0
dev.cpu.1.cx_supported: C1/1 C2/57
dev.cpu.1.cx_lowest: C1
dev.cpu.1.cx_usage: 100.00% 0.00% last 497us

Of course I enabled

# Little power management.
performance_cx_lowest="HIGH"
performance_cpu_freq=${performance_cx_lowest}
economy_cx_lowest="LOW"
economy_cpu_freq=${economy_cx_lowest}

in my /etc/rc.conf, it the behavior expected ?

Thanks for your answers :-).

-- 
Demelier David
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-12 Thread Giovanni Trematerra
On Wed, May 12, 2010 at 3:35 PM, David DEMELIER
 wrote:
> Hi, I tested your patch and it didn't panic. I checked the dev.cpu
> sysctl nodes to see if the CPU freq is changing or not.
>

It's very odd. I did nothing to prevent panic. in fact you should have
seen a panic.
did you apply the patch on a vanilla src? Do you still get panic
without the patch
when you unplug your AC adapter?

Thank you

--
GIanni
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-12 Thread Kevin Oberman
> Date: Wed, 12 May 2010 15:35:51 +0200
> From: David DEMELIER 
> Sender: owner-freebsd-sta...@freebsd.org
> 
> Hi, I tested your patch and it didn't panic. I checked the dev.cpu
> sysctl nodes to see if the CPU freq is changing or not.
> 
> I unplugged the cable :
> mark...@melon ~ $ sysctl dev.cpu
> dev.cpu.0.%desc: ACPI CPU
> dev.cpu.0.%driver: cpu
> dev.cpu.0.%location: handle=\_PR_.CPU0
> dev.cpu.0.%pnpinfo: _HID=none _UID=0
> dev.cpu.0.%parent: acpi0
> dev.cpu.0.freq: 450
> dev.cpu.0.freq_levels: 2101/35000 1837/30625 1600/23888 1400/20902
> 1200/15000 1050/13125 900/11250 750/9375 600/7500 450/5625 300/3750
> 150/1875
> dev.cpu.0.cx_supported: C1/1 C2/1 C3/162
> dev.cpu.0.cx_lowest: C3
> dev.cpu.0.cx_usage: 0.00% 99.99% 0.00% last 131us
> dev.cpu.1.%desc: ACPI CPU
> dev.cpu.1.%driver: cpu
> dev.cpu.1.%location: handle=\_PR_.CPU1
> dev.cpu.1.%pnpinfo: _HID=none _UID=0
> dev.cpu.1.%parent: acpi0
> dev.cpu.1.cx_supported: C1/1 C2/1 C3/162
> dev.cpu.1.cx_lowest: C3
> dev.cpu.1.cx_usage: 0.00% 99.99% 0.00% last 260us
> 
> I plugged the cable :
> 
> mark...@melon ~ $ sysctl dev.cpu
> dev.cpu.0.%desc: ACPI CPU
> dev.cpu.0.%driver: cpu
> dev.cpu.0.%location: handle=\_PR_.CPU0
> dev.cpu.0.%pnpinfo: _HID=none _UID=0
> dev.cpu.0.%parent: acpi0
> dev.cpu.0.freq: 2101
> dev.cpu.0.freq_levels: 2101/35000 1837/30625 1600/23888 1400/20902
> 1200/15000 1050/13125 900/11250 750/9375 600/7500 450/5625 300/3750
> 150/1875
> dev.cpu.0.cx_supported: C1/1 C2/57
> dev.cpu.0.cx_lowest: C1
> dev.cpu.0.cx_usage: 100.00% 0.00% last 497us
> dev.cpu.1.%desc: ACPI CPU
> dev.cpu.1.%driver: cpu
> dev.cpu.1.%location: handle=\_PR_.CPU1
> dev.cpu.1.%pnpinfo: _HID=none _UID=0
> dev.cpu.1.%parent: acpi0
> dev.cpu.1.cx_supported: C1/1 C2/57
> dev.cpu.1.cx_lowest: C1
> dev.cpu.1.cx_usage: 100.00% 0.00% last 497us
> 
> Of course I enabled
> 
> # Little power management.
> performance_cx_lowest="HIGH"
> performance_cpu_freq=${performance_cx_lowest}
> economy_cx_lowest="LOW"
> economy_cpu_freq=${economy_cx_lowest}
> 
> in my /etc/rc.conf, it the behavior expected ?

I won't say that it is expected, but it is not unusual. It looks like
more and more laptops don't offer higher 'C' states when on AC power. My
ThinkPad gives me C3 on AC power and adds C4 on battery.

You have an awful lot of available frequencies. I really recommend
turning off TCC/Throttling, if they are active. They don't really save
power and can cause problems at low values. They also impact powerd's
responsiveness to changes in CPU load. What you REALLY want are the true
power management clock/voltage step which are usually between 2 and
6. My old T30 only had two. My not quite as old T43 has 5 ranging from
2 GHz down to 800 MHz.

I really wish TCC and throttling would be disabled by default or totally
removed. they were intended for thermal management, not power management.
-- 
R. Kevin Oberman, Network Engineer
Energy Sciences Network (ESnet)
Ernest O. Lawrence Berkeley National Laboratory (Berkeley Lab)
E-mail: ober...@es.net  Phone: +1 510 486-8634
Key fingerprint:059B 2DDF 031C 9BA3 14A4  EADA 927D EBB3 987B 3751
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-12 Thread David DEMELIER
I remove the patch, and built the kernel (I updated the src this
morning) and it does not panic now. It's really odd. If it reappears
soon I will tell you.

Thanks.

-- 
Demelier David
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-12 Thread Attilio Rao
2010/5/12 David DEMELIER :
> I remove the patch, and built the kernel (I updated the src this
> morning) and it does not panic now. It's really odd. If it reappears
> soon I will tell you.

I looked at the code with Giovanni and I have the feeling that the
race with the idle thread may still be fatal.
We need to fix that.

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-12 Thread Brandon Gooch
On Wed, May 12, 2010 at 9:41 AM, Attilio Rao  wrote:
> 2010/5/12 David DEMELIER :
>> I remove the patch, and built the kernel (I updated the src this
>> morning) and it does not panic now. It's really odd. If it reappears
>> soon I will tell you.
>
> I looked at the code with Giovanni and I have the feeling that the
> race with the idle thread may still be fatal.
> We need to fix that.
>
> Attilio
>

That seems to be the case, as my laptop shows about an 80-85 % chance
of experiencing a panic if left idle for long-ish periods of time (2
to 4 hours). I usually rebuild world or big ports overnight, and more
often than not I wake up to a panicked machine, same situation every
time:

...
rman_get_bushandle() at rman_get_bushandle+0x1
sched_idletd() at sched_idletd+0x123
fork_exit() at fork_exit+0x12a
fork_trampoline() at fork_trampoline+0xe
...

The kernel/userland is rebuilt, the ports are finished compiling --
it's in the time AFTER the completion of all tasks that the machine
gets bored and tries to kill itself :)

I have seen the AC adapter plug/unplug "hang" in the past on this
laptop, but I never made the connection between the events, as
nowadays my laptop usually stays plugged in :(

Attilio, I hope you can track this one down, let me know if I can do
anything to help or test...

-Brandon
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-13 Thread perryh
"Kevin Oberman"  wrote:

> ... TCC and throttling ...
> they were intended for thermal management, not power management.

Shouldn't the two be equivalent?  Heat generated is directly related
to power consumed.
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-13 Thread Kevin Oberman
> Date: Thu, 13 May 2010 00:09:05 -0700
> From: per...@pluto.rain.com
> 
> "Kevin Oberman"  wrote:
> 
> > ... TCC and throttling ...
> > they were intended for thermal management, not power management.
> 
> Shouldn't the two be equivalent?  Heat generated is directly related
> to power consumed.

They are roughly equivalent. TCC performs slightly better as it is
internal to the CPU and can run automatically with no OS involvement.
Throttling requires the OS set the number of cycles to skip on pins of
the CPU. My testing has shown only about a 5% difference on the worst
case in a P4-Mobile CPU. FreeBSD will use TCC when it is available and
throttling when it is not. It never uses both. (It did for a short while
and it was not pretty!)

Heat generated is almost directly proportional to power consumed.
Unfortunately, when you use TCC or throttling the performance is also
directly proportional to the power consumed. the result is that, to
perform any operation, you end up using almost the same power. Testing
has shown that it is really a net loss to do this.

For an excellent review of the situation, please read Alexandar Motin's
paper on FreeBSD power tuning at:
http://wiki.freebsd.org/TuningPowerConsumption

He performed the same testing I had performed about two years prior and
went well beyond what I had done. More importantly, he wrote up an
excellent document which describes how to set up a system for best
power/performance and explains why. I think is is a 'must read' for
anyone who wants to run a power efficient system.
-- 
R. Kevin Oberman, Network Engineer
Energy Sciences Network (ESnet)
Ernest O. Lawrence Berkeley National Laboratory (Berkeley Lab)
E-mail: ober...@es.net  Phone: +1 510 486-8634
Key fingerprint:059B 2DDF 031C 9BA3 14A4  EADA 927D EBB3 987B 3751
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-13 Thread Giovanni Trematerra
On Thu, May 13, 2010 at 1:09 AM, Brandon Gooch
 wrote:
> On Wed, May 12, 2010 at 9:41 AM, Attilio Rao  wrote:
>> 2010/5/12 David DEMELIER :
>>> I remove the patch, and built the kernel (I updated the src this
>>> morning) and it does not panic now. It's really odd. If it reappears
>>> soon I will tell you.
>>
>> I looked at the code with Giovanni and I have the feeling that the
>> race with the idle thread may still be fatal.
>> We need to fix that.
>>
>> Attilio
>>
>
> That seems to be the case, as my laptop shows about an 80-85 % chance
> of experiencing a panic if left idle for long-ish periods of time (2
> to 4 hours). I usually rebuild world or big ports overnight, and more
> often than not I wake up to a panicked machine, same situation every
> time:
>
> ...
> rman_get_bushandle() at rman_get_bushandle+0x1
> sched_idletd() at sched_idletd+0x123
> fork_exit() at fork_exit+0x12a
> fork_trampoline() at fork_trampoline+0xe
> ...
>
> The kernel/userland is rebuilt, the ports are finished compiling --
> it's in the time AFTER the completion of all tasks that the machine
> gets bored and tries to kill itself :)
>
> I have seen the AC adapter plug/unplug "hang" in the past on this
> laptop, but I never made the connection between the events, as
> nowadays my laptop usually stays plugged in :(
>
> Attilio, I hope you can track this one down, let me know if I can do
> anything to help or test...
>

Attilio and I came up with this patch. It seems ready for stress
testing and review
Please test and report back.

Thank you

P.S: all the faults are only mine.

--
Gianni
diff -r d7d0e04f42e3 sys/dev/acpica/acpi_cpu.c
--- a/sys/dev/acpica/acpi_cpu.c Wed May 12 04:01:56 2010 +0200
+++ b/sys/dev/acpica/acpi_cpu.c Fri May 14 02:20:18 2010 +0200
@@ -88,6 +88,7 @@ struct acpi_cpu_softc {
 int cpu_cx_lowest;
 charcpu_cx_supported[64];
 int cpu_rid;
+   struct mtx   cpu_lock;
 };
 
 struct acpi_cpu_device {
@@ -100,6 +101,10 @@ struct acpi_cpu_device {
 #define CPU_SET_REG(reg, width, val)   \
 (bus_space_write_ ## width(rman_get_bustag((reg)), 
\
   rman_get_bushandle((reg)), 0, (val)))
+#define ACPI_CPU_LOCK(sc) \
+   mtx_lock_spin(&sc->cpu_lock)
+#define ACPI_CPU_UNLOCK(sc) \
+   mtx_unlock_spin(&sc->cpu_lock)
 
 #define PM_USEC(x)  ((x) >> 2) /* ~4 clocks per usec (3.57955 Mhz) */
 
@@ -284,6 +289,7 @@ acpi_cpu_attach(device_t dev)
 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
 
 sc = device_get_softc(dev);
+   mtx_init(&sc->cpu_lock, "ntflck", NULL, MTX_SPIN);
 sc->cpu_dev = dev;
 sc->cpu_handle = acpi_get_handle(dev);
 cpu_id = (int)(intptr_t)acpi_get_private(dev);
@@ -409,26 +415,26 @@ acpi_cpu_postattach(void *unused __unuse
 SYSINIT(acpi_cpu, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE,
 acpi_cpu_postattach, NULL);
 
-/*
- * Disable any entry to the idle function during suspend and re-enable it
- * during resume.
- */
 static int
 acpi_cpu_suspend(device_t dev)
 {
+struct acpi_cpu_softc *sc;
 int error;
 
+sc = device_get_softc(dev);
 error = bus_generic_suspend(dev);
 if (error)
return (error);
+   ACPI_CPU_LOCK(sc);
 cpu_disable_idle = TRUE;
+   ACPI_CPU_UNLOCK(sc);
+
 return (0);
 }
 
 static int
 acpi_cpu_resume(device_t dev)
 {
-
 cpu_disable_idle = FALSE;
 return (bus_generic_resume(dev));
 }
@@ -609,7 +615,9 @@ acpi_cpu_generic_cx_probe(struct acpi_cp
cx_ptr->trans_lat = AcpiGbl_FADT.C2Latency;
cx_ptr++;
sc->cpu_cx_count++;
-   }
+   } else
+   panic("%s: Cannot allocate resource %d for C3 state", __func__, 
+   cx_ptr->res_type);
 }
 if (sc->cpu_p_blk_len < 6)
return;
@@ -625,7 +633,9 @@ acpi_cpu_generic_cx_probe(struct acpi_cp
cx_ptr->trans_lat = AcpiGbl_FADT.C3Latency;
cx_ptr++;
sc->cpu_cx_count++;
-   }
+   } else
+   panic("%s: Cannot allocate resource %d for C3 state", __func__, 
+   cx_ptr->res_type);
 }
 }
 
@@ -721,6 +731,8 @@ acpi_cpu_cx_cst(struct acpi_cpu_softc *s
}
 #endif
 
+   ACPI_CPU_LOCK(sc);
+
/* Allocate the control register for C2 or C3. */
acpi_PkgGas(sc->cpu_dev, pkg, 0, &cx_ptr->res_type, &sc->cpu_rid,
&cx_ptr->p_lvlx, RF_SHAREABLE);
@@ -732,7 +744,17 @@ acpi_cpu_cx_cst(struct acpi_cpu_softc *s
 cx_ptr->trans_lat));
cx_ptr++;
sc->cpu_cx_count++;
+   cpu_disable_idle = FALSE;
+   } else {
+   device_printf(sc->cpu_dev, "cannot allocate control register"
+   " for C2 o C3.");
+
+   /*
+* disable acpi_cpu_idle otherwise we get a panic
+*/
+   cpu_disable_idle = TRUE;
}
+   AC

Re: Kernel panic when unpluggin AC adaptor

2010-05-13 Thread Attilio Rao
2010/5/14 Giovanni Trematerra :
> On Thu, May 13, 2010 at 1:09 AM, Brandon Gooch
>  wrote:
>> On Wed, May 12, 2010 at 9:41 AM, Attilio Rao  wrote:
>>> 2010/5/12 David DEMELIER :
 I remove the patch, and built the kernel (I updated the src this
 morning) and it does not panic now. It's really odd. If it reappears
 soon I will tell you.
>>>
>>> I looked at the code with Giovanni and I have the feeling that the
>>> race with the idle thread may still be fatal.
>>> We need to fix that.
>>>
>>> Attilio
>>>
>>
>> That seems to be the case, as my laptop shows about an 80-85 % chance
>> of experiencing a panic if left idle for long-ish periods of time (2
>> to 4 hours). I usually rebuild world or big ports overnight, and more
>> often than not I wake up to a panicked machine, same situation every
>> time:
>>
>> ...
>> rman_get_bushandle() at rman_get_bushandle+0x1
>> sched_idletd() at sched_idletd+0x123
>> fork_exit() at fork_exit+0x12a
>> fork_trampoline() at fork_trampoline+0xe
>> ...
>>
>> The kernel/userland is rebuilt, the ports are finished compiling --
>> it's in the time AFTER the completion of all tasks that the machine
>> gets bored and tries to kill itself :)
>>
>> I have seen the AC adapter plug/unplug "hang" in the past on this
>> laptop, but I never made the connection between the events, as
>> nowadays my laptop usually stays plugged in :(
>>
>> Attilio, I hope you can track this one down, let me know if I can do
>> anything to help or test...
>>
>
> Attilio and I came up with this patch. It seems ready for stress
> testing and review
> Please test and report back.

I have still to review it completely, hope to do that asap.

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-13 Thread Andriy Gapon
on 14/05/2010 03:25 Giovanni Trematerra said the following:
> Attilio and I came up with this patch. It seems ready for stress
> testing and review
> Please test and report back.

It seems that there is inconsistent indentation for some of new lines.
Original style seems to be softtabstop=4 tabstop=8 noexpandtab in vim-speak.

-- 
Andriy Gapon
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-15 Thread Brandon Gooch
On Thu, May 13, 2010 at 7:25 PM, Giovanni Trematerra
 wrote:
> On Thu, May 13, 2010 at 1:09 AM, Brandon Gooch
>  wrote:
>> On Wed, May 12, 2010 at 9:41 AM, Attilio Rao  wrote:
>>> 2010/5/12 David DEMELIER :
 I remove the patch, and built the kernel (I updated the src this
 morning) and it does not panic now. It's really odd. If it reappears
 soon I will tell you.
>>>
>>> I looked at the code with Giovanni and I have the feeling that the
>>> race with the idle thread may still be fatal.
>>> We need to fix that.
>>>
>>> Attilio
>>>
>>
>> That seems to be the case, as my laptop shows about an 80-85 % chance
>> of experiencing a panic if left idle for long-ish periods of time (2
>> to 4 hours). I usually rebuild world or big ports overnight, and more
>> often than not I wake up to a panicked machine, same situation every
>> time:
>>
>> ...
>> rman_get_bushandle() at rman_get_bushandle+0x1
>> sched_idletd() at sched_idletd+0x123
>> fork_exit() at fork_exit+0x12a
>> fork_trampoline() at fork_trampoline+0xe
>> ...
>>
>> The kernel/userland is rebuilt, the ports are finished compiling --
>> it's in the time AFTER the completion of all tasks that the machine
>> gets bored and tries to kill itself :)
>>
>> I have seen the AC adapter plug/unplug "hang" in the past on this
>> laptop, but I never made the connection between the events, as
>> nowadays my laptop usually stays plugged in :(
>>
>> Attilio, I hope you can track this one down, let me know if I can do
>> anything to help or test...
>>
>
> Attilio and I came up with this patch. It seems ready for stress
> testing and review
> Please test and report back.
>
> Thank you
>
> P.S: all the faults are only mine.

I tried the patch, and my kernel panics I panic on boot. I have
8.5MB(!) of JPG images (6 of them) if anyone needs to see them. I'm
looking for a place to post them, but if anyone wants, I can send via
e-mail...

-Brandon
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-18 Thread Giovanni Trematerra
On Sat, May 15, 2010 at 9:12 PM, Brandon Gooch
 wrote:
> On Thu, May 13, 2010 at 7:25 PM, Giovanni Trematerra
>  wrote:
>> On Thu, May 13, 2010 at 1:09 AM, Brandon Gooch
>>  wrote:
>>> On Wed, May 12, 2010 at 9:41 AM, Attilio Rao  wrote:
 2010/5/12 David DEMELIER :
> I remove the patch, and built the kernel (I updated the src this
> morning) and it does not panic now. It's really odd. If it reappears
> soon I will tell you.

 I looked at the code with Giovanni and I have the feeling that the
 race with the idle thread may still be fatal.
 We need to fix that.

 Attilio

>>>
>>> That seems to be the case, as my laptop shows about an 80-85 % chance
>>> of experiencing a panic if left idle for long-ish periods of time (2
>>> to 4 hours). I usually rebuild world or big ports overnight, and more
>>> often than not I wake up to a panicked machine, same situation every
>>> time:
>>>
>>> ...
>>> rman_get_bushandle() at rman_get_bushandle+0x1
>>> sched_idletd() at sched_idletd+0x123
>>> fork_exit() at fork_exit+0x12a
>>> fork_trampoline() at fork_trampoline+0xe
>>> ...
>>>
>>> The kernel/userland is rebuilt, the ports are finished compiling --
>>> it's in the time AFTER the completion of all tasks that the machine
>>> gets bored and tries to kill itself :)
>>>
>>> I have seen the AC adapter plug/unplug "hang" in the past on this
>>> laptop, but I never made the connection between the events, as
>>> nowadays my laptop usually stays plugged in :(
>>>
>>> Attilio, I hope you can track this one down, let me know if I can do
>>> anything to help or test...
>>>
>>
>> Attilio and I came up with this patch. It seems ready for stress
>> testing and review
>> Please test and report back.
>>
>> Thank you
>>
>> P.S: all the faults are only mine.
>
> I tried the patch, and my kernel panics I panic on boot. I have
> 8.5MB(!) of JPG images (6 of them) if anyone needs to see them. I'm
> looking for a place to post them, but if anyone wants, I can send via
> e-mail...

Hi Brandon,
Could you please, try this new one? The panic at boot stage should be solved,
at least I tried on a 8-way machine and all went ok at boot.
Please, remove WITNESS_SKIPSPIN from your kernel config file.
This patch might be sub-optimal and contains style(9) error but if it
works we are
on the right way.
Let me know if it works for you.

Thanks

--
Gianni
diff -r d7d0e04f42e3 sys/dev/acpica/acpi_cpu.c
--- a/sys/dev/acpica/acpi_cpu.c Wed May 12 04:01:56 2010 +0200
+++ b/sys/dev/acpica/acpi_cpu.c Mon May 17 09:21:25 2010 +0200
@@ -88,6 +88,8 @@ struct acpi_cpu_softc {
 int cpu_cx_lowest;
 charcpu_cx_supported[64];
 int cpu_rid;
+   struct mtx   cpu_lock;
+   int  cpu_disable_idle;
 };
 
 struct acpi_cpu_device {
@@ -100,6 +102,10 @@ struct acpi_cpu_device {
 #define CPU_SET_REG(reg, width, val)   \
 (bus_space_write_ ## width(rman_get_bustag((reg)), 
\
   rman_get_bushandle((reg)), 0, (val)))
+#define ACPI_CPU_LOCK(sc) \
+   mtx_lock_spin(&sc->cpu_lock)
+#define ACPI_CPU_UNLOCK(sc) \
+   mtx_unlock_spin(&sc->cpu_lock)
 
 #define PM_USEC(x)  ((x) >> 2) /* ~4 clocks per usec (3.57955 Mhz) */
 
@@ -127,7 +133,6 @@ static uint8_t   cpu_cst_cnt;   /* Indicat
 static int  cpu_quirks;/* Indicate any hardware bugs. */
 
 /* Runtime state. */
-static int  cpu_disable_idle; /* Disable entry to idle function */
 static int  cpu_cx_count;  /* Number of valid Cx states */
 
 /* Values for sysctl. */
@@ -284,6 +289,7 @@ acpi_cpu_attach(device_t dev)
 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
 
 sc = device_get_softc(dev);
+   mtx_init(&sc->cpu_lock, "ntflck", NULL, MTX_SPIN);
 sc->cpu_dev = dev;
 sc->cpu_handle = acpi_get_handle(dev);
 cpu_id = (int)(intptr_t)acpi_get_private(dev);
@@ -409,27 +415,30 @@ acpi_cpu_postattach(void *unused __unuse
 SYSINIT(acpi_cpu, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE,
 acpi_cpu_postattach, NULL);
 
-/*
- * Disable any entry to the idle function during suspend and re-enable it
- * during resume.
- */
 static int
 acpi_cpu_suspend(device_t dev)
 {
+struct acpi_cpu_softc *sc;
 int error;
 
+sc = device_get_softc(dev);
 error = bus_generic_suspend(dev);
 if (error)
return (error);
-cpu_disable_idle = TRUE;
+   ACPI_CPU_LOCK(sc);
+sc->cpu_disable_idle = TRUE;
+   ACPI_CPU_UNLOCK(sc);
+
 return (0);
 }
 
 static int
 acpi_cpu_resume(device_t dev)
 {
+struct acpi_cpu_softc *sc;
 
-cpu_disable_idle = FALSE;
+sc = device_get_softc(dev);
+sc->cpu_disable_idle = FALSE;
 return (bus_generic_resume(dev));
 }
 
@@ -523,16 +532,16 @@ acpi_cpu_shutdown(device_t dev)
 {
 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
 
+struct acpi_cpu_softc *sc;
+
+sc

Re: Kernel panic when unpluggin AC adaptor

2010-05-18 Thread Brandon Gooch
On Tue, May 18, 2010 at 9:04 AM, Giovanni Trematerra
 wrote:
> On Sat, May 15, 2010 at 9:12 PM, Brandon Gooch
>  wrote:
>> On Thu, May 13, 2010 at 7:25 PM, Giovanni Trematerra
>>  wrote:
>>> On Thu, May 13, 2010 at 1:09 AM, Brandon Gooch
>>>  wrote:
 On Wed, May 12, 2010 at 9:41 AM, Attilio Rao  wrote:
> 2010/5/12 David DEMELIER :
>> I remove the patch, and built the kernel (I updated the src this
>> morning) and it does not panic now. It's really odd. If it reappears
>> soon I will tell you.
>
> I looked at the code with Giovanni and I have the feeling that the
> race with the idle thread may still be fatal.
> We need to fix that.
>
> Attilio
>

 That seems to be the case, as my laptop shows about an 80-85 % chance
 of experiencing a panic if left idle for long-ish periods of time (2
 to 4 hours). I usually rebuild world or big ports overnight, and more
 often than not I wake up to a panicked machine, same situation every
 time:

 ...
 rman_get_bushandle() at rman_get_bushandle+0x1
 sched_idletd() at sched_idletd+0x123
 fork_exit() at fork_exit+0x12a
 fork_trampoline() at fork_trampoline+0xe
 ...

 The kernel/userland is rebuilt, the ports are finished compiling --
 it's in the time AFTER the completion of all tasks that the machine
 gets bored and tries to kill itself :)

 I have seen the AC adapter plug/unplug "hang" in the past on this
 laptop, but I never made the connection between the events, as
 nowadays my laptop usually stays plugged in :(

 Attilio, I hope you can track this one down, let me know if I can do
 anything to help or test...

>>>
>>> Attilio and I came up with this patch. It seems ready for stress
>>> testing and review
>>> Please test and report back.
>>>
>>> Thank you
>>>
>>> P.S: all the faults are only mine.
>>
>> I tried the patch, and my kernel panics I panic on boot. I have
>> 8.5MB(!) of JPG images (6 of them) if anyone needs to see them. I'm
>> looking for a place to post them, but if anyone wants, I can send via
>> e-mail...
>
> Hi Brandon,
> Could you please, try this new one? The panic at boot stage should be solved,
> at least I tried on a 8-way machine and all went ok at boot.
> Please, remove WITNESS_SKIPSPIN from your kernel config file.
> This patch might be sub-optimal and contains style(9) error but if it
> works we are
> on the right way.
> Let me know if it works for you.

Applied the patch, built, installed, and booted new kernel: no panic!

I will remove WITNESS_SKIPSPIN and build another kernel. Then I'll
"try" to trigger the panic (by letting my laptop sit idle after a
buildworld session).

Thanks for giving this some attention, I hope you and/or others are
able to get to the bottom of this...

-Brandon
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-19 Thread Brandon Gooch
On Tue, May 18, 2010 at 10:47 PM, Brandon Gooch
 wrote:
> On Tue, May 18, 2010 at 9:04 AM, Giovanni Trematerra
>  wrote:
>> On Sat, May 15, 2010 at 9:12 PM, Brandon Gooch
>>  wrote:
>>> On Thu, May 13, 2010 at 7:25 PM, Giovanni Trematerra
>>>  wrote:
 On Thu, May 13, 2010 at 1:09 AM, Brandon Gooch
  wrote:
> On Wed, May 12, 2010 at 9:41 AM, Attilio Rao  wrote:
>> 2010/5/12 David DEMELIER :
>>> I remove the patch, and built the kernel (I updated the src this
>>> morning) and it does not panic now. It's really odd. If it reappears
>>> soon I will tell you.
>>
>> I looked at the code with Giovanni and I have the feeling that the
>> race with the idle thread may still be fatal.
>> We need to fix that.
>>
>> Attilio
>>
>
> That seems to be the case, as my laptop shows about an 80-85 % chance
> of experiencing a panic if left idle for long-ish periods of time (2
> to 4 hours). I usually rebuild world or big ports overnight, and more
> often than not I wake up to a panicked machine, same situation every
> time:
>
> ...
> rman_get_bushandle() at rman_get_bushandle+0x1
> sched_idletd() at sched_idletd+0x123
> fork_exit() at fork_exit+0x12a
> fork_trampoline() at fork_trampoline+0xe
> ...
>
> The kernel/userland is rebuilt, the ports are finished compiling --
> it's in the time AFTER the completion of all tasks that the machine
> gets bored and tries to kill itself :)
>
> I have seen the AC adapter plug/unplug "hang" in the past on this
> laptop, but I never made the connection between the events, as
> nowadays my laptop usually stays plugged in :(
>
> Attilio, I hope you can track this one down, let me know if I can do
> anything to help or test...
>

 Attilio and I came up with this patch. It seems ready for stress
 testing and review
 Please test and report back.

 Thank you

 P.S: all the faults are only mine.
>>>
>>> I tried the patch, and my kernel panics I panic on boot. I have
>>> 8.5MB(!) of JPG images (6 of them) if anyone needs to see them. I'm
>>> looking for a place to post them, but if anyone wants, I can send via
>>> e-mail...
>>
>> Hi Brandon,
>> Could you please, try this new one? The panic at boot stage should be solved,
>> at least I tried on a 8-way machine and all went ok at boot.
>> Please, remove WITNESS_SKIPSPIN from your kernel config file.
>> This patch might be sub-optimal and contains style(9) error but if it
>> works we are
>> on the right way.
>> Let me know if it works for you.
>
> Applied the patch, built, installed, and booted new kernel: no panic!
>
> I will remove WITNESS_SKIPSPIN and build another kernel. Then I'll
> "try" to trigger the panic (by letting my laptop sit idle after a
> buildworld session).
>
> Thanks for giving this some attention, I hope you and/or others are
> able to get to the bottom of this...

Hey everyone, just reporting in:

The laptop has experienced the longest uptime it's seen in a while --
so far, so good!

I'll keep the machine up and running just in case...

-Brandon
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-24 Thread David DEMELIER
2010/5/12 Giovanni Trematerra :
> On Fri, May 7, 2010 at 8:33 PM, Demelier David  
> wrote:
>> Le Vendredi 07 mai 2010 à 18:22 +0200, Giovanni Trematerra a écrit :
>>> On Fri, May 7, 2010 at 2:08 PM, Demelier David  
>>> wrote:
>>> > Hi,
>>> >        I noticed that pluggin the AC adaptor when I boot without it does 
>>> > not
>>> >        panic. It only panic when removing it.
>>> >
>>> >        Maybe that could help ?
>>> >
>>>
>>> Good to know. The problem lies somewhere when performance state change.
>>> In your case it happens when you remove AC adaptor. Let's hope someone on
>>> acpi@ ml comes up with a good idea.
>>>
>>
>> Okay so for the moment no change, I'll wait for someone with an idea
>> that could solve my problem. For me because the panic only happens when
>> changing profile from ac plugged -> ac unplugged (and not the reverse) I
>> would think it's a cpu related acpi issue.
>>
>
> I looked deeper and it seems to me that when you unplug the AC
> adapter, acpi_cpu_notify calls acpi_cpu_cx_cst that try to allocate a
> new cx_ptr->p_lvlx  via acpi_PkgGas.
> If acpi_PkgGas set cx_ptr->p_lvlx to NULL for any reasons you'll have
> the panic that you reported.
> A solution would be to set acpi_cpu_hook to NULL so acpi_cpu_idle won't call 
> it.
> I need some time to have a patch because of the possible race between
> acpi_cpu_notify and
> acpi_cpu_idle during set acpi_cpu_hook to NULL.
> if you have time and want panic your system you could try the attached
> patch, just to be
> sure that we catch it.
>

Hi, it paniced today ! I don't know why it randomly panic but it did,
the backtrace didn't change. There is a picture about the panic :

http://img541.imageshack.us/img541/2773/dsc00388xa.jpg

Cheers.

-- 
Demelier David
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-24 Thread Giovanni Trematerra
On Mon, May 24, 2010 at 9:43 PM, David DEMELIER
 wrote:
> 2010/5/12 Giovanni Trematerra :
>> On Fri, May 7, 2010 at 8:33 PM, Demelier David  
>> wrote:
>>> Le Vendredi 07 mai 2010 à 18:22 +0200, Giovanni Trematerra a écrit :
 On Fri, May 7, 2010 at 2:08 PM, Demelier David  
 wrote:
 > Hi,
 >        I noticed that pluggin the AC adaptor when I boot without it does 
 > not
 >        panic. It only panic when removing it.
 >
 >        Maybe that could help ?
 >

 Good to know. The problem lies somewhere when performance state change.
 In your case it happens when you remove AC adaptor. Let's hope someone on
 acpi@ ml comes up with a good idea.

>>>
>>> Okay so for the moment no change, I'll wait for someone with an idea
>>> that could solve my problem. For me because the panic only happens when
>>> changing profile from ac plugged -> ac unplugged (and not the reverse) I
>>> would think it's a cpu related acpi issue.
>>>
>>
>> I looked deeper and it seems to me that when you unplug the AC
>> adapter, acpi_cpu_notify calls acpi_cpu_cx_cst that try to allocate a
>> new cx_ptr->p_lvlx  via acpi_PkgGas.
>> If acpi_PkgGas set cx_ptr->p_lvlx to NULL for any reasons you'll have
>> the panic that you reported.
>> A solution would be to set acpi_cpu_hook to NULL so acpi_cpu_idle won't call 
>> it.
>> I need some time to have a patch because of the possible race between
>> acpi_cpu_notify and
>> acpi_cpu_idle during set acpi_cpu_hook to NULL.
>> if you have time and want panic your system you could try the attached
>> patch, just to be
>> sure that we catch it.
>>
>
> Hi, it paniced today ! I don't know why it randomly panic but it did,
> the backtrace didn't change. There is a picture about the panic :
>
> http://img541.imageshack.us/img541/2773/dsc00388xa.jpg

What was you trying? acpi_idle5.diff.txt patch?
How did it panic? Unplugging AC adapter?

Thanks

--
Gianni
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-25 Thread David DEMELIER
2010/5/25 Giovanni Trematerra :
> On Mon, May 24, 2010 at 9:43 PM, David DEMELIER
>  wrote:
>> 2010/5/12 Giovanni Trematerra :
>>> On Fri, May 7, 2010 at 8:33 PM, Demelier David  
>>> wrote:
 Le Vendredi 07 mai 2010 à 18:22 +0200, Giovanni Trematerra a écrit :
> On Fri, May 7, 2010 at 2:08 PM, Demelier David  
> wrote:
> > Hi,
> >        I noticed that pluggin the AC adaptor when I boot without it 
> > does not
> >        panic. It only panic when removing it.
> >
> >        Maybe that could help ?
> >
>
> Good to know. The problem lies somewhere when performance state change.
> In your case it happens when you remove AC adaptor. Let's hope someone on
> acpi@ ml comes up with a good idea.
>

 Okay so for the moment no change, I'll wait for someone with an idea
 that could solve my problem. For me because the panic only happens when
 changing profile from ac plugged -> ac unplugged (and not the reverse) I
 would think it's a cpu related acpi issue.

>>>
>>> I looked deeper and it seems to me that when you unplug the AC
>>> adapter, acpi_cpu_notify calls acpi_cpu_cx_cst that try to allocate a
>>> new cx_ptr->p_lvlx  via acpi_PkgGas.
>>> If acpi_PkgGas set cx_ptr->p_lvlx to NULL for any reasons you'll have
>>> the panic that you reported.
>>> A solution would be to set acpi_cpu_hook to NULL so acpi_cpu_idle won't 
>>> call it.
>>> I need some time to have a patch because of the possible race between
>>> acpi_cpu_notify and
>>> acpi_cpu_idle during set acpi_cpu_hook to NULL.
>>> if you have time and want panic your system you could try the attached
>>> patch, just to be
>>> sure that we catch it.
>>>
>>
>> Hi, it paniced today ! I don't know why it randomly panic but it did,
>> the backtrace didn't change. There is a picture about the panic :
>>
>> http://img541.imageshack.us/img541/2773/dsc00388xa.jpg
>
> What was you trying? acpi_idle5.diff.txt patch?
> How did it panic? Unplugging AC adapter?
>

Hi, I tried this one : lvlx.diff.txt. Yes by unplugging the AC adapter.

-- 
Demelier David
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-25 Thread Giovanni Trematerra
On Tue, May 25, 2010 at 5:52 PM, David DEMELIER
 wrote:
> 2010/5/25 Giovanni Trematerra :
>> On Mon, May 24, 2010 at 9:43 PM, David DEMELIER
>>  wrote:
>>> 2010/5/12 Giovanni Trematerra :
 On Fri, May 7, 2010 at 8:33 PM, Demelier David  
 wrote:
> Le Vendredi 07 mai 2010 à 18:22 +0200, Giovanni Trematerra a écrit :
>> On Fri, May 7, 2010 at 2:08 PM, Demelier David 
>>  wrote:
>> > Hi,
>> >        I noticed that pluggin the AC adaptor when I boot without it 
>> > does not
>> >        panic. It only panic when removing it.
>> >
>> >        Maybe that could help ?
>> >
>>
>> Good to know. The problem lies somewhere when performance state change.
>> In your case it happens when you remove AC adaptor. Let's hope someone on
>> acpi@ ml comes up with a good idea.
>>
>
> Okay so for the moment no change, I'll wait for someone with an idea
> that could solve my problem. For me because the panic only happens when
> changing profile from ac plugged -> ac unplugged (and not the reverse) I
> would think it's a cpu related acpi issue.
>

 I looked deeper and it seems to me that when you unplug the AC
 adapter, acpi_cpu_notify calls acpi_cpu_cx_cst that try to allocate a
 new cx_ptr->p_lvlx  via acpi_PkgGas.
 If acpi_PkgGas set cx_ptr->p_lvlx to NULL for any reasons you'll have
 the panic that you reported.
 A solution would be to set acpi_cpu_hook to NULL so acpi_cpu_idle won't 
 call it.
 I need some time to have a patch because of the possible race between
 acpi_cpu_notify and
 acpi_cpu_idle during set acpi_cpu_hook to NULL.
 if you have time and want panic your system you could try the attached
 patch, just to be
 sure that we catch it.

>>>
>>> Hi, it paniced today ! I don't know why it randomly panic but it did,
>>> the backtrace didn't change. There is a picture about the panic :
>>>
>>> http://img541.imageshack.us/img541/2773/dsc00388xa.jpg
>>
>> What was you trying? acpi_idle5.diff.txt patch?
>> How did it panic? Unplugging AC adapter?
>>
>
> Hi, I tried this one : lvlx.diff.txt. Yes by unplugging the AC adapter.
>

This is an old one. Could you try acpi_idle5.diff.txt? I kept you in
Cc when I sent to
the list. If you have problems, let me know, I'll resend to you  the patch.

Thank you.

--
Gianni
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-26 Thread David DEMELIER
2010/5/25 Giovanni Trematerra :
> On Tue, May 25, 2010 at 5:52 PM, David DEMELIER
>  wrote:
>> 2010/5/25 Giovanni Trematerra :
>>> On Mon, May 24, 2010 at 9:43 PM, David DEMELIER
>>>  wrote:
 2010/5/12 Giovanni Trematerra :
> On Fri, May 7, 2010 at 8:33 PM, Demelier David  
> wrote:
>> Le Vendredi 07 mai 2010 à 18:22 +0200, Giovanni Trematerra a écrit :
>>> On Fri, May 7, 2010 at 2:08 PM, Demelier David 
>>>  wrote:
>>> > Hi,
>>> >        I noticed that pluggin the AC adaptor when I boot without it 
>>> > does not
>>> >        panic. It only panic when removing it.
>>> >
>>> >        Maybe that could help ?
>>> >
>>>
>>> Good to know. The problem lies somewhere when performance state change.
>>> In your case it happens when you remove AC adaptor. Let's hope someone 
>>> on
>>> acpi@ ml comes up with a good idea.
>>>
>>
>> Okay so for the moment no change, I'll wait for someone with an idea
>> that could solve my problem. For me because the panic only happens when
>> changing profile from ac plugged -> ac unplugged (and not the reverse) I
>> would think it's a cpu related acpi issue.
>>
>
> I looked deeper and it seems to me that when you unplug the AC
> adapter, acpi_cpu_notify calls acpi_cpu_cx_cst that try to allocate a
> new cx_ptr->p_lvlx  via acpi_PkgGas.
> If acpi_PkgGas set cx_ptr->p_lvlx to NULL for any reasons you'll have
> the panic that you reported.
> A solution would be to set acpi_cpu_hook to NULL so acpi_cpu_idle won't 
> call it.
> I need some time to have a patch because of the possible race between
> acpi_cpu_notify and
> acpi_cpu_idle during set acpi_cpu_hook to NULL.
> if you have time and want panic your system you could try the attached
> patch, just to be
> sure that we catch it.
>

 Hi, it paniced today ! I don't know why it randomly panic but it did,
 the backtrace didn't change. There is a picture about the panic :

 http://img541.imageshack.us/img541/2773/dsc00388xa.jpg
>>>
>>> What was you trying? acpi_idle5.diff.txt patch?
>>> How did it panic? Unplugging AC adapter?
>>>
>>
>> Hi, I tried this one : lvlx.diff.txt. Yes by unplugging the AC adapter.
>>
>
> This is an old one. Could you try acpi_idle5.diff.txt? I kept you in
> Cc when I sent to
> the list. If you have problems, let me know, I'll resend to you  the patch.
>
> Thank you.
>

Hi, it panic'ed with the same backtrace.

Thanks.

-- 
Demelier David
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-26 Thread Giovanni Trematerra
On Wed, May 26, 2010 at 11:14 AM, David DEMELIER
 wrote:
> 2010/5/25 Giovanni Trematerra :
>> On Tue, May 25, 2010 at 5:52 PM, David DEMELIER
>>  wrote:
>>> 2010/5/25 Giovanni Trematerra :
 On Mon, May 24, 2010 at 9:43 PM, David DEMELIER
  wrote:
> 2010/5/12 Giovanni Trematerra :
>> On Fri, May 7, 2010 at 8:33 PM, Demelier David 
>>  wrote:
>>> Le Vendredi 07 mai 2010 à 18:22 +0200, Giovanni Trematerra a écrit :
 On Fri, May 7, 2010 at 2:08 PM, Demelier David 
  wrote:
 > Hi,
 >        I noticed that pluggin the AC adaptor when I boot without it 
 > does not
 >        panic. It only panic when removing it.
 >
 >        Maybe that could help ?
 >

 Good to know. The problem lies somewhere when performance state change.
 In your case it happens when you remove AC adaptor. Let's hope someone 
 on
 acpi@ ml comes up with a good idea.

>>>
>>> Okay so for the moment no change, I'll wait for someone with an idea
>>> that could solve my problem. For me because the panic only happens when
>>> changing profile from ac plugged -> ac unplugged (and not the reverse) I
>>> would think it's a cpu related acpi issue.
>>>
>>
>> I looked deeper and it seems to me that when you unplug the AC
>> adapter, acpi_cpu_notify calls acpi_cpu_cx_cst that try to allocate a
>> new cx_ptr->p_lvlx  via acpi_PkgGas.
>> If acpi_PkgGas set cx_ptr->p_lvlx to NULL for any reasons you'll have
>> the panic that you reported.
>> A solution would be to set acpi_cpu_hook to NULL so acpi_cpu_idle won't 
>> call it.
>> I need some time to have a patch because of the possible race between
>> acpi_cpu_notify and
>> acpi_cpu_idle during set acpi_cpu_hook to NULL.
>> if you have time and want panic your system you could try the attached
>> patch, just to be
>> sure that we catch it.
>>
>
> Hi, it paniced today ! I don't know why it randomly panic but it did,
> the backtrace didn't change. There is a picture about the panic :
>
> http://img541.imageshack.us/img541/2773/dsc00388xa.jpg

 What was you trying? acpi_idle5.diff.txt patch?
 How did it panic? Unplugging AC adapter?

>>>
>>> Hi, I tried this one : lvlx.diff.txt. Yes by unplugging the AC adapter.
>>>
>>
>> This is an old one. Could you try acpi_idle5.diff.txt? I kept you in
>> Cc when I sent to
>> the list. If you have problems, let me know, I'll resend to you  the patch.
>>
>> Thank you.
>>
>
> Hi, it panic'ed with the same backtrace.
>

Can you please post your dmesg?

Thanks

--
Gianni
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-26 Thread David DEMELIER
2010/5/26 Giovanni Trematerra :
> On Wed, May 26, 2010 at 11:14 AM, David DEMELIER
>  wrote:
>> 2010/5/25 Giovanni Trematerra :
>>> On Tue, May 25, 2010 at 5:52 PM, David DEMELIER
>>>  wrote:
 2010/5/25 Giovanni Trematerra :
> On Mon, May 24, 2010 at 9:43 PM, David DEMELIER
>  wrote:
>> 2010/5/12 Giovanni Trematerra :
>>> On Fri, May 7, 2010 at 8:33 PM, Demelier David 
>>>  wrote:
 Le Vendredi 07 mai 2010 à 18:22 +0200, Giovanni Trematerra a écrit :
> On Fri, May 7, 2010 at 2:08 PM, Demelier David 
>  wrote:
> > Hi,
> >        I noticed that pluggin the AC adaptor when I boot without it 
> > does not
> >        panic. It only panic when removing it.
> >
> >        Maybe that could help ?
> >
>
> Good to know. The problem lies somewhere when performance state 
> change.
> In your case it happens when you remove AC adaptor. Let's hope 
> someone on
> acpi@ ml comes up with a good idea.
>

 Okay so for the moment no change, I'll wait for someone with an idea
 that could solve my problem. For me because the panic only happens when
 changing profile from ac plugged -> ac unplugged (and not the reverse) 
 I
 would think it's a cpu related acpi issue.

>>>
>>> I looked deeper and it seems to me that when you unplug the AC
>>> adapter, acpi_cpu_notify calls acpi_cpu_cx_cst that try to allocate a
>>> new cx_ptr->p_lvlx  via acpi_PkgGas.
>>> If acpi_PkgGas set cx_ptr->p_lvlx to NULL for any reasons you'll have
>>> the panic that you reported.
>>> A solution would be to set acpi_cpu_hook to NULL so acpi_cpu_idle won't 
>>> call it.
>>> I need some time to have a patch because of the possible race between
>>> acpi_cpu_notify and
>>> acpi_cpu_idle during set acpi_cpu_hook to NULL.
>>> if you have time and want panic your system you could try the attached
>>> patch, just to be
>>> sure that we catch it.
>>>
>>
>> Hi, it paniced today ! I don't know why it randomly panic but it did,
>> the backtrace didn't change. There is a picture about the panic :
>>
>> http://img541.imageshack.us/img541/2773/dsc00388xa.jpg
>
> What was you trying? acpi_idle5.diff.txt patch?
> How did it panic? Unplugging AC adapter?
>

 Hi, I tried this one : lvlx.diff.txt. Yes by unplugging the AC adapter.

>>>
>>> This is an old one. Could you try acpi_idle5.diff.txt? I kept you in
>>> Cc when I sent to
>>> the list. If you have problems, let me know, I'll resend to you  the patch.
>>>
>>> Thank you.
>>>
>>
>> Hi, it panic'ed with the same backtrace.
>>
>
> Can you please post your dmesg?
>

Sent !

-- 
Demelier David
Copyright (c) 1992-2010 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 8.1-PRERELEASE #3: Wed May 26 11:48:16 CEST 2010
r...@melon.malikania.fr:/usr/obj/usr/src/sys/Melon amd64
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: Intel(R) Core(TM)2 Duo CPU T6570  @ 2.10GHz (2094.77-MHz K8-class CPU)
  Origin = "GenuineIntel"  Id = 0x1067a  Family = 6  Model = 17  Stepping = 10
  
Features=0xbfebfbff
  
Features2=0x408e3bd
  AMD Features=0x20100800
  AMD Features2=0x1
  TSC: P-state invariant
real memory  = 3221225472 (3072 MB)
avail memory = 3092127744 (2948 MB)
ACPI APIC Table: 
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
FreeBSD/SMP: 1 package(s) x 2 core(s)
 cpu0 (BSP): APIC ID:  0
 cpu1 (AP): APIC ID:  1
ioapic0: Changing APIC ID to 1
ioapic0  irqs 0-23 on motherboard
kbd1 at kbdmux0
cryptosoft0:  on motherboard
acpi0:  on motherboard
acpi0: [ITHREAD]
acpi0: Power Button (fixed)
acpi_hpet0:  iomem 0xfed0-0xfed003ff on acpi0
Timecounter "HPET" frequency 14318180 Hz quality 900
Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x408-0x40b on acpi0
cpu0:  on acpi0
cpu1:  on acpi0
acpi_ec0:  port 0x62,0x66 on acpi0
pcib0:  port 0xcf8-0xcff on acpi0
pci0:  on pcib0
pcib1:  irq 16 at device 1.0 on pci0
pci1:  on pcib1
vgapci0:  port 0x7000-0x70ff mem 
0xc000-0xcfff,0xd840-0xd840 irq 16 at device 0.0 on pci1
acpi_video0:  on vgapci0
hdac0:  mem 0xd841-0xd8413fff 
irq 17 at device 0.1 on pci1
hdac0: HDA Driver Revision: 20100226_0142
hdac0: [ITHREAD]
uhci0:  port 0x80a0-0x80bf irq 16 at device 
26.0 on pci0
uhci0: [ITHREAD]
usbus0:  on uhci0
uhci1:  port 0x8080-0x809f irq 17 at device 
26.1 on pci0
uhci1: [ITHREAD]
usbus1:  on uhci1
uhci2:  port 0x8060-0x807f irq 18 at device 
26.2 on pci0
uhci2: [ITHREAD]
usbus2:  on uhci2
ehci0:  mem 0xd8504400-0xd85047ff irq 
19 at device 26.7 on pci0
ehci0: [ITHREAD]
usbus3: EHCI version 1.0
usbus3: 

Re: Kernel panic when unpluggin AC adaptor

2010-05-26 Thread Giovanni Trematerra
On Wed, May 26, 2010 at 12:01 PM, David DEMELIER
 wrote:
> 2010/5/26 Giovanni Trematerra :
>> On Wed, May 26, 2010 at 11:14 AM, David DEMELIER
>>  wrote:
>>> 2010/5/25 Giovanni Trematerra :
 On Tue, May 25, 2010 at 5:52 PM, David DEMELIER
  wrote:
> 2010/5/25 Giovanni Trematerra :
>> On Mon, May 24, 2010 at 9:43 PM, David DEMELIER
>>  wrote:
>>> 2010/5/12 Giovanni Trematerra :
 On Fri, May 7, 2010 at 8:33 PM, Demelier David 
  wrote:
> Le Vendredi 07 mai 2010 à 18:22 +0200, Giovanni Trematerra a écrit :
>> On Fri, May 7, 2010 at 2:08 PM, Demelier David 
>>  wrote:
>> > Hi,
>> >        I noticed that pluggin the AC adaptor when I boot without 
>> > it does not
>> >        panic. It only panic when removing it.
>> >
>> >        Maybe that could help ?
>> >
>>
>> Good to know. The problem lies somewhere when performance state 
>> change.
>> In your case it happens when you remove AC adaptor. Let's hope 
>> someone on
>> acpi@ ml comes up with a good idea.
>>
>
> Okay so for the moment no change, I'll wait for someone with an idea
> that could solve my problem. For me because the panic only happens 
> when
> changing profile from ac plugged -> ac unplugged (and not the 
> reverse) I
> would think it's a cpu related acpi issue.
>

 I looked deeper and it seems to me that when you unplug the AC
 adapter, acpi_cpu_notify calls acpi_cpu_cx_cst that try to allocate a
 new cx_ptr->p_lvlx  via acpi_PkgGas.
 If acpi_PkgGas set cx_ptr->p_lvlx to NULL for any reasons you'll have
 the panic that you reported.
 A solution would be to set acpi_cpu_hook to NULL so acpi_cpu_idle 
 won't call it.
 I need some time to have a patch because of the possible race between
 acpi_cpu_notify and
 acpi_cpu_idle during set acpi_cpu_hook to NULL.
 if you have time and want panic your system you could try the attached
 patch, just to be
 sure that we catch it.

>>>
>>> Hi, it paniced today ! I don't know why it randomly panic but it did,
>>> the backtrace didn't change. There is a picture about the panic :
>>>
>>> http://img541.imageshack.us/img541/2773/dsc00388xa.jpg
>>
>> What was you trying? acpi_idle5.diff.txt patch?
>> How did it panic? Unplugging AC adapter?
>>
>
> Hi, I tried this one : lvlx.diff.txt. Yes by unplugging the AC adapter.
>

 This is an old one. Could you try acpi_idle5.diff.txt? I kept you in
 Cc when I sent to
 the list. If you have problems, let me know, I'll resend to you  the patch.

 Thank you.

>>>
>>> Hi, it panic'ed with the same backtrace.
>>>
>>
>> Can you please post your dmesg?
>>
>
> Sent !

As your PC is in a good mood to make test, :)
could you try this patch?

Thank you

--
Gianni
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-05-26 Thread Giovanni Trematerra
On Wed, May 26, 2010 at 3:55 PM, Giovanni Trematerra
 wrote:
> On Wed, May 26, 2010 at 12:01 PM, David DEMELIER
>  wrote:
>> 2010/5/26 Giovanni Trematerra :
>>> On Wed, May 26, 2010 at 11:14 AM, David DEMELIER
>>>  wrote:
 2010/5/25 Giovanni Trematerra :
> On Tue, May 25, 2010 at 5:52 PM, David DEMELIER
>  wrote:
>> 2010/5/25 Giovanni Trematerra :
>>> On Mon, May 24, 2010 at 9:43 PM, David DEMELIER
>>>  wrote:
 2010/5/12 Giovanni Trematerra :
> On Fri, May 7, 2010 at 8:33 PM, Demelier David 
>  wrote:
>> Le Vendredi 07 mai 2010 à 18:22 +0200, Giovanni Trematerra a écrit :
>>> On Fri, May 7, 2010 at 2:08 PM, Demelier David 
>>>  wrote:
>>> > Hi,
>>> >        I noticed that pluggin the AC adaptor when I boot without 
>>> > it does not
>>> >        panic. It only panic when removing it.
>>> >
>>> >        Maybe that could help ?
>>> >
>>>
>>> Good to know. The problem lies somewhere when performance state 
>>> change.
>>> In your case it happens when you remove AC adaptor. Let's hope 
>>> someone on
>>> acpi@ ml comes up with a good idea.
>>>
>>
>> Okay so for the moment no change, I'll wait for someone with an idea
>> that could solve my problem. For me because the panic only happens 
>> when
>> changing profile from ac plugged -> ac unplugged (and not the 
>> reverse) I
>> would think it's a cpu related acpi issue.
>>
>
> I looked deeper and it seems to me that when you unplug the AC
> adapter, acpi_cpu_notify calls acpi_cpu_cx_cst that try to allocate a
> new cx_ptr->p_lvlx  via acpi_PkgGas.
> If acpi_PkgGas set cx_ptr->p_lvlx to NULL for any reasons you'll have
> the panic that you reported.
> A solution would be to set acpi_cpu_hook to NULL so acpi_cpu_idle 
> won't call it.
> I need some time to have a patch because of the possible race between
> acpi_cpu_notify and
> acpi_cpu_idle during set acpi_cpu_hook to NULL.
> if you have time and want panic your system you could try the attached
> patch, just to be
> sure that we catch it.
>

 Hi, it paniced today ! I don't know why it randomly panic but it did,
 the backtrace didn't change. There is a picture about the panic :

 http://img541.imageshack.us/img541/2773/dsc00388xa.jpg
>>>
>>> What was you trying? acpi_idle5.diff.txt patch?
>>> How did it panic? Unplugging AC adapter?
>>>
>>
>> Hi, I tried this one : lvlx.diff.txt. Yes by unplugging the AC adapter.
>>
>
> This is an old one. Could you try acpi_idle5.diff.txt? I kept you in
> Cc when I sent to
> the list. If you have problems, let me know, I'll resend to you  the 
> patch.
>
> Thank you.
>

 Hi, it panic'ed with the same backtrace.

>>>
>>> Can you please post your dmesg?
>>>
>>
>> Sent !
>
> As your PC is in a good mood to make test, :)
> could you try this patch?
>
> Thank you
>
> --
> Gianni
>

Here the patch :(
diff -r ac95a73d358d sys/dev/acpica/acpi_cpu.c
--- a/sys/dev/acpica/acpi_cpu.c Tue May 18 08:13:40 2010 -0400
+++ b/sys/dev/acpica/acpi_cpu.c Wed May 26 09:44:49 2010 -0400
@@ -88,6 +88,7 @@ struct acpi_cpu_softc {
 int cpu_cx_lowest;
 charcpu_cx_supported[64];
 int cpu_rid;
+struct mtx  cpu_lock;
 };
 
 struct acpi_cpu_device {
@@ -100,6 +101,10 @@ struct acpi_cpu_device {
 #define CPU_SET_REG(reg, width, val)   \
 (bus_space_write_ ## width(rman_get_bustag((reg)), 
\
   rman_get_bushandle((reg)), 0, (val)))
+#define ACPI_CPU_LOCK(sc)  \
+mtx_lock_spin(&sc->cpu_lock)
+#define ACPI_CPU_UNLOCK(sc)\
+mtx_unlock_spin(&sc->cpu_lock)
 
 #define PM_USEC(x)  ((x) >> 2) /* ~4 clocks per usec (3.57955 Mhz) */
 
@@ -127,7 +132,7 @@ static int   cpu_quirks;/* Indicate any
 static int  cpu_quirks;/* Indicate any hardware bugs. */
 
 /* Runtime state. */
-static int  cpu_disable_idle; /* Disable entry to idle function */
+static int  cpu_disable_idle; /* Global disable idle function */
 static int  cpu_cx_count;  /* Number of valid Cx states */
 
 /* Values for sysctl. */
@@ -284,6 +289,7 @@ acpi_cpu_attach(device_t dev)
 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
 
 sc = device_get_softc(dev);
+mtx_init(&sc->cpu_lock, "ntflck", NULL, MTX_SPIN);
 sc->cpu_dev = dev;
 sc->cpu_handle = acpi_get_handle(dev);
 cpu_id = (int)(intptr_t)acpi_get_private(dev);
@@ -416,20 +422,25 @@ static int
 static int
 acpi_cpu_suspend(device_t dev)
 {
+struc

Re: Kernel panic when unpluggin AC adaptor

2010-05-26 Thread David DEMELIER
2010/5/26 Giovanni Trematerra :
> On Wed, May 26, 2010 at 3:55 PM, Giovanni Trematerra
>  wrote:
>> On Wed, May 26, 2010 at 12:01 PM, David DEMELIER
>>  wrote:
>>> 2010/5/26 Giovanni Trematerra :
 On Wed, May 26, 2010 at 11:14 AM, David DEMELIER
  wrote:
> 2010/5/25 Giovanni Trematerra :
>> On Tue, May 25, 2010 at 5:52 PM, David DEMELIER
>>  wrote:
>>> 2010/5/25 Giovanni Trematerra :
 On Mon, May 24, 2010 at 9:43 PM, David DEMELIER
  wrote:
> 2010/5/12 Giovanni Trematerra :
>> On Fri, May 7, 2010 at 8:33 PM, Demelier David 
>>  wrote:
>>> Le Vendredi 07 mai 2010 à 18:22 +0200, Giovanni Trematerra a écrit :
 On Fri, May 7, 2010 at 2:08 PM, Demelier David 
  wrote:
 > Hi,
 >        I noticed that pluggin the AC adaptor when I boot without 
 > it does not
 >        panic. It only panic when removing it.
 >
 >        Maybe that could help ?
 >

 Good to know. The problem lies somewhere when performance state 
 change.
 In your case it happens when you remove AC adaptor. Let's hope 
 someone on
 acpi@ ml comes up with a good idea.

>>>
>>> Okay so for the moment no change, I'll wait for someone with an idea
>>> that could solve my problem. For me because the panic only happens 
>>> when
>>> changing profile from ac plugged -> ac unplugged (and not the 
>>> reverse) I
>>> would think it's a cpu related acpi issue.
>>>
>>
>> I looked deeper and it seems to me that when you unplug the AC
>> adapter, acpi_cpu_notify calls acpi_cpu_cx_cst that try to allocate a
>> new cx_ptr->p_lvlx  via acpi_PkgGas.
>> If acpi_PkgGas set cx_ptr->p_lvlx to NULL for any reasons you'll have
>> the panic that you reported.
>> A solution would be to set acpi_cpu_hook to NULL so acpi_cpu_idle 
>> won't call it.
>> I need some time to have a patch because of the possible race between
>> acpi_cpu_notify and
>> acpi_cpu_idle during set acpi_cpu_hook to NULL.
>> if you have time and want panic your system you could try the 
>> attached
>> patch, just to be
>> sure that we catch it.
>>
>
> Hi, it paniced today ! I don't know why it randomly panic but it did,
> the backtrace didn't change. There is a picture about the panic :
>
> http://img541.imageshack.us/img541/2773/dsc00388xa.jpg

 What was you trying? acpi_idle5.diff.txt patch?
 How did it panic? Unplugging AC adapter?

>>>
>>> Hi, I tried this one : lvlx.diff.txt. Yes by unplugging the AC adapter.
>>>
>>
>> This is an old one. Could you try acpi_idle5.diff.txt? I kept you in
>> Cc when I sent to
>> the list. If you have problems, let me know, I'll resend to you  the 
>> patch.
>>
>> Thank you.
>>
>
> Hi, it panic'ed with the same backtrace.
>

 Can you please post your dmesg?

>>>
>>> Sent !
>>
>> As your PC is in a good mood to make test, :)
>> could you try this patch?
>>
>> Thank you
>>
>> --
>> Gianni
>>
>
> Here the patch :(
>

Sorry, still the same :-(

-- 
Demelier David
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Kernel panic when unpluggin AC adaptor

2010-06-11 Thread Giovanni Trematerra
On Thu, Jun 10, 2010 at 10:58 PM, Giovanni Trematerra
 wrote:
> On Tue, May 4, 2010 at 6:35 PM, David DEMELIER  
> wrote:
>> Good news ! It worked, check the picture here :
>>
>> http://img63.imageshack.us/img63/4244/dsc00361g.jpg
>>
>
> Into the file sys/dev/acpica/acpi_cpu.c at the end of acpi_cpu_notify
> (a per cpu notification handler), called when _CST objects changing,
> global cpu_cx_count is set to the greatest value of all sc->cpu_cx_count
> per-cpu variables. That could result in a panic as David reported,
> because that lets to invoke acpi_cpu_global_cx_lowest_sysctl from
> /etc/rc.d/power_profile, when AC adapter is unplugged,  with a value
> that not all the CPUs could handle in the acpi_cpu_idle.
> The patch also change global cpu_cx_lowest according to new value of
> global cpu_cx_count if needed.
>
> David Demelier made a great work to test every patch I sent him
> to identify the source of the problem.
>
> Please, let me know your comments and possibly commit the patch
> if you think is good enough.

As jhb@ pointed me out in private with the previous patch a CPU could
never enter in the
lowest Cx-state even if it gained.
So I'd like to propose this new solution.
When hw.acpi.cpu.cx_lowest sysctl is set, the global handler in
sys/dev/acpi_cpu.c
will set the greatest sc->cpu_cx_lowest value supported by the CPU and
not the same
value for all CPUs.
Later, when CPU, possibly gain new Cx-states, the acpi_cpu_notify
handler will set
sc->cpu_cx_lowest accordingly with global cx_lowest and the Cx-states
supported by
the CPU.

Now I think that /etc/rc.d/power_profile script has a problem but that
is a different story.
The script select the lowest_value only querying cx-states of the dev.cpu.0.
If different CPUs may have different Cx-states, the script should use
as lowest_value the
lowest value between all the CPUs.

Please, let me know your comments and possibly commit the patch
if you think is good enough.

--
Gianni
diff -r ac95a73d358d sys/dev/acpica/acpi_cpu.c
--- a/sys/dev/acpica/acpi_cpu.c Tue May 18 08:13:40 2010 -0400
+++ b/sys/dev/acpica/acpi_cpu.c Fri Jun 11 03:10:37 2010 -0400
@@ -1009,6 +1009,8 @@ acpi_cpu_notify(ACPI_HANDLE h, UINT32 no
if (isc->cpu_cx_count > cpu_cx_count)
cpu_cx_count = isc->cpu_cx_count;
 }
+if (sc->cpu_cx_lowest < cpu_cx_lowest)
+   acpi_cpu_set_cx_lowest(sc, min(cpu_cx_lowest, sc->cpu_cx_count - 1));
 ACPI_SERIAL_END(cpu);
 }
 
@@ -1204,7 +1206,7 @@ acpi_cpu_global_cx_lowest_sysctl(SYSCTL_
 ACPI_SERIAL_BEGIN(cpu);
 for (i = 0; i < cpu_ndevices; i++) {
sc = device_get_softc(cpu_devices[i]);
-   acpi_cpu_set_cx_lowest(sc, val);
+   acpi_cpu_set_cx_lowest(sc, min(val, sc->cpu_cx_count - 1));
 }
 ACPI_SERIAL_END(cpu);
 
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"

Re: Kernel panic when unpluggin AC adaptor

2010-06-11 Thread John Baldwin
On Friday 11 June 2010 6:27:48 am Giovanni Trematerra wrote:
> On Thu, Jun 10, 2010 at 10:58 PM, Giovanni Trematerra
>  wrote:
> > On Tue, May 4, 2010 at 6:35 PM, David DEMELIER  
wrote:
> >> Good news ! It worked, check the picture here :
> >>
> >> http://img63.imageshack.us/img63/4244/dsc00361g.jpg
> >>
> >
> > Into the file sys/dev/acpica/acpi_cpu.c at the end of acpi_cpu_notify
> > (a per cpu notification handler), called when _CST objects changing,
> > global cpu_cx_count is set to the greatest value of all sc->cpu_cx_count
> > per-cpu variables. That could result in a panic as David reported,
> > because that lets to invoke acpi_cpu_global_cx_lowest_sysctl from
> > /etc/rc.d/power_profile, when AC adapter is unplugged,  with a value
> > that not all the CPUs could handle in the acpi_cpu_idle.
> > The patch also change global cpu_cx_lowest according to new value of
> > global cpu_cx_count if needed.
> >
> > David Demelier made a great work to test every patch I sent him
> > to identify the source of the problem.
> >
> > Please, let me know your comments and possibly commit the patch
> > if you think is good enough.
> 
> As jhb@ pointed me out in private with the previous patch a CPU could
> never enter in the
> lowest Cx-state even if it gained.
> So I'd like to propose this new solution.
> When hw.acpi.cpu.cx_lowest sysctl is set, the global handler in
> sys/dev/acpi_cpu.c
> will set the greatest sc->cpu_cx_lowest value supported by the CPU and
> not the same
> value for all CPUs.
> Later, when CPU, possibly gain new Cx-states, the acpi_cpu_notify
> handler will set
> sc->cpu_cx_lowest accordingly with global cx_lowest and the Cx-states
> supported by
> the CPU.
> 
> Now I think that /etc/rc.d/power_profile script has a problem but that
> is a different story.
> The script select the lowest_value only querying cx-states of the dev.cpu.0.
> If different CPUs may have different Cx-states, the script should use
> as lowest_value the
> lowest value between all the CPUs.

Yes.

> Please, let me know your comments and possibly commit the patch
> if you think is good enough.

I think this is a good compromise for now.

-- 
John Baldwin
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"