]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/log
FreeBSD/stable/10.git
7 years agoMFC 301017,301018,301019,301020,301021,301022,301106
sephe [Fri, 24 Jun 2016 01:49:59 +0000 (01:49 +0000)]
MFC 301017,301018,301019,301020,301021,301022,301106

301017
    hyperv/vmbus: Indentation cleanup

    No functional changes.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6602

301018
    hyperv/vmbus: Move global vmbus id array to stack.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6603

301019
    hyperv/vmbus: Redefine SynIC message.

    - Avoid unnecessary indirection.
    - Avoid bit fields.
    - Use __packed.

    Reviewed by:        Jun Su <junsu microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6636

301020
    hyperv/vmbus: White space cleanup

    No functional changes

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6637

301021
    hyperv: Move guid2str from vmbus file to hyperv file

    - Use uint8_t for GUID byte array.
    - Define GUID string length.
    - Break long lines.
    - Nuke unnecessary stack variable.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6640

301022
    hyperv/kvp: Use if_xname.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6641

301106
    hyperv/vmbus: Redefine event flags.

    - Nuke unnecessary union.
    - Avoid convoluted macro indirection.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6671

git-svn-id: svn://svn.freebsd.org/base/stable/10@302166 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 301015
sephe [Fri, 24 Jun 2016 01:20:33 +0000 (01:20 +0000)]
MFC 301015

    hyperv/vmbus: Rename ISR functions

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6601

git-svn-id: svn://svn.freebsd.org/base/stable/10@302165 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301963:
kib [Thu, 23 Jun 2016 09:06:11 +0000 (09:06 +0000)]
MFC r301963:
Return usual error indicator to shell.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302137 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301962:
kib [Thu, 23 Jun 2016 09:04:50 +0000 (09:04 +0000)]
MFC r301962:
Always allow loading of cpuctl(4).

git-svn-id: svn://svn.freebsd.org/base/stable/10@302136 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300987,300988,300989,300992,300993,300994,301009
sephe [Thu, 23 Jun 2016 09:03:52 +0000 (09:03 +0000)]
MFC 300987,300988,300989,300992,300993,300994,301009

300987
    hyperv/et: Fix STIMER0 operations.

    - Make sure that STIMER0 is disabled before writting to it, since
      writing to an enabled STIMER will result in undefined behaviour.
    - It is unnecessary to reconfigure STIMER0 upon each et_start().
    - Make sure that MSR_HV_REF_TIME_COUNT will not return 0, since
      writing 0 to STIMER_COUNT will disable the target STIMER.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6573

300988
    hyperv/vmbus: Move SINT settings to vmbus_var.h

    While I'm here remove the event timer's dependency on hv_vmbus_priv.h

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6574

300989
    hyperv/et: Make sure only one event timer will be registered

    This nullifies the need to use softc.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6591

300992
    hyperv: Move timer frequency definition to common place.

    And cleanup event timer period settings.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6597

300993
    hyperv/et: Device renaming; consistent w/ other Hyper-V utils

    While I'm here, prefix function names w/ vmbus, since unlike Hyper-V
    timecounter, Hyper-V event timer will not work w/o vmbus.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6598

300994
    hyperv/et: Allow Hyper-V event timer be disabled

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6599

301009
    hyperv/vmbus: Process event timer before checking events

    And update comment.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6600

git-svn-id: svn://svn.freebsd.org/base/stable/10@302135 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301960:
kib [Thu, 23 Jun 2016 09:02:50 +0000 (09:02 +0000)]
MFC r301960:
Remove XXX comments from kern_thread.c.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302134 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301959:
kib [Thu, 23 Jun 2016 09:00:58 +0000 (09:00 +0000)]
MFC r301959:
Remove code duplication.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302133 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300981
sephe [Thu, 23 Jun 2016 08:38:01 +0000 (08:38 +0000)]
MFC 300981

    tcp: Don't prematurely drop receiving-only connections

    If the connection was persistent and receiving-only, several (12)
    sporadic device insufficient buffers would cause the connection be
    dropped prematurely:
    Upon ENOBUFS in tcp_output() for an ACK, retransmission timer is
    started.  No one will stop this retransmission timer for receiving-
    only connection, so the retransmission timer promises to expire and
    t_rxtshift is promised to be increased.  And t_rxtshift will not be
    reset to 0, since no RTT measurement will be done for receiving-only
    connection.  If this receiving-only connection lived long enough
    (e.g. >350sec, given the RTO starts from 200ms), and it suffered 12
    sporadic device insufficient buffers, i.e. t_rxtshift >= 12, this
    receiving-only connection would be dropped prematurely by the
    retransmission timer.

    We now assert that for data segments, SYNs or FINs either rexmit or
    persist timer was wired upon ENOBUFS.  And don't set rexmit timer
    for other cases, i.e. ENOBUFS upon ACKs.

    Discussed with:     lstewart, hiren, jtl, Mike Karels
    MFC after:  3 weeks
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5872

git-svn-id: svn://svn.freebsd.org/base/stable/10@302132 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300825,300827,300830,300831,300832,300834
sephe [Thu, 23 Jun 2016 08:26:07 +0000 (08:26 +0000)]
MFC 300825,300827,300830,300831,300832,300834

300825
    hyperv: Move CPUID related bits to hyperv_reg.h and give them clean name

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6565

300827
    hyperv: Move timer related MSRs into hyperv_reg.h

    And avoid bit fields for event timer.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6566

300830
    hyperv/vmbus: Move MSR EOM to hyperv_reg.h

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6567

300831
    hyperv: GC unneeded bits

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6568

300832
    hyperv: Clean up Hyper-V timecounter a bit.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6569

300834
    hyperv: Test features before enabling optional functionalities

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6571

git-svn-id: svn://svn.freebsd.org/base/stable/10@302129 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300654,300655,300708
sephe [Thu, 23 Jun 2016 08:09:44 +0000 (08:09 +0000)]
MFC 300654,300655,300708

300654
    hyperv/vmbus: Rework SynIC setup and teardown

    - Avoid bit fields.
    - Fix SINT setup (preserve required bits).

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6529

300655
    hyperv: Preserve required bits when disable Hypercall

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6530

300708
    hyperv: Rework guest id settings according to Hyper-V spec

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6553

git-svn-id: svn://svn.freebsd.org/base/stable/10@302128 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300647,300650,300651,300652,300653
sephe [Thu, 23 Jun 2016 07:53:58 +0000 (07:53 +0000)]
MFC 300647,300650,300651,300652,300653

300647
    hyperv/vmbus: Move vcpuid into vmbus softc per-cpu data

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6521

300650
    hyperv/vmbus: Move two global flags into vmbus softc

    And pack them into one flag field.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6522

300651
    hyperv/vmbus: Minor style and white space cleanup

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6523

300652
    hyperv/vmbus: Pass vmbus softc to vmbus_synic_setup

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6527

300653
    hyperv/vmbus: Nuke unnecessary MSR read

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6528

git-svn-id: svn://svn.freebsd.org/base/stable/10@302127 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300646
sephe [Thu, 23 Jun 2016 07:36:03 +0000 (07:36 +0000)]
MFC 300646

    hyperv/vmbus: Move event/message taskqueue/task to vmbus softc

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6520

