History log of /src/sys/dev/hyperv/vmbus.c |
Revision | | Date | Author | Comments |
1.20 |
| 06-Sep-2025 |
riastradh | hyperv(4): Use paravirt_membar_sync(9) where needed.
Annotate each remaining membar_sync with the bus_dmamap_sync that I think it really ought to be. Sprinkle some more annotations of where bus_dmamap_sync ought to go. (Although these likely don't matter -- except as __insn_barrier equivalents -- for hyperv on x86, and these buffers are not likely to ever bounce, the syncs may be needed on Arm for the underlying r-before-r/w and r/w-before-w ordering if nothing else.)
PR kern/59618: occasional virtio block device lock ups/hangs
(hyperv(4) is not virtio(4) but the same fundamental issue arises.)
|
1.19 |
| 29-Mar-2025 |
nonaka | vmbus(4): Fix missing conversion to condvar(9).
|
1.18 |
| 20-May-2022 |
nonaka | branches: 1.18.4; 1.18.10; Improve Hyper-V support.
vmbus(4): - Added support for multichannel.
hvn(4): - Added support for multichannel. - Added support for change MTU. - Added support for TX aggregation. - Improve VLAN support. - Improve checksum offload support.
|
1.17 |
| 09-Apr-2022 |
riastradh | sys: Use membar_release/acquire around reference drop.
This just goes through my recent reference count membar audit and changes membar_exit to membar_release and membar_enter to membar_acquire -- this should make everything cheaper on most CPUs without hurting correctness, because membar_acquire is generally cheaper than membar_enter.
|
1.16 |
| 12-Mar-2022 |
riastradh | sys: Membar audit around reference count releases.
If two threads are using an object that is freed when the reference count goes to zero, we need to ensure that all memory operations related to the object happen before freeing the object.
Using an atomic_dec_uint_nv(&refcnt) == 0 ensures that only one thread takes responsibility for freeing, but it's not enough to ensure that the other thread's memory operations happen before the freeing.
Consider:
Thread A Thread B obj->foo = 42; obj->baz = 73; mumble(&obj->bar); grumble(&obj->quux); /* membar_exit(); */ /* membar_exit(); */ atomic_dec -- not last atomic_dec -- last /* membar_enter(); */ KASSERT(invariant(obj->foo, obj->bar)); free_stuff(obj);
The memory barriers ensure that
obj->foo = 42; mumble(&obj->bar);
in thread A happens before
KASSERT(invariant(obj->foo, obj->bar)); free_stuff(obj);
in thread B. Without them, this ordering is not guaranteed.
So in general it is necessary to do
membar_exit(); if (atomic_dec_uint_nv(&obj->refcnt) != 0) return; membar_enter();
to release a reference, for the `last one out hit the lights' style of reference counting. (This is in contrast to the style where one thread blocks new references and then waits under a lock for existing ones to drain with a condvar -- no membar needed thanks to mutex(9).)
I searched for atomic_dec to find all these. Obviously we ought to have a better abstraction for this because there's so much copypasta. This is a stop-gap measure to fix actual bugs until we have that. It would be nice if an abstraction could gracefully handle the different styles of reference counting in use -- some years ago I drafted an API for this, but making it cover everything got a little out of hand (particularly with struct vnode::v_usecount) and I ended up setting it aside to work on psref/localcount instead for better scalability.
I got bored of adding #ifdef __HAVE_ATOMIC_AS_MEMBAR everywhere, so I only put it on things that look performance-critical on 5sec review. We should really adopt membar_enter_preatomic/membar_exit_postatomic or something (except they are applicable only to atomic r/m/w, not to atomic_load/store_*, making the naming annoying) and get rid of all the ifdefs.
|
1.15 |
| 23-Dec-2021 |
yamaguchi | hyper-v: move idt vector allocating to vmbus_init_interrupts_md() for refactoring
And, the deallocating is also moved to vmbus_deinit_interrupts_md().
reviewed by nonaka@n.o.
|
1.14 |
| 07-Aug-2021 |
thorpej | Merge thorpej-cfargs2.
|
1.13 |
| 24-Apr-2021 |
thorpej | branches: 1.13.8; Merge thorpej-cfargs branch:
Simplify and make extensible the config_search() / config_found() / config_attach() interfaces: rather than having different variants for which arguments you want pass along, just have a single call that takes a variadic list of tag-value arguments.
Adjust all call sites: - Simplify wherever possible; don't pass along arguments that aren't actually needed. - Don't be explicit about what interface attribute is attaching if the device only has one. (More simplification.) - Add a config_probe() function to be used in indirect configuiration situations, making is visibly easier to see when indirect config is in play, and allowing for future change in semantics. (As of now, this is just a wrapper around config_match(), but that is an implementation detail.)
Remove unnecessary or redundant interface attributes where they're not needed.
There are currently 5 "cfargs" defined: - CFARG_SUBMATCH (submatch function for direct config) - CFARG_SEARCH (search function for indirect config) - CFARG_IATTR (interface attribte) - CFARG_LOCATORS (locators array) - CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)
...and a sentinel value CFARG_EOL.
Add some extra sanity checking to ensure that interface attributes aren't ambiguous.
Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark ports to associate those device handles with device_t instance. This will trickle trough to more places over time (need back-end for pre-OFW Sun OBP; any others?).
|
1.12 |
| 29-Jan-2021 |
nonaka | branches: 1.12.2; vmbus(4): Don't wait forever.
|
1.11 |
| 26-May-2020 |
nonaka | branches: 1.11.2; vmbus(4): Do not call hyperv_dma_alloc() in interrupt context.
The channel offer and rescind process is performed on another context.
|
1.10 |
| 26-May-2020 |
nonaka | vmbus(4): Fixed incorrect use of vmbus_wait() in vmbus_channel_scan().
Found by kUBSan.
|
1.9 |
| 25-May-2020 |
nonaka | Use howmany() macro.
|
1.8 |
| 10-Dec-2019 |
nonaka | hvn(4) can be added and deleted dynamically.
|
1.7 |
| 07-Dec-2019 |
nonaka | Get a Hyper-V virtual processor id in cpu_hatch().
Currently, it is got in config_interrupts context. However, since it is required when attaching a device, it is got earlier than now.
|
1.6 |
| 06-Dec-2019 |
nonaka | Clear the allocated memory in hyperv_dma_alloc().
|
1.5 |
| 22-Nov-2019 |
nonaka | vmbus(4), hvn(4), hvkbd(4): Fixed wait time for tsleep(9).
|
1.4 |
| 09-Jul-2019 |
nakayama | branches: 1.4.2; Zero clear the allocated ring buffer for vmbus_channel. This change makes Hyper-V's vmbus devices work properly even after reboot.
|
1.3 |
| 24-May-2019 |
nonaka | branches: 1.3.2; Added drivers for Hyper-V Synthetic Keyboard and Video device.
|
1.2 |
| 15-Feb-2019 |
hannken | branches: 1.2.2; Add __diagused.
|
1.1 |
| 15-Feb-2019 |
nonaka | Added Microsoft Hyper-V support. It ported from OpenBSD and FreeBSD.
graphical console is not work on Gen.2 VM yet. To use the serial console, enter "consdev com,0x3f8,115200" on efiboot.
|
1.2.2.6 |
| 29-Jan-2021 |
martin | Pull up following revision(s) (requested by nonaka in ticket #1647):
sys/dev/hyperv/if_hvn.c: revision 1.20 (via patch) sys/dev/hyperv/hvkbd.c: revision 1.7 (via patch) sys/dev/hyperv/vmbus.c: revision 1.12 (via patch)
hvkbd(4): Don't wait forever. vmbus(4): Don't wait forever. hvn(4): Don't wait forever.
|
1.2.2.5 |
| 24-Nov-2019 |
martin | Pull up following revision(s) (requested by nonaka in ticket #1455):
sys/dev/hyperv/if_hvn.c: revision 1.8 sys/dev/hyperv/if_hvn.c: revision 1.9 sys/dev/hyperv/hvkbd.c: revision 1.5 sys/dev/hyperv/hvkbd.c: revision 1.6 sys/dev/hyperv/vmbus.c: revision 1.5
vmbus(4), hvn(4), hvkbd(4): Fixed wait time for tsleep(9). hvn(4), hvkbd(4): Only need to poll when cold.
|
1.2.2.4 |
| 09-Jul-2019 |
martin | Pull up following revision(s) (requested by nakayama in ticket #1286):
sys/dev/hyperv/vmbus.c: revision 1.4
Zero clear the allocated ring buffer for vmbus_channel. This change makes Hyper-V's vmbus devices work properly even after reboot.
|
1.2.2.3 |
| 12-Jun-2019 |
martin | Pull up following revision(s) (requested by nonaka in ticket #1280):
sys/arch/x86/x86/consinit.c: revision 1.29 sys/dev/hyperv/vmbusvar.h: revision 1.2 sys/dev/hyperv/genfb_vmbusvar.h: revision 1.1 sys/arch/x86/x86/x86_autoconf.c: revision 1.78 sys/arch/x86/x86/identcpu.c: revision 1.91 sys/arch/x86/x86/hyperv.c: revision 1.2 sys/arch/x86/x86/hyperv.c: revision 1.3 sys/arch/x86/x86/hyperv.c: revision 1.4 sys/arch/i386/conf/GENERIC: revision 1.1207 sys/dev/wscons/wsconsio.h: revision 1.123 sys/arch/x86/x86/hypervvar.h: revision 1.1 sys/arch/amd64/conf/GENERIC: revision 1.528 sys/dev/hyperv/files.hyperv: revision 1.2 sys/arch/x86/include/autoconf.h: revision 1.6 sys/dev/hyperv/hyperv_common.c: revision 1.2 sys/arch/xen/x86/autoconf.c: revision 1.23 sys/arch/x86/pci/pci_machdep.c: revision 1.86 sys/dev/hyperv/hvkbd.c: revision 1.1 sys/dev/hyperv/hypervvar.h: revision 1.2 sys/dev/acpi/vmbus_acpi.c: revision 1.2 sys/dev/hyperv/vmbus.c: revision 1.3 sys/dev/hyperv/hvkbdvar.h: revision 1.1 sys/dev/hyperv/genfb_vmbus.c: revision 1.1
Added drivers for Hyper-V Synthetic Keyboard and Video device.
Avoid undefined reference to `hyperv_guid_video' without vmbus(4).
Avoid undefined reference to `hyperv_is_gen1' without hyperv(4).
Use efi_probe().
|
1.2.2.2 |
| 09-Mar-2019 |
martin | Pull up following revision(s) via patch (requested by nonaka in ticket #1210):
sys/dev/hyperv/vmbusvar.h: revision 1.1 sys/dev/hyperv/hvs.c: revision 1.1 sys/dev/hyperv/if_hvn.c: revision 1.1 sys/dev/hyperv/vmbusic.c: revision 1.1 sys/arch/x86/x86/lapic.c: revision 1.69 sys/arch/x86/isa/clock.c: revision 1.34 sys/arch/x86/include/intrdefs.h: revision 1.22 sys/arch/i386/conf/GENERIC: revision 1.1201 sys/arch/x86/x86/hyperv.c: revision 1.1 sys/arch/x86/include/cpu.h: revision 1.105 sys/arch/x86/x86/x86_machdep.c: revision 1.124 sys/arch/i386/conf/GENERIC: revision 1.1203 sys/arch/amd64/amd64/genassym.cf: revision 1.74 sys/arch/i386/conf/GENERIC: revision 1.1204 sys/arch/amd64/conf/GENERIC: revision 1.520 sys/arch/x86/x86/hypervreg.h: revision 1.1 sys/arch/amd64/amd64/vector.S: revision 1.69 sys/dev/hyperv/hvshutdown.c: revision 1.1 sys/dev/hyperv/hvshutdown.c: revision 1.2 sys/dev/usb/if_urndisreg.h: file removal sys/arch/x86/x86/cpu.c: revision 1.167 sys/arch/x86/conf/files.x86: revision 1.107 sys/dev/usb/if_urndis.c: revision 1.20 sys/dev/hyperv/vmbusicreg.h: revision 1.1 sys/dev/hyperv/hvheartbeat.c: revision 1.1 sys/dev/hyperv/vmbusicreg.h: revision 1.2 sys/dev/hyperv/hvheartbeat.c: revision 1.2 sys/dev/hyperv/files.hyperv: revision 1.1 sys/dev/ic/rndisreg.h: revision 1.1 sys/arch/i386/i386/genassym.cf: revision 1.111 sys/dev/ic/rndisreg.h: revision 1.2 sys/dev/hyperv/hyperv_common.c: revision 1.1 sys/dev/hyperv/hvtimesync.c: revision 1.1 sys/dev/hyperv/hypervreg.h: revision 1.1 sys/dev/hyperv/hvtimesync.c: revision 1.2 sys/dev/hyperv/vmbusicvar.h: revision 1.1 sys/dev/hyperv/if_hvnreg.h: revision 1.1 sys/arch/x86/x86/lapic.c: revision 1.70 sys/arch/amd64/amd64/vector.S: revision 1.70 sys/dev/ic/ndisreg.h: revision 1.1 sys/arch/amd64/conf/GENERIC: revision 1.516 sys/dev/hyperv/hypervvar.h: revision 1.1 sys/arch/amd64/conf/GENERIC: revision 1.518 sys/arch/amd64/conf/GENERIC: revision 1.519 sys/arch/i386/conf/files.i386: revision 1.400 sys/dev/acpi/vmbus_acpi.c: revision 1.1 sys/dev/hyperv/vmbus.c: revision 1.1 sys/dev/hyperv/vmbus.c: revision 1.2 sys/arch/x86/x86/intr.c: revision 1.144 sys/arch/i386/i386/vector.S: revision 1.83 sys/arch/amd64/conf/files.amd64: revision 1.112
separate RNDIS definitions from urndis(4) for use with Hyper-V NetVSC.
-
Added Microsoft Hyper-V support. It ported from OpenBSD and FreeBSD. graphical console is not work on Gen.2 VM yet. To use the serial console, enter "consdev com,0x3f8,115200" on efiboot.
-
Add __diagused.
-
PR/53984: Partial revert of modify lapic_calibrate_timer() in lapic.c r1.69.
-
Update Hyper-V related drivers description.
-
Remove unused definition.
-
Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly discussed on irc. NFCI intended.
-
commented out hvkvp entry.
-
fix typo. pointed out by pgoyette@n.o.
-
Use IDTVEC instead of NENTRY for handle_hyperv_hypercall.
-
Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly discussed on irc.
|
1.2.2.1 |
| 15-Feb-2019 |
martin | file vmbus.c was added on branch netbsd-8 on 2019-03-09 17:10:19 +0000
|
1.3.2.3 |
| 08-Apr-2020 |
martin | Merge changes from current as of 20200406
|
1.3.2.2 |
| 10-Jun-2019 |
christos | Sync with HEAD
|
1.3.2.1 |
| 24-May-2019 |
christos | file vmbus.c was added on branch phil-wifi on 2019-06-10 22:07:09 +0000
|
1.4.2.2 |
| 04-Feb-2021 |
martin | Pull up following revision(s) (requested by nonaka in ticket #1192):
sys/dev/hyperv/if_hvn.c: revision 1.20 (via patch) sys/dev/hyperv/hvkbd.c: revision 1.7 (via patch) sys/dev/hyperv/vmbus.c: revision 1.12 (via patch)
hvkbd(4): Don't wait forever. vmbus(4): Don't wait forever. hvn(4): Don't wait forever.
|
1.4.2.1 |
| 24-Nov-2019 |
martin | Pull up following revision(s) (requested by nonaka in ticket #464):
sys/dev/hyperv/if_hvn.c: revision 1.8 sys/dev/hyperv/if_hvn.c: revision 1.9 sys/dev/hyperv/hvkbd.c: revision 1.5 sys/dev/hyperv/hvkbd.c: revision 1.6 sys/dev/hyperv/vmbus.c: revision 1.5
vmbus(4), hvn(4), hvkbd(4): Fixed wait time for tsleep(9). hvn(4), hvkbd(4): Only need to poll when cold.
|
1.11.2.1 |
| 03-Apr-2021 |
thorpej | Sync with HEAD.
|
1.12.2.1 |
| 23-Mar-2021 |
thorpej | Convert config_found_ia() call sites where the device only carries a single interface attribute to bare config_found() calls.
|
1.13.8.1 |
| 04-Aug-2021 |
thorpej | Adapt to CFARGS().
|
1.18.10.1 |
| 02-Aug-2025 |
perseant | Sync with HEAD
|
1.18.4.1 |
| 04-Apr-2025 |
martin | Pull up following revision(s) (requested by nonaka in ticket #1079):
sys/dev/hyperv/vmbus.c: revision 1.19
vmbus(4): Fix missing conversion to condvar(9).
|