Bug 11330 - int3: 0000 in tsc_read_refs when using powernow_k7
Summary: int3: 0000 in tsc_read_refs when using powernow_k7
Status: CLOSED CODE_FIX
Alias: None
Product: Platform Specific/Hardware
Classification: Unclassified
Component: i386 (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: platform_i386
URL:
Keywords:
Depends on:
Blocks: Regressions-2.6.26
  Show dependency tree
 
Reported: 2008-08-14 04:21 UTC by Mikko Vinni
Modified: 2008-08-19 09:57 UTC (History)
3 users (show)

See Also:
Kernel Version: 2.6.27-rc3
Tree: Mainline
Regression: Yes


Attachments

Description Mikko Vinni 2008-08-14 04:21:09 UTC
Latest working kernel version:2.6.26-rc5 (newer ones not tested until 2.6.27-rc2)
Earliest failing kernel version: 2.6.27-rc2
Distribution: Ubuntu 8.04.1
Hardware Environment: hp nx9005, mobile AMD Athlon(tm) XP2000+
Problem Description: loading powernow-k7 causes an int3, and frequency scaling doesn't work.

...
[   32.943714] toshiba_acpi: Unknown parameter `hotkeys_over_acpi'
[   32.970019] ACPI: WMI: Mapper loaded
[   33.220020] powernow: PowerNOW! Technology present. Can scale: frequency and voltage.
[   33.220020] int3: 0000 [#1] 
[   33.220020] Modules linked in: powernow_k7(+) cpufreq_userspace cpufreq_stats cpufreq_powersave cpufreq_conservative wmi sbs sbshc xfs sr_mod sbp2 parport_pc lp parport i2c_ali1535 joydev psmouse serio_raw i2c_ali15x3 i2c_core snd_ali5451 snd_ac97_codec ac97_bus snd_pcm_oss snd_mixer_oss snd_pcm container snd_seq_dummy video output snd_seq_oss snd_seq_midi battery snd_rawmidi snd_seq_midi_event ac button snd_seq snd_timer snd_seq_device snd ati_agp soundcore snd_page_alloc agpgart shpchp pci_hotplug af_packet evdev iptable_nat nf_nat nf_conntrack_ipv4 nf_conntrack iptable_mangle iptable_filter ip_tables x_tables ext3 jbd mbcache ide_cd_mod cdrom ide_disk pata_acpi ata_generic libata scsi_mod dock alim15x3 floppy ide_pci_generic ohci1394 natsemi ide_core ieee1394 ohci_hcd usbcore thermal processor fan fuse fbcon tileblit font bitblit softcursor
[   33.220020] 
[   33.220020] Pid: 4970, comm: modprobe Not tainted (2.6.27-rc3-rieska #1)
[   33.220020] EIP: 0060:[<c03e6e81>] EFLAGS: 00000046 CPU: 0
[   33.220020] EIP is at tsc_read_refs+0x1/0xb0
[   33.220020] EAX: dbcd4ca4 EBX: 00000000 ECX: c0010042 EDX: 00000000
[   33.220020] ESI: 000b0b0b EDI: 00000246 EBP: dbcd4cb8 ESP: dbcd4c60
[   33.220020]  DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 0068
[   33.220020] Process modprobe (pid: 4970, ti=dbcd4000 task=dd4d3c50 task.ti=dbcd4000)
[   33.220020] Stack: c0108b89 ffffffff 0000006c 37303c50 dbcd4d88 deb7da6c c03b4320 00000044 
[   33.220020]        00000000 c03c2da4 001201d2 dbcd4cc0 dd4d0000 dbcd4cb0 c01e5156 dbcd4cb8 
[   33.220020]        c0138c4e dbcd4cd0 00003940 00194663 000b0b0b fffffff4 dbcd4ccc c0108ff7 
[   33.220020] Call Trace:
[   33.220020]  [<c0108b89>] ? native_calibrate_tsc+0x29/0x2c0
[   33.220020]  [<c01e5156>] ? string+0x26/0x90
[   33.220020]  [<c0138c4e>] ? getnstimeofday+0x3e/0xe0
[   33.220020]  [<c0108ff7>] ? recalibrate_cpu_khz+0x37/0x80
[   33.220020]  [<deb801a2>] ? powernow_cpu_init+0x32/0x4ae [powernow_k7]
[   33.220020]  [<c02d73eb>] ? down_write+0xb/0x30
[   33.220020]  [<c0255cb2>] ? cpufreq_add_dev+0xb2/0x260
[   33.220020]  [<c0122c97>] ? release_console_sem+0x187/0x1a0
[   33.220020]  [<c0243575>] ? sysdev_driver_register+0x75/0x120
[   33.220020]  [<c0255985>] ? cpufreq_register_driver+0x55/0xb0
[   33.220020]  [<deb800ce>] ? powernow_init+0x8e/0x130 [powernow_k7]
[   33.220020]  [<c0101239>] ? do_one_initcall+0x29/0x150
[   33.220020]  [<deb80040>] ? powernow_init+0x0/0x130 [powernow_k7]
[   33.220020]  [<c016c71c>] ? __vunmap+0x6c/0xd0
[   33.220020]  [<c0141f57>] ? sys_init_module+0x127/0x1ac0
[   33.220020]  [<c015a645>] ? filemap_fault+0x255/0x3a0
[   33.220020]  [<c0103a3d>] ? sysenter_do_call+0x12/0x25
[   33.220020]  =======================
[   33.220020] Code: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc <cc> cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc 
[   33.220020] EIP: [<c03e6e81>] tsc_read_refs+0x1/0xb0 SS:ESP 0068:dbcd4c60
[   33.220020] ---[ end trace 90ef9dbcb2b9d03e ]---


An alternative trace with -rc2:

[   37.067660] int3: 0000 [#1] 
[   37.067746] Modules linked in: powernow_k7(+) cpufreq_userspace cpufreq_stats cpufreq_powersave cpufreq_conservative wmi sbs sbshc xfs sr_mod sbp2 parport_pc lp parport i2c_ali1535 joydev psmouse serio_raw i2c_ali15x3 i2c_core snd_ali5451 snd_ac97_codec ac97_bus snd_pcm_oss snd_mixer_oss snd_pcm snd_seq_dummy container video output snd_seq_oss snd_seq_midi snd_rawmidi snd_seq_midi_event snd_seq battery snd_timer snd_seq_device ac button snd soundcore shpchp pci_hotplug snd_page_alloc ati_agp agpgart af_packet evdev iptable_nat nf_nat nf_conntrack_ipv4 nf_conntrack iptable_mangle iptable_filter ip_tables x_tables ext3 jbd mbcache ide_cd_mod cdrom ide_disk pata_acpi ata_generic libata scsi_mod dock usbhid hid alim15x3 floppy ide_pci_generic ohci1394 natsemi ide_core ieee1394 ohci_hcd usbcore thermal processor fan fuse fbcon tileblit font bitblit softcursor
[   37.070736] 
[   37.070780] Pid: 5225, comm: modprobe Not tainted (2.6.27-rc2-rieska #1)
[   37.070831] EIP: 0060:[<c03e6fe1>] EFLAGS: 00000046 CPU: 0
[   37.070895] EIP is at tsc_read_refs+0x1/0xb0
[   37.070941] EAX: dc489d18 EBX: 00000000 ECX: c0010042 EDX: 00000000
[   37.070990] ESI: 000b0b0b EDI: 00000246 EBP: dc489d2c ESP: dc489cd4
[   37.071039]  DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 0068
[   37.071089] Process modprobe (pid: 5225, ti=dc489000 task=db8bb040 task.ti=dc489000)
[   37.071140] Stack: c0108b89 ffffffff 0000006c db8bc88c dc489dfc deb92a6c db8bc88c 00000006 
[   37.071477]        00000000 00000002 dc48e0c6 ffffffff ffffffff ffffffff dc489d38 dc489e7c 
[   37.071812]        c0370479 00000000 00000212 00194662 000b0b0b fffffff4 dc489d40 c0108ff7 
[   37.072147] Call Trace:
[   37.072228]  [<c0108b89>] ? native_calibrate_tsc+0x29/0x2c0
[   37.072350]  [<c0108ff7>] ? recalibrate_cpu_khz+0x37/0x80
[   37.072462]  [<dea4e1a2>] ? powernow_cpu_init+0x32/0x4ae [powernow_k7]
[   37.072583]  [<c01e02c5>] ? ida_get_new_above+0x75/0x170
[   37.072697]  [<c018c79d>] ? find_inode+0x3d/0x70
[   37.072813]  [<c02d730b>] ? down_write+0xb/0x30
[   37.072927]  [<c0255c22>] ? cpufreq_add_dev+0xb2/0x260
[   37.073046]  [<c0122b07>] ? release_console_sem+0x187/0x1a0
[   37.073162]  [<c02434e5>] ? sysdev_driver_register+0x75/0x120
[   37.073277]  [<c02558f5>] ? cpufreq_register_driver+0x55/0xb0
[   37.073352]  [<dea4e0ce>] ? powernow_init+0x8e/0x130 [powernow_k7]
[   37.073352]  [<c0141fc4>] ? sys_init_module+0x124/0x1ac0
[   37.073352]  [<c015a6b5>] ? filemap_fault+0x255/0x3a0
[   37.073352]  [<c0103a3d>] ? sysenter_do_call+0x12/0x25
[   37.073352]  =======================
[   37.073352] Code: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc <cc> cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc 
[   37.073352] EIP: [<c03e6fe1>] tsc_read_refs+0x1/0xb0 SS:ESP 0068:dc489cd4
[   37.073352] ---[ end trace 18f36a04897ae05c ]---


Steps to reproduce: seems to happen when I reboot either of those two test kernels (only booted each once).


An uneducated question: can tsc_read_refs be __init?

static u64 __init tsc_read_refs(u64 *pm, u64 *hpet)
{
...
}

unsigned long native_calibrate_tsc(void)
{
        unsigned long flags;
        u64 tsc1, tsc2, tr1, tr2, delta, pm1, pm2, hpet1, hpet2;
        int hpet = is_hpet_enabled();
        unsigned int tsc_khz_val = 0;

        local_irq_save(flags);

        tsc1 = tsc_read_refs(&pm1, hpet ? &hpet1 : NULL);
...
}


This may be another bug, but the laptop seems to hang after flashing the keyboard leds when trying to shutdown or reboot. With the 2.6.26-rc6 kernel I am running it works fine (as does the cpufreq driver).
Comment 1 Adrian Bunk 2008-08-14 04:30:12 UTC
(In reply to comment #0)
> An uneducated question: can tsc_read_refs be __init?

No. Does fixing this bug fix the problem?
Comment 2 Mikko Vinni 2008-08-14 08:44:05 UTC
(In reply to comment #1)
> (In reply to comment #0)
> > An uneducated question: can tsc_read_refs be __init?
> 
> No. Does fixing this bug fix the problem?
> 

Yes. The following change indeed makes the int3 message go away, the frequency seems to be changing in response to increasing or decreasing load, and incidentally the machine doesn't hang at power off anymore. Thanks.

This change was tested on top of v2.6.27-rc3-171-gb635ace.

diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 7603c05..46af716 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -104,7 +104,7 @@ __setup("notsc", notsc_setup);
 /*
  * Read TSC and the reference counters. Take care of SMI disturbance
  */
-static u64 __init tsc_read_refs(u64 *pm, u64 *hpet)
+static u64 tsc_read_refs(u64 *pm, u64 *hpet)
 {
 	u64 t1, t2;
 	int i;
Comment 3 Adrian Bunk 2008-08-14 12:39:30 UTC
Patch: http://bugzilla.kernel.org/show_bug.cgi?id=11330#c2
Comment 4 Adrian Bunk 2008-08-14 12:40:37 UTC
Caused by:

commit bfc0f5947afa5e3a13e55867f4478c8a92c11dca
Author: Alok Kataria <akataria@vmware.com>
Date:   Tue Jul 1 11:43:24 2008 -0700

    x86: merge tsc calibration
    
    Merge the tsc calibration code for the 32bit and 64bit kernel.
    The paravirtualized calculate_cpu_khz for 64bit now points to the correct
    tsc_calibrate code as in 32bit.
    Original native_calculate_cpu_khz for 64 bit is now called as calibrate_cpu.
    
    Also moved the recalibrate_cpu_khz function in the common file.
    Note that this function is called only from powernow K7 cpu freq driver.
    
    Signed-off-by: Alok N Kataria <akataria@vmware.com>
    Signed-off-by: Dan Hecht <dhecht@vmware.com>
    Cc: Dan Hecht <dhecht@vmware.com>
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
Comment 5 H. Peter Anvin 2008-08-17 22:49:37 UTC
Fix merged into x86/urgent for upstream merge
Comment 6 Rafael J. Wysocki 2008-08-19 09:57:54 UTC
Fixed by commit d554d9a4295d.

Note You need to log in before you can comment on or make changes to this bug.