Re: Reboot on "shutdown -r" hangs after final "uptime ..." string

From: Abdullah Ibn Hamad Al-Marri <almarrie_at_gmail.com>
Date: Fri, 10 Aug 2007 17:00:52 +0300
On 8/10/07, bruce_at_cran.org.uk <bruce_at_cran.org.uk> wrote:
> On Fri, Aug 10, 2007 at 01:51:09AM -0700, Julian Elischer wrote:
> > Bruce Cran wrote:
> > >Thomas Sparrevohn wrote:
> > >>I have the same problem - just as a test try to load a kernel without
> > >>any USB drivers at all
> > >>And shutdown - on my machine it the ACPI part works - however the
> > >>system hangs during the device Shutdown phase - this machine is a dell
> > >>as well - would be nice if somebody using other than dell has the problem
> > >>
> > >I'm running 7.0-CURRENT and am seeing the same problem on my Dell
> > >Inspiron 1501 amd64 laptop.  This machine has OHCI and EHCI controllers;
> > >removing the EHCI driver solves the problem and allows the computer to
> > >reboot properly.  I initially thought it was an ACPI problem but now I'm
> > >not so sure - is there anything I can do to help debug it?  I've added
> > >printfs to kern_shutdown.c and as far as I can see the last function to
> > >be called is shutdown_wait; since that doesn't do anything I know more
> > >is going on, but I don't know where to look.
> >
> > I have the same problem on my Dell inspiron 7500.
> > it HAS worked in the past. It has even powered down in the past when asked.
> > but now it just hangs.. I suspect that acpi may have something to do with
> > it.
> >
> > No idea where to look though.
>
> On this laptop, FreeBSD 6.2 really struggled with ACPI - just listing
> the hw.acpi sysctls would result in lots of AE_NOT_FOUND messages; 7.0-CURRENT
> works a lot better, and the only warning relating to ACPI I see is during
> boot:
>
> acpi0: reservation of fed00000, 400 (3) failed
> acpi0: reservation of 0, 1000 (3) failed
>
> Compiling the disassembled AML generated by acpidump results in the
> following error:
>
> brucecran-DellInspiron1501.asl 5724: Unload (PB5)
> Error 4044 -                      Invalid type ^ ([Device|Reference] found, Unload operator
> requires [DdbHandle])
>
> As a starting point, I've uploaded the output of 'acpidump -dt' to
> http://www.cran.org.uk/~brucec/freebsd/i1501_shutdown/brucecran-DellInspiron1501.asl
> I've also put a verbose boot log, with ACPI debugging output enabled at
> http://www.cran.org.uk/~brucec/freebsd/i1501_shutdown/dmesg_bootverbose.txt
>
> --
> Bruce Cran
>
> > >>>-----Original Message-----
> > >>>From: owner-freebsd-acpi_at_freebsd.org [mailto:owner-freebsd-
> > >>>acpi_at_freebsd.org] On Behalf Of Artem Naluzhny
> > >>>Sent: 15 May 2007 21:54
> > >>>To: acpi_at_freebsd.org
> > >>>Subject: Reboot on "shutdown -r" hangs after final "uptime ..." string
> > >>>
> > >>>Hi
> > >>>
> > >>>I played with different combinations of debug.acpi.do_powerstate,
> > >>>hw.acpi.disable_on_reboot and hw.acpi.handle_reboot sysctls on my
> > >>>Inspiron 1501 notebook without success. Environment:
> > >>>
> > >>>FreeBSD 7.0-CURRENT #1: Thu May 10 21:22:20 EEST 2007
> > >>>    root_at_tut.intra:/usr/obj/usr/src/sys/TUT
> > >>>WARNING: WITNESS option enabled, expect reduced performance.
> > >>>Preloaded elf kernel "/boot/kernel/kernel" at 0xc082b000.
> > >>>Preloaded elf module "/boot/kernel/acpi.ko" at 0xc082b1c4.
> > >>>Calibrating clock(s) ... i8254 clock: 1193176 Hz
> > >>>CLK_USE_I8254_CALIBRATION not specified - using default frequency
> > >>>Timecounter "i8254" frequency 1193182 Hz quality 0
> > >>>Calibrating TSC clock ... TSC clock: 1596011252 Hz
> > >>>CPU: AMD Turion(tm) 64 X2 Mobile Technology TL-50 (1596.01-MHz 686-
> > >>>class CPU)
> > >>>  Origin = "AuthenticAMD"  Id = 0x40f82  Stepping = 2
> > >>>
> > >>>Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PG
> > >>>E,MCA,CMOV,PAT,PSE36,CLFLU
> > >>>SH,MMX,FXSR,SSE,SSE2,HTT>
> > >>>  Features2=0x2001<SSE3,CX16>
> > >>>  AMD
> > >>>Features=0xea500800<SYSCALL,NX,MMX+,FFXSR,RDTSCP,LM,3DNow!+,3DNow!>
> > >>>  AMD Features2=0x1f<LAHF,CMP,SVM,ExtAPIC,CR8>
> > >>>HTT bit cleared - FreeBSD does not have licensing issues requiring it.
> > >>>
> > >>>  Cores per package: 2
> > >>>Data TLB: 32 entries, fully associative
> > >>>Instruction TLB: 32 entries, fully associative
> > >>>L1 data cache: 64 kbytes, 64 bytes/line, 1 lines/tag, 2-way associative
> > >>>L1 instruction cache: 64 kbytes, 64 bytes/line, 1 lines/tag, 2-way
> > >>>associative
> > >>>L2 internal cache: 256 kbytes, 64 bytes/line, 1 lines/tag, 8-way
> > >>>associative
> > >>>real memory  = 937885696 (894 MB)
> > >>>Physical memory chunk(s):
> > >>>0x0000000000001000 - 0x000000000009cfff, 638976 bytes (156 pages)
> > >>>0x0000000000100000 - 0x00000000003fffff, 3145728 bytes (768 pages)
> > >>>0x0000000000c28000 - 0x0000000036e6ffff, 908361728 bytes (221768 pages)
> > >>>avail memory = 908304384 (866 MB)
> > >>>Table 'FACP' at 0x37e7fb9a
> > >>>Table 'TCPA' at 0x37e7fc0e
> > >>>Table 'SSDT' at 0x37e7fc40
> > >>>Table 'APIC' at 0x37e7fdc2
> > >>>MADT: Found table at 0x37e7fdc2
> > >>>MP Configuration Table version 1.4 found at 0xc009e171
> > >>>APIC: Using the MADT enumerator.
> > >>>MADT: Found CPU APIC ID 0 ACPI ID 0: enabled
> > >>>SMP: Added CPU 0 (AP)
> > >>>MADT: Found CPU APIC ID 1 ACPI ID 1: enabled
> > >>>SMP: Added CPU 1 (AP)
> > >>>ACPI APIC Table: <PTLTD          APIC  >
> > >>>INTR: Adding local APIC 1 as a target
> > >>>FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
> > >>> cpu0 (BSP): APIC ID:  0
> > >>> cpu1 (AP): APIC ID:  1
> > >>>bios32: Found BIOS32 Service Directory header at 0xc00f84a0
> > >>>bios32: Entry = 0xfdc84 (c00fdc84)  Rev = 0  Len = 1
> > >>>pcibios: PCI BIOS entry at 0xfdc80+0x0
> > >>>pnpbios: Found PnP BIOS data at 0xc00f8540
> > >>>pnpbios: Entry = e5d0:9499  Rev = 1.0
> > >>>Other BIOS signatures found:
> > >>>APIC: CPU 0 has ACPI ID 0
> > >>>APIC: CPU 1 has ACPI ID 1
> > >>>ACPI: RSDP _at_ 0x0xf8500/0x0014 (v  0 PTLTD )
> > >>>ACPI: RSDT _at_ 0x0x37e79578/0x0040 (v  1 DELL    M08     0x06040000  LTP
> > >>>0x00000000)
> > >>>ACPI: FACP _at_ 0x0x37e7fb9a/0x0074 (v  1 ATI    Bowfin   0x06040000 ATI
> > >>>0x000F4240)
> > >>>ACPI: DSDT _at_ 0x0x37e795b8/0x65E2 (v  1    ATI    SB600 0x06040000 MSFT
> > >>>0x03000000)
> > >>>ACPI: FACS _at_ 0x0x37e90fc0/0x0040
> > >>>ACPI: TCPA _at_ 0x0x37e7fc0e/0x0032 (v  2 AMD             0x06040000 PTEC
> > >>>0x00000000)
> > >>>ACPI: SSDT _at_ 0x0x37e7fc40/0x0182 (v  1 PTLTD  POWERNOW 0x06040000  LTP
> > >>>0x00000001)
> > >>>ACPI: APIC _at_ 0x0x37e7fdc2/0x0054 (v  1 PTLTD     APIC   0x06040000
> > >>>LTP 0x00000000)
> > >>>ACPI: MCFG _at_ 0x0x37e7fe16/0x003C (v  1 PTLTD    MCFG   0x06040000  LTP
> > >>>0x00000000)
> > >>>ACPI: HPET _at_ 0x0x37e7fe52/0x0038 (v  1 PTLTD  HPETTBL  0x06040000  LTP
> > >>>0x00000001)
> > >>>ACPI: SLIC _at_ 0x0x37e7fe8a/0x0176 (v  1 DELL    M08     0x06040000  LTP
> > >>>0x00000000)
> > >>>MADT: Found IO APIC ID 2, Interrupt 0 at 0xfec00000
> > >>>ioapic0: Routing external 8259A's -> intpin 0
> > >>>lapic0: Routing NMI -> LINT1
> > >>>lapic0: LINT1 trigger: edge
> > >>>lapic0: LINT1 polarity: high
> > >>>lapic1: Routing NMI -> LINT1
> > >>>lapic1: LINT1 trigger: edge
> > >>>lapic1: LINT1 polarity: high
> > >>>MADT: Forcing active-low polarity and level trigger for SCI
> > >>>ioapic0: intpin 9 polarity: low
> > >>>ioapic0: intpin 9 trigger: level
> > >>>ioapic0 <Version 2.1> irqs 0-23 on motherboard
> > >>>cpu0 BSP:
> > >>>     ID: 0x00000000   VER: 0x80050010 LDR: 0x00000000 DFR: 0xffffffff
> > >>>  lint0: 0x00010700 lint1: 0x00000400 TPR: 0x00000000 SVR: 0x000001ff
> > >>>  timer: 0x000100ef therm: 0x00010000 err: 0x00010000 pcm: 0x00010000
> > >>>io: <I/O>
> > >>>null: <null device, zero device>
> > >>>random: <entropy source, Software, Yarrow>
> > >>>kbd: new array size 4
> > >>>kbd1 at kbdmux0
> > >>>mem: <memory>
> > >>>Pentium Pro MTRR support enabled
> > >>>npx0: INT 16 interface
> > >>>acpi0: <DELL M08    > on motherboard
> > >>>ioapic0: routing intpin 9 (ISA IRQ 9) to vector 48
> > >>>acpi0: [MPSAFE]
> > >>>acpi0: [ITHREAD]
> > >>>pci_open(1):    mode 1 addr port (0x0cf8) is 0x80009020
> > >>>pci_open(1a):   mode1res=0x80000000 (0x80000000)
> > >>>pci_cfgcheck:   device 0 [class=060000] [hdr=00] is there (id=59501002)
> > >>>pcibios: BIOS_PRESENT call failed
> > >>>AcpiOsDerivePciId: bus 0 dev 18 func 0
> > >>>AcpiOsDerivePciId: bus 0 dev 17 func 0
> > >>>acpi0: Power Button (fixed)
> > >>>acpi0: wakeup code va 0xd5a40000 pa 0x9c000
> > >>>AcpiOsDerivePciId: bus 0 dev 20 func 1
> > >>>unknown: I/O range not supported
> > >>>AcpiOsDerivePciId: bus 0 dev 0 func 0
> > >>>AcpiOsDerivePciId: bus 0 dev 20 func 0
> > >>>acpi0: reservation of 0, 1000 (3) failed
> > >>>ACPI timer: 1/1 1/1 1/1 1/1 1/1 1/1 1/1 1/1 1/1 1/1 -> 10
> > >>>Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000
> > >>>acpi_timer0: <32-bit timer at 3.579545MHz> port 0x8008-0x800b on acpi0
> > >>>acpi_ec0: <Embedded Controller: GPE 0x14> port 0x62,0x66 on acpi0
> > >>>
> > >>>
> > >>>Any suggestions?
> > >>>
> > >>>--
> > >>>tut
> > >>>DaRK VoIP GuRU
> > >>>_______________________________________________
> > >>>freebsd-acpi_at_freebsd.org mailing list
> > >>>http://lists.freebsd.org/mailman/listinfo/freebsd-acpi
> > >>>To unsubscribe, send any mail to "freebsd-acpi-unsubscribe_at_freebsd.org"
> > >>>
> > >>
> > >>
> > >
> > >_______________________________________________
> > >freebsd-current_at_freebsd.org mailing list
> > >http://lists.freebsd.org/mailman/listinfo/freebsd-current
> > >To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"
> >
> > _______________________________________________
> > freebsd-current_at_freebsd.org mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-current
> > To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"
> >
> _______________________________________________
> freebsd-current_at_freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"
>



