Remerge as previous one was broken

This commit is contained in:
bapt 2015-10-03 07:22:07 +00:00
commit 97d3cc0901
126 changed files with 642 additions and 311 deletions

View File

@ -61,9 +61,6 @@ SUBDIR= ${SUBDIR_OVERRIDE}
.else
SUBDIR= lib libexec
SUBDIR+=bin
.if ${MK_GAMES} != "no"
SUBDIR+=games
.endif
.if ${MK_CDDL} != "no"
SUBDIR+=cddl
.endif
@ -1409,7 +1406,7 @@ legacy:
_bt= _bootstrap-tools
.if ${MK_GAMES} != "no"
_strfile= games/fortune/strfile
_strfile= usr.bin/fortune/strfile
.endif
.if ${MK_GCC} != "no" && ${MK_CXX} != "no"

View File

@ -53,6 +53,8 @@ run(int n, ...)
va_start(va, n);
#if defined(__FreeBSD__) && defined(__amd64__)
for (i = 0; i < 5; i++) {
#elif defined(__FreeBSD__) && defined(__aarch64__)
for (i = 0; i < 7; i++) {
#else
for (i = 0; i < 9; i++) {
#endif
@ -116,6 +118,10 @@ ATF_TC_BODY(setcontext_link, tc)
/* FreeBSD/amd64 only permits up to 6 arguments. */
makecontext(&uc[i], (void *)run, 6, i,
0, 1, 2, 3, 4);
#elif defined(__FreeBSD__) && defined(__aarch64__)
/* FreeBSD/arm64 only permits up to 8 arguments. */
makecontext(&uc[i], (void *)run, 8, i,
0, 1, 2, 3, 4, 5, 6);
#else
makecontext(&uc[i], (void *)run, 10, i,
0, 1, 2, 3, 4, 5, 6, 7, 8);

View File

@ -29,7 +29,7 @@
# when going to single-user mode.
console none unknown off secure
#
ttyv0 "/usr/libexec/getty Pc" xterm off secure
ttyv0 "/usr/libexec/getty Pc" xterm onifconsole secure
# Virtual terminals
ttyv1 "/usr/libexec/getty Pc" xterm off secure
ttyv2 "/usr/libexec/getty Pc" xterm off secure
@ -41,9 +41,9 @@ ttyv7 "/usr/libexec/getty Pc" xterm off secure
#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure
# Serial terminals
# The 'dialup' keyword identifies dialin lines to login, fingerd etc.
ttyu0 "/usr/libexec/getty std.9600" vt100 on secure
ttyu1 "/usr/libexec/getty std.9600" dialup off secure
ttyu2 "/usr/libexec/getty std.9600" dialup off secure
ttyu3 "/usr/libexec/getty std.9600" dialup off secure
ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure
ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure
ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure
ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure
# Dumb console
dcons "/usr/libexec/getty std.9600" vt100 off secure

View File

@ -1,21 +0,0 @@
# $FreeBSD$
.include <src.opts.mk>
SUBDIR= \
caesar \
factor \
fortune \
grdc \
morse \
number \
pom \
primes \
random \
${_tests}
.if ${MK_TESTS} != "no"
_tests= tests
.endif
.include <bsd.subdir.mk>

View File

@ -1,6 +0,0 @@
# @(#)Makefile.inc 8.1 (Berkeley) 5/31/93
# $FreeBSD$
BINDIR?= /usr/bin
FILESDIR?= ${SHAREDIR}/games
WARNS?= 6

View File

@ -1,10 +0,0 @@
# $FreeBSD$
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/games
.PATH: ${.CURDIR:H:H}/tests
KYUAFILE= yes
.include <bsd.test.mk>

View File

@ -22,10 +22,8 @@ arm_install_uboot() {
UBOOT_FILES="u-boot.img"
FATMOUNT="${DESTDIR%${KERNEL}}/fat"
UFSMOUNT="${DESTDIR%${KERNEL}}/ufs"
chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/sunxi-spl.bin \
of=/dev/${mddev} bs=1k seek=8
chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \
of=/dev/${mddev} bs=1k seek=40 conv=notrunc,sync
chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/u-boot-sunxi-with-spl.bin \
of=/dev/${mddev} bs=1k seek=8 conv=sync
chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}"
chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT}
chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT}

View File

@ -21,10 +21,8 @@ arm_install_uboot() {
UBOOT_FILES="u-boot.img"
FATMOUNT="${DESTDIR%${KERNEL}}/fat"
UFSMOUNT="${DESTDIR%${KERNEL}}/ufs"
chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/sunxi-spl.bin \
of=/dev/${mddev} bs=1k seek=8
chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \
of=/dev/${mddev} bs=1k seek=40 conv=notrunc,sync
chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/u-boot-sunxi-with-spl.bin \
of=/dev/${mddev} bs=1k seek=8 conv=sync
chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}"
chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT}
chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT}

View File

@ -22,10 +22,8 @@ arm_install_uboot() {
UBOOT_FILES="u-boot.img"
FATMOUNT="${DESTDIR%${KERNEL}}/fat"
UFSMOUNT="${DESTDIR%${KERNEL}}/ufs"
chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/sunxi-spl.bin \
of=/dev/${mddev} bs=1k seek=8
chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \
of=/dev/${mddev} bs=1k seek=40 conv=notrunc,sync
chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/u-boot-sunxi-with-spl.bin \
of=/dev/${mddev} bs=1k seek=8 conv=sync
chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}"
chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT}
chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT}

View File

@ -1487,6 +1487,15 @@ static state_func_t
death(void)
{
session_t *sp;
int block, blocked;
size_t len;
/* Temporarily block suspend. */
len = sizeof(blocked);
block = 1;
if (sysctlbyname("kern.suspend_blocked", &blocked, &len,
&block, sizeof(block)) == -1)
blocked = 0;
/*
* Also revoke the TTY here. Because runshutdown() may reopen
@ -1503,6 +1512,11 @@ death(void)
/* Try to run the rc.shutdown script within a period of time */
runshutdown();
/* Unblock suspend if we blocked it. */
if (!blocked)
sysctlbyname("kern.suspend_blocked", NULL, NULL,
&blocked, sizeof(blocked));
return (state_func_t) death_single;
}

View File

