svn commit: r308073 - in head/sys/powerpc: include powerpc

2016-10-28 Thread Justin Hibbits
Author: jhibbits
Date: Sat Oct 29 01:24:30 2016
New Revision: 308073
URL: https://svnweb.freebsd.org/changeset/base/308073

Log:
  Add the SPE feature mask for e500v1 and e500v2
  
  On e500v2 SoCs it will now print:
  
  cpu0: Features 84e08000
  
  at bootup.

Modified:
  head/sys/powerpc/include/cpu.h
  head/sys/powerpc/powerpc/cpu.c

Modified: head/sys/powerpc/include/cpu.h
==
--- head/sys/powerpc/include/cpu.h  Sat Oct 29 01:22:55 2016
(r308072)
+++ head/sys/powerpc/include/cpu.h  Sat Oct 29 01:24:30 2016
(r308073)
@@ -56,6 +56,9 @@ extern int cpu_features2;
 #definePPC_FEATURE_HAS_FPU 0x0800
 #definePPC_FEATURE_HAS_MMU 0x0400
 #definePPC_FEATURE_UNIFIED_CACHE 0x0100
+#definePPC_FEATURE_HAS_SPE 0x0080
+#definePPC_FEATURE_HAS_EFP_SINGLE  0x0040
+#definePPC_FEATURE_HAS_EFP_DOUBLE  0x0020
 #definePPC_FEATURE_BOOKE   0x8000
 #definePPC_FEATURE_SMT 0x4000
 #definePPC_FEATURE_ARCH_2_05   0x1000
@@ -70,7 +73,8 @@ extern int cpu_features2;
 #definePPC_FEATURE_BITMASK 
\
"\20"   \
"\040PPC32\037PPC64\035ALTIVEC\034FPU\033MMU\031UNIFIEDCACHE"   \
-   "\020BOOKE\017SMT\015ARCH205\013DFP\011ARCH206\010VSX"
+   "\030SPE\027SPESFP\026DPESFP\020BOOKE\017SMT\015ARCH205\013DFP" \
+   "\011ARCH206\010VSX"
 #definePPC_FEATURE2_BITMASK
\
"\20"   \
"\040ARCH207\037HTM\032VCRYPTO"

