svn commit: r216679 - head/sys/x86/x86
Author: jhb Date: Thu Dec 23 15:17:28 2010 New Revision: 216679 URL: http://svn.freebsd.org/changeset/base/216679 Log: Drop the icu_lock spinlock while pausing briefly after masking the interrupt in the I/O APIC before moving it to a different CPU. If the interrupt had been triggered by the I/O APIC after locking icu_lock but before we masked the pin in the I/O APIC, then this could cause the interrupt to be pending on the "old" CPU and it would finally trigger after we had moved the interrupt to the new CPU. This could cause us to panic as there was no interrupt source associated with the old IDT vector on the old CPU. Dropping the lock after the interrupt is masked but before it is moved allows the interrupt to fire and be handled in this case before it is moved. Tested by:Daniel Braniss danny of cs huji ac il MFC after:1 week Modified: head/sys/x86/x86/io_apic.c Modified: head/sys/x86/x86/io_apic.c == --- head/sys/x86/x86/io_apic.c Thu Dec 23 03:12:03 2010(r216678) +++ head/sys/x86/x86/io_apic.c Thu Dec 23 15:17:28 2010(r216679) @@ -359,7 +359,9 @@ ioapic_assign_cpu(struct intsrc *isrc, u if (!intpin->io_masked && !intpin->io_edgetrigger) { ioapic_write(io->io_addr, IOAPIC_REDTBL_LO(intpin->io_intpin), intpin->io_lowreg | IOART_INTMSET); + mtx_unlock_spin(&icu_lock); DELAY(100); + mtx_lock_spin(&icu_lock); } intpin->io_cpu = apic_id; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r216674 - head/sys/dev/acpica
John, On 12/23/10 04:27, John Baldwin wrote: Author: jhb Date: Wed Dec 22 20:27:20 2010 New Revision: 216674 URL: http://svn.freebsd.org/changeset/base/216674 Log: Use resource_list_reserve() to reserve I/O port and memory resources for ACPI devices even if they are not allocated by a device driver since the resources are in use and should not be allocated to another device. Looks like either my laptop's BIOS/firmware is crappy or this commit breaks booting. Following are the images I captured, although it may not be useful: http://people.freebsd.org/~ganbold/crash1.jpg http://people.freebsd.org/~ganbold/crash2.jpg dmesg (without this commit): http://people.freebsd.org/~ganbold/dmesg.txt thanks, Ganbold Modified: head/sys/dev/acpica/acpi.c head/sys/dev/acpica/acpivar.h Modified: head/sys/dev/acpica/acpi.c == --- head/sys/dev/acpica/acpi.c Wed Dec 22 19:57:03 2010(r216673) +++ head/sys/dev/acpica/acpi.c Wed Dec 22 20:27:20 2010(r216674) @@ -116,7 +116,10 @@ static int acpi_read_ivar(device_t dev, static intacpi_write_ivar(device_t dev, device_t child, int index, uintptr_t value); static struct resource_list *acpi_get_rlist(device_t dev, device_t child); +static voidacpi_reserve_resources(device_t dev); static intacpi_sysres_alloc(device_t dev); +static int acpi_set_resource(device_t dev, device_t child, int type, + int rid, u_long start, u_long count); static struct resource *acpi_alloc_resource(device_t bus, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags); @@ -187,7 +190,7 @@ static device_method_t acpi_methods[] = DEVMETHOD(bus_read_ivar, acpi_read_ivar), DEVMETHOD(bus_write_ivar, acpi_write_ivar), DEVMETHOD(bus_get_resource_list, acpi_get_rlist), -DEVMETHOD(bus_set_resource,bus_generic_rl_set_resource), +DEVMETHOD(bus_set_resource,acpi_set_resource), DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), DEVMETHOD(bus_alloc_resource, acpi_alloc_resource), DEVMETHOD(bus_release_resource, acpi_release_resource), @@ -1109,73 +1112,144 @@ acpi_sysres_alloc(device_t dev) return (0); } -static struct resource * -acpi_alloc_resource(device_t bus, device_t child, int type, int *rid, -u_long start, u_long end, u_long count, u_int flags) +static char *pcilink_ids[] = { "PNP0C0F", NULL }; +static char *sysres_ids[] = { "PNP0C01", "PNP0C02", NULL }; + +/* + * Reserve declared resources for devices found during attach once system + * resources have been allocated. + */ +static void +acpi_reserve_resources(device_t dev) { -ACPI_RESOURCE ares; -struct acpi_device *ad = device_get_ivars(child); -struct resource_list *rl =&ad->ad_rl; struct resource_list_entry *rle; -struct resource *res; -struct rman *rm; +struct resource_list *rl; +struct acpi_device *ad; +struct acpi_softc *sc; +device_t *children; +int child_count, i; -res = NULL; +sc = device_get_softc(dev); +if (device_get_children(dev,&children,&child_count) != 0) + return; +for (i = 0; i< child_count; i++) { + ad = device_get_ivars(children[i]); + rl =&ad->ad_rl; -/* We only handle memory and IO resources through rman. */ -switch (type) { -case SYS_RES_IOPORT: - rm =&acpi_rman_io; - break; -case SYS_RES_MEMORY: - rm =&acpi_rman_mem; - break; -default: - rm = NULL; + /* Don't reserve system resources. */ + if (ACPI_ID_PROBE(dev, children[i], sysres_ids) != NULL) + continue; + + STAILQ_FOREACH(rle, rl, link) { + /* +* Don't reserve IRQ resources. There are many sticky things +* to get right otherwise (e.g. IRQs for psm, atkbd, and HPET +* when using legacy routing). +*/ + if (rle->type == SYS_RES_IRQ) + continue; + + /* +* Try to reserve the resource from our parent. If this +* fails because the resource is a system resource, just +* let it be. The resource range is already reserved so +* that other devices will not use it. If the driver +* needs to allocate the resource, then +* acpi_alloc_resource() will sub-alloc from the system +* resource. +*/ + resource_list_reserve(rl, dev, children[i], rle->type,&rle->rid, + rle->start, rle->end, rle->count, 0); + } } - -ACPI_SERIAL_BEGIN(acpi); +free(children, M_TEMP); +sc->acpi_resources_reserved = 1; +} + +static int +acpi_set_resource(device_t dev, device_t child, int type, int rid, +u_long start, u_long cou
Re: svn commit: r216674 - head/sys/dev/acpica
On Thursday 23 December 2010 11:41 am, Ganbold wrote: > John, > > On 12/23/10 04:27, John Baldwin wrote: > > Author: jhb > > Date: Wed Dec 22 20:27:20 2010 > > New Revision: 216674 > > URL: http://svn.freebsd.org/changeset/base/216674 > > > > Log: > >Use resource_list_reserve() to reserve I/O port and memory > > resources for ACPI devices even if they are not allocated by a > > device driver since the resources are in use and should not be > > allocated to another device. > > Looks like either my laptop's BIOS/firmware is crappy or this > commit breaks booting. > Following are the images I captured, although it may not be useful: > > http://people.freebsd.org/~ganbold/crash1.jpg > http://people.freebsd.org/~ganbold/crash2.jpg > > dmesg (without this commit): > > http://people.freebsd.org/~ganbold/dmesg.txt Yesterday I reported the same problem to jhb and I think I found the culprit, i.e., EC is probed from ECDT before sysresource. Please stay tuned. Jung-uk Kim ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r216680 - head/sys/dev/acpica
Author: jhb Date: Thu Dec 23 18:50:14 2010 New Revision: 216680 URL: http://svn.freebsd.org/changeset/base/216680 Log: Don't try to reserve a resource that is already allocated. If the ECDT table is present, then the acpi_ec(4) driver will allocate its resources from nexus0 before the acpi0 device reserves resources for child devices. Reviewed by: jkim Modified: head/sys/dev/acpica/acpi.c Modified: head/sys/dev/acpica/acpi.c == --- head/sys/dev/acpica/acpi.c Thu Dec 23 15:17:28 2010(r216679) +++ head/sys/dev/acpica/acpi.c Thu Dec 23 18:50:14 2010(r216680) @@ -1150,6 +1150,14 @@ acpi_reserve_resources(device_t dev) continue; /* +* Don't reserve the resource if it is already allocated. +* The acpi_ec(4) driver can allocate its resources early +* if ECDT is present. +*/ + if (rle->res != NULL) + continue; + + /* * Try to reserve the resource from our parent. If this * fails because the resource is a system resource, just * let it be. The resource range is already reserved so ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r216681 - head/sys/arm/xscale/ixp425
Author: imp Date: Thu Dec 23 19:28:50 2010 New Revision: 216681 URL: http://svn.freebsd.org/changeset/base/216681 Log: IXP4XX_GPIO_{,UN}LOCK() don't take args. Remove the sc here to make this compile again. Modified: head/sys/arm/xscale/ixp425/avila_gpio.c Modified: head/sys/arm/xscale/ixp425/avila_gpio.c == --- head/sys/arm/xscale/ixp425/avila_gpio.c Thu Dec 23 18:50:14 2010 (r216680) +++ head/sys/arm/xscale/ixp425/avila_gpio.c Thu Dec 23 19:28:50 2010 (r216681) @@ -148,7 +148,7 @@ avila_gpio_pin_configure(struct avila_gp * Manage input/output */ if (flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) { - IXP4XX_GPIO_LOCK(sc); + IXP4XX_GPIO_LOCK(); pin->gp_flags &= ~(GPIO_PIN_INPUT|GPIO_PIN_OUTPUT); if (flags & GPIO_PIN_OUTPUT) { pin->gp_flags |= GPIO_PIN_OUTPUT; @@ -158,7 +158,7 @@ avila_gpio_pin_configure(struct avila_gp pin->gp_flags |= GPIO_PIN_INPUT; GPIO_SET_BITS(sc, IXP425_GPIO_GPOER, mask); } - IXP4XX_GPIO_UNLOCK(sc); + IXP4XX_GPIO_UNLOCK(); } } @@ -190,11 +190,11 @@ avila_gpio_pin_getflags(device_t dev, ui if (pin >= IXP4XX_GPIO_PINS || !(sc->sc_valid & (1 << pin))) return (EINVAL); - IXP4XX_GPIO_LOCK(sc); + IXP4XX_GPIO_LOCK(); /* refresh since we do not own all the pins */ sc->sc_pins[pin].gp_flags = avila_gpio_pin_flags(sc, pin); *flags = sc->sc_pins[pin].gp_flags; - IXP4XX_GPIO_UNLOCK(sc); + IXP4XX_GPIO_UNLOCK(); return (0); } @@ -242,12 +242,12 @@ avila_gpio_pin_set(device_t dev, uint32_ if (pin >= IXP4XX_GPIO_PINS || !(sc->sc_valid & mask)) return (EINVAL); - IXP4XX_GPIO_LOCK(sc); + IXP4XX_GPIO_LOCK(); if (value) GPIO_SET_BITS(sc, IXP425_GPIO_GPOUTR, mask); else GPIO_CLEAR_BITS(sc, IXP425_GPIO_GPOUTR, mask); - IXP4XX_GPIO_UNLOCK(sc); + IXP4XX_GPIO_UNLOCK(); return (0); } @@ -260,9 +260,9 @@ avila_gpio_pin_get(device_t dev, uint32_ if (pin >= IXP4XX_GPIO_PINS || !(sc->sc_valid & (1 << pin))) return (EINVAL); - IXP4XX_GPIO_LOCK(sc); + IXP4XX_GPIO_LOCK(); *val = (GPIO_CONF_READ_4(sc, IXP425_GPIO_GPINR) & (1 << pin)) ? 1 : 0; - IXP4XX_GPIO_UNLOCK(sc); + IXP4XX_GPIO_UNLOCK(); return (0); } @@ -277,13 +277,13 @@ avila_gpio_pin_toggle(device_t dev, uint if (pin >= IXP4XX_GPIO_PINS || !(sc->sc_valid & mask)) return (EINVAL); - IXP4XX_GPIO_LOCK(sc); + IXP4XX_GPIO_LOCK(); res = GPIO_CONF_READ_4(sc, IXP425_GPIO_GPINR) & mask; if (res) GPIO_CLEAR_BITS(sc, IXP425_GPIO_GPOUTR, mask); else GPIO_SET_BITS(sc, IXP425_GPIO_GPOUTR, mask); - IXP4XX_GPIO_UNLOCK(sc); + IXP4XX_GPIO_UNLOCK(); return (0); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r216685 - head
Author: imp Date: Fri Dec 24 04:55:56 2010 New Revision: 216685 URL: http://svn.freebsd.org/changeset/base/216685 Log: Redirect stderr from config to /dev/null. config -m is printing lots of annoying warnings when dealing with arm. The arm config files need to be fixed, but this restricts the output to a more useful place. Modified: head/Makefile Modified: head/Makefile == --- head/Makefile Fri Dec 24 04:52:53 2010(r216684) +++ head/Makefile Fri Dec 24 04:55:56 2010(r216685) @@ -350,8 +350,8 @@ KERNCONFS!= cd ${.CURDIR}/sys/${TARGET}/ universe_kernconfs: .for kernel in ${KERNCONFS} TARGET_ARCH_${kernel}!=cd ${.CURDIR}/sys/${TARGET}/conf && \ - config -m ${.CURDIR}/sys/${TARGET}/conf/${kernel} | \ - cut -f 2 + config -m ${.CURDIR}/sys/${TARGET}/conf/${kernel} 2> /dev/null | \ + cut -f 2 universe_kernconfs: universe_kernconf_${TARGET}_${kernel} universe_kernconf_${TARGET}_${kernel}: @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r216687 - head/lib/libthr/thread
Author: davidxu Date: Fri Dec 24 07:41:39 2010 New Revision: 216687 URL: http://svn.freebsd.org/changeset/base/216687 Log: Always clear flag PMUTEX_FLAG_DEFERED when unlocking, as it is only significant for lock owner. Modified: head/lib/libthr/thread/thr_mutex.c Modified: head/lib/libthr/thread/thr_mutex.c == --- head/lib/libthr/thread/thr_mutex.c Fri Dec 24 06:41:29 2010 (r216686) +++ head/lib/libthr/thread/thr_mutex.c Fri Dec 24 07:41:39 2010 (r216687) @@ -653,7 +653,7 @@ mutex_unlock_common(struct pthread_mutex m->m_count > 0)) { m->m_count--; } else { - if (curthread->will_sleep == 0 && (m->m_flags & PMUTEX_FLAG_DEFERED) != 0) { + if ((m->m_flags & PMUTEX_FLAG_DEFERED) != 0) { defered = 1; m->m_flags &= ~PMUTEX_FLAG_DEFERED; } else @@ -662,7 +662,7 @@ mutex_unlock_common(struct pthread_mutex DEQUEUE_MUTEX(curthread, m); _thr_umutex_unlock(&m->m_lock, id); - if (defered) { + if (curthread->will_sleep == 0 && defered) { _thr_wake_all(curthread->defer_waiters, curthread->nwaiter_defer); curthread->nwaiter_defer = 0; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"