git-svn-id: svn://svn.freebsd.org/base/stable/10@302126 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300645
sephe [Thu, 23 Jun 2016 07:09:44 +0000 (07:09 +0000)]
MFC 300645

    hyperv/vmbus: Allocate/setup IDT vector after all ISR resources are ready

    And release IDT vector before releasing ISR resources on interrupt
    teardown path.  We still have some work to do on the interrupt tearing
    down path.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6519

git-svn-id: svn://svn.freebsd.org/base/stable/10@302124 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300576,300644
sephe [Thu, 23 Jun 2016 06:27:41 +0000 (06:27 +0000)]
MFC 300576,300644

300576
    hyperv/vmbus: Free message taskqueue during interrupt teardown

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6506

300644
    hyperv/vmbus: Check hyperv_dmamem_alloc return value

    Though it is highly unlikely this function would fail w/ BUS_DMA_WAITOK,
    we had better to check its return value; better safe then sorry here.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6518

git-svn-id: svn://svn.freebsd.org/base/stable/10@302122 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300574
sephe [Thu, 23 Jun 2016 06:18:32 +0000 (06:18 +0000)]
MFC 300574

    hyperv/vmbus: Factor out functions for vmbus interrupt set/teardown

    This paves way for further cleanup and fix.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6505

git-svn-id: svn://svn.freebsd.org/base/stable/10@302120 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300573
sephe [Thu, 23 Jun 2016 05:56:04 +0000 (05:56 +0000)]
MFC 300573

    hyperv/vmbus: Git rid of sc version of pcpu data extraction macro

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6503

git-svn-id: svn://svn.freebsd.org/base/stable/10@302119 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300572
sephe [Thu, 23 Jun 2016 05:51:57 +0000 (05:51 +0000)]
MFC 300572

    hyperv/vmbus: Use busdma(9) for messages and event flags

    And
    - Move message and event flags to vmbus_softc per-cpu data.
    - Get rid of hv_setup_arg, which serves no purpose now.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6502

git-svn-id: svn://svn.freebsd.org/base/stable/10@302118 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300565,300567,300568,300570,300571
sephe [Thu, 23 Jun 2016 05:35:08 +0000 (05:35 +0000)]
MFC 300565,300567,300568,300570,300571

300565
    hyperv/vmbus: Move vmbus interrupt counter into vmbus softc

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6497

300567
    hyperv/vmbus: Pass vmbus_softc and curcpu to hv_vmbus_isr()

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6498

300568
    hyperv/busdma: Take BUS_DMA_ZERO into account

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6499

300570
    hyperv/vmbus: Rename local variable and break long lines

    No functional changes.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6500

300571
    hyperv/vmbus: Move SynIC setup/teardown from hyperv file to vmbus file

    Avoid unnecessary exposure.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6501

git-svn-id: svn://svn.freebsd.org/base/stable/10@302116 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300487
sephe [Thu, 23 Jun 2016 05:08:17 +0000 (05:08 +0000)]
MFC 300487

    hyperv/vmbus: Move IDT vector to vmbus_softc

    Prepare to get rid of the hv_setup_arg.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6449

git-svn-id: svn://svn.freebsd.org/base/stable/10@302115 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300480,300481,300486
sephe [Thu, 23 Jun 2016 04:40:13 +0000 (04:40 +0000)]
MFC 300480,300481,300486

300480
    hyperv: Move Hypercall setup to an early place.

    It does not belong to the vmbus.

    While I'm here rework the Hypercall setup, e.g. use busdma(9)
    and avoid bit fields.

    Discussed with:     Jun Su <junsu microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6445

300481
    hyperv/vmbus: Declare Synic message and event w/ proper types

    Avoid ugly casts.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6446

300486
    hyperv/vmbus: Get rid of vmbus_devp

    While I'm here, nuke useless print in vmbus_attach().

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6447

git-svn-id: svn://svn.freebsd.org/base/stable/10@302114 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300478,300479
sephe [Thu, 23 Jun 2016 03:25:18 +0000 (03:25 +0000)]
MFC 300478,300479

300478
    hyperv: Add helpers for busdma(9) operation

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6443

300479
    hyperv/hn: Use hyperv busdma(9) helper.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6444

git-svn-id: svn://svn.freebsd.org/base/stable/10@302113 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300122,300123,300124,300126,300127,300129,300455
sephe [Thu, 23 Jun 2016 03:14:09 +0000 (03:14 +0000)]
MFC 300122,300123,300124,300126,300127,300129,300455

300122
    hyperv: Set vm_guest to VM_GUEST_VM, if hypervisor is not Hyper-V

    Reviewed by:        kib
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6412

300123
    hyperv/vmbus: Staticize vmbus_devclass

    Reviewed by:        Jun Su <junsu microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6414

300124
    hyperv/vmbus: Reindent and cleanup devmethods.

    While I'm here, use DEVMETHOD_END.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6415

300126
    hyperv/vmbus: Fix SYSINIT function prototype and usage.

    Reviewed by:        Jun Su <junsu microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6416

300127
    hyperv/vmbus: Minor function definition style fixup

    Reviewed by:        Jun Su <junsu microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6417

300129
    hyperv/vmbus: Use consistent device description as other devices

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6418

300455
    hyperv: Move guest id setup to early place

    And
    - Rework the guest id composition.
    - Nuke useless saved guest_id.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6430

git-svn-id: svn://svn.freebsd.org/base/stable/10@302112 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300108,300111,300112,300120,300121
sephe [Thu, 23 Jun 2016 02:53:24 +0000 (02:53 +0000)]
MFC 300108,300111,300112,300120,300121

300108
    hyperv/vmbus: Minor white space and style cleanup

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6407

300111
    hyperv/vmbus: Utilize curcpu

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6408

300112
    hyperv/vmbus: Function renaming vmbus_msg_swintr -> vmbus_msg_task

    It is not an SWI handler for a long time.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6409

300120
    hyperv/vmbus: Remove useless modevent handler

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6410

300121
    hyperv/vmbus: Nuke unnecessary function indirection

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6411

git-svn-id: svn://svn.freebsd.org/base/stable/10@302111 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 299927,300101,300102,300105,300107
sephe [Thu, 23 Jun 2016 02:37:24 +0000 (02:37 +0000)]
MFC 299927,300101,300102,300105,300107

299927
    hyperv/vmbus: Use atomic_testandclear

    Prepare to use unsigned long for event channel bit array.

    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6382

300101
    hyperv/vmbus: Use unsigned long for event bits.

    And move base channel id calculation out of inner loop.  This prepares
    for more event processing optimization.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6384

300102
    hyperv/vmbus: Reduce the # of event loops by recording event flag count

    Use vmbus softc to save vmbus per-cpu data.  More stuffs will be moved
    into vmbus softc.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6403

300105
    hyperv/vmbus: Use atomic swap and flsl to process event flags

    Greatly reduce the locked instructions and reduce number of inner loops.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6404

300107
    hyperv/vmbus: Avoid two unnecessary protocol checks on isr handling path

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6405

git-svn-id: svn://svn.freebsd.org/base/stable/10@302109 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 299912
sephe [Thu, 23 Jun 2016 02:21:37 +0000 (02:21 +0000)]
MFC 299912

    atomic: Add testandclear on i386/amd64

    Reviewed by:        kib
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6381

git-svn-id: svn://svn.freebsd.org/base/stable/10@302108 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 299889,299890,299892
sephe [Thu, 23 Jun 2016 01:47:30 +0000 (01:47 +0000)]
MFC 299889,299890,299892

