svn commit: r287497 - in head/sys: kern sys

2015-09-05 Thread Kirk McKusick
Author: mckusick
Date: Sun Sep  6 05:50:51 2015
New Revision: 287497
URL: https://svnweb.freebsd.org/changeset/base/287497

Log:
  Track changes to kern.maxvnodes and appropriately increase or decrease
  the size of the name cache hash table (mapping file names to vnodes)
  and the vnode hash table (mapping mount point and inode number to vnode).
  An appropriate locking strategy is the key to changing hash table sizes
  while they are in active use.
  
  Reviewed by: kib
  Tested by:   Peter Holm
  Differential Revision: https://reviews.freebsd.org/D2265
  MFC after:   2 weeks

Modified:
  head/sys/kern/vfs_cache.c
  head/sys/kern/vfs_hash.c
  head/sys/kern/vfs_subr.c
  head/sys/sys/vnode.h

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Sat Sep  5 23:22:59 2015(r287496)
+++ head/sys/kern/vfs_cache.c   Sun Sep  6 05:50:51 2015(r287497)
@@ -327,11 +327,17 @@ sysctl_debug_hashstat_rawnchash(SYSCTL_H
struct namecache *ncp;
int i, error, n_nchash, *cntbuf;
 
+retry:
n_nchash = nchash + 1;  /* nchash is max index, not count */
if (req->oldptr == NULL)
return SYSCTL_OUT(req, 0, n_nchash * sizeof(int));
cntbuf = malloc(n_nchash * sizeof(int), M_TEMP, M_ZERO | M_WAITOK);
CACHE_RLOCK();
+   if (n_nchash != nchash + 1) {
+   CACHE_RUNLOCK();
+   free(cntbuf, M_TEMP);
+   goto retry;
+   }
/* Scan hash tables counting entries */
for (ncpp = nchashtbl, i = 0; i < n_nchash; ncpp++, i++)
LIST_FOREACH(ncp, ncpp, nc_hash)
@@ -930,6 +936,44 @@ nchinit(void *dummy __unused)
 }
 SYSINIT(vfs, SI_SUB_VFS, SI_ORDER_SECOND, nchinit, NULL);
 
