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

2014-12-30 Thread Steven Hartland


On 31/12/2014 02:12, Xin Li wrote:

On 12/23/14 01:31, Steven Hartland wrote:

Author: smh
Date: Tue Dec 23 09:31:24 2014
New Revision: 276123
URL: https://svnweb.freebsd.org/changeset/base/276123

Log:
   Always sync the global ZFS config cache to reflect the new mosconfig
   
   This fixes out of date zpool.cache for root pools, which can cause issues

   such as confusion of zdb etc.
   
   MFC after:	1 month


Modified:
   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.cTue Dec 
23 08:51:30 2014(r276122)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.cTue Dec 
23 09:31:24 2014(r276123)
@@ -536,8 +536,7 @@ spa_config_update(spa_t *spa, int what)
/*
 * Update the global config cache to reflect the new mosconfig.
 */
-   if (!spa->spa_is_root)
-   spa_config_sync(spa, B_FALSE, what != SPA_CONFIG_UPDATE_POOL);
+   spa_config_sync(spa, B_FALSE, what != SPA_CONFIG_UPDATE_POOL);
  
  	if (what == SPA_CONFIG_UPDATE_POOL)

spa_config_update(spa, SPA_CONFIG_UPDATE_VDEVS);

It seems like that this change breaks systems where not all pools are
available (e.g. some of pools are encrypted) at boot time, by removing
all these pools from the cache file.

As a result, on the next boot, these pools would not be imported even
when the devices are available (geli attached), and reverting this
change would restore the system to its previous behavior.

Perhaps it have exposed an existing bug?


I've managed to reproduce this here with mdX backed test pools, and 
looking into it this is due to spa_config_sync:


/*
 * Skip over our own pool if we're about to remove
 * ourselves from the spa namespace or any pool 
that

 * is readonly. Since we cannot guarantee that a
 * readonly pool would successfully import upon 
reboot,
 * we don't allow them to be written to the 
cache file.

 */
if ((spa == target && removing) ||
!spa_writeable(spa)) {
continue;
}

This was added by upstream:
https://github.com/illumos/illumos-gate/commit/fb02ae025247e3b662600e5a9c1b4c33ecab7d72
https://www.illumos.org/issues/3639

It seems the desired behavior was to exclude read only pools, to prevent 
them being mounted writable on reboot, but the check is too wide and 
also excludes unavailable pools too.


The attached patch corrects the test to only check writable on active 
pools so I believe should fix the issue your seeing.


If you can test it and lmk that would be great.

Regards
Steve


Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c
===
--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c (revision 
276123)
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c (working copy)
@@ -241,7 +241,8 @@ spa_config_sync(spa_t *target, boolean_t removing,
 * we don't allow them to be written to the cache file.
 */
if ((spa == target && removing) ||
-   !spa_writeable(spa))
+   (spa_state(spa) == POOL_STATE_ACTIVE &&
+   !spa_writeable(spa)))
continue;
 
mutex_enter(&spa->spa_props_lock);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

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

2014-12-30 Thread Steven Hartland
Author: smh
Date: Wed Dec 31 04:54:48 2014
New Revision: 276450
URL: https://svnweb.freebsd.org/changeset/base/276450

Log:
  Correct zpool list displaying invalid EXPANDSZ for unavailable pool vdevs
  
  When pools are unavailable their vdevs are also unavailable which means
  that vdev_max_asize remains at the default zero. This default was being
  used to calculate vs_esize resulting in a negative number as vdev_asize >
  vdev_max_asize, which caused zpool list -v to display 16.0E for EXPANDSZ
  of these vdevs.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c  Wed Dec 31 
