PERFORCE change 167019 for review
Marko Zec
zec at FreeBSD.org
Wed Aug 5 08:29:43 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=167019
Change 167019 by zec at zec_tpx32 on 2009/08/05 08:29:02
IFC @ 167016
Affected files ...
.. //depot/projects/vimage-commit2/src/sys/amd64/amd64/machdep.c#15 integrate
.. //depot/projects/vimage-commit2/src/sys/contrib/pf/net/pf.c#18 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/aac/aac.c#5 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/acpica/acpi.c#12 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/acpica/acpi_battery.c#4 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/acpica/acpi_cpu.c#6 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/acpica/acpi_dock.c#3 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/acpica/acpi_thermal.c#3 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/adb/adb_bus.c#5 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/amdtemp/amdtemp.c#2 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/amr/amr.c#6 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/ata/ata-all.c#9 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/atkbdc/psm.c#7 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/bktr/bktr_os.c#4 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#25 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/drm/drm_drv.c#13 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/ips/ips_pci.c#2 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/mfi/mfi.c#9 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/mlx/mlx.c#6 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/mmc/mmc.c#10 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/pccbb/pccbb.c#7 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/pst/pst-iop.c#2 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/rp/rp.c#4 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/sound/pci/hda/hdac.c#19 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/twe/twe.c#2 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/usb/controller/usb_controller.c#13 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/usb/input/ukbd.c#12 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/usb/net/usb_ethernet.c#7 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/usb/usb_compat_linux.c#12 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/usb/usb_dev.c#13 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/usb/usb_handle_request.c#12 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/usb/usb_hub.c#16 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/usb/wlan/if_upgt.c#7 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/xen/blkback/blkback.c#4 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/xen/netback/netback.c#3 integrate
.. //depot/projects/vimage-commit2/src/sys/i386/acpica/acpi_machdep.c#7 integrate
.. //depot/projects/vimage-commit2/src/sys/i386/bios/smapi.c#4 integrate
.. //depot/projects/vimage-commit2/src/sys/i386/bios/smbios.c#2 integrate
.. //depot/projects/vimage-commit2/src/sys/i386/bios/vpd.c#2 integrate
.. //depot/projects/vimage-commit2/src/sys/i386/i386/machdep.c#15 integrate
.. //depot/projects/vimage-commit2/src/sys/kern/kern_uuid.c#16 integrate
.. //depot/projects/vimage-commit2/src/sys/kern/subr_bus.c#11 integrate
.. //depot/projects/vimage-commit2/src/sys/kern/tty_pts.c#14 integrate
.. //depot/projects/vimage-commit2/src/sys/kern/tty_ttydisc.c#8 integrate
.. //depot/projects/vimage-commit2/src/sys/net/if_bridge.c#23 integrate
.. //depot/projects/vimage-commit2/src/sys/netinet/icmp6.h#7 integrate
.. //depot/projects/vimage-commit2/src/sys/netinet/icmp_var.h#6 integrate
.. //depot/projects/vimage-commit2/src/sys/netinet/in_gif.c#18 integrate
.. //depot/projects/vimage-commit2/src/sys/netinet/in_pcb.h#24 integrate
.. //depot/projects/vimage-commit2/src/sys/netinet/ip_divert.c#35 integrate
.. //depot/projects/vimage-commit2/src/sys/netinet/ip_icmp.c#22 integrate
.. //depot/projects/vimage-commit2/src/sys/netinet/ip_input.c#50 integrate
.. //depot/projects/vimage-commit2/src/sys/netinet/ip_var.h#22 integrate
.. //depot/projects/vimage-commit2/src/sys/netinet/tcp_input.c#43 integrate
.. //depot/projects/vimage-commit2/src/sys/netinet/tcp_var.h#21 integrate
.. //depot/projects/vimage-commit2/src/sys/netinet/udp_usrreq.c#46 integrate
.. //depot/projects/vimage-commit2/src/sys/netinet/udp_var.h#12 integrate
.. //depot/projects/vimage-commit2/src/sys/netinet6/icmp6.c#34 integrate
.. //depot/projects/vimage-commit2/src/sys/pc98/cbus/fdc.c#2 integrate
.. //depot/projects/vimage-commit2/src/sys/sys/bus.h#4 integrate
.. //depot/projects/vimage-commit2/src/sys/sys/param.h#51 integrate
.. //depot/projects/vimage-commit2/src/sys/xen/xenbus/xenbus_probe.c#7 integrate
Differences ...
==== //depot/projects/vimage-commit2/src/sys/amd64/amd64/machdep.c#15 (text+ko) ====
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.706 2009/07/27 13:51:55 rpaulo Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.707 2009/08/02 11:26:23 ed Exp $");
#include "opt_atalk.h"
#include "opt_atpic.h"
@@ -214,6 +214,7 @@
sysenv = getenv("smbios.system.product");
if (sysenv != NULL) {
if (strncmp(sysenv, "MacBook1,1", 10) == 0 ||
+ strncmp(sysenv, "MacBook3,1", 10) == 0 ||
strncmp(sysenv, "MacBookPro1,1", 13) == 0 ||
strncmp(sysenv, "MacBookPro1,2", 13) == 0 ||
strncmp(sysenv, "Macmini1,1", 10) == 0) {
==== //depot/projects/vimage-commit2/src/sys/contrib/pf/net/pf.c#18 (text+ko) ====
@@ -41,7 +41,7 @@
#include "opt_inet6.h"
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/contrib/pf/net/pf.c,v 1.68 2009/08/01 19:26:27 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/contrib/pf/net/pf.c,v 1.69 2009/08/02 19:43:32 rwatson Exp $");
#endif
#ifdef __FreeBSD__
@@ -6141,7 +6141,7 @@
if (r->rt == PF_FASTROUTE) {
in_rtalloc(ro, 0);
if (ro->ro_rt == 0) {
- IPSTAT_INC(ips_noroute);
+ KMOD_IPSTAT_INC(ips_noroute);
goto bad;
}
@@ -6272,16 +6272,16 @@
if ((ifp->if_capabilities & IFCAP_CSUM_IPv4) &&
ifp->if_bridge == NULL) {
m0->m_pkthdr.csum_flags |= M_IPV4_CSUM_OUT;
- IPSTAT_INC(ips_outhwcsum);
+ KMOD_IPSTAT_INC(ips_outhwcsum);
} else {
ip->ip_sum = 0;
ip->ip_sum = in_cksum(m0, ip->ip_hl << 2);
}
/* Update relevant hardware checksum stats for TCP/UDP */
if (m0->m_pkthdr.csum_flags & M_TCPV4_CSUM_OUT)
- TCPSTAT_INC(tcpstat.tcps_outhwcsum);
+ KMOD_TCPSTAT_INC(tcps_outhwcsum);
else if (m0->m_pkthdr.csum_flags & M_UDPV4_CSUM_OUT)
- UDPSTAT_INC(udps_outhwcsum);
+ KMOD_UDPSTAT_INC(udps_outhwcsum);
error = (*ifp->if_output)(ifp, m0, sintosa(dst), NULL);
goto done;
}
@@ -6291,7 +6291,7 @@
* Must be able to put at least 8 bytes per fragment.
*/
if (ip->ip_off & htons(IP_DF)) {
- IPSTAT_INC(ips_cantfrag);
+ KMOD_IPSTAT_INC(ips_cantfrag);
if (r->rt != PF_DUPTO) {
#ifdef __FreeBSD__
/* icmp_error() expects host byte ordering */
@@ -6348,7 +6348,7 @@
}
if (error == 0)
- IPSTAT_INC(ips_fragmented);
+ KMOD_IPSTAT_INC(ips_fragmented);
done:
if (r->rt != PF_DUPTO)
@@ -6622,23 +6622,23 @@
switch (p) {
case IPPROTO_TCP:
{
- TCPSTAT_INC(tcps_rcvbadsum);
+ KMOD_TCPSTAT_INC(tcps_rcvbadsum);
break;
}
case IPPROTO_UDP:
{
- UDPSTAT_INC(udps_badsum);
+ KMOD_UDPSTAT_INC(udps_badsum);
break;
}
case IPPROTO_ICMP:
{
- ICMPSTAT_INC(icps_checksum);
+ KMOD_ICMPSTAT_INC(icps_checksum);
break;
}
#ifdef INET6
case IPPROTO_ICMPV6:
{
- ICMP6STAT_INC(icp6s_checksum);
+ KMOD_ICMP6STAT_INC(icp6s_checksum);
break;
}
#endif /* INET6 */
@@ -6725,17 +6725,17 @@
m->m_pkthdr.csum_flags |= flag_bad;
switch (p) {
case IPPROTO_TCP:
- TCPSTAT_INC(tcps_rcvbadsum);
+ KMOD_TCPSTAT_INC(tcps_rcvbadsum);
break;
case IPPROTO_UDP:
- UDPSTAT_INC(udps_badsum);
+ KMOD_UDPSTAT_INC(udps_badsum);
break;
case IPPROTO_ICMP:
- ICMPSTAT_INC(icps_checksum);
+ KMOD_ICMPSTAT_INC(icps_checksum);
break;
#ifdef INET6
case IPPROTO_ICMPV6:
- ICMP6STAT_INC(icp6s_checksum);
+ KMOD_ICMP6STAT_INC(icp6s_checksum);
break;
#endif /* INET6 */
}
==== //depot/projects/vimage-commit2/src/sys/dev/aac/aac.c#5 (text+ko) ====
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/aac/aac.c,v 1.142 2009/05/20 17:29:21 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/aac/aac.c,v 1.143 2009/08/02 14:28:40 attilio Exp $");
/*
* Driver for the Adaptec 'FSA' family of PCI/SCSI RAID adapters.
@@ -3270,10 +3270,10 @@
while (co != NULL) {
if (co->co_found == 0) {
mtx_unlock(&sc->aac_io_lock);
- mtx_lock(&Giant);
+ newbus_xlock();
device_delete_child(sc->aac_dev,
co->co_disk);
- mtx_unlock(&Giant);
+ newbus_xunlock();
mtx_lock(&sc->aac_io_lock);
co_next = TAILQ_NEXT(co, co_link);
mtx_lock(&sc->aac_container_lock);
@@ -3291,9 +3291,9 @@
/* Attach the newly created containers */
if (added) {
mtx_unlock(&sc->aac_io_lock);
- mtx_lock(&Giant);
+ newbus_xlock();
bus_generic_attach(sc->aac_dev);
- mtx_unlock(&Giant);
+ newbus_xunlock();
mtx_lock(&sc->aac_io_lock);
}
==== //depot/projects/vimage-commit2/src/sys/dev/acpica/acpi.c#12 (text+ko) ====
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi.c,v 1.264 2009/06/05 18:44:36 jkim Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi.c,v 1.265 2009/08/02 14:28:40 attilio Exp $");
#include "opt_acpi.h"
#include <sys/param.h>
@@ -675,8 +675,6 @@
device_t child, *devlist;
int error, i, numdevs, pstate;
- GIANT_REQUIRED;
-
/* First give child devices a chance to suspend. */
error = bus_generic_suspend(dev);
if (error)
@@ -719,8 +717,6 @@
int i, numdevs, error;
device_t child, *devlist;
- GIANT_REQUIRED;
-
/*
* Put all devices in D0 before resuming them. Call _S0D on each one
* since some systems expect this.
@@ -745,8 +741,6 @@
acpi_shutdown(device_t dev)
{
- GIANT_REQUIRED;
-
/* Allow children to shutdown first. */
bus_generic_shutdown(dev);
@@ -2534,11 +2528,7 @@
thread_unlock(curthread);
#endif
- /*
- * Be sure to hold Giant across DEVICE_SUSPEND/RESUME since non-MPSAFE
- * drivers need this.
- */
- mtx_lock(&Giant);
+ newbus_xlock();
slp_state = ACPI_SS_NONE;
@@ -2611,7 +2601,7 @@
if (slp_state >= ACPI_SS_SLEPT)
acpi_enable_fixed_events(sc);
- mtx_unlock(&Giant);
+ newbus_xunlock();
#ifdef SMP
thread_lock(curthread);
==== //depot/projects/vimage-commit2/src/sys/dev/acpica/acpi_battery.c#4 (text+ko) ====
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_battery.c,v 1.28 2009/06/05 18:44:36 jkim Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_battery.c,v 1.29 2009/08/02 14:28:40 attilio Exp $");
#include "opt_acpi.h"
#include <sys/param.h>
@@ -329,6 +329,7 @@
dev = NULL;
found_unit = 0;
+ newbus_slock();
batt_dc = devclass_find("battery");
maxunit = devclass_get_maxunit(batt_dc);
for (i = 0; i < maxunit; i++) {
@@ -340,6 +341,7 @@
found_unit++;
dev = NULL;
}
+ newbus_sunlock();
return (dev);
}
@@ -369,13 +371,17 @@
*/
switch (cmd) {
case ACPIIO_BATT_GET_UNITS:
+ newbus_slock();
*(int *)addr = acpi_battery_get_units();
+ newbus_sunlock();
error = 0;
break;
case ACPIIO_BATT_GET_BATTINFO:
if (dev != NULL || unit == ACPI_BATTERY_ALL_UNITS) {
bzero(&ioctl_arg->battinfo, sizeof(ioctl_arg->battinfo));
+ newbus_slock();
error = acpi_battery_get_battinfo(dev, &ioctl_arg->battinfo);
+ newbus_sunlock();
}
break;
case ACPIIO_BATT_GET_BIF:
@@ -416,6 +422,11 @@
{
int val, error;
+ /*
+ * Tolerate a race here because newbus lock can't be acquired before
+ * acpi_battery_get_battinfo() as it can create a LOR with the sysctl
+ * lock.
+ */
acpi_battery_get_battinfo(NULL, &acpi_battery_battinfo);
val = *(u_int *)oidp->oid_arg1;
error = sysctl_handle_int(oidp, &val, 0, req);
@@ -427,6 +438,10 @@
{
int count, error;
+ /*
+ * Tolerate a race here in order to avoid a LOR between sysctl lock
+ * and newbus lock.
+ */
count = acpi_battery_get_units();
error = sysctl_handle_int(oidp, &count, 0, req);
return (error);
==== //depot/projects/vimage-commit2/src/sys/dev/acpica/acpi_cpu.c#6 (text+ko) ====
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_cpu.c,v 1.78 2009/06/05 18:44:36 jkim Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_cpu.c,v 1.79 2009/08/02 14:28:40 attilio Exp $");
#include "opt_acpi.h"
#include <sys/param.h>
@@ -732,7 +732,9 @@
int i;
/* Get set of CPU devices */
+ newbus_slock();
devclass_get_devices(acpi_cpu_devclass, &cpu_devices, &cpu_ndevices);
+ newbus_sunlock();
/*
* Setup any quirks that might necessary now that we have probed
==== //depot/projects/vimage-commit2/src/sys/dev/acpica/acpi_dock.c#3 (text) ====
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/dev/acpica/acpi_dock.c,v 1.7 2009/06/05 18:44:36 jkim Exp $
+ * $FreeBSD: src/sys/dev/acpica/acpi_dock.c,v 1.8 2009/08/02 14:28:40 attilio Exp $
*/
#include "opt_acpi.h"
@@ -188,12 +188,12 @@
dev = (device_t)context;
+ newbus_xlock();
if (!device_is_enabled(dev))
device_enable(dev);
- mtx_lock(&Giant);
device_probe_and_attach(dev);
- mtx_unlock(&Giant);
+ newbus_xunlock();
}
static ACPI_STATUS
@@ -299,11 +299,11 @@
"ejecting device for %s\n", acpi_name(handle));
dev = acpi_get_device(handle);
+ newbus_xlock();
if (dev != NULL && device_is_attached(dev)) {
- mtx_lock(&Giant);
device_detach(dev);
- mtx_unlock(&Giant);
}
+ newbus_xunlock();
acpi_SetInteger(handle, "_EJ0", 0);
out:
==== //depot/projects/vimage-commit2/src/sys/dev/acpica/acpi_thermal.c#3 (text+ko) ====
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_thermal.c,v 1.71 2009/06/05 18:44:36 jkim Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_thermal.c,v 1.72 2009/08/02 14:28:40 attilio Exp $");
#include "opt_acpi.h"
#include <sys/param.h>
@@ -936,6 +936,8 @@
sc = NULL;
for (;;) {
+ newbus_slock();
+
/* If the number of devices has changed, re-evaluate. */
if (devclass_get_count(acpi_tz_devclass) != devcount) {
if (devs != NULL) {
@@ -948,6 +950,7 @@
for (i = 0; i < devcount; i++)
sc[i] = device_get_softc(devs[i]);
}
+ newbus_sunlock();
/* Check for temperature events and act on them. */
for (i = 0; i < devcount; i++) {
==== //depot/projects/vimage-commit2/src/sys/dev/adb/adb_bus.c#5 (text+ko) ====
@@ -22,7 +22,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/dev/adb/adb_bus.c,v 1.4 2008/12/06 23:26:02 nwhitehorn Exp $
+ * $FreeBSD: src/sys/dev/adb/adb_bus.c,v 1.5 2009/08/02 14:28:40 attilio Exp $
*/
#include <sys/cdefs.h>
@@ -113,6 +113,7 @@
uint8_t i, next_free;
uint16_t r3;
+ newbus_xlock();
sc->sc_dev = dev;
sc->parent = device_get_parent(dev);
@@ -187,6 +188,7 @@
}
bus_generic_attach(dev);
+ newbus_xunlock();
config_intrhook_disestablish(&sc->enum_hook);
}
==== //depot/projects/vimage-commit2/src/sys/dev/amdtemp/amdtemp.c#2 (text+ko) ====
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/amdtemp/amdtemp.c,v 1.3 2009/03/13 16:43:31 rpaulo Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/amdtemp/amdtemp.c,v 1.4 2009/08/02 14:28:40 attilio Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -269,6 +269,7 @@
/*
* dev.cpu.N.temperature.
*/
+ newbus_xlock();
nexus = device_find_child(root_bus, "nexus", 0);
acpi = device_find_child(nexus, "acpi", 0);
@@ -285,6 +286,7 @@
"Max of sensor 0 / 1");
}
}
+ newbus_xunlock();
config_intrhook_disestablish(&sc->sc_ich);
}
==== //depot/projects/vimage-commit2/src/sys/dev/amr/amr.c#6 (text+ko) ====
@@ -56,7 +56,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/amr/amr.c,v 1.89 2009/05/20 17:29:21 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/amr/amr.c,v 1.90 2009/08/02 14:28:40 attilio Exp $");
/*
* Driver for the AMI MegaRaid family of controllers.
@@ -90,6 +90,10 @@
SYSCTL_NODE(_hw, OID_AUTO, amr, CTLFLAG_RD, 0, "AMR driver parameters");
+/*
+ * In order to get rid of Giant, amr_state should be protected by
+ * a proper softc lock for the cdev operations.
+ */
static d_open_t amr_open;
static d_close_t amr_close;
static d_ioctl_t amr_ioctl;
@@ -312,9 +316,11 @@
config_intrhook_disestablish(&sc->amr_ich);
sc->amr_ich.ich_func = NULL;
+ newbus_xlock();
/* get up-to-date drive information */
if (amr_query_controller(sc)) {
device_printf(sc->amr_dev, "can't scan controller for drives\n");
+ newbus_xunlock();
return;
}
@@ -347,6 +353,7 @@
/* interrupts will be enabled before we do anything more */
sc->amr_state |= AMR_STATE_INTEN;
+ newbus_xunlock();
/*
* Start the timeout routine.
@@ -434,7 +441,11 @@
amr_open(struct cdev *dev, int flags, int fmt, struct thread *td)
{
int unit = dev2unit(dev);
- struct amr_softc *sc = devclass_get_softc(devclass_find("amr"), unit);
+ struct amr_softc *sc;
+
+ newbus_slock();
+ sc = devclass_get_softc(devclass_find("amr"), unit);
+ newbus_sunlock();
debug_called(1);
@@ -490,7 +501,11 @@
amr_close(struct cdev *dev, int flags, int fmt, struct thread *td)
{
int unit = dev2unit(dev);
- struct amr_softc *sc = devclass_get_softc(devclass_find("amr"), unit);
+ struct amr_softc *sc;
+
+ newbus_slock();
+ sc = devclass_get_softc(devclass_find("amr"), unit);
+ newbus_sunlock();
debug_called(1);
@@ -507,6 +522,7 @@
struct amr_softc *sc = (struct amr_softc *)dev->si_drv1;
int i, error = 0;
+ newbus_xlock();
sc->amr_state |= AMR_STATE_REMAP_LD;
while (sc->amr_busyslots) {
device_printf(sc->amr_dev, "idle controller\n");
@@ -530,6 +546,7 @@
sc->amr_drive[i].al_disk = 0;
}
}
+ newbus_xunlock();
shutdown_out:
amr_startup(sc);
@@ -805,7 +822,9 @@
struct amr_linux_ioctl ali;
int adapter, error;
+ newbus_slock();
devclass = devclass_find("amr");
+ newbus_sunlock();
if (devclass == NULL)
return (ENOENT);
==== //depot/projects/vimage-commit2/src/sys/dev/ata/ata-all.c#9 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/ata-all.c,v 1.307 2009/07/26 14:04:48 mav Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/ata-all.c,v 1.308 2009/08/02 14:28:40 attilio Exp $");
#include "opt_ata.h"
#include <sys/param.h>
@@ -54,7 +54,6 @@
static d_ioctl_t ata_ioctl;
static struct cdevsw ata_cdevsw = {
.d_version = D_VERSION,
- .d_flags = D_NEEDGIANT, /* we need this as newbus isn't mpsafe */
.d_ioctl = ata_ioctl,
.d_name = "ata",
};
@@ -204,7 +203,9 @@
{
device_t dev = (device_t)context;
+ newbus_xlock();
ata_reinit(dev);
+ newbus_xunlock();
}
int
@@ -246,7 +247,6 @@
/* reinit the children and delete any that fails */
if (!device_get_children(dev, &children, &nchildren)) {
- mtx_lock(&Giant); /* newbus suckage it needs Giant */
for (i = 0; i < nchildren; i++) {
/* did any children go missing ? */
if (children[i] && device_is_attached(children[i]) &&
@@ -269,7 +269,6 @@
}
}
free(children, M_TEMP);
- mtx_unlock(&Giant); /* newbus suckage dealt with, release Giant */
}
/* if we still have a good request put it on the queue again */
@@ -395,6 +394,7 @@
int *value = (int *)data;
int i, nchildren, error = ENOTTY;
+ newbus_xlock();
switch (cmd) {
case IOCATAGMAXCHANNEL:
/* In case we have channel 0..n this will return n+1. */
@@ -405,32 +405,40 @@
case IOCATAREINIT:
if (*value >= devclass_get_maxunit(ata_devclass) ||
!(device = devclass_get_device(ata_devclass, *value)) ||
- !device_is_attached(device))
+ !device_is_attached(device)) {
+ newbus_xunlock();
return ENXIO;
+ }
error = ata_reinit(device);
break;
case IOCATAATTACH:
if (*value >= devclass_get_maxunit(ata_devclass) ||
!(device = devclass_get_device(ata_devclass, *value)) ||
- !device_is_attached(device))
+ !device_is_attached(device)) {
+ newbus_xunlock();
return ENXIO;
+ }
error = DEVICE_ATTACH(device);
break;
case IOCATADETACH:
if (*value >= devclass_get_maxunit(ata_devclass) ||
!(device = devclass_get_device(ata_devclass, *value)) ||
- !device_is_attached(device))
+ !device_is_attached(device)) {
+ newbus_xunlock();
return ENXIO;
+ }
error = DEVICE_DETACH(device);
break;
case IOCATADEVICES:
if (devices->channel >= devclass_get_maxunit(ata_devclass) ||
!(device = devclass_get_device(ata_devclass, devices->channel)) ||
- !device_is_attached(device))
+ !device_is_attached(device)) {
+ newbus_xunlock();
return ENXIO;
+ }
bzero(devices->name[0], 32);
bzero(&devices->params[0], sizeof(struct ata_params));
bzero(devices->name[1], 32);
@@ -465,6 +473,7 @@
if (ata_raid_ioctl_func)
error = ata_raid_ioctl_func(cmd, data);
}
+ newbus_xunlock();
return error;
}
@@ -572,7 +581,7 @@
struct ata_channel *ch;
int ctlr;
- mtx_lock(&Giant); /* newbus suckage it needs Giant */
+ newbus_xlock();
/* kick of probe and attach on all channels */
for (ctlr = 0; ctlr < devclass_get_maxunit(ata_devclass); ctlr++) {
@@ -587,8 +596,7 @@
free(ata_delayed_attach, M_TEMP);
ata_delayed_attach = NULL;
}
-
- mtx_unlock(&Giant); /* newbus suckage dealt with, release Giant */
+ newbus_xunlock();
}
@@ -717,7 +725,6 @@
if (bootverbose)
device_printf(dev, "Identifying devices: %08x\n", ch->devices);
- mtx_lock(&Giant);
/* Skip existing devices. */
if (!device_get_children(dev, &children, &nchildren)) {
for (i = 0; i < nchildren; i++) {
@@ -729,10 +736,8 @@
/* Create new devices. */
if (bootverbose)
device_printf(dev, "New devices: %08x\n", n);
- if (n == 0) {
- mtx_unlock(&Giant);
+ if (n == 0)
return (0);
- }
for (i = 0; i < ATA_PM; ++i) {
if (n & (((ATA_ATA_MASTER | ATA_ATAPI_MASTER) << i))) {
int unit = -1;
@@ -775,7 +780,6 @@
}
bus_generic_probe(dev);
bus_generic_attach(dev);
- mtx_unlock(&Giant);
return 0;
}
==== //depot/projects/vimage-commit2/src/sys/dev/atkbdc/psm.c#7 (text+ko) ====
@@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/atkbdc/psm.c,v 1.103 2009/03/16 08:21:51 rnoland Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/atkbdc/psm.c,v 1.104 2009/08/02 14:28:40 attilio Exp $");
#include "opt_isa.h"
#include "opt_psm.h"
@@ -1488,7 +1488,9 @@
if (sc->state & PSM_OPEN)
return (EBUSY);
+ newbus_xlock();
device_busy(devclass_get_device(psm_devclass, unit));
+ newbus_xunlock();
/* Initialize state */
sc->mode.level = sc->dflt_mode.level;
@@ -1643,7 +1645,9 @@
/* close is almost always successful */
sc->state &= ~PSM_OPEN;
kbdc_lock(sc->kbdc, FALSE);
+ newbus_xlock();
device_unbusy(devclass_get_device(psm_devclass, unit));
+ newbus_xunlock();
return (0);
}
==== //depot/projects/vimage-commit2/src/sys/dev/bktr/bktr_os.c#4 (text+ko) ====
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/bktr/bktr_os.c,v 1.57 2009/05/26 12:01:37 ed Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/bktr/bktr_os.c,v 1.58 2009/08/02 14:28:40 attilio Exp $");
/*
* This is part of the Driver for Video Capture Cards (Frame grabbers)
@@ -597,7 +597,9 @@
return( ENXIO );
/* Record that the device is now busy */
+ newbus_xlock();
device_busy(devclass_get_device(bktr_devclass, unit));
+ newbus_xunlock();
if (bt848_card != -1) {
@@ -668,8 +670,11 @@
}
/* If there was an error opening the device, undo the busy status */
- if (result != 0)
+ if (result != 0) {
+ newbus_xlock();
device_unbusy(devclass_get_device(bktr_devclass, unit));
+ newbus_xunlock();
+ }
return( result );
}
@@ -689,6 +694,7 @@
/* Get the device data */
bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit);
if (bktr == NULL) {
+
/* the device is no longer valid/functioning */
return (ENXIO);
}
@@ -705,10 +711,11 @@
break;
default:
return (ENXIO);
- break;
}
+ newbus_xlock();
device_unbusy(devclass_get_device(bktr_devclass, unit));
+ newbus_xunlock();
return( result );
}
==== //depot/projects/vimage-commit2/src/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#25 (text+ko) ====
@@ -28,7 +28,7 @@
***************************************************************************/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c,v 1.36 2009/08/01 19:26:27 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c,v 1.37 2009/08/02 19:43:32 rwatson Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -3821,7 +3821,7 @@
#endif
toep->tp_state = tp->t_state;
- TCPSTAT_INC(tcps_connects);
+ KMOD_TCPSTAT_INC(tcps_connects);
}
==== //depot/projects/vimage-commit2/src/sys/dev/drm/drm_drv.c#13 (text+ko) ====
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/drm/drm_drv.c,v 1.27 2009/06/23 18:24:09 rnoland Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/drm/drm_drv.c,v 1.28 2009/08/02 14:28:40 attilio Exp $");
/** @file drm_drv.c
* The catch-all file for DRM device support, including module setup/teardown,
@@ -614,11 +614,13 @@
if (!retcode) {
atomic_inc(&dev->counts[_DRM_STAT_OPENS]);
+ newbus_xlock();
DRM_LOCK();
device_busy(dev->device);
if (!dev->open_count++)
retcode = drm_firstopen(dev);
DRM_UNLOCK();
+ newbus_xunlock();
}
return retcode;
@@ -632,6 +634,11 @@
DRM_DEBUG("open_count = %d\n", dev->open_count);
+ /*
+ * We require to lock newbus here for handling device_unbusy() and
+ * avoid a LOR with DRM_LOCK.
+ */
+ newbus_xlock();
DRM_LOCK();
if (dev->driver->preclose != NULL)
@@ -708,6 +715,7 @@
}
DRM_UNLOCK();
+ newbus_xunlock();
}
/* drm_ioctl is called whenever a process performs an ioctl on /dev/drm.
==== //depot/projects/vimage-commit2/src/sys/dev/ips/ips_pci.c#2 (text+ko) ====
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ips/ips_pci.c,v 1.15 2007/02/23 12:18:44 piso Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ips/ips_pci.c,v 1.16 2009/08/02 14:28:40 attilio Exp $");
#include <dev/ips/ipsreg.h>
#include <dev/ips/ips.h>
@@ -173,10 +173,12 @@
struct ips_softc *sc = (struct ips_softc *)arg;
config_intrhook_disestablish(&sc->ips_ich);
+ newbus_xlock();
if (ips_adapter_init(sc))
ips_pci_free(sc);
else
sc->configured = 1;
+ newbus_xunlock();
}
static int ips_pci_free(ips_softc_t *sc)
==== //depot/projects/vimage-commit2/src/sys/dev/mfi/mfi.c#9 (text) ====
@@ -51,7 +51,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi.c,v 1.50 2009/07/10 08:18:08 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi.c,v 1.51 2009/08/02 14:28:40 attilio Exp $");
#include "opt_mfi.h"
@@ -1327,11 +1327,11 @@
mfi_release_command(cm);
mtx_unlock(&sc->mfi_io_lock);
- mtx_lock(&Giant);
+ newbus_xlock();
if ((child = device_add_child(sc->mfi_dev, "mfid", -1)) == NULL) {
device_printf(sc->mfi_dev, "Failed to add logical disk\n");
free(ld_info, M_MFIBUF);
- mtx_unlock(&Giant);
+ newbus_xunlock();
mtx_lock(&sc->mfi_io_lock);
return;
}
@@ -1339,7 +1339,7 @@
device_set_ivars(child, ld_info);
device_set_desc(child, "MFI Logical Disk");
bus_generic_attach(sc->mfi_dev);
- mtx_unlock(&Giant);
+ newbus_xunlock();
mtx_lock(&sc->mfi_io_lock);
}
@@ -1805,9 +1805,9 @@
KASSERT(ld != NULL, ("volume dissappeared"));
if (cm->cm_frame->header.cmd_status == MFI_STAT_OK) {
mtx_unlock(&sc->mfi_io_lock);
- mtx_lock(&Giant);
+ newbus_xlock();
device_delete_child(sc->mfi_dev, ld->ld_dev);
- mtx_unlock(&Giant);
+ newbus_xunlock();
mtx_lock(&sc->mfi_io_lock);
} else
mfi_disk_enable(ld);
@@ -1815,11 +1815,11 @@
case MFI_DCMD_CFG_CLEAR:
if (cm->cm_frame->header.cmd_status == MFI_STAT_OK) {
mtx_unlock(&sc->mfi_io_lock);
- mtx_lock(&Giant);
+ newbus_xlock();
TAILQ_FOREACH_SAFE(ld, &sc->mfi_ld_tqh, ld_link, ldn) {
device_delete_child(sc->mfi_dev, ld->ld_dev);
}
- mtx_unlock(&Giant);
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list