299889
    hyperv/vmbus: Simplify event processing

    While I'm here, remove useless comment and unnecessary return.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6332

299890
    hyperv/vmbus: Simplify event processing

    For channel0, it will never be processed on event handling path,
    so there is no need to install it.  After skipping in the channel0
    installation, we could discard the channel0 check on event
    handling hot code path.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6333

299892
    hyperv/vmbus: Fix event processing loop indentation.

    No functional changes.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6334

git-svn-id: svn://svn.freebsd.org/base/stable/10@302107 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301929:
kib [Wed, 22 Jun 2016 09:10:52 +0000 (09:10 +0000)]
MFC r301929:
Do not assume that we own the use reference on the covered vnode until
we set MNTK_UNMOUNT flag on the mp.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302079 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301928:
kib [Wed, 22 Jun 2016 09:08:18 +0000 (09:08 +0000)]
MFC r301928:
Only access vp->v_rdev for VCHR vnodes in devfs_reclaim().

git-svn-id: svn://svn.freebsd.org/base/stable/10@302078 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r300892,r300893,r301130,r301404,r301414,r301460:
bdrewery [Tue, 21 Jun 2016 20:32:34 +0000 (20:32 +0000)]
MFC r300892,r300893,r301130,r301404,r301414,r301460:

  r300892:
    Rename function to be less generic.
  r300893:
    Don't truncate existing error when writing the log.
  r301130:
    Enable filemon on all architectures.
  r301404:
    Support all architectures by just using sysent.
  r301414:
    Fix build after r301404.
  r301460:
    Cleanup COMPAT_FREEBSD32 support.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302072 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r297160,r297196:
bdrewery [Tue, 21 Jun 2016 20:20:30 +0000 (20:20 +0000)]
MFC r297160,r297196:

  r297160:
    Document openat(2) behavior.
  r297196:
    Spell out 'system calls'.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302070 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r271049:
bdrewery [Tue, 21 Jun 2016 20:15:30 +0000 (20:15 +0000)]
MFC r271049:

  Note that script(1) consumes filemon(4).

git-svn-id: svn://svn.freebsd.org/base/stable/10@302068 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r297156,r297157,r297158,r297159,r297161,r297172,r297200,r297201,r297202,
bdrewery [Tue, 21 Jun 2016 20:13:19 +0000 (20:13 +0000)]
MFC r297156,r297157,r297158,r297159,r297161,r297172,r297200,r297201,r297202,
    r297203,r297256:

  r297156:
    Track filemon usage via a proc.p_filemon pointer rather than its own lists.
  r297157:
    Stop tracking stat(2).
  r297158:
    Consolidate open(2) and openat(2) code.
  r297159:
    Use curthread for vn_fullpath.
  r297161:
    Attempt to use the namecache for openat(2) path resolution.
  r297172:
    Consolidate common link(2) logic.
  r297200:
    Follow-up r297156: Close the log in filemon_dtr rather than in the last
    reference.
  r297201:
    Return any log write failure encountered when closing the filemon fd.
  r297202:
    Remove unused done argument to copyinstr(9).
  r297203:
    Handle copyin failures.
  r297256:
    Remove unneeded return left from refactoring.

Relnotes: yes (filemon stability/performance updates)
Sponsored by: EMC / Isilon Storage Division

git-svn-id: svn://svn.freebsd.org/base/stable/10@302066 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301549, r301550:
pfg [Tue, 21 Jun 2016 15:47:54 +0000 (15:47 +0000)]
MFC r301549, r301550:
ng_mppc(4): Bring netgraph(3) MPPC compression support.

Support for compression has been available from July 2007 but it
was never imported due to concerns with patents once held by
STAC/HiFn. The issues have clearly been resolved so bring it
in now.

Special thanks to Brett Glass for preserving the code and
pointing documentation for the expiration case.

Taken from: mav (through Brett Glass)

git-svn-id: svn://svn.freebsd.org/base/stable/10@302061 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 299401,299888
sephe [Tue, 21 Jun 2016 07:05:49 +0000 (07:05 +0000)]
MFC 299401,299888

299401
    hyperv/hn: Extract RSS hash value and type.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6287

299888
    hyperv/hn: Combine per-packet-information parsing.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@302053 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 299506
sephe [Tue, 21 Jun 2016 06:56:09 +0000 (06:56 +0000)]
MFC 299506

    mxge: Setup mbuf flowid before calling tcp_lro_rx().

    Reviewed by:        gallatin
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6320

git-svn-id: svn://svn.freebsd.org/base/stable/10@302052 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 298696,298730
sephe [Tue, 21 Jun 2016 06:52:21 +0000 (06:52 +0000)]
MFC 298696,298730

298696
    tcp/lro: Fix typo.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298730
    tcp/lro: Fix more typo

    Noticed by: hiren
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@302051 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 298690,298693,298694
sephe [Tue, 21 Jun 2016 06:45:29 +0000 (06:45 +0000)]
MFC 298690,298693,298694

298690
    hyperv/hn: Mark sysctls MPSAFE

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298693
    hyperv/vmbus: Mark sysctls MPSAFE

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298694
    hyperv/hn: Add stat for # of chimney sending tries

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@302050 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 298618,298620,298688,298689
sephe [Tue, 21 Jun 2016 06:37:38 +0000 (06:37 +0000)]
MFC 298618,298620,298688,298689

298618
    hyperv/stor: Set description properly in probe devmethod

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298620
    hyperv/hn: Change description to "Hyper-V Network Interface"

    This is consistent w/ other Hyper-V devices.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298688
    hyperv/hn: Restart sending earlier once we gathered some free TX descs

    This greatly reduces the oqdrops under heavy workload.

    For TCP send/recv test (10K concurrent connections):
    oqdrops is reduced by 17% on sending side, and 57% on receiving side.

    For nginx-1.8/wrk-4 1KB object test (10K concurrent connections,
    4 requests/connection):
    oqdrops is reduced by 44% on nginx side, and 10% on wrk side.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298689
    hyperv/hn: Remove unapplied comment.

    Chimney sending buffers are shared across channels.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@302049 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 298569,298570,298571,298572,298574,298575,298613,298614,298615,298616,298617
sephe [Tue, 21 Jun 2016 06:18:41 +0000 (06:18 +0000)]
MFC 298569,298570,298571,298572,298574,298575,298613,298614,298615,298616,298617

298569
    hyperv/channel: Remove the unnecessary 'new' flag

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298570
    hyperv/channel: Minor style changes; no functional changes.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298571
    hyperv/channel: Remove unapplied comment

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298572
    hyperv/channel: Log a warning about duplicated primary channel offer

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298574
    hyperv/channel: Add functions to synchronize sub-channel offers

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298575
    hyperv/hn: Synchronize sub-channel offers

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298613
    hyperv/stor: Remove the useless hs_open_multi_channel

    This fixes the sub-channel offer race after Hyper-V device probe/attach
    is moved to vmbus SYSINIT/attach.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298614
    hyperv/stor: Synchronize sub-channel offers

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298615
    hyperv/hn: Avoid sub-channel creation callback.

    Since the sub-channel offers are synchronized, we can do our own
    channel setup without using the sub-channel creation callback.

    This paves the way to whack the sub-channel creation callback.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298616
    hyperv/stor: Avoid sub-channel creation callback.

    Since the sub-channel offers are synchronized, we can do our own
    channel setup without using the sub-channel creation callback.

    This paves the way to whack the sub-channel creation callback.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298617
    hyperv/channel: Git rid of the sub-channel creation callback

    It is no longer used.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@302048 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 298561,298563