+void
+cache_changesize(int newmaxvnodes)
+{
+   struct nchashhead *new_nchashtbl, *old_nchashtbl;
+   u_long new_nchash, old_nchash;
+   struct namecache *ncp;
+   uint32_t hash;
+   int i;
+
+   new_nchashtbl = hashinit(newmaxvnodes * 2, M_VFSCACHE, &new_nchash);
+   /* If same hash table size, nothing to do */
+   if (nchash == new_nchash) {
+   free(new_nchashtbl, M_VFSCACHE);
+   return;
+   }
+   /*
+* Move everything from the old hash table to the new table.
+* None of the namecache entries in the table can be removed
+* because to do so, they have to be removed from the hash table.
+*/
+   CACHE_WLOCK();
+   old_nchashtbl = nchashtbl;
+   old_nchash = nchash;
+   nchashtbl = new_nchashtbl;
+   nchash = new_nchash;
+   for (i = 0; i <= old_nchash; i++) {
+   while ((ncp = LIST_FIRST(&old_nchashtbl[i])) != NULL) {
+   hash = fnv_32_buf(nc_get_name(ncp), ncp->nc_nlen,
+   FNV1_32_INIT);
+   hash = fnv_32_buf(&ncp->nc_dvp, sizeof(ncp->nc_dvp),
+   hash);
+   LIST_REMOVE(ncp, nc_hash);
+   LIST_INSERT_HEAD(NCHHASH(hash), ncp, nc_hash);
+   }
+   }
+   CACHE_WUNLOCK();
+   free(old_nchashtbl, M_VFSCACHE);
+}
 
 /*
  * Invalidate all entries to a particular vnode.

Modified: head/sys/kern/vfs_hash.c
==
--- head/sys/kern/vfs_hash.cSat Sep  5 23:22:59 2015(r287496)
+++ head/sys/kern/vfs_hash.cSun Sep  6 05:50:51 2015(r287497)
@@ -161,3 +161,40 @@ vfs_hash_rehash(struct vnode *vp, u_int 
vp->v_hash = hash;
rw_wunlock(&vfs_hash_lock);
 }
+
+void
+vfs_hash_changesize(int newmaxvnodes)
+{
+   struct vfs_hash_head *vfs_hash_newtbl, *vfs_hash_oldtbl;
+   u_long vfs_hash_newmask, vfs_hash_oldmask;
+   struct vnode *vp;
+   int i;
+
+   vfs_hash_newtbl = hashinit(newmaxvnodes, M_VFS_HASH,
+   &vfs_hash_newmask);
+   /* If same hash table size, nothing to do */
+   if (vfs_hash_mask == vfs_hash_newmask) {
+   free(vfs_hash_newtbl, M_VFS_HASH);
+   return;
+   }
+   /*
+* Move everything from the old hash table to the new table.
+* None of the vnodes in the table can be recycled because to
+* do so, they have to be removed from the hash table.
+*/
+   rw_wlock(&vfs_hash_lock);
+   vfs_hash_oldtbl = vfs_hash_tbl;
+   vfs_hash_oldmask = vfs_hash_mask;
+   vfs_hash_tbl = vfs_hash_newtbl;
+   vfs_hash_mask = vfs_hash_newmask;
+   for (i = 0; i <= vfs_hash_oldmask; i++) {
+   while ((vp = LIST_FIRST(&vfs_hash_oldtbl[i])) != NULL) {
+   LIST_REMOVE(vp, v_hashlist);
+   LIST_INSERT_HEAD(
+   vfs_hash_bucket(vp->v_mount, vp->v_hash),
+   vp, v_hashlist);
+   }
+   }
+   rw_wunlock(&vfs_hash_lock);
+   free(vfs_hash_old

svn commit: r287496 - head/sys/dev/drm2/i915

2015-09-05 Thread Baptiste Daroussin
Author: bapt
Date: Sat Sep  5 23:22:59 2015
New Revision: 287496
URL: https://svnweb.freebsd.org/changeset/base/287496

Log:
  Reduce diff with linux 3.8.13 on i915 headers

Modified:
  head/sys/dev/drm2/i915/intel_drv.h
  head/sys/dev/drm2/i915/intel_ringbuffer.h
  head/sys/dev/drm2/i915/intel_sdvo_regs.h

Modified: head/sys/dev/drm2/i915/intel_drv.h
==
--- head/sys/dev/drm2/i915/intel_drv.h  Sat Sep  5 22:54:02 2015
(r287495)
+++ head/sys/dev/drm2/i915/intel_drv.h  Sat Sep  5 23:22:59 2015
(r287496)
@@ -73,6 +73,10 @@
 #define KHz(x) (1000*x)
 #define MHz(x) KHz(1000*x)
 
+/*
+ * Display related stuff
+ */
+
 /* store information about an Ixxx DVO */
 /* The i830->i865 use multiple DVOs with multiple i2cs */
 /* the i915, i945 have a single sDVO i2c bus - which is different */
@@ -94,6 +98,7 @@
 #define INTEL_OUTPUT_HDMI 6
 #define INTEL_OUTPUT_DISPLAYPORT 7
 #define INTEL_OUTPUT_EDP 8
+#define INTEL_OUTPUT_UNKNOWN 9
 
 /* Intel Pipe Clone Bit */
 #define INTEL_HDMIB_CLONE_BIT 1

Modified: head/sys/dev/drm2/i915/intel_ringbuffer.h
==
--- head/sys/dev/drm2/i915/intel_ringbuffer.h   Sat Sep  5 22:54:02 2015
(r287495)
+++ head/sys/dev/drm2/i915/intel_ringbuffer.h   Sat Sep  5 23:22:59 2015
(r287496)
@@ -5,6 +5,17 @@
 #ifndef _INTEL_RINGBUFFER_H_
 #define _INTEL_RINGBUFFER_H_
 
+/*
+ * Gen2 BSpec "1. Programming Environment" / 1.4.4.6 "Ring Buffer Use"
+ * Gen3 BSpec "vol1c Memory Interface Functions" / 2.3.4.5 "Ring Buffer Use"
+ * Gen4+ BSpec "vol1c Memory Interface and Command Stream" / 5.3.4.5 "Ring 
Buffer Use"
+ *
+ * "If the Ring Buffer Head Pointer and the Tail Pointer are on the same
+ * cacheline, the Head Pointer must not be greater than the Tail
+ * Pointer."
+ */
+#define I915_RING_FREE_SPACE 64
+
 struct  intel_hw_status_page {
u32 *page_addr;
unsigned intgfx_addr;
@@ -60,7 +71,7 @@ struct  intel_ring_buffer {
 */
u32 last_retired_head;
 
-   u32 irq_refcount;
+   u32 irq_refcount;   /* protected by 
dev_priv->irq_lock */
u32 irq_enable_mask;/* bitmask to enable ring 
interrupt */
u32 trace_irq_seqno;
u32 sync_seqno[I915_NUM_RINGS-1];
@@ -79,14 +90,15 @@ struct  intel_ring_buffer {
uint32_t(*get_seqno)(struct intel_ring_buffer *ring);
int (*dispatch_execbuffer)(struct intel_ring_buffer *ring,
   uint32_t offset, uint32_t 
length);
+#define I915_DISPATCH_SECURE 0x1
+#define I915_DISPATCH_PINNED 0x2
void(*cleanup)(struct intel_ring_buffer *ring);
int (*sync_to)(struct intel_ring_buffer *ring,
   struct intel_ring_buffer *to,
   u32 seqno);
- 
+
u32 semaphore_register[3]; /*our mbox written by others */
u32 signal_mbox[2]; /* mboxes this ring signals to */
-
/**
 * List of objects currently involved in rendering from the
 * ringbuffer.
@@ -162,10 +174,10 @@ intel_ring_sync_index(struct intel_ring_
return idx;
 }
 
-static inline uint32_t
-intel_read_status_page(struct intel_ring_buffer *ring, int reg)
+static inline u32
+intel_read_status_page(struct intel_ring_buffer *ring,
+  int reg)
 {
-
/* Ensure that the compiler doesn't optimize away the load. */
__compiler_membar();
return (atomic_load_acq_32(ring->status_page.page_addr + reg));
@@ -183,7 +195,7 @@ static inline int intel_wait_ring_idle(s
 int intel_ring_begin(struct intel_ring_buffer *ring, int n);
 
 static inline void intel_ring_emit(struct intel_ring_buffer *ring,
-  uint32_t data)
+  u32 data)
 {
*(volatile uint32_t *)((char *)ring->virtual_start +
ring->tail) = data;

Modified: head/sys/dev/drm2/i915/intel_sdvo_regs.h
==
--- head/sys/dev/drm2/i915/intel_sdvo_regs.hSat Sep  5 22:54:02 2015
(r287495)
+++ head/sys/dev/drm2/i915/intel_sdvo_regs.hSat Sep  5 23:22:59 2015
(r287496)
@@ -63,6 +63,11 @@ struct intel_sdvo_caps {
u16 output_flags;
 } __attribute__((packed));
 
+/* Note: SDVO detailed timing flags match EDID misc flags. */
+#define DTD_FLAG_HSYNC_POSITIVE (1 << 1)
+#define DTD_FLAG_VSYNC_POSITIVE (1 << 2)
+#define DTD_FLAG_INTERLACE (1 << 7)
+
 /** This matches the EDID DTD structure, more or less */
 struct intel_sdvo_dtd {
struct {
@@ -705,6 +710,8 @@ struct intel_sdvo_enhancements_arg {
 #define SDVO_CMD_SET_AUDIO_STAT0x91
 #define SDVO_CMD_GET_AUDIO_STAT

svn commit: r287494 - head/usr.sbin/sesutil

2015-09-05 Thread Baptiste Daroussin
Author: bapt
Date: Sat Sep  5 22:33:40 2015
New Revision: 287494
URL: https://svnweb.freebsd.org/changeset/base/287494

Log:
  Yet another fix for gcc 4.2

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

Modified: head/usr.sbin/sesutil/sesutil.c
==
--- head/usr.sbin/sesutil/sesutil.c Sat Sep  5 21:55:01 2015
(r287493)
+++ head/usr.sbin/sesutil/sesutil.c Sat Sep  5 22:33:40 2015
(r287494)
@@ -83,13 +83,13 @@ do_locate(int fd, unsigned int idx, bool
 static bool
 disk_match(const char *devnames, const char *disk, size_t len)
 {
-   const char *devname;
+   const char *dname;
 
-   devname = devnames;
-   while ((devname = strstr(devname, disk)) != NULL) {
-   if (devname[len] == '\0' || devname[len] == ',')
+   dname = devnames;
+   while ((dname = strstr(dname, disk)) != NULL) {
+   if (dname[len] == '\0' || dname[len] == ',')
return (true);
-   devname++;
+   dname++;
}
return (false);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287493 - head/usr.sbin/sesutil

2015-09-05 Thread Baptiste Daroussin
Author: bapt
Date: Sat Sep  5 21:55:01 2015
New Revision: 287493
URL: https://svnweb.freebsd.org/changeset/base/287493

Log:
  Remove extra i++
  
  Reported by:  allanjude@

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

Modified: head/usr.sbin/sesutil/sesutil.c
==
--- head/usr.sbin/sesutil/sesutil.c Sat Sep  5 21:12:19 2015
(r287492)
+++ head/usr.sbin/sesutil/sesutil.c Sat Sep  5 21:55:01 2015
(r287493)
@@ -175,7 +175,6 @@ locate(int argc, char **argv)
}
}   
close(fd);
-   i++;
}
globfree(&g);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287492 - head/sys/dev/e1000

2015-09-05 Thread Sean Bruno
Author: sbruno
Date: Sat Sep  5 21:12:19 2015
New Revision: 287492
URL: https://svnweb.freebsd.org/changeset/base/287492

Log:
  Revert last two commits to em(4)/igb(4).  Reports are coming in that
  this breaks initialization and reads from EEPROM on boot/driver load.
  
  r287469 is being reverted as a dependancy on r287467

Modified:
  head/sys/dev/e1000/e1000_80003es2lan.c
  head/sys/dev/e1000/e1000_82540.c
  head/sys/dev/e1000/e1000_82541.c
  head/sys/dev/e1000/e1000_82542.c
  head/sys/dev/e1000/e1000_82543.c
  head/sys/dev/e1000/e1000_82571.h
  head/sys/dev/e1000/e1000_82575.c
  head/sys/dev/e1000/e1000_82575.h
  head/sys/dev/e1000/e1000_api.c
  head/sys/dev/e1000/e1000_api.h
  head/sys/dev/e1000/e1000_defines.h
  head/sys/dev/e1000/e1000_hw.h
  head/sys/dev/e1000/e1000_i210.c
  head/sys/dev/e1000/e1000_i210.h
  head/sys/dev/e1000/e1000_ich8lan.c
  head/sys/dev/e1000/e1000_ich8lan.h
  head/sys/dev/e1000/e1000_mac.c
  head/sys/dev/e1000/e1000_mac.h
  head/sys/dev/e1000/e1000_nvm.c
  head/sys/dev/e1000/e1000_nvm.h
  head/sys/dev/e1000/e1000_osdep.h
  head/sys/dev/e1000/e1000_phy.c
  head/sys/dev/e1000/e1000_regs.h
  head/sys/dev/e1000/if_em.c
  head/sys/dev/e1000/if_em.h
  head/sys/dev/e1000/if_igb.c

Modified: head/sys/dev/e1000/e1000_80003es2lan.c
==
--- head/sys/dev/e1000/e1000_80003es2lan.c  Sat Sep  5 19:28:41 2015
(r287491)
+++ head/sys/dev/e1000/e1000_80003es2lan.c  Sat Sep  5 21:12:19 2015
(r287492)
@@ -851,17 +851,11 @@ static s32 e1000_reset_hw_80003es2lan(st
e1000_release_phy_80003es2lan(hw);
 
/* Disable IBIST slave mode (far-end loopback) */
-   ret_val = e1000_read_kmrn_reg_80003es2lan(hw,
-   E1000_KMRNCTRLSTA_INBAND_PARAM, &kum_reg_data);
-   if (!ret_val) {
-   kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE;
-   ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
-E1000_KMRNCTRLSTA_INBAND_PARAM,
-kum_reg_data);
-   if (ret_val)
-   DEBUGOUT("Error disabling far-end loopback\n");
-   } else
-   DEBUGOUT("Error disabling far-end loopback\n");
+   e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
+   &kum_reg_data);
+   kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE;
+   e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
+   kum_reg_data);
 
ret_val = e1000_get_auto_rd_done_generic(hw);
if (ret_val)
@@ -917,18 +911,11 @@ static s32 e1000_init_hw_80003es2lan(str
return ret_val;
 
/* Disable IBIST slave mode (far-end loopback) */
-   ret_val =
-   e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
-   &kum_reg_data);
-   if (!ret_val) {
-   kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE;
-   ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
-E1000_KMRNCTRLSTA_INBAND_PARAM,
-kum_reg_data);
-   if (ret_val)
-   DEBUGOUT("Error disabling far-end loopback\n");
-   } else
-   DEBUGOUT("Error disabling far-end loopback\n");
+   e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
+   &kum_reg_data);
+   kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE;
+   e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
+kum_reg_data);
 
/* Set the transmit descriptor write-back policy */
reg_data = E1000_READ_REG(hw, E1000_TXDCTL(0));

Modified: head/sys/dev/e1000/e1000_82540.c
==
--- head/sys/dev/e1000/e1000_82540.cSat Sep  5 19:28:41 2015
(r287491)
+++ head/sys/dev/e1000/e1000_82540.cSat Sep  5 21:12:19 2015
(r287492)
@@ -66,7 +66,7 @@ static s32  e1000_read_mac_addr_82540(st
 static s32 e1000_init_phy_params_82540(struct e1000_hw *hw)
 {
struct e1000_phy_info *phy = &hw->phy;
-   s32 ret_val;
+   s32 ret_val = E1000_SUCCESS;
 
phy->addr   = 1;
phy->autoneg_mask   = AUTONEG_ADVERTISE_SPEED_DEFAULT;
@@ -329,7 +329,7 @@ static s32 e1000_init_hw_82540(struct e1
 {
struct e1000_mac_info *mac = &hw->mac;
u32 txdctl, ctrl_ext;
-   s32 ret_val;
+   s32 ret_val = E1000_SUCCESS;
u16 i;
 
DEBUGFUNC("e1000_init_hw_82540");
@@ -411,7 +411,7 @@ static s32 e1000_init_hw_82540(struct e1
 static s32 e1000_setup_copper_link_82540(struct e1000_hw *hw)
 {
u32 ctrl;
-   s32 ret_val;
+   s32 

svn commit: r287491 - head/usr.bin/procstat

2015-09-05 Thread Allan Jude
Author: allanjude
Date: Sat Sep  5 19:28:41 2015
New Revision: 287491
URL: https://svnweb.freebsd.org/changeset/base/287491

Log:
  Fix build error on gcc platforms
  
  Approved by:  bapt (mentor)

Modified:
  head/usr.bin/procstat/procstat_kstack.c

Modified: head/usr.bin/procstat/procstat_kstack.c
==
--- head/usr.bin/procstat/procstat_kstack.c Sat Sep  5 18:36:23 2015
(r287490)
+++ head/usr.bin/procstat/procstat_kstack.c Sat Sep  5 19:28:41 2015
(r287491)
@@ -131,6 +131,7 @@ kstack_cleanup_encoded(const char *old, 
cp_new++;
}
}
+   *cp_new = '\0';
cp_tofree = cp_loop = strdup(new);
} else
cp_tofree = cp_loop = strdup(old);
@@ -138,7 +139,6 @@ kstack_cleanup_encoded(const char *old, 
if (strlen(cp_line) != 0 && *cp_line != 127)
xo_emit("{le:token/%s}", cp_line);
}
-   *cp_new = '\0';
free(cp_tofree);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287489 - head/sys/boot/efi/loader/arch/amd64

2015-09-05 Thread Marcel Moolenaar
Author: marcel
Date: Sat Sep  5 18:24:51 2015
New Revision: 287489
URL: https://svnweb.freebsd.org/changeset/base/287489

Log:
  Auto-detect the UGA frame buffer and stride on a MacBook. We're
  striking a delicate balance between exhaustive searching and
  banking on assumptions. The environment variables can be used
  as a fall-back anyway. With this change, all known and tested
  Macs with only UGA should have a working console out of the
  box... for now...

Modified:
  head/sys/boot/efi/loader/arch/amd64/framebuffer.c

Modified: head/sys/boot/efi/loader/arch/amd64/framebuffer.c
==
--- head/sys/boot/efi/loader/arch/amd64/framebuffer.c   Sat Sep  5 17:34:49 
2015(r287488)
+++ head/sys/boot/efi/loader/arch/amd64/framebuffer.c   Sat Sep  5 18:24:51 
2015(r287489)
@@ -175,7 +175,7 @@ efifb_uga_find_pixel(EFI_UGA_DRAW_PROTOC
ofs += count;
size -= count;
}
-   printf("Couldn't find the pixel");
+   printf("No change detected in frame buffer");
 
  fail:
printf(" -- error %lu\n", status & ~EFI_ERROR_MASK);
@@ -218,18 +218,20 @@ efifb_uga_get_pciio(void)
 }
 
 static EFI_STATUS
-efifb_uga_detect_framebuffer(EFI_UGA_DRAW_PROTOCOL *uga,
-EFI_PCI_IO_PROTOCOL *pciio, uint64_t *addrp, uint64_t *sizep)
+efifb_uga_locate_framebuffer(EFI_PCI_IO_PROTOCOL *pciio, uint64_t *addrp,
+uint64_t *sizep)
 {
uint8_t *resattr;
-   uint64_t a, addr, s, size;
-   ssize_t ofs;
+   uint64_t addr, size;
EFI_STATUS status;
u_int bar;
 
+   if (pciio == NULL)
+   return (EFI_DEVICE_ERROR);
+
/* Attempt to get the frame buffer address (imprecise). */
-   addr = 0;
-   size = 0;
+   *addrp = 0;
+   *sizep = 0;
for (bar = 0; bar < 6; bar++) {
status = pciio->GetBarAttributes(pciio, bar, NULL,
(void **)&resattr);
@@ -238,43 +240,27 @@ efifb_uga_detect_framebuffer(EFI_UGA_DRA
/* XXX magic offsets and constants. */
if (resattr[0] == 0x87 && resattr[3] == 0) {
/* 32-bit address space descriptor (MEMIO) */
-   a = le32dec(resattr + 10);
-   s = le32dec(resattr + 22);
+   addr = le32dec(resattr + 10);
+   size = le32dec(resattr + 22);
} else if (resattr[0] == 0x8a && resattr[3] == 0) {
/* 64-bit address space descriptor (MEMIO) */
-   a = le64dec(resattr + 14);
-   s = le64dec(resattr + 38);
+   addr = le64dec(resattr + 14);
+   size = le64dec(resattr + 38);
} else {
-   a = 0;
-   s = 0;
+   addr = 0;
+   size = 0;
}
BS->FreePool(resattr);
-   if (a == 0 || s == 0)
+   if (addr == 0 || size == 0)
continue;
 
/* We assume the largest BAR is the frame buffer. */
-   if (s > size) {
-   addr = a;
-   size = s;
+   if (size > *sizep) {
+   *addrp = addr;
+   *sizep = size;
}
}
-   if (addr == 0 || size == 0)
-   return (EFI_DEVICE_ERROR);
-
-   /*
-* The visible part of the frame buffer may not start at offset
-* 0, so try to detect it.
-*/
-   ofs = efifb_uga_find_pixel(uga, 0, pciio, addr, size);
-   if (ofs == -1)
-   return (EFI_NO_RESPONSE);
-
-   addr += ofs;
-   size -= ofs;
-
-   *addrp = addr;
-   *sizep = size;
-   return (0);
+   return ((*addrp == 0 || *sizep == 0) ? EFI_DEVICE_ERROR : 0);
 }
 
 static int
@@ -284,29 +270,75 @@ efifb_from_uga(struct efi_fb *efifb, EFI
char *ev, *p;
EFI_STATUS status;
ssize_t ofs;
-   uint32_t horiz, vert, depth, refresh;
+   uint32_t np, horiz, vert, depth, refresh;
 
status = uga->GetMode(uga, &horiz, &vert, &depth, &refresh);
if (EFI_ERROR(status))
return (1);
efifb->fb_height = vert;
efifb->fb_width = horiz;
+   /* Paranoia... */
+   if (efifb->fb_height == 0 || efifb->fb_width == 0)
+   return (1);
+
+   /* The color masks are fixed AFAICT. */
efifb_mask_from_pixfmt(efifb, PixelBlueGreenRedReserved8BitPerColor,
NULL);
 
+   /*
+* The stride is equal or larger to the width. Often it's the
+* next larger power of two. We'll start with that...
+*/
+   efifb->fb_stride = efifb->fb_width;
+   do {
+   np = efifb->fb_stride & (efifb->fb_stride - 1);
+   if (np) {
+   efifb->fb_strid

svn commit: r287488 - head/sys/vm

2015-09-05 Thread Alan Cox
Author: alc
Date: Sat Sep  5 17:34:49 2015
New Revision: 287488
URL: https://svnweb.freebsd.org/changeset/base/287488

Log:
  Eliminate pointless requeueing of pages from terminated objects.  These
  pages will have left the inactive queue before the page daemon performs
  its next scan.  Also, ignore references to pages from terminated objects.
  This allows the clean pages to be freed a little sooner.
  
  Move some comments to their proper place, i.e., next to the code that
  they describe, and update other nearby comments.
  
  Reviewed by:  kib
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==
--- head/sys/vm/vm_pageout.cSat Sep  5 17:29:07 2015(r287487)
+++ head/sys/vm/vm_pageout.cSat Sep  5 17:34:49 2015(r287488)
@@ -1186,13 +1186,9 @@ unlock_page:
}
 
/*
-* We bump the activation count if the page has been
-* referenced while in the inactive queue.  This makes
-* it less likely that the page will be added back to the
-* inactive queue prematurely again.  Here we check the 
-* page tables (or emulated bits, if any), given the upper 
-* level VM system not knowing anything about existing 
-* references.
+* If the page has been referenced and the object is not dead,
+* reactivate or requeue the page depending on whether the
+* object is mapped.
 */
if ((m->aflags & PGA_REFERENCED) != 0) {
vm_page_aflag_clear(m, PGA_REFERENCED);
@@ -1205,21 +1201,25 @@ unlock_page:
KASSERT(!pmap_page_is_mapped(m),
("vm_pageout_scan: page %p is mapped", m));
}
-
-   /*
-* If the upper level VM system knows about any page 
-* references, we reactivate the page or requeue it.
-*/
if (act_delta != 0) {
if (object->ref_count != 0) {
vm_page_activate(m);
+
+   /*
+* Increase the activation count if the page
+* was referenced while in the inactive queue.
+* This makes it less likely that the page will
+* be returned prematurely to the inactive
+* queue.
+*/
m->act_count += act_delta + ACT_ADVANCE;
-   } else {
+   goto drop_page;
+   } else if ((object->flags & OBJ_DEAD) == 0) {
vm_pagequeue_lock(pq);
queues_locked = TRUE;
vm_page_requeue_locked(m);
+   goto drop_page;
}
-   goto drop_page;
}
 
/*
@@ -1243,6 +1243,15 @@ unlock_page:
vm_page_free(m);
PCPU_INC(cnt.v_dfree);
--page_shortage;
+   } else if ((object->flags & OBJ_DEAD) != 0) {
+   /*
+* Leave dirty pages from dead objects at the front of
+* the queue.  They are being paged out and freed by
+* the thread that destroyed the object.  They will
+* leave the queue shortly after the scan finishes, so 
+* they should be discounted from the inactive count.
+*/
+   addl_page_shortage++;
} else if ((m->flags & PG_WINATCFLS) == 0 && pass < 2) {
/*
 * Dirty pages need to be paged out, but flushing
@@ -1278,18 +1287,11 @@ unlock_page:
pageout_ok = vm_page_count_min();
else
pageout_ok = TRUE;
-
-   /*
-* We don't bother paging objects that are "dead".  
-* Those objects are in a "rundown" state.
-*/
-   if (!pageout_ok || (object->flags & OBJ_DEAD) != 0) {
+   if (!pageout_ok) {
vm_pagequeue_lock(pq);
-   vm_page_unlock(m);
-   VM_OBJECT_WUNLOCK(object);
queues_locked = TRUE;
vm_page_requeue_locked(m);
-   goto relock_queues;
+   

svn commit: r287487 - head/sys/arm64/arm64

2015-09-05 Thread Andrew Turner
Author: andrew
Date: Sat Sep  5 17:29:07 2015
New Revision: 287487
URL: https://svnweb.freebsd.org/changeset/base/287487

Log:
  Add ddb show commands to print the special registers and to ask the
  hardware to perform address translation for us. These are useful to help
  track down what caused us to enter the debugger.
  
  Sponsored by: ABT Systems Ltd

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

Modified: head/sys/arm64/arm64/machdep.c
==
--- head/sys/arm64/arm64/machdep.c  Sat Sep  5 17:02:01 2015
(r287486)
+++ head/sys/arm64/arm64/machdep.c  Sat Sep  5 17:29:07 2015
(r287487)
@@ -26,6 +26,7 @@
  */
 
 #include "opt_platform.h"
+#include "opt_ddb.h"
 
 #include 
 __FBSDID("$FreeBSD$");
@@ -868,3 +869,89 @@ initarm(struct arm64_bootparams *abp)
early_boot = 0;
 }
 
+#ifdef DDB
+#include 
+
+DB_SHOW_COMMAND(specialregs, db_show_spregs)
+{
+#definePRINT_REG(reg)  \
+db_printf(__STRING(reg) " = %#016lx\n", READ_SPECIALREG(reg))
+
+   PRINT_REG(actlr_el1);
+   PRINT_REG(afsr0_el1);
+   PRINT_REG(afsr1_el1);
+   PRINT_REG(aidr_el1);
+   PRINT_REG(amair_el1);
+   PRINT_REG(ccsidr_el1);
+   PRINT_REG(clidr_el1);
+   PRINT_REG(contextidr_el1);
+   PRINT_REG(cpacr_el1);
+   PRINT_REG(csselr_el1);
+   PRINT_REG(ctr_el0);
+   PRINT_REG(currentel);
+   PRINT_REG(daif);
+   PRINT_REG(dczid_el0);
+   PRINT_REG(elr_el1);
+   PRINT_REG(esr_el1);
+   PRINT_REG(far_el1);
+   PRINT_REG(fpcr);
+   PRINT_REG(fpsr);
+   PRINT_REG(id_aa64afr0_el1);
+   PRINT_REG(id_aa64afr1_el1);
+   PRINT_REG(id_aa64dfr0_el1);
+   PRINT_REG(id_aa64dfr1_el1);
+   PRINT_REG(id_aa64isar0_el1);
+   PRINT_REG(id_aa64isar1_el1);
+   PRINT_REG(id_aa64pfr0_el1);
+   PRINT_REG(id_aa64pfr1_el1);
+   PRINT_REG(id_afr0_el1);
+   PRINT_REG(id_dfr0_el1);
+   PRINT_REG(id_isar0_el1);
+   PRINT_REG(id_isar1_el1);
+   PRINT_REG(id_isar2_el1);
+   PRINT_REG(id_isar3_el1);
+   PRINT_REG(id_isar4_el1);
+   PRINT_REG(id_isar5_el1);
+   PRINT_REG(id_mmfr0_el1);
+   PRINT_REG(id_mmfr1_el1);
+   PRINT_REG(id_mmfr2_el1);
+   PRINT_REG(id_mmfr3_el1);
+#if 0
+   /* Missing from llvm */
+   PRINT_REG(id_mmfr4_el1);
+#endif
+   PRINT_REG(id_pfr0_el1);
+   PRINT_REG(id_pfr1_el1);
+   PRINT_REG(isr_el1);
+   PRINT_REG(mair_el1);
+   PRINT_REG(midr_el1);
+   PRINT_REG(mpidr_el1);
+   PRINT_REG(mvfr0_el1);
+   PRINT_REG(mvfr1_el1);
+   PRINT_REG(mvfr2_el1);
+   PRINT_REG(revidr_el1);
+   PRINT_REG(sctlr_el1);
+   PRINT_REG(sp_el0);
+   PRINT_REG(spsel);
+   PRINT_REG(spsr_el1);
+   PRINT_REG(tcr_el1);
+   PRINT_REG(tpidr_el0);
+   PRINT_REG(tpidr_el1);
+   PRINT_REG(tpidrro_el0);
+   PRINT_REG(ttbr0_el1);
+   PRINT_REG(ttbr1_el1);
+   PRINT_REG(vbar_el1);
+#undef PRINT_REG
+}
+
+DB_SHOW_COMMAND(vtop, db_show_vtop)
+{
+   uint64_t phys;
+
+   if (have_addr) {
+   phys = arm64_address_translate_s1e1r(addr);
+   db_printf("Physical address reg: 0x%016lx\n", phys);
+   } else
+   db_printf("show vtop \n");
+}
+#endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287486 - head/usr.bin/procstat

2015-09-05 Thread Allan Jude
Author: allanjude
Date: Sat Sep  5 17:02:01 2015
New Revision: 287486
URL: https://svnweb.freebsd.org/changeset/base/287486

Log:
  Introduce libxo to procstat(1)
  
  Reviewed by:  rodrigc, bapt
  Approved by:  marcel (mentor)
  Relnotes: yes
  Sponsored by: ScaleEngine Inc.
  Differential Revision:https://reviews.freebsd.org/D2446

Modified:
  head/usr.bin/procstat/Makefile
  head/usr.bin/procstat/procstat.1
  head/usr.bin/procstat/procstat.c
  head/usr.bin/procstat/procstat.h
  head/usr.bin/procstat/procstat_args.c
  head/usr.bin/procstat/procstat_auxv.c
  head/usr.bin/procstat/procstat_basic.c
  head/usr.bin/procstat/procstat_bin.c
  head/usr.bin/procstat/procstat_cred.c
  head/usr.bin/procstat/procstat_cs.c
  head/usr.bin/procstat/procstat_files.c
  head/usr.bin/procstat/procstat_kstack.c
  head/usr.bin/procstat/procstat_rlimit.c
  head/usr.bin/procstat/procstat_rusage.c
  head/usr.bin/procstat/procstat_sigs.c
  head/usr.bin/procstat/procstat_threads.c
  head/usr.bin/procstat/procstat_vm.c

Modified: head/usr.bin/procstat/Makefile
==
--- head/usr.bin/procstat/Makefile  Sat Sep  5 16:59:30 2015
(r287485)
+++ head/usr.bin/procstat/Makefile  Sat Sep  5 17:02:01 2015
(r287486)
@@ -17,6 +17,6 @@ SRCS= procstat.c  \
procstat_threads.c  \
procstat_vm.c
 
-LIBADD+=   util procstat
+LIBADD+=   procstat xo util sbuf
 
 .include 

Modified: head/usr.bin/procstat/procstat.1
==
--- head/usr.bin/procstat/procstat.1Sat Sep  5 16:59:30 2015
(r287485)
+++ head/usr.bin/procstat/procstat.1Sat Sep  5 17:02:01 2015
(r287486)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 18, 2015
+.Dd September 5, 2015
 .Dt PROCSTAT 1
 .Os
 .Sh NAME
@@ -33,6 +33,7 @@
 .Nd get detailed process information
 .Sh SYNOPSIS
 .Nm
+.Op Fl -libxo
 .Op Fl CHhn
 .Op Fl w Ar interval
 .Op Fl b | c | e | f | i | j | k | l | r | s | S | t | v | x
@@ -52,6 +53,13 @@ By default, basic process statistics are
 options may be specified in order to select more detailed process information
 for printing:
 .Bl -tag -width indent
+.It Fl -libxo
+Generate output via
+.Xr libxo 3
+in a selection of different human and machine readable formats.
+See
+.Xr xo_parse_args 3
+for details on command line arguments.
 .It Fl b
 Display binary information for the process.
 .It Fl c
@@ -531,16 +539,19 @@ auxiliary vector value
 .Xr cap_enter 2 ,
 .Xr cap_rights_limit 2 ,
 .Xr libprocstat 3 ,
+.Xr libxo 3 ,
+.Xr xo_parse_args 3 ,
 .Xr ddb 4 ,
 .Xr stack 9
 .Sh AUTHORS
-.An Robert N M Watson
+.An Robert N M Watson Aq Mt rwat...@freebsd.org .
+.br
+.Xr libxo 3
+support was added by
+.An -nosplit
+Allan Jude
+.Aq Mt allanj...@freebsd.org .
 .Sh BUGS
-Some field values may include spaces, which limits the extent to which the
-output of
-.Nm
-may be mechanically parsed.
-.Pp
 The display of open file or memory mapping pathnames is implemented using the
 kernel's name cache.
 If a file system does not use the name cache, or the path to a file is not in

Modified: head/usr.bin/procstat/procstat.c
==
--- head/usr.bin/procstat/procstat.cSat Sep  5 16:59:30 2015
(r287485)
+++ head/usr.bin/procstat/procstat.cSat Sep  5 17:02:01 2015
(r287486)
@@ -1,5 +1,6 @@
 /*-
  * Copyright (c) 2007, 2011 Robert N. M. Watson
+ * Copyright (c) 2015 Allan Jude 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -47,17 +48,24 @@ static void
 usage(void)
 {
 
-   fprintf(stderr, "usage: procstat [-CHhn] [-M core] [-N system] "
-   "[-w interval] \n");
-   fprintf(stderr, "[-b | -c | -e | -f | -i | -j | -k | "
-   "-l | -r | -s | -S | -t | -v | -x]\n");
-   fprintf(stderr, "[-a | pid | core ...]\n");
+   xo_error("usage: procstat [-CHhn] [-M core] [-N system] "
+   "[-w interval]\n"
+   "[-b | -c | -e | -f | -i | -j | -k | "
+   "-l | -r | -s | -S | -t | -v | -x]\n"
+   "[-a | pid | core ...]\n");
+   xo_finish();
exit(EX_USAGE);
 }
 
 static void
 procstat(struct procstat *prstat, struct kinfo_proc *kipp)
 {
+   char *pidstr = NULL;
+
+   asprintf(&pidstr, "%d", kipp->ki_pid);
+   if (pidstr == NULL)
+   xo_errc(1, ENOMEM, "Failed to allocate memory in procstat()");
+   xo_open_container(pidstr);
 
if (bflag)
procstat_bin(prstat, kipp);
@@ -89,6 +97,9 @@ procstat(struct procstat *prstat, struct
procstat_cs(prstat, kipp);
else
procstat_basic(kipp);
+
+   xo_close_container(pidstr);
+   free(pidstr);
 }
 
 /*
@@ -126,10 +137,14 @@ main(int argc, char *argv[])
p

svn commit: r287485 - head/usr.sbin/sesutil

2015-09-05 Thread Baptiste Daroussin
Author: bapt
Date: Sat Sep  5 16:59:30 2015
New Revision: 287485
URL: https://svnweb.freebsd.org/changeset/base/287485

Log:
  Fix build with gcc 4.2
  
  Reported by:  kib

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

Modified: head/usr.sbin/sesutil/sesutil.c
==
--- head/usr.sbin/sesutil/sesutil.c Sat Sep  5 14:14:03 2015
(r287484)
+++ head/usr.sbin/sesutil/sesutil.c Sat Sep  5 16:59:30 2015
(r287485)
@@ -104,7 +104,7 @@ locate(int argc, char **argv)
size_t len, i;
int fd, nobj, j;
bool all = false;
-   bool locate;
+   bool onoff;
 
if (argc != 2) {
errx(EXIT_FAILURE, "usage: %s locate [disk] [on|off]",
@@ -114,9 +114,9 @@ locate(int argc, char **argv)
disk = argv[0];
 
if (strcmp(argv[1], "on") == 0) {
-   locate = true;
+   onoff = true;
} else if (strcmp(argv[1], "off") == 0) {
-   locate = false;
+   onoff = false;
} else {
errx(EXIT_FAILURE, "usage: %s locate [disk] [on|off]",
getprogname());
@@ -165,11 +165,11 @@ locate(int argc, char **argv)
continue;
if (objdn.elm_names_len > 0) {
if (all) {
-   do_locate(fd, objdn.elm_idx, locate);
+   do_locate(fd, objdn.elm_idx, onoff);
continue;
}
if (disk_match(objdn.elm_devnames, disk, len)) {
-   do_locate(fd, objdn.elm_idx, locate);
+   do_locate(fd, objdn.elm_idx, onoff);
break;
}
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r287442 - in head: lib/libprocstat lib/libutil share/man/man5 sys/kern sys/sys

2015-09-05 Thread Garrett Cooper

> On Sep 5, 2015, at 07:50, Conrad Meyer  wrote:
> 
> I'll be offline for the next ~48 hours. It sounds like it's annoying
> but not critical to fix. If it isn't fixed when I get back, I'll
> figure something out.
> 
> Thanks,
> Conrad
> 
> P.S., What systems have both imgact_elf64 and 32?

Anything with COMPAT32 on (amd64, powerpc64, etc).
Cheers,
-NGie
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r287467 - head/sys/dev/e1000

2015-09-05 Thread Tijl Coosemans
On Fri, 4 Sep 2015 16:30:49 + (UTC) Sean Bruno  wrote:
> Author: sbruno
> Date: Fri Sep  4 16:30:48 2015
> New Revision: 287467
> URL: https://svnweb.freebsd.org/changeset/base/287467
> 
> Log:
>   e1000: Shared code updates
>   -Fix compiler warning in 80003es2lan.c
>   -Add return value handler for e1000_*_kmrn_reg_80003es2lan
>   -Fix usage of DEBUGOUT
>   -Remove unnecessary variable initializations.
>   -Removed unused variables (complaints from gcc).
>   -Edit defines in 82571.h.
>   -Add workaround for igb hw errata.
>   -Shared code changes for Skylake/I219 support.
>   -Remove unused OBFF and LTR functions.
>   
>   Differential Revision:  https://reviews.freebsd.org/D3162
>   Submitted by:   erj
>   MFC after:  1 month
>   Sponsored by:   Intel Corporation
> 
> Modified:
>   head/sys/dev/e1000/e1000_80003es2lan.c
>   head/sys/dev/e1000/e1000_82540.c
>   head/sys/dev/e1000/e1000_82541.c
>   head/sys/dev/e1000/e1000_82542.c
>   head/sys/dev/e1000/e1000_82543.c
>   head/sys/dev/e1000/e1000_82571.h
>   head/sys/dev/e1000/e1000_82575.c
>   head/sys/dev/e1000/e1000_82575.h
>   head/sys/dev/e1000/e1000_api.c
>   head/sys/dev/e1000/e1000_api.h
>   head/sys/dev/e1000/e1000_defines.h
>   head/sys/dev/e1000/e1000_hw.h
>   head/sys/dev/e1000/e1000_i210.c
>   head/sys/dev/e1000/e1000_i210.h
>   head/sys/dev/e1000/e1000_ich8lan.c
>   head/sys/dev/e1000/e1000_ich8lan.h
>   head/sys/dev/e1000/e1000_mac.c
>   head/sys/dev/e1000/e1000_mac.h
>   head/sys/dev/e1000/e1000_nvm.c
>   head/sys/dev/e1000/e1000_nvm.h
>   head/sys/dev/e1000/e1000_osdep.h
>   head/sys/dev/e1000/e1000_phy.c
>   head/sys/dev/e1000/e1000_regs.h
>   head/sys/dev/e1000/if_igb.c

I have an em device that fails to attach after this commit:

em0@pci0:0:25:0: class=0x02 card=0x00018086 chip=0x294c8086 rev=0x02 
hdr=0x00
vendor = 'Intel Corporation'
device = '82566DC-2 Gigabit Network Connection'
class  = network
subclass   = ethernet

em0:  port 0x3400-0x341f mem
0x9220-0x9221,0x92224000-0x92224fff irq 20 at device 25.0 on pci0
em0: Using an MSI interrupt

At this point the machine waits for about half a minute and then continues
with this:

em0: The EEPROM Checksum Is Not Valid
device_attach: em0 attach returned 5
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r287442 - in head: lib/libprocstat lib/libutil share/man/man5 sys/kern sys/sys

2015-09-05 Thread Conrad Meyer
I'll be offline for the next ~48 hours. It sounds like it's annoying
but not critical to fix. If it isn't fixed when I get back, I'll
figure something out.

Thanks,
Conrad

P.S., What systems have both imgact_elf64 and 32?

On Sat, Sep 5, 2015 at 7:04 AM, Tijl Coosemans  wrote:
> On Thu, 3 Sep 2015 20:32:10 + (UTC) "Conrad E. Meyer"  
> wrote:
>> Author: cem
>> Date: Thu Sep  3 20:32:10 2015
>> New Revision: 287442
>> URL: https://svnweb.freebsd.org/changeset/base/287442
>>
>> Log:
>>   Detect badly behaved coredump note helpers
>>
>>   Coredump notes depend on being able to invoke dump routines twice; once
>>   in a dry-run mode to get the size of the note, and another to actually
>>   emit the note to the corefile.
>>
>>   When a note helper emits a different length section the second time
>>   around than the length it requested the first time, the kernel produces
>>   a corrupt coredump.
>>
>>   NT_PROCSTAT_FILES output length, when packing kinfo structs, is tied to
>>   the length of filenames corresponding to vnodes in the process' fd table
>>   via vn_fullpath.  As vnodes may move around during dump, this is racy.
>>
>>   So:
>>
>>- Detect badly behaved notes in putnote() and pad underfilled notes.
>>
>>- Add a fail point, debug.fail_point.fill_kinfo_vnode__random_path to
>>  exercise the NT_PROCSTAT_FILES corruption.  It simply picks random
>>  lengths to expand or truncate paths to in fo_fill_kinfo_vnode().
>>
>>- Add a sysctl, kern.coredump_pack_fileinfo, to allow users to
>>  disable kinfo packing for PROCSTAT_FILES notes.  This should avoid
>>  both FILES note corruption and truncation, even if filenames change,
>>  at the cost of about 1 kiB in padding bloat per open fd.  Document
>>  the new sysctl in core.5.
>>
>>- Fix note_procstat_files to self-limit in the 2nd pass.  Since
>>  sometimes this will result in a short write, pad up to our advertised
>>  size.  This addresses note corruption, at the risk of sometimes
>>  truncating the last several fd info entries.
>>
>>- Fix NT_PROCSTAT_FILES consumers libutil and libprocstat to grok the
>>  zero padding.
>>
>>   With suggestions from:  bjk, jhb, kib, wblock
>>   Approved by:markj (mentor)
>>   Relnotes:   yes
>>   Sponsored by:   EMC / Isilon Storage Division
>>   Differential Revision:  https://reviews.freebsd.org/D3548
>>
>> Modified:
>>   head/lib/libprocstat/libprocstat.c
>>   head/lib/libutil/kinfo_getfile.c
>>   head/share/man/man5/core.5
>>   head/sys/kern/imgact_elf.c
>>   head/sys/kern/kern_descrip.c
>>   head/sys/kern/vfs_vnops.c
>>   head/sys/sys/user.h
>>
>> Modified: head/sys/kern/imgact_elf.c
>> ==
>> --- head/sys/kern/imgact_elf.cThu Sep  3 19:42:56 2015
>> (r287441)
>> +++ head/sys/kern/imgact_elf.cThu Sep  3 20:32:10 2015
>> (r287442)
>> @@ -1875,29 +1902,56 @@ __elfN(note_procstat_proc)(void *arg, st
>>  CTASSERT(sizeof(struct kinfo_file) == KINFO_FILE_SIZE);
>>  #endif
>>
>> +static int pack_fileinfo = 1;
>> +SYSCTL_INT(_kern, OID_AUTO, coredump_pack_fileinfo, CTLFLAG_RWTUN,
>> +&pack_fileinfo, 0,
>> +"Enable file path packing in 'procstat -f' coredump notes");
>
> This file can be compiled twice (included by both imgact_elf32.c and
> imgact_elf64.c) so this sysctl can be added twice and the second time
> results in an error message in dmesg: "can't re-use a leaf".
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287484 - in head/sys: netinet netinet6

2015-09-05 Thread Alexander V. Chernikov
Author: melifaro
Date: Sat Sep  5 14:14:03 2015
New Revision: 287484
URL: https://svnweb.freebsd.org/changeset/base/287484

Log:
  Do not pass lle to nd6_ns_output().  Use newly-added
nd6_llinfo_get_holdsrc() to extract desired IPv6 source
from holdchain and pass it to the nd6_ns_output().

Modified:
  head/sys/netinet/toecore.c
  head/sys/netinet6/nd6.c
  head/sys/netinet6/nd6.h
  head/sys/netinet6/nd6_nbr.c

Modified: head/sys/netinet/toecore.c
==
--- head/sys/netinet/toecore.c  Sat Sep  5 12:28:18 2015(r287483)
+++ head/sys/netinet/toecore.c  Sat Sep  5 14:14:03 2015(r287484)
@@ -482,7 +482,7 @@ restart:
(long)ND_IFINFO(ifp)->retrans * hz / 1000);
LLE_WUNLOCK(lle);
 
-   nd6_ns_output(ifp, NULL, &sin6->sin6_addr, NULL, 0);
+   nd6_ns_output(ifp, NULL, NULL, &sin6->sin6_addr, 0);
 
return (EWOULDBLOCK);
} else {

Modified: head/sys/netinet6/nd6.c
==
--- head/sys/netinet6/nd6.c Sat Sep  5 12:28:18 2015(r287483)
+++ head/sys/netinet6/nd6.c Sat Sep  5 14:14:03 2015(r287484)
@@ -510,6 +510,34 @@ nd6_llinfo_settimer_locked(struct llentr
LLE_REMREF(ln);
 }
 
+/*
+* Gets source address of the first packet in hold queue
+* and stores it in @src.
+* Returns pointer to @src (if hold queue is not empty) or NULL.
+*
+*/
+static struct in6_addr *
+nd6_llinfo_get_holdsrc(struct llentry *ln, struct in6_addr *src)
+{
+   struct ip6_hdr hdr;
+   struct mbuf *m;
+
+   if (ln->la_hold == NULL)
+   return (NULL);
+
+   /*
+* assume every packet in la_hold has the same IP header
+*/
+   m = ln->la_hold;
+   if (sizeof(hdr) < m->m_len)
+   return (NULL);
+
+   m_copydata(m, 0, sizeof(hdr), (caddr_t)&hdr);
+   *src = hdr.ip6_src;
+
+   return (src);
+}
+
 void
 nd6_llinfo_settimer(struct llentry *ln, long tick)
 {
@@ -523,9 +551,10 @@ static void
 nd6_llinfo_timer(void *arg)
 {
struct llentry *ln;
-   struct in6_addr *dst;
+   struct in6_addr *dst, *pdst, *psrc, src;
struct ifnet *ifp;
struct nd_ifinfo *ndi = NULL;
+   int send_ns;
 
KASSERT(arg != NULL, ("%s: arg NULL", __func__));
ln = (struct llentry *)arg;
@@ -552,6 +581,10 @@ nd6_llinfo_timer(void *arg)
}
ifp = ln->lle_tbl->llt_ifp;
CURVNET_SET(ifp->if_vnet);
+   ndi = ND_IFINFO(ifp);
+   send_ns = 0;
+   dst = &ln->r_l3addr.addr6;
+   pdst = dst;
 
if (ln->ln_ntick > 0) {
if (ln->ln_ntick > INT_MAX) {
@@ -564,8 +597,6 @@ nd6_llinfo_timer(void *arg)
goto done;
}
 
-   ndi = ND_IFINFO(ifp);
-   dst = &ln->r_l3addr.addr6;
if (ln->la_flags & LLE_STATIC) {
goto done;
}
@@ -580,10 +611,9 @@ nd6_llinfo_timer(void *arg)
case ND6_LLINFO_INCOMPLETE:
if (ln->la_asked < V_nd6_mmaxtries) {
ln->la_asked++;
-   nd6_llinfo_settimer_locked(ln, (long)ndi->retrans * hz 
/ 1000);
-   LLE_WUNLOCK(ln);
-   nd6_ns_output(ifp, NULL, dst, ln, NULL);
-   LLE_WLOCK(ln);
+   send_ns = 1;
+   /* Send NS to multicast address */
+   pdst = NULL;
} else {
struct mbuf *m = ln->la_hold;
if (m) {
@@ -627,10 +657,7 @@ nd6_llinfo_timer(void *arg)
/* We need NUD */
ln->la_asked = 1;
ln->ln_state = ND6_LLINFO_PROBE;
-   nd6_llinfo_settimer_locked(ln, (long)ndi->retrans * hz 
/ 1000);
-   LLE_WUNLOCK(ln);
-   nd6_ns_output(ifp, dst, dst, ln, NULL);
-   LLE_WLOCK(ln);
+   send_ns = 1;
} else {
ln->ln_state = ND6_LLINFO_STALE; /* XXX */
nd6_llinfo_settimer_locked(ln, (long)V_nd6_gctimer * 
hz);
@@ -639,10 +666,7 @@ nd6_llinfo_timer(void *arg)
case ND6_LLINFO_PROBE:
if (ln->la_asked < V_nd6_umaxtries) {
ln->la_asked++;
-   nd6_llinfo_settimer_locked(ln, (long)ndi->retrans * hz 
/ 1000);
-   LLE_WUNLOCK(ln);
-   nd6_ns_output(ifp, dst, dst, ln, NULL);
-   LLE_WLOCK(ln);
+   send_ns = 1;
} else {
EVENTHANDLER_INVOKE(lle_event, ln, LLENTRY_EXPIRED);
(void)nd6_free(ln, 0);
@@ -654,6 +678,14 @@ nd6_llinfo_timer(void *arg)
 

Re: svn commit: r287442 - in head: lib/libprocstat lib/libutil share/man/man5 sys/kern sys/sys

2015-09-05 Thread Tijl Coosemans
On Thu, 3 Sep 2015 20:32:10 + (UTC) "Conrad E. Meyer"  
wrote:
> Author: cem
> Date: Thu Sep  3 20:32:10 2015
> New Revision: 287442
> URL: https://svnweb.freebsd.org/changeset/base/287442
> 
> Log:
>   Detect badly behaved coredump note helpers
>   
>   Coredump notes depend on being able to invoke dump routines twice; once
>   in a dry-run mode to get the size of the note, and another to actually
>   emit the note to the corefile.
>   
>   When a note helper emits a different length section the second time
>   around than the length it requested the first time, the kernel produces
>   a corrupt coredump.
>   
>   NT_PROCSTAT_FILES output length, when packing kinfo structs, is tied to
>   the length of filenames corresponding to vnodes in the process' fd table
>   via vn_fullpath.  As vnodes may move around during dump, this is racy.
>   
>   So:
>   
>- Detect badly behaved notes in putnote() and pad underfilled notes.
>   
>- Add a fail point, debug.fail_point.fill_kinfo_vnode__random_path to
>  exercise the NT_PROCSTAT_FILES corruption.  It simply picks random
>  lengths to expand or truncate paths to in fo_fill_kinfo_vnode().
>   
>- Add a sysctl, kern.coredump_pack_fileinfo, to allow users to
>  disable kinfo packing for PROCSTAT_FILES notes.  This should avoid
>  both FILES note corruption and truncation, even if filenames change,
>  at the cost of about 1 kiB in padding bloat per open fd.  Document
>  the new sysctl in core.5.
>   
>- Fix note_procstat_files to self-limit in the 2nd pass.  Since
>  sometimes this will result in a short write, pad up to our advertised
>  size.  This addresses note corruption, at the risk of sometimes
>  truncating the last several fd info entries.
>   
>- Fix NT_PROCSTAT_FILES consumers libutil and libprocstat to grok the
>  zero padding.
>   
>   With suggestions from:  bjk, jhb, kib, wblock
>   Approved by:markj (mentor)
>   Relnotes:   yes
>   Sponsored by:   EMC / Isilon Storage Division
>   Differential Revision:  https://reviews.freebsd.org/D3548
> 
> Modified:
>   head/lib/libprocstat/libprocstat.c
>   head/lib/libutil/kinfo_getfile.c
>   head/share/man/man5/core.5
>   head/sys/kern/imgact_elf.c
>   head/sys/kern/kern_descrip.c
>   head/sys/kern/vfs_vnops.c
>   head/sys/sys/user.h
> 
> Modified: head/sys/kern/imgact_elf.c
> ==
> --- head/sys/kern/imgact_elf.cThu Sep  3 19:42:56 2015
> (r287441)
> +++ head/sys/kern/imgact_elf.cThu Sep  3 20:32:10 2015
> (r287442)
> @@ -1875,29 +1902,56 @@ __elfN(note_procstat_proc)(void *arg, st
>  CTASSERT(sizeof(struct kinfo_file) == KINFO_FILE_SIZE);
>  #endif
>  
> +static int pack_fileinfo = 1;
> +SYSCTL_INT(_kern, OID_AUTO, coredump_pack_fileinfo, CTLFLAG_RWTUN,
> +&pack_fileinfo, 0,
> +"Enable file path packing in 'procstat -f' coredump notes");

This file can be compiled twice (included by both imgact_elf32.c and
imgact_elf64.c) so this sysctl can be added twice and the second time
results in an error message in dmesg: "can't re-use a leaf".
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287483 - head/sys/ufs/ffs

2015-09-05 Thread Konstantin Belousov
Author: kib
Date: Sat Sep  5 12:28:18 2015
New Revision: 287483
URL: https://svnweb.freebsd.org/changeset/base/287483

Log:
  Do not consume extra reference.  This is a bug in r287479.
  
  Reported and tested by:   pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

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

Modified: head/sys/ufs/ffs/ffs_softdep.c
==
--- head/sys/ufs/ffs/ffs_softdep.c  Sat Sep  5 10:29:47 2015
(r287482)
+++ head/sys/ufs/ffs/ffs_softdep.c  Sat Sep  5 12:28:18 2015
(r287483)
@@ -13325,8 +13325,7 @@ softdep_ast_cleanup_proc(void)
if (softdep_excess_items(ump, D_NEWBLK) ||
softdep_excess_items(ump, D_ALLOCDIRECT) ||
softdep_excess_items(ump, D_ALLOCINDIR)) {
-   error = vn_start_write(NULL, &mp, V_MNTREF |
-   V_WAIT);
+   error = vn_start_write(NULL, &mp, V_WAIT);
if (error == 0) {
req = true;
VFS_SYNC(mp, MNT_WAIT);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287482 - head/share/man/man4

2015-09-05 Thread Baptiste Daroussin
Author: bapt
Date: Sat Sep  5 10:29:47 2015
New Revision: 287482
URL: https://svnweb.freebsd.org/changeset/base/287482

Log:
  Cross reference sesutil(8) and ses(4)
  
  Submitted by: trasz
  MFC after:1 month (with r287473)

Modified:
  head/share/man/man4/ses.4

Modified: head/share/man/man4/ses.4
==
--- head/share/man/man4/ses.4   Sat Sep  5 10:15:19 2015(r287481)
+++ head/share/man/man4/ses.4   Sat Sep  5 10:29:47 2015(r287482)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 29, 2000
+.Dd September 05, 2015
 .Dt SES 4
 .Os
 .Sh NAME
@@ -123,6 +123,8 @@ When the kernel is configured with
 .Tn DEBUG
 enabled, the first open to an SES device will spit out overall enclosure
 parameters to the console.
+.Sh SEE ALSO
+.Xr sesutil 8
 .Sh HISTORY
 The
 .Nm
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287481 - head/sys/netinet

2015-09-05 Thread Gleb Smirnoff
Author: glebius
Date: Sat Sep  5 10:15:19 2015
New Revision: 287481
URL: https://svnweb.freebsd.org/changeset/base/287481

Log:
  Use Jenkins hash for TCP syncache.
  
  o Unlike xor, in Jenkins hash every bit of input affects virtually
every bit of output, thus salting the hash actually works. With
xor salting only provides a false sense of security, since if
hash(x) collides with hash(y), then of course, hash(x) ^ salt
would also collide with hash(y) ^ salt. [1]
  o Jenkins provides much better distribution than xor, very close to
ideal.
  
  TCP connection setup/teardown benchmark has shown a 10% increase
  with default hash size, and with bigger hashes that still provide
  possibility for collisions. With enormous hash size, when dataset is
  by an order of magnitude smaller than hash size, the benchmark has
  shown 4% decrease in performance decrease, which is expected and
  acceptable.
  
  Noticed by:   Jeffrey Knockel  [1]
  Benchmarks by:jch
  Reviewed by:  jch, pkelsey, delphij
  Security: strengthens protection against hash collision DoS
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/netinet/in_pcb.h
  head/sys/netinet/tcp_syncache.c
  head/sys/netinet/tcp_syncache.h

Modified: head/sys/netinet/in_pcb.h
==
--- head/sys/netinet/in_pcb.h   Sat Sep  5 08:55:51 2015(r287480)
+++ head/sys/netinet/in_pcb.h   Sat Sep  5 10:15:19 2015(r287481)
@@ -79,6 +79,8 @@ struct in_addr_4in6 {
 /*
  * NOTE: ipv6 addrs should be 64-bit aligned, per RFC 2553.  in_conninfo has
  * some extra padding to accomplish this.
+ * NOTE 2: tcp_syncache.c uses first 5 32-bit words, which identify fport,
+ * lport, faddr to generate hash, so these fields shouldn't be moved.
  */
 struct in_endpoints {
u_int16_t   ie_fport;   /* foreign port */

Modified: head/sys/netinet/tcp_syncache.c
==
--- head/sys/netinet/tcp_syncache.c Sat Sep  5 08:55:51 2015
(r287480)
+++ head/sys/netinet/tcp_syncache.c Sat Sep  5 10:15:19 2015
(r287481)
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -186,27 +187,6 @@ SYSCTL_INT(_net_inet_tcp_syncache, OID_A
 
 static MALLOC_DEFINE(M_SYNCACHE, "syncache", "TCP syncache");
 
-#define SYNCACHE_HASH(inc, mask)   \
-   ((V_tcp_syncache.hash_secret ^  \
- (inc)->inc_faddr.s_addr ^ \
- ((inc)->inc_faddr.s_addr >> 16) ^ \
- (inc)->inc_fport ^ (inc)->inc_lport) & mask)
-
-#define SYNCACHE_HASH6(inc, mask)  \
-   ((V_tcp_syncache.hash_secret ^  \
- (inc)->inc6_faddr.s6_addr32[0] ^  \
- (inc)->inc6_faddr.s6_addr32[3] ^  \
- (inc)->inc_fport ^ (inc)->inc_lport) & mask)
-
-#define ENDPTS_EQ(a, b) (  \
-   (a)->ie_fport == (b)->ie_fport &&   \
-   (a)->ie_lport == (b)->ie_lport &&   \
-   (a)->ie_faddr.s_addr == (b)->ie_faddr.s_addr && \
-   (a)->ie_laddr.s_addr == (b)->ie_laddr.s_addr\
-)
-
-#define ENDPTS6_EQ(a, b) (memcmp(a, b, sizeof(*a)) == 0)
-
 #defineSCH_LOCK(sch)   mtx_lock(&(sch)->sch_mtx)
 #defineSCH_UNLOCK(sch) mtx_unlock(&(sch)->sch_mtx)
 #defineSCH_LOCK_ASSERT(sch)mtx_assert(&(sch)->sch_mtx, MA_OWNED)
@@ -486,41 +466,29 @@ syncache_lookup(struct in_conninfo *inc,
 {
struct syncache *sc;
struct syncache_head *sch;
+   uint32_t hash;
 
-#ifdef INET6
-   if (inc->inc_flags & INC_ISIPV6) {
-   sch = &V_tcp_syncache.hashbase[
-   SYNCACHE_HASH6(inc, V_tcp_syncache.hashmask)];
-   *schp = sch;
-
-   SCH_LOCK(sch);
+   /*
+* The hash is built on foreign port + local port + foreign address.
+* We rely on the fact that struct in_conninfo starts with 16 bits
+* of foreign port, then 16 bits of local port then followed by 128
+* bits of foreign address.  In case of IPv4 address, the first 3
+* 32-bit words of the address always are zeroes.
+*/
+   hash = jenkins_hash32((uint32_t *)&inc->inc_ie, 5,
+   V_tcp_syncache.hash_secret) & V_tcp_syncache.hashmask;
 
-   /* Circle through bucket row to find matching entry. */
-   TAILQ_FOREACH(sc, &sch->sch_bucket, sc_hash) {
-   if (ENDPTS6_EQ(&inc->inc_ie, &sc->sc_inc.inc_ie))
-   return (sc);
-   }
-   } else
-#endif
-   {
-   

svn commit: r287480 - in stable/10/lib/libc: amd64/gen compat-43 db/btree db/hash gen i386/gen include net stdio stdlib sys

2015-09-05 Thread Konstantin Belousov
Author: kib
Date: Sat Sep  5 08:55:51 2015
New Revision: 287480
URL: https://svnweb.freebsd.org/changeset/base/287480

Log:
  MFC r287292:
  Switch libc from using _sig{procmask,action,suspend} symbols, which
  are aliases for the syscall stubs and are plt-interposed, to the
  libc-private aliases of internally interposed sigprocmask() etc.
  
  MFC r287300:
  Use libthr interposed functions instead of syscalls, in posix_spawn()'
  child.

Modified:
  stable/10/lib/libc/amd64/gen/setjmp.S
  stable/10/lib/libc/amd64/gen/sigsetjmp.S
  stable/10/lib/libc/compat-43/sigcompat.c
  stable/10/lib/libc/db/btree/bt_open.c
  stable/10/lib/libc/db/hash/hash_page.c
  stable/10/lib/libc/gen/daemon.c
  stable/10/lib/libc/gen/posix_spawn.c
  stable/10/lib/libc/gen/readpassphrase.c
  stable/10/lib/libc/gen/setmode.c
  stable/10/lib/libc/gen/siginterrupt.c
  stable/10/lib/libc/gen/signal.c
  stable/10/lib/libc/gen/wordexp.c
  stable/10/lib/libc/i386/gen/setjmp.S
  stable/10/lib/libc/i386/gen/sigsetjmp.S
  stable/10/lib/libc/include/libc_private.h
  stable/10/lib/libc/net/rcmd.c
  stable/10/lib/libc/stdio/tmpfile.c
  stable/10/lib/libc/stdlib/abort.c
  stable/10/lib/libc/stdlib/system.c
  stable/10/lib/libc/sys/sigaction.c
  stable/10/lib/libc/sys/sigprocmask.c
  stable/10/lib/libc/sys/sigsuspend.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/amd64/gen/setjmp.S
==
--- stable/10/lib/libc/amd64/gen/setjmp.S   Sat Sep  5 08:48:24 2015
(r287479)
+++ stable/10/lib/libc/amd64/gen/setjmp.S   Sat Sep  5 08:55:51 2015
(r287480)
@@ -55,7 +55,7 @@ ENTRY(setjmp)
movq$0,%rsi /* (sigset_t*)set  */
leaq72(%rcx),%rdx   /* 9,10; (sigset_t*)oset */
/* stack is 16-byte aligned */
-   callPIC_PLT(CNAME(_sigprocmask))
+   call__libc_sigprocmask
popq%rdi
movq%rdi,%rcx
movq0(%rsp),%rdx/* retval */
@@ -83,7 +83,7 @@ ENTRY(__longjmp)
leaq72(%rdx),%rsi   /* (sigset_t*)set  */
movq$0,%rdx /* (sigset_t*)oset */
subq$0x8,%rsp   /* make the stack 16-byte aligned */
-   callPIC_PLT(CNAME(_sigprocmask))
+   call__libc_sigprocmask
addq$0x8,%rsp
popq%rsi
popq%rdi/* jmpbuf */

Modified: stable/10/lib/libc/amd64/gen/sigsetjmp.S
==
--- stable/10/lib/libc/amd64/gen/sigsetjmp.SSat Sep  5 08:48:24 2015
(r287479)
+++ stable/10/lib/libc/amd64/gen/sigsetjmp.SSat Sep  5 08:55:51 2015
(r287480)
@@ -63,7 +63,7 @@ ENTRY(sigsetjmp)
movq$0,%rsi /* (sigset_t*)set  */
leaq72(%rcx),%rdx   /* 9,10 (sigset_t*)oset */
/* stack is 16-byte aligned */
-   callPIC_PLT(CNAME(_sigprocmask))
+   call__libc_sigprocmask
popq%rdi
 2: movq%rdi,%rcx
movq0(%rsp),%rdx/* retval */
@@ -92,7 +92,7 @@ ENTRY(__siglongjmp)
leaq72(%rdx),%rsi   /* (sigset_t*)set  */
movq$0,%rdx /* (sigset_t*)oset */
subq$0x8,%rsp   /* make the stack 16-byte aligned */
-   callPIC_PLT(CNAME(_sigprocmask))
+   call__libc_sigprocmask
addq$0x8,%rsp
popq%rsi
popq%rdi/* jmpbuf */

Modified: stable/10/lib/libc/compat-43/sigcompat.c
==
--- stable/10/lib/libc/compat-43/sigcompat.cSat Sep  5 08:48:24 2015
(r287479)
+++ stable/10/lib/libc/compat-43/sigcompat.cSat Sep  5 08:55:51 2015
(r287480)
@@ -59,7 +59,7 @@ sigvec(signo, sv, osv)
} else
sap = NULL;
osap = osv != NULL ? &osa : NULL;
-   ret = _sigaction(signo, sap, osap);
+   ret = __libc_sigaction(signo, sap, osap);
if (ret == 0 && osv != NULL) {
osv->sv_handler = osa.sa_handler;
osv->sv_flags = osa.sa_flags ^ SV_INTERRUPT;
@@ -77,7 +77,7 @@ sigsetmask(mask)
 
sigemptyset(&set);
set.__bits[0] = mask;
-   n = _sigprocmask(SIG_SETMASK, &set, &oset);
+   n = __libc_sigprocmask(SIG_SETMASK, &set, &oset);
if (n)
return (n);
return (oset.__bits[0]);
@@ -92,7 +92,7 @@ sigblock(mask)
 
sigemptyset(&set);
set.__bits[0] = mask;
-   n = _sigprocmask(SIG_BLOCK, &set, &oset);
+   n = __libc_sigprocmask(SIG_BLOCK, &set, &oset);
if (n)
return (n);
return (oset.__bits[0]);
@@ -105,7 +105,7 @@ sigpause(int mask)
 
sigemptyset(&set);
set.__bits[0] = mask;
-   return (_sigsuspend(&set));
+   return (__libc_sigsuspend(&set));
 }
 
 int

svn commit: r287479 - head/sys/ufs/ffs

2015-09-05 Thread Konstantin Belousov
Author: kib
Date: Sat Sep  5 08:48:24 2015
New Revision: 287479
URL: https://svnweb.freebsd.org/changeset/base/287479

Log:
  Declare the writes around the call to VFS_SYNC() in
  softdep_ast_cleanup_proc().
  
  Tested by:pho (previous version)
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

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

Modified: head/sys/ufs/ffs/ffs_softdep.c
==
--- head/sys/ufs/ffs/ffs_softdep.c  Sat Sep  5 06:24:00 2015
(r287478)
+++ head/sys/ufs/ffs/ffs_softdep.c  Sat Sep  5 08:48:24 2015
(r287479)
@@ -13325,8 +13325,13 @@ softdep_ast_cleanup_proc(void)
if (softdep_excess_items(ump, D_NEWBLK) ||
softdep_excess_items(ump, D_ALLOCDIRECT) ||
softdep_excess_items(ump, D_ALLOCINDIR)) {
-   req = true;
-   VFS_SYNC(mp, MNT_WAIT);
+   error = vn_start_write(NULL, &mp, V_MNTREF |
+   V_WAIT);
+   if (error == 0) {
+   req = true;
+   VFS_SYNC(mp, MNT_WAIT);
+   vn_finished_write(mp);
+   }
}
if ((td->td_pflags & TDP_KTHREAD) != 0 || !req)
break;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"