Modified: head/sys/powerpc/powerpc/cpu.c
==
--- head/sys/powerpc/powerpc/cpu.c  Sat Oct 29 01:22:55 2016
(r308072)
+++ head/sys/powerpc/powerpc/cpu.c  Sat Oct 29 01:24:30 2016
(r308073)
@@ -180,9 +180,12 @@ static const struct cputab models[] = {
 { "Motorola PowerPC 8245", MPC8245,REVFMT_MAJMIN,
   PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup },
 { "Freescale e500v1 core", FSL_E500v1, REVFMT_MAJMIN,
-  PPC_FEATURE_BOOKE, 0, cpu_booke_setup },
+  PPC_FEATURE_BOOKE | PPC_FEATURE_HAS_SPE | PPC_FEATURE_HAS_EFP_SINGLE,
+  0, cpu_booke_setup },
 { "Freescale e500v2 core", FSL_E500v2, REVFMT_MAJMIN,
-  PPC_FEATURE_BOOKE, 0, cpu_booke_setup },
+  PPC_FEATURE_BOOKE | PPC_FEATURE_HAS_SPE |
+  PPC_FEATURE_HAS_EFP_SINGLE | PPC_FEATURE_HAS_EFP_DOUBLE, 0,
+  cpu_booke_setup },
{ "Freescale e500mc core",  FSL_E500mc, REVFMT_MAJMIN,
   PPC_FEATURE_BOOKE | PPC_FEATURE_HAS_FPU, 0, cpu_booke_setup },
{ "Freescale e5500 core",   FSL_E5500,  REVFMT_MAJMIN,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308072 - head/lib/libc/powerpcspe/gen

2016-10-28 Thread Justin Hibbits
Author: jhibbits
Date: Sat Oct 29 01:22:55 2016
New Revision: 308072
URL: https://svnweb.freebsd.org/changeset/base/308072

Log:
  Fix a copy causing a segfault with sigsetjmp.
  
  I'm not sure how this passed my code inspection and initial testing, it's
  obviously wrong.  Found when debugging csh.

Modified:
  head/lib/libc/powerpcspe/gen/setjmp.S
  head/lib/libc/powerpcspe/gen/sigsetjmp.S

Modified: head/lib/libc/powerpcspe/gen/setjmp.S
==
--- head/lib/libc/powerpcspe/gen/setjmp.S   Sat Oct 29 00:16:43 2016
(r308071)
+++ head/lib/libc/powerpcspe/gen/setjmp.S   Sat Oct 29 01:22:55 2016
(r308072)
@@ -95,29 +95,29 @@ END(setjmp)
 
WEAK_REFERENCE(CNAME(__longjmp), longjmp)
 ENTRY(__longjmp)
-   evldd   %r9,24+0*8(%r6)
-   evldd   %r10,24+1*8(%r6)
-   evldd   %r11,24+2*8(%r6)
-   evldd   %r12,24+3*8(%r6)
-   evldd   %r13,24+4*8(%r6)
-   evldd   %r14,24+5*8(%r6)
-   evldd   %r15,24+6*8(%r6)
-   evldd   %r16,24+7*8(%r6)
-   evldd   %r17,24+8*8(%r6)
-   evldd   %r18,24+9*8(%r6)
-   evldd   %r19,24+10*8(%r6)
-   evldd   %r20,24+11*8(%r6)
-   evldd   %r21,24+12*8(%r6)
-   evldd   %r22,24+13*8(%r6)
-   evldd   %r23,24+14*8(%r6)
-   evldd   %r24,24+15*8(%r6)
-   evldd   %r25,24+16*8(%r6)
-   evldd   %r26,24+17*8(%r6)
-   evldd   %r27,24+18*8(%r6)
-   evldd   %r28,24+19*8(%r6)
-   evldd   %r29,24+20*8(%r6)
-   evldd   %r30,24+21*8(%r6)
-   evldd   %r31,24+22*8(%r6)
+   evldd   %r9,24+0*8(%r3)
+   evldd   %r10,24+1*8(%r3)
+   evldd   %r11,24+2*8(%r3)
+   evldd   %r12,24+3*8(%r3)
+   evldd   %r13,24+4*8(%r3)
+   evldd   %r14,24+5*8(%r3)
+   evldd   %r15,24+6*8(%r3)
+   evldd   %r16,24+7*8(%r3)
+   evldd   %r17,24+8*8(%r3)
+   evldd   %r18,24+9*8(%r3)
+   evldd   %r19,24+10*8(%r3)
+   evldd   %r20,24+11*8(%r3)
+   evldd   %r21,24+12*8(%r3)
+   evldd   %r22,24+13*8(%r3)
+   evldd   %r23,24+14*8(%r3)
+   evldd   %r24,24+15*8(%r3)
+   evldd   %r25,24+16*8(%r3)
+   evldd   %r26,24+17*8(%r3)
+   evldd   %r27,24+18*8(%r3)
+   evldd   %r28,24+19*8(%r3)
+   evldd   %r29,24+20*8(%r3)
+   evldd   %r30,24+21*8(%r3)
+   evldd   %r31,24+22*8(%r3)
 
mr  %r6,%r4 /* save val param */
mtlr%r11/* r11 -> link reg */

Modified: head/lib/libc/powerpcspe/gen/sigsetjmp.S
==
--- head/lib/libc/powerpcspe/gen/sigsetjmp.SSat Oct 29 00:16:43 2016
(r308071)
+++ head/lib/libc/powerpcspe/gen/sigsetjmp.SSat Oct 29 01:22:55 2016
(r308072)
@@ -103,29 +103,29 @@ END(sigsetjmp)
 ENTRY(siglongjmp)
 
/* FPRs */
-   evldd   %r9,24+0*8(%r6)
-   evldd   %r10,24+1*8(%r6)
-   evldd   %r11,24+2*8(%r6)
-   evldd   %r12,24+3*8(%r6)
-   evldd   %r13,24+4*8(%r6)
-   evldd   %r14,24+5*8(%r6)
-   evldd   %r15,24+6*8(%r6)
-   evldd   %r16,24+7*8(%r6)
-   evldd   %r17,24+8*8(%r6)
-   evldd   %r18,24+9*8(%r6)
-   evldd   %r19,24+10*8(%r6)
-   evldd   %r20,24+11*8(%r6)
-   evldd   %r21,24+12*8(%r6)
-   evldd   %r22,24+13*8(%r6)
-   evldd   %r23,24+14*8(%r6)
-   evldd   %r24,24+15*8(%r6)
-   evldd   %r25,24+16*8(%r6)
-   evldd   %r26,24+17*8(%r6)
-   evldd   %r27,24+18*8(%r6)
-   evldd   %r28,24+19*8(%r6)
-   evldd   %r29,24+20*8(%r6)
-   evldd   %r30,24+21*8(%r6)
-   evldd   %r31,24+22*8(%r6)
+   evldd   %r9,24+0*8(%r3)
+   evldd   %r10,24+1*8(%r3)
+   evldd   %r11,24+2*8(%r3)
+   evldd   %r12,24+3*8(%r3)
+   evldd   %r13,24+4*8(%r3)
+   evldd   %r14,24+5*8(%r3)
+   evldd   %r15,24+6*8(%r3)
+   evldd   %r16,24+7*8(%r3)
+   evldd   %r17,24+8*8(%r3)
+   evldd   %r18,24+9*8(%r3)
+   evldd   %r19,24+10*8(%r3)
+   evldd   %r20,24+11*8(%r3)
+   evldd   %r21,24+12*8(%r3)
+   evldd   %r22,24+13*8(%r3)
+   evldd   %r23,24+14*8(%r3)
+   evldd   %r24,24+15*8(%r3)
+   evldd   %r25,24+16*8(%r3)
+   evldd   %r26,24+17*8(%r3)
+   evldd   %r27,24+18*8(%r3)
+   evldd   %r28,24+19*8(%r3)
+   evldd   %r29,24+20*8(%r3)
+   evldd   %r30,24+21*8(%r3)
+   evldd   %r31,24+22*8(%r3)
 
lwz %r7,0(%r3)
mr  %r6,%r4
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308071 - stable/10/sys/dev/cxgbe/tom

2016-10-28 Thread John Baldwin
Author: jhb
Date: Sat Oct 29 00:16:43 2016
New Revision: 308071
URL: https://svnweb.freebsd.org/changeset/base/308071

Log:
  MFC 272079,272080: cxgbe/tom: Update for syncache_add locking changes.
  
  272079:
  cxgbe/tom:  Catch up with r271119, syncache_add doesn't need tcbinfo lock.
  
  272080:
  Update comment (missed this bit in r272079).

Modified:
  stable/10/sys/dev/cxgbe/tom/t4_listen.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/cxgbe/tom/t4_listen.c
==
--- stable/10/sys/dev/cxgbe/tom/t4_listen.c Fri Oct 28 23:53:37 2016
(r308070)
+++ stable/10/sys/dev/cxgbe/tom/t4_listen.c Sat Oct 29 00:16:43 2016
(r308071)
@@ -1311,7 +1311,7 @@ do_pass_accept_req(struct sge_iq *iq, co
REJECT_PASS_ACCEPT();
rpl = wrtod(wr);
 
-   INP_INFO_WLOCK(_tcbinfo); /* for 4-tuple check, syncache_add */
+   INP_INFO_WLOCK(_tcbinfo); /* for 4-tuple check */
 
/* Don't offload if the 4-tuple is already in use */
if (toe_4tuple_check(, , ifp) != 0) {
@@ -1319,6 +1319,7 @@ do_pass_accept_req(struct sge_iq *iq, co
free(wr, M_CXGBE);
REJECT_PASS_ACCEPT();
}
+   INP_INFO_WUNLOCK(_tcbinfo);
 
inp = lctx->inp;/* listening socket, not owned by TOE */
INP_WLOCK(inp);
@@ -1331,7 +1332,6 @@ do_pass_accept_req(struct sge_iq *iq, co
 * resources tied to this listen context.
 */
INP_WUNLOCK(inp);
-   INP_INFO_WUNLOCK(_tcbinfo);
free(wr, M_CXGBE);
REJECT_PASS_ACCEPT();
}
@@ -1378,12 +1378,10 @@ do_pass_accept_req(struct sge_iq *iq, co
 
/*
 * If all goes well t4_syncache_respond will get called during
-* syncache_add.  Also note that syncache_add releases both pcbinfo and
-* pcb locks.
+* syncache_add.  Note that syncache_add releases the pcb lock.
 */
toe_syncache_add(, , , inp, tod, synqe);
INP_UNLOCK_ASSERT(inp); /* ok to assert, we have a ref on the inp */
-   INP_INFO_UNLOCK_ASSERT(_tcbinfo);
 
/*
 * If we replied during syncache_add (synqe->wr has been consumed),
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308068 - head/sys/dev/ioat

2016-10-28 Thread Conrad E. Meyer
Author: cem
Date: Fri Oct 28 23:53:35 2016
New Revision: 308068
URL: https://svnweb.freebsd.org/changeset/base/308068

Log:
  ioat(4): Assert the submit lock in ioat_submit_single
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/dev/ioat/ioat.c

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cFri Oct 28 23:53:33 2016(r308067)
+++ head/sys/dev/ioat/ioat.cFri Oct 28 23:53:35 2016(r308068)
@@ -1804,6 +1804,8 @@ static void
 ioat_submit_single(struct ioat_softc *ioat)
 {
 
+   mtx_assert(>submit_lock, MA_OWNED);
+
ioat_get(ioat, IOAT_ACTIVE_DESCR_REF);
atomic_add_rel_int(>head, 1);
atomic_add_rel_int(>hw_head, 1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308067 - head/sys/dev/ioat

2016-10-28 Thread Conrad E. Meyer
Author: cem
Date: Fri Oct 28 23:53:33 2016
New Revision: 308067
URL: https://svnweb.freebsd.org/changeset/base/308067

Log:
  ioat(4): Add additional tracing
  
  These probes help track down driver bugs.
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/dev/ioat/ioat.c

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cFri Oct 28 23:01:11 2016(r308066)
+++ head/sys/dev/ioat/ioat.cFri Oct 28 23:53:33 2016(r308067)
@@ -693,8 +693,8 @@ ioat_process_events(struct ioat_softc *i
while (desc->hw_desc_bus_addr != status && ioat_get_active(ioat) > 0) {
desc = ioat_get_ring_entry(ioat, ioat->tail);
dmadesc = >bus_dmadesc;
-   CTR4(KTR_IOAT, "channel=%u completing desc %u ok  cb %p(%p)",
-   ioat->chan_idx, ioat->tail, dmadesc->callback_fn,
+   CTR5(KTR_IOAT, "channel=%u completing desc idx %u (%p) ok  cb 
%p(%p)",
+   ioat->chan_idx, ioat->tail, dmadesc, dmadesc->callback_fn,
dmadesc->callback_arg);
 
if (dmadesc->callback_fn != NULL)
@@ -703,6 +703,8 @@ ioat_process_events(struct ioat_softc *i
completed++;
ioat->tail++;
}
+   CTR5(KTR_IOAT, "%s channel=%u head=%u tail=%u active=%u", __func__,
+   ioat->chan_idx, ioat->head, ioat->tail, ioat_get_active(ioat));
 
if (completed != 0) {
ioat->last_seen = desc->hw_desc_bus_addr;
@@ -760,8 +762,8 @@ out:
while (ioat_get_active(ioat) > 0) {
desc = ioat_get_ring_entry(ioat, ioat->tail);
dmadesc = >bus_dmadesc;
-   CTR4(KTR_IOAT, "channel=%u completing desc %u err cb %p(%p)",
-   ioat->chan_idx, ioat->tail, dmadesc->callback_fn,
+   CTR5(KTR_IOAT, "channel=%u completing desc idx %u (%p) err cb 
%p(%p)",
+   ioat->chan_idx, ioat->tail, dmadesc, dmadesc->callback_fn,
dmadesc->callback_arg);
 
if (dmadesc->callback_fn != NULL)
@@ -773,6 +775,8 @@ out:
ioat->stats.descriptors_processed++;
ioat->stats.descriptors_error++;
}
+   CTR5(KTR_IOAT, "%s channel=%u head=%u tail=%u active=%u", __func__,
+   ioat->chan_idx, ioat->head, ioat->tail, ioat_get_active(ioat));
 
if (ioat->is_completion_pending) {
ioat->is_completion_pending = FALSE;
@@ -947,7 +951,8 @@ ioat_release(bus_dmaengine_t dmaengine)
struct ioat_softc *ioat;
 
ioat = to_ioat_softc(dmaengine);
-   CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx);
+   CTR3(KTR_IOAT, "%s channel=%u dispatch hw_head=%u", __func__,
+   ioat->chan_idx, ioat->hw_head & UINT16_MAX);
ioat_write_2(ioat, IOAT_DMACOUNT_OFFSET, (uint16_t)ioat->hw_head);
 
if (!ioat->is_completion_pending) {
@@ -1040,7 +1045,6 @@ ioat_copy(bus_dmaengine_t dmaengine, bus
struct ioat_softc *ioat;
 
ioat = to_ioat_softc(dmaengine);
-   CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx);
 
if (((src | dst) & (0xull << 48)) != 0) {
ioat_log_message(0, "%s: High 16 bits of src/dst invalid\n",
@@ -1058,6 +1062,8 @@ ioat_copy(bus_dmaengine_t dmaengine, bus
dump_descriptor(hw_desc);
 
ioat_submit_single(ioat);
+   CTR6(KTR_IOAT, "%s channel=%u desc=%p dest=%lx src=%lx len=%lx",
+   __func__, ioat->chan_idx, >bus_dmadesc, dst, src, len);
return (>bus_dmadesc);
 }
 
@@ -1414,11 +1420,16 @@ ioat_reserve_space(struct ioat_softc *io
if (ioat_get_ring_space(ioat) >= num_descs)
goto out;
 
+   CTR3(KTR_IOAT, "%s channel=%u starved (%u)", __func__,
+   ioat->chan_idx, num_descs);
+
if (!dug && !ioat->is_submitter_processing &&
(1 << ioat->ring_size_order) > num_descs) {
ioat->is_submitter_processing = TRUE;
mtx_unlock(>submit_lock);
 
+   CTR2(KTR_IOAT, "%s channel=%u attempting to process 
events",
+   __func__, ioat->chan_idx);
ioat_process_events(ioat);
 
mtx_lock(>submit_lock);
@@ -1433,6 +1444,8 @@ ioat_reserve_space(struct ioat_softc *io
order = ioat->ring_size_order;
if (ioat->is_resize_pending || order == IOAT_MAX_ORDER) {
if ((mflags & M_WAITOK) != 0) {
+   CTR2(KTR_IOAT, "%s channel=%u blocking on 
completions",
+   __func__, ioat->chan_idx);
msleep(>tail, >submit_lock, 0,
"ioat_rsz", 0);
continue;
@@ -1794,6 +1807,9 @@ 

svn commit: r308069 - head/sys/dev/ioat

2016-10-28 Thread Conrad E. Meyer
Author: cem
Date: Fri Oct 28 23:53:36 2016
New Revision: 308069
URL: https://svnweb.freebsd.org/changeset/base/308069

Log:
  ioat(4): Add failpoint for delay() in ioat_release
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/dev/ioat/ioat.c

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cFri Oct 28 23:53:35 2016(r308068)
+++ head/sys/dev/ioat/ioat.cFri Oct 28 23:53:36 2016(r308069)
@@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -951,8 +952,12 @@ ioat_release(bus_dmaengine_t dmaengine)
struct ioat_softc *ioat;
 
ioat = to_ioat_softc(dmaengine);
-   CTR3(KTR_IOAT, "%s channel=%u dispatch hw_head=%u", __func__,
-   ioat->chan_idx, ioat->hw_head & UINT16_MAX);
+   CTR4(KTR_IOAT, "%s channel=%u dispatch1 hw_head=%u head=%u", __func__,
+   ioat->chan_idx, ioat->hw_head & UINT16_MAX, ioat->head);
+   KFAIL_POINT_CODE(DEBUG_FP, ioat_release, /* do nothing */);
+   CTR4(KTR_IOAT, "%s channel=%u dispatch2 hw_head=%u head=%u", __func__,
+   ioat->chan_idx, ioat->hw_head & UINT16_MAX, ioat->head);
+
ioat_write_2(ioat, IOAT_DMACOUNT_OFFSET, (uint16_t)ioat->hw_head);
 
if (!ioat->is_completion_pending) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308070 - head/sys/dev/ioat

2016-10-28 Thread Conrad E. Meyer
Author: cem
Date: Fri Oct 28 23:53:37 2016
New Revision: 308070
URL: https://svnweb.freebsd.org/changeset/base/308070

Log:
  ioat(4): Use memory completion rather than device register
  
  The CHANSTS register is a split 64-bit register on CBDMA units before
  hardware v3.3.  If a torn read happens during ioat_process_events(),
  software cannot know when to stop completing descriptors correctly.
  
  So, just use the device-pushed main memory channel status instead.
  
  Remove the ioat_get_active() seatbelt as well.  It does nothing if the
  completion address is valid.
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/dev/ioat/ioat.c
  head/sys/dev/ioat/ioat_internal.h

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cFri Oct 28 23:53:36 2016(r308069)
+++ head/sys/dev/ioat/ioat.cFri Oct 28 23:53:37 2016(r308070)
@@ -677,7 +677,7 @@ ioat_process_events(struct ioat_softc *i
}
 
completed = 0;
-   comp_update = ioat_get_chansts(ioat);
+   comp_update = *ioat->comp_update;
status = comp_update & IOAT_CHANSTS_COMPLETED_DESCRIPTOR_MASK;
 
if (status == ioat->last_seen) {
@@ -691,7 +691,7 @@ ioat_process_events(struct ioat_softc *i
__func__, ioat->chan_idx, comp_update, ioat->last_seen);
 
desc = ioat_get_ring_entry(ioat, ioat->tail - 1);
-   while (desc->hw_desc_bus_addr != status && ioat_get_active(ioat) > 0) {
+   while (desc->hw_desc_bus_addr != status) {
desc = ioat_get_ring_entry(ioat, ioat->tail);
dmadesc = >bus_dmadesc;
CTR5(KTR_IOAT, "channel=%u completing desc idx %u (%p) ok  cb 
%p(%p)",

Modified: head/sys/dev/ioat/ioat_internal.h
==
--- head/sys/dev/ioat/ioat_internal.h   Fri Oct 28 23:53:36 2016
(r308069)
+++ head/sys/dev/ioat/ioat_internal.h   Fri Oct 28 23:53:37 2016
(r308070)
@@ -523,6 +523,15 @@ struct ioat_softc {
 void ioat_test_attach(void);
 void ioat_test_detach(void);
 
+/*
+ * XXX DO NOT USE this routine for obtaining the current completed descriptor.
+ *
+ * The double_4 read on ioat<3.3 appears to result in torn reads.  And v3.2
+ * hardware is still commonplace (Broadwell Xeon has it).  Instead, use the
+ * device-pushed *comp_update.
+ *
+ * It is safe to use ioat_get_chansts() for the low status bits.
+ */
 static inline uint64_t
 ioat_get_chansts(struct ioat_softc *ioat)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308066 - head/sys/dev/cxgbe/common

2016-10-28 Thread Navdeep Parhar
Author: np
Date: Fri Oct 28 23:01:11 2016
New Revision: 308066
URL: https://svnweb.freebsd.org/changeset/base/308066

Log:
  cxgbe(4): Accurate statistics for all chip settings.
  
  There are 4 independent knobs in T5+ chips to include or exclude PAUSE
  frames from the "total frames" and "multicast frames" counters in either
  direction.  This change lets the driver deal with any combination of
  these settings.

Modified:
  head/sys/dev/cxgbe/common/t4_hw.c

Modified: head/sys/dev/cxgbe/common/t4_hw.c
==
--- head/sys/dev/cxgbe/common/t4_hw.c   Fri Oct 28 20:23:38 2016
(r308065)
+++ head/sys/dev/cxgbe/common/t4_hw.c   Fri Oct 28 23:01:11 2016
(r308066)
@@ -5870,10 +5870,13 @@ void t4_get_port_stats(struct adapter *a
p->tx_ppp6  = GET_STAT(TX_PORT_PPP6);
p->tx_ppp7  = GET_STAT(TX_PORT_PPP7);
 
-   if (stat_ctl & F_COUNTPAUSESTATTX) {
-   p->tx_frames -= p->tx_pause;
-   p->tx_octets -= p->tx_pause * 64;
-   p->tx_mcast_frames -= p->tx_pause;
+   if (chip_id(adap) >= CHELSIO_T5) {
+   if (stat_ctl & F_COUNTPAUSESTATTX) {
+   p->tx_frames -= p->tx_pause;
+   p->tx_octets -= p->tx_pause * 64;
+   }
+   if (stat_ctl & F_COUNTPAUSEMCTX)
+   p->tx_mcast_frames -= p->tx_pause;
}
 
p->rx_pause = GET_STAT(RX_PORT_PAUSE);
@@ -5904,10 +5907,13 @@ void t4_get_port_stats(struct adapter *a
p->rx_ppp6  = GET_STAT(RX_PORT_PPP6);
p->rx_ppp7  = GET_STAT(RX_PORT_PPP7);
 
-   if (stat_ctl & F_COUNTPAUSESTATRX) {
-   p->rx_frames -= p->rx_pause;
-   p->rx_octets -= p->rx_pause * 64;
-   p->rx_mcast_frames -= p->rx_pause;
+   if (chip_id(adap) >= CHELSIO_T5) {
+   if (stat_ctl & F_COUNTPAUSESTATRX) {
+   p->rx_frames -= p->rx_pause;
+   p->rx_octets -= p->rx_pause * 64;
+   }
+   if (stat_ctl & F_COUNTPAUSEMCRX)
+   p->rx_mcast_frames -= p->rx_pause;
}
 
p->rx_ovflow0 = (bgmap & 1) ? GET_STAT_COM(RX_BG_0_MAC_DROP_FRAME) : 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r307971 - head/sys/mips/include

2016-10-28 Thread John Baldwin
On Friday, October 28, 2016 08:54:50 PM Konstantin Belousov wrote:
> On Fri, Oct 28, 2016 at 09:59:26AM -0700, John Baldwin wrote:
> > Well, we could perhaps patch those to use SA_SIGINFO instead, but if it's
> > a non-trivial amount of effort I'm not going to bother.  I'm surprised that
> > some of those would use sigcontext.  Both mono and go post-date SA_SIGINFO
> > being standardized and supported on FreeBSD AFAIK.  Supporting sigcontext
> > just means extra BSD-specific code in those applications compared to using
> > SA_SIGINFO. :-/
> 
> For libunwind, I can see a rationale for struct sigcontext use.  It seems
> that on Linux, rt_sigreturn(2) syscall takes struct sigcontext *, and not
> struct ucontext *, as the argument.  This is not unreasonable, because
> the additional ucontext fields make no sense for sigreturn, for us they
> are copied into kernel AS but are also unused.
> 
> So my FreeBSD port followed the existing Linux code.  And I started wondering
> should we change our sigreturn(2) to take sigcontext * instead of ucontext *.

Hmm, that's an interesting thought (and it seems 'struct sigcontext' isn't
BSD-only).  We would definitely want to ensure that the initial bit of 
ucontext_t
matches a sigcontext if we were to go that route.

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


svn commit: r308065 - head/sys/dev/aacraid

2016-10-28 Thread Warner Losh
Author: imp
Date: Fri Oct 28 20:23:38 2016
New Revision: 308065
URL: https://svnweb.freebsd.org/changeset/base/308065

Log:
  Remove a PCI ID for a raid controller from Adaptec that was planned,
  but never released. Since no real hardware was released with this ID,
  just drop it from the aacraid driver. This paves the path for future
  drivers for hardware that actually has this ID.
  
  Submitted by: Scott Benesh from Microsemi.
  Differential Revision: https://reviews.freebsd.org/D8377
  MFC After: 3 days

Modified:
  head/sys/dev/aacraid/aacraid_pci.c

Modified: head/sys/dev/aacraid/aacraid_pci.c
==
--- head/sys/dev/aacraid/aacraid_pci.c  Fri Oct 28 20:15:19 2016
(r308064)
+++ head/sys/dev/aacraid/aacraid_pci.c  Fri Oct 28 20:23:38 2016
(r308065)
@@ -102,8 +102,6 @@ struct aac_ident
 "Adaptec RAID Controller"},
{0x9005, 0x028d, 0, 0, AAC_HWIF_SRCV, 0,
 "Adaptec RAID Controller"},
-   {0x9005, 0x028f, 0, 0, AAC_HWIF_SRCV, 0,
-"Adaptec RAID Controller"},
{0, 0, 0, 0, 0, 0, 0}
 };
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-10-28 Thread Kirk McKusick
Author: mckusick
Date: Fri Oct 28 20:15:19 2016
New Revision: 308064
URL: https://svnweb.freebsd.org/changeset/base/308064

Log:
  Avoid possible overflow when calclating malloc size for auxillary
  data structure sizes when mounting and reloading UFS/FFS
  filesystems by using a u_long rather than an int for the size.
  
  Reported by: Mariusz Zaborski 
  MFC after:   1 week

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

Modified: head/sys/ufs/ffs/ffs_vfsops.c
==
--- head/sys/ufs/ffs/ffs_vfsops.c   Fri Oct 28 19:46:08 2016
(r308063)
+++ head/sys/ufs/ffs/ffs_vfsops.c   Fri Oct 28 20:15:19 2016
(r308064)
@@ -588,7 +588,8 @@ ffs_reload(struct mount *mp, struct thre
struct fs *fs, *newfs;
struct ufsmount *ump;
ufs2_daddr_t sblockloc;
-   int i, blks, size, error;
+   int i, blks, error;
+   u_long size;
int32_t *lp;
 
ump = VFSTOUFS(mp);
@@ -658,7 +659,7 @@ ffs_reload(struct mount *mp, struct thre
size += fs->fs_ncg * sizeof(int32_t);
size += fs->fs_ncg * sizeof(u_int8_t);
free(fs->fs_csp, M_UFSMNT);
-   space = malloc((u_long)size, M_UFSMNT, M_WAITOK);
+   space = malloc(size, M_UFSMNT, M_WAITOK);
fs->fs_csp = space;
for (i = 0; i < blks; i += fs->fs_frag) {
size = fs->fs_bsize;
@@ -751,7 +752,8 @@ ffs_mountfs(devvp, mp, td)
struct cdev *dev;
void *space;
ufs2_daddr_t sblockloc;
-   int error, i, blks, size, ronly;
+   int error, i, blks, len, ronly;
+   u_long size;
int32_t *lp;
struct ucred *cred;
struct g_consumer *cp;
@@ -856,11 +858,11 @@ ffs_mountfs(devvp, mp, td)
/*
 * Get journal provider name.
 */
-   size = 1024;
-   mp->mnt_gjprovider = malloc(size, M_UFSMNT, M_WAITOK);
-   if (g_io_getattr("GJOURNAL::provider", cp, ,
+   len = 1024;
+   mp->mnt_gjprovider = malloc((u_long)len, M_UFSMNT, M_WAITOK);
+   if (g_io_getattr("GJOURNAL::provider", cp, ,
mp->mnt_gjprovider) == 0) {
-   mp->mnt_gjprovider = realloc(mp->mnt_gjprovider, size,
+   mp->mnt_gjprovider = realloc(mp->mnt_gjprovider, len,
M_UFSMNT, M_WAITOK);
MNT_ILOCK(mp);
mp->mnt_flag |= MNT_GJOURNAL;
@@ -912,7 +914,7 @@ ffs_mountfs(devvp, mp, td)
if (fs->fs_contigsumsize > 0)
size += fs->fs_ncg * sizeof(int32_t);
size += fs->fs_ncg * sizeof(u_int8_t);
-   space = malloc((u_long)size, M_UFSMNT, M_WAITOK);
+   space = malloc(size, M_UFSMNT, M_WAITOK);
fs->fs_csp = space;
for (i = 0; i < blks; i += fs->fs_frag) {
size = fs->fs_bsize;
@@ -997,8 +999,8 @@ ffs_mountfs(devvp, mp, td)
 #endif
}
if ((fs->fs_flags & FS_TRIM) != 0) {
-   size = sizeof(int);
-   if (g_io_getattr("GEOM::candelete", cp, ,
+   len = sizeof(int);
+   if (g_io_getattr("GEOM::candelete", cp, ,
>um_candelete) == 0) {
if (!ump->um_candelete)
printf("WARNING: %s: TRIM flag on fs but disk "
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308063 - in stable/10: sys/dev/pci usr.sbin/pciconf

2016-10-28 Thread Alexander Motin
Author: mav
Date: Fri Oct 28 19:46:08 2016
New Revision: 308063
URL: https://svnweb.freebsd.org/changeset/base/308063

Log:
  MFC r307731: Add names for some DASP devices.

Modified:
  stable/10/sys/dev/pci/pci.c
  stable/10/usr.sbin/pciconf/pciconf.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/pci/pci.c
==
--- stable/10/sys/dev/pci/pci.c Fri Oct 28 19:45:39 2016(r308062)
+++ stable/10/sys/dev/pci/pci.c Fri Oct 28 19:46:08 2016(r308063)
@@ -4185,6 +4185,9 @@ static const struct
{PCIC_CRYPTO,   PCIS_CRYPTO_ENTERTAIN,  1, "entertainment 
crypto"},
{PCIC_DASP, -1, 0, "dasp"},
{PCIC_DASP, PCIS_DASP_DPIO, 1, "DPIO module"},
+   {PCIC_DASP, PCIS_DASP_PERFCNTRS,1, "performance 
counters"},
+   {PCIC_DASP, PCIS_DASP_COMM_SYNC,1, "communication 
synchronizer"},
+   {PCIC_DASP, PCIS_DASP_MGMT_CARD,1, "signal processing 
management"},
{0, 0, 0,   NULL}
 };
 

Modified: stable/10/usr.sbin/pciconf/pciconf.c
==
--- stable/10/usr.sbin/pciconf/pciconf.cFri Oct 28 19:45:39 2016
(r308062)
+++ stable/10/usr.sbin/pciconf/pciconf.cFri Oct 28 19:46:08 2016
(r308063)
@@ -690,6 +690,9 @@ static struct
{PCIC_CRYPTO,   PCIS_CRYPTO_NETCOMP,"entertainment crypto"},
{PCIC_DASP, -1, "dasp"},
{PCIC_DASP, PCIS_DASP_DPIO, "DPIO module"},
+   {PCIC_DASP, PCIS_DASP_PERFCNTRS,"performance counters"},
+   {PCIC_DASP, PCIS_DASP_COMM_SYNC,"communication 
synchronizer"},
+   {PCIC_DASP, PCIS_DASP_MGMT_CARD,"signal processing 
management"},
{0, 0,  NULL}
 };
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308062 - in stable/11: sys/dev/pci usr.sbin/pciconf

2016-10-28 Thread Alexander Motin
Author: mav
Date: Fri Oct 28 19:45:39 2016
New Revision: 308062
URL: https://svnweb.freebsd.org/changeset/base/308062

Log:
  MFC r307731: Add names for some DASP devices.

Modified:
  stable/11/sys/dev/pci/pci.c
  stable/11/usr.sbin/pciconf/pciconf.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/pci/pci.c
==
--- stable/11/sys/dev/pci/pci.c Fri Oct 28 18:25:32 2016(r308061)
+++ stable/11/sys/dev/pci/pci.c Fri Oct 28 19:45:39 2016(r308062)
@@ -4607,6 +4607,9 @@ static const struct
{PCIC_CRYPTO,   PCIS_CRYPTO_ENTERTAIN,  1, "entertainment 
crypto"},
{PCIC_DASP, -1, 0, "dasp"},
{PCIC_DASP, PCIS_DASP_DPIO, 1, "DPIO module"},
+   {PCIC_DASP, PCIS_DASP_PERFCNTRS,1, "performance 
counters"},
+   {PCIC_DASP, PCIS_DASP_COMM_SYNC,1, "communication 
synchronizer"},
+   {PCIC_DASP, PCIS_DASP_MGMT_CARD,1, "signal processing 
management"},
{0, 0, 0,   NULL}
 };
 

Modified: stable/11/usr.sbin/pciconf/pciconf.c
==
--- stable/11/usr.sbin/pciconf/pciconf.cFri Oct 28 18:25:32 2016
(r308061)
+++ stable/11/usr.sbin/pciconf/pciconf.cFri Oct 28 19:45:39 2016
(r308062)
@@ -697,6 +697,9 @@ static struct
{PCIC_CRYPTO,   PCIS_CRYPTO_NETCOMP,"entertainment crypto"},
{PCIC_DASP, -1, "dasp"},
{PCIC_DASP, PCIS_DASP_DPIO, "DPIO module"},
+   {PCIC_DASP, PCIS_DASP_PERFCNTRS,"performance counters"},
+   {PCIC_DASP, PCIS_DASP_COMM_SYNC,"communication 
synchronizer"},
+   {PCIC_DASP, PCIS_DASP_MGMT_CARD,"signal processing 
management"},
{0, 0,  NULL}
 };
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308061 - in stable/10/sys: cddl/contrib/opensolaris/uts/common/fs/zfs geom

2016-10-28 Thread Alexander Motin
Author: mav
Date: Fri Oct 28 18:25:32 2016
New Revision: 308061
URL: https://svnweb.freebsd.org/changeset/base/308061

Log:
  MFC r300881, r302058 (by asomers):
  Avoid issuing spa config updates for physical path when not necessary
  
  ZFS's configuration needs to be updated whenever the physical path for a
  device changes, but not when a new device is introduced. This is because new
  devices necessarily cause config updates, but only if they are actually
  accepted into the pool.
  
  sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
  Split vdev_geom_set_physpath out of vdev_geom_attrchanged.  When
  setting the vdev's physical path, only request a config update if
  the physical path has changed.  Don't request it when opening a
  device for the first time, because the config sync will happen
  anyway upstack.
  
  sys/geom/geom_dev.c
  Split g_dev_set_physpath and g_dev_set_media out of
  g_dev_attrchanged

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
  stable/10/sys/geom/geom_dev.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Fri Oct 28 18:24:05 2016(r308060)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Fri Oct 28 18:25:32 2016(r308061)
@@ -87,32 +87,17 @@ vdev_geom_set_rotation_rate(vdev_t *vd, 
 }
 
 static void
-vdev_geom_attrchanged(struct g_consumer *cp, const char *attr)
+vdev_geom_set_physpath(struct g_consumer *cp, boolean_t do_null_update)
 {
+   boolean_t needs_update = B_FALSE;
vdev_t *vd;
-   spa_t *spa;
char *physpath;
int error, physpath_len;
 
-   vd = cp->private;
-   if (vd == NULL)
-   return;
-
-   if (strcmp(attr, "GEOM::rotation_rate") == 0) {
-   vdev_geom_set_rotation_rate(vd, cp);
-   return;
-   }
-
-   if (strcmp(attr, "GEOM::physpath") != 0)
-   return;
-
if (g_access(cp, 1, 0, 0) != 0)
return;
 
-   /*
-* Record/Update physical path information for this device.
-*/
-   spa = vd->vdev_spa;
+   vd = cp->private;
physpath_len = MAXPATHLEN;
physpath = g_malloc(physpath_len, M_WAITOK|M_ZERO);
error = g_io_getattr("GEOM::physpath", cp, _len, physpath);
@@ -124,12 +109,46 @@ vdev_geom_attrchanged(struct g_consumer 
g_topology_assert();
old_physpath = vd->vdev_physpath;
vd->vdev_physpath = spa_strdup(physpath);
-   spa_async_request(spa, SPA_ASYNC_CONFIG_UPDATE);
 
-   if (old_physpath != NULL)
+   if (old_physpath != NULL) {
+   needs_update = (strcmp(old_physpath,
+   vd->vdev_physpath) != 0);
spa_strfree(old_physpath);
+   } else
+   needs_update = do_null_update;
}
g_free(physpath);
+
+   /*
+* If the physical path changed, update the config.
+* Only request an update for previously unset physpaths if
+* requested by the caller.
+*/
+   if (needs_update)
+   spa_async_request(vd->vdev_spa, SPA_ASYNC_CONFIG_UPDATE);
+
+}
+
+static void
+vdev_geom_attrchanged(struct g_consumer *cp, const char *attr)
+{
+   vdev_t *vd;
+   char *old_physpath;
+   int error;
+
+   vd = cp->private;
+   if (vd == NULL)
+   return;
+
+   if (strcmp(attr, "GEOM::rotation_rate") == 0) {
+   vdev_geom_set_rotation_rate(vd, cp);
+   return;
+   }
+
+   if (strcmp(attr, "GEOM::physpath") == 0) {
+   vdev_geom_set_physpath(cp, /*do_null_update*/B_TRUE);
+   return;
+   }
 }
 
 static void
@@ -259,8 +278,10 @@ vdev_geom_attach(struct g_provider *pp, 
 * 2) Set it to a linked list of vdevs, not just a single vdev
 */
cp->private = vd;
-   if (vd != NULL)
+   if (vd != NULL) {
vd->vdev_tsd = cp;
+   vdev_geom_set_physpath(cp, /*do_null_update*/B_FALSE);
+   }
 
cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
return (cp);

Modified: stable/10/sys/geom/geom_dev.c
==
--- stable/10/sys/geom/geom_dev.c   Fri Oct 28 18:24:05 2016
(r308060)
+++ stable/10/sys/geom/geom_dev.c   Fri Oct 28 18:25:32 2016
(r308061)
@@ -222,55 +222,68 @@ g_dev_print(void)
 }
 
 static void
-g_dev_attrchanged(struct g_consumer *cp, const char *attr)
+g_dev_set_physpath(struct g_consumer *cp)
+{
+   struct g_dev_softc *sc;

svn commit: r308060 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-10-28 Thread Alexander Motin
Author: mav
Date: Fri Oct 28 18:24:05 2016
New Revision: 308060
URL: https://svnweb.freebsd.org/changeset/base/308060

Log:
  MFC r300059 (by asomers): Speed up vdev_geom_open_by_guids
  
  Speedup is hard to measure because the only time vdev_geom_open_by_guids
  gets called on many drives at the same time is during boot. But with
  vdev_geom_open hacked to always call vdev_geom_open_by_guids, operations
  like "zpool create" speed up by 65%.
  
  sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
  
  * Read all of a vdev's labels in parallel instead of sequentially.
  * In vdev_geom_read_config, don't read the entire label, including
the uberblock.  That's a waste of RAM.  Just read the vdev config
nvlist.  Reduces the IO and RAM involved with tasting from 1MB to
448KB.

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Fri Oct 28 18:22:00 2016(r308059)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Fri Oct 28 18:24:05 2016(r308060)
@@ -327,52 +327,82 @@ nvlist_get_guids(nvlist_t *list, uint64_
(void) nvlist_lookup_uint64(list, ZPOOL_CONFIG_POOL_GUID, pguid);
 }
 
-static int
-vdev_geom_io(struct g_consumer *cp, int cmd, void *data, off_t offset, off_t 
size)
+/*
+ * Issue one or more bios to the vdev in parallel
+ * cmds, datas, offsets, errors, and sizes are arrays of length ncmds.  Each IO
+ * operation is described by parallel entries from each array.  There may be
+ * more bios actually issued than entries in the array
+ */
+static void
+vdev_geom_io(struct g_consumer *cp, int *cmds, void **datas, off_t *offsets,
+off_t *sizes, int *errors, int ncmds)
 {
-   struct bio *bp;
+   struct bio **bios;
u_char *p;
-   off_t off, maxio;
-   int error;
+   off_t off, maxio, s, end;
+   int i, n_bios, j;
+   size_t bios_size;
 
-   ASSERT((offset % cp->provider->sectorsize) == 0);
-   ASSERT((size % cp->provider->sectorsize) == 0);
-
-   bp = g_alloc_bio();
-   off = offset;
-   offset += size;
-   p = data;
maxio = MAXPHYS - (MAXPHYS % cp->provider->sectorsize);
-   error = 0;
+   n_bios = 0;
 
-   for (; off < offset; off += maxio, p += maxio, size -= maxio) {
-   bzero(bp, sizeof(*bp));
-   bp->bio_cmd = cmd;
-   bp->bio_done = NULL;
-   bp->bio_offset = off;
-   bp->bio_length = MIN(size, maxio);
-   bp->bio_data = p;
-   g_io_request(bp, cp);
-   error = biowait(bp, "vdev_geom_io");
-   if (error != 0)
-   break;
+   /* How many bios are required for all commands ? */
+   for (i = 0; i < ncmds; i++)
+   n_bios += (sizes[i] + maxio - 1) / maxio;
+
+   /* Allocate memory for the bios */
+   bios_size = n_bios * sizeof(struct bio*);
+   bios = kmem_zalloc(bios_size, KM_SLEEP);
+
+   /* Prepare and issue all of the bios */
+   for (i = j = 0; i < ncmds; i++) {
+   off = offsets[i];
+   p = datas[i];
+   s = sizes[i];
+   end = off + s;
+   ASSERT((off % cp->provider->sectorsize) == 0);
+   ASSERT((s % cp->provider->sectorsize) == 0);
+
+   for (; off < end; off += maxio, p += maxio, s -= maxio, j++) {
+   bios[j] = g_alloc_bio();
+   bios[j]->bio_cmd = cmds[i];
+   bios[j]->bio_done = NULL;
+   bios[j]->bio_offset = off;
+   bios[j]->bio_length = MIN(s, maxio);
+   bios[j]->bio_data = p;
+   g_io_request(bios[j], cp);
+   }
+   }
+   ASSERT(j == n_bios);
+
+   /* Wait for all of the bios to complete, and clean them up */
+   for (i = j = 0; i < ncmds; i++) {
+   off = offsets[i];
+   s = sizes[i];
+   end = off + s;
+
+   for (; off < end; off += maxio, s -= maxio, j++) {
+   errors[i] = biowait(bios[j], "vdev_geom_io") || 
errors[i];
+   g_destroy_bio(bios[j]);
+   }
}
-
-   g_destroy_bio(bp);
-   return (error);
+   kmem_free(bios, bios_size);
 }
 
 static int
 vdev_geom_read_config(struct g_consumer *cp, nvlist_t **config)
 {
struct g_provider *pp;
-   vdev_label_t *label;
+   vdev_phys_t *vdev_lists[VDEV_LABELS];
char *p, *buf;
size_t buflen;
-   uint64_t psize;
-   off_t offset, size;
-   uint64_t state, txg;
-   

svn commit: r308059 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-10-28 Thread Alexander Motin
Author: mav
Date: Fri Oct 28 18:22:00 2016
New Revision: 308059
URL: https://svnweb.freebsd.org/changeset/base/308059

Log:
  MFC r298814 (by asomers): Fix a use-after-free when "zpool import" fails
  
  clear vd->vdev_tsd in vdev_geom_close_locked instead of vdev_geom_detach.
  In the latter function, it would fail to happen in certain circumstances
  where cp->private was unset.  Ideally, the latter should never happen, but
  it can happen when vdev open fails, or where spares are involved.

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Fri Oct 28 18:20:14 2016(r308058)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Fri Oct 28 18:22:00 2016(r308059)
@@ -278,10 +278,6 @@ vdev_geom_detach(struct g_consumer *cp, 
cp->provider && cp->provider->name ? cp->provider->name : "NULL");
 
vd = cp->private;
-   if (vd != NULL) {
-   vd->vdev_tsd = NULL;
-   vd->vdev_delayed_close = B_FALSE;
-   }
cp->private = NULL;
 
gp = cp->geom;
@@ -313,6 +309,8 @@ vdev_geom_close_locked(vdev_t *vd)
g_topology_assert();
 
cp = vd->vdev_tsd;
+   vd->vdev_tsd = NULL;
+   vd->vdev_delayed_close = B_FALSE;
if (cp == NULL)
return;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308058 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-10-28 Thread Alexander Motin
Author: mav
Date: Fri Oct 28 18:20:14 2016
New Revision: 308058
URL: https://svnweb.freebsd.org/changeset/base/308058

Log:
  MFC r298786 (by asomers):
  Refactor vdev_geom_attach and friends to reduce code duplication
  
  sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
  Move checks for provider's sectorsize and mediasize into a single
  location in vdev_geom_attach. Remove the zfs::vdev::taste class;
  it's ok to use the regular vdev class for tasting. Consolidate guid
  checks into a single location in vdev_attach_ok. Consolidate some
  error handling code from vdev_geom_attach into vdev_geom_detach,
  closing a resource leak of geom consumers in the process.

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Fri Oct 28 18:18:53 2016(r308057)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Fri Oct 28 18:20:14 2016(r308058)
@@ -63,6 +63,9 @@ TUNABLE_INT("vfs.zfs.vdev.bio_delete_dis
 SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, bio_delete_disable, CTLFLAG_RW,
 _geom_bio_delete_disable, 0, "Disable BIO_DELETE");
 
+/* Declare local functions */
+static void vdev_geom_detach(struct g_consumer *cp, boolean_t open_for_read);
+
 /*
  * Thread local storage used to indicate when a thread is probing geoms
  * for their guids.  If NULL, this thread is not tasting geoms.  If non NULL,
@@ -170,6 +173,17 @@ vdev_geom_attach(struct g_provider *pp, 
g_topology_assert();
 
ZFS_LOG(1, "Attaching to %s.", pp->name);
+
+   if (pp->sectorsize > VDEV_PAD_SIZE || !ISP2(pp->sectorsize)) {
+   ZFS_LOG(1, "Failing attach of %s. Incompatible sectorsize %d\n",
+   pp->name, pp->sectorsize);
+   return (NULL);
+   } else if (pp->mediasize < SPA_MINDEVSIZE) {
+   ZFS_LOG(1, "Failing attach of %s. Incompatible mediasize %ju\n",
+   pp->name, pp->mediasize);
+   return (NULL);
+   }
+
/* Do we have geom already? No? Create one. */
LIST_FOREACH(gp, _vdev_class.geom, geom) {
if (gp->flags & G_GEOM_WITHER)
@@ -187,14 +201,14 @@ vdev_geom_attach(struct g_provider *pp, 
if (error != 0) {
ZFS_LOG(1, "%s(%d): g_attach failed: %d\n", __func__,
__LINE__, error);
-   g_wither_geom(gp, ENXIO);
+   vdev_geom_detach(cp, B_FALSE);
return (NULL);
}
error = g_access(cp, 1, 0, 1);
if (error != 0) {
ZFS_LOG(1, "%s(%d): g_access failed: %d\n", __func__,
   __LINE__, error);
-   g_wither_geom(gp, ENXIO);
+   vdev_geom_detach(cp, B_FALSE);
return (NULL);
}
ZFS_LOG(1, "Created geom and consumer for %s.", pp->name);
@@ -212,15 +226,14 @@ vdev_geom_attach(struct g_provider *pp, 
if (error != 0) {
ZFS_LOG(1, "%s(%d): g_attach failed: %d\n",
__func__, __LINE__, error);
-   g_destroy_consumer(cp);
+   vdev_geom_detach(cp, B_FALSE);
return (NULL);
}
error = g_access(cp, 1, 0, 1);
if (error != 0) {
ZFS_LOG(1, "%s(%d): g_access failed: %d\n",
__func__, __LINE__, error);
-   g_detach(cp);
-   g_destroy_consumer(cp);
+   vdev_geom_detach(cp, B_FALSE);
return (NULL);
}
ZFS_LOG(1, "Created consumer for %s.", pp->name);
@@ -246,39 +259,41 @@ vdev_geom_attach(struct g_provider *pp, 
 * 2) Set it to a linked list of vdevs, not just a single vdev
 */
cp->private = vd;
-   vd->vdev_tsd = cp;
+   if (vd != NULL)
+   vd->vdev_tsd = cp;
 
cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
return (cp);
 }
 
 static void
-vdev_geom_close_locked(vdev_t *vd)
+vdev_geom_detach(struct g_consumer *cp, boolean_t open_for_read)
 {
struct g_geom *gp;
-   struct g_consumer *cp;
+   vdev_t *vd;
 
g_topology_assert();
 
-   cp = vd->vdev_tsd;
-   if (cp == NULL)
-   return;
+   ZFS_LOG(1, "Detaching consumer. Provider %s.",
+ 

svn commit: r308057 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2016-10-28 Thread Alexander Motin
Author: mav
Date: Fri Oct 28 18:18:53 2016
New Revision: 308057
URL: https://svnweb.freebsd.org/changeset/base/308057

Log:
  MFC r294329 (by asomers): Disallow zvol-backed ZFS pools
  
  Using zvols as backing devices for ZFS pools is fraught with panics and
  deadlocks. For example, attempting to online a missing device in the
  presence of a zvol can cause a panic when vdev_geom tastes the zvol.  Better
  to completely disable vdev_geom from ever opening a zvol. The solution
  relies on setting a thread-local variable during vdev_geom_open, and
  returning EOPNOTSUPP during zvol_open if that thread-local variable is set.
  
  Remove the check for MUTEX_HELD(_state_lock) in zvol_open. Its intent
  was to prevent a recursive mutex acquisition panic. However, the new check
  for the thread-local variable also fixes that problem.
  
  Also, fix a panic in vdev_geom_taste_orphan. For an unknown reason, this
  function was set to panic. But it can occur that a device disappears during
  tasting, and it causes no problems to ignore this departure.

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
Directory Properties:
  stable/10/   (props changed)

Modified: 
stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h
Fri Oct 28 18:09:08 2016(r308056)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h
Fri Oct 28 18:18:53 2016(r308057)
@@ -381,6 +381,7 @@ extern void vdev_set_min_asize(vdev_t *v
  */
 /* zdb uses this tunable, so it must be declared here to make lint happy. */
 extern int zfs_vdev_cache_size;
+extern uint_t zfs_geom_probe_vdev_key;
 
 #ifdef illumos
 /*

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Fri Oct 28 18:09:08 2016(r308056)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Fri Oct 28 18:18:53 2016(r308057)
@@ -63,6 +63,13 @@ TUNABLE_INT("vfs.zfs.vdev.bio_delete_dis
 SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, bio_delete_disable, CTLFLAG_RW,
 _geom_bio_delete_disable, 0, "Disable BIO_DELETE");
 
+/*
+ * Thread local storage used to indicate when a thread is probing geoms
+ * for their guids.  If NULL, this thread is not tasting geoms.  If non NULL,
+ * it is looking for a replacement for the vdev_t* that is its value.
+ */
+uint_t zfs_geom_probe_vdev_key;
+
 static void
 vdev_geom_set_rotation_rate(vdev_t *vd, struct g_consumer *cp)
 { 
@@ -329,9 +336,8 @@ vdev_geom_io(struct g_consumer *cp, int 
 static void
 vdev_geom_taste_orphan(struct g_consumer *cp)
 {
-
-   KASSERT(1 == 0, ("%s called while tasting %s.", __func__,
-   cp->provider->name));
+   ZFS_LOG(0, "WARNING: Orphan %s while tasting its VDev GUID.",
+   cp->provider->name);
 }
 
 static int
@@ -578,7 +584,6 @@ vdev_geom_attach_by_guids(vdev_t *vd)
g_topology_assert();
 
zgp = g_new_geomf(_vdev_class, "zfs::vdev::taste");
-   /* This orphan function should be never called. */
zgp->orphan = vdev_geom_taste_orphan;
zcp = g_new_consumer(zgp);
 
@@ -714,6 +719,9 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi
size_t bufsize;
int error;
 
+   /* Set the TLS to indicate downstack that we should not access zvols*/
+   VERIFY(tsd_set(zfs_geom_probe_vdev_key, vd) == 0);
+
/*
 * We must have a pathname, and it must be absolute.
 */
@@ -764,6 +772,9 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi
}
}
 
+   /* Clear the TLS now that tasting is done */
+   VERIFY(tsd_set(zfs_geom_probe_vdev_key, NULL) == 0);
+
if (cp == NULL) {
ZFS_LOG(1, "Provider %s not found.", vd->vdev_path);
error = ENOENT;

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Fri Oct 28 18:09:08 2016(r308056)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Fri Oct 28 18:18:53 2016(r308057)
@@ -207,6 +207,7 @@ extern void zfs_fini(void);
 uint_t zfs_fsyncer_key;
 extern uint_t rrw_tsd_key;
 static uint_t zfs_allow_log_key;
+extern uint_t zfs_geom_probe_vdev_key;
 
 typedef int zfs_ioc_legacy_func_t(zfs_cmd_t *);
 typedef int zfs_ioc_func_t(const char *, nvlist_t *, nvlist_t *);
@@ 

svn commit: r308056 - head/lib/libc/gen

2016-10-28 Thread John Baldwin
Author: jhb
Date: Fri Oct 28 18:09:08 2016
New Revision: 308056
URL: https://svnweb.freebsd.org/changeset/base/308056

Log:
  Fix formatting of tables.
  
  Specifically, use .Ta instead of tabs to separate column entries.  While
  here fix a few other things:
  - Use .Sy for all column headers (previously only the first column header
was bold)
  - Use .Dv to markup constants used for MIB names.
  - Use "1234" and "4321" for the byte order descriptions without
thousands separators.
  - Mark up header files in the first table with .In.
  
  MFC after:2 weeks

Modified:
  head/lib/libc/gen/sysctl.3

Modified: head/lib/libc/gen/sysctl.3
==
--- head/lib/libc/gen/sysctl.3  Fri Oct 28 17:05:14 2016(r308055)
+++ head/lib/libc/gen/sysctl.3  Fri Oct 28 18:09:08 2016(r308056)
@@ -183,16 +183,16 @@ The top level names are defined with a C
 and are as follows.
 The next and subsequent levels down are found in the include files
 listed here, and described in separate sections below.
-.Bl -column CTLXMACHDEPXXX "Next level namesXX" -offset indent
-.It Sy "Name   Next level namesDescription"
-.It "CTL_DEBUG sys/sysctl.hDebugging"
-.It "CTL_VFS   sys/mount.h File system"
-.It "CTL_HWsys/sysctl.hGeneric CPU, I/O"
-.It "CTL_KERN  sys/sysctl.hHigh kernel limits"
-.It "CTL_MACHDEP   sys/sysctl.hMachine dependent"
-.It "CTL_NET   sys/socket.hNetworking"
-.It "CTL_USER  sys/sysctl.hUser-level"
-.It "CTL_VMvm/vm_param.h   Virtual memory"
+.Bl -column CTLXMACHDEPXXX "Next Level NamesXX" -offset indent
+.It Sy Name Ta Sy Next Level Names Ta Sy Description
+.It Dv CTL_DEBUG Ta In sys/sysctl.h Ta Debugging
+.It Dv CTL_VFS Ta In sys/mount.h Ta File system
+.It Dv CTL_HW Ta In sys/sysctl.h Ta Generic CPU, I/O
+.It Dv CTL_KERN Ta In sys/sysctl.h Ta High kernel limits
+.It Dv CTL_MACHDEP Ta In sys/sysctl.h Ta Machine dependent
+.It Dv CTL_NET Ta In sys/socket.h Ta Networking
+.It Dv CTL_USER Ta In sys/sysctl.h Ta User-level
+.It Dv CTL_VM Ta In vm/vm_param.h Ta Virtual memory
 .El
 .Pp
 For example, the following retrieves the maximum number of processes allowed
@@ -270,20 +270,20 @@ The string and integer information avail
 is detailed below.
 The changeable column shows whether a process with appropriate
 privilege may change the value.
-.Bl -column "Second level nameXX" integerXXX -offset indent
-.It Sy "Second level name  TypeChangeable"
-.It "HW_MACHINEstring  no"
-.It "HW_MODEL  string  no"
-.It "HW_NCPU   integer no"
-.It "HW_BYTEORDER  integer no"
-.It "HW_PHYSMEMinteger no"
-.It "HW_USERMEMinteger no"
-.It "HW_PAGESIZE   integer no"
-.\".It "HW_DISKNAMES   integer no"
-.\".It "HW_DISKSTATS   integer no"
-.It "HW_FLOATINGPT integer no"
-.It "HW_MACHINE_ARCH   string  no"
-.It "HW_REALMEMinteger no"
+.Bl -column "Second Level Name" integerXXX Changeable -offset indent
+.It Sy Second Level Name Ta Sy Type Ta Sy Changeable
+.It Dv HW_MACHINE Ta string Ta no
+.It Dv HW_MODEL Ta string Ta no
+.It Dv HW_NCPU Ta integer Ta no
+.It Dv HW_BYTEORDER Ta integer Ta no
+.It Dv HW_PHYSMEM Ta integer Ta no
+.It Dv HW_USERMEM Ta integer Ta no
+.It Dv HW_PAGESIZE Ta integer Ta no
+.\".It Dv HW_DISKNAMES Ta integer Ta no
+.\".It Dv HW_DISKSTATS Ta integer Ta no
+.It Dv HW_FLOATINGPT Ta integer Ta no
+.It Dv HW_MACHINE_ARCH Ta string Ta no
+.It Dv HW_REALMEM Ta integer Ta no
 .El
 .Bl -tag -width 6n
 .It Li HW_MACHINE
@@ -293,7 +293,7 @@ The machine model
 .It Li HW_NCPU
 The number of cpus.
 .It Li HW_BYTEORDER
-The byteorder (4,321, or 1,234).
+The byteorder (4321 or 1234).
 .It Li HW_PHYSMEM
 The bytes of physical memory.
 .It Li HW_USERMEM
@@ -319,36 +319,36 @@ system vnodes, the open file entries, ro
 virtual memory statistics, load average history, and clock rate
 information.
 .Bl -column "KERNXMAXFILESPERPROCXXX" "struct clockrateXXX" -offset indent
-.It Sy "Second level name  TypeChangeable"
-.It "KERN_ARGMAX   integer no"
-.It "KERN_BOOTFILE string  yes"
-.It "KERN_BOOTTIME struct timeval  no"
-.It "KERN_CLOCKRATEstruct clockinfono"
-.It "KERN_FILE struct xfileno"
-.It "KERN_HOSTID   integer yes"
-.It "KERN_HOSTUUID string  yes"
-.It "KERN_HOSTNAME string  yes"
-.It "KERN_JOB_CONTROL  integer no"
-.It "KERN_MAXFILES integer yes"
-.It "KERN_MAXFILESPERPROC  integer yes"
-.It "KERN_MAXPROC  integer no"
-.It "KERN_MAXPROCPERUIDinteger yes"
-.It "KERN_MAXVNODESinteger yes"
-.It "KERN_NGROUPS  integer no"
-.It "KERN_NISDOMAINNAMEstring  yes"
-.It "KERN_OSRELDATEinteger no"
-.It "KERN_OSRELEASEstring  no"
-.It "KERN_OSREVinteger no"
-.It "KERN_OSTYPE   string  no"
-.It "KERN_POSIX1   integer no"
-.It "KERN_PROC nodenot applicable"
-.It "KERN_PROF nodenot applicable"
-.It "KERN_QUANTUM  integer yes"
-.It 

Re: svn commit: r307971 - head/sys/mips/include

2016-10-28 Thread Konstantin Belousov
On Fri, Oct 28, 2016 at 09:59:26AM -0700, John Baldwin wrote:
> Well, we could perhaps patch those to use SA_SIGINFO instead, but if it's
> a non-trivial amount of effort I'm not going to bother.  I'm surprised that
> some of those would use sigcontext.  Both mono and go post-date SA_SIGINFO
> being standardized and supported on FreeBSD AFAIK.  Supporting sigcontext
> just means extra BSD-specific code in those applications compared to using
> SA_SIGINFO. :-/

For libunwind, I can see a rationale for struct sigcontext use.  It seems
that on Linux, rt_sigreturn(2) syscall takes struct sigcontext *, and not
struct ucontext *, as the argument.  This is not unreasonable, because
the additional ucontext fields make no sense for sigreturn, for us they
are copied into kernel AS but are also unused.

So my FreeBSD port followed the existing Linux code.  And I started wondering
should we change our sigreturn(2) to take sigcontext * instead of ucontext *.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r307971 - head/sys/mips/include

2016-10-28 Thread John Baldwin
On Friday, October 28, 2016 06:31:58 PM Konstantin Belousov wrote:
> On Thu, Oct 27, 2016 at 03:08:01PM -0700, John Baldwin wrote:
> > On Wednesday, October 26, 2016 05:37:08 PM John Baldwin wrote:
> > > Author: jhb
> > > Date: Wed Oct 26 17:37:08 2016
> > > New Revision: 307971
> > > URL: https://svnweb.freebsd.org/changeset/base/307971
> > > 
> > > Log:
> > >   Correct definition of 'struct sigcontext' on MIPS.
> > >   
> > >   Add missing fields ('sr' and 'mc_tls') to 'struct sigcontext'.
> > >   
> > >   The kernel doesn't use 'struct sigcontext' but instead uses 'ucontext_t'
> > >   which includes 'mcontext_t' in 'struct sigframe' to build the signal 
> > > frame.
> > >   As a result, this change is not an ABI change but simply making
> > >   'struct sigcontext' correct.  Note that 'struct sigcontext' is only used
> > >   for "Traditional BSD style" signal handlers.
> > >   
> > >   While here, rename the 'xxx' field to '__spare__' to match 'mcontext_t'.
> > >   
> > >   Sponsored by:   DARPA, AFRL
> > 
> > We should perhaps a static assertion somewhere that
> > sizeof(sigset_t) + sizeof(ucontext_t) == sizeof(struct sigcontext) if
> > that is really true of all of our architectures.
> This should be mcontext_t instead of ucontext_t.

Yes.  I will try adding that static assert to sys/kern/kern_sig.c and
seeing if it survives a universe build.

> > Alternatively, we might consider retiring 'struct sigcontext' altogether.
> > It's purpose has been superseded by SA_SIGINFO (which is more portable)
> > which has been around for quite a while now.  As a first step I guess
> > we could try an exp-run with 'struct sigcontext' removed.  (We should
> > have ditched this in 5.0 since we have a separate sendsig/sigreturn path
> > for FreeBSD 4.x already.  Oh well.)
> 
> I do not think that this is a practical option. I know that struct
> sigcontext is used by nongnu libunwind. Quick search identifies mono and
> go as consumers as well.

Well, we could perhaps patch those to use SA_SIGINFO instead, but if it's
a non-trivial amount of effort I'm not going to bother.  I'm surprised that
some of those would use sigcontext.  Both mono and go post-date SA_SIGINFO
being standardized and supported on FreeBSD AFAIK.  Supporting sigcontext
just means extra BSD-specific code in those applications compared to using
SA_SIGINFO. :-/

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


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

2016-10-28 Thread Alexander Motin
Author: mav
Date: Fri Oct 28 17:05:14 2016
New Revision: 308055
URL: https://svnweb.freebsd.org/changeset/base/308055

Log:
  Add vdev_reopening support to vdev_geom.
  
  It allows to avoid extra GEOM providers flapping without significant need.
  Since GEOM got resize support, we don't need to reopen provider to get new
  size.  If provider was orphaned and no longer valid, ZFS should already
  know that, and in such case reopen should be done in full as expected.
  
  MFC after:2 weeks

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Oct 
28 16:31:58 2016(r308054)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Oct 
28 17:05:14 2016(r308055)
@@ -776,7 +776,14 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi
return (EINVAL);
}
 
-   vd->vdev_tsd = NULL;
+   /*
+* Reopen the device if it's not currently open. Otherwise,
+* just update the physical size of the device.
+*/
+   if ((cp = vd->vdev_tsd) != NULL) {
+   ASSERT(vd->vdev_reopening);
+   goto skip_open;
+   }
 
DROP_GIANT();
g_topology_lock();
@@ -861,6 +868,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi
vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED;
return (error);
}
+skip_open:
pp = cp->provider;
 
/*
@@ -896,6 +904,9 @@ static void
 vdev_geom_close(vdev_t *vd)
 {
 
+   if (vd->vdev_reopening)
+   return;
+
DROP_GIANT();
g_topology_lock();
vdev_geom_close_locked(vd);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308053 - stable/11/cddl/contrib/opensolaris/lib/libdtrace/common

2016-10-28 Thread George V. Neville-Neil
Author: gnn
Date: Fri Oct 28 16:27:58 2016
New Revision: 308053
URL: https://svnweb.freebsd.org/changeset/base/308053

Log:
  Corrected non-portable reuse of va_list in dt_printf()
  
  Submitted by:   Graeme Jenkinson
  Reviewed by:markj

Modified:
  stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c
==
--- stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c   Fri Oct 
28 16:22:45 2016(r308052)
+++ stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c   Fri Oct 
28 16:27:58 2016(r308053)
@@ -581,6 +581,7 @@ int
 dt_printf(dtrace_hdl_t *dtp, FILE *fp, const char *format, ...)
 {
va_list ap;
+   va_list ap2;
int n;
 
 #ifndef illumos
@@ -605,11 +606,13 @@ dt_printf(dtrace_hdl_t *dtp, FILE *fp, c
len = dtp->dt_sprintf_buflen - len;
assert(len >= 0);
 
-   if ((n = vsnprintf(buf, len, format, ap)) < 0)
+   va_copy(ap2, ap);
+   if ((n = vsnprintf(buf, len, format, ap2)) < 0)
n = dt_set_errno(dtp, errno);
 
+   va_end(ap2);
va_end(ap);
-
+   
return (n);
}
 
@@ -640,11 +643,14 @@ dt_printf(dtrace_hdl_t *dtp, FILE *fp, c
dtp->dt_buffered_buf[0] = '\0';
}
 
-   if ((needed = vsnprintf(NULL, 0, format, ap)) < 0) {
+   va_copy(ap2, ap);
+   if ((needed = vsnprintf(NULL, 0, format, ap2)) < 0) {
rval = dt_set_errno(dtp, errno);
+   va_end(ap2);
va_end(ap);
return (rval);
}
+   va_end(ap2);
 
if (needed == 0) {
va_end(ap);
@@ -670,12 +676,15 @@ dt_printf(dtrace_hdl_t *dtp, FILE *fp, c
dtp->dt_buffered_size <<= 1;
}
 
+   va_copy(ap2, ap);
if (vsnprintf(>dt_buffered_buf[dtp->dt_buffered_offs],
-   avail, format, ap) < 0) {
+   avail, format, ap2) < 0) {
rval = dt_set_errno(dtp, errno);
+   va_end(ap2);
va_end(ap);
return (rval);
}
+   va_end(ap2);
 
dtp->dt_buffered_offs += needed;
assert(dtp->dt_buffered_buf[dtp->dt_buffered_offs] == '\0');
@@ -683,8 +692,10 @@ dt_printf(dtrace_hdl_t *dtp, FILE *fp, c
return (0);
}
 
-   n = vfprintf(fp, format, ap);
+   va_copy(ap2, ap);
+   n = vfprintf(fp, format, ap2);
fflush(fp);
+   va_end(ap2);
va_end(ap);
 
if (n < 0) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-10-28 Thread Alexander Motin
Author: mav
Date: Fri Oct 28 16:21:31 2016
New Revision: 308051
URL: https://svnweb.freebsd.org/changeset/base/308051

Log:
  Matching GUIDs, handle possible race on vdev detach.
  
  In case of vdev detach, causing top level mirror vdev destruction, leaf
  vdev changes its GUID to one of the destroyed mirror, that creates race
  condition when GUID in vdev label may not match one in the pool config.
  
  This change replicates logic nuance of vdev_validate() by adding special
  exception, matching the vdev GUID against the top level vdev GUID.
  Since this exception is not completely reliable (may give false positives
  if we fail to erase label on detached vdev), use it only as last resort.
  
  Quick way to reproduce this scenario now is detach vdev from a pool with
  enabled autoextend.  During vdev detach autoextend logic tries to reopen
  remaining vdev, that always fails now since in-memory configuration is
  already updated, while on-disk labels are not yet.
  
  MFC after:2 weeks

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Oct 
28 15:57:55 2016(r308050)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Oct 
28 16:21:31 2016(r308051)
@@ -338,14 +338,6 @@ vdev_geom_close_locked(vdev_t *vd)
vdev_geom_detach(cp, B_TRUE);
 }
 
-static void
-nvlist_get_guids(nvlist_t *list, uint64_t *pguid, uint64_t *vguid)
-{
-
-   (void) nvlist_lookup_uint64(list, ZPOOL_CONFIG_GUID, vguid);
-   (void) nvlist_lookup_uint64(list, ZPOOL_CONFIG_POOL_GUID, pguid);
-}
-
 /*
  * Issue one or more bios to the vdev in parallel
  * cmds, datas, offsets, errors, and sizes are arrays of length ncmds.  Each IO
@@ -606,58 +598,69 @@ vdev_geom_read_pool_label(const char *na
return (*count > 0 ? 0 : ENOENT);
 }
 
-static void
-vdev_geom_read_guids(struct g_consumer *cp, uint64_t *pguid, uint64_t *vguid)
-{
-   nvlist_t *config;
-
-   g_topology_assert_not();
-
-   *pguid = 0;
-   *vguid = 0;
-   if (vdev_geom_read_config(cp, ) == 0) {
-   nvlist_get_guids(config, pguid, vguid);
-   nvlist_free(config);
-   }
-}
+enum match {
+   NO_MATCH,
+   TOP_MATCH,
+   FULL_MATCH
+};
 
-static boolean_t
+static enum match
 vdev_attach_ok(vdev_t *vd, struct g_provider *pp)
 {
-   uint64_t pool_guid;
-   uint64_t vdev_guid;
-   struct g_consumer *zcp;
-   boolean_t pool_ok;
-   boolean_t vdev_ok;
+   nvlist_t *config;
+   uint64_t pool_guid, top_guid, vdev_guid;
+   struct g_consumer *cp;
 
-   zcp = vdev_geom_attach(pp, NULL);
-   if (zcp == NULL) {
+   cp = vdev_geom_attach(pp, NULL);
+   if (cp == NULL) {
ZFS_LOG(1, "Unable to attach tasting instance to %s.",
pp->name);
-   return (B_FALSE);
+   return (NO_MATCH);
}
g_topology_unlock();
-   vdev_geom_read_guids(zcp, _guid, _guid);
+   if (vdev_geom_read_config(cp, ) != 0) {
+   g_topology_lock();
+   vdev_geom_detach(cp, B_TRUE);
+   ZFS_LOG(1, "Unable to read config from %s.", pp->name);
+   return (NO_MATCH);
+   }
g_topology_lock();
-   vdev_geom_detach(zcp, B_TRUE);
+   vdev_geom_detach(cp, B_TRUE);
 
-   /* 
-* Check that the label's vdev guid matches the desired guid.  If the
-* label has a pool guid, check that it matches too. (Inactive spares
-* and L2ARCs do not have any pool guid in the label.)
+   pool_guid = 0;
+   (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID, _guid);
+   top_guid = 0;
+   (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_TOP_GUID, _guid);
+   vdev_guid = 0;
+   (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_GUID, _guid);
+   nvlist_free(config);
+
+   /*
+* Check that the label's pool guid matches the desired guid.
+* Inactive spares and L2ARCs do not have any pool guid in the label.
 */
-   if ((pool_guid == 0 || pool_guid == spa_guid(vd->vdev_spa)) &&
-   vdev_guid == vd->vdev_guid) {
-   ZFS_LOG(1, "guids match for provider %s.", vd->vdev_path);
-   return (B_TRUE);
-   } else {
-   ZFS_LOG(1, "guid mismatch for provider %s: "
-   "%ju:%ju != %ju:%ju.", vd->vdev_path,
-   (uintmax_t)spa_guid(vd->vdev_spa),
-   (uintmax_t)vd->vdev_guid,
-   (uintmax_t)pool_guid, (uintmax_t)vdev_guid);
-   return (B_FALSE);
+   if (pool_guid != 0 && pool_guid != spa_guid(vd->vdev_spa)) {
+   ZFS_LOG(1, "pool guid mismatch for provider %s: %ju != %ju.",
+   

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

2016-10-28 Thread Andriy Gapon
Author: avg
Date: Fri Oct 28 15:57:55 2016
New Revision: 308050
URL: https://svnweb.freebsd.org/changeset/base/308050

Log:
  fix a syntax error in r308039 ...
  
  that I somehow introduced between testing the change
  iand committing it.
  
  MFC after:1 week
  X-MFC with:   r307903

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

Modified: head/sys/amd64/vmm/amd/svm.c
==
--- head/sys/amd64/vmm/amd/svm.cFri Oct 28 15:30:10 2016
(r308049)
+++ head/sys/amd64/vmm/amd/svm.cFri Oct 28 15:57:55 2016
(r308050)
@@ -514,7 +514,7 @@ svm_vminit(struct vm *vm, pmap_t pmap)
 {
struct svm_softc *svm_sc;
struct svm_vcpu *vcpu;
-   vm_paddr_t msrpm_pa, iopm_pa, pml4_pa
+   vm_paddr_t msrpm_pa, iopm_pa, pml4_pa;
int i;
 
svm_sc = contigmalloc(sizeof (*svm_sc), M_SVM, M_WAITOK | M_ZERO,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-10-28 Thread Alexander Motin
Author: mav
Date: Fri Oct 28 15:30:10 2016
New Revision: 308049
URL: https://svnweb.freebsd.org/changeset/base/308049

Log:
  Improve few debugging log messages.

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Oct 
28 15:20:53 2016(r308048)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Oct 
28 15:30:10 2016(r308049)
@@ -223,7 +223,7 @@ vdev_geom_attach(struct g_provider *pp, 
}
error = g_access(cp, 1, 0, 1);
if (error != 0) {
-   ZFS_LOG(1, "%s(%d): g_access failed: %d\n", __func__,
+   ZFS_LOG(1, "%s(%d): g_access failed: %d", __func__,
   __LINE__, error);
vdev_geom_detach(cp, B_FALSE);
return (NULL);
@@ -293,7 +293,7 @@ vdev_geom_detach(struct g_consumer *cp, 
 
g_topology_assert();
 
-   ZFS_LOG(1, "Detaching consumer. Provider %s.",
+   ZFS_LOG(1, "Detaching from %s.",
cp->provider && cp->provider->name ? cp->provider->name : "NULL");
 
vd = cp->private;
@@ -307,7 +307,7 @@ vdev_geom_detach(struct g_consumer *cp, 
if (cp->acw > 0)
g_access(cp, 0, -cp->acw, 0);
if (cp->provider != NULL) {
-   ZFS_LOG(1, "Destroying consumer to %s.",
+   ZFS_LOG(1, "Destroying consumer for %s.",
cp->provider->name ? cp->provider->name : "NULL");
g_detach(cp);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r307971 - head/sys/mips/include

2016-10-28 Thread Konstantin Belousov
On Thu, Oct 27, 2016 at 03:08:01PM -0700, John Baldwin wrote:
> On Wednesday, October 26, 2016 05:37:08 PM John Baldwin wrote:
> > Author: jhb
> > Date: Wed Oct 26 17:37:08 2016
> > New Revision: 307971
> > URL: https://svnweb.freebsd.org/changeset/base/307971
> > 
> > Log:
> >   Correct definition of 'struct sigcontext' on MIPS.
> >   
> >   Add missing fields ('sr' and 'mc_tls') to 'struct sigcontext'.
> >   
> >   The kernel doesn't use 'struct sigcontext' but instead uses 'ucontext_t'
> >   which includes 'mcontext_t' in 'struct sigframe' to build the signal 
> > frame.
> >   As a result, this change is not an ABI change but simply making
> >   'struct sigcontext' correct.  Note that 'struct sigcontext' is only used
> >   for "Traditional BSD style" signal handlers.
> >   
> >   While here, rename the 'xxx' field to '__spare__' to match 'mcontext_t'.
> >   
> >   Sponsored by: DARPA, AFRL
> 
> We should perhaps a static assertion somewhere that
> sizeof(sigset_t) + sizeof(ucontext_t) == sizeof(struct sigcontext) if
> that is really true of all of our architectures.
This should be mcontext_t instead of ucontext_t.

> 
> Alternatively, we might consider retiring 'struct sigcontext' altogether.
> It's purpose has been superseded by SA_SIGINFO (which is more portable)
> which has been around for quite a while now.  As a first step I guess
> we could try an exp-run with 'struct sigcontext' removed.  (We should
> have ditched this in 5.0 since we have a separate sendsig/sigreturn path
> for FreeBSD 4.x already.  Oh well.)

I do not think that this is a practical option. I know that struct
sigcontext is used by nongnu libunwind. Quick search identifies mono and
go as consumers as well.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308047 - stable/10/sys/sys

2016-10-28 Thread Andriy Gapon
Author: avg
Date: Fri Oct 28 15:20:43 2016
New Revision: 308047
URL: https://svnweb.freebsd.org/changeset/base/308047

Log:
  bump __FreeBSD_version for libzfs_core.h
  
  Direct commit.

Modified:
  stable/10/sys/sys/param.h

Modified: stable/10/sys/sys/param.h
==
--- stable/10/sys/sys/param.h   Fri Oct 28 15:18:11 2016(r308046)
+++ stable/10/sys/sys/param.h   Fri Oct 28 15:20:43 2016(r308047)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1003509  /* Master, propagated to newvers */
+#define __FreeBSD_version 1003510  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r307971 - head/sys/mips/include

2016-10-28 Thread John Baldwin
On Wednesday, October 26, 2016 05:37:08 PM John Baldwin wrote:
> Author: jhb
> Date: Wed Oct 26 17:37:08 2016
> New Revision: 307971
> URL: https://svnweb.freebsd.org/changeset/base/307971
> 
> Log:
>   Correct definition of 'struct sigcontext' on MIPS.
>   
>   Add missing fields ('sr' and 'mc_tls') to 'struct sigcontext'.
>   
>   The kernel doesn't use 'struct sigcontext' but instead uses 'ucontext_t'
>   which includes 'mcontext_t' in 'struct sigframe' to build the signal frame.
>   As a result, this change is not an ABI change but simply making
>   'struct sigcontext' correct.  Note that 'struct sigcontext' is only used
>   for "Traditional BSD style" signal handlers.
>   
>   While here, rename the 'xxx' field to '__spare__' to match 'mcontext_t'.
>   
>   Sponsored by:   DARPA, AFRL

We should perhaps a static assertion somewhere that
sizeof(sigset_t) + sizeof(ucontext_t) == sizeof(struct sigcontext) if
that is really true of all of our architectures.

Alternatively, we might consider retiring 'struct sigcontext' altogether.
It's purpose has been superseded by SA_SIGINFO (which is more portable)
which has been around for quite a while now.  As a first step I guess
we could try an exp-run with 'struct sigcontext' removed.  (We should
have ditched this in 5.0 since we have a separate sendsig/sigreturn path
for FreeBSD 4.x already.  Oh well.)

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


svn commit: r308048 - stable/11/sys/sys

2016-10-28 Thread Andriy Gapon
Author: avg
Date: Fri Oct 28 15:20:53 2016
New Revision: 308048
URL: https://svnweb.freebsd.org/changeset/base/308048

Log:
  bump __FreeBSD_version for libzfs_core.h
  
  Direct commit.

Modified:
  stable/11/sys/sys/param.h

Modified: stable/11/sys/sys/param.h
==
--- stable/11/sys/sys/param.h   Fri Oct 28 15:20:43 2016(r308047)
+++ stable/11/sys/sys/param.h   Fri Oct 28 15:20:53 2016(r308048)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1100505  /* Master, propagated to newvers */
+#define __FreeBSD_version 1100506  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308046 - stable/10/sys/sys

2016-10-28 Thread Andriy Gapon
Author: avg
Date: Fri Oct 28 15:18:11 2016
New Revision: 308046
URL: https://svnweb.freebsd.org/changeset/base/308046

Log:
  MFC r307141: remove a few stray spaces from sys/param.h

Modified:
  stable/10/sys/sys/param.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/sys/param.h
==
--- stable/10/sys/sys/param.h   Fri Oct 28 15:17:53 2016(r308045)
+++ stable/10/sys/sys/param.h   Fri Oct 28 15:18:11 2016(r308046)
@@ -44,7 +44,7 @@
 #define BSD4_3 1
 #define BSD4_4 1
 
-/* 
+/*
  * __FreeBSD_version numbers are documented in the Porter's Handbook.
  * If you bump the version for any reason, you should update the documentation
  * there.
@@ -239,7 +239,7 @@
  *
  * BKVASIZE -  Nominal buffer space per buffer, in bytes.  BKVASIZE is the
  * minimum KVM memory reservation the kernel is willing to make.
- * Filesystems can of course request smaller chunks.  Actual 
+ * Filesystems can of course request smaller chunks.  Actual
  * backing memory uses a chunk size of a page (PAGE_SIZE).
  * The default value here can be overridden on a per-architecture
  * basis by defining it in .  This should
@@ -248,8 +248,8 @@
  *
  * If you make BKVASIZE too small you risk seriously fragmenting
  * the buffer KVM map which may slow things down a bit.  If you
- * make it too big the kernel will not be able to optimally use 
- * the KVM memory reserved for the buffer cache and will wind 
+ * make it too big the kernel will not be able to optimally use
+ * the KVM memory reserved for the buffer cache and will wind
  * up with too-few buffers.
  *
  * The default is 16384, roughly 2x the block size used by a
@@ -342,7 +342,7 @@ __END_DECLS
 
 #define dbtoc(db)  /* calculates devblks to pages */ \
((db + (ctodb(1) - 1)) >> (PAGE_SHIFT - DEV_BSHIFT))
- 
+
 #define ctodb(db)  /* calculates pages to devblks */ \
((db) << (PAGE_SHIFT - DEV_BSHIFT))
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308045 - stable/11/sys/sys

2016-10-28 Thread Andriy Gapon
Author: avg
Date: Fri Oct 28 15:17:53 2016
New Revision: 308045
URL: https://svnweb.freebsd.org/changeset/base/308045

Log:
  MFC r307141: remove a few stray spaces from sys/param.h

Modified:
  stable/11/sys/sys/param.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/sys/param.h
==
--- stable/11/sys/sys/param.h   Fri Oct 28 15:15:51 2016(r308044)
+++ stable/11/sys/sys/param.h   Fri Oct 28 15:17:53 2016(r308045)
@@ -44,7 +44,7 @@
 #define BSD4_3 1
 #define BSD4_4 1
 
-/* 
+/*
  * __FreeBSD_version numbers are documented in the Porter's Handbook.
  * If you bump the version for any reason, you should update the documentation
  * there.
@@ -241,7 +241,7 @@
  *
  * BKVASIZE -  Nominal buffer space per buffer, in bytes.  BKVASIZE is the
  * minimum KVM memory reservation the kernel is willing to make.
- * Filesystems can of course request smaller chunks.  Actual 
+ * Filesystems can of course request smaller chunks.  Actual
  * backing memory uses a chunk size of a page (PAGE_SIZE).
  * The default value here can be overridden on a per-architecture
  * basis by defining it in .  This should
@@ -250,8 +250,8 @@
  *
  * If you make BKVASIZE too small you risk seriously fragmenting
  * the buffer KVM map which may slow things down a bit.  If you
- * make it too big the kernel will not be able to optimally use 
- * the KVM memory reserved for the buffer cache and will wind 
+ * make it too big the kernel will not be able to optimally use
+ * the KVM memory reserved for the buffer cache and will wind
  * up with too-few buffers.
  *
  * The default is 16384, roughly 2x the block size used by a
@@ -344,7 +344,7 @@ __END_DECLS
 
 #define dbtoc(db)  /* calculates devblks to pages */ \
((db + (ctodb(1) - 1)) >> (PAGE_SHIFT - DEV_BSHIFT))
- 
+
 #define ctodb(db)  /* calculates pages to devblks */ \
((db) << (PAGE_SHIFT - DEV_BSHIFT))
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308044 - stable/10/include

2016-10-28 Thread Andriy Gapon
Author: avg
Date: Fri Oct 28 15:15:51 2016
New Revision: 308044
URL: https://svnweb.freebsd.org/changeset/base/308044

Log:
  MFC r307131: install header files required development with libzfs_core

Modified:
  stable/10/include/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/include/Makefile
==
--- stable/10/include/Makefile  Fri Oct 28 15:15:27 2016(r308043)
+++ stable/10/include/Makefile  Fri Oct 28 15:15:51 2016(r308044)
@@ -236,6 +236,17 @@ copies:
cd ${.CURDIR}/../sys/rpc; \
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
${DESTDIR}${INCLUDEDIR}/rpc
+.if ${MK_CDDL} != "no"
+   cd ${.CURDIR}/../cddl/contrib/opensolaris/lib/libzfs_core/common; \
+   ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 
libzfs_core.h \
+   ${DESTDIR}${INCLUDEDIR}
+   cd ${.CURDIR}/../cddl/contrib/opensolaris/lib/libnvpair; \
+   ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 libnvpair.h \
+   ${DESTDIR}${INCLUDEDIR}
+   cd ${.CURDIR}/../sys/cddl/contrib/opensolaris/uts/common/sys; \
+   ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nvpair.h \
+   ${DESTDIR}${INCLUDEDIR}/sys
+.endif
 
 symlinks:
@${ECHO} "Setting up symlinks to kernel source tree..."
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308043 - stable/11/include

2016-10-28 Thread Andriy Gapon
Author: avg
Date: Fri Oct 28 15:15:27 2016
New Revision: 308043
URL: https://svnweb.freebsd.org/changeset/base/308043

Log:
  MFC r307131: install header files required development with libzfs_core

Modified:
  stable/11/include/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/include/Makefile
==
--- stable/11/include/Makefile  Fri Oct 28 15:02:24 2016(r308042)
+++ stable/11/include/Makefile  Fri Oct 28 15:15:27 2016(r308043)
@@ -236,6 +236,17 @@ copies: .PHONY .META
cd ${.CURDIR}/../sys/teken; \
${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 teken.h \
${DESTDIR}${INCLUDEDIR}/teken
+.if ${MK_CDDL} != "no"
+   cd ${.CURDIR}/../cddl/contrib/opensolaris/lib/libzfs_core/common; \
+   ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 
libzfs_core.h \
+   ${DESTDIR}${INCLUDEDIR}
+   cd ${.CURDIR}/../cddl/contrib/opensolaris/lib/libnvpair; \
+   ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 libnvpair.h \
+   ${DESTDIR}${INCLUDEDIR}
+   cd ${.CURDIR}/../sys/cddl/contrib/opensolaris/uts/common/sys; \
+   ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nvpair.h \
+   ${DESTDIR}${INCLUDEDIR}/sys
+.endif
 
 symlinks: .PHONY .META
@${ECHO} "Setting up symlinks to kernel source tree..."
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308042 - stable/10/sys/dev/smbus

2016-10-28 Thread Andriy Gapon
Author: avg
Date: Fri Oct 28 15:02:24 2016
New Revision: 308042
URL: https://svnweb.freebsd.org/changeset/base/308042

Log:
  MFC r307130: smbus: allow child devices to be added via hints
  
  Note that r281985 has never been MFC-ed to this branch, so this
  commit contains a couple of bits from that commit.

Modified:
  stable/10/sys/dev/smbus/smbconf.h
  stable/10/sys/dev/smbus/smbus.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/smbus/smbconf.h
==
--- stable/10/sys/dev/smbus/smbconf.h   Fri Oct 28 14:50:23 2016
(r308041)
+++ stable/10/sys/dev/smbus/smbconf.h   Fri Oct 28 15:02:24 2016
(r308042)
@@ -34,6 +34,10 @@
 
 #define n(flags) (~(flags) & (flags))
 
+/* Order constants for smbus children. */
+#define SMBUS_ORDER_HINTED 20
+#define SMBUS_ORDER_PNP40
+
 /*
  * How tsleep() is called in smb_request_bus().
  */

Modified: stable/10/sys/dev/smbus/smbus.c
==
--- stable/10/sys/dev/smbus/smbus.c Fri Oct 28 14:50:23 2016
(r308041)
+++ stable/10/sys/dev/smbus/smbus.c Fri Oct 28 15:02:24 2016
(r308042)
@@ -31,49 +31,24 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
-#include  
+#include 
 
 #include 
 #include 
 
-/*
- * Autoconfiguration and support routines for System Management bus
- */
-
-/*
- * Device methods
- */
-static int smbus_probe(device_t);
-static int smbus_attach(device_t);
-static int smbus_detach(device_t);
-
-static device_method_t smbus_methods[] = {
-/* device interface */
-DEVMETHOD(device_probe, smbus_probe),
-DEVMETHOD(device_attach,smbus_attach),
-DEVMETHOD(device_detach,smbus_detach),
-
-   /* bus interface */
-   DEVMETHOD(bus_add_child,bus_generic_add_child),
 
-   DEVMETHOD_END
-};
-
-driver_t smbus_driver = {
-"smbus",
-smbus_methods,
-sizeof(struct smbus_softc),
+struct smbus_ivar
+{
+   uint8_t addr;
 };
 
-devclass_t smbus_devclass;
-
 /*
- * At 'probe' time, we add all the devices which we know about to the
- * bus.  The generic attach routine will probe and attach them if they
- * are alive.
+ * Autoconfiguration and support routines for System Management bus
  */
+
 static int
 smbus_probe(device_t dev)
 {
@@ -90,6 +65,7 @@ smbus_attach(device_t dev)
 
mtx_init(>lock, device_get_nameunit(dev), "smbus", MTX_DEF);
bus_generic_probe(dev);
+   bus_enumerate_hinted_children(dev);
bus_generic_attach(dev);
 
return (0);
@@ -104,6 +80,7 @@ smbus_detach(device_t dev)
error = bus_generic_detach(dev);
if (error)
return (error);
+   device_delete_children(dev);
mtx_destroy(>lock);
 
return (0);
@@ -114,4 +91,154 @@ smbus_generic_intr(device_t dev, u_char 
 {
 }
 
+static device_t
+smbus_add_child(device_t dev, u_int order, const char *name, int unit)
+{
+   struct smbus_ivar *devi;
+   device_t child;
+
+   child = device_add_child_ordered(dev, order, name, unit);
+   if (child == NULL)
+   return (child);
+   devi = malloc(sizeof(struct smbus_ivar), M_DEVBUF, M_NOWAIT | M_ZERO);
+   if (devi == NULL) {
+   device_delete_child(dev, child);
+   return (NULL);
+   }
+   device_set_ivars(child, devi);
+   return (child);
+}
+
+static void
+smbus_hinted_child(device_t bus, const char *dname, int dunit)
+{
+   struct smbus_ivar *devi;
+   device_t child;
+   int addr;
+
+   addr = 0;
+   resource_int_value(dname, dunit, "addr", );
+   if (addr > UINT8_MAX) {
+   device_printf(bus, "ignored incorrect slave address hint 0x%x"
+   " for %s%d\n", addr, dname, dunit);
+   return;
+   }
+   child = BUS_ADD_CHILD(bus, SMBUS_ORDER_HINTED, dname, dunit);
+   if (child == NULL)
+   return;
+   devi = device_get_ivars(child);
+   devi->addr = addr;
+}
+
+
+static int
+smbus_child_location_str(device_t parent, device_t child, char *buf,
+size_t buflen)
+{
+   struct smbus_ivar *devi;
+
+   devi = device_get_ivars(child);
+   if (devi->addr != 0)
+   snprintf(buf, buflen, "addr=0x%x", devi->addr);
+   else if (buflen)
+   buf[0] = 0;
+   return (0);
+}
+
+static int
+smbus_print_child(device_t parent, device_t child)
+{
+   struct smbus_ivar *devi;
+   int retval;
+
+   devi = device_get_ivars(child);
+   retval = bus_print_child_header(parent, child);
+   if (devi->addr != 0)
+   retval += printf(" at addr 0x%x", devi->addr);
+   retval += bus_print_child_footer(parent, child);
+
+   return (retval);
+}
+
+static int
+smbus_read_ivar(device_t parent, device_t child, int 

svn commit: r308041 - stable/11/sys/dev/smbus

2016-10-28 Thread Andriy Gapon
Author: avg
Date: Fri Oct 28 14:50:23 2016
New Revision: 308041
URL: https://svnweb.freebsd.org/changeset/base/308041

Log:
  MFC r307130: smbus: allow child devices to be added via hints

Modified:
  stable/11/sys/dev/smbus/smbconf.h
  stable/11/sys/dev/smbus/smbus.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/smbus/smbconf.h
==
--- stable/11/sys/dev/smbus/smbconf.h   Fri Oct 28 14:49:54 2016
(r308040)
+++ stable/11/sys/dev/smbus/smbconf.h   Fri Oct 28 14:50:23 2016
(r308041)
@@ -34,6 +34,10 @@
 
 #define n(flags) (~(flags) & (flags))
 
+/* Order constants for smbus children. */
+#define SMBUS_ORDER_HINTED 20
+#define SMBUS_ORDER_PNP40
+
 /*
  * How tsleep() is called in smb_request_bus().
  */

Modified: stable/11/sys/dev/smbus/smbus.c
==
--- stable/11/sys/dev/smbus/smbus.c Fri Oct 28 14:49:54 2016
(r308040)
+++ stable/11/sys/dev/smbus/smbus.c Fri Oct 28 14:50:23 2016
(r308041)
@@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -41,54 +42,16 @@ __FBSDID("$FreeBSD$");
 #include "smbus_if.h"
 #include "bus_if.h"
 
+struct smbus_ivar
+{
+   uint8_t addr;
+};
 
 /*
  * Autoconfiguration and support routines for System Management bus
  */
+static void smbus_probe_device(device_t dev, u_char addr);
 
-/*
- * Device methods
- */
-static int smbus_probe(device_t);
-static int smbus_attach(device_t);
-static int smbus_detach(device_t);
-
-static int smbus_child_location_str(device_t parent, device_t child,
-   char *buf, size_t buflen);
-static int smbus_print_child(device_t parent, device_t child);
-static void smbus_probe_device(device_t dev, u_char* addr);
-static int smbus_read_ivar(device_t parent, device_t child, int which,
-   uintptr_t *result);
-
-static device_method_t smbus_methods[] = {
-/* device interface */
-DEVMETHOD(device_probe, smbus_probe),
-DEVMETHOD(device_attach,smbus_attach),
-DEVMETHOD(device_detach,smbus_detach),
-
-   /* bus interface */
-   DEVMETHOD(bus_add_child,bus_generic_add_child),
-   DEVMETHOD(bus_child_location_str, smbus_child_location_str),
-   DEVMETHOD(bus_driver_added, bus_generic_driver_added),
-   DEVMETHOD(bus_print_child,  smbus_print_child),
-   DEVMETHOD(bus_read_ivar,smbus_read_ivar),
-
-   DEVMETHOD_END
-};
-
-driver_t smbus_driver = {
-"smbus",
-smbus_methods,
-sizeof(struct smbus_softc),
-};
-
-devclass_t smbus_devclass;
-
-/*
- * At 'probe' time, we add all the devices which we know about to the
- * bus.  The generic attach routine will probe and attach them if they
- * are alive.
- */
 static int
 smbus_probe(device_t dev)
 {
@@ -107,9 +70,9 @@ smbus_attach(device_t dev)
mtx_init(>lock, device_get_nameunit(dev), "smbus", MTX_DEF);
bus_generic_probe(dev);
for (addr = SMBUS_ADDR_MIN; addr < SMBUS_ADDR_MAX; ++addr) {
-   sc->addrs[addr] = addr;
-   smbus_probe_device(dev, >addrs[addr]);
+   smbus_probe_device(dev, addr);
}
+   bus_enumerate_hinted_children(dev);
bus_generic_attach(dev);
 
return (0);
@@ -124,6 +87,7 @@ smbus_detach(device_t dev)
error = bus_generic_detach(dev);
if (error)
return (error);
+   device_delete_children(dev);
mtx_destroy(>lock);
 
return (0);
@@ -135,34 +99,78 @@ smbus_generic_intr(device_t dev, u_char 
 }
 
 static void
-smbus_probe_device(device_t dev, u_char* addr)
+smbus_probe_device(device_t dev, u_char addr)
 {
device_t child;
int error;
u_char cmd;
u_char buf[2];
+   struct smbus_ivar *devi;
 
cmd = 0x01;
-   error = smbus_trans(dev, *addr, cmd,
+   error = smbus_trans(dev, addr, cmd,
SMB_TRANS_NOCNT | SMB_TRANS_NOREPORT,
NULL, 0, buf, 1, NULL);
if (error == 0) {
if (bootverbose)
-   device_printf(dev, "Probed address 0x%02x\n", *addr);
-   child = device_add_child(dev, NULL, -1);
-   device_set_ivars(child, addr);
+   device_printf(dev, "Probed address 0x%02x\n", addr);
+   child = BUS_ADD_CHILD(dev, SMBUS_ORDER_PNP, NULL, -1);
+   if (child == NULL)
+   return;
+   devi = device_get_ivars(child);
+   devi->addr = addr;
+   }
+}
+
+static device_t
+smbus_add_child(device_t dev, u_int order, const char *name, int unit)
+{
+   struct smbus_ivar *devi;
+   device_t child;
+
+   child = device_add_child_ordered(dev, order, name, unit);
+

svn commit: r308040 - head/usr.sbin/watchdogd

2016-10-28 Thread Andriy Gapon
Author: avg
Date: Fri Oct 28 14:49:54 2016
New Revision: 308040
URL: https://svnweb.freebsd.org/changeset/base/308040

Log:
  nap time between pats is forced to be at most half of the timeout
  
  Previously, if the timeout was less than 10 seconds, for example, about
  8 seconds, then the watchdog timer would be let to expire before patting
  the watchdog.
  
  MFC after:2 weeks

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

Modified: head/usr.sbin/watchdogd/watchdogd.c
==
--- head/usr.sbin/watchdogd/watchdogd.c Fri Oct 28 14:38:01 2016
(r308039)
+++ head/usr.sbin/watchdogd/watchdogd.c Fri Oct 28 14:49:54 2016
(r308040)
@@ -80,7 +80,8 @@ static u_int timeout = WD_TO_128SEC;
 static u_int exit_timeout = WD_TO_NEVER;
 static u_int pretimeout = 0;
 static u_int timeout_sec;
-static u_int passive = 0;
+static u_int nap = 10;
+static int passive = 0;
 static int is_daemon = 0;
 static int is_dry_run = 0;  /* do not arm the watchdog, only
   report on timing of the watch
@@ -88,7 +89,6 @@ static int is_dry_run = 0;  /* do not ar
 static int do_timedog = 0;
 static int do_syslog = 1;
 static int fd = -1;
-static int nap = 10;
 static int carp_thresh_seconds = -1;
 static char *test_cmd = NULL;
 
@@ -771,6 +771,9 @@ parseargs(int argc, char *argv[])
}
}
 
+   if (nap > timeout_sec / 2)
+   nap = timeout_sec / 2;
+
if (carp_thresh_seconds == -1)
carp_thresh_seconds = nap;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-10-28 Thread Andriy Gapon
Author: avg
Date: Fri Oct 28 14:38:01 2016
New Revision: 308039
URL: https://svnweb.freebsd.org/changeset/base/308039

Log:
  vmm: another take at maximmum address passed to contigmalloc
  
  Just using vm_paddr_t value with all bits set.
  That should work as long as the type is unsigned.
  
  While there, fix a couple of whitespace issues nearby.
  
  MFC after:1 week
  X-MFC with:   r307903

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

Modified: head/sys/amd64/vmm/amd/svm.c
==
--- head/sys/amd64/vmm/amd/svm.cFri Oct 28 13:37:58 2016
(r308038)
+++ head/sys/amd64/vmm/amd/svm.cFri Oct 28 14:38:01 2016
(r308039)
@@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 
 #include "vmm_lapic.h"
 #include "vmm_stat.h"
@@ -515,11 +514,11 @@ svm_vminit(struct vm *vm, pmap_t pmap)
 {
struct svm_softc *svm_sc;
struct svm_vcpu *vcpu;
-   vm_paddr_t msrpm_pa, iopm_pa, pml4_pa;  
+   vm_paddr_t msrpm_pa, iopm_pa, pml4_pa
int i;
 
svm_sc = contigmalloc(sizeof (*svm_sc), M_SVM, M_WAITOK | M_ZERO,
-   0, VM_MAX_ADDRESS, PAGE_SIZE, 0);
+   0, ~(vm_paddr_t)0, PAGE_SIZE, 0);
svm_sc->vm = vm;
svm_sc->nptp = (vm_offset_t)vtophys(pmap->pm_pml4);
 
@@ -536,7 +535,7 @@ svm_vminit(struct vm *vm, pmap_t pmap)
svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_GSBASE);
svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_FSBASE);
svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_KGSBASE);
-   
+
svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_STAR);
svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_LSTAR);
svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_CSTAR);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308038 - head/sys/dev/netmap

2016-10-28 Thread Sean Bruno
Author: sbruno
Date: Fri Oct 28 13:37:58 2016
New Revision: 308038
URL: https://svnweb.freebsd.org/changeset/base/308038

Log:
  The buffer address is always overwritten in the extended descriptor format,
  we have to refresh it ... always.  This fixes problems reported in NetMap
  with em(4) devices after conversion to extended descriptor format in
  svn r293331.
  
  Submitted by: luigi@
  Reported by:  fra...@opnsense.org
  MFC after:2 days

Modified:
  head/sys/dev/netmap/if_em_netmap.h

Modified: head/sys/dev/netmap/if_em_netmap.h
==
--- head/sys/dev/netmap/if_em_netmap.h  Fri Oct 28 12:59:21 2016
(r308037)
+++ head/sys/dev/netmap/if_em_netmap.h  Fri Oct 28 13:37:58 2016
(r308038)
@@ -277,9 +277,9 @@ em_netmap_rxsync(struct netmap_kring *kr
if (addr == NETMAP_BUF_BASE(na)) /* bad buf */
goto ring_reset;
 
+   curr->read.buffer_addr = htole64(paddr);
if (slot->flags & NS_BUF_CHANGED) {
/* buffer has changed, reload map */
-   curr->read.buffer_addr = htole64(paddr);
netmap_reload_map(na, rxr->rxtag, rxbuf->map, 
addr);
slot->flags &= ~NS_BUF_CHANGED;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308037 - stable/10/sbin/init

2016-10-28 Thread Konstantin Belousov
Author: kib
Date: Fri Oct 28 12:59:21 2016
New Revision: 308037
URL: https://svnweb.freebsd.org/changeset/base/308037

Log:
  MFC r306808:
  Add verbosity around failed reboot(2) call.

Modified:
  stable/10/sbin/init/init.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/init/init.c
==
--- stable/10/sbin/init/init.c  Fri Oct 28 12:58:40 2016(r308036)
+++ stable/10/sbin/init/init.c  Fri Oct 28 12:59:21 2016(r308037)
@@ -891,8 +891,13 @@ single_user(void)
if (Reboot) {
/* Instead of going single user, let's reboot the machine */
sync();
-   reboot(howto);
-   _exit(0);
+   if (reboot(howto) == -1) {
+   emergency("reboot(%#x) failed, %s", howto,
+   strerror(errno));
+   _exit(1); /* panic and reboot */
+   }
+   warning("reboot(%#x) returned", howto);
+   _exit(0); /* panic as well */
}
 
shell = get_shell();
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308036 - stable/10/sbin/init

2016-10-28 Thread Konstantin Belousov
Author: kib
Date: Fri Oct 28 12:58:40 2016
New Revision: 308036
URL: https://svnweb.freebsd.org/changeset/base/308036

Log:
  MFC r306807:
  When making a pause after detecting hard kill of the single-user
  shell, ensure that we do sleep for at least the specified time, in
  presence of signals.

Modified:
  stable/10/sbin/init/init.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/init/init.c
==
--- stable/10/sbin/init/init.c  Fri Oct 28 12:56:27 2016(r308035)
+++ stable/10/sbin/init/init.c  Fri Oct 28 12:58:40 2016(r308036)
@@ -876,6 +876,7 @@ single_user(void)
sigset_t mask;
const char *shell;
char *argv[2];
+   struct timeval tv, tn;
 #ifdef SECURE
struct ttyent *typ;
struct passwd *pp;
@@ -1008,7 +1009,14 @@ single_user(void)
 *  reboot(8) killed shell?
 */
warning("single user shell terminated.");
-   sleep(STALL_TIMEOUT);
+   gettimeofday(, NULL);
+   tn = tv;
+   tv.tv_sec += STALL_TIMEOUT;
+   while (tv.tv_sec > tn.tv_sec || (tv.tv_sec ==
+   tn.tv_sec && tv.tv_usec > tn.tv_usec)) {
+   sleep(1);
+   gettimeofday(, NULL);
+   }
_exit(0);
} else {
warning("single user shell terminated, restarting");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308035 - stable/11/sbin/init

2016-10-28 Thread Konstantin Belousov
Author: kib
Date: Fri Oct 28 12:56:27 2016
New Revision: 308035
URL: https://svnweb.freebsd.org/changeset/base/308035

Log:
  MFC r306808:
  Add verbosity around failed reboot(2) call.

Modified:
  stable/11/sbin/init/init.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/init/init.c
==
--- stable/11/sbin/init/init.c  Fri Oct 28 12:55:14 2016(r308034)
+++ stable/11/sbin/init/init.c  Fri Oct 28 12:56:27 2016(r308035)
@@ -885,8 +885,13 @@ single_user(void)
if (Reboot) {
/* Instead of going single user, let's reboot the machine */
sync();
-   reboot(howto);
-   _exit(0);
+   if (reboot(howto) == -1) {
+   emergency("reboot(%#x) failed, %s", howto,
+   strerror(errno));
+   _exit(1); /* panic and reboot */
+   }
+   warning("reboot(%#x) returned", howto);
+   _exit(0); /* panic as well */
}
 
shell = get_shell();
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308034 - stable/11/sbin/init

2016-10-28 Thread Konstantin Belousov
Author: kib
Date: Fri Oct 28 12:55:14 2016
New Revision: 308034
URL: https://svnweb.freebsd.org/changeset/base/308034

Log:
  MFC r306807:
  When making a pause after detecting hard kill of the single-user
  shell, ensure that we do sleep for at least the specified time, in
  presence of signals.

Modified:
  stable/11/sbin/init/init.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/init/init.c
==
--- stable/11/sbin/init/init.c  Fri Oct 28 12:46:38 2016(r308033)
+++ stable/11/sbin/init/init.c  Fri Oct 28 12:55:14 2016(r308034)
@@ -870,6 +870,7 @@ single_user(void)
sigset_t mask;
const char *shell;
char *argv[2];
+   struct timeval tv, tn;
 #ifdef SECURE
struct ttyent *typ;
struct passwd *pp;
@@ -1002,7 +1003,14 @@ single_user(void)
 *  reboot(8) killed shell?
 */
warning("single user shell terminated.");
-   sleep(STALL_TIMEOUT);
+   gettimeofday(, NULL);
+   tn = tv;
+   tv.tv_sec += STALL_TIMEOUT;
+   while (tv.tv_sec > tn.tv_sec || (tv.tv_sec ==
+   tn.tv_sec && tv.tv_usec > tn.tv_usec)) {
+   sleep(1);
+   gettimeofday(, NULL);
+   }
_exit(0);
} else {
warning("single user shell terminated, restarting");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308033 - stable/10/sys/dev/sound/usb

2016-10-28 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Oct 28 12:46:38 2016
New Revision: 308033
URL: https://svnweb.freebsd.org/changeset/base/308033

Log:
  MFC r307651:
  Add support for adjusting the hardware buffering delay for USB audio.
  
  Requested by: Goran Mekic 

Modified:
  stable/10/sys/dev/sound/usb/uaudio.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sound/usb/uaudio.c
==
--- stable/10/sys/dev/sound/usb/uaudio.cFri Oct 28 12:43:49 2016
(r308032)
+++ stable/10/sys/dev/sound/usb/uaudio.cFri Oct 28 12:46:38 2016
(r308033)
@@ -95,6 +95,7 @@ __FBSDID("$FreeBSD$");
 static int uaudio_default_rate = 0;/* use rate list */
 static int uaudio_default_bits = 32;
 static int uaudio_default_channels = 0;/* use default */
+static int uaudio_buffer_ms = 8;
 
 #ifdef USB_DEBUG
 static int uaudio_debug = 0;
@@ -115,9 +116,32 @@ SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, def
 TUNABLE_INT("hw.usb.uaudio.default_channels", _default_channels);
 SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_channels, CTLFLAG_RW,
 _default_channels, 0, "uaudio default sample channels");
+
+static int
+uaudio_buffer_ms_sysctl(SYSCTL_HANDLER_ARGS)
+{
+   int err, val;
+
+   val = uaudio_buffer_ms;
+   err = sysctl_handle_int(oidp, , 0, req);
+
+   if (err != 0 || req->newptr == NULL || val == uaudio_buffer_ms)
+   return (err);
+
+   if (val > 8)
+   val = 8;
+   else if (val < 2)
+   val = 2;
+
+   uaudio_buffer_ms = val;
+
+   return (0);
+}
+SYSCTL_PROC(_hw_usb_uaudio, OID_AUTO, buffer_ms, CTLTYPE_INT | CTLFLAG_RWTUN,
+0, sizeof(int), uaudio_buffer_ms_sysctl, "I",
+"uaudio buffering delay from 2ms to 8ms");
 #endif
 
-#defineUAUDIO_IRQS (8000 / UAUDIO_NFRAMES) /* interrupts per 
second */
 #defineUAUDIO_NFRAMES  64  /* must be factor of 8 due 
HS-USB */
 #defineUAUDIO_NCHANBUFS2   /* number of outstanding 
request */
 #defineUAUDIO_RECURSE_LIMIT255 /* rounds */
@@ -1284,10 +1308,10 @@ uaudio_configure_msg_sub(struct uaudio_s
 
if (fps < 8000) {
/* FULL speed USB */
-   frames = 8;
+   frames = uaudio_buffer_ms;
} else {
/* HIGH speed USB */
-   frames = UAUDIO_NFRAMES;
+   frames = uaudio_buffer_ms * 8;
}
 
fps_shift = usbd_xfer_get_fps_shift(chan->xfer[0]);
@@ -2164,8 +2188,9 @@ tr_setup:
}
 
/* start the SYNC transfer one time per second, if any */
-   if (++(ch->intr_counter) >= UAUDIO_IRQS) {
-   ch->intr_counter = 0;
+   ch->intr_counter += ch->intr_frames;
+   if (ch->intr_counter >= ch->frames_per_second) {
+   ch->intr_counter -= ch->frames_per_second;
usbd_transfer_start(ch->xfer[UAUDIO_NCHANBUFS]);
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308032 - stable/11/sys/dev/sound/usb

2016-10-28 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Oct 28 12:43:49 2016
New Revision: 308032
URL: https://svnweb.freebsd.org/changeset/base/308032

Log:
  MFC r307651:
  Add support for adjusting the hardware buffering delay for USB audio.
  
  Requested by: Goran Mekic 

Modified:
  stable/11/sys/dev/sound/usb/uaudio.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/sound/usb/uaudio.c
==
--- stable/11/sys/dev/sound/usb/uaudio.cFri Oct 28 12:36:59 2016
(r308031)
+++ stable/11/sys/dev/sound/usb/uaudio.cFri Oct 28 12:43:49 2016
(r308032)
@@ -95,6 +95,7 @@ __FBSDID("$FreeBSD$");
 static int uaudio_default_rate = 0;/* use rate list */
 static int uaudio_default_bits = 32;
 static int uaudio_default_channels = 0;/* use default */
+static int uaudio_buffer_ms = 8;
 
 #ifdef USB_DEBUG
 static int uaudio_debug = 0;
@@ -109,9 +110,32 @@ SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, def
 _default_bits, 0, "uaudio default sample bits");
 SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_channels, CTLFLAG_RWTUN,
 _default_channels, 0, "uaudio default sample channels");
+
+static int
+uaudio_buffer_ms_sysctl(SYSCTL_HANDLER_ARGS)
+{
+   int err, val;
+
+   val = uaudio_buffer_ms;
+   err = sysctl_handle_int(oidp, , 0, req);
+
+   if (err != 0 || req->newptr == NULL || val == uaudio_buffer_ms)
+   return (err);
+
+   if (val > 8)
+   val = 8;
+   else if (val < 2)
+   val = 2;
+
+   uaudio_buffer_ms = val;
+
+   return (0);
+}
+SYSCTL_PROC(_hw_usb_uaudio, OID_AUTO, buffer_ms, CTLTYPE_INT | CTLFLAG_RWTUN,
+0, sizeof(int), uaudio_buffer_ms_sysctl, "I",
+"uaudio buffering delay from 2ms to 8ms");
 #endif
 
-#defineUAUDIO_IRQS (8000 / UAUDIO_NFRAMES) /* interrupts per 
second */
 #defineUAUDIO_NFRAMES  64  /* must be factor of 8 due 
HS-USB */
 #defineUAUDIO_NCHANBUFS2   /* number of outstanding 
request */
 #defineUAUDIO_RECURSE_LIMIT255 /* rounds */
@@ -1278,10 +1302,10 @@ uaudio_configure_msg_sub(struct uaudio_s
 
if (fps < 8000) {
/* FULL speed USB */
-   frames = 8;
+   frames = uaudio_buffer_ms;
} else {
/* HIGH speed USB */
-   frames = UAUDIO_NFRAMES;
+   frames = uaudio_buffer_ms * 8;
}
 
fps_shift = usbd_xfer_get_fps_shift(chan->xfer[0]);
@@ -2158,8 +2182,9 @@ tr_setup:
}
 
/* start the SYNC transfer one time per second, if any */
-   if (++(ch->intr_counter) >= UAUDIO_IRQS) {
-   ch->intr_counter = 0;
+   ch->intr_counter += ch->intr_frames;
+   if (ch->intr_counter >= ch->frames_per_second) {
+   ch->intr_counter -= ch->frames_per_second;
usbd_transfer_start(ch->xfer[UAUDIO_NCHANBUFS]);
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308031 - head/sys/dev/mlx4/mlx4_en

2016-10-28 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Oct 28 12:36:59 2016
New Revision: 308031
URL: https://svnweb.freebsd.org/changeset/base/308031

Log:
  Fix indentation and remove duplicate queue stopped stats increment.
  
  Found by: Ryan Stone 
  Sponsored by: Mellanox Technologies
  MFC after:1 week

Modified:
  head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c

Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c
==
--- head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c  Fri Oct 28 12:27:05 2016
(r308030)
+++ head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c  Fri Oct 28 12:36:59 2016
(r308031)
@@ -707,20 +707,19 @@ static int mlx4_en_xmit(struct mlx4_en_p
 
/* check if TX ring is full */
if (unlikely(mlx4_en_tx_ring_is_full(ring))) {
-   /* every full native Tx ring stops queue */
-   if (ring->blocked == 0)
-   atomic_add_int(>blocked, 1);
-   /* Set HW-queue-is-full flag */
-   atomic_set_int(>if_drv_flags, IFF_DRV_OACTIVE);
-   priv->port_stats.queue_stopped++;
-   ring->blocked = 1;
+   /* every full native Tx ring stops queue */
+   if (ring->blocked == 0)
+   atomic_add_int(>blocked, 1);
+   /* Set HW-queue-is-full flag */
+   atomic_set_int(>if_drv_flags, IFF_DRV_OACTIVE);
priv->port_stats.queue_stopped++;
+   ring->blocked = 1;
ring->queue_stopped++;
 
/* Use interrupts to find out when queue opened */
mlx4_en_arm_cq(priv, priv->tx_cq[tx_ind]);
return (ENOBUFS);
-}
+   }
 
/* sanity check we are not wrapping around */
KASSERT(((~ring->prod) & ring->size_mask) >=
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308030 - head/sys/x86/x86

2016-10-28 Thread Konstantin Belousov
Author: kib
Date: Fri Oct 28 12:27:05 2016
New Revision: 308030
URL: https://svnweb.freebsd.org/changeset/base/308030

Log:
  Use correct cpu id in the banner.  Fix style.
  
  Noted by: avg
  Sponsored by: The FreeBSD Foundation
  MFC after:9 days

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

Modified: head/sys/x86/x86/cpu_machdep.c
==
--- head/sys/x86/x86/cpu_machdep.c  Fri Oct 28 11:53:22 2016
(r308029)
+++ head/sys/x86/x86/cpu_machdep.c  Fri Oct 28 12:27:05 2016
(r308030)
@@ -551,7 +551,7 @@ nmi_call_kdb(u_int cpu, u_int type, stru
 * NMI can be hooked up to a pushbutton for debugging.
 */
if (kdb_on_nmi) {
-   printf ("NMI/cpu%d ... going to debugger\n", cpu);
+   printf("NMI/cpu%d ... going to debugger\n", cpu);
kdb_trap(type, 0, frame);
}
 #endif /* KDB */
@@ -572,6 +572,6 @@ nmi_handle_intr(u_int type, struct trapf
return;
}
 #endif
-   nmi_call_kdb(0, type, frame);
+   nmi_call_kdb(PCPU_GET(cpuid), type, frame);
 #endif
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308029 - head/sys/i386/i386

2016-10-28 Thread Konstantin Belousov
Author: kib
Date: Fri Oct 28 11:53:22 2016
New Revision: 308029
URL: https://svnweb.freebsd.org/changeset/base/308029

Log:
  Handle pmap_enter() over an existing 4/2M page in KVA on i386.
  
  The userspace case was already handled by pmap_allocpte().  For kernel
  VA, page table page must exist, and demote cannot fail, so we need to
  just call pmap_demote_pde().  Also note that due to the machine AS
  layout, promotions in the KVA on i386 are highly unlikely, so this
  change is mostly for completeness.
  
  Reviewed by:  alc, markj
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  Differential revision:https://reviews.freebsd.org/D8323

Modified:
  head/sys/i386/i386/pmap.c

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Fri Oct 28 11:46:39 2016(r308028)
+++ head/sys/i386/i386/pmap.c   Fri Oct 28 11:53:22 2016(r308029)
@@ -3466,11 +3466,14 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
PMAP_LOCK(pmap);
sched_pin();
 
-   /*
-* In the case that a page table page is not
-* resident, we are creating it here.
-*/
+   pde = pmap_pde(pmap, va);
if (va < VM_MAXUSER_ADDRESS) {
+   /*
+* va is for UVA.
+* In the case that a page table page is not resident,
+* we are creating it here.  pmap_allocpte() handles
+* demotion.
+*/
mpte = pmap_allocpte(pmap, va, flags);
if (mpte == NULL) {
KASSERT((flags & PMAP_ENTER_NOSLEEP) != 0,
@@ -3480,19 +3483,28 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
PMAP_UNLOCK(pmap);
return (KERN_RESOURCE_SHORTAGE);
}
+   } else {
+   /*
+* va is for KVA, so pmap_demote_pde() will never fail
+* to install a page table page.  PG_V is also
+* asserted by pmap_demote_pde().
+*/
+   KASSERT(pde != NULL && (*pde & PG_V) != 0,
+   ("KVA %#x invalid pde pdir %#jx", va,
+   (uintmax_t)pmap->pm_pdir[PTDPTDI]));
+   if ((*pde & PG_PS) != 0)
+   pmap_demote_pde(pmap, pde, va);
}
-
-   pde = pmap_pde(pmap, va);
-   if ((*pde & PG_PS) != 0)
-   panic("pmap_enter: attempted pmap_enter on 4MB page");
pte = pmap_pte_quick(pmap, va);
 
/*
-* Page Directory table entry not valid, we need a new PT page
+* Page Directory table entry is not valid, which should not
+* happen.  We should have either allocated the page table
+* page or demoted the existing mapping above.
 */
if (pte == NULL) {
panic("pmap_enter: invalid page directory pdir=%#jx, va=%#x",
-   (uintmax_t)pmap->pm_pdir[PTDPTDI], va);
+   (uintmax_t)pmap->pm_pdir[PTDPTDI], va);
}
 
pa = VM_PAGE_TO_PHYS(m);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308028 - head/sys/fs/cd9660

2016-10-28 Thread Konstantin Belousov
Author: kib
Date: Fri Oct 28 11:46:39 2016
New Revision: 308028
URL: https://svnweb.freebsd.org/changeset/base/308028

Log:
  Use buffer pager for cd9660.
  
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/fs/cd9660/cd9660_vnops.c

Modified: head/sys/fs/cd9660/cd9660_vnops.c
==
--- head/sys/fs/cd9660/cd9660_vnops.c   Fri Oct 28 11:46:15 2016
(r308027)
+++ head/sys/fs/cd9660/cd9660_vnops.c   Fri Oct 28 11:46:39 2016
(r308028)
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -74,6 +75,7 @@ static vop_readdir_t  cd9660_readdir;
 static vop_readlink_t  cd9660_readlink;
 static vop_strategy_t  cd9660_strategy;
 static vop_vptofh_tcd9660_vptofh;
+static vop_getpages_t  cd9660_getpages;
 
 /*
  * Setattr call. Only allowed for block and character special devices.
@@ -836,6 +838,45 @@ cd9660_vptofh(ap)
return (0);
 }
 
+SYSCTL_NODE(_vfs, OID_AUTO, cd9660, CTLFLAG_RW, 0, "cd9660 filesystem");
+static int use_buf_pager = 1;
+SYSCTL_INT(_vfs_cd9660, OID_AUTO, use_buf_pager, CTLFLAG_RWTUN,
+_buf_pager, 0,
+"Use buffer pager instead of bmap");
+
+static daddr_t
+cd9660_gbp_getblkno(struct vnode *vp, vm_ooffset_t off)
+{
+
+   return (lblkno(VTOI(vp)->i_mnt, off));
+}
+
+static int
+cd9660_gbp_getblksz(struct vnode *vp, daddr_t lbn)
+{
+   struct iso_node *ip;
+
+   ip = VTOI(vp);
+   return (blksize(ip->i_mnt, ip, lbn));
+}
+
+static int
+cd9660_getpages(struct vop_getpages_args *ap)
+{
+   struct vnode *vp;
+
+   vp = ap->a_vp;
+   if (vp->v_type == VCHR || vp->v_type == VBLK)
+   return (EOPNOTSUPP);
+
+   if (use_buf_pager)
+   return (vfs_bio_getpages(vp, ap->a_m, ap->a_count,
+   ap->a_rbehind, ap->a_rahead, cd9660_gbp_getblkno,
+   cd9660_gbp_getblksz));
+   return (vnode_pager_generic_getpages(vp, ap->a_m, ap->a_count,
+   ap->a_rbehind, ap->a_rahead, NULL, NULL));
+}
+
 /*
  * Global vfs data structures for cd9660
  */
@@ -857,6 +898,7 @@ struct vop_vector cd9660_vnodeops = {
.vop_setattr =  cd9660_setattr,
.vop_strategy = cd9660_strategy,
.vop_vptofh =   cd9660_vptofh,
+   .vop_getpages = cd9660_getpages,
 };
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308027 - head/sys/fs/msdosfs

2016-10-28 Thread Konstantin Belousov
Author: kib
Date: Fri Oct 28 11:46:15 2016
New Revision: 308027
URL: https://svnweb.freebsd.org/changeset/base/308027

Log:
  Use buffer pager for msdosfs.
  
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/fs/msdosfs/msdosfs_vnops.c

Modified: head/sys/fs/msdosfs/msdosfs_vnops.c
==
--- head/sys/fs/msdosfs/msdosfs_vnops.c Fri Oct 28 11:43:59 2016
(r308026)
+++ head/sys/fs/msdosfs/msdosfs_vnops.c Fri Oct 28 11:46:15 2016
(r308027)
@@ -62,11 +62,13 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -97,6 +99,7 @@ static vop_rmdir_tmsdosfs_rmdir;
 static vop_symlink_t   msdosfs_symlink;
 static vop_readdir_t   msdosfs_readdir;
 static vop_bmap_t  msdosfs_bmap;
+static vop_getpages_t  msdosfs_getpages;
 static vop_strategy_t  msdosfs_strategy;
 static vop_print_t msdosfs_print;
 static vop_pathconf_t  msdosfs_pathconf;
@@ -1798,6 +1801,38 @@ msdosfs_bmap(struct vop_bmap_args *ap)
return (0);
 }
 
+SYSCTL_NODE(_vfs, OID_AUTO, msdosfs, CTLFLAG_RW, 0, "msdos filesystem");
+static int use_buf_pager = 1;
+SYSCTL_INT(_vfs_msdosfs, OID_AUTO, use_buf_pager, CTLFLAG_RWTUN,
+_buf_pager, 0,
+"Use buffer pager instead of bmap");
+
+static daddr_t
+msdosfs_gbp_getblkno(struct vnode *vp, vm_ooffset_t off)
+{
+
+   return (de_cluster(VTODE(vp)->de_pmp, off));
+}
+
+static int
+msdosfs_gbp_getblksz(struct vnode *vp, daddr_t lbn)
+{
+
+   return (VTODE(vp)->de_pmp->pm_bpcluster);
+}
+
+static int
+msdosfs_getpages(struct vop_getpages_args *ap)
+{
+
+   if (use_buf_pager)
+   return (vfs_bio_getpages(ap->a_vp, ap->a_m, ap->a_count,
+   ap->a_rbehind, ap->a_rahead, msdosfs_gbp_getblkno,
+   msdosfs_gbp_getblksz));
+   return (vnode_pager_generic_getpages(ap->a_vp, ap->a_m, ap->a_count,
+   ap->a_rbehind, ap->a_rahead, NULL, NULL));
+}
+
 static int
 msdosfs_strategy(struct vop_strategy_args *ap)
 {
@@ -1898,6 +1933,7 @@ struct vop_vector msdosfs_vnodeops = {
 
.vop_access =   msdosfs_access,
.vop_bmap = msdosfs_bmap,
+   .vop_getpages = msdosfs_getpages,
.vop_cachedlookup = msdosfs_lookup,
.vop_open = msdosfs_open,
.vop_close =msdosfs_close,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308026 - in head/sys: kern sys ufs/ffs

2016-10-28 Thread Konstantin Belousov
Author: kib
Date: Fri Oct 28 11:43:59 2016
New Revision: 308026
URL: https://svnweb.freebsd.org/changeset/base/308026

Log:
  Generalize UFS buffer pager to allow it serving other filesystems
  which also use buffer cache.
  
  Most important addition to the code is the handling of filesystems
  where the block size is less than the machine page size, which might
  require reading several buffers to validate single page.
  
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/kern/vfs_bio.c
  head/sys/sys/buf.h
  head/sys/ufs/ffs/ffs_vnops.c

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Fri Oct 28 11:35:06 2016(r308025)
+++ head/sys/kern/vfs_bio.c Fri Oct 28 11:43:59 2016(r308026)
@@ -75,9 +75,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -4636,6 +4637,161 @@ bdata2bio(struct buf *bp, struct bio *bi
}
 }
 
+static int buf_pager_relbuf;
+SYSCTL_INT(_vfs, OID_AUTO, buf_pager_relbuf, CTLFLAG_RWTUN,
+_pager_relbuf, 0,
+"Make buffer pager release buffers after reading");
+
+/*
+ * The buffer pager.  It uses buffer reads to validate pages.
+ *
+ * In contrast to the generic local pager from vm/vnode_pager.c, this
+ * pager correctly and easily handles volumes where the underlying
+ * device block size is greater than the machine page size.  The
+ * buffer cache transparently extends the requested page run to be
+ * aligned at the block boundary, and does the necessary bogus page
+ * replacements in the addends to avoid obliterating already valid
+ * pages.
+ *
+ * The only non-trivial issue is that the exclusive busy state for
+ * pages, which is assumed by the vm_pager_getpages() interface, is
+ * incompatible with the VMIO buffer cache's desire to share-busy the
+ * pages.  This function performs a trivial downgrade of the pages'
+ * state before reading buffers, and a less trivial upgrade from the
+ * shared-busy to excl-busy state after the read.
+ */
+int
+vfs_bio_getpages(struct vnode *vp, vm_page_t *ma, int count,
+int *rbehind, int *rahead, vbg_get_lblkno_t get_lblkno,
+vbg_get_blksize_t get_blksize)
+{
+   vm_page_t m;
+   vm_object_t object;
+   struct buf *bp;
+   daddr_t lbn, lbnp;
+   vm_ooffset_t la, lb, poff, poffe;
+   long bsize;
+   int bo_bs, error, i;
+   bool redo, lpart;
+
+   object = vp->v_object;
+   la = IDX_TO_OFF(ma[count - 1]->pindex);
+   if (la >= object->un_pager.vnp.vnp_size)
+   return (VM_PAGER_BAD);
+   lpart = la + PAGE_SIZE > object->un_pager.vnp.vnp_size;
+   bo_bs = get_blksize(vp, get_lblkno(vp, IDX_TO_OFF(ma[0]->pindex)));
+   if (rbehind != NULL) {
+   lb = IDX_TO_OFF(ma[0]->pindex);
+   *rbehind = OFF_TO_IDX(lb - rounddown2(lb, bo_bs));
+   }
+   if (rahead != NULL) {
+   *rahead = OFF_TO_IDX(roundup2(la, bo_bs) - la);
+   if (la + IDX_TO_OFF(*rahead) >= object->un_pager.vnp.vnp_size) {
+   *rahead = OFF_TO_IDX(roundup2(object->un_pager.
+   vnp.vnp_size, PAGE_SIZE) - la);
+   }
+   }
+   VM_OBJECT_WLOCK(object);
+again:
+   for (i = 0; i < count; i++)
+   vm_page_busy_downgrade(ma[i]);
+   VM_OBJECT_WUNLOCK(object);
+
+   lbnp = -1;
+   for (i = 0; i < count; i++) {
+   m = ma[i];
+
+   /*
+* Pages are shared busy and the object lock is not
+* owned, which together allow for the pages'
+* invalidation.  The racy test for validity avoids
+* useless creation of the buffer for the most typical
+* case when invalidation is not used in redo or for
+* parallel read.  The shared->excl upgrade loop at
+* the end of the function catches the race in a
+* reliable way (protected by the object lock).
+*/
+   if (m->valid == VM_PAGE_BITS_ALL)
+   continue;
+
+   poff = IDX_TO_OFF(m->pindex);
+   poffe = MIN(poff + PAGE_SIZE, object->un_pager.vnp.vnp_size);
+   for (; poff < poffe; poff += bsize) {
+   lbn = get_lblkno(vp, poff);
+   if (lbn == lbnp)
+   goto next_page;
+   lbnp = lbn;
+
+   bsize = get_blksize(vp, lbn);
+   error = bread_gb(vp, lbn, bsize, NOCRED, GB_UNMAPPED,
+   );
+   if (error != 0)
+   goto end_pages;
+   if (LIST_EMPTY(>b_dep)) {
+   /*
+  

svn commit: r308025 - head/sys/fs/msdosfs

2016-10-28 Thread Konstantin Belousov
Author: kib
Date: Fri Oct 28 11:35:06 2016
New Revision: 308025
URL: https://svnweb.freebsd.org/changeset/base/308025

Log:
  Enable vn_io_fault() deadlock avoidance for msdosfs.
  
  Reported and tested by:   pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/fs/msdosfs/msdosfs_vfsops.c
  head/sys/fs/msdosfs/msdosfs_vnops.c

Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c
==
--- head/sys/fs/msdosfs/msdosfs_vfsops.cFri Oct 28 11:34:32 2016
(r308024)
+++ head/sys/fs/msdosfs/msdosfs_vfsops.cFri Oct 28 11:35:06 2016
(r308025)
@@ -742,7 +742,7 @@ mountmsdosfs(struct vnode *devvp, struct
mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum;
MNT_ILOCK(mp);
mp->mnt_flag |= MNT_LOCAL;
-   mp->mnt_kern_flag |= MNTK_USES_BCACHE;
+   mp->mnt_kern_flag |= MNTK_USES_BCACHE | MNTK_NO_IOPF;
MNT_IUNLOCK(mp);
 
if (pmp->pm_flags & MSDOSFS_LARGEFS)

Modified: head/sys/fs/msdosfs/msdosfs_vnops.c
==
--- head/sys/fs/msdosfs/msdosfs_vnops.c Fri Oct 28 11:34:32 2016
(r308024)
+++ head/sys/fs/msdosfs/msdosfs_vnops.c Fri Oct 28 11:35:06 2016
(r308025)
@@ -593,7 +593,7 @@ msdosfs_read(struct vop_read_args *ap)
diff = blsize - bp->b_resid;
if (diff < n)
n = diff;
-   error = uiomove(bp->b_data + on, (int) n, uio);
+   error = vn_io_fault_uiomove(bp->b_data + on, (int) n, uio);
brelse(bp);
} while (error == 0 && uio->uio_resid > 0 && n != 0);
if (!isadir && (error == 0 || uio->uio_resid != orig_resid) &&
@@ -723,6 +723,12 @@ msdosfs_write(struct vop_write_args *ap)
 * then no need to read data from disk.
 */
bp = getblk(thisvp, bn, pmp->pm_bpcluster, 0, 0, 0);
+   /*
+* This call to vfs_bio_clrbuf() ensures that
+* even if vn_io_fault_uiomove() below faults,
+* garbage from the newly instantiated buffer
+* is not exposed to the userspace via mmap().
+*/
vfs_bio_clrbuf(bp);
/*
 * Do the bmap now, since pcbmap needs buffers
@@ -760,7 +766,7 @@ msdosfs_write(struct vop_write_args *ap)
/*
 * Copy the data from user space into the buf header.
 */
-   error = uiomove(bp->b_data + croffset, n, uio);
+   error = vn_io_fault_uiomove(bp->b_data + croffset, n, uio);
if (error) {
brelse(bp);
break;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308024 - head/sys/fs/msdosfs

2016-10-28 Thread Konstantin Belousov
Author: kib
Date: Fri Oct 28 11:34:32 2016
New Revision: 308024
URL: https://svnweb.freebsd.org/changeset/base/308024

Log:
  Ensure that cluster allocations never allocate clusters outside the
  volume limits.  In particular:
  - Assert that usemap_alloc() and usemap_free() cluster number argument
is valid.
  - In chainlength(), return 0 if cluster start is after the max cluster.
  - In chainlength(), cut the calculated cluster chain length at the max
cluster.
  - For true paranoia, after the pm_inusemap is calculated in
fillinusemap(), reset all bits in the array for clusters after the
max cluster, as in-use.
  
  Reported and tested by:   pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/fs/msdosfs/msdosfs_fat.c

Modified: head/sys/fs/msdosfs/msdosfs_fat.c
==
--- head/sys/fs/msdosfs/msdosfs_fat.c   Fri Oct 28 11:26:44 2016
(r308023)
+++ head/sys/fs/msdosfs/msdosfs_fat.c   Fri Oct 28 11:34:32 2016
(r308024)
@@ -382,6 +382,8 @@ usemap_alloc(struct msdosfsmount *pmp, u
 
MSDOSFS_ASSERT_MP_LOCKED(pmp);
 
+   KASSERT(cn <= pmp->pm_maxcluster, ("cn too large %lu %lu", cn,
+   pmp->pm_maxcluster));
KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0,
("usemap_alloc on ro msdosfs mount"));
KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS)))
@@ -398,6 +400,9 @@ usemap_free(struct msdosfsmount *pmp, u_
 {
 
MSDOSFS_ASSERT_MP_LOCKED(pmp);
+
+   KASSERT(cn <= pmp->pm_maxcluster, ("cn too large %lu %lu", cn,
+   pmp->pm_maxcluster));
KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0,
("usemap_free on ro msdosfs mount"));
pmp->pm_freeclustercount++;
@@ -637,6 +642,8 @@ chainlength(struct msdosfsmount *pmp, u_
 
MSDOSFS_ASSERT_MP_LOCKED(pmp);
 
+   if (start > pmp->pm_maxcluster)
+   return (0);
max_idx = pmp->pm_maxcluster / N_INUSEBITS;
idx = start / N_INUSEBITS;
start %= N_INUSEBITS;
@@ -644,11 +651,18 @@ chainlength(struct msdosfsmount *pmp, u_
map &= ~((1 << start) - 1);
if (map) {
len = ffs(map) - 1 - start;
-   return (len > count ? count : len);
+   len = MIN(len, count);
+   if (start + len > pmp->pm_maxcluster)
+   len = pmp->pm_maxcluster - start + 1;
+   return (len);
}
len = N_INUSEBITS - start;
-   if (len >= count)
-   return (count);
+   if (len >= count) {
+   len = count;
+   if (start + len > pmp->pm_maxcluster)
+   len = pmp->pm_maxcluster - start + 1;
+   return (len);
+   }
while (++idx <= max_idx) {
if (len >= count)
break;
@@ -659,7 +673,10 @@ chainlength(struct msdosfsmount *pmp, u_
}
len += N_INUSEBITS;
}
-   return (len > count ? count : len);
+   len = MIN(len, count);
+   if (start + len > pmp->pm_maxcluster)
+   len = pmp->pm_maxcluster - start + 1;
+   return (len);
 }
 
 /*
@@ -918,6 +935,11 @@ fillinusemap(struct msdosfsmount *pmp)
}
if (bp != NULL)
brelse(bp);
+
+   for (cn = pmp->pm_maxcluster + 1; cn < (pmp->pm_maxcluster +
+   N_INUSEBITS) / N_INUSEBITS; cn++)
+   pmp->pm_inusemap[cn / N_INUSEBITS] |= 1 << (cn % N_INUSEBITS);
+
return (0);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308023 - head/sys/fs/msdosfs

2016-10-28 Thread Konstantin Belousov
Author: kib
Date: Fri Oct 28 11:26:44 2016
New Revision: 308023
URL: https://svnweb.freebsd.org/changeset/base/308023

Log:
  If the fatchain() call in chainalloc() returned an error, revert
  marking the cluster run as in-use.
  
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/fs/msdosfs/msdosfs_fat.c

Modified: head/sys/fs/msdosfs/msdosfs_fat.c
==
--- head/sys/fs/msdosfs/msdosfs_fat.c   Fri Oct 28 11:23:36 2016
(r308022)
+++ head/sys/fs/msdosfs/msdosfs_fat.c   Fri Oct 28 11:26:44 2016
(r308023)
@@ -691,8 +691,11 @@ chainalloc(struct msdosfsmount *pmp, u_l
pmp->pm_nxtfree = CLUST_FIRST;
pmp->pm_flags |= MSDOSFS_FSIMOD;
error = fatchain(pmp, start, count, fillwith);
-   if (error != 0)
+   if (error != 0) {
+   for (cl = start, n = count; n-- > 0;)
+   usemap_free(pmp, cl++);
return (error);
+   }
 #ifdef MSDOSFS_DEBUG
printf("clusteralloc(): allocated cluster chain at %lu (%lu 
clusters)\n",
start, count);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308022 - head/sys/fs/msdosfs

2016-10-28 Thread Konstantin Belousov
Author: kib
Date: Fri Oct 28 11:23:36 2016
New Revision: 308022
URL: https://svnweb.freebsd.org/changeset/base/308022

Log:
  Use symbolic name for the value of fully free word in pm_inusemap.
  Explicitely mention every bit in the value.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/fs/msdosfs/msdosfs_fat.c

Modified: head/sys/fs/msdosfs/msdosfs_fat.c
==
--- head/sys/fs/msdosfs/msdosfs_fat.c   Fri Oct 28 11:01:49 2016
(r308021)
+++ head/sys/fs/msdosfs/msdosfs_fat.c   Fri Oct 28 11:23:36 2016
(r308022)
@@ -60,6 +60,8 @@
 #include 
 #include 
 
+#defineFULL_RUN((u_int)0x)
+
 static int chainalloc(struct msdosfsmount *pmp, u_long start,
u_long count, u_long fillwith, u_long *retcluster,
u_long *got);
@@ -752,8 +754,8 @@ clusteralloc1(struct msdosfsmount *pmp, 
idx = cn / N_INUSEBITS;
map = pmp->pm_inusemap[idx];
map |= (1 << (cn % N_INUSEBITS)) - 1;
-   if (map != (u_int)-1) {
-   cn = idx * N_INUSEBITS + ffs(map^(u_int)-1) - 1;
+   if (map != FULL_RUN) {
+   cn = idx * N_INUSEBITS + ffs(map ^ FULL_RUN) - 1;
if ((l = chainlength(pmp, cn, count)) >= count)
return (chainalloc(pmp, cn, count, fillwith, 
retcluster, got));
if (l > foundl) {
@@ -769,8 +771,8 @@ clusteralloc1(struct msdosfsmount *pmp, 
idx = cn / N_INUSEBITS;
map = pmp->pm_inusemap[idx];
map |= (1 << (cn % N_INUSEBITS)) - 1;
-   if (map != (u_int)-1) {
-   cn = idx * N_INUSEBITS + ffs(map^(u_int)-1) - 1;
+   if (map != FULL_RUN) {
+   cn = idx * N_INUSEBITS + ffs(map ^ FULL_RUN) - 1;
if ((l = chainlength(pmp, cn, count)) >= count)
return (chainalloc(pmp, cn, count, fillwith, 
retcluster, got));
if (l > foundl) {
@@ -878,7 +880,7 @@ fillinusemap(struct msdosfsmount *pmp)
 * loop further down.
 */
for (cn = 0; cn < (pmp->pm_maxcluster + N_INUSEBITS) / N_INUSEBITS; 
cn++)
-   pmp->pm_inusemap[cn] = (u_int)-1;
+   pmp->pm_inusemap[cn] = FULL_RUN;
 
/*
 * Figure how many free clusters are in the filesystem by ripping
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308021 - head/sys/fs/msdosfs

2016-10-28 Thread Konstantin Belousov
Author: kib
Date: Fri Oct 28 11:01:49 2016
New Revision: 308021
URL: https://svnweb.freebsd.org/changeset/base/308021

Log:
  Use symbolic name for the free cluster number.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/fs/msdosfs/msdosfs_fat.c

Modified: head/sys/fs/msdosfs/msdosfs_fat.c
==
--- head/sys/fs/msdosfs/msdosfs_fat.c   Fri Oct 28 10:59:34 2016
(r308020)
+++ head/sys/fs/msdosfs/msdosfs_fat.c   Fri Oct 28 11:01:49 2016
(r308021)
@@ -908,7 +908,7 @@ fillinusemap(struct msdosfsmount *pmp)
readcn >>= 4;
readcn &= pmp->pm_fatmask;
 
-   if (readcn == 0)
+   if (readcn == CLUST_FREE)
usemap_free(pmp, cn);
}
if (bp != NULL)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308020 - head/sys/fs/msdosfs

2016-10-28 Thread Konstantin Belousov
Author: kib
Date: Fri Oct 28 10:59:34 2016
New Revision: 308020
URL: https://svnweb.freebsd.org/changeset/base/308020

Log:
  Fix comment formatting.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/fs/msdosfs/msdosfs_fat.c

Modified: head/sys/fs/msdosfs/msdosfs_fat.c
==
--- head/sys/fs/msdosfs/msdosfs_fat.c   Fri Oct 28 10:57:41 2016
(r308019)
+++ head/sys/fs/msdosfs/msdosfs_fat.c   Fri Oct 28 10:59:34 2016
(r308020)
@@ -972,12 +972,14 @@ extendfile(struct denode *dep, u_long co
while (count > 0) {
/*
 * Allocate a new cluster chain and cat onto the end of the
-* file.  * If the file is empty we make de_StartCluster point
-* to the new block.  Note that de_StartCluster being 0 is
-* sufficient to be sure the file is empty since we exclude
-* attempts to extend the root directory above, and the root
-* dir is the only file with a startcluster of 0 that has
-* blocks allocated (sort of).
+* file.
+* If the file is empty we make de_StartCluster point
+* to the new block.  Note that de_StartCluster being
+* 0 is sufficient to be sure the file is empty since
+* we exclude attempts to extend the root directory
+* above, and the root dir is the only file with a
+* startcluster of 0 that has blocks allocated (sort
+* of).
 */
if (dep->de_StartCluster == 0)
cn = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308019 - head/sys/fs/msdosfs

2016-10-28 Thread Konstantin Belousov
Author: kib
Date: Fri Oct 28 10:57:41 2016
New Revision: 308019
URL: https://svnweb.freebsd.org/changeset/base/308019

Log:
  Remove useless NULL check.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/fs/msdosfs/msdosfs_vfsops.c

Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c
==
--- head/sys/fs/msdosfs/msdosfs_vfsops.cFri Oct 28 08:53:18 2016
(r308018)
+++ head/sys/fs/msdosfs/msdosfs_vfsops.cFri Oct 28 10:57:41 2016
(r308019)
@@ -760,8 +760,7 @@ error_exit:
}
if (pmp) {
lockdestroy(>pm_fatlock);
-   if (pmp->pm_inusemap)
-   free(pmp->pm_inusemap, M_MSDOSFSFAT);
+   free(pmp->pm_inusemap, M_MSDOSFSFAT);
free(pmp, M_MSDOSFSMNT);
mp->mnt_data = NULL;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308018 - head/sys/dev/hyperv/netvsc

2016-10-28 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Oct 28 08:53:18 2016
New Revision: 308018
URL: https://svnweb.freebsd.org/changeset/base/308018

Log:
  hyeprv/hn: Rename cleaned up RNDIS header file.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8360

Added:
  head/sys/dev/hyperv/netvsc/hn_rndis.h
 - copied unchanged from r308017, 
head/sys/dev/hyperv/netvsc/hv_rndis_filter.h
Deleted:
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.h
Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c

Copied: head/sys/dev/hyperv/netvsc/hn_rndis.h (from r308017, 
head/sys/dev/hyperv/netvsc/hv_rndis_filter.h)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/hyperv/netvsc/hn_rndis.h   Fri Oct 28 08:53:18 2016
(r308018, copy of r308017, head/sys/dev/hyperv/netvsc/hv_rndis_filter.h)
@@ -0,0 +1,49 @@
+/*-
+ * Copyright (c) 2009-2012,2016 Microsoft Corp.
+ * Copyright (c) 2010-2012 Citrix Inc.
+ * Copyright (c) 2012 NetApp Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice unmodified, this list of conditions, and the following
+ *disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _HN_RNDIS_H_
+#define _HN_RNDIS_H_
+
+struct hn_softc;
+
+inthn_rndis_attach(struct hn_softc *sc, int mtu);
+void   hn_rndis_detach(struct hn_softc *sc);
+inthn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags);
+inthn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_cnt);
+inthn_rndis_get_eaddr(struct hn_softc *sc, uint8_t *eaddr);
+/* link_status: NDIS_MEDIA_STATE_ */
+inthn_rndis_get_linkstatus(struct hn_softc *sc,
+   uint32_t *link_status);
+/* filter: NDIS_PACKET_TYPE_. */
+inthn_rndis_set_rxfilter(struct hn_softc *sc, uint32_t filter);
+void   hn_rndis_rx_ctrl(struct hn_softc *sc, const void *data,
+   int dlen);
+
+#endif  /* !_HN_RNDIS_H_ */

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Oct 28 08:41:30 
2016(r308017)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Oct 28 08:53:18 
2016(r308018)
@@ -125,7 +125,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include "vmbus_if.h"
 

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.cFri Oct 28 08:41:30 
2016(r308017)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.cFri Oct 28 08:53:18 
2016(r308018)
@@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #define HN_RNDIS_RID_COMPAT_MASK   0x
 #define HN_RNDIS_RID_COMPAT_MAXHN_RNDIS_RID_COMPAT_MASK
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308017 - head/sys/dev/hyperv/netvsc

2016-10-28 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Oct 28 08:41:30 2016
New Revision: 308017
URL: https://svnweb.freebsd.org/changeset/base/308017

Log:
  hyperv/hn: Change header guardian; in preparation for the upcoming rename.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8359

Modified:
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.h

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.h
==
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.hFri Oct 28 08:32:54 
2016(r308016)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.hFri Oct 28 08:41:30 
2016(r308017)
@@ -28,8 +28,8 @@
  * $FreeBSD$
  */
 
-#ifndef __HV_RNDIS_FILTER_H__
-#define __HV_RNDIS_FILTER_H__
+#ifndef _HN_RNDIS_H_
+#define _HN_RNDIS_H_
 
 struct hn_softc;
 
@@ -46,4 +46,4 @@ int   hn_rndis_set_rxfilter(struct hn_sof
 void   hn_rndis_rx_ctrl(struct hn_softc *sc, const void *data,
int dlen);
 
-#endif  /* __HV_RNDIS_FILTER_H__ */
+#endif  /* !_HN_RNDIS_H_ */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308016 - head/sys/dev/hyperv/netvsc

2016-10-28 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Oct 28 08:32:54 2016
New Revision: 308016
URL: https://svnweb.freebsd.org/changeset/base/308016

Log:
  hyperv/hn: Cleanup RNDIS related files.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8358

Modified:
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.h
  head/sys/dev/hyperv/netvsc/if_hnvar.h

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.cFri Oct 28 08:18:49 
2016(r308015)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.cFri Oct 28 08:32:54 
2016(r308016)
@@ -29,11 +29,12 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_inet6.h"
+#include "opt_inet.h"
+
 #include 
-#include 
 #include 
-#include 
-#include 
+#include 
 #include 
 
 #include 
@@ -76,19 +77,23 @@ __FBSDID("$FreeBSD$");
 #define HN_NDIS_LSOV2_CAP_IP6  \
(NDIS_LSOV2_CAP_IP6EXT | NDIS_LSOV2_CAP_TCP6OPT)
 
-/*
- * Forward declarations
- */
-static int hn_rndis_query(struct hn_softc *sc, uint32_t oid,
-const void *idata, size_t idlen, void *odata, size_t *odlen0);
-static int hn_rndis_query2(struct hn_softc *sc, uint32_t oid,
-const void *idata, size_t idlen, void *odata, size_t *odlen0,
-size_t min_odlen);
-static int hn_rndis_set(struct hn_softc *sc, uint32_t oid, const void *data,
-size_t dlen);
-static int hn_rndis_conf_offload(struct hn_softc *sc, int mtu);
-static int hn_rndis_query_hwcaps(struct hn_softc *sc,
-struct ndis_offload *caps);
+static const void  *hn_rndis_xact_exec1(struct hn_softc *,
+   struct vmbus_xact *, size_t,
+   struct hn_nvs_sendctx *, size_t *);
+static const void  *hn_rndis_xact_execute(struct hn_softc *,
+   struct vmbus_xact *, uint32_t, size_t, size_t *,
+   uint32_t);
+static int hn_rndis_query(struct hn_softc *, uint32_t,
+   const void *, size_t, void *, size_t *);
+static int hn_rndis_query2(struct hn_softc *, uint32_t,
+   const void *, size_t, void *, size_t *, size_t);
+static int hn_rndis_set(struct hn_softc *, uint32_t,
+   const void *, size_t);
+static int hn_rndis_init(struct hn_softc *);
+static int hn_rndis_halt(struct hn_softc *);
+static int hn_rndis_conf_offload(struct hn_softc *, int);
+static int hn_rndis_query_hwcaps(struct hn_softc *,
+   struct ndis_offload *);
 
 static __inline uint32_t
 hn_rndis_rid(struct hn_softc *sc)

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.h
==
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.hFri Oct 28 08:18:49 
2016(r308015)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.hFri Oct 28 08:32:54 
2016(r308016)
@@ -33,6 +33,16 @@
 
 struct hn_softc;
 
+inthn_rndis_attach(struct hn_softc *sc, int mtu);
+void   hn_rndis_detach(struct hn_softc *sc);
+inthn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags);
+inthn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_cnt);
+inthn_rndis_get_eaddr(struct hn_softc *sc, uint8_t *eaddr);
+/* link_status: NDIS_MEDIA_STATE_ */
+inthn_rndis_get_linkstatus(struct hn_softc *sc,
+   uint32_t *link_status);
+/* filter: NDIS_PACKET_TYPE_. */
+inthn_rndis_set_rxfilter(struct hn_softc *sc, uint32_t filter);
 void   hn_rndis_rx_ctrl(struct hn_softc *sc, const void *data,
int dlen);
 

Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h
==
--- head/sys/dev/hyperv/netvsc/if_hnvar.h   Fri Oct 28 08:18:49 2016
(r308015)
+++ head/sys/dev/hyperv/netvsc/if_hnvar.h   Fri Oct 28 08:32:54 2016
(r308016)
@@ -231,14 +231,4 @@ struct hn_softc {
 #define HN_LINK_FLAG_LINKUP0x0001
 #define HN_LINK_FLAG_NETCHG0x0002
 
-inthn_rndis_attach(struct hn_softc *sc, int mtu);
-void   hn_rndis_detach(struct hn_softc *sc);
-inthn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags);
-inthn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_cnt);
-inthn_rndis_get_eaddr(struct hn_softc *sc, uint8_t *eaddr);
-inthn_rndis_get_linkstatus(struct hn_softc *sc,
-   uint32_t *link_status);
-/* filter: NDIS_PACKET_TYPE_. */
-inthn_rndis_set_rxfilter(struct hn_softc *sc, uint32_t filter);
-
 #endif /* !_IF_HNVAR_H_ */
___
svn-src-all@freebsd.org mailing list

svn commit: r308015 - head/sys/dev/hyperv/netvsc

2016-10-28 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Oct 28 08:18:49 2016
New Revision: 308015
URL: https://svnweb.freebsd.org/changeset/base/308015

Log:
  hyperv/hn: Pull data path code up.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8357

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  head/sys/dev/hyperv/netvsc/if_hnvar.h

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Oct 28 08:08:46 
2016(r308014)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Oct 28 08:18:49 
2016(r308015)
@@ -1244,6 +1244,42 @@ hn_rndis_pktmsg_offset(uint32_t ofs)
return (ofs - __offsetof(struct rndis_packet_msg, rm_dataoffset));
 }
 
+static __inline void *
+hn_rndis_pktinfo_append(struct rndis_packet_msg *pkt, size_t pktsize,
+size_t pi_dlen, uint32_t pi_type)
+{
+   const size_t pi_size = HN_RNDIS_PKTINFO_SIZE(pi_dlen);
+   struct rndis_pktinfo *pi;
+
+   KASSERT((pi_size & RNDIS_PACKET_MSG_OFFSET_ALIGNMASK) == 0,
+   ("unaligned pktinfo size %zu, pktinfo dlen %zu", pi_size, pi_dlen));
+
+   /*
+* Per-packet-info does not move; it only grows.
+*
+* NOTE:
+* rm_pktinfooffset in this phase counts from the beginning
+* of rndis_packet_msg.
+*/
+   KASSERT(pkt->rm_pktinfooffset + pkt->rm_pktinfolen + pi_size <= pktsize,
+   ("%u pktinfo overflows RNDIS packet msg", pi_type));
+   pi = (struct rndis_pktinfo *)((uint8_t *)pkt + pkt->rm_pktinfooffset +
+   pkt->rm_pktinfolen);
+   pkt->rm_pktinfolen += pi_size;
+
+   pi->rm_size = pi_size;
+   pi->rm_type = pi_type;
+   pi->rm_pktinfooffset = RNDIS_PKTINFO_OFFSET;
+
+   /* Data immediately follow per-packet-info. */
+   pkt->rm_dataoffset += pi_size;
+
+   /* Update RNDIS packet msg length */
+   pkt->rm_len += pi_size;
+
+   return (pi->rm_data);
+}
+
 /*
  * NOTE:
  * If this function fails, then both txd and m_head0 will be freed.

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.cFri Oct 28 08:08:46 
2016(r308014)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.cFri Oct 28 08:18:49 
2016(r308015)
@@ -104,42 +104,6 @@ again:
return ((rid & 0x) << 16);
 }
 
-void *
-hn_rndis_pktinfo_append(struct rndis_packet_msg *pkt, size_t pktsize,
-size_t pi_dlen, uint32_t pi_type)
-{
-   const size_t pi_size = HN_RNDIS_PKTINFO_SIZE(pi_dlen);
-   struct rndis_pktinfo *pi;
-
-   KASSERT((pi_size & RNDIS_PACKET_MSG_OFFSET_ALIGNMASK) == 0,
-   ("unaligned pktinfo size %zu, pktinfo dlen %zu", pi_size, pi_dlen));
-
-   /*
-* Per-packet-info does not move; it only grows.
-*
-* NOTE:
-* rm_pktinfooffset in this phase counts from the beginning
-* of rndis_packet_msg.
-*/
-   KASSERT(pkt->rm_pktinfooffset + pkt->rm_pktinfolen + pi_size <= pktsize,
-   ("%u pktinfo overflows RNDIS packet msg", pi_type));
-   pi = (struct rndis_pktinfo *)((uint8_t *)pkt + pkt->rm_pktinfooffset +
-   pkt->rm_pktinfolen);
-   pkt->rm_pktinfolen += pi_size;
-
-   pi->rm_size = pi_size;
-   pi->rm_type = pi_type;
-   pi->rm_pktinfooffset = RNDIS_PKTINFO_OFFSET;
-
-   /* Data immediately follow per-packet-info. */
-   pkt->rm_dataoffset += pi_size;
-
-   /* Update RNDIS packet msg length */
-   pkt->rm_len += pi_size;
-
-   return (pi->rm_data);
-}
-
 void
 hn_rndis_rx_ctrl(struct hn_softc *sc, const void *data, int dlen)
 {

Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h
==
--- head/sys/dev/hyperv/netvsc/if_hnvar.h   Fri Oct 28 08:08:46 2016
(r308014)
+++ head/sys/dev/hyperv/netvsc/if_hnvar.h   Fri Oct 28 08:18:49 2016
(r308015)
@@ -231,13 +231,9 @@ struct hn_softc {
 #define HN_LINK_FLAG_LINKUP0x0001
 #define HN_LINK_FLAG_NETCHG0x0002
 
-struct rndis_packet_msg;
-
 inthn_rndis_attach(struct hn_softc *sc, int mtu);
 void   hn_rndis_detach(struct hn_softc *sc);
 inthn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags);
-void   *hn_rndis_pktinfo_append(struct rndis_packet_msg *,
-   size_t pktsize, size_t pi_dlen, uint32_t pi_type);
 inthn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_cnt);
 inthn_rndis_get_eaddr(struct hn_softc *sc, uint8_t *eaddr);
 inthn_rndis_get_linkstatus(struct hn_softc *sc,
___
svn-src-all@freebsd.org mailing list

svn commit: r308014 - head/sys/dev/hyperv/netvsc

2016-10-28 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Oct 28 08:08:46 2016
New Revision: 308014
URL: https://svnweb.freebsd.org/changeset/base/308014

Log:
  hyperv/hn: Reorganize RX path; mainly pull non-control code path up
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8356

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.h
  head/sys/dev/hyperv/netvsc/if_hnvar.h

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Oct 28 07:59:02 
2016(r308013)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Oct 28 08:08:46 
2016(r308014)
@@ -166,6 +166,16 @@ __FBSDID("$FreeBSD$");
 
 #define HN_EARLY_TXEOF_THRESH  8
 
+#define HN_RXINFO_VLAN 0x0001
+#define HN_RXINFO_CSUM 0x0002
+#define HN_RXINFO_HASHINF  0x0004
+#define HN_RXINFO_HASHVAL  0x0008
+#define HN_RXINFO_ALL  \
+   (HN_RXINFO_VLAN |   \
+HN_RXINFO_CSUM |   \
+HN_RXINFO_HASHINF |\
+HN_RXINFO_HASHVAL)
+
 struct hn_txdesc {
 #ifndef HN_USE_TXDESC_BUFRING
SLIST_ENTRY(hn_txdesc) link;
@@ -188,6 +198,17 @@ struct hn_txdesc {
 #define HN_TXD_FLAG_ONLIST 0x1
 #define HN_TXD_FLAG_DMAMAP 0x2
 
+#define HN_NDIS_VLAN_INFO_INVALID  0x
+#define HN_NDIS_RXCSUM_INFO_INVALID0
+#define HN_NDIS_HASH_INFO_INVALID  0
+
+struct hn_rxinfo {
+   uint32_tvlan_info;
+   uint32_tcsum_info;
+   uint32_thash_info;
+   uint32_thash_value;
+};
+
 #define HN_LRO_LENLIM_MULTIRX_DEF  (12 * ETHERMTU)
 #define HN_LRO_LENLIM_DEF  (25 * ETHERMTU)
 /* YYY 2*MTU is a bit rough, but should be good enough. */
@@ -377,12 +398,18 @@ static void hn_link_status(struct hn_sof
 static int hn_sendpkt_rndis_sglist(struct hn_tx_ring *, struct hn_txdesc *);
 static int hn_sendpkt_rndis_chim(struct hn_tx_ring *, struct hn_txdesc *);
 static int hn_set_rxfilter(struct hn_softc *);
+static void hn_link_status_update(struct hn_softc *);
+static void hn_network_change(struct hn_softc *);
+
+static int hn_rndis_rxinfo(const void *, int, struct hn_rxinfo *);
+static void hn_rndis_rx_data(struct hn_rx_ring *, const void *, int);
+static void hn_rndis_rx_status(struct hn_softc *, const void *, int);
 
 static void hn_nvs_handle_notify(struct hn_softc *sc,
const struct vmbus_chanpkt_hdr *pkt);
 static void hn_nvs_handle_comp(struct hn_softc *sc, struct vmbus_channel *chan,
const struct vmbus_chanpkt_hdr *pkt);
-static void hn_nvs_handle_rxbuf(struct hn_softc *sc, struct hn_rx_ring *rxr,
+static void hn_nvs_handle_rxbuf(struct hn_rx_ring *rxr,
struct vmbus_channel *chan,
const struct vmbus_chanpkt_hdr *pkthdr);
 static void hn_nvs_ack_rxbuf(struct vmbus_channel *chan, uint64_t tid);
@@ -1006,7 +1033,7 @@ hn_netchg_status_taskfunc(void *xsc, int
hn_link_status(sc);
 }
 
-void
+static void
 hn_link_status_update(struct hn_softc *sc)
 {
 
@@ -1014,7 +1041,7 @@ hn_link_status_update(struct hn_softc *s
taskqueue_enqueue(sc->hn_mgmt_taskq, >hn_link_task);
 }
 
-void
+static void
 hn_network_change(struct hn_softc *sc)
 {
 
@@ -1615,15 +1642,9 @@ hn_lro_rx(struct lro_ctrl *lc, struct mb
 }
 #endif
 
-/*
- * Called when we receive a data packet from the "wire" on the
- * specified device
- *
- * Note:  This is no longer used as a callback
- */
-int
+static int
 hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen,
-const struct hn_recvinfo *info)
+const struct hn_rxinfo *info)
 {
struct ifnet *ifp = rxr->hn_ifp;
struct mbuf *m_new;
@@ -4025,6 +4046,325 @@ hn_resume(struct hn_softc *sc)
hn_resume_mgmt(sc);
 }
 
+static void 
+hn_rndis_rx_status(struct hn_softc *sc, const void *data, int dlen)
+{
+   const struct rndis_status_msg *msg;
+   int ofs;
+
+   if (dlen < sizeof(*msg)) {
+   if_printf(sc->hn_ifp, "invalid RNDIS status\n");
+   return;
+   }
+   msg = data;
+
+   switch (msg->rm_status) {
+   case RNDIS_STATUS_MEDIA_CONNECT:
+   case RNDIS_STATUS_MEDIA_DISCONNECT:
+   hn_link_status_update(sc);
+   break;
+
+   case RNDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG:
+   /* Not really useful; ignore. */
+   break;
+
+   case RNDIS_STATUS_NETWORK_CHANGE:
+   ofs = RNDIS_STBUFOFFSET_ABS(msg->rm_stbufoffset);
+   if (dlen < ofs + msg->rm_stbuflen ||
+   msg->rm_stbuflen < sizeof(uint32_t)) {
+   if_printf(sc->hn_ifp, 

svn commit: r308013 - head/sys/dev/hyperv/netvsc

2016-10-28 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Oct 28 07:59:02 2016
New Revision: 308013
URL: https://svnweb.freebsd.org/changeset/base/308013

Log:
  hyperv/hn: Nuke unnecessary indirection.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8355

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.h
  head/sys/dev/hyperv/netvsc/if_hnvar.h

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Oct 28 07:48:17 
2016(r308012)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Oct 28 07:59:02 
2016(r308013)
@@ -358,6 +358,7 @@ static void hn_chan_detach(struct hn_sof
 static int hn_attach_subchans(struct hn_softc *);
 static void hn_detach_allchans(struct hn_softc *);
 static void hn_chan_callback(struct vmbus_channel *chan, void *xrxr);
+static void hn_chan_rollup(struct hn_rx_ring *, struct hn_tx_ring *);
 static void hn_set_ring_inuse(struct hn_softc *, int);
 static int hn_synth_attach(struct hn_softc *, int);
 static void hn_synth_detach(struct hn_softc *);
@@ -1188,7 +1189,7 @@ hn_tx_done(struct hn_nvs_sendctx *sndc, 
}
 }
 
-void
+static void
 hn_chan_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr)
 {
 #if defined(INET) || defined(INET6)
@@ -4213,7 +4214,7 @@ hn_chan_callback(struct vmbus_channel *c
if (bufferlen > HN_PKTBUF_LEN)
free(buffer, M_DEVBUF);
 
-   hv_rf_channel_rollup(rxr, rxr->hn_txr);
+   hn_chan_rollup(rxr, rxr->hn_txr);
 }
 
 static void

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.cFri Oct 28 07:48:17 
2016(r308012)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.cFri Oct 28 07:59:02 
2016(r308013)
@@ -1352,10 +1352,3 @@ hn_rndis_detach(struct hn_softc *sc)
/* Halt the RNDIS. */
hn_rndis_halt(sc);
 }
-
-void
-hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr)
-{
-
-   hn_chan_rollup(rxr, txr);
-}

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.h
==
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.hFri Oct 28 07:48:17 
2016(r308012)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.hFri Oct 28 07:59:02 
2016(r308013)
@@ -42,7 +42,5 @@ struct hn_rx_ring;
 
 void hv_rf_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr,
 const void *data, int dlen);
-void hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr);
 
 #endif  /* __HV_RNDIS_FILTER_H__ */
-

Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h
==
--- head/sys/dev/hyperv/netvsc/if_hnvar.h   Fri Oct 28 07:48:17 2016
(r308012)
+++ head/sys/dev/hyperv/netvsc/if_hnvar.h   Fri Oct 28 07:59:02 2016
(r308013)
@@ -258,7 +258,6 @@ int hn_rndis_set_rxfilter(struct hn_sof
 
 inthn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen,
const struct hn_recvinfo *info);
-void   hn_chan_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr);
 void   hn_link_status_update(struct hn_softc *sc);
 void   hn_network_change(struct hn_softc *sc);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308012 - in head/sys: conf dev/hyperv/netvsc modules/hyperv/netvsc

2016-10-28 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Oct 28 07:48:17 2016
New Revision: 308012
URL: https://svnweb.freebsd.org/changeset/base/308012

Log:
  hyperv/hn: Rename cleaned up NVS source file.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8354

Added:
  head/sys/dev/hyperv/netvsc/hn_nvs.c
 - copied unchanged from r308011, head/sys/dev/hyperv/netvsc/hv_net_vsc.c
Deleted:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.c
Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/modules/hyperv/netvsc/Makefile

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Fri Oct 28 05:56:23 2016(r308011)
+++ head/sys/conf/files.amd64   Fri Oct 28 07:48:17 2016(r308012)
@@ -291,7 +291,7 @@ dev/hwpmc/hwpmc_uncore.coptionalhwpmc
 dev/hwpmc/hwpmc_piv.c  optionalhwpmc
 dev/hwpmc/hwpmc_tsc.c  optionalhwpmc
 dev/hwpmc/hwpmc_x86.c  optionalhwpmc
-dev/hyperv/netvsc/hv_net_vsc.c optionalhyperv
+dev/hyperv/netvsc/hn_nvs.c optionalhyperv
 dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  optionalhyperv
 dev/hyperv/netvsc/hv_rndis_filter.coptionalhyperv
 dev/hyperv/storvsc/hv_storvsc_drv_freebsd.coptionalhyperv

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Fri Oct 28 05:56:23 2016(r308011)
+++ head/sys/conf/files.i386Fri Oct 28 07:48:17 2016(r308012)
@@ -248,7 +248,7 @@ dev/hwpmc/hwpmc_piv.c   optional hwpmc
 dev/hwpmc/hwpmc_ppro.c optional hwpmc
 dev/hwpmc/hwpmc_tsc.c  optional hwpmc
 dev/hwpmc/hwpmc_x86.c  optional hwpmc
-dev/hyperv/netvsc/hv_net_vsc.c optionalhyperv
+dev/hyperv/netvsc/hn_nvs.c optionalhyperv
 dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  optionalhyperv
 dev/hyperv/netvsc/hv_rndis_filter.coptionalhyperv
 dev/hyperv/storvsc/hv_storvsc_drv_freebsd.coptionalhyperv

Copied: head/sys/dev/hyperv/netvsc/hn_nvs.c (from r308011, 
head/sys/dev/hyperv/netvsc/hv_net_vsc.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/hyperv/netvsc/hn_nvs.c Fri Oct 28 07:48:17 2016
(r308012, copy of r308011, head/sys/dev/hyperv/netvsc/hv_net_vsc.c)
@@ -0,0 +1,693 @@
+/*-
+ * Copyright (c) 2009-2012,2016 Microsoft Corp.
+ * Copyright (c) 2010-2012 Citrix Inc.
+ * Copyright (c) 2012 NetApp Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice unmodified, this list of conditions, and the following
+ *disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Network Virtualization Service.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "opt_inet6.h"
+#include "opt_inet.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+static int hn_nvs_conn_chim(struct hn_softc *);
+static int hn_nvs_conn_rxbuf(struct hn_softc *);
+static int hn_nvs_disconn_chim(struct hn_softc *);
+static int hn_nvs_disconn_rxbuf(struct hn_softc *);
+static int hn_nvs_conf_ndis(struct hn_softc *, int);
+static int hn_nvs_init_ndis(struct hn_softc *);
+static int