sephe [Tue, 21 Jun 2016 05:49:07 +0000 (05:49 +0000)]
MFC 298561,298563

298561
    hn: Increase odrops for if_transmit method if drbr_enqueue fails.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298563
    hyperv/hn: Allow users to configure ifq or bufring depth.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@302047 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 298449,298568
sephe [Tue, 21 Jun 2016 05:33:26 +0000 (05:33 +0000)]
MFC 298449,298568

298449
    hyperv/et: Make Hyper-V event timer a device.

    Submitted by:       Jun Su <junsu microsoft com>
    Reviewed by:        sephe, Dexuan Cui <decui microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5957

298568
    hyperv/et: Strip extra white space in function name

    Reported by:        Sascha Wildner <saw online de>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@302046 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 298446
sephe [Tue, 21 Jun 2016 05:20:41 +0000 (05:20 +0000)]
MFC 298446

    hyperv: Update copyright to 2016 for the files Microsoft changed in 2016

    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6039

git-svn-id: svn://svn.freebsd.org/base/stable/10@302045 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 298260
sephe [Tue, 21 Jun 2016 05:16:21 +0000 (05:16 +0000)]
MFC 298260

    hyperv/vmbus: Make device probe/attach synchronous w/ vmbus attach/SYSINIT

    Discussed with:     Jun Su <junsu microsoft com>, Dexuan Cui <decui microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@302044 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 298041,298259
sephe [Tue, 21 Jun 2016 05:11:19 +0000 (05:11 +0000)]
MFC 298041,298259

298041
    hyperv: No need to zero out softc

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298259
    hyperv: Remove two assign-only local variables

    Submitted by:       Jun Su <junsu microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@302043 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 298040
sephe [Tue, 21 Jun 2016 05:02:03 +0000 (05:02 +0000)]
MFC 298040

    hyperv/stor: Use xpt_done_direct() upon I/O completion

    Reviewed by:        mav
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5955

git-svn-id: svn://svn.freebsd.org/base/stable/10@302042 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 297931,298022
sephe [Tue, 21 Jun 2016 04:51:55 +0000 (04:51 +0000)]
MFC 297931,298022

297931
    Expose doreti as a global symbol on amd64 and i386.

    doreti provides the common code path for returning from interrupt
    andlers on x86.  Exposing doreti as a global symbol allows kernel
    modules to include low-level interrupt handlers instead of requiring
    all low-level handlers to be statically compiled into the kernel.

    Submitted by:       Howard Su <howard0su@gmail.com>
    Reviewed by:        kib

298022
    hyperv: Deprecate HYPERV option by moving Hyper-V IDT vector into vmbus

    Submitted by:       Jun Su <junsu microsoft com>
    Reviewed by:        jhb, kib, sephe
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5910

git-svn-id: svn://svn.freebsd.org/base/stable/10@302041 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 297815,297841,297908,297913
sephe [Tue, 21 Jun 2016 02:36:03 +0000 (02:36 +0000)]
MFC 297815,297841,297908,297913

297815
    hyperv: Typo

    Noticed by: kib
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

297841
    hyperv: Replace 0 w/ NULL

    Submitted by:       pfg
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

297908
    hyperv/vmbus: Merge duplicated version check for events

    Submitted by:       Jun Su <junsu microsoft com>
    Reviewed by:        sephe
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5911

297913
    hyperv: device_get_softc does not return NULL

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@302040 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r300240
truckman [Mon, 20 Jun 2016 19:00:47 +0000 (19:00 +0000)]
MFC r300240

Change net.inet.tcp.ecn.enable sysctl mib from a binary off/on
control to a three way setting.
  0 - Totally disable ECN. (no change)
  1 - Enable ECN if incoming connections request it.  Outgoing
      connections will request ECN.  (no change from present != 0 setting)
  2 - Enable ECN if incoming connections request it.  Outgoing
      conections will not request ECN.

Change the default value of net.inet.tcp.ecn.enable from 0 to 2.

Linux version 2.4.20 and newer, Solaris, and Mac OS X 10.5 and newer have
similar capabilities.  The actual values above match Linux, and the default
matches the current Linux default.

Reviewed by: eadler
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D6386

git-svn-id: svn://svn.freebsd.org/base/stable/10@302032 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301853:
kib [Mon, 20 Jun 2016 09:15:03 +0000 (09:15 +0000)]
MFC r301853:
Do not access pv_table array for fictitious pages.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302028 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301851:
kib [Mon, 20 Jun 2016 09:06:50 +0000 (09:06 +0000)]
MFC r301851:
Explicitely initialize sw_alloc_sx.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302027 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r300259:
cy [Sun, 19 Jun 2016 00:39:23 +0000 (00:39 +0000)]
MFC r300259:

  Enable the two ip_frag tuneables. The code is there but the two
  ip_frag tuneables aren't registered in the ipf_tuners linked list.
  This commmit enables the two existing ip_frag tuneables by registering
  them.

MFC r300260:

  Remove extraneous blank line.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302015 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301076: Fix typo ESRC -> ESRCH in pthread man pages.
jilles [Sat, 18 Jun 2016 13:44:10 +0000 (13:44 +0000)]
MFC r301076: Fix typo ESRC -> ESRCH in pthread man pages.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302011 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r300970: Remove non-history libkse references and fix typo
jilles [Sat, 18 Jun 2016 13:42:33 +0000 (13:42 +0000)]
MFC r300970: Remove non-history libkse references and fix typo
"PTHREAD_PROCESSES_PRIVATE".

git-svn-id: svn://svn.freebsd.org/base/stable/10@302010 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoAdd mergeinfo missed in r300954.
jilles [Sat, 18 Jun 2016 13:41:00 +0000 (13:41 +0000)]
Add mergeinfo missed in r300954.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302009 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r300998:
ed [Sat, 18 Jun 2016 12:46:50 +0000 (12:46 +0000)]
MFC r300998:

  Add missing va_list to <wchar.h>.

  It looks like va_list should always be defined when XSI is enabled. It
  moved over to the POSIX base in the 2008 edition.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302008 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301406:
ed [Sat, 18 Jun 2016 12:44:14 +0000 (12:44 +0000)]
MFC r301406:

  Don't test for INKERNEL to check whether we're in kernel space.

  It turns out that <machine/param.h> actually defines a macro under this
  name, even when we're not in kernelspace. This causes us to suppress
  some macro definitions that are used by userspace apps.

PR: 210026
Reported by: jbeich@

git-svn-id: svn://svn.freebsd.org/base/stable/10@302006 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r300231: elf_common.h: add section header flag and dynamic types
emaste [Sat, 18 Jun 2016 01:23:38 +0000 (01:23 +0000)]
MFC r300231: elf_common.h: add section header flag and dynamic types

SHF_COMPRESSED section contains compressed data
DT_TLSDESC_PLT Location of PLT entry for TLS descriptor resolver calls
DT_TLSDESC_GOT Location of GOT entry used by resolver PLT entry

git-svn-id: svn://svn.freebsd.org/base/stable/10@302002 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r299529,r299540,r299576,r299896:
mm [Fri, 17 Jun 2016 22:40:10 +0000 (22:40 +0000)]
MFC r299529,r299540,r299576,r299896:

