Home | History | Annotate | Line # | Download | only in kern
kern_cpu.c revision 1.2.10.5
      1  1.2.10.5  jmcneill /*	$NetBSD: kern_cpu.c,v 1.2.10.5 2007/11/04 21:03:31 jmcneill Exp $	*/
      2  1.2.10.1  jmcneill 
      3  1.2.10.1  jmcneill /*-
      4  1.2.10.1  jmcneill  * Copyright (c) 2007 The NetBSD Foundation, Inc.
      5  1.2.10.1  jmcneill  * All rights reserved.
      6  1.2.10.1  jmcneill  *
      7  1.2.10.1  jmcneill  * This code is derived from software contributed to The NetBSD Foundation
      8  1.2.10.1  jmcneill  * by Andrew Doran.
      9  1.2.10.1  jmcneill  *
     10  1.2.10.1  jmcneill  * Redistribution and use in source and binary forms, with or without
     11  1.2.10.1  jmcneill  * modification, are permitted provided that the following conditions
     12  1.2.10.1  jmcneill  * are met:
     13  1.2.10.1  jmcneill  * 1. Redistributions of source code must retain the above copyright
     14  1.2.10.1  jmcneill  *    notice, this list of conditions and the following disclaimer.
     15  1.2.10.1  jmcneill  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.2.10.1  jmcneill  *    notice, this list of conditions and the following disclaimer in the
     17  1.2.10.1  jmcneill  *    documentation and/or other materials provided with the distribution.
     18  1.2.10.1  jmcneill  * 3. All advertising materials mentioning features or use of this software
     19  1.2.10.1  jmcneill  *    must display the following acknowledgement:
     20  1.2.10.1  jmcneill  *        This product includes software developed by the NetBSD
     21  1.2.10.1  jmcneill  *        Foundation, Inc. and its contributors.
     22  1.2.10.1  jmcneill  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.2.10.1  jmcneill  *    contributors may be used to endorse or promote products derived
     24  1.2.10.1  jmcneill  *    from this software without specific prior written permission.
     25  1.2.10.1  jmcneill  *
     26  1.2.10.1  jmcneill  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.2.10.1  jmcneill  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.2.10.1  jmcneill  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.2.10.1  jmcneill  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.2.10.1  jmcneill  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.2.10.1  jmcneill  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.2.10.1  jmcneill  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.2.10.1  jmcneill  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.2.10.1  jmcneill  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.2.10.1  jmcneill  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.2.10.1  jmcneill  * POSSIBILITY OF SUCH DAMAGE.
     37  1.2.10.1  jmcneill  */
     38       1.2      yamt 
     39       1.2      yamt /*-
     40       1.2      yamt  * Copyright (c)2007 YAMAMOTO Takashi,
     41       1.2      yamt  * All rights reserved.
     42       1.2      yamt  *
     43       1.2      yamt  * Redistribution and use in source and binary forms, with or without
     44       1.2      yamt  * modification, are permitted provided that the following conditions
     45       1.2      yamt  * are met:
     46       1.2      yamt  * 1. Redistributions of source code must retain the above copyright
     47       1.2      yamt  *    notice, this list of conditions and the following disclaimer.
     48       1.2      yamt  * 2. Redistributions in binary form must reproduce the above copyright
     49       1.2      yamt  *    notice, this list of conditions and the following disclaimer in the
     50       1.2      yamt  *    documentation and/or other materials provided with the distribution.
     51       1.2      yamt  *
     52       1.2      yamt  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     53       1.2      yamt  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     54       1.2      yamt  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     55       1.2      yamt  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     56       1.2      yamt  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     57       1.2      yamt  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     58       1.2      yamt  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     59       1.2      yamt  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     60       1.2      yamt  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     61       1.2      yamt  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     62       1.2      yamt  * SUCH DAMAGE.
     63       1.2      yamt  */
     64       1.2      yamt 
     65       1.2      yamt #include <sys/cdefs.h>
     66       1.2      yamt 
     67  1.2.10.5  jmcneill __KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.2.10.5 2007/11/04 21:03:31 jmcneill Exp $");
     68       1.2      yamt 
     69       1.2      yamt #include <sys/param.h>
     70       1.2      yamt #include <sys/systm.h>
     71       1.2      yamt #include <sys/idle.h>
     72       1.2      yamt #include <sys/sched.h>
     73  1.2.10.4     joerg #include <sys/intr.h>
     74  1.2.10.1  jmcneill #include <sys/conf.h>
     75  1.2.10.1  jmcneill #include <sys/cpu.h>
     76  1.2.10.1  jmcneill #include <sys/cpuio.h>
     77  1.2.10.1  jmcneill #include <sys/proc.h>
     78  1.2.10.1  jmcneill #include <sys/kernel.h>
     79  1.2.10.1  jmcneill #include <sys/kauth.h>
     80  1.2.10.4     joerg #include <sys/xcall.h>
     81  1.2.10.4     joerg #include <sys/pool.h>
     82  1.2.10.1  jmcneill 
     83  1.2.10.3  jmcneill #include <uvm/uvm_extern.h>
     84  1.2.10.3  jmcneill 
     85  1.2.10.1  jmcneill void	cpuctlattach(int);
     86  1.2.10.1  jmcneill 
     87  1.2.10.5  jmcneill static void	cpu_xc_online(struct cpu_info *);
     88  1.2.10.5  jmcneill static void	cpu_xc_offline(struct cpu_info *);
     89  1.2.10.4     joerg 
     90  1.2.10.1  jmcneill dev_type_ioctl(cpuctl_ioctl);
     91  1.2.10.1  jmcneill 
     92  1.2.10.1  jmcneill const struct cdevsw cpuctl_cdevsw = {
     93  1.2.10.1  jmcneill 	nullopen, nullclose, nullread, nullwrite, cpuctl_ioctl,
     94  1.2.10.1  jmcneill 	nullstop, notty, nopoll, nommap, nokqfilter,
     95  1.2.10.1  jmcneill 	D_OTHER | D_MPSAFE
     96  1.2.10.1  jmcneill };
     97  1.2.10.5  jmcneill 
     98  1.2.10.1  jmcneill kmutex_t cpu_lock;
     99  1.2.10.4     joerg int	ncpu;
    100  1.2.10.4     joerg int	ncpuonline;
    101       1.2      yamt 
    102       1.2      yamt int
    103       1.2      yamt mi_cpu_attach(struct cpu_info *ci)
    104       1.2      yamt {
    105       1.2      yamt 	struct schedstate_percpu *spc = &ci->ci_schedstate;
    106       1.2      yamt 	int error;
    107       1.2      yamt 
    108  1.2.10.2  jmcneill 	ci->ci_index = ncpu;
    109  1.2.10.2  jmcneill 
    110       1.2      yamt 	mutex_init(&spc->spc_lwplock, MUTEX_SPIN, IPL_SCHED);
    111       1.2      yamt 	sched_cpuattach(ci);
    112  1.2.10.3  jmcneill 	uvm_cpu_attach(ci);
    113       1.2      yamt 
    114       1.2      yamt 	error = create_idle_lwp(ci);
    115       1.2      yamt 	if (error != 0) {
    116       1.2      yamt 		/* XXX revert sched_cpuattach */
    117       1.2      yamt 		return error;
    118       1.2      yamt 	}
    119       1.2      yamt 
    120  1.2.10.4     joerg 	softint_init(ci);
    121  1.2.10.4     joerg 	xc_init_cpu(ci);
    122  1.2.10.4     joerg 	TAILQ_INIT(&ci->ci_data.cpu_biodone);
    123       1.2      yamt 	ncpu++;
    124  1.2.10.4     joerg 	ncpuonline++;
    125       1.2      yamt 
    126       1.2      yamt 	return 0;
    127       1.2      yamt }
    128  1.2.10.1  jmcneill 
    129  1.2.10.1  jmcneill void
    130  1.2.10.1  jmcneill cpuctlattach(int dummy)
    131  1.2.10.1  jmcneill {
    132  1.2.10.1  jmcneill 
    133  1.2.10.1  jmcneill }
    134  1.2.10.1  jmcneill 
    135  1.2.10.1  jmcneill int
    136  1.2.10.1  jmcneill cpuctl_ioctl(dev_t dev, u_long cmd, void *data, int flag, lwp_t *l)
    137  1.2.10.1  jmcneill {
    138  1.2.10.1  jmcneill 	CPU_INFO_ITERATOR cii;
    139  1.2.10.1  jmcneill 	cpustate_t *cs;
    140  1.2.10.1  jmcneill 	struct cpu_info *ci;
    141  1.2.10.1  jmcneill 	int error, i;
    142  1.2.10.1  jmcneill 	u_int id;
    143  1.2.10.1  jmcneill 
    144  1.2.10.1  jmcneill 	error = 0;
    145  1.2.10.1  jmcneill 
    146  1.2.10.1  jmcneill 	mutex_enter(&cpu_lock);
    147  1.2.10.1  jmcneill 	switch (cmd) {
    148  1.2.10.1  jmcneill 	case IOC_CPU_SETSTATE:
    149  1.2.10.1  jmcneill 		error = kauth_authorize_generic(l->l_cred,
    150  1.2.10.1  jmcneill 		    KAUTH_GENERIC_ISSUSER, NULL);
    151  1.2.10.1  jmcneill 		if (error != 0)
    152  1.2.10.1  jmcneill 			break;
    153  1.2.10.1  jmcneill 		cs = data;
    154  1.2.10.1  jmcneill 		if ((ci = cpu_lookup(cs->cs_id)) == NULL) {
    155  1.2.10.1  jmcneill 			error = ESRCH;
    156  1.2.10.1  jmcneill 			break;
    157  1.2.10.1  jmcneill 		}
    158  1.2.10.1  jmcneill 		if (!cs->cs_intr) {
    159  1.2.10.1  jmcneill 			error = EOPNOTSUPP;
    160  1.2.10.1  jmcneill 			break;
    161  1.2.10.1  jmcneill 		}
    162  1.2.10.1  jmcneill 		error = cpu_setonline(ci, cs->cs_online);
    163  1.2.10.1  jmcneill 		break;
    164  1.2.10.1  jmcneill 
    165  1.2.10.1  jmcneill 	case IOC_CPU_GETSTATE:
    166  1.2.10.1  jmcneill 		cs = data;
    167  1.2.10.1  jmcneill 		id = cs->cs_id;
    168  1.2.10.4     joerg 		memset(cs, 0, sizeof(*cs));
    169  1.2.10.1  jmcneill 		cs->cs_id = id;
    170  1.2.10.1  jmcneill 		if ((ci = cpu_lookup(id)) == NULL) {
    171  1.2.10.1  jmcneill 			error = ESRCH;
    172  1.2.10.1  jmcneill 			break;
    173  1.2.10.1  jmcneill 		}
    174  1.2.10.1  jmcneill 		if ((ci->ci_schedstate.spc_flags & SPCF_OFFLINE) != 0)
    175  1.2.10.1  jmcneill 			cs->cs_online = false;
    176  1.2.10.1  jmcneill 		else
    177  1.2.10.1  jmcneill 			cs->cs_online = true;
    178  1.2.10.1  jmcneill 		cs->cs_intr = true;
    179  1.2.10.1  jmcneill 		cs->cs_lastmod = ci->ci_schedstate.spc_lastmod;
    180  1.2.10.1  jmcneill 		break;
    181  1.2.10.1  jmcneill 
    182  1.2.10.1  jmcneill 	case IOC_CPU_MAPID:
    183  1.2.10.1  jmcneill 		i = 0;
    184  1.2.10.1  jmcneill 		for (CPU_INFO_FOREACH(cii, ci)) {
    185  1.2.10.1  jmcneill 			if (i++ == *(int *)data)
    186  1.2.10.1  jmcneill 				break;
    187  1.2.10.1  jmcneill 		}
    188  1.2.10.1  jmcneill 		if (ci == NULL)
    189  1.2.10.1  jmcneill 			error = ESRCH;
    190  1.2.10.1  jmcneill 		else
    191  1.2.10.1  jmcneill 			*(int *)data = ci->ci_cpuid;
    192  1.2.10.1  jmcneill 		break;
    193  1.2.10.1  jmcneill 
    194  1.2.10.1  jmcneill 	case IOC_CPU_GETCOUNT:
    195  1.2.10.1  jmcneill 		*(int *)data = ncpu;
    196  1.2.10.1  jmcneill 		break;
    197  1.2.10.1  jmcneill 
    198  1.2.10.1  jmcneill 	default:
    199  1.2.10.1  jmcneill 		error = ENOTTY;
    200  1.2.10.1  jmcneill 		break;
    201  1.2.10.1  jmcneill 	}
    202  1.2.10.1  jmcneill 	mutex_exit(&cpu_lock);
    203  1.2.10.1  jmcneill 
    204  1.2.10.1  jmcneill 	return error;
    205  1.2.10.1  jmcneill }
    206  1.2.10.1  jmcneill 
    207  1.2.10.1  jmcneill struct cpu_info *
    208  1.2.10.1  jmcneill cpu_lookup(cpuid_t id)
    209  1.2.10.1  jmcneill {
    210  1.2.10.1  jmcneill 	CPU_INFO_ITERATOR cii;
    211  1.2.10.1  jmcneill 	struct cpu_info *ci;
    212  1.2.10.1  jmcneill 
    213  1.2.10.1  jmcneill 	for (CPU_INFO_FOREACH(cii, ci)) {
    214  1.2.10.1  jmcneill 		if (ci->ci_cpuid == id)
    215  1.2.10.1  jmcneill 			return ci;
    216  1.2.10.1  jmcneill 	}
    217  1.2.10.1  jmcneill 
    218  1.2.10.1  jmcneill 	return NULL;
    219  1.2.10.1  jmcneill }
    220  1.2.10.1  jmcneill 
    221  1.2.10.4     joerg static void
    222  1.2.10.5  jmcneill cpu_xc_offline(struct cpu_info *ci)
    223  1.2.10.4     joerg {
    224  1.2.10.5  jmcneill 	struct schedstate_percpu *spc, *mspc = NULL;
    225  1.2.10.5  jmcneill 	struct cpu_info *mci;
    226  1.2.10.5  jmcneill 	struct lwp *l;
    227  1.2.10.5  jmcneill 	CPU_INFO_ITERATOR cii;
    228  1.2.10.4     joerg 	int s;
    229  1.2.10.4     joerg 
    230  1.2.10.5  jmcneill 	spc = &ci->ci_schedstate;
    231  1.2.10.4     joerg 	s = splsched();
    232  1.2.10.4     joerg 	spc->spc_flags |= SPCF_OFFLINE;
    233  1.2.10.4     joerg 	splx(s);
    234  1.2.10.5  jmcneill 
    235  1.2.10.5  jmcneill 	/* Take the first available CPU for the migration */
    236  1.2.10.5  jmcneill 	for (CPU_INFO_FOREACH(cii, mci)) {
    237  1.2.10.5  jmcneill 		mspc = &mci->ci_schedstate;
    238  1.2.10.5  jmcneill 		if ((mspc->spc_flags & SPCF_OFFLINE) == 0)
    239  1.2.10.5  jmcneill 			break;
    240  1.2.10.5  jmcneill 	}
    241  1.2.10.5  jmcneill 	KASSERT(mci != NULL);
    242  1.2.10.5  jmcneill 
    243  1.2.10.5  jmcneill 	/*
    244  1.2.10.5  jmcneill 	 * Migrate all non-bound threads to the other CPU.
    245  1.2.10.5  jmcneill 	 * Please note, that this runs from the xcall thread, thus handling
    246  1.2.10.5  jmcneill 	 * of LSONPROC is not needed.
    247  1.2.10.5  jmcneill 	 */
    248  1.2.10.5  jmcneill 	mutex_enter(&proclist_lock);
    249  1.2.10.5  jmcneill 
    250  1.2.10.5  jmcneill 	/*
    251  1.2.10.5  jmcneill 	 * Note that threads on the runqueue might sleep after this, but
    252  1.2.10.5  jmcneill 	 * sched_takecpu() would migrate such threads to the appropriate CPU.
    253  1.2.10.5  jmcneill 	 */
    254  1.2.10.5  jmcneill 	LIST_FOREACH(l, &alllwp, l_list) {
    255  1.2.10.5  jmcneill 		lwp_lock(l);
    256  1.2.10.5  jmcneill 		if (l->l_cpu == ci && (l->l_stat == LSSLEEP ||
    257  1.2.10.5  jmcneill 		    l->l_stat == LSSTOP || l->l_stat == LSSUSPENDED)) {
    258  1.2.10.5  jmcneill 			KASSERT((l->l_flag & LW_RUNNING) == 0);
    259  1.2.10.5  jmcneill 			l->l_cpu = mci;
    260  1.2.10.5  jmcneill 		}
    261  1.2.10.5  jmcneill 		lwp_unlock(l);
    262  1.2.10.5  jmcneill 	}
    263  1.2.10.5  jmcneill 
    264  1.2.10.5  jmcneill 	/* Double-lock the runqueues */
    265  1.2.10.5  jmcneill 	if (ci < mci) {
    266  1.2.10.5  jmcneill 		spc_lock(ci);
    267  1.2.10.5  jmcneill 		spc_lock(mci);
    268  1.2.10.5  jmcneill 	} else {
    269  1.2.10.5  jmcneill 		spc_lock(mci);
    270  1.2.10.5  jmcneill 		spc_lock(ci);
    271  1.2.10.5  jmcneill 	}
    272  1.2.10.5  jmcneill 
    273  1.2.10.5  jmcneill 	/* Handle LSRUN and LSIDL cases */
    274  1.2.10.5  jmcneill 	LIST_FOREACH(l, &alllwp, l_list) {
    275  1.2.10.5  jmcneill 		if (l->l_cpu != ci || (l->l_flag & LW_BOUND))
    276  1.2.10.5  jmcneill 			continue;
    277  1.2.10.5  jmcneill 		if (l->l_stat == LSRUN && (l->l_flag & LW_INMEM) != 0) {
    278  1.2.10.5  jmcneill 			sched_dequeue(l);
    279  1.2.10.5  jmcneill 			l->l_cpu = mci;
    280  1.2.10.5  jmcneill 			lwp_setlock(l, mspc->spc_mutex);
    281  1.2.10.5  jmcneill 			sched_enqueue(l, false);
    282  1.2.10.5  jmcneill 		} else if (l->l_stat == LSRUN || l->l_stat == LSIDL) {
    283  1.2.10.5  jmcneill 			l->l_cpu = mci;
    284  1.2.10.5  jmcneill 			lwp_setlock(l, mspc->spc_mutex);
    285  1.2.10.5  jmcneill 		}
    286  1.2.10.5  jmcneill 	}
    287  1.2.10.5  jmcneill 	spc_unlock(ci);
    288  1.2.10.5  jmcneill 	spc_unlock(mci);
    289  1.2.10.5  jmcneill 
    290  1.2.10.5  jmcneill 	mutex_exit(&proclist_lock);
    291  1.2.10.4     joerg }
    292  1.2.10.4     joerg 
    293  1.2.10.4     joerg static void
    294  1.2.10.5  jmcneill cpu_xc_online(struct cpu_info *ci)
    295  1.2.10.4     joerg {
    296  1.2.10.5  jmcneill 	struct schedstate_percpu *spc;
    297  1.2.10.4     joerg 	int s;
    298  1.2.10.4     joerg 
    299  1.2.10.5  jmcneill 	spc = &ci->ci_schedstate;
    300  1.2.10.4     joerg 	s = splsched();
    301  1.2.10.4     joerg 	spc->spc_flags &= ~SPCF_OFFLINE;
    302  1.2.10.4     joerg 	splx(s);
    303  1.2.10.4     joerg }
    304  1.2.10.4     joerg 
    305  1.2.10.1  jmcneill int
    306  1.2.10.1  jmcneill cpu_setonline(struct cpu_info *ci, bool online)
    307  1.2.10.1  jmcneill {
    308  1.2.10.1  jmcneill 	struct schedstate_percpu *spc;
    309  1.2.10.1  jmcneill 	CPU_INFO_ITERATOR cii;
    310  1.2.10.1  jmcneill 	struct cpu_info *ci2;
    311  1.2.10.4     joerg 	uint64_t where;
    312  1.2.10.4     joerg 	xcfunc_t func;
    313  1.2.10.1  jmcneill 	int nonline;
    314  1.2.10.1  jmcneill 
    315  1.2.10.1  jmcneill 	spc = &ci->ci_schedstate;
    316  1.2.10.1  jmcneill 
    317  1.2.10.1  jmcneill 	KASSERT(mutex_owned(&cpu_lock));
    318  1.2.10.1  jmcneill 
    319  1.2.10.1  jmcneill 	if (online) {
    320  1.2.10.1  jmcneill 		if ((spc->spc_flags & SPCF_OFFLINE) == 0)
    321  1.2.10.1  jmcneill 			return 0;
    322  1.2.10.4     joerg 		func = (xcfunc_t)cpu_xc_online;
    323  1.2.10.4     joerg 		ncpuonline++;
    324  1.2.10.1  jmcneill 	} else {
    325  1.2.10.1  jmcneill 		if ((spc->spc_flags & SPCF_OFFLINE) != 0)
    326  1.2.10.1  jmcneill 			return 0;
    327  1.2.10.1  jmcneill 		nonline = 0;
    328  1.2.10.1  jmcneill 		for (CPU_INFO_FOREACH(cii, ci2)) {
    329  1.2.10.1  jmcneill 			nonline += ((ci2->ci_schedstate.spc_flags &
    330  1.2.10.1  jmcneill 			    SPCF_OFFLINE) == 0);
    331  1.2.10.1  jmcneill 		}
    332  1.2.10.1  jmcneill 		if (nonline == 1)
    333  1.2.10.1  jmcneill 			return EBUSY;
    334  1.2.10.4     joerg 		func = (xcfunc_t)cpu_xc_offline;
    335  1.2.10.4     joerg 		ncpuonline--;
    336  1.2.10.1  jmcneill 	}
    337  1.2.10.1  jmcneill 
    338  1.2.10.5  jmcneill 	where = xc_unicast(0, func, ci, NULL, ci);
    339  1.2.10.4     joerg 	xc_wait(where);
    340  1.2.10.5  jmcneill 	if (online) {
    341  1.2.10.5  jmcneill 		KASSERT((spc->spc_flags & SPCF_OFFLINE) == 0);
    342  1.2.10.5  jmcneill 	} else {
    343  1.2.10.5  jmcneill 		KASSERT(spc->spc_flags & SPCF_OFFLINE);
    344  1.2.10.5  jmcneill 	}
    345  1.2.10.4     joerg 	spc->spc_lastmod = time_second;
    346  1.2.10.4     joerg 
    347  1.2.10.1  jmcneill 	return 0;
    348  1.2.10.1  jmcneill }
    349