From 3020e3be3756cae1943fa7319645e49add96f8f7 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Thu, 19 Jun 2003 01:55:08 +0000 Subject: [PATCH] thread stage 5: Separate the inline functions out of sys/buf.h, creating sys/buf2.h (A methodology that will continue as time passes). This solves inline vs struct ordering problems. Do a major cleanup of the globaldata access methodology. Create a gcc-cacheable 'mycpu' macro & inline to access per-cpu data. Atomicy is not required because we will never change cpus out from under a thread, even if it gets preempted by an interrupt thread, because we want to be able to implement per-cpu caches that do not require locked bus cycles or special instructions. --- sys/bus/cam/scsi/scsi_cd.c | 4 +- sys/bus/cam/scsi/scsi_da.c | 4 +- sys/bus/cam/scsi/scsi_pass.c | 4 +- sys/bus/cam/scsi/scsi_sa.c | 5 +- sys/cpu/i386/include/cpu.h | 8 +- sys/dev/disk/ata/ata-disk.c | 4 +- sys/dev/disk/ata/ata-raid.c | 4 +- sys/dev/disk/ata/atapi-cd.c | 4 +- sys/dev/disk/ata/atapi-fd.c | 4 +- sys/dev/disk/ata/atapi-tape.c | 4 +- sys/dev/disk/ccd/ccd.c | 3 +- sys/dev/disk/fd/fd.c | 4 +- sys/dev/disk/md/md.c | 4 +- sys/dev/raid/aac/aac_compat.h | 4 +- sys/dev/raid/amr/amr_compat.h | 4 +- sys/dev/raid/mlx/mlx_compat.h | 4 +- sys/dev/raid/twe/twe_compat.h | 4 +- sys/dev/raid/vinum/vinumhdr.h | 5 +- sys/i386/i386/genassym.c | 3 +- sys/i386/i386/machdep.c | 3 +- sys/i386/include/cpu.h | 8 +- sys/i386/include/globaldata.h | 3 +- sys/i386/include/globals.h | 144 ++++--------------- sys/i386/include/proc.h | 5 +- sys/kern/init_main.c | 8 +- sys/kern/kern_exit.c | 8 +- sys/kern/kern_resource.c | 18 ++- sys/kern/kern_shutdown.c | 3 +- sys/kern/kern_subr.c | 6 +- sys/kern/kern_synch.c | 22 +-- sys/kern/vfs_bio.c | 4 +- sys/kern/vfs_cluster.c | 3 +- sys/kern/vfs_subr.c | 4 +- sys/platform/pc32/i386/genassym.c | 3 +- sys/platform/pc32/i386/machdep.c | 3 +- sys/platform/pc32/include/globaldata.h | 3 +- sys/platform/pc32/include/globals.h | 144 ++++--------------- sys/platform/pc32/include/proc.h | 5 +- sys/platform/vkernel/i386/genassym.c | 3 +- sys/sys/buf.h | 154 +------------------- sys/sys/buf2.h | 188 +++++++++++++++++++++++++ sys/sys/proc.h | 5 +- sys/vfs/mfs/mfs_vfsops.c | 4 +- sys/vfs/mfs/mfs_vnops.c | 4 +- sys/vfs/msdosfs/msdosfs_vnops.c | 4 +- sys/vfs/nfs/nfs_bio.c | 4 +- sys/vfs/nfs/nfs_serv.c | 4 +- sys/vfs/nfs/nfs_subs.c | 4 +- sys/vfs/nfs/nfs_vnops.c | 4 +- sys/vfs/specfs/spec_vnops.c | 4 +- sys/vfs/ufs/ffs_balloc.c | 3 +- sys/vfs/ufs/ffs_softdep.c | 3 +- sys/vfs/ufs/ffs_vnops.c | 4 +- sys/vfs/ufs/ufs_disksubr.c | 5 +- sys/vm/swap_pager.c | 4 +- sys/vm/vm_pager.c | 4 +- 56 files changed, 405 insertions(+), 477 deletions(-) create mode 100644 sys/sys/buf2.h diff --git a/sys/bus/cam/scsi/scsi_cd.c b/sys/bus/cam/scsi/scsi_cd.c index 5b0ae45261..9f4823718a 100644 --- a/sys/bus/cam/scsi/scsi_cd.c +++ b/sys/bus/cam/scsi/scsi_cd.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/cam/scsi/scsi_cd.c,v 1.31.2.13 2002/11/25 05:30:31 njl Exp $ - * $DragonFly: src/sys/bus/cam/scsi/scsi_cd.c,v 1.2 2003/06/17 04:28:19 dillon Exp $ + * $DragonFly: src/sys/bus/cam/scsi/scsi_cd.c,v 1.3 2003/06/19 01:54:55 dillon Exp $ */ /* * Portions of this driver taken from the original FreeBSD cd driver. @@ -61,6 +61,8 @@ #include #include #include +#include +#include #include #include diff --git a/sys/bus/cam/scsi/scsi_da.c b/sys/bus/cam/scsi/scsi_da.c index d58bfd1cd6..40614bb7d4 100644 --- a/sys/bus/cam/scsi/scsi_da.c +++ b/sys/bus/cam/scsi/scsi_da.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/cam/scsi/scsi_da.c,v 1.42.2.36 2003/05/17 21:48:30 njl Exp $ - * $DragonFly: src/sys/bus/cam/scsi/scsi_da.c,v 1.2 2003/06/17 04:28:19 dillon Exp $ + * $DragonFly: src/sys/bus/cam/scsi/scsi_da.c,v 1.3 2003/06/19 01:54:55 dillon Exp $ */ #ifdef _KERNEL @@ -48,6 +48,8 @@ #include #include #include +#include +#include #include diff --git a/sys/bus/cam/scsi/scsi_pass.c b/sys/bus/cam/scsi/scsi_pass.c index bcf3a282a3..c5fbe275cc 100644 --- a/sys/bus/cam/scsi/scsi_pass.c +++ b/sys/bus/cam/scsi/scsi_pass.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/cam/scsi/scsi_pass.c,v 1.19 2000/01/17 06:27:37 mjacob Exp $ - * $DragonFly: src/sys/bus/cam/scsi/scsi_pass.c,v 1.2 2003/06/17 04:28:19 dillon Exp $ + * $DragonFly: src/sys/bus/cam/scsi/scsi_pass.c,v 1.3 2003/06/19 01:54:55 dillon Exp $ */ #include @@ -41,6 +41,8 @@ #include #include #include +#include +#include #include #include diff --git a/sys/bus/cam/scsi/scsi_sa.c b/sys/bus/cam/scsi/scsi_sa.c index 437206a0c5..804005019d 100644 --- a/sys/bus/cam/scsi/scsi_sa.c +++ b/sys/bus/cam/scsi/scsi_sa.c @@ -1,6 +1,6 @@ /* * $FreeBSD: src/sys/cam/scsi/scsi_sa.c,v 1.45.2.13 2002/12/17 17:08:50 trhodes Exp $ - * $DragonFly: src/sys/bus/cam/scsi/scsi_sa.c,v 1.2 2003/06/17 04:28:19 dillon Exp $ + * $DragonFly: src/sys/bus/cam/scsi/scsi_sa.c,v 1.3 2003/06/19 01:54:55 dillon Exp $ * * Implementation of SCSI Sequential Access Peripheral driver for CAM. * @@ -41,7 +41,8 @@ #include #include #include -#include +#include +#include #include #include diff --git a/sys/cpu/i386/include/cpu.h b/sys/cpu/i386/include/cpu.h index 5a671ce6e4..73cfb5f70f 100644 --- a/sys/cpu/i386/include/cpu.h +++ b/sys/cpu/i386/include/cpu.h @@ -35,7 +35,7 @@ * * from: @(#)cpu.h 5.4 (Berkeley) 5/9/91 * $FreeBSD: src/sys/i386/include/cpu.h,v 1.43.2.2 2001/06/15 09:37:57 scottl Exp $ - * $DragonFly: src/sys/cpu/i386/include/cpu.h,v 1.2 2003/06/17 04:28:35 dillon Exp $ + * $DragonFly: src/sys/cpu/i386/include/cpu.h,v 1.3 2003/06/19 01:55:05 dillon Exp $ */ #ifndef _MACHINE_CPU_H_ @@ -87,8 +87,8 @@ * added, we will have an atomicy problem. The type of atomicy we need is * a non-locked orl. */ -#define need_resched() do { astpending = AST_RESCHED|AST_PENDING; } while (0) -#define resched_wanted() (astpending & AST_RESCHED) +#define need_resched() do { mycpu->gd_astpending = AST_RESCHED|AST_PENDING; } while (0) +#define resched_wanted() (mycpu->gd_astpending & AST_RESCHED) /* * Arrange to handle pending profiling ticks before returning to user mode. @@ -111,7 +111,7 @@ */ #define signotify(p) aston() -#define aston() do { astpending |= AST_PENDING; } while (0) +#define aston() do { mycpu->gd_astpending |= AST_PENDING; } while (0) #define astoff() /* diff --git a/sys/dev/disk/ata/ata-disk.c b/sys/dev/disk/ata/ata-disk.c index fb7e4308b7..35f5838cf7 100644 --- a/sys/dev/disk/ata/ata-disk.c +++ b/sys/dev/disk/ata/ata-disk.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/ata-disk.c,v 1.60.2.24 2003/01/30 07:19:59 sos Exp $ - * $DragonFly: src/sys/dev/disk/ata/ata-disk.c,v 1.2 2003/06/17 04:28:22 dillon Exp $ + * $DragonFly: src/sys/dev/disk/ata/ata-disk.c,v 1.3 2003/06/19 01:54:59 dillon Exp $ */ #include "opt_ata.h" @@ -52,6 +52,8 @@ #include #include #include +#include +#include /* device structures */ static d_open_t adopen; diff --git a/sys/dev/disk/ata/ata-raid.c b/sys/dev/disk/ata/ata-raid.c index 4d5d4f7f90..e0239201d9 100644 --- a/sys/dev/disk/ata/ata-raid.c +++ b/sys/dev/disk/ata/ata-raid.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/ata-raid.c,v 1.3.2.19 2003/01/30 07:19:59 sos Exp $ - * $DragonFly: src/sys/dev/disk/ata/ata-raid.c,v 1.2 2003/06/17 04:28:22 dillon Exp $ + * $DragonFly: src/sys/dev/disk/ata/ata-raid.c,v 1.3 2003/06/19 01:54:59 dillon Exp $ */ #include "opt_ata.h" @@ -46,6 +46,8 @@ #include #include #include +#include +#include /* device structures */ static d_open_t aropen; diff --git a/sys/dev/disk/ata/atapi-cd.c b/sys/dev/disk/ata/atapi-cd.c index fb936df83b..8c808dfcdb 100644 --- a/sys/dev/disk/ata/atapi-cd.c +++ b/sys/dev/disk/ata/atapi-cd.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/atapi-cd.c,v 1.48.2.20 2002/11/25 05:30:31 njl Exp $ - * $DragonFly: src/sys/dev/disk/ata/atapi-cd.c,v 1.2 2003/06/17 04:28:22 dillon Exp $ + * $DragonFly: src/sys/dev/disk/ata/atapi-cd.c,v 1.3 2003/06/19 01:54:59 dillon Exp $ */ #include "opt_ata.h" @@ -46,6 +46,8 @@ #include #include #include +#include +#include #include #include #include diff --git a/sys/dev/disk/ata/atapi-fd.c b/sys/dev/disk/ata/atapi-fd.c index d510e1c24c..5bea60b447 100644 --- a/sys/dev/disk/ata/atapi-fd.c +++ b/sys/dev/disk/ata/atapi-fd.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/atapi-fd.c,v 1.44.2.9 2002/07/31 11:19:26 sos Exp $ - * $DragonFly: src/sys/dev/disk/ata/atapi-fd.c,v 1.2 2003/06/17 04:28:22 dillon Exp $ + * $DragonFly: src/sys/dev/disk/ata/atapi-fd.c,v 1.3 2003/06/19 01:54:59 dillon Exp $ */ #include @@ -40,6 +40,8 @@ #include #include #include +#include +#include #include #include #include diff --git a/sys/dev/disk/ata/atapi-tape.c b/sys/dev/disk/ata/atapi-tape.c index e6eb455d94..c39e492721 100644 --- a/sys/dev/disk/ata/atapi-tape.c +++ b/sys/dev/disk/ata/atapi-tape.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/atapi-tape.c,v 1.36.2.12 2002/07/31 11:19:26 sos Exp $ - * $DragonFly: src/sys/dev/disk/ata/atapi-tape.c,v 1.2 2003/06/17 04:28:22 dillon Exp $ + * $DragonFly: src/sys/dev/disk/ata/atapi-tape.c,v 1.3 2003/06/19 01:54:59 dillon Exp $ */ #include "opt_ata.h" @@ -41,6 +41,8 @@ #include #include #include +#include +#include #include #include #include diff --git a/sys/dev/disk/ccd/ccd.c b/sys/dev/disk/ccd/ccd.c index 1186103b2b..63a9132b45 100644 --- a/sys/dev/disk/ccd/ccd.c +++ b/sys/dev/disk/ccd/ccd.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/ccd/ccd.c,v 1.73.2.1 2001/09/11 09:49:52 kris Exp $ */ -/* $DragonFly: src/sys/dev/disk/ccd/ccd.c,v 1.2 2003/06/17 04:28:23 dillon Exp $ */ +/* $DragonFly: src/sys/dev/disk/ccd/ccd.c,v 1.3 2003/06/19 01:55:03 dillon Exp $ */ /* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */ @@ -106,6 +106,7 @@ #include #include #include +#include #include diff --git a/sys/dev/disk/fd/fd.c b/sys/dev/disk/fd/fd.c index 8cc26b4c9b..579f8bd8f3 100644 --- a/sys/dev/disk/fd/fd.c +++ b/sys/dev/disk/fd/fd.c @@ -51,7 +51,7 @@ * * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 * $FreeBSD: src/sys/isa/fd.c,v 1.176.2.8 2002/05/15 21:56:14 joerg Exp $ - * $DragonFly: src/sys/dev/disk/fd/fd.c,v 1.2 2003/06/17 04:28:40 dillon Exp $ + * $DragonFly: src/sys/dev/disk/fd/fd.c,v 1.3 2003/06/19 01:55:05 dillon Exp $ * */ @@ -76,6 +76,8 @@ #include #include +#include + #include #include #include diff --git a/sys/dev/disk/md/md.c b/sys/dev/disk/md/md.c index 3b97c44fbf..031c92e40c 100644 --- a/sys/dev/disk/md/md.c +++ b/sys/dev/disk/md/md.c @@ -7,7 +7,7 @@ * ---------------------------------------------------------------------------- * * $FreeBSD: src/sys/dev/md/md.c,v 1.8.2.2 2002/08/19 17:43:34 jdp Exp $ - * $DragonFly: src/sys/dev/disk/md/md.c,v 1.2 2003/06/17 04:28:28 dillon Exp $ + * $DragonFly: src/sys/dev/disk/md/md.c,v 1.3 2003/06/19 01:55:03 dillon Exp $ * */ @@ -24,6 +24,8 @@ #include #include #include +#include +#include #ifndef MD_NSECT #define MD_NSECT (10000 * 2) diff --git a/sys/dev/raid/aac/aac_compat.h b/sys/dev/raid/aac/aac_compat.h index 9d84fe2595..cc7950ccf9 100644 --- a/sys/dev/raid/aac/aac_compat.h +++ b/sys/dev/raid/aac/aac_compat.h @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/aac/aac_compat.h,v 1.2.2.2 2001/09/19 19:09:11 scottl Exp $ - * $DragonFly: src/sys/dev/raid/aac/Attic/aac_compat.h,v 1.2 2003/06/17 04:28:21 dillon Exp $ + * $DragonFly: src/sys/dev/raid/aac/Attic/aac_compat.h,v 1.3 2003/06/19 01:54:56 dillon Exp $ */ /* * Backwards compatibility support. @@ -36,7 +36,9 @@ */ #if __FreeBSD_version < 500003 /* old buf style */ +#include #include +#include #define FREEBSD_4 #define bio buf #define bioq_init(x) bufq_init(x) diff --git a/sys/dev/raid/amr/amr_compat.h b/sys/dev/raid/amr/amr_compat.h index c4f1d702c9..d584a87cf8 100644 --- a/sys/dev/raid/amr/amr_compat.h +++ b/sys/dev/raid/amr/amr_compat.h @@ -53,15 +53,17 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/amr/amr_compat.h,v 1.2.2.4 2002/11/11 13:19:10 emoore Exp $ - * $DragonFly: src/sys/dev/raid/amr/amr_compat.h,v 1.2 2003/06/17 04:28:22 dillon Exp $ + * $DragonFly: src/sys/dev/raid/amr/amr_compat.h,v 1.3 2003/06/19 01:54:58 dillon Exp $ */ /* * Backwards compatibility support. */ #if __FreeBSD_version < 500003 /* old buf style */ +# include # include # include +# include # define INTR_ENTROPY 0 # define FREEBSD_4 diff --git a/sys/dev/raid/mlx/mlx_compat.h b/sys/dev/raid/mlx/mlx_compat.h index 795d451cc1..b775f19c4f 100644 --- a/sys/dev/raid/mlx/mlx_compat.h +++ b/sys/dev/raid/mlx/mlx_compat.h @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/mlx/mlx_compat.h,v 1.1.2.1 2001/06/25 04:37:51 msmith Exp $ - * $DragonFly: src/sys/dev/raid/mlx/mlx_compat.h,v 1.2 2003/06/17 04:28:28 dillon Exp $ + * $DragonFly: src/sys/dev/raid/mlx/mlx_compat.h,v 1.3 2003/06/19 01:55:04 dillon Exp $ */ /* * Portability and compatibility interfaces. @@ -35,7 +35,9 @@ # include # define INTR_ENTROPY 0 +# include /* old buf style */ # include /* old buf style */ +# include typedef struct buf mlx_bio; typedef struct buf_queue_head mlx_bioq; # define MLX_BIO_QINIT(bq) bufq_init(&bq); diff --git a/sys/dev/raid/twe/twe_compat.h b/sys/dev/raid/twe/twe_compat.h index 014703af00..42a886c66c 100644 --- a/sys/dev/raid/twe/twe_compat.h +++ b/sys/dev/raid/twe/twe_compat.h @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/twe/twe_compat.h,v 1.1.2.3 2002/03/07 09:57:02 msmith Exp $ - * $DragonFly: src/sys/dev/raid/twe/twe_compat.h,v 1.2 2003/06/17 04:28:32 dillon Exp $ + * $DragonFly: src/sys/dev/raid/twe/twe_compat.h,v 1.3 2003/06/19 01:55:04 dillon Exp $ */ /* * Portability and compatibility interfaces. @@ -136,6 +136,8 @@ # define INTR_ENTROPY 0 # include /* old buf style */ +# include +# include typedef struct buf twe_bio; typedef struct buf_queue_head twe_bioq; # define TWE_BIO_QINIT(bq) bufq_init(&bq); diff --git a/sys/dev/raid/vinum/vinumhdr.h b/sys/dev/raid/vinum/vinumhdr.h index 42ebc72ec6..9efff70cbd 100644 --- a/sys/dev/raid/vinum/vinumhdr.h +++ b/sys/dev/raid/vinum/vinumhdr.h @@ -38,7 +38,7 @@ /* * $Id: vinumhdr.h,v 1.18 2001/01/04 00:14:14 grog Exp grog $ * $FreeBSD: src/sys/dev/vinum/vinumhdr.h,v 1.16.2.1 2001/03/13 02:59:43 grog Exp $ - * $DragonFly: src/sys/dev/raid/vinum/vinumhdr.h,v 1.2 2003/06/17 04:28:33 dillon Exp $ + * $DragonFly: src/sys/dev/raid/vinum/vinumhdr.h,v 1.3 2003/06/19 01:55:04 dillon Exp $ */ #include @@ -71,6 +71,9 @@ #include #endif #include + +#include + #include #include #include diff --git a/sys/i386/i386/genassym.c b/sys/i386/i386/genassym.c index c64d184487..8be2ee0319 100644 --- a/sys/i386/i386/genassym.c +++ b/sys/i386/i386/genassym.c @@ -35,7 +35,7 @@ * * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 * $FreeBSD: src/sys/i386/i386/genassym.c,v 1.86.2.3 2002/03/03 05:42:49 nyan Exp $ - * $DragonFly: src/sys/i386/i386/Attic/genassym.c,v 1.6 2003/06/18 18:29:55 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/genassym.c,v 1.7 2003/06/19 01:55:05 dillon Exp $ */ #include "opt_user_ldt.h" @@ -71,7 +71,6 @@ #endif #include #include -#include #include ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace)); diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 2d1d372b47..9470ff4505 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -36,7 +36,7 @@ * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 * $FreeBSD: src/sys/i386/i386/machdep.c,v 1.385.2.30 2003/05/31 08:48:05 alc Exp $ - * $DragonFly: src/sys/i386/i386/Attic/machdep.c,v 1.4 2003/06/18 18:29:55 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/machdep.c,v 1.5 2003/06/19 01:55:05 dillon Exp $ */ #include "apm.h" @@ -103,7 +103,6 @@ #ifdef SMP #include #endif -#include #ifdef PERFMON #include #endif diff --git a/sys/i386/include/cpu.h b/sys/i386/include/cpu.h index e60b89a705..01e40c895b 100644 --- a/sys/i386/include/cpu.h +++ b/sys/i386/include/cpu.h @@ -35,7 +35,7 @@ * * from: @(#)cpu.h 5.4 (Berkeley) 5/9/91 * $FreeBSD: src/sys/i386/include/cpu.h,v 1.43.2.2 2001/06/15 09:37:57 scottl Exp $ - * $DragonFly: src/sys/i386/include/Attic/cpu.h,v 1.2 2003/06/17 04:28:35 dillon Exp $ + * $DragonFly: src/sys/i386/include/Attic/cpu.h,v 1.3 2003/06/19 01:55:05 dillon Exp $ */ #ifndef _MACHINE_CPU_H_ @@ -87,8 +87,8 @@ * added, we will have an atomicy problem. The type of atomicy we need is * a non-locked orl. */ -#define need_resched() do { astpending = AST_RESCHED|AST_PENDING; } while (0) -#define resched_wanted() (astpending & AST_RESCHED) +#define need_resched() do { mycpu->gd_astpending = AST_RESCHED|AST_PENDING; } while (0) +#define resched_wanted() (mycpu->gd_astpending & AST_RESCHED) /* * Arrange to handle pending profiling ticks before returning to user mode. @@ -111,7 +111,7 @@ */ #define signotify(p) aston() -#define aston() do { astpending |= AST_PENDING; } while (0) +#define aston() do { mycpu->gd_astpending |= AST_PENDING; } while (0) #define astoff() /* diff --git a/sys/i386/include/globaldata.h b/sys/i386/include/globaldata.h index 15c86248b5..d4077b1cf1 100644 --- a/sys/i386/include/globaldata.h +++ b/sys/i386/include/globaldata.h @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/include/globaldata.h,v 1.11.2.1 2000/05/16 06:58:10 dillon Exp $ - * $DragonFly: src/sys/i386/include/Attic/globaldata.h,v 1.5 2003/06/18 18:29:58 dillon Exp $ + * $DragonFly: src/sys/i386/include/Attic/globaldata.h,v 1.6 2003/06/19 01:55:05 dillon Exp $ */ /* @@ -98,3 +98,4 @@ extern struct privatespace SMP_prvspace[]; extern struct globaldata UP_globaldata; #endif + diff --git a/sys/i386/include/globals.h b/sys/i386/include/globals.h index c90f3bf739..91728b4632 100644 --- a/sys/i386/include/globals.h +++ b/sys/i386/include/globals.h @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/include/globals.h,v 1.5.2.1 2000/05/16 06:58:10 dillon Exp $ - * $DragonFly: src/sys/i386/include/Attic/globals.h,v 1.5 2003/06/18 18:29:58 dillon Exp $ + * $DragonFly: src/sys/i386/include/Attic/globals.h,v 1.6 2003/06/19 01:55:05 dillon Exp $ */ #ifndef _MACHINE_GLOBALS_H_ @@ -32,94 +32,36 @@ #ifdef _KERNEL -#define GLOBAL_LVALUE(name, type) \ - (*(type *)_global_ptr_##name()) - -#define GLOBAL_RVALUE(name, type) \ - ((type)_global_##name()) - -/* non-volatile version */ -#define GLOBAL_LVALUE_NV(name, type) \ - (*(type *)_global_ptr_##name##_nv()) - -#define GLOBAL_RVALUE_NV(name, type) \ - ((type)_global_##name##_nv()) - -#define GLOBAL_FUNC(name) \ - static __inline void *_global_ptr_##name(void) { \ - void *val; \ - __asm __volatile("movl $gd_" #name ",%0;" \ - "addl %%fs:globaldata,%0" : "=r" (val)); \ - return (val); \ - } \ - static __inline void *_global_ptr_##name##_nv(void) { \ - void *val; \ - __asm("movl $gd_" #name ",%0;" \ - "addl %%fs:globaldata,%0" : "=r" (val)); \ - return (val); \ - } \ - static __inline int _global_##name(void) { \ - int val; \ - __asm __volatile("movl %%fs:gd_" #name ",%0" : "=r" (val)); \ - return (val); \ - } \ - static __inline int _global_##name##_nv(void) { \ - int val; \ - __asm("movl %%fs:gd_" #name ",%0" : "=r" (val)); \ - return (val); \ - } \ - static __inline void _global_##name##_set(int val) { \ - __asm __volatile("movl %0,%%fs:gd_" #name : : "r" (val)); \ - } \ - static __inline void _global_##name##_set_nv(int val) { \ - __asm("movl %0,%%fs:gd_" #name : : "r" (val)); \ - } - -#if defined(SMP) || defined(KLD_MODULE) || defined(ACTUALLY_LKM_NOT_KERNEL) /* - * The following set of macros works for UP kernel as well, but for maximum - * performance we allow the global variables to be accessed directly. On the - * other hand, kernel modules should always use these macros to maintain - * portability between UP and SMP kernels. + * mycpu() retrieves the base of the current cpu's globaldata structure. + * Note that it is *NOT* volatile, meaning that the value may be cached by + * GCC. We have to force a dummy memory reference so gcc does not cache + * the gd pointer across a procedure call (which might block and cause us + * to wakeup on a different cpu). + * + * Also note that in TurtleBSD a thread can be preempted, but it cannot + * move to another cpu preemptively so the 'gd' pointer is good until you + * block. */ -#define curthread GLOBAL_RVALUE_NV(curthread, struct thread *) -#define idlethread GLOBAL_RVALUE_NV(idlethread, struct thread) -#define npxthread GLOBAL_LVALUE(npxthread, struct thread *) -#define common_tss GLOBAL_LVALUE(common_tss, struct i386tss) -#define switchtime GLOBAL_LVALUE(switchtime, struct timeval) -#define switchticks GLOBAL_LVALUE(switchticks, int) +#if defined(SMP) || defined(KLD_MODULE) || defined(ACTUALLY_LKM_NOT_KERNEL) -#define common_tssd GLOBAL_LVALUE(common_tssd, struct segment_descriptor) -#define tss_gdt GLOBAL_LVALUE(tss_gdt, struct segment_descriptor *) -#define astpending GLOBAL_LVALUE(astpending, u_int) +extern int __mycpu__dummy; -#ifdef USER_LDT -#define currentldt GLOBAL_LVALUE(currentldt, int) -#endif +static __inline +struct globaldata * +_get_mycpu(void) +{ + struct globaldata *gd; -#ifdef SMP -#define cpuid GLOBAL_RVALUE(cpuid, u_int) -#define other_cpus GLOBAL_LVALUE(other_cpus, u_int) -#define inside_intr GLOBAL_LVALUE(inside_intr, int) -#define prv_CMAP1 GLOBAL_LVALUE(prv_CMAP1, pt_entry_t *) -#define prv_CMAP2 GLOBAL_LVALUE(prv_CMAP2, pt_entry_t *) -#define prv_CMAP3 GLOBAL_LVALUE(prv_CMAP3, pt_entry_t *) -#define prv_PMAP1 GLOBAL_LVALUE(prv_PMAP1, pt_entry_t *) -#define prv_CADDR1 GLOBAL_RVALUE(prv_CADDR1, caddr_t) -#define prv_CADDR2 GLOBAL_RVALUE(prv_CADDR2, caddr_t) -#define prv_CADDR3 GLOBAL_RVALUE(prv_CADDR3, caddr_t) -#define prv_PADDR1 GLOBAL_RVALUE(prv_PADDR1, unsigned *) -#endif + __asm ("movl %%fs:globaldata,%0" : "=r" (gd) : "m"(__mycpu__dummy)); + return(gd); +} -#else /*UP kernel*/ -/* - * Otherwise we optimize for direct access in UP - */ -extern struct thread *curthread; /* Current running proc. */ -extern struct thread idlethread; /* Idle thread global */ -extern u_int astpending; /* software interrupt pending */ -extern int switchticks; /* `ticks' at last context switch. */ -extern struct timeval switchtime; /* Uptime at last context switch */ +#define mycpu _get_mycpu() + +#else + +#define mycpu (&UP_globaldata) #endif @@ -127,43 +69,9 @@ extern struct timeval switchtime; /* Uptime at last context switch */ * note: curthread is never NULL, but curproc can be. Also note that * in Turtle, the current pcb is stored in the thread structure. */ +#define curthread (mycpu->gd_curthread) #define curproc (curthread->td_proc) -GLOBAL_FUNC(curthread) -GLOBAL_FUNC(idlethread) -GLOBAL_FUNC(astpending) -GLOBAL_FUNC(npxthread) -GLOBAL_FUNC(common_tss) -GLOBAL_FUNC(switchtime) -GLOBAL_FUNC(switchticks) - -GLOBAL_FUNC(common_tssd) -GLOBAL_FUNC(tss_gdt) - -#ifdef USER_LDT -GLOBAL_FUNC(currentldt) -#endif - -#ifdef SMP -GLOBAL_FUNC(cpuid) -GLOBAL_FUNC(other_cpus) -GLOBAL_FUNC(inside_intr) -GLOBAL_FUNC(prv_CMAP1) -GLOBAL_FUNC(prv_CMAP2) -GLOBAL_FUNC(prv_CMAP3) -GLOBAL_FUNC(prv_PMAP1) -GLOBAL_FUNC(prv_CADDR1) -GLOBAL_FUNC(prv_CADDR2) -GLOBAL_FUNC(prv_CADDR3) -GLOBAL_FUNC(prv_PADDR1) -#endif - -/* - * This is only used in kern/init_main.c and kern/kern_exit.c and should - * be converted to procedures. YYY - */ -#define SET_CURTHREAD(x) (_global_curthread_set_nv((int)x)) -#define CLR_CURPROC() curthread->td_proc = NULL #endif /* _KERNEL */ diff --git a/sys/i386/include/proc.h b/sys/i386/include/proc.h index 9aaaeb4d1e..29a0a2c71c 100644 --- a/sys/i386/include/proc.h +++ b/sys/i386/include/proc.h @@ -32,12 +32,15 @@ * * from: @(#)proc.h 7.1 (Berkeley) 5/15/91 * $FreeBSD: src/sys/i386/include/proc.h,v 1.10 1999/08/28 00:44:21 peter Exp $ - * $DragonFly: src/sys/i386/include/Attic/proc.h,v 1.2 2003/06/17 04:28:36 dillon Exp $ + * $DragonFly: src/sys/i386/include/Attic/proc.h,v 1.3 2003/06/19 01:55:05 dillon Exp $ */ #ifndef _MACHINE_PROC_H_ #define _MACHINE_PROC_H_ +#include +#include +#include #include /* diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 2da952f2d1..9126e827f7 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -40,7 +40,7 @@ * * @(#)init_main.c 8.9 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/init_main.c,v 1.134.2.8 2003/06/06 20:21:32 tegge Exp $ - * $DragonFly: src/sys/kern/init_main.c,v 1.5 2003/06/18 18:30:08 dillon Exp $ + * $DragonFly: src/sys/kern/init_main.c,v 1.6 2003/06/19 01:55:06 dillon Exp $ */ #include "opt_init_path.h" @@ -371,7 +371,7 @@ proc0_init(void *dummy __unused) * Initialize the current process pointer (curproc) before * any possible traps/probes to simplify trap processing. */ - SET_CURTHREAD(p->p_thread); + mycpu->gd_curthread = p->p_thread; } SYSINIT(p0init, SI_SUB_INTRINSIC, SI_ORDER_FIRST, proc0_init, NULL) @@ -391,8 +391,8 @@ proc0_post(void *dummy __unused) microtime(&p->p_stats->p_start); p->p_runtime = 0; } - microuptime(&switchtime); - switchticks = ticks; + microuptime(&mycpu->gd_switchtime); + mycpu->gd_switchticks = ticks; /* * Give the ``random'' number generator a thump. diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 281890927f..af433f9b9e 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -37,7 +37,7 @@ * * @(#)kern_exit.c 8.7 (Berkeley) 2/12/94 * $FreeBSD: src/sys/kern/kern_exit.c,v 1.92.2.11 2003/01/13 22:51:16 dillon Exp $ - * $DragonFly: src/sys/kern/kern_exit.c,v 1.4 2003/06/18 18:30:08 dillon Exp $ + * $DragonFly: src/sys/kern/kern_exit.c,v 1.5 2003/06/19 01:55:06 dillon Exp $ */ #include "opt_compat.h" @@ -324,8 +324,8 @@ exit1(p, rv) * directly. Set it now so that the rest of the exit time gets * counted somewhere if possible. */ - microuptime(&switchtime); - switchticks = ticks; + microuptime(&mycpu->gd_switchtime); + mycpu->gd_switchticks = ticks; /* * notify interested parties of our demise. @@ -370,7 +370,7 @@ exit1(p, rv) * * Other substructures are freed from wait(). */ - CLR_CURPROC(); + mycpu->gd_curthread->td_proc = NULL; if (--p->p_limit->p_refcnt == 0) { FREE(p->p_limit, M_SUBPROC); p->p_limit = NULL; diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index 5f945569a0..d687a03af3 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -37,7 +37,7 @@ * * @(#)kern_resource.c 8.5 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/kern_resource.c,v 1.55.2.5 2001/11/03 01:41:08 ps Exp $ - * $DragonFly: src/sys/kern/kern_resource.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/kern_resource.c,v 1.3 2003/06/19 01:55:06 dillon Exp $ */ #include "opt_compat.h" @@ -537,13 +537,17 @@ calcru(p, up, sp, ip) * quantum, which is much greater than the sampling error. */ microuptime(&tv); - if (timevalcmp(&tv, &switchtime, <)) - printf("microuptime() went backwards (%ld.%06ld -> %ld.%06ld)\n", - switchtime.tv_sec, switchtime.tv_usec, + if (timevalcmp(&tv, &mycpu->gd_switchtime, <)) { + printf("microuptime() went backwards " + "(%ld.%06ld -> %ld.%06ld)\n", + mycpu->gd_switchtime.tv_sec, + mycpu->gd_switchtime.tv_usec, tv.tv_sec, tv.tv_usec); - else - tu += (tv.tv_usec - switchtime.tv_usec) + - (tv.tv_sec - switchtime.tv_sec) * (int64_t)1000000; + } else { + tu += (tv.tv_usec - mycpu->gd_switchtime.tv_usec) + + (tv.tv_sec - mycpu->gd_switchtime.tv_sec) * + (int64_t)1000000; + } } ptu = p->p_uu + p->p_su + p->p_iu; if (tu < ptu || (int64_t)tu < 0) { diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index c7daf1a942..2a1b773530 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -37,7 +37,7 @@ * * @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/kern_shutdown.c,v 1.72.2.12 2002/02/21 19:15:10 dillon Exp $ - * $DragonFly: src/sys/kern/kern_shutdown.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/kern_shutdown.c,v 1.3 2003/06/19 01:55:06 dillon Exp $ */ #include "opt_ddb.h" @@ -62,6 +62,7 @@ #include #include #include +#include #include #include diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c index 5b7941f673..697f02c9f5 100644 --- a/sys/kern/kern_subr.c +++ b/sys/kern/kern_subr.c @@ -37,7 +37,7 @@ * * @(#)kern_subr.c 8.3 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/kern_subr.c,v 1.31.2.2 2002/04/21 08:09:37 bde Exp $ - * $DragonFly: src/sys/kern/kern_subr.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/kern_subr.c,v 1.3 2003/06/19 01:55:06 dillon Exp $ */ #include @@ -89,7 +89,7 @@ uiomove(cp, n, uio) case UIO_USERSPACE: case UIO_USERISPACE: - if (ticks - switchticks >= hogticks) + if (ticks - mycpu->gd_switchticks >= hogticks) uio_yield(); if (uio->uio_rw == UIO_READ) error = copyout(cp, iov->iov_base, cnt); @@ -151,7 +151,7 @@ uiomoveco(cp, n, uio, obj) case UIO_USERSPACE: case UIO_USERISPACE: - if (ticks - switchticks >= hogticks) + if (ticks - mycpu->gd_switchticks >= hogticks) uio_yield(); if (uio->uio_rw == UIO_READ) { #ifdef ENABLE_VFS_IOOPT diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index b2f213c8f2..785fcd3850 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -37,7 +37,7 @@ * * @(#)kern_synch.c 8.9 (Berkeley) 5/19/95 * $FreeBSD: src/sys/kern/kern_synch.c,v 1.87.2.6 2002/10/13 07:29:53 kbyanc Exp $ - * $DragonFly: src/sys/kern/kern_synch.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/kern_synch.c,v 1.3 2003/06/19 01:55:06 dillon Exp $ */ #include "opt_ktrace.h" @@ -840,14 +840,16 @@ mi_switch() * process was running, and add that to its total so far. */ microuptime(&new_switchtime); - if (timevalcmp(&new_switchtime, &switchtime, <)) { + if (timevalcmp(&new_switchtime, &mycpu->gd_switchtime, <)) { printf("microuptime() went backwards (%ld.%06ld -> %ld.%06ld)\n", - switchtime.tv_sec, switchtime.tv_usec, + mycpu->gd_switchtime.tv_sec, mycpu->gd_switchtime.tv_usec, new_switchtime.tv_sec, new_switchtime.tv_usec); - new_switchtime = switchtime; + new_switchtime = mycpu->gd_switchtime; } else { - p->p_runtime += (new_switchtime.tv_usec - switchtime.tv_usec) + - (new_switchtime.tv_sec - switchtime.tv_sec) * (int64_t)1000000; + p->p_runtime += + (new_switchtime.tv_usec - mycpu->gd_switchtime.tv_usec) + + (new_switchtime.tv_sec - mycpu->gd_switchtime.tv_sec) * + (int64_t)1000000; } /* @@ -872,11 +874,11 @@ mi_switch() * Pick a new current process and record its start time. */ cnt.v_swtch++; - switchtime = new_switchtime; + mycpu->gd_switchtime = new_switchtime; cpu_switch(p); - if (switchtime.tv_sec == 0) - microuptime(&switchtime); - switchticks = ticks; + if (mycpu->gd_switchtime.tv_sec == 0) + microuptime(&mycpu->gd_switchtime); + mycpu->gd_switchticks = ticks; splx(x); } diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 150c7faac2..1e6892408c 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -12,7 +12,7 @@ * John S. Dyson. * * $FreeBSD: src/sys/kern/vfs_bio.c,v 1.242.2.20 2003/05/28 18:38:10 alc Exp $ - * $DragonFly: src/sys/kern/vfs_bio.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_bio.c,v 1.3 2003/06/19 01:55:06 dillon Exp $ */ /* @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -52,6 +53,7 @@ #include #include #include +#include static MALLOC_DEFINE(M_BIOBUF, "BIO buffer", "BIO buffer"); diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c index 3fa203155c..1b96990169 100644 --- a/sys/kern/vfs_cluster.c +++ b/sys/kern/vfs_cluster.c @@ -34,7 +34,7 @@ * * @(#)vfs_cluster.c 8.7 (Berkeley) 2/13/94 * $FreeBSD: src/sys/kern/vfs_cluster.c,v 1.92.2.9 2001/11/18 07:10:59 dillon Exp $ - * $DragonFly: src/sys/kern/vfs_cluster.c,v 1.2 2003/06/17 04:28:42 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_cluster.c,v 1.3 2003/06/19 01:55:06 dillon Exp $ */ #include "opt_debug_cluster.h" @@ -53,6 +53,7 @@ #include #include #include +#include #if defined(CLUSTERDEBUG) #include diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 835fc3bfb1..720f9a5cca 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -37,7 +37,7 @@ * * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 * $FreeBSD: src/sys/kern/vfs_subr.c,v 1.249.2.30 2003/04/04 20:35:57 tegge Exp $ - * $DragonFly: src/sys/kern/vfs_subr.c,v 1.2 2003/06/17 04:28:42 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_subr.c,v 1.3 2003/06/19 01:55:06 dillon Exp $ */ /* @@ -80,6 +80,8 @@ #include #include +#include + static MALLOC_DEFINE(M_NETADDR, "Export Host", "Export host address structure"); static void insmntque __P((struct vnode *vp, struct mount *mp)); diff --git a/sys/platform/pc32/i386/genassym.c b/sys/platform/pc32/i386/genassym.c index 7a649691ce..c4465aed92 100644 --- a/sys/platform/pc32/i386/genassym.c +++ b/sys/platform/pc32/i386/genassym.c @@ -35,7 +35,7 @@ * * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 * $FreeBSD: src/sys/i386/i386/genassym.c,v 1.86.2.3 2002/03/03 05:42:49 nyan Exp $ - * $DragonFly: src/sys/platform/pc32/i386/genassym.c,v 1.6 2003/06/18 18:29:55 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/genassym.c,v 1.7 2003/06/19 01:55:05 dillon Exp $ */ #include "opt_user_ldt.h" @@ -71,7 +71,6 @@ #endif #include #include -#include #include ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace)); diff --git a/sys/platform/pc32/i386/machdep.c b/sys/platform/pc32/i386/machdep.c index 3c16990133..b50550e130 100644 --- a/sys/platform/pc32/i386/machdep.c +++ b/sys/platform/pc32/i386/machdep.c @@ -36,7 +36,7 @@ * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 * $FreeBSD: src/sys/i386/i386/machdep.c,v 1.385.2.30 2003/05/31 08:48:05 alc Exp $ - * $DragonFly: src/sys/platform/pc32/i386/machdep.c,v 1.4 2003/06/18 18:29:55 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/machdep.c,v 1.5 2003/06/19 01:55:05 dillon Exp $ */ #include "apm.h" @@ -103,7 +103,6 @@ #ifdef SMP #include #endif -#include #ifdef PERFMON #include #endif diff --git a/sys/platform/pc32/include/globaldata.h b/sys/platform/pc32/include/globaldata.h index 7300d8de63..27fa4b5528 100644 --- a/sys/platform/pc32/include/globaldata.h +++ b/sys/platform/pc32/include/globaldata.h @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/include/globaldata.h,v 1.11.2.1 2000/05/16 06:58:10 dillon Exp $ - * $DragonFly: src/sys/platform/pc32/include/globaldata.h,v 1.5 2003/06/18 18:29:58 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/include/globaldata.h,v 1.6 2003/06/19 01:55:05 dillon Exp $ */ /* @@ -98,3 +98,4 @@ extern struct privatespace SMP_prvspace[]; extern struct globaldata UP_globaldata; #endif + diff --git a/sys/platform/pc32/include/globals.h b/sys/platform/pc32/include/globals.h index f7db4664c9..0ed60dd960 100644 --- a/sys/platform/pc32/include/globals.h +++ b/sys/platform/pc32/include/globals.h @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/include/globals.h,v 1.5.2.1 2000/05/16 06:58:10 dillon Exp $ - * $DragonFly: src/sys/platform/pc32/include/Attic/globals.h,v 1.5 2003/06/18 18:29:58 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/include/Attic/globals.h,v 1.6 2003/06/19 01:55:05 dillon Exp $ */ #ifndef _MACHINE_GLOBALS_H_ @@ -32,94 +32,36 @@ #ifdef _KERNEL -#define GLOBAL_LVALUE(name, type) \ - (*(type *)_global_ptr_##name()) - -#define GLOBAL_RVALUE(name, type) \ - ((type)_global_##name()) - -/* non-volatile version */ -#define GLOBAL_LVALUE_NV(name, type) \ - (*(type *)_global_ptr_##name##_nv()) - -#define GLOBAL_RVALUE_NV(name, type) \ - ((type)_global_##name##_nv()) - -#define GLOBAL_FUNC(name) \ - static __inline void *_global_ptr_##name(void) { \ - void *val; \ - __asm __volatile("movl $gd_" #name ",%0;" \ - "addl %%fs:globaldata,%0" : "=r" (val)); \ - return (val); \ - } \ - static __inline void *_global_ptr_##name##_nv(void) { \ - void *val; \ - __asm("movl $gd_" #name ",%0;" \ - "addl %%fs:globaldata,%0" : "=r" (val)); \ - return (val); \ - } \ - static __inline int _global_##name(void) { \ - int val; \ - __asm __volatile("movl %%fs:gd_" #name ",%0" : "=r" (val)); \ - return (val); \ - } \ - static __inline int _global_##name##_nv(void) { \ - int val; \ - __asm("movl %%fs:gd_" #name ",%0" : "=r" (val)); \ - return (val); \ - } \ - static __inline void _global_##name##_set(int val) { \ - __asm __volatile("movl %0,%%fs:gd_" #name : : "r" (val)); \ - } \ - static __inline void _global_##name##_set_nv(int val) { \ - __asm("movl %0,%%fs:gd_" #name : : "r" (val)); \ - } - -#if defined(SMP) || defined(KLD_MODULE) || defined(ACTUALLY_LKM_NOT_KERNEL) /* - * The following set of macros works for UP kernel as well, but for maximum - * performance we allow the global variables to be accessed directly. On the - * other hand, kernel modules should always use these macros to maintain - * portability between UP and SMP kernels. + * mycpu() retrieves the base of the current cpu's globaldata structure. + * Note that it is *NOT* volatile, meaning that the value may be cached by + * GCC. We have to force a dummy memory reference so gcc does not cache + * the gd pointer across a procedure call (which might block and cause us + * to wakeup on a different cpu). + * + * Also note that in TurtleBSD a thread can be preempted, but it cannot + * move to another cpu preemptively so the 'gd' pointer is good until you + * block. */ -#define curthread GLOBAL_RVALUE_NV(curthread, struct thread *) -#define idlethread GLOBAL_RVALUE_NV(idlethread, struct thread) -#define npxthread GLOBAL_LVALUE(npxthread, struct thread *) -#define common_tss GLOBAL_LVALUE(common_tss, struct i386tss) -#define switchtime GLOBAL_LVALUE(switchtime, struct timeval) -#define switchticks GLOBAL_LVALUE(switchticks, int) +#if defined(SMP) || defined(KLD_MODULE) || defined(ACTUALLY_LKM_NOT_KERNEL) -#define common_tssd GLOBAL_LVALUE(common_tssd, struct segment_descriptor) -#define tss_gdt GLOBAL_LVALUE(tss_gdt, struct segment_descriptor *) -#define astpending GLOBAL_LVALUE(astpending, u_int) +extern int __mycpu__dummy; -#ifdef USER_LDT -#define currentldt GLOBAL_LVALUE(currentldt, int) -#endif +static __inline +struct globaldata * +_get_mycpu(void) +{ + struct globaldata *gd; -#ifdef SMP -#define cpuid GLOBAL_RVALUE(cpuid, u_int) -#define other_cpus GLOBAL_LVALUE(other_cpus, u_int) -#define inside_intr GLOBAL_LVALUE(inside_intr, int) -#define prv_CMAP1 GLOBAL_LVALUE(prv_CMAP1, pt_entry_t *) -#define prv_CMAP2 GLOBAL_LVALUE(prv_CMAP2, pt_entry_t *) -#define prv_CMAP3 GLOBAL_LVALUE(prv_CMAP3, pt_entry_t *) -#define prv_PMAP1 GLOBAL_LVALUE(prv_PMAP1, pt_entry_t *) -#define prv_CADDR1 GLOBAL_RVALUE(prv_CADDR1, caddr_t) -#define prv_CADDR2 GLOBAL_RVALUE(prv_CADDR2, caddr_t) -#define prv_CADDR3 GLOBAL_RVALUE(prv_CADDR3, caddr_t) -#define prv_PADDR1 GLOBAL_RVALUE(prv_PADDR1, unsigned *) -#endif + __asm ("movl %%fs:globaldata,%0" : "=r" (gd) : "m"(__mycpu__dummy)); + return(gd); +} -#else /*UP kernel*/ -/* - * Otherwise we optimize for direct access in UP - */ -extern struct thread *curthread; /* Current running proc. */ -extern struct thread idlethread; /* Idle thread global */ -extern u_int astpending; /* software interrupt pending */ -extern int switchticks; /* `ticks' at last context switch. */ -extern struct timeval switchtime; /* Uptime at last context switch */ +#define mycpu _get_mycpu() + +#else + +#define mycpu (&UP_globaldata) #endif @@ -127,43 +69,9 @@ extern struct timeval switchtime; /* Uptime at last context switch */ * note: curthread is never NULL, but curproc can be. Also note that * in Turtle, the current pcb is stored in the thread structure. */ +#define curthread (mycpu->gd_curthread) #define curproc (curthread->td_proc) -GLOBAL_FUNC(curthread) -GLOBAL_FUNC(idlethread) -GLOBAL_FUNC(astpending) -GLOBAL_FUNC(npxthread) -GLOBAL_FUNC(common_tss) -GLOBAL_FUNC(switchtime) -GLOBAL_FUNC(switchticks) - -GLOBAL_FUNC(common_tssd) -GLOBAL_FUNC(tss_gdt) - -#ifdef USER_LDT -GLOBAL_FUNC(currentldt) -#endif - -#ifdef SMP -GLOBAL_FUNC(cpuid) -GLOBAL_FUNC(other_cpus) -GLOBAL_FUNC(inside_intr) -GLOBAL_FUNC(prv_CMAP1) -GLOBAL_FUNC(prv_CMAP2) -GLOBAL_FUNC(prv_CMAP3) -GLOBAL_FUNC(prv_PMAP1) -GLOBAL_FUNC(prv_CADDR1) -GLOBAL_FUNC(prv_CADDR2) -GLOBAL_FUNC(prv_CADDR3) -GLOBAL_FUNC(prv_PADDR1) -#endif - -/* - * This is only used in kern/init_main.c and kern/kern_exit.c and should - * be converted to procedures. YYY - */ -#define SET_CURTHREAD(x) (_global_curthread_set_nv((int)x)) -#define CLR_CURPROC() curthread->td_proc = NULL #endif /* _KERNEL */ diff --git a/sys/platform/pc32/include/proc.h b/sys/platform/pc32/include/proc.h index 192cefb87d..1809945930 100644 --- a/sys/platform/pc32/include/proc.h +++ b/sys/platform/pc32/include/proc.h @@ -32,12 +32,15 @@ * * from: @(#)proc.h 7.1 (Berkeley) 5/15/91 * $FreeBSD: src/sys/i386/include/proc.h,v 1.10 1999/08/28 00:44:21 peter Exp $ - * $DragonFly: src/sys/platform/pc32/include/proc.h,v 1.2 2003/06/17 04:28:36 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/include/proc.h,v 1.3 2003/06/19 01:55:05 dillon Exp $ */ #ifndef _MACHINE_PROC_H_ #define _MACHINE_PROC_H_ +#include +#include +#include #include /* diff --git a/sys/platform/vkernel/i386/genassym.c b/sys/platform/vkernel/i386/genassym.c index 3205111d52..9f9ab4fa2f 100644 --- a/sys/platform/vkernel/i386/genassym.c +++ b/sys/platform/vkernel/i386/genassym.c @@ -35,7 +35,7 @@ * * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 * $FreeBSD: src/sys/i386/i386/genassym.c,v 1.86.2.3 2002/03/03 05:42:49 nyan Exp $ - * $DragonFly: src/sys/platform/vkernel/i386/genassym.c,v 1.6 2003/06/18 18:29:55 dillon Exp $ + * $DragonFly: src/sys/platform/vkernel/i386/genassym.c,v 1.7 2003/06/19 01:55:05 dillon Exp $ */ #include "opt_user_ldt.h" @@ -71,7 +71,6 @@ #endif #include #include -#include #include ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace)); diff --git a/sys/sys/buf.h b/sys/sys/buf.h index c3bd2858a6..36f674967d 100644 --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -37,7 +37,7 @@ * * @(#)buf.h 8.9 (Berkeley) 3/30/95 * $FreeBSD: src/sys/sys/buf.h,v 1.88.2.10 2003/01/25 19:02:23 dillon Exp $ - * $DragonFly: src/sys/sys/buf.h,v 1.2 2003/06/17 04:28:58 dillon Exp $ + * $DragonFly: src/sys/sys/buf.h,v 1.3 2003/06/19 01:55:07 dillon Exp $ */ #ifndef _SYS_BUF_H_ @@ -257,107 +257,11 @@ struct buf { #ifdef _KERNEL /* - * Buffer locking + * Buffer locking. See sys/buf2.h for inline functions. */ struct simplelock buftimelock; /* Interlock on setting prio and timo */ extern char *buf_wmesg; /* Default buffer lock message */ #define BUF_WMESG "bufwait" -#include /* XXX for curproc */ -/* - * Initialize a lock. - */ -#define BUF_LOCKINIT(bp) \ - lockinit(&(bp)->b_lock, PRIBIO + 4, buf_wmesg, 0, 0) -/* - * - * Get a lock sleeping non-interruptably until it becomes available. - */ -static __inline int BUF_LOCK __P((struct buf *, int)); -static __inline int -BUF_LOCK(struct buf *bp, int locktype) -{ - int s, ret; - - s = splbio(); - simple_lock(&buftimelock); - locktype |= LK_INTERLOCK; - bp->b_lock.lk_wmesg = buf_wmesg; - bp->b_lock.lk_prio = PRIBIO + 4; - /* bp->b_lock.lk_timo = 0; not necessary */ - ret = lockmgr(&(bp)->b_lock, locktype, &buftimelock, curproc); - splx(s); - return ret; -} -/* - * Get a lock sleeping with specified interruptably and timeout. - */ -static __inline int BUF_TIMELOCK __P((struct buf *, int, char *, int, int)); -static __inline int -BUF_TIMELOCK(struct buf *bp, int locktype, char *wmesg, int catch, int timo) -{ - int s, ret; - - s = splbio(); - simple_lock(&buftimelock); - locktype |= LK_INTERLOCK | LK_TIMELOCK; - bp->b_lock.lk_wmesg = wmesg; - bp->b_lock.lk_prio = (PRIBIO + 4) | catch; - bp->b_lock.lk_timo = timo; - ret = lockmgr(&(bp)->b_lock, (locktype), &buftimelock, curproc); - splx(s); - return ret; -} -/* - * Release a lock. Only the acquiring process may free the lock unless - * it has been handed off to biodone. - */ -static __inline void BUF_UNLOCK __P((struct buf *)); -static __inline void -BUF_UNLOCK(struct buf *bp) -{ - int s; - - s = splbio(); - lockmgr(&(bp)->b_lock, LK_RELEASE, NULL, curproc); - splx(s); -} - -/* - * Free a buffer lock. - */ -#define BUF_LOCKFREE(bp) \ - if (BUF_REFCNT(bp) > 0) \ - panic("free locked buf") -/* - * When initiating asynchronous I/O, change ownership of the lock to the - * kernel. Once done, the lock may legally released by biodone. The - * original owning process can no longer acquire it recursively, but must - * wait until the I/O is completed and the lock has been freed by biodone. - */ -static __inline void BUF_KERNPROC __P((struct buf *)); -static __inline void -BUF_KERNPROC(struct buf *bp) -{ - struct proc *p = curproc; - - if (p != NULL && bp->b_lock.lk_lockholder == p->p_pid) - p->p_locks--; - bp->b_lock.lk_lockholder = LK_KERNPROC; -} -/* - * Find out the number of references to a lock. - */ -static __inline int BUF_REFCNT __P((struct buf *)); -static __inline int -BUF_REFCNT(struct buf *bp) -{ - int s, ret; - - s = splbio(); - ret = lockcount(&(bp)->b_lock); - splx(s); - return ret; -} #endif /* _KERNEL */ @@ -382,60 +286,6 @@ struct cluster_save { struct buf **bs_children; /* List of associated buffers. */ }; -#ifdef _KERNEL -static __inline void bufq_init __P((struct buf_queue_head *head)); - -static __inline void bufq_insert_tail __P((struct buf_queue_head *head, - struct buf *bp)); - -static __inline void bufq_remove __P((struct buf_queue_head *head, - struct buf *bp)); - -static __inline struct buf *bufq_first __P((struct buf_queue_head *head)); - -static __inline void -bufq_init(struct buf_queue_head *head) -{ - TAILQ_INIT(&head->queue); - head->last_pblkno = 0; - head->insert_point = NULL; - head->switch_point = NULL; -} - -static __inline void -bufq_insert_tail(struct buf_queue_head *head, struct buf *bp) -{ - if ((bp->b_flags & B_ORDERED) != 0) { - head->insert_point = bp; - head->switch_point = NULL; - } - TAILQ_INSERT_TAIL(&head->queue, bp, b_act); -} - -static __inline void -bufq_remove(struct buf_queue_head *head, struct buf *bp) -{ - if (bp == head->switch_point) - head->switch_point = TAILQ_NEXT(bp, b_act); - if (bp == head->insert_point) { - head->insert_point = TAILQ_PREV(bp, buf_queue, b_act); - if (head->insert_point == NULL) - head->last_pblkno = 0; - } else if (bp == TAILQ_FIRST(&head->queue)) - head->last_pblkno = bp->b_pblkno; - TAILQ_REMOVE(&head->queue, bp, b_act); - if (TAILQ_FIRST(&head->queue) == head->switch_point) - head->switch_point = NULL; -} - -static __inline struct buf * -bufq_first(struct buf_queue_head *head) -{ - return (TAILQ_FIRST(&head->queue)); -} - -#endif /* _KERNEL */ - /* * Definitions for the buffer free lists. */ diff --git a/sys/sys/buf2.h b/sys/sys/buf2.h new file mode 100644 index 0000000000..87fd84cd30 --- /dev/null +++ b/sys/sys/buf2.h @@ -0,0 +1,188 @@ +/* + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)buf.h 8.9 (Berkeley) 3/30/95 + * $FreeBSD: src/sys/sys/buf.h,v 1.88.2.10 2003/01/25 19:02:23 dillon Exp $ + * $DragonFly: src/sys/sys/buf2.h,v 1.1 2003/06/19 01:55:07 dillon Exp $ + */ + +#ifndef _SYS_BUF2_H_ +#define _SYS_BUF2_H_ + +#ifdef _KERNEL + +/* + * Initialize a lock. + */ +#define BUF_LOCKINIT(bp) \ + lockinit(&(bp)->b_lock, PRIBIO + 4, buf_wmesg, 0, 0) + +/* + * + * Get a lock sleeping non-interruptably until it becomes available. + */ +static __inline int BUF_LOCK __P((struct buf *, int)); +static __inline int +BUF_LOCK(struct buf *bp, int locktype) +{ + int s, ret; + + s = splbio(); + simple_lock(&buftimelock); + locktype |= LK_INTERLOCK; + bp->b_lock.lk_wmesg = buf_wmesg; + bp->b_lock.lk_prio = PRIBIO + 4; + /* bp->b_lock.lk_timo = 0; not necessary */ + ret = lockmgr(&(bp)->b_lock, locktype, &buftimelock, curproc); + splx(s); + return ret; +} +/* + * Get a lock sleeping with specified interruptably and timeout. + */ +static __inline int BUF_TIMELOCK __P((struct buf *, int, char *, int, int)); +static __inline int +BUF_TIMELOCK(struct buf *bp, int locktype, char *wmesg, int catch, int timo) +{ + int s, ret; + + s = splbio(); + simple_lock(&buftimelock); + locktype |= LK_INTERLOCK | LK_TIMELOCK; + bp->b_lock.lk_wmesg = wmesg; + bp->b_lock.lk_prio = (PRIBIO + 4) | catch; + bp->b_lock.lk_timo = timo; + ret = lockmgr(&(bp)->b_lock, (locktype), &buftimelock, curproc); + splx(s); + return ret; +} +/* + * Release a lock. Only the acquiring process may free the lock unless + * it has been handed off to biodone. + */ +static __inline void BUF_UNLOCK __P((struct buf *)); +static __inline void +BUF_UNLOCK(struct buf *bp) +{ + int s; + + s = splbio(); + lockmgr(&(bp)->b_lock, LK_RELEASE, NULL, curproc); + splx(s); +} + +/* + * Free a buffer lock. + */ +#define BUF_LOCKFREE(bp) \ + if (BUF_REFCNT(bp) > 0) \ + panic("free locked buf") +/* + * When initiating asynchronous I/O, change ownership of the lock to the + * kernel. Once done, the lock may legally released by biodone. The + * original owning process can no longer acquire it recursively, but must + * wait until the I/O is completed and the lock has been freed by biodone. + */ +static __inline void BUF_KERNPROC __P((struct buf *)); +static __inline void +BUF_KERNPROC(struct buf *bp) +{ + struct proc *p = curproc; + + if (p != NULL && bp->b_lock.lk_lockholder == p->p_pid) + p->p_locks--; + bp->b_lock.lk_lockholder = LK_KERNPROC; +} +/* + * Find out the number of references to a lock. + */ +static __inline int BUF_REFCNT __P((struct buf *)); +static __inline int +BUF_REFCNT(struct buf *bp) +{ + int s, ret; + + s = splbio(); + ret = lockcount(&(bp)->b_lock); + splx(s); + return ret; +} + +static __inline void +bufq_init(struct buf_queue_head *head) +{ + TAILQ_INIT(&head->queue); + head->last_pblkno = 0; + head->insert_point = NULL; + head->switch_point = NULL; +} + +static __inline void +bufq_insert_tail(struct buf_queue_head *head, struct buf *bp) +{ + if ((bp->b_flags & B_ORDERED) != 0) { + head->insert_point = bp; + head->switch_point = NULL; + } + TAILQ_INSERT_TAIL(&head->queue, bp, b_act); +} + +static __inline void +bufq_remove(struct buf_queue_head *head, struct buf *bp) +{ + if (bp == head->switch_point) + head->switch_point = TAILQ_NEXT(bp, b_act); + if (bp == head->insert_point) { + head->insert_point = TAILQ_PREV(bp, buf_queue, b_act); + if (head->insert_point == NULL) + head->last_pblkno = 0; + } else if (bp == TAILQ_FIRST(&head->queue)) + head->last_pblkno = bp->b_pblkno; + TAILQ_REMOVE(&head->queue, bp, b_act); + if (TAILQ_FIRST(&head->queue) == head->switch_point) + head->switch_point = NULL; +} + +static __inline struct buf * +bufq_first(struct buf_queue_head *head) +{ + return (TAILQ_FIRST(&head->queue)); +} + +#endif /* _KERNEL */ + +#endif /* !_SYS_BUF2_H_ */ diff --git a/sys/sys/proc.h b/sys/sys/proc.h index ae9b849553..a5a0e5d378 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -37,13 +37,12 @@ * * @(#)proc.h 8.15 (Berkeley) 5/19/95 * $FreeBSD: src/sys/sys/proc.h,v 1.99.2.9 2003/06/06 20:21:32 tegge Exp $ - * $DragonFly: src/sys/sys/proc.h,v 1.5 2003/06/18 18:30:11 dillon Exp $ + * $DragonFly: src/sys/sys/proc.h,v 1.6 2003/06/19 01:55:07 dillon Exp $ */ #ifndef _SYS_PROC_H_ #define _SYS_PROC_H_ -#include /* Machine-dependent proc substruct. */ #include /* For struct callout_handle. */ #include #include @@ -54,8 +53,8 @@ #endif #include #include /* For struct klist */ - #include +#include /* Machine-dependent proc substruct. */ /* * One structure allocated per session. diff --git a/sys/vfs/mfs/mfs_vfsops.c b/sys/vfs/mfs/mfs_vfsops.c index 75e5b57e7d..a906984407 100644 --- a/sys/vfs/mfs/mfs_vfsops.c +++ b/sys/vfs/mfs/mfs_vfsops.c @@ -32,7 +32,7 @@ * * @(#)mfs_vfsops.c 8.11 (Berkeley) 6/19/95 * $FreeBSD: src/sys/ufs/mfs/mfs_vfsops.c,v 1.81.2.3 2001/07/04 17:35:21 tegge Exp $ - * $DragonFly: src/sys/vfs/mfs/mfs_vfsops.c,v 1.2 2003/06/17 04:28:59 dillon Exp $ + * $DragonFly: src/sys/vfs/mfs/mfs_vfsops.c,v 1.3 2003/06/19 01:55:08 dillon Exp $ */ @@ -50,6 +50,8 @@ #include #include +#include + #include #include #include diff --git a/sys/vfs/mfs/mfs_vnops.c b/sys/vfs/mfs/mfs_vnops.c index 852d2391cf..ff599c7afa 100644 --- a/sys/vfs/mfs/mfs_vnops.c +++ b/sys/vfs/mfs/mfs_vnops.c @@ -32,7 +32,7 @@ * * @(#)mfs_vnops.c 8.11 (Berkeley) 5/22/95 * $FreeBSD: src/sys/ufs/mfs/mfs_vnops.c,v 1.47.2.1 2001/05/22 02:06:43 bp Exp $ - * $DragonFly: src/sys/vfs/mfs/mfs_vnops.c,v 1.2 2003/06/17 04:28:59 dillon Exp $ + * $DragonFly: src/sys/vfs/mfs/mfs_vnops.c,v 1.3 2003/06/19 01:55:08 dillon Exp $ */ #include @@ -46,6 +46,8 @@ #include #include +#include + #include #include diff --git a/sys/vfs/msdosfs/msdosfs_vnops.c b/sys/vfs/msdosfs/msdosfs_vnops.c index ce7d3ef54a..08f0f79c8c 100644 --- a/sys/vfs/msdosfs/msdosfs_vnops.c +++ b/sys/vfs/msdosfs/msdosfs_vnops.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/msdosfs/msdosfs_vnops.c,v 1.95.2.4 2003/06/13 15:05:47 trhodes Exp $ */ -/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_vnops.c,v 1.2 2003/06/17 04:28:47 dillon Exp $ */ +/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_vnops.c,v 1.3 2003/06/19 01:55:06 dillon Exp $ */ /* $NetBSD: msdosfs_vnops.c,v 1.68 1998/02/10 14:10:04 mrg Exp $ */ /*- @@ -69,6 +69,8 @@ #include #include +#include + #include #include #include diff --git a/sys/vfs/nfs/nfs_bio.c b/sys/vfs/nfs/nfs_bio.c index fb3b5db899..7fde3d4db9 100644 --- a/sys/vfs/nfs/nfs_bio.c +++ b/sys/vfs/nfs/nfs_bio.c @@ -35,7 +35,7 @@ * * @(#)nfs_bio.c 8.9 (Berkeley) 3/30/95 * $FreeBSD: src/sys/nfs/nfs_bio.c,v 1.83.2.4 2002/12/29 18:19:53 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_bio.c,v 1.2 2003/06/17 04:28:54 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_bio.c,v 1.3 2003/06/19 01:55:07 dillon Exp $ */ @@ -56,6 +56,8 @@ #include #include +#include + #include #include #include diff --git a/sys/vfs/nfs/nfs_serv.c b/sys/vfs/nfs/nfs_serv.c index ac17748293..3e5838e66c 100644 --- a/sys/vfs/nfs/nfs_serv.c +++ b/sys/vfs/nfs/nfs_serv.c @@ -35,7 +35,7 @@ * * @(#)nfs_serv.c 8.8 (Berkeley) 7/31/95 * $FreeBSD: src/sys/nfs/nfs_serv.c,v 1.93.2.6 2002/12/29 18:19:53 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_serv.c,v 1.2 2003/06/17 04:28:54 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_serv.c,v 1.3 2003/06/19 01:55:07 dillon Exp $ */ /* @@ -93,6 +93,8 @@ #include #include +#include + #include #include #include diff --git a/sys/vfs/nfs/nfs_subs.c b/sys/vfs/nfs/nfs_subs.c index 73655efeec..62eb7577c5 100644 --- a/sys/vfs/nfs/nfs_subs.c +++ b/sys/vfs/nfs/nfs_subs.c @@ -35,7 +35,7 @@ * * @(#)nfs_subs.c 8.8 (Berkeley) 5/22/95 * $FreeBSD: src/sys/nfs/nfs_subs.c,v 1.90.2.2 2001/10/25 19:18:53 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_subs.c,v 1.2 2003/06/17 04:28:54 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_subs.c,v 1.3 2003/06/19 01:55:07 dillon Exp $ */ /* @@ -64,6 +64,8 @@ #include #include +#include + #include #include #include diff --git a/sys/vfs/nfs/nfs_vnops.c b/sys/vfs/nfs/nfs_vnops.c index e4d206ed3a..cafbc346de 100644 --- a/sys/vfs/nfs/nfs_vnops.c +++ b/sys/vfs/nfs/nfs_vnops.c @@ -35,7 +35,7 @@ * * @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95 * $FreeBSD: src/sys/nfs/nfs_vnops.c,v 1.150.2.5 2001/12/20 19:56:28 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_vnops.c,v 1.2 2003/06/17 04:28:54 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_vnops.c,v 1.3 2003/06/19 01:55:07 dillon Exp $ */ @@ -68,6 +68,8 @@ #include #include +#include + #include #include diff --git a/sys/vfs/specfs/spec_vnops.c b/sys/vfs/specfs/spec_vnops.c index e290caf744..0b479528b2 100644 --- a/sys/vfs/specfs/spec_vnops.c +++ b/sys/vfs/specfs/spec_vnops.c @@ -32,7 +32,7 @@ * * @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95 * $FreeBSD: src/sys/miscfs/specfs/spec_vnops.c,v 1.131.2.4 2001/02/26 04:23:20 jlemon Exp $ - * $DragonFly: src/sys/vfs/specfs/spec_vnops.c,v 1.2 2003/06/17 04:28:42 dillon Exp $ + * $DragonFly: src/sys/vfs/specfs/spec_vnops.c,v 1.3 2003/06/19 01:55:06 dillon Exp $ */ #include @@ -53,6 +53,8 @@ #include #include +#include + static int spec_advlock __P((struct vop_advlock_args *)); static int spec_bmap __P((struct vop_bmap_args *)); static int spec_close __P((struct vop_close_args *)); diff --git a/sys/vfs/ufs/ffs_balloc.c b/sys/vfs/ufs/ffs_balloc.c index 4ecde27cad..580b89b269 100644 --- a/sys/vfs/ufs/ffs_balloc.c +++ b/sys/vfs/ufs/ffs_balloc.c @@ -32,11 +32,12 @@ * * @(#)ffs_balloc.c 8.8 (Berkeley) 6/16/95 * $FreeBSD: src/sys/ufs/ffs/ffs_balloc.c,v 1.26.2.1 2002/10/10 19:48:20 dillon Exp $ - * $DragonFly: src/sys/vfs/ufs/ffs_balloc.c,v 1.2 2003/06/17 04:28:59 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/ffs_balloc.c,v 1.3 2003/06/19 01:55:08 dillon Exp $ */ #include #include +#include #include #include #include diff --git a/sys/vfs/ufs/ffs_softdep.c b/sys/vfs/ufs/ffs_softdep.c index a1bbf6e583..dc90cdab61 100644 --- a/sys/vfs/ufs/ffs_softdep.c +++ b/sys/vfs/ufs/ffs_softdep.c @@ -37,7 +37,7 @@ * * from: @(#)ffs_softdep.c 9.59 (McKusick) 6/21/00 * $FreeBSD: src/sys/ufs/ffs/ffs_softdep.c,v 1.57.2.11 2002/02/05 18:46:53 dillon Exp $ - * $DragonFly: src/sys/vfs/ufs/ffs_softdep.c,v 1.2 2003/06/17 04:28:59 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/ffs_softdep.c,v 1.3 2003/06/19 01:55:08 dillon Exp $ */ /* @@ -60,6 +60,7 @@ #include #include #include +#include #include #include #include diff --git a/sys/vfs/ufs/ffs_vnops.c b/sys/vfs/ufs/ffs_vnops.c index e41ea5ba92..52052e7701 100644 --- a/sys/vfs/ufs/ffs_vnops.c +++ b/sys/vfs/ufs/ffs_vnops.c @@ -32,7 +32,7 @@ * * @(#)ffs_vnops.c 8.15 (Berkeley) 5/14/95 * $FreeBSD: src/sys/ufs/ffs/ffs_vnops.c,v 1.64 2000/01/10 12:04:25 phk Exp $ - * $DragonFly: src/sys/vfs/ufs/ffs_vnops.c,v 1.2 2003/06/17 04:28:59 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/ffs_vnops.c,v 1.3 2003/06/19 01:55:08 dillon Exp $ */ #include @@ -54,6 +54,8 @@ #include #include +#include + #include #include #include diff --git a/sys/vfs/ufs/ufs_disksubr.c b/sys/vfs/ufs/ufs_disksubr.c index ce258b8a00..268b77c1e9 100644 --- a/sys/vfs/ufs/ufs_disksubr.c +++ b/sys/vfs/ufs/ufs_disksubr.c @@ -37,17 +37,20 @@ * * @(#)ufs_disksubr.c 8.5 (Berkeley) 1/21/94 * $FreeBSD: src/sys/ufs/ufs/ufs_disksubr.c,v 1.44.2.3 2001/03/05 05:42:19 obrien Exp $ - * $DragonFly: src/sys/vfs/ufs/Attic/ufs_disksubr.c,v 1.2 2003/06/17 04:28:59 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/Attic/ufs_disksubr.c,v 1.3 2003/06/19 01:55:08 dillon Exp $ */ #include #include +#include #include #include #include #include #include +#include + /* * Seek sort for disks. * diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index bb2a36ddb8..cc61fe2214 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -65,7 +65,7 @@ * @(#)swap_pager.c 8.9 (Berkeley) 3/21/94 * * $FreeBSD: src/sys/vm/swap_pager.c,v 1.130.2.12 2002/08/31 21:15:55 dillon Exp $ - * $DragonFly: src/sys/vm/swap_pager.c,v 1.2 2003/06/17 04:29:00 dillon Exp $ + * $DragonFly: src/sys/vm/swap_pager.c,v 1.3 2003/06/19 01:55:08 dillon Exp $ */ #include @@ -98,6 +98,8 @@ #include #include +#include + #define SWM_FREE 0x02 /* free, period */ #define SWM_POP 0x04 /* pop out */ diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 230aa7c04f..870f52cd87 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -62,7 +62,7 @@ * rights to redistribute these changes. * * $FreeBSD: src/sys/vm/vm_pager.c,v 1.54.2.2 2001/11/18 07:11:00 dillon Exp $ - * $DragonFly: src/sys/vm/vm_pager.c,v 1.2 2003/06/17 04:29:00 dillon Exp $ + * $DragonFly: src/sys/vm/vm_pager.c,v 1.3 2003/06/19 01:55:08 dillon Exp $ */ /* @@ -86,6 +86,8 @@ #include #include +#include + MALLOC_DEFINE(M_VMPGDATA, "VM pgdata", "XXX: VM pager private data"); extern struct pagerops defaultpagerops; -- 2.41.0