@ -32,15 +32,19 @@ CLEANFILES+= ipnat.tab.c ipnat.tab.h
CLEANFILES+= ippool_y.c ippool_l.c
CLEANFILES+= ippool.tab.c ippool.tab.h
ipnat_y.c: ipnat_y.y
ipnat.tab.c ipnat.tab.h: ipnat_y.y
${YACC} -b ipnat -d ${.ALLSRC}
ipnat_y.c: ipnat.tab.c
sed -e 's/yy/ipnat_yy/g' \
-e 's/y.tab.c/ipnat_y.c/' \
-e s/\"ipnat_y.y\"/\"..\\/tools\\/ipnat_y.y\"/ \
ipnat.tab.c > ${.TARGET}
ipnat_y.h: ipnat.tab.h
sed -e 's/yy/ipnat_yy/g' \
-e 's/y.tab.h/ipnat_y.h/' \
ipnat.tab.h > ${.TARGET:.c=.h}
ipnat.tab.h > ${.TARGET}
ipnat_y.h: ipnat_y.c
@ -54,13 +58,17 @@ ipnat_l.h: lexer.h
sed -e 's/yy/ipnat_yy/g' \
${.ALLSRC} > ${.TARGET}
ippool_y.c: ippool_y.y
ippool.tab.c ippool.tab.h: ippool_y.y
${YACC} -b ippool -d ${.ALLSRC}
ippool_y.c: ippool.tab.c
sed -e 's/yy/ippool_yy/g' \
-e 's/"ippool_y.y"/"..\/tools\/ippool_y.y"/' \
ippool.tab.c > ${.TARGET}
ippool_y.h: ippool.tab.h
sed -e 's/yy/ippool_yy/g' \
ippool.tab.h > ${.TARGET:.c=.h}
ippool.tab.h > ${.TARGET}
ippool_y.h: ippool_y.c
@ -74,13 +82,17 @@ ippool_l.h: lexer.h
sed -e 's/yy/ippool_yy/g' \
${.ALLSRC} > ${.TARGET}
ipf_y.c: ipf_y.y
ipf.tab.c ipf.tab.h: ipf_y.y
${YACC} -b ipf -d ${.ALLSRC}
ipf_y.c: ipf.tab.c
sed -e 's/yy/ipf_yy/g' \
-e 's/"ipf_y.y"/"..\/tools\/ipf_y.y"/' \
ipf.tab.c > ${.TARGET}
ipf_y.h: ipf.tab.h
sed -e 's/yy/ipf_yy/g' \
ipf.tab.h > ${.TARGET:.c=.h}
ipf.tab.h > ${.TARGET}
ipf_y.h: ipf_y.c

View File

@ -237,10 +237,11 @@ stage_as.$s: .dirdep
CLEANFILES += ${STAGE_TARGETS} stage_incs stage_includes
# stage_*links usually needs to follow any others.
.for t in ${STAGE_TARGETS:N*links:O:u}
.ORDER: $t stage_links
.ORDER: $t stage_symlinks
.if !empty(STAGE_SETS) && !empty(STAGE_TARGETS:Nstage_links)
.for s in ${STAGE_SETS:O:u}
stage_links.$s: ${STAGE_TARGETS:Nstage_links:O:u}
.endfor
.endif
# make sure this exists
staging:

View File

@ -1069,7 +1069,7 @@ init_proc0(vm_offset_t kstack)
(thread0.td_kstack + kstack_pages * PAGE_SIZE) - 1;
thread0.td_pcb->pcb_flags = 0;
thread0.td_pcb->pcb_vfpcpu = -1;
thread0.td_pcb->pcb_vfpstate.fpscr = VFPSCR_DN | VFPSCR_FZ;
thread0.td_pcb->pcb_vfpstate.fpscr = VFPSCR_DN;
thread0.td_frame = &proc0_tf;
pcpup->pc_curpcb = thread0.td_pcb;
}

View File

@ -134,7 +134,7 @@ cpu_fork(register struct thread *td1, register struct proc *p2,
pcb2->pcb_regs.sf_sp = STACKALIGN(td2->td_frame);
pcb2->pcb_vfpcpu = -1;
pcb2->pcb_vfpstate.fpscr = VFPSCR_DN | VFPSCR_FZ;
pcb2->pcb_vfpstate.fpscr = VFPSCR_DN;
tf = td2->td_frame;
tf->tf_spsr &= ~PSR_C;

View File

@ -182,6 +182,8 @@ pic_ipi_read(int i)
if (val == 0)
return (0);
ipi = ffs(val) - 1;
BSWR4(MBOX0CLR_CORE(cpu), 1 << ipi);
dsb();
return (ipi);
}
return (0x3ff);
@ -190,12 +192,6 @@ pic_ipi_read(int i)
void
pic_ipi_clear(int ipi)
{
int cpu;
cpu = PCPU_GET(cpuid);
dsb();
BSWR4(MBOX0CLR_CORE(cpu), 1 << ipi);
wmb();
}
void

View File

@ -439,4 +439,37 @@ atomic_subtract_long(volatile u_long *p, u_long v)
atomic_subtract_32((volatile uint32_t *)p, v);
}
/*
* ARMv5 does not support SMP. For both kernel and user modes, only a
* compiler barrier is needed for fences, since CPU is always
* self-consistent.
*/
static __inline void
atomic_thread_fence_acq(void)
{
__compiler_membar();
}
static __inline void
atomic_thread_fence_rel(void)
{
__compiler_membar();
}
static __inline void
atomic_thread_fence_acq_rel(void)
{
__compiler_membar();
}
static __inline void
atomic_thread_fence_seq_cst(void)
{
__compiler_membar();
}
#endif /* _MACHINE_ATOMIC_H_ */

View File

@ -596,4 +596,32 @@ atomic_store_rel_long(volatile u_long *p, u_long v)
#undef ATOMIC_ACQ_REL
#undef ATOMIC_ACQ_REL_LONG
static __inline void
atomic_thread_fence_acq(void)
{
dmb();
}
static __inline void
atomic_thread_fence_rel(void)
{
dmb();
}
static __inline void
atomic_thread_fence_acq_rel(void)
{
dmb();
}
static __inline void
atomic_thread_fence_seq_cst(void)
{
dmb();
}
#endif /* _MACHINE_ATOMIC_V6_H_ */

View File

@ -82,34 +82,6 @@ atomic_store_long(volatile u_long *dst, u_long src)
*dst = src;
}
static __inline void
atomic_thread_fence_acq(void)
{
dmb();
}
static __inline void
atomic_thread_fence_rel(void)
{
dmb();
}
static __inline void
atomic_thread_fence_acq_rel(void)
{
dmb();
}
static __inline void
atomic_thread_fence_seq_cst(void)
{
dmb();
}
#define atomic_clear_ptr atomic_clear_32
#define atomic_set_ptr atomic_set_32
#define atomic_cmpset_ptr atomic_cmpset_32

View File

@ -378,10 +378,14 @@ int
pic_ipi_read(int i __unused)
{
uint32_t val;
int ipi;
val = MPIC_CPU_READ(mv_mpic_sc, MPIC_IN_DRBL);
if (val)
return (ffs(val) - 1);
if (val) {
ipi = ffs(val) - 1;
MPIC_CPU_WRITE(mv_mpic_sc, MPIC_IN_DRBL, ~(1 << ipi));
return (ipi);
}
return (0x3ff);
}
@ -389,10 +393,6 @@ pic_ipi_read(int i __unused)
void
pic_ipi_clear(int ipi)
{
uint32_t val;
val = ~(1 << ipi);
MPIC_CPU_WRITE(mv_mpic_sc, MPIC_IN_DRBL, val);
}
#endif

View File

