Eliminate the arena parameter to kmem_free(). Implicitly this corrects anerror in the function hypercall_memfree(), where the wrong arena was beingpassed to kmem_free().Introduce a per-page flag
Eliminate the arena parameter to kmem_free(). Implicitly this corrects anerror in the function hypercall_memfree(), where the wrong arena was beingpassed to kmem_free().Introduce a per-page flag, VPO_KMEM_EXEC, to mark physical pages that aremapped in kmem with execute permissions. Use this flag to determine whicharena the kmem virtual addresses are returned to.Eliminate UMA_SLAB_KRWX. The introduction of VPO_KMEM_EXEC makes itredundant.Update the nearby comment for UMA_SLAB_KERNEL.Reviewed by: kib, markjDiscussed with: jeffApproved by: re (marius)Differential Revision: https://reviews.freebsd.org/D16845
show more ...
Eliminate kmem_malloc()'s unused arena parameter. (The arena parameterbecame unused in FreeBSD 12.x as a side-effect of the NUMA-relatedchanges.)Reviewed by: kib, markjDiscussed with: jeff, re@
Eliminate kmem_malloc()'s unused arena parameter. (The arena parameterbecame unused in FreeBSD 12.x as a side-effect of the NUMA-relatedchanges.)Reviewed by: kib, markjDiscussed with: jeff, re@Differential Revision: https://reviews.freebsd.org/D16825
Use SMAP on amd64.Ifuncs selectors dispatch copyin(9) family to the suitable variant, toset rflags.AC around userspace access. Rflags.AC bit is cleared inall kernel entry points unconditionally
Use SMAP on amd64.Ifuncs selectors dispatch copyin(9) family to the suitable variant, toset rflags.AC around userspace access. Rflags.AC bit is cleared inall kernel entry points unconditionally even on machines notsupporting SMAP.Reviewed by: jhbSponsored by: The FreeBSD FoundationDifferential revision: https://reviews.freebsd.org/D13838
hyperv: Fix boot-up after malloc() returns memory of NX by default nowFreeBSD VM can't boot up on Hyper-V after the recent malloc change inr335068: Make UMA and malloc(9) return non-executable mem
hyperv: Fix boot-up after malloc() returns memory of NX by default nowFreeBSD VM can't boot up on Hyper-V after the recent malloc change inr335068: Make UMA and malloc(9) return non-executable memory in most cases.The hypercall page here must be executable.Fix the boot-up issue by adding M_EXEC.PR: 229167Sponsored by: Microsoft
i386 4/4G split.The change makes the user and kernel address spaces on i386independent, giving each almost the full 4G of usable virtual addressesexcept for one PDE at top used for trampoline and
i386 4/4G split.The change makes the user and kernel address spaces on i386independent, giving each almost the full 4G of usable virtual addressesexcept for one PDE at top used for trampoline and per-CPU trampolinestacks, and system structures that must be always mapped, namely IDT,GDT, common TSS and LDT, and process-private TSS and LDT if allocated.By using 1:1 mapping for the kernel text and data, it appearedpossible to eliminate assembler part of the locore.S which bootstrapsinitial page table and KPTmap. The code is rewritten in C and movedinto the pmap_cold(). The comment in vmparam.h explains the KVAlayout.There is no PCID mechanism available in protected mode, so eachkernel/user switch forth and back completely flushes the TLB, exceptfor the trampoline PTD region. The TLB invalidations for userspacebecomes trivial, because IPI handlers switch page tables. On the otherhand, context switches no longer need to reload %cr3.copyout(9) was rewritten to use vm_fault_quick_hold(). An issue fornew copyout(9) is compatibility with wiring user buffers around sysctlhandlers. This explains two kind of locks for copyout ptes andaccounting of the vslock() calls. The vm_fault_quick_hold() AKA slowpath, is only tried after the 'fast path' failed, which temporarychanges mapping to the userspace and copies the data to/from smallper-cpu buffer in the trampoline. If a page fault occurs during thecopy, it is short-circuit by exception.s to not even reach C code.The change was motivated by the need to implement the Meltdownmitigation, but instead of KPTI the full split is done. The i386architecture already shows the sizing problems, in particular, it isimpossible to link clang and lld with debugging. I expect that theissues due to the virtual address space limits would only exaggerateand the split gives more liveness to the platform.Tested by: phoDiscussed with: bdeSponsored by: The FreeBSD FoundationMFC after: 1 monthDifferential revision: https://reviews.freebsd.org/D14633
Correct comment typo in Hyper-VPR: 226665Submitted by: Ryo ONODERAMFC after: 3 days
Rename assym.s to assym.incassym is only to be included by other .s files, and should neveractually be assembled by itself.Reviewed by: imp, bdrewery (earlier)Sponsored by: The FreeBSD Foundati
Rename assym.s to assym.incassym is only to be included by other .s files, and should neveractually be assembled by itself.Reviewed by: imp, bdrewery (earlier)Sponsored by: The FreeBSD FoundationDifferential Revision: https://reviews.freebsd.org/D14180
PTI for amd64.The implementation of the Kernel Page Table Isolation (KPTI) foramd64, first version. It provides a workaround for the 'meltdown'vulnerability. PTI is turned off by default for now
PTI for amd64.The implementation of the Kernel Page Table Isolation (KPTI) foramd64, first version. It provides a workaround for the 'meltdown'vulnerability. PTI is turned off by default for now, enable with theloader tunable vm.pmap.pti=1.The pmap page table is split into kernel-mode table and user-modetable. Kernel-mode table is identical to the non-PTI table, whileusermode table is obtained from kernel table by leaving userspacemappings intact, but only leaving the following parts of the kernelmapped: kernel text (but not modules text) PCPU GDT/IDT/user LDT/task structures IST stacks for NMI and doublefault handlers.Kernel switches to user page table before returning to usermode, andrestores full kernel page table on the entry. Initial kernel-modestack for PTI trampoline is allocated in PCPU, it is only 16qwords. Kernel entry trampoline switches page tables. then thehardware trap frame is copied to the normal kstack, and executioncontinues.IST stacks are kept mapped and no trampoline is needed forNMI/doublefault, but of course page table switch is performed.On return to usermode, the trampoline is used again, iret frame iscopied to the trampoline stack, page tables are switched and iretq isexecuted. The case of iretq faulting due to the invalid usermodecontext is tricky, since the frame for fault is appended to thetrampoline frame. Besides copying the fault frame and original(corrupted) frame to kstack, the fault frame must be patched to makeit look as if the fault occured on the kstack, see the comment indoret_iret detection code in trap().Currently kernel pages which are mapped during trampoline operationare identical for all pmaps. They are registered usingpmap_pti_add_kva(). Besides initial registrations done during boot,LDT and non-common TSS segments are registered if user requested theiruse. In principle, they can be installed into kernel page table perpmap with some work. Similarly, PCPU can be hidden from userspacemapping using trampoline PCPU page, but again I do not see muchbenefits besides complexity.PDPE pages for the kernel half of the user page tables arepre-allocated during boot because we need to know pml4 entries whichare copied to the top-level paging structure page, in advance on a newpmap creation. I enforce this to avoid iterating over the allexisting pmaps if a new PDPE page is needed for PTI kernel mappings.The iteration is a known problematic operation on i386.The need to flush hidden kernel translations on the switch to usermode make global tables (PG_G) meaningless and even harming, so PG_Guse is disabled for PTI case. Our existing use of PCID isincompatible with PTI and is automatically disabled if PTI isenabled. PCID can be forced on only for developer's benefit.MCE is known to be broken, it requires IST stack to operate completelycorrectly even for non-PTI case, and absolutely needs dedicated ISTstack because MCE delivery while trampoline did not switched from PTIstack is fatal. The fix is pending.Reviewed by: markj (partially)Tested by: pho (previous version)Discussed with: jeff, jhbSponsored by: The FreeBSD FoundationMFC after: 2 weeks
hyperv/vmbus: Expose Hyper-V major version.MFC after: 3 daysSponsored by: Microsoft
hyperv/vmbus: Add tunable to pin/unpin event tasks.Event tasks are pinned to their respective CPU by default, in the samefashion as they were.Unpin the event tasks by setting hw.vmbus.pin_evttas
hyperv/vmbus: Add tunable to pin/unpin event tasks.Event tasks are pinned to their respective CPU by default, in the samefashion as they were.Unpin the event tasks by setting hw.vmbus.pin_evttask to 0, if certainCPUs serve special purpose.MFC after: 3 daysSponsored by: Microsoft
hyperv: Update copyright for the files changed in 2017MFC after: 3 daysSponsored by: MicrosoftDifferential Revision: https://reviews.freebsd.org/D11982
hyperv/vmbus: Reorganize vmbus device treeFor GEN1 Hyper-V, vmbus is attached to pcib0, which contains theresources for PCI passthrough and SR-IOV. There is noacpi_syscontainer0 on GEN1 Hyper-V.
hyperv/vmbus: Reorganize vmbus device treeFor GEN1 Hyper-V, vmbus is attached to pcib0, which contains theresources for PCI passthrough and SR-IOV. There is noacpi_syscontainer0 on GEN1 Hyper-V.For GEN2 Hyper-V, vmbus is attached to acpi_syscontainer0, whichcontains the resources for PCI passthrough and SR-IOV. There isno pcib0 on GEN2 Hyper-V.The ACPI VMBUS device now only holds its _CRS, which is empty asof this commit; its existence is mainly for upward compatibility.Device tree structure is suggested by jhb@.Tested-by: dexuan@Collabrated-wth: dexuan@MFC after: 1 weekSponsored by: MicrosoftDifferential Revision: https://reviews.freebsd.org/D10565
hyperv: Use kmem_malloc for hypercall memory due to NX bit change.Reported by: dexuan@MFC after: nowSponsored by: Microsoft
hyperv: Add method to read 64bit Hyper-V specific time value.MFC after: 1 weekSponsored by: MicrosoftDifferential Revision: https://reviews.freebsd.org/D9057
hyperv/vmbus: Nuke unnecessary critical sections.MFC after: 1 weekSponsored by: MicrosoftDifferential Revision: https://reviews.freebsd.org/D8906
hyperv: Unbreak EARLY_AP_STARUP Hyper-V bootstrap by using intrhookProperly working pause and friends are required.MFC after: 3 daysSponsored by: Microsoft
hyperv: Implement userspace gettimeofday(2) with Hyper-V reference TSCThis 6 times gettimeofday performance, as measured bytools/tools/syscall_timingReviewed by: kibMFC after: 1 weekSponsored
hyperv: Implement userspace gettimeofday(2) with Hyper-V reference TSCThis 6 times gettimeofday performance, as measured bytools/tools/syscall_timingReviewed by: kibMFC after: 1 weekSponsored by: MicrosoftDifferential Revision: https://reviews.freebsd.org/D8789
hyperv: Allow userland to ro-mmap reference TSC pageThis paves way to implement VDSO for the enlightened time counter.Reviewed by: kibMFC after: 1 weekSponsored by: MicrosoftDifferential Revis
hyperv: Allow userland to ro-mmap reference TSC pageThis paves way to implement VDSO for the enlightened time counter.Reviewed by: kibMFC after: 1 weekSponsored by: MicrosoftDifferential Revision: https://reviews.freebsd.org/D8768
hyperv: Implement "enlightened" time counter, which is rdtsc based.Reviewed by: kibMFC after: 1 weekSponsored by: MicrosoftDifferential Revision: https://reviews.freebsd.org/D8763
hyperv/vmbus: Add channel polling support.MFC after: 1 weekSponsored by: MicrosoftDifferential Revision: https://reviews.freebsd.org/D8738
hyperv/timesync: Support "sent TC" to improve accuracy.MFC after: 1 weekSponsored by: MicrosoftDifferential Revision: https://reviews.freebsd.org/D8723
hyperv/vmbus: Utilize vmbus_chan_run_task()MFC after: 1 weekSponsored by: MicrosoftDifferential Revision: https://reviews.freebsd.org/D8686
hyperv/vmbus: Use pause if possible.This makes booting on Hyper-V w/ small # of vCPUs work properly.Reported by: Hongxiong Xian <v-hoxian microsoft com>, Hongjiang Zhang <honzhan microsoft com>M
hyperv/vmbus: Use pause if possible.This makes booting on Hyper-V w/ small # of vCPUs work properly.Reported by: Hongxiong Xian <v-hoxian microsoft com>, Hongjiang Zhang <honzhan microsoft com>MFC after: 1 weekSponsored by: Microsoft
hypver/vmbus: Remove extra assertion.It is asserted by vmbus_chan_gpadl_connect() now.MFC after: 1 weekSponsored by: MicrosoftDifferential Revision: https://reviews.freebsd.org/D8660
hyperv/vmbus: Add DEVMETHOD to map cpu to event taskq.MFC after: 1 weekSponsored by: MicrosoftDifferential Revision: https://reviews.freebsd.org/D8658
12345678910>>...14