369342 |
23-Feb-2021 |
emaste |
xen-blkback: fix leak of grant maps on ring setup failure
Multi page rings are mapped using a single hypercall that gets passed an array of grants to map. One of the grants in the array failing to map would lead to the failure of the whole ring setup operation, but there was no cleanup of the rest of the grant maps in the array that could have likely been created as a result of the hypercall.
Add proper cleanup on the failure path during ring setup to unmap any grants that could have been created.
This is part of XSA-361.
Sponsored by: Citrix Systems R&D
(cherry picked from commit 808d4aad1022a2a33d222663b0c9badde30b9d45)
Git Hash: 89238773a37f4fc8f0bf3ccca3aa03874478f194 Git Author: royger@FreeBSD.org |
369072 |
21-Jan-2021 |
royger |
xen: allow limiting the amount of duplicated pending xenstore watches
Xenstore watches received are queued in a list and processed in a deferred thread. Such queuing was done without any checking, so a guest could potentially trigger a resource starvation against the FreeBSD kernel if such kernel is watching any user-controlled xenstore path.
Allowing limiting the amount of pending events a watch can accumulate to prevent a remote guest from triggering this resource starvation issue.
For the PV device backends and frontends this limitation is only applied to the other end /state node, which is limited to 1 pending event, the rest of the watched paths can still have unlimited pending watches because they are either local or controlled by a privileged domain.
The xenstore user-space device gets special treatment as it's not possible for the kernel to know whether the paths being watched by user-space processes are controlled by a guest domain. For this reason watches set by the xenstore user-space device are limited to 1000 pending events. Note this can be modified using the max_pending_watch_events sysctl of the device.
This is XSA-349.
Sponsored by: Citrix Systems R&D MFC after: 3 days
(cherry picked from commit 4e4e43dc9e1afc863670a031cc5cc75eb5e668d6)
Note the xenstore user-space device part of this backport is dropped, as in stable/11 the device doesn't support setting up watches.
Git Hash: d9bd043f93df1a31ef16d2198d720a0a0831357f Git Author: royger@FreeBSD.org |
362331 |
18-Jun-2020 |
royger |
MFC r352925: xen/ctrl: acknowledge all control requests MFC r357616: xen/console: fix priority of Xen console MFC r361274: dev/xenstore: fix return with locks held Note this should be dev/evtchn not dev/xenstore. MFC r361578: xenpv: do not use low 1MB for Xen mappings on i386 MFC r361580: xen/control: short circuit xctrl_on_watch_event on spurious event
Those are all Xen related fixes or minor improvements that have been sitting on current for a reasonable time without complaints.
Sponsored by: Citrix Systems R&D |
346817 |
28-Apr-2019 |
dchagin |
MFC r329873 (by emaste@):
Correct pseudo misspelling in sys/ comments
contrib code and #define in intel_ata.h unchanged. |
334315 |
29-May-2018 |
royger |
MFC r334027: xen-blkback: do not use state 3
Linux will not connect to a backend that's in state 3 (XenbusStateInitialised), it needs to be in state 2 (XenbusStateInitWait) for Linux to attempt to connect to the backend.
Approved by: re (kib) |
331722 |
29-Mar-2018 |
eadler |
Revert r330897:
This was intended to be a non-functional change. It wasn't. The commit message was thus wrong. In addition it broke arm, and merged crypto related code.
Revert with prejudice.
This revert skips files touched in r316370 since that commit was since MFCed. This revert also skips files that require $FreeBSD$ property changes.
Thank you to those who helped me get out of this mess including but not limited to gonzo, kevans, rgrimes.
Requested by: gjb (re) |
330897 |
14-Mar-2018 |
eadler |
Partial merge of the SPDX changes
These changes are incomplete but are making it difficult to determine what other changes can/should be merged.
No objections from: pfg |
323472 |
11-Sep-2017 |
ian |
MFC r322411:
Stop calling atrtc_set() from the xen timer clock_settime() method. That removes the only reference to atrtc_set() from outside of atrtc.c, so make it static.
The xen timer driver registers as a realtime clock with 1us resolution. In the past that resulted in only the xen timer's clock_settime() getting called, so it would call atrtc_set() to set the hardware clock as well. As of r32090, the clock_settime() method of all registered realtime clocks gets called, so the xen driver no longer needs to chain-call the lower-resolution driver.
Thanks to royger@ for talking me through the xen stuff, and for testing. |
323207 |
06-Sep-2017 |
rlibby |
MFC r320517:
netfront.c: avoid gcc variably-modified warning |
320219 |
22-Jun-2017 |
cperciva |
MFC r319491:
Skip setting the MTU in the netfront driver (xn# devices) if the new MTU is the same as the old MTU. In particular, on Amazon EC2 "T2" instances without this change, the network interface is reinitialized every 30 minutes due to the MTU being (re)set when a new DHCP lease is obtained.
Approved by: re (delphij) |
318919 |
26-May-2017 |
royger |
MFC r318523, r318631:
xen/netfront: don't drop the ring RX lock with inconsistent ring state xen/netfront: don't drop the RX lock in xn_rxeof |
318918 |
26-May-2017 |
royger |
MFC r318520:
xen/blkfront: correctly detach a disk with active users |
318347 |
16-May-2017 |
royger |
MCF r310418: xen: fix IPI setup with EARLY_AP_STARTUP
Sponsored by: Citrix Systems R&D |
316362 |
01-Apr-2017 |
asomers |
MFC r314148, r314150
r314148: Misc Coverity fixes in xnb(4)
Most of these are null pointer dereferences or missing error checks in the unit tests. One is a missing error check in xnb_attach_failed. None can cause real problems in running systems.
Reported by: Coverity CIDs: 1092469 1092468 1092467 2092466 1092465 1092512 1092511 1092510 CIDs: 1092510 1092509 1092508 1092507 Reviewed by: royger MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D9234
r314150: Fix the xnb(4) unit tests
One test was inadvertently expecting a bug in the kernel's sscanf implementation circa 2012. I don't know when that bug got fixed.
Reported by: royger Reviewed by: royger MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D9766 |
316007 |
27-Mar-2017 |
kevlo |
MFC r315878: Don't initialize if_output to ether_output(), ether_ifattach() does it for us already. While here, remove NOTYET code since if_watchdog is no longer used.
Reviewed by: royger |
315668 |
21-Mar-2017 |
royger |
MFC r314840:
xen: add support for canceled suspend
Submitted by: Liuyingdong <liuyingdong@huawei.com> Reviewed by: royger |
315667 |
21-Mar-2017 |
royger |
MFC r314841:
xenstore: fix suspension when using the xenstore device
Submitted by: Liuyingdong <liuyingdong@huawei.com> Reviewed by: royger |
315666 |
21-Mar-2017 |
royger |
MFC r314094:
xen/timer: mark the Xen PV timer as not safe for suspension
Submitted by: Liuyingdong <liuyingdong@huawei.com> Reviewed by: royger |
315665 |
21-Mar-2017 |
royger |
MFC r314842:
xen/netfront: fix inbound packet flags for checksum offload
Reviewed by: Wei Liu <wei.liu2@citrix.com> Sponsored by: Citrix Systems R&D |
315403 |
16-Mar-2017 |
royger |
MFC r308126:
xen/netfront: fix statistics
PR: 213439 |
310228 |
18-Dec-2016 |
dim |
MFC r310013 (by cperciva):
Check that blkfront devices have a non-zero number of sectors and a non-zero sector size. Such a device would be a virtual disk of zero bytes; clearly not useful, and not something we should try to attach.
As a fortuitous side effect, checking that these values are non-zero here results in them not *becoming* zero later on the function. This odd behaviour began with r309124 (clang 3.9.0) but is challenging to debug; making any changes to this function whatsoever seems to affect the llvm optimizer behaviour enough to make the unexpected zeroing of the sector_size variable cease.
PR: 215209 Security: The potential for variables to unexpectedly become zero has worrying consequences for security in general, but not so much in this particular context.
MFC r310086:
In xbd_connect(), use correct scanf conversion specifiers for the feature_barrier and feature_flush variables. Otherwise, adjacent variables on the stack, such as sector_size, may be overwritten, with disastrous results.
Note that I did not see a good reason to revert the addition of zero checks introduced in r310013. Better safe than sorry.
PR: 215209 Tested by: royger |
303902 |
10-Aug-2016 |
royger |
MFC r303488 and r303771:
xen-netfront: fix trying to send packets with disconnected netfront xen-netfront: improve the logic when handling nic features from ioctl
Approved by: re (kib) |
302408 |
08-Jul-2016 |
gjb |
Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle. Prune svn:mergeinfo from the new branch, as nothing has been merged here.
Additional commits post-branch will follow.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
301742 |
09-Jun-2016 |
royger |
xen/timer: re-introduce the inittodr call in the resume path
r298930 removed the inittodr call, but it seems like this prevents "calcru: runtime went backwards ..." messages from occasionally appearing when resuming from migration.
Reported by: Karl Pielorz <kpielorz@tdx.co.uk> Sponsored by: Citrix Systems R&D
|
301512 |
06-Jun-2016 |
royger |
xen-netfront: fix initialization
A couple of mostly cosmetic fixes for the final initialization of netfront:
- Switch to "connected" state before starting to kick the rings. - Correctly use "rxq" in the initialization loop (previously rxq was not updated in the loop, and netfront would kick np->rxq[N] several times). - Declare and define xn_connect as static, it's not used outside of this file.
Reviewed by: Wei Liu <wei.liu2@citrix.com> Sponsored by: Citrix Systems R&D Differential revision: https://reviews.freebsd.org/D6657
|
301269 |
03-Jun-2016 |
royger |
xen-blkback: fix error path on failed attach
The current error path in case of failure during attach/initialization is not correct and leaves blkback in a stuck state. This is due to blkback waiting for blkfront to switch to state XenbusStateClosed, but if blkfront never attached (because the guest is not even started) it cannot possibly make it to that state.
Instead just wait for the frontend to be in a state different than XenbusStateConnected in order to proceed with the shutdown. Also, it is wrong to call xbb_detach directly because it destroys the lock which can still be used by xbb_frontend_changed.
Sponsored by: Citrix Systems R&D
|
301268 |
03-Jun-2016 |
royger |
blkback: add support for hotplug scripts
Hotplug scripts are needed in order to use fancy disk configurations in xl, like iSCSI disks. The job of hotplug scripts is to locally attach the disk and present it to blkback as a block device or a regular file.
This change introduces a new xenstore node in the blkback hierarchy, called "physical-device-path". This is a straigh replacement for the "params" node, which was used before.
Hotplug scripts will need to read the "params" node, perform whatever actions are necessary and then write the "physical-device-path" node. The hotplug script is also in charge of detaching the disk once the domain has been shutdown.
Sponsored by: Citrix Systems R&D
|
301204 |
02-Jun-2016 |
royger |
xen-netfront: use callout_reset_curcpu instead of callout_reset
This should help distribute the load of the callbacks.
Suggested by: hps Sponsored by: Citrix Systems R&D
|
301201 |
02-Jun-2016 |
royger |
xen-netfront: perform an interface reset when changing options
The PV backend will only pick the new options when the interface is detached and reattached again, so perform a full reset when changing options. This is very fast, and should not be noticeable by the user.
Reviewed by: Wei Liu <wei.liu2@citrix.com> Sponsored by: Citrix Systems R&D Differential revision: https://reviews.freebsd.org/D6658
|
301200 |
02-Jun-2016 |
royger |
xen-netfront: release grant references used for the shared rings
Just calling gnttab_end_foreign_access_ref doesn't free the references, instead call gnttab_end_foreign_access with a NULL page argument in order to have the grant references freed. The code that maps the ring (xenbus_map_ring) already uses gnttab_grant_foreign_access which takes care of allocating a grant reference.
Reviewed by: Wei Liu <wei.liu2@citrix.com> Sponsored by: Citrix Systems R&D Differential revision: https://reviews.freebsd.org/D6608
|
301199 |
02-Jun-2016 |
royger |
xen-netfront: fix two hotplug related issues
This patch fixes two issues seen on hot-unplug. The first one is a panic caused by calling ether_ifdetach after freeing the internal netfront queue structures. ether_ifdetach will call xn_qflush, and this needs to be done before freeing the queues. This prevents the following panic:
Fatal trap 9: general protection fault while in kernel mode cpuid = 2; apic id = 04 instruction pointer = 0x20:0xffffffff80b1687f stack pointer = 0x28:0xfffffe009239e770 frame pointer = 0x28:0xfffffe009239e780 code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags = interrupt enabled, resume, IOPL = 0 current process = 0 (thread taskq) [ thread pid 0 tid 100015 ] Stopped at strlen+0x1f: movq (%rcx),%rax db> bt Tracing pid 0 tid 100015 td 0xfffff800038a6000 strlen() at strlen+0x1f/frame 0xfffffe009239e780 kvprintf() at kvprintf+0xfa0/frame 0xfffffe009239e890 vsnprintf() at vsnprintf+0x31/frame 0xfffffe009239e8b0 kassert_panic() at kassert_panic+0x5a/frame 0xfffffe009239e920 __mtx_lock_flags() at __mtx_lock_flags+0x164/frame 0xfffffe009239e970 xn_qflush() at xn_qflush+0x59/frame 0xfffffe009239e9b0 if_detach() at if_detach+0x17e/frame 0xfffffe009239ea10 netif_free() at netif_free+0x97/frame 0xfffffe009239ea30 netfront_detach() at netfront_detach+0x11/frame 0xfffffe009239ea40 [...]
Another panic can be triggered by hot-plugging a NIC:
Fatal trap 18: integer divide fault while in kernel mode cpuid = 0; apic id = 00 instruction pointer = 0x20:0xffffffff80902203 stack pointer = 0x28:0xfffffe00508d3660 frame pointer = 0x28:0xfffffe00508d36a0 code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags = interrupt enabled, resume, IOPL = 0 current process = 2960 (ifconfig) [ thread pid 2960 tid 100088 ] Stopped at xn_txq_mq_start+0x33: divl %esi,%eax db> bt Tracing pid 2960 tid 100088 td 0xfffff8000850aa00 xn_txq_mq_start() at xn_txq_mq_start+0x33/frame 0xfffffe00508d36a0 ether_output() at ether_output+0x570/frame 0xfffffe00508d3720 arprequest() at arprequest+0x433/frame 0xfffffe00508d3820 arp_ifinit() at arp_ifinit+0x49/frame 0xfffffe00508d3850 xn_ioctl() at xn_ioctl+0x1a2/frame 0xfffffe00508d3890 in_control() at in_control+0x882/frame 0xfffffe00508d3910 ifioctl() at ifioctl+0xda1/frame 0xfffffe00508d39a0 kern_ioctl() at kern_ioctl+0x246/frame 0xfffffe00508d3a00 sys_ioctl() at sys_ioctl+0x171/frame 0xfffffe00508d3ae0 amd64_syscall() at amd64_syscall+0x2db/frame 0xfffffe00508d3bf0 Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfffffe00508d3bf0 --- syscall (54, FreeBSD ELF64, sys_ioctl), rip = 0x8011e185a, rsp = 0x7fffffffe478, rbp = 0x7fffffffe4c0 ---
This is caused by marking the driver as active before it's fully initialized, and thus calling xn_txq_mq_start with num_queues set to 0.
Reviewed by: Wei Liu <wei.liu2@citrix.com> Sponsored by: Citrix Systems R&D Differential revision: https://reviews.freebsd.org/D6646
|
301198 |
02-Jun-2016 |
royger |
xen-netfront: switch to using an interrupt handler
In order to use custom taskqueues we would have to mask the interrupt, which is basically what is already done for an interrupt handler, or else we risk loosing interrupts. This switches netfront to the same interrupt handling that was done before multiqueue support was added.
Reviewed by: Wei Liu <wei.liu2@citrix.com> Sponsored by: Citrix Systems R&D
|
301197 |
02-Jun-2016 |
royger |
xen-netfront: always keep the Rx ring full of requests
This is based on Linux commit 1f3c2eba1e2d866ef99bb9b10ade4096e3d7607c from David Vrabel:
A full Rx ring only requires 1 MiB of memory. This is not enough memory that it is useful to dynamically scale the number of Rx requests in the ring based on traffic rates, because:
a) Even the full 1 MiB is a tiny fraction of a typically modern Linux VM (for example, the AWS micro instance still has 1 GiB of memory).
b) Netfront would have used up to 1 MiB already even with moderate data rates (there was no adjustment of target based on memory pressure).
c) Small VMs are going to typically have one VCPU and hence only one queue.
Keeping the ring full of Rx requests handles bursty traffic better than trying to converge on an optimal number of requests to keep filled.
Reviewed by: Wei Liu <wei.liu2@citrix.com> Sponsored by: Citrix Systems R&D
|
301196 |
02-Jun-2016 |
royger |
xen-netfront: fix receiving TSO packets
Currently FreeBSD is not properly fetching the TSO information from the Xen PV ring, and thus the received packets didn't have all the necessary information, like the segment size or even the TSO flag set.
Sponsored by: Citrix Systems R&D
|
299746 |
14-May-2016 |
jhb |
Add an EARLY_AP_STARTUP option to start APs earlier during boot.
Currently, Application Processors (non-boot CPUs) are started by MD code at SI_SUB_CPU, but they are kept waiting in a "pen" until SI_SUB_SMP at which point they are released to run kernel threads. SI_SUB_SMP is one of the last SYSINIT levels, so APs don't enter the scheduler and start running threads until fairly late in the boot.
This change moves SI_SUB_SMP up to just before software interrupt threads are created allowing the APs to start executing kernel threads much sooner (before any devices are probed). This allows several initialization routines that need to perform initialization on all CPUs to now perform that initialization in one step rather than having to defer the AP initialization to a second SYSINIT run at SI_SUB_SMP. It also permits all CPUs to be available for handling interrupts before any devices are probed.
This last feature fixes a problem on with interrupt vector exhaustion. Specifically, in the old model all device interrupts were routed onto the boot CPU during boot. Later after the APs were released at SI_SUB_SMP, interrupts were redistributed across all CPUs.
However, several drivers for multiqueue hardware allocate N interrupts per CPU in the system. In a system with many CPUs, just a few drivers doing this could exhaust the available pool of interrupt vectors on the boot CPU as each driver was allocating N * mp_ncpu vectors on the boot CPU. Now, drivers will allocate interrupts on their desired CPUs during boot meaning that only N interrupts are allocated from the boot CPU instead of N * mp_ncpu.
Some other bits of code can also be simplified as smp_started is now true much earlier and will now always be true for these bits of code. This removes the need to treat the single-CPU boot environment as a special case.
As a transition aid, the new behavior is available under a new kernel option (EARLY_AP_STARTUP). This will allow the option to be turned off if need be during initial testing. I plan to enable this on x86 by default in a followup commit in the next few days and to have all platforms moved over before 11.0. Once the transition is complete, the option will be removed along with the !EARLY_AP_STARTUP code.
These changes have only been tested on x86. Other platform maintainers are encouraged to port their architectures over as well. The main things to check for are any uses of smp_started in MD code that can be simplified and SI_SUB_SMP SYSINITs in MD code that can be removed in the EARLY_AP_STARTUP case (e.g. the interrupt shuffling).
PR: kern/199321 Reviewed by: markj, gnn, kib Sponsored by: Netflix
|
299542 |
12-May-2016 |
royger |
xen-netfront: fix feature detection
Current netfront code relies on xs_scanf returning a value < 0 on error, which is not right, xs_scanf returns a positive value on error.
MFC after: 3 days Tested by: Stephen Jones <StephenJo@LivingComputerMuseum.org> Sponsored by: Citrix Systems R&D
|
299423 |
11-May-2016 |
royger |
xen/resume: only send BITMAP IPIs if CPUs > 1
This is quite harmless on HEAD, but it's worse on stable/10 where lapic_ipi_vectored is the local APIC native IPI implementation. On stable/10 cpu_ops.ipi_vectored should be used instead.
MFC after: 5 days Sponsored by: Citrix Systems R&D
|
299353 |
10-May-2016 |
trasz |
Remove misc NULL checks after M_WAITOK allocations.
MFC after: 1 month Sponsored by: The FreeBSD Foundation
|
299185 |
06-May-2016 |
royger |
xen/privcmd: fix integer truncation in IOCTL_PRIVCMD_MMAPBATCH
The size field in the XENMEM_add_to_physmap_range is an uint16_t, and the privcmd driver was doing an implicit truncation of an int into an uint16_t when filling the hypercall parameters.
Fix this by adding a loop and making sure privcmd splits ioctl request into 2^16 chunks when issuing the hypercalls.
Reported and tested by: Marcin Cieslak <saper@saper.info> Sponsored by: Citrix Systems R&D
|
299090 |
04-May-2016 |
asomers |
Improve performance and functionality of the bitstring(3) api
Two new functions are provided, bit_ffs_at() and bit_ffc_at(), which allow for efficient searching of set or cleared bits starting from any bit offset within the bit string.
Performance is improved by operating on longs instead of bytes and using ffsl() for searches within a long. ffsl() is a compiler builtin in both clang and gcc for most architectures, converting what was a brute force while loop search into a couple of instructions.
All of the bitstring(3) API continues to be contained in the header file. Some of the functions are large enough that perhaps they should be uninlined and moved to a library, but that is beyond the scope of this commit.
sys/sys/bitstring.h: Convert the majority of the existing bit string implementation from macros to inline functions.
Properly protect the implementation from inadvertant macro expansion when included in a user's program by prefixing all private macros/functions and local variables with '_'.
Add bit_ffs_at() and bit_ffc_at(). Implement bit_ffs() and bit_ffc() in terms of their "at" counterparts.
Provide a kernel implementation of bit_alloc(), making the full API usable in the kernel.
Improve code documenation.
share/man/man3/bitstring.3: Add pre-exisiting API bit_ffc() to the synopsis.
Document new APIs.
Document the initialization state of the bit strings allocated/declared by bit_alloc() and bit_decl().
Correct documentation for bitstr_size(). The original code comments indicate the size is in bytes, not "elements of bitstr_t". The new implementation follows this lead. Only hastd assumed "elements" rather than bytes and it has been corrected.
etc/mtree/BSD.tests.dist: tests/sys/Makefile: tests/sys/sys/Makefile: tests/sys/sys/bitstring.c: Add tests for all existing and new functionality.
include/bitstring.h Include all headers needed by sys/bitstring.h
lib/libbluetooth/bluetooth.h: usr.sbin/bluetooth/hccontrol/le.c: Include bitstring.h instead of sys/bitstring.h.
sbin/hastd/activemap.c: Correct usage of bitstr_size().
sys/dev/xen/blkback/blkback.c Use new bit_alloc.
sys/kern/subr_unit.c: Remove hard-coded assumption that sizeof(bitstr_t) is 1. Get rid of unrb.busy, which caches the number of bits set in unrb.map. When INVARIANTS are disabled, nothing needs to know that information. callapse_unr can be adapted to use bit_ffs and bit_ffc instead. Eliminating unrb.busy saves memory, simplifies the code, and provides a slight speedup when INVARIANTS are disabled.
sys/net/flowtable.c: Use the new kernel implementation of bit-alloc, instead of hacking the old libc-dependent macro.
sys/sys/param.h Update __FreeBSD_version to indicate availability of new API
Submitted by: gibbs, asomers Reviewed by: gibbs, ngie MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D6004
|
299065 |
04-May-2016 |
royger |
xen/pvclock: set the correct resolution for the Xen PV clock
The Xen PV clock has a resolution of 1ns, so set the resolution to the highest one that FreeBSD supports, which is 1us.
MFC after: 2 weeks Sponsored by: Citrix Systems R&D
|
298955 |
03-May-2016 |
pfg |
sys/dev: minor spelling fixes.
Most affect comments, very few have user-visible effects.
|
298934 |
02-May-2016 |
royger |
xen/control: improve suspend/resume
Implement several small improvements to the suspend/resume Xen sequence:
- Call the power_suspend_early event before stopping all processes. - Stop all processes. This was done implicitly previously by putting all the CPUs in a known IPI handler. - Warm up the timecounter. - Re-initialize the time of day register.
Sponsored by: Citrix Systems R&D
|
298930 |
02-May-2016 |
royger |
xen/time: fix PV clock resolution
The current resolution of the Xen PV clock is too high, which causes an adjustment of 5s to be applied to it. Reduce the resolution to be the same as the RTC plus one, so it's always selected as the best source when available on x86.
Also don't reset the clock on resume, it's pointless and discards any previous adjustments.
Sponsoted by: Citrix Systems R&D
|
298929 |
02-May-2016 |
royger |
xen/time: allow Dom0 to set the host time
Dom0 should be able to set the host time. This is implemented by first writing to the RTC (as would be done on bare metal), and then using the XENPF_settime64 hypercall in order to force Xen to update the wallclock shared page of all domains.
Sponsored by: Citrix Systems R&D
|
298927 |
02-May-2016 |
royger |
xen/timer: remove the timer setup loop
With the removal of the usage of the VCPU_SSHOTTMR_future flag, now all errors from xentimer_vcpu_start_timer should be considered fatal, and the loop is no longer needed since in case of setting the timer in the past we will get an event interrupt right away (instead of returning ETIME).
Sponsored by: Citrix Systems R&D MFC after : 2 weeks
|
298926 |
02-May-2016 |
royger |
xen/x86: don't lose event interrupts
On slow platforms with unreliable TSC, such as QEMU emulated machines, it is possible for the FreeBSD kernel to request the next event in the past. In that case, in the current implementation of xentimer_vcpu_start_timer, we simply return -ETIME. To be precise Xen returns -ETIME and we pass it on. As a consequence we need to loop around to function to make sure that the timer is properly set.
Instead it is better to always ask the hypervisor for a timer event, even if the timeout is past. To do that, remove the VCPU_SSHOTTMR_future flag.
Submitted by: Stefano Stabellini <sstabellini@kernel.org> Reviewed by: royger MFC after: 2 weeks
|
298646 |
26-Apr-2016 |
pfg |
sys/dev: extend use of the howmany() macro when available.
We have a howmany() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read.
|
297679 |
07-Apr-2016 |
jhb |
Associate device_t objects with ACPI handles via PCI_CHILD_ADDED().
Previously, the ACPI PCI bus driver did a single pass over the devices in the namespace that were a child of a given PCI bus to associate the PCI bus-enumerated device_t devices with the corresponding ACPI handles. However, this meant that handles were only established at runtime for devices found during the initial PCI bus scan.
PCI_IOV adds devices that show up after the initial PCI bus scan, and coming changes to add a bus rescan can also add devices after the initial scan.
This change adds a pci_child_added() callback to the ACPI PCI bus that walks the namespace to find the ACPI handle for each device that is added. Using a callback means that the handle is correctly set for any device no matter how it is added (initial scan, IOV, or a bus rescan).
|
297570 |
05-Apr-2016 |
jhb |
Remove a redundant check.
cpu_suspend_map is always empty if smp_started is false.
Sponsored by: Netflix
|
297522 |
03-Apr-2016 |
mav |
Pass through some new block device features.
MFC after: 1 month
|
297482 |
01-Apr-2016 |
sephe |
tcp/lro: Use tcp_lro_flush_all in device drivers to avoid code duplication
And factor out tcp_lro_rx_done, which deduplicates the same logic with netinet/tcp_lro.c
Reviewed by: gallatin (1st version), hps, zbb, np, Dexuan Cui <decui microsoft com> Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5725
|
296272 |
01-Mar-2016 |
jhb |
Remove taskqueue_enqueue_fast().
taskqueue_enqueue() was changed to support both fast and non-fast taskqueues 10 years ago in r154167. It has been a compat shim ever since. It's time for the compat shim to go.
Submitted by: Howard Su <howard0su@gmail.com> Reviewed by: sephe Differential Revision: https://reviews.freebsd.org/D5131
|
296242 |
01-Mar-2016 |
glebius |
New way to manage reference counting of mbuf external storage.
The m_ext.ext_cnt pointer becomes a union. It can now hold the refcount value itself. To tell that m_ext.ext_flags flag EXT_FLAG_EMBREF is used. The first mbuf to attach a cluster stores the refcount. The further mbufs to reference the cluster point at refcount in the first mbuf. The first mbuf is freed only when the last reference is freed.
The benefit over refcounts stored in separate slabs is that now refcounts of different, unrelated mbufs do not share a cache line.
For EXT_EXTREF mbufs the zone_ext_refcnt is no longer needed, and m_extadd() becomes void, making widely used M_EXTADD macro safe.
For EXT_SFBUF mbufs the sf_ext_ref() is removed, which was an optimization exactly against the cache aliasing problem with regular refcounting.
Discussed with: rrs, rwatson, gnn, hiren, sbruno, np Reviewed by: rrs Differential Revision: https://reviews.freebsd.org/D5396 Sponsored by: Netflix
|
295609 |
14-Feb-2016 |
cperciva |
Don't dereference a pointer immediately after determining that it is equal to NULL. [1]
While I'm here, s/xb/xbd/ (the name changed a long time ago but this instance wasn't corrected).
Reported by: PVS-Studio [1]
|
295513 |
11-Feb-2016 |
royger |
xen-netfront: remove useless NULL check in netif_free
xn_ifp is allocated in create_netdev with if_alloc(IFT_ETHER). According to the current arrangement it can't be NULL.
Coverity ID: 1349805 Submitted by: Wei Liu <wei.liu2@citrix.com> Reviewed by: royger Sponsored by: Citrix Systems R&D Differential revision: https://reviews.freebsd.org/D5252
|
295511 |
11-Feb-2016 |
royger |
xen-netfront: rearrange error paths in setup_txqs
Coverity spotted double free errors in error path. Fix that by removing the extraneous calls.
Coverity ID: 1349798 Submitted by: Wei Liu <wei.liu2@citrix.com> Reviewed by: royger Sponsored by: Citrix Systems R&D Differential revision: https://reviews.freebsd.org/D5251
|
295510 |
11-Feb-2016 |
royger |
xen-netfront: remove pointless assignment in xn_ioctl
The variable error is assigned to 0 before entering the switch. Assigning error to 0 before break pointless rewrites the real error value that should be returned.
Coverity ID: 1304974 Submitted by: Wei Liu <wei.liu2@citrix.com> Reviewed by: royger Sponsored by: Citrix Systems R&D Differential revision: https://reviews.freebsd.org/D5250
|
294442 |
20-Jan-2016 |
royger |
xen-netfront: add multiqueue support
Add support for multiple TX and RX queue pairs. The default number of queues is set to 4, but can be easily changed from the sysctl node hw.xn.num_queues.
Also heavily refactor netfront driver: break out a bunch of helper functions and different structures. Use threads to handle TX and RX. Remove some dead code and fix quite a few bugs as I go along.
Submitted by: Wei Liu <wei.liu2@citrix.com> Reviewed by: royger Sponsored by: Citrix Systems R&D Relnotes: Yes Differential Revision: https://reviews.freebsd.org/D4193
|
293700 |
11-Jan-2016 |
cperciva |
Add two more assertions to catch busdma problems. Each segment provided by busdma to the blkfront driver must be an integer number of sectors, and must be aligned in memory on a "sector" boundary.
Having these assertions yesterday would have made finding the bug fixed in r293698 somewhat easier.
|
291024 |
18-Nov-2015 |
royger |
xen: fix dropping bitmap IPIs during resume
Current Xen resume code clears all pending bitmap IPIs on resume, which is not correct. Instead re-inject bitmap IPI vectors on resume to all CPUs in order to acknowledge any pending bitmap IPIs.
Sponsored by: Citrix Systems R&D MFC after: 2 weeks
|
290611 |
09-Nov-2015 |
royger |
xen-blkfront: add support for unmapped IO
Using unmapped IO is really beneficial when running inside of a VM, since it avoids IPIs to other vCPUs in order to invalidate the mappings.
This patch adds unmapped IO support to blkfront. The following tests results have been obtained when running on a Xen host without HAP:
PVHVM 3165.84 real 6354.17 user 4483.32 sys PVHVM with unmapped IO 2099.46 real 4624.52 user 2967.38 sys
This is because when running using shadow page tables TLB flushes and range invalidations are much more expensive, so using unmapped IO provides a very important performance boost.
Sponsored by: Citrix Systems R&D MFC after: 2 weeks X-MFC-with: r290610
dev/xen/blkfront/blkfront.c: - Add and announce support for unmapped IO.
|
290393 |
05-Nov-2015 |
royger |
xen-netfront: remove unused header files
Submitted by: Wei Liu <wei.liu2@citrix.com> Reviewed by: royger Sponsored by: Citrix Systems R&D Differential Revision: https://reviews.freebsd.org/D4079
|
290201 |
30-Oct-2015 |
sjg |
Do not FALLTHROUGH for SIOC{ADD,DEL}MULTI
ifmedia_ioctl() returns EINVAL
Differential Revision: 3897 Submitted by: aronen@juniper.net Reviewed by: marcel
|
290005 |
26-Oct-2015 |
royger |
x86/dma_bounce: revert r289834 and r289836
The new load_ma implementation can cause dereferences when used with certain drivers, back it out until the reason is found:
Fatal trap 12: page fault while in kernel mode cpuid = 11; apic id = 03 fault virtual address = 0x30 fault code = supervisor read data, page not present instruction pointer = 0x20:0xffffffff808a2d22 stack pointer = 0x28:0xfffffe07cc737710 frame pointer = 0x28:0xfffffe07cc737790 code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags = interrupt enabled, resume, IOPL = 0 current process = 13 (g_down) trap number = 12 panic: page fault cpuid = 11 KDB: stack backtrace: #0 0xffffffff80641647 at kdb_backtrace+0x67 #1 0xffffffff80606762 at vpanic+0x182 #2 0xffffffff806067e3 at panic+0x43 #3 0xffffffff8084eef1 at trap_fatal+0x351 #4 0xffffffff8084f0e4 at trap_pfault+0x1e4 #5 0xffffffff8084e82f at trap+0x4bf #6 0xffffffff80830d57 at calltrap+0x8 #7 0xffffffff8063beab at _bus_dmamap_load_ccb+0x1fb #8 0xffffffff8063bc51 at bus_dmamap_load_ccb+0x91 #9 0xffffffff8042dcad at ata_dmaload+0x11d #10 0xffffffff8042df7e at ata_begin_transaction+0x7e #11 0xffffffff8042c18e at ataaction+0x9ce #12 0xffffffff802a220f at xpt_run_devq+0x5bf #13 0xffffffff802a17ad at xpt_action_default+0x94d #14 0xffffffff802c0024 at adastart+0x8b4 #15 0xffffffff802a2e93 at xpt_run_allocq+0x193 #16 0xffffffff802c0735 at adastrategy+0xf5 #17 0xffffffff80554206 at g_disk_start+0x426 Uptime: 2m29s
|
289836 |
23-Oct-2015 |
royger |
blkfront: add support for unmapped IO
Using unmapped IO is really beneficial when running inside of a VM, since it avoids IPIs to other vCPUs in order to invalidate the mappings.
This patch adds unmapped IO support to blkfront. The following tests results have been obtained when running on a Xen host without HAP:
PVHVM 3165.84 real 6354.17 user 4483.32 sys PVHVM with unmapped IO 2099.46 real 4624.52 user 2967.38 sys
This is because when running using shadow page tables TLB flushes and range invalidations are much more expensive, so using unmapped IO provides a very important performance boost.
Sponsored by: Citrix Systems R&D MFC after: 2 weeks X-MFC-with: r289834
|
289697 |
21-Oct-2015 |
royger |
netfront: fix LINT-NOIP
r289587 broke LINT-NOIP kernels because the lro and queued local variables are defined but not used. Add preprocessor guards around them.
Reported by: emaste Sponsored by: Citrix Systems R&D
|
289686 |
21-Oct-2015 |
royger |
xen: Code cleanup and small bug fixes
xen/hypervisor.h: - Remove unused helpers: MULTI_update_va_mapping, is_initial_xendomain, is_running_on_xen - Remove unused define CONFIG_X86_PAE - Remove unused variable xen_start_info: note that it's used inpcifront which is not built at all - Remove forward declaration of HYPERVISOR_crash
xen/xen-os.h: - Remove unused define CONFIG_X86_PAE - Drop unused helpers: test_and_clear_bit, clear_bit, force_evtchn_callback - Implement a generic version (based on ofed/include/linux/bitops.h) of set_bit and test_bit and prefix them by xen_ to avoid any use by other code than Xen. Note that It would be worth to investigate a generic implementation in FreeBSD. - Replace barrier() by __compiler_membar() - Replace cpu_relax() by cpu_spinwait(): it's exactly the same as rep;nop = pause
xen/xen_intr.h: - Move the prototype of xen_intr_handle_upcall in it: Use by all the platform
x86/xen/xen_intr.c: - Use BITSET* for the enabledbits: Avoid to use custom helpers - test_bit/set_bit has been renamed to xen_test_bit/xen_set_bit - Don't export the variable xen_intr_pcpu
dev/xen/blkback/blkback.c: - Fix the string format when XBB_DEBUG is enabled: host_addr is typed uint64_t
dev/xen/balloon/balloon.c: - Remove set but not used variable - Use the correct type for frame_list: xen_pfn_t represents the frame number on any architecture
dev/xen/control/control.c: - Return BUS_PROBE_WILDCARD in xs_probe: Returning 0 in a probe callback means the driver can handle this device. If by any chance xenstore is the first driver, every new device with the driver is unset will use xenstore.
dev/xen/grant-table/grant_table.c: - Remove unused cmpxchg - Drop unused include opt_pmap.h: Doesn't exist on ARM64 and it doesn't contain anything required for the code on x86
dev/xen/netfront/netfront.c: - Use the correct type for rx_pfn_array: xen_pfn_t represents the frame number on any architecture
dev/xen/netback/netback.c: - Use the correct type for gmfn: xen_pfn_t represents the frame number on any architecture
dev/xen/xenstore/xenstore.c: - Return BUS_PROBE_WILDCARD in xctrl_probe: Returning 0 in a probe callback means the driver can handle this device. If by any chance xenstore is the first driver, every new device with the driver is unset will use xenstore.
Note that with the changes, x86/include/xen/xen-os.h doesn't contain anymore arch-specific code. Although, a new series will add some helpers that differ between x86 and ARM64, so I've kept the headers for now.
Submitted by: Julien Grall <julien.grall@citrix.com> Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D3921 Sponsored by: Citrix Systems R&D
|
289591 |
19-Oct-2015 |
royger |
xen-netfront: use "netfront" in lock description
Missed from r289585.
Submitted by: Wei Liu <wei.liu2@citrix.com> Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D3937 Sponsored by: Citrix Systems R&D
|
289589 |
19-Oct-2015 |
royger |
xen-netfront: fix netfront create_dev error path
The failure path for allocating rx grant refs should not try to free tx grant refs because tx grant refs were allocated after that. Also fix the error path for xen_net_read_mac.
Submitted by: Wei Liu <wei.liu2@citrix.com> Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D3891 Sponsored by: Citrix Systems R&D
|
289588 |
19-Oct-2015 |
royger |
xen-netfront: no need to set if_output
This is redundant because ether_ifattach will set that field.
Submitted by: Wei Liu <wei.liu2@citrix.com> Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D3918 Sponsored by: Citrix Systems R&D
|
289587 |
19-Oct-2015 |
royger |
xen-netfront: remove a bunch of FreeBSD version check
We're way beyond FreeBSD 7 at this point.
Submitted by: Wei Liu <wei.liu2@citrix.com> Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D3892 Sponsored by: Citrix Systems R&D
|
289585 |
19-Oct-2015 |
royger |
xen-netfront: remove XN_LOCK_{INIT,DESTROY}
Multiqueue feature will make the number of queues dynamic, so XN_LOCK_INIT won't be that useful. Remove the macro and call mtx_init directly.
XN_LOCK_DESTROY is just dead code.
Submitted by: Wei Liu <wei.liu2@citrix.com> Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D3890 Sponsored by: Citrix Systems R&D
|
289584 |
19-Oct-2015 |
royger |
xen-netfront: clean up netfront stats structure
Rename it with netfront_ prefix and purge a bunch of unused fields.
Submitted by: Wei Liu <wei.liu2@citrix.com> Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D3889 Sponsored by: Citrix Systems R&D
|
289583 |
19-Oct-2015 |
royger |
xen-netfront: purge page flipping support
Currently neither Linux nor FreeBSD netback supports page flipping. NetBSD still supports that. It is not sure how many people actually use page flipping, but page flipping is supposed to be slower than copying nowadays. It will also shatter frontend / backend address space.
Overall this feature is more of a burden than a benefit.
Submitted by: Wei Liu <wei.liu2@citrix.com> Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D3888 Sponsored by: Citrix Systems R&D
|
289582 |
19-Oct-2015 |
royger |
xen-netfront: delete all trailing white spaces
Submitted by: Wei Liu <wei.liu2@citrix.com> Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D3886 Sponsored by: Citrix Systems R&D
|
289033 |
08-Oct-2015 |
royger |
xen/console: Introduce a new console driver for Xen guest
The current Xen console driver is crashing very quickly when using it on an ARM guest. This is because the console lock is recursive and it may lead to recursion on the tty lock and/or corrupt the ring pointer.
Furthermore, the console lock is not always taken where it should be and has to be released too early because of the way the console has been designed.
Over the years, code has been modified to support various new features but the driver has not been reworked.
This new driver has been rewritten with the idea of only having a small set of specific function to write either via the shared ring or the hypercall interface.
Note that HVM support has been left aside for now because it requires additional features which are not yet supported. A follow-up patch will be sent with HVM guest support.
List of items that may be good to have but not mandatory: - Avoid to flush for each character written when using the tty - Support multiple consoles
Submitted by: Julien Grall <julien.grall@citrix.com> Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D3698 Sponsored by: Citrix Systems R&D
|
288917 |
06-Oct-2015 |
royger |
Update Xen headers from 4.2 to 4.6
Pull the latest headers for Xen which allow us to add support for ARM and use new features in FreeBSD.
This is a verbatim copy of the xen/include/public so every headers which don't exits anymore in the Xen repositories have been dropped.
Note the interface version hasn't been bumped, it will be done in a follow-up. Although, it requires fix in the code to get it compiled:
- sys/xen/xen_intr.h: evtchn_port_t is already defined in the headers so drop it.
- {amd64,i386}/include/intr_machdep.h: NR_EVENT_CHANNELS now depends on xen/interface/event_channel.h, so include it.
- {amd64,i386}/{amd64,i386}/support.S: It's not neccessary to include machine/intr_machdep.h. This is also fixing build compilation with the new headers.
- dev/xen/blkfront/blkfront.c: The typedef for blkif_request_segmenthas been dropped. So directly use struct blkif_request_segment
Finally, modify xen/interface/xen-compat.h to throw a preprocessing error if __XEN_INTERFACE_VERSION__ is not set. This is allow us to catch any file where xen/xen-os.h is not correctly included.
Submitted by: Julien Grall <julien.grall@citrix.com> Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D3805 Sponsored by: Citrix Systems R&D
|
287882 |
16-Sep-2015 |
zbb |
Add domain support to PCI bus allocation
When the system has more than a single PCI domain, the bus numbers are not unique, thus they cannot be used for "pci" device numbering. Change bus numbers to -1 (i.e. to-be-determined automatically) wherever the code did not care about domains.
Reviewed by: jhb Obtained from: Semihalf Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3406
|
287132 |
25-Aug-2015 |
araujo |
Code cleanup unused-but-set-variable spotted by gcc.
Reviewed by: royger Approved by: bapt (mentor) Differential Revision: D3476
|
286999 |
21-Aug-2015 |
royger |
xen: allow disabling PV disks and nics
Introduce two new loader tunnables that can be used to disable PV disks and PV nics at boot time. They default to 0 and should be set to 1 (or any number different than 0) in order to disable the PV devices:
hw.xen.disable_pv_disks=1 hw.xen.disable_pv_nics=1
In /boot/loader.conf will disable both PV disks and nics.
Sponsored by: Citrix Systems R&D Tested by: Karl Pielorz <kpielorz_lst@tdx.co.uk> MFC after: 1 week
|
286786 |
14-Aug-2015 |
jhb |
Remove another remnant of PV domU support and assume that we always run with an automatically translated physmap under XEN.
Reviewed by: royger (earlier version) Differential Revision: https://reviews.freebsd.org/D3325
|
286372 |
06-Aug-2015 |
jhb |
Remove some more vestiges of the Xen PV domu support. Specifically, use vtophys() directly instead of vtomach() and retire the no-longer-used headers <machine/xenfunc.h> and <machine/xenvar.h>.
Reported by: bde (stale bits in <machine/xenfunc.h>) Reviewed by: royger (earlier version) Differential Revision: https://reviews.freebsd.org/D3266
|
286062 |
30-Jul-2015 |
cperciva |
Add support for Xen blkif indirect segment I/Os. This makes it possible for the blkfront driver to perform I/Os of up to 2 MB, subject to support from the blkback to which it is connected and the initiation of such large I/Os by the rest of the kernel. In practice, the I/O size is increased from 40 kB to 128 kB.
The changes to xen/interface/io/blkif.h consist merely of merging updates from the upstream Xen repository.
In dev/xen/blkfront/block.h we add some convenience macros and structure fields used for indirect-page I/Os: The device records its negotiated limit on the number of indirect pages used, while each I/O command structure gains permanently allocated page(s) for indirect page references and the Xen grant references for those pages.
In dev/xen/blkfront/blkfront.c we now check in xbd_queue_cb whether a request is small enough to handle without an indirection page, and either follow the previous behaviour or use new code for issuing an indirect segment I/O. In xbd_connect we read the size of indirect segment I/Os supported by the backend and select the maximum size we will use; then allocate the pages and Xen grant references for each I/O command structure. In xbd_free those grants and pages are released.
A new loader tunable, hw.xbd.xbd_enable_indirect, can be set to 0 in order to disable this functionality; it works by pretending that the backend does not support this feature. Some backends exhibit a loss of performance with large I/Os, so users may wish to test with and without this functionality enabled.
Reviewed by: royger MFC after: 3 days Relnotes: yes
|
285391 |
11-Jul-2015 |
mjg |
Create a dedicated function for ensuring that cdir and rdir are populated.
Previously several places were doing it on its own, partially incorrectly (e.g. without the filedesc locked) or even actively harmful by populating jdir or assigning rootvnode without vrefing it.
Reviewed by: kib
|
285089 |
03-Jul-2015 |
royger |
netfront: preserve configuration across migrations
Try to preserve the xn configuration when migrating. This is not always possible since the backend might not have the same set of options available, in which case we will try to preserve as many as possible.
MFC after: 2 weeks PR: 183139 Reported by: mcdouga9@egr.msu.edu Sponsored by: Citrix Systems R&D
|
284723 |
23-Jun-2015 |
cperciva |
Rename mksegarray to xbd_mksegarray for consistency with other function names in this file.
Submitted by: royger
|
284670 |
21-Jun-2015 |
cperciva |
Garbage collect comments and a macro which related to the pre-r284296 support for a "segment block" extension in FreeBSD's Xen blkfront/blkback drivers.
This commit should not result in any functional changes.
|
284663 |
21-Jun-2015 |
cperciva |
Move the bus_dma_tag creation and per-transaction data allocation from xbd_initialize to xbd_connect. Both of these initialization steps need to know what the maximum possible I/O size will be, and when we gain support for indirect segment I/Os we won't know that value until we reach xbd_connect. Since none of this data is used before xbd_connect completes, moving the initialization is harmless.
This commit should not result in any functional changes.
|
284662 |
21-Jun-2015 |
cperciva |
If we fail to allocate memory, pass ENOMEM as the error code, not the "error" variable (which is always zero at this point).
|
284618 |
20-Jun-2015 |
cperciva |
Refactor xbd_queue_cb, extracting the code which converts bus_dma segments into blkif segments, and moving it into a new function. This will be used by upcoming support for indirect-segment blkif requests.
This commit should not result in any functional changes.
|
284615 |
19-Jun-2015 |
cperciva |
Minor clean up to xbd_queue_cb: * nsegs must be at most BLKIF_MAX_SEGMENTS_PER_REQUEST (since we specify that limit to bus_dma_tag_create), so KASSERT that rather than silently adjusting the request. * block_segs is now a synonym for nsegs, so garbage collect that variable. * nsegs is never read during or after the while loop, so remove the dead decrement from the loop.
These were all left behind from the pre-r284296 support for a "segment block" extension.
|
284296 |
12-Jun-2015 |
royger |
xen-blk{front/back}: remove broken FreeBSD extensions
The FreeBSD extension adds a new request type, called blkif_segment_block which has a size of 112bytes for both i386 and amd64. This is fine on amd64, since requests have a size of 112B there also. But this is not true for i386, where requests have a size of 108B. So on i386 we basically overrun the ring slot when queuing a request of type blkif_segment_block_t, which is very bad.
Remove this extension (including a cleanup of the public blkif.h header file) from blkfront and blkback.
Sponsored by: Citrix Systems R&D Tested-by: cperciva
|
283291 |
22-May-2015 |
jkim |
CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten years for head. However, it is continuously misused as the mpsafe argument for callout_init(9). Deprecate the flag and clean up callout_init() calls to make them more consistent.
Differential Revision: https://reviews.freebsd.org/D2613 Reviewed by: jhb MFC after: 2 weeks
|
282908 |
14-May-2015 |
royger |
netfront: wait for backend to connect before sending ARP
Netfront has to wait for the backend to switch to state XenbusStateConnected before sending the ARP request, or else the backend might not be connected and thus the packet will be lost.
Sponsored by: Citrix Systems R&D MFC after: 1 week
|
282634 |
08-May-2015 |
royger |
xen: introduce a newbus function to allocate unused memory
In order to map memory from other domains when running on Xen FreeBSD uses unused physical memory regions. Until now this memory has been allocated using bus_alloc_resource, but this is not completely safe as we can end up using unreclaimed MMIO or ACPI regions.
Fix this by introducing a new newbus method that can be used by Xen drivers to request for unused memory regions. On amd64 we make sure this memory comes from regions above 4GB in order to prevent clashes with MMIO/ACPI regions. On i386 there's nothing we can do, so just fall back to the previous mechanism.
Sponsored by: Citrix Systems R&D Tested by: Gustau Pérez <gperez@entel.upc.edu>
|
282274 |
30-Apr-2015 |
jhb |
Remove support for Xen PV domU kernels. Support for HVM domU kernels remains. Xen is planning to phase out support for PV upstream since it is harder to maintain and has more overhead. Modern x86 CPUs include virtualization extensions that support HVM guests instead of PV guests. In addition, the PV code was i386 only and not as well maintained recently as the HVM code. - Remove the i386-only NATIVE option that was used to disable certain components for PV kernels. These components are now standard as they are on amd64. - Remove !XENHVM bits from PV drivers. - Remove various shims required for XEN (e.g. PT_UPDATES_FLUSH, LOAD_CR3, etc.) - Remove duplicate copy of <xen/features.h>. - Remove unused, i386-only xenstored.h.
Differential Revision: https://reviews.freebsd.org/D2362 Reviewed by: royger Tested by: royger (i386/amd64 HVM domU and amd64 PVH dom0) Relnotes: yes
|
281774 |
20-Apr-2015 |
araujo |
Remove unused variable.
Differential Revision: D2333 Reviewed by: royger
|
280838 |
30-Mar-2015 |
royger |
xen: add a handler for the debug interrupt
Handle the VIRQ_DEBUG signal and print a stack trace of each vCPU on the Xen console. This is only used for debug purposes and is triggered by the administrator of the Xen host.
Sponsored by: Citrix Systems R&D MFC after: 1 week
|
279394 |
28-Feb-2015 |
royger |
netback: disable GSO
The current GSO implementation in netback is broken and causes errors on the guest tx path. While this is fixed disable GSO in order to have a working netback.
Sponsored by: Citrix Systems R&D Discussed with: gibbs
|
279365 |
27-Feb-2015 |
glebius |
Use m_getjcl() instead of old mbuf(9) KPIs.
Tested by: royger
|
279212 |
23-Feb-2015 |
glebius |
Previous version of mbufq were fine initialized by M_ZERO, while new one require explicti initialization.
Reported by: royger
|
278977 |
19-Feb-2015 |
glebius |
Provide a set of inline functions to manage simple mbuf(9) queues, based on queue(3)'s STAILQ. Utilize them in cxgb(4) and Xen, deleting home grown implementations.
Sponsored by: Netflix Sponsored by: Nginx, Inc.
|
278844 |
16-Feb-2015 |
royger |
xen: fix xenstore dev
Xenstore user-space device has two problems currently: - It does not correctly handle concurrent clients, because it's storing each client data in dev->si_drv1. - It does not correctly free this data when the client closes the device.
In order to solve both of this issues store the per-client data using cdevpriv, which also comes with a hook in order to perform the necessary cleanup on device close.
While there also make the device eternal.
Sponsored by: Citrix Systems R&D Reported and Tested by: thompsa MFC after: 2 weeks
|
278183 |
04-Feb-2015 |
bryanv |
Generalized parts of the XEN timer code into a generic pvclock
KVM clock shares the same data structures between the guest and the host as Xen so it makes sense to just have a single copy of this code.
Differential Revision: https://reviews.freebsd.org/D1429 Reviewed by: royger (eariler version) MFC after: 1 month
|
277103 |
13-Jan-2015 |
delphij |
Use the common codepath to handle SIOCGIFADDR.
Before this change, the current code handles SIOCGIFADDR the same way with SIOCSIFADDR, which involves full arp_ifinit, et al. They should be unnecessary for SIOCGIFADDR case.
Differential Revision: https://reviews.freebsd.org/D1508 Reviewed by: glebius MFC after: 2 weeks
|
276750 |
06-Jan-2015 |
rwatson |
In order to reduce use of M_EXT outside of the mbuf allocator and socket-buffer implementations, introduce a return value for MCLGET() (and m_cljget() that underlies it) to allow the caller to avoid testing M_EXT itself. Update all callers to use the return value.
With this change, very few network device drivers remain aware of M_EXT; the primary exceptions lie in mbuf-chain pretty printers for debugging, and in a few cases, custom mbuf and cluster allocation implementations.
NB: This is a difficult-to-test change as it touches many drivers for which I don't have physical devices. Instead we've gone for intensive review, but further post-commit review would definitely be appreciated to spot errors where changes could not easily be made mechanically, but were largely mechanical in nature.
Differential Revision: https://reviews.freebsd.org/D1440 Reviewed by: adrian, bz, gnn Sponsored by: EMC / Isilon Storage Division
|
276531 |
02-Jan-2015 |
hselasky |
Remove duplicate pci_driver class declaration.
|
275677 |
10-Dec-2014 |
royger |
xen: convert the Grant-table code to a NewBus device
This allows the Grant-table code to attach directly to the xenpv bus, allowing us to remove the grant-table initialization done in xenpv.
Sponsored by: Citrix Systems R&D
|
275675 |
10-Dec-2014 |
royger |
xen: move grant table code
Mave the grant table code into the dev/xen folder in preparation for turning it into a device using the newbus interface. This is just code motion, no functional changes.
Sponsored by: Citrix Systems R&D
|
275649 |
09-Dec-2014 |
royger |
xen: create a new PCI bus override
When running as a Xen PVH Dom0 we need to add custom buses that override some of the functionality present in the ACPI PCI Bus and the PCI Bus. We currently override the ACPI PCI Bus, but not the PCI Bus, so add a new override for the PCI Bus and share the generic functions between them.
Reported by: David P. Discher <dpd@dpdtech.com> Sponsored by: Citrix Systems R&D
conf/files.amd64: - Add the new files.
x86/xen/xen_pci_bus.c: - Generic file that contains the PCI overrides so they can be used by the several PCI specific buses.
xen/xen_pci.h: - Prototypes for the generic overried functions.
dev/xen/pci/xen_pci.c: - Xen specific override for the PCI bus.
dev/xen/pci/xen_acpi_pci.c: - Xen specific override for the ACPI PCI bus.
|
274668 |
18-Nov-2014 |
imp |
opt_global.h is included automatically in the build. No need to explicitly include it in these places.
Sponsored by: Netflix
|
273477 |
22-Oct-2014 |
royger |
netback: change xnb naming convention
Current FreeBSD netback names the interface with xnb<device unit>, but this is not suitable for usage with the Xen toolstack, which expects something similar to <prefix><domid><handle>. In order to solve this, change the netback naming convention to use xnb<domid>.<handle>.
Sponsored by: Citrix Systems R&D
dev/xen/netback/netback.c: - Change netback to use the nomenclature stated above.
|
273476 |
22-Oct-2014 |
royger |
xen: implement the privcmd user-space device
This device is only attached to priviledged domains, and allows the toolstack to interact with Xen. The two functions of the privcmd interface is to allow the execution of hypercalls from user-space, and the mapping of foreign domain memory.
Sponsored by: Citrix Systems R&D
i386/include/xen/hypercall.h: amd64/include/xen/hypercall.h: - Introduce a function to make generic hypercalls into Xen.
xen/interface/xen.h: xen/interface/memory.h: - Import the new hypercall XENMEM_add_to_physmap_range used by auto-translated guests to map memory from foreign domains.
dev/xen/privcmd/privcmd.c: - This device has the following functions: - Allow user-space applications to make hypercalls into Xen. - Allow user-space applications to map memory from foreign domains, this is accomplished using the newly introduced hypercall (XENMEM_add_to_physmap_range).
xen/privcmd.h: - Public ioctl interface for the privcmd device.
x86/xen/hvm.c: - Remove declaration of hypercall_page, now it's declared in hypercall.h.
conf/files: - Add the privcmd device to the build process.
|
273474 |
22-Oct-2014 |
royger |
xen: import a proper event channel user-space device
The user-space event channel device is used by applications to receive and send event channel interrupts. This device is based on the Linux evtchn device.
Sponsored by: Citrix Systems R&D
xen/evtchn/evtchn_dev.c: - Remove the old event channel device, which was already disabled in the build system.
dev/xen/evtchn/evtchn_dev.c: - Import a new event channel device based on the one present in Linux. - This device allows the following operations: - Bind VIRQ event channels (ioctl). - Bind regular event channels (ioctl). - Create and bind new event channels (ioctl). - Unbind event channels (ioctl). - Send notifications to event channels (ioctl). - Reset the device shared memory ring (ioctl). - Unmask event channels (write). - Receive event channel upcalls (read). - The new code is MP safe, and can be used concurrently.
conf/files: - Add the new device to the build system.
|
273377 |
21-Oct-2014 |
hselasky |
Fix multiple incorrect SYSCTL arguments in the kernel:
- Wrong integer type was specified.
- Wrong or missing "access" specifier. The "access" specifier sometimes included the SYSCTL type, which it should not, except for procedural SYSCTL nodes.
- Logical OR where binary OR was expected.
- Properly assert the "access" argument passed to all SYSCTL macros, using the CTASSERT macro. This applies to both static- and dynamically created SYSCTLs.
- Properly assert the the data type for both static and dynamic SYSCTLs. In the case of static SYSCTLs we only assert that the data pointed to by the SYSCTL data pointer has the correct size, hence there is no easy way to assert types in the C language outside a C-function.
- Rewrote some code which doesn't pass a constant "access" specifier when creating dynamic SYSCTL nodes, which is now a requirement.
- Updated "EXAMPLES" section in SYSCTL manual page.
MFC after: 3 days Sponsored by: Mellanox Technologies
|
272321 |
30-Sep-2014 |
royger |
xen: fix blkback pushing responses before releasing internal resources
Fix a problem where the blockback driver could run out of requests, despite the fact that we allocate enough request and reqlist structures to satisfy the maximum possible number of requests.
The problem was that we were sending responses back to the other end (blockfront) before freeing resources. The Citrix Windows driver is pretty agressive about queueing, and would queue more I/O to us immediately after we sent responses to it. We would run into a resource shortage and stall out I/O until we freed resources.
It isn't clear whether the request shortage condition was an indirect cause of the I/O hangs we've been seeing between Windows with the Citrix PV drivers and FreeBSD's blockback, but the above problem is certainly a bug.
Sponsored by: Spectra Logic Submitted by: ken Reviewed by: royger
dev/xen/blkback/blkback.c: - Break xbb_send_response() into two sub-functions, xbb_queue_response() and xbb_push_responses(). Remove xbb_send_response(), because it is no longer used.
- Adjust xbb_complete_reqlist() so that it calls the two new functions, and holds the mutex around both calls. The mutex insures that another context can't come along and push responses before we've freed our resources.
- Change xbb_release_reqlist() so that it requires the mutex to be held instead of acquiring the mutex itself. Both callers could easily hold the mutex while calling it, and one really needs to hold the mutex during the call.
- Add two new counters, accessible via sysctl variables. The first one counts the number of I/Os that are queued and waiting to be pushed (reqs_queued_for_completion). The second one (reqs_completed_with_error) counts the number of requests we've completed with an error status.
|
272320 |
30-Sep-2014 |
royger |
xen/balloon: fix accounting of current memory pages on PVH
Using realmem on PVH is not realiable, since in this case the realmem value is computed from Maxmem, which contains the higher memory address found. Use HYPERVISOR_start_info->nr_pages instead, which is set by the hypervisor and contains the exact number of memory pages assigned to the domain.
Sponsored by: Citrix Systems R&D
|
272319 |
30-Sep-2014 |
royger |
xen: add xenstored user-space device
This device is used by the user-space daemon that runs xenstore (xenstored). It allows xenstored to map the xenstore memory page, and reports the event channel xenstore is using.
Sponsored by: Citrix Systems R&D
dev/xen/xenstore/xenstored_dev.c: - Add the xenstored character device that's used to map the xenstore memory into user-space, and to report the event channel used by xenstore.
conf/files: - Add the device to the build process.
|
272318 |
30-Sep-2014 |
royger |
xen: convert the xenstore user-space char device to a newbus device
Convert the xenstore user-space device (/dev/xen/xenstore) to a device using the newbus interface. This allows us to make the device initialization dependant on the initialization of xenstore itself in the kernel.
Sponsored by: Citrix Systems R&D
dev/xen/xenstore/xenstore.c: - Convert to a newbus device, this removes the xs_dev_init function.
xen/xenstore/xenstore_internal.h: - Remove xs_dev_init prototype.
dev/xen/xenstore/xenstore.c: - Don't call xs_dev_init anymore, the device will attach itself when xenstore is started.
|
272317 |
30-Sep-2014 |
royger |
xen: defer xenstore initialization until xenstored is started
The xenstore related devices in the kernel cannot be started until xenstored is running, which will happen later in the Dom0 case. If start_info_t doesn't contain a valid xenstore event channel, defer all xenstore related devices attachment to later.
Sponsored by: Citrix Systems R&D
dev/xen/xenstore/xenstore.c: - Prevent xenstore from trying to attach it's descendant devices if xenstore is not initialized. - Add a callback in the xenstore interrupt filter that will trigger the plug of xenstore descendant devices on the first received interrupt. This interrupt is generated when xenstored attaches to the event channel, and serves as a notification that xenstored is running.
|
272314 |
30-Sep-2014 |
royger |
xen: move xenstore devices
Move xenstore related devices (xenstore.c and xenstore_dev.c) from xen/xenstore to dev/xen/xenstore. This is just code motion, no functional changes.
Sponsored by: Citrix Systems R&D
|
272312 |
30-Sep-2014 |
royger |
xen: make xen balloon a driver that depends on xenstore
This is done so we can prevent the Xen Balloon driver from attaching before xenstore is setup.
Sponsored by: Citrix Systems R&D
dev/xen/balloon/balloon.c: - Make xen balloon a driver that depends on xenstore.
|
271946 |
22-Sep-2014 |
hselasky |
Improve transmit sending offload, TSO, algorithm in general.
The current TSO limitation feature only takes the total number of bytes in an mbuf chain into account and does not limit by the number of mbufs in a chain. Some kinds of hardware is limited by two factors. One is the fragment length and the second is the fragment count. Both of these limits need to be taken into account when doing TSO. Else some kinds of hardware might have to drop completely valid mbuf chains because they cannot loaded into the given hardware's DMA engine. The new way of doing TSO limitation has been made backwards compatible as input from other FreeBSD developers and will use defaults for values not set.
Reviewed by: adrian, rmacklem Sponsored by: Mellanox Technologies MFC after: 1 week
|
271849 |
19-Sep-2014 |
glebius |
Mechanically convert to if_inc_counter().
|
271551 |
13-Sep-2014 |
hselasky |
Revert r271504. A new patch to solve this issue will be made.
Suggested by: adrian @
|
271504 |
13-Sep-2014 |
hselasky |
Improve transmit sending offload, TSO, algorithm in general.
The current TSO limitation feature only takes the total number of bytes in an mbuf chain into account and does not limit by the number of mbufs in a chain. Some kinds of hardware is limited by two factors. One is the fragment length and the second is the fragment count. Both of these limits need to be taken into account when doing TSO. Else some kinds of hardware might have to drop completely valid mbuf chains because they cannot loaded into the given hardware's DMA engine. The new way of doing TSO limitation has been made backwards compatible as input from other FreeBSD developers and will use defaults for values not set.
MFC after: 1 week Sponsored by: Mellanox Technologies
|
271099 |
04-Sep-2014 |
royger |
Revert r269814: blkfront: add support for unmapped IO
Current busdma code for unmapped bios will not properly align the segment size, causing corruption on blkfront devices. Revert the commit until busdma code is fixed.
Reported by: mav MFC after: 1 day
|
270339 |
22-Aug-2014 |
royger |
xen: fix incorrectly accounted free
Fix some frees incorrectly assigned to M_XENBUS when the memory is allocated with M_XENSTORE.
Sponsored by: Citrix Systems R&D MFC after: 1 week
dev/xen/blkback/blkback.c: - Fix incorrect frees.
|
270337 |
22-Aug-2014 |
royger |
netback: remove dead code
Remove the xen_net_read_mac function since it's not used anymore.
Sponsored by: Citrix Systems R&D
|
270333 |
22-Aug-2014 |
royger |
netback: fixes for netback
This patch contains the following fixes for netback: - Only unbind the evtchn if it has been bound. - Set xnb->bridge to NULL after free to prevent double-freeing it. - Set the MAC address for the host-facing interface to a dummy value.
Sponsored by: Citrix Systems R&D
dev/xen/netback/netback.c: - Prevent trying to unbind if the evtchn has not been bounded. - Prevent double-freeing xnb->bridge. - Set the MAC address of the host-facing interface to a dummy value, so it can work when the interface is added to a bridge.
|
269814 |
11-Aug-2014 |
royger |
blkfront: add support for unmapped IO
Using unmapped IO is really beneficial when running inside of a VM, since it avoids IPIs to other vCPUs in order to invalidate the mappings.
This patch adds unmapped IO support to blkfront. The following tests results have been obtained when running on a Xen host without HAP:
PVHVM 3165.84 real 6354.17 user 4483.32 sys PVHVM with unmapped IO 2099.46 real 4624.52 user 2967.38 sys
This is because when running using shadow page tables TLB flushes and range invalidations are much more expensive, so using unmapped IO provides a very important performance boost.
Sponsored by: Citrix Systems R&D Tested by: robak MFC after: 1 week PR: 191173
dev/xen/blkfront/blkfront.c: - Add and announce support for unmapped IO.
|
269514 |
04-Aug-2014 |
royger |
xen: Dom0 console fixes
Minor fixes to make the Xen Dom0 console work. This includes always returning there's pending input in xencons_has_input, because on Dom0 there's no shared ring and we cannot test the indexes. The second fix is to use the CONSOLEIO_read hypercall in order to read input data from the Xen console.
Sponsored by: Citrix Systems R&D
dev/xen/console/xencons_ring.c: - Always return true in xencons_has_input for Dom0. - Implement Dom0 console support for xencons_handle_input.
|
267858 |
25-Jun-2014 |
royger |
xen/virtio: fix balloon drivers to not mark pages as WIRED
Prevent the Xen and VirtIO balloon drivers from marking pages as wired. This prevents them from increasing the system wired page count, which can lead to mlock failing because of hitting the limit in vm.max_wired.
In the Xen case make sure pages are zeroed before giving them back to the hypervisor, or else we might be leaking data. Also remove the balloon_{append/retrieve} and link pages directly into the ballooned_pages queue using the plinks.q field in the page struct.
Sponsored by: Citrix Systems R&D Reviewed by: kib, bryanv Approved by: gibbs
dev/virtio/balloon/virtio_balloon.c: - Don't allocate pages with VM_ALLOC_WIRED.
dev/xen/balloon/balloon.c: - Don't allocate pages with VM_ALLOC_WIRED. - Make sure pages are zeroed before giving them back to the hypervisor. - Remove the balloon_entry struct and the balloon_{append/retrieve} functions and use the page plinks.q entry to link the pages directly into the ballooned_pages queue.
|
267548 |
16-Jun-2014 |
attilio |
- Modify vm_page_unwire() and vm_page_enqueue() to directly accept the queue where to enqueue pages that are going to be unwired. - Add stronger checks to the enqueue/dequeue for the pagequeues when adding and removing pages to them.
Of course, for unmanaged pages the queue parameter of vm_page_unwire() will be ignored, just as the active parameter today. This makes adding new pagequeues quicker.
This change effectively modifies the KPI. __FreeBSD_version will be, however, bumped just when the full cache of free pages will be evicted.
Sponsored by: EMC / Isilon storage division Reviewed by: alc Tested by: pho
|
267536 |
16-Jun-2014 |
royger |
xen: add missing files
Commit missing files that actually belong to previous commits.
Sponsored by: Citrix Systems R&D Approved by: gibbs
|
267534 |
16-Jun-2014 |
royger |
xen: unify gnttab initialization for PVHVM and PVH
Switch the initialization of gnttab to use an unused physical memory range for both PVHVM and PVH.
In the past PVHVM was using the xenpci BAR, but there's no reason to do that, and in fact FreeBSD was probably doing it because it was the way it was done in Windows, were drivers cannot probably request for unused physical memory ranges, but it was never enforced in the hypervisor.
Sponsored by: Citrix Systems R&D Approved by: gibbs
xen/gnttab.c: - Allocate contiguous physical memory for grant table frames for both PVHVM and PVH. - Since gnttab is not a device, use the xenpv device in order to request for this allocation.
dev/xen/xenpci/xenpcivar.h: dev/xen/xenpci/xenpci.c: - Remove the now unused xenpci_alloc_space and xenpci_alloc_space_int functions.
xen/gnttab.h: - Change the prototype of gnttab_init and gnttab_resume, that now takes a device_t parameter.
dev/xen/control/control.c: x86/xen/xenpv.c: - Changes to accomodate the new prototype of gnttab_init and gnttab_resume.
|
267531 |
16-Jun-2014 |
royger |
xen: add shutdown hook for PVH
Add the PV shutdown hook to PVH.
Sponsored by: Citrix Systems R&D Approved by: gibbs
dev/xen/control/control.c: - Make xen_pv_shutdown_final available on XENHVM builds. - Register the Xen PV shutdown hook for PVH guests.
|
267528 |
16-Jun-2014 |
royger |
xen: introduce xenpv bus
Create a dummy bus so top level Xen devices can attach to it (instead of attaching directly to the nexus). This allows to have all the Xen related devices grouped under a single bus.
Sponsored by: Citrix Systems R&D Approved by: gibbs
x86/xen/xenpv.c: - Attach the xenpv bus when running as a Xen guest. - Attach the ISA bus if needed, in order to attach syscons.
conf/files.amd6: conf/files.i386: - Include the xenpv.c file in the build of i386/amd64 kernels using XENHVM.
dev/xen/console/console.c: dev/xen/timer/timer.c: xen/xenstore/xenstore.c: - Attach to the xenpv bus instead of the Nexus.
dev/xen/xenpci/xenpci.c: - Xen specific devices on PVHVM guests are no longer attached to the xenpci device, they are instead attached to the xenpv bus, remove the now unused methods.
|
263268 |
17-Mar-2014 |
royger |
xen: fix usage of db_active in xen console
Replace usage of db_active in Xen console with kdb_active.
Reported by: Andrzej Tobola <ato@iem.pw.edu.pl> Approved by: gibbs Sponsored by: Citrix Systems R&D
|
263008 |
11-Mar-2014 |
royger |
xen: implement an early timer for Xen PVH
When running as a PVH guest, there's no emulated i8254, so we need to use the Xen PV timer as the early source for DELAY. This change allows for different implementations of the early DELAY function and implements a Xen variant for it.
Approved by: gibbs Sponsored by: Citrix Systems R&D
dev/xen/timer/timer.c: dev/xen/timer/timer.h: - Implement Xen early delay functions using the PV timer and declare them.
x86/include/init.h: - Add hooks for early clock source initialization and early delay functions.
i386/i386/machdep.c: pc98/pc98/machdep.c: amd64/amd64/machdep.c: - Set early delay hooks to use the i8254 on bare metal. - Use clock_init (that will in turn make use of init_ops) to initialize the early clock source.
amd64/include/clock.h: i386/include/clock.h: - Declare i8254_delay and clock_init.
i386/xen/clock.c: - Rename DELAY to i8254_delay.
x86/isa/clock.c: - Introduce clock_init that will take care of initializing the early clock by making use of the init_ops hooks. - Move non ISA related delay functions to the newly introduced delay file.
x86/x86/delay.c: - Add moved delay related functions. - Implement generic DELAY function that will use the init_ops hooks.
x86/xen/pv.c: - Set PVH hooks for the early delay related functions in init_ops.
conf/files.amd64: conf/files.i386: conf/files.pc98: - Add delay.c to the kernel build.
|
263007 |
11-Mar-2014 |
royger |
xen: rework xen timer so it can be used early in boot process
This should not introduce any functional change, and makes the functions suitable to be called before we have actually mapped the vcpu_info struct on a per-cpu basis.
Approved by: gibbs Sponsored by: Citrix Systems R&D
dev/xen/timer/timer.c: - Remove citrical_{enter/exit}, the clock code will already be called with preemption disabled when needed. Add a comment to that regard in xentimer_get_timecount. - Allow xen_fetch_vcpu_time to be called with a specifc vcpu_info that will be used to fetch current time. - Assert that xentimer_et_start will always be called with preemption disabled.
|
263004 |
11-Mar-2014 |
royger |
xen: add and enable Xen console for PVH guests
This adds and enables the PV console used on XEN kernels to GENERIC/XENHVM kernels in order for it to be used on PVH.
Approved by: gibbs Sponsored by: Citrix Systems R&D
dev/xen/console/console.c: - Define console_page. - Move xc_printf debug function from i386 XEN code to generic console code. - Rework xc_printf. - Use xen_initial_domain instead of open-coded checks for Dom0. - Gate the attach of the PV console to PV(H) guests.
dev/xen/console/xencons_ring.c: - Allow the PV Xen console to output earlier by directly signaling the event channel in start_info if the event channel is not yet initialized. - Use HYPERVISOR_start_info instead of xen_start_info.
i386/include/xen/xen-os.h: - Remove prototype for xc_printf since it's now declared in global xen-os.h
i386/xen/xen_machdep.c: - Remove previous version of xc_printf. - Remove definition of console_page (now it's defined in the console itself). - Fix some printf formatting errors.
x86/xen/pv.c: - Add some early boot debug messages using xc_printf. - Set console_page based on the value passed in start_info.
xen/xen-os.h: - Declare console_page and add prototype for xc_printf.
|
261916 |
15-Feb-2014 |
dim |
In sys/dev/xen/console/console.c, #if 0 an unused static function.
MFC after: 3 days
|
258622 |
26-Nov-2013 |
avg |
dtrace sdt: remove the ugly sname parameter of SDT_PROBE_DEFINE
In its stead use the Solaris / illumos approach of emulating '-' (dash) in probe names with '__' (two consecutive underscores).
Reviewed by: markj MFC after: 3 weeks
|
258541 |
25-Nov-2013 |
attilio |
- For kernel compiled only with KDTRACE_HOOKS and not any lock debugging option, unbreak the lock tracing release semantic by embedding calls to LOCKSTAT_PROFILE_RELEASE_LOCK() direclty in the inlined version of the releasing functions for mutex, rwlock and sxlock. Failing to do so skips the lockstat_probe_func invokation for unlocking. - As part of the LOCKSTAT support is inlined in mutex operation, for kernel compiled without lock debugging options, potentially every consumer must be compiled including opt_kdtrace.h. Fix this by moving KDTRACE_HOOKS into opt_global.h and remove the dependency by opt_kdtrace.h for all files, as now only KDTRACE_FRAMES is linked there and it is only used as a compile-time stub [0].
[0] immediately shows some new bug as DTRACE-derived support for debug in sfxge is broken and it was never really tested. As it was not including correctly opt_kdtrace.h before it was never enabled so it was kept broken for a while. Fix this by using a protection stub, leaving sfxge driver authors the responsibility for fixing it appropriately [1].
Sponsored by: EMC / Isilon storage division Discussed with: rstone [0] Reported by: rstone [1] Discussed with: philip
|
258178 |
15-Nov-2013 |
gibbs |
Improve robustness of the Xen balloon driver.
sys/dev/xen/balloon/balloon.c: Remove unused and commented out code.
Fix deadlock caused by performing a sleepable malloc while holding the balloon mutex.
Perform proper accounting of the memory used by the domain.
Submitted by: Roger Pau Monné Sponsored by: Citrix Systems R&D Reviewed by: gibbs MFC after: 2 days
|
257913 |
10-Nov-2013 |
glebius |
Fix typo in r257515.
Submitted by: az
|
257876 |
09-Nov-2013 |
gibbs |
On XenServer the "halt" message is used instead of "poweroff", which makes FreeBSD halt but not poweroff (as expected when issuing a shutdown from the VM manager). Fix this by using the same handler for both "halt" and "poweroff".
NB: The "halt" signal seems to be used on XenServer only. The OSS Xen toolstack (xl) uses "poweroff" instead.
Submitted by: Roger Pau Monné Sponsored by: Citrix Systems R&D Reviewed by: gibbs MFC after: 2 days
|
257515 |
01-Nov-2013 |
glebius |
Somehow fix LINT-NOIP.
|
257341 |
29-Oct-2013 |
nwhitehorn |
More BUS_PROBE_NOWILDCARD sweeping. Some devices here (if_ath_ahb and siba) resist easy conversion since they implement a great deal of their attach logic inside probe(). Some of this could be fixed by moving it to attach(), but some requires something more subtle than BUS_PROBE_NOWILDCARD.
|
257276 |
28-Oct-2013 |
glebius |
Remove dead function show_device(). It isn't buildable if DEBUG is defined, due to unknown field "xn_ifno". The field wasn't known since beginning of history of this file.
|
257275 |
28-Oct-2013 |
glebius |
Include if_var.h.
|
256868 |
22-Oct-2013 |
bz |
Make netback compile without INET support in the kernel.
This shuld have been a problem since r230587. Not exactly sure why it was not detected the last weeks with the tinderbox. I would assume r255744 is what started to cause it.
MFC after: 1 week
|
256423 |
13-Oct-2013 |
gibbs |
Allow FreeBSD to be booted from CDROM media on XenServer 6.2 and prior releases.
Submitted by: Roger Pau Monné Sponsored by: Citrix Systems R&D Reviewed by: gibbs Approved by: re (gjb)
sys/dev/xen/blkfront/blkfront.c: On XenServer versions up to an including 6.2, paravirtualized CDROM support is broken. When running in an HVM domain, ignore paravirtualized instances of CDROM media, and instead rely on native drivers attaching to emulated hardware. This functions correctly on all currently known Xen based platforms.
|
256117 |
07-Oct-2013 |
dim |
Initialize a variable in sys/dev/xen/control/control.c, to silence a gcc warning.
Approved by: re (gjb) MFC after: 3 days
|
256073 |
05-Oct-2013 |
gibbs |
Formalize the concept of virtual CPU ids by adding a per-cpu vcpu_id field. Perform vcpu enumeration for Xen PV and HVM environments and convert all Xen drivers to use vcpu_id instead of a hard coded assumption of the mapping algorithm (acpi or apic ID) in use.
Submitted by: Roger Pau Monné Sponsored by: Citrix Systems R&D Reviewed by: gibbs Approved by: re (blanket Xen)
amd64/include/pcpu.h: i386/include/pcpu.h: Add vcpu_id to the amd64 and i386 pcpu structures.
dev/xen/timer/timer.c x86/xen/xen_intr.c Use new vcpu_id instead of assuming acpi_id == vcpu_id.
i386/xen/mp_machdep.c: i386/xen/mptable.c x86/xen/hvm.c: Perform Xen HVM and Xen full PV vcpu_id mapping.
x86/xen/hvm.c: x86/acpica/madt.c Change SYSINIT ordering of acpi CPU enumeration so that it is guaranteed to be available at the time of Xen HVM vcpu id mapping.
|
255726 |
20-Sep-2013 |
gibbs |
Add support for suspend/resume/migration operations when running as a Xen PVHVM guest.
Submitted by: Roger Pau Monné Sponsored by: Citrix Systems R&D Reviewed by: gibbs Approved by: re (blanket Xen) MFC after: 2 weeks
sys/amd64/amd64/mp_machdep.c: sys/i386/i386/mp_machdep.c: - Make sure that are no MMU related IPIs pending on migration. - Reset pending IPI_BITMAP on resume. - Init vcpu_info on resume.
sys/amd64/include/intr_machdep.h: sys/i386/include/intr_machdep.h: sys/x86/acpica/acpi_wakeup.c: sys/x86/x86/intr_machdep.c: sys/x86/isa/atpic.c: sys/x86/x86/io_apic.c: sys/x86/x86/local_apic.c: - Add a "suspend_cancelled" parameter to pic_resume(). For the Xen PIC, restoration of interrupt services differs between the aborted suspend and normal resume cases, so we must provide this information.
sys/dev/acpica/acpi_timer.c: sys/dev/xen/timer/timer.c: sys/timetc.h: - Don't swap out "suspend safe" timers across a suspend/resume cycle. This includes the Xen PV and ACPI timers.
sys/dev/xen/control/control.c: - Perform proper suspend/resume process for PVHVM: - Suspend all APs before going into suspension, this allows us to reset the vcpu_info on resume for each AP. - Reset shared info page and callback on resume.
sys/dev/xen/timer/timer.c: - Implement suspend/resume support for the PV timer. Since FreeBSD doesn't perform a per-cpu resume of the timer, we need to call smp_rendezvous in order to correctly resume the timer on each CPU.
sys/dev/xen/xenpci/xenpci.c: - Don't reset the PCI interrupt on each suspend/resume.
sys/kern/subr_smp.c: - When suspending a PVHVM domain make sure there are no MMU IPIs in-flight, or we will get a lockup on resume due to the fact that pending event channels are not carried over on migration. - Implement a generic version of restart_cpus that can be used by suspended and stopped cpus.
sys/x86/xen/hvm.c: - Implement resume support for the hypercall page and shared info. - Clear vcpu_info so it can be reset by APs when resuming from suspension.
sys/dev/xen/xenpci/xenpci.c: sys/x86/xen/hvm.c: sys/x86/xen/xen_intr.c: - Support UP kernel configurations.
sys/x86/xen/xen_intr.c: - Properly rebind per-cpus VIRQs and IPIs on resume.
|
255218 |
04-Sep-2013 |
gibbs |
Correct blkback handling of the BLKIF_OP_FLUSH_DISKCACHE opcode.
Properly round-trip the "operation code" for client requests.
sys/dev/xen/blkback/blkback.c: In xbb_dispatch_dev() when processing a flush request, correctly set bio->bio_caller1 to the request list (not bare request) for the operation, as is expected by the completion handler xbb_bio_done().
In xbb_get_resources(), initialize "operation" in the driver's internal request object from the client's "ring request", so it is correct when used to populate the reply when this operation completes.
Submitted by: Roger Pau Monné Sponsored by: Citrix Systems R&D Reviewed by: gibbs
|
255179 |
03-Sep-2013 |
gibbs |
sys/dev/xen/blkback/blkback.c: Initialize the request id for requests in xbb_get_resources() instead of its previous location in xbb_dispatch_io(). This guarantees that all request types (e.g. BLKIF_OP_FLUSH_DISKCACHE) have the front-end specified id recorded.
Submitted by: Roger Pau Monné Sponsored by: Citrix Systems R&D
|
255051 |
30-Aug-2013 |
cperciva |
If reading a virtual-device value fails, attempt to read a virtual-device-ext value. Some hosts do not publish "extended" disk IDs via virtual-device in an attempt to avoid confusing old blkfront drivers, and without this change we failed to attach such disks.
In particular, this commit allows all 24 ephemeral disks on EC2 hs1.8xlarge instances to be used, instead of only the first 15.
MFC after: 3 days
|
255046 |
29-Aug-2013 |
gibbs |
Introduce a new, HVM compatible, paravirtualized timer driver for Xen. Use this new driver for both PV and HVM instances.
This driver requires a Xen hypervisor that supports vector callbacks, VCPUOP hypercalls, and reports that it has a "safe PV clock".
New timer driver: Submitted by: will Sponsored by: Spectra Logic Corporation
PV port to new driver, and bug fixes: Submitted by: Roger Pau Monné Sponsored by: Citrix Systems R&D
sys/dev/xen/timer/timer.c: - Register a PV timer device driver which (currently) implements device_{identify,probe,attach} and stubs device_detach. The detach routine requires functionality not provided by timecounters(4). The suspend and resume routines need additional work (due to Xen requiring that the hypercalls be executed on the target VCPU), and aren't needed for our purposes.
- Make sure there can only be one device instance of this driver, and that it only registers one eventtimers(4) and one timecounters(4) device interface. Make both interfaces use PCPU data as needed.
- Match, with a few style cleanups & API differences, the Xen versions of the "fetch time" functions.
- Document the magic scale_delta() better for the i386 version.
- When registering the event timer, bind a separate event channel for the timer VIRQ to the device's event timer interrupt handler for each active VCPU. Describe each interrupt as "xen_et:c%d", so they can be identified per CPU in "vmstat -i" or "show intrcnt" in KDB.
- When scheduling a timer into the hypervisor, try up to 60 times if the hypervisor rejects the time as being in the past. In the common case, this retry shouldn't happen, and if it does, it should only happen once. This is because the event timer advertises a minimum period of 100usec, which is only less than the usual hypercall round trip time about 1 out of every 100 tries. (Unlike other similar drivers, this one actually checks whether the hypervisor accepted the singleshot timer set hypercall.)
- Implement a RTC PV clock based on the hypervisor wallclock.
sys/conf/files: - Add dev/xen/timer/timer.c if the kernel configuration includes either the XEN or XENHVM options.
sys/conf/files.i386: sys/i386/include/xen/xen_clock_util.h: sys/i386/xen/clock.c: sys/i386/xen/xen_clock_util.c: sys/i386/xen/mp_machdep.c: sys/i386/xen/xen_rtc.c: - Remove previous PV timer used in i386 XEN PV kernels, the new timer introduced in this change is used instead (so we share the same code between PVHVM and PV).
MFC after: 2 weeks
|
255040 |
29-Aug-2013 |
gibbs |
Implement vector callback for PVHVM and unify event channel implementations
Re-structure Xen HVM support so that: - Xen is detected and hypercalls can be performed very early in system startup. - Xen interrupt services are implemented using FreeBSD's native interrupt delivery infrastructure. - the Xen interrupt service implementation is shared between PV and HVM guests. - Xen interrupt handlers can optionally use a filter handler in order to avoid the overhead of dispatch to an interrupt thread. - interrupt load can be distributed among all available CPUs. - the overhead of accessing the emulated local and I/O apics on HVM is removed for event channel port events. - a similar optimization can eventually, and fairly easily, be used to optimize MSI.
Early Xen detection, HVM refactoring, PVHVM interrupt infrastructure, and misc Xen cleanups:
Sponsored by: Spectra Logic Corporation
Unification of PV & HVM interrupt infrastructure, bug fixes, and misc Xen cleanups:
Submitted by: Roger Pau Monné Sponsored by: Citrix Systems R&D
sys/x86/x86/local_apic.c: sys/amd64/include/apicvar.h: sys/i386/include/apicvar.h: sys/amd64/amd64/apic_vector.S: sys/i386/i386/apic_vector.s: sys/amd64/amd64/machdep.c: sys/i386/i386/machdep.c: sys/i386/xen/exception.s: sys/x86/include/segments.h: Reserve IDT vector 0x93 for the Xen event channel upcall interrupt handler. On Hypervisors that support the direct vector callback feature, we can request that this vector be called directly by an injected HVM interrupt event, instead of a simulated PCI interrupt on the Xen platform PCI device. This avoids all of the overhead of dealing with the emulated I/O APIC and local APIC. It also means that the Hypervisor can inject these events on any CPU, allowing upcalls for different ports to be handled in parallel.
sys/amd64/amd64/mp_machdep.c: sys/i386/i386/mp_machdep.c: Map Xen per-vcpu area during AP startup.
sys/amd64/include/intr_machdep.h: sys/i386/include/intr_machdep.h: Increase the FreeBSD IRQ vector table to include space for event channel interrupt sources.
sys/amd64/include/pcpu.h: sys/i386/include/pcpu.h: Remove Xen HVM per-cpu variable data. These fields are now allocated via the dynamic per-cpu scheme. See xen_intr.c for details.
sys/amd64/include/xen/hypercall.h: sys/dev/xen/blkback/blkback.c: sys/i386/include/xen/xenvar.h: sys/i386/xen/clock.c: sys/i386/xen/xen_machdep.c: sys/xen/gnttab.c: Prefer FreeBSD primatives to Linux ones in Xen support code.
sys/amd64/include/xen/xen-os.h: sys/i386/include/xen/xen-os.h: sys/xen/xen-os.h: sys/dev/xen/balloon/balloon.c: sys/dev/xen/blkback/blkback.c: sys/dev/xen/blkfront/blkfront.c: sys/dev/xen/console/xencons_ring.c: sys/dev/xen/control/control.c: sys/dev/xen/netback/netback.c: sys/dev/xen/netfront/netfront.c: sys/dev/xen/xenpci/xenpci.c: sys/i386/i386/machdep.c: sys/i386/include/pmap.h: sys/i386/include/xen/xenfunc.h: sys/i386/isa/npx.c: sys/i386/xen/clock.c: sys/i386/xen/mp_machdep.c: sys/i386/xen/mptable.c: sys/i386/xen/xen_clock_util.c: sys/i386/xen/xen_machdep.c: sys/i386/xen/xen_rtc.c: sys/xen/evtchn/evtchn_dev.c: sys/xen/features.c: sys/xen/gnttab.c: sys/xen/gnttab.h: sys/xen/hvm.h: sys/xen/xenbus/xenbus.c: sys/xen/xenbus/xenbus_if.m: sys/xen/xenbus/xenbusb_front.c: sys/xen/xenbus/xenbusvar.h: sys/xen/xenstore/xenstore.c: sys/xen/xenstore/xenstore_dev.c: sys/xen/xenstore/xenstorevar.h: Pull common Xen OS support functions/settings into xen/xen-os.h.
sys/amd64/include/xen/xen-os.h: sys/i386/include/xen/xen-os.h: sys/xen/xen-os.h: Remove constants, macros, and functions unused in FreeBSD's Xen support.
sys/xen/xen-os.h: sys/i386/xen/xen_machdep.c: sys/x86/xen/hvm.c: Introduce new functions xen_domain(), xen_pv_domain(), and xen_hvm_domain(). These are used in favor of #ifdefs so that FreeBSD can dynamically detect and adapt to the presence of a hypervisor. The goal is to have an HVM optimized GENERIC, but more is necessary before this is possible.
sys/amd64/amd64/machdep.c: sys/dev/xen/xenpci/xenpcivar.h: sys/dev/xen/xenpci/xenpci.c: sys/x86/xen/hvm.c: sys/sys/kernel.h: Refactor magic ioport, Hypercall table and Hypervisor shared information page setup, and move it to a dedicated HVM support module.
HVM mode initialization is now triggered during the SI_SUB_HYPERVISOR phase of system startup. This currently occurs just after the kernel VM is fully setup which is just enough infrastructure to allow the hypercall table and shared info page to be properly mapped.
sys/xen/hvm.h: sys/x86/xen/hvm.c: Add definitions and a method for configuring Hypervisor event delievery via a direct vector callback.
sys/amd64/include/xen/xen-os.h: sys/x86/xen/hvm.c:
sys/conf/files: sys/conf/files.amd64: sys/conf/files.i386: Adjust kernel build to reflect the refactoring of early Xen startup code and Xen interrupt services.
sys/dev/xen/blkback/blkback.c: sys/dev/xen/blkfront/blkfront.c: sys/dev/xen/blkfront/block.h: sys/dev/xen/control/control.c: sys/dev/xen/evtchn/evtchn_dev.c: sys/dev/xen/netback/netback.c: sys/dev/xen/netfront/netfront.c: sys/xen/xenstore/xenstore.c: sys/xen/evtchn/evtchn_dev.c: sys/dev/xen/console/console.c: sys/dev/xen/console/xencons_ring.c Adjust drivers to use new xen_intr_*() API.
sys/dev/xen/blkback/blkback.c: Since blkback defers all event handling to a taskqueue, convert this task queue to a "fast" taskqueue, and schedule it via an interrupt filter. This avoids an unnecessary ithread context switch.
sys/xen/xenstore/xenstore.c: The xenstore driver is MPSAFE. Indicate as much when registering its interrupt handler.
sys/xen/xenbus/xenbus.c: sys/xen/xenbus/xenbusvar.h: Remove unused event channel APIs.
sys/xen/evtchn.h: Remove all kernel Xen interrupt service API definitions from this file. It is now only used for structure and ioctl definitions related to the event channel userland device driver.
Update the definitions in this file to match those from NetBSD. Implementing this interface will be necessary for Dom0 support.
sys/xen/evtchn/evtchnvar.h: Add a header file for implemenation internal APIs related to managing event channels event delivery. This is used to allow, for example, the event channel userland device driver to access low-level routines that typical kernel consumers of event channel services should never access.
sys/xen/interface/event_channel.h: sys/xen/xen_intr.h: Standardize on the evtchn_port_t type for referring to an event channel port id. In order to prevent low-level event channel APIs from leaking to kernel consumers who should not have access to this data, the type is defined twice: Once in the Xen provided event_channel.h, and again in xen/xen_intr.h. The double declaration is protected by __XEN_EVTCHN_PORT_DEFINED__ to ensure it is never declared twice within a given compilation unit.
sys/xen/xen_intr.h: sys/xen/evtchn/evtchn.c: sys/x86/xen/xen_intr.c: sys/dev/xen/xenpci/evtchn.c: sys/dev/xen/xenpci/xenpcivar.h: New implementation of Xen interrupt services. This is similar in many respects to the i386 PV implementation with the exception that events for bound to event channel ports (i.e. not IPI, virtual IRQ, or physical IRQ) are further optimized to avoid mask/unmask operations that aren't necessary for these edge triggered events.
Stubs exist for supporting physical IRQ binding, but will need additional work before this implementation can be fully shared between PV and HVM.
sys/amd64/amd64/mp_machdep.c: sys/i386/i386/mp_machdep.c: sys/i386/xen/mp_machdep.c sys/x86/xen/hvm.c: Add support for placing vcpu_info into an arbritary memory page instead of using HYPERVISOR_shared_info->vcpu_info. This allows the creation of domains with more than 32 vcpus.
sys/i386/i386/machdep.c: sys/i386/xen/clock.c: sys/i386/xen/xen_machdep.c: sys/i386/xen/exception.s: Add support for new event channle implementation.
|
254968 |
27-Aug-2013 |
cperciva |
Remove duplicate dev.xbd.*.max_requests sysctl added in r252260.
Approved by: gibbs
|
254910 |
26-Aug-2013 |
andre |
Fix mbuf debugging printf()'s after the recent mbuf header changes.
|
254025 |
07-Aug-2013 |
jeff |
Replace kernel virtual address space allocation with vmem. This provides transparent layering and better fragmentation.
- Normalize functions that allocate memory to use kmem_* - Those that allocate address space are named kva_* - Those that operate on maps are named kmap_* - Implement recursive allocation handling for kmem_arena in vmem.
Reviewed by: alc Tested by: pho Sponsored by: EMC / Isilon Storage Division
|
252260 |
26-Jun-2013 |
gibbs |
In the Xen block front driver, take advantage of backends that support cache flush and write barrier commands.
sys/dev/xen/blkfront/block.h: Add per-command flag that specifies that the I/O queue must be frozen after this command is dispatched. This is used to implement "single-stepping".
Remove the unused per-command flag that indicates a polled command.
Add block device instance flags to record backend features.
Add a block device instance flag to indicate the I/O queue is frozen until all outstanding I/O completes.
Enhance the queue API to allow the number of elements in a queue to be interrogated.
Prefer "inline" to "__inline".
sys/dev/xen/blkfront/blkfront.c: Formalize queue freeze semantics by adding methods for both global and command-associated queue freezing.
Provide mechanism to freeze the I/O queue until all outstanding I/O completes. Use this to implement barrier semantics (BIO_ORDERED) when the backend does not support BLKIF_OP_WRITE_BARRIER commands.
Implement BIO_FLUSH as either a BLKIF_OP_FLUSH_DISKCACHE command or a 0 byte write barrier. Currently, all publicly available backends perform a diskcache flush when processing barrier commands, and this frontend behavior matches what is done in Linux.
Simplify code by using new queue length API.
Report backend features during device attach and via sysctl.
Submitted by: Roger Pau Monné Submitted by: gibbs (Merge with new driver queue API, sysctl support)
|
251807 |
16-Jun-2013 |
gibbs |
sys/dev/xen/blkfront/blkfront.c: In xbd_thaw(), fix inverted logic to verify the queue is frozen before attempting a thaw.
MFC after: 1 week
|
251772 |
15-Jun-2013 |
gibbs |
Properly track the different reasons new I/O is temporarily disabled, and only re-enable I/O when all reasons have cleared.
sys/dev/xen/blkfront/block.h: In the block front driver softc, replace the boolean XBDF_FROZEN flag with a count of commands and driver global issues that freeze the I/O queue. So long xbd_qfrozen_cnt is non-zero, I/O is halted.
Add flags to xbd_flags for tracking grant table entry and free command resource shortages. Each of these classes can increment xbd_qfrozen_cnt at most once.
Add a command flag (XBDCF_ASYNC_MAPPING) that is set whenever the initial mapping attempt of a command fails with EINPROGRESS.
sys/dev/xen/blkfront/blkfront.c: In xbd_queue_cb(), use new XBDCF_ASYNC_MAPPING flag to definitively know if an async bus dmamap load has occurred.
Add xbd_freeze() and xbd_thaw() helper methods for managing xbd_qfrozen_cnt and use them to implement all queue freezing logic.
Add missing "thaw" to restart I/O processing once grant references become available.
Sponsored by: Spectra Logic Corporation
|
251751 |
14-Jun-2013 |
gibbs |
Improve debugger visibility into queuing functions by removing the macro scheme for defining inline command queuing functions.
Prefer enums to #defines.
sys/dev/xen/blkfront/block.h Replace inline function generation performed by the XBDQ_COMMAND_QUEUE() macro with single instances of each inline function (init, enqueue, dequeue, remove). This was made possible by using queue indexes instead of bit flags in the command structure, and passing the index enum as an argument to the functions.
Improve panic/assert messages in the queue functions.
Combine queue data and stats into a single data structure and declare an array of them instead of each queue individually.
Convert command flags, softc state, and softc flags to enums.
sys/dev/xen/blkfront/blkfront.c Mechanical adjustments for new queue api.
Sponsored by: Spectra Logic Corporation MFC after: 1 week
|
251729 |
14-Jun-2013 |
gibbs |
sys/dev/xen/netfront/netfront.c: In netif_free(), call ifmedia_removeall() after ether_ifdetach() so that bpf listeners are detached, any link state processing is completed, and there is no chance for external reference to media information.
Suggested by: yongari MFC after: 1 week
|
251297 |
03-Jun-2013 |
andre |
Specify a maximum TSO length limiting the segment chain to what the Xen host side can handle after defragmentation.
This prevents the driver from throwing away too long TSO chains and improves the performance on Amazon AWS instances with 10GigE virtual interfaces to the normally expected throughput.
Submitted by: cperciva (earlier version) Reviewed by: cperciva Tested by: cperciva MFC after: 1 week
|
251215 |
01-Jun-2013 |
gibbs |
sys/dev/xen/blkfront/blkfront.c: Remove dead code.
Sponsored by: Spectra Logic Corporation MFC after: 1 week
|
251214 |
01-Jun-2013 |
gibbs |
sys/dev/xen/blkfront/blkfront.c: Remove local, and incorrect, definition for the value of an invalid grant reference.
Extract ring cleanup code into xbd_free_ring() function for symetry with xbd_alloc_ring(). This process also eliminated an initialized but unused variable.
Sponsored by: Spectra Logic Corporation MFC after: 1 week
|
251206 |
31-May-2013 |
gibbs |
Style changes. No intended functional changes.
o rename flush_requests => xbd_flush_requests o rename xbd_setup_ring => xbd_alloc_ring
Sponsored by: Spectra Logic Corporation MFC after: 1 week
|
251204 |
31-May-2013 |
gibbs |
Style cleanups. No intended functional changes.
o Group functions by by their functionality. o Remove superfluous declarations. o Remove more unused (#ifdef'd out) code.
Sponsored by: Spectra Logic Corporation
|
251195 |
31-May-2013 |
gibbs |
Style cleanups. No intended functional changes.
o This driver is the "xbd" driver, not the "blkfront", "blkif", "xbf", or "xb" driver. Use the "xbd_" naming conventions for all functions, structures, and constants. o The prevailing convention for structure fields in this driver is to prefix them with an abreviation of the structure type. Update "recently added" fields to match this style. o Remove unused data structures. o Remove superfluous casts. o Make a pass over the whole driver and bring it closer to style(9) conformance.
Sponsored by: Spectra Logic Corporation MFC after: 1 week
|
251176 |
31-May-2013 |
gibbs |
Make netif_free() safe to call on a partially initialized softc.
Sponsored by: Spectra Logic Corporation MFC after: 1 week
|
251175 |
31-May-2013 |
gibbs |
Apply the ad* => ada* IDE device name transition to the Xen block front driver.
Submitted by: Bei Guan <gbtju85@gmail.com> Reviewed by: gibbs MFC after: 1 week
|
250913 |
22-May-2013 |
gibbs |
Correct panic on detach of Xen PV network interfaces.
dev/xen/netfront: In netif_free(), properly stop the interface and drain any pending timers prior to disconnecting from the backend device.
Remove all media and detach our interface object from the system prior to deleting it.
PR: kern/176471 Submitted by: Roger Pau Monne <roger.pau@citrix.com> Reviewed by: gibbs MFC after: 1 week
|
249588 |
17-Apr-2013 |
gabor |
- Correct spelling in comments
Submitted by: Christoph Mallon <christoph.mallon@gmx.de> (via private mail)
|
249583 |
17-Apr-2013 |
gabor |
- Correct mispellings of the word necessary
Submitted by: Christoph Mallon <christoph.mallon@gmx.de> (via private mail)
|
246128 |
30-Jan-2013 |
sbz |
Use DEVMETHOD_END macro defined in sys/bus.h instead of {0, 0} sentinel on device_method_t arrays
Reviewed by: cognet Approved by: cognet
|
244993 |
03-Jan-2013 |
marius |
Remove files not connected to the build. It's confusing enough that we still have two not quite the same evtchn.c left over.
MFC after: 3 day
|
244991 |
03-Jan-2013 |
marius |
- Replace partially incorrect function names in panic(9) strings with __func__ and add some missing ones. - Remove a stale comment. - Remove unused NUM_ELEMENTS macro. - Remove extra empty lines. - Use DEVMETHOD_END. - Use NULL rather than 0 for pointers.
MFC after: 3 days
|
244990 |
03-Jan-2013 |
marius |
- Fix !SMP build. - Replace incorrect function names in printf(9) strings with __func__. - Make xctrl_shutdown_reasons table const. - Use nitems() rather than rolling an own version. - Use DEVMETHOD_END. - Use NULL rather than 0 for pointers.
MFC after: 3 days
|
243857 |
04-Dec-2012 |
glebius |
Mechanically substitute flags from historic mbuf allocator with malloc(9) flags in sys/dev.
|
242934 |
12-Nov-2012 |
dim |
Redo r242889, now using the method from projects/amd64_xen_pv r240747.
Reminded by: kib MFC after: 3 days
|
242890 |
11-Nov-2012 |
rdivacky |
Fix a typo.
|
242889 |
11-Nov-2012 |
rdivacky |
Change the XNB_ASSERT from a statement expression to do-while(0) as its result is never used.
|
241896 |
22-Oct-2012 |
kib |
Remove the support for using non-mpsafe filesystem modules.
In particular, do not lock Giant conditionally when calling into the filesystem module, remove the VFS_LOCK_GIANT() and related macros. Stop handling buffers belonging to non-mpsafe filesystems.
The VFS_VERSION is bumped to indicate the interface change which does not result in the interface signatures changes.
Conducted and reviewed by: attilio Tested by: pho
|
240521 |
14-Sep-2012 |
eadler |
s/ is is / is /g s/ a a / a /g
Approved by: cperciva MFC after: 3 days
|
237518 |
24-Jun-2012 |
ken |
Fix a bug which causes a panic in daopen(). The panic is caused by a da(4) instance going away while GEOM is still probing it.
In this case, the GEOM disk class instance has been created by disk_create(), and the taste of the disk is queued in the GEOM event queue.
While that event is queued, the da(4) instance goes away. When the open call comes into the da(4) driver, it dereferences the freed (but non-NULL) peripheral pointer provided by GEOM, which results in a panic.
The solution is to add a callback to the GEOM disk code that is called when all of its resources are cleaned up. This is implemented inside GEOM by adding an optional callback that is called when all consumers have detached from a provider, and the provider is about to be deleted.
scsi_cd.c, scsi_da.c: In the register routine for the cd(4) and da(4) routines, acquire a reference to the CAM peripheral instance just before we call disk_create().
Use the new GEOM disk d_gone() callback to register a callback (dadiskgonecb()/cddiskgonecb()) that decrements the peripheral reference count once GEOM has finished cleaning up its resources.
In the cd(4) driver, clean up open and close behavior slightly. GEOM makes sure we only get one open() and one close call, so there is no need to set an open flag and decrement the reference count if we are not the first open.
In the cd(4) driver, use cam_periph_release_locked() in a couple of error scenarios to avoid extra mutex calls.
geom.h: Add a new, optional, providergone callback that is called when a provider is about to be deleted.
geom_disk.h: Add a new d_gone() callback to the GEOM disk interface.
Bump the DISK_VERSION to version 2. This probably should have been done after a couple of previous changes, especially the addition of the d_getattr() callback.
geom_disk.c: Add a providergone callback for the disk class, g_disk_providergone(), that calls the user's d_gone() callback if it exists.
Bump the DISK_VERSION to 2.
geom_subr.c: In g_destroy_provider(), call the providergone callback if it has been provided.
In g_new_geomf(), propagate the class's providergone callback to the new geom instance.
blkfront.c: Callers of disk_create() are supposed to pass in DISK_VERSION, not an explicit disk API version number. Update the blkfront driver to do that.
disk.9: Update the disk(9) man page to include information on the new d_gone() callback, as well as the previously added d_getattr() callback, d_descr field, and HBA PCI ID fields.
MFC after: 5 days
|
237322 |
20-Jun-2012 |
fabient |
Allow booting XENHVM kernel without Xen hypervisor.
MFC after: 3 days
|
233939 |
06-Apr-2012 |
pluknet |
Free ballooned pages with the corresponding malloc type.
MFC after: 1 week
|
233465 |
25-Mar-2012 |
gibbs |
Correct failure to attach the PV block front device on Citrix XenServer configurations that advertise the multi-page ring extension, but only allow a single page of ring space.
sys/dev/xen/blkfront/blkfront.c: If only one page of ring space is being used, do not publish in the XenStore the number of pages in use (1), via either of the supported multi-page ring extension schemes.
Single page operation is the same with or without the ring-page extension being negotiated. Relying on the legacy behavior avoids an incompatible difference in how the two ring-page extension schemes that are out in the wild, deal with the base case of a single page. The Amazon/Red Hat drivers use the same XenStore variable as if the extension was not negotiated. The Citrix drivers assume the new ring reference XenStore variables will be available
Reported by: Oliver Schonefeld <schonefeld@ids-mannheim.de> MFC after: 3 days
|
232883 |
12-Mar-2012 |
scottl |
Final pass at having devices use their bus parent for dma tags. The remaining drivers that haven't been converted have various problems or complexities that will be dealt with later. This list includes:
hptrr, hptmv, hpt27xx - device aggregation across multiple parents drm - want to talk to the maintainer first tsec, sec - Openfirmware devices, not sure if changes are warranted fatm - Done except for unused testing code usb - want to talk to the maintainer first ce, cp, ctau, cx - Significant driver changes needed to convey parent info
There are also devices tucked into architecture subtrees that I'll leave for the respective maintainers to deal with.
|
231883 |
17-Feb-2012 |
gibbs |
Fix regression in the handling of blkback close events for devices that are unplugged via QEMU.
sys/dev/xen/blkback/blkback.c: Toolstack initiated closures change the frontend's state to Closing. The backend must change to Closing as well, even if we can't actually close yet, in order for the frontend to notice and start the closing process.
MFC after: 3 days
|
231839 |
16-Feb-2012 |
gibbs |
Fix a bug in the calculation of the maximum I/O request size. The previous code did not limit the I/O request size based on the maximum number of segments supported by the back-end. In current practice, since the only back-end supporting chained requests is the FreeBSD implementation, this limit was never exceeded.
sys/dev/xen/blkfront/block.h: Add two macros, XBF_SEGS_TO_SIZE() and XBF_SIZE_TO_SEGS(), to centralize the logic of reserving a segment to deal with non-page-aligned I/Os.
sys/dev/xen/blkfront/blkfront.c: o When negotiating transfer parameters, limit the max_request_size we use and publish, if it is greater than the maximum, unaligned, I/O we can support with the number of segments advertised by the backend. o Don't unilaterally reduce the I/O size published to the disk layer by a single page. max_request_size is already properly limited in the transfer parameter negotiation code. o Fix typos in printf strings: "max_requests_segments" -> "max_request_segments" "specificed" -> "specified"
MFC after: 1 day
|
231837 |
16-Feb-2012 |
gibbs |
Fix typo in a printf string: "specificed" -> "specified".
MFC after: 1 day
|
231743 |
15-Feb-2012 |
gibbs |
Enhance documentation, improve interoperability, and fix defects in FreeBSD's front and back Xen blkif interface drivers.
sys/dev/xen/blkfront/block.h: sys/dev/xen/blkfront/blkfront.c: sys/dev/xen/blkback/blkback.c: Replace FreeBSD specific multi-page ring impelementation with support for both the Citrix and Amazon/RedHat versions of this extension.
sys/dev/xen/blkfront/blkfront.c: o Add a per-instance sysctl tree that exposes all negotiated transport parameters (ring pages, max number of requests, max request size, max number of segments). o In blkfront_vdevice_to_unit() add a missing return statement so that we properly identify the unit number for high numbered xvd devices.
sys/dev/xen/blkback/blkback.c: o Add static dtrace probes for several events in this driver. o Defer connection shutdown processing until the front-end enters the closed state. This avoids prematurely tearing down the connection when buggy front-ends transition to the closing state, even though the device is open and they veto the close request from the tool stack. o Add nodes for maximum request size and the number of active ring pages to the exising, per-instance, sysctl tree. o Miscelaneous style cleanup.
sys/xen/interface/io/blkif.h: o Add extensive documentation of the XenStore nodes used to implement the blkif interface. o Document the startup sequence between a front and back driver. o Add structures and documenatation for the "discard" feature (AKA Trim). o Cleanup some definitions related to FreeBSD's request number/size/segment-limit extension.
sys/dev/xen/blkfront/blkfront.c: sys/dev/xen/blkback/blkback.c: sys/xen/xenbus/xenbusvar.h: Add the convenience function xenbus_get_otherend_state() and use it to simplify some logic in both block-front and block-back.
MFC after: 1 day
|
230916 |
02-Feb-2012 |
ken |
Fix the netback driver build for i386.
netback.c: Add missing VM includes.
xen/xenvar.h, xen/xenpmap.h: Move some XENHVM macros from <machine/xen/xenpmap.h> to <machine/xen/xenvar.h> on i386 to match the amd64 headers.
conf/files: Add netback to the build.
Submitted by: jhb MFC after: 3 days
|
230587 |
26-Jan-2012 |
ken |
Xen netback driver rewrite.
share/man/man4/Makefile, share/man/man4/xnb.4, sys/dev/xen/netback/netback.c, sys/dev/xen/netback/netback_unit_tests.c:
Rewrote the netback driver for xen to attach properly via newbus and work properly in both HVM and PVM mode (only HVM is tested). Works with the in-tree FreeBSD netfront driver or the Windows netfront driver from SuSE. Has not been extensively tested with a Linux netfront driver. Does not implement LRO, TSO, or polling. Includes unit tests that may be run through sysctl after compiling with XNB_DEBUG defined.
sys/dev/xen/blkback/blkback.c, sys/xen/interface/io/netif.h:
Comment elaboration.
sys/kern/uipc_mbuf.c:
Fix page fault in kernel mode when calling m_print() on a null mbuf. Since m_print() is only used for debugging, there are no performance concerns for extra error checking code.
sys/kern/subr_scanf.c:
Add the "hh" and "ll" width specifiers from C99 to scanf(). A few callers were already using "ll" even though scanf() was handling it as "l".
Submitted by: Alan Somers <alans@spectralogic.com> Submitted by: John Suykerbuyk <johns@spectralogic.com> Sponsored by: Spectra Logic MFC after: 1 week Reviewed by: ken
|
230183 |
16-Jan-2012 |
cperciva |
Make XENHVM work on i386. The __ffs() function counts bits starting from zero, unlike ffs(3), which starts counting from 1.
|
229767 |
07-Jan-2012 |
kevlo |
ether_ifattach() sets if_mtu to ETHERMTU, don't bother set it again
Reviewed by: yongari
|
228631 |
17-Dec-2011 |
avg |
kern cons: introduce infrastructure for console grabbing by kernel
At the moment grab and ungrab methods of all console drivers are no-ops.
Current intended meaning of the calls is that the kernel takes control of console input. In the future the semantics may be extended to mean that the calling thread takes full ownership of the console (e.g. console output from other threads could be suspended).
Inspired by: bde MFC after: 2 months
|
228471 |
13-Dec-2011 |
ed |
Replace `inline static' by `static inline'.
If I interpret the C standard correctly, the storage specifier should be placed before the inline keyword. While at it, replace __inline by inline in the files affected.
|
227843 |
22-Nov-2011 |
marius |
- There's no need to overwrite the default device method with the default one. Interestingly, these are actually the default for quite some time (bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9) since r52045) but even recently added device drivers do this unnecessarily. Discussed with: jhb, marcel - While at it, use DEVMETHOD_END. Discussed with: jhb - Also while at it, use __FBSDID.
|
227309 |
07-Nov-2011 |
ed |
Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.
The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static.
|
227293 |
07-Nov-2011 |
ed |
Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.
This means that their use is restricted to a single C file.
|
226843 |
27-Oct-2011 |
alc |
Eliminate vestiges of page coloring in VM_ALLOC_NOOBJ calls to vm_page_alloc(). While I'm here, for the sake of consistency, always specify the allocation class, such as VM_ALLOC_NORMAL, as the first of the flags.
|
225709 |
21-Sep-2011 |
gibbs |
Update netfront so that it queries and honors published back-end features.
sys/dev/xen/netfront/netfront.c: o Add xn_query_features() which reads the XenStore and records the TSO, LRO, and chained ring-request support of the backend. o Rename xn_configure_lro() to xn_configure_features() and use this routine to manage the setup of TSO, LRO, and checksum offload. o In create_netdev(), initialize if_capabilities and if_hwassist to the capabilities found on all backends. Delegate configuration of if_capenable and the TSO flag if if_hwassist to xn_configure_features().
Reported by: Hugo Silva (fix inspired by patch provided) Approved by: re MFC after: 1 week
|
225708 |
21-Sep-2011 |
gibbs |
Modify the netfront driver so it can successfully attach to PV devices with the ioemu attribute set.
sys/dev/xen/netfront/netfront.c: o If a mac address for the interface cannot be found in the front-side XenStore tree, look for an entry in the back-side tree. With ioemu devices, the emulator does not populate the front side tree and neither does Xend. o Return an error rather than panic when an attach attempt fails.
Reported by: Janne Snabb (fix inspired by patch provided) PR: kern/154302 Approved by: re
|
225707 |
21-Sep-2011 |
gibbs |
Correct suspend/resume support in the Netfront driver.
Sponsored by: BQ Internet
sys/dev/xen/netfront/netfront.c: o Implement netfront_suspend(), a specialized suspend handler for the netfront driver. This routine simply disables the carrier so the driver is idle during system suspend processing. o Fix a leak when re-initializing LRO during a link reset. o In netif_release_tx_bufs(), when cleaning up the grant references for our TX ring, use gnttab_end_foreign_access_ref instead of attempting to grant the page again. o In netif_release_tx_bufs(), we do not track mbufs associated with mbuf chains, but instead just free each mbuf directly. Use m_free(), not m_freem(), to avoid double frees of mbufs. o Refactor some code to enhance clarity.
Approved by: re MFC after: 1 week
|
225705 |
21-Sep-2011 |
gibbs |
Add suspend/resume support to the Xen blkfront driver.
Sponsored by: BQ Internet
sys/dev/xen/blkfront/block.h: sys/dev/xen/blkfront/blkfront.c: Remove now unused blkif_vdev_t from the blkfront soft.
sys/dev/xen/blkfront/blkfront.c: o In blkfront_suspend(), indicate the desire to suspend by changing the softc connected state to SUSPENDED, and then wait for any I/O pending on the remote peer to drain. Cancel suspend processing if I/O does not drain within 30 seconds. o Enable and update blkfront_resume(). Since I/O is drained prior to the suspension of the VM, the complicated recovery process performed by other Xen blkfront implementations is avoided. We simply tear down the connection to our old peer, and then re-connect. o In blkif_initialize(), fix a resource leak and botched return if we cannot allocate shadow memory for our requests. o In blkfront_backend_changed(), correct our response to the XenbusStateInitialised state. This state indicates that our backend peer has published sufficient data for blkfront to publish ring information and other XenStore data, not that a connection can occur. Blkfront now will only perform connection processing in response to the XenbusStateConnected state. This corrects an issue where blkfront connected before the backend was ready during resume processing.
Approved by: re MFC after: 1 week
|
225704 |
21-Sep-2011 |
gibbs |
Properly handle suspend/resume events in the Xen device framework.
Sponsored by: BQ Internet
sys/xen/xenbus/xenbusb.c: o In xenbusb_resume(), publish the state transition of the resuming device into XenbusStateIntiailising so that the remote peer can see it. Recording the state locally is not sufficient to trigger a re-connect sequence. o In xenbusb_resume(), defer new-bus resume processing until after the remote peer's XenStore address has been updated. The drivers may need to refer to this information during resume processing.
sys/xen/xenbus/xenbusb_back.c: sys/xen/xenbus/xenbusb_front.c: Register xenbusb_resume() rather than bus_generic_resume() as the handler for device_resume events.
sys/xen/xenstore/xenstore.c: o Fix grammer in a comment. o In xs_suspend(), pass suspend events on to the child devices (e.g. xenbusb_front/back, that are attached to the XenStore.
Approved by: re MFC after: 1 week
|
225343 |
02-Sep-2011 |
rwatson |
Add support for alternative break-to-debugger support on the Xen console. This should help debug boot-time hangs experienced in 9.0-BETA.
MFC after: 3 weeks Tested by: sbruno Approved by: re (kib)
|
223758 |
04-Jul-2011 |
attilio |
With retirement of cpumask_t and usage of cpuset_t for representing a mask of CPUs, pc_other_cpus and pc_cpumask become highly inefficient.
Remove them and replace their usage with custom pc_cpuid magic (as, atm, pc_cpumask can be easilly represented by (1 << pc_cpuid) and pc_other_cpus by (all_cpus & ~(1 << pc_cpuid))).
This change is not targeted for MFC because of struct pcpu members removal and dependency by cpumask_t retirement.
MD review by: marcel, marius, alc Tested by: pluknet MD testing by: marcel, marius, gonzo, andreast
|
223059 |
13-Jun-2011 |
gibbs |
Several enhancements to the Xen block back driver.
sys/dev/xen/blkback/blkback.c: o Implement front-end request coalescing. This greatly improves the performance of front-end clients that are unaware of the dynamic request-size/number of requests negotiation available in the FreeBSD backend driver. This required a large restructuring in how this driver records in-flight transactions and how those transactions are mapped into kernel KVA. For example, the driver now includes a mini "KVA manager" that allocates ranges of contiguous KVA to patches of requests that are physically contiguous in the backing store so that a single bio or UIO segment can be used to represent the I/O.
o Refuse to open any backend files or devices if the system has yet to mount root. This avoids a panic.
o Properly handle "onlined" devices. An "onlined" backend device stays attached to its backing store across front-end disconnections. This feature is intended to reduce latency when a front-end does a hand-off to another driver (e.g. PV aware bootloader to OS kernel) or during a VM reboot.
o Harden the driver against a pathological/buggy front-end by carefully vetting front-end XenStore data such as the front-end state.
o Add sysctls that report the negotiated number of segments per-request and the number of requests that can be concurrently in flight.
Submitted by: kdm Reviewed by: gibbs Sponsored by: Spectra Logic Corporation MFC after: 1 week
|
222975 |
11-Jun-2011 |
gibbs |
Monitor and emit events for XenStore changes to XenBus trees of the devices we manage. These changes can be due to writes we make ourselves or due to changes made by the control domain. The goal of these changes is to insure that all state transitions can be detected regardless of their source and to allow common device policies (e.g. "onlined" backend devices) to be centralized in the XenBus bus code.
sys/xen/xenbus/xenbusvar.h: sys/xen/xenbus/xenbus.c: sys/xen/xenbus/xenbus_if.m: Add a new method for XenBus drivers "localend_changed". This method is invoked whenever a write is detected to a device's XenBus tree. The default implementation of this method is a no-op.
sys/xen/xenbus/xenbus_if.m: sys/dev/xen/netfront/netfront.c: sys/dev/xen/blkfront/blkfront.c: sys/dev/xen/blkback/blkback.c: Change the signature of the "otherend_changed" method. This notification cannot fail, so it should return void.
sys/xen/xenbus/xenbusb_back.c: Add "online" device handling to the XenBus Back Bus support code. An online backend device remains active after a front-end detaches as a reconnect is expected to occur in the near future.
sys/xen/interface/io/xenbus.h: Add comment block further explaining the meaning and driver responsibilities associated with the XenBus Closed state.
sys/xen/xenbus/xenbusb.c: sys/xen/xenbus/xenbusb.h: sys/xen/xenbus/xenbusb_back.c: sys/xen/xenbus/xenbusb_front.c: sys/xen/xenbus/xenbusb_if.m: o Register a XenStore watch against the local XenBus tree for all devices. o Cache the string length of the path to our local tree. o Allow the xenbus front and back drivers to hook/filter both local and otherend watch processing. o Update the device ivar version of "state" when we detect a XenStore update of that node.
sys/dev/xen/control/control.c: sys/xen/xenbus/xenbus.c: sys/xen/xenbus/xenbusb.c: sys/xen/xenbus/xenbusb.h: sys/xen/xenbus/xenbusvar.h: sys/xen/xenstore/xenstorevar.h: Allow clients of the XenStore watch mechanism to attach a single uintptr_t worth of client data to the watch. This removes the need to carefully place client watch data within enclosing objects so that a cast or offsetof calculation can be used to convert from watch to enclosing object.
Sponsored by: Spectra Logic Corporation MFC after: 1 week
|
222813 |
07-Jun-2011 |
attilio |
etire the cpumask_t type and replace it with cpuset_t usage.
This is intended to fix the bug where cpu mask objects are capped to 32. MAXCPU, then, can now arbitrarely bumped to whatever value. Anyway, as long as several structures in the kernel are statically allocated and sized as MAXCPU, it is suggested to keep it as low as possible for the time being.
Technical notes on this commit itself: - More functions to handle with cpuset_t objects are introduced. The most notable are cpusetobj_ffs() (which calculates a ffs(3) for a cpuset_t object), cpusetobj_strprint() (which prepares a string representing a cpuset_t object) and cpusetobj_strscan() (which creates a valid cpuset_t starting from a string representation). - pc_cpumask and pc_other_cpus are target to be removed soon. With the moving from cpumask_t to cpuset_t they are now inefficient and not really useful. Anyway, for the time being, please note that access to pcpu datas is protected by sched_pin() in order to avoid migrating the CPU while reading more than one (possible) word - Please note that size of cpuset_t objects may differ between kernel and userland. While this is not directly related to the patch itself, it is good to understand that concept and possibly use the patch as a reference on how to deal with cpuset_t objects in userland, when accessing kernland members. - KTR_CPUMASK is changed and now is represented through a string, to be set as the example reported in NOTES.
Please additively note that no MAXCPU is bumped in this patch, but private testing has been done until to MAXCPU=128 on a real 8x8x2(htt) machine (amd64).
Please note that the FreeBSD version is not yet bumped because of the upcoming pcpu changes. However, note that this patch is not targeted for MFC.
People to thank for the time spent on this patch: - sbruno, pluknet and Nicholas Esborn (nick AT desert DOT net) tested several revision of the patches and really helped in improving stability of this work. - marius fixed several bugs in the sparc64 implementation and reviewed patches related to ktr. - jeff and jhb discussed the basic approach followed. - kib and marcel made targeted review on some specific part of the patch. - marius, art, nwhitehorn and andreast reviewed MD specific part of the patch. - marius, andreast, gonzo, nwhitehorn and jceel tested MD specific implementations of the patch. - Other people have made contributions on other patches that have been already committed and have been listed separately.
Companies that should be mentioned for having participated at several degrees: - Yahoo! for having offered the machines used for testing on big count of CPUs. - The FreeBSD Foundation for having sponsored my devsummit attendance, which has been instrumental. - Sandvine for having offered offices and infrastructure during development.
(I really hope I didn't forget anyone, if it happened I apologize in advance).
|
221827 |
13-May-2011 |
mav |
Fix msleep() usage in Xen balloon driver to not wake up on every HZ tick.
|
221130 |
27-Apr-2011 |
bz |
Make various (pseudo) interfaces compile without INET in the kernel adding appropriate #ifdefs. For module builds the framework needs adjustments for at least carp.
Reviewed by: gnn Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems MFC after: 4 days
|
218056 |
29-Jan-2011 |
gibbs |
Fix bug in the netfront driver that caused excessive packet drops during receive processing.
Remove unnecessary restrictions on the mbuf chain length built during an LRO receive. This restriction was copied from the Linux netfront driver where the LRO implementation cannot handle more than 18 discontinuities. The FreeBSD implementation has no such restriction.
MFC after: 1 week
|
217566 |
19-Jan-2011 |
mdf |
Fix a few more SYSCTL_PROC() that were missing a CTLFLAG type specifier.
|
216956 |
04-Jan-2011 |
rwatson |
Make "options XENHVM" compile for i386, not just amd64 -- a largely mechanical change. This opens the door for using PV device drivers under Xen HVM on i386, as well as more general harmonisation of i386 and amd64 Xen support in FreeBSD.
Reviewed by: cperciva MFC after: 3 weeks
|
216790 |
29-Dec-2010 |
cperciva |
A lack of console input is not the same thing as a byte of \0 input. Correctly return -1 from cngetc when no input is available to be read.
This fixes the '(CTRL-C to abort)' spam while dumping.
MFC after: 3 days
|
216241 |
06-Dec-2010 |
cperciva |
Set correct maximum I/O length. We can only handle I/O of up to max_request_segments * PAGE_SIZE if the I/O is page-aligned; the largest I/O we can guarantee will work is PAGE_SIZE less than that. This unbreaks 'diskinfo -t'.
|
215682 |
22-Nov-2010 |
jhb |
Purge mergeinfo on sys/dev/xen/xenpci. The only unique mergeinfo compared to head was not useful (it came in with the merge from /user/dfr/xenhvm/7 and that mergeinfo is still present at sys/) and not worth keeping an extra set of mergeinfo around in the kernel.
|
215681 |
22-Nov-2010 |
jhb |
Remove some bogus, self-referential mergeinfo.
|
214444 |
28-Oct-2010 |
gibbs |
sys/dev/xen/blkback/blkback.c: In xbb_detach() only perform cleanup of our taskqueue and device statistics structures if they have been initialized. This avoids a panic when xbb_detach() is called on a partially initialized device instance, due to an early failure in attach.
Sponsored by: Spectra Logic Corporation
|
214077 |
19-Oct-2010 |
gibbs |
Improve the Xen para-virtualized device infrastructure of FreeBSD:
o Add support for backend devices (e.g. blkback) o Implement extensions to the Xen para-virtualized block API to allow for larger and more outstanding I/Os. o Import a completely rewritten block back driver with support for fronting I/O to both raw devices and files. o General cleanup and documentation of the XenBus and XenStore support code. o Robustness and performance updates for the block front driver. o Fixes to the netfront driver.
Sponsored by: Spectra Logic Corporation
sys/xen/xenbus/init.txt: Deleted: This file explains the Linux method for XenBus device enumeration and thus does not apply to FreeBSD's NewBus approach.
sys/xen/xenbus/xenbus_probe_backend.c: Deleted: Linux version of backend XenBus service routines. It was never ported to FreeBSD. See xenbusb.c, xenbusb_if.m, xenbusb_front.c xenbusb_back.c for details of FreeBSD's XenBus support.
sys/xen/xenbus/xenbusvar.h: sys/xen/xenbus/xenbus_xs.c: sys/xen/xenbus/xenbus_comms.c: sys/xen/xenbus/xenbus_comms.h: sys/xen/xenstore/xenstorevar.h: sys/xen/xenstore/xenstore.c: Split XenStore into its own tree. XenBus is a software layer built on top of XenStore. The old arrangement and the naming of some structures and functions blurred these lines making it difficult to discern what services are provided by which layer and at what times these services are available (e.g. during system startup and shutdown).
sys/xen/xenbus/xenbus_client.c: sys/xen/xenbus/xenbus.c: sys/xen/xenbus/xenbus_probe.c: sys/xen/xenbus/xenbusb.c: sys/xen/xenbus/xenbusb.h: Split up XenBus code into methods available for use by client drivers (xenbus.c) and code used by the XenBus "bus code" to enumerate, attach, detach, and service bus drivers.
sys/xen/reboot.c: sys/dev/xen/control/control.c: Add a XenBus front driver for handling shutdown, reboot, suspend, and resume events published in the XenStore. Move all PV suspend/reboot support from reboot.c into this driver.
sys/xen/blkif.h: New file from Xen vendor with macros and structures used by a block back driver to service requests from a VM running a different ABI (e.g. amd64 back with i386 front).
sys/conf/files: Adjust kernel build spec for new XenBus/XenStore layout and added Xen functionality.
sys/dev/xen/balloon/balloon.c: sys/dev/xen/netfront/netfront.c: sys/dev/xen/blkfront/blkfront.c: sys/xen/xenbus/... sys/xen/xenstore/... o Rename XenStore APIs and structures from xenbus_* to xs_*. o Adjust to use of M_XENBUS and M_XENSTORE malloc types for allocation of objects returned by these APIs. o Adjust for changes in the bus interface for Xen drivers.
sys/xen/xenbus/... sys/xen/xenstore/... Add Doxygen comments for these interfaces and the code that implements them.
sys/dev/xen/blkback/blkback.c: o Rewrite the Block Back driver to attach properly via newbus, operate correctly in both PV and HVM mode regardless of domain (e.g. can be in a DOM other than 0), and to deal with the latest metadata available in XenStore for block devices.
o Allow users to specify a file as a backend to blkback, in addition to character devices. Use the namei lookup of the backend path to automatically configure, based on file type, the appropriate backend method.
The current implementation is limited to a single outstanding I/O at a time to file backed storage.
sys/dev/xen/blkback/blkback.c: sys/xen/interface/io/blkif.h: sys/xen/blkif.h: sys/dev/xen/blkfront/blkfront.c: sys/dev/xen/blkfront/block.h: Extend the Xen blkif API: Negotiable request size and number of requests.
This change extends the information recorded in the XenStore allowing block front/back devices to negotiate for optimal I/O parameters. This has been achieved without sacrificing backward compatibility with drivers that are unaware of these protocol enhancements. The extensions center around the connection protocol which now includes these additions:
o The back-end device publishes its maximum supported values for, request I/O size, the number of page segments that can be associated with a request, the maximum number of requests that can be concurrently active, and the maximum number of pages that can be in the shared request ring. These values are published before the back-end enters the XenbusStateInitWait state.
o The front-end waits for the back-end to enter either the InitWait or Initialize state. At this point, the front end limits it's own capabilities to the lesser of the values it finds published by the backend, it's own maximums, or, should any back-end data be missing in the store, the values supported by the original protocol. It then initializes it's internal data structures including allocation of the shared ring, publishes its maximum capabilities to the XenStore and transitions to the Initialized state.
o The back-end waits for the front-end to enter the Initalized state. At this point, the back end limits it's own capabilities to the lesser of the values it finds published by the frontend, it's own maximums, or, should any front-end data be missing in the store, the values supported by the original protocol. It then initializes it's internal data structures, attaches to the shared ring and transitions to the Connected state.
o The front-end waits for the back-end to enter the Connnected state, transitions itself to the connected state, and can commence I/O.
Although an updated front-end driver must be aware of the back-end's InitWait state, the back-end has been coded such that it can tolerate a front-end that skips this step and transitions directly to the Initialized state without waiting for the back-end.
sys/xen/interface/io/blkif.h: o Increase BLKIF_MAX_SEGMENTS_PER_REQUEST to 255. This is the maximum number possible without changing the blkif request header structure (nr_segs is a uint8_t).
o Add two new constants: BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK, and BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK. These respectively indicate the number of segments that can fit in the first ring-buffer entry of a request, and for each subsequent (sg element only) ring-buffer entry associated with the "header" ring-buffer entry of the request.
o Add the blkif_request_segment_t typedef for segment elements.
o Add the BLKRING_GET_SG_REQUEST() macro which wraps the RING_GET_REQUEST() macro and returns a properly cast pointer to an array of blkif_request_segment_ts.
o Add the BLKIF_SEGS_TO_BLOCKS() macro which calculates the number of ring entries that will be consumed by a blkif request with the given number of segments.
sys/xen/blkif.h: o Update for changes in interface/io/blkif.h macros.
o Update the BLKIF_MAX_RING_REQUESTS() macro to take the ring size as an argument to allow this calculation on multi-page rings.
o Add a companion macro to BLKIF_MAX_RING_REQUESTS(), BLKIF_RING_PAGES(). This macro determines the number of ring pages required in order to support a ring with the supplied number of request blocks.
sys/dev/xen/blkback/blkback.c: sys/dev/xen/blkfront/blkfront.c: sys/dev/xen/blkfront/block.h: o Negotiate with the other-end with the following limits: Reqeust Size: MAXPHYS Max Segments: (MAXPHYS/PAGE_SIZE) + 1 Max Requests: 256 Max Ring Pages: Sufficient to support Max Requests with Max Segments.
o Dynamically allocate request pools and segemnts-per-request.
o Update ring allocation/attachment code to support a multi-page shared ring.
o Update routines that access the shared ring to handle multi-block requests.
sys/dev/xen/blkfront/blkfront.c: o Track blkfront allocations in a blkfront driver specific malloc pool.
o Strip out XenStore transaction retry logic in the connection code. Transactions only need to be used when the update to multiple XenStore nodes must be atomic. That is not the case here.
o Fully disable blkif_resume() until it can be fixed properly (it didn't work before this change).
o Destroy bus-dma objects during device instance tear-down.
o Properly handle backend devices with powef-of-2 sector sizes larger than 512b.
sys/dev/xen/blkback/blkback.c: Advertise support for and implement the BLKIF_OP_WRITE_BARRIER and BLKIF_OP_FLUSH_DISKCACHE blkif opcodes using BIO_FLUSH and the BIO_ORDERED attribute of bios.
sys/dev/xen/blkfront/blkfront.c: sys/dev/xen/blkfront/block.h: Fix various bugs in blkfront.
o gnttab_alloc_grant_references() returns 0 for success and non-zero for failure. The check for < 0 is a leftover Linuxism.
o When we negotiate with blkback and have to reduce some of our capabilities, print out the original and reduced capability before changing the local capability. So the user now gets the correct information.
o Fix blkif_restart_queue_callback() formatting. Make sure we hold the mutex in that function before calling xb_startio().
o Fix a couple of KASSERT()s.
o Fix a check in the xb_remove_* macro to be a little more specific.
sys/xen/gnttab.h: sys/xen/gnttab.c: Define GNTTAB_LIST_END publicly as GRANT_REF_INVALID.
sys/dev/xen/netfront/netfront.c: Use GRANT_REF_INVALID instead of driver private definitions of the same constant.
sys/xen/gnttab.h: sys/xen/gnttab.c: Add the gnttab_end_foreign_access_references() API.
This API allows a client to batch the release of an array of grant references, instead of coding a private for loop. The implementation takes advantage of this batching to reduce lock overhead to one acquisition and release per-batch instead of per-freed grant reference.
While here, reduce the duration the gnttab_list_lock is held during gnttab_free_grant_references() operations. The search to find the tail of the incoming free list does not rely on global state and so can be performed without holding the lock.
sys/dev/xen/xenpci/evtchn.c: sys/dev/xen/evtchn/evtchn.c: sys/xen/xen_intr.h: o Implement the bind_interdomain_evtchn_to_irqhandler API for HVM mode. This allows an HVM domain to serve back end devices to other domains. This API is already implemented for PV mode.
o Synchronize the API between HVM and PV.
sys/dev/xen/xenpci/xenpci.c: o Scan the full region of CPUID space in which the Xen VMM interface may be implemented. On systems using SuSE as a Dom0 where the Viridian API is also exported, the VMM interface is above the region we used to search.
o Pass through bus_alloc_resource() calls so that XenBus drivers attaching on an HVM system can allocate unused physical address space from the nexus. The block back driver makes use of this facility.
sys/i386/xen/xen_machdep.c: Use the correct type for accessing the statically mapped xenstore metadata.
sys/xen/interface/hvm/params.h: sys/xen/xenstore/xenstore.c: Move hvm_get_parameter() to the correct global header file instead of as a private method to the XenStore.
sys/xen/interface/io/protocols.h: Sync with vendor.
sys/xeninterface/io/ring.h: Add macro for calculating the number of ring pages needed for an N deep ring.
To avoid duplication within the macros, create and use the new __RING_HEADER_SIZE() macro. This macro calculates the size of the ring book keeping struct (producer/consumer indexes, etc.) that resides at the head of the ring.
Add the __RING_PAGES() macro which calculates the number of shared ring pages required to support a ring with the given number of requests.
These APIs are used to support the multi-page ring version of the Xen block API.
sys/xeninterface/io/xenbus.h: Add Comments.
sys/xen/xenbus/... o Refactor the FreeBSD XenBus support code to allow for both front and backend device attachments.
o Make use of new config_intr_hook capabilities to allow front and back devices to be probed/attached in parallel.
o Fix bugs in probe/attach state machine that could cause the system to hang when confronted with a failure either in the local domain or in a remote domain to which one of our driver instances is attaching.
o Publish all required state to the XenStore on device detach and failure. The majority of the missing functionality was for serving as a back end since the typical "hot-plug" scripts in Dom0 don't handle the case of cleaning up for a "service domain" that is not itself.
o Add dynamic sysctl nodes exposing the generic ivars of XenBus devices.
o Add doxygen style comments to the majority of the code.
o Cleanup types, formatting, etc.
sys/xen/xenbus/xenbusb.c: Common code used by both front and back XenBus busses.
sys/xen/xenbus/xenbusb_if.m: Method definitions for a XenBus bus.
sys/xen/xenbus/xenbusb_front.c: sys/xen/xenbus/xenbusb_back.c: XenBus bus specialization for front and back devices.
MFC after: 1 month
|
208901 |
08-Jun-2010 |
ken |
A number of netfront fixes and stability improvements:
- Re-enable TSO. This was broken previously due to CSUM_TSO clearing the CSUM_TCP flag, so our checksum flags were incorrectly set going to the netback driver. That was fixed in r206844 in tcp_output.c, so we can turn TSO back on here.
- Fix the way transmit slots are calculated, so that we can't overfill the ring.
- Avoid sending packets with more fragments/segments than netback can handle. The Linux netback code can only handle packets of MAX_SKB_FRAGS, which turns out to be 18 on machines with 4K pages. We can easily generate packets with 32 or so fragments with TSO turned on. Right now the solution is just to drop the packets (since netback doesn't seem to handle it gracefully), but we should come up with a way to allow a driver to tell the TCP stack the maximum number of fragments it can handle in a single packet.
- Fix the way the consumer is tracked in the receive path. It could get out of sync fairly easily.
- Use standard Xen ring macros to make it clearer how netfront is using the rings.
- Get rid of Linux-ish negative errno return values.
- Added more documentation to the driver.
- Refactored code to make it easier to read.
- Some other minor fixes.
Reviewed by: gibbs
Reviewed by: gibbs Sponsored by: Spectra Logic MFC after: 7 days
|
207736 |
07-May-2010 |
mckusick |
Merger of the quota64 project into head.
This joint work of Dag-Erling Smørgrav and myself updates the FFS quota system to support both traditional 32-bit and new 64-bit quotas (for those of you who want to put 2+Tb quotas on your users).
By default quotas are not compiled into the kernel. To include them in your kernel configuration you need to specify:
options QUOTA # Enable FFS quotas
If you are already running with the current 32-bit quotas, they should continue to work just as they have in the past. If you wish to convert to using 64-bit quotas, use `quotacheck -c 64'; if you wish to revert from 64-bit quotas back to 32-bit quotas, use `quotacheck -c 32'.
There is a new library of functions to simplify the use of the quota system, do `man quotafile' for details. If your application is currently using the quotactl(2), it is highly recommended that you convert your application to use the quotafile interface. Note that existing binaries will continue to work.
Special thanks to John Kozubik of rsync.net for getting me interested in pursuing 64-bit quota support and for funding part of my development time on this project.
|
207673 |
05-May-2010 |
joel |
Switch to our preferred 2-clause BSD license.
Approved by: kmacy
|
205104 |
12-Mar-2010 |
rrs |
The proper fix for the delayed SCTP checksum is to have the delayed function take an argument as to the offset to the SCTP header. This allows it to work for V4 and V6. This of course means changing all callers of the function to either pass the header len, if they have it, or create it (ip_hl << 2 or sizeof(ip6_hdr)). PR: 144529 MFC after: 2 weeks
|
204158 |
21-Feb-2010 |
kmacy |
- make printf conditional - fix witness warnings by making configuration lock a mutex
|
201236 |
29-Dec-2009 |
gibbs |
In blkif_queue_cb(), test the return value from gnttab_claim_grant_reference() for >= 0 instead of != ENOSPC.
|
201138 |
28-Dec-2009 |
gibbs |
Correct alignment and boundary constraints in blkfront's bus dma tag. The blkif interface in Xen requires all I/O to be 512 byte aligned with each segment bounded by a 4k page.
Note: This submission only documents the proper contraints for blkif I/O. The alignment code in busdma does not yet handle alignment constraints correctly in all cases.
|
199997 |
01-Dec-2009 |
gibbs |
Add media ioctl support and link notifications so that devd will attempt to run dhclient on a netfront (xn) device that is setup for DHCP in /etc/rc.conf.
PR: kern/136251 (fixed differently than the submitted patch)
|
199960 |
30-Nov-2009 |
kmacy |
Merge Scott Long's latest blkfront now that the licensing issues are resolved
|
199959 |
30-Nov-2009 |
kmacy |
Update license to reflect terms in xen 2.0 as of the time when the driver was ported to FreeBSD
|
199735 |
24-Nov-2009 |
kmacy |
remove annoying printf that cripples kdb on PV guests
|
199734 |
24-Nov-2009 |
kmacy |
fixup kernel core dumps on paravirtual guests
|
199549 |
19-Nov-2009 |
jhb |
Remove commented out reference to if_watchdog and an assignment of zero to if_timer.
Reviewed by: scottl
|
196661 |
30-Aug-2009 |
kmacy |
add core dump support to blkfront
Obtained from: Frank Suchomel
|
196499 |
24-Aug-2009 |
ed |
Cleanups to the Xen console driver:
- Use CONSOLE_DRIVER() instead of the deprecated CONS_DRIVER() declaration.
- This means we cannot use cn_checkc anymore, which is supposed to do the same as cn_getc nowadays. Remove the cn_getc implementation (that was never being called) and rename cn_checkc to cn_getc.
- Don't run-time patch cn_putc, but add the logic to xc_cnputc().
This means I could do some cleanups to our console code...
Tested by: nobody on hackers@
|
196403 |
20-Aug-2009 |
jhb |
Temporarily revert the new-bus locking for 8.0 release. It will be reintroduced after HEAD is reopened for commits by re@.
Approved by: re (kib), attilio
|
196327 |
17-Aug-2009 |
jhb |
- Remove self-referential mergeinfo from xen/netfront and xen/xenpci that claims those directories were merged into themselves. - Remove mergeinfo on xen/xenpci that claims the stable/7 xenpci was merged into head.
Approved by: re (mergeinfo blanket)
|
196037 |
02-Aug-2009 |
attilio |
Make the newbus subsystem Giant free by adding the new newbus sxlock. The newbus lock is responsible for protecting newbus internIal structures, device states and devclass flags. It is necessary to hold it when all such datas are accessed. For the other operations, softc locking should ensure enough protection to avoid races.
Newbus lock is automatically held when virtual operations on the device and bus are invoked when loading the driver or when the suspend/resume take place. For other 'spourious' operations trying to access/modify the newbus topology, newbus lock needs to be automatically acquired and dropped.
For the moment Giant is also acquired in some key point (modules subsystem) in order to avoid problems before the 8.0 release as module handlers could make assumptions about it. This Giant locking should go just after the release happens.
Please keep in mind that the public interface can be expanded in order to provide more support, if there are really necessities at some point and also some bugs could arise as long as the patch needs a bit of further testing.
Bump __FreeBSD_version in order to reflect the newbus lock introduction.
Reviewed by: ed, hps, jhb, imp, mav, scottl No answer by: ariff, thompsa, yongari Tested by: pho, G. Trematerra <giovanni dot trematerra at gmail dot com>, Brandon Gooch <jamesbrandongooch at gmail dot com> Sponsored by: Yahoo! Incorporated Approved by: re (ksmith)
|
194130 |
13-Jun-2009 |
kmacy |
update backend_changed to reflect .m prototype
|
193618 |
07-Jun-2009 |
adrian |
Fix compilation when compiled w/out WITNESS.
Submitted by: Edwin Shao <poleris@gmail.com>
|
193018 |
29-May-2009 |
ed |
Last minute TTY API change: remove mutex argument from tty_alloc().
I don't want people to override the mutex when allocating a TTY. It has to be there, to keep drivers like syscons happy. So I'm creating a tty_alloc_mutex() which can be used in those cases. tty_alloc_mutex() should eventually be removed.
The advantage of this approach, is that we can just remove a function, without breaking the regular API in the future.
|
192927 |
27-May-2009 |
adrian |
Delete useless #ifdef; make it more obvious if setting TSO fails.
|
192894 |
27-May-2009 |
adrian |
Clear IFF_DRV_OACTIVE if at least one TX xen/mbuf ring slot has been freed.
|
192876 |
27-May-2009 |
adrian |
Enforce that there are actually enough xenbus TX ring descriptors available before attempting to queue the packet.
|
192875 |
27-May-2009 |
adrian |
Comment tidyup; comment where the next explicit check should appear.
|
192871 |
27-May-2009 |
adrian |
Ensure that there are enough TX mbuf ring slots available before beginning to dequeue a packet.
The tx path was trying to ensure that enough Xenbus TX ring slots existed but it didn't check to see whether the mbuf TX ring slots were also available. They get freed in xn_txeof() which occurs after transmission, rather than earlier on in the process. (The same happens under Linux too.)
Due to whatever reason (CPU use, scheduling, memory constraints, whatever) the mbuf TX ring may not have enough slots free and would allocate slot 0. This is used as the freelist head pointer to represent "free" mbuf TX ring slots; setting this to an actual mbuf value rather than an id crashes the code.
This commit introduces some basic code to track the TX mbuf ring use and then (hopefully!) ensures that enough slots are free in said TX mbuf ring before it enters the actual work loop.
A few notes:
* Similar logic needs to be introduced to check there are enough actual slots available in the xenbuf TX ring. There's some logic which is invoked earlier but it doesn't hard-check against the number of available ring slots. Its trivial to do; I'll do it in a subsequent commit.
* As I've now commented in the source, it is likely possible to deadlock the driver under certain conditions where the rings aren't receiving any changes (which I should enumerate) and thus Xen doesn't send any further software interrupts. I need to make sure that the timer(s) are running right and the queues are periodically kicked.
PR: 134926
|
192870 |
27-May-2009 |
adrian |
Do the invariant check before the mbuf is dereferenced.
|
192869 |
27-May-2009 |
adrian |
Flesh out some inline documentation which hopefully reflect the intended reality of these functions.
|
192868 |
27-May-2009 |
adrian |
Add in some INVARIANT checks in the TX mbuf descriptor "freelist" management code.
Slot 0 must always remain "free" and be a pointer to the first free entry in the mbuf descriptor list. It is thus an error to have code allocate or push slot 0 back into the list.
|
192286 |
18-May-2009 |
adrian |
The merge in r189699 reverted part of the work done in a previous commit (r188036.)
Re-revert that change so the Xen networking functions again.
|
192285 |
18-May-2009 |
adrian |
Disable some un-needed console debugging.
|
192004 |
11-May-2009 |
kmacy |
don't acquire tty lock with console lock held
|
192003 |
11-May-2009 |
kmacy |
xen console lock needs to be a spin lock in case it is acquired from an interrupt context
|
190633 |
01-Apr-2009 |
piso |
Implement an ipfw action to reassemble ip packets: reass.
|
190627 |
01-Apr-2009 |
dfr |
Fix the Xen build for i386 PV mode.
|
190581 |
30-Mar-2009 |
mav |
Integrate user/mav/ata branch:
Add ch_suspend/ch_resume methods for PCI controllers and implement them for AHCI. Refactor AHCI channel initialization according to it.
Fix Port Multipliers operation. It is far from perfect yet, but works now. Tested with JMicron JMB363 AHCI + SiI 3726 PMP pair. Previous version was also tested with SiI 4726 PMP.
Hardware sponsored by: Vitsch Electronics / VEHosting.nl
|
189699 |
11-Mar-2009 |
dfr |
Merge in support for Xen HVM on amd64 architecture.
|
188198 |
05-Feb-2009 |
kmacy |
fix non-witness compile
|
188066 |
03-Feb-2009 |
rrs |
Adds support for SCTP checksum offload. This means we, like TCP and UDP, move the checksum calculation into the IP routines when there is no hardware support we call into the normal SCTP checksum routine.
The next round of SCTP updates will use this functionality. Of course the IGB driver needs a few updates to support the new intel controller set that actually does SCTP csum offload too.
Reviewed by: gnn, rwatson, kmacy
|
188036 |
02-Feb-2009 |
kmacy |
break out of loop if we run out of mbufs
|
187830 |
28-Jan-2009 |
ed |
Last step of splitting up minor and unit numbers: remove minor().
Inside the kernel, the minor() function was responsible for obtaining the device minor number of a character device. Because we made device numbers dynamically allocated and independent of the unit number passed to make_dev() a long time ago, it was actually a misnomer. If you really want to obtain the device number, you should use dev2udev().
We already converted all the drivers to use dev2unit() to obtain the device unit number, which is still used by a lot of drivers. I've noticed not a single driver passes NULL to dev2unit(). Even if they would, its behaviour would make little sense. This is why I've removed the NULL check.
Ths commit removes minor(), minor2unit() and unit2minor() from the kernel. Because there was a naming collision with uminor(), we can rename umajor() and uminor() back to major() and minor(). This means that the makedev(3) manual page also applies to kernel space code now.
I suspect umajor() and uminor() isn't used that often in external code, but to make it easier for other parties to port their code, I've increased __FreeBSD_version to 800062.
|
186557 |
29-Dec-2008 |
kmacy |
merge 186535, 186537, and 186538 from releng_7_xen
Log: - merge in latest xenbus from dfr's xenhvm - fix race condition in xs_read_reply by converting tsleep to mtx_sleep
Log: unmask evtchn in bind_{virq, ipi}_to_irq
Log: - remove code for handling case of not being able to sleep - eliminate tsleep - make sleeps atomic
|
185605 |
04-Dec-2008 |
kmacy |
Integrate 185578 from dfr Use newbus to managed devices
|
185473 |
30-Nov-2008 |
dfr |
Don't call ether_ioctl() with locks held. Loop in xn_rxeof() until the backend stops adding stuff to the ring otherwise we miss RX interrupts which kills performance.
|
184329 |
27-Oct-2008 |
ed |
Remove unused consdev structure fields.
The cn_unit and cn_tp fields don't seem to be used anywhere. Some drivers set them, while others don't. Just remove them, in an attempt to make our consdev code a little easier to understand.
|
183397 |
27-Sep-2008 |
ed |
Replace all calls to minor() with dev2unit().
After I removed all the unit2minor()/minor2unit() calls from the kernel yesterday, I realised calling minor() everywhere is quite confusing. Character devices now only have the ability to store a unit number, not a minor number. Remove the confusion by using dev2unit() everywhere.
This commit could also be considered as a bug fix. A lot of drivers call minor(), while they should actually be calling dev2unit(). In -CURRENT this isn't a problem, but it turns out we never had any problem reports related to that issue in the past. I suspect not many people connect more than 256 pieces of the same hardware.
Reviewed by: kib
|
183375 |
26-Sep-2008 |
kmacy |
Update xen/interface includes to the latest in mercurial
MFC after: 1 month
|
183341 |
25-Sep-2008 |
kmacy |
reflect header change in netfront
MFC after: 1 month
|
182371 |
28-Aug-2008 |
attilio |
Decontextualize the couplet VOP_GETATTR / VOP_SETATTR as the passed thread was always curthread and totally unuseful.
Tested by: Giovanni Trematerra <giovanni dot trematerra at gmail dot com>
|
182091 |
24-Aug-2008 |
kmacy |
Evidently the block device starts at 767.
MFC after: 1 month
|
182082 |
23-Aug-2008 |
kmacy |
make block devices start at 0
|
181945 |
21-Aug-2008 |
kmacy |
For reasons that I have not delved in to Xen 3.2 netback now does header splitting so packets > 128 bytes are now split in to multiple buffer. This fixes netfront to handle multiple buffers per rx packet.
MFC after: 1 month
|
181916 |
20-Aug-2008 |
kmacy |
change netfront to match xen31_6 fix console locking
|
181914 |
20-Aug-2008 |
kmacy |
mark blkfront_info as ready
MFC after: 1 month
|
181910 |
20-Aug-2008 |
kmacy |
include vmparam.h for KERNBASE and fix typo
|
181909 |
20-Aug-2008 |
kmacy |
register netfront before xenbus does its probing
MFC after: 1 month
|
181908 |
20-Aug-2008 |
ed |
Integrate the Xen console driver.
I initially didn't want to integrate the Xen console driver, because it did not receive any testing. Kip Macy suggested that I'd better check it in right now, because this is the easiest way for him to test it while he is working on the Xen import.
Requested by: kmacy
|
181805 |
17-Aug-2008 |
kmacy |
Make sure that machine addresses are vm_paddr_t
MFC after: 1 month
|
181747 |
15-Aug-2008 |
kmacy |
Compile fixes for xen build.
MFC after: 1 month.
|
181643 |
12-Aug-2008 |
kmacy |
Import Xen paravirtual drivers.
MFC after: 2 weeks
|