---------- Forwarded message ----------
From: Don Lewis <truckman_at_freebsd.org>
Date: Aug 5, 2007 3:04 AM
Subject: CFT - patch to fix ehci hang on shutdown
To: current_at_freebsd.org


I've got an AMD 64 X2 machine that uses the recent NVIDIA GeForce 7050 /
nForce 630a chipset that hangs on shutdown.  It hangs with both UP and
SMP kernels, and with both FreeBSD 6.2-STABLE and 7.0-CURRENT.  The
problem appears to be that a delay is needed between the the call

        EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET);

in ehci_shutdown(), and the call

        cparams = EREAD4(sc, EHCI_HCCPARAMS);

in ehci_pci_givecontroller().


There are three instances of a code sequence that does a controller
reset in ehci.c, one of which, in ehci_init(), inserts some delays and
periodically polls the controller to look for the completion of the
reset.  It seems to make sense to encapsulate the latter version of the
sequence in a separate function, and then call that function from
ehci_reset(), ehci_detach(), and ehci_shutdown().  I implemented this in
the attached patch, and it fixes shutdown problem for me on both
7.0-CURRENT and 6.2-STABLE (with some minor tweaks for the latter).

I've tested this patch on this system with both i386 and amd64 kernels,
and I also tested it on my Pentium-M laptop.  The shutdown problems are
gone and everything else looks normal, but I don't have any USB 2.0
peripherals to do further testing.  I'd appreciate any testing that can
be done in the next serveral days before I ask re_at_ for approval to
commit this to -CURRENT.

