diff options
author | Garrett D'Amore <garrett@nexenta.com> | 2011-01-19 08:06:56 -0800 |
---|---|---|
committer | Garrett D'Amore <garrett@nexenta.com> | 2011-01-19 08:06:56 -0800 |
commit | c7c6ab2a4af23be725dea6dacf112b0b9f3fe26f (patch) | |
tree | 1750ae875f07b48b0cb3debc6bc6f321fc9fdc6b /usr/src | |
parent | a3002e0aebb2c7fba71fcbbba97ad98ab8340dc4 (diff) | |
download | illumos-gate-c7c6ab2a4af23be725dea6dacf112b0b9f3fe26f.tar.gz |
536 hat_getkpfnum needs to be removed
Reviewed by: gwr@nexenta.com
Reviewed by: trisk@nexenta.com
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/uts/common/Makefile.files | 6 | ||||
-rw-r--r-- | usr/src/uts/common/vm/hat.c | 149 | ||||
-rw-r--r-- | usr/src/uts/common/vm/hat.h | 20 | ||||
-rw-r--r-- | usr/src/uts/i86pc/vm/hat_i86.c | 44 | ||||
-rw-r--r-- | usr/src/uts/sfmmu/vm/hat_sfmmu.c | 66 | ||||
-rw-r--r-- | usr/src/uts/sfmmu/vm/hat_sfmmu.h | 2 | ||||
-rw-r--r-- | usr/src/uts/sun4/sys/fcode.h | 4 | ||||
-rw-r--r-- | usr/src/uts/sun4u/starcat/os/starcat.c | 9 |
8 files changed, 15 insertions, 285 deletions
diff --git a/usr/src/uts/common/Makefile.files b/usr/src/uts/common/Makefile.files index ce0e8ee604..ec5dde4c13 100644 --- a/usr/src/uts/common/Makefile.files +++ b/usr/src/uts/common/Makefile.files @@ -190,7 +190,6 @@ GENUNIX_OBJS += \ gid.o \ groups.o \ grow.o \ - hat.o \ hat_refmod.o \ id32.o \ id_space.o \ @@ -1939,11 +1938,6 @@ NXGE_HCALL_OBJS = \ # KICONV_EMEA_OBJS += kiconv_emea.o -# -# blk2scsa -# -BLK2SCSA_OBJS = blk2scsa.o - KICONV_JA_OBJS += kiconv_ja.o KICONV_KO_OBJS += kiconv_cck_common.o kiconv_ko.o diff --git a/usr/src/uts/common/vm/hat.c b/usr/src/uts/common/vm/hat.c deleted file mode 100644 index 8ecf77b3f8..0000000000 --- a/usr/src/uts/common/vm/hat.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/param.h> -#include <sys/kmem.h> -#include <sys/sysmacros.h> -#include <sys/cmn_err.h> -#include <sys/systm.h> -#include <sys/modctl.h> -#include <sys/kobj.h> -#include <vm/hat.h> - -/* - * PSARC 2004/405 made hat_getkpfnum(9F) obsolete. As part of the - * obsolecense, the original documented behavior will begin to be - * enforced in the future; namely, hat_getkpfnum(9F) may _only_ - * be called with device-mapped memory virtual addresses. Since - * changing hat_getkpfnum(9F) to return PFN_INVALID on kernel memory - * would break a lot of modules without any warning, we've implemented - * the following mechanism as a stop-gap. In a future release, this - * can all be ripped out and hat_getkpfnum(9F) changed to return - * PFN_INVALID if it isn't called with a device-mapped memory address. - * - * We keep track of each module that has used hat_getkpfnum(9F) - * incorrectly. This allows us to avoid flooding the console/logs - * with too many warnings about a bad module that has already been - * flagged. - * - * On amd64 hat_getkpfnum() is never supported. - */ - -#if !defined(__amd64) - -#define HAT_STACK_MAXDEPTH 15 - -struct badcall_node { - char *bc_modname; - int bc_stackdepth; - pc_t bc_callstack[HAT_STACK_MAXDEPTH]; - struct badcall_node *bc_linkage; -}; - -static struct badcall_node *bad_getkpfnum_callers; - -/* - * Common VM HAT routines. - */ - -static void -printwarn(struct badcall_node *bc) -{ - int sf; - char *ksym; - ulong_t off; - - cmn_err(CE_WARN, "Module %s is using the obsolete hat_getkpfnum(9F)", - bc->bc_modname); - cmn_err(CE_CONT, "interface in a way that will not be supported in\n"); - cmn_err(CE_CONT, "a future release of Solaris. Please contact the\n"); - cmn_err(CE_CONT, "vendor that supplied the module for assistance,\n"); - cmn_err(CE_CONT, "or consult the Writing Device Drivers guide,\n"); - cmn_err(CE_CONT, "available from http://www.sun.com for migration\n"); - cmn_err(CE_CONT, "advice.\n"); - cmn_err(CE_CONT, "---\n"); - cmn_err(CE_CONT, "Callstack of bad caller:\n"); - - for (sf = 0; sf < bc->bc_stackdepth; sf++) { - ksym = kobj_getsymname(bc->bc_callstack[sf], &off); - cmn_err(CE_CONT, "\t%s+%lx\n", ksym? ksym : "?", off); - } -} - - -void -hat_getkpfnum_badcall(void *caller) -{ - struct badcall_node bcs; - char *modname = mod_containing_pc((caddr_t)caller); - struct badcall_node *bc; - -#ifdef __sparc - /* - * This is a hack until the ifb and jfb framebuffer drivers - * are fixed. Right now they use hat_getkpfnum() in a way that - * is really safe but will be incorrectly flagged as being - * buggy. - */ - if (strcmp(modname, "ifb") == 0 || strcmp(modname, "jfb") == 0) - return; -#elif defined(__i386) - /* - * This is a hack until these ethernet drivers can be fixed - * or EOL'd. hat_getkpfnum() will continue to work correctly - * until this list can be removed. - */ - if (strcmp(modname, "dnet") == 0 || strcmp(modname, "pcn") == 0 || - strcmp(modname, "adp") == 0) - return; -#endif /* __sparc / __i386 */ - - for (bc = bad_getkpfnum_callers; bc != NULL; bc = bc->bc_linkage) - if (strcmp(bc->bc_modname, modname) == 0) - return; - - /* - * We haven't seen this caller before, so create a log of - * the callstack and module name, and emit a warning to the - * user. - */ - bc = kmem_zalloc(sizeof (struct badcall_node), KM_NOSLEEP); - if (bc != NULL) { - bc->bc_linkage = bad_getkpfnum_callers; - bc->bc_modname = modname; - bad_getkpfnum_callers = bc; - } else { - bc = &bcs; - bc->bc_modname = modname; - } - - bc->bc_stackdepth = getpcstack(bc->bc_callstack, HAT_STACK_MAXDEPTH); - - printwarn(bc); -} -#endif /* __amd64 */ diff --git a/usr/src/uts/common/vm/hat.h b/usr/src/uts/common/vm/hat.h index bed40f63d9..1d91475e38 100644 --- a/usr/src/uts/common/vm/hat.h +++ b/usr/src/uts/common/vm/hat.h @@ -181,10 +181,6 @@ void hat_thread_exit(kthread_t *); * pfn_t hat_getpfnum(hat, addr) * returns pfn for <hat, addr> or PFN_INVALID if mapping is invalid. * - * pfn_t hat_getkpfnum(addr) - * returns pfn for non-memory mapped addr in kernel address space - * or PFN_INVALID if mapping is invalid or is kernel memory. - * * int hat_probe(hat, addr) * return 0 if no valid mapping is present. Faster version * of hat_getattr in certain architectures. @@ -239,15 +235,6 @@ pfn_t va_to_pfn(void *); uint64_t va_to_pa(void *); /* - * hat_getkpfnum() is never supported on amd64 and will be - * removed from other platforms in future release - */ -#if !defined(__amd64) -pfn_t hat_getkpfnum(caddr_t); -#endif - - -/* * Kernel Physical Mapping (segkpm) hat interface routines. */ caddr_t hat_kpm_mapin(struct page *, struct kpme *); @@ -519,13 +506,6 @@ void hat_freestat(struct as *, int); void hat_resvstat(size_t, struct as *, caddr_t); /* - * Transitionary routine while we still allow hat_getkpfnum(caddr_t) - * to return a pfn for kernel memory, but want to warn the user that - * it isn't supported. - */ -void hat_getkpfnum_badcall(void *caller); - -/* * Relocation callback routines. Currently only sfmmu HAT supports * these. */ diff --git a/usr/src/uts/i86pc/vm/hat_i86.c b/usr/src/uts/i86pc/vm/hat_i86.c index bc8e3e197f..8da02a4c36 100644 --- a/usr/src/uts/i86pc/vm/hat_i86.c +++ b/usr/src/uts/i86pc/vm/hat_i86.c @@ -25,7 +25,9 @@ * Copyright (c) 2010, Intel Corporation. * All rights reserved. */ - +/* + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + */ /* * VM - Hardware Address Translation management for i386 and amd64 @@ -2806,46 +2808,6 @@ hat_getpfnum(hat_t *hat, caddr_t addr) } /* - * hat_getkpfnum() is an obsolete DDI routine, and its use is discouraged. - * Use hat_getpfnum(kas.a_hat, ...) instead. - * - * We'd like to return PFN_INVALID if the mappings have underlying page_t's - * but can't right now due to the fact that some software has grown to use - * this interface incorrectly. So for now when the interface is misused, - * return a warning to the user that in the future it won't work in the - * way they're abusing it, and carry on. - * - * Note that hat_getkpfnum() is never supported on amd64. - */ -#if !defined(__amd64) -pfn_t -hat_getkpfnum(caddr_t addr) -{ - pfn_t pfn; - int badcaller = 0; - - if (khat_running == 0) - panic("hat_getkpfnum(): called too early\n"); - if ((uintptr_t)addr < kernelbase) - return (PFN_INVALID); - - XPV_DISALLOW_MIGRATE(); - if (segkpm && IS_KPM_ADDR(addr)) { - badcaller = 1; - pfn = hat_kpm_va2pfn(addr); - } else { - pfn = hat_getpfnum(kas.a_hat, addr); - badcaller = pf_is_memory(pfn); - } - - if (badcaller) - hat_getkpfnum_badcall(caller()); - XPV_ALLOW_MIGRATE(); - return (pfn); -} -#endif /* __amd64 */ - -/* * int hat_probe(hat, addr) * return 0 if no valid mapping is present. Faster version * of hat_getattr in certain architectures. diff --git a/usr/src/uts/sfmmu/vm/hat_sfmmu.c b/usr/src/uts/sfmmu/vm/hat_sfmmu.c index d457c9924f..d590764927 100644 --- a/usr/src/uts/sfmmu/vm/hat_sfmmu.c +++ b/usr/src/uts/sfmmu/vm/hat_sfmmu.c @@ -21,6 +21,9 @@ /* * Copyright (c) 1993, 2010, Oracle and/or its affiliates. All rights reserved. */ +/* + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + */ /* * VM - Hardware Address Translation management for Spitfire MMU. @@ -372,14 +375,6 @@ static id_t sfmmu_cb_nextid = 0; static id_t sfmmu_tsb_cb_id; struct sfmmu_callback *sfmmu_cb_table; -/* - * Kernel page relocation is enabled by default for non-caged - * kernel pages. This has little effect unless segkmem_reloc is - * set, since by default kernel memory comes from inside the - * kernel cage. - */ -int hat_kpr_enabled = 1; - kmutex_t kpr_mutex; kmutex_t kpr_suspendlock; kthread_t *kreloc_thread; @@ -6876,7 +6871,7 @@ hat_page_relocate(page_t **target, page_t **replacement, spgcnt_t *nrelocp) int cflags = 0; #endif - if (hat_kpr_enabled == 0 || !kcage_on || PP_ISNORELOC(*target)) { + if (!kcage_on || PP_ISNORELOC(*target)) { PAGE_RELOCATE_LOG(target, replacement, EAGAIN, -1); return (EAGAIN); } @@ -7922,7 +7917,7 @@ sfmmu_check_kpfn(pfn_t pfn) if (hat_check_vtop == 0) return; - if (hat_kpr_enabled == 0 || kvseg.s_base == NULL || panicstr) + if (kvseg.s_base == NULL || panicstr) return; pp = page_numtopp_nolock(pfn); @@ -8014,57 +8009,6 @@ hat_getpfnum(struct hat *hat, caddr_t addr) } /* - * hat_getkpfnum() is an obsolete DDI routine, and its use is discouraged. - * Use hat_getpfnum(kas.a_hat, ...) instead. - * - * We'd like to return PFN_INVALID if the mappings have underlying page_t's - * but can't right now due to the fact that some software has grown to use - * this interface incorrectly. So for now when the interface is misused, - * return a warning to the user that in the future it won't work in the - * way they're abusing it, and carry on (after disabling page relocation). - */ -pfn_t -hat_getkpfnum(caddr_t addr) -{ - pfn_t pfn; - tte_t tte; - int badcaller = 0; - extern int segkmem_reloc; - - if (segkpm && IS_KPM_ADDR(addr)) { - badcaller = 1; - pfn = sfmmu_kpm_vatopfn(addr); - } else { - while ((pfn = sfmmu_vatopfn(addr, ksfmmup, &tte)) - == PFN_SUSPENDED) { - sfmmu_vatopfn_suspended(addr, ksfmmup, &tte); - } - badcaller = pf_is_memory(pfn); - } - - if (badcaller) { - /* - * We can't return PFN_INVALID or the caller may panic - * or corrupt the system. The only alternative is to - * disable page relocation at this point for all kernel - * memory. This will impact any callers of page_relocate() - * such as FMA or DR. - * - * RFE: Add junk here to spit out an ereport so the sysadmin - * can be advised that he should upgrade his device driver - * so that this doesn't happen. - */ - hat_getkpfnum_badcall(caller()); - if (hat_kpr_enabled && segkmem_reloc) { - hat_kpr_enabled = 0; - segkmem_reloc = 0; - cmn_err(CE_WARN, "Kernel Page Relocation is DISABLED"); - } - } - return (pfn); -} - -/* * This routine will return both pfn and tte for the vaddr. */ static pfn_t diff --git a/usr/src/uts/sfmmu/vm/hat_sfmmu.h b/usr/src/uts/sfmmu/vm/hat_sfmmu.h index 14a0f126c8..337a93704d 100644 --- a/usr/src/uts/sfmmu/vm/hat_sfmmu.h +++ b/usr/src/uts/sfmmu/vm/hat_sfmmu.h @@ -1084,8 +1084,6 @@ struct sfmmu_callback { extern int sfmmu_max_cb_id; extern struct sfmmu_callback *sfmmu_cb_table; -extern int hat_kpr_enabled; - struct pa_hment; /* diff --git a/usr/src/uts/sun4/sys/fcode.h b/usr/src/uts/sun4/sys/fcode.h index 2e2887c142..f900370d9a 100644 --- a/usr/src/uts/sun4/sys/fcode.h +++ b/usr/src/uts/sun4/sys/fcode.h @@ -26,8 +26,6 @@ #ifndef _SYS_FCODE_H #define _SYS_FCODE_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/sysmacros.h> #include <sys/ddi.h> #include <sys/sunddi.h> @@ -160,7 +158,7 @@ typedef struct fc_client_interface fc_ci_t; /* * FC_GET_FCODE_DATA: This ioctl allows userland portion of the fcode * interpreter to get the fcode into a local buffer without having - * to use mmap() interface (which calls hat_getkpfnum() routine). + * to use mmap() interface. * This allows DR kernel cage memory to be relocated while this * fcode buffer is allocated. * diff --git a/usr/src/uts/sun4u/starcat/os/starcat.c b/usr/src/uts/sun4u/starcat/os/starcat.c index 3a3fe9abc3..0fdcba26b8 100644 --- a/usr/src/uts/sun4u/starcat/os/starcat.c +++ b/usr/src/uts/sun4u/starcat/os/starcat.c @@ -23,6 +23,10 @@ * Use is subject to license terms. */ +/* + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + */ + #include <sys/param.h> #include <sys/systm.h> #include <sys/sysmacros.h> @@ -178,7 +182,7 @@ set_platform_defaults(void) /* * KPR (kernel page relocation) is supported on this platform. */ - if (hat_kpr_enabled && kernel_cage_enable && ncpunode >= 32) { + if (kernel_cage_enable && ncpunode >= 32) { segkmem_reloc = 1; cmn_err(CE_NOTE, "!Kernel Page Relocation is ENABLED"); } else { @@ -1318,8 +1322,7 @@ plat_lpkmem_is_supported(void) { extern int segkmem_reloc; - if (hat_kpr_enabled && kernel_cage_enable && - (ncpunode >= 32 || segkmem_reloc == 1)) + if (kernel_cage_enable && (ncpunode >= 32 || segkmem_reloc == 1)) return (0); return (1); |