r299529,r299540:
Update libarchive to 3.2.0

New features:
- new bsdcat command-line utility
- LZ4 compression (in src only via external utility from ports)
- Warc format support
- 'Raw' format writer
- Zip: Support archives >4GB, entries >4GB
- Zip: Support encrypting and decrypting entries
- Zip: Support experimental streaming extension
- Identify encrypted entries in several formats
- New --clear-nochange-flags option to bsdtar tries to remove noschg and
  similar flags before deleting files
- New --ignore-zeros option to bsdtar to handle concatenated tar archives
- Use multi-threaded LZMA decompression if liblzma supports it
- Expose version info for libraries used by libarchive

r299576,r299896:
Fix broken cpio behavior.

Relnotes: yes

git-svn-id: svn://svn.freebsd.org/base/stable/10@302001 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301607
arybchik [Fri, 17 Jun 2016 09:07:27 +0000 (09:07 +0000)]
MFC r301607

sfxge(4): host byte order is required for IP ID in TSO descriptors

Submitted by:   Artem V. Andreev <Artem.Andreev at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.

git-svn-id: svn://svn.freebsd.org/base/stable/10@301989 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301604
arybchik [Fri, 17 Jun 2016 09:06:30 +0000 (09:06 +0000)]
MFC r301604

sfxge(4): cleanup: add missing probes to ef10_nvram_segment_write_tlv

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.

git-svn-id: svn://svn.freebsd.org/base/stable/10@301988 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301495
arybchik [Fri, 17 Jun 2016 09:05:26 +0000 (09:05 +0000)]
MFC r301495

sfxge(4): update TX vFIFO ULL tag location to avoid merge conflict

Sponsored by:   Solarflare Communications, Inc.

git-svn-id: svn://svn.freebsd.org/base/stable/10@301987 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301427
arybchik [Fri, 17 Jun 2016 09:04:06 +0000 (09:04 +0000)]
MFC r301427

sfxge(4): allow firmware to auto-configure event queues on Medford

On Medford, licenses are required to enable RX and event cut through and to
disable RX batching. To avoid the need for the driver to make decisions based on
the licensing state, the MC_CMD_INIT_EVQ has been extended to allow us to leave
the decision to the firmware. If the adapter is licensed for low-latency use,
the firmware will choose the optimal settings for latency, otherwise it will use
the best settings for throughput.

For Huntington we still need to choose the settings ourselves.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D6717

git-svn-id: svn://svn.freebsd.org/base/stable/10@301986 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301309
arybchik [Fri, 17 Jun 2016 09:02:51 +0000 (09:02 +0000)]
MFC r301309

sfxge(4): always be ready to receive batched events

When the low-latency firmware variant is running, it is reported as not
being capable of batching RX events, but it can still do so if the
FORCE_EV_MERGING flag is set on an RXQ.  Therefore we need to handle
batched RX events even if the capability isn't set.

If this bug is fixed in the firmware such that the capability is set
even when running the low-latency firmware variant, it will almost
always be reported so I don't think we lose much by removing the check.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D6705

git-svn-id: svn://svn.freebsd.org/base/stable/10@301985 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301308
arybchik [Fri, 17 Jun 2016 09:01:11 +0000 (09:01 +0000)]
MFC r301308

sfxge(4): add helper to compute timer quantum

This also adjusts the timer values used to match the Linux net
driver implementation:
a) non-zero time intervals should result in at least one quantum
b) timer load/reload values are only zero biased for Falcon/Siena

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D6704

git-svn-id: svn://svn.freebsd.org/base/stable/10@301984 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301237
arybchik [Fri, 17 Jun 2016 08:59:08 +0000 (08:59 +0000)]
MFC r301237

sfxge(4): support EVQ timer workaround via MCDI

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/6675

git-svn-id: svn://svn.freebsd.org/base/stable/10@301983 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301127
arybchik [Fri, 17 Jun 2016 08:57:52 +0000 (08:57 +0000)]
MFC r301127

sfxge(4): cleanup: remove unused variables in common code

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.

git-svn-id: svn://svn.freebsd.org/base/stable/10@301982 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301125
arybchik [Fri, 17 Jun 2016 08:56:47 +0000 (08:56 +0000)]
MFC r301125

sfxge(4): cleanup: add missing space after if keyword

Sponsored by:   Solarflare Communications, Inc.

git-svn-id: svn://svn.freebsd.org/base/stable/10@301981 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301122
arybchik [Fri, 17 Jun 2016 08:56:01 +0000 (08:56 +0000)]
MFC r301122

sfxge(4): set moderation in efx_ev_qcreate

This simplifies setting an initial interrupt moderation value, and
avoids most calls to evx_ev_qmoderate from contexts where MCDI is
not allowed (MCDI is need for an EVQ timer workaround in a later patch).

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D6673

git-svn-id: svn://svn.freebsd.org/base/stable/10@301980 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301061
arybchik [Fri, 17 Jun 2016 08:54:43 +0000 (08:54 +0000)]
MFC r301061

sfxge(4): regenerate MCDI headers from firmwaresrc .yml

Sponsored by:   Solarflare Communications, Inc.

git-svn-id: svn://svn.freebsd.org/base/stable/10@301979 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301773 & r301775:
cy [Fri, 17 Jun 2016 02:48:57 +0000 (02:48 +0000)]
MFC r301773 & r301775:

Clarify the wording to be more accurate.

git-svn-id: svn://svn.freebsd.org/base/stable/10@301978 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301291:
pfg [Fri, 17 Jun 2016 02:29:55 +0000 (02:29 +0000)]
MFC r301291:
libiberty: prevent integer overflow.

Take care of very old bug leading to heap-buffer overflow by
processing certain file headers via bfd binary.

PR: 200888
Obtained from: OpenBSD

git-svn-id: svn://svn.freebsd.org/base/stable/10@301976 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 298039,298042
sephe [Thu, 16 Jun 2016 06:34:12 +0000 (06:34 +0000)]
MFC 298039,298042

298039
    hyperv/vmbus: Put multi-channel offer logging under bootverbose

    Suggested by:       Dexuan Cui <decui microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298042
    hyperv/hn: Hide ring to channel linkage message under bootverbose

    Suggested by:       Dexuan Cui <decui microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@301954 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agohyperv/hn: ifnet TSO configuration is available on 10-stable.
sephe [Thu, 16 Jun 2016 06:26:09 +0000 (06:26 +0000)]
hyperv/hn: ifnet TSO configuration is available on 10-stable.

Sponsored by: Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@301953 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 297809,297810,297811
sephe [Thu, 16 Jun 2016 05:24:00 +0000 (05:24 +0000)]
MFC 297809,297810,297811

297809
    hyperv/hn: Cap default # of rings to 8.

    8 gives the best performance in both Azure and local Hyper-V on both
    10Ge and 40Ge. More rings are still allowed by manual configuration.

    Reviewed by:        Dexuan Cui <decui microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5879

297810
    hyperv/hn: By default enable multiple TX/RX rings, aka vRSS.

    Reviewed by:        Dexuan Cui <decui microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5880

297811
    hyperv/hn: Remove unnecessary NULL checks

    Submitted by:       Jun Su <junsu microsoft com>
    Reviewed by:        sephe
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5905

