Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Convert tsleep(&lbolt) to kpause(). Make ltsleep/mtslee...
details: https://anonhg.NetBSD.org/src/rev/f425e8f85296
branches: trunk
changeset: 749688:f425e8f85296
user: pooka <pooka%NetBSD.org@localhost>
date: Sat Dec 05 22:34:43 2009 +0000
description:
Convert tsleep(&lbolt) to kpause(). Make ltsleep/mtsleep on lbolt
illegal. I examined all places where lbolt is referenced to make
sure there were pointer aliases of it passed to tsleep, but put a
KASSERT in m/ltsleep() just to be sure.
diffstat:
sys/arch/arm/xscale/pxa2x0_apm.c | 4 ++--
sys/arch/hp300/dev/mt.c | 8 ++++----
sys/dev/gpib/mt.c | 8 ++++----
sys/dev/scsipi/st.c | 8 ++++----
sys/dev/sdmmc/sdmmc_io.c | 6 +++---
sys/kern/kern_synch.c | 6 ++++--
sys/uvm/uvm_fault.c | 8 ++++----
sys/uvm/uvm_loan.c | 10 +++++-----
8 files changed, 30 insertions(+), 28 deletions(-)
diffs (249 lines):
diff -r 80ba190b8939 -r f425e8f85296 sys/arch/arm/xscale/pxa2x0_apm.c
--- a/sys/arch/arm/xscale/pxa2x0_apm.c Sat Dec 05 22:25:51 2009 +0000
+++ b/sys/arch/arm/xscale/pxa2x0_apm.c Sat Dec 05 22:34:43 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pxa2x0_apm.c,v 1.1 2008/12/06 22:10:41 ober Exp $ */
+/* $NetBSD: pxa2x0_apm.c,v 1.2 2009/12/05 22:34:43 pooka Exp $ */
/* $OpenBSD: pxa2x0_apm.c,v 1.28 2007/03/29 18:42:38 uwe Exp $ */
/*-
@@ -443,7 +443,7 @@
apm_battlow = apm_suspends = apm_userstandbys = 0;
APM_UNLOCK(sc);
- tsleep(&lbolt, PWAIT, "apmev", 0);
+ kpause("apmev", false, hz, NULL);
}
}
diff -r 80ba190b8939 -r f425e8f85296 sys/arch/hp300/dev/mt.c
--- a/sys/arch/hp300/dev/mt.c Sat Dec 05 22:25:51 2009 +0000
+++ b/sys/arch/hp300/dev/mt.c Sat Dec 05 22:34:43 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mt.c,v 1.49 2009/05/26 06:38:26 he Exp $ */
+/* $NetBSD: mt.c,v 1.50 2009/12/05 22:34:43 pooka Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.49 2009/05/26 06:38:26 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.50 2009/12/05 22:34:43 pooka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -333,8 +333,8 @@
goto errout;
if (!(sc->sc_flags & MTF_REW))
break;
- if (tsleep((void *) &lbolt, PCATCH | (PZERO + 1),
- "mt", 0) != 0) {
+ error = kpause("mt", true, hz, NULL);
+ if (error != 0 && error != EWOULDBLOCK) {
error = EINTR;
goto errout;
}
diff -r 80ba190b8939 -r f425e8f85296 sys/dev/gpib/mt.c
--- a/sys/dev/gpib/mt.c Sat Dec 05 22:25:51 2009 +0000
+++ b/sys/dev/gpib/mt.c Sat Dec 05 22:34:43 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mt.c,v 1.22 2009/09/12 18:44:36 tsutsui Exp $ */
+/* $NetBSD: mt.c,v 1.23 2009/12/05 22:34:43 pooka Exp $ */
/*-
* Copyright (c) 1996-2003 The NetBSD Foundation, Inc.
@@ -114,7 +114,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.22 2009/09/12 18:44:36 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.23 2009/12/05 22:34:43 pooka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -387,8 +387,8 @@
goto errout;
if (!(sc->sc_flags & MTF_REW))
break;
- if (tsleep((void *) &lbolt, PCATCH | (PZERO + 1),
- "mt", 0) != 0) {
+ error = kpause("mt", true, hz, NULL);
+ if (error != 0 && error != EWOULDBLOCK) {
error = EINTR;
goto errout;
}
diff -r 80ba190b8939 -r f425e8f85296 sys/dev/scsipi/st.c
--- a/sys/dev/scsipi/st.c Sat Dec 05 22:25:51 2009 +0000
+++ b/sys/dev/scsipi/st.c Sat Dec 05 22:34:43 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: st.c,v 1.214 2009/11/23 02:13:47 rmind Exp $ */
+/* $NetBSD: st.c,v 1.215 2009/12/05 22:34:43 pooka Exp $ */
/*-
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.214 2009/11/23 02:13:47 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.215 2009/12/05 22:34:43 pooka Exp $");
#include "opt_scsi.h"
@@ -646,10 +646,10 @@
oflags = periph->periph_flags;
periph->periph_flags |= PERIPH_OPEN;
- slpintr = tsleep(&lbolt, PUSER|PCATCH, "stload", 0);
+ slpintr = kpause("stload", true, hz, NULL);
periph->periph_flags = oflags; /* restore flags */
- if (slpintr) {
+ if (slpintr != 0 && slpintr != EWOULDBLOCK) {
goto bad;
}
}
diff -r 80ba190b8939 -r f425e8f85296 sys/dev/sdmmc/sdmmc_io.c
--- a/sys/dev/sdmmc/sdmmc_io.c Sat Dec 05 22:25:51 2009 +0000
+++ b/sys/dev/sdmmc/sdmmc_io.c Sat Dec 05 22:34:43 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdmmc_io.c,v 1.1 2009/04/21 03:00:30 nonaka Exp $ */
+/* $NetBSD: sdmmc_io.c,v 1.2 2009/12/05 22:34:43 pooka Exp $ */
/* $OpenBSD: sdmmc_io.c,v 1.10 2007/09/17 01:33:33 krw Exp $ */
/*
@@ -20,7 +20,7 @@
/* Routines for SD I/O cards. */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdmmc_io.c,v 1.1 2009/04/21 03:00:30 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc_io.c,v 1.2 2009/12/05 22:34:43 pooka Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -250,7 +250,7 @@
retry = 5;
while (!sdmmc_io_function_ready(sf) && retry-- > 0)
- tsleep(&lbolt, PPAUSE, "pause", 0);
+ kpause("pause", false, hz, NULL);
return (retry >= 0) ? 0 : ETIMEDOUT;
}
diff -r 80ba190b8939 -r f425e8f85296 sys/kern/kern_synch.c
--- a/sys/kern/kern_synch.c Sat Dec 05 22:25:51 2009 +0000
+++ b/sys/kern/kern_synch.c Sat Dec 05 22:34:43 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_synch.c,v 1.271 2009/10/21 21:12:06 rmind Exp $ */
+/* $NetBSD: kern_synch.c,v 1.272 2009/12/05 22:34:43 pooka Exp $ */
/*-
* Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009
@@ -69,7 +69,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.271 2009/10/21 21:12:06 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.272 2009/12/05 22:34:43 pooka Exp $");
#include "opt_kstack.h"
#include "opt_perfctrs.h"
@@ -188,6 +188,7 @@
int error;
KASSERT((l->l_pflag & LP_INTR) == 0);
+ KASSERT(ident != &lbolt);
if (sleepq_dontsleep(l)) {
(void)sleepq_abort(NULL, 0);
@@ -224,6 +225,7 @@
int error;
KASSERT((l->l_pflag & LP_INTR) == 0);
+ KASSERT(ident != &lbolt);
if (sleepq_dontsleep(l)) {
(void)sleepq_abort(mtx, (priority & PNORELOCK) != 0);
diff -r 80ba190b8939 -r f425e8f85296 sys/uvm/uvm_fault.c
--- a/sys/uvm/uvm_fault.c Sat Dec 05 22:25:51 2009 +0000
+++ b/sys/uvm/uvm_fault.c Sat Dec 05 22:34:43 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_fault.c,v 1.127 2009/11/01 11:16:32 uebayasi Exp $ */
+/* $NetBSD: uvm_fault.c,v 1.128 2009/12/05 22:34:43 pooka Exp $ */
/*
*
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.127 2009/11/01 11:16:32 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.128 2009/12/05 22:34:43 pooka Exp $");
#include "opt_uvmhist.h"
@@ -1215,7 +1215,7 @@
goto ReFault;
case EAGAIN:
- tsleep(&lbolt, PVM, "fltagain1", 0);
+ kpause("fltagain1", false, hz/2, NULL);
goto ReFault;
default:
@@ -1515,7 +1515,7 @@
if (error == EAGAIN) {
UVMHIST_LOG(maphist,
" pgo_get says TRY AGAIN!",0,0,0,0);
- tsleep(&lbolt, PVM, "fltagain2", 0);
+ kpause("fltagain2", false, hz/2, NULL);
goto ReFault;
}
diff -r 80ba190b8939 -r f425e8f85296 sys/uvm/uvm_loan.c
--- a/sys/uvm/uvm_loan.c Sat Dec 05 22:25:51 2009 +0000
+++ b/sys/uvm/uvm_loan.c Sat Dec 05 22:34:43 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_loan.c,v 1.73 2008/12/03 14:46:24 pooka Exp $ */
+/* $NetBSD: uvm_loan.c,v 1.74 2009/12/05 22:34:43 pooka Exp $ */
/*
*
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_loan.c,v 1.73 2008/12/03 14:46:24 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_loan.c,v 1.74 2009/12/05 22:34:43 pooka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -403,7 +403,7 @@
/* "try again"? sleep a bit and retry ... */
if (error == EAGAIN) {
- tsleep(&lbolt, PVM, "loanagain", 0);
+ kpause("loanagain", false, hz/2, NULL);
return (0);
}
@@ -535,7 +535,7 @@
pgoff + (ndone << PAGE_SHIFT), pgpp, &npages, 0,
VM_PROT_READ, 0, PGO_SYNCIO);
if (error == EAGAIN) {
- tsleep(&lbolt, PVM, "loanuopg", 0);
+ kpause("loanuopg", false, hz/2, NULL);
continue;
}
if (error)
@@ -675,7 +675,7 @@
if (error) {
if (error == EAGAIN) {
- tsleep(&lbolt, PVM, "fltagain2", 0);
+ kpause("fltagain2", false, hz/2, NULL);
return (0);
}
return (-1);
Home |
Main Index |
Thread Index |
Old Index