04:52:32 2014(r276449)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c  Wed Dec 31 
04:54:48 2014(r276450)
@@ -2776,7 +2776,8 @@ vdev_get_stats(vdev_t *vd, vdev_stat_t *
vs->vs_rsize = vdev_get_min_asize(vd);
if (vd->vdev_ops->vdev_op_leaf)
vs->vs_rsize += VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE;
-   vs->vs_esize = vd->vdev_max_asize - vd->vdev_asize;
+   if (vd->vdev_max_asize != 0)
+   vs->vs_esize = vd->vdev_max_asize - vd->vdev_asize;
vs->vs_configured_ashift = vd->vdev_top != NULL
? vd->vdev_top->vdev_ashift : vd->vdev_ashift;
vs->vs_logical_ashift = vd->vdev_logical_ashift;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276449 - stable/9/contrib/binutils/gas

2014-12-30 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Dec 31 04:52:32 2014
New Revision: 276449
URL: https://svnweb.freebsd.org/changeset/base/276449

Log:
  MFC   r276229:
  Backport fix for binutils 11867: .quad directive not assembled correctly
  
  Alan Modra (and Alan's employer) graciously permitted use of his patch
  under GPLv2.
  
  Obtained from:OpenBSD

Modified:
  stable/9/contrib/binutils/gas/expr.c
  stable/9/contrib/binutils/gas/read.c
Directory Properties:
  stable/9/contrib/binutils/   (props changed)

Modified: stable/9/contrib/binutils/gas/expr.c
==
--- stable/9/contrib/binutils/gas/expr.cWed Dec 31 04:51:09 2014
(r276448)
+++ stable/9/contrib/binutils/gas/expr.cWed Dec 31 04:52:32 2014
(r276449)
@@ -1040,6 +1040,15 @@ operand (expressionS *expressionP, enum 
  {
for (i = 0; i < expressionP->X_add_number; ++i)
  generic_bignum[i] = ~generic_bignum[i];
+
+   /* Extend the bignum to at least the size of .octa.  */
+   if (expressionP->X_add_number < SIZE_OF_LARGE_NUMBER)
+ {
+   expressionP->X_add_number = SIZE_OF_LARGE_NUMBER;
+   for (; i < expressionP->X_add_number; ++i)
+ generic_bignum[i] = ~(LITTLENUM_TYPE) 0;
+ }
+
if (c == '-')
  for (i = 0; i < expressionP->X_add_number; ++i)
{
@@ -1050,14 +1059,12 @@ operand (expressionS *expressionP, enum 
  }
else if (c == '!')
  {
-   int nonzero = 0;
for (i = 0; i < expressionP->X_add_number; ++i)
- {
-   if (generic_bignum[i])
- nonzero = 1;
-   generic_bignum[i] = 0;
- }
-   generic_bignum[0] = nonzero;
+ if (generic_bignum[i] != 0)
+   break;
+   expressionP->X_add_number = i >= expressionP->X_add_number;
+   expressionP->X_op = O_constant;
+   expressionP->X_unsigned = 1;
  }
  }
else if (expressionP->X_op != O_illegal

Modified: stable/9/contrib/binutils/gas/read.c
==
--- stable/9/contrib/binutils/gas/read.cWed Dec 31 04:51:09 2014
(r276448)
+++ stable/9/contrib/binutils/gas/read.cWed Dec 31 04:52:32 2014
(r276449)
@@ -4117,15 +4117,32 @@ emit_expr (expressionS *exp, unsigned in
   unsigned int size;
   LITTLENUM_TYPE *nums;
 
-  know (nbytes % CHARS_PER_LITTLENUM == 0);
-
   size = exp->X_add_number * CHARS_PER_LITTLENUM;
   if (nbytes < size)
{
- as_warn (_("bignum truncated to %d bytes"), nbytes);
+ int i = nbytes / CHARS_PER_LITTLENUM;
+ if (i != 0)
+   {
+ LITTLENUM_TYPE sign = 0;
+ if ((generic_bignum[--i]
+  & (1 << (LITTLENUM_NUMBER_OF_BITS - 1))) != 0)
+   sign = ~(LITTLENUM_TYPE) 0;
+ while (++i < exp->X_add_number)
+   if (generic_bignum[i] != sign)
+ break;
+   }
+ if (i < exp->X_add_number)
+   as_warn (_("bignum truncated to %d bytes"), nbytes);
  size = nbytes;
}
 
+  if (nbytes == 1)
+   {
+ md_number_to_chars (p, (valueT) generic_bignum[0], 1);
+ return;
+   }
+  know (nbytes % CHARS_PER_LITTLENUM == 0);
+
   if (target_big_endian)
{
  while (nbytes > size)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276448 - stable/10/contrib/binutils/gas

2014-12-30 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Dec 31 04:51:09 2014
New Revision: 276448
URL: https://svnweb.freebsd.org/changeset/base/276448

Log:
  MFC   r276229:
  Backport fix for binutils 11867: .quad directive not assembled correctly
  
  Alan Modra (and Alan's employer) graciously permitted use of his patch
  under GPLv2.
  
  Obtained from:OpenBSD

Modified:
  stable/10/contrib/binutils/gas/expr.c
  stable/10/contrib/binutils/gas/read.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/contrib/binutils/gas/expr.c
==
--- stable/10/contrib/binutils/gas/expr.c   Wed Dec 31 04:12:38 2014
(r276447)
+++ stable/10/contrib/binutils/gas/expr.c   Wed Dec 31 04:51:09 2014
(r276448)
@@ -1040,6 +1040,15 @@ operand (expressionS *expressionP, enum 
  {
for (i = 0; i < expressionP->X_add_number; ++i)
  generic_bignum[i] = ~generic_bignum[i];
+
+   /* Extend the bignum to at least the size of .octa.  */
+   if (expressionP->X_add_number < SIZE_OF_LARGE_NUMBER)
+ {
+   expressionP->X_add_number = SIZE_OF_LARGE_NUMBER;
+   for (; i < expressionP->X_add_number; ++i)
+ generic_bignum[i] = ~(LITTLENUM_TYPE) 0;
+ }
+
if (c == '-')
  for (i = 0; i < expressionP->X_add_number; ++i)
{
@@ -1050,14 +1059,12 @@ operand (expressionS *expressionP, enum 
  }
else if (c == '!')
  {
-   int nonzero = 0;
for (i = 0; i < expressionP->X_add_number; ++i)
- {
-   if (generic_bignum[i])
- nonzero = 1;
-   generic_bignum[i] = 0;
- }
-   generic_bignum[0] = nonzero;
+ if (generic_bignum[i] != 0)
+   break;
+   expressionP->X_add_number = i >= expressionP->X_add_number;
+   expressionP->X_op = O_constant;
+   expressionP->X_unsigned = 1;
  }
  }
else if (expressionP->X_op != O_illegal

Modified: stable/10/contrib/binutils/gas/read.c
==
--- stable/10/contrib/binutils/gas/read.c   Wed Dec 31 04:12:38 2014
(r276447)
+++ stable/10/contrib/binutils/gas/read.c   Wed Dec 31 04:51:09 2014
(r276448)
@@ -4117,15 +4117,32 @@ emit_expr (expressionS *exp, unsigned in
   unsigned int size;
   LITTLENUM_TYPE *nums;
 
-  know (nbytes % CHARS_PER_LITTLENUM == 0);
-
   size = exp->X_add_number * CHARS_PER_LITTLENUM;
   if (nbytes < size)
{
- as_warn (_("bignum truncated to %d bytes"), nbytes);
+ int i = nbytes / CHARS_PER_LITTLENUM;
+ if (i != 0)
+   {
+ LITTLENUM_TYPE sign = 0;
+ if ((generic_bignum[--i]
+  & (1 << (LITTLENUM_NUMBER_OF_BITS - 1))) != 0)
+   sign = ~(LITTLENUM_TYPE) 0;
+ while (++i < exp->X_add_number)
+   if (generic_bignum[i] != sign)
+ break;
+   }
+ if (i < exp->X_add_number)
+   as_warn (_("bignum truncated to %d bytes"), nbytes);
  size = nbytes;
}
 
+  if (nbytes == 1)
+   {
+ md_number_to_chars (p, (valueT) generic_bignum[0], 1);
+ return;
+   }
+  know (nbytes % CHARS_PER_LITTLENUM == 0);
+
   if (target_big_endian)
{
  while (nbytes > size)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276447 - stable/10/sys/amd64/vmm/io

2014-12-30 Thread Neel Natu
Author: neel
Date: Wed Dec 31 04:12:38 2014
New Revision: 276447
URL: https://svnweb.freebsd.org/changeset/base/276447

Log:
  MFC r276323
  Implement "special mask mode" in vatpic.

Modified:
  stable/10/sys/amd64/vmm/io/vatpic.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/vmm/io/vatpic.c
==
--- stable/10/sys/amd64/vmm/io/vatpic.c Wed Dec 31 04:11:29 2014
(r276446)
+++ stable/10/sys/amd64/vmm/io/vatpic.c Wed Dec 31 04:12:38 2014
(r276447)
@@ -73,6 +73,7 @@ struct atpic {
uint8_t request;/* Interrupt Request Register (IIR) */
uint8_t service;/* Interrupt Service (ISR) */
uint8_t mask;   /* Interrupt Mask Register (IMR) */
+   uint8_t smm;/* special mask mode */
 
int acnt[8];/* sum of pin asserts and deasserts */
int lowprio;/* lowest priority irq */
@@ -131,8 +132,16 @@ vatpic_get_highest_isrpin(struct atpic *
ATPIC_PIN_FOREACH(pin, atpic, i) {
 bit = (1 << pin);
 
-   if (atpic->service & bit)
-   return (pin);
+   if (atpic->service & bit) {
+   /*
+* An IS bit that is masked by an IMR bit will not be
+* cleared by a non-specific EOI in Special Mask Mode.
+*/
+   if (atpic->smm && (atpic->mask & bit) != 0)
+   continue;
+   else
+   return (pin);
+   }
}
 
return (-1);
@@ -153,6 +162,15 @@ vatpic_get_highest_irrpin(struct atpic *
if (atpic->sfn)
serviced &= ~(1 << 2);
 
+   /*
+* In 'Special Mask Mode', when a mask bit is set in OCW1 it inhibits
+* further interrupts at that level and enables interrupts from all
+* other levels that are not masked. In other words the ISR has no
+* bearing on the levels that can generate interrupts.
+*/
+   if (atpic->smm)
+   serviced = 0;
+
ATPIC_PIN_FOREACH(pin, atpic, tmp) {
bit = 1 << pin;
 
@@ -261,6 +279,7 @@ vatpic_icw1(struct vatpic *vatpic, struc
atpic->lowprio = 7;
atpic->rd_cmd_reg = 0;
atpic->poll = 0;
+   atpic->smm = 0;
 
if ((val & ICW1_SNGL) != 0) {
VATPIC_CTR0(vatpic, "vatpic cascade mode required");
@@ -375,8 +394,10 @@ vatpic_ocw3(struct vatpic *vatpic, struc
VATPIC_CTR1(vatpic, "atpic ocw3 0x%x", val);
 
if (val & OCW3_ESMM) {
-   VATPIC_CTR0(vatpic, "atpic special mask mode not implemented");
-   return (-1);
+   atpic->smm = val & OCW3_SMM ? 1 : 0;
+   VATPIC_CTR2(vatpic, "%s atpic special mask mode %s",
+   master_atpic(vatpic, atpic) ? "master" : "slave",
+   atpic->smm ?  "enabled" : "disabled");
}
 
if (val & OCW3_RR) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276446 - head/cddl/contrib/opensolaris/lib/libzfs/common

2014-12-30 Thread Steven Hartland
Author: smh
Date: Wed Dec 31 04:11:29 2014
New Revision: 276446
URL: https://svnweb.freebsd.org/changeset/base/276446

Log:
  Use the correct state name for unavailable pools in zpool list
  
  This corrects inconsitencies between zpool list and zpool status which are
  both described as displaying the pool  however zpool list would use
  this hardcoded FAULTED instead of the correct UNAVAIL.
  
  MFC after:1 month

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c   Wed Dec 
31 02:38:23 2014(r276445)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c   Wed Dec 
31 04:11:29 2014(r276446)
@@ -256,7 +256,8 @@ zpool_get_prop(zpool_handle_t *zhp, zpoo
break;
 
case ZPOOL_PROP_HEALTH:
-   (void) strlcpy(buf, "FAULTED", len);
+   (void) strlcpy(buf,
+   zpool_pool_state_to_name(POOL_STATE_UNAVAIL), len);
break;
 
case ZPOOL_PROP_GUID:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2014-12-30 Thread Steven Hartland


On 31/12/2014 02:12, Xin Li wrote:

On 12/23/14 01:31, Steven Hartland wrote:

Author: smh
Date: Tue Dec 23 09:31:24 2014
New Revision: 276123
URL: https://svnweb.freebsd.org/changeset/base/276123

Log:
   Always sync the global ZFS config cache to reflect the new mosconfig
   
   This fixes out of date zpool.cache for root pools, which can cause issues

   such as confusion of zdb etc.
   
   MFC after:	1 month


Modified:
   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.cTue Dec 
23 08:51:30 2014(r276122)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.cTue Dec 
23 09:31:24 2014(r276123)
@@ -536,8 +536,7 @@ spa_config_update(spa_t *spa, int what)
/*
 * Update the global config cache to reflect the new mosconfig.
 */
-   if (!spa->spa_is_root)
-   spa_config_sync(spa, B_FALSE, what != SPA_CONFIG_UPDATE_POOL);
+   spa_config_sync(spa, B_FALSE, what != SPA_CONFIG_UPDATE_POOL);
  
  	if (what == SPA_CONFIG_UPDATE_POOL)

spa_config_update(spa, SPA_CONFIG_UPDATE_VDEVS);

It seems like that this change breaks systems where not all pools are
available (e.g. some of pools are encrypted) at boot time, by removing
all these pools from the cache file.

As a result, on the next boot, these pools would not be imported even
when the devices are available (geli attached), and reverting this
change would restore the system to its previous behavior.

Perhaps it have exposed an existing bug?
I've seen pools which where unavailable disappear from zpool list and 
zpool status before this patch, but though it was my imagination as they 
where test pools I was messing around with, so assumed I'd removed them.


Sounds like it wasn't my imagination and it was indeed an existing bug.

Does it do it every time for you then Xin? I ask as when I tried to 
reproduce I couldn't.


Regards
Steve
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2014-12-30 Thread Ian Lepore
Author: ian
Date: Wed Dec 31 02:38:23 2014
New Revision: 276445
URL: https://svnweb.freebsd.org/changeset/base/276445

Log:
  Change the order of operations for the initial cache setup.  Turning off
  the cache before clean/invalidate ensured that no new lines can come into
  the cache or migrate between levels during the operation, but may not be
  safe on some chips.  Instead, if the cache was enabled on entry, do the
  wbinv while it's still enabled, and then disable it and do a separate
  invalidate pass.  After the intitial writeback we know there are no
  dirty lines left and no new dirty lines can be created as long as we
  carefully avoid touching memory before turning the cache off.  Add a
  comment about that so no new code gets inserted between those points.

Modified:
  head/sys/arm/arm/locore-v6.S

Modified: head/sys/arm/arm/locore-v6.S
==
--- head/sys/arm/arm/locore-v6.SWed Dec 31 02:33:12 2014
(r276444)
+++ head/sys/arm/arm/locore-v6.SWed Dec 31 02:38:23 2014
(r276445)
@@ -84,11 +84,9 @@ ASENTRY_NP(_start)
 */
mrc CP15_SCTLR(r7)
tst r7, #CPU_CONTROL_DC_ENABLE
-   beq 1f
-   bic r7, #CPU_CONTROL_DC_ENABLE
-   mcr CP15_SCTLR(r7)
-   ISB
-   bl  dcache_wbinv_poc_all
+   blnedcache_wbinv_poc_all
+
+   /* ! Do not write to memory between wbinv and disabling cache ! */
 
/*
 * Now there are no dirty lines, but there may still be lines marked
@@ -96,6 +94,7 @@ ASENTRY_NP(_start)
 * before setting up new page tables and re-enabling the mmu.
 */
 1: 
+   bic r7, #CPU_CONTROL_DC_ENABLE
bic r7, #CPU_CONTROL_MMU_ENABLE
bic r7, #CPU_CONTROL_IC_ENABLE
bic r7, #CPU_CONTROL_UNAL_ENABLE
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2014-12-30 Thread Ian Lepore
Author: ian
Date: Wed Dec 31 02:33:12 2014
New Revision: 276444
URL: https://svnweb.freebsd.org/changeset/base/276444

Log:
  Fix a paste-o.
  
  Submitted by: Michal Meloun 

Modified:
  head/sys/arm/arm/cpu_asm-v6.S

Modified: head/sys/arm/arm/cpu_asm-v6.S
==
--- head/sys/arm/arm/cpu_asm-v6.S   Wed Dec 31 01:48:23 2014
(r276443)
+++ head/sys/arm/arm/cpu_asm-v6.S   Wed Dec 31 02:33:12 2014
(r276444)
@@ -106,7 +106,7 @@ ASENTRY_NP(dcache_inv_pou_all)
bx  lr
 #else
mrc CP15_CLIDR(r0)
-   andsr0, r0, #0x0700
+   andsr0, r0, #0x3800
mov r0, r0, lsr #26 /* Get LoUU (naturally aligned) */
beq 4f
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2014-12-30 Thread Xin Li
On 12/23/14 01:31, Steven Hartland wrote:
> Author: smh
> Date: Tue Dec 23 09:31:24 2014
> New Revision: 276123
> URL: https://svnweb.freebsd.org/changeset/base/276123
> 
> Log:
>   Always sync the global ZFS config cache to reflect the new mosconfig
>   
>   This fixes out of date zpool.cache for root pools, which can cause issues
>   such as confusion of zdb etc.
>   
>   MFC after:  1 month
> 
> Modified:
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c
> 
> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c
> ==
> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c  Tue Dec 
> 23 08:51:30 2014(r276122)
> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c  Tue Dec 
> 23 09:31:24 2014(r276123)
> @@ -536,8 +536,7 @@ spa_config_update(spa_t *spa, int what)
>   /*
>* Update the global config cache to reflect the new mosconfig.
>*/
> - if (!spa->spa_is_root)
> - spa_config_sync(spa, B_FALSE, what != SPA_CONFIG_UPDATE_POOL);
> + spa_config_sync(spa, B_FALSE, what != SPA_CONFIG_UPDATE_POOL);
>  
>   if (what == SPA_CONFIG_UPDATE_POOL)
>   spa_config_update(spa, SPA_CONFIG_UPDATE_VDEVS);

It seems like that this change breaks systems where not all pools are
available (e.g. some of pools are encrypted) at boot time, by removing
all these pools from the cache file.

As a result, on the next boot, these pools would not be imported even
when the devices are available (geli attached), and reverting this
change would restore the system to its previous behavior.

Perhaps it have exposed an existing bug?

Cheers,
-- 
Xin LI https://www.delphij.net/
FreeBSD - The Power to Serve!   Live free or die
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276443 - head/contrib/elftoolchain/libelf

2014-12-30 Thread Ed Maste
Author: emaste
Date: Wed Dec 31 01:48:23 2014
New Revision: 276443
URL: https://svnweb.freebsd.org/changeset/base/276443

Log:
  libelf: Rearrange size test to prevent integer overflow
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/contrib/elftoolchain/libelf/elf_scn.c

Modified: head/contrib/elftoolchain/libelf/elf_scn.c
==
--- head/contrib/elftoolchain/libelf/elf_scn.c  Wed Dec 31 01:38:02 2014
(r276442)
+++ head/contrib/elftoolchain/libelf/elf_scn.c  Wed Dec 31 01:48:23 2014
(r276443)
@@ -62,7 +62,7 @@ _libelf_load_section_headers(Elf *e, voi
 #defineCHECK_EHDR(E,EH)do {\
if (fsz != (EH)->e_shentsize || \
shnum > SIZE_MAX / fsz ||   \
-   shoff + fsz * shnum > e->e_rawsize) {   \
+   fsz * shnum > e->e_rawsize - shoff) {   \
LIBELF_SET_ERROR(HEADER, 0);\
return (0); \
}   \
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276442 - stable/9/sys/fs/nfsclient

2014-12-30 Thread Rick Macklem
Author: rmacklem
Date: Wed Dec 31 01:38:02 2014
New Revision: 276442
URL: https://svnweb.freebsd.org/changeset/base/276442

Log:
  MFC: r276221
  Delete some duplicate code that was harmless because
  exactly the same code is at the end of the nfscl_checksattr()
  function that is called just before it. As such, this code
  had already been executed and didn't do anything.

Modified:
  stable/9/sys/fs/nfsclient/nfs_clvnops.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/fs/   (props changed)

Modified: stable/9/sys/fs/nfsclient/nfs_clvnops.c
==
--- stable/9/sys/fs/nfsclient/nfs_clvnops.c Wed Dec 31 01:34:37 2014
(r276441)
+++ stable/9/sys/fs/nfsclient/nfs_clvnops.c Wed Dec 31 01:38:02 2014
(r276442)
@@ -1583,20 +1583,6 @@ again:
}
} else if (NFS_ISV34(dvp) && (fmode & O_EXCL)) {
if (nfscl_checksattr(vap, &nfsva)) {
-   /*
-* We are normally called with only a partially
-* initialized VAP. Since the NFSv3 spec says that
-* the server may use the file attributes to
-* store the verifier, the spec requires us to do a
-* SETATTR RPC. FreeBSD servers store the verifier in
-* atime, but we can't really assume that all servers
-* will so we ensure that our SETATTR sets both atime
-* and mtime.
-*/
-   if (vap->va_mtime.tv_sec == VNOVAL)
-   vfs_timestamp(&vap->va_mtime);
-   if (vap->va_atime.tv_sec == VNOVAL)
-   vap->va_atime = vap->va_mtime;
error = nfsrpc_setattr(newvp, vap, NULL, cnp->cn_cred,
cnp->cn_thread, &nfsva, &attrflag, NULL);
if (error && (vap->va_uid != (uid_t)VNOVAL ||
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276441 - stable/9/sys/fs/nfsserver

2014-12-30 Thread Rick Macklem
Author: rmacklem
Date: Wed Dec 31 01:34:37 2014
New Revision: 276441
URL: https://svnweb.freebsd.org/changeset/base/276441

Log:
  MFC: r276193
  A deadlock in the NFSv4 server with vfs.nfsd.enable_locallocks=1
  was reported via email. This was caused by a LOR between the
  sleep lock used to serialize the local locking (nfsrv_locklf())
  and locking the vnode. I believe this patch fixes the problem
  by delaying relocking of the vnode until the sleep lock is
  unlocked (nfsrv_unlocklf()). To avoid nfsvno_advlock() having the side
  effect of unlocking the vnode, unlocking the vnode was moved to before
  the functions that call nfsvno_advlock().
  It shouldn't affect the execution of the default case where
  vfs.nfsd.enable_locallocks=0.

Modified:
  stable/9/sys/fs/nfsserver/nfs_nfsdport.c
  stable/9/sys/fs/nfsserver/nfs_nfsdstate.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/fs/   (props changed)

Modified: stable/9/sys/fs/nfsserver/nfs_nfsdport.c
==
--- stable/9/sys/fs/nfsserver/nfs_nfsdport.cWed Dec 31 01:29:44 2014
(r276440)
+++ stable/9/sys/fs/nfsserver/nfs_nfsdport.cWed Dec 31 01:34:37 2014
(r276441)
@@ -2969,12 +2969,7 @@ nfsvno_advlock(struct vnode *vp, int fty
 
if (nfsrv_dolocallocks == 0)
goto out;
-
-   /* Check for VI_DOOMED here, so that VOP_ADVLOCK() isn't performed. */
-   if ((vp->v_iflag & VI_DOOMED) != 0) {
-   error = EPERM;
-   goto out;
-   }
+   ASSERT_VOP_UNLOCKED(vp, "nfsvno_advlock: vp locked");
 
fl.l_whence = SEEK_SET;
fl.l_type = ftype;
@@ -2998,14 +2993,12 @@ nfsvno_advlock(struct vnode *vp, int fty
fl.l_pid = (pid_t)0;
fl.l_sysid = (int)nfsv4_sysid;
 
-   NFSVOPUNLOCK(vp, 0);
if (ftype == F_UNLCK)
error = VOP_ADVLOCK(vp, (caddr_t)td->td_proc, F_UNLCK, &fl,
(F_POSIX | F_REMOTE));
else
error = VOP_ADVLOCK(vp, (caddr_t)td->td_proc, F_SETLK, &fl,
(F_POSIX | F_REMOTE));
-   NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY);
 
 out:
NFSEXITCODE(error);

Modified: stable/9/sys/fs/nfsserver/nfs_nfsdstate.c
==
--- stable/9/sys/fs/nfsserver/nfs_nfsdstate.c   Wed Dec 31 01:29:44 2014
(r276440)
+++ stable/9/sys/fs/nfsserver/nfs_nfsdstate.c   Wed Dec 31 01:34:37 2014
(r276441)
@@ -1168,6 +1168,8 @@ nfsrv_freeallnfslocks(struct nfsstate *s
vnode_t tvp = NULL;
uint64_t first, end;
 
+   if (vp != NULL)
+   ASSERT_VOP_UNLOCKED(vp, "nfsrv_freeallnfslocks: vnode locked");
lop = LIST_FIRST(&stp->ls_lock);
while (lop != LIST_END(&stp->ls_lock)) {
nlop = LIST_NEXT(lop, lo_lckowner);
@@ -1187,9 +1189,10 @@ nfsrv_freeallnfslocks(struct nfsstate *s
if (gottvp == 0) {
if (nfsrv_dolocallocks == 0)
tvp = NULL;
-   else if (vp == NULL && cansleep != 0)
+   else if (vp == NULL && cansleep != 0) {
tvp = nfsvno_getvp(&lfp->lf_fh);
-   else
+   NFSVOPUNLOCK(tvp, 0);
+   } else
tvp = vp;
gottvp = 1;
}
@@ -1210,7 +1213,7 @@ nfsrv_freeallnfslocks(struct nfsstate *s
lop = nlop;
}
if (vp == NULL && tvp != NULL)
-   vput(tvp);
+   vrele(tvp);
 }
 
 /*
@@ -1321,7 +1324,7 @@ nfsrv_lockctrl(vnode_t vp, struct nfssta
struct nfsclient *clp = NULL;
u_int32_t bits;
int error = 0, haslock = 0, ret, reterr;
-   int getlckret, delegation = 0, filestruct_locked;
+   int getlckret, delegation = 0, filestruct_locked, vnode_unlocked = 0;
fhandle_t nfh;
uint64_t first, end;
uint32_t lock_flags;
@@ -1411,6 +1414,11 @@ tryagain:
 * locking rolled back.
 */
NFSUNLOCKSTATE();
+   if (vnode_unlocked == 0) {
+   ASSERT_VOP_ELOCKED(vp, "nfsrv_lockctrl1");
+   vnode_unlocked = 1;
+   NFSVOPUNLOCK(vp, 0);
+   }
reterr = nfsrv_locallock(vp, lfp,
(new_lop->lo_flags & (NFSLCK_READ | NFSLCK_WRITE)),
new_lop->lo_first, new_lop->lo_end, cfp, p);
@@ -1569,6 +1577,11 @@ tryagain:
if (filestruct_locked != 0) {
/* Roll back local locks. */
NFSUNLOCKSTATE();
+   if (vnode_unlocked == 0) {
+   ASSERT_VOP_ELOCKED(v

svn commit: r276440 - stable/9/sys/kern

2014-12-30 Thread Rick Macklem
Author: rmacklem
Date: Wed Dec 31 01:29:44 2014
New Revision: 276440
URL: https://svnweb.freebsd.org/changeset/base/276440

Log:
  MFC: r276192, r276200
  Modify vop_stdadvlock{async}() so that it only
  locks/unlocks the vnode and does a VOP_GETATTR()
  for the SEEK_END case. This is safe to do, since
  lf_advlock{async}() only uses the size argument
  for the SEEK_END case.
  The NFSv4 server needs this when
  vfs.nfsd.enable_locallocks!=0 since locking the
  vnode results in a LOR that can cause a deadlock
  for the nfsd threads.

Modified:
  stable/9/sys/kern/vfs_default.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/vfs_default.c
==
--- stable/9/sys/kern/vfs_default.c Wed Dec 31 00:54:38 2014
(r276439)
+++ stable/9/sys/kern/vfs_default.c Wed Dec 31 01:29:44 2014
(r276440)
@@ -399,17 +399,24 @@ int
 vop_stdadvlock(struct vop_advlock_args *ap)
 {
struct vnode *vp;
-   struct ucred *cred;
struct vattr vattr;
int error;
 
vp = ap->a_vp;
-   cred = curthread->td_ucred;
-   vn_lock(vp, LK_SHARED | LK_RETRY);
-   error = VOP_GETATTR(vp, &vattr, cred);
-   VOP_UNLOCK(vp, 0);
-   if (error)
-   return (error);
+   if (ap->a_fl->l_whence == SEEK_END) {
+   /*
+* The NFSv4 server must avoid doing a vn_lock() here, since it
+* can deadlock the nfsd threads, due to a LOR.  Fortunately
+* the NFSv4 server always uses SEEK_SET and this code is
+* only required for the SEEK_END case.
+*/
+   vn_lock(vp, LK_SHARED | LK_RETRY);
+   error = VOP_GETATTR(vp, &vattr, curthread->td_ucred);
+   VOP_UNLOCK(vp, 0);
+   if (error)
+   return (error);
+   } else
+   vattr.va_size = 0;
 
return (lf_advlock(ap, &(vp->v_lockf), vattr.va_size));
 }
@@ -418,17 +425,19 @@ int
 vop_stdadvlockasync(struct vop_advlockasync_args *ap)
 {
struct vnode *vp;
-   struct ucred *cred;
struct vattr vattr;
int error;
 
vp = ap->a_vp;
-   cred = curthread->td_ucred;
-   vn_lock(vp, LK_SHARED | LK_RETRY);
-   error = VOP_GETATTR(vp, &vattr, cred);
-   VOP_UNLOCK(vp, 0);
-   if (error)
-   return (error);
+   if (ap->a_fl->l_whence == SEEK_END) {
+   /* The size argument is only needed for SEEK_END. */
+   vn_lock(vp, LK_SHARED | LK_RETRY);
+   error = VOP_GETATTR(vp, &vattr, curthread->td_ucred);
+   VOP_UNLOCK(vp, 0);
+   if (error)
+   return (error);
+   } else
+   vattr.va_size = 0;
 
return (lf_advlockasync(ap, &(vp->v_lockf), vattr.va_size));
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276439 - in head/sys: amd64/include mips/include vm

2014-12-30 Thread Alan Cox
Author: alc
Date: Wed Dec 31 00:54:38 2014
New Revision: 276439
URL: https://svnweb.freebsd.org/changeset/base/276439

Log:
  The physical memory allocator supports the use of distinct free lists for
  managing pages from different address ranges.  Generally speaking, this
  feature is used to increase the likelihood that physical pages are
  available that can meet special DMA requirements or can be accessed through
  a limited-coverage direct mapping (e.g., MIPS).  However, prior to this
  change, the configuration of the free lists was static, i.e., it was
  determined at compile time.  Consequentally, free lists could be created
  for address ranges that held no actual pages, for example, on 32-bit MIPS-
  based systems with 512 MB or less of physical memory.  This change makes
  the creation of the free lists dynamic, i.e., it is based on the available
  physical memory at boot time.
  
  On 64-bit x86-based systems with 64 GB or more of physical memory, create
  free lists for managing pages with physical addresses below 4 GB.  This
  change is to address reported problems with initializing devices that
  require the allocation of physical pages below 4 GB on some systems with
  128 GB or more of physical memory.
  
  PR:   185727
  Differential Revision:https://reviews.freebsd.org/D1274
  Reviewed by:  jhb, kib
  MFC after:3 weeks
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/amd64/include/vmparam.h
  head/sys/mips/include/vmparam.h
  head/sys/vm/vm_phys.c
  head/sys/vm/vm_phys.h

Modified: head/sys/amd64/include/vmparam.h
==
--- head/sys/amd64/include/vmparam.hWed Dec 31 00:44:11 2014
(r276438)
+++ head/sys/amd64/include/vmparam.hWed Dec 31 00:54:38 2014
(r276439)
@@ -101,14 +101,22 @@
 #defineVM_FREEPOOL_DIRECT  1
 
 /*
- * Create two free page lists: VM_FREELIST_DEFAULT is for physical
- * pages that are above the largest physical address that is
- * accessible by ISA DMA and VM_FREELIST_ISADMA is for physical pages
- * that are below that address.
+ * Create up to three free page lists: VM_FREELIST_DMA32 is for physical pages
+ * that have physical addresses below 4G but are not accessible by ISA DMA,
+ * and VM_FREELIST_ISADMA is for physical pages that are accessible by ISA
+ * DMA.
  */
-#defineVM_NFREELIST2
+#defineVM_NFREELIST3
 #defineVM_FREELIST_DEFAULT 0
-#defineVM_FREELIST_ISADMA  1
+#defineVM_FREELIST_DMA32   1
+#defineVM_FREELIST_ISADMA  2
+
+/*
+ * Create the DMA32 free list only if the number of physical pages above
+ * physical address 4G is at least 16M, which amounts to 64GB of physical
+ * memory.
+ */
+#defineVM_DMA32_NPAGES_THRESHOLD   16777216
 
 /*
  * An allocation size of 16MB is supported in order to optimize the

Modified: head/sys/mips/include/vmparam.h
==
--- head/sys/mips/include/vmparam.h Wed Dec 31 00:44:11 2014
(r276438)
+++ head/sys/mips/include/vmparam.h Wed Dec 31 00:54:38 2014
(r276439)
@@ -160,13 +160,11 @@
 #defineVM_FREEPOOL_DIRECT  1
 
 /*
- * we support 2 free lists:
- *
- * - DEFAULT for direct mapped (KSEG0) pages.
- *   Note: This usage of DEFAULT may be misleading because we use
- *   DEFAULT for allocating direct mapped pages. The normal page
- *   allocations use HIGHMEM if available, and then DEFAULT. 
- * - HIGHMEM for other pages 
+ * Create up to two free lists on !__mips_n64: VM_FREELIST_DEFAULT is for
+ * physical pages that are above the largest physical address that is
+ * accessible through the direct map (KSEG0) and VM_FREELIST_LOWMEM is for
+ * physical pages that are below that address.  VM_LOWMEM_BOUNDARY is the
+ * physical address for the end of the direct map (KSEG0).
  */
 #ifdef __mips_n64
 #defineVM_NFREELIST1
@@ -174,10 +172,10 @@
 #defineVM_FREELIST_DIRECT  VM_FREELIST_DEFAULT
 #else
 #defineVM_NFREELIST2
-#defineVM_FREELIST_DEFAULT 1
-#defineVM_FREELIST_HIGHMEM 0
-#defineVM_FREELIST_DIRECT  VM_FREELIST_DEFAULT
-#defineVM_HIGHMEM_ADDRESS  ((vm_paddr_t)0x2000)
+#defineVM_FREELIST_DEFAULT 0
+#defineVM_FREELIST_LOWMEM  1
+#defineVM_FREELIST_DIRECT  VM_FREELIST_LOWMEM
+#defineVM_LOWMEM_BOUNDARY  ((vm_paddr_t)0x2000)
 #endif
 
 /*

Modified: head/sys/vm/vm_phys.c
==
--- head/sys/vm/vm_phys.c   Wed Dec 31 00:44:11 2014(r276438)
+++ head/sys/vm/vm_phys.c   Wed Dec 31 00:54:38 2014(r276439)
@@ -101,7 +101,32 @@ MALLOC_DEFINE(M_FICT_PAGES, "vm_fictitio
 static struct vm_freelist
 vm_phys_free_queues[MAXME

svn commit: r276438 - stable/10/sys/fs/nfsclient

2014-12-30 Thread Rick Macklem
Author: rmacklem
Date: Wed Dec 31 00:44:11 2014
New Revision: 276438
URL: https://svnweb.freebsd.org/changeset/base/276438

Log:
  MFC: r276221
  Delete some duplicate code that was harmless because
  exactly the same code is at the end of the nfscl_checksattr()
  function that is called just before it. As such, this code
  had already been executed and didn't do anything.

Modified:
  stable/10/sys/fs/nfsclient/nfs_clvnops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/nfsclient/nfs_clvnops.c
==
--- stable/10/sys/fs/nfsclient/nfs_clvnops.cWed Dec 31 00:40:10 2014
(r276437)
+++ stable/10/sys/fs/nfsclient/nfs_clvnops.cWed Dec 31 00:44:11 2014
(r276438)
@@ -1608,20 +1608,6 @@ again:
}
} else if (NFS_ISV34(dvp) && (fmode & O_EXCL)) {
if (nfscl_checksattr(vap, &nfsva)) {
-   /*
-* We are normally called with only a partially
-* initialized VAP. Since the NFSv3 spec says that
-* the server may use the file attributes to
-* store the verifier, the spec requires us to do a
-* SETATTR RPC. FreeBSD servers store the verifier in
-* atime, but we can't really assume that all servers
-* will so we ensure that our SETATTR sets both atime
-* and mtime.
-*/
-   if (vap->va_mtime.tv_sec == VNOVAL)
-   vfs_timestamp(&vap->va_mtime);
-   if (vap->va_atime.tv_sec == VNOVAL)
-   vap->va_atime = vap->va_mtime;
error = nfsrpc_setattr(newvp, vap, NULL, cnp->cn_cred,
cnp->cn_thread, &nfsva, &attrflag, NULL);
if (error && (vap->va_uid != (uid_t)VNOVAL ||
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276437 - stable/10/sys/fs/nfsserver

2014-12-30 Thread Rick Macklem
Author: rmacklem
Date: Wed Dec 31 00:40:10 2014
New Revision: 276437
URL: https://svnweb.freebsd.org/changeset/base/276437

Log:
  MFC: r276193
  A deadlock in the NFSv4 server with vfs.nfsd.enable_locallocks=1
  was reported via email. This was caused by a LOR between the
  sleep lock used to serialize the local locking (nfsrv_locklf())
  and locking the vnode. I believe this patch fixes the problem
  by delaying relocking of the vnode until the sleep lock is
  unlocked (nfsrv_unlocklf()). To avoid nfsvno_advlock() having the side
  effect of unlocking the vnode, unlocking the vnode was moved to before
  the functions that call nfsvno_advlock().
  It shouldn't affect the execution of the default case where
  vfs.nfsd.enable_locallocks=0.

Modified:
  stable/10/sys/fs/nfsserver/nfs_nfsdport.c
  stable/10/sys/fs/nfsserver/nfs_nfsdstate.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/nfsserver/nfs_nfsdport.c
==
--- stable/10/sys/fs/nfsserver/nfs_nfsdport.c   Wed Dec 31 00:34:37 2014
(r276436)
+++ stable/10/sys/fs/nfsserver/nfs_nfsdport.c   Wed Dec 31 00:40:10 2014
(r276437)
@@ -2965,12 +2965,7 @@ nfsvno_advlock(struct vnode *vp, int fty
 
if (nfsrv_dolocallocks == 0)
goto out;
-
-   /* Check for VI_DOOMED here, so that VOP_ADVLOCK() isn't performed. */
-   if ((vp->v_iflag & VI_DOOMED) != 0) {
-   error = EPERM;
-   goto out;
-   }
+   ASSERT_VOP_UNLOCKED(vp, "nfsvno_advlock: vp locked");
 
fl.l_whence = SEEK_SET;
fl.l_type = ftype;
@@ -2994,14 +2989,12 @@ nfsvno_advlock(struct vnode *vp, int fty
fl.l_pid = (pid_t)0;
fl.l_sysid = (int)nfsv4_sysid;
 
-   NFSVOPUNLOCK(vp, 0);
if (ftype == F_UNLCK)
error = VOP_ADVLOCK(vp, (caddr_t)td->td_proc, F_UNLCK, &fl,
(F_POSIX | F_REMOTE));
else
error = VOP_ADVLOCK(vp, (caddr_t)td->td_proc, F_SETLK, &fl,
(F_POSIX | F_REMOTE));
-   NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY);
 
 out:
NFSEXITCODE(error);

Modified: stable/10/sys/fs/nfsserver/nfs_nfsdstate.c
==
--- stable/10/sys/fs/nfsserver/nfs_nfsdstate.c  Wed Dec 31 00:34:37 2014
(r276436)
+++ stable/10/sys/fs/nfsserver/nfs_nfsdstate.c  Wed Dec 31 00:40:10 2014
(r276437)
@@ -1344,6 +1344,8 @@ nfsrv_freeallnfslocks(struct nfsstate *s
vnode_t tvp = NULL;
uint64_t first, end;
 
+   if (vp != NULL)
+   ASSERT_VOP_UNLOCKED(vp, "nfsrv_freeallnfslocks: vnode locked");
lop = LIST_FIRST(&stp->ls_lock);
while (lop != LIST_END(&stp->ls_lock)) {
nlop = LIST_NEXT(lop, lo_lckowner);
@@ -1363,9 +1365,10 @@ nfsrv_freeallnfslocks(struct nfsstate *s
if (gottvp == 0) {
if (nfsrv_dolocallocks == 0)
tvp = NULL;
-   else if (vp == NULL && cansleep != 0)
+   else if (vp == NULL && cansleep != 0) {
tvp = nfsvno_getvp(&lfp->lf_fh);
-   else
+   NFSVOPUNLOCK(tvp, 0);
+   } else
tvp = vp;
gottvp = 1;
}
@@ -1386,7 +1389,7 @@ nfsrv_freeallnfslocks(struct nfsstate *s
lop = nlop;
}
if (vp == NULL && tvp != NULL)
-   vput(tvp);
+   vrele(tvp);
 }
 
 /*
@@ -1497,7 +1500,7 @@ nfsrv_lockctrl(vnode_t vp, struct nfssta
struct nfsclient *clp = NULL;
u_int32_t bits;
int error = 0, haslock = 0, ret, reterr;
-   int getlckret, delegation = 0, filestruct_locked;
+   int getlckret, delegation = 0, filestruct_locked, vnode_unlocked = 0;
fhandle_t nfh;
uint64_t first, end;
uint32_t lock_flags;
@@ -1587,6 +1590,11 @@ tryagain:
 * locking rolled back.
 */
NFSUNLOCKSTATE();
+   if (vnode_unlocked == 0) {
+   ASSERT_VOP_ELOCKED(vp, "nfsrv_lockctrl1");
+   vnode_unlocked = 1;
+   NFSVOPUNLOCK(vp, 0);
+   }
reterr = nfsrv_locallock(vp, lfp,
(new_lop->lo_flags & (NFSLCK_READ | NFSLCK_WRITE)),
new_lop->lo_first, new_lop->lo_end, cfp, p);
@@ -1748,6 +1756,11 @@ tryagain:
if (filestruct_locked != 0) {
/* Roll back local locks. */
NFSUNLOCKSTATE();
+   if (vnode_unlocked == 0) {
+   ASSERT_VOP_ELOCKED(vp, "nfsrv_lockctrl2");
+

svn commit: r276436 - stable/10/sys/kern

2014-12-30 Thread Rick Macklem
Author: rmacklem
Date: Wed Dec 31 00:34:37 2014
New Revision: 276436
URL: https://svnweb.freebsd.org/changeset/base/276436

Log:
  MFC: r276192, r276200
  Modify vop_stdadvlock{async}() so that it only
  locks/unlocks the vnode and does a VOP_GETATTR()
  for the SEEK_END case. This is safe to do, since
  lf_advlock{async}() only uses the size argument
  for the SEEK_END case.
  The NFSv4 server needs this when
  vfs.nfsd.enable_locallocks!=0 since locking the
  vnode results in a LOR that can cause a deadlock
  for the nfsd threads.

Modified:
  stable/10/sys/kern/vfs_default.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/vfs_default.c
==
--- stable/10/sys/kern/vfs_default.cWed Dec 31 00:09:05 2014
(r276435)
+++ stable/10/sys/kern/vfs_default.cWed Dec 31 00:34:37 2014
(r276436)
@@ -399,17 +399,24 @@ int
 vop_stdadvlock(struct vop_advlock_args *ap)
 {
struct vnode *vp;
-   struct ucred *cred;
struct vattr vattr;
int error;
 
vp = ap->a_vp;
-   cred = curthread->td_ucred;
-   vn_lock(vp, LK_SHARED | LK_RETRY);
-   error = VOP_GETATTR(vp, &vattr, cred);
-   VOP_UNLOCK(vp, 0);
-   if (error)
-   return (error);
+   if (ap->a_fl->l_whence == SEEK_END) {
+   /*
+* The NFSv4 server must avoid doing a vn_lock() here, since it
+* can deadlock the nfsd threads, due to a LOR.  Fortunately
+* the NFSv4 server always uses SEEK_SET and this code is
+* only required for the SEEK_END case.
+*/
+   vn_lock(vp, LK_SHARED | LK_RETRY);
+   error = VOP_GETATTR(vp, &vattr, curthread->td_ucred);
+   VOP_UNLOCK(vp, 0);
+   if (error)
+   return (error);
+   } else
+   vattr.va_size = 0;
 
return (lf_advlock(ap, &(vp->v_lockf), vattr.va_size));
 }
@@ -418,17 +425,19 @@ int
 vop_stdadvlockasync(struct vop_advlockasync_args *ap)
 {
struct vnode *vp;
-   struct ucred *cred;
struct vattr vattr;
int error;
 
vp = ap->a_vp;
-   cred = curthread->td_ucred;
-   vn_lock(vp, LK_SHARED | LK_RETRY);
-   error = VOP_GETATTR(vp, &vattr, cred);
-   VOP_UNLOCK(vp, 0);
-   if (error)
-   return (error);
+   if (ap->a_fl->l_whence == SEEK_END) {
+   /* The size argument is only needed for SEEK_END. */
+   vn_lock(vp, LK_SHARED | LK_RETRY);
+   error = VOP_GETATTR(vp, &vattr, curthread->td_ucred);
+   VOP_UNLOCK(vp, 0);
+   if (error)
+   return (error);
+   } else
+   vattr.va_size = 0;
 
return (lf_advlockasync(ap, &(vp->v_lockf), vattr.va_size));
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276435 - stable/9/usr.bin/file

2014-12-30 Thread Xin LI
Author: delphij
Date: Wed Dec 31 00:09:05 2014
New Revision: 276435
URL: https://svnweb.freebsd.org/changeset/base/276435

Log:
  MFC r267897: Update Makefile to reflect file update.

Modified:
  stable/9/usr.bin/file/Makefile
Directory Properties:
  stable/9/usr.bin/file/   (props changed)

Modified: stable/9/usr.bin/file/Makefile
==
--- stable/9/usr.bin/file/Makefile  Wed Dec 31 00:08:37 2014
(r276434)
+++ stable/9/usr.bin/file/Makefile  Wed Dec 31 00:09:05 2014
(r276435)
@@ -21,7 +21,8 @@
 # 4. This notice may not be removed or altered.
 
 SRCDIR=${.CURDIR}/../../contrib/file
-.PATH: ${SRCDIR}
+.PATH: ${SRCDIR}/src
+.PATH: ${SRCDIR}/doc
 
 PROG=  file
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276434 - stable/9/share/man/man4

2014-12-30 Thread Peter Jeremy
Author: peterj
Date: Wed Dec 31 00:08:37 2014
New Revision: 276434
URL: https://svnweb.freebsd.org/changeset/base/276434

Log:
  MFH r230580:
  Don't mention no longer supported ioctl commands.
  
  MFH r274083:
  convert .Nm to proper .Xr's...
  
  MFH r275298:
  Cross reference tap(4) and tun(4) and include a short explanation as
  to how they differ.  This will assist users in selecting which interface
  is more appropriate for their purposes.
  
  No objection: glebius (r230580), jmg (r274083)
  Approved by:  grog (co-mentor)

Modified:
  stable/9/share/man/man4/tap.4
  stable/9/share/man/man4/tun.4
Directory Properties:
  stable/9/share/man/man4/   (props changed)

Modified: stable/9/share/man/man4/tap.4
==
--- stable/9/share/man/man4/tap.4   Tue Dec 30 23:52:48 2014
(r276433)
+++ stable/9/share/man/man4/tap.4   Wed Dec 31 00:08:37 2014
(r276434)
@@ -1,7 +1,7 @@
 .\" $FreeBSD$
 .\" Based on PR#2411
 .\"
-.Dd September 8, 2008
+.Dd November 30, 2014
 .Dt TAP 4
 .Os
 .Sh NAME
@@ -18,22 +18,33 @@ described as the network interface analo
 that is,
 .Nm
 does for network interfaces what the
-.Nm pty
+.Xr pty 4
 driver does for terminals.
 .Pp
 The
 .Nm
 driver, like the
-.Nm pty
+.Xr pty 4
 driver, provides two interfaces: an interface like the usual facility
 it is simulating
 (an Ethernet network interface in the case of
 .Nm ,
 or a terminal for
-.Nm pty ) ,
+.Xr pty 4 ) ,
 and a character-special device
 .Dq control
 interface.
+A client program transfers Ethernet frames to or from the 
+.Nm
+.Dq control
+interface.
+The
+.Xr tun 4
+interface provides similar functionality at the network layer:
+a client will transfer IP (by default) packets to or from a
+.Xr tun 4
+.Dq control
+interface.
 .Pp
 The network interfaces are named
 .Dq Li tap0 ,
@@ -89,11 +100,7 @@ Control devices (once successfully opene
 is unloaded or the interface is destroyed.
 .Pp
 Each interface supports the usual Ethernet network interface
-.Xr ioctl 2 Ns s ,
-such as
-.Dv SIOCSIFADDR
-and
-.Dv SIOCSIFNETMASK ,
+.Xr ioctl 2 Ns s
 and thus can be used with
 .Xr ifconfig 8
 like any other Ethernet interface.
@@ -318,4 +325,5 @@ VMware
 .El
 .Sh SEE ALSO
 .Xr inet 4 ,
-.Xr intro 4
+.Xr intro 4 ,
+.Xr tun 4

Modified: stable/9/share/man/man4/tun.4
==
--- stable/9/share/man/man4/tun.4   Tue Dec 30 23:52:48 2014
(r276433)
+++ stable/9/share/man/man4/tun.4   Wed Dec 31 00:08:37 2014
(r276434)
@@ -2,7 +2,7 @@
 .\" $FreeBSD$
 .\" Based on PR#2411
 .\"
-.Dd February 4, 2007
+.Dd November 30, 2014
 .Dt TUN 4
 .Os
 .Sh NAME
@@ -35,6 +35,17 @@ or a terminal for
 and a character-special device
 .Dq control
 interface.
+A client program transfers IP (by default) packets to or from the 
+.Nm
+.Dq control
+interface.
+The
+.Xr tap 4
+interface provides similar functionality at the Ethernet layer:
+a client will transfer Ethernet frames to or from a
+.Xr tap 4
+.Dq control
+interface.
 .Pp
 The network interfaces are named
 .Dq Li tun0 ,
@@ -307,6 +318,7 @@ them pile up.
 .Xr inet 4 ,
 .Xr intro 4 ,
 .Xr pty 4 ,
+.Xr tap 4 ,
 .Xr ifconfig 8
 .Sh AUTHORS
 This manual page was originally obtained from
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276433 - stable/10/share/man/man4

2014-12-30 Thread Peter Jeremy
Author: peterj
Date: Tue Dec 30 23:52:48 2014
New Revision: 276433
URL: https://svnweb.freebsd.org/changeset/base/276433

Log:
  MFH r274083:
  convert .Nm to proper .Xr's...
  
  MFH r275298:
  Cross reference tap(4) and tun(4) and include a short explanation as
  to how they differ.  This will assist users in selecting which interface
  is more appropriate for their purposes.
  
  No objection: jmg (r274083)
  Approved by:  grog (co-mentor)

Modified:
  stable/10/share/man/man4/tap.4
  stable/10/share/man/man4/tun.4
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/tap.4
==
--- stable/10/share/man/man4/tap.4  Tue Dec 30 23:38:31 2014
(r276432)
+++ stable/10/share/man/man4/tap.4  Tue Dec 30 23:52:48 2014
(r276433)
@@ -1,7 +1,7 @@
 .\" $FreeBSD$
 .\" Based on PR#2411
 .\"
-.Dd January 26, 2012
+.Dd November 30, 2014
 .Dt TAP 4
 .Os
 .Sh NAME
@@ -18,22 +18,33 @@ described as the network interface analo
 that is,
 .Nm
 does for network interfaces what the
-.Nm pty
+.Xr pty 4
 driver does for terminals.
 .Pp
 The
 .Nm
 driver, like the
-.Nm pty
+.Xr pty 4
 driver, provides two interfaces: an interface like the usual facility
 it is simulating
 (an Ethernet network interface in the case of
 .Nm ,
 or a terminal for
-.Nm pty ) ,
+.Xr pty 4 ) ,
 and a character-special device
 .Dq control
 interface.
+A client program transfers Ethernet frames to or from the 
+.Nm
+.Dq control
+interface.
+The
+.Xr tun 4
+interface provides similar functionality at the network layer:
+a client will transfer IP (by default) packets to or from a
+.Xr tun 4
+.Dq control
+interface.
 .Pp
 The network interfaces are named
 .Dq Li tap0 ,
@@ -314,4 +325,5 @@ VMware
 .El
 .Sh SEE ALSO
 .Xr inet 4 ,
-.Xr intro 4
+.Xr intro 4 ,
+.Xr tun 4

Modified: stable/10/share/man/man4/tun.4
==
--- stable/10/share/man/man4/tun.4  Tue Dec 30 23:38:31 2014
(r276432)
+++ stable/10/share/man/man4/tun.4  Tue Dec 30 23:52:48 2014
(r276433)
@@ -2,7 +2,7 @@
 .\" $FreeBSD$
 .\" Based on PR#2411
 .\"
-.Dd February 4, 2007
+.Dd November 30, 2014
 .Dt TUN 4
 .Os
 .Sh NAME
@@ -35,6 +35,17 @@ or a terminal for
 and a character-special device
 .Dq control
 interface.
+A client program transfers IP (by default) packets to or from the 
+.Nm
+.Dq control
+interface.
+The
+.Xr tap 4
+interface provides similar functionality at the Ethernet layer:
+a client will transfer Ethernet frames to or from a
+.Xr tap 4
+.Dq control
+interface.
 .Pp
 The network interfaces are named
 .Dq Li tun0 ,
@@ -307,6 +318,7 @@ them pile up.
 .Xr inet 4 ,
 .Xr intro 4 ,
 .Xr pty 4 ,
+.Xr tap 4 ,
 .Xr ifconfig 8
 .Sh AUTHORS
 This manual page was originally obtained from
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276432 - head/sys/amd64/vmm/amd

2014-12-30 Thread Neel Natu
Author: neel
Date: Tue Dec 30 23:38:31 2014
New Revision: 276432
URL: https://svnweb.freebsd.org/changeset/base/276432

Log:
  Initialize all fields of 'struct vm_exception exception' before passing it to
  vm_inject_exception(). This fixes the issue that 'exception.cpuid' is
  uninitialized when calling 'vm_inject_exception()'.
  
  However, in practice this change is a no-op because vm_inject_exception()
  does not use 'exception.cpuid' for anything.
  
  Reported by:Coverity Scan
  CID:1261297
  MFC after:  3 days

Modified:
  head/sys/amd64/vmm/amd/svm.c

Modified: head/sys/amd64/vmm/amd/svm.c
==
--- head/sys/amd64/vmm/amd/svm.cTue Dec 30 22:46:20 2014
(r276431)
+++ head/sys/amd64/vmm/amd/svm.cTue Dec 30 23:38:31 2014
(r276432)
@@ -1322,9 +1322,12 @@ svm_vmexit(struct svm_softc *svm_sc, int
 
if (reflect) {
/* Reflect the exception back into the guest */
+   bzero(&exception, sizeof(struct vm_exception));
exception.vector = idtvec;
-   exception.error_code_valid = errcode_valid;
-   exception.error_code = errcode_valid ? info1 : 0;
+   if (errcode_valid) {
+   exception.error_code = info1;
+   exception.error_code_valid = 1;
+   }
VCPU_CTR2(svm_sc->vm, vcpu, "Reflecting exception "
"%d/%#x into the guest", exception.vector,
exception.error_code);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2014-12-30 Thread Bjoern A. Zeeb

> On 30 Dec 2014, at 21:40 , Mateusz Guzik  wrote:
> 
> Author: mjg
> Date: Tue Dec 30 21:40:45 2014
> New Revision: 276424
> URL: https://svnweb.freebsd.org/changeset/base/276424
> 
> Log:
>  Convert vfs hash lock from a mutex to an rwlock.

This is very obvious from the change.

What is not and should be described as well is some of this:

- Why?
- What are the benefits?
- What are the locking implications?
- Does it make a performance difference?  If yes, was it measured?
- …  (you got the idea)



> 
> Modified:
>  head/sys/kern/vfs_hash.c
> 
> Modified: head/sys/kern/vfs_hash.c
> ==
> --- head/sys/kern/vfs_hash.c  Tue Dec 30 20:46:01 2014(r276423)
> +++ head/sys/kern/vfs_hash.c  Tue Dec 30 21:40:45 2014(r276424)
> @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
> #include 
> #include 
> #include 
> +#include 
> #include 
> 
> static MALLOC_DEFINE(M_VFS_HASH, "vfs_hash", "VFS hash table");
> @@ -40,14 +41,14 @@ static MALLOC_DEFINE(M_VFS_HASH, "vfs_ha
> static LIST_HEAD(vfs_hash_head, vnode)*vfs_hash_tbl;
> static LIST_HEAD(,vnode)  vfs_hash_side;
> static u_long vfs_hash_mask;
> -static struct mtxvfs_hash_mtx;
> +static struct rwlock vfs_hash_lock;
> 
> static void
> vfs_hashinit(void *dummy __unused)
> {
> 
>   vfs_hash_tbl = hashinit(desiredvnodes, M_VFS_HASH, &vfs_hash_mask);
> - mtx_init(&vfs_hash_mtx, "vfs hash", NULL, MTX_DEF);
> + rw_init(&vfs_hash_lock, "vfs hash");
>   LIST_INIT(&vfs_hash_side);
> }
> 
> @@ -75,7 +76,7 @@ vfs_hash_get(const struct mount *mp, u_i
>   int error;
> 
>   while (1) {
> - mtx_lock(&vfs_hash_mtx);
> + rw_rlock(&vfs_hash_lock);
>   LIST_FOREACH(vp, vfs_hash_bucket(mp, hash), v_hashlist) {
>   if (vp->v_hash != hash)
>   continue;
> @@ -84,7 +85,7 @@ vfs_hash_get(const struct mount *mp, u_i
>   if (fn != NULL && fn(vp, arg))
>   continue;
>   VI_LOCK(vp);
> - mtx_unlock(&vfs_hash_mtx);
> + rw_runlock(&vfs_hash_lock);
>   error = vget(vp, flags | LK_INTERLOCK, td);
>   if (error == ENOENT && (flags & LK_NOWAIT) == 0)
>   break;
> @@ -94,7 +95,7 @@ vfs_hash_get(const struct mount *mp, u_i
>   return (0);
>   }
>   if (vp == NULL) {
> - mtx_unlock(&vfs_hash_mtx);
> + rw_runlock(&vfs_hash_lock);
>   *vpp = NULL;
>   return (0);
>   }
> @@ -105,9 +106,9 @@ void
> vfs_hash_remove(struct vnode *vp)
> {
> 
> - mtx_lock(&vfs_hash_mtx);
> + rw_wlock(&vfs_hash_lock);
>   LIST_REMOVE(vp, v_hashlist);
> - mtx_unlock(&vfs_hash_mtx);
> + rw_wunlock(&vfs_hash_lock);
> }
> 
> int
> @@ -118,7 +119,7 @@ vfs_hash_insert(struct vnode *vp, u_int 
> 
>   *vpp = NULL;
>   while (1) {
> - mtx_lock(&vfs_hash_mtx);
> + rw_wlock(&vfs_hash_lock);
>   LIST_FOREACH(vp2,
>   vfs_hash_bucket(vp->v_mount, hash), v_hashlist) {
>   if (vp2->v_hash != hash)
> @@ -128,13 +129,13 @@ vfs_hash_insert(struct vnode *vp, u_int 
>   if (fn != NULL && fn(vp2, arg))
>   continue;
>   VI_LOCK(vp2);
> - mtx_unlock(&vfs_hash_mtx);
> + rw_wunlock(&vfs_hash_lock);
>   error = vget(vp2, flags | LK_INTERLOCK, td);
>   if (error == ENOENT && (flags & LK_NOWAIT) == 0)
>   break;
> - mtx_lock(&vfs_hash_mtx);
> + rw_wlock(&vfs_hash_lock);
>   LIST_INSERT_HEAD(&vfs_hash_side, vp, v_hashlist);
> - mtx_unlock(&vfs_hash_mtx);
> + rw_wunlock(&vfs_hash_lock);
>   vput(vp);
>   if (!error)
>   *vpp = vp2;
> @@ -146,7 +147,7 @@ vfs_hash_insert(struct vnode *vp, u_int 
>   }
>   vp->v_hash = hash;
>   LIST_INSERT_HEAD(vfs_hash_bucket(vp->v_mount, hash), vp, v_hashlist);
> - mtx_unlock(&vfs_hash_mtx);
> + rw_wunlock(&vfs_hash_lock);
>   return (0);
> }
> 
> @@ -154,9 +155,9 @@ void
> vfs_hash_rehash(struct vnode *vp, u_int hash)
> {
> 
> - mtx_lock(&vfs_hash_mtx);
> + rw_wlock(&vfs_hash_lock);
>   LIST_REMOVE(vp, v_hashlist);
>   LIST_INSERT_HEAD(vfs_hash_bucket(vp->v_mount, hash), vp, v_hashlist);
>   vp->v_hash = hash;
> - mtx_unlock(&vfs_hash_mtx);
> + rw_wunlock(&vfs_hash_lock);
> }
> 

— 
Bjoern A. Zeeb  Charles Haddon Spurgeon:
"Friends

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

2014-12-30 Thread Mateusz Guzik
On Wed, Dec 31, 2014 at 01:12:43AM +0300, Gleb Smirnoff wrote:
> On Tue, Dec 30, 2014 at 09:22:27PM +0100, Mateusz Guzik wrote:
> M> On Tue, Dec 30, 2014 at 11:06:01PM +0300, Gleb Smirnoff wrote:
> M> > On Sun, Dec 28, 2014 at 07:24:02PM +, Mateusz Guzik wrote:
> M> > M> Author: mjg
> M> > M> Date: Sun Dec 28 19:24:01 2014
> M> > M> New Revision: 276341
> M> > M> URL: https://svnweb.freebsd.org/changeset/base/276341
> M> > M> 
> M> > M> Log:
> M> > M>   sysctl: don't modify oid_running for static nodes
> M> > M>   
> M> > M>   It is necessary to prevent nodes from being destroyed while used, 
> but static
> M> > M>   ones cannot be destroyed.
> M> > 
> M> > What about nodes that go away on kernel module unload? Not sure
> M> > they were protected properly before your commit, though :)
> M> > 
> M> 
> M> They are not static.
> 
> I don't see how they can get CTLFLAG_DYN. Look for any (un)loadable
> modules as an example, e.g. aio(4) implemented in vfs_aio.c. How its
> sysctls get CTLFLAG_DYN?
> 

Bugger.

Turns out indeed one can sysctl_register_oid and then it does not have
the flag. What's more, one can unregister it in similar way which
completely ignores oid_running anyway.

As such, yes, there is a bug but my changes don't affect it.

Maybe I'll try to fix it later with a proven hack (a macro which expands
to 0 at kernel compile time and to _DYN during module build).

-- 
Mateusz Guzik 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276430 - head/contrib/netbsd-tests/lib/libc/sys

2014-12-30 Thread Garrett Cooper
Author: ngie
Date: Tue Dec 30 22:32:29 2014
New Revision: 276430
URL: https://svnweb.freebsd.org/changeset/base/276430

Log:
  Expect access_test:access_inval to fail before __FreeBSD_version == 1100033
  
  This will allow me to MFC the test, as jilles@ requested that I don't MFC the
  access(2) KBI change to 10-STABLE in r271655

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_access.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_access.c
==
--- head/contrib/netbsd-tests/lib/libc/sys/t_access.c   Tue Dec 30 22:22:46 
2014(r276429)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_access.c   Tue Dec 30 22:32:29 
2014(r276430)
@@ -41,6 +41,7 @@ __RCSID("$NetBSD: t_access.c,v 1.1 2011/
 #include 
 
 #ifdef __FreeBSD__
+#include 
 #include 
 #endif
 
@@ -116,6 +117,10 @@ ATF_TC_HEAD(access_inval, tc)
 ATF_TC_BODY(access_inval, tc)
 {
 
+#if defined(__FreeBSD__) && __FreeBSD_version < 1100033
+   atf_tc_expect_fail("arguments to access aren't validated; see "
+   "bug # 181155 for more details");
+#endif
errno = 0;
 
ATF_REQUIRE(access("/usr", -1) != 0);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276429 - in stable/10: sys/amd64/include sys/amd64/vmm sys/amd64/vmm/intel sys/amd64/vmm/io sys/modules/linux sys/modules/vmm usr.sbin/bhyve

2014-12-30 Thread Neel Natu
Author: neel
Date: Tue Dec 30 22:22:46 2014
New Revision: 276429
URL: https://svnweb.freebsd.org/changeset/base/276429

Log:
  MFC r273683
  Move the ACPI PM timer emulation into vmm.ko.
  
  MFC r273706
  Change the type of the first argument to the I/O emulation handlers to
  'struct vm *'.
  
  MFC r273710
  Add a comment explaining the intent behind the I/O reservation [0x72-0x77].
  
  MFC r273744
  Add foo_genassym.c files to DPSRCS so dependencies for them are generated.
  This ensures these objects are rebuilt to generate an updated header of
  assembly constants if needed.
  
  MFC r274045
  If the start bit, PxCMD.ST, is cleared and nothing is in-flight then
  PxCI, PxSACT, PxCMD.CCS and PxCMD.CR should be 0.
  
  MFC r274076
  Improve the ability to cancel an in-flight request by using an interrupt,
  via SIGCONT, to force the read or write system call to return prematurely.
  
  MFC r274330
  To allow a request to be submitted from within the callback routine of
  a completing one increase the total by 1 but don't advertise it.
  
  MFC r274931
  Change the lower bound for guest vmspace allocation to 0 instead of using
  the VM_MIN_ADDRESS constant.
  
  MFC r275817
  For level triggered interrupts clear the PIC IRR bit when the interrupt pin
  is deasserted.
  
  MFC r275850
  Fix 8259 IRQ priority resolver.
  
  MFC r275952
  Various 8259 device model improvements.
  
  MFC r275965
  Emulate writes to the IA32_MISC_ENABLE MSR.

Added:
  stable/10/sys/amd64/vmm/io/vpmtmr.c
 - copied, changed from r273683, head/sys/amd64/vmm/io/vpmtmr.c
  stable/10/sys/amd64/vmm/io/vpmtmr.h
 - copied, changed from r273683, head/sys/amd64/vmm/io/vpmtmr.h
Deleted:
  stable/10/usr.sbin/bhyve/pmtmr.c
Modified:
  stable/10/sys/amd64/include/vmm.h
  stable/10/sys/amd64/vmm/intel/vmx_msr.c
  stable/10/sys/amd64/vmm/io/vatpic.c
  stable/10/sys/amd64/vmm/io/vatpic.h
  stable/10/sys/amd64/vmm/io/vatpit.c
  stable/10/sys/amd64/vmm/io/vatpit.h
  stable/10/sys/amd64/vmm/vmm.c
  stable/10/sys/amd64/vmm/vmm_ioport.c
  stable/10/sys/amd64/vmm/vmm_ioport.h
  stable/10/sys/modules/linux/Makefile
  stable/10/sys/modules/vmm/Makefile
  stable/10/usr.sbin/bhyve/Makefile
  stable/10/usr.sbin/bhyve/block_if.c
  stable/10/usr.sbin/bhyve/pci_ahci.c
  stable/10/usr.sbin/bhyve/rtc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/include/vmm.h
==
--- stable/10/sys/amd64/include/vmm.h   Tue Dec 30 22:19:34 2014
(r276428)
+++ stable/10/sys/amd64/include/vmm.h   Tue Dec 30 22:22:46 2014
(r276429)
@@ -285,6 +285,7 @@ int vm_assign_pptdev(struct vm *vm, int 
 int vm_unassign_pptdev(struct vm *vm, int bus, int slot, int func);
 struct vatpic *vm_atpic(struct vm *vm);
 struct vatpit *vm_atpit(struct vm *vm);
+struct vpmtmr *vm_pmtmr(struct vm *vm);
 
 /*
  * Inject exception 'vme' into the guest vcpu. This function returns 0 on

Modified: stable/10/sys/amd64/vmm/intel/vmx_msr.c
==
--- stable/10/sys/amd64/vmm/intel/vmx_msr.c Tue Dec 30 22:19:34 2014
(r276428)
+++ stable/10/sys/amd64/vmm/intel/vmx_msr.c Tue Dec 30 22:22:46 2014
(r276429)
@@ -376,9 +376,31 @@ vmx_rdmsr(struct vmx *vmx, int vcpuid, u
 int
 vmx_wrmsr(struct vmx *vmx, int vcpuid, u_int num, uint64_t val, bool *retu)
 {
-   int error = 0;
-
+   uint64_t changed;
+   int error;
+   
+   error = 0;
switch (num) {
+   case MSR_IA32_MISC_ENABLE:
+   changed = val ^ misc_enable;
+   /*
+* If the host has disabled the NX feature then the guest
+* also cannot use it. However, a Linux guest will try to
+* enable the NX feature by writing to the MISC_ENABLE MSR.
+*
+* This can be safely ignored because the memory management
+* code looks at CPUID.8001H:EDX.NX to check if the
+* functionality is actually enabled.
+*/
+   changed &= ~(1UL << 34);
+
+   /*
+* Punt to userspace if any other bits are being modified.
+*/
+   if (changed)
+   error = EINVAL;
+
+   break;
default:
error = EINVAL;
break;

Modified: stable/10/sys/amd64/vmm/io/vatpic.c
==
--- stable/10/sys/amd64/vmm/io/vatpic.c Tue Dec 30 22:19:34 2014
(r276428)
+++ stable/10/sys/amd64/vmm/io/vatpic.c Tue Dec 30 22:22:46 2014
(r276429)
@@ -75,7 +75,7 @@ struct atpic {
uint8_t mask;   /* Interrupt Mask Register (IMR) */
 
int acnt[8];/* sum of pin asserts and deasserts */
-   int priority;   /* current pin priority */
+ 

svn commit: r276428 - in head: lib/libvmmapi sys/amd64/include sys/amd64/vmm sys/amd64/vmm/io sys/modules/vmm usr.sbin/bhyve usr.sbin/bhyvectl

2014-12-30 Thread Neel Natu
Author: neel
Date: Tue Dec 30 22:19:34 2014
New Revision: 276428
URL: https://svnweb.freebsd.org/changeset/base/276428

Log:
  Replace bhyve's minimal RTC emulation with a fully featured one in vmm.ko.
  
  The new RTC emulation supports all interrupt modes: periodic, update ended
  and alarm. It is also capable of maintaining the date/time and NVRAM contents
  across virtual machine reset. Also, the date/time fields can now be modified
  by the guest.
  
  Since bhyve now emulates both the PIT and the RTC there is no need for
  "Legacy Replacement Routing" in the HPET so get rid of it.
  
  The RTC device state can be inspected via bhyvectl as follows:
  bhyvectl --vm=vm --get-rtc-time
  bhyvectl --vm=vm --set-rtc-time=
  bhyvectl --vm=vm --rtc-nvram-offset= --get-rtc-nvram
  bhyvectl --vm=vm --rtc-nvram-offset= --set-rtc-nvram=
  
  Reviewed by:  tychon
  Discussed with:   grehan
  Differential Revision:https://reviews.freebsd.org/D1385
  MFC after:2 weeks

Added:
  head/sys/amd64/vmm/io/vrtc.c   (contents, props changed)
  head/sys/amd64/vmm/io/vrtc.h   (contents, props changed)
Modified:
  head/lib/libvmmapi/vmmapi.c
  head/lib/libvmmapi/vmmapi.h
  head/sys/amd64/include/vmm.h
  head/sys/amd64/include/vmm_dev.h
  head/sys/amd64/vmm/io/vhpet.c
  head/sys/amd64/vmm/vmm.c
  head/sys/amd64/vmm/vmm_dev.c
  head/sys/amd64/vmm/vmm_ioport.c
  head/sys/modules/vmm/Makefile
  head/usr.sbin/bhyve/rtc.c
  head/usr.sbin/bhyvectl/bhyvectl.c

Modified: head/lib/libvmmapi/vmmapi.c
==
--- head/lib/libvmmapi/vmmapi.c Tue Dec 30 22:04:24 2014(r276427)
+++ head/lib/libvmmapi/vmmapi.c Tue Dec 30 22:19:34 2014(r276428)
@@ -1146,3 +1146,55 @@ vm_set_intinfo(struct vmctx *ctx, int vc
error = ioctl(ctx->fd, VM_SET_INTINFO, &vmii);
return (error);
 }
+
+int
+vm_rtc_write(struct vmctx *ctx, int offset, uint8_t value)
+{
+   struct vm_rtc_data rtcdata;
+   int error;
+
+   bzero(&rtcdata, sizeof(struct vm_rtc_data));
+   rtcdata.offset = offset;
+   rtcdata.value = value;
+   error = ioctl(ctx->fd, VM_RTC_WRITE, &rtcdata);
+   return (error);
+}
+
+int
+vm_rtc_read(struct vmctx *ctx, int offset, uint8_t *retval)
+{
+   struct vm_rtc_data rtcdata;
+   int error;
+
+   bzero(&rtcdata, sizeof(struct vm_rtc_data));
+   rtcdata.offset = offset;
+   error = ioctl(ctx->fd, VM_RTC_READ, &rtcdata);
+   if (error == 0)
+   *retval = rtcdata.value;
+   return (error);
+}
+
+int
+vm_rtc_settime(struct vmctx *ctx, time_t secs)
+{
+   struct vm_rtc_time rtctime;
+   int error;
+
+   bzero(&rtctime, sizeof(struct vm_rtc_time));
+   rtctime.secs = secs;
+   error = ioctl(ctx->fd, VM_RTC_SETTIME, &rtctime);
+   return (error);
+}
+
+int
+vm_rtc_gettime(struct vmctx *ctx, time_t *secs)
+{
+   struct vm_rtc_time rtctime;
+   int error;
+
+   bzero(&rtctime, sizeof(struct vm_rtc_time));
+   error = ioctl(ctx->fd, VM_RTC_GETTIME, &rtctime);
+   if (error == 0)
+   *secs = rtctime.secs;
+   return (error);
+}

Modified: head/lib/libvmmapi/vmmapi.h
==
--- head/lib/libvmmapi/vmmapi.h Tue Dec 30 22:04:24 2014(r276427)
+++ head/lib/libvmmapi/vmmapi.h Tue Dec 30 22:19:34 2014(r276428)
@@ -133,6 +133,12 @@ void   vm_copyin(struct vmctx *ctx, int vc
 void   vm_copyout(struct vmctx *ctx, int vcpu, const void *host_src,
struct iovec *guest_iov, size_t len);
 
+/* RTC */
+intvm_rtc_write(struct vmctx *ctx, int offset, uint8_t value);
+intvm_rtc_read(struct vmctx *ctx, int offset, uint8_t *retval);
+intvm_rtc_settime(struct vmctx *ctx, time_t secs);
+intvm_rtc_gettime(struct vmctx *ctx, time_t *secs);
+
 /* Reset vcpu register state */
 intvcpu_reset(struct vmctx *ctx, int vcpu);
 

Modified: head/sys/amd64/include/vmm.h
==
--- head/sys/amd64/include/vmm.hTue Dec 30 22:04:24 2014
(r276427)
+++ head/sys/amd64/include/vmm.hTue Dec 30 22:19:34 2014
(r276428)
@@ -286,6 +286,7 @@ int vm_unassign_pptdev(struct vm *vm, in
 struct vatpic *vm_atpic(struct vm *vm);
 struct vatpit *vm_atpit(struct vm *vm);
 struct vpmtmr *vm_pmtmr(struct vm *vm);
+struct vrtc *vm_rtc(struct vm *vm);
 
 /*
  * Inject exception 'vme' into the guest vcpu. This function returns 0 on

Modified: head/sys/amd64/include/vmm_dev.h
==
--- head/sys/amd64/include/vmm_dev.hTue Dec 30 22:04:24 2014
(r276427)
+++ head/sys/amd64/include/vmm_dev.hTue Dec 30 22:19:34 2014
(r276428)
@@ -195,6 +195,15 @@ struct vm_intinfo {
uint64_tinfo2;
 };
 
+struct vm_rtc_time {
+   time_t  secs;
+};
+
+struct vm_rtc_

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

2014-12-30 Thread Gleb Smirnoff
On Tue, Dec 30, 2014 at 09:22:27PM +0100, Mateusz Guzik wrote:
M> On Tue, Dec 30, 2014 at 11:06:01PM +0300, Gleb Smirnoff wrote:
M> > On Sun, Dec 28, 2014 at 07:24:02PM +, Mateusz Guzik wrote:
M> > M> Author: mjg
M> > M> Date: Sun Dec 28 19:24:01 2014
M> > M> New Revision: 276341
M> > M> URL: https://svnweb.freebsd.org/changeset/base/276341
M> > M> 
M> > M> Log:
M> > M>   sysctl: don't modify oid_running for static nodes
M> > M>   
M> > M>   It is necessary to prevent nodes from being destroyed while used, but 
static
M> > M>   ones cannot be destroyed.
M> > 
M> > What about nodes that go away on kernel module unload? Not sure
M> > they were protected properly before your commit, though :)
M> > 
M> 
M> They are not static.

I don't see how they can get CTLFLAG_DYN. Look for any (un)loadable
modules as an example, e.g. aio(4) implemented in vfs_aio.c. How its
sysctls get CTLFLAG_DYN?

-- 
Totus tuus, Glebius.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276427 - head/contrib/elftoolchain/libelf

2014-12-30 Thread Ed Maste
Author: emaste
Date: Tue Dec 30 22:04:24 2014
New Revision: 276427
URL: https://svnweb.freebsd.org/changeset/base/276427

Log:
  Check for multiplication integer overflow in CHECK_EHDR
  
  The initial fix in r276374 is valid only for 64-bit objects. Revert it
  and return an error in CHECK_EHDR if the multiplication would overflow.
  
  The original buffer overflow issue was found with the security/afl
  fuzzer and has upstream elftoolchain ticket 462. The 32-bit object issue
  with r276374 found by antoine@ during an i386 exp-run.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/contrib/elftoolchain/libelf/elf_scn.c

Modified: head/contrib/elftoolchain/libelf/elf_scn.c
==
--- head/contrib/elftoolchain/libelf/elf_scn.c  Tue Dec 30 21:55:50 2014
(r276426)
+++ head/contrib/elftoolchain/libelf/elf_scn.c  Tue Dec 30 22:04:24 2014
(r276427)
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "_libelf.h"
@@ -50,7 +51,6 @@ _libelf_load_section_headers(Elf *e, voi
Elf64_Ehdr *eh64;
int ec, swapbytes;
unsigned char *src;
-   unsigned char *rawend;
size_t fsz, i, shnum;
int (*xlator)(unsigned char *_d, size_t _dsz, unsigned char *_s,
size_t _c, int _swap);
@@ -61,6 +61,7 @@ _libelf_load_section_headers(Elf *e, voi
 
 #defineCHECK_EHDR(E,EH)do {\
if (fsz != (EH)->e_shentsize || \
+   shnum > SIZE_MAX / fsz ||   \
shoff + fsz * shnum > e->e_rawsize) {   \
LIBELF_SET_ERROR(HEADER, 0);\
return (0); \
@@ -87,7 +88,6 @@ _libelf_load_section_headers(Elf *e, voi
 
swapbytes = e->e_byteorder != LIBELF_PRIVATE(byteorder);
src = e->e_rawfile + shoff;
-   rawend = e->e_rawfile + e->e_rawsize;
 
/*
 * If the file is using extended numbering then section #0
@@ -104,8 +104,6 @@ _libelf_load_section_headers(Elf *e, voi
}
 
for (; i < shnum; i++, src += fsz) {
-   if (src + sizeof(scn->s_shdr) > rawend)
-   return (0);
if ((scn = _libelf_allocate_scn(e, i)) == NULL)
return (0);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2014-12-30 Thread Warren Block
Author: wblock (doc committer)
Date: Tue Dec 30 21:55:50 2014
New Revision: 276426
URL: https://svnweb.freebsd.org/changeset/base/276426

Log:
  Remove the svn:executable property from iscsi.4.
  
  PR:   196380
  Submitted by: trond.endres...@ximalas.info
  MFC after:1 week

Modified:
Directory Properties:
  head/share/man/man4/iscsi.4   (props changed)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276425 - head/sys/fs/nullfs

2014-12-30 Thread Mateusz Guzik
Author: mjg
Date: Tue Dec 30 21:41:35 2014
New Revision: 276425
URL: https://svnweb.freebsd.org/changeset/base/276425

Log:
  Convert nullfs hash lock from a mutex to an rwlock.

Modified:
  head/sys/fs/nullfs/null_subr.c

Modified: head/sys/fs/nullfs/null_subr.c
==
--- head/sys/fs/nullfs/null_subr.c  Tue Dec 30 21:40:45 2014
(r276424)
+++ head/sys/fs/nullfs/null_subr.c  Tue Dec 30 21:41:35 2014
(r276425)
@@ -38,7 +38,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -57,7 +57,7 @@
 #defineNULL_NHASH(vp) (&null_node_hashtbl[vfs_hash_index(vp) & 
null_hash_mask])
 
 static LIST_HEAD(null_node_hashhead, null_node) *null_node_hashtbl;
-static struct mtx null_hashmtx;
+static struct rwlock null_hash_lock;
 static u_long null_hash_mask;
 
 static MALLOC_DEFINE(M_NULLFSHASH, "nullfs_hash", "NULLFS hash table");
@@ -75,7 +75,7 @@ nullfs_init(vfsp)
 
null_node_hashtbl = hashinit(desiredvnodes, M_NULLFSHASH,
&null_hash_mask);
-   mtx_init(&null_hashmtx, "nullhs", NULL, MTX_DEF);
+   rw_init(&null_hash_lock, "nullhs");
return (0);
 }
 
@@ -84,7 +84,7 @@ nullfs_uninit(vfsp)
struct vfsconf *vfsp;
 {
 
-   mtx_destroy(&null_hashmtx);
+   rw_destroy(&null_hash_lock);
hashdestroy(null_node_hashtbl, M_NULLFSHASH, null_hash_mask);
return (0);
 }
@@ -111,7 +111,7 @@ null_hashget(mp, lowervp)
 * reference count (but NOT the lower vnode's VREF counter).
 */
hd = NULL_NHASH(lowervp);
-   mtx_lock(&null_hashmtx);
+   rw_rlock(&null_hash_lock);
LIST_FOREACH(a, hd, null_hash) {
if (a->null_lowervp == lowervp && NULLTOV(a)->v_mount == mp) {
/*
@@ -122,11 +122,11 @@ null_hashget(mp, lowervp)
 */
vp = NULLTOV(a);
vref(vp);
-   mtx_unlock(&null_hashmtx);
+   rw_runlock(&null_hash_lock);
return (vp);
}
}
-   mtx_unlock(&null_hashmtx);
+   rw_runlock(&null_hash_lock);
return (NULLVP);
 }
 
@@ -144,7 +144,7 @@ null_hashins(mp, xp)
struct vnode *ovp;
 
hd = NULL_NHASH(xp->null_lowervp);
-   mtx_lock(&null_hashmtx);
+   rw_wlock(&null_hash_lock);
LIST_FOREACH(oxp, hd, null_hash) {
if (oxp->null_lowervp == xp->null_lowervp &&
NULLTOV(oxp)->v_mount == mp) {
@@ -154,12 +154,12 @@ null_hashins(mp, xp)
 */
ovp = NULLTOV(oxp);
vref(ovp);
-   mtx_unlock(&null_hashmtx);
+   rw_wunlock(&null_hash_lock);
return (ovp);
}
}
LIST_INSERT_HEAD(hd, xp, null_hash);
-   mtx_unlock(&null_hashmtx);
+   rw_wunlock(&null_hash_lock);
return (NULLVP);
 }
 
@@ -277,9 +277,9 @@ null_hashrem(xp)
struct null_node *xp;
 {
 
-   mtx_lock(&null_hashmtx);
+   rw_wlock(&null_hash_lock);
LIST_REMOVE(xp, null_hash);
-   mtx_unlock(&null_hashmtx);
+   rw_wunlock(&null_hash_lock);
 }
 
 #ifdef DIAGNOSTIC
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276424 - head/sys/kern

2014-12-30 Thread Mateusz Guzik
Author: mjg
Date: Tue Dec 30 21:40:45 2014
New Revision: 276424
URL: https://svnweb.freebsd.org/changeset/base/276424

Log:
  Convert vfs hash lock from a mutex to an rwlock.

Modified:
  head/sys/kern/vfs_hash.c

Modified: head/sys/kern/vfs_hash.c
==
--- head/sys/kern/vfs_hash.cTue Dec 30 20:46:01 2014(r276423)
+++ head/sys/kern/vfs_hash.cTue Dec 30 21:40:45 2014(r276424)
@@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 static MALLOC_DEFINE(M_VFS_HASH, "vfs_hash", "VFS hash table");
@@ -40,14 +41,14 @@ static MALLOC_DEFINE(M_VFS_HASH, "vfs_ha
 static LIST_HEAD(vfs_hash_head, vnode) *vfs_hash_tbl;
 static LIST_HEAD(,vnode)   vfs_hash_side;
 static u_long  vfs_hash_mask;
-static struct mtx  vfs_hash_mtx;
+static struct rwlock   vfs_hash_lock;
 
 static void
 vfs_hashinit(void *dummy __unused)
 {
 
vfs_hash_tbl = hashinit(desiredvnodes, M_VFS_HASH, &vfs_hash_mask);
-   mtx_init(&vfs_hash_mtx, "vfs hash", NULL, MTX_DEF);
+   rw_init(&vfs_hash_lock, "vfs hash");
LIST_INIT(&vfs_hash_side);
 }
 
@@ -75,7 +76,7 @@ vfs_hash_get(const struct mount *mp, u_i
int error;
 
while (1) {
-   mtx_lock(&vfs_hash_mtx);
+   rw_rlock(&vfs_hash_lock);
LIST_FOREACH(vp, vfs_hash_bucket(mp, hash), v_hashlist) {
if (vp->v_hash != hash)
continue;
@@ -84,7 +85,7 @@ vfs_hash_get(const struct mount *mp, u_i
if (fn != NULL && fn(vp, arg))
continue;
VI_LOCK(vp);
-   mtx_unlock(&vfs_hash_mtx);
+   rw_runlock(&vfs_hash_lock);
error = vget(vp, flags | LK_INTERLOCK, td);
if (error == ENOENT && (flags & LK_NOWAIT) == 0)
break;
@@ -94,7 +95,7 @@ vfs_hash_get(const struct mount *mp, u_i
return (0);
}
if (vp == NULL) {
-   mtx_unlock(&vfs_hash_mtx);
+   rw_runlock(&vfs_hash_lock);
*vpp = NULL;
return (0);
}
@@ -105,9 +106,9 @@ void
 vfs_hash_remove(struct vnode *vp)
 {
 
-   mtx_lock(&vfs_hash_mtx);
+   rw_wlock(&vfs_hash_lock);
LIST_REMOVE(vp, v_hashlist);
-   mtx_unlock(&vfs_hash_mtx);
+   rw_wunlock(&vfs_hash_lock);
 }
 
 int
@@ -118,7 +119,7 @@ vfs_hash_insert(struct vnode *vp, u_int 
 
*vpp = NULL;
while (1) {
-   mtx_lock(&vfs_hash_mtx);
+   rw_wlock(&vfs_hash_lock);
LIST_FOREACH(vp2,
vfs_hash_bucket(vp->v_mount, hash), v_hashlist) {
if (vp2->v_hash != hash)
@@ -128,13 +129,13 @@ vfs_hash_insert(struct vnode *vp, u_int 
if (fn != NULL && fn(vp2, arg))
continue;
VI_LOCK(vp2);
-   mtx_unlock(&vfs_hash_mtx);
+   rw_wunlock(&vfs_hash_lock);
error = vget(vp2, flags | LK_INTERLOCK, td);
if (error == ENOENT && (flags & LK_NOWAIT) == 0)
break;
-   mtx_lock(&vfs_hash_mtx);
+   rw_wlock(&vfs_hash_lock);
LIST_INSERT_HEAD(&vfs_hash_side, vp, v_hashlist);
-   mtx_unlock(&vfs_hash_mtx);
+   rw_wunlock(&vfs_hash_lock);
vput(vp);
if (!error)
*vpp = vp2;
@@ -146,7 +147,7 @@ vfs_hash_insert(struct vnode *vp, u_int 
}
vp->v_hash = hash;
LIST_INSERT_HEAD(vfs_hash_bucket(vp->v_mount, hash), vp, v_hashlist);
-   mtx_unlock(&vfs_hash_mtx);
+   rw_wunlock(&vfs_hash_lock);
return (0);
 }
 
@@ -154,9 +155,9 @@ void
 vfs_hash_rehash(struct vnode *vp, u_int hash)
 {
 
-   mtx_lock(&vfs_hash_mtx);
+   rw_wlock(&vfs_hash_lock);
LIST_REMOVE(vp, v_hashlist);
LIST_INSERT_HEAD(vfs_hash_bucket(vp->v_mount, hash), vp, v_hashlist);
vp->v_hash = hash;
-   mtx_unlock(&vfs_hash_mtx);
+   rw_wunlock(&vfs_hash_lock);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276423 - stable/10/share/mk

2014-12-30 Thread Garrett Cooper
Author: ngie
Date: Tue Dec 30 20:46:01 2014
New Revision: 276423
URL: https://svnweb.freebsd.org/changeset/base/276423

Log:
  MFC r274077:
  
As an optimization (in simple, well used cases) only call cat ${.ALLSRC} 
when
generating files from various sources instead of calling cat ${.ALLSRC} | 
sed
  
The perl case was skipped because it's not being used in the tree at this 
time

Modified:
  stable/10/share/mk/atf.test.mk
  stable/10/share/mk/plain.test.mk
  stable/10/share/mk/tap.test.mk
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/mk/atf.test.mk
==
--- stable/10/share/mk/atf.test.mk  Tue Dec 30 20:44:05 2014
(r276422)
+++ stable/10/share/mk/atf.test.mk  Tue Dec 30 20:46:01 2014
(r276423)
@@ -105,8 +105,12 @@ ATF_TESTS_SH_SED_${_T}?= # empty
 ATF_TESTS_SH_SRC_${_T}?= ${_T}.sh
 ${_T}: ${ATF_TESTS_SH_SRC_${_T}}
echo '#! /usr/libexec/atf-sh' > ${.TARGET}.tmp
+.if empty(ATF_TESTS_SH_SED_${_T})
+   cat ${.ALLSRC:N*Makefile*} >>${.TARGET}.tmp
+.else
cat ${.ALLSRC:N*Makefile*} \
| sed ${ATF_TESTS_SH_SED_${_T}} >>${.TARGET}.tmp
+.endif
chmod +x ${.TARGET}.tmp
mv ${.TARGET}.tmp ${.TARGET}
 .endfor

Modified: stable/10/share/mk/plain.test.mk
==
--- stable/10/share/mk/plain.test.mkTue Dec 30 20:44:05 2014
(r276422)
+++ stable/10/share/mk/plain.test.mkTue Dec 30 20:46:01 2014
(r276423)
@@ -57,8 +57,12 @@ CLEANFILES+= ${_T} ${_T}.tmp
 PLAIN_TESTS_SH_SED_${_T}?= # empty
 PLAIN_TESTS_SH_SRC_${_T}?= ${_T}.sh
 ${_T}: ${PLAIN_TESTS_SH_SRC_${_T}}
+.if empty(PLAIN_TESTS_SH_SED_${_T})
+   cat ${.ALLSRC:N*Makefile*} >${.TARGET}.tmp
+.else
cat ${.ALLSRC:N*Makefile*} \
| sed ${PLAIN_TESTS_SH_SED_${_T}} >${.TARGET}.tmp
+.endif
chmod +x ${.TARGET}.tmp
mv ${.TARGET}.tmp ${.TARGET}
 .endfor

Modified: stable/10/share/mk/tap.test.mk
==
--- stable/10/share/mk/tap.test.mk  Tue Dec 30 20:44:05 2014
(r276422)
+++ stable/10/share/mk/tap.test.mk  Tue Dec 30 20:46:01 2014
(r276423)
@@ -86,7 +86,11 @@ CLEANFILES+= ${_T} ${_T}.tmp
 TAP_TESTS_SH_SED_${_T}?= # empty
 TAP_TESTS_SH_SRC_${_T}?= ${_T}.sh
 ${_T}: ${TAP_TESTS_SH_SRC_${_T}}
+.if empty(TAP_TESTS_SH_SED_${_T})
+   cat ${.ALLSRC} >${.TARGET}.tmp
+.else
cat ${.ALLSRC} | sed ${TAP_TESTS_SH_SED_${_T}} >${.TARGET}.tmp
+.endif
chmod +x ${.TARGET}.tmp
mv ${.TARGET}.tmp ${.TARGET}
 .endfor
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276422 - stable/10/share/mk

2014-12-30 Thread Garrett Cooper
Author: ngie
Date: Tue Dec 30 20:44:05 2014
New Revision: 276422
URL: https://svnweb.freebsd.org/changeset/base/276422

Log:
  MFC r267276:
  
Ensure files are created during the build when using bsd.subdir.mk.
  
When FILES is defined in a Makefile that _also_ includes bsd.subdir.mk, the
build of the files (if any) was not properly triggered during the build
stage.  This was because bsd.files.mk did not define the buildfiles target
if it was already defined... and bsd.subdir.mk defined this target on its
own, thus causing a conflict.
  
Fix this by unconditionally defining buildfiles from bsd.files.mk; this is
safe because nothing else in the tree needs to redefine this and because the
target itself contains no commands: all it does is define dependencies.
Also ensure that bsd.files.mk is always pulled in by bsd.test.mk regardless
of what bsd.prog.mk does.
  
These fixes allow "make installworld" to run cleanly on a system with
read-only src and obj trees.
  
This is "make tinderbox" clean.
  
Reviewed by:imp
Obtained from:  jilles

Modified:
  stable/10/share/mk/bsd.files.mk
  stable/10/share/mk/bsd.test.mk
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/mk/bsd.files.mk
==
--- stable/10/share/mk/bsd.files.mk Tue Dec 30 20:23:03 2014
(r276421)
+++ stable/10/share/mk/bsd.files.mk Tue Dec 30 20:44:05 2014
(r276422)
@@ -4,13 +4,14 @@
 .error bsd.files.mk cannot be included directly.
 .endif
 
+.if !target()
+:
+
 FILESGROUPS?=  FILES
 
-.if !target(buildfiles)
 .for group in ${FILESGROUPS}
 buildfiles: ${${group}}
 .endfor
-.endif
 
 all: buildfiles
 
@@ -65,3 +66,5 @@ _${group}INS: ${_${group}FILES}
 
 realinstall: installfiles
 .ORDER: beforeinstall installfiles
+
+.endif # !target()

Modified: stable/10/share/mk/bsd.test.mk
==
--- stable/10/share/mk/bsd.test.mk  Tue Dec 30 20:23:03 2014
(r276421)
+++ stable/10/share/mk/bsd.test.mk  Tue Dec 30 20:44:05 2014
(r276422)
@@ -94,8 +94,7 @@ test: aftertest
 
 .if !empty(PROGS) || !empty(PROGS_CXX) || !empty(SCRIPTS)
 .include 
-.elif !empty(FILES)
-.include 
 .endif
+.include 
 
 .include 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2014-12-30 Thread Mateusz Guzik
On Tue, Dec 30, 2014 at 11:06:01PM +0300, Gleb Smirnoff wrote:
> On Sun, Dec 28, 2014 at 07:24:02PM +, Mateusz Guzik wrote:
> M> Author: mjg
> M> Date: Sun Dec 28 19:24:01 2014
> M> New Revision: 276341
> M> URL: https://svnweb.freebsd.org/changeset/base/276341
> M> 
> M> Log:
> M>   sysctl: don't modify oid_running for static nodes
> M>   
> M>   It is necessary to prevent nodes from being destroyed while used, but 
> static
> M>   ones cannot be destroyed.
> 
> What about nodes that go away on kernel module unload? Not sure
> they were protected properly before your commit, though :)
> 

They are not static.

They seem to be protected properly though.

-- 
Mateusz Guzik 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276419 - head/usr.sbin/binmiscctl

2014-12-30 Thread Warren Block
Author: wblock (doc committer)
Date: Tue Dec 30 20:20:18 2014
New Revision: 276419
URL: https://svnweb.freebsd.org/changeset/base/276419

Log:
  Move the explanation for examples before the example itself.  Add
  numerous QEMU examples and explanations supplied by sbruno, with thanks
  to Ingo Schwarze for help with the mdoc markup.  Code, text, testing,
  proofreading, cinematography, stunts, and the haunting theme song
  supplied by sbruno.
  
  Submitted by: sbruno
  Reviewed by:  sbruno
  MFC after:1 week

Modified:
  head/usr.sbin/binmiscctl/binmiscctl.8

Modified: head/usr.sbin/binmiscctl/binmiscctl.8
==
--- head/usr.sbin/binmiscctl/binmiscctl.8   Tue Dec 30 20:10:37 2014
(r276418)
+++ head/usr.sbin/binmiscctl/binmiscctl.8   Tue Dec 30 20:20:18 2014
(r276419)
@@ -27,7 +27,7 @@
 .\"
 .\" Support for miscellaneous binary image activators
 .\"
-.Dd April 10, 2014
+.Dd December 30, 2014
 .Dt BINMISCCTL 8
 .Os
 .Sh NAME
@@ -146,46 +146,148 @@ Look up and print out the activator entr
 Take a snapshot and print all the activator entries currently configured.
 .El
 .Sh EXAMPLES
+Add an image activator to run the LLVM interpreter (lli) on bitcode
+compiled files:
 .Bd -ragged -offset indent
 # binmiscctl add llvmbc --interpreter ''/usr/bin/lli --fake-argv0=#a''
 --magic ''BC\\xc0\\xde'' --size 4 --set-enabled
 .Ed
 .Pp
-Add an image activator to run the LLVM interpreter (lli) on bitcode
-compiled files.
 .Ar #a
-gets replaced with the old
+is replaced with the old
 .Dv argv0
 value so that 'lli' can fake its
 .Dv argv0 .
 Set its state to enabled.
 .Pp
+Set the state of the
+.Ar llvmbc
+image activator to disabled:
 .Dl # binmiscctl disable llvmbc
 .Pp
 Set the state of the
 .Ar llvmbc
-image activator to disabled.
-.Pp
+image activator to enabled:
 .Dl # binmiscctl enable llvmbc
 .Pp
-Set the state of the
+Delete the
 .Ar llvmbc
-image activator to enabled.
-.Pp
+image activator:
 .Dl # binmiscctl remove llvmbc
 .Pp
-Delete the
+Look up and list the record for the
 .Ar llvmbc
-image activator.
-.Pp
+image activator:
 .Dl # binmiscctl lookup llvmbc
 .Pp
-Look up and list the record for the
-.Ar llvmbc
-image activator.
+Add QEMU bsd-user program as an image activator for ARM little-endian binaries:
+.Bd -literal -offset indent
+# binmiscctl add armelf \e
+  --interpreter "/usr/local/bin/qemu-arm-static" \e
+  --magic "\ex7f\ex45\ex4c\ex46\ex01\ex01\ex01\ex00\ex00\ex00\e
+   \ex00\ex00\ex00\ex00\ex00\ex00\ex02\ex00\ex28\ex00" \e
+  --mask  "\exff\exff\exff\exff\exff\exff\exff\ex00\exff\exff\e
+   \exff\exff\exff\exff\exff\exff\exfe\exff\exff\exff" \e
+  --size 20 --set-enabled
+.Ed
+.Pp
+Add QEMU bsd-user program as an image activator for ARM big-endian binaries:
+.Bd -literal -offset indent
+# binmiscctl add armebelf \e
+  --interpreter "/usr/local/bin/qemu-arm-static" \e
+  --magic "\ex7f\ex45\ex4c\ex46\ex01\ex02\ex01\ex00\ex00\ex00\e
+   \ex00\ex00\ex00\ex00\ex00\ex00\ex00\ex02\ex00\ex28" \e
+  --mask  "\exff\exff\exff\exff\exff\exff\exff\ex00\exff\exff\e
+   \exff\exff\exff\exff\exff\exff\exff\exfe\exff\exff" \e
+  --size 20 --set-enabled
+.Ed
+.Pp
+Add QEMU bsd-user program as an image activator for MIPS32 binaries:
+.Bd -literal -offset indent
+# binmiscctl add mips32 \e
+  --interpreter "/usr/local/bin/qemu-mips-static" \e
+  --magic "\ex7f\ex45\ex4c\ex46\ex01\ex02\ex01\ex00\ex00\ex00\e
+   \ex00\ex00\ex00\ex00\ex00\ex00\ex00\ex02\ex00\ex08" \e
+  --mask  "\exff\exff\exff\exff\exff\exff\exff\ex00\exff\exff\e
+   \exff\exff\exff\exff\exff\exff\exff\exfe\exff\exff" \e
+  --size 20 --set-enabled
+.Ed
+.Pp
+Add QEMU bsd-user program as an image activator for MIPS64 binaries:
+.Bd -literal -offset indent
+# binmiscctl add mips64 \e
+  --interpreter "/usr/local/bin/qemu-mips64-static" \e
+  --magic "\ex7f\ex45\ex4c\ex46\ex02\ex02\ex01\ex00\ex00\ex00\e
+   \ex00\ex00\ex00\ex00\ex00\ex00\ex00\ex02\ex00\ex08" \e
+  --mask "\exff\exff\exff\exff\exff\exff\exff\ex00\exff\exff\e
+  \exff\exff\exff\exff\exff\exff\exff\exfe\exff\exff" \e
+  --size 20 --set-enabled
+.Ed
+.Pp
+Add QEMU bsd-user program as an image activator for PowerPC binaries:
+.Bd -literal -offset indent
+# binmiscctl add powerpc \e
+  --interpreter "/usr/local/bin/qemu-ppc-static" \e
+  --magic "\ex7f\ex45\ex4c\ex46\ex01\ex02\ex01\ex00\ex00\ex00\e
+   \ex00\ex00\ex00\ex00\ex00\ex00\ex00\ex02\ex00\ex14" \e
+  --mask  "\exff\exff\exff\exff\exff\exff\exff\ex00\exff\exff\e
+   \exff\exff\exff\exff\exff\exff\exff\exfe\exff\exff" \e
+  --size 20 --set-enabled
+.Ed
+.Pp
+Add QEMU bsd-user program as an image activator for PowerPC64 binaries:
+.Bd -literal -offset indent
+# binmiscctl add powerpc64 \e
+  --interpreter "/usr/local/bin/qemu-ppc64-static" \e
+  --magic "\ex7f\ex45\ex4c\ex46\ex01\ex02\ex01\ex00\ex00\ex00\e
+   \ex00\ex00\ex00\ex00\ex00\ex00\ex00\ex02\ex00\

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

2014-12-30 Thread Gleb Smirnoff
On Sun, Dec 28, 2014 at 07:24:02PM +, Mateusz Guzik wrote:
M> Author: mjg
M> Date: Sun Dec 28 19:24:01 2014
M> New Revision: 276341
M> URL: https://svnweb.freebsd.org/changeset/base/276341
M> 
M> Log:
M>   sysctl: don't modify oid_running for static nodes
M>   
M>   It is necessary to prevent nodes from being destroyed while used, but 
static
M>   ones cannot be destroyed.

What about nodes that go away on kernel module unload? Not sure
they were protected properly before your commit, though :)

-- 
Totus tuus, Glebius.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276417 - head/contrib/libcxxrt

2014-12-30 Thread Dimitry Andric
Author: dim
Date: Tue Dec 30 20:01:06 2014
New Revision: 276417
URL: https://svnweb.freebsd.org/changeset/base/276417

Log:
  Import libcxxrt master 00bc29eb6513624824a6d7db2ebc768a4216a604.
  
  Interesting fixes:
  76584a0  Reorganize code to use only 32bit atomic ops for 32bit platforms
  30d2ae5  Implement __cxa_throw_bad_array_new_length
  
  Reviewed by:  bapt
  MFC after:1 month
  Differential Revision: https://reviews.freebsd.org/D1390

Modified:
  head/contrib/libcxxrt/atomic.h
  head/contrib/libcxxrt/cxxabi.h
  head/contrib/libcxxrt/dwarf_eh.h
  head/contrib/libcxxrt/dynamic_cast.cc
  head/contrib/libcxxrt/exception.cc
  head/contrib/libcxxrt/guard.cc
  head/contrib/libcxxrt/stdexcept.cc
  head/contrib/libcxxrt/stdexcept.h
  head/contrib/libcxxrt/typeinfo.cc
  head/contrib/libcxxrt/unwind-arm.h
  head/contrib/libcxxrt/unwind.h
Directory Properties:
  head/contrib/libcxxrt/   (props changed)

Modified: head/contrib/libcxxrt/atomic.h
==
--- head/contrib/libcxxrt/atomic.h  Tue Dec 30 19:51:30 2014
(r276416)
+++ head/contrib/libcxxrt/atomic.h  Tue Dec 30 20:01:06 2014
(r276417)
@@ -11,7 +11,7 @@
  */
 #if __has_builtin(__c11_atomic_exchange)
 #define ATOMIC_SWAP(addr, val)\
-   __c11_atomic_exchange((_Atomic(__typeof__(val))*)addr, val, 
__ATOMIC_ACQ_REL)
+   
__c11_atomic_exchange(reinterpret_cast<_Atomic(__typeof__(val))*>(addr), val, 
__ATOMIC_ACQ_REL)
 #elif __has_builtin(__sync_swap)
 #define ATOMIC_SWAP(addr, val)\
__sync_swap(addr, val)
@@ -22,7 +22,7 @@
 
 #if __has_builtin(__c11_atomic_load)
 #define ATOMIC_LOAD(addr)\
-   __c11_atomic_load((_Atomic(__typeof__(*addr))*)addr, __ATOMIC_ACQUIRE)
+   __c11_atomic_load(reinterpret_cast<_Atomic(__typeof__(*addr))*>(addr), 
__ATOMIC_ACQUIRE)
 #else
 #define ATOMIC_LOAD(addr)\
(__sync_synchronize(), *addr)

Modified: head/contrib/libcxxrt/cxxabi.h
==
--- head/contrib/libcxxrt/cxxabi.h  Tue Dec 30 19:51:30 2014
(r276416)
+++ head/contrib/libcxxrt/cxxabi.h  Tue Dec 30 20:01:06 2014
(r276417)
@@ -110,7 +110,7 @@ struct __cxa_exception
 * handler count reaches 0 (which it doesn't with the top bit set).
 */
int handlerCount;
-#ifdef __arm__
+#if defined(__arm__) && !defined(__ARM_DWARF_EH__)
/**
 * The ARM EH ABI requires the unwind library to keep track of 
exceptions
 * during cleanups.  These support nesting, so we need to keep a list of

Modified: head/contrib/libcxxrt/dwarf_eh.h
==
--- head/contrib/libcxxrt/dwarf_eh.hTue Dec 30 19:51:30 2014
(r276416)
+++ head/contrib/libcxxrt/dwarf_eh.hTue Dec 30 20:01:06 2014
(r276417)
@@ -83,7 +83,7 @@ enum dwarf_data_encoding
  */
 static inline enum dwarf_data_encoding get_encoding(unsigned char x)
 {
-   return (enum dwarf_data_encoding)(x & 0xf);
+   return static_cast(x & 0xf);
 }
 
 /**
@@ -115,7 +115,7 @@ enum dwarf_data_relative
  */
 static inline enum dwarf_data_relative get_base(unsigned char x)
 {
-   return (enum dwarf_data_relative)(x & 0x70);
+   return static_cast(x & 0x70);
 }
 /**
  * Returns whether an encoding represents an indirect address.
@@ -206,9 +206,9 @@ static int64_t read_sleb128(dw_eh_ptr_t 
if ((uleb >> (bits-1)) == 1)
{
// Sign extend by setting all bits in front of it to 1
-   uleb |= ((int64_t)-1) << bits;
+   uleb |= static_cast(-1) << bits;
}
-   return (int64_t)uleb;
+   return static_cast(uleb);
 }
 /**
  * Reads a value using the specified encoding from the address pointed to by
@@ -224,7 +224,7 @@ static uint64_t read_value(char encoding
// Read fixed-length types
 #define READ(dwarf, type) \
case dwarf:\
-   v = (uint64_t)(*(type*)(*data));\
+   v = 
static_cast(*reinterpret_cast(*data));\
*data += sizeof(type);\
break;
READ(DW_EH_PE_udata2, uint16_t)
@@ -263,16 +263,16 @@ static uint64_t resolve_indirect_value(_
switch (get_base(encoding))
{
case DW_EH_PE_pcrel:
-   v += (uint64_t)start;
+   v += reinterpret_cast(start);
break;
case DW_EH_PE_textrel:
-   v += (uint64_t)_Unwind_GetTextRelBase(c);
+   v += 
static_cast(static_cast(_Unwind_GetTextRelBase(c)));
break;
case DW_EH_PE_datarel:
-   v += (uint64_t)_Unwind_GetDataRelBase(c);
+   v += 
static_cast(static_cast(_Unwind_GetDataRelBase(c)));
break;
case DW_

svn commit: r276416 - in stable/9: contrib/file contrib/file/Magdir contrib/file/doc contrib/file/m4 contrib/file/magic contrib/file/magic/Magdir contrib/file/python contrib/file/src contrib/file/t...

2014-12-30 Thread Xin LI
Author: delphij
Date: Tue Dec 30 19:51:30 2014
New Revision: 276416
URL: https://svnweb.freebsd.org/changeset/base/276416

Log:
  MFC: file 5.21

Added:
  stable/9/contrib/file/config.guess
 - copied unchanged from r267897, head/contrib/file/config.guess
  stable/9/contrib/file/config.sub
 - copied unchanged from r267897, head/contrib/file/config.sub
  stable/9/contrib/file/depcomp
 - copied unchanged from r267897, head/contrib/file/depcomp
  stable/9/contrib/file/doc/
 - copied from r267897, head/contrib/file/doc/
  stable/9/contrib/file/ltmain.sh
 - copied unchanged from r267897, head/contrib/file/ltmain.sh
  stable/9/contrib/file/m4/
 - copied from r267897, head/contrib/file/m4/
  stable/9/contrib/file/magic/
 - copied from r267897, head/contrib/file/magic/
  stable/9/contrib/file/magic/Magdir/kerberos
 - copied unchanged from r275698, head/contrib/file/magic/Magdir/kerberos
  stable/9/contrib/file/magic/Magdir/meteorological
 - copied unchanged from r275698, 
head/contrib/file/magic/Magdir/meteorological
  stable/9/contrib/file/missing
 - copied, changed from r267897, head/contrib/file/missing
  stable/9/contrib/file/python/
 - copied from r267897, head/contrib/file/python/
  stable/9/contrib/file/src/
 - copied from r267897, head/contrib/file/src/
  stable/9/contrib/file/tests/escapevel.result
 - copied unchanged from r267897, head/contrib/file/tests/escapevel.result
  stable/9/contrib/file/tests/escapevel.testfile
 - copied unchanged from r267897, head/contrib/file/tests/escapevel.testfile
  stable/9/contrib/file/tests/issue311docx.result
 - copied unchanged from r267897, 
head/contrib/file/tests/issue311docx.result
  stable/9/contrib/file/tests/issue311docx.testfile
 - copied unchanged from r267897, 
head/contrib/file/tests/issue311docx.testfile
Deleted:
  stable/9/contrib/file/Header
  stable/9/contrib/file/Localstuff
  stable/9/contrib/file/Magdir/
  stable/9/contrib/file/Makefile.am-src
  stable/9/contrib/file/apprentice.c
  stable/9/contrib/file/apptype.c
  stable/9/contrib/file/ascmagic.c
  stable/9/contrib/file/asprintf.c
  stable/9/contrib/file/cdf.c
  stable/9/contrib/file/cdf.h
  stable/9/contrib/file/cdf_time.c
  stable/9/contrib/file/compress.c
  stable/9/contrib/file/elfclass.h
  stable/9/contrib/file/encoding.c
  stable/9/contrib/file/file.c
  stable/9/contrib/file/file.h
  stable/9/contrib/file/file.man
  stable/9/contrib/file/file_opts.h
  stable/9/contrib/file/fsmagic.c
  stable/9/contrib/file/funcs.c
  stable/9/contrib/file/getline.c
  stable/9/contrib/file/getopt_long.c
  stable/9/contrib/file/is_tar.c
  stable/9/contrib/file/libmagic.man
  stable/9/contrib/file/magic.c
  stable/9/contrib/file/magic.h
  stable/9/contrib/file/magic.man
  stable/9/contrib/file/magic/Magdir/rinex
  stable/9/contrib/file/magic2mime
  stable/9/contrib/file/mygetopt.h
  stable/9/contrib/file/names.h
  stable/9/contrib/file/print.c
  stable/9/contrib/file/readcdf.c
  stable/9/contrib/file/readelf.c
  stable/9/contrib/file/readelf.h
  stable/9/contrib/file/softmagic.c
  stable/9/contrib/file/strlcat.c
  stable/9/contrib/file/strlcpy.c
  stable/9/contrib/file/tar.h
  stable/9/contrib/file/tests/gedcom.magic
  stable/9/contrib/file/vasprintf.c
Modified:
  stable/9/contrib/file/ChangeLog
  stable/9/contrib/file/Makefile.am
  stable/9/contrib/file/Makefile.in
  stable/9/contrib/file/README
  stable/9/contrib/file/TODO
  stable/9/contrib/file/aclocal.m4
  stable/9/contrib/file/compile
  stable/9/contrib/file/config.h.in
  stable/9/contrib/file/configure
  stable/9/contrib/file/configure.ac
  stable/9/contrib/file/doc/Makefile.in
  stable/9/contrib/file/doc/file.man
  stable/9/contrib/file/doc/libmagic.man
  stable/9/contrib/file/install-sh
  stable/9/contrib/file/magic/Localstuff
  stable/9/contrib/file/magic/Magdir/android
  stable/9/contrib/file/magic/Magdir/animation
  stable/9/contrib/file/magic/Magdir/archive
  stable/9/contrib/file/magic/Magdir/blender
  stable/9/contrib/file/magic/Magdir/commands
  stable/9/contrib/file/magic/Magdir/compress
  stable/9/contrib/file/magic/Magdir/database
  stable/9/contrib/file/magic/Magdir/elf
  stable/9/contrib/file/magic/Magdir/filesystems
  stable/9/contrib/file/magic/Magdir/images
  stable/9/contrib/file/magic/Magdir/jpeg
  stable/9/contrib/file/magic/Magdir/linux
  stable/9/contrib/file/magic/Magdir/macintosh
  stable/9/contrib/file/magic/Magdir/msooxml
  stable/9/contrib/file/magic/Magdir/netbsd
  stable/9/contrib/file/magic/Magdir/pascal
  stable/9/contrib/file/magic/Magdir/pgp
  stable/9/contrib/file/magic/Magdir/python
  stable/9/contrib/file/magic/Magdir/riff
  stable/9/contrib/file/magic/Magdir/sequent
  stable/9/contrib/file/magic/Magdir/sereal
  stable/9/contrib/file/magic/Magdir/ssh
  stable/9/contrib/file/magic/Magdir/vms
  stable/9/contrib/file/magic/Magdir/vorbis
  stable/9/contrib/file/magic/Magdir/windows
  stable/9/contrib/file/magic/Makefile.am
  stable/9/contrib/file/magic/Makefile.in
 

svn commit: r276415 - in stable/10: contrib/file contrib/file/doc contrib/file/magic contrib/file/magic/Magdir contrib/file/python contrib/file/src contrib/file/tests lib/libmagic

2014-12-30 Thread Xin LI
Author: delphij
Date: Tue Dec 30 19:39:31 2014
New Revision: 276415
URL: https://svnweb.freebsd.org/changeset/base/276415

Log:
  MFC r275698: MFV r275696: file 5.21.

Added:
  stable/10/contrib/file/magic/Magdir/kerberos
 - copied unchanged from r275698, head/contrib/file/magic/Magdir/kerberos
  stable/10/contrib/file/magic/Magdir/meteorological
 - copied unchanged from r275698, 
head/contrib/file/magic/Magdir/meteorological
Deleted:
  stable/10/contrib/file/magic/Magdir/rinex
Modified:
  stable/10/contrib/file/ChangeLog
  stable/10/contrib/file/Makefile.in
  stable/10/contrib/file/TODO
  stable/10/contrib/file/aclocal.m4
  stable/10/contrib/file/config.h.in
  stable/10/contrib/file/configure
  stable/10/contrib/file/configure.ac
  stable/10/contrib/file/doc/Makefile.in
  stable/10/contrib/file/doc/file.man
  stable/10/contrib/file/doc/libmagic.man
  stable/10/contrib/file/magic/Localstuff
  stable/10/contrib/file/magic/Magdir/android
  stable/10/contrib/file/magic/Magdir/animation
  stable/10/contrib/file/magic/Magdir/archive
  stable/10/contrib/file/magic/Magdir/blender
  stable/10/contrib/file/magic/Magdir/commands
  stable/10/contrib/file/magic/Magdir/compress
  stable/10/contrib/file/magic/Magdir/database
  stable/10/contrib/file/magic/Magdir/elf
  stable/10/contrib/file/magic/Magdir/filesystems
  stable/10/contrib/file/magic/Magdir/images
  stable/10/contrib/file/magic/Magdir/jpeg
  stable/10/contrib/file/magic/Magdir/linux
  stable/10/contrib/file/magic/Magdir/macintosh
  stable/10/contrib/file/magic/Magdir/msooxml
  stable/10/contrib/file/magic/Magdir/netbsd
  stable/10/contrib/file/magic/Magdir/pascal
  stable/10/contrib/file/magic/Magdir/pgp
  stable/10/contrib/file/magic/Magdir/python
  stable/10/contrib/file/magic/Magdir/riff
  stable/10/contrib/file/magic/Magdir/sequent
  stable/10/contrib/file/magic/Magdir/sereal
  stable/10/contrib/file/magic/Magdir/ssh
  stable/10/contrib/file/magic/Magdir/vms
  stable/10/contrib/file/magic/Magdir/vorbis
  stable/10/contrib/file/magic/Magdir/windows
  stable/10/contrib/file/magic/Makefile.am
  stable/10/contrib/file/magic/Makefile.in
  stable/10/contrib/file/missing
  stable/10/contrib/file/python/Makefile.in
  stable/10/contrib/file/src/Makefile.in
  stable/10/contrib/file/src/apprentice.c
  stable/10/contrib/file/src/ascmagic.c
  stable/10/contrib/file/src/cdf.c
  stable/10/contrib/file/src/cdf.h
  stable/10/contrib/file/src/compress.c
  stable/10/contrib/file/src/elfclass.h
  stable/10/contrib/file/src/encoding.c
  stable/10/contrib/file/src/file.c
  stable/10/contrib/file/src/file.h
  stable/10/contrib/file/src/file_opts.h
  stable/10/contrib/file/src/fsmagic.c
  stable/10/contrib/file/src/funcs.c
  stable/10/contrib/file/src/getline.c
  stable/10/contrib/file/src/magic.c
  stable/10/contrib/file/src/magic.h
  stable/10/contrib/file/src/magic.h.in
  stable/10/contrib/file/src/pread.c
  stable/10/contrib/file/src/readcdf.c
  stable/10/contrib/file/src/readelf.c
  stable/10/contrib/file/src/softmagic.c
  stable/10/contrib/file/src/vasprintf.c
  stable/10/contrib/file/tests/Makefile.in
  stable/10/lib/libmagic/config.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/contrib/file/ChangeLog
==
--- stable/10/contrib/file/ChangeLogTue Dec 30 18:42:53 2014
(r276414)
+++ stable/10/contrib/file/ChangeLogTue Dec 30 19:39:31 2014
(r276415)
@@ -1,3 +1,69 @@
+2014-12-10  20:01  Christos Zoulas 
+
+   * release 5.21
+
+2014-11-27  18:40  Christos Zoulas 
+
+   * Allow setting more parameters from the command line.
+   * Split name/use and indirect magic recursion limits.
+
+2014-11-27  11:12  Christos Zoulas 
+
+   * Adjust ELF parameters and the default recursion
+ level.
+   * Allow setting the recursion level dynamically.
+
+2014-11-24   8:55  Christos Zoulas 
+
+   * The following fixes resulted from Thomas Jarosch's fuzzing
+ tests that revealed severe performance issues on pathological
+ input:
+   - limit number of elf program and sections processing
+   - abort elf note processing quickly
+   - reduce the number of recursion levels from 20 to 10
+   - preserve error messages in indirect magic handling
+
+2014-11-12  10:30  Christos Zoulas 
+
+   * fix bogus free in the user buffer case.
+
+2014-11-11  12:35  Christos Zoulas 
+
+   * fix out of bounds read for pascal strings
+   * fix memory leak (not freeing the head of each mlist)
+
+2014-11-07  10:25  Christos Zoulas 
+
+   * When printing strings from a file, convert them to printable
+ on a byte by byte basis, so that we don't get issues with
+ locale's trying to interpret random byte streams as UTF-8 and
+ having printf error out with EILSEQ.
+ 
+2014-10-17  11:48  Christos Zoulas 
+
+   * fix bounds in note reading (Francisco Alonso / Red Hat

svn commit: r276414 - head

2014-12-30 Thread Ed Maste
Author: emaste
Date: Tue Dec 30 18:42:53 2014
New Revision: 276414
URL: https://svnweb.freebsd.org/changeset/base/276414

Log:
  Use BINUTILS_BOOTSTRAP knob for binutils only
  
  Previously it also disabled building elftoolchain bootstrap tools such as
  strip(1).
  
  Differential Revision:https://reviews.freebsd.org/D1398
  Reviewed by:  imp
  Sponsored by: The FreeBSD Foundation

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Tue Dec 30 17:30:47 2014(r276413)
+++ head/Makefile.inc1  Tue Dec 30 18:42:53 2014(r276414)
@@ -1440,8 +1440,10 @@ _kgzip=  usr.sbin/kgzip
 .endif
 
 # If we're given an XAS, don't build binutils.
-.if ${XAS:M/*} == "" && ${MK_BINUTILS_BOOTSTRAP} != "no"
+.if ${XAS:M/*} == ""
+.if ${MK_BINUTILS_BOOTSTRAP} != "no"
 _binutils= gnu/usr.bin/binutils
+.endif
 .if ${MK_ELFTOOLCHAIN_TOOLS} != "no"
 _elftctools=   lib/libelftc \
usr.bin/addr2line \
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276412 - head/lib/libstand

2014-12-30 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Tue Dec 30 16:55:53 2014
New Revision: 276412
URL: https://svnweb.freebsd.org/changeset/base/276412

Log:
  Fix loader's ability to read the 10.1 release PowerPC ISOs. There appears to
  be some kind of problem with the version of makefs used for these disks.
  There may be a better way to handle this problem, so I've set the MFC
  timer for a fairly long time period.
  
  MFC after:2 weeks

Modified:
  head/lib/libstand/cd9660.c

Modified: head/lib/libstand/cd9660.c
==
--- head/lib/libstand/cd9660.c  Tue Dec 30 16:22:20 2014(r276411)
+++ head/lib/libstand/cd9660.c  Tue Dec 30 16:55:53 2014(r276412)
@@ -151,9 +151,14 @@ susp_lookup_record(struct open_file *f, 
return (NULL);
p = susp_buffer + isonum_733(shc->offset);
end = p + isonum_733(shc->length);
-   } else
+   } else {
/* Ignore this record and skip to the next. */
p += isonum_711(sh->length);
+
+   /* Avoid infinite loops with corrupted file systems */
+   if (isonum_711(sh->length) == 0)
+   return (NULL);
+   }
}
return (NULL);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276409 - head/sys/dev/virtio/mmio

2014-12-30 Thread Andrew Turner
Author: andrew
Date: Tue Dec 30 12:47:44 2014
New Revision: 276409
URL: https://svnweb.freebsd.org/changeset/base/276409

Log:
  Set the page size in the virtio-mmio driver. Some backends, e.g QEMU, assume
  a 1 byte page size until told otherwise.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/virtio/mmio/virtio_mmio.c

Modified: head/sys/dev/virtio/mmio/virtio_mmio.c
==
--- head/sys/dev/virtio/mmio/virtio_mmio.c  Tue Dec 30 10:30:12 2014
(r276408)
+++ head/sys/dev/virtio/mmio/virtio_mmio.c  Tue Dec 30 12:47:44 2014
(r276409)
@@ -506,6 +506,8 @@ vtmmio_alloc_virtqueues(device_t dev, in
if (sc->vtmmio_vqs == NULL)
return (ENOMEM);
 
+   vtmmio_write_config_4(sc, VIRTIO_MMIO_GUEST_PAGE_SIZE, 1 << PAGE_SHIFT);
+
for (idx = 0; idx < nvqs; idx++) {
vqx = &sc->vtmmio_vqs[idx];
info = &vq_info[idx];
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276408 - in stable/10/sys: fs/msdosfs kern

2014-12-30 Thread Konstantin Belousov
Author: kib
Date: Tue Dec 30 10:30:12 2014
New Revision: 276408
URL: https://svnweb.freebsd.org/changeset/base/276408

Log:
  MFC r275638:
  Do not call VFS_SYNC() before VFS_UNMOUNT() for forced unmount.

Modified:
  stable/10/sys/fs/msdosfs/msdosfs_vfsops.c
  stable/10/sys/kern/vfs_mount.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/msdosfs/msdosfs_vfsops.c
==
--- stable/10/sys/fs/msdosfs/msdosfs_vfsops.c   Tue Dec 30 09:20:29 2014
(r276407)
+++ stable/10/sys/fs/msdosfs/msdosfs_vfsops.c   Tue Dec 30 10:30:12 2014
(r276408)
@@ -797,11 +797,15 @@ msdosfs_unmount(struct mount *mp, int mn
int error, flags;
 
flags = 0;
-   if (mntflags & MNT_FORCE)
+   error = msdosfs_sync(mp, MNT_WAIT);
+   if ((mntflags & MNT_FORCE) != 0) {
flags |= FORCECLOSE;
+   } else if (error != 0) {
+   return (error);
+   }
error = vflush(mp, 0, flags, curthread);
-   if (error && error != ENXIO)
-   return error;
+   if (error != 0 && error != ENXIO)
+   return (error);
pmp = VFSTOMSDOSFS(mp);
if ((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0) {
error = markvoldirty(pmp, 0);

Modified: stable/10/sys/kern/vfs_mount.c
==
--- stable/10/sys/kern/vfs_mount.c  Tue Dec 30 09:20:29 2014
(r276407)
+++ stable/10/sys/kern/vfs_mount.c  Tue Dec 30 10:30:12 2014
(r276408)
@@ -1305,8 +1305,8 @@ dounmount(mp, flags, td)
}
vput(fsrootvp);
}
-   if (((mp->mnt_flag & MNT_RDONLY) ||
-(error = VFS_SYNC(mp, MNT_WAIT)) == 0) || (flags & MNT_FORCE) != 0)
+   if ((mp->mnt_flag & MNT_RDONLY) != 0 || (flags & MNT_FORCE) != 0 ||
+   (error = VFS_SYNC(mp, MNT_WAIT)) == 0)
error = VFS_UNMOUNT(mp, flags);
vn_finished_write(mp);
/*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276407 - head/sys/dev/usb/controller

2014-12-30 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec 30 09:20:29 2014
New Revision: 276407
URL: https://svnweb.freebsd.org/changeset/base/276407

Log:
  Allow systems having a page size greater than 4K to use fewer
  scatter-gather XHCI TRB entries for its payload data. The XHCI
  controller can handle at least 65536 bytes per scatter-gather list
  entry.
  
  MFC after:1 week
  Suggested by: Kohji Okuno 

Modified:
  head/sys/dev/usb/controller/xhci.h

Modified: head/sys/dev/usb/controller/xhci.h
==
--- head/sys/dev/usb/controller/xhci.h  Tue Dec 30 08:50:50 2014
(r276406)
+++ head/sys/dev/usb/controller/xhci.h  Tue Dec 30 09:20:29 2014
(r276407)
@@ -320,11 +320,23 @@ struct xhci_dev_endpoint_trbs {
XHCI_MAX_TRANSFERS) + XHCI_MAX_STREAMS];
 };
 
-#defineXHCI_TD_PAGE_NBUF   17  /* units, room enough for 
64Kbytes */
-#defineXHCI_TD_PAGE_SIZE   4096/* bytes */
-#defineXHCI_TD_PAYLOAD_MAX (XHCI_TD_PAGE_SIZE * (XHCI_TD_PAGE_NBUF 
- 1))
+#if (USB_PAGE_SIZE < 4096)
+#error "The XHCI driver needs a pagesize above 4K"
+#endif
+
+/* Define the maximum payload which we will handle in a single TRB */
+#defineXHCI_TD_PAYLOAD_MAX 65536   /* bytes */
+
+/* Define the maximum payload of a single scatter-gather list element */
+#defineXHCI_TD_PAGE_SIZE \
+  ((USB_PAGE_SIZE < XHCI_TD_PAYLOAD_MAX) ? USB_PAGE_SIZE : XHCI_TD_PAYLOAD_MAX)
+
+/* Define the maximum length of the scatter-gather list */
+#defineXHCI_TD_PAGE_NBUF \
+  (((XHCI_TD_PAYLOAD_MAX + XHCI_TD_PAGE_SIZE - 1) / XHCI_TD_PAGE_SIZE) + 1)
 
 struct xhci_td {
+   /* one LINK TRB has been added to the TRB array */
struct xhci_trb td_trb[XHCI_TD_PAGE_NBUF + 1];
 
 /*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276406 - head/sys/dev/vt/hw/vga

2014-12-30 Thread Roger Pau Monné
Author: royger
Date: Tue Dec 30 08:50:50 2014
New Revision: 276406
URL: https://svnweb.freebsd.org/changeset/base/276406

Log:
  vt_vga: fix an off-by-one error
  
  This correctly sets the end of the memory region registered by vt_vga.
  
  Reported by:  marius

Modified:
  head/sys/dev/vt/hw/vga/vt_vga.c

Modified: head/sys/dev/vt/hw/vga/vt_vga.c
==
--- head/sys/dev/vt/hw/vga/vt_vga.c Tue Dec 30 08:50:07 2014
(r276405)
+++ head/sys/dev/vt/hw/vga/vt_vga.c Tue Dec 30 08:50:50 2014
(r276406)
@@ -1275,7 +1275,7 @@ vtvga_attach(device_t dev)
 
res_id = 0;
pseudo_phys_res = bus_alloc_resource(dev, SYS_RES_MEMORY,
-   &res_id, VGA_MEM_BASE, VGA_MEM_BASE + VGA_MEM_SIZE,
+   &res_id, VGA_MEM_BASE, VGA_MEM_BASE + VGA_MEM_SIZE - 1,
VGA_MEM_SIZE, RF_ACTIVE);
if (pseudo_phys_res == NULL)
panic("Unable to reserve vt_vga memory");
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276405 - head/sys/dev/vt/hw/efifb

2014-12-30 Thread Roger Pau Monné
Author: royger
Date: Tue Dec 30 08:50:07 2014
New Revision: 276405
URL: https://svnweb.freebsd.org/changeset/base/276405

Log:
  Partially revert "vt: register the memory regions used by the vt drivers"
  
  Revert the EFI part of r276064 until I can test it properly on a real EFI
  system. This was causing problems to people booting using UEFI and vt.
  
  Reported by:  O. Hartmann 

Modified:
  head/sys/dev/vt/hw/efifb/efifb.c

Modified: head/sys/dev/vt/hw/efifb/efifb.c
==
--- head/sys/dev/vt/hw/efifb/efifb.cTue Dec 30 08:33:51 2014
(r276404)
+++ head/sys/dev/vt/hw/efifb/efifb.cTue Dec 30 08:50:07 2014
(r276405)
@@ -37,9 +37,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
 
 #include "opt_platform.h"
 
@@ -182,53 +179,3 @@ vt_efifb_remap(void *xinfo)
info->fb_size, VM_MEMATTR_WRITE_COMBINING);
 }
 
-/* Dummy NewBus functions to reserve the resources used by the efifb driver */
-static void
-vtefifb_identify(driver_t *driver, device_t parent)
-{
-
-   if (local_info.fb_pbase == 0 || local_info.fb_size == 0)
-   return;
-
-   if (BUS_ADD_CHILD(parent, 0, driver->name, 0) == NULL)
-   panic("Unable to attach vt_efifb console");
-}
-
-static int
-vtefifb_probe(device_t dev)
-{
-
-   device_set_desc(dev, "vt_efifb driver");
-   return (BUS_PROBE_NOWILDCARD);
-}
-
-static int
-vtefifb_attach(device_t dev)
-{
-   struct resource *pseudo_phys_res;
-   int res_id;
-
-   res_id = 0;
-   pseudo_phys_res = bus_alloc_resource(dev, SYS_RES_MEMORY,
-   &res_id, local_info.fb_pbase,
-   local_info.fb_pbase + local_info.fb_size,
-   local_info.fb_size, RF_ACTIVE);
-   if (pseudo_phys_res == NULL)
-   panic("Unable to reserve vt_efifb memory");
-   return (0);
-}
-
-/* Private Device Attachment Data  
---*/
-static device_method_t vtefifb_methods[] = {
-   /* Device interface */
-   DEVMETHOD(device_identify,  vtefifb_identify),
-   DEVMETHOD(device_probe, vtefifb_probe),
-   DEVMETHOD(device_attach,vtefifb_attach),
-
-   DEVMETHOD_END
-};
-
-DEFINE_CLASS_0(vtefifb, vtefifb_driver, vtefifb_methods, 0);
-devclass_t vtefifb_devclass;
-
-DRIVER_MODULE(vtefifb, nexus, vtefifb_driver, vtefifb_devclass, NULL, NULL);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r276083 - head/etc

2014-12-30 Thread Bruce Simpson

On 22/12/2014 21:26, Dmitry Morozovsky wrote:

Log:
   Add VAMI (VMware Appliance Management Interface) port.
   


This is vApp / VMware Studio related; any plans to get FreeBSD guests 
working?


___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276404 - head/sys/dev/usb/controller

2014-12-30 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec 30 08:33:51 2014
New Revision: 276404
URL: https://svnweb.freebsd.org/changeset/base/276404

Log:
  Add missed flushing of data which can happen when "xhci_configure_mask()"
  is called from "xhci_configure_reset_endpoint()". Ensure the 3-strikes
  error feature is always enabled except for ISOCHRONOUS transfers.
  
  MFC after:1 week
  Suggested by: marius@

Modified:
  head/sys/dev/usb/controller/xhci.c

Modified: head/sys/dev/usb/controller/xhci.c
==
--- head/sys/dev/usb/controller/xhci.c  Tue Dec 30 08:24:14 2014
(r276403)
+++ head/sys/dev/usb/controller/xhci.c  Tue Dec 30 08:33:51 2014
(r276404)
@@ -2283,6 +2283,7 @@ xhci_configure_mask(struct usb_device *u
temp |= XHCI_SCTX_0_CTX_NUM_SET(x + 1);
xhci_ctx_set_le32(sc, &pinp->ctx_slot.dwSctx0, temp);
}
+   usb_pc_cpu_flush(&sc->sc_hw.devs[index].input_pc);
return (0);
 }
 
@@ -2387,10 +2388,14 @@ xhci_configure_endpoint(struct usb_devic
XHCI_EPCTX_1_MAXB_SET(max_packet_count) |
XHCI_EPCTX_1_MAXP_SIZE_SET(max_packet_size);
 
-   if ((udev->parent_hs_hub != NULL) || (udev->address != 0)) {
-   if (type != UE_ISOCHRONOUS)
-   temp |= XHCI_EPCTX_1_CERR_SET(3);
-   }
+   /*
+* Always enable the "three strikes and you are gone" feature
+* except for ISOCHRONOUS endpoints. This is suggested by
+* section 4.3.3 in the XHCI specification about device slot
+* initialisation.
+*/
+   if (type != UE_ISOCHRONOUS)
+   temp |= XHCI_EPCTX_1_CERR_SET(3);
 
switch (type) {
case UE_CONTROL:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276403 - in stable/10: sys/amd64/include sys/amd64/vmm sys/amd64/vmm/amd sys/amd64/vmm/intel sys/amd64/vmm/io sys/modules/vmm usr.sbin/bhyve usr.sbin/bhyvectl

2014-12-30 Thread Neel Natu
Author: neel
Date: Tue Dec 30 08:24:14 2014
New Revision: 276403
URL: https://svnweb.freebsd.org/changeset/base/276403

Log:
  MFC r273375
  Add support AMD processors with the SVM/AMD-V hardware extensions.
  
  MFC r273749
  Remove bhyve SVM feature printf's now that they are available in the general
  CPU feature detection code.
  
  MFC r273766
  Add missing 'break' pointed out by Coverity CID 1249760.
  
  MFC r276098
  Allow ktr(4) tracing of all guest exceptions via the tunable 
"hw.vmm.trace_guest_exceptions"
  
  MFC r276392
  Inject #UD into the guest when it executes either 'MONITOR' or 'MWAIT' on an
  AMD/SVM host.
  
  MFC r276402
  Remove "svn:mergeinfo" property that was dragged along when these files were
  svn copied in r273375.

Added:
 - copied unchanged from r273375, head/sys/amd64/vmm/amd/npt.c
 - copied unchanged from r273375, head/sys/amd64/vmm/amd/npt.h
  stable/10/sys/amd64/vmm/amd/svm.c   (contents, props changed)
 - copied, changed from r273375, head/sys/amd64/vmm/amd/svm.c
 - copied unchanged from r273375, head/sys/amd64/vmm/amd/svm.h
 - copied unchanged from r273375, head/sys/amd64/vmm/amd/svm_genassym.c
 - copied unchanged from r273375, head/sys/amd64/vmm/amd/svm_msr.c
 - copied unchanged from r273375, head/sys/amd64/vmm/amd/svm_msr.h
 - copied unchanged from r273375, head/sys/amd64/vmm/amd/svm_softc.h
 - copied unchanged from r273375, head/sys/amd64/vmm/amd/svm_support.S
  stable/10/sys/amd64/vmm/amd/vmcb.c   (contents, props changed)
 - copied, changed from r273375, head/sys/amd64/vmm/amd/vmcb.c
  stable/10/sys/amd64/vmm/amd/vmcb.h   (contents, props changed)
 - copied, changed from r273375, head/sys/amd64/vmm/amd/vmcb.h
Directory Properties:
  stable/10/sys/amd64/vmm/amd/npt.c   (props changed)
  stable/10/sys/amd64/vmm/amd/npt.h   (props changed)
  stable/10/sys/amd64/vmm/amd/svm.h   (props changed)
  stable/10/sys/amd64/vmm/amd/svm_genassym.c   (props changed)
  stable/10/sys/amd64/vmm/amd/svm_msr.c   (props changed)
  stable/10/sys/amd64/vmm/amd/svm_msr.h   (props changed)
  stable/10/sys/amd64/vmm/amd/svm_softc.h   (props changed)
  stable/10/sys/amd64/vmm/amd/svm_support.S   (props changed)
Modified:
  stable/10/sys/amd64/include/vmm.h
  stable/10/sys/amd64/include/vmm_instruction_emul.h
  stable/10/sys/amd64/vmm/amd/amdv.c
  stable/10/sys/amd64/vmm/intel/vmcs.c
  stable/10/sys/amd64/vmm/intel/vmcs.h
  stable/10/sys/amd64/vmm/intel/vmx.c
  stable/10/sys/amd64/vmm/io/vlapic.c
  stable/10/sys/amd64/vmm/vmm.c
  stable/10/sys/amd64/vmm/vmm_instruction_emul.c
  stable/10/sys/amd64/vmm/x86.c
  stable/10/sys/modules/vmm/Makefile
  stable/10/usr.sbin/bhyve/bhyverun.c
  stable/10/usr.sbin/bhyve/xmsr.c
  stable/10/usr.sbin/bhyvectl/bhyvectl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/include/vmm.h
==
--- stable/10/sys/amd64/include/vmm.h   Tue Dec 30 07:08:30 2014
(r276402)
+++ stable/10/sys/amd64/include/vmm.h   Tue Dec 30 08:24:14 2014
(r276403)
@@ -357,6 +357,8 @@ void vm_copyin(struct vm *vm, int vcpuid
 void *kaddr, size_t len);
 void vm_copyout(struct vm *vm, int vcpuid, const void *kaddr,
 struct vm_copyinfo *copyinfo, size_t len);
+
+int vcpu_trace_exceptions(struct vm *vm, int vcpuid);
 #endif /* KERNEL */
 
 #defineVM_MAXCPU   16  /* maximum virtual cpus 
*/
@@ -487,6 +489,7 @@ enum vm_exitcode {
VM_EXITCODE_TASK_SWITCH,
VM_EXITCODE_MONITOR,
VM_EXITCODE_MWAIT,
+   VM_EXITCODE_SVM,
VM_EXITCODE_MAX
 };
 
@@ -564,6 +567,14 @@ struct vm_exit {
int inst_type;
int inst_error;
} vmx;
+   /*
+* SVM specific payload.
+*/
+   struct {
+   uint64_texitcode;
+   uint64_texitinfo1;
+   uint64_texitinfo2;
+   } svm;
struct {
uint32_tcode;   /* ecx value */
uint64_twval;

Modified: stable/10/sys/amd64/include/vmm_instruction_emul.h
==
--- stable/10/sys/amd64/include/vmm_instruction_emul.h  Tue Dec 30 07:08:30 
2014(r276402)
+++ stable/10/sys/amd64/include/vmm_instruction_emul.h  Tue Dec 30 08:24:14 
2014(r276403)
@@ -93,7 +93,7 @@ int vmm_fetch_instruction(struct vm *vm,
 int vmm_gla2gpa(struct vm *vm, int vcpuid, struct vm_guest_paging *paging,
 uint64_t gla, int prot, uint64_t *gpa);
 
-void vie_init(struct vie *vie);
+void vie_init(struct vie *vie, const char *inst_bytes, int inst_length);
 
 /*
  * Decode the instruction fetched into 'vie' so it can be emulated.

Modified: stable/10/sys/amd64/vmm/amd/amdv.c
===