svn commit: r233770 - head/lib/libc/net

2012-04-02 Thread Xin LI
Author: delphij
Date: Mon Apr  2 07:42:17 2012
New Revision: 233770
URL: http://svn.freebsd.org/changeset/base/233770

Log:
  Eliminate two cases of unwanted strncpy().  The name is not required
  by the current code, and the results would get overwritten anyway
  by subsequent memset().
  
  Reviewed by:  ume
  MFC after:1 month

Modified:
  head/lib/libc/net/getaddrinfo.c
  head/lib/libc/net/name6.c

Modified: head/lib/libc/net/getaddrinfo.c
==
--- head/lib/libc/net/getaddrinfo.c Mon Apr  2 07:18:31 2012
(r233769)
+++ head/lib/libc/net/getaddrinfo.c Mon Apr  2 07:42:17 2012
(r233770)
@@ -847,8 +847,6 @@ set_source(struct ai_order *aio, struct 
struct in6_ifreq ifr6;
u_int32_t flags6;
 
-   /* XXX: interface name should not be hardcoded */
-   strncpy(ifr6.ifr_name, lo0, sizeof(ifr6.ifr_name));
memset(ifr6, 0, sizeof(ifr6));
memcpy(ifr6.ifr_addr, ai.ai_addr, ai.ai_addrlen);
if (_ioctl(s, SIOCGIFAFLAG_IN6, ifr6) == 0) {

Modified: head/lib/libc/net/name6.c
==
--- head/lib/libc/net/name6.c   Mon Apr  2 07:18:31 2012(r233769)
+++ head/lib/libc/net/name6.c   Mon Apr  2 07:42:17 2012(r233770)
@@ -884,8 +884,6 @@ set_source(struct hp_order *aio, struct 
struct in6_ifreq ifr6;
u_int32_t flags6;
 
-   /* XXX: interface name should not be hardcoded */
-   strncpy(ifr6.ifr_name, lo0, sizeof(ifr6.ifr_name));
memset(ifr6, 0, sizeof(ifr6));
memcpy(ifr6.ifr_addr, ss, ss.ss_len);
if (_ioctl(s, SIOCGIFAFLAG_IN6, ifr6) == 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: r233771 - head/sys/dev/usb

2012-04-02 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr  2 07:51:30 2012
New Revision: 233771
URL: http://svn.freebsd.org/changeset/base/233771

Log:
  Add definitions and structures for USB 2.0 Link Power Management, LPM.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/usb/usb.h
  head/sys/dev/usb/usb_request.c
  head/sys/dev/usb/usb_request.h

Modified: head/sys/dev/usb/usb.h
==
--- head/sys/dev/usb/usb.h  Mon Apr  2 07:42:17 2012(r233770)
+++ head/sys/dev/usb/usb.h  Mon Apr  2 07:51:30 2012(r233771)
@@ -225,7 +225,8 @@ typedef struct usb_device_request usb_de
 #defineUR_RESET_TT 0x09
 #defineUR_GET_TT_STATE 0x0a
 #defineUR_STOP_TT  0x0b
-#defineUR_SET_HUB_DEPTH0x0c
+#defineUR_SET_AND_TEST 0x0c/* USB 2.0 only */
+#defineUR_SET_HUB_DEPTH0x0c/* USB 3.0 only */
 #defineUSB_SS_HUB_DEPTH_MAX5
 #defineUR_GET_PORT_ERR_COUNT   0x0d
 
@@ -248,6 +249,7 @@ typedef struct usb_device_request usb_de
 #defineUHF_PORT_LINK_STATE 5
 #defineUHF_PORT_POWER  8
 #defineUHF_PORT_LOW_SPEED  9
+#defineUHF_PORT_L1 10
 #defineUHF_C_PORT_CONNECTION   16
 #defineUHF_C_PORT_ENABLE   17
 #defineUHF_C_PORT_SUSPEND  18
@@ -255,6 +257,7 @@ typedef struct usb_device_request usb_de
 #defineUHF_C_PORT_RESET20
 #defineUHF_PORT_TEST   21
 #defineUHF_PORT_INDICATOR  22
+#defineUHF_C_PORT_L1   23
 
 /* SuperSpeed HUB specific features */
 #defineUHF_PORT_U1_TIMEOUT 23
@@ -324,7 +327,12 @@ struct usb_devcap_usb2ext_descriptor {
uByte   bDescriptorType;
uByte   bDevCapabilityType;
uDWord  bmAttributes;
-#defineUSB_V2EXT_LPM 0x02
+#defineUSB_V2EXT_LPM (1U  1)
+#defineUSB_V2EXT_BESL_SUPPORTED (1U  2)
+#defineUSB_V2EXT_BESL_BASELINE_VALID (1U  3)
+#defineUSB_V2EXT_BESL_DEEP_VALID (1U  4)
+#defineUSB_V2EXT_BESL_BASELINE_GET(x) (((x)  8)  0xF)
+#defineUSB_V2EXT_BESL_DEEP_GET(x) (((x)  12)  0xF)
 } __packed;
 typedef struct usb_devcap_usb2ext_descriptor usb_devcap_usb2ext_descriptor_t;
 
@@ -671,6 +679,7 @@ struct usb_port_status {
 #defineUPS_SUSPEND 0x0004
 #defineUPS_OVERCURRENT_INDICATOR   0x0008
 #defineUPS_RESET   0x0010
+#defineUPS_PORT_L1 0x0020  /* USB 2.0 only */
 /* The link-state bits are valid for Super-Speed USB HUBs */
 #defineUPS_PORT_LINK_STATE_GET(x)  (((x)  5)  0xF)
 #defineUPS_PORT_LINK_STATE_SET(x)  (((x)  0xF)  5)
@@ -701,7 +710,8 @@ struct usb_port_status {
 #defineUPS_C_SUSPEND   0x0004
 #defineUPS_C_OVERCURRENT_INDICATOR 0x0008
 #defineUPS_C_PORT_RESET0x0010
-#defineUPS_C_BH_PORT_RESET 0x0020
+#defineUPS_C_PORT_L1   0x0020  /* USB 2.0 only */
+#defineUPS_C_BH_PORT_RESET 0x0020  /* USB 3.0 only */
 #defineUPS_C_PORT_LINK_STATE   0x0040
 #defineUPS_C_PORT_CONFIG_ERROR 0x0080
 } __packed;

Modified: head/sys/dev/usb/usb_request.c
==
--- head/sys/dev/usb/usb_request.c  Mon Apr  2 07:42:17 2012
(r233770)
+++ head/sys/dev/usb/usb_request.c  Mon Apr  2 07:51:30 2012
(r233771)
@@ -2226,3 +2226,57 @@ usbd_req_set_port_link_state(struct usb_
USETW(req.wLength, 0);
return (usbd_do_request(udev, mtx, req, 0));
 }
+
+/**
+ * usbd_req_set_lpm_info
+ *
+ * USB 2.0 specific request for Link Power Management.
+ *
+ * Returns:
+ * 0:  Success
+ * USB_ERR_PENDING_REQUESTS:   NYET
+ * USB_ERR_TIMEOUT:TIMEOUT
+ * USB_ERR_STALL:  STALL
+ * Else:   Failure
+ **/
+usb_error_t
+usbd_req_set_lpm_info(struct usb_device *udev, struct mtx *mtx,
+uint8_t port, uint8_t besl, uint8_t addr, uint8_t rwe)
+{
+   struct usb_device_request req;
+   usb_error_t err;
+   uint8_t buf[1];
+
+   req.bmRequestType = UT_WRITE_CLASS_OTHER;
+   req.bRequest = UR_SET_AND_TEST;
+   USETW(req.wValue, UHF_PORT_L1);
+   req.wIndex[0] = (port  0xF) | ((besl  0xF)  4);
+   req.wIndex[1] = (addr  0x7F) | (rwe ? 0x80 : 0x00);
+   USETW(req.wLength, sizeof(buf));
+
+   /* set default value in case of short transfer */
+   buf[0] = 0x00;
+
+   err = usbd_do_request(udev, mtx, req, buf);
+   if (err)
+   return (err);
+
+   switch (buf[0]) {
+   case 0x00:  

Re: svn commit: r233749 - in head/gnu/lib: libstdc++ libsupc++

2012-04-02 Thread David Chisnall
On 2 Apr 2012, at 02:03, Alexander Kabaev wrote:

 there are reports of this commit breaking complex C++ binaries such as
 build as part of KDE4. This is being looked at.

Do you have any more information about what is broken? (Run-time failures, 
linker failures?)

David___
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: r233768 - head/sys/dev/mfi

2012-04-02 Thread Garrett Cooper
On Sun, Apr 1, 2012 at 7:22 PM, Doug Ambrisko ambri...@freebsd.org wrote:
 Author: ambrisko
 Date: Mon Apr  2 02:22:22 2012
 New Revision: 233768
 URL: http://svn.freebsd.org/changeset/base/233768

 Log:
  Change typedef atomic_t to struct mfi_atomic to avoid name space
  collision and some couple more style changes.

Thanks Doug!
___
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: r233773 - head/usr.sbin/arp

2012-04-02 Thread Gleb Smirnoff
Author: glebius
Date: Mon Apr  2 10:44:25 2012
New Revision: 233773
URL: http://svn.freebsd.org/changeset/base/233773

Log:
  Historically arp(8) did a route lookup for the entry it is
  about to add, and failed if it exist and had invalid data
  link type.
  
  Later on, in r201282, this check morphed to other code, but
  message proxy entry exists for non 802 device still left,
  and now it is printed in a case if route prefix found is
  equal to current address being added. In other words, when
  we are trying to add ARP entry for a network address. The
  message is absolutely unrelated and disappointing in this
  case.
  
  I don't see anything bad with setting ARP entries for
  network addresses. While useless in usual network,
  in a /31 RFC3021 it may be necessary. This, remove this code.

Modified:
  head/usr.sbin/arp/arp.c

Modified: head/usr.sbin/arp/arp.c
==
--- head/usr.sbin/arp/arp.c Mon Apr  2 10:24:50 2012(r233772)
+++ head/usr.sbin/arp/arp.c Mon Apr  2 10:44:25 2012(r233773)
@@ -387,10 +387,6 @@ set(int argc, char **argv)
}
addr = (struct sockaddr_inarp *)(rtm + 1);
sdl = (struct sockaddr_dl *)(SA_SIZE(addr) + (char *)addr);
-   if (addr-sin_addr.s_addr == dst-sin_addr.s_addr) {
-   printf(set: proxy entry exists for non 802 device\n);
-   return (1);
-   }
 
if ((sdl-sdl_family != AF_LINK) ||
(rtm-rtm_flags  RTF_GATEWAY) ||
___
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: r233774 - in head/sys: dev/sound/usb dev/usb dev/usb/controller dev/usb/input dev/usb/misc dev/usb/net dev/usb/serial dev/usb/storage dev/usb/template dev/usb/wlan netgraph/bluetooth/dr...

2012-04-02 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr  2 10:50:42 2012
New Revision: 233774
URL: http://svn.freebsd.org/changeset/base/233774

Log:
  Fix compiler warnings, mostly signed issues,
  when USB modules are compiled with WARNS=9.
  
  MFC after:1 weeks

Modified:
  head/sys/dev/sound/usb/uaudio.c
  head/sys/dev/sound/usb/uaudioreg.h
  head/sys/dev/usb/controller/at91dci.c
  head/sys/dev/usb/controller/atmegadci.c
  head/sys/dev/usb/controller/avr32dci.c
  head/sys/dev/usb/controller/dwc_otg.c
  head/sys/dev/usb/controller/ehci.c
  head/sys/dev/usb/controller/musb_otg.c
  head/sys/dev/usb/controller/ohci.c
  head/sys/dev/usb/controller/uhci.c
  head/sys/dev/usb/controller/uss820dci.c
  head/sys/dev/usb/controller/xhci.c
  head/sys/dev/usb/input/atp.c
  head/sys/dev/usb/input/uep.c
  head/sys/dev/usb/input/uhid.c
  head/sys/dev/usb/input/ukbd.c
  head/sys/dev/usb/input/ums.c
  head/sys/dev/usb/misc/ufm.c
  head/sys/dev/usb/net/if_aue.c
  head/sys/dev/usb/net/if_axe.c
  head/sys/dev/usb/net/if_cdce.c
  head/sys/dev/usb/net/if_cue.c
  head/sys/dev/usb/net/if_ipheth.c
  head/sys/dev/usb/net/if_kue.c
  head/sys/dev/usb/net/if_rue.c
  head/sys/dev/usb/net/if_udav.c
  head/sys/dev/usb/net/if_usie.c
  head/sys/dev/usb/net/ruephy.c
  head/sys/dev/usb/net/uhso.c
  head/sys/dev/usb/serial/ubsa.c
  head/sys/dev/usb/serial/uchcom.c
  head/sys/dev/usb/serial/ucycom.c
  head/sys/dev/usb/serial/ufoma.c
  head/sys/dev/usb/serial/ulpt.c
  head/sys/dev/usb/serial/umodem.c
  head/sys/dev/usb/serial/uplcom.c
  head/sys/dev/usb/serial/usb_serial.c
  head/sys/dev/usb/serial/usb_serial.h
  head/sys/dev/usb/storage/umass.c
  head/sys/dev/usb/storage/urio.c
  head/sys/dev/usb/storage/ustorage_fs.c
  head/sys/dev/usb/template/usb_template.c
  head/sys/dev/usb/usb_busdma.c
  head/sys/dev/usb/usb_compat_linux.c
  head/sys/dev/usb/usb_dev.c
  head/sys/dev/usb/usb_device.c
  head/sys/dev/usb/usb_handle_request.c
  head/sys/dev/usb/usb_hid.c
  head/sys/dev/usb/usb_hub.c
  head/sys/dev/usb/usb_msctest.c
  head/sys/dev/usb/usb_request.c
  head/sys/dev/usb/usb_transfer.c
  head/sys/dev/usb/usbdi.h
  head/sys/dev/usb/usbhid.h
  head/sys/dev/usb/wlan/if_rum.c
  head/sys/dev/usb/wlan/if_run.c
  head/sys/dev/usb/wlan/if_uath.c
  head/sys/dev/usb/wlan/if_upgt.c
  head/sys/dev/usb/wlan/if_ural.c
  head/sys/dev/usb/wlan/if_urtw.c
  head/sys/dev/usb/wlan/if_zyd.c
  head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c

Modified: head/sys/dev/sound/usb/uaudio.c
==
--- head/sys/dev/sound/usb/uaudio.c Mon Apr  2 10:44:25 2012
(r233773)
+++ head/sys/dev/sound/usb/uaudio.c Mon Apr  2 10:50:42 2012
(r233774)
@@ -1272,15 +1272,15 @@ uaudio_chan_record_callback(struct usb_x
 {
struct uaudio_chan *ch = usbd_xfer_softc(xfer);
struct usb_page_cache *pc;
-   uint32_t n;
-   uint32_t m;
-   uint32_t blockcount;
uint32_t offset0;
uint32_t offset1;
uint32_t mfl;
+   int m;
+   int n;
int len;
int actlen;
int nframes;
+   int blockcount;
 
usbd_xfer_status(xfer, actlen, NULL, NULL, nframes);
mfl = usbd_xfer_max_framelen(xfer);
@@ -1307,9 +1307,9 @@ uaudio_chan_record_callback(struct usb_x
 
m = (ch-end - ch-cur);
 
-   if (m  len) {
+   if (m  len)
m = len;
-   }
+
usbd_copy_out(pc, offset1, ch-cur, m);
 
len -= m;
@@ -1884,10 +1884,10 @@ uaudio_mixer_add_selector(struct uaudio_
 
 static uint32_t
 uaudio_mixer_feature_get_bmaControls(const struct usb_audio_feature_unit *d,
-uint8_t index)
+uint8_t i)
 {
uint32_t temp = 0;
-   uint32_t offset = (index * d-bControlSize);
+   uint32_t offset = (i * d-bControlSize);
 
if (d-bControlSize  0) {
temp |= d-bmaControls[offset];
@@ -2636,8 +2636,8 @@ uaudio_mixer_feature_name(const struct u
return (uat-feature);
 }
 
-const static struct uaudio_terminal_node *
-uaudio_mixer_get_input(const struct uaudio_terminal_node *iot, uint8_t index)
+static const struct uaudio_terminal_node *
+uaudio_mixer_get_input(const struct uaudio_terminal_node *iot, uint8_t i)
 {
struct uaudio_terminal_node *root = iot-root;
uint8_t n;
@@ -2645,17 +2645,16 @@ uaudio_mixer_get_input(const struct uaud
n = iot-usr.id_max;
do {
if (iot-usr.bit_input[n / 8]  (1  (n % 8))) {
-   if (!index--) {
+   if (!i--)
return (root + n);
-   }
}
} while (n--);
 
return (NULL);
 }
 
-const static struct uaudio_terminal_node *
-uaudio_mixer_get_output(const struct uaudio_terminal_node *iot, uint8_t index)
+static const struct 

svn commit: r233776 - head/sys/mips/mips

2012-04-02 Thread Jayachandran C.
Author: jchandra
Date: Mon Apr  2 11:41:33 2012
New Revision: 233776
URL: http://svn.freebsd.org/changeset/base/233776

Log:
  Reinstate the XTLB handler for CPU_NLM and CPU_RMI
  
  These platforms set the KX bit even when booted in 32 bit mode. So
  the XLTB handler is needed even when __mips_n64 is not defined.

Modified:
  head/sys/mips/mips/machdep.c

Modified: head/sys/mips/mips/machdep.c
==
--- head/sys/mips/mips/machdep.cMon Apr  2 11:27:20 2012
(r233775)
+++ head/sys/mips/mips/machdep.cMon Apr  2 11:41:33 2012
(r233776)
@@ -346,7 +346,7 @@ mips_vector_init(void)
bcopy(MipsTLBMiss, (void *)MIPS_UTLB_MISS_EXC_VEC,
  MipsTLBMissEnd - MipsTLBMiss);
 
-#ifdef __mips_n64
+#if defined(__mips_n64) || defined(CPU_RMI) || defined(CPU_NLM)
bcopy(MipsTLBMiss, (void *)MIPS_XTLB_MISS_EXC_VEC,
  MipsTLBMissEnd - MipsTLBMiss);
 #endif
___
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: r233777 - head/libexec/rtld-elf

2012-04-02 Thread Alexander Kabaev
Author: kan
Date: Mon Apr  2 11:50:14 2012
New Revision: 233777
URL: http://svn.freebsd.org/changeset/base/233777

Log:
  Do not try to adjust stacks if dlopen_object is called too early.
  
  This is a follow-up to r233231, which fixed similar issue with
  object initialization code.
  
  Reviewed by:  kib
  MFC after:1 week (with 233231)

Modified:
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/rtld.c
==
--- head/libexec/rtld-elf/rtld.cMon Apr  2 11:41:33 2012
(r233776)
+++ head/libexec/rtld-elf/rtld.cMon Apr  2 11:50:14 2012
(r233777)
@@ -2585,7 +2585,10 @@ dlopen_object(const char *name, int fd, 
name);
 GDB_STATE(RT_CONSISTENT,obj ? obj-linkmap : NULL);
 
-map_stacks_exec(lockstate);
+
+if (!(lo_flags  RTLD_LO_EARLY)) {
+   map_stacks_exec(lockstate);
+}
 
 if (initlist_objects_ifunc(initlist, (mode  RTLD_MODEMASK) == RTLD_NOW,
   (lo_flags  RTLD_LO_EARLY) ? SYMLOOK_EARLY : 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: r233778 - head/libexec/rtld-elf

2012-04-02 Thread Alexander Kabaev
Author: kan
Date: Mon Apr  2 11:59:13 2012
New Revision: 233778
URL: http://svn.freebsd.org/changeset/base/233778

Log:
  Remove extra blank line from revious commit.
  
  Submitted by: trema

Modified:
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/rtld.c
==
--- head/libexec/rtld-elf/rtld.cMon Apr  2 11:50:14 2012
(r233777)
+++ head/libexec/rtld-elf/rtld.cMon Apr  2 11:59:13 2012
(r233778)
@@ -2585,7 +2585,6 @@ dlopen_object(const char *name, int fd, 
name);
 GDB_STATE(RT_CONSISTENT,obj ? obj-linkmap : NULL);
 
-
 if (!(lo_flags  RTLD_LO_EARLY)) {
map_stacks_exec(lockstate);
 }
___
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: r228969 - head/sys/netinet

2012-04-02 Thread John Baldwin
On Sunday, April 01, 2012 8:05:00 am Mikolaj Golub wrote:
 Hi,
 
 On 12/29/11, John Baldwin j...@freebsd.org wrote:
  Author: jhb
  Date: Thu Dec 29 20:41:16 2011
  New Revision: 228969
  URL: http://svn.freebsd.org/changeset/base/228969
 
  Log:
Defer the work of freeing IPv4 multicast options from a socket to an
asychronous task.  This avoids tearing down multicast state including
sending IGMP leave messages and reprogramming MAC filters while holding
the per-protocol global pcbinfo lock that is used in the receive path of
packet processing.
 
Reviewed by:  rwatson
MFC after:1 month
 
  Modified:
head/sys/netinet/in_mcast.c
head/sys/netinet/ip_var.h
 
  Modified: head/sys/netinet/in_mcast.c
  ==
  --- head/sys/netinet/in_mcast.c Thu Dec 29 19:01:29 2011
  (r228968)
  +++ head/sys/netinet/in_mcast.c Thu Dec 29 20:41:16 2011
  (r228969)
  @@ -46,6 +46,7 @@ __FBSDID($FreeBSD$);
   #include sys/protosw.h
   #include sys/sysctl.h
   #include sys/ktr.h
  +#include sys/taskqueue.h
   #include sys/tree.h
 
   #include net/if.h
  @@ -144,6 +145,8 @@ static void inm_purge(struct in_multi *)
   static voidinm_reap(struct in_multi *);
   static struct ip_moptions *
  inp_findmoptions(struct inpcb *);
  +static voidinp_freemoptions_internal(struct ip_moptions *);
  +static voidinp_gcmoptions(void *, int);
   static int inp_get_source_filters(struct inpcb *, struct sockopt *);
   static int inp_join_group(struct inpcb *, struct sockopt *);
   static int inp_leave_group(struct inpcb *, struct sockopt *);
  @@ -179,6 +182,10 @@ static SYSCTL_NODE(_net_inet_ip_mcast, O
   CTLFLAG_RD | CTLFLAG_MPSAFE, sysctl_ip_mcast_filters,
   Per-interface stack-wide source filters);
 
  +static STAILQ_HEAD(, ip_moptions) imo_gc_list =
  +STAILQ_HEAD_INITIALIZER(imo_gc_list);
  +static struct task imo_gc_task = TASK_INITIALIZER(0, inp_gcmoptions, NULL);
  +
   /*
* Inline function which wraps assertions for a valid ifp.
* The ifnet layer will set the ifma's ifp pointer to NULL if the ifp
  @@ -1518,17 +1525,29 @@ inp_findmoptions(struct inpcb *inp)
   }
 
   /*
  - * Discard the IP multicast options (and source filters).
  + * Discard the IP multicast options (and source filters).  To minimize
  + * the amount of work done while holding locks such as the INP's
  + * pcbinfo lock (which is used in the receive path), the free
  + * operation is performed asynchronously in a separate task.
*
* SMPng: NOTE: assumes INP write lock is held.
*/
   void
   inp_freemoptions(struct ip_moptions *imo)
   {
  -   struct in_mfilter   *imf;
  -   size_t   idx, nmships;
 
  KASSERT(imo != NULL, (%s: ip_moptions is NULL, __func__));
  +   IN_MULTI_LOCK();
  +   STAILQ_INSERT_TAIL(imo_gc_list, imo, imo_link);
  +   IN_MULTI_UNLOCK();
  +   taskqueue_enqueue(taskqueue_thread, imo_gc_task);
  +}
  +
  +static void
  +inp_freemoptions_internal(struct ip_moptions *imo)
  +{
  +   struct in_mfilter   *imf;
  +   size_t   idx, nmships;
 
  nmships = imo-imo_num_memberships;
  for (idx = 0; idx  nmships; ++idx) {
  @@ -1546,6 +1565,22 @@ inp_freemoptions(struct ip_moptions *imo
  free(imo, M_IPMOPTS);
   }
 
  +static void
  +inp_gcmoptions(void *context, int pending)
  +{
  +   struct ip_moptions *imo;
  +
  +   IN_MULTI_LOCK();
  +   while (!STAILQ_EMPTY(imo_gc_list)) {
  +   imo = STAILQ_FIRST(imo_gc_list);
  +   STAILQ_REMOVE_HEAD(imo_gc_list, imo_link);
  +   IN_MULTI_UNLOCK();
  +   inp_freemoptions_internal(imo);
  +   IN_MULTI_LOCK();
  +   }
  +   IN_MULTI_UNLOCK();
  +}
  +
   /*
* Atomically get source filters on a socket for an IPv4 multicast group.
* Called with INP lock held; returns with lock released.
 
  Modified: head/sys/netinet/ip_var.h
  ==
  --- head/sys/netinet/ip_var.h   Thu Dec 29 19:01:29 2011
  (r228968)
  +++ head/sys/netinet/ip_var.h   Thu Dec 29 20:41:16 2011
  (r228969)
  @@ -93,6 +93,7 @@ struct ip_moptions {
  u_short imo_max_memberships;/* max memberships this socket */
  struct  in_multi **imo_membership;  /* group memberships */
  struct  in_mfilter *imo_mfilters;   /* source filters */
  +   STAILQ_ENTRY(ip_moptions) imo_link;
   };
 
   struct ipstat {
 
 
 I have been observing panics like below after recent upgrade on VIMAGE kernel:
 
 #0  doadump (textdump=-2022567936) at pcpu.h:244
 #1  0x8051b739 in db_fncall (dummy1=1, dummy2=0, dummy3=-2127531040,
 dummy4=0x872b2920 )
 at /home/golub/freebsd/base/head/sys/ddb/db_command.c:573
 #2  0x8051bb31 in db_command (last_cmdp=0x8112eefc, cmd_table=0x0, dopager=1)
 at /home/golub/freebsd/base/head/sys/ddb/db_command.c:449
 

Re: svn commit: r233700 - head/sys/kern

2012-04-02 Thread John Baldwin
On Friday, March 30, 2012 3:49:51 pm Dimitry Andric wrote:
 On 2012-03-30 15:30, Stefan Farfeleder wrote:
  here are a few similar cases.
 
 Hm, what about this one that clang warns about:
 
sys/dev/asr/asr.c:2420:57: warning: for loop has empty body [-Wempty-
body]
 for (ha = Asr_softc_list; *ha; ha = ((*ha)-ha_next));
^
sys/dev/asr/asr.c:2420:57: note: put the semicolon on a separate line to 
silence this warning [-Wempty-body]
 
 I'm not sure about it though, the code looks like this:
 
 static int
 asr_attach(device_t dev)
 {
 [...]
  Asr_softc_t  *sc, **ha;
 [...]
  LIST_INIT((sc-ha_ccb));
  /* Link us into the HA list */
  for (ha = Asr_softc_list; *ha; ha = ((*ha)-ha_next));
  *(ha) = sc;
 
 It seems the for loop walks the list until the end, then tacks 'sc' onto
 it.
 
 So to 'fix' the warning, and make the meaning more explicit, we should
 probably rewrite that fragment as:
 
  LIST_INIT((sc-ha_ccb));
  /* Link us into the HA list */
  for (ha = Asr_softc_list; *ha; ha = ((*ha)-ha_next))
   ;
   *(ha) = sc;
 
 Is this OK?

Can we just make that code use a STAILQ() instead of doing it obscurely by 
hand?

-- 
John Baldwin
___
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: r233781 - in head/sys: amd64/amd64 i386/i386 x86/include x86/x86

2012-04-02 Thread John Baldwin
Author: jhb
Date: Mon Apr  2 15:07:22 2012
New Revision: 233781
URL: http://svn.freebsd.org/changeset/base/233781

Log:
  Make machine check exception logging more readable.  On newer Intel systems,
  an uncorrected ECC error tends to fire on all CPUs in a package
  simultaneously and the current printf hacks are not sufficient to make
  the messages legible.  Instead, use the existing mca_lock spinlock to
  serialize calls to mca_log() and change the machine check code to panic
  directly when an unrecoverable error is encoutered rather than falling
  back to a trap_fatal() call in trap() (which adds nearly a screen-full of
  logging messages that aren't useful for machine checks).
  
  MFC after:2 weeks

Modified:
  head/sys/amd64/amd64/trap.c
  head/sys/i386/i386/trap.c
  head/sys/x86/include/mca.h
  head/sys/x86/x86/mca.c

Modified: head/sys/amd64/amd64/trap.c
==
--- head/sys/amd64/amd64/trap.c Mon Apr  2 14:52:28 2012(r233780)
+++ head/sys/amd64/amd64/trap.c Mon Apr  2 15:07:22 2012(r233781)
@@ -233,8 +233,7 @@ trap(struct trapframe *frame)
 #endif
 
if (type == T_MCHK) {
-   if (!mca_intr())
-   trap_fatal(frame, 0);
+   mca_intr();
goto out;
}
 

Modified: head/sys/i386/i386/trap.c
==
--- head/sys/i386/i386/trap.c   Mon Apr  2 14:52:28 2012(r233780)
+++ head/sys/i386/i386/trap.c   Mon Apr  2 15:07:22 2012(r233781)
@@ -254,8 +254,7 @@ trap(struct trapframe *frame)
 #endif
 
if (type == T_MCHK) {
-   if (!mca_intr())
-   trap_fatal(frame, 0);
+   mca_intr();
goto out;
}
 

Modified: head/sys/x86/include/mca.h
==
--- head/sys/x86/include/mca.h  Mon Apr  2 14:52:28 2012(r233780)
+++ head/sys/x86/include/mca.h  Mon Apr  2 15:07:22 2012(r233781)
@@ -48,7 +48,7 @@ struct mca_record {
 
 void   cmc_intr(void);
 void   mca_init(void);
-intmca_intr(void);
+void   mca_intr(void);
 void   mca_resume(void);
 
 #endif

Modified: head/sys/x86/x86/mca.c
==
--- head/sys/x86/x86/mca.c  Mon Apr  2 14:52:28 2012(r233780)
+++ head/sys/x86/x86/mca.c  Mon Apr  2 15:07:22 2012(r233781)
@@ -457,9 +457,9 @@ mca_record_entry(enum scan_mode mode, co
mtx_lock_spin(mca_lock);
rec = STAILQ_FIRST(mca_freelist);
if (rec == NULL) {
-   mtx_unlock_spin(mca_lock);
printf(MCA: Unable to allocate space for an event.\n);
mca_log(record);
+   mtx_unlock_spin(mca_lock);
return;
}
STAILQ_REMOVE_HEAD(mca_freelist, link);
@@ -589,7 +589,9 @@ mca_scan(enum scan_mode mode)
count++;
if (rec.mr_status  ucmask) {
recoverable = 0;
+   mtx_lock_spin(mca_lock);
mca_log(rec);
+   mtx_unlock_spin(mca_lock);
}
mca_record_entry(mode, rec);
}
@@ -636,9 +638,7 @@ mca_scan_cpus(void *arg)
STAILQ_FOREACH(mca, mca_records, link) {
if (!mca-logged) {
mca-logged = 1;
-   mtx_unlock_spin(mca_lock);
mca_log(mca-rec);
-   mtx_lock_spin(mca_lock);
}
}
mtx_unlock_spin(mca_lock);
@@ -924,7 +924,7 @@ mca_init_bsp(void *arg __unused)
 SYSINIT(mca_init_bsp, SI_SUB_CPU, SI_ORDER_ANY, mca_init_bsp, NULL);
 
 /* Called when a machine check exception fires. */
-int
+void
 mca_intr(void)
 {
uint64_t mcg_status;
@@ -938,7 +938,7 @@ mca_intr(void)
printf(MC Type: 0x%jx  Address: 0x%jx\n,
(uintmax_t)rdmsr(MSR_P5_MC_TYPE),
(uintmax_t)rdmsr(MSR_P5_MC_ADDR));
-   return (0);
+   panic(Machine check);
}
 
/* Scan the banks and check for any non-recoverable errors. */
@@ -949,7 +949,8 @@ mca_intr(void)
 
/* Clear MCIP. */
wrmsr(MSR_MCG_STATUS, mcg_status  ~MCG_STATUS_MCIP);
-   return (recoverable);
+   if (!recoverable)
+   panic(Unrecoverable machine check exception);
 }
 
 #ifdef DEV_APIC
@@ -972,9 +973,7 @@ cmc_intr(void)
STAILQ_FOREACH(mca, mca_records, link) {
if (!mca-logged) {
mca-logged = 1;
-

Re: svn commit: r233768 - head/sys/dev/mfi

2012-04-02 Thread Doug Ambrisko
Garrett Cooper writes:
| On Sun, Apr 1, 2012 at 7:22 PM, Doug Ambrisko ambri...@freebsd.org wrote:
|  Author: ambrisko
|  Date: Mon Apr ?2 02:22:22 2012
|  New Revision: 233768
|  URL: http://svn.freebsd.org/changeset/base/233768
| 
|  Log:
|  Change typedef atomic_t to struct mfi_atomic to avoid name space
|  collision and some couple more style changes.

Now, I just have to figure out what the IA64 issue is.  Some important
clues are missing from the log and doing a test build on a ref machine
didn't help.

Make universe is going to take some time since I have to wait for
my main machine to come back up.

Doug A.
___
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: r233783 - head/usr.sbin/makefs/cd9660

2012-04-02 Thread Andreas Tobler
Author: andreast
Date: Mon Apr  2 16:26:32 2012
New Revision: 233783
URL: http://svn.freebsd.org/changeset/base/233783

Log:
  - Write the ISO9660 descriptor after the apm partition entries.
  - Fill the needed pmPartStatus flags. At least the OpenBIOS
implementation relies on these flags.
  
  This commit fixes the panic seen on OS-X when inserting a FreeBSD/ppc disc.
  Additionally OpenBIOS recognizes the partition where the boot code is located.
  This lets us load a FreeBSD/ppc PowerMac kernel inside qemu.
  
  PR:   powerpc/162091
  MFC after:1 week

Modified:
  head/usr.sbin/makefs/cd9660/cd9660_eltorito.c

Modified: head/usr.sbin/makefs/cd9660/cd9660_eltorito.c
==
--- head/usr.sbin/makefs/cd9660/cd9660_eltorito.c   Mon Apr  2 16:13:54 
2012(r233782)
+++ head/usr.sbin/makefs/cd9660/cd9660_eltorito.c   Mon Apr  2 16:26:32 
2012(r233783)
@@ -538,9 +538,19 @@ cd9660_write_apm_partition_entry(FILE *f
 off_t sector_start, off_t nsectors, off_t sector_size,
 const char *part_name, const char *part_type)
 {
-   uint32_t apm32;
+   uint32_t apm32, part_status;
uint16_t apm16;
 
+   /* See Apple Tech Note 1189 for the details about the pmPartStatus
+* flags.
+* Below the flags which are default:
+* - IsValid 0x01
+* - IsAllocated 0x02
+* - IsReadable  0x10
+* - IsWritable  0x20
+*/
+   part_status = 0x01 | 0x02 | 0x10 | 0x20;
+
if (fseeko(fd, (off_t)(idx + 1) * sector_size, SEEK_SET) == -1)
err(1, fseeko);
 
@@ -562,6 +572,17 @@ cd9660_write_apm_partition_entry(FILE *f
fwrite(part_name, strlen(part_name) + 1, 1, fd);
fseek(fd, 32 - strlen(part_name) - 1, SEEK_CUR);
fwrite(part_type, strlen(part_type) + 1, 1, fd);
+   fseek(fd, 32 - strlen(part_type) - 1, SEEK_CUR);
+
+   apm32 = 0;
+   /* pmLgDataStart */
+fwrite(apm32, sizeof(apm32), 1, fd);
+   /* pmDataCnt */ 
+   apm32 = htobe32(nsectors);
+fwrite(apm32, sizeof(apm32), 1, fd);
+   /* pmPartStatus */
+   apm32 = htobe32(part_status);
+fwrite(apm32, sizeof(apm32), 1, fd);
 
return 0;
 }
@@ -666,12 +687,6 @@ cd9660_write_boot(FILE *fd)
cd9660_write_apm_partition_entry(fd, 0, total_parts, 1,
total_parts, 512, Apple, Apple_partition_map);
 
-   /* Write ISO9660 descriptor, enclosing the whole disk */
-   cd9660_write_apm_partition_entry(fd, 1, total_parts, 0,
-   diskStructure.totalSectors *
-   (diskStructure.sectorSize / 512), 512, ISO9660,
-   CD_ROM_Mode_1);
-
/* Write all partition entries */
apm_partitions = 0;
TAILQ_FOREACH(t, diskStructure.boot_images, image_list) {
@@ -679,11 +694,16 @@ cd9660_write_boot(FILE *fd)
continue;
 
cd9660_write_apm_partition_entry(fd,
-   2 + apm_partitions++, total_parts,
+   1 + apm_partitions++, total_parts,
t-sector * (diskStructure.sectorSize / 512),
t-num_sectors * (diskStructure.sectorSize / 512),
512, CD Boot, Apple_Bootstrap);
}
+   /* Write ISO9660 descriptor, enclosing the whole disk */
+cd9660_write_apm_partition_entry(fd, 2 + apm_partitions,
+   total_parts, 0, diskStructure.totalSectors *
+   (diskStructure.sectorSize / 512), 512, ISO9660,
+   CD_ROM_Mode_1);
}
 
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: r233787 - head/sys/ufs/ufs

2012-04-02 Thread Jaakko Heinonen
Author: jh
Date: Mon Apr  2 16:33:21 2012
New Revision: 233787
URL: http://svn.freebsd.org/changeset/base/233787

Log:
  - Use more natural ip-i_flags instead of vap-va_flags in the final
flags check.
  - Add a comment for the immutable/append check done after handling of
the flags.
  - Style improvements.
  
  No functional change intended.
  
  Submitted by: bde
  MFC after:2 weeks

Modified:
  head/sys/ufs/ufs/ufs_vnops.c

Modified: head/sys/ufs/ufs/ufs_vnops.c
==
--- head/sys/ufs/ufs/ufs_vnops.cMon Apr  2 16:33:07 2012
(r233786)
+++ head/sys/ufs/ufs/ufs_vnops.cMon Apr  2 16:33:21 2012
(r233787)
@@ -545,8 +545,8 @@ ufs_setattr(ap)
 * processes.
 */
if (!priv_check_cred(cred, PRIV_VFS_SYSFLAGS, 0)) {
-   if (ip-i_flags
-(SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) {
+   if (ip-i_flags 
+   (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) {
error = securelevel_gt(cred, 0);
if (error)
return (error);
@@ -560,8 +560,8 @@ ufs_setattr(ap)
ip-i_flags = vap-va_flags;
DIP_SET(ip, i_flags, vap-va_flags);
} else {
-   if (ip-i_flags
-(SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) ||
+   if (ip-i_flags 
+   (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) ||
(vap-va_flags  UF_SETTABLE) != vap-va_flags)
return (EPERM);
ip-i_flags = SF_SETTABLE;
@@ -570,9 +570,15 @@ ufs_setattr(ap)
}
ip-i_flag |= IN_CHANGE;
error = UFS_UPDATE(vp, 0);
-   if (vap-va_flags  (IMMUTABLE | APPEND))
+   if (ip-i_flags  (IMMUTABLE | APPEND))
return (error);
}
+   /*
+* If immutable or append, no one can change any of its attributes
+* except the ones already handled (exec atime and, in some cases
+* for the superuser, file flags including the immutability flags
+* themselves).
+*/
if (ip-i_flags  (IMMUTABLE | APPEND))
return (EPERM);
/*
___
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: r233793 - head/sys/x86/x86

2012-04-02 Thread John Baldwin
Author: jhb
Date: Mon Apr  2 17:26:21 2012
New Revision: 233793
URL: http://svn.freebsd.org/changeset/base/233793

Log:
  Further tweak the changes made in r233709.  The kernel doesn't permit
  sleeping from a swi handler (even though in this case it would be ok), so
  switch the refill and scanning SWI handlers to being tasks on a fast
  taskqueue.  Also, only schedule the refill task for a CMCI as an MC# can
  fire at any time, so it should do the minimal amount of work needed and
  avoid opportunities to deadlock before it panics (such as scheduling a
  task it won't ever need in practice).  To handle the case of an MC# only
  finding recoverable errors (which should never happen), always try to
  refill the event free list when the periodic scan executes.
  
  MFC after:2 weeks

Modified:
  head/sys/x86/x86/mca.c

Modified: head/sys/x86/x86/mca.c
==
--- head/sys/x86/x86/mca.c  Mon Apr  2 17:16:24 2012(r233792)
+++ head/sys/x86/x86/mca.c  Mon Apr  2 17:26:21 2012(r233793)
@@ -50,6 +50,7 @@ __FBSDID($FreeBSD$);
 #include sys/smp.h
 #include sys/sysctl.h
 #include sys/systm.h
+#include sys/taskqueue.h
 #include machine/intr_machdep.h
 #include machine/apicvar.h
 #include machine/cputypes.h
@@ -108,8 +109,9 @@ static int mca_freecount;
 static STAILQ_HEAD(, mca_internal) mca_records;
 static struct callout mca_timer;
 static int mca_ticks = 3600;   /* Check hourly by default. */
+static struct taskqueue *mca_tq;
+static struct task mca_refill_task, mca_scan_task;
 static struct mtx mca_lock;
-static void *mca_refill_swi, *mca_scan_swi;
 
 #ifdef DEV_APIC
 static struct cmc_state **cmc_state;   /* Indexed by cpuid, bank */
@@ -439,7 +441,7 @@ mca_fill_freelist(void)
 }
 
 static void
-mca_refill(void *arg)
+mca_refill(void *context, int pending)
 {
 
mca_fill_freelist();
@@ -464,8 +466,6 @@ mca_record_entry(enum scan_mode mode, co
}
STAILQ_REMOVE_HEAD(mca_freelist, link);
mca_freecount--;
-   if (mca_refill_swi != NULL)
-   swi_sched(mca_refill_swi, 0);
}
 
rec-rec = *record;
@@ -473,6 +473,8 @@ mca_record_entry(enum scan_mode mode, co
STAILQ_INSERT_TAIL(mca_records, rec, link);
mca_count++;
mtx_unlock_spin(mca_lock);
+   if (mode == CMCI)
+   taskqueue_enqueue_fast(mca_tq, mca_refill_task);
 }
 
 #ifdef DEV_APIC
@@ -616,12 +618,13 @@ mca_scan(enum scan_mode mode)
  * them to the console.
  */
 static void
-mca_scan_cpus(void *arg)
+mca_scan_cpus(void *context, int pending)
 {
struct mca_internal *mca;
struct thread *td;
int count, cpu;
 
+   mca_fill_freelist();
td = curthread;
count = 0;
thread_lock(td);
@@ -649,7 +652,7 @@ static void
 mca_periodic_scan(void *arg)
 {
 
-   swi_sched(mca_scan_swi, 1);
+   taskqueue_enqueue_fast(mca_tq, mca_scan_task);
callout_reset(mca_timer, mca_ticks * hz, mca_periodic_scan, NULL);
 }
 
@@ -663,23 +666,29 @@ sysctl_mca_scan(SYSCTL_HANDLER_ARGS)
if (error)
return (error);
if (i)
-   swi_sched(mca_scan_swi, 1);
+   taskqueue_enqueue_fast(mca_tq, mca_scan_task);
return (0);
 }
 
 static void
+mca_createtq(void *dummy)
+{
+   if (mca_banks = 0)
+   return;
+
+   mca_tq = taskqueue_create_fast(mca, M_WAITOK,
+   taskqueue_thread_enqueue, mca_tq);
+   taskqueue_start_threads(mca_tq, 1, PI_SWI(SWI_TQ), mca taskq);
+}
+SYSINIT(mca_createtq, SI_SUB_CONFIGURE, SI_ORDER_ANY, mca_createtq, NULL);
+
+static void
 mca_startup(void *dummy)
 {
-   struct intr_event *ie;
 
-   if (!mca_enabled || !(cpu_feature  CPUID_MCA))
+   if (mca_banks = 0)
return;
 
-   ie = NULL;
-   swi_add(ie, mca:scan, mca_scan_cpus, NULL, SWI_TQ, INTR_MPSAFE,
-   mca_scan_swi);
-   swi_add(ie, mca:refill, mca_refill, NULL, SWI_TQ, INTR_MPSAFE,
-   mca_refill_swi);
callout_reset(mca_timer, mca_ticks * hz, mca_periodic_scan, NULL);
 }
 SYSINIT(mca_startup, SI_SUB_SMP, SI_ORDER_ANY, mca_startup, NULL);
@@ -718,8 +727,10 @@ mca_setup(uint64_t mcg_cap)
mca_banks = mcg_cap  MCG_CAP_COUNT;
mtx_init(mca_lock, mca, NULL, MTX_SPIN);
STAILQ_INIT(mca_records);
+   TASK_INIT(mca_scan_task, 0, mca_scan_cpus, NULL);
callout_init(mca_timer, CALLOUT_MPSAFE);
STAILQ_INIT(mca_freelist);
+   TASK_INIT(mca_refill_task, 0, mca_refill, NULL);
mca_fill_freelist();
SYSCTL_ADD_INT(NULL, SYSCTL_STATIC_CHILDREN(_hw_mca), OID_AUTO,
count, CTLFLAG_RD, mca_count, 0, Record count);
___
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: r233805 - head/sys/dev/mfi

2012-04-02 Thread Doug Ambrisko
Author: ambrisko
Date: Mon Apr  2 19:13:02 2012
New Revision: 233805
URL: http://svn.freebsd.org/changeset/base/233805

Log:
  Move struct megasas_sge from mfi_ioctl.h to mfivar.h so we can
  remove including machine/bus.h.  Add some more mfi_ prefixes to
  avoid name space pollution.
  
  This should address the last tinderbox issues.

Modified:
  head/sys/dev/mfi/mfi_ioctl.h
  head/sys/dev/mfi/mfi_tbolt.c
  head/sys/dev/mfi/mfivar.h

Modified: head/sys/dev/mfi/mfi_ioctl.h
==
--- head/sys/dev/mfi/mfi_ioctl.hMon Apr  2 19:06:28 2012
(r233804)
+++ head/sys/dev/mfi/mfi_ioctl.hMon Apr  2 19:13:02 2012
(r233805)
@@ -28,19 +28,12 @@
 __FBSDID($FreeBSD$);
 
 #include dev/mfi/mfireg.h
-#include machine/bus.h
 
 struct iovec32 {
u_int32_t   iov_base;
int iov_len;
 };
 
-struct megasas_sge
-{
-   bus_addr_t phys_addr;
-   uint32_t length;
-};
-
 #define MFIQ_FREE  0
 #define MFIQ_BIO   1
 #define MFIQ_READY 2

Modified: head/sys/dev/mfi/mfi_tbolt.c
==
--- head/sys/dev/mfi/mfi_tbolt.cMon Apr  2 19:06:28 2012
(r233804)
+++ head/sys/dev/mfi/mfi_tbolt.cMon Apr  2 19:13:02 2012
(r233805)
@@ -520,7 +520,7 @@ int mfi_tbolt_reset(struct mfi_softc *sc
uint32_t fw_state;
 
mtx_lock(sc-mfi_io_lock);
-   if (atomic_read(sc-fw_reset_no_pci_access)) {
+   if (mfi_atomic_read(sc-fw_reset_no_pci_access)) {
device_printf(sc-mfi_dev, NO PCI ACCESS\n);
mtx_unlock(sc-mfi_io_lock);
return 1;

Modified: head/sys/dev/mfi/mfivar.h
==
--- head/sys/dev/mfi/mfivar.h   Mon Apr  2 19:06:28 2012(r233804)
+++ head/sys/dev/mfi/mfivar.h   Mon Apr  2 19:13:02 2012(r233805)
@@ -155,13 +155,19 @@ struct mfi_skinny_dma_info {
int noofmaps;
 };
 
+struct megasas_sge
+{
+   bus_addr_t  phys_addr;
+   uint32_tlength;
+};
+
 struct mfi_cmd_tbolt;
 struct mfi_atomic {
volatile unsigned int   val;
 };
 
-#defineatomic_read(v)  ((v)-val)
-#defineatomic_set(v,i) ((v)-val - (i))
+#definemfi_atomic_read(v)  ((v)-val)
+#definemfi_atomic_set(v,i) ((v)-val - (i))
 
 struct mfi_softc {
device_tmfi_dev;
@@ -582,7 +588,7 @@ SYSCTL_DECL(_hw_mfi);
 #define MFI_CMD_TIMEOUT 30
 #define MFI_SYS_PD_IO  0
 #define MFI_LD_IO  1
-#define SKINNY_MEMORY 0x0200
+#define MFI_SKINNY_MEMORY 0x0200
 #define MFI_MAXPHYS (128 * 1024)
 
 #ifdef MFI_DEBUG
___
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: r233809 - head/sys/kern

2012-04-02 Thread Konstantin Belousov
Author: kib
Date: Mon Apr  2 19:35:36 2012
New Revision: 233809
URL: http://svn.freebsd.org/changeset/base/233809

Log:
  When process exists, not only the children shall be reparented to
  init, but also the orphans shall be removed from the orphan list,
  because the list header is destroyed.
  
  Reported and tested by:   pho
  MFC after:3 days

Modified:
  head/sys/kern/kern_exit.c

Modified: head/sys/kern/kern_exit.c
==
--- head/sys/kern/kern_exit.c   Mon Apr  2 19:34:56 2012(r233808)
+++ head/sys/kern/kern_exit.c   Mon Apr  2 19:35:36 2012(r233809)
@@ -430,6 +430,13 @@ exit1(struct thread *td, int rv)
if (q-p_flag  P_TRACED) {
struct thread *temp;
 
+   /*
+* Since q was found on our children list, the
+* proc_reparent() call moved q to the orphan
+* list due to present P_TRACED flag. Clear
+* orphan link for q now while q is locked.
+*/
+   clear_orphan(q);
q-p_flag = ~(P_TRACED | P_STOPPED_TRACE);
FOREACH_THREAD_IN_PROC(q, temp)
temp-td_dbgflags = ~TDB_SUSPEND;
@@ -438,6 +445,15 @@ exit1(struct thread *td, int rv)
PROC_UNLOCK(q);
}
 
+   /*
+* Also get rid of our orphans.
+*/
+   while ((q = LIST_FIRST(p-p_orphans)) != NULL) {
+   PROC_LOCK(q);
+   clear_orphan(q);
+   PROC_UNLOCK(q);
+   }
+
/* Save exit status. */
PROC_LOCK(p);
p-p_xthread = td;
___
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: r233674 - head/libexec/rtld-elf

2012-04-02 Thread Marcel Moolenaar

On Mar 29, 2012, at 11:11 AM, Konstantin Belousov wrote:

 While this band-aid fixes the build, the change is obviously bad.
 The reason to have this #ifdef is that ia64 is the only architecture
 that declares __tls_get_addr() as
 
 void *__tls_get_addr(unsigned long module, unsigned long offset);

It should actually be:
void *__tls_get_addr(size_t module, size_t offset)

But size_t equals unsigned long, so the effect is the same.

The prototype if __tls_get_addr() is defined in the PSABI
document for Itanium. Intel document 245370-003.

FYI,

-- 
Marcel Moolenaar
mar...@xcllnt.net


___
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: r233817 - in head/sys/ufs: ffs ufs

2012-04-02 Thread Kirk McKusick
Author: mckusick
Date: Mon Apr  2 21:58:37 2012
New Revision: 233817
URL: http://svn.freebsd.org/changeset/base/233817

Log:
  A file cannot be deallocated until its last name has been removed
  and it is no longer referenced by a user process. The inode for a
  file whose name has been removed, but is still referenced at the
  time of a crash will still be allocated in the filesystem, but will
  have no references (e.g., they will have no names referencing them
  from any directory).
  
  With traditional soft updates these unreferenced inodes will be
  found and reclaimed when the background fsck is run. When using
  journaled soft updates, the kernel must keep track of these inodes
  so that it can find and reclaim them during the cleanup process.
  Their existence cannot be stored in the journal as the journal only
  handles short-term events, and they may persist for days. So, they
  are tracked by keeping them in a linked list whose head pointer is
  stored in the superblock. The journal tracks them only until their
  linked list pointers have been commited to disk. Part of the cleanup
  process involves traversing the list of unreferenced inodes and
  reclaiming them.
  
  This bug was triggered when confusion arose in the commit steps
  of keeping the unreferenced-inode linked list coherent on disk.
  Notably, a race between the link() system call adding a link-count
  to a file and the unlink() system call removing a link-count to
  the file. Here if the unlink() ran after link() had looked up
  the file but before link() had incremented the link-count of the
  file, the file's link-count would drop to zero before the link()
  incremented it back up to one. If the file was referenced by a
  user process, the first transition through zero made it appear
  that it should be added to the unreferenced-inode list when in
  fact it should not have been added. If the new name created by
  link() was deleted within a few seconds (with the file still
  referenced by a user process) it would legitimately be a candidate
  for addition to the unreferenced-inode list. The result was that
  there were two attempts to add the same inode to the unreferenced-inode
  list which scrambled the unreferenced-inode list's pointers leading
  to a panic. The fix is to detect and avoid the false attempt at
  adding it to the unreferenced-inode list by having the link()
  system call check to see if the link count is zero before it
  increments it. If it is, the link() fails with ENOENT (showing that
  it has failed the link()/unlink() race).
  
  While tracking down this bug, we have added additional assertions
  to detect the problem sooner and also simplified some of the code.
  
  Reported by:  Kirk Russell
  Fix submitted by: Jeff Roberson
  Tested by:Peter Holm
  PR:   kern/159971
  MFC (to 9 only):  2 weeks

Modified:
  head/sys/ufs/ffs/ffs_softdep.c
  head/sys/ufs/ufs/ufs_vnops.c

Modified: head/sys/ufs/ffs/ffs_softdep.c
==
--- head/sys/ufs/ffs/ffs_softdep.c  Mon Apr  2 20:36:35 2012
(r233816)
+++ head/sys/ufs/ffs/ffs_softdep.c  Mon Apr  2 21:58:37 2012
(r233817)
@@ -4323,6 +4323,7 @@ inodedep_lookup_ip(ip)
(void) inodedep_lookup(UFSTOVFS(ip-i_ump), ip-i_number, dflags,
inodedep);
inodedep-id_nlinkdelta = ip-i_nlink - ip-i_effnlink;
+   KASSERT((inodedep-id_state  UNLINKED) == 0, (inode unlinked));
 
return (inodedep);
 }
@@ -8455,6 +8456,7 @@ softdep_setup_remove(bp, dp, ip, isrmdir
if (inodedep_lookup(UFSTOVFS(ip-i_ump), ip-i_number, 0,
inodedep) == 0)
panic(softdep_setup_remove: Lost inodedep.);
+   KASSERT((inodedep-id_state  UNLINKED) == 0, (inode unlinked));
dirrem-dm_state |= ONDEPLIST;
LIST_INSERT_HEAD(inodedep-id_dirremhd, dirrem, dm_inonext);
 
@@ -8987,6 +8989,7 @@ first_unlinked_inodedep(ump)
struct inodedep *inodedep;
struct inodedep *idp;
 
+   mtx_assert(lk, MA_OWNED);
for (inodedep = TAILQ_LAST(ump-softdep_unlinked, inodedeplst);
inodedep; inodedep = idp) {
if ((inodedep-id_state  UNLINKNEXT) == 0)
@@ -8995,11 +8998,8 @@ first_unlinked_inodedep(ump)
if (idp == NULL || (idp-id_state  UNLINKNEXT) == 0)
break;
if ((inodedep-id_state  UNLINKPREV) == 0)
-   panic(first_unlinked_inodedep: prev != next);
+   break;
}
-   if (inodedep == NULL)
-   return (NULL);
-
return (inodedep);
 }
 
@@ -9038,8 +9038,12 @@ handle_written_sbdep(sbdep, bp)
struct mount *mp;
struct fs *fs;
 
+   mtx_assert(lk, MA_OWNED);
fs = sbdep-sb_fs;
mp = UFSTOVFS(sbdep-sb_ump);
+   /*
+* If the superblock doesn't match the in-memory list start over.
+*/
inodedep = 

Re: svn commit: r233805 - head/sys/dev/mfi

2012-04-02 Thread Garrett Cooper
On Mon, Apr 2, 2012 at 12:13 PM, Doug Ambrisko ambri...@freebsd.org wrote:
 Author: ambrisko
 Date: Mon Apr  2 19:13:02 2012
 New Revision: 233805
 URL: http://svn.freebsd.org/changeset/base/233805

 Log:
  Move struct megasas_sge from mfi_ioctl.h to mfivar.h so we can
  remove including machine/bus.h.  Add some more mfi_ prefixes to
  avoid name space pollution.

  This should address the last tinderbox issues.

Yup -- it fixed pc98. Thanks Doug!
___
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