Re: svn commit: r254799 - in head/sys: dev/cas dev/hatm dev/iscsi_initiator dev/lge dev/mwl kern sys

2013-08-25 Thread Glen Barber
On Sat, Aug 24, 2013 at 04:57:44PM +, Andre Oppermann wrote:
 Author: andre
 Date: Sat Aug 24 16:57:44 2013
 New Revision: 254799
 URL: http://svnweb.freebsd.org/changeset/base/254799
 
 Log:
   Add an mbuf pointer parameter to (*ext_free) to give the external
   free function access to the mbuf the external memory was attached
   to.
   
   Mechanically adjust all users to include the mbuf parameter.
   
   This fixes a long standing annoyance for external free functions.
   Before one had to sacrifice one of the argument pointers for this.
   

 Modified: head/sys/kern/uipc_mbuf.c
 ==
 --- head/sys/kern/uipc_mbuf.c Sat Aug 24 16:55:53 2013(r254798)
 +++ head/sys/kern/uipc_mbuf.c Sat Aug 24 16:57:44 2013(r254799)
 @@ -247,8 +247,8 @@ m_freem(struct mbuf *mb)
   */
  int
  m_extadd(struct mbuf *mb, caddr_t buf, u_int size,
 -void (*freef)(void *, void *), void *arg1, void *arg2, int flags, int 
 type,
 -int wait)
 +void (*freef)(struct mbuf *, void *, void *), void *arg1, void *arg2,
 +int flags, int type, int wait)
  {
   KASSERT(type != EXT_CLUSTER, (%s: EXT_CLUSTER not allowed, __func__));
  

I think this breaks head/.

cc  -c -O2 -pipe -fno-strict-aliasing  -std=c99  -Wall -Wredundant-decls
-Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes
-Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno-pointer-sign
-fformat-extensions  -Wmissing-include-dirs -fdiagnostics-show-option
-Wno-error-tautological-compare -Wno-error-empty-body
-Wno-error-parentheses-equality  -nostdinc  -I. -I/src/sys
-I/src/sys/contrib/altq -I/src/sys/contrib/libfdt -D_KERNEL
-DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -DGPROF -DGPROF4
-DGUPROF -fno-builtin -mno-aes -mno-avx -mno-mmx -mno-sse -msoft-float
-ffreestanding -fstack-protector -Werror -pg /src/sys/kern/uipc_cow.c
/src/sys/kern/uipc_cow.c:164:2: error: incompatible pointer types
passing 'void (void *, void *)' to parameter of type 'void (*)(struct
mbuf *, void *, void *)' [-Werror,-Wincompatible-pointer-types]
MEXTADD(m0, sf_buf_kva(sf), PAGE_SIZE, socow_iodone,
^~~~
/src/sys/sys/mbuf.h:760:50: note: expanded from macro 'MEXTADD'
(void )m_extadd((m), (caddr_t)(buf), (size), (free), (arg1),
(arg2),\
 ^~
/src/sys/sys/mbuf.h:898:14: note: passing argument to parameter here
void (*)(struct mbuf *, void *, void *), void *,
void *,
   ^
1 error generated.
*** Error code 1

Stop.
bmake[1]: stopped in /obj/i386.i386/src/sys/LINT
*** Error code 1

http://tinderbox.freebsd.org/tinderbox-head-build-HEAD-i386-i386.full

Glen



pgpwL2B9H4Lho.pgp
Description: PGP signature


Re: svn commit: r254824 - head/sys/dev/hwpmc

2013-08-25 Thread hiren panchasara
On Sat, Aug 24, 2013 at 7:07 PM, Adrian Chadd adr...@freebsd.org wrote:

 Author: adrian
 Date: Sun Aug 25 02:07:28 2013
 New Revision: 254824
 URL: http://svnweb.freebsd.org/changeset/base/254824

 Log:
   Update the MEM_UOP_RETIRED PMC operation for sandy bridge and sandy
   bridge Xeon.

   Summary: These are PEBS events but they're also available as normal
   counter/sample events.  The source table (Table 19-2) lists the
   base versions (LOAD, STLB_MISS, SPLIT, ALL) but it says they must
   be qualified with other values.  This particular commit fleshes
   out those umask values.

   Source:

   * Linux; SDM June 2013, Volume 3B, Table 19-2 and 18-21.

   Tested:

   * Sandy Bridge (non-Xeon)

 Modified:
   head/sys/dev/hwpmc/hwpmc_core.c
   head/sys/dev/hwpmc/pmc_events.h

 Modified: head/sys/dev/hwpmc/hwpmc_core.c

 ==
 --- head/sys/dev/hwpmc/hwpmc_core.c Sun Aug 25 01:55:14 2013
  (r254823)
 +++ head/sys/dev/hwpmc/hwpmc_core.c Sun Aug 25 02:07:28 2013
  (r254824)
 @@ -1514,19 +1514,21 @@ static struct iap_event_descr iap_events
  IAPDESCR(CEH_00H, 0xCE, 0x00, IAP_F_FM | IAP_F_ALLCPUSCORE2),
  IAPDESCR(CFH_00H, 0xCF, 0x00, IAP_F_FM | IAP_F_CA | IAP_F_CC2),

 +/* Sandy Bridge / Sandy Bridge Xeon - 11, 12, 21, 41, 42, 81, 82 */
  IAPDESCR(D0H_00H, 0xD0, 0x00, IAP_F_FM | IAP_F_CC),
 -IAPDESCR(D0H_01H, 0xD0, 0x01, IAP_F_FM | IAP_F_I7 | IAP_F_WM |
 -   IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW),
 -IAPDESCR(D0H_02H, 0xD0, 0x02, IAP_F_FM | IAP_F_SB | IAP_F_IB |
 -   IAP_F_SBX | IAP_F_IBX | IAP_F_HW),
 -IAPDESCR(D0H_10H, 0xD0, 0x10, IAP_F_FM | IAP_F_SB | IAP_F_IB |
 -   IAP_F_SBX | IAP_F_IBX | IAP_F_HW),
 -IAPDESCR(D0H_20H, 0xD0, 0x20, IAP_F_FM | IAP_F_SB | IAP_F_IB |
 -   IAP_F_SBX | IAP_F_IBX | IAP_F_HW),
 -IAPDESCR(D0H_40H, 0xD0, 0x40, IAP_F_FM | IAP_F_SB | IAP_F_IB |
 -   IAP_F_SBX | IAP_F_IBX | IAP_F_HW),
 -IAPDESCR(D0H_80H, 0xD0, 0X80, IAP_F_FM | IAP_F_SB | IAP_F_IB |
 -   IAP_F_SBX | IAP_F_IBX | IAP_F_HW),
 +IAPDESCR(D0H_01H, 0xD0, 0x01, IAP_F_FM | IAP_F_I7 | IAP_F_WM |
 IAP_F_IB | IAP_F_IBX | IAP_F_HW),


This is unnecessarily going above 80-columns.

Thanks,
Hiren

 +IAPDESCR(D0H_02H, 0xD0, 0x02, IAP_F_FM | IAP_F_IB | IAP_F_IBX |
 IAP_F_HW),
 +IAPDESCR(D0H_10H, 0xD0, 0x10, IAP_F_FM | IAP_F_IB | IAP_F_IBX |
 IAP_F_HW),
 +IAPDESCR(D0H_11H, 0xD0, 0x11, IAP_F_FM | IAP_F_SB | IAP_F_SBX),
 +IAPDESCR(D0H_12H, 0xD0, 0x12, IAP_F_FM | IAP_F_SB | IAP_F_SBX),
 +IAPDESCR(D0H_20H, 0xD0, 0x20, IAP_F_FM | IAP_F_IB | IAP_F_IBX |
 IAP_F_HW),
 +IAPDESCR(D0H_21H, 0xD0, 0x21, IAP_F_FM | IAP_F_SB | IAP_F_SBX),
 +IAPDESCR(D0H_40H, 0xD0, 0x40, IAP_F_FM | IAP_F_IB | IAP_F_IBX |
 IAP_F_HW),
 +IAPDESCR(D0H_41H, 0xD0, 0x41, IAP_F_FM | IAP_F_SB | IAP_F_SBX),
 +IAPDESCR(D0H_42H, 0xD0, 0x42, IAP_F_FM | IAP_F_SB | IAP_F_SBX),
 +IAPDESCR(D0H_80H, 0xD0, 0x80, IAP_F_FM | IAP_F_IB | IAP_F_IBX |
 IAP_F_HW),
 +IAPDESCR(D0H_81H, 0xD0, 0x81, IAP_F_FM | IAP_F_SB | IAP_F_SBX),
 +IAPDESCR(D0H_82H, 0xD0, 0x82, IAP_F_FM | IAP_F_SB | IAP_F_SBX),

  IAPDESCR(D1H_01H, 0xD1, 0x01, IAP_F_FM | IAP_F_WM | IAP_F_SB |
 IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW),

 Modified: head/sys/dev/hwpmc/pmc_events.h

 ==
 --- head/sys/dev/hwpmc/pmc_events.h Sun Aug 25 01:55:14 2013
  (r254823)
 +++ head/sys/dev/hwpmc/pmc_events.h Sun Aug 25 02:07:28 2013
  (r254824)
 @@ -1053,9 +1053,16 @@ __PMC_EV(IAP, EVENT_D0H_00H) \
  __PMC_EV(IAP, EVENT_D0H_01H)   \
  __PMC_EV(IAP, EVENT_D0H_02H)   \
  __PMC_EV(IAP, EVENT_D0H_10H)   \
 +__PMC_EV(IAP, EVENT_D0H_11H)   \
 +__PMC_EV(IAP, EVENT_D0H_12H)   \
  __PMC_EV(IAP, EVENT_D0H_20H)   \
 +__PMC_EV(IAP, EVENT_D0H_21H)   \
  __PMC_EV(IAP, EVENT_D0H_40H)   \
 +__PMC_EV(IAP, EVENT_D0H_41H)   \
 +__PMC_EV(IAP, EVENT_D0H_42H)   \
  __PMC_EV(IAP, EVENT_D0H_80H)   \
 +__PMC_EV(IAP, EVENT_D0H_81H)   \
 +__PMC_EV(IAP, EVENT_D0H_82H)   \
  __PMC_EV(IAP, EVENT_D1H_01H)   \
  __PMC_EV(IAP, EVENT_D1H_02H)   \
  __PMC_EV(IAP, EVENT_D1H_04H)   \
 @@ -3286,12 +3293,13 @@ __PMC_EV_ALIAS(FP_ASSIST.ANY, IAP_EVEN
  __PMC_EV_ALIAS(ROB_MISC_EVENTS.LBR_INSERTS, IAP_EVENT_CCH_20H)   \
  __PMC_EV_ALIAS(MEM_TRANS_RETIRED.LOAD_LATENCY, IAP_EVENT_CDH_01H)\
  __PMC_EV_ALIAS(MEM_TRANS_RETIRED.PRECISE_STORE, IAP_EVENT_CDH_02H)   \
 -__PMC_EV_ALIAS(MEM_UOP_RETIRED.LOADS, IAP_EVENT_D0H_01H) \
 -__PMC_EV_ALIAS(MEM_UOP_RETIRED.STORES, IAP_EVENT_D0H_02H)\
 -__PMC_EV_ALIAS(MEM_UOP_RETIRED.STLB_MISS, IAP_EVENT_D0H_10H) \
 

svn commit: r254825 - head/share/man/man9

2013-08-25 Thread Joel Dahl
Author: joel (doc committer)
Date: Sun Aug 25 06:58:51 2013
New Revision: 254825
URL: http://svnweb.freebsd.org/changeset/base/254825

Log:
  mdoc fixes.

Modified:
  head/share/man/man9/pfil.9

Modified: head/share/man/man9/pfil.9
==
--- head/share/man/man9/pfil.9  Sun Aug 25 02:07:28 2013(r254824)
+++ head/share/man/man9/pfil.9  Sun Aug 25 06:58:51 2013(r254825)
@@ -71,6 +71,7 @@ typedef int (*pfil_func_t)(void *arg, st
 .Fn pfil_wlock struct pfil_head *
 .Ft void
 .Fn pfil_wunlock struct pfil_head *
+.Ed
 .Sh DESCRIPTION
 The
 .Nm
@@ -241,7 +242,7 @@ Fine-grained locking was added in
 lock export was added in
 .Fx 10.0 .
 .Sh BUGS
-.Pp When a
+When a
 .Vt pfil_head
 is being modified, no traffic is diverted
 (to avoid deadlock).
___
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: r254826 - head/share/man/man9

2013-08-25 Thread Joel Dahl
Author: joel (doc committer)
Date: Sun Aug 25 06:59:30 2013
New Revision: 254826
URL: http://svnweb.freebsd.org/changeset/base/254826

Log:
  Remove EOL whitespace.

Modified:
  head/share/man/man9/timeout.9

Modified: head/share/man/man9/timeout.9
==
--- head/share/man/man9/timeout.9   Sun Aug 25 06:58:51 2013
(r254825)
+++ head/share/man/man9/timeout.9   Sun Aug 25 06:59:30 2013
(r254826)
@@ -256,7 +256,7 @@ after the callout function returns.
 .Pp
 The
 .Fn callout_init_rw
-and the 
+and the
 .Fn callout_init_rm
 fuctions serve the need of using rwlocks and rmlocks in conjunction
 with callouts.
___
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: r254827 - head/etc/defaults

2013-08-25 Thread Jeremie Le Hen
Author: jlh
Date: Sun Aug 25 07:46:18 2013
New Revision: 254827
URL: http://svnweb.freebsd.org/changeset/base/254827

Log:
  Move daily_status_security_noamd next to 200.chkmounts's variables.

Modified:
  head/etc/defaults/periodic.conf

Modified: head/etc/defaults/periodic.conf
==
--- head/etc/defaults/periodic.conf Sun Aug 25 06:59:30 2013
(r254826)
+++ head/etc/defaults/periodic.conf Sun Aug 25 07:46:18 2013
(r254827)
@@ -166,7 +166,6 @@ daily_local=/etc/daily.local  
# Loca
 # 450.status-security above.
 daily_status_security_inline=NO  # Run inline ?
 daily_status_security_output=root# user or /file
-daily_status_security_noamd=NO   # Don't check amd mounts
 daily_status_security_logdir=/var/log# Directory for 
logs
 daily_status_security_diff_flags=-b -u   # flags for diff output
 
@@ -180,6 +179,7 @@ daily_status_security_neggrpperm_enable=
 daily_status_security_chkmounts_enable=YES
 #daily_status_security_chkmounts_ignore=^amd:# Don't check 
matching
# FS types
+daily_status_security_noamd=NO   # Don't check amd mounts
 
 # 300.chkuid0
 daily_status_security_chkuid0_enable=YES
___
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: r254828 - head/sys/dev/usb/controller

2013-08-25 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Aug 25 08:42:50 2013
New Revision: 254828
URL: http://svnweb.freebsd.org/changeset/base/254828

Log:
  Bugfix: The endpoint profile should only be checked in device mode when
  allocating USB transfers and not in host mode.
  
  Reported by:  George Mitchell george+free...@m5p.com

Modified:
  head/sys/dev/usb/controller/dwc_otg.c
  head/sys/dev/usb/controller/musb_otg.c

Modified: head/sys/dev/usb/controller/dwc_otg.c
==
--- head/sys/dev/usb/controller/dwc_otg.c   Sun Aug 25 07:46:18 2013
(r254827)
+++ head/sys/dev/usb/controller/dwc_otg.c   Sun Aug 25 08:42:50 2013
(r254828)
@@ -3968,7 +3968,6 @@ done:
 static void
 dwc_otg_xfer_setup(struct usb_setup_params *parm)
 {
-   const struct usb_hw_ep_profile *pf;
struct usb_xfer *xfer;
void *last_obj;
uint32_t ntd;
@@ -4011,16 +4010,21 @@ dwc_otg_xfer_setup(struct usb_setup_para
 */
last_obj = NULL;
 
+   ep_no = xfer-endpointno  UE_ADDR;
+
/*
-* get profile stuff
+* Check for a valid endpoint profile in USB device mode:
 */
-   ep_no = xfer-endpointno  UE_ADDR;
-   dwc_otg_get_hw_ep_profile(parm-udev, pf, ep_no);
+   if (xfer-flags_int.usb_mode == USB_MODE_DEVICE) {
+   const struct usb_hw_ep_profile *pf;
 
-   if (pf == NULL) {
-   /* should not happen */
-   parm-err = USB_ERR_INVAL;
-   return;
+   dwc_otg_get_hw_ep_profile(parm-udev, pf, ep_no);
+
+   if (pf == NULL) {
+   /* should not happen */
+   parm-err = USB_ERR_INVAL;
+   return;
+   }
}
 
/* align data */

Modified: head/sys/dev/usb/controller/musb_otg.c
==
--- head/sys/dev/usb/controller/musb_otg.c  Sun Aug 25 07:46:18 2013
(r254827)
+++ head/sys/dev/usb/controller/musb_otg.c  Sun Aug 25 08:42:50 2013
(r254828)
@@ -4026,7 +4026,6 @@ done:
 static void
 musbotg_xfer_setup(struct usb_setup_params *parm)
 {
-   const struct usb_hw_ep_profile *pf;
struct musbotg_softc *sc;
struct usb_xfer *xfer;
void *last_obj;
@@ -4088,12 +4087,14 @@ musbotg_xfer_setup(struct usb_setup_para
 */
last_obj = NULL;
 
+   ep_no = xfer-endpointno  UE_ADDR;
+
/*
-* get profile stuff
+* Check for a valid endpoint profile in USB device mode:
 */
-   if (ntd) {
+   if (xfer-flags_int.usb_mode == USB_MODE_DEVICE) {
+   const struct usb_hw_ep_profile *pf;
 
-   ep_no = xfer-endpointno  UE_ADDR;
musbotg_get_hw_ep_profile(parm-udev, pf, ep_no);
 
if (pf == NULL) {
@@ -4101,9 +4102,6 @@ musbotg_xfer_setup(struct usb_setup_para
parm-err = USB_ERR_INVAL;
return;
}
-   } else {
-   ep_no = 0;
-   pf = NULL;
}
 
/* align data */
___
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: r254829 - head/usr.sbin/periodic

2013-08-25 Thread Jeremie Le Hen
Author: jlh
Date: Sun Aug 25 08:56:09 2013
New Revision: 254829
URL: http://svnweb.freebsd.org/changeset/base/254829

Log:
  Export a PERIODIC environment variable from periodic(8).  This will
  allow periodic security scripts to know if they have been called in
  a daily or a weekly context.

Modified:
  head/usr.sbin/periodic/periodic.sh

Modified: head/usr.sbin/periodic/periodic.sh
==
--- head/usr.sbin/periodic/periodic.sh  Sun Aug 25 08:42:50 2013
(r254828)
+++ head/usr.sbin/periodic/periodic.sh  Sun Aug 25 08:56:09 2013
(r254829)
@@ -76,6 +76,7 @@ shift
 arg=$1
 
 tmp_output=`mktemp ${TMPDIR:-/tmp}/periodic.XX`
+export PERIODIC=$arg${PERIODIC:+ }${PERIODIC}
 
 # Execute each executable file in the directory list.  If the x bit is not
 # set, assume the user didn't really want us to muck with it (it's 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: r254830 - head/sys/kern

2013-08-25 Thread Andre Oppermann
Author: andre
Date: Sun Aug 25 09:40:15 2013
New Revision: 254830
URL: http://svnweb.freebsd.org/changeset/base/254830

Log:
  Adjust socow_iodone() after r254799.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/uipc_cow.c

Modified: head/sys/kern/uipc_cow.c
==
--- head/sys/kern/uipc_cow.cSun Aug 25 08:56:09 2013(r254829)
+++ head/sys/kern/uipc_cow.cSun Aug 25 09:40:15 2013(r254830)
@@ -70,10 +70,10 @@ struct netsend_cow_stats {
 
 static struct netsend_cow_stats socow_stats;
 
-static void socow_iodone(void *addr, void *args);
+static void socow_iodone(struct mbuf *m, void *addr, void *args);
 
 static void
-socow_iodone(void *addr, void *args)
+socow_iodone(struct mbuf *m, void *addr, void *args)
 {  
struct sf_buf *sf;
vm_page_t pp;
___
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: r254831 - head/sys/net

2013-08-25 Thread Andre Oppermann
Author: andre
Date: Sun Aug 25 09:41:37 2013
New Revision: 254831
URL: http://svnweb.freebsd.org/changeset/base/254831

Log:
  Remove unnecessary setup of the m-pkthdr.header pointer.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/net/if_fddisubr.c
  head/sys/net/if_iso88025subr.c

Modified: head/sys/net/if_fddisubr.c
==
--- head/sys/net/if_fddisubr.c  Sun Aug 25 09:40:15 2013(r254830)
+++ head/sys/net/if_fddisubr.c  Sun Aug 25 09:41:37 2013(r254831)
@@ -390,7 +390,6 @@ fddi_input(ifp, m)
goto dropanyway;
}
fh = mtod(m, struct fddi_header *);
-   m-m_pkthdr.header = (void *)fh;
 
/*
 * Discard packet if interface is not up.

Modified: head/sys/net/if_iso88025subr.c
==
--- head/sys/net/if_iso88025subr.c  Sun Aug 25 09:40:15 2013
(r254830)
+++ head/sys/net/if_iso88025subr.c  Sun Aug 25 09:41:37 2013
(r254831)
@@ -476,7 +476,6 @@ iso88025_input(ifp, m)
goto dropanyway;
}
th = mtod(m, struct iso88025_header *);
-   m-m_pkthdr.header = (void *)th;
 
/*
 * Discard packet if interface is not up.
___
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: r254832 - head/sys/ofed/drivers/net/mlx4

2013-08-25 Thread Andre Oppermann
Author: andre
Date: Sun Aug 25 09:45:26 2013
New Revision: 254832
URL: http://svnweb.freebsd.org/changeset/base/254832

Log:
  Change m-pkthdr.header to m-pkthdr.PH_loc.ptr after r254804
  to transiently store pointers to packet headers.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/ofed/drivers/net/mlx4/en_frag.c

Modified: head/sys/ofed/drivers/net/mlx4/en_frag.c
==
--- head/sys/ofed/drivers/net/mlx4/en_frag.cSun Aug 25 09:41:37 2013
(r254831)
+++ head/sys/ofed/drivers/net/mlx4/en_frag.cSun Aug 25 09:45:26 2013
(r254832)
@@ -87,7 +87,7 @@ static void flush_session(struct mlx4_en
  u16 more)
 {
struct mbuf *mb = session-fragments;
-   struct ip *iph = mb-m_pkthdr.header;
+   struct ip *iph = mb-m_pkthdr.PH_loc.ptr;
struct net_device *dev = mb-m_pkthdr.rcvif;
 
/* Update IP length and checksum */
@@ -132,7 +132,7 @@ int mlx4_en_rx_frags(struct mlx4_en_priv
u16 offset;
 
iph = (struct ip *)(mtod(mb, char *) + ETHER_HDR_LEN);
-   mb-m_pkthdr.header = iph;
+   mb-m_pkthdr.PH_loc.ptr = iph;
ip_len = ntohs(iph-ip_len);
ip_hlen = iph-ip_hl * 4;
data_len = ip_len - ip_hlen;
___
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: r254833 - head/sys/dev/drm2

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 09:46:03 2013
New Revision: 254833
URL: http://svnweb.freebsd.org/changeset/base/254833

Log:
  drm: Import Linux commit cd004b3f4cd4169815c82bf9e424fda06978898a
  
  Author: Shirish S s.shir...@samsung.com
  Date:   Thu Aug 30 07:04:06 2012 +
  
  drm: edid: add support for E-DDC
  
  The current logic for probing ddc is limited to
  2 blocks (256 bytes), this patch adds support
  for the 4 block (512) data.
  
  To do this, a single 8-bit segment index is
  passed to the display via the I2C address 30h.
  Data from the selected segment is then immediately
  read via the regular DDC2 address using a repeated
  I2C 'START' signal.
  
  Signed-off-by: Shirish S s.shir...@samsung.com
  Reviewed-by: Jean Delvare jdelv...@suse.de
  Reviewed-by: Daniel Vetter daniel.vet...@ffwll.ch
  Reviewed-by: Ville Syrjala ville.syrj...@linux.intel.com
  Signed-off-by: Dave Airlie airl...@redhat.com

Modified:
  head/sys/dev/drm2/drm_edid.c

Modified: head/sys/dev/drm2/drm_edid.c
==
--- head/sys/dev/drm2/drm_edid.cSun Aug 25 09:45:26 2013
(r254832)
+++ head/sys/dev/drm2/drm_edid.cSun Aug 25 09:46:03 2013
(r254833)
@@ -253,6 +253,8 @@ drm_do_probe_ddc_edid(device_t adapter, 
  int block, int len)
 {
unsigned char start = block * EDID_LENGTH;
+   unsigned char segment = block  1;
+   unsigned char xfers = segment ? 3 : 2;
int ret, retries = 5;
 
/* The core i2c driver will automatically retry the transfer if the
@@ -264,6 +266,11 @@ drm_do_probe_ddc_edid(device_t adapter, 
do {
struct iic_msg msgs[] = {
{
+   .slave  = DDC_SEGMENT_ADDR  1,
+   .flags  = 0,
+   .len= 1,
+   .buf= segment,
+   }, {
.slave  = DDC_ADDR  1,
.flags  = IIC_M_WR,
.len= 1,
@@ -275,7 +282,13 @@ drm_do_probe_ddc_edid(device_t adapter, 
.buf= buf,
}
};
-   ret = iicbus_transfer(adapter, msgs, 2);
+
+   /*
+* Avoid sending the segment addr to not upset non-compliant ddc
+* monitors.
+*/
+   ret = iicbus_transfer(adapter, msgs[3 - xfers], xfers);
+
if (ret != 0)
DRM_DEBUG_KMS(iicbus_transfer countdown %d error %d\n,
retries, ret);
___
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: r254834 - in head/sys: netinet netinet6

2013-08-25 Thread Andre Oppermann
Author: andre
Date: Sun Aug 25 09:49:00 2013
New Revision: 254834
URL: http://svnweb.freebsd.org/changeset/base/254834

Log:
  For now limit printf(9) %x of the 64bit pkthdr.csum_flags field to 32bits.
  The upper 32bits are not occupied for now.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/netinet/sctp_input.c
  head/sys/netinet6/sctp6_usrreq.c

Modified: head/sys/netinet/sctp_input.c
==
--- head/sys/netinet/sctp_input.c   Sun Aug 25 09:46:03 2013
(r254833)
+++ head/sys/netinet/sctp_input.c   Sun Aug 25 09:49:00 2013
(r254834)
@@ -6026,7 +6026,7 @@ sctp_input_with_port(struct mbuf *i_pak,
sctp_input(): Packet of length %d received on %s with csum_flags 
0x%x.\n,
m-m_pkthdr.len,
if_name(m-m_pkthdr.rcvif),
-   m-m_pkthdr.csum_flags);
+   (int)m-m_pkthdr.csum_flags);
if (m-m_flags  M_FLOWID) {
mflowid = m-m_pkthdr.flowid;
use_mflowid = 1;

Modified: head/sys/netinet6/sctp6_usrreq.c
==
--- head/sys/netinet6/sctp6_usrreq.cSun Aug 25 09:46:03 2013
(r254833)
+++ head/sys/netinet6/sctp6_usrreq.cSun Aug 25 09:49:00 2013
(r254834)
@@ -112,7 +112,7 @@ sctp6_input_with_port(struct mbuf **i_pa
sctp6_input(): Packet of length %d received on %s with csum_flags 
0x%x.\n,
m-m_pkthdr.len,
if_name(m-m_pkthdr.rcvif),
-   m-m_pkthdr.csum_flags);
+   (int)m-m_pkthdr.csum_flags);
if (m-m_flags  M_FLOWID) {
mflowid = m-m_pkthdr.flowid;
use_mflowid = 1;
___
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: r254835 - head/sys/dev/drm2

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 09:53:00 2013
New Revision: 254835
URL: http://svnweb.freebsd.org/changeset/base/254835

Log:
  drm: Fix typo in KASSERT message: s/Dandling/Dangling/

Modified:
  head/sys/dev/drm2/drm_gem.c

Modified: head/sys/dev/drm2/drm_gem.c
==
--- head/sys/dev/drm2/drm_gem.c Sun Aug 25 09:49:00 2013(r254834)
+++ head/sys/dev/drm2/drm_gem.c Sun Aug 25 09:53:00 2013(r254835)
@@ -163,7 +163,7 @@ void
 drm_gem_object_reference(struct drm_gem_object *obj)
 {
 
-   KASSERT(obj-refcount  0, (Dandling obj %p, obj));
+   KASSERT(obj-refcount  0, (Dangling obj %p, obj));
refcount_acquire(obj-refcount);
 }
 
___
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: r254836 - head/sys/dev/drm2

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 09:58:31 2013
New Revision: 254836
URL: http://svnweb.freebsd.org/changeset/base/254836

Log:
  drm: Support gem_open_object() and gem_close_object() callbacks
  
  ... in struct drm_driver_info.

Modified:
  head/sys/dev/drm2/drmP.h
  head/sys/dev/drm2/drm_gem.c

Modified: head/sys/dev/drm2/drmP.h
==
--- head/sys/dev/drm2/drmP.hSun Aug 25 09:53:00 2013(r254835)
+++ head/sys/dev/drm2/drmP.hSun Aug 25 09:58:31 2013(r254836)
@@ -737,6 +737,8 @@ struct drm_driver_info {
 
int (*gem_init_object)(struct drm_gem_object *obj);
void(*gem_free_object)(struct drm_gem_object *obj);
+   int (*gem_open_object)(struct drm_gem_object *, struct drm_file *);
+   void(*gem_close_object)(struct drm_gem_object *, struct drm_file *);
 
struct cdev_pager_ops *gem_pager_ops;
 

Modified: head/sys/dev/drm2/drm_gem.c
==
--- head/sys/dev/drm2/drm_gem.c Sun Aug 25 09:53:00 2013(r254835)
+++ head/sys/dev/drm2/drm_gem.c Sun Aug 25 09:58:31 2013(r254836)
@@ -242,24 +242,40 @@ int
 drm_gem_handle_create(struct drm_file *file_priv, struct drm_gem_object *obj,
 uint32_t *handle)
 {
-   int error;
+   struct drm_device *dev = obj-dev;
+   int ret;
 
-   error = drm_gem_name_create(file_priv-object_names, obj, handle);
-   if (error != 0)
-   return (error);
+   ret = drm_gem_name_create(file_priv-object_names, obj, handle);
+   if (ret != 0)
+   return (ret);
drm_gem_object_handle_reference(obj);
+
+   if (dev-driver-gem_open_object) {
+   ret = dev-driver-gem_open_object(obj, file_priv);
+   if (ret) {
+   drm_gem_handle_delete(file_priv, *handle);
+   return ret;
+   }
+   }
+
return (0);
 }
 
 int
 drm_gem_handle_delete(struct drm_file *file_priv, uint32_t handle)
 {
+   struct drm_device *dev;
struct drm_gem_object *obj;
 
obj = drm_gem_names_remove(file_priv-object_names, handle);
if (obj == NULL)
return (EINVAL);
+
+   dev = obj-dev;
+   if (dev-driver-gem_close_object)
+   dev-driver-gem_close_object(obj, file_priv);
drm_gem_object_handle_unreference_unlocked(obj);
+
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: r254837 - head/sys/dev/drm2

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 10:01:59 2013
New Revision: 254837
URL: http://svnweb.freebsd.org/changeset/base/254837

Log:
  drm: Call gem_close_object driver callback from 
drm_gem_object_release_handle()
  
  This fixes leakage of bo_va for Cayman and following card generations.

Modified:
  head/sys/dev/drm2/drm_gem.c

Modified: head/sys/dev/drm2/drm_gem.c
==
--- head/sys/dev/drm2/drm_gem.c Sun Aug 25 09:58:31 2013(r254836)
+++ head/sys/dev/drm2/drm_gem.c Sun Aug 25 10:01:59 2013(r254837)
@@ -328,9 +328,17 @@ drm_gem_open(struct drm_device *dev, str
 static int
 drm_gem_object_release_handle(uint32_t name, void *ptr, void *arg)
 {
+   struct drm_file *file_priv;
struct drm_gem_object *obj;
+   struct drm_device *dev;
 
+   file_priv = arg;
obj = ptr;
+   dev = obj-dev;
+
+   if (dev-driver-gem_close_object)
+   dev-driver-gem_close_object(obj, file_priv);
+
drm_gem_object_handle_unreference(obj);
return (0);
 }
@@ -340,7 +348,7 @@ drm_gem_release(struct drm_device *dev, 
 {
 
drm_gem_names_foreach(file_priv-object_names,
-   drm_gem_object_release_handle, NULL);
+   drm_gem_object_release_handle, file_priv);
drm_gem_names_fini(file_priv-object_names);
 }
 
___
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: r254838 - head/sys/dev/drm2

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 10:04:10 2013
New Revision: 254838
URL: http://svnweb.freebsd.org/changeset/base/254838

Log:
  drm: In drm_gem_name_create(), verify argument before acquiring lock
  
  Submitted by: J.R. Oldroyd j...@opal.com

Modified:
  head/sys/dev/drm2/drm_gem_names.c

Modified: head/sys/dev/drm2/drm_gem_names.c
==
--- head/sys/dev/drm2/drm_gem_names.c   Sun Aug 25 10:01:59 2013
(r254837)
+++ head/sys/dev/drm2/drm_gem_names.c   Sun Aug 25 10:04:10 2013
(r254838)
@@ -132,12 +132,12 @@ drm_gem_name_create(struct drm_gem_names
 {
struct drm_gem_name *np;
 
-   np = malloc(sizeof(struct drm_gem_name), M_GEM_NAMES, M_WAITOK);
-   mtx_lock(names-lock);
if (*name != 0) {
-   mtx_unlock(names-lock);
return (EALREADY);
}
+
+   np = malloc(sizeof(struct drm_gem_name), M_GEM_NAMES, M_WAITOK);
+   mtx_lock(names-lock);
np-name = alloc_unr(names-unr);
if (np-name == -1) {
mtx_unlock(names-lock);
___
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: r254840 - head/sys/dev/drm2

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 10:13:23 2013
New Revision: 254840
URL: http://svnweb.freebsd.org/changeset/base/254840

Log:
  drm: Use DRM_IF_MAJOR  DRM_IF_MINOR from drm_core.h

Modified:
  head/sys/dev/drm2/drm_ioctl.c

Modified: head/sys/dev/drm2/drm_ioctl.c
==
--- head/sys/dev/drm2/drm_ioctl.c   Sun Aug 25 10:08:58 2013
(r254839)
+++ head/sys/dev/drm2/drm_ioctl.c   Sun Aug 25 10:13:23 2013
(r254840)
@@ -37,6 +37,7 @@ __FBSDID($FreeBSD$);
  */
 
 #include dev/drm2/drmP.h
+#include dev/drm2/drm_core.h
 
 /*
  * Beginning in revision 1.1 of the DRM interface, getunique will return
@@ -255,10 +256,6 @@ int drm_getcap(struct drm_device *dev, v
return 0;
 }
 
-
-#define DRM_IF_MAJOR   1
-#define DRM_IF_MINOR   2
-
 int drm_setversion(struct drm_device *dev, void *data,
   struct drm_file *file_priv)
 {
___
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: r254841 - head/sys/dev/drm2

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 10:28:02 2013
New Revision: 254841
URL: http://svnweb.freebsd.org/changeset/base/254841

Log:
  drm: Import list_for_each_entry_safe_from() macro

Modified:
  head/sys/dev/drm2/drm_linux_list.h

Modified: head/sys/dev/drm2/drm_linux_list.h
==
--- head/sys/dev/drm2/drm_linux_list.h  Sun Aug 25 10:13:23 2013
(r254840)
+++ head/sys/dev/drm2/drm_linux_list.h  Sun Aug 25 10:28:02 2013
(r254841)
@@ -144,6 +144,11 @@ list_del_init(struct list_head *entry) {
pos-member != (head); \
pos = n, n = list_entry(n-member.next, __typeof(*n), member))
 
+#define list_for_each_entry_safe_from(pos, n, head, member)
\
+   for (n = list_entry(pos-member.next, __typeof(*pos), member);  
\
+pos-member != (head);
\
+pos = n, n = list_entry(n-member.next, __typeof(*n), member))
+
 #define list_first_entry(ptr, type, member) \
list_entry((ptr)-next, type, member)
 
___
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: r254842 - in head/sys: compat/ndis dev/cas dev/hatm dev/if_ndis dev/iscsi_initiator dev/lge dev/mwl dev/wb kern sys

2013-08-25 Thread Andre Oppermann
Author: andre
Date: Sun Aug 25 10:57:09 2013
New Revision: 254842
URL: http://svnweb.freebsd.org/changeset/base/254842

Log:
  Give (*ext_free) an int return value allowing for very sophisticated
  external mbuf buffer management capabilities in the future.
  
  For now only EXT_FREE_OK is defined with current legacy behavior.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/compat/ndis/kern_ndis.c
  head/sys/compat/ndis/ndis_var.h
  head/sys/dev/cas/if_cas.c
  head/sys/dev/hatm/if_hatm_intr.c
  head/sys/dev/if_ndis/if_ndis.c
  head/sys/dev/iscsi_initiator/isc_soc.c
  head/sys/dev/lge/if_lge.c
  head/sys/dev/mwl/if_mwl.c
  head/sys/dev/wb/if_wb.c
  head/sys/kern/subr_mbpool.c
  head/sys/kern/uipc_cow.c
  head/sys/kern/uipc_mbuf.c
  head/sys/kern/uipc_syscalls.c
  head/sys/sys/mbpool.h
  head/sys/sys/mbuf.h
  head/sys/sys/sf_buf.h

Modified: head/sys/compat/ndis/kern_ndis.c
==
--- head/sys/compat/ndis/kern_ndis.cSun Aug 25 10:28:02 2013
(r254841)
+++ head/sys/compat/ndis/kern_ndis.cSun Aug 25 10:57:09 2013
(r254842)
@@ -482,16 +482,14 @@ ndis_return(dobj, arg)
KeReleaseSpinLock(block-nmb_returnlock, irql);
 }
 
-void
-ndis_return_packet(buf, arg)
-   void*buf;   /* not used */
-   void*arg;
+int
+ndis_return_packet(struct mbuf *m, void *buf, void *arg)
 {
ndis_packet *p;
ndis_miniport_block *block;
 
if (arg == NULL)
-   return;
+   return (EXT_FREE_OK);
 
p = arg;
 
@@ -500,7 +498,7 @@ ndis_return_packet(buf, arg)
 
/* Release packet when refcount hits zero, otherwise return. */
if (p-np_refcnt)
-   return;
+   return (EXT_FREE_OK);
 
block = ((struct ndis_softc *)p-np_softc)-ndis_block;
 
@@ -512,6 +510,8 @@ ndis_return_packet(buf, arg)
IoQueueWorkItem(block-nmb_returnitem,
(io_workitem_func)kernndis_functbl[7].ipt_wrap,
WORKQUEUE_CRITICAL, block);
+
+   return (EXT_FREE_OK);
 }
 
 void

Modified: head/sys/compat/ndis/ndis_var.h
==
--- head/sys/compat/ndis/ndis_var.h Sun Aug 25 10:28:02 2013
(r254841)
+++ head/sys/compat/ndis/ndis_var.h Sun Aug 25 10:57:09 2013
(r254842)
@@ -1743,7 +1743,7 @@ extern int ndis_halt_nic(void *);
 extern int ndis_shutdown_nic(void *);
 extern int ndis_pnpevent_nic(void *, int);
 extern int ndis_init_nic(void *);
-extern void ndis_return_packet(void *, void *);
+extern int ndis_return_packet(struct mbuf *, void *, void *);
 extern int ndis_init_dma(void *);
 extern int ndis_destroy_dma(void *);
 extern int ndis_create_sysctls(void *);

Modified: head/sys/dev/cas/if_cas.c
==
--- head/sys/dev/cas/if_cas.c   Sun Aug 25 10:28:02 2013(r254841)
+++ head/sys/dev/cas/if_cas.c   Sun Aug 25 10:57:09 2013(r254842)
@@ -132,7 +132,7 @@ static void cas_detach(struct cas_softc 
 static int cas_disable_rx(struct cas_softc *sc);
 static int cas_disable_tx(struct cas_softc *sc);
 static voidcas_eint(struct cas_softc *sc, u_int status);
-static voidcas_free(struct mbuf *m, void *arg1, void* arg2);
+static int cas_free(struct mbuf *m, void *arg1, void* arg2);
 static voidcas_init(void *xsc);
 static voidcas_init_locked(struct cas_softc *sc);
 static voidcas_init_regs(struct cas_softc *sc);
@@ -1887,7 +1887,7 @@ cas_rint(struct cas_softc *sc)
 #endif
 }
 
-static void
+static int
 cas_free(struct mbuf *m, void *arg1, void *arg2)
 {
struct cas_rxdsoft *rxds;
@@ -1904,7 +1904,7 @@ cas_free(struct mbuf *m, void *arg1, voi
rxds = sc-sc_rxdsoft[idx];
 #endif
if (refcount_release(rxds-rxds_refcount) == 0)
-   return;
+   return (EXT_FREE_OK);
 
/*
 * NB: this function can be called via m_freem(9) within
@@ -1915,6 +1915,7 @@ cas_free(struct mbuf *m, void *arg1, voi
cas_add_rxdesc(sc, idx);
if (locked == 0)
CAS_UNLOCK(sc);
+   return (EXT_FREE_OK);
 }
 
 static inline void

Modified: head/sys/dev/hatm/if_hatm_intr.c
==
--- head/sys/dev/hatm/if_hatm_intr.cSun Aug 25 10:28:02 2013
(r254841)
+++ head/sys/dev/hatm/if_hatm_intr.cSun Aug 25 10:57:09 2013
(r254842)
@@ -260,7 +260,7 @@ hatm_mbuf_page_alloc(struct hatm_softc *
 /*
  * Free an mbuf and put it onto the free list.
  */
-static void
+static int
 hatm_mbuf0_free(struct mbuf *m, void *buf, void *args)
 {
struct hatm_softc *sc = args;
@@ -270,8 +270,9 @@ hatm_mbuf0_free(struct mbuf *m, void *bu
(freeing unused mbuf %x, c-hdr.flags));
c-hdr.flags = ~MBUF_USED;

svn commit: r254845 - head/sys/arm/arm

2013-08-25 Thread Andrew Turner
Author: andrew
Date: Sun Aug 25 11:21:03 2013
New Revision: 254845
URL: http://svnweb.freebsd.org/changeset/base/254845

Log:
  Add the unwind information to irq_entry so we can pass through it when
  unwinding the stack.

Modified:
  head/sys/arm/arm/irq_dispatch.S

Modified: head/sys/arm/arm/irq_dispatch.S
==
--- head/sys/arm/arm/irq_dispatch.S Sun Aug 25 11:01:18 2013
(r254844)
+++ head/sys/arm/arm/irq_dispatch.S Sun Aug 25 11:21:03 2013
(r254845)
@@ -89,6 +89,7 @@ AST_LOCALS
 ASENTRY_NP(irq_entry)
sub lr, lr, #0x0004 /* Adjust the lr */
PUSHFRAMEINSVC  /* Push an interrupt frame */
+   UNWINDSVCFRAME
mov r0, sp  /* arg for dispatcher */
 
mov r1, #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: r254847 - head/sys/arm/arm

2013-08-25 Thread Andrew Turner
Author: andrew
Date: Sun Aug 25 11:23:38 2013
New Revision: 254847
URL: http://svnweb.freebsd.org/changeset/base/254847

Log:
  Add the frame information to cpu_switch to allow us to unwind out of it,
  for example when dumping threads in the kernel debugger.

Modified:
  head/sys/arm/arm/swtch.S

Modified: head/sys/arm/arm/swtch.S
==
--- head/sys/arm/arm/swtch.SSun Aug 25 11:21:10 2013(r254846)
+++ head/sys/arm/arm/swtch.SSun Aug 25 11:23:38 2013(r254847)
@@ -218,6 +218,11 @@ END(cpu_throw)
 ENTRY(cpu_switch)
stmfd   sp!, {r4-r7, lr}
sub sp, sp, #4;
+#ifdef __ARM_EABI__
+   .save   {r4-r7, lr}
+   .pad#4
+#endif
+
mov r6, r2 /* Save the mutex */
 
 .Lswitch_resume:
___
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: r254849 - in head: bin/sh tools/regression/bin/sh/builtins

2013-08-25 Thread Jilles Tjoelker
Author: jilles
Date: Sun Aug 25 11:42:53 2013
New Revision: 254849
URL: http://svnweb.freebsd.org/changeset/base/254849

Log:
  sh: Recognize -- as end of options in alias builtin.
  
  Aliases starting with - (which are non-POSIX) will need to be preceded by
  an alias not starting with - or the newly added --.

Added:
  head/tools/regression/bin/sh/builtins/alias4.0   (contents, props changed)
Modified:
  head/bin/sh/alias.c

Modified: head/bin/sh/alias.c
==
--- head/bin/sh/alias.c Sun Aug 25 11:34:37 2013(r254848)
+++ head/bin/sh/alias.c Sun Aug 25 11:42:53 2013(r254849)
@@ -237,17 +237,19 @@ printaliases(void)
 }
 
 int
-aliascmd(int argc, char **argv)
+aliascmd(int argc __unused, char **argv __unused)
 {
char *n, *v;
int ret = 0;
struct alias *ap;
 
-   if (argc == 1) {
+   nextopt();
+
+   if (*argptr == NULL) {
printaliases();
return (0);
}
-   while ((n = *++argv) != NULL) {
+   while ((n = *argptr++) != NULL) {
if ((v = strchr(n+1, '=')) == NULL) /* n+1: funny ksh stuff */
if ((ap = lookupalias(n, 0)) == NULL) {
warning(%s: not found, n);

Added: head/tools/regression/bin/sh/builtins/alias4.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/bin/sh/builtins/alias4.0  Sun Aug 25 11:42:53 
2013(r254849)
@@ -0,0 +1,4 @@
+# $FreeBSD$
+
+unalias -a
+alias --
___
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: r254824 - head/sys/dev/hwpmc

2013-08-25 Thread Adrian Chadd
Ah, damnit! Thanks for catching that.

Sorry, normally I use editor macros to catch this, but for some reason, the
I'm over 80 columns wide macro isn't in vim. Let me fix this.


-adrian



On 24 August 2013 23:56, hiren panchasara hi...@freebsd.org wrote:




 On Sat, Aug 24, 2013 at 7:07 PM, Adrian Chadd adr...@freebsd.org wrote:

 Author: adrian
 Date: Sun Aug 25 02:07:28 2013
 New Revision: 254824
 URL: http://svnweb.freebsd.org/changeset/base/254824

 Log:
   Update the MEM_UOP_RETIRED PMC operation for sandy bridge and sandy
   bridge Xeon.

   Summary: These are PEBS events but they're also available as normal
   counter/sample events.  The source table (Table 19-2) lists the
   base versions (LOAD, STLB_MISS, SPLIT, ALL) but it says they must
   be qualified with other values.  This particular commit fleshes
   out those umask values.

   Source:

   * Linux; SDM June 2013, Volume 3B, Table 19-2 and 18-21.

   Tested:

   * Sandy Bridge (non-Xeon)

 Modified:
   head/sys/dev/hwpmc/hwpmc_core.c
   head/sys/dev/hwpmc/pmc_events.h

 Modified: head/sys/dev/hwpmc/hwpmc_core.c

 ==
 --- head/sys/dev/hwpmc/hwpmc_core.c Sun Aug 25 01:55:14 2013
  (r254823)
 +++ head/sys/dev/hwpmc/hwpmc_core.c Sun Aug 25 02:07:28 2013
  (r254824)
 @@ -1514,19 +1514,21 @@ static struct iap_event_descr iap_events
  IAPDESCR(CEH_00H, 0xCE, 0x00, IAP_F_FM | IAP_F_ALLCPUSCORE2),
  IAPDESCR(CFH_00H, 0xCF, 0x00, IAP_F_FM | IAP_F_CA | IAP_F_CC2),

 +/* Sandy Bridge / Sandy Bridge Xeon - 11, 12, 21, 41, 42, 81, 82 */
  IAPDESCR(D0H_00H, 0xD0, 0x00, IAP_F_FM | IAP_F_CC),
 -IAPDESCR(D0H_01H, 0xD0, 0x01, IAP_F_FM | IAP_F_I7 | IAP_F_WM |
 -   IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW),
 -IAPDESCR(D0H_02H, 0xD0, 0x02, IAP_F_FM | IAP_F_SB | IAP_F_IB |
 -   IAP_F_SBX | IAP_F_IBX | IAP_F_HW),
 -IAPDESCR(D0H_10H, 0xD0, 0x10, IAP_F_FM | IAP_F_SB | IAP_F_IB |
 -   IAP_F_SBX | IAP_F_IBX | IAP_F_HW),
 -IAPDESCR(D0H_20H, 0xD0, 0x20, IAP_F_FM | IAP_F_SB | IAP_F_IB |
 -   IAP_F_SBX | IAP_F_IBX | IAP_F_HW),
 -IAPDESCR(D0H_40H, 0xD0, 0x40, IAP_F_FM | IAP_F_SB | IAP_F_IB |
 -   IAP_F_SBX | IAP_F_IBX | IAP_F_HW),
 -IAPDESCR(D0H_80H, 0xD0, 0X80, IAP_F_FM | IAP_F_SB | IAP_F_IB |
 -   IAP_F_SBX | IAP_F_IBX | IAP_F_HW),
 +IAPDESCR(D0H_01H, 0xD0, 0x01, IAP_F_FM | IAP_F_I7 | IAP_F_WM |
 IAP_F_IB | IAP_F_IBX | IAP_F_HW),


 This is unnecessarily going above 80-columns.

 Thanks,
 Hiren

 +IAPDESCR(D0H_02H, 0xD0, 0x02, IAP_F_FM | IAP_F_IB | IAP_F_IBX |
 IAP_F_HW),
 +IAPDESCR(D0H_10H, 0xD0, 0x10, IAP_F_FM | IAP_F_IB | IAP_F_IBX |
 IAP_F_HW),
 +IAPDESCR(D0H_11H, 0xD0, 0x11, IAP_F_FM | IAP_F_SB | IAP_F_SBX),
 +IAPDESCR(D0H_12H, 0xD0, 0x12, IAP_F_FM | IAP_F_SB | IAP_F_SBX),
 +IAPDESCR(D0H_20H, 0xD0, 0x20, IAP_F_FM | IAP_F_IB | IAP_F_IBX |
 IAP_F_HW),
 +IAPDESCR(D0H_21H, 0xD0, 0x21, IAP_F_FM | IAP_F_SB | IAP_F_SBX),
 +IAPDESCR(D0H_40H, 0xD0, 0x40, IAP_F_FM | IAP_F_IB | IAP_F_IBX |
 IAP_F_HW),
 +IAPDESCR(D0H_41H, 0xD0, 0x41, IAP_F_FM | IAP_F_SB | IAP_F_SBX),
 +IAPDESCR(D0H_42H, 0xD0, 0x42, IAP_F_FM | IAP_F_SB | IAP_F_SBX),
 +IAPDESCR(D0H_80H, 0xD0, 0x80, IAP_F_FM | IAP_F_IB | IAP_F_IBX |
 IAP_F_HW),
 +IAPDESCR(D0H_81H, 0xD0, 0x81, IAP_F_FM | IAP_F_SB | IAP_F_SBX),
 +IAPDESCR(D0H_82H, 0xD0, 0x82, IAP_F_FM | IAP_F_SB | IAP_F_SBX),

  IAPDESCR(D1H_01H, 0xD1, 0x01, IAP_F_FM | IAP_F_WM | IAP_F_SB |
 IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW),

 Modified: head/sys/dev/hwpmc/pmc_events.h

 ==
 --- head/sys/dev/hwpmc/pmc_events.h Sun Aug 25 01:55:14 2013
  (r254823)
 +++ head/sys/dev/hwpmc/pmc_events.h Sun Aug 25 02:07:28 2013
  (r254824)
 @@ -1053,9 +1053,16 @@ __PMC_EV(IAP, EVENT_D0H_00H) \
  __PMC_EV(IAP, EVENT_D0H_01H)   \
  __PMC_EV(IAP, EVENT_D0H_02H)   \
  __PMC_EV(IAP, EVENT_D0H_10H)   \
 +__PMC_EV(IAP, EVENT_D0H_11H)   \
 +__PMC_EV(IAP, EVENT_D0H_12H)   \
  __PMC_EV(IAP, EVENT_D0H_20H)   \
 +__PMC_EV(IAP, EVENT_D0H_21H)   \
  __PMC_EV(IAP, EVENT_D0H_40H)   \
 +__PMC_EV(IAP, EVENT_D0H_41H)   \
 +__PMC_EV(IAP, EVENT_D0H_42H)   \
  __PMC_EV(IAP, EVENT_D0H_80H)   \
 +__PMC_EV(IAP, EVENT_D0H_81H)   \
 +__PMC_EV(IAP, EVENT_D0H_82H)   \
  __PMC_EV(IAP, EVENT_D1H_01H)   \
  __PMC_EV(IAP, EVENT_D1H_02H)   \
  __PMC_EV(IAP, EVENT_D1H_04H)   \
 @@ -3286,12 +3293,13 @@ __PMC_EV_ALIAS(FP_ASSIST.ANY, IAP_EVEN
  __PMC_EV_ALIAS(ROB_MISC_EVENTS.LBR_INSERTS, IAP_EVENT_CCH_20H)   \
  __PMC_EV_ALIAS(MEM_TRANS_RETIRED.LOAD_LATENCY, IAP_EVENT_CDH_01H)\
  __PMC_EV_ALIAS(MEM_TRANS_RETIRED.PRECISE_STORE, 

svn commit: r254850 - head/sys/dev/hwpmc

2013-08-25 Thread Adrian Chadd
Author: adrian
Date: Sun Aug 25 12:02:20 2013
New Revision: 254850
URL: http://svnweb.freebsd.org/changeset/base/254850

Log:
  Fix a 80 character long line, introduced in my previous commit.
  
  Noticed by: hiren

Modified:
  head/sys/dev/hwpmc/hwpmc_core.c

Modified: head/sys/dev/hwpmc/hwpmc_core.c
==
--- head/sys/dev/hwpmc/hwpmc_core.c Sun Aug 25 11:42:53 2013
(r254849)
+++ head/sys/dev/hwpmc/hwpmc_core.c Sun Aug 25 12:02:20 2013
(r254850)
@@ -1516,7 +1516,8 @@ static struct iap_event_descr iap_events
 
 /* Sandy Bridge / Sandy Bridge Xeon - 11, 12, 21, 41, 42, 81, 82 */
 IAPDESCR(D0H_00H, 0xD0, 0x00, IAP_F_FM | IAP_F_CC),
-IAPDESCR(D0H_01H, 0xD0, 0x01, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_IB | 
IAP_F_IBX | IAP_F_HW),
+IAPDESCR(D0H_01H, 0xD0, 0x01, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_IB |
+   IAP_F_IBX | IAP_F_HW),
 IAPDESCR(D0H_02H, 0xD0, 0x02, IAP_F_FM | IAP_F_IB | IAP_F_IBX | IAP_F_HW),
 IAPDESCR(D0H_10H, 0xD0, 0x10, IAP_F_FM | IAP_F_IB | IAP_F_IBX | IAP_F_HW),
 IAPDESCR(D0H_11H, 0xD0, 0x11, IAP_F_FM | IAP_F_SB | IAP_F_SBX),
___
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: r254851 - in head/contrib/llvm/tools/lldb/source: . Plugins/Process/gdb-remote

2013-08-25 Thread Ed Maste
Author: emaste
Date: Sun Aug 25 12:07:34 2013
New Revision: 254851
URL: http://svnweb.freebsd.org/changeset/base/254851

Log:
  Disable lldb target support not (currently) of interest
  
  - Remote iOS debugging
  - OS X symbol provider, core files
  - PECOFF object files
  - Linux platform support
  
  Sponsored by: DARPA, AFRL

Modified:
  
head/contrib/llvm/tools/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  head/contrib/llvm/tools/lldb/source/lldb.cpp

Modified: 
head/contrib/llvm/tools/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
==
--- 
head/contrib/llvm/tools/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
 Sun Aug 25 12:02:20 2013(r254850)
+++ 
head/contrib/llvm/tools/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
 Sun Aug 25 12:07:34 2013(r254851)
@@ -57,7 +57,6 @@
 #include lldb/Host/Host.h
 #include Plugins/Process/Utility/InferiorCallPOSIX.h
 #include Plugins/Process/Utility/StopInfoMachException.h
-#include Plugins/Platform/MacOSX/PlatformRemoteiOS.h
 #include Utility/StringExtractorGDBRemote.h
 #include GDBRemoteRegisterContext.h
 #include ProcessGDBRemote.h
@@ -1809,6 +1808,7 @@ ProcessGDBRemote::DoDestroy ()
 if (log)
 log-Printf (ProcessGDBRemote::DoDestroy());
 
+#if 0 // XXX Currently no iOS target support on FreeBSD
 // There is a bug in older iOS debugservers where they don't shut down the 
process
 // they are debugging properly.  If the process is sitting at a breakpoint 
or an exception,
 // this can cause problems with restarting.  So we check to see if any of 
our threads are stopped
@@ -1912,6 +1912,7 @@ ProcessGDBRemote::DoDestroy ()
 }
 }
 }
+#endif
 
 // Interrupt if our inferior is running...
 int exit_status = SIGABRT;

Modified: head/contrib/llvm/tools/lldb/source/lldb.cpp
==
--- head/contrib/llvm/tools/lldb/source/lldb.cppSun Aug 25 12:02:20 
2013(r254850)
+++ head/contrib/llvm/tools/lldb/source/lldb.cppSun Aug 25 12:07:34 
2013(r254851)
@@ -29,7 +29,6 @@
 #include Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
 #include Plugins/Disassembler/llvm/DisassemblerLLVMC.h
 #include Plugins/Instruction/ARM/EmulateInstructionARM.h
-#include Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h
 #include Plugins/SymbolVendor/ELF/SymbolVendorELF.h
 #include Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
 #include Plugins/ObjectFile/ELF/ObjectFileELF.h
@@ -38,10 +37,8 @@
 #include Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
 #include Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h
 #include Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h
-#include Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
 #include Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
 #include Plugins/Platform/FreeBSD/PlatformFreeBSD.h
-#include Plugins/Platform/Linux/PlatformLinux.h
 #include 
Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
 #ifndef LLDB_DISABLE_PYTHON
 #include Plugins/OperatingSystem/Python/OperatingSystemPython.h
@@ -60,8 +57,6 @@
 #include Plugins/Platform/MacOSX/PlatformiOSSimulator.h
 #endif
 
-#include Plugins/Process/mach-core/ProcessMachCore.h
-
 #if defined(__linux__) or defined(__FreeBSD__)
 #include Plugins/Process/elf-core/ProcessElfCore.h
 #endif
@@ -109,10 +104,8 @@ lldb_private::Initialize ()
 UnwindAssemblyInstEmulation::Initialize();
 UnwindAssembly_x86::Initialize();
 EmulateInstructionARM::Initialize ();
-ObjectFilePECOFF::Initialize ();
 DynamicLoaderPOSIXDYLD::Initialize ();
 PlatformFreeBSD::Initialize();
-PlatformLinux::Initialize();
 SymbolFileDWARFDebugMap::Initialize();
 ItaniumABILanguageRuntime::Initialize();
 #ifndef LLDB_DISABLE_PYTHON
@@ -130,8 +123,6 @@ lldb_private::Initialize ()
 ObjectContainerUniversalMachO::Initialize();
 ObjectFileMachO::Initialize();
 ProcessKDP::Initialize();
-ProcessMachCore::Initialize();
-SymbolVendorMacOSX::Initialize();
 PlatformDarwinKernel::Initialize();
 PlatformRemoteiOS::Initialize();
 PlatformMacOSX::Initialize();
@@ -193,10 +184,8 @@ lldb_private::Terminate ()
 UnwindAssembly_x86::Terminate();
 UnwindAssemblyInstEmulation::Terminate();
 EmulateInstructionARM::Terminate ();
-ObjectFilePECOFF::Terminate ();
 DynamicLoaderPOSIXDYLD::Terminate ();
 PlatformFreeBSD::Terminate();
-PlatformLinux::Terminate();
 SymbolFileDWARFDebugMap::Terminate();
 ItaniumABILanguageRuntime::Terminate();
 #ifndef LLDB_DISABLE_PYTHON
@@ -210,9 +199,7 @@ lldb_private::Terminate ()
 AppleObjCRuntimeV1::Terminate();
 ObjectContainerUniversalMachO::Terminate();
 ObjectFileMachO::Terminate();
-

Re: svn commit: r251370 - head/sys/arm/arm

2013-08-25 Thread Andrew Turner
On Tue, 4 Jun 2013 09:21:18 + (UTC)
Grzegorz Bernacki g...@freebsd.org wrote:

 Author: gber
 Date: Tue Jun  4 09:21:18 2013
 New Revision: 251370
 URL: http://svnweb.freebsd.org/changeset/base/251370
 
 Log:
   Implement pmap_copy() for ARMv6/v7.
   
   Copy the given range of mappings from the source map to the
   destination map, thereby reducing the number of VM faults on fork.
   
   Submitted by:   Zbigniew Bodek z...@semihalf.com
   Sponsored by:   The FreeBSD Foundation, Semihalf
 
 Modified:
   head/sys/arm/arm/pmap-v6.c

This change leads to a deadlock when I attempt to run make buildworld
on my PandaBoard. The problem is you are locking
pvh_global_lock, src_pmap, and dst_pmap then calling
pmap_alloc_l2_bucket.

This may unlock pvh_global_lock and dst_pmap, but it has no knowledge
of src_pmap so it will keep it locked.

If another thread needs to lock src_pmap, for example the pagedaemon
may in pmap_clearbit, it will lock pvh_global_lock. This will succeed
when pmap_alloc_l2_bucket unlocks it. It will then attempt to lock
src_pmap but, as it is already locked, it will wait for pmap_copy to
unlock it.

At this point pmap_alloc_l2_bucket will attempt to lock pvh_global_lock
again, however this lock is already held so it waits for the other
thread to unlock it.

At this point both threads are waiting on each other causing a deadlock.

I don't know enough about the pmap or vm code to be able to fix this,
other than reverting this commit.

Andrew

 
 Modified: head/sys/arm/arm/pmap-v6.c
 ==
 --- head/sys/arm/arm/pmap-v6.cTue Jun  4 07:37:06 2013
 (r251369) +++ head/sys/arm/arm/pmap-v6.c  Tue Jun  4 09:21:18
 2013  (r251370) @@ -2966,6 +2966,126 @@ void
  pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr,
  vm_size_t len, vm_offset_t src_addr)
  {
 + struct l2_bucket *l2b_src, *l2b_dst;
 + struct pv_entry *pve;
 + vm_offset_t addr;
 + vm_offset_t end_addr;
 + vm_offset_t next_bucket;
 + u_int flags;
 + boolean_t l2b_alloc;
 +
 + CTR4(KTR_PMAP, %s: VA = 0x%08x, len = 0x%08x. Will %s\n,
 __func__,
 + src_addr, len, (dst_addr != src_addr) ? exit : copy);
 +
 + if (dst_addr != src_addr)
 + return;
 +
 + rw_wlock(pvh_global_lock);
 + if (dst_pmap  src_pmap) {
 + PMAP_LOCK(dst_pmap);
 + PMAP_LOCK(src_pmap);
 + } else {
 + PMAP_LOCK(src_pmap);
 + PMAP_LOCK(dst_pmap);
 + }
 +
 + end_addr = src_addr + len;
 + addr = src_addr;
 + /*
 +  * Iterate through all used l2_buckets in a given range.
 +  */
 + while (addr  end_addr) {
 + pt_entry_t *src_ptep, *dst_ptep;
 + pt_entry_t src_pte;
 +
 + next_bucket = L2_NEXT_BUCKET(addr);
 + /*
 +  * If the next bucket VA is out of the
 +  * copy range then set it to end_addr in order
 +  * to copy all mappings until the given limit.
 +  */ 
 + if (next_bucket  end_addr)
 + next_bucket = end_addr;
 +
 + l2b_src = pmap_get_l2_bucket(src_pmap, addr);
 + if (l2b_src == NULL) {
 + addr = next_bucket;
 + continue;
 + }
 + src_ptep = l2b_src-l2b_kva[l2pte_index(addr)];
 +
 + while (addr  next_bucket) {
 + vm_page_t srcmpte;
 +
 + src_pte = *src_ptep;
 + srcmpte = PHYS_TO_VM_PAGE(l2pte_pa(src_pte));
 + /*
 +  * We only virtual copy managed pages
 +  */
 + if (srcmpte  (srcmpte-oflags 
 VPO_UNMANAGED) == 0) {
 + l2b_alloc = FALSE;
 + l2b_dst =
 pmap_get_l2_bucket(dst_pmap, addr);
 + /*
 +  * Check if the allocation of another
 +  * l2_bucket is necessary.
 +  */
 + if (l2b_dst == NULL) {
 + l2b_dst =
 pmap_alloc_l2_bucket(dst_pmap,
 + addr);
 + l2b_alloc = TRUE;
 + }
 + if (l2b_dst == NULL)
 + goto out;
 +
 + dst_ptep =
 l2b_dst-l2b_kva[l2pte_index(addr)]; +
 + if (*dst_ptep == 0 
 + (pve =
 pmap_get_pv_entry(dst_pmap, TRUE))) {
 + /*
 +  * Check whether the source
 mapping is
 +  * writable and set the
 proper flag
 +  * for a copied mapping so
 that 

svn commit: r254853 - head/sys/dev/drm2

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 12:27:15 2013
New Revision: 254853
URL: http://svnweb.freebsd.org/changeset/base/254853

Log:
  drm: Import drm_fixed.h from Linux 3.8

Added:
  head/sys/dev/drm2/drm_fixed.h   (contents, props changed)

Added: head/sys/dev/drm2/drm_fixed.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/drm2/drm_fixed.h   Sun Aug 25 12:27:15 2013
(r254853)
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2009 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the Software),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Dave Airlie
+ */
+
+#include sys/cdefs.h
+__FBSDID($FreeBSD$);
+
+#ifndef DRM_FIXED_H
+#define DRM_FIXED_H
+
+typedef union dfixed {
+   u32 full;
+} fixed20_12;
+
+
+#define dfixed_const(A) (u32)(((A)  12))/*  + ((B + 0.000122)*4096)) */
+#define dfixed_const_half(A) (u32)(((A)  12) + 2048)
+#define dfixed_const_666(A) (u32)(((A)  12) + 2731)
+#define dfixed_const_8(A) (u32)(((A)  12) + 3277)
+#define dfixed_mul(A, B) ((u64)((u64)(A).full * (B).full + 2048)  12)
+#define dfixed_init(A) { .full = dfixed_const((A)) }
+#define dfixed_init_half(A) { .full = dfixed_const_half((A)) }
+#define dfixed_trunc(A) ((A).full  12)
+#define dfixed_frac(A) ((A).full  ((1  12) - 1))
+
+static inline u32 dfixed_floor(fixed20_12 A)
+{
+   u32 non_frac = dfixed_trunc(A);
+
+   return dfixed_const(non_frac);
+}
+
+static inline u32 dfixed_ceil(fixed20_12 A)
+{
+   u32 non_frac = dfixed_trunc(A);
+
+   if (A.full  dfixed_const(non_frac))
+   return dfixed_const(non_frac + 1);
+   else
+   return dfixed_const(non_frac);
+}
+
+static inline u32 dfixed_div(fixed20_12 A, fixed20_12 B)
+{
+   u64 tmp = ((u64)A.full  13);
+
+   do_div(tmp, B.full);
+   tmp += 1;
+   tmp /= 2;
+   return lower_32_bits(tmp);
+}
+#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


Re: svn commit: r251370 - head/sys/arm/arm

2013-08-25 Thread Zbigniew Bodek
2013/8/25 Andrew Turner and...@fubar.geek.nz

 On Tue, 4 Jun 2013 09:21:18 + (UTC)
 Grzegorz Bernacki g...@freebsd.org wrote:

  Author: gber
  Date: Tue Jun  4 09:21:18 2013
  New Revision: 251370
  URL: http://svnweb.freebsd.org/changeset/base/251370
 
  Log:
Implement pmap_copy() for ARMv6/v7.
 
Copy the given range of mappings from the source map to the
destination map, thereby reducing the number of VM faults on fork.
 
Submitted by:   Zbigniew Bodek z...@semihalf.com
Sponsored by:   The FreeBSD Foundation, Semihalf
 
  Modified:
head/sys/arm/arm/pmap-v6.c

 This change leads to a deadlock when I attempt to run make buildworld
 on my PandaBoard. The problem is you are locking
 pvh_global_lock, src_pmap, and dst_pmap then calling
 pmap_alloc_l2_bucket.

 This may unlock pvh_global_lock and dst_pmap, but it has no knowledge
 of src_pmap so it will keep it locked.

 If another thread needs to lock src_pmap, for example the pagedaemon
 may in pmap_clearbit, it will lock pvh_global_lock. This will succeed
 when pmap_alloc_l2_bucket unlocks it. It will then attempt to lock
 src_pmap but, as it is already locked, it will wait for pmap_copy to
 unlock it.

 At this point pmap_alloc_l2_bucket will attempt to lock pvh_global_lock
 again, however this lock is already held so it waits for the other
 thread to unlock it.

 At this point both threads are waiting on each other causing a deadlock.

 I don't know enough about the pmap or vm code to be able to fix this,
 other than reverting this commit.

 Andrew


Hello Andrew,

Yes, you are right.
We've already discussed this with Olivier (who found this and informed me)
and decided to comment this out
after committing superpages support.
Currently there is no other way to fix this due to pmap_alloc_l2_bucket()
implementation.
If you are in a great hurry with the commit reversal/commenting out
pmap_copy() then I see no problem to do so.

Best regards
Zbyszek Bodek
___
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: r254854 - in head/sys: netinet netinet6

2013-08-25 Thread Michael Tuexen
Author: tuexen
Date: Sun Aug 25 12:44:03 2013
New Revision: 254854
URL: http://svnweb.freebsd.org/changeset/base/254854

Log:
  Provide human readable debug output.

Modified:
  head/sys/netinet/sctp_input.c
  head/sys/netinet6/sctp6_usrreq.c

Modified: head/sys/netinet/sctp_input.c
==
--- head/sys/netinet/sctp_input.c   Sun Aug 25 12:27:15 2013
(r254853)
+++ head/sys/netinet/sctp_input.c   Sun Aug 25 12:44:03 2013
(r254854)
@@ -6023,10 +6023,10 @@ sctp_input_with_port(struct mbuf *i_pak,
}
 #endif
SCTPDBG(SCTP_DEBUG_CRCOFFLOAD,
-   sctp_input(): Packet of length %d received on %s with csum_flags 
0x%x.\n,
+   sctp_input(): Packet of length %d received on %s with csum_flags 
0x%b.\n,
m-m_pkthdr.len,
if_name(m-m_pkthdr.rcvif),
-   (int)m-m_pkthdr.csum_flags);
+   (int)m-m_pkthdr.csum_flags, CSUM_BITS);
if (m-m_flags  M_FLOWID) {
mflowid = m-m_pkthdr.flowid;
use_mflowid = 1;

Modified: head/sys/netinet6/sctp6_usrreq.c
==
--- head/sys/netinet6/sctp6_usrreq.cSun Aug 25 12:27:15 2013
(r254853)
+++ head/sys/netinet6/sctp6_usrreq.cSun Aug 25 12:44:03 2013
(r254854)
@@ -109,10 +109,10 @@ sctp6_input_with_port(struct mbuf **i_pa
}
 #endif
SCTPDBG(SCTP_DEBUG_CRCOFFLOAD,
-   sctp6_input(): Packet of length %d received on %s with csum_flags 
0x%x.\n,
+   sctp6_input(): Packet of length %d received on %s with csum_flags 
0x%b.\n,
m-m_pkthdr.len,
if_name(m-m_pkthdr.rcvif),
-   (int)m-m_pkthdr.csum_flags);
+   (int)m-m_pkthdr.csum_flags, CSUM_BITS);
if (m-m_flags  M_FLOWID) {
mflowid = m-m_pkthdr.flowid;
use_mflowid = 1;
___
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: r254855 - head/sys/dev/hwpmc

2013-08-25 Thread Adrian Chadd
Author: adrian
Date: Sun Aug 25 12:58:34 2013
New Revision: 254855
URL: http://svnweb.freebsd.org/changeset/base/254855

Log:
  Update the mis-predicted branch PMC names (for sandy bridge) to not clash.
  
  The SDM (June 2013) tables on these are rather confusing.  Yes, they
  assign the same name (BR_MISP_RETIRED.ALL_BRANCHES) to two codes
  (C5H/00H and C5H/04H.) The latter however is the PEBS version.
  
  So, to make it easier to see the difference - and yes, we can use
  both without having to actually enable the PEBS specific bits! -
  just rename the PEBS one to _PS so there's no clashing.
  
  Tested:
  
  * Sandy bridge

Modified:
  head/sys/dev/hwpmc/pmc_events.h

Modified: head/sys/dev/hwpmc/pmc_events.h
==
--- head/sys/dev/hwpmc/pmc_events.h Sun Aug 25 12:44:03 2013
(r254854)
+++ head/sys/dev/hwpmc/pmc_events.h Sun Aug 25 12:58:34 2013
(r254855)
@@ -3282,7 +3282,7 @@ __PMC_EV_ALIAS(BR_INST_RETIRED.FAR_BRAN
 __PMC_EV_ALIAS(BR_MISP_RETIRED.ALL_BRANCHES, IAP_EVENT_C5H_00H)  \
 __PMC_EV_ALIAS(BR_MISP_RETIRED.CONDITIONAL, IAP_EVENT_C5H_01H)   \
 __PMC_EV_ALIAS(BR_MISP_RETIRED.NEAR_CALL, IAP_EVENT_C5H_02H) \
-__PMC_EV_ALIAS(BR_MISP_RETIRED.ALL_BRANCHES, IAP_EVENT_C5H_04H)  \
+__PMC_EV_ALIAS(BR_MISP_RETIRED.ALL_BRANCHES_PS, IAP_EVENT_C5H_04H)   \
 __PMC_EV_ALIAS(BR_MISP_RETIRED.NOT_TAKEN, IAP_EVENT_C5H_10H) \
 __PMC_EV_ALIAS(BR_MISP_RETIRED.TAKEN, IAP_EVENT_C5H_20H) \
 __PMC_EV_ALIAS(FP_ASSIST.X87_OUTPUT, IAP_EVENT_CAH_02H)  \
@@ -3514,7 +3514,7 @@ __PMC_EV_ALIAS(BR_INST_RETIRED.FAR_BRAN
 __PMC_EV_ALIAS(BR_MISP_RETIRED.ALL_BRANCHES, IAP_EVENT_C5H_00H)   \
 __PMC_EV_ALIAS(BR_MISP_RETIRED.CONDITIONAL, IAP_EVENT_C5H_01H)\
 __PMC_EV_ALIAS(BR_MISP_RETIRED.NEAR_CALL, IAP_EVENT_C5H_02H)  \
-__PMC_EV_ALIAS(BR_MISP_RETIRED.ALL_BRANCHES, IAP_EVENT_C5H_04H)   \
+__PMC_EV_ALIAS(BR_MISP_RETIRED.ALL_BRANCHES_PS, IAP_EVENT_C5H_04H)\
 __PMC_EV_ALIAS(BR_MISP_RETIRED.NOT_TAKEN, IAP_EVENT_C5H_10H)  \
 __PMC_EV_ALIAS(BR_MISP_RETIRED.TAKEN, IAP_EVENT_C5H_20H)  \
 __PMC_EV_ALIAS(FP_ASSIST.X87_OUTPUT, IAP_EVENT_CAH_02H)   \
___
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: r254857 - head/sys/sys

2013-08-25 Thread Andre Oppermann
Author: andre
Date: Sun Aug 25 13:30:37 2013
New Revision: 254857
URL: http://svnweb.freebsd.org/changeset/base/254857

Log:
  Fix CSUM compatibility mapping.  SCTP is a layer 4 protocol.
  
  Submitted by: tuexen

Modified:
  head/sys/sys/mbuf.h

Modified: head/sys/sys/mbuf.h
==
--- head/sys/sys/mbuf.h Sun Aug 25 13:10:03 2013(r254856)
+++ head/sys/sys/mbuf.h Sun Aug 25 13:30:37 2013(r254857)
@@ -418,7 +418,7 @@ struct mbuf {
 #defineCSUM_IP_VALID   CSUM_L3_VALID
 #defineCSUM_DATA_VALID CSUM_L4_VALID
 #defineCSUM_PSEUDO_HDR CSUM_L4_CALC
-#defineCSUM_SCTP_VALID CSUM_L3_VALID
+#defineCSUM_SCTP_VALID CSUM_L4_VALID
 #defineCSUM_DELAY_DATA (CSUM_TCP|CSUM_UDP)
 #defineCSUM_DELAY_IP   CSUM_IP /* Only v4, no v6 IP 
hdr csum */
 #defineCSUM_DELAY_DATA_IPV6(CSUM_TCP_IPV6|CSUM_UDP_IPV6)
___
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: r254858 - head/sys/dev/drm2

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 14:27:14 2013
New Revision: 254858
URL: http://svnweb.freebsd.org/changeset/base/254858

Log:
  drm: Add missing bits to drmP.h, required by the Radeon driver
  
  Some of the FreeBSD-specific definitions are moved to drm_os_freebsd.h.
  But there's still work to do to clean it up and reduce the diff with
  Linux' drmP.h.

Added:
  head/sys/dev/drm2/drm_os_freebsd.h   (contents, props changed)
Modified:
  head/sys/dev/drm2/drmP.h

Modified: head/sys/dev/drm2/drmP.h
==
--- head/sys/dev/drm2/drmP.hSun Aug 25 13:30:37 2013(r254857)
+++ head/sys/dev/drm2/drmP.hSun Aug 25 14:27:14 2013(r254858)
@@ -1,9 +1,15 @@
-/* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*-
- * Created: Mon Jan  4 10:05:05 1999 by fa...@precisioninsight.com
+/**
+ * \file drmP.h
+ * Private header for Direct Rendering Manager
+ *
+ * \author Rickard E. (Rik) Faith fa...@valinux.com
+ * \author Gareth Hughes gar...@valinux.com
  */
-/*-
+
+/*
  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
  * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * Copyright (c) 2009-2010, Code Aurora Forum.
  * All rights reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -24,11 +30,6 @@
  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- *Rickard E. (Rik) Faith fa...@valinux.com
- *Gareth Hughes gar...@valinux.com
- *
  */
 
 #include sys/cdefs.h
@@ -39,9 +40,6 @@ __FBSDID($FreeBSD$);
 
 #if defined(_KERNEL) || defined(__KERNEL__)
 
-struct drm_device;
-struct drm_file;
-
 #include sys/param.h
 #include sys/queue.h
 #include sys/malloc.h
@@ -99,12 +97,19 @@ struct drm_file;
 #include sys/bus.h
 
 #include dev/drm2/drm.h
+#include dev/drm2/drm_sarea.h
+
 #include dev/drm2/drm_atomic.h
 #include dev/drm2/drm_internal.h
 #include dev/drm2/drm_linux_list.h
 #include dev/drm2/drm_gem_names.h
-#include dev/drm2/drm_mm.h
+
+struct drm_file;
+struct drm_device;
+
+#include dev/drm2/drm_os_freebsd.h
 #include dev/drm2/drm_hashtab.h
+#include dev/drm2/drm_mm.h
 
 #include opt_compat.h
 #include opt_drm.h
@@ -120,6 +125,10 @@ struct drm_file;
 #undef DRM_LINUX
 #define DRM_LINUX 0
 
+/***/
+/** \name DRM template customization defaults */
+/*@{*/
+
 /* driver capabilities and requirements mask */
 #define DRIVER_USE_AGP 0x1
 #define DRIVER_REQUIRE_AGP 0x2
@@ -135,8 +144,8 @@ struct drm_file;
 #define DRIVER_IRQ_VBL20x800
 #define DRIVER_GEM 0x1000
 #define DRIVER_MODESET 0x2000
-#define DRIVER_USE_PLATFORM_DEVICE  0x4000
-#defineDRIVER_LOCKLESS_IRQ 0x8000
+#define DRIVER_PRIME   0x4000
+#define DRIVER_LOCKLESS_IRQ 0x8000
 
 
 #define DRM_HASH_SIZE16 /* Size of key hash table*/
@@ -177,7 +186,10 @@ SYSCTL_DECL(_hw_drm);
 
 #define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8)
 
-   /* Internal types and structures */
+/***/
+/** \name Internal types and structures */
+/*@{*/
+
 #define DRM_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
 #define DRM_MIN(a,b) ((a)(b)?(a):(b))
 #define DRM_MAX(a,b) ((a)(b)?(a):(b))
@@ -228,12 +240,6 @@ typedef void   irqreturn_t;
 #define IRQ_HANDLED/* nothing */
 #define IRQ_NONE   /* nothing */
 
-#define unlikely(x)__builtin_expect(!!(x), 0)
-#define likely(x)  __builtin_expect(!!(x), 1)
-#define container_of(ptr, type, member) ({ \
-   __typeof( ((type *)0)-member ) *__mptr = (ptr);\
-   (type *)( (char *)__mptr - offsetof(type,member) );})
-
 enum {
DRM_IS_NOT_AGP,
DRM_IS_AGP,
@@ -255,16 +261,6 @@ enum {
 #definetime_after_eq(a,b)  ((long)(b) - (long)(a) = 0)
 #define drm_msleep(x, msg) pause((msg), ((int64_t)(x)) * hz / 1000)
 
-typedef vm_paddr_t dma_addr_t;
-typedef uint64_t u64;
-typedef uint32_t u32;
-typedef uint16_t u16;
-typedef uint8_t u8;
-typedef int64_t s64;
-typedef int32_t s32;
-typedef int16_t s16;
-typedef int8_t s8;
-
 /* DRM_READMEMORYBARRIER() prevents reordering of reads.
  * DRM_WRITEMEMORYBARRIER() prevents reordering of writes.
  * DRM_MEMORYBARRIER() prevents reordering of reads and writes.
@@ -312,16 +308,6 @@ typedef int8_t s8;
 #define DRM_GET_USER_UNCHECKED(val, uaddr) \
((val) = fuword32(uaddr), 0)
 
-#define cpu_to_le32(x) htole32(x)
-#define le32_to_cpu(x) le32toh(x)
-
-#define DRM_HZ hz
-#define DRM_UDELAY(udelay) DELAY(udelay)
-#define DRM_MDELAY(msecs)  do { int loops = (msecs);   \
- while (loops--) 

svn commit: r254860 - head/sys/dev/drm2

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 14:33:49 2013
New Revision: 254860
URL: http://svnweb.freebsd.org/changeset/base/254860

Log:
  drm: Update drm_atomic.h, now that projects/atomic64 is in HEAD
  
  Submitted by: jkim@

Modified:
  head/sys/dev/drm2/drm_atomic.h

Modified: head/sys/dev/drm2/drm_atomic.h
==
--- head/sys/dev/drm2/drm_atomic.h  Sun Aug 25 14:29:47 2013
(r254859)
+++ head/sys/dev/drm2/drm_atomic.h  Sun Aug 25 14:33:49 2013
(r254860)
@@ -32,62 +32,51 @@
 #include sys/cdefs.h
 __FBSDID($FreeBSD$);
 
-/* Many of these implementations are rather fake, but good enough. */
+typedef uint32_t   atomic_t;
+typedef uint64_t   atomic64_t;
 
-typedef u_int32_t atomic_t;
+#defineBITS_TO_LONGS(x)howmany(x, sizeof(long) * NBBY)
 
-#define atomic_set(p, v)   (*(p) = (v))
-#define atomic_read(p) (*(p))
-#define atomic_inc(p)  atomic_add_int(p, 1)
-#define atomic_dec(p)  atomic_subtract_int(p, 1)
-#define atomic_add(n, p)   atomic_add_int(p, n)
-#define atomic_sub(n, p)   atomic_subtract_int(p, n)
+#defineatomic_set(p, v)atomic_store_rel_int(p, v)
+#defineatomic_read(p)  atomic_load_acq_int(p)
 
-static __inline atomic_t
-test_and_set_bit(int b, volatile void *p)
-{
-   int s = splhigh();
-   unsigned int m = 1b;
-   unsigned int r = *(volatile int *)p  m;
-   *(volatile int *)p |= m;
-   splx(s);
-   return r;
-}
-
-static __inline void
-clear_bit(int b, volatile void *p)
-{
-   atomic_clear_int(((volatile int *)p) + (b  5), 1  (b  0x1f));
-}
-
-static __inline void
-set_bit(int b, volatile void *p)
-{
-   atomic_set_int(((volatile int *)p) + (b  5), 1  (b  0x1f));
-}
-
-static __inline int
-test_bit(int b, volatile void *p)
-{
-   return ((volatile int *)p)[b  5]  (1  (b  0x1f));
-}
+#defineatomic_add(v, p)atomic_add_int(p, v)
+#defineatomic_sub(v, p)atomic_subtract_int(p, v)
+#defineatomic_inc(p)   atomic_add(1, p)
+#defineatomic_dec(p)   atomic_sub(1, p)
+
+#defineatomic_add_return(v, p) (atomic_fetchadd_int(p, v) + 
(v))
+#defineatomic_sub_return(v, p) (atomic_fetchadd_int(p, -(v)) - 
(v))
+#defineatomic_inc_return(p)atomic_add_return(1, p)
+#defineatomic_dec_return(p)atomic_sub_return(1, p)
+
+#defineatomic_add_and_test(v, p)   (atomic_add_return(v, p) == 0)
+#defineatomic_sub_and_test(v, p)   (atomic_sub_return(v, p) == 0)
+#defineatomic_inc_and_test(p)  (atomic_inc_return(p) == 0)
+#defineatomic_dec_and_test(p)  (atomic_dec_return(p) == 0)
+
+#defineatomic_xchg(p, v)   atomic_swap_int(p, v)
+#defineatomic64_xchg(p, v) atomic_swap_64(p, v)
+
+#defineclear_bit(b, p) \
+atomic_clear_int((volatile u_int *)(p) + (b) / 32, 1  (b) % 32)
+#defineset_bit(b, p) \
+atomic_set_int((volatile u_int *)(p) + (b) / 32, 1  (b) % 32)
+#definetest_bit(b, p) \
+(atomic_load_acq_int((volatile u_int *)(p) + (b) / 32)  (1  (b) % 32))
+#definetest_and_set_bit(b, p) \
+atomic_testandset_int((volatile u_int *)(p) + (b) / 32, b)
 
 static __inline int
 find_first_zero_bit(volatile void *p, int max)
 {
-   int b;
-   volatile int *ptr = (volatile int *)p;
+   volatile int *np = p;
+   int i, n;
 
-   for (b = 0; b  max; b += 32) {
-   if (ptr[b  5] != ~0) {
-   for (;;) {
-   if ((ptr[b  5]  (1  (b  0x1f))) == 0)
-   return b;
-   b++;
-   }
-   }
+   for (i = 0; i  max / (NBBY * sizeof(int)); i++) {
+   n = ~np[i];
+   if (n != 0)
+   return (i * NBBY * sizeof(int) + ffs(n) - 1);
}
-   return max;
+   return (max);
 }
-
-#defineBITS_TO_LONGS(x) (howmany((x), NBBY * sizeof(long)))
___
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: r254861 - head/sys/dev/drm2/ttm

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 14:39:51 2013
New Revision: 254861
URL: http://svnweb.freebsd.org/changeset/base/254861

Log:
  drm/ttm: Import Linux commit 63d0a4195560362e2e00a3ad38fc331d34e1da9b
  
  Author: Maarten Lankhorst maarten.lankho...@canonical.com
  Date:   Tue Jan 15 14:56:37 2013 +0100
  
  drm/ttm: remove lru_lock around ttm_bo_reserve
  
  There should no longer be assumptions that reserve will always succeed
  with the lru lock held, so we can safely break the whole atomic
  reserve/lru thing. As a bonus this fixes most lockdep annotations for
  reservations.
  
  Signed-off-by: Maarten Lankhorst maarten.lankho...@canonical.com
  Reviewed-by: Jerome Glisse jgli...@redhat.com

Modified:
  head/sys/dev/drm2/ttm/ttm_bo.c
  head/sys/dev/drm2/ttm/ttm_bo_driver.h
  head/sys/dev/drm2/ttm/ttm_execbuf_util.c

Modified: head/sys/dev/drm2/ttm/ttm_bo.c
==
--- head/sys/dev/drm2/ttm/ttm_bo.c  Sun Aug 25 14:33:49 2013
(r254860)
+++ head/sys/dev/drm2/ttm/ttm_bo.c  Sun Aug 25 14:39:51 2013
(r254861)
@@ -196,13 +196,13 @@ int ttm_bo_del_from_lru(struct ttm_buffe
return put_count;
 }
 
-int ttm_bo_reserve_locked(struct ttm_buffer_object *bo,
+int ttm_bo_reserve_nolru(struct ttm_buffer_object *bo,
  bool interruptible,
  bool no_wait, bool use_sequence, uint32_t sequence)
 {
int ret;
 
-   while (unlikely(atomic_read(bo-reserved) != 0)) {
+   while (unlikely(atomic_xchg(bo-reserved, 1) != 0)) {
/**
 * Deadlock avoidance for multi-bo reserving.
 */
@@ -224,22 +224,35 @@ int ttm_bo_reserve_locked(struct ttm_buf
return -EBUSY;
 
ret = ttm_bo_wait_unreserved_locked(bo, interruptible);
+
if (unlikely(ret))
return ret;
}
 
-   atomic_set(bo-reserved, 1);
if (use_sequence) {
+   bool wake_up = false;
/**
 * Wake up waiters that may need to recheck for deadlock,
 * if we decreased the sequence number.
 */
if (unlikely((bo-val_seq - sequence  (1  31))
 || !bo-seq_valid))
-   wakeup(bo);
+   wake_up = true;
 
+   /*
+* In the worst case with memory ordering these values can be
+* seen in the wrong order. However since we call wake_up_all
+* in that case, this will hopefully not pose a problem,
+* and the worst case would only cause someone to accidentally
+* hit -EAGAIN in ttm_bo_reserve when they see old value of
+* val_seq. However this would only happen if seq_valid was
+* written before val_seq was, and just means some slightly
+* increased cpu usage
+*/
bo-val_seq = sequence;
bo-seq_valid = true;
+   if (wake_up)
+   wakeup(bo);
} else {
bo-seq_valid = false;
}
@@ -268,14 +281,14 @@ int ttm_bo_reserve(struct ttm_buffer_obj
int put_count = 0;
int ret;
 
-   mtx_lock(glob-lru_lock);
-   ret = ttm_bo_reserve_locked(bo, interruptible, no_wait, use_sequence,
-   sequence);
-   if (likely(ret == 0))
+   ret = ttm_bo_reserve_nolru(bo, interruptible, no_wait, use_sequence,
+  sequence);
+   if (likely(ret == 0)) {
+   mtx_lock(glob-lru_lock);
put_count = ttm_bo_del_from_lru(bo);
-   mtx_unlock(glob-lru_lock);
-
-   ttm_bo_list_ref_sub(bo, put_count, true);
+   mtx_unlock(glob-lru_lock);
+   ttm_bo_list_ref_sub(bo, put_count, true);
+   }
 
return ret;
 }
@@ -488,7 +501,7 @@ static void ttm_bo_cleanup_refs_or_queue
int ret;
 
mtx_lock(glob-lru_lock);
-   ret = ttm_bo_reserve_locked(bo, false, true, false, 0);
+   ret = ttm_bo_reserve_nolru(bo, false, true, false, 0);
 
mtx_lock(bdev-fence_lock);
(void) ttm_bo_wait(bo, false, false, true);
@@ -580,7 +593,7 @@ static int ttm_bo_cleanup_refs_and_unloc
return ret;
 
mtx_lock(glob-lru_lock);
-   ret = ttm_bo_reserve_locked(bo, false, true, false, 0);
+   ret = ttm_bo_reserve_nolru(bo, false, true, false, 0);
 
/*
 * We raced, and lost, someone else holds the reservation now,
@@ -644,7 +657,14 @@ static int ttm_bo_delayed_delete(struct 
refcount_acquire(nentry-list_kref);
}
 
-   ret = ttm_bo_reserve_locked(entry, false, !remove_all, false, 
0);
+   ret = 

svn commit: r254862 - head/sys/dev/drm2/ttm

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 14:41:22 2013
New Revision: 254862
URL: http://svnweb.freebsd.org/changeset/base/254862

Log:
  drm/ttm: Import Linux commit 7a1863084c9d90ce4b67d645bf9b0f1612e68f62
  
  Author: Maarten Lankhorst maarten.lankho...@canonical.com
  Date:   Tue Jan 15 14:56:48 2013 +0100
  
  drm/ttm: cleanup ttm_eu_reserve_buffers handling
  
  With the lru lock no longer required for protecting reservations we
  can just do a ttm_bo_reserve_nolru on -EBUSY, and handle all errors
  in a single path.
  
  Signed-off-by: Maarten Lankhorst maarten.lankho...@canonical.com
  Reviewed-by: Jerome Glisse jgli...@redhat.com

Modified:
  head/sys/dev/drm2/ttm/ttm_bo.c
  head/sys/dev/drm2/ttm/ttm_execbuf_util.c

Modified: head/sys/dev/drm2/ttm/ttm_bo.c
==
--- head/sys/dev/drm2/ttm/ttm_bo.c  Sun Aug 25 14:39:51 2013
(r254861)
+++ head/sys/dev/drm2/ttm/ttm_bo.c  Sun Aug 25 14:41:22 2013
(r254862)
@@ -659,10 +659,8 @@ static int ttm_bo_delayed_delete(struct 
 
ret = ttm_bo_reserve_nolru(entry, false, true, false, 0);
if (remove_all  ret) {
-   mtx_unlock(glob-lru_lock);
ret = ttm_bo_reserve_nolru(entry, false, false,
   false, 0);
-   mtx_lock(glob-lru_lock);
}
 
if (!ret)

Modified: head/sys/dev/drm2/ttm/ttm_execbuf_util.c
==
--- head/sys/dev/drm2/ttm/ttm_execbuf_util.cSun Aug 25 14:39:51 2013
(r254861)
+++ head/sys/dev/drm2/ttm/ttm_execbuf_util.cSun Aug 25 14:41:22 2013
(r254862)
@@ -83,19 +83,6 @@ static void ttm_eu_list_ref_sub(struct l
}
 }
 
-static int ttm_eu_wait_unreserved_locked(struct list_head *list,
-struct ttm_buffer_object *bo)
-{
-   int ret;
-
-   ttm_eu_del_from_lru_locked(list);
-   ret = ttm_bo_wait_unreserved_locked(bo, true);
-   if (unlikely(ret != 0))
-   ttm_eu_backoff_reservation_locked(list);
-   return ret;
-}
-
-
 void ttm_eu_backoff_reservation(struct list_head *list)
 {
struct ttm_validate_buffer *entry;
@@ -149,19 +136,21 @@ retry_locked:
list_for_each_entry(entry, list, head) {
struct ttm_buffer_object *bo = entry-bo;
 
-retry_this_bo:
ret = ttm_bo_reserve_nolru(bo, true, true, true, val_seq);
switch (ret) {
case 0:
break;
case -EBUSY:
-   ret = ttm_eu_wait_unreserved_locked(list, bo);
-   if (unlikely(ret != 0)) {
-   mtx_unlock(glob-lru_lock);
-   ttm_eu_list_ref_sub(list);
-   return ret;
-   }
-   goto retry_this_bo;
+   ttm_eu_del_from_lru_locked(list);
+   ret = ttm_bo_reserve_nolru(bo, true, false,
+  true, val_seq);
+   if (!ret)
+   break;
+
+   if (unlikely(ret != -EAGAIN))
+   goto err;
+
+   /* fallthrough */
case -EAGAIN:
ttm_eu_backoff_reservation_locked(list);
ttm_eu_list_ref_sub(list);
@@ -172,18 +161,13 @@ retry_this_bo:
}
goto retry_locked;
default:
-   ttm_eu_backoff_reservation_locked(list);
-   mtx_unlock(glob-lru_lock);
-   ttm_eu_list_ref_sub(list);
-   return ret;
+   goto err;
}
 
entry-reserved = true;
if (unlikely(atomic_read(bo-cpu_writers)  0)) {
-   ttm_eu_backoff_reservation_locked(list);
-   mtx_unlock(glob-lru_lock);
-   ttm_eu_list_ref_sub(list);
-   return -EBUSY;
+   ret = -EBUSY;
+   goto err;
}
}
 
@@ -192,6 +176,12 @@ retry_this_bo:
ttm_eu_list_ref_sub(list);
 
return 0;
+
+err:
+   ttm_eu_backoff_reservation_locked(list);
+   mtx_unlock(glob-lru_lock);
+   ttm_eu_list_ref_sub(list);
+   return ret;
 }
 
 void ttm_eu_fence_buffer_objects(struct list_head *list, void *sync_obj)
___
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: r254863 - head/sys/dev/drm2/ttm

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 14:47:22 2013
New Revision: 254863
URL: http://svnweb.freebsd.org/changeset/base/254863

Log:
  drm/ttm: Import Linux commit 5e45d7dfd74100d622f9cdc70bfd1f9fae1671de
  
  Author: Maarten Lankhorst maarten.lankho...@canonical.com
  Date:   Tue Jan 15 14:57:05 2013 +0100
  
  drm/ttm: add ttm_bo_reserve_slowpath
  
  Instead of dropping everything, waiting for the bo to be unreserved
  and trying over, a better strategy would be to do a blocking wait.
  
  This can be mapped a lot better to a mutex_lock-like call.
  
  Signed-off-by: Maarten Lankhorst maarten.lankho...@canonical.com
  Reviewed-by: Jerome Glisse jgli...@redhat.com
  
  Approved by:  kib@

Modified:
  head/sys/dev/drm2/ttm/ttm_bo.c
  head/sys/dev/drm2/ttm/ttm_bo_driver.h

Modified: head/sys/dev/drm2/ttm/ttm_bo.c
==
--- head/sys/dev/drm2/ttm/ttm_bo.c  Sun Aug 25 14:41:22 2013
(r254862)
+++ head/sys/dev/drm2/ttm/ttm_bo.c  Sun Aug 25 14:47:22 2013
(r254863)
@@ -293,6 +293,56 @@ int ttm_bo_reserve(struct ttm_buffer_obj
return ret;
 }
 
+int ttm_bo_reserve_slowpath_nolru(struct ttm_buffer_object *bo,
+ bool interruptible, uint32_t sequence)
+{
+   bool wake_up = false;
+   int ret;
+
+   while (unlikely(atomic_xchg(bo-reserved, 1) != 0)) {
+   if (bo-seq_valid  sequence == bo-val_seq) {
+   DRM_ERROR(
+   %s: bo-seq_valid  sequence == bo-val_seq,
+   __func__);
+   }
+
+   ret = ttm_bo_wait_unreserved_locked(bo, interruptible);
+
+   if (unlikely(ret))
+   return ret;
+   }
+
+   if ((bo-val_seq - sequence  (1  31)) || !bo-seq_valid)
+   wake_up = true;
+
+   /**
+* Wake up waiters that may need to recheck for deadlock,
+* if we decreased the sequence number.
+*/
+   bo-val_seq = sequence;
+   bo-seq_valid = true;
+   if (wake_up)
+   wakeup(bo);
+
+   return 0;
+}
+
+int ttm_bo_reserve_slowpath(struct ttm_buffer_object *bo,
+   bool interruptible, uint32_t sequence)
+{
+   struct ttm_bo_global *glob = bo-glob;
+   int put_count, ret;
+
+   ret = ttm_bo_reserve_slowpath_nolru(bo, interruptible, sequence);
+   if (likely(!ret)) {
+   mtx_lock(glob-lru_lock);
+   put_count = ttm_bo_del_from_lru(bo);
+   mtx_unlock(glob-lru_lock);
+   ttm_bo_list_ref_sub(bo, put_count, true);
+   }
+   return ret;
+}
+
 void ttm_bo_unreserve_locked(struct ttm_buffer_object *bo)
 {
ttm_bo_add_to_lru(bo);

Modified: head/sys/dev/drm2/ttm/ttm_bo_driver.h
==
--- head/sys/dev/drm2/ttm/ttm_bo_driver.h   Sun Aug 25 14:41:22 2013
(r254862)
+++ head/sys/dev/drm2/ttm/ttm_bo_driver.h   Sun Aug 25 14:47:22 2013
(r254863)
@@ -822,6 +822,36 @@ extern int ttm_bo_reserve(struct ttm_buf
  bool interruptible,
  bool no_wait, bool use_sequence, uint32_t sequence);
 
+/**
+ * ttm_bo_reserve_slowpath_nolru:
+ * @bo: A pointer to a struct ttm_buffer_object.
+ * @interruptible: Sleep interruptible if waiting.
+ * @sequence: Set (@bo)-sequence to this value after lock
+ *
+ * This is called after ttm_bo_reserve returns -EAGAIN and we backed off
+ * from all our other reservations. Because there are no other reservations
+ * held by us, this function cannot deadlock any more.
+ *
+ * Will not remove reserved buffers from the lru lists.
+ * Otherwise identical to ttm_bo_reserve_slowpath.
+ */
+extern int ttm_bo_reserve_slowpath_nolru(struct ttm_buffer_object *bo,
+bool interruptible,
+uint32_t sequence);
+
+
+/**
+ * ttm_bo_reserve_slowpath:
+ * @bo: A pointer to a struct ttm_buffer_object.
+ * @interruptible: Sleep interruptible if waiting.
+ * @sequence: Set (@bo)-sequence to this value after lock
+ *
+ * This is called after ttm_bo_reserve returns -EAGAIN and we backed off
+ * from all our other reservations. Because there are no other reservations
+ * held by us, this function cannot deadlock any more.
+ */
+extern int ttm_bo_reserve_slowpath(struct ttm_buffer_object *bo,
+  bool interruptible, uint32_t sequence);
 
 /**
  * ttm_bo_reserve_nolru:
___
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: r254864 - head/sys/dev/drm2/ttm

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 14:52:20 2013
New Revision: 254864
URL: http://svnweb.freebsd.org/changeset/base/254864

Log:
  drm/ttm: Import Linux commit f2d476a110bc24fde008698ae9018c99e803e25c
  
  Author: Maarten Lankhorst maarten.lankho...@canonical.com
  Date:   Tue Jan 15 14:57:10 2013 +0100
  
  drm/ttm: use ttm_bo_reserve_slowpath_nolru in ttm_eu_reserve_buffers, v2
  
  This requires re-use of the seqno, which increases fairness slightly.
  Instead of spinning with a new seqno every time we keep the current one,
  but still drop all other reservations we hold. Only when we succeed,
  we try to get back our other reservations again.
  
  This should increase fairness slightly as well.
  
  Changes since v1:
   - Increase val_seq before calling ttm_bo_reserve_slowpath_nolru and
 retrying to take all entries to prevent a race.
  
  Signed-off-by: Maarten Lankhorst maarten.lankho...@canonical.com
  Reviewed-by: Jerome Glisse jgli...@redhat.com
  
  Approved by:  kib@

Modified:
  head/sys/dev/drm2/ttm/ttm_execbuf_util.c

Modified: head/sys/dev/drm2/ttm/ttm_execbuf_util.c
==
--- head/sys/dev/drm2/ttm/ttm_execbuf_util.cSun Aug 25 14:47:22 2013
(r254863)
+++ head/sys/dev/drm2/ttm/ttm_execbuf_util.cSun Aug 25 14:52:20 2013
(r254864)
@@ -130,12 +130,16 @@ int ttm_eu_reserve_buffers(struct list_h
glob = entry-bo-glob;
 
mtx_lock(glob-lru_lock);
-retry_locked:
val_seq = entry-bo-bdev-val_seq++;
 
+retry_locked:
list_for_each_entry(entry, list, head) {
struct ttm_buffer_object *bo = entry-bo;
 
+   /* already slowpath reserved? */
+   if (entry-reserved)
+   continue;
+
ret = ttm_bo_reserve_nolru(bo, true, true, true, val_seq);
switch (ret) {
case 0:
@@ -153,12 +157,26 @@ retry_locked:
/* fallthrough */
case -EAGAIN:
ttm_eu_backoff_reservation_locked(list);
+
+   /*
+* temporarily increase sequence number every retry,
+* to prevent us from seeing our old reservation
+* sequence when someone else reserved the buffer,
+* but hasn't updated the seq_valid/seqno members yet.
+*/
+   val_seq = entry-bo-bdev-val_seq++;
+
ttm_eu_list_ref_sub(list);
-   ret = ttm_bo_wait_unreserved_locked(bo, true);
+   ret = ttm_bo_reserve_slowpath_nolru(bo, true, val_seq);
if (unlikely(ret != 0)) {
mtx_unlock(glob-lru_lock);
return ret;
}
+   entry-reserved = true;
+   if (unlikely(atomic_read(bo-cpu_writers)  0)) {
+   ret = -EBUSY;
+   goto err;
+   }
goto retry_locked;
default:
goto err;
___
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: r254865 - head/sys/dev/drm2/ttm

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 14:53:39 2013
New Revision: 254865
URL: http://svnweb.freebsd.org/changeset/base/254865

Log:
  drm/ttm: Import Linux commit cc4c0c4de3c775be22072ec3251f2e581b63d9a0
  
  Author: Maarten Lankhorst maarten.lankho...@canonical.com
  Date:   Tue Jan 15 14:57:28 2013 +0100
  
  drm/ttm: unexport ttm_bo_wait_unreserved
  
  All legitimate users of this function outside ttm_bo.c are gone, now
  it's only an implementation detail.
  
  Signed-off-by: Maarten Lankhorst maarten.lankho...@canonical.com
  Reviewed-by: Jerome Glisse jgli...@redhat.com
  
  Approved by:  kib@

Modified:
  head/sys/dev/drm2/ttm/ttm_bo.c
  head/sys/dev/drm2/ttm/ttm_bo_driver.h

Modified: head/sys/dev/drm2/ttm/ttm_bo.c
==
--- head/sys/dev/drm2/ttm/ttm_bo.c  Sun Aug 25 14:52:20 2013
(r254864)
+++ head/sys/dev/drm2/ttm/ttm_bo.c  Sun Aug 25 14:53:39 2013
(r254865)
@@ -131,7 +131,7 @@ static void ttm_bo_release_list(struct t
ttm_mem_global_free(bdev-glob-mem_glob, acc_size);
 }
 
-int
+static int
 ttm_bo_wait_unreserved_locked(struct ttm_buffer_object *bo, bool interruptible)
 {
const char *wmsg;

Modified: head/sys/dev/drm2/ttm/ttm_bo_driver.h
==
--- head/sys/dev/drm2/ttm/ttm_bo_driver.h   Sun Aug 25 14:52:20 2013
(r254864)
+++ head/sys/dev/drm2/ttm/ttm_bo_driver.h   Sun Aug 25 14:53:39 2013
(r254865)
@@ -899,18 +899,6 @@ extern void ttm_bo_unreserve(struct ttm_
  */
 extern void ttm_bo_unreserve_locked(struct ttm_buffer_object *bo);
 
-/**
- * ttm_bo_wait_unreserved
- *
- * @bo: A pointer to a struct ttm_buffer_object.
- *
- * Wait for a struct ttm_buffer_object to become unreserved.
- * This is typically used in the execbuf code to relax cpu-usage when
- * a potential deadlock condition backoff.
- */
-extern int ttm_bo_wait_unreserved_locked(struct ttm_buffer_object *bo,
- bool interruptible);
-
 /*
  * ttm_bo_util.c
  */
___
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: r254866 - head/sys/dev/drm2/ttm

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 14:55:08 2013
New Revision: 254866
URL: http://svnweb.freebsd.org/changeset/base/254866

Log:
  drm/ttm: Import Linux commit 630541863b29f88c7ab34e647758344e4cd1eafd
  
  Author: Dave Airlie airl...@gmail.com
  Date:   Wed Jan 16 14:25:44 2013 +1000
  
  ttm: don't destroy old mm_node on memcpy failure
  
  When we are using memcpy to move objects around, and we fail to memcpy
  due to lack of memory to populate or failure to finish the copy, we don't
  want to destroy the mm_node that has been copied into old_copy.
  
  While working on a new kms driver that uses memcpy, if I overallocated 
bo's
  up to the memory limits, and eviction failed, then machine would oops soon
  after due to having an active bo with an already freed drm_mm embedded in 
it,
  freeing it a second time didn't end well.
  
  Reviewed-by: Jerome Glisse jgli...@redhat.com
  Signed-off-by: Dave Airlie airl...@redhat.com
  
  Approved by:  kib@

Modified:
  head/sys/dev/drm2/ttm/ttm_bo_util.c

Modified: head/sys/dev/drm2/ttm/ttm_bo_util.c
==
--- head/sys/dev/drm2/ttm/ttm_bo_util.c Sun Aug 25 14:53:39 2013
(r254865)
+++ head/sys/dev/drm2/ttm/ttm_bo_util.c Sun Aug 25 14:55:08 2013
(r254866)
@@ -321,8 +321,12 @@ int ttm_bo_move_memcpy(struct ttm_buffer
 
if (ttm-state == tt_unpopulated) {
ret = ttm-bdev-driver-ttm_tt_populate(ttm);
-   if (ret)
+   if (ret) {
+   /* if we fail here don't nuke the mm node
+* as the bo still owns it */
+   old_copy.mm_node = NULL;
goto out1;
+   }
}
 
add = 0;
@@ -346,8 +350,11 @@ int ttm_bo_move_memcpy(struct ttm_buffer
   prot);
} else
ret = ttm_copy_io_page(new_iomap, old_iomap, page);
-   if (ret)
+   if (ret) {
+   /* failing here, means keep old copy as-is */
+   old_copy.mm_node = NULL;
goto out1;
+   }
}
mb();
 out2:
___
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: r254870 - head/sys/dev/drm2/ttm

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 15:00:48 2013
New Revision: 254870
URL: http://svnweb.freebsd.org/changeset/base/254870

Log:
  drm/ttm: Make ttm_bo_wait() call uninterruptible in page fault handler
  
  This fixes a crash where a SIGLALRM, heavily used by X.Org, would
  interrupt the wait, causing the page fault to fail and the Xorg
  process to receive a SIGSEGV.
  
  Approved by:  kib@

Modified:
  head/sys/dev/drm2/ttm/ttm_bo_vm.c

Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c
==
--- head/sys/dev/drm2/ttm/ttm_bo_vm.c   Sun Aug 25 15:00:34 2013
(r254869)
+++ head/sys/dev/drm2/ttm/ttm_bo_vm.c   Sun Aug 25 15:00:48 2013
(r254870)
@@ -154,7 +154,23 @@ reserve:
 
mtx_lock(bdev-fence_lock);
if (test_bit(TTM_BO_PRIV_FLAG_MOVING, bo-priv_flags)) {
-   ret = ttm_bo_wait(bo, false, true, false);
+   /*
+* Here, the behavior differs between Linux and FreeBSD.
+*
+* On Linux, the wait is interruptible (3rd argument to
+* ttm_bo_wait). There must be some mechanism to resume
+* page fault handling, once the signal is processed.
+*
+* On FreeBSD, the wait is uninteruptible. This is not a
+* problem as we can't end up with an unkillable process
+* here, because the wait will eventually time out.
+*
+* An example of this situation is the Xorg process
+* which uses SIGALRM internally. The signal could
+* interrupt the wait, causing the page fault to fail
+* and the process to receive SIGSEGV.
+*/
+   ret = ttm_bo_wait(bo, false, false, false);
mtx_unlock(bdev-fence_lock);
if (unlikely(ret != 0)) {
retval = VM_PAGER_ERROR;
___
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: r254873 - head/sys/dev/drm2/ttm

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 15:05:22 2013
New Revision: 254873
URL: http://svnweb.freebsd.org/changeset/base/254873

Log:
  drm/ttm: When removing a range of pages from a pool, remove all of them
  
  Submitted by: Mark Kettenis and Jonathan Gray from OpenBSD
  Approved by:  kib@

Modified:
  head/sys/dev/drm2/ttm/ttm_page_alloc.c

Modified: head/sys/dev/drm2/ttm/ttm_page_alloc.c
==
--- head/sys/dev/drm2/ttm/ttm_page_alloc.c  Sun Aug 25 15:01:43 2013
(r254872)
+++ head/sys/dev/drm2/ttm/ttm_page_alloc.c  Sun Aug 25 15:05:22 2013
(r254873)
@@ -320,6 +320,7 @@ static int ttm_page_pool_free(struct ttm
vm_page_t *pages_to_free;
unsigned freed_pages = 0,
 npages_to_free = nr_free;
+   unsigned i;
 
if (NUM_PAGES_TO_ALLOC  nr_free)
npages_to_free = NUM_PAGES_TO_ALLOC;
@@ -338,7 +339,8 @@ restart:
/* We can only remove NUM_PAGES_TO_ALLOC at a time. */
if (freed_pages = NUM_PAGES_TO_ALLOC) {
/* remove range of pages from the pool */
-   TAILQ_REMOVE(pool-list, p, plinks.q);
+   for (i = 0; i  freed_pages; i++)
+   TAILQ_REMOVE(pool-list, pages_to_free[i], 
plinks.q);
 
ttm_pool_update_free_locked(pool, freed_pages);
/**
@@ -373,7 +375,8 @@ restart:
 
/* remove range of pages from the pool */
if (freed_pages) {
-   TAILQ_REMOVE(pool-list, p, plinks.q);
+   for (i = 0; i  freed_pages; i++)
+   TAILQ_REMOVE(pool-list, pages_to_free[i], plinks.q);
 
ttm_pool_update_free_locked(pool, freed_pages);
nr_free -= freed_pages;
___
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: r254874 - head/sys/dev/drm2/ttm

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 15:06:48 2013
New Revision: 254874
URL: http://svnweb.freebsd.org/changeset/base/254874

Log:
  drm/ttm: Improve comment in ttm_bo_vm_ctor() about lack of ref acquisition
  
  Approved by:  kib@

Modified:
  head/sys/dev/drm2/ttm/ttm_bo_vm.c

Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c
==
--- head/sys/dev/drm2/ttm/ttm_bo_vm.c   Sun Aug 25 15:05:22 2013
(r254873)
+++ head/sys/dev/drm2/ttm/ttm_bo_vm.c   Sun Aug 25 15:06:48 2013
(r254874)
@@ -285,8 +285,16 @@ ttm_bo_vm_ctor(void *handle, vm_ooffset_
 {
 
/*
-* We don't acquire a reference on bo-kref here, because it was
-* already done in ttm_bo_mmap_single().
+* On Linux, a reference to the buffer object is acquired here.
+* The reason is that this function is not called when the
+* mmap() is initialized, but only when a process forks for
+* instance. Therefore on Linux, the reference on the bo is
+* acquired either in ttm_bo_mmap() or ttm_bo_vm_open(). It's
+* then released in ttm_bo_vm_close().
+*
+* Here, this function is called during mmap() intialization.
+* Thus, the reference acquired in ttm_bo_mmap_single() is
+* sufficient.
 */
 
*color = 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: r254875 - head/sys/dev/drm2/ttm

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 15:12:26 2013
New Revision: 254875
URL: http://svnweb.freebsd.org/changeset/base/254875

Log:
  ttm: to_page-valid = VM_PAGE_BITS_ALL before vm_page_dirty(to_page)
  
  Approved by;  kib@

Modified:
  head/sys/dev/drm2/ttm/ttm_tt.c

Modified: head/sys/dev/drm2/ttm/ttm_tt.c
==
--- head/sys/dev/drm2/ttm/ttm_tt.c  Sun Aug 25 15:06:48 2013
(r254874)
+++ head/sys/dev/drm2/ttm/ttm_tt.c  Sun Aug 25 15:12:26 2013
(r254875)
@@ -353,8 +353,8 @@ int ttm_tt_swapout(struct ttm_tt *ttm, v
continue;
to_page = vm_page_grab(obj, i, VM_ALLOC_NORMAL);
pmap_copy_page(from_page, to_page);
-   vm_page_dirty(to_page);
to_page-valid = VM_PAGE_BITS_ALL;
+   vm_page_dirty(to_page);
vm_page_xunbusy(to_page);
}
vm_object_pip_wakeup(obj);
___
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: r254876 - head/sys/dev/drm2/ttm

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 15:15:55 2013
New Revision: 254876
URL: http://svnweb.freebsd.org/changeset/base/254876

Log:
  drm/ttm: Fix unmap of buffer object
  
  Add a new ttm_bo_release_mmap() function to unmap pages in a
  vm_object_t. Pages are freed when the buffer object is later released.
  
  This function is called in ttm_bo_unmap_virtual_locked(), replacing
  Linux' unmap_mapping_range(). In particular this is called when a buffer
  object is about to be moved, so that its mapping is invalidated.
  
  However, we don't use this function in ttm_bo_vm_dtor(), because the
  vm_object_t is already marked as OBJ_DEAD and the pages will be
  unmapped.
  
  Approved by:  kib@

Modified:
  head/sys/dev/drm2/ttm/ttm_bo.c
  head/sys/dev/drm2/ttm/ttm_bo_vm.c

Modified: head/sys/dev/drm2/ttm/ttm_bo.c
==
--- head/sys/dev/drm2/ttm/ttm_bo.c  Sun Aug 25 15:12:26 2013
(r254875)
+++ head/sys/dev/drm2/ttm/ttm_bo.c  Sun Aug 25 15:15:55 2013
(r254876)
@@ -1634,13 +1634,8 @@ bool ttm_mem_reg_is_pci(struct ttm_bo_de
 
 void ttm_bo_unmap_virtual_locked(struct ttm_buffer_object *bo)
 {
-   struct ttm_bo_device *bdev = bo-bdev;
-   /* off_t offset = (off_t)bo-addr_space_offset;XXXKIB */
-   /* off_t holelen = ((off_t)bo-mem.num_pages)  PAGE_SHIFT;XXXKIB */
 
-   if (!bdev-dev_mapping)
-   return;
-   /* unmap_mapping_range(bdev-dev_mapping, offset, holelen, 1); XXXKIB */
+   ttm_bo_release_mmap(bo);
ttm_mem_io_free_vm(bo);
 }
 

Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c
==
--- head/sys/dev/drm2/ttm/ttm_bo_vm.c   Sun Aug 25 15:12:26 2013
(r254875)
+++ head/sys/dev/drm2/ttm/ttm_bo_vm.c   Sun Aug 25 15:15:55 2013
(r254876)
@@ -361,6 +361,33 @@ out_unref:
return ret;
 }
 
+void
+ttm_bo_release_mmap(struct ttm_buffer_object *bo)
+{
+   vm_object_t vm_obj;
+   vm_page_t m;
+   int i;
+
+   vm_obj = cdev_pager_lookup(bo);
+   if (vm_obj == NULL) {
+   return;
+   }
+
+   VM_OBJECT_WLOCK(vm_obj);
+retry:
+   for (i = 0; i  bo-num_pages; i++) {
+   m = vm_page_lookup(vm_obj, i);
+   if (m == NULL)
+   continue;
+   if (vm_page_sleep_if_busy(m, ttm_unm))
+   goto retry;
+   cdev_pager_free_page(vm_obj, m);
+   }
+   VM_OBJECT_WUNLOCK(vm_obj);
+
+   vm_object_deallocate(vm_obj);
+}
+
 #if 0
 int ttm_fbdev_mmap(struct vm_area_struct *vma, struct ttm_buffer_object *bo)
 {
___
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: r254877 - head/sys/dev/drm2/ttm

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 15:26:45 2013
New Revision: 254877
URL: http://svnweb.freebsd.org/changeset/base/254877

Log:
  drm/ttm: Fix style in ttm_bo_release_mmap()

Modified:
  head/sys/dev/drm2/ttm/ttm_bo_vm.c

Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c
==
--- head/sys/dev/drm2/ttm/ttm_bo_vm.c   Sun Aug 25 15:15:55 2013
(r254876)
+++ head/sys/dev/drm2/ttm/ttm_bo_vm.c   Sun Aug 25 15:26:45 2013
(r254877)
@@ -369,9 +369,8 @@ ttm_bo_release_mmap(struct ttm_buffer_ob
int i;
 
vm_obj = cdev_pager_lookup(bo);
-   if (vm_obj == NULL) {
+   if (vm_obj == NULL)
return;
-   }
 
VM_OBJECT_WLOCK(vm_obj);
 retry:
___
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: r254878 - head/sys/dev/drm2/ttm

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 15:29:23 2013
New Revision: 254878
URL: http://svnweb.freebsd.org/changeset/base/254878

Log:
  drm/ttm: Fix a reversed condition and add missing locks
  
  This allows to run OpenGL applications on at least two test machines
  with the Radeon driver.
  
  Approved by:  kib@

Modified:
  head/sys/dev/drm2/ttm/ttm_bo.c

Modified: head/sys/dev/drm2/ttm/ttm_bo.c
==
--- head/sys/dev/drm2/ttm/ttm_bo.c  Sun Aug 25 15:26:45 2013
(r254877)
+++ head/sys/dev/drm2/ttm/ttm_bo.c  Sun Aug 25 15:29:23 2013
(r254878)
@@ -145,7 +145,7 @@ ttm_bo_wait_unreserved_locked(struct ttm
flags = 0;
wmsg = ttbowu;
}
-   while (!ttm_bo_is_reserved(bo)) {
+   while (ttm_bo_is_reserved(bo)) {
ret = -msleep(bo, bo-glob-lru_lock, flags, wmsg, 0);
if (ret != 0)
break;
@@ -281,14 +281,15 @@ int ttm_bo_reserve(struct ttm_buffer_obj
int put_count = 0;
int ret;
 
+   mtx_lock(bo-glob-lru_lock);
ret = ttm_bo_reserve_nolru(bo, interruptible, no_wait, use_sequence,
   sequence);
if (likely(ret == 0)) {
-   mtx_lock(glob-lru_lock);
put_count = ttm_bo_del_from_lru(bo);
mtx_unlock(glob-lru_lock);
ttm_bo_list_ref_sub(bo, put_count, true);
-   }
+   } else
+   mtx_unlock(bo-glob-lru_lock);
 
return ret;
 }
@@ -333,13 +334,14 @@ int ttm_bo_reserve_slowpath(struct ttm_b
struct ttm_bo_global *glob = bo-glob;
int put_count, ret;
 
+   mtx_lock(glob-lru_lock);
ret = ttm_bo_reserve_slowpath_nolru(bo, interruptible, sequence);
if (likely(!ret)) {
-   mtx_lock(glob-lru_lock);
put_count = ttm_bo_del_from_lru(bo);
mtx_unlock(glob-lru_lock);
ttm_bo_list_ref_sub(bo, put_count, true);
-   }
+   } else
+   mtx_unlock(glob-lru_lock);
return ret;
 }
 
___
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: r254879 - head/sys/dev/drm2/ttm

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 15:33:17 2013
New Revision: 254879
URL: http://svnweb.freebsd.org/changeset/base/254879

Log:
  drm/ttm: Remove unused VM_ALLOC_DMA32 define

Modified:
  head/sys/dev/drm2/ttm/ttm_page_alloc.c

Modified: head/sys/dev/drm2/ttm/ttm_page_alloc.c
==
--- head/sys/dev/drm2/ttm/ttm_page_alloc.c  Sun Aug 25 15:29:23 2013
(r254878)
+++ head/sys/dev/drm2/ttm/ttm_page_alloc.c  Sun Aug 25 15:33:17 2013
(r254879)
@@ -49,8 +49,6 @@ __FBSDID($FreeBSD$);
 #include asm/agp.h
 #endif
 
-#defineVM_ALLOC_DMA32  VM_ALLOC_RESERVED1
-
 #define NUM_PAGES_TO_ALLOC (PAGE_SIZE/sizeof(vm_page_t))
 #define SMALL_ALLOCATION   16
 #define FREE_ALL_PAGES (~0U)
___
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: r254880 - in head/sys/dev/drm2: . ttm

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 15:38:16 2013
New Revision: 254880
URL: http://svnweb.freebsd.org/changeset/base/254880

Log:
  drm: Use the new drm_atomic.h, following the merge of projects/atomic64
  
  Submitted by: jkim@

Modified:
  head/sys/dev/drm2/drm_gem.c
  head/sys/dev/drm2/drm_irq.c
  head/sys/dev/drm2/ttm/ttm_bo.c
  head/sys/dev/drm2/ttm/ttm_bo_util.c
  head/sys/dev/drm2/ttm/ttm_bo_vm.c

Modified: head/sys/dev/drm2/drm_gem.c
==
--- head/sys/dev/drm2/drm_gem.c Sun Aug 25 15:33:17 2013(r254879)
+++ head/sys/dev/drm2/drm_gem.c Sun Aug 25 15:38:16 2013(r254880)
@@ -121,7 +121,7 @@ drm_gem_private_object_init(struct drm_d
obj-vm_obj = NULL;
 
obj-refcount = 1;
-   atomic_set(obj-handle_count, 0);
+   atomic_store_rel_int(obj-handle_count, 0);
obj-size = size;
 
return (0);

Modified: head/sys/dev/drm2/drm_irq.c
==
--- head/sys/dev/drm2/drm_irq.c Sun Aug 25 15:33:17 2013(r254879)
+++ head/sys/dev/drm2/drm_irq.c Sun Aug 25 15:38:16 2013(r254880)
@@ -786,7 +786,7 @@ int drm_vblank_get(struct drm_device *de
 
mtx_lock(dev-vbl_lock);
/* Going from 0-1 means we have to enable interrupts again */
-   if (atomic_fetchadd_int(dev-vblank_refcount[crtc], 1) == 0) {
+   if (atomic_add_return(1, dev-vblank_refcount[crtc]) == 1) {
mtx_lock(dev-vblank_time_lock);
if (!dev-vblank_enabled[crtc]) {
/* Enable vblank irqs under vblank_time_lock protection.
@@ -831,7 +831,7 @@ void drm_vblank_put(struct drm_device *d
(Too many drm_vblank_put for crtc %d, crtc));
 
/* Last user schedules interrupt disable */
-   if (atomic_fetchadd_int(dev-vblank_refcount[crtc], -1) == 1 
+   if (atomic_dec_and_test(dev-vblank_refcount[crtc]) 
(drm_vblank_offdelay  0))
callout_reset(dev-vblank_disable_callout,
(drm_vblank_offdelay * DRM_HZ) / 1000,

Modified: head/sys/dev/drm2/ttm/ttm_bo.c
==
--- head/sys/dev/drm2/ttm/ttm_bo.c  Sun Aug 25 15:33:17 2013
(r254879)
+++ head/sys/dev/drm2/ttm/ttm_bo.c  Sun Aug 25 15:38:16 2013
(r254880)
@@ -1723,7 +1723,8 @@ int ttm_bo_wait(struct ttm_buffer_object
if (driver-sync_obj_signaled(bo-sync_obj)) {
void *tmp_obj = bo-sync_obj;
bo-sync_obj = NULL;
-   clear_bit(TTM_BO_PRIV_FLAG_MOVING, bo-priv_flags);
+   atomic_clear_long(bo-priv_flags,
+ 1UL  TTM_BO_PRIV_FLAG_MOVING);
mtx_unlock(bdev-fence_lock);
driver-sync_obj_unref(tmp_obj);
mtx_lock(bdev-fence_lock);
@@ -1746,8 +1747,8 @@ int ttm_bo_wait(struct ttm_buffer_object
if (likely(bo-sync_obj == sync_obj)) {
void *tmp_obj = bo-sync_obj;
bo-sync_obj = NULL;
-   clear_bit(TTM_BO_PRIV_FLAG_MOVING,
- bo-priv_flags);
+   atomic_clear_long(bo-priv_flags,
+ 1UL  TTM_BO_PRIV_FLAG_MOVING);
mtx_unlock(bdev-fence_lock);
driver-sync_obj_unref(sync_obj);
driver-sync_obj_unref(tmp_obj);

Modified: head/sys/dev/drm2/ttm/ttm_bo_util.c
==
--- head/sys/dev/drm2/ttm/ttm_bo_util.c Sun Aug 25 15:33:17 2013
(r254879)
+++ head/sys/dev/drm2/ttm/ttm_bo_util.c Sun Aug 25 15:38:16 2013
(r254880)
@@ -637,7 +637,8 @@ int ttm_bo_move_accel_cleanup(struct ttm
 * operation has completed.
 */
 
-   set_bit(TTM_BO_PRIV_FLAG_MOVING, bo-priv_flags);
+   atomic_set_long(bo-priv_flags,
+   1UL  TTM_BO_PRIV_FLAG_MOVING);
mtx_unlock(bdev-fence_lock);
if (tmp_obj)
driver-sync_obj_unref(tmp_obj);

Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c
==
--- head/sys/dev/drm2/ttm/ttm_bo_vm.c   Sun Aug 25 15:33:17 2013
(r254879)
+++ head/sys/dev/drm2/ttm/ttm_bo_vm.c   Sun Aug 25 15:38:16 2013
(r254880)
@@ -153,7 +153,8 @@ reserve:
 */
 
mtx_lock(bdev-fence_lock);
-   if (test_bit(TTM_BO_PRIV_FLAG_MOVING, bo-priv_flags)) {
+   if ((atomic_load_acq_long(bo-priv_flags) 
+   (1UL  TTM_BO_PRIV_FLAG_MOVING)) != 0) {
/*
 * Here, the behavior differs between Linux and FreeBSD.
 *

svn commit: r254883 - head/sys/dev/pci

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 18:23:15 2013
New Revision: 254883
URL: http://svnweb.freebsd.org/changeset/base/254883

Log:
  vga_pci: Remove left-over debugging printf()'s

Modified:
  head/sys/dev/pci/vga_pci.c

Modified: head/sys/dev/pci/vga_pci.c
==
--- head/sys/dev/pci/vga_pci.c  Sun Aug 25 18:09:11 2013(r254882)
+++ head/sys/dev/pci/vga_pci.c  Sun Aug 25 18:23:15 2013(r254883)
@@ -105,13 +105,11 @@ vga_pci_map_bios(device_t dev, size_t *s
 * the original ROM may not be valid after boot.
 */
 
-   printf(%s: Mapping BIOS shadow\n, __func__);
*size = VGA_PCI_BIOS_SHADOW_SIZE;
return (pmap_mapbios(VGA_PCI_BIOS_SHADOW_ADDR, *size));
}
 #endif
 
-   printf(%s: Mapping PCI expansion ROM\n, __func__);
rid = PCIR_BIOS;
res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, rid, RF_ACTIVE);
if (res == NULL) {
@@ -135,7 +133,6 @@ vga_pci_unmap_bios(device_t dev, void *b
 #if defined(__amd64__) || defined(__i386__) || defined(__ia64__)
if (vga_pci_is_boot_display(dev)) {
/* We mapped the BIOS shadow copy located at 0xC. */
-   printf(%s: Unmapping BIOS shadow\n, __func__);
pmap_unmapdev((vm_offset_t)bios, VGA_PCI_BIOS_SHADOW_SIZE);
 
return;
@@ -151,7 +148,6 @@ vga_pci_unmap_bios(device_t dev, void *b
 * caller's reference.
 */
 
-   printf(%s: Unmapping PCI expansion ROM\n, __func__);
rid = PCIR_BIOS;
res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, rid, RF_ACTIVE);
 
___
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: r254887 - head/sys/sys

2013-08-25 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sun Aug 25 20:01:21 2013
New Revision: 254887
URL: http://svnweb.freebsd.org/changeset/base/254887

Log:
  Bump __FreeBSD_version to 151 after Radeon KMS driver import

Modified:
  head/sys/sys/param.h

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hSun Aug 25 19:39:31 2013(r254886)
+++ head/sys/sys/param.hSun Aug 25 20:01:21 2013(r254887)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 150  /* Master, propagated to newvers */
+#define __FreeBSD_version 151  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
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: r254888 - in head: sys/sys tools/regression/file/fcntlflags

2013-08-25 Thread Jilles Tjoelker
Author: jilles
Date: Sun Aug 25 21:52:04 2013
New Revision: 254888
URL: http://svnweb.freebsd.org/changeset/base/254888

Log:
  Fix fcntl F_GETFL F_SETFL for files opened execute-only (O_EXEC).
  
  The FFLAGS and OFLAGS now work correctly also for files opened with O_EXEC.
  Except possibly fuse, the other users pass values without O_EXEC set. fuse
  appears to assume O_EXEC is handled correctly.
  
  Although F_SETFL may not be commonly used for execute-only file descriptors,
  F_GETFL may be useful to find the access mode.

Added:
  head/tools/regression/file/fcntlflags/
  head/tools/regression/file/fcntlflags/Makefile   (contents, props changed)
  head/tools/regression/file/fcntlflags/fcntlflags.c   (contents, props changed)
  head/tools/regression/file/fcntlflags/fcntlflags.t   (contents, props changed)
Modified:
  head/sys/sys/fcntl.h

Modified: head/sys/sys/fcntl.h
==
--- head/sys/sys/fcntl.hSun Aug 25 20:01:21 2013(r254887)
+++ head/sys/sys/fcntl.hSun Aug 25 21:52:04 2013(r254888)
@@ -136,8 +136,8 @@ typedef __pid_t pid_t;
 
 #ifdef _KERNEL
 /* convert from open() flags to/from fflags; convert O_RD/WR to FREAD/FWRITE */
-#defineFFLAGS(oflags)  ((oflags) + 1)
-#defineOFLAGS(fflags)  ((fflags) - 1)
+#defineFFLAGS(oflags)  ((oflags)  O_EXEC ? (oflags) : (oflags) + 1)
+#defineOFLAGS(fflags)  ((fflags)  O_EXEC ? (fflags) : (fflags) - 1)
 
 /* bits to save after open */
 #defineFMASK   
(FREAD|FWRITE|FAPPEND|FASYNC|FFSYNC|FNONBLOCK|O_DIRECT|FEXEC)

Added: head/tools/regression/file/fcntlflags/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/file/fcntlflags/Makefile  Sun Aug 25 21:52:04 
2013(r254888)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+PROG=  fcntlflags
+MAN=
+WARNS?=6
+
+.include bsd.prog.mk

Added: head/tools/regression/file/fcntlflags/fcntlflags.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/file/fcntlflags/fcntlflags.c  Sun Aug 25 21:52:04 
2013(r254888)
@@ -0,0 +1,110 @@
+/*-
+ * Copyright (c) 2013 Jilles Tjoelker
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include sys/cdefs.h
+
+#include fcntl.h
+#include stdio.h
+#include unistd.h
+
+/*
+ * O_ACCMODE is currently defined incorrectly. This is what it should be.
+ * Various code depends on the incorrect value.
+ */
+#define CORRECT_O_ACCMODE (O_ACCMODE | O_EXEC)
+
+static int testnum;
+
+static void
+subtests(const char *path, int omode, const char *omodetext)
+{
+   int fd, flags1, flags2, flags3;
+
+   fd = open(path, omode);
+   if (fd == -1)
+   printf(not ok %d - open(\%s\, %s) failed\n,
+   testnum++, path, omodetext);
+   else
+   printf(ok %d - open(\%s\, %s) succeeded\n,
+   testnum++, path, omodetext);
+   flags1 = fcntl(fd, F_GETFL);
+   if (flags1 == -1)
+   printf(not ok %d - fcntl(F_GETFL) failed\n, testnum++);
+   else if ((flags1  CORRECT_O_ACCMODE) == omode)
+   printf(ok %d - fcntl(F_GETFL) gave correct result\n,
+   testnum++);
+   else
+   printf(not ok %d - fcntl(F_GETFL) gave incorrect result 
+   (%#x  %#x != %#x)\n,
+   testnum++, flags1, CORRECT_O_ACCMODE, omode);
+   if (fcntl(fd, F_SETFL, flags1) == -1)
+   

svn commit: r254889 - in head: cddl/lib/libdtrace sys/conf sys/netinet sys/netinet6

2013-08-25 Thread Mark Johnston
Author: markj
Date: Sun Aug 25 21:54:41 2013
New Revision: 254889
URL: http://svnweb.freebsd.org/changeset/base/254889

Log:
  Implement the ip, tcp, and udp DTrace providers. The probe definitions use
  dynamic translation so that their arguments match the definitions for
  these providers in Solaris and illumos. Thus, existing scripts for these
  providers should work unmodified on FreeBSD.
  
  Tested by:gnn, hiren
  MFC after:1 month

Added:
  head/cddl/lib/libdtrace/ip.d   (contents, props changed)
  head/cddl/lib/libdtrace/tcp.d   (contents, props changed)
  head/cddl/lib/libdtrace/udp.d   (contents, props changed)
  head/sys/netinet/in_kdtrace.c   (contents, props changed)
  head/sys/netinet/in_kdtrace.h   (contents, props changed)
Modified:
  head/cddl/lib/libdtrace/Makefile
  head/sys/conf/files
  head/sys/netinet/ip_fastfwd.c
  head/sys/netinet/ip_input.c
  head/sys/netinet/ip_output.c
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_output.c
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/tcp_syncache.c
  head/sys/netinet/tcp_usrreq.c
  head/sys/netinet/tcp_var.h
  head/sys/netinet/udp_usrreq.c
  head/sys/netinet/udp_var.h
  head/sys/netinet6/ip6_input.c
  head/sys/netinet6/ip6_mroute.c
  head/sys/netinet6/nd6.c
  head/sys/netinet6/send.c
  head/sys/netinet6/udp6_usrreq.c

Modified: head/cddl/lib/libdtrace/Makefile
==
--- head/cddl/lib/libdtrace/MakefileSun Aug 25 21:52:04 2013
(r254888)
+++ head/cddl/lib/libdtrace/MakefileSun Aug 25 21:54:41 2013
(r254889)
@@ -48,8 +48,11 @@ SRCS=dt_aggregate.c \
 
 DSRCS= errno.d \
io.d\
+   ip.d\
psinfo.d\
signal.d\
+   tcp.d   \
+   udp.d   \
unistd.d
 
 WARNS?=1

Added: head/cddl/lib/libdtrace/ip.d
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/cddl/lib/libdtrace/ip.dSun Aug 25 21:54:41 2013
(r254889)
@@ -0,0 +1,285 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the License).
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets [] replaced with your own identifying
+ * information: Portions Copyright [] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ * $FreeBSD$
+ */
+/*
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013 Mark Johnston ma...@freebsd.org
+ */
+
+#pragma D depends_on provider ip
+
+/*
+ * pktinfo is where packet ID info can be made available for deeper
+ * analysis if packet IDs become supported by the kernel in the future.
+ * The pkt_addr member is currently always NULL.
+ */
+typedef struct pktinfo {
+   uintptr_t pkt_addr;
+} pktinfo_t;
+
+/*
+ * csinfo is where connection state info is made available.
+ */
+typedef uint32_t zoneid_t;
+typedef struct csinfo {
+   uintptr_t cs_addr;
+   uint64_t cs_cid;
+   pid_t cs_pid;
+   zoneid_t cs_zoneid;
+} csinfo_t;
+
+/*
+ * ipinfo contains common IP info for both IPv4 and IPv6.
+ */
+typedef struct ipinfo {
+   uint8_t ip_ver; /* IP version (4, 6) */
+   uint32_t ip_plength;/* payload length */
+   string ip_saddr;/* source address */
+   string ip_daddr;/* destination address */
+} ipinfo_t;
+
+/*
+ * ifinfo contains network interface info.
+ */
+typedef struct ifinfo {
+   string if_name; /* interface name */
+   int8_t if_local;/* is delivered locally */
+   /*netstackid_t if_ipstack;*//* ipstack ID */
+   uintptr_t if_addr;  /* pointer to raw ill_t */
+} ifinfo_t;
+
+typedef uint32_t ipaddr_t;
+typedef struct {
+   uint8_t ipha_version_and_hdr_length;
+   uint8_t ipha_type_of_service;
+   uint16_tipha_length;
+   uint16_tipha_ident;
+   uint16_tipha_fragment_offset_and_flags;
+   uint8_t ipha_ttl;
+   uint8_t ipha_protocol;
+   uint16_tipha_hdr_checksum;
+   ipaddr_tipha_src;
+   ipaddr_t   

Re: svn commit: r254585 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2013-08-25 Thread Jeremie Le Hen
Hi Xin,

On Tue, Aug 20, 2013 at 10:31:14PM +, Xin LI wrote:
 Author: delphij
 Date: Tue Aug 20 22:31:13 2013
 New Revision: 254585
 URL: http://svnweb.freebsd.org/changeset/base/254585
 
 Log:
   MFV r254220:
   
   Illumos ZFS issues:
 4039 zfs_rename()/zfs_link() needs stronger test for XDEV
 
 Modified:
   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
 Directory Properties:
   head/sys/cddl/contrib/opensolaris/   (props changed)
 
 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
 ==
 --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c   Tue Aug 
 20 21:47:07 2013(r254584)
 +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c   Tue Aug 
 20 22:31:13 2013(r254585)
 @@ -21,6 +21,7 @@
  /*
   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights 
 reserved.
   * Copyright (c) 2013 by Delphix. All rights reserved.
 + * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
   */
  
  /* Portions Copyright 2007 Jeremy Teo */
 @@ -3727,13 +3728,18 @@ zfs_rename(vnode_t *sdvp, char *snm, vno
   if (VOP_REALVP(tdvp, realvp, ct) == 0)
   tdvp = realvp;
  
 - if (tdvp-v_vfsp != sdvp-v_vfsp || zfsctl_is_node(tdvp)) {
 + tdzp = VTOZ(tdvp);
 + ZFS_VERIFY_ZP(tdzp);
 +
 + /*
 +  * We check z_zfsvfs rather than v_vfsp here, because snapshots and the
 +  * ctldir appear to have the same v_vfsp.
 +  */
 + if (tdzp-z_zfsvfs != zfsvfs || zfsctl_is_node(tdvp)) {
   ZFS_EXIT(zfsvfs);
   return (SET_ERROR(EXDEV));
   }
  
 - tdzp = VTOZ(tdvp);
 - ZFS_VERIFY_ZP(tdzp);
   if (zfsvfs-z_utf8  u8_validate(tnm,
   strlen(tnm), NULL, U8_VALIDATE_ENTIRE, error)  0) {
   ZFS_EXIT(zfsvfs);
 @@ -4293,14 +4299,18 @@ zfs_link(vnode_t *tdvp, vnode_t *svp, ch
   return (SET_ERROR(EPERM));
   }
  
 - if (svp-v_vfsp != tdvp-v_vfsp || zfsctl_is_node(svp)) {
 + szp = VTOZ(svp);
 + ZFS_VERIFY_ZP(szp);
 +
 + /*
 +  * We check z_zfsvfs rather than v_vfsp here, because snapshots and the
 +  * ctldir appear to have the same v_vfsp.
 +  */
 + if (szp-z_zfsvfs != zfsvfs || zfsctl_is_node(svp)) {
   ZFS_EXIT(zfsvfs);
   return (SET_ERROR(EXDEV));
   }
  
 - szp = VTOZ(svp);
 - ZFS_VERIFY_ZP(szp);
 -
   /* Prevent links to .zfs/shares files */
  
   if ((error = sa_lookup(szp-z_sa_hdl, SA_ZPL_PARENT(zfsvfs),


I suspect this leads to a panic on my -CURRENT machine:


#1  0x8033a664 in db_fncall_generic (addr=-2138557936,
rv=0xfe00e5a30c90, nargs=0, args=0xfe00e5a30ca0)
at /usr/src/sys/ddb/db_command.c:578
#2  0x8033a34a in db_fncall (dummy1=-2138210939, dummy2=0, dummy3=-1,
dummy4=0xfe00e5a30d80 ) at /usr/src/sys/ddb/db_command.c:630
#3  0x80339fe1 in db_command (last_cmdp=0x812b7850,
cmd_table=0x0, dopager=0) at /usr/src/sys/ddb/db_command.c:449
#4  0x8033a0c2 in db_command_script (
command=0x812b8754 call doadump)
at /usr/src/sys/ddb/db_command.c:520
#5  0x80340b09 in db_script_exec (
scriptname=0xfe00e5a30f50 kdb.enter.panic, warnifnotfound=0)
at /usr/src/sys/ddb/db_script.c:302
#6  0x8034096c in db_script_kdbenter (
eventname=0x80f7cd55 panic) at /usr/src/sys/ddb/db_script.c:324
#7  0x8033dee1 in db_trap (type=3, code=0)
at /usr/src/sys/ddb/db_main.c:230
#8  0x808d84b6 in kdb_trap (type=3, code=0, tf=0xfe00e5a31390)
at /usr/src/sys/kern/subr_kdb.c:654
#9  0x80dbc22a in trap (frame=0xfe00e5a31390)
at /usr/src/sys/amd64/amd64/trap.c:579
#10 0x80d99282 in calltrap ()
at /usr/src/sys/amd64/amd64/exception.S:232
#11 0x808d7d85 in breakpoint () at cpufunc.h:63
#12 0x808d79eb in kdb_enter (why=0x80f7cd55 panic,
msg=0x80f7cd55 panic) at /usr/src/sys/kern/subr_kdb.c:445
#13 0x808838b3 in vpanic (
fmt=0x81b05389 solaris assert: %s, file: %s, line: %d,
ap=0xfe00e5a31530) at /usr/src/sys/kern/kern_shutdown.c:747
#14 0x80883960 in panic (
fmt=0x81b05389 solaris assert: %s, file: %s, line: %d)
at /usr/src/sys/kern/kern_shutdown.c:683
#15 0x81b0443c in assfail (
a=0x819ab3cc zp == NULL || zp-z_vnode == NULL || zp-z_vnode == 
vp,
f=0x819ab403 
/usr/src/sys/modules/zfs/../../cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h,
 l=248)
at 
/usr/src/sys/modules/opensolaris/../../cddl/compat/opensolaris/kern/opensolaris_cmn_err.c:81
#16 0x8191b111 in VTOZ (vp=0xf800967f5b10) at zfs_znode.h:248
#17 0x8192372c in zfs_rename (sdvp=0xf800911bf3b0,
snm=0xf80004a9d806 patchoHq2mGI, tdvp=0xf800967f5b10,
tnm=0xf8000451780f periodic.conf.5, 

svn commit: r254893 - head/sys/netinet

2013-08-25 Thread Mark Johnston
Author: markj
Date: Mon Aug 26 00:28:57 2013
New Revision: 254893
URL: http://svnweb.freebsd.org/changeset/base/254893

Log:
  The second last argument of udp:::receive is supposed to contain the
  connection state, not the IP header.
  
  X-MFC with:   r254889

Modified:
  head/sys/netinet/udp_usrreq.c

Modified: head/sys/netinet/udp_usrreq.c
==
--- head/sys/netinet/udp_usrreq.c   Sun Aug 25 23:26:43 2013
(r254892)
+++ head/sys/netinet/udp_usrreq.c   Mon Aug 26 00:28:57 2013
(r254893)
@@ -620,7 +620,7 @@ udp_input(struct mbuf *m, int off)
return;
}
 
-   UDP_PROBE(receive, NULL, inp, ip, ip, uh);
+   UDP_PROBE(receive, NULL, inp, ip, inp, uh);
udp_append(inp, ip, m, iphlen, udp_in);
INP_RUNLOCK(inp);
return;
___
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