MFC r209598:
Initializes the ratectl for a node when the state is changed to RUN.
This prevents a kernel fault by dividing with zero because the initial
rate was 0 and didn't be initialized.
MFC r209597:
Fixes NULL pointer reference that it's occurred when the state is
changed to RUN because ic->ic_newassoc isn't set anywhere now. In the
previous bwi_newassoc() is used to initialize AMRR rate routines.
Merge 209589 from head:
After processing the O_SKIPTO opcode our cmd points to the next rule, and
"match" processing at the end of inner loop would look ahead into the next
rule, which is incorrect. Particularly, in the case when the next rule
started with F_NOT opcode it was skipped blindly.
To fix this, exit the inner loop with the continue operator forcibly and
explicitly.
- Add a utility macro to simplify calculating an aggregate sum from a DPCPU
counter variable.
- Rename the internal for loop iterator to "_i" to avoid potential shadowing of
external variables named "i". The "_" prefix is reserved for infrastructure
type code and is therefore not expected to be used by normal code likely to
call DPCPU_SUM(). [1]
- Change DPCPU_SUM to return the sum rather than calculate and assign it
internally. Usage is now: "sum = DPCPU_SUM(dpcpu_var, member_to_sum);" [2]
- Fix some style nits. [3]
Sponsored by: FreeBSD Foundation
Suggested by: bde [3], mdf [1], kib [1,2], pjd [1,3]
Reviewed by: jhb, rpaulo, rwatson (old version of r209119), kib (r209325)
- Rework the underlying ALQ storage to be a circular buffer, which amongst other
things allows variable length messages to be easily supported.
- Extend KPI with alq_writen() and alq_getn() to support variable length
messages, which is enabled at ALQ creation time depending on the arguments
passed to alq_open(). Also add variants of alq_open() and alq_post() that
accept a flags argument. The KPI is still fully backwards compatible and
shouldn't require any change in ALQ consumers unless they wish to utilise
the new features.
- Introduce the ALQ_NOACTIVATE and ALQ_ORDERED flags to allow ALQ consumers
to have more control over IO scheduling and resource acquisition
respectively.
- Strengthen invariants checking.
- Document ALQ changes in ALQ(9) man page.
Sponsored by: FreeBSD Foundation
Reviewed by: gnn, jeff, rpaulo, rwatson
marius [Wed, 7 Jul 2010 19:52:50 +0000 (19:52 +0000)]
MFC: r209695
- Pin the IPI cache and TLB demap functions in order to prevent migration
between determining the other CPUs and calling cpu_ipi_selected(), which
apart from generally doing the wrong thing can lead to a panic when a
CPU is told to IPI itself (which sun4u doesn't support).
Reported and tested by: Nathaniel W Filardo
- Add __unused where appropriate.
Package set for 8.1-RELEASE. We still have a 2Gb maximum file size
limit caused by cvsup still being used for some of our mirror system.
That is being worked on.
Modify the console mouse pointer drawing routine to use single-byte writes
instead of 4-byte ones. Because the mouse pointer can start part way
through a character cell, 4-byte memory operations are not necessarily
aligned, triggering a fatal alignment exception when the console pointer
was moved on PowerPC G5 systems.
Move default HZ from 100 to 1000 on powerpc, and rearrange the logic
slightly, so that it is set to 100 on ARM and MIPS and defaults to 1000,
instead of defaulting to 100, and setting it to 1000 on everything but
ARM and MIPS.
- Missing full stops
- Upper case the first character of an description
- Section headings do not need to be quoted. From OpenBSD's make.1, revision 1.81
- Plural of suffix is suffixes. From OpenBSD's make.1, revision 1.61
- s/seperating/separating/
MFC r209169:
Fix TX retry rate handling. tx->linkq is an index to a rate table
beginning with the highest available rate. Currently we always use
54m for the first retry no matter what AMRR has choosen. Fix this
by setting the index to the next lower rate.
Implement an optional delay to the ddb reset/reboot command.
This allows textdumps to be run automatically with unattended reboots
after a resonable timeout, while still permitting an administrator to
break into debugger if attached to the console at the time of the
event for further debugging. Cap the maximum delay at 1 week to avoid
highly accidental results, and default to 15s in case of problems
parsing the timeout value.
Move hex2dec helper function from db_thread.c to db_command.c to make
it generally available and prefix it with a "db_" to avoid namespace
collisions.
Improve IPsec flow distribution for better netisr parallelism.
Instead of using the pointer that would have the last bits masked in a %
statement in netisr_select_cpuid() to select the queue, use the SPI.
MFC r209337: sh: Fix compilation with -DNO_HISTORY.
The LINENO code uses snprintf() and relied on "myhistedit.h" to pull in the
necessary <stdio.h>.
Compiling with -DNO_HISTORY disables all editing and history support and
allows linking without -ledit -ltermcap. This may be useful for embedded
systems.
MFC r209104:
Add modifications of devctl_notify(9) functions that take flags. Use
flags to specify M_WAITOK/M_NOWAIT. M_WAITOK allows devctl to sleep for
the memory allocation.
MFC r209294:
Add -fno-asynchronous-unwind-tables to disable unwind table generation
for crtbegin/crtend. While there, disable omitting the frame pointer.
MFC r209540
* Do not dereference a NULL pointer when calling an SCTP send syscall
not providing a destination address and using ktrace.
* Do not copy out kernel memory when providing sinfo for sctp_recvmsg().
Both bug where reported by Valentin Nechayev.
The first bug results in a kernel panic.
tuexen [Mon, 28 Jun 2010 10:50:14 +0000 (10:50 +0000)]
MFC r209470,r209499
* Implement sctp_does_stcb_own_this_addr() correclty. It was taking the
wrong side into account.
* sctp_findassociation_ep_addr() must check the local address if available.
This fixes a bug where ABORT chunks were accepted even in the case where
the local was not owned by the endpoint.
Thanks to brucec for pointing out a bug in my first version of the fix.
kib [Mon, 28 Jun 2010 01:16:34 +0000 (01:16 +0000)]
MFC r209120:
In NFS clients, instead of inconsistently using #ifdef
DIAGNOSTIC and #ifndef DIAGNOSTIC for debug assertions, prefer
KASSERT(). Also change one #ifdef DIAGNOSTIC in the new nfs server.
delphij [Sun, 27 Jun 2010 03:06:20 +0000 (03:06 +0000)]
MFC 196750,196751,196818,196819 (ache@):
196750:
1) Use isprint() instead of hardcoded values to detect non-printable.
2) Use (unsigned char) cast in waddch() calls.
It fix highlighting bug: sign extension of 8bit to the attributes area.
3) Use setlocale() in any case.
196751:
Move <locale.h> out of NO_CATGETS define too (as setlocale() in prev.
commit)
196818:
1) Remove single occurance of HAS_CTYPE ifdef, ctype functions
used here for a long time and needs their header in anycase.
2) Add (unsigned char) casts to more ctype macros.
3) Simplify menu input handling using ctype instead of range unguarded
hardcoded tricks.
196819:
Remove single occurance of HAS_CTYPE ifdef, ctype functions
used here for a long time and needs their header in anycase.
Requested by: Patrick Lamaiziere <patfbsd davenulle org>
Ok'ed by: ache
jhb [Thu, 24 Jun 2010 13:17:45 +0000 (13:17 +0000)]
MFC 208915,208991:
- Use a bit more care when moving I/O APIC interrupts between CPUs. Mask
the interrupt followed by a brief delay if it is not currently masked
before moving the interrupt.
- Move the icu_lock out of ioapic_program_intpin() and into callers. This
closes a race where ioapic_program_intpin() could use a stale value of
the masked state to compute the masked bit in the register.
jhb [Thu, 24 Jun 2010 13:11:12 +0000 (13:11 +0000)]
MFC 208392:
- Adjust the whitespace for the lines that output fields in 'show pcpu' in
DDB so that all the fields line up.
- Print out the tid of the per-CPU idlethread instead of the pid since
the idle process is now shared across all idle threads.
jhb [Thu, 24 Jun 2010 12:08:50 +0000 (12:08 +0000)]
MFC 208391:
Assert that the thread passed to sched_bind() and sched_unbind() is
curthread as those routines are only supported for curthread currently.
ae [Thu, 24 Jun 2010 05:52:44 +0000 (05:52 +0000)]
MFC r207094 (by marcel):
Implement the resize verb and add support for resizing partitions
for all schemes but EBR.
MFC r207095 (by marcel):
Implement the resize command for resizing partitions. Without new
size, the partition in question is resized to fill all available
space.
mount(8): add xref to devfs(5)
devfs(5): change example to something more likely to be useful (it is not
necessary to mount a devfs on /dev manually, but for chroots/jails it is
often needed), mention since when devfs is preferred to device nodes on ufs
and when device nodes on ufs stopped working
jhb [Wed, 23 Jun 2010 18:46:10 +0000 (18:46 +0000)]
MFC 198988:
Take a step towards removing if_watchdog/if_timer. Don't explicitly set
if_watchdog/if_timer to NULL/0 when initializing an ifnet. if_alloc()
sets those members to NULL/0 already.
jhb [Wed, 23 Jun 2010 17:56:20 +0000 (17:56 +0000)]
MFC 208388:
- Set 'dmadat' earlier so that we properly setup the heap if we fail to
locate a high memory area for the heap using the SMAP.
- Read the number of hard drive devices from the BIOS instead of hardcoding
a limit of 128. Some BIOSes duplicate disk devices once you get beyond
the maximum drive number.
jhb [Wed, 23 Jun 2010 17:04:42 +0000 (17:04 +0000)]
MFC 209213:
When updating individual CPU's lowest Cx state to use, never set it to a
state lower than the lowest one supported by the current CPU. This closes
some races with changes to the hw.acpi.cpu_cx_lowest sysctl while Cx
states for individual CPUs were changing (e.g. unplugging the AC adapter
of a laptop) that could result in panics.
nwhitehorn [Wed, 23 Jun 2010 13:13:14 +0000 (13:13 +0000)]
MFC r209369:
Temporarily disable instruction relocation while setting up the kernel's
IBAT entry in early boot in order to prevent possible faults from races
between the instruction cache and the MMU.
kib [Wed, 23 Jun 2010 10:06:57 +0000 (10:06 +0000)]
MFC r208920:
Reorganize the code in bdwrite() which handles move of dirtiness from
the buffer pages to buffer. Drain the VPO_BUSY bit of the buffer pages
before setting valid and clean bits.
Stable/8 version of vfs_page_set_validclean() requires page queue lock.
ae [Tue, 22 Jun 2010 07:38:30 +0000 (07:38 +0000)]
MFC r207178:
Fix undo for schemes that have internal partitions. Internal partitions
do not constitute user-visible or active partitions and as such should
not prevent undoing pending operations.
While here, initialize the last usable sector for the placeholder geom
based on the null scheme, created to allow undoing the destruction of
a scheme. This gives consistent output with "gpart show".
mjacob [Tue, 22 Jun 2010 04:40:50 +0000 (04:40 +0000)]
This is an MFC of 209188
For the target port groups structures, don't allocate the initial element.
This makes things easier for target implementations to calculate how many
elements they need to allocate.
rmacklem [Tue, 22 Jun 2010 01:30:46 +0000 (01:30 +0000)]
MFC: r209191
Add MODULE_DEPEND() macros to the experimental NFS client and
server so that the modules will load when kernels are built with
none of the NFS* configuration options specified. I believe this
resolves the problems reported by PR kern/144458 and the email on
freebsd-stable@ posted by Dmitry Pryanishnikov on June 13.
delphij [Mon, 21 Jun 2010 22:00:57 +0000 (22:00 +0000)]
MFC r208969,209268:
Driver update of twa(4) from LSI. Many thanks to LSI for continuing to
support FreeBSD.
1) Timeout ioctl command timeouts.
Do not reset the controller if ioctl command completed
successfully.
2) Remove G66_WORKAROUND code (this bug never shipped).
3) Remove unnecessary interrupt lock (intr_lock).
4) Timeout firmware handshake for PChip reset (don't wait forever).
5) Handle interrupts inline.
6) Unmask command interrupt ONLY when adding a command to the pending
queue.
7) Mask command interrupt ONLY after removing the last command from
the pending queue.
8) Remove TW_OSLI_DEFERRED_INTR_USED code.
9) Replace controller "state" with separate data fields to avoid races:
10) Fix "req" leak in twa_action() when simq is frozen and req is NOT
null.
11) Replace softc "state" with separate data fields to avoid races:
TW_OSLI_CTLR_STATE_OPEN sc->open
TW_OSLI_CTLR_STATE_SIMQ_FROZEN sc->simq_frozen
12) Fix reference to TW_OSLI_REQ_FLAGS_IN_PROGRESS in
tw_osl_complete_passthru()
13) Use correct CAM status values.
Change CAM_REQ_CMP_ERR to CAM_REQ_INVALID.
Remove use of CAM_RELEASE_SIMQ for physical data addresses.
14) Do not freeze/ release the simq with non I/O commands.
When it is appropriate to temporarily freeze the simq with an I/O
command use:
xpt_freeze_simq(sim, 1);
ccb->ccb_h.status |= CAM_RELEASE_SIMQ;
otherwise use:
xpt_freeze_simq(sim, 1);
xpt_release_simq(sim, 1);
Submitted by: Tom Couch <tom.couch lsi.com>
PR: kern/147695
kaiw [Mon, 21 Jun 2010 13:47:29 +0000 (13:47 +0000)]
MFC r209122:
* Improve compatibility with existing application code by permitting the
use of `elf_getbase()` on non-archive members. This change is needed
for gcc LTO (-flto) to work properly.
* Style fix: paranthesize returned values.
* Document the current behaviour of `elf_getbase()`.
mjacob [Mon, 21 Jun 2010 04:37:39 +0000 (04:37 +0000)]
This is an MFC of 208895.
Fix XPT_GET_TRAN_SETTING for FC which has been broken for while so that
it will figure out the correct target to handle index and be able to find
things like WWPN, etc.
mav [Sun, 20 Jun 2010 10:23:46 +0000 (10:23 +0000)]
MFC r209155:
Fix bug introduced in SVN rev 194985. When calling pic_assign_cpu()
for pre-bound IRQs during boot, submit there LAPIC ID, same as in other
places, not CPU ID.
marcel [Sat, 19 Jun 2010 04:57:58 +0000 (04:57 +0000)]
MFC revs 209026 and 209085:
o Bump MAX_BPAGES from 256 to 1024.
o Synchronize the kernel entry on all CPUs with the use of the ptc.g
instruction on a single CPU by implementing a bare-bones readers-
writer lock.
mjacob [Sat, 19 Jun 2010 00:37:14 +0000 (00:37 +0000)]
This is an MFC of 208808
I was getting panics in sleepq_add for the second sleep in isp_kthread.
I don't know why- but it occurred to me in looking at the second sleep
is that all I want is a pause- not an actual sleep. So do that instead.
kan [Fri, 18 Jun 2010 16:14:37 +0000 (16:14 +0000)]
MFC r207578:
Do not encode more than CTF_MAX_VLEN(1023) enum members.
CTF can not represent enums with more than CTF_MAX_VLEN members, but
ctfconvert will happily ignore that limitation and create CTF section no
other tool can interpret.
This change is different from similar change from upstream, which just
returns an error if big enum is encountered. Doing that means that
every FreeBSD kernel with compiled in hwpmc will have no useable CTF
information due to pmc_event enum having 1236+ members.