git-svn-id: svn://svn.freebsd.org/base/stable/10@301952 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 297636,297800,297801,297805,297807,297808
sephe [Thu, 16 Jun 2016 05:12:28 +0000 (05:12 +0000)]
MFC 297636,297800,297801,297805,297807,297808

297636
    hyperv: Typo in r297634

    Noticed by: hiren
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

297800
    hyperv/vmbus: Nuke unused function

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

297801
    hyperv/vmbus: Get rid of max_leaf detection; this is actually not used.

    It will be replaced by a new one.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

297805
    hyperv: Break long line

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

297807
    hyperv: Print more features

    And add comment about the MSR features.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

297808
    hyperv: Define macro for Hyper-V interface

    Suggested by:       rpokala
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@301951 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 297334
sephe [Thu, 16 Jun 2016 04:32:11 +0000 (04:32 +0000)]
MFC 297334

    vt: Use textmode when we're running on hypervisors

    The graphic mode is noticeably slow on hypervisors, especially
    on Hyper-V (1 second to each line).

    Submitted by:       Dexuan Cui <decui microsoft com>
    Reviewed by:        kib, sephe, royger (early loader version)
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5739

git-svn-id: svn://svn.freebsd.org/base/stable/10@301950 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 297265
sephe [Thu, 16 Jun 2016 04:21:27 +0000 (04:21 +0000)]
MFC 297265

    tcp/lro: Return TCP_LRO_NO_ENTRIES if we are short of LRO entries.

    So that callers could react accordingly.

    Reviewed by:        gallatin (no objection)
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5695

git-svn-id: svn://svn.freebsd.org/base/stable/10@301949 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 297220
sephe [Thu, 16 Jun 2016 03:25:26 +0000 (03:25 +0000)]
MFC 297220

    hyperv/utils: Allow hint to disable individual utility

    Reviewed by:        kib, Dexuan Cui <decui microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5714

git-svn-id: svn://svn.freebsd.org/base/stable/10@301948 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 297180,297181,297182
sephe [Thu, 16 Jun 2016 03:16:43 +0000 (03:16 +0000)]
MFC 297180,297181,297182

297180
    hyperv/hn: Reduce TCP segment aggregation limit for multiple RX rings

    This mainly used to improve ACK timeliness when multiple RX rings
    are enabled.

    This value gives the best performance in both Azure and Hyper-V
    environment, w/ both 10Ge and 40Ge using non-{INVARIANTS,WITNESS}
    kernel.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5691

297181
    hyperv/hn: Factor out hn_set_lro_lenlim()

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5692

297182
    hyperv/hn: When short of mbufs on the RX path, don't spam the console.

    Instead, increase the IQDROPS counter.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5693

git-svn-id: svn://svn.freebsd.org/base/stable/10@301947 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 297142,297143,297176,297177,297178,297221
sephe [Thu, 16 Jun 2016 03:04:16 +0000 (03:04 +0000)]
MFC 297142,297143,297176,297177,297178,297221

297142
    hyperv: Factor out snprinf_hv_guid()

    Submitted by:       Ju Sun <junsu microsoft com>
    Reviewed by:        Dexuan Cui <decui microsoft com>, sephe
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5651

297143
    hyperv/vmbus: Implement bus_child_pnpinfo_str method

    Submitted by:       Jun Su <junsu microsoft com>
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5669