@ -131,45 +131,51 @@ __FBSDID("$FreeBSD$");
2:
.endm
handle_el1h_sync:
ENTRY(handle_el1h_sync)
save_registers 1
mov x0, sp
bl do_el1h_sync
restore_registers 1
eret
END(handle_el1h_sync)
handle_el1h_irq:
ENTRY(handle_el1h_irq)
save_registers 1
mov x0, sp
bl arm_cpu_intr
restore_registers 1
eret
END(handle_el1h_irq)
handle_el1h_error:
ENTRY(handle_el1h_error)
brk 0xf13
END(handle_el1h_error)
handle_el0_sync:
ENTRY(handle_el0_sync)
save_registers 0
mov x0, sp
bl do_el0_sync
do_ast
restore_registers 0
eret
END(handle_el0_sync)
handle_el0_irq:
ENTRY(handle_el0_irq)
save_registers 0
mov x0, sp
bl arm_cpu_intr
do_ast
restore_registers 0
eret
END(handle_el0_irq)
handle_el0_error:
ENTRY(handle_el0_error)
save_registers 0
mov x0, sp
bl do_el0_error
brk 0xf23
1: b 1b
END(handle_el0_error)
.macro vempty
.align 7

View File

@ -243,6 +243,16 @@ static void _pmap_unwire_l3(pmap_t pmap, vm_offset_t va, vm_page_t m,
struct spglist *free);
static int pmap_unuse_l3(pmap_t, vm_offset_t, pd_entry_t, struct spglist *);
/*
* These load the old table data and store the new value.
* They need to be atomic as the System MMU may write to the table at
* the same time as the CPU.
*/
#define pmap_load_store(table, entry) atomic_swap_64(table, entry)
#define pmap_set(table, mask) atomic_set_64(table, mask)
#define pmap_load_clear(table) atomic_swap_64(table, 0)
#define pmap_load(table) (*table)
/********************/
/* Inline functions */
/********************/
@ -277,7 +287,7 @@ pmap_l1_to_l2(pd_entry_t *l1, vm_offset_t va)
{
pd_entry_t *l2;
l2 = (pd_entry_t *)PHYS_TO_DMAP(*l1 & ~ATTR_MASK);
l2 = (pd_entry_t *)PHYS_TO_DMAP(pmap_load(l1) & ~ATTR_MASK);
return (&l2[pmap_l2_index(va)]);
}
@ -287,7 +297,7 @@ pmap_l2(pmap_t pmap, vm_offset_t va)
pd_entry_t *l1;
l1 = pmap_l1(pmap, va);
if ((*l1 & ATTR_DESCR_MASK) != L1_TABLE)
if ((pmap_load(l1) & ATTR_DESCR_MASK) != L1_TABLE)
return (NULL);
return (pmap_l1_to_l2(l1, va));
@ -298,7 +308,7 @@ pmap_l2_to_l3(pd_entry_t *l2, vm_offset_t va)
{
pt_entry_t *l3;
l3 = (pd_entry_t *)PHYS_TO_DMAP(*l2 & ~ATTR_MASK);
l3 = (pd_entry_t *)PHYS_TO_DMAP(pmap_load(l2) & ~ATTR_MASK);
return (&l3[pmap_l3_index(va)]);
}
@ -308,7 +318,7 @@ pmap_l3(pmap_t pmap, vm_offset_t va)
pd_entry_t *l2;
l2 = pmap_l2(pmap, va);
if (l2 == NULL || (*l2 & ATTR_DESCR_MASK) != L2_TABLE)
if (l2 == NULL || (pmap_load(l2) & ATTR_DESCR_MASK) != L2_TABLE)
return (NULL);
return (pmap_l2_to_l3(l2, va));
@ -326,19 +336,19 @@ pmap_get_tables(pmap_t pmap, vm_offset_t va, pd_entry_t **l1, pd_entry_t **l2,
l1p = pmap_l1(pmap, va);
*l1 = l1p;
if ((*l1p & ATTR_DESCR_MASK) == L1_BLOCK) {
if ((pmap_load(l1p) & ATTR_DESCR_MASK) == L1_BLOCK) {
*l2 = NULL;
*l3 = NULL;
return (true);
}
if ((*l1p & ATTR_DESCR_MASK) != L1_TABLE)
if ((pmap_load(l1p) & ATTR_DESCR_MASK) != L1_TABLE)
return (false);
l2p = pmap_l1_to_l2(l1p, va);
*l2 = l2p;
if ((*l2p & ATTR_DESCR_MASK) == L2_BLOCK) {
if ((pmap_load(l2p) & ATTR_DESCR_MASK) == L2_BLOCK) {
*l3 = NULL;
return (true);
}
@ -348,16 +358,6 @@ pmap_get_tables(pmap_t pmap, vm_offset_t va, pd_entry_t **l1, pd_entry_t **l2,
return (true);
}
/*
* These load the old table data and store the new value.
* They need to be atomic as the System MMU may write to the table at
* the same time as the CPU.
*/
#define pmap_load_store(table, entry) atomic_swap_64(table, entry)
#define pmap_set(table, mask) atomic_set_64(table, mask)
#define pmap_load_clear(table) atomic_swap_64(table, 0)
#define pmap_load(table) (*table)
static __inline int
pmap_is_current(pmap_t pmap)
{
@ -799,11 +799,11 @@ pmap_extract(pmap_t pmap, vm_offset_t va)
*/
l2p = pmap_l2(pmap, va);
if (l2p != NULL) {
l2 = *l2p;
l2 = pmap_load(l2p);
if ((l2 & ATTR_DESCR_MASK) == L2_TABLE) {
l3p = pmap_l2_to_l3(l2p, va);
if (l3p != NULL) {
l3 = *l3p;
l3 = pmap_load(l3p);
if ((l3 & ATTR_DESCR_MASK) == L3_PAGE)
pa = (l3 & ~ATTR_MASK) |
@ -852,23 +852,25 @@ pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot)
vm_paddr_t
pmap_kextract(vm_offset_t va)
{
pd_entry_t *l2;
pd_entry_t *l2p, l2;
pt_entry_t *l3;
vm_paddr_t pa;
if (va >= DMAP_MIN_ADDRESS && va < DMAP_MAX_ADDRESS) {
pa = DMAP_TO_PHYS(va);
} else {
l2 = pmap_l2(kernel_pmap, va);
if (l2 == NULL)
l2p = pmap_l2(kernel_pmap, va);
if (l2p == NULL)
panic("pmap_kextract: No l2");
if ((*l2 & ATTR_DESCR_MASK) == L2_BLOCK)
return ((*l2 & ~ATTR_MASK) | (va & L2_OFFSET));
l2 = pmap_load(l2p);
if ((l2 & ATTR_DESCR_MASK) == L2_BLOCK)
return ((l2 & ~ATTR_MASK) |
(va & L2_OFFSET));
l3 = pmap_l2_to_l3(l2, va);
l3 = pmap_l2_to_l3(l2p, va);
if (l3 == NULL)
panic("pmap_kextract: No l3...");
pa = (*l3 & ~ATTR_MASK) | (va & PAGE_MASK);
pa = (pmap_load(l3) & ~ATTR_MASK) | (va & PAGE_MASK);
}
return (pa);
}
@ -1242,11 +1244,11 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp)
return (NULL);
}
} else {
pdpg = PHYS_TO_VM_PAGE(*l1 & ~ATTR_MASK);
pdpg = PHYS_TO_VM_PAGE(pmap_load(l1) & ~ATTR_MASK);
pdpg->wire_count++;
}
l2 = (pd_entry_t *)PHYS_TO_DMAP(*l1 & ~ATTR_MASK);
l2 = (pd_entry_t *)PHYS_TO_DMAP(pmap_load(l1) & ~ATTR_MASK);
l2 = &l2[ptepindex & Ln_ADDR_MASK];
pmap_load_store(l2, VM_PAGE_TO_PHYS(m) | L2_TABLE);
PTE_SYNC(l2);
@ -1738,7 +1740,7 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
if (l2 == NULL)
continue;
l3_paddr = *l2;
l3_paddr = pmap_load(l2);
/*
* Weed out invalid mappings.
@ -1805,7 +1807,7 @@ pmap_remove_all(vm_page_t m)
pv_entry_t pv;
pmap_t pmap;
pt_entry_t *l3, tl3;
pd_entry_t *l2;
pd_entry_t *l2, tl2;
struct spglist free;
KASSERT((m->oflags & VPO_UNMANAGED) == 0,
@ -1817,7 +1819,9 @@ pmap_remove_all(vm_page_t m)
PMAP_LOCK(pmap);
pmap_resident_count_dec(pmap, 1);
l2 = pmap_l2(pmap, pv->pv_va);
KASSERT((*l2 & ATTR_DESCR_MASK) == L2_TABLE,
KASSERT(l2 != NULL, ("pmap_remove_all: no l2 table found"));
tl2 = pmap_load(l2);
KASSERT((tl2 & ATTR_DESCR_MASK) == L2_TABLE,
("pmap_remove_all: found a table when expecting "
"a block in %p's pv list", m));
l3 = pmap_l2_to_l3(l2, pv->pv_va);
@ -1837,7 +1841,7 @@ pmap_remove_all(vm_page_t m)
*/
if (pmap_page_dirty(tl3))
vm_page_dirty(m);
pmap_unuse_l3(pmap, pv->pv_va, *l2, &free);
pmap_unuse_l3(pmap, pv->pv_va, tl2, &free);
TAILQ_REMOVE(&m->md.pv_list, pv, pv_next);
m->md.pv_gen++;
free_pv_entry(pmap, pv);
@ -1883,7 +1887,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot)
va_next = eva;
l2 = pmap_l1_to_l2(l1, sva);
if (l2 == NULL || (*l2 & ATTR_DESCR_MASK) != L2_TABLE)
if (l2 == NULL || (pmap_load(l2) & ATTR_DESCR_MASK) != L2_TABLE)
continue;
if (va_next > eva)
@ -2345,7 +2349,7 @@ pmap_unwire(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
continue;
if ((pmap_load(l3) & ATTR_SW_WIRED) == 0)
panic("pmap_unwire: l3 %#jx is missing "
"ATTR_SW_WIRED", (uintmax_t)*l3);
"ATTR_SW_WIRED", (uintmax_t)pmap_load(l3));
/*
* PG_W must be cleared atomically. Although the pmap
@ -2836,7 +2840,7 @@ pmap_remove_write(vm_page_t m)
}
l3 = pmap_l3(pmap, pv->pv_va);
retry:
oldl3 = *l3;
oldl3 = pmap_load(l3);
if ((oldl3 & ATTR_AP_RW_BIT) == ATTR_AP(ATTR_AP_RW)) {
if (!atomic_cmpset_long(l3, oldl3,
oldl3 | ATTR_AP(ATTR_AP_RO)))
@ -2879,7 +2883,7 @@ pmap_ts_referenced(vm_page_t m)
pv_entry_t pv, pvf;
pmap_t pmap;
struct rwlock *lock;
pd_entry_t *l2;
pd_entry_t *l2p, l2;
pt_entry_t *l3;
vm_paddr_t pa;
int cleared, md_gen, not_cleared;
@ -2912,12 +2916,14 @@ pmap_ts_referenced(vm_page_t m)
goto retry;
}
}
l2 = pmap_l2(pmap, pv->pv_va);
KASSERT((*l2 & ATTR_DESCR_MASK) == L2_TABLE,
l2p = pmap_l2(pmap, pv->pv_va);
KASSERT(l2p != NULL, ("pmap_ts_referenced: no l2 table found"));
l2 = pmap_load(l2p);
KASSERT((l2 & ATTR_DESCR_MASK) == L2_TABLE,
("pmap_ts_referenced: found an invalid l2 table"));
l3 = pmap_l2_to_l3(l2, pv->pv_va);
l3 = pmap_l2_to_l3(l2p, pv->pv_va);
if ((pmap_load(l3) & ATTR_AF) != 0) {
if (safe_to_clear_referenced(pmap, *l3)) {
if (safe_to_clear_referenced(pmap, pmap_load(l3))) {
/*
* TODO: We don't handle the access flag
* at all. We need to be able to set it in
@ -2931,8 +2937,8 @@ pmap_ts_referenced(vm_page_t m)
* them is wasted effort. We do the
* hard work for unwired pages only.
*/
pmap_remove_l3(pmap, l3, pv->pv_va,
*l2, &free, &lock);
pmap_remove_l3(pmap, l3, pv->pv_va, l2,
&free, &lock);
pmap_invalidate_page(pmap, pv->pv_va);
cleared++;
if (pvf == pv)

View File

@ -781,9 +781,9 @@ ctl_isc_announce_lun(struct ctl_lun *lun)
msg->hdr.nexus.targ_lun = lun->lun;
msg->hdr.nexus.targ_mapped_lun = lun->lun;
msg->lun.flags = lun->flags;
msg->lun.pr_generation = lun->PRGeneration;
msg->lun.pr_generation = lun->pr_generation;
msg->lun.pr_res_idx = lun->pr_res_idx;
msg->lun.pr_res_type = lun->res_type;
msg->lun.pr_res_type = lun->pr_res_type;
msg->lun.pr_key_count = lun->pr_key_count;
i = 0;
if (lun->lun_devid) {
@ -1085,9 +1085,9 @@ ctl_isc_lun_sync(struct ctl_softc *softc, union ctl_ha_msg *msg, int len)
/* If peer is primary and we are not -- use data */
if ((lun->flags & CTL_LUN_PRIMARY_SC) == 0 &&
(lun->flags & CTL_LUN_PEER_SC_PRIMARY)) {
lun->PRGeneration = msg->lun.pr_generation;
lun->pr_generation = msg->lun.pr_generation;
lun->pr_res_idx = msg->lun.pr_res_idx;
lun->res_type = msg->lun.pr_res_type;
lun->pr_res_type = msg->lun.pr_res_type;
lun->pr_key_count = msg->lun.pr_key_count;
for (k = 0; k < CTL_MAX_INITIATORS; k++)
ctl_clr_prkey(lun, k);
@ -5101,6 +5101,13 @@ ctl_scsi_reserve(struct ctl_scsiio *ctsio)
ctl_set_reservation_conflict(ctsio);
goto bailout;
}
/* SPC-3 exceptions to SPC-2 RESERVE and RELEASE behavior. */
if (lun->flags & CTL_LUN_PR_RESERVED) {
ctl_set_success(ctsio);
goto bailout;
}
lun->flags |= CTL_LUN_RESERVED;
lun->res_idx = residx;
ctl_set_success(ctsio);
@ -5130,7 +5137,7 @@ ctl_start_stop(struct ctl_scsiio *ctsio)
residx = ctl_get_initindex(&ctsio->io_hdr.nexus);
if (ctl_get_prkey(lun, residx) == 0 ||
(lun->pr_res_idx != residx && lun->res_type < 4)) {
(lun->pr_res_idx != residx && lun->pr_res_type < 4)) {
ctl_set_reservation_conflict(ctsio);
ctl_done((union ctl_io *)ctsio);
@ -7540,7 +7547,7 @@ ctl_persistent_reserve_in(struct ctl_scsiio *ctsio)
goto retry;
}
scsi_ulto4b(lun->PRGeneration, res_keys->header.generation);
scsi_ulto4b(lun->pr_generation, res_keys->header.generation);
scsi_ulto4b(sizeof(struct scsi_per_res_key) *
lun->pr_key_count, res_keys->header.length);
@ -7571,7 +7578,7 @@ ctl_persistent_reserve_in(struct ctl_scsiio *ctsio)
res = (struct scsi_per_res_in_rsrv *)ctsio->kern_data_ptr;
scsi_ulto4b(lun->PRGeneration, res->header.generation);
scsi_ulto4b(lun->pr_generation, res->header.generation);
if (lun->flags & CTL_LUN_PR_RESERVED)
{
@ -7614,7 +7621,7 @@ ctl_persistent_reserve_in(struct ctl_scsiio *ctsio)
scsi_u64to8b(ctl_get_prkey(lun, lun->pr_res_idx),
res->data.reservation);
}
res->data.scopetype = lun->res_type;
res->data.scopetype = lun->pr_res_type;
break;
}
case SPRI_RC: //report capabilities
@ -7624,7 +7631,8 @@ ctl_persistent_reserve_in(struct ctl_scsiio *ctsio)
res_cap = (struct scsi_per_res_cap *)ctsio->kern_data_ptr;
scsi_ulto2b(sizeof(*res_cap), res_cap->length);
res_cap->flags2 |= SPRI_TMV | SPRI_ALLOW_5;
res_cap->flags1 = SPRI_CRH;
res_cap->flags2 = SPRI_TMV | SPRI_ALLOW_5;
type_mask = SPRI_TM_WR_EX_AR |
SPRI_TM_EX_AC_RO |
SPRI_TM_WR_EX_RO |
@ -7659,7 +7667,7 @@ ctl_persistent_reserve_in(struct ctl_scsiio *ctsio)
goto retry;
}
scsi_ulto4b(lun->PRGeneration, res_status->header.generation);
scsi_ulto4b(lun->pr_generation, res_status->header.generation);
res_desc = &res_status->desc[0];
for (i = 0; i < CTL_MAX_INITIATORS; i++) {
@ -7671,7 +7679,7 @@ ctl_persistent_reserve_in(struct ctl_scsiio *ctsio)
(lun->pr_res_idx == i ||
lun->pr_res_idx == CTL_PR_ALL_REGISTRANTS)) {
res_desc->flags = SPRI_FULL_R_HOLDER;
res_desc->scopetype = lun->res_type;
res_desc->scopetype = lun->pr_res_type;
}
scsi_ulto2b(i / CTL_MAX_INIT_PER_PORT,
res_desc->rel_trgt_port_id);
@ -7760,11 +7768,11 @@ ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, uint64_t res_key,
ctl_est_ua(lun, i, CTL_UA_REG_PREEMPT);
}
lun->pr_key_count = 1;
lun->res_type = type;
if (lun->res_type != SPR_TYPE_WR_EX_AR
&& lun->res_type != SPR_TYPE_EX_AC_AR)
lun->pr_res_type = type;
if (lun->pr_res_type != SPR_TYPE_WR_EX_AR &&
lun->pr_res_type != SPR_TYPE_EX_AC_AR)
lun->pr_res_idx = residx;
lun->PRGeneration++;
lun->pr_generation++;
mtx_unlock(&lun->lun_lock);
/* send msg to other side */
@ -7834,7 +7842,7 @@ ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, uint64_t res_key,
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}
lun->PRGeneration++;
lun->pr_generation++;
mtx_unlock(&lun->lun_lock);
/* send msg to other side */
@ -7900,19 +7908,19 @@ ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, uint64_t res_key,
ctl_clr_prkey(lun, i);
lun->pr_key_count--;
ctl_est_ua(lun, i, CTL_UA_REG_PREEMPT);
} else if (type != lun->res_type
&& (lun->res_type == SPR_TYPE_WR_EX_RO
|| lun->res_type ==SPR_TYPE_EX_AC_RO)){
} else if (type != lun->pr_res_type &&
(lun->pr_res_type == SPR_TYPE_WR_EX_RO ||
lun->pr_res_type == SPR_TYPE_EX_AC_RO)) {
ctl_est_ua(lun, i, CTL_UA_RES_RELEASE);
}
}
lun->res_type = type;
if (lun->res_type != SPR_TYPE_WR_EX_AR
&& lun->res_type != SPR_TYPE_EX_AC_AR)
lun->pr_res_type = type;
if (lun->pr_res_type != SPR_TYPE_WR_EX_AR &&
lun->pr_res_type != SPR_TYPE_EX_AC_AR)
lun->pr_res_idx = residx;
else
lun->pr_res_idx = CTL_PR_ALL_REGISTRANTS;
lun->PRGeneration++;
lun->pr_generation++;
mtx_unlock(&lun->lun_lock);
persis_io.hdr.nexus = ctsio->io_hdr.nexus;
@ -7949,7 +7957,7 @@ ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, uint64_t res_key,
ctl_done((union ctl_io *)ctsio);
return (1);
}
lun->PRGeneration++;
lun->pr_generation++;
mtx_unlock(&lun->lun_lock);
persis_io.hdr.nexus = ctsio->io_hdr.nexus;
@ -7993,9 +8001,9 @@ ctl_pro_preempt_other(struct ctl_lun *lun, union ctl_ha_msg *msg)
}
lun->pr_key_count = 1;
lun->res_type = msg->pr.pr_info.res_type;
if (lun->res_type != SPR_TYPE_WR_EX_AR
&& lun->res_type != SPR_TYPE_EX_AC_AR)
lun->pr_res_type = msg->pr.pr_info.res_type;
if (lun->pr_res_type != SPR_TYPE_WR_EX_AR &&
lun->pr_res_type != SPR_TYPE_EX_AC_AR)
lun->pr_res_idx = msg->pr.pr_info.residx;
} else {
for (i = 0; i < CTL_MAX_INITIATORS; i++) {
@ -8017,20 +8025,20 @@ ctl_pro_preempt_other(struct ctl_lun *lun, union ctl_ha_msg *msg)
ctl_clr_prkey(lun, i);
lun->pr_key_count--;
ctl_est_ua(lun, i, CTL_UA_REG_PREEMPT);
} else if (msg->pr.pr_info.res_type != lun->res_type
&& (lun->res_type == SPR_TYPE_WR_EX_RO
|| lun->res_type == SPR_TYPE_EX_AC_RO)) {
} else if (msg->pr.pr_info.res_type != lun->pr_res_type
&& (lun->pr_res_type == SPR_TYPE_WR_EX_RO ||
lun->pr_res_type == SPR_TYPE_EX_AC_RO)) {
ctl_est_ua(lun, i, CTL_UA_RES_RELEASE);
}
}
lun->res_type = msg->pr.pr_info.res_type;
if (lun->res_type != SPR_TYPE_WR_EX_AR
&& lun->res_type != SPR_TYPE_EX_AC_AR)
lun->pr_res_type = msg->pr.pr_info.res_type;
if (lun->pr_res_type != SPR_TYPE_WR_EX_AR &&
lun->pr_res_type != SPR_TYPE_EX_AC_AR)
lun->pr_res_idx = msg->pr.pr_info.residx;
else
lun->pr_res_idx = CTL_PR_ALL_REGISTRANTS;
}
lun->PRGeneration++;
lun->pr_generation++;
}
@ -8212,9 +8220,9 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio)
lun->flags &= ~CTL_LUN_PR_RESERVED;
lun->pr_res_idx = CTL_PR_NO_RESERVATION;
if ((lun->res_type == SPR_TYPE_WR_EX_RO
|| lun->res_type == SPR_TYPE_EX_AC_RO)
&& lun->pr_key_count) {
if ((lun->pr_res_type == SPR_TYPE_WR_EX_RO ||
lun->pr_res_type == SPR_TYPE_EX_AC_RO) &&
lun->pr_key_count) {
/*
* If the reservation is a registrants
* only type we need to generate a UA
@ -8230,15 +8238,15 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio)
CTL_UA_RES_RELEASE);
}
}
lun->res_type = 0;
lun->pr_res_type = 0;
} else if (lun->pr_res_idx == CTL_PR_ALL_REGISTRANTS) {
if (lun->pr_key_count==0) {
lun->flags &= ~CTL_LUN_PR_RESERVED;
lun->res_type = 0;
lun->pr_res_type = 0;
lun->pr_res_idx = CTL_PR_NO_RESERVATION;
}
}
lun->PRGeneration++;
lun->pr_generation++;
mtx_unlock(&lun->lun_lock);
persis_io.hdr.nexus = ctsio->io_hdr.nexus;
@ -8257,7 +8265,7 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio)
if (ctl_get_prkey(lun, residx) == 0)
lun->pr_key_count++;
ctl_set_prkey(lun, residx, sa_res_key);
lun->PRGeneration++;
lun->pr_generation++;
mtx_unlock(&lun->lun_lock);
persis_io.hdr.nexus = ctsio->io_hdr.nexus;
@ -8286,7 +8294,7 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio)
*/
if ((lun->pr_res_idx != residx
&& lun->pr_res_idx != CTL_PR_ALL_REGISTRANTS)
|| lun->res_type != type) {
|| lun->pr_res_type != type) {
mtx_unlock(&lun->lun_lock);
free(ctsio->kern_data_ptr, M_CTL);
ctl_set_reservation_conflict(ctsio);
@ -8306,7 +8314,7 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio)
lun->pr_res_idx = CTL_PR_ALL_REGISTRANTS;
lun->flags |= CTL_LUN_PR_RESERVED;
lun->res_type = type;
lun->pr_res_type = type;
mtx_unlock(&lun->lun_lock);
@ -8341,7 +8349,7 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio)
goto done;
}
if (lun->res_type != type) {
if (lun->pr_res_type != type) {
mtx_unlock(&lun->lun_lock);
free(ctsio->kern_data_ptr, M_CTL);
ctl_set_illegal_pr_release(ctsio);
@ -8352,7 +8360,7 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio)
/* okay to release */
lun->flags &= ~CTL_LUN_PR_RESERVED;
lun->pr_res_idx = CTL_PR_NO_RESERVATION;
lun->res_type = 0;
lun->pr_res_type = 0;
/*
* if this isn't an exclusive access
@ -8382,7 +8390,7 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio)
mtx_lock(&lun->lun_lock);
lun->flags &= ~CTL_LUN_PR_RESERVED;
lun->res_type = 0;
lun->pr_res_type = 0;
lun->pr_key_count = 0;
lun->pr_res_idx = CTL_PR_NO_RESERVATION;
@ -8392,7 +8400,7 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio)
ctl_clr_prkey(lun, i);
ctl_est_ua(lun, i, CTL_UA_REG_PREEMPT);
}
lun->PRGeneration++;
lun->pr_generation++;
mtx_unlock(&lun->lun_lock);
persis_io.hdr.nexus = ctsio->io_hdr.nexus;
@ -8459,7 +8467,7 @@ ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg)
lun->pr_key_count++;
ctl_set_prkey(lun, msg->pr.pr_info.residx,
scsi_8btou64(msg->pr.pr_info.sa_res_key));
lun->PRGeneration++;
lun->pr_generation++;
break;
case CTL_PR_UNREG_KEY:
@ -8472,9 +8480,9 @@ ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg)
lun->flags &= ~CTL_LUN_PR_RESERVED;
lun->pr_res_idx = CTL_PR_NO_RESERVATION;
if ((lun->res_type == SPR_TYPE_WR_EX_RO
|| lun->res_type == SPR_TYPE_EX_AC_RO)
&& lun->pr_key_count) {
if ((lun->pr_res_type == SPR_TYPE_WR_EX_RO ||
lun->pr_res_type == SPR_TYPE_EX_AC_RO) &&
lun->pr_key_count) {
/*
* If the reservation is a registrants
* only type we need to generate a UA
@ -8490,20 +8498,20 @@ ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg)
ctl_est_ua(lun, i, CTL_UA_RES_RELEASE);
}
}
lun->res_type = 0;
lun->pr_res_type = 0;
} else if (lun->pr_res_idx == CTL_PR_ALL_REGISTRANTS) {
if (lun->pr_key_count==0) {
lun->flags &= ~CTL_LUN_PR_RESERVED;
lun->res_type = 0;
lun->pr_res_type = 0;
lun->pr_res_idx = CTL_PR_NO_RESERVATION;
}
}
lun->PRGeneration++;
lun->pr_generation++;
break;
case CTL_PR_RESERVE:
lun->flags |= CTL_LUN_PR_RESERVED;
lun->res_type = msg->pr.pr_info.res_type;
lun->pr_res_type = msg->pr.pr_info.res_type;
lun->pr_res_idx = msg->pr.pr_info.residx;
break;
@ -8513,8 +8521,8 @@ ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg)
* if this isn't an exclusive access res generate UA for all
* other registrants.
*/
if (lun->res_type != SPR_TYPE_EX_AC
&& lun->res_type != SPR_TYPE_WR_EX) {
if (lun->pr_res_type != SPR_TYPE_EX_AC &&
lun->pr_res_type != SPR_TYPE_WR_EX) {
for (i = softc->init_min; i < softc->init_max; i++)
if (i == residx || ctl_get_prkey(lun, i) == 0)
continue;
@ -8523,7 +8531,7 @@ ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg)
lun->flags &= ~CTL_LUN_PR_RESERVED;
lun->pr_res_idx = CTL_PR_NO_RESERVATION;
lun->res_type = 0;
lun->pr_res_type = 0;
break;
case CTL_PR_PREEMPT:
@ -8531,7 +8539,7 @@ ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg)
break;
case CTL_PR_CLEAR:
lun->flags &= ~CTL_LUN_PR_RESERVED;
lun->res_type = 0;
lun->pr_res_type = 0;
lun->pr_key_count = 0;
lun->pr_res_idx = CTL_PR_NO_RESERVATION;
@ -8541,7 +8549,7 @@ ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg)
ctl_clr_prkey(lun, i);
ctl_est_ua(lun, i, CTL_UA_REG_PREEMPT);
}
lun->PRGeneration++;
lun->pr_generation++;
break;
}
@ -11286,9 +11294,9 @@ ctl_scsiio_lun_check(struct ctl_lun *lun,
(entry->flags & CTL_CMD_FLAG_ALLOW_ON_PR_RESV)) {
/* No reservation or command is allowed. */;
} else if ((entry->flags & CTL_CMD_FLAG_ALLOW_ON_PR_WRESV) &&
(lun->res_type == SPR_TYPE_WR_EX ||
lun->res_type == SPR_TYPE_WR_EX_RO ||
lun->res_type == SPR_TYPE_WR_EX_AR)) {
(lun->pr_res_type == SPR_TYPE_WR_EX ||
lun->pr_res_type == SPR_TYPE_WR_EX_RO ||
lun->pr_res_type == SPR_TYPE_WR_EX_AR)) {
/* The command is allowed for Write Exclusive resv. */;
} else {
/*
@ -11296,8 +11304,8 @@ ctl_scsiio_lun_check(struct ctl_lun *lun,
* reservation and this isn't the res holder then set a
* conflict.
*/
if (ctl_get_prkey(lun, residx) == 0
|| (residx != lun->pr_res_idx && lun->res_type < 4)) {
if (ctl_get_prkey(lun, residx) == 0 ||
(residx != lun->pr_res_idx && lun->pr_res_type < 4)) {
ctl_set_reservation_conflict(ctsio);
retval = 1;
goto bailout;

View File

@ -392,11 +392,11 @@ struct ctl_lun {
struct ctl_log_pages log_pages;
struct ctl_lun_io_stats stats;
uint32_t res_idx;
unsigned int PRGeneration;
uint32_t pr_generation;
uint64_t *pr_keys[CTL_MAX_PORTS];
int pr_key_count;
uint32_t pr_res_idx;
uint8_t res_type;
uint8_t pr_res_type;
int prevent_count;
uint32_t prevent[(CTL_MAX_INITIATORS+31)/32];
uint8_t *write_buffer;

View File

@ -1128,7 +1128,7 @@ static int
tpc_process_wut(struct tpc_list *list)
{
struct tpc_io *tio, *tior, *tiow;
struct runl run, *prun;
struct runl run;
int drange, srange;
off_t doffset, soffset;
off_t srclba, dstlba, numbytes, donebytes, roundbytes;
@ -1208,8 +1208,7 @@ tpc_process_wut(struct tpc_list *list)
// srclba, dstlba);
donebytes = 0;
TAILQ_INIT(&run);
prun = &run;
list->tbdio = 1;
list->tbdio = 0;
TAILQ_INIT(&list->allio);
while (donebytes < numbytes) {
roundbytes = numbytes - donebytes;
@ -1262,8 +1261,8 @@ tpc_process_wut(struct tpc_list *list)
tiow->io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = tiow;
TAILQ_INSERT_TAIL(&tior->run, tiow, rlinks);
TAILQ_INSERT_TAIL(prun, tior, rlinks);
prun = &tior->run;
TAILQ_INSERT_TAIL(&run, tior, rlinks);
list->tbdio++;
donebytes += roundbytes;
srclba += roundbytes / srcblock;
dstlba += roundbytes / dstblock;
@ -1295,7 +1294,6 @@ tpc_process_zero_wut(struct tpc_list *list)
ctl_free_io(tio->io);
free(tio, M_CTL);
}
free(list->buf, M_CTL);
if (list->abort) {
ctl_set_task_aborted(list->ctsio);
return (CTL_RETVAL_ERROR);
@ -1311,7 +1309,6 @@ tpc_process_zero_wut(struct tpc_list *list)
}
dstblock = list->lun->be_lun->blocksize;
list->buf = malloc(dstblock, M_CTL, M_WAITOK | M_ZERO);
TAILQ_INIT(&run);
prun = &run;
list->tbdio = 1;
@ -1328,9 +1325,9 @@ tpc_process_zero_wut(struct tpc_list *list)
TAILQ_INSERT_TAIL(&list->allio, tiow, links);
tiow->io = tpcl_alloc_io();
ctl_scsi_write_same(tiow->io,
/*data_ptr*/ list->buf,
/*data_len*/ dstblock,
/*byte2*/ 0,
/*data_ptr*/ NULL,
/*data_len*/ 0,
/*byte2*/ SWS_NDOB,
/*lba*/ scsi_8btou64(list->range[r].lba),
/*num_blocks*/ len,
/*tag_type*/ CTL_TAG_SIMPLE,

View File

@ -2574,8 +2574,11 @@ acpi_ReqSleepState(struct acpi_softc *sc, int state)
if (!acpi_sleep_states[state])
return (EOPNOTSUPP);
/* If a suspend request is already in progress, just return. */
if (sc->acpi_next_sstate != 0) {
/*
* If a reboot/shutdown/suspend request is already in progress or
* suspend is blocked due to an upcoming shutdown, just return.
*/
if (rebooting || sc->acpi_next_sstate != 0 || suspend_blocked) {
return (0);
}

View File

@ -1151,7 +1151,8 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
if (ctx_id != 0) {
DRM_DEBUG("Ring %s doesn't support contexts\n",
ring->name);
return -EPERM;
ret = -EPERM;
goto pre_struct_lock_err;
}
break;
case I915_EXEC_BLT:
@ -1159,7 +1160,8 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
if (ctx_id != 0) {
DRM_DEBUG("Ring %s doesn't support contexts\n",
ring->name);
return -EPERM;
ret = -EPERM;
goto pre_struct_lock_err;
}
break;
default:
@ -1171,7 +1173,8 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
if (!intel_ring_initialized(ring)) {
DRM_DEBUG("execbuf with invalid ring: %d\n",
(int)(args->flags & I915_EXEC_RING_MASK));
return -EINVAL;
ret = -EINVAL;
goto pre_struct_lock_err;
}
mode = args->flags & I915_EXEC_CONSTANTS_MASK;

View File

@ -137,6 +137,10 @@ static int show_busybufs = 1;
SYSCTL_INT(_kern_shutdown, OID_AUTO, show_busybufs, CTLFLAG_RW,
&show_busybufs, 0, "");
int suspend_blocked = 0;
SYSCTL_INT(_kern, OID_AUTO, suspend_blocked, CTLFLAG_RW,
&suspend_blocked, 0, "Block suspend due to a pending shutdown");
/*
* Variable panicstr contains argument to first call to panic; used as flag
* to indicate that the kernel has already called panic.

View File

@ -623,6 +623,10 @@ sbuf_vprintf(struct sbuf *s, const char *fmt, va_list ap)
va_copy(ap_copy, ap);
len = vsnprintf(&s->s_buf[s->s_len], SBUF_FREESPACE(s) + 1,
fmt, ap_copy);
if (len < 0) {
s->s_error = errno;
return (-1);
}
va_end(ap_copy);
if (SBUF_FREESPACE(s) >= len)

View File

@ -1077,16 +1077,15 @@ vop_stdadvise(struct vop_advise_args *ap)
BO_RLOCK(&vp->v_bufobj);
bsize = vp->v_bufobj.bo_bsize;
startn = ap->a_start / bsize;
if (ap->a_end == OFF_MAX) {
endn = -1;
bl = &vp->v_bufobj.bo_clean.bv_hd;
if (!TAILQ_EMPTY(bl))
endn = TAILQ_LAST(bl, buflists)->b_lblkno;
bl = &vp->v_bufobj.bo_dirty.bv_hd;
if (!TAILQ_EMPTY(bl) &&
endn < TAILQ_LAST(bl, buflists)->b_lblkno)
endn = TAILQ_LAST(bl, buflists)->b_lblkno;
} else
endn = -1;
bl = &vp->v_bufobj.bo_clean.bv_hd;
if (!TAILQ_EMPTY(bl))
endn = TAILQ_LAST(bl, buflists)->b_lblkno;
bl = &vp->v_bufobj.bo_dirty.bv_hd;
if (!TAILQ_EMPTY(bl) &&
endn < TAILQ_LAST(bl, buflists)->b_lblkno)
endn = TAILQ_LAST(bl, buflists)->b_lblkno;
if (ap->a_end != OFF_MAX && endn != -1)
endn = ap->a_end / bsize;
BO_RUNLOCK(&vp->v_bufobj);
/*

View File

@ -168,7 +168,7 @@ ccmp_encap(struct ieee80211_key *k, struct mbuf *m, uint8_t keyid)
ivp[7] = k->wk_keytsc >> 40; /* PN5 */
/*
* Finally, do software encrypt if neeed.
* Finally, do software encrypt if needed.
*/
if ((k->wk_flags & IEEE80211_KEY_SWENCRYPT) &&
!ccmp_encrypt(k, m, hdrlen))

View File

@ -195,7 +195,7 @@ tkip_encap(struct ieee80211_key *k, struct mbuf *m, uint8_t keyid)
ivp[7] = k->wk_keytsc >> 40; /* TSC5 */
/*
* Finally, do software encrypt if neeed.
* Finally, do software encrypt if needed.
*/
if (k->wk_flags & IEEE80211_KEY_SWENCRYPT) {
if (!tkip_encrypt(ctx, k, m, hdrlen))

View File

@ -184,7 +184,7 @@ wep_encap(struct ieee80211_key *k, struct mbuf *m, uint8_t keyid)
ivp[3] = keyid;
/*
* Finally, do software encrypt if neeed.
* Finally, do software encrypt if needed.
*/
if ((k->wk_flags & IEEE80211_KEY_SWENCRYPT) &&
!wep_encrypt(k, m, hdrlen))

View File

@ -46,6 +46,7 @@
#include <sys/stdint.h> /* for people using printf mainly */
extern int cold; /* nonzero if we are doing a cold boot */
extern int suspend_blocked; /* block suspend due to pending shutdown */
extern int rebooting; /* kern_reboot() has been called. */
extern const char *panicstr; /* panic message */
extern char version[]; /* system version */

View File

@ -43,8 +43,10 @@ BSARGS= DESTDIR= \
legacy: .MAKE .META
mkdir -p ${LEGACY_TOOLS}
${MAKE} -C ${SRCTOP}/etc distrib-dirs DESTDIR=${BTOOLSDIR} > $@2
${MAKE} -C ${SRCTOP}/etc distrib-dirs DESTDIR=${LEGACY_TOOLS} > $@
${MAKE} -C ${SRCTOP}/etc distrib-dirs DESTDIR=${BTOOLSDIR} \
> $@.distrib-dirs_btoolsdir
${MAKE} -C ${SRCTOP}/etc distrib-dirs DESTDIR=${LEGACY_TOOLS} \
> $@.distrib-dirs_legacy_tools
${BSENV} ${MAKE} -C ${SRCTOP} -f Makefile.inc1 ${BSARGS} $@
touch $@

View File

@ -8,7 +8,9 @@ all:
# we don't need to see it.
stage-distrib-dirs: .META
mkdir -p ${STAGE_OBJTOP}
${.MAKE} -C ${SRCTOP}/etc distrib-dirs -DWITH_TESTS DESTDIR=${STAGE_OBJTOP} > $@
${.MAKE} -C ${SRCTOP}/etc distrib-dirs -DWITH_TESTS \
DESTDIR=${STAGE_OBJTOP} > $@.distrib_dirs
touch $@
.include <bsd.prog.mk>

View File

@ -230,6 +230,18 @@ SUBDIR+= finger
SUBDIR+= ftp
.endif
.if ${MK_GAMES} != "no"
SUBDIR+= caesar
SUBDIR+= factor
SUBDIR+= fortune
SUBDIR+= grdc
SUBDIR+= morse
SUBDIR+= number
SUBDIR+= pom
SUBDIR+= primes
SUBDIR+= random
.endif
.if ${MK_GPL_DTC} != "yes"
SUBDIR+= dtc
.endif
@ -254,10 +266,8 @@ SUBDIR+= iscsictl
.if ${MK_KDUMP} != "no"
SUBDIR+= kdump
.if ${MACHINE_ARCH} != "aarch64" # ARM64TODO truss does not build
SUBDIR+= truss
.endif
.endif
.if ${MK_KERBEROS_SUPPORT} != "no"
SUBDIR+= compile_et

Some files were not shown because too many files have changed in this diff Show More