Index: sys/dev/usb/ehci.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/ehci.c,v
retrieving revision 1.55
diff -u -r1.55 ehci.c
--- sys/dev/usb/ehci.c  20 Jun 2007 05:10:52 -0000      1.55
+++ sys/dev/usb/ehci.c  4 Aug 2007 21:05:46 -0000
_at__at_ -311,6 +311,25 _at__at_
        ehci_device_isoc_done,
 };

+static usbd_status
+ehci_hcreset(ehci_softc_t *sc)
+{
+       u_int32_t hcr;
+       u_int i;
+
+       EOWRITE4(sc, EHCI_USBCMD, 0);   /* Halt controller */
+       usb_delay_ms(&sc->sc_bus, 1);
+       EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET);
+       for (i = 0; i < 100; i++) {
+               usb_delay_ms(&sc->sc_bus, 1);
+               hcr = EOREAD4(sc, EHCI_USBCMD) & EHCI_CMD_HCRESET;
+               if (!hcr)
+                       return (USBD_NORMAL_COMPLETION);
+       }
+       printf("%s: reset timeout\n", device_get_nameunit(sc->sc_bus.bdev));
+       return (USBD_IOERROR);
+}
+
 usbd_status
 ehci_init(ehci_softc_t *sc)
 {
_at__at_ -365,20 +384,9 _at__at_

        /* Reset the controller */
        DPRINTF(("%s: resetting\n", device_get_nameunit(sc->sc_bus.bdev)));
-       EOWRITE4(sc, EHCI_USBCMD, 0);   /* Halt controller */
-       usb_delay_ms(&sc->sc_bus, 1);
-       EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET);
-       for (i = 0; i < 100; i++) {
-               usb_delay_ms(&sc->sc_bus, 1);
-               hcr = EOREAD4(sc, EHCI_USBCMD) & EHCI_CMD_HCRESET;
-               if (!hcr)
-                       break;
-       }
-       if (hcr) {
-               printf("%s: reset timeout\n",
-                   device_get_nameunit(sc->sc_bus.bdev));
-               return (USBD_IOERROR);
-       }
+       err = ehci_hcreset(sc);
+       if (err != USBD_NORMAL_COMPLETION)
+               return (err);

        /* frame list size at default, read back what we got and use that */
        switch (EHCI_CMD_FLS(EOREAD4(sc, EHCI_USBCMD))) {
_at__at_ -927,8 +935,7 _at__at_
        sc->sc_dying = 1;

        EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs);
-       EOWRITE4(sc, EHCI_USBCMD, 0);
-       EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET);
+       (void) ehci_hcreset(sc);
        callout_stop(&sc->sc_tmo_intrlist);
        callout_stop(&sc->sc_tmo_pcd);

_at__at_ -1090,8 +1097,7 _at__at_
        ehci_softc_t *sc = v;

        DPRINTF(("ehci_shutdown: stopping the HC\n"));
-       EOWRITE4(sc, EHCI_USBCMD, 0);   /* Halt controller */
-       EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET);
+       (void) ehci_hcreset(sc);
 }

 usbd_status


_______________________________________________
freebsd-current_at_freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"


-- 
Regards,

-Abdullah Ibn Hamad Al-Marri
Arab Portal
http://www.WeArab.Net/


-- 
Regards,

-Abdullah Ibn Hamad Al-Marri
Arab Portal
http://www.WeArab.Net/
Received on Fri Aug 10 2007 - 12:00:57 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:16 UTC