297176
    hyperv/evttimer: Use an independent message slot so that it can work

    Using the same message slot as the other types of the messages has
    the side effect that the event timer message could be deferred to
    the swi threads to run (lacking of trapframe and the original code
    didn't even handle that, so the event timer was actually broken).

    As of this commit we use an independent message slot for event timer,
    so that we could handle all of event timer messages in the interrupt
    handler directly.  Note, the message slot for event timer is still
    bind to the same interrupt vector as the other types of messages.

    Submitted by:       Jun Su <junsu microsoft com>
    Reviewed by:        sephe
    Discussed with: Jun Su <junsu microsoft com>, Dexuan Cui <decui microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5696

297177
    hyperv/vmbus: Use taskqueue_fast for non-performance critical messages

    This gets rid of the per-cpu SWIs.

    Submitted by:       Jun Su <junsu microsoft com>
    Reviewed by:        Dexuan Cui <decui microsoft com>, sephe
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5215

297178
    hyperv/vmbus: Remove NULL check for taskqueue_create_fast(M_WAITOK)

    Submitted by:       Jun Su <junsu microsoft com>
    Reviewed by:        Dexuan Cui <decui microsoft com>, sephe
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5215

297221
    hyperv/vmbus: Create per-cpu fast taskqueue for msg handling

    Using one taskqueue does not work, since the EOM MSR must be written
    on the msg's owner CPU.

    Noticed by: Jun Su <junsu microsoft com>
    Discussed with:     Jun Su <junsu microsoft com>, Dexuan Cui <decui microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@301946 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 296379,296380,296381,296593,296594,296595
sephe [Thu, 16 Jun 2016 02:48:18 +0000 (02:48 +0000)]
MFC 296379,296380,296381,296593,296594,296595

296379
    hyperv/hn: Add multiple channel support, a.k.a. vRSS

    Each channel contains one RX ring and one TX ring.  And we
    try to distribute the channels to different evenly.

    Note: Currently we don't have enough information to extract
    the RSS type and RSS hash value from the received packets.

    This greatly improves the TX/RX performance for 8 virtual CPU
    Hyper-V over 10Ge: it can max out 10Ge for TCP when multiple
    RX/TX rings are enabled.

    This almost doubles the TX/RX performance for locally connected
    Hyper-Vs: was 6Gbps w/ 128 TCP streams, now 11Gbps w/ multiple
    RX/TX rings enabled.

    It is not enabled by default; it will be switched on after more
    tests.

    Collaborated with:  Hongjiang Zhang <honzhan microsoft com>
    MFC after:  2 week
    Sponsored by:       Microsoft OSTC

296380
    hyperv/hn: Pass channel to send done callbacks.

    Mainly to strigent the data packet send done check.

    MFC after:  2 weeks
    Sponsored by:       Microsoft OSTC

296381
    hyperv/hn: Add per-TX ring stats for # of transmitted packets

    MFC after:  2 weeks
    Sponsored by:       Microsoft OSTC

296593
    hyperv/hn: Move if_initname to an earlier place

    So that functions shared w/ attach path could use if_printf().

    While I'm here, remove unnecessary if_dunit and if_dname assignment.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5576

296594
    hyperv/hn: Factor out hn_channel_attach

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5577

296595
    hyperv/hn: Make the # of TX rings configurable.

    Rename the tunables to avoid confusion.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5578

git-svn-id: svn://svn.freebsd.org/base/stable/10@301943 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 297802,297803(297481),297804
sephe [Thu, 16 Jun 2016 01:57:16 +0000 (01:57 +0000)]
MFC 297802,297803(297481),297804

297802
    hyperv: Identify Hyper-V features and recommends properly

    Features bits will be used to detect devices, e.g. timers, which
    do not have corresponding event channels.

    Submitted by:       Jun Su <junsu microsoft com>
    Reviewed by:        sephe, Dexuan Cui <decui microsoft com>
    Rearranged by:      sephe
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

279803(297481)
    hyperv: Register Hyper-V timer early enough for TSC freq calibration

    The i8254 simulation in Hyper-V is kinda broken and is not available
    in Generation 2 Hyper-V VMs, so Hyper-V timer must be registered early
    enough so that it can be used to do the TSC freq calibration.

    This fixes the notorious warning like this:
    calcru: runtime went backwards from 50 usec to 25 usec for pid 0 (kernel)

    Submitted by:       Dexuan Cui <decui microsoft com>
    Reviewed by:        kib, sephe
    Tested by:  kib, sephe
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5778

    =================

    hyperv: Resurrect r297481

    This time we make sure that the TIME_REF_COUNT MSR exists.

    Submitted by:       Jun Su <junsu microsoft com>
    Reviewed by:        sephe, Dexuan Cui <decui microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

297804
    hyperv: Declare hyperv_{features,recommends} properly

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@301942 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301532
vangyzen [Wed, 15 Jun 2016 14:11:49 +0000 (14:11 +0000)]
MFC r301532

newsyslog: Eliminate unnecessary sleep(10) when -R and -s are specified

After going through the signal work list, during which do_sigwork()
is called and essentially does nothing because -s and -R were
specified on the command line, newsyslog will sleep for 10 seconds
as the (verbose) code says: "Pause 10 seconds to allow daemon(s)
to close log file(s)".

However, the man page verbiage for -R (and -s) seems quite clear
that this sleep() is unnecessary because the daemon was expected
to have already closed the log file before calling newsyslog.

PR: 210020
Submitted by: David A. Bright <david_a_bright@dell.com>
Sponsored by: Dell Inc.

git-svn-id: svn://svn.freebsd.org/base/stable/10@301926 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 297635
sephe [Wed, 15 Jun 2016 09:52:01 +0000 (09:52 +0000)]
MFC 297635

    hyperv/vmbus: Use default mtx for channel message queue

    First of all sema_post() can't be called w/ spinlock, and the channel
    message queue processing is not on hot code path, i.e. spinlock is not
    necessary.

    Submitted by:       Jun Su <junsu microsoft com>
    Reviewed by:        sephe, Dexuan Cui <decui microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5812

git-svn-id: svn://svn.freebsd.org/base/stable/10@301925 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 297219
sephe [Wed, 15 Jun 2016 09:39:41 +0000 (09:39 +0000)]
MFC 297219

    hyperv/vmbus: use a better retry method in hv_vmbus_post_message()

    Most often, hv_vmbus_post_message() doesn't fail.  However, it fails
    intermittently when GPADLs of large shared memory is to be established
    with the host, e.g. on the hn(4) attach path: a GPADL of 15MB sendbuf
    is created, for which lots of messages will be flooded to the host.
    The host side tries to throttle the message rate by returning
    HV_STATUS_INSUFFICIENT_BUFFERS.

    Before this commit, we do several retries for failed messages, but the
    delay between each retry is pretty/too low, which will cause sporadic
    message posting failure.  We now use large delay (>=1ms) between each
    retry to fix the message posting failure.

    Submitted by:       Dexuan Cui <decui microsoft com>
    Reviewed by:        sephe
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5715

git-svn-id: svn://svn.freebsd.org/base/stable/10@301924 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301596
truckman [Wed, 15 Jun 2016 06:42:30 +0000 (06:42 +0000)]
MFC r301596

Don't leak olinep if malloc() fails.

If malloc() fails to allocate linep, then free olinep (if it exists)
before returning to avoid a memory leak.

Reported by: Coverity
CID: 1016716
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D6755

git-svn-id: svn://svn.freebsd.org/base/stable/10@301921 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301592
truckman [Wed, 15 Jun 2016 06:40:30 +0000 (06:40 +0000)]
MFC r301592

Don't leak addrinfo if ai->ai_addrlen <= minsiz test fails.

If the ai->ai_addrlen <= minsiz test fails, then freeaddrinfo()
does not get called to free the memory just allocated by getaddrinfo().
Fix by moving ai->ai_addrlen <= minsiz to a separate nested if
block, and keep freeaddrinfo() in the outer block so that freeaddrinfo()
will be called whenever getaddrinfo() succeeds.

Reported by: Coverity
CID: 1273652
Reviewed by: ume
Differential Revision: https://reviews.freebsd.org/D6756

git-svn-id: svn://svn.freebsd.org/base/stable/10@301920 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301582
truckman [Wed, 15 Jun 2016 06:33:40 +0000 (06:33 +0000)]
MFC     r301582

Explicitly NUL terminate the buffer filled by fread().

The fix in r300649 was not sufficient to convince Coverity that the
buffer was NUL terminated, even with the buffer pre-zeroed.  Swap
the size and nmemb arguments to fread() so that a valid lenght is
returned, which we can use to terminate the string in the buffer
at the correct location.  This should also quiet the complaint about
the return value of fread() not being checked.

Reported by: Coverity
CID: 10190541009614
Secur3ty:
Sponsore dby:

git-svn-id: svn://svn.freebsd.org/base/stable/10@301919 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 296293,296296,296297,296305
sephe [Wed, 15 Jun 2016 06:32:00 +0000 (06:32 +0000)]
MFC 296293,296296,296297,296305

296293
    hyperv/hn: Pass channel to hv_nv_on_receive_completion()

    While I'm here, staticize this function.

    Submitted by:       Hongjiang Zhang <honzhan microsoft com>
    Modified by:        sephe
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

296296
    hyperv/hn: Make read buffer per-channel

    Submitted by:       Hongjiang Zhang <honzhan microsoft com>
    Reorganized by:     sephe
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

296297
    hyperv/hn: Fix typo in comment

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

296305
    hyperv/hn: Make # of rings configurable

    And since the host may not being able to allocate the # of rings
    requested by us, save the # of rings allocated by the host in the
    ring_inuse counters; use ring_inuse counters for run time operation.

    This paves the way for the upcoming vRSS support.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@301918 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r299484, r301574
truckman [Wed, 15 Jun 2016 06:27:43 +0000 (06:27 +0000)]
MFC r299484, r301574

r299484 | cem | 2016-05-11 15:04:28 -0700 (Wed, 11 May 2016) | 13 lines

random(6): Fix double-close

In the case where a file lacks a trailing newline, there is some "evil" code to
reverse goto the tokenizing code ("make_token") for the final token in the
file.  In this case, 'fd' is closed more than once.  Use a negative sentinel
value to guard close(2), preventing the double close.

Ideally, this code would be restructured to avoid this ugly construction.

r301574 | truckman | 2016-06-07 19:14:05 -0700 (Tue, 07 Jun 2016) | 15 lines

Fix a (false positive?) Argument cannot be negative coverity defect.

Rather than guarding close(fd) with an fd >= 0 test and setting fd
to -1 when it is closed to avoid a potential double-close, just
move the close() call after the conditional "goto make_token".  This
moves the close() call totally outside the loop to avoid the
possibility of calling it twice.  This should also prevent a Coverity
warning about checking fd for validity after it was previously passed
to read().

Reported by: Coverity
CID: 10061231355335

git-svn-id: svn://svn.freebsd.org/base/stable/10@301917 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 296291,301109
sephe [Wed, 15 Jun 2016 06:08:05 +0000 (06:08 +0000)]
MFC 296291,301109

296291
    hyperv/chan: Factor out the vcpu setting

    And use it for cpu0 assignment; it does not sound right to assume that
    cpu0 maps to vcpu0.  And this factored out function will be exposed to
    drivers, if driver specific CPU binding is needed, e.g. hn(4).

    Move default cpu select after saving channel offer message. This makes
    sure that all useful information of the channel has been setup.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5504

301109
    hyperv/channel: Only cpu0 is supported as channel target cpu on WIN7

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@301916 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 296181,296184,296187,296188,296252,296253,296289,296290
sephe [Wed, 15 Jun 2016 05:57:06 +0000 (05:57 +0000)]
MFC 296181,296184,296187,296188,296252,296253,296289,296290

296181
    hyperv/channel: Add debug sysctl nodes for channel indices

    It would serve as a debug tool, if the shared buffer ring's indices
    stopped updating.

    Submitted by:       HongJiang Zhang <honzhan microsoft com>
    Reviewed by:        sephe, Jun Su <junsu microsoft com>
    Modified by:        sephe
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5402

296184
    hyperv/hn: Switch to if_transmit by default after r296178

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5485

296187
    hyperv/hn: Utilize mbuf flowid

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5488

296188
    hyperv/channel: Add sysctl node for channel owner cpu

    And add sysctl node for sub-channel's channel id.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5489

296252
    hyperv/hn: Set hash per-packet-info for each packet transmission

    So that the host could dispatch the TX done back to this TX ring's
    owner channel

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5498

296253
    hyperv/channel: Nuke useless stack variable

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5499

296289
    hyperv/chan: Add sysctl node to check whether monitor is allocated or not

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5502

296290
    hyperv/chan: Function renaming; no functional change

    The renamed function create a sysctl tree for channel, and many
    non-statistics nodes exists, so don't claim it only adds sysctl
    nodes for statistics.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5503

git-svn-id: svn://svn.freebsd.org/base/stable/10@301915 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 296180,297634
sephe [Wed, 15 Jun 2016 05:31:35 +0000 (05:31 +0000)]
MFC 296180,297634

296180
    hyperv: Use proper fence function to keep store-load order for msgs

    sfence only makes sure about the store-store order, which is not
    sufficient here.  Use atomic_thread_fence_seq_cst() as suggested
    jhb and kib (a locked op in the nutshell, which should have the

    Reviewed by:        jhb, kib, Jun Su <junsu microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5436

297634
    hyperv: Use mb() instead of atomic_thread_fence_seq_cst()

    Since atomic_thread_fence_seq_cst() will become compiler fence on UP kernel.

    Reviewed by:        kib, Dexuan Cui <decui microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5852

git-svn-id: svn://svn.freebsd.org/base/stable/10@301914 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 296178
sephe [Wed, 15 Jun 2016 05:16:37 +0000 (05:16 +0000)]
MFC 296178

    buf_ring/drbr: Add buf_ring_peek_clear_sc and use it in drbr_peek

    Unlike buf_ring_peek, it only supports single consumer mode, and it
    clears the cons_head if DEBUG_BUFRING/INVARIANTS is defined.

    The normal use case of drbr_peek for network drivers is:

    m = drbr_peek(br);
    err = hw_spec_encap(&m); /* could m_defrag/m_collapse */
    (*)
    if (err) {
        if (m == NULL)
            drbr_advance(br);
        else
            drbr_putback(br, m);
        /* break the loop */
    }
    drbr_advance(br);

    The race is:
    If hw_spec_encap() m_defrag or m_collapse the mbuf, i.e. the old mbuf
    was freed, or like the Hyper-V's network driver, that transmission-
    done does not even require the TX lock; then on the other CPU at the
    (*) time, the freed mbuf could be recycled and being drbr_enqueue even
    before the current CPU had the chance to call drbr_{advance,putback}.
    This triggers a panic in drbr_enqueue duplicated element check, if
    DEBUG_BUFRING/INVARIANTS is defined.

    Use buf_ring_peek_clear_sc() in drbr_peek() to fix the above race.

    This change is a NO-OP, if neither DEBUG_BUFRING nor INVARIANTS are
    defined.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5416

git-svn-id: svn://svn.freebsd.org/base/stable/10@301913 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 296083,296084,296085,296086,296087,296088,296089
sephe [Wed, 15 Jun 2016 03:48:55 +0000 (03:48 +0000)]
MFC 296083,296084,296085,296086,296087,296088,296089

296083
    hyperv: Remove useless channel inbound_lock

    It serves no purpose.

    Reviewed by:        Hongjiang Zhang <honzhan microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5450

296084
    hyperv: Always set device for channels

    And unregister hv_device only for primary channels, who own the hv_device.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5451

296085
    hyperv/hn: Pass channel as the channel callback argument

    This is the preamble to pass channel back to hn(4) upon TX/RX done.

    Reviewed by:        Hongjiang Zhang <honzhan microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5452

296086
    hyperv/hn: Pass channel to TX/RX done

    This is preamble to associate the TX/RX rings to their channel.

    While I'm here, revoke unused netvsc_recv_rollup.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5453

296087
    hyperv/hn: Associate TX/RX ring with channel

    This fixes the TX/RX ring selection for TX/RX done.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5454

296088
    hyperv/hn: Remove the useless num_outstanding_sends

    We rely on taskqueue draining now.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5456

296089
    hyperv/hn: Make transmission path channel aware

    Chimney sending buffer still needs conversion, which will be done
    along with the upcoming vRSS support.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5457

git-svn-id: svn://svn.freebsd.org/base/stable/10@301912 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 296022,296024,296076
sephe [Wed, 15 Jun 2016 03:17:05 +0000 (03:17 +0000)]
MFC 296022,296024,296076

296022
    hyperv/hn: Implement ifnet.if_transmit method

    It will be turned on by default later.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5415

296024
    hyperv/hn: Hold the TX ring lock then drain TX desc buf_ring

    Reported by:        Hongxiong Xian <v-hoxian microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

296076
    hyperv: Use atomic_fetchadd_int to get GPADL id.

    Reviewed by:        Hongjiang Zhang <honzhan microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5439

git-svn-id: svn://svn.freebsd.org/base/stable/10@301911 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301764:
jamie [Wed, 15 Jun 2016 01:59:55 +0000 (01:59 +0000)]
MFC r301764:

  Fix a vnode leak when giving a child jail a too-long path when
  debug.disablefullpath=1.

git-svn-id: svn://svn.freebsd.org/base/stable/10@301910 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301760:
jamie [Wed, 15 Jun 2016 01:58:54 +0000 (01:58 +0000)]
MFC r301760:

  Re-order some jail parameter reading to prevent a vnode leak.

git-svn-id: svn://svn.freebsd.org/base/stable/10@301909 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301758:
jamie [Wed, 15 Jun 2016 01:57:22 +0000 (01:57 +0000)]
MFC r301758:

  Clean up some logic in jail error messages, replacing a missing test and
  a redundant test with a single correct test.

git-svn-id: svn://svn.freebsd.org/base/stable/10@301908 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301745:
jamie [Wed, 15 Jun 2016 01:56:20 +0000 (01:56 +0000)]
MFC r301745:

  Make sure the OSD methods for jail set and remove can't run concurrently,
  by holding allprison_lock exclusively (even if only for a moment before
  downgrading) on all paths that call PR_METHOD_REMOVE.  Since they may run
  on a downgraded lock, it's still possible for them to run concurrently
  with PR_METHOD_GET, which will need to use the prison lock.

git-svn-id: svn://svn.freebsd.org/base